/* ================= CG_PredictPlayerState Generates cg.cur_lc->predictedPlayerState for the current cg.time cg.cur_lc->predictedPlayerState is guaranteed to be valid after exiting. For demo playback, this will be an interpolation between two valid playerState_t. For normal gameplay, it will be the result of predicted usercmd_t on top of the most recent playerState_t received from the server. Each new snapshot will usually have one or more new usercmd over the last, but we simulate all unacknowledged commands each time, not just the new ones. This means that on an internet connection, quite a few pmoves may be issued each frame. OPTIMIZE: don't re-simulate unless the newly arrived snapshot playerState_t differs from the predicted one. Would require saving all intermediate playerState_t during prediction. We detect prediction errors and allow them to be decayed off over several frames to ease the jerk. ================= */ void CG_PredictPlayerState( void ) { int cmdNum, current; playerState_t oldPlayerState; qboolean moved; usercmd_t oldestCmd; usercmd_t latestCmd; cg.cur_lc->hyperspace = qfalse; // will be set if touching a trigger_teleport // if this is the first frame we must guarantee // predictedPlayerState is valid even if there is some // other error condition if ( !cg.cur_lc->validPPS ) { cg.cur_lc->validPPS = qtrue; cg.cur_lc->predictedPlayerState = *cg.cur_ps; } // demo playback just copies the moves if ( cg.demoPlayback || (cg.cur_ps->pm_flags & PMF_FOLLOW) ) { CG_InterpolatePlayerState( qfalse ); return; } // non-predicting local movement will grab the latest angles if ( cg_nopredict.integer || cg_synchronousClients.integer ) { CG_InterpolatePlayerState( qtrue ); return; } // prepare for pmove cg_pmove.ps = &cg.cur_lc->predictedPlayerState; if (cg.cur_lc->predictedPlayerState.collisionType == CT_CAPSULE) { cg_pmove.trace = CG_TraceCapsule; } else { cg_pmove.trace = CG_Trace; } cg_pmove.pointcontents = CG_PointContents; if ( cg_pmove.ps->pm_type == PM_DEAD ) { cg_pmove.tracemask = MASK_PLAYERSOLID & ~CONTENTS_BODY; } else { cg_pmove.tracemask = MASK_PLAYERSOLID; } if ( cg.cur_ps->persistant[PERS_TEAM] == TEAM_SPECTATOR ) { cg_pmove.tracemask &= ~CONTENTS_BODY; // spectators can fly through bodies } cg_pmove.noFootsteps = ( cgs.dmflags & DF_NO_FOOTSTEPS ) > 0; // save the state before the pmove so we can detect transitions oldPlayerState = cg.cur_lc->predictedPlayerState; current = trap_GetCurrentCmdNumber(); // if we don't have the commands right after the snapshot, we // can't accurately predict a current position, so just freeze at // the last good position we had cmdNum = current - CMD_BACKUP + 1; trap_GetUserCmd( cmdNum, &oldestCmd, cg.cur_localPlayerNum ); if ( oldestCmd.serverTime > cg.cur_ps->commandTime && oldestCmd.serverTime < cg.time ) { // special check for map_restart if ( cg_showmiss.integer ) { CG_Printf ("exceeded PACKET_BACKUP on commands\n"); } return; } // get the latest command so we can know which commands are from previous map_restarts trap_GetUserCmd( current, &latestCmd, cg.cur_localPlayerNum ); // get the most recent information we have, even if // the server time is beyond our current cg.time, // because predicted player positions are going to // be ahead of everything else anyway if ( cg.nextSnap && !cg.nextFrameTeleport && !cg.thisFrameTeleport && cg.nextSnap->playerNums[cg.cur_localPlayerNum] != -1) { cg.cur_lc->predictedPlayerState = cg.nextSnap->pss[cg.cur_localPlayerNum]; cg.physicsTime = cg.nextSnap->serverTime; } else { cg.cur_lc->predictedPlayerState = *cg.cur_ps; cg.physicsTime = cg.snap->serverTime; } if ( pmove_msec.integer < 8 ) { trap_Cvar_SetValue( "pmove_msec", 8 ); } else if ( pmove_msec.integer > 33 ) { trap_Cvar_SetValue( "pmove_msec", 33 ); } cg_pmove.pmove_fixed = pmove_fixed.integer;// | cg_pmove_fixed.integer; cg_pmove.pmove_msec = pmove_msec.integer; cg_pmove.pmove_overbounce = pmove_overbounce.integer; // run cmds moved = qfalse; for ( cmdNum = current - CMD_BACKUP + 1 ; cmdNum <= current ; cmdNum++ ) { // get the command trap_GetUserCmd( cmdNum, &cg_pmove.cmd, cg.cur_localPlayerNum ); if ( cg_pmove.pmove_fixed ) { PM_UpdateViewAngles( cg_pmove.ps, &cg_pmove.cmd ); } // don't do anything if the time is before the snapshot player time if ( cg_pmove.cmd.serverTime <= cg.cur_lc->predictedPlayerState.commandTime ) { continue; } // don't do anything if the command was from a previous map_restart if ( cg_pmove.cmd.serverTime > latestCmd.serverTime ) { continue; } // check for a prediction error from last frame // on a lan, this will often be the exact value // from the snapshot, but on a wan we will have // to predict several commands to get to the point // we want to compare if ( cg.cur_lc->predictedPlayerState.commandTime == oldPlayerState.commandTime ) { vec3_t delta; float len; if ( cg.thisFrameTeleport ) { // a teleport will not cause an error decay VectorClear( cg.cur_lc->predictedError ); if ( cg_showmiss.integer ) { CG_Printf( "PredictionTeleport\n" ); } cg.thisFrameTeleport = qfalse; } else { vec3_t adjusted, new_angles; CG_AdjustPositionForMover( cg.cur_lc->predictedPlayerState.origin, cg.cur_lc->predictedPlayerState.groundEntityNum, cg.physicsTime, cg.oldTime, adjusted, cg.cur_lc->predictedPlayerState.viewangles, new_angles); if ( cg_showmiss.integer ) { if (!VectorCompare( oldPlayerState.origin, adjusted )) { CG_Printf("prediction error\n"); } } VectorSubtract( oldPlayerState.origin, adjusted, delta ); len = VectorLength( delta ); if ( len > 0.1 ) { if ( cg_showmiss.integer ) { CG_Printf("Prediction miss: %f\n", len); } if ( cg_errorDecay.integer ) { int t; float f; t = cg.time - cg.cur_lc->predictedErrorTime; f = ( cg_errorDecay.value - t ) / cg_errorDecay.value; if ( f < 0 ) { f = 0; } if ( f > 0 && cg_showmiss.integer ) { CG_Printf("Double prediction decay: %f\n", f); } VectorScale( cg.cur_lc->predictedError, f, cg.cur_lc->predictedError ); } else { VectorClear( cg.cur_lc->predictedError ); } VectorAdd( delta, cg.cur_lc->predictedError, cg.cur_lc->predictedError ); cg.cur_lc->predictedErrorTime = cg.oldTime; } } } // don't predict gauntlet firing, which is only supposed to happen // when it actually inflicts damage cg_pmove.gauntletHit = qfalse; if ( cg_pmove.pmove_fixed ) { cg_pmove.cmd.serverTime = ((cg_pmove.cmd.serverTime + pmove_msec.integer-1) / pmove_msec.integer) * pmove_msec.integer; } Pmove (&cg_pmove); moved = qtrue; // add push trigger movement effects CG_TouchTriggerPrediction(); // check for predictable events that changed from previous predictions //CG_CheckChangedPredictableEvents(&cg.cur_lc->predictedPlayerState); } if ( cg_showmiss.integer > 1 ) { CG_Printf( "[%i : %i] ", cg_pmove.cmd.serverTime, cg.time ); } if ( !moved ) { if ( cg_showmiss.integer ) { CG_Printf( "not moved\n" ); } return; } // adjust for the movement of the groundentity CG_AdjustPositionForMover( cg.cur_lc->predictedPlayerState.origin, cg.cur_lc->predictedPlayerState.groundEntityNum, cg.physicsTime, cg.time, cg.cur_lc->predictedPlayerState.origin, cg.cur_lc->predictedPlayerState.viewangles,cg.cur_lc->predictedPlayerState.viewangles); if ( cg_showmiss.integer ) { if (cg.cur_lc->predictedPlayerState.eventSequence > oldPlayerState.eventSequence + MAX_PS_EVENTS) { CG_Printf("WARNING: dropped event\n"); } } // fire events and other transition triggered things CG_TransitionPlayerState( &cg.cur_lc->predictedPlayerState, &oldPlayerState ); if ( cg_showmiss.integer ) { if (cg.cur_lc->eventSequence > cg.cur_lc->predictedPlayerState.eventSequence) { CG_Printf("WARNING: double event\n"); cg.cur_lc->eventSequence = cg.cur_lc->predictedPlayerState.eventSequence; } } }
void CG_DemosDrawActiveFrame( int serverTime, stereoFrame_t stereoView ) { int deltaTime; qboolean hadSkip; qboolean captureFrame; float captureFPS; float frameSpeed; int blurTotal, blurIndex; float blurFraction; float stereoSep = CG_Cvar_Get( "r_stereoSeparation" ); int inwater, entityNum; if (!demo.initDone) { if ( !cg.snap ) { demoProcessSnapShots( qtrue ); } if ( !cg.snap ) { CG_Error( "No Initial demo snapshot found" ); } demoPlaybackInit(); } cg.demoPlayback = 2; // update cvars CG_UpdateCvars(); // if we are only updating the screen as a loading // pacifier, don't even try to read snapshots if ( cg.loading ) { CG_DrawInformation(); return; } captureFrame = demo.capture.active && !demo.play.paused; if ( captureFrame ) { trap_MME_BlurInfo( &blurTotal, &blurIndex ); captureFPS = mov_captureFPS.value; if ( blurTotal > 0) { captureFPS *= blurTotal; blurFraction = blurIndex / (float)blurTotal; } else { blurFraction = 0; } } else { } /* Forward the demo */ deltaTime = serverTime - demo.serverTime; if (deltaTime > 50) deltaTime = 50; demo.serverTime = serverTime; demo.serverDeltaTime = 0.001 * deltaTime; cg.oldTime = cg.time; cg.oldTimeFraction = cg.timeFraction; if (demo.play.time < 0) { demo.play.time = demo.play.fraction = 0; } demo.play.oldTime = demo.play.time; /* Handle the music */ if ( demo.play.paused ) { if ( lastMusicStart >= 0) demoSynchMusic( -1, 0 ); } else { int musicStart = (demo.play.time - mov_musicStart.value * 1000 ); if ( musicStart <= 0 ) { if (lastMusicStart >= 0 ) demoSynchMusic( -1, 0 ); } else { if ( demo.play.time != demo.play.lastTime || lastMusicStart < 0) demoSynchMusic( musicStart, 0 ); } } /* forward the time a bit till the moment of capture */ if ( captureFrame && demo.capture.locked && demo.play.time < demo.capture.start ) { int left = demo.capture.start - demo.play.time; if ( left > 2000) { left -= 1000; captureFrame = qfalse; } else if (left > 5) { captureFrame = qfalse; left = 5; } demo.play.time += left; } else if ( captureFrame && demo.loop.total && blurTotal ) { float loopFraction = demo.loop.index / (float)demo.loop.total; demo.play.time = demo.loop.start; demo.play.fraction = demo.loop.range * loopFraction; demo.play.time += (int)demo.play.fraction; demo.play.fraction -= (int)demo.play.fraction; } else if (captureFrame) { float frameDelay = 1000.0f / captureFPS; demo.play.fraction += frameDelay * demo.play.speed; demo.play.time += (int)demo.play.fraction; demo.play.fraction -= (int)demo.play.fraction; } else if ( demo.find ) { demo.play.time = demo.play.oldTime + 20; demo.play.fraction = 0; if ( demo.play.paused ) demo.find = findNone; } else if (!demo.play.paused) { float delta = demo.play.fraction + deltaTime * demo.play.speed; demo.play.time += (int)delta; demo.play.fraction = delta - (int)delta; } demo.play.lastTime = demo.play.time; if ( demo.loop.total && captureFrame && blurTotal ) { //Delay till we hit the right part at the start int time; float timeFraction; if ( demo.loop.lineDelay && !blurIndex ) { time = demo.loop.start - demo.loop.lineDelay; timeFraction = 0; if ( demo.loop.lineDelay > 8 ) demo.loop.lineDelay -= 8; else demo.loop.lineDelay = 0; captureFrame = qfalse; } else { if ( blurIndex == blurTotal - 1 ) { //We'll restart back to the start again demo.loop.lineDelay = 2000; if ( ++demo.loop.index >= demo.loop.total ) { demo.loop.total = 0; } } time = demo.loop.start; timeFraction = demo.loop.range * blurFraction; } time += (int)timeFraction; timeFraction -= (int)timeFraction; lineAt( time, timeFraction, &demo.line.time, &cg.timeFraction, &frameSpeed ); } else { lineAt( demo.play.time, demo.play.fraction, &demo.line.time, &cg.timeFraction, &frameSpeed ); } /* Set the correct time */ cg.time = trap_MME_SeekTime( demo.line.time ); /* cg.time is shifted ahead a bit to correct some issues.. */ frameSpeed *= demo.play.speed; cg.frametime = (cg.time - cg.oldTime) + (cg.timeFraction - cg.oldTimeFraction); if (cg.frametime < 0) { int i; cg.frametime = 0; hadSkip = qtrue; cg.oldTime = cg.time; cg.oldTimeFraction = cg.timeFraction; CG_InitLocalEntities(); CG_InitMarkPolys(); CG_ClearParticles (); trap_FX_Reset( ); trap_R_DecalReset(); cg.centerPrintTime = 0; cg.damageTime = 0; cg.powerupTime = 0; cg.rewardTime = 0; cg.scoreFadeTime = 0; cg.lastKillTime = 0; cg.attackerTime = 0; cg.soundTime = 0; cg.itemPickupTime = 0; cg.itemPickupBlendTime = 0; cg.weaponSelectTime = 0; cg.headEndTime = 0; cg.headStartTime = 0; cg.v_dmg_time = 0; cg.rewardCount[0] = 0; cg.rewardStack = 0; cg.rewardTime = 0; trap_S_ClearLoopingSounds(qtrue); for (i = 0; i < MAX_CHATBOX_ITEMS; i++) cg.chatItems[i].time = 0; } else if (cg.frametime > 100) { hadSkip = qtrue; } else { hadSkip = qfalse; } /* Make sure the random seed is the same each time we hit this frame */ srand( (cg.time % 10000000) + cg.timeFraction * 1000); /* Prepare to render the screen */ trap_S_ClearLoopingSounds(qfalse); trap_R_ClearScene(); /* Update demo related information */ trap_SetUserCmdValue( cg.weaponSelect, 1 ); demoProcessSnapShots( hadSkip ); if ( !cg.snap ) { CG_DrawInformation(); return; } CG_PreparePacketEntities( ); CG_DemosUpdatePlayer( ); chaseUpdate( demo.play.time, demo.play.fraction ); cameraUpdate( demo.play.time, demo.play.fraction ); dofUpdate( demo.play.time, demo.play.fraction ); demoEffectUpdate( demo.play.time, demo.play.fraction ); cg.clientFrame++; // update cg.predictedPlayerState CG_InterpolatePlayerState( qfalse ); BG_PlayerStateToEntityState( &cg.predictedPlayerState, &cg.predictedPlayerEntity.currentState, qfalse ); if ( cg.cpma.detected ) { if ( cg.predictedPlayerState.pm_type >= 4 ) cg.predictedPlayerEntity.currentState.eType = ET_INVISIBLE; } cg.predictedPlayerEntity.currentValid = qtrue; VectorCopy( cg.predictedPlayerEntity.currentState.pos.trBase, cg.predictedPlayerEntity.lerpOrigin ); VectorCopy( cg.predictedPlayerEntity.currentState.apos.trBase, cg.predictedPlayerEntity.lerpAngles ); inwater = demoSetupView(); CG_TileClear(); trap_FX_Begin( cg.time, cg.timeFraction ); scriptRun( hadSkip ); CG_AddPacketEntities(); CG_AddMarks(); CG_AddParticles (); CG_AddLocalEntities(); if ( cg.playerCent == &cg.predictedPlayerEntity ) { // warning sounds when powerup is wearing off CG_PowerupTimerSounds(); CG_AddViewWeapon( &cg.predictedPlayerState ); } else if ( cg.playerCent && cg.playerCent->currentState.number < MAX_CLIENTS ) { CG_AddViewWeaponDirect( cg.playerCent ); } trap_S_UpdateEntityPosition(ENTITYNUM_NONE, cg.refdef.vieworg); CG_PlayBufferedSounds(); CG_PlayBufferedVoiceChats(); cg.refdef.time = cg.time; memcpy( cg.refdef.areamask, cg.snap->areamask, sizeof( cg.refdef.areamask ) ); /* Render some extra demo related stuff */ if (!captureFrame) { switch (demo.editType) { case editCamera: cameraDraw( demo.play.time, demo.play.fraction ); break; case editChase: chaseDraw( demo.play.time, demo.play.fraction ); break; case editDof: dofDraw( demo.play.time, demo.play.fraction ); break; case editEffect: demoEffectDraw( demo.play.time, demo.play.fraction ); break; } /* Add bounding boxes for easy aiming */ if ( demo.editType && ( demo.cmd.buttons & BUTTON_ATTACK) && ( demo.cmd.buttons & BUTTON_AFFIRMATIVE) ) { int i; centity_t *targetCent; for (i = 0;i<MAX_GENTITIES;i++) { targetCent = demoTargetEntity( i ); if (targetCent) { vec3_t container, traceStart, traceImpact, forward; const float *color; demoCentityBoxSize( targetCent, container ); VectorSubtract( demo.viewOrigin, targetCent->lerpOrigin, traceStart ); AngleVectors( demo.viewAngles, forward, 0, 0 ); if (BoxTraceImpact( traceStart, forward, container, traceImpact )) { color = colorRed; } else { color = colorYellow; } demoDrawBox( targetCent->lerpOrigin, container, color ); } } } if ( mov_gridStep.value > 0 && mov_gridRange.value > 0) { vec4_t color; vec3_t offset; qhandle_t shader = trap_R_RegisterShader( "mme/gridline" ); color[0] = color[1] = color[2] = 1; color[3] = 0; offset[0] = offset[1] = offset[2] = 0; Q_parseColor( mov_gridColor.string, ospColors, color ); demoDrawGrid( demo.viewOrigin, color, offset, mov_gridWidth.value, mov_gridStep.value, mov_gridRange.value, shader ); } } if (frameSpeed > 5) frameSpeed = 5; trap_S_UpdateScale( frameSpeed ); if (cg.playerCent && cg.predictedPlayerState.pm_type == PM_INTERMISSION) { entityNum = cg.snap->ps.clientNum; } else if (cg.playerCent) { entityNum = cg.playerCent->currentState.number; } else { entityNum = ENTITYNUM_NONE; } trap_S_Respatialize( entityNum, cg.refdef.vieworg, cg.refdef.viewaxis, inwater); trap_FX_End(); if (captureFrame && stereoSep > 0.0f) trap_Cvar_Set("r_stereoSeparation", va("%f", -stereoSep)); trap_MME_TimeFraction(cg.timeFraction); trap_R_RenderScene( &cg.refdef ); if ( demo.viewType == viewChase && cg.playerCent && ( cg.playerCent->currentState.number < MAX_CLIENTS ) ) CG_Draw2D(); // CG_DrawSmallString( 0, 0, va( "height %d", cg.playerCent->pe.viewHeight ), 1 ); if (captureFrame) { char fileName[MAX_OSPATH]; Com_sprintf( fileName, sizeof( fileName ), "capture/%s/%s", mme_demoFileName.string, mov_captureName.string ); trap_MME_Capture( fileName, captureFPS, demo.viewFocus, demo.viewRadius ); if ( mov_captureCamera.integer ) demoAddViewPos( fileName, demo.viewOrigin, demo.viewAngles, demo.viewFov ); } else { if (demo.editType && !cg.playerCent) demoDrawCrosshair(); hudDraw(); if (demo.editType) { demoDrawProgress(trap_MME_ProgressTime()); } } //checkCaptureEnd: if ( demo.capture.active && demo.capture.locked && demo.play.time > demo.capture.end ) { Com_Printf( "Capturing ended\n" ); if (demo.autoLoad) { trap_SendConsoleCommand( "disconnect\n" ); } demo.capture.active = qfalse; } }
/* * CG_SetupViewDef */ static void CG_SetupViewDef( cg_viewdef_t *view, int type, bool flipped ) { memset( view, 0, sizeof( cg_viewdef_t ) ); // // VIEW SETTINGS // view->type = type; view->flipped = flipped; if( view->type == VIEWDEF_PLAYERVIEW ) { view->POVent = cg.frame.playerState.POVnum; view->draw2D = true; // set up third-person if( cgs.demoPlaying ) view->thirdperson = CG_DemoCam_GetThirdPerson(); else if( chaseCam.mode == CAM_THIRDPERSON ) view->thirdperson = true; else view->thirdperson = ( cg_thirdPerson->integer != 0 ); if( cg_entities[view->POVent].serverFrame != cg.frame.serverFrame ) view->thirdperson = false; // check for drawing gun if( !view->thirdperson && view->POVent > 0 && view->POVent <= gs.maxclients ) { if( ( cg_entities[view->POVent].serverFrame == cg.frame.serverFrame ) && ( cg_entities[view->POVent].current.weapon != 0 ) ) view->drawWeapon = ( cg_gun->integer != 0 ) && ( cg_gun_alpha->value > 0 ); } // check for chase cams if( !( cg.frame.playerState.pmove.pm_flags & PMF_NO_PREDICTION ) ) { if( (unsigned)view->POVent == cgs.playerNum + 1 ) { if( cg_predict->integer && !cgs.demoPlaying ) { view->playerPrediction = true; } } } } else if( view->type == VIEWDEF_CAMERA ) { CG_DemoCam_GetViewDef( view ); } else { module_Error( "CG_SetupView: Invalid view type %i\n", view->type ); } // // SETUP REFDEF FOR THE VIEW SETTINGS // if( view->type == VIEWDEF_PLAYERVIEW ) { int i; vec3_t viewoffset; if( view->playerPrediction ) { CG_PredictMovement(); // fixme: crouching is predicted now, but it looks very ugly VectorSet( viewoffset, 0.0f, 0.0f, cg.predictedPlayerState.viewheight ); for( i = 0; i < 3; i++ ) { view->origin[i] = cg.predictedPlayerState.pmove.origin[i] + viewoffset[i] - ( 1.0f - cg.lerpfrac ) * cg.predictionError[i]; view->angles[i] = cg.predictedPlayerState.viewangles[i]; } CG_ViewSmoothPredictedSteps( view->origin ); // smooth out stair climbing if( cg_viewBob->integer && !cg_thirdPerson->integer ) { view->origin[2] += CG_ViewSmoothFallKick() * 6.5f; } } else { cg.predictingTimeStamp = cg.time; cg.predictFrom = 0; // we don't run prediction, but we still set cg.predictedPlayerState with the interpolation CG_InterpolatePlayerState( &cg.predictedPlayerState ); VectorSet( viewoffset, 0.0f, 0.0f, cg.predictedPlayerState.viewheight ); VectorAdd( cg.predictedPlayerState.pmove.origin, viewoffset, view->origin ); VectorCopy( cg.predictedPlayerState.viewangles, view->angles ); } view->refdef.fov_x = cg.predictedPlayerState.fov; CG_CalcViewBob(); VectorCopy( cg.predictedPlayerState.pmove.velocity, view->velocity ); } else if( view->type == VIEWDEF_CAMERA ) { view->refdef.fov_x = CG_DemoCam_GetOrientation( view->origin, view->angles, view->velocity ); } Matrix3_FromAngles( view->angles, view->axis ); if( view->flipped ) VectorInverse( &view->axis[AXIS_RIGHT] ); // view rectangle size view->refdef.x = scr_vrect.x; view->refdef.y = scr_vrect.y; view->refdef.width = scr_vrect.width; view->refdef.height = scr_vrect.height; view->refdef.time = cg.time; view->refdef.areabits = cg.frame.areabits; view->refdef.scissor_x = scr_vrect.x; view->refdef.scissor_y = scr_vrect.y; view->refdef.scissor_width = scr_vrect.width; view->refdef.scissor_height = scr_vrect.height; view->refdef.fov_y = CalcFov( view->refdef.fov_x, view->refdef.width, view->refdef.height ); AdjustFov( &view->refdef.fov_x, &view->refdef.fov_y, view->refdef.width, view->refdef.height, false ); view->fracDistFOV = tan( view->refdef.fov_x * ( M_PI/180 ) * 0.5f ); view->refdef.minLight = 0.3f; if( view->thirdperson ) CG_ThirdPersonOffsetView( view ); if( !view->playerPrediction ) cg.predictedWeaponSwitch = 0; VectorCopy( cg.view.origin, view->refdef.vieworg ); Matrix3_Copy( cg.view.axis, view->refdef.viewaxis ); VectorInverse( &view->refdef.viewaxis[AXIS_RIGHT] ); view->refdef.colorCorrection = NULL; if( cg_colorCorrection->integer ) { int colorCorrection = GS_ColorCorrection(); if( ( colorCorrection > 0 ) && ( colorCorrection < MAX_IMAGES ) ) view->refdef.colorCorrection = cgs.imagePrecache[colorCorrection]; } }