/* ================= CG_DrawActiveFrame Generates and draws a game scene and status information at the given time. ================= */ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demoPlayback ) { int inwater; cg.cld = 0; // NERVE - SMF - reset clientDamage #ifdef DEBUGTIME_ENABLED int dbgTime = trap_Milliseconds(),elapsed; int dbgCnt = 0; #endif cg.time = serverTime; cg.demoPlayback = demoPlayback; // update cvars CG_UpdateCvars(); /* // RF, if we should force a weapon, then do so if( !cg.weaponSelect ) { if (cg_loadWeaponSelect.integer > 0) { cg.weaponSelect = cg_loadWeaponSelect.integer; cg.weaponSelectTime = cg.time; trap_Cvar_Set( "cg_loadWeaponSelect", "0" ); // turn it off } } */ #ifdef DEBUGTIME_ENABLED CG_Printf( "\n" ); #endif DEBUGTIME // if we are only updating the screen as a loading // pacifier, don't even try to read snapshots if ( cg.infoScreenText[0] != 0 ) { CG_DrawInformation(); return; } // any looped sounds will be respecified as entities // are added to the render list trap_S_ClearLoopingSounds( qfalse ); DEBUGTIME // clear all the render lists trap_R_ClearScene(); DEBUGTIME // set up cg.snap and possibly cg.nextSnap CG_ProcessSnapshots(); DEBUGTIME // if we haven't received any snapshots yet, all // we can draw is the information screen if ( !cg.snap || ( cg.snap->snapFlags & SNAPFLAG_NOT_ACTIVE ) ) { CG_DrawInformation(); return; } if ( cg.weaponSelect == WP_FG42SCOPE || cg.weaponSelect == WP_SNOOPERSCOPE || cg.weaponSelect == WP_SNIPERRIFLE ) { float spd; spd = VectorLength( cg.snap->ps.velocity ); if ( spd > 180.0f ) { switch ( cg.weaponSelect ) { case WP_FG42SCOPE: CG_FinishWeaponChange( cg.weaponSelect, WP_FG42 ); break; case WP_SNOOPERSCOPE: CG_FinishWeaponChange( cg.weaponSelect, WP_GARAND ); break; case WP_SNIPERRIFLE: CG_FinishWeaponChange( cg.weaponSelect, WP_MAUSER ); break; } } } DEBUGTIME if ( !cg.lightstylesInited ) { CG_SetupDlightstyles(); } DEBUGTIME // if we have been told not to render, don't if ( cg_norender.integer ) { return; } // this counter will be bumped for every valid scene we generate cg.clientFrame++; // update cg.predictedPlayerState CG_PredictPlayerState(); DEBUGTIME // decide on third person view cg.renderingThirdPerson = cg_thirdPerson.integer /*|| (cg.snap->ps.stats[STAT_HEALTH] <= 0)*/; // build cg.refdef inwater = CG_CalcViewValues(); CG_CalcShakeCamera(); CG_ApplyShakeCamera(); DEBUGTIME // RF, draw the skyboxportal CG_DrawSkyBoxPortal(); DEBUGTIME if ( inwater ) { CG_UnderwaterSounds(); } DEBUGTIME // first person blend blobs, done after AnglesToAxis if ( !cg.renderingThirdPerson ) { CG_DamageBlendBlob(); } DEBUGTIME // build the render lists if ( !cg.hyperspace ) { CG_AddPacketEntities(); // adter calcViewValues, so predicted player state is correct CG_AddMarks(); DEBUGTIME // Rafael particles CG_AddParticles(); // done. DEBUGTIME CG_AddLocalEntities(); DEBUGTIME }
/* ================= CG_DrawActiveFrame Generates and draws a game scene and status information at the given time. ================= */ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demoPlayback ) { int inwater; int mpSetup; // NERVE - SMF #ifdef DEBUGTIME_ENABLED int dbgTime=trap_Milliseconds(),elapsed; int dbgCnt=0; #endif cg.time = serverTime; cg.demoPlayback = demoPlayback; // update cvars CG_UpdateCvars(); #ifdef DEBUGTIME_ENABLED CG_Printf("\n"); #endif DEBUGTIME // if we are only updating the screen as a loading // pacifier, don't even try to read snapshots if ( cg.infoScreenText[0] != 0 ) { CG_DrawInformation(); return; } // any looped sounds will be respecified as entities // are added to the render list trap_S_ClearLoopingSounds(qfalse); DEBUGTIME // clear all the render lists trap_R_ClearScene(); DEBUGTIME // set up cg.snap and possibly cg.nextSnap CG_ProcessSnapshots(); DEBUGTIME // if we haven't received any snapshots yet, all // we can draw is the information screen if ( !cg.snap || ( cg.snap->snapFlags & SNAPFLAG_NOT_ACTIVE ) ) { CG_DrawInformation(); return; } // check for server set weapons we might not know about // (FIXME: this is a hack for the time being since a scripted "selectweapon" does // not hit the first snap, the server weapon set in cg_playerstate.c line 219 doesn't // do the trick) if( !cg.weaponSelect && cg.snap->ps.weapon) { cg.weaponSelect = cg.snap->ps.weapon; cg.weaponSelectTime = cg.time; } //----(SA) nerve uses this for snooper/sniper if (cg.weaponSelect == WP_FG42SCOPE) { float spd; spd = VectorLength(cg.snap->ps.velocity); if (spd > 180.0f) CG_FinishWeaponChange(WP_FG42SCOPE, WP_FG42); } DEBUGTIME if(!cg.lightstylesInited) CG_SetupDlightstyles(); DEBUGTIME // if we have been told not to render, don't if (cg_norender.integer) { return; } // this counter will be bumped for every valid scene we generate cg.clientFrame++; // update cg.predictedPlayerState CG_PredictPlayerState(); DEBUGTIME // decide on third person view cg.renderingThirdPerson = cg_thirdPerson.integer || (cg.snap->ps.stats[STAT_HEALTH] <= 0); // build cg.refdef inwater = CG_CalcViewValues(); DEBUGTIME // RF, draw the skyboxportal CG_DrawSkyBoxPortal(); DEBUGTIME if(inwater) CG_UnderwaterSounds(); DEBUGTIME // first person blend blobs, done after AnglesToAxis if ( !cg.renderingThirdPerson ) { CG_DamageBlendBlob(); } DEBUGTIME // build the render lists if ( !cg.hyperspace ) { CG_AddPacketEntities(); // adter calcViewValues, so predicted player state is correct CG_AddMarks(); DEBUGTIME // Rafael particles CG_AddParticles (); // done. DEBUGTIME CG_AddLocalEntities(); DEBUGTIME }