fixed footstep sound radius bug

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@3883 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
driAn
2008-12-06 13:32:38 +00:00
parent 1f7524b1b3
commit 3ef184e1d8
2 changed files with 13 additions and 3 deletions
+4 -2
View File
@@ -259,7 +259,7 @@ void audiomanager::updateplayerfootsteps(playerent *p)
{
if(!p) return;
const int footstepradius = 10;
const int footstepradius = 20;
static float lastoffset = 0;
// find existing footstep sounds
@@ -406,6 +406,7 @@ soundconfig::soundconfig(sbuffer *b, int vol, int maxuses, bool loop, int audibl
this->maxuses = maxuses;
this->loop = loop;
this->audibleradius = audibleradius;
this->model = audibleradius > 0 ? DM_LINEAR : DM_DEFAULT; // use linear model when radius is configured
uses = 0;
muted = false;
}
@@ -553,7 +554,8 @@ void audiomanager::updateaudio()
if(e.type!=SOUND) continue;
int sound = e.attr1;
bool hearable = e.attr2==0 || camera1->o.dist(o)<e.attr2;
int radius = e.attr2;
bool hearable = (radius==0 || camera1->o.dist(o)<radius);
entityreference entref(&e);
// search existing sound loc
+9 -1
View File
@@ -223,7 +223,15 @@ struct soundconfig
int uses, maxuses; // track uses
bool loop;
bool muted;
int audibleradius; // only play if camera is within the radius
int audibleradius;
enum distancemodel
{
DM_DEFAULT = 0, // use openal distance model
DM_LINEAR // custom linear model (used in conjunction with audibleradius)
};
distancemodel model;
soundconfig(sbuffer *b, int vol, int maxuses, bool loop, int audibleradius);
void onattach();