From e0c2c29994f62d8f5c6ce214f71c356a8cf50b64 Mon Sep 17 00:00:00 2001 From: driAn Date: Sat, 16 Aug 2008 09:11:27 +0000 Subject: [PATCH] stuck-test on flagdrop git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2329 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/entities.cpp | 6 +++++- source/src/entity.h | 6 +++--- source/src/physics.cpp | 3 ++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/source/src/entities.cpp b/source/src/entities.cpp index 4bfe827b..45a49057 100644 --- a/source/src/entities.cpp +++ b/source/src/entities.cpp @@ -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; diff --git a/source/src/entity.h b/source/src/entity.h index 3e58740c..8245e13e 100644 --- a/source/src/entity.h +++ b/source/src/entity.h @@ -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() diff --git a/source/src/physics.cpp b/source/src/physics.cpp index 0f4a0f3a..95d2ad76 100644 --- a/source/src/physics.cpp +++ b/source/src/physics.cpp @@ -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));