stuck-test on flagdrop

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2329 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
driAn
2008-08-16 09:11:27 +00:00
parent 0e635ece6b
commit e0c2c29994
3 changed files with 10 additions and 5 deletions
+5 -1
View File
@@ -331,7 +331,11 @@ void flagdropped(int flag, int action, short x, short y, short z)
p.o.y = y;
p.o.z = z;
p.vel.z = -0.8f;
loopi(20) moveplayer(&p, 10, true, 50); // calc drop position
loopi(100)
{
moveplayer(&p, 10, true, 50); // calc drop position
if(p.stuck) break;
}
f.flag->x = (short)p.o.x;
f.flag->y = (short)p.o.y;
f.flag->z = (short)p.o.z;
+3 -3
View File
@@ -100,14 +100,14 @@ struct physent
int timeinair; // used for fake gravity
float radius, eyeheight, aboveeye; // bounding box size
bool inwater;
bool onfloor, onladder, jumpnext, crouching, trycrouch, cancollide;
bool onfloor, onladder, jumpnext, crouching, trycrouch, cancollide, stuck;
int lastcrouch, lastsplash;
char move, strafe;
uchar state, type;
static const int crouchtime;
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), lastcrouch(0), lastsplash(0), state(CS_ALIVE)
crouching(false), trycrouch(false), cancollide(true), stuck(false), lastcrouch(0), lastsplash(0), state(CS_ALIVE)
{
reset();
}
@@ -124,7 +124,7 @@ struct physent
vel.x = vel.y = vel.z = 0;
move = strafe = 0;
timeinair = lastcrouch = lastsplash = 0;
onfloor = onladder = inwater = jumpnext = crouching = trycrouch = false;
onfloor = onladder = inwater = jumpnext = crouching = trycrouch = stuck = false;
}
virtual float dyneyeheight()
+2 -1
View File
@@ -443,7 +443,8 @@ void moveplayer(physent *pl, int moveres, bool local, int curtime)
if(pl->type==ENT_BOUNCE) { pl->vel.z = -pl->vel.z; pl->vel.mul(0.5f); }
break;
}
pl->stuck = (oldorigin==pl->o);
if(collided) pl->oncollision();
else pl->onmoved(oldorigin.sub(pl->o));