fixed splash sound flood, refactored audio
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2183 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
+3
-3
@@ -101,13 +101,13 @@ struct physent
|
||||
float radius, eyeheight, aboveeye; // bounding box size
|
||||
bool inwater;
|
||||
bool onfloor, onladder, jumpnext, crouching, trycrouch, cancollide;
|
||||
int lastcrouch;
|
||||
int lastcrouch, lastsplash;
|
||||
char move, strafe;
|
||||
uchar state, type;
|
||||
static const int crouchtime;
|
||||
|
||||
physent() : o(0, 0, 0), deltapos(0, 0, 0), newpos(0, 0, 0), yaw(270), pitch(0), roll(0), pitchvel(0),
|
||||
crouching(false), trycrouch(false), cancollide(true), lastcrouch(0), state(CS_ALIVE)
|
||||
crouching(false), trycrouch(false), cancollide(true), lastcrouch(0), lastsplash(0), state(CS_ALIVE)
|
||||
{
|
||||
reset();
|
||||
}
|
||||
@@ -123,7 +123,7 @@ struct physent
|
||||
{
|
||||
vel.x = vel.y = vel.z = 0;
|
||||
move = strafe = 0;
|
||||
timeinair = 0;
|
||||
timeinair = lastcrouch = lastsplash = 0;
|
||||
onfloor = onladder = inwater = jumpnext = crouching = trycrouch = false;
|
||||
}
|
||||
|
||||
|
||||
+1
-3
@@ -650,9 +650,7 @@ int main(int argc, char **argv)
|
||||
fps = (1000.0f/elapsed+fps*10)/11;
|
||||
frames++;
|
||||
|
||||
extern void updatevol(); updatevol();
|
||||
checkmapsounds();
|
||||
checkplayerloopsounds();
|
||||
updateaudio();
|
||||
|
||||
computeraytable(camera1->o.x, camera1->o.y, dynfov());
|
||||
if(frames>3)
|
||||
|
||||
@@ -476,7 +476,11 @@ void moveplayer(physent *pl, int moveres, bool local, int curtime)
|
||||
// play sounds on water transitions
|
||||
if(!pl->inwater && water)
|
||||
{
|
||||
playsound(S_SPLASH2, NULL, NULL, &pl->o);
|
||||
if(!pl->lastsplash || lastmillis-pl->lastsplash>500)
|
||||
{
|
||||
playsound(S_SPLASH2, NULL, NULL, pl==player1 ? NULL : &pl->o);
|
||||
pl->lastsplash = lastmillis;
|
||||
}
|
||||
if(pl==player1) pl->vel.z = 0;
|
||||
}
|
||||
else if(pl->inwater && !water) playsound(S_SPLASH1, NULL, NULL, &pl->o);
|
||||
|
||||
@@ -502,6 +502,7 @@ extern void musicsuggest(int id, int millis = 0, bool rndofs = false);
|
||||
extern void musicfadeout(int id);
|
||||
extern void clearsounds();
|
||||
extern void detachsounds(playerent *owner);
|
||||
extern void updateaudio();
|
||||
|
||||
// rendermodel
|
||||
extern void rendermodel(const char *mdl, int anim, int tex, float rad, const vec &o, float yaw, float pitch, float speed = 0, int basetime = 0, playerent *d = NULL, modelattach *a = NULL, float scale = 1.0f);
|
||||
|
||||
+765
-405
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user