bounce sound for grenades
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2072 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -134,6 +134,8 @@ struct physent
|
||||
else if(crouching) return croucheyeheight; // fully crouching
|
||||
return eyeheight; // not crouching
|
||||
}
|
||||
|
||||
virtual void oncollision() {};
|
||||
};
|
||||
|
||||
struct dynent : physent // animated ent
|
||||
@@ -499,5 +501,6 @@ struct grenadeent : bounceent
|
||||
virtual void destroy();
|
||||
virtual bool applyphysics();
|
||||
void moveoutsidebbox(const vec &direction, playerent *boundingbox);
|
||||
void oncollision();
|
||||
};
|
||||
|
||||
|
||||
@@ -385,6 +385,7 @@ void moveplayer(physent *pl, int moveres, bool local, int curtime)
|
||||
}
|
||||
}
|
||||
|
||||
bool collided = false;
|
||||
if(!editfly) loopi(moveres) // discrete steps collision detection & sliding
|
||||
{
|
||||
const float f = 1.0f/moveres;
|
||||
@@ -394,7 +395,8 @@ void moveplayer(physent *pl, int moveres, bool local, int curtime)
|
||||
pl->o.y += f*d.y;
|
||||
pl->o.z += f*d.z;
|
||||
hitplayer = NULL;
|
||||
if(collide(pl, false, drop, rise)) continue;
|
||||
if(collide(pl, false, drop, rise)) continue;
|
||||
else collided = true;
|
||||
if(pl->type==ENT_CAMERA) return;
|
||||
if(pl->type==ENT_PLAYER && hitplayer)
|
||||
{
|
||||
@@ -438,6 +440,8 @@ void moveplayer(physent *pl, int moveres, bool local, int curtime)
|
||||
break;
|
||||
}
|
||||
|
||||
if(collided) pl->oncollision();
|
||||
|
||||
if(pl->type==ENT_CAMERA) return;
|
||||
else if(pl->type!=ENT_BOUNCE)
|
||||
{
|
||||
|
||||
@@ -158,8 +158,8 @@ struct oggstream
|
||||
|
||||
alclearerr();
|
||||
alBufferData(bufid, format, pcm, size, info->rate);
|
||||
return !alerr();
|
||||
}
|
||||
return !alerr();
|
||||
}
|
||||
|
||||
bool update()
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ enum
|
||||
S_FEXPLODE,
|
||||
S_SPLASH1, S_SPLASH2,
|
||||
S_FLAGDROP, S_FLAGPICKUP, S_FLAGRETURN, S_FLAGSCORE,
|
||||
S_GRENADEPULL, S_GRENADETHROW,
|
||||
S_GRENADEPULL, S_GRENADETHROW, S_GRENADEBOUNCE1, S_GRENADEBOUNCE2,
|
||||
S_RAKIMBO, S_GUNCHANGE, S_GIB, S_HEADSHOT,
|
||||
S_CALLVOTE, S_VOTEPASS, S_VOTEFAIL,
|
||||
S_FOOTSTEPS, S_FOOTSTEPSCROUCH,
|
||||
|
||||
@@ -548,7 +548,6 @@ grenadeent::grenadeent (playerent *owner, int millis)
|
||||
bouncetype = BT_NADE;
|
||||
maxspeed = 27.0f;
|
||||
rotspeed = 6.0f;
|
||||
|
||||
}
|
||||
|
||||
void grenadeent::explode()
|
||||
@@ -625,7 +624,7 @@ void grenadeent::moveoutsidebbox(const vec &direction, playerent *boundingbox)
|
||||
|
||||
void grenadeent::destroy() { explode(); }
|
||||
bool grenadeent::applyphysics() { return nadestate==NS_THROWED; }
|
||||
|
||||
void grenadeent::oncollision() { if(nadestate==NS_THROWED) playsound(S_GRENADEBOUNCE1+rnd(2), this, 0, 0); }
|
||||
|
||||
// grenades
|
||||
|
||||
|
||||
Reference in New Issue
Block a user