diff options
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_draw.c | 13 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 1 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 1 | ||||
-rw-r--r-- | src/cgame/cg_predict.c | 12 | ||||
-rw-r--r-- | src/cgame/cg_view.c | 6 |
5 files changed, 18 insertions, 15 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 82df413a..ef15b798 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -798,10 +798,7 @@ CG_DrawPlayerBoosted */ static void CG_DrawPlayerBoosted( rectDef_t *rect, vec4_t color, qhandle_t shader ) { - playerState_t *ps = &cg.snap->ps; - qboolean boosted = ps->stats[ STAT_STATE ] & SS_BOOSTED; - - if( boosted ) + if( cg.boostedTime >= 0 ) color[ 3 ] = AH_MAX_ALPHA; else color[ 3 ] = AH_MIN_ALPHA; @@ -818,17 +815,15 @@ CG_DrawPlayerBoosterBolt */ static void CG_DrawPlayerBoosterBolt( rectDef_t *rect, vec4_t color, qhandle_t shader ) { - playerState_t *ps = &cg.snap->ps; - qboolean boosted = ps->stats[ STAT_STATE ] & SS_BOOSTED; vec4_t localColor; Vector4Copy( color, localColor ); - if( boosted ) + if( cg.boostedTime >= 0 ) { - if( ps->stats[ STAT_BOOSTTIME ] > BOOST_TIME - 3000 ) + if( ( cg.time - cg.boostedTime ) > BOOST_TIME - 3000 ) { - qboolean flash = ( ps->stats[ STAT_BOOSTTIME ] / 500 ) % 2; + qboolean flash = ( cg.time / 500 ) % 2; if( flash ) localColor[ 3 ] = 1.0f; diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 05cbcbdf..38ee43e9 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1107,6 +1107,7 @@ typedef struct qboolean weapon2Firing; qboolean weapon3Firing; + int boostedTime; int poisonedTime; vec3_t lastNormal; //TA: view smoothage diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 1797b972..eab3d0f2 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -1757,6 +1757,7 @@ void CG_Init( int serverMessageNum, int serverCommandSequence, int clientNum ) CG_LoadHudMenu( ); // load new hud stuff cg.weaponSelect = WP_NONE; + cg.boostedTime = -1; // old servers diff --git a/src/cgame/cg_predict.c b/src/cgame/cg_predict.c index 34f00c4f..e34fe8df 100644 --- a/src/cgame/cg_predict.c +++ b/src/cgame/cg_predict.c @@ -476,13 +476,13 @@ static int CG_IsUnacceptableError( playerState_t *ps, playerState_t *pps ) if( fabs( AngleDelta( ps->viewangles[ 0 ], pps->viewangles[ 0 ] ) ) > 1.0f || fabs( AngleDelta( ps->viewangles[ 1 ], pps->viewangles[ 1 ] ) ) > 1.0f || - fabs( AngleDelta( ps->viewangles[ 2 ], pps->viewangles[ 2 ] ) ) > 1.0f ) + fabs( AngleDelta( ps->viewangles[ 2 ], pps->viewangles[ 2 ] ) ) > 1.0f ) { return 12; } if( pps->viewheight != ps->viewheight ) - return 13; + return 13; if( pps->damageEvent != ps->damageEvent || pps->damageYaw != ps->damageYaw || @@ -699,22 +699,22 @@ void CG_PredictPlayerState( void ) // make sure the state differences are acceptable errorcode = CG_IsUnacceptableError( &cg.predictedPlayerState, &cg.savedPmoveStates[ i ] ); - + if( errorcode ) { if( cg_showmiss.integer ) CG_Printf("errorcode %d at %d\n", errorcode, cg.time); break; } - + // this one is almost exact, so we'll copy it in as the starting point *cg_pmove.ps = cg.savedPmoveStates[ i ]; // advance the head cg.stateHead = ( i + 1 ) % NUM_SAVED_STATES; - + // set the next command to predict predictCmd = cg.lastPredictedCommand + 1; - + // a saved state matched, so flag it error = qfalse; break; diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c index 477196c5..dfd9e34b 100644 --- a/src/cgame/cg_view.c +++ b/src/cgame/cg_view.c @@ -1264,6 +1264,12 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demo // decide on third person view cg.renderingThirdPerson = cg_thirdPerson.integer || ( cg.snap->ps.stats[ STAT_HEALTH ] <= 0 ); + // Infer when we first became boosted + if( cg.snap->ps.stats[ STAT_STATE ] && SS_BOOSTED && cg.boostedTime < 0 ) + cg.boostedTime = cg.time; + else if( !( cg.snap->ps.stats[ STAT_STATE ] && SS_BOOSTED ) && cg.boostedTime >= 0 ) + cg.boostedTime = -1; + // build cg.refdef inwater = CG_CalcViewValues( ); |