registersound fix, + new "showgrid" variable
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6729 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
+15
-10
@@ -193,10 +193,24 @@ void audiomanager::registermusic(char *name)
|
||||
musics.add(newstring(name));
|
||||
}
|
||||
|
||||
int audiomanager::findsound(char *name, int vol, vector<soundconfig> &sounds)
|
||||
{
|
||||
loopv(sounds)
|
||||
{
|
||||
if(!strcmp(sounds[i].buf->name, name) && (!vol || sounds[i].vol==vol)) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int audiomanager::addsound(char *name, int vol, int maxuses, bool loop, vector<soundconfig> &sounds, bool load, int audibleradius)
|
||||
{
|
||||
if(nosound) return -1;
|
||||
if(!soundvol) return -1;
|
||||
|
||||
// check if the sound was already registered
|
||||
int index = findsound(name, vol, sounds);
|
||||
if(index > -1) return index;
|
||||
|
||||
sbuffer *b = bufferpool.find(name);
|
||||
if(!b)
|
||||
{
|
||||
@@ -211,15 +225,6 @@ int audiomanager::addsound(char *name, int vol, int maxuses, bool loop, vector<s
|
||||
return sounds.length()-1;
|
||||
}
|
||||
|
||||
int audiomanager::findsound(char *name, int vol, vector<soundconfig> &sounds)
|
||||
{
|
||||
loopv(sounds)
|
||||
{
|
||||
if(!strcmp(sounds[i].buf->name, name) && (!vol || sounds[i].vol==vol)) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void audiomanager::preloadmapsound(entity &e)
|
||||
{
|
||||
if(e.type!=SOUND || !mapsounds.inrange(e.attr1)) return;
|
||||
@@ -783,7 +788,7 @@ VARFP(soundvol, 0, 128, 255, audiomgr.setlistenervol(soundvol); );
|
||||
|
||||
COMMANDF(registersound, ARG_4STR, (char *name, char *vol, char *loop, char *audibleradius)
|
||||
{
|
||||
audiomgr.addsound(name, atoi(vol), -1, atoi(loop) != 0, gamesounds, true, atoi(audibleradius));
|
||||
intret(audiomgr.addsound(name, atoi(vol), -1, atoi(loop) != 0, gamesounds, true, atoi(audibleradius)));
|
||||
});
|
||||
|
||||
COMMANDF(mapsound, ARG_2STR, (char *name, char *maxuses)
|
||||
|
||||
Reference in New Issue
Block a user