From 61000eb1346fd78b079f7aa89161bc58b387bcdc Mon Sep 17 00:00:00 2001 From: /dev/humancontroller Date: Sun, 13 Jul 2014 16:29:29 +0200 Subject: do not treat a clipmask of 0 as MASK_DEADSOLID in some cases remove the clipmask == 0 special cases from G_TestEntityPosition() and G_Physics(). when spawning corpses, set their clipmask to MASK_DEADSOLID instead of 0. --- src/game/g_client.c | 1 + src/game/g_mover.c | 10 ++-------- src/game/g_physics.c | 13 ++++--------- 3 files changed, 7 insertions(+), 17 deletions(-) (limited to 'src/game') diff --git a/src/game/g_client.c b/src/game/g_client.c index 50a236c3..b4d4e1b3 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -470,6 +470,7 @@ static void SpawnCorpse( gentity_t *ent ) body->timestamp = level.time; body->s.event = 0; body->r.contents = CONTENTS_CORPSE; + body->clipmask = MASK_DEADSOLID; body->s.clientNum = ent->client->ps.stats[ STAT_CLASS ]; body->nonSegModel = ent->client->ps.persistant[ PERS_STATE ] & PS_NONSEGMODEL; diff --git a/src/game/g_mover.c b/src/game/g_mover.c index cedb47fc..a0df546b 100644 --- a/src/game/g_mover.c +++ b/src/game/g_mover.c @@ -55,17 +55,11 @@ G_TestEntityPosition gentity_t *G_TestEntityPosition( gentity_t *ent ) { trace_t tr; - int mask; - - if( ent->clipmask ) - mask = ent->clipmask; - else - mask = MASK_SOLID; if( ent->client ) - trap_Trace( &tr, ent->client->ps.origin, ent->r.mins, ent->r.maxs, ent->client->ps.origin, ent->s.number, mask ); + trap_Trace( &tr, ent->client->ps.origin, ent->r.mins, ent->r.maxs, ent->client->ps.origin, ent->s.number, ent->clipmask ); else - trap_Trace( &tr, ent->s.pos.trBase, ent->r.mins, ent->r.maxs, ent->s.pos.trBase, ent->s.number, mask ); + trap_Trace( &tr, ent->s.pos.trBase, ent->r.mins, ent->r.maxs, ent->s.pos.trBase, ent->s.number, ent->clipmask ); if( tr.startsolid ) return &g_entities[ tr.entityNum ]; diff --git a/src/game/g_physics.c b/src/game/g_physics.c index 753bd605..52669bd8 100644 --- a/src/game/g_physics.c +++ b/src/game/g_physics.c @@ -87,7 +87,6 @@ void G_Physics( gentity_t *ent, int msec ) vec3_t origin; trace_t tr; int contents; - int mask; // if groundentity has been set to -1, it may have been pushed off an edge if( ent->s.groundEntityNum == -1 ) @@ -107,12 +106,6 @@ void G_Physics( gentity_t *ent, int msec ) } } - // trace a line from the previous position to the current position - if( ent->clipmask ) - mask = ent->clipmask; - else - mask = MASK_DEADSOLID; - if( ent->s.pos.trType == TR_STATIONARY ) { // check think function @@ -125,7 +118,7 @@ void G_Physics( gentity_t *ent, int msec ) VectorMA( origin, -2.0f, ent->s.origin2, origin ); - trap_Trace( &tr, ent->r.currentOrigin, ent->r.mins, ent->r.maxs, origin, ent->s.number, mask ); + trap_Trace( &tr, ent->r.currentOrigin, ent->r.mins, ent->r.maxs, origin, ent->s.number, ent->clipmask ); if( tr.fraction == 1.0f ) ent->s.groundEntityNum = -1; @@ -136,10 +129,12 @@ void G_Physics( gentity_t *ent, int msec ) return; } + // trace a line from the previous position to the current position + // get current position BG_EvaluateTrajectory( &ent->s.pos, level.time, origin ); - trap_Trace( &tr, ent->r.currentOrigin, ent->r.mins, ent->r.maxs, origin, ent->s.number, mask ); + trap_Trace( &tr, ent->r.currentOrigin, ent->r.mins, ent->r.maxs, origin, ent->s.number, ent->clipmask ); VectorCopy( tr.endpos, ent->r.currentOrigin ); -- cgit