distance restricted grendade bounce sound

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2133 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
driAn
2008-05-31 12:22:56 +00:00
parent 2bb0b7f118
commit a5c49a70e3
3 changed files with 14 additions and 7 deletions
+8 -6
View File
@@ -553,7 +553,7 @@ grenadeent::grenadeent (playerent *owner, int millis)
bouncetype = BT_NADE;
maxspeed = 30.0f;
rotspeed = 6.0f;
lastcollision = 0;
distsincebounce = 0.0f;
}
void grenadeent::explode()
@@ -633,11 +633,13 @@ bool grenadeent::applyphysics() { return nadestate==NS_THROWED; }
void grenadeent::oncollision()
{
if(nadestate==NS_THROWED && (!lastcollision || lastmillis-lastcollision>50))
{
playsound(S_GRENADEBOUNCE1+rnd(2), 0, 0, &o);
lastcollision = lastmillis;
}
if(distsincebounce>=1.5f) playsound(S_GRENADEBOUNCE1+rnd(2), 0, 0, &o);
distsincebounce = 0.0f;
}
void grenadeent::onmoved(const vec &dist)
{
distsincebounce += dist.magnitude();
}
// grenades