crouch works even if activated in mid-air

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1874 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
driAn
2008-05-04 19:19:37 +00:00
parent baf257139b
commit 1bcc770305
2 changed files with 8 additions and 9 deletions
+4 -5
View File
@@ -292,6 +292,9 @@ void moveplayer(physent *pl, int moveres, bool local, int curtime)
int move = pl->onladder && !pl->onfloor && pl->move == -1 ? 0 : pl->move; // movement on ladder
water = hdr.waterlevel>pl->o.z-0.5f;
// test local crouch
if(pl == player1 && !(intermission || player1->onladder || (pl->trycrouch && !player1->onfloor && player1->timeinair > 50))) updatecrouch(player1, player1->trycrouch);
const float speed = curtime/(water ? 2000.0f : 1000.0f)*pl->maxspeed*(pl->crouching ? 0.5f : 1.0f);
const float friction = water ? 20.0f : (pl->onfloor || editfly || specfly ? 6.0f : (pl->onladder ? 1.5f : 30.0f));
const float fpsfric = friction/curtime*20.0f;
@@ -533,11 +536,7 @@ void updatecrouch(playerent *p, bool on)
else p->lastcrouch = lastmillis-(physent::crouchtime-progress); // only change direction, fix progress time
}
void crouch(bool on)
{
if(intermission || player1->onladder || (on && !player1->onfloor && player1->timeinair > 50)) return;
updatecrouch(player1, on);
}
void crouch(bool on) { player1->trycrouch = on; }
COMMAND(backward, ARG_DOWN);
COMMAND(forward, ARG_DOWN);