summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2020-04-13 00:40:49 +0200
committerPaweł Redman <pawel.redman@gmail.com>2020-04-13 00:40:49 +0200
commit651dc71f5d27c3f86efce012fdac5b2d31ed34c7 (patch)
tree6ecc4acd6346157b152a96f374af5903bc156136 /src/game
parent5f4058b373ebbeffed60437354efb820260473d0 (diff)
Fix wallwalking on some ceilings
Diffstat (limited to 'src/game')
-rw-r--r--src/game/bg_pmove.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c
index 542b585..9225cbe 100644
--- a/src/game/bg_pmove.c
+++ b/src/game/bg_pmove.c
@@ -1723,6 +1723,7 @@ static void PM_GroundClimbTrace( void )
int rTtANGrTsTt;
float ldDOTtCs, d;
vec3_t abc;
+ vec3_t normalDelta;
//TA: If we're on the ceiling then grapplePoint is a rotation normal.. otherwise its a surface normal.
// would have been nice if Carmack had left a few random variables in the ps struct for mod makers
@@ -1804,6 +1805,15 @@ static void PM_GroundClimbTrace( void )
if( trace.fraction < 1.0f && !( trace.surfaceFlags & ( SURF_SKY | SURF_SLICK ) ) &&
!( trace.entityNum != ENTITYNUM_WORLD && i != 4 ) )
{
+ // enneract: Not all ceilings are perfectly flat. Some patch meshes might
+ // end up with normals *very* close to ceilingNormal and this messes up
+ // the code pretty hard. "Straighten" the normal if it's the case.
+ VectorSubtract( trace.plane.normal, ceilingNormal, normalDelta );
+ if( VectorLength( normalDelta ) < 1e-6f )
+ {
+ VectorCopy( ceilingNormal, trace.plane.normal );
+ }
+
if( i == 2 || i == 3 )
{
if( i == 2 )