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:
Lucas GAUTHERON
2011-12-10 18:03:04 +00:00
parent 3746c0a430
commit 37efdcdb3e
2 changed files with 47 additions and 38 deletions
+15 -10
View File
@@ -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)