.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Cyborg Factory > POD-Bot mm > Releases, Installers, Docs & Coding
Releases, Installers, Docs & Coding Where the official development happens

Reply
 
Thread Tools
bot_sounds.cpp
Old
  (#1)
Huntkillaz
Member
 
Huntkillaz's Avatar
 
Status: Offline
Posts: 594
Join Date: Mar 2004
Location: Middle Earth (New Zealand)
Default bot_sounds.cpp - 30-05-2004

there's 3 distinctive lines that's being used over n over

i was wondering if u put it into a method that gets called instead

it would be neater code.. but will it slow\use more resources (ie memory\cpu)?


●_•
  
Reply With Quote
Re: bot_sounds.cpp
Old
  (#2)
sPlOrYgOn
<-- He did it.
 
sPlOrYgOn's Avatar
 
Status: Offline
Posts: 1,558
Join Date: Jan 2004
Location: Los Angeles, California, USA, North America, Earth, Solar System, Milky Way.
Default Re: bot_sounds.cpp - 30-05-2004

yea but i think for 2 different if's it won't be called..
so i think he was trying to save cpu usage at the expense of the dll's size.
  
Reply With Quote
Re: bot_sounds.cpp
Old
  (#3)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: bot_sounds.cpp - 30-05-2004

...or he was just lazy and did a lot of CTRL-C CTRL-V



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: bot_sounds.cpp
Old
  (#4)
Huntkillaz
Member
 
Huntkillaz's Avatar
 
Status: Offline
Posts: 594
Join Date: Mar 2004
Location: Middle Earth (New Zealand)
Default Re: bot_sounds.cpp - 31-05-2004

so the bot_sounds.cpp can be reduced file size alot by adding a method similar to this:

Code:
  void SoundMethod(boolean a,float b, float c, boolean d)
   {
   	  if(a){
   		  if ((iIndex < 0) || (iIndex >= gpGlobals->maxClients))
 			 iIndex = UTIL_GetNearestPlayerIndex (VecBModelOrigin (pEdict));
   	  }
   		 clients[iIndex].fHearingDistance = b * fVolume;
   		 clients[iIndex].fTimeSoundLasting = gpGlobals->time + c;
   		if(d)
 			 clients[iIndex].vecSoundPosition = pEdict->v.origin;
   		  else
   			  clients[iIndex].vecSoundPosition = vecPosition;
   }
and having 1 method call at each place instead of 3-5 lines?

but will it be efficient??


●_•

Last edited by Huntkillaz; 31-05-2004 at 06:12..
  
Reply With Quote
Re: bot_sounds.cpp
Old
  (#5)
sPlOrYgOn
<-- He did it.
 
sPlOrYgOn's Avatar
 
Status: Offline
Posts: 1,558
Join Date: Jan 2004
Location: Los Angeles, California, USA, North America, Earth, Solar System, Milky Way.
Default Re: bot_sounds.cpp - 31-05-2004

actually it'll be very very very slightly less efficient but it'll save space in the dll...
at least thats what i think it'll do..

btw...
more descriptive names...
and I don't see iIndex or fVolume or pEdict or vecPosition defined anywhere in that scope...
  
Reply With Quote
Re: bot_sounds.cpp
Old
  (#6)
Huntkillaz
Member
 
Huntkillaz's Avatar
 
Status: Offline
Posts: 594
Join Date: Mar 2004
Location: Middle Earth (New Zealand)
Default Re: bot_sounds.cpp - 31-05-2004

Quote:
Originally Posted by sPlOrYgOn
actually it'll be very very very slightly less efficient but it'll save space in the dll...
at least thats what i think it'll do..

btw...
more descriptive names...
and I don't see iIndex or fVolume or pEdict or vecPosition defined anywhere in that scope...
scope as in the paramaters of the method??...lol i wrote what the code would look like ..not the actual code :o... still learning whats whato_O


●_•
  
Reply With Quote
Re: bot_sounds.cpp
Old
  (#7)
sPlOrYgOn
<-- He did it.
 
sPlOrYgOn's Avatar
 
Status: Offline
Posts: 1,558
Join Date: Jan 2004
Location: Los Angeles, California, USA, North America, Earth, Solar System, Milky Way.
Default Re: bot_sounds.cpp - 31-05-2004

hmm
I dunno of any way to teach you what a scope is but to show you...
Code:
#include <iostream>
using namespace std;

namespace blue
{
   int x = 3;
}

int x = 2;

int main ()
{
   int x = 0;
   {
      int x = 1;
      cout << "This is the value of x: " << x << endl;
      cout << "No.. this is.... " << blue::x << endl;
      cout << "Geez idiots this is.. " << ::x << endl;
   }
   cout << "You're all wrong.. this is.. " << x << endl;
   return (0);
}
well thats a little scope thingy...
  
Reply With Quote
Re: bot_sounds.cpp
Old
  (#8)
Huntkillaz
Member
 
Huntkillaz's Avatar
 
Status: Offline
Posts: 594
Join Date: Mar 2004
Location: Middle Earth (New Zealand)
Default Re: bot_sounds.cpp - 01-06-2004

ahhhh...u mean class.......sorry as i said i've only learnt a little java...and c\c++ is like going to lower langs..

basically this is a method thats within the bot_sounds.cpp if u have a look u'll see that these 5 lines are often used...so to save space one can replace the 3-5 lines with just 1 method call...

i'll try do it and put it up....


●_•
  
Reply With Quote
Re: bot_sounds.cpp
Old
  (#9)
sPlOrYgOn
<-- He did it.
 
sPlOrYgOn's Avatar
 
Status: Offline
Posts: 1,558
Join Date: Jan 2004
Location: Los Angeles, California, USA, North America, Earth, Solar System, Milky Way.
Default Re: bot_sounds.cpp - 01-06-2004

I say we go and add more hearable sounds...
it seems to be like it's missing some useful sounds..
  
Reply With Quote
Re: bot_sounds.cpp
Old
  (#10)
Huntkillaz
Member
 
Huntkillaz's Avatar
 
Status: Offline
Posts: 594
Join Date: Mar 2004
Location: Middle Earth (New Zealand)
Default Re: bot_sounds.cpp - 05-06-2004

yep ur right ..knife hit's and stabs aint there... world spawn...

what other's do we need?


●_•
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com