From 588af5daec6d9508b6cf46335bfc6de72c82331f Mon Sep 17 00:00:00 2001 From: Michael Levin Date: Sat, 3 Oct 2009 11:32:18 +0000 Subject: * Options menu video modes glitch fixed (a backport) * Scores will not be reset to 0 for players whose classes change while the scoreboard is showing * Hive offset fixed so that less of the hive is sunk under the floor * Buildable positioning cap-traces are cached, saving CPU * Buildable cap-traces will not interact with bodies (players and buildables) * For Aliens holding dodge while jumping will result in a weaker jump Marauder walljump changes: * Finds a wall regardless of where player is aiming * No longer uses direction keys to direct walljump (player is using these to hug the wall!) * Will direct jump in player's view direction --- src/cgame/cg_buildable.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'src/cgame/cg_buildable.c') diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c index 3fba12e4..8f4c2e5c 100644 --- a/src/cgame/cg_buildable.c +++ b/src/cgame/cg_buildable.c @@ -622,12 +622,14 @@ static void CG_PositionAndOrientateBuildable( const vec3_t angles, const vec3_t VectorMA( inOrigin, -TRACE_DEPTH, normal, end ); VectorMA( inOrigin, 1.0f, normal, start ); - CG_CapTrace( &tr, start, mins, maxs, end, skipNumber, MASK_PLAYERSOLID ); + CG_CapTrace( &tr, start, mins, maxs, end, skipNumber, + CONTENTS_SOLID | CONTENTS_PLAYERCLIP ); if( tr.fraction == 1.0f ) { //erm we missed completely - try again with a box trace - CG_Trace( &tr, start, mins, maxs, end, skipNumber, MASK_PLAYERSOLID ); + CG_Trace( &tr, start, mins, maxs, end, skipNumber, + CONTENTS_SOLID | CONTENTS_PLAYERCLIP ); } VectorMA( inOrigin, tr.fraction * -TRACE_DEPTH, normal, outOrigin ); @@ -1286,8 +1288,29 @@ void CG_Buildable( centity_t *cent ) BG_FindBBoxForBuildable( es->modelindex, mins, maxs ); if( es->pos.trType == TR_STATIONARY ) - CG_PositionAndOrientateBuildable( angles, ent.origin, surfNormal, es->number, - mins, maxs, ent.axis, ent.origin ); + { + // Positioning a buildable involves potentially up to two traces, and + // seeing as buildables rarely move, we cache the results and recalculate + // only if the buildable moves or changes orientation + if( VectorCompare( cent->buildableCache.cachedOrigin, cent->lerpOrigin ) && + VectorCompare( cent->buildableCache.cachedNormal, surfNormal ) ) + { + VectorCopy( cent->buildableCache.axis[ 0 ], ent.axis[ 0 ] ); + VectorCopy( cent->buildableCache.axis[ 1 ], ent.axis[ 1 ] ); + VectorCopy( cent->buildableCache.axis[ 2 ], ent.axis[ 2 ] ); + } + else + { + CG_PositionAndOrientateBuildable( angles, ent.origin, surfNormal, + es->number, mins, maxs, ent.axis, + ent.origin ); + VectorCopy( ent.axis[ 0 ], cent->buildableCache.axis[ 0 ] ); + VectorCopy( ent.axis[ 1 ], cent->buildableCache.axis[ 1 ] ); + VectorCopy( ent.axis[ 2 ], cent->buildableCache.axis[ 2 ] ); + VectorCopy( cent->lerpOrigin, cent->buildableCache.cachedOrigin ); + VectorCopy( surfNormal, cent->buildableCache.cachedNormal ); + } + } //offset on the Z axis if required VectorMA( ent.origin, BG_FindZOffsetForBuildable( es->modelindex ), surfNormal, ent.origin ); -- cgit