From ffd6a8dd077d737f34f4f8d52a558d3e412a3eb2 Mon Sep 17 00:00:00 2001 From: driAn Date: Sat, 27 Sep 2008 12:59:15 +0000 Subject: [PATCH] fixed mapmodels physics (shoot through) git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2776 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/physics.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/src/physics.cpp b/source/src/physics.cpp index 80eaf984..083c491a 100644 --- a/source/src/physics.cpp +++ b/source/src/physics.cpp @@ -109,7 +109,7 @@ bool cornertest(int mip, int x, int y, int dx, int dy, int &bx, int &by, int &bs void mmcollide(physent *d, float &hi, float &lo) // collide with a mapmodel { - float eyeheight = d->dyneyeheight(); + const float eyeheight = d->dyneyeheight(); loopv(ents) { entity &e = ents[i]; @@ -120,7 +120,7 @@ void mmcollide(physent *d, float &hi, float &lo) // collide with a map if(fabs(e.x-d->o.x)o.y)floor+mmi.zoff+e.attr3); - const float dz = d->o.z+(-eyeheight+d->aboveeye)/2.0f; + const float dz = d->o.z-eyeheight; if(dzlo) lo = mmz+mmi.h; } @@ -156,6 +156,7 @@ bool collide(physent *d, bool spawn, float drop, float rise) const int y2 = int(fy2); float hi = 127, lo = -128; const float eyeheight = d->dyneyeheight(); + const float playerheight = eyeheight + d->aboveeye; for(int x = x1; x<=x2; x++) for(int y = y1; y<=y2; y++) // collide with map { @@ -191,7 +192,7 @@ bool collide(physent *d, bool spawn, float drop, float rise) if(floor>lo) lo = floor; } - if(hi-lo < eyeheight + d->aboveeye) return false; + if(hi-lo < playerheight) return false; float headspace = 10; loopv(players) // collide with other players @@ -206,6 +207,8 @@ bool collide(physent *d, bool spawn, float drop, float rise) headspace -= 0.01f; mmcollide(d, hi, lo); // collide with map models + if(hi-lo < playerheight) return false; + if(spawn) { d->o.z = lo+eyeheight; // just drop to floor (sideeffect)