From cdb8781108f8a7665f9b0bbd990e51b5e86449b1 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Sun, 21 Dec 2003 03:46:43 +0000 Subject: * Added a means of overriding class and buildable media settings via cfg file * View locking works again * Trapper projectile is displayed properly --- src/cgame/cg_buildable.c | 6 ++++++ src/cgame/cg_main.c | 4 ++++ src/cgame/cg_players.c | 21 +++++++++++++-------- 3 files changed, 23 insertions(+), 8 deletions(-) (limited to 'src/cgame') diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c index 51176488..2715529e 100644 --- a/src/cgame/cg_buildable.c +++ b/src/cgame/cg_buildable.c @@ -730,6 +730,9 @@ void CG_GhostBuildable( buildable_t buildable ) CG_CapTrace( &tr, start, mins, maxs, end, ps->clientNum, MASK_PLAYERSOLID ); VectorMA( entity_origin, tr.fraction * -TRACE_DEPTH, tr.plane.normal, ent.origin ); + //offset on the Z axis if required + VectorMA( ent.origin, BG_FindZOffsetForBuildable( buildable ), tr.plane.normal, ent.origin ); + VectorCopy( ent.origin, ent.lightingOrigin ); VectorCopy( ent.origin, ent.oldorigin ); // don't positionally lerp at all @@ -942,6 +945,9 @@ void CG_Buildable( centity_t *cent ) VectorMA( ent.origin, tr.fraction * -TRACE_DEPTH, surfNormal, ent.origin ); } + //offset on the Z axis if required + VectorMA( ent.origin, BG_FindZOffsetForBuildable( es->modelindex ), surfNormal, ent.origin ); + VectorCopy( ent.origin, ent.oldorigin ); // don't positionally lerp at all VectorCopy( ent.origin, ent.lightingOrigin ); diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 53cecc20..249b86c9 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -1666,6 +1666,10 @@ void CG_Init( int serverMessageNum, int serverCommandSequence, int clientNum ) //inform UI to repress cursor whilst loading trap_Cvar_Set( "ui_loading", "1" ); + //TA: load overrides + BG_InitClassOverrides( ); + BG_InitBuildableOverrides( ); + //TA: dyn memory CG_InitMemory( ); diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c index 22db91e1..9dd06cd7 100644 --- a/src/cgame/cg_players.c +++ b/src/cgame/cg_players.c @@ -1564,7 +1564,7 @@ Returns the Z component of the surface being shadowed =============== */ #define SHADOW_DISTANCE 128 -static qboolean CG_PlayerShadow( centity_t *cent, float *shadowPlane ) +static qboolean CG_PlayerShadow( centity_t *cent, float *shadowPlane, pClass_t class ) { vec3_t end, mins = { -15, -15, 0 }, maxs = { 15, 15, 2 }; trace_t trace; @@ -1596,7 +1596,8 @@ static qboolean CG_PlayerShadow( centity_t *cent, float *shadowPlane ) // add the mark as a temporary, so it goes directly to the renderer // without taking a spot in the cg_marks array CG_ImpactMark( cgs.media.shadowMarkShader, trace.endpos, trace.plane.normal, - cent->pe.legs.yawAngle, alpha,alpha,alpha,1, qfalse, 24, qtrue ); + cent->pe.legs.yawAngle, alpha,alpha,alpha,1, qfalse, + 24 * BG_FindShadowScaleForClass( class ), qtrue ); return qtrue; } @@ -1836,12 +1837,13 @@ void CG_Player( centity_t *cent ) qboolean shadow; float shadowPlane; entityState_t *es = ¢->currentState; - int class = ( es->powerups >> 8 ) & 0xFF; + pClass_t class = ( es->powerups >> 8 ) & 0xFF; float scale; vec3_t tempAxis[ 3 ], tempAxis2[ 3 ]; vec3_t angles; int held = es->modelindex; pTeam_t team = es->powerups & 0xFF; + vec3_t surfNormal = { 0.0f, 0.0f, 1.0f }; // the client number is stored in clientNum. It can't be derived // from the entity number, because a single client may have @@ -1911,9 +1913,7 @@ void CG_Player( centity_t *cent ) CG_PlayerSprites( cent ); // add the shadow - //TA: but only for humans FIXME this is dumb - /*if( team == PTE_HUMANS )*/ - shadow = CG_PlayerShadow( cent, &shadowPlane ); + shadow = CG_PlayerShadow( cent, &shadowPlane, class ); // add a water splash if partially in and out of water CG_PlayerSplash( cent ); @@ -1951,7 +1951,7 @@ void CG_Player( centity_t *cent ) //move the origin closer into the wall with a CapTrace if( es->eFlags & EF_WALLCLIMB && !( es->eFlags & EF_DEAD ) && !( cg.intermissionStarted ) ) { - vec3_t surfNormal, start, end, mins, maxs; + vec3_t start, end, mins, maxs; trace_t tr; if( es->eFlags & EF_WALLCLIMBCEILING ) @@ -1982,6 +1982,11 @@ void CG_Player( centity_t *cent ) legs.nonNormalizedAxes = qtrue; } + //offset on the Z axis if required + VectorMA( legs.origin, BG_FindZOffsetForClass( class ), surfNormal, legs.origin ); + VectorCopy( legs.origin, legs.lightingOrigin ); + VectorCopy( legs.origin, legs.oldorigin ); // don't positionally lerp at all + trap_R_AddRefEntityToScene( &legs ); // if the model failed, allow the default nullmodel to be displayed @@ -2121,7 +2126,7 @@ void CG_Corpse( centity_t *cent ) } // add the shadow - shadow = CG_PlayerShadow( cent, &shadowPlane ); + shadow = CG_PlayerShadow( cent, &shadowPlane, es->clientNum ); // get the player model information renderfx = 0; -- cgit