git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@4951 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Rafael Barreto
2010-05-20 19:41:26 +00:00
parent f5c80de15e
commit 91677d98e9
2 changed files with 8 additions and 5 deletions
+3 -3
View File
@@ -101,7 +101,7 @@ public:
int timeinair; // used for fake gravity
float radius, eyeheight, maxeyeheight, aboveeye; // bounding box size
bool inwater;
bool onfloor, onladder, jumpnext, crouching, trycrouch, cancollide, stuck;
bool onfloor, onladder, jumpnext, crouching, crouchedinair, trycrouch, cancollide, stuck;
int lastjump;
int lastsplash;
char move, strafe;
@@ -109,7 +109,7 @@ public:
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), lastjump(0), lastsplash(0), state(CS_ALIVE)
crouching(false), crouchedinair(false), trycrouch(false), cancollide(true), stuck(false), lastjump(0), lastsplash(0), state(CS_ALIVE)
{
reset();
}
@@ -127,7 +127,7 @@ public:
vel.x = vel.y = vel.z = eyeheightvel = 0.0f;
move = strafe = 0;
timeinair = lastjump = lastsplash = 0;
onfloor = onladder = inwater = jumpnext = crouching = trycrouch = stuck = false;
onfloor = onladder = inwater = jumpnext = crouching = crouchedinair = trycrouch = stuck = false;
}
virtual void oncollision() {}
+5 -2
View File
@@ -444,12 +444,15 @@ void moveplayer(physent *pl, int moveres, bool local, int curtime)
pl->lastjump = lastmillis;
}
pl->timeinair = 0;
pl->crouchedinair = false;
}
else
{
pl->timeinair += curtime;
if (pl->trycrouch && !pl->crouching) pl->vel.z += 0.8f;
if (!pl->trycrouch && pl->crouching) pl->vel.z -= 0.8f;
if (pl->trycrouch && !pl->crouching && !pl->crouchedinair) {
pl->vel.z += 0.6f;
pl->crouchedinair = true;
}
}
}