test: straferun doublejump
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@3884 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
+3
-2
@@ -101,13 +101,14 @@ struct physent
|
||||
float radius, eyeheight, maxeyeheight, aboveeye; // bounding box size
|
||||
bool inwater;
|
||||
bool onfloor, onladder, jumpnext, crouching, trycrouch, cancollide, stuck;
|
||||
int lastjump;
|
||||
int lastsplash;
|
||||
char move, strafe;
|
||||
uchar state, type;
|
||||
float eyeheightvel;
|
||||
|
||||
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), stuck(false), lastsplash(0), state(CS_ALIVE)
|
||||
crouching(false), trycrouch(false), cancollide(true), stuck(false), lastjump(0), lastsplash(0), state(CS_ALIVE)
|
||||
{
|
||||
reset();
|
||||
}
|
||||
@@ -124,7 +125,7 @@ struct physent
|
||||
{
|
||||
vel.x = vel.y = vel.z = eyeheightvel = 0.0f;
|
||||
move = strafe = 0;
|
||||
timeinair = lastsplash = 0;
|
||||
timeinair = lastjump = lastsplash = 0;
|
||||
onfloor = onladder = inwater = jumpnext = crouching = trycrouch = stuck = false;
|
||||
}
|
||||
|
||||
|
||||
+12
-2
@@ -427,9 +427,19 @@ void moveplayer(physent *pl, int moveres, bool local, int curtime)
|
||||
if(pl->jumpnext)
|
||||
{
|
||||
pl->jumpnext = false;
|
||||
pl->vel.z = 2.0f; // physics impulse upwards
|
||||
if(water) { pl->vel.x /= 8; pl->vel.y /= 8; } // dampen velocity change even harder, gives correct water feel
|
||||
pl->vel.z = 2.0f; // physics impulse upwards
|
||||
bool doublejump = pl->lastjump && lastmillis-pl->lastjump < 250 && pl->strafe != 0;
|
||||
if(doublejump) // more velocity on double jump
|
||||
{
|
||||
pl->vel.mul(1.25f);
|
||||
}
|
||||
if(water) // dampen velocity change even harder, gives correct water feel
|
||||
{
|
||||
pl->vel.x /= 8.0f;
|
||||
pl->vel.y /= 8.0f;
|
||||
}
|
||||
else if(pl==player1 || pl->type!=ENT_PLAYER) audiomgr.playsoundc(S_JUMP, pl);
|
||||
pl->lastjump = lastmillis;
|
||||
}
|
||||
pl->timeinair = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user