/* =============== CG_TransitionPlayerState =============== */ void CG_TransitionPlayerState( playerState_t *ps, playerState_t *ops ) { // check for changing follow mode if ( ps->clientNum != ops->clientNum ) { cg.thisFrameTeleport = true; // make sure we don't get any unwanted transition effects *ops = *ps; } // damage events (player is getting wounded) if ( ps->damageEvent != ops->damageEvent && ps->damageCount ) { CG_DamageFeedback( ps->damageYaw, ps->damagePitch, ps->damageCount ); } // respawning if ( ps->persistant[PERS_SPAWN_COUNT] != ops->persistant[PERS_SPAWN_COUNT] ) { CG_Respawn(); } if ( cg.mapRestart ) { CG_Respawn(); cg.mapRestart = false; } if ( cg.snap->ps.pm_type != PM_INTERMISSION && ps->persistant[PERS_TEAM] != ClientBase::TEAM_SPECTATOR ) { CG_CheckLocalSounds( ps, ops ); } // run events CG_CheckPlayerstateEvents( ps, ops ); }
/* =============== CG_TransitionPlayerState =============== */ void CG_TransitionPlayerState( playerState_t *ps, playerState_t *ops ) { // check for changing follow mode if ( ps->clientNum != ops->clientNum ) { cg.thisFrameTeleport = true; // make sure we don't get any unwanted transition effects *ops = *ps; CG_ResetPainBlend(); } // damage events (player is getting wounded) if ( ps->damageEvent != ops->damageEvent && ps->damageCount ) { CG_DamageFeedback( ps->damageYaw, ps->damagePitch, ps->damageCount ); } // respawning if ( ps->persistant[ PERS_SPAWN_COUNT ] != ops->persistant[ PERS_SPAWN_COUNT ] ) { CG_Respawn(); } if ( cg.mapRestart ) { CG_Respawn(); cg.mapRestart = false; } if ( cg.snap->ps.pm_type != PM_INTERMISSION && ps->persistant[ PERS_SPECSTATE ] == SPECTATOR_NOT ) { CG_CheckLocalSounds( ps, ops ); } // run events CG_CheckPlayerstateEvents( ps, ops ); // smooth the ducking viewheight change if ( ps->viewheight != ops->viewheight ) { cg.duckChange = ps->viewheight - ops->viewheight; cg.duckTime = cg.time; } // changed team if ( ps->persistant[ PERS_TEAM ] != ops->persistant[ PERS_TEAM ] ) { cg.lastHealthCross = 0; cg.chargeMeterAlpha = 0.0f; } if ( ps->stats[ STAT_TAGSCORE ] != ops->stats[ STAT_TAGSCORE ] ) cg.tagScoreTime = cg.time; }
/* =============== CG_TransitionPlayerState =============== */ void CG_TransitionPlayerState( playerState_t *ps, playerState_t *ops ) { // check for changing follow mode if( ps->clientNum != ops->clientNum ) { cg.thisFrameTeleport = qtrue; // make sure we don't get any unwanted transition effects *ops = *ps; CG_ResetPainBlend( ); } // damage events (player is getting wounded) if( ps->damageEvent != ops->damageEvent && ps->damageCount ) CG_DamageFeedback( ps->damageYaw, ps->damagePitch, ps->damageCount ); // respawning if( ps->persistant[ PERS_SPAWN_COUNT ] != ops->persistant[ PERS_SPAWN_COUNT ] ) CG_Respawn( ); if( cg.mapRestart ) { CG_Respawn( ); cg.mapRestart = qfalse; } if( cg.snap->ps.pm_type != PM_INTERMISSION && ps->persistant[ PERS_SPECSTATE ] == SPECTATOR_NOT ) CG_CheckLocalSounds( ps, ops ); // run events CG_CheckPlayerstateEvents( ps, ops ); // smooth the ducking viewheight change if( ps->viewheight != ops->viewheight ) { cg.duckChange = ps->viewheight - ops->viewheight; cg.duckTime = cg.time; } // changed team if( ps->stats[ STAT_TEAM ] != ops->stats[ STAT_TEAM ] ) { cg.lastHealthCross = 0; cg.chargeMeterAlpha = 0.0f; } if( ps->stats[ STAT_FUEL ] < JETPACK_FUEL_JUMP && ops->stats[ STAT_FUEL ] >= JETPACK_FUEL_JUMP && cg.predictedPlayerEntity.jetPackJumpTime + 1000 > cg.time ) { trap_S_StartSound( NULL, cg.predictedPlayerState.clientNum, CHAN_AUTO, cgs.media.jetpackNoJumpFuelSound ); } }
/* ================== CG_SetInitialSnapshot This will only happen on the very first snapshot, or on tourney restarts. All other times will use CG_TransitionSnapshot instead. FIXME: Also called by map_restart? ================== */ void CG_SetInitialSnapshot( snapshot_t *snap ) { int i; centity_t *cent; entityState_t *state; cg.snap = snap; BG_PlayerStateToEntityState( &snap->ps, &cg_entities[ snap->ps.clientNum ].currentState, qfalse ); // sort out solid entities CG_BuildSolidList(); CG_ExecuteNewServerCommands( snap->serverCommandSequence ); // set our local weapon selection pointer to // what the server has indicated the current weapon is CG_Respawn(); for ( i = 0; i < cg.snap->numEntities; i++ ) { state = &cg.snap->entities[ i ]; cent = &cg_entities[ state->number ]; memcpy( ¢->currentState, state, sizeof( entityState_t ) ); //cent->currentState = *state; cent->interpolate = qfalse; cent->currentValid = qtrue; CG_ResetEntity( cent ); // check for events CG_CheckEvents( cent ); } }
// This will only happen on the very first snapshot, or on tourney restarts. // All other times will use CG_TransitionSnapshot instead. // FIXME: Also called by map_restart? void CG_SetInitialSnapshot( snapshot_t *snap ) { int i; centity_t *cent; entityState_t *state; cg.snap = snap; if ( !cg_entities[snap->ps.clientNum].ghoul2 && trap->G2_HaveWeGhoul2Models( cgs.clientinfo[snap->ps.clientNum].ghoul2Model ) ) { trap->G2API_DuplicateGhoul2Instance( cgs.clientinfo[snap->ps.clientNum].ghoul2Model, &cg_entities[snap->ps.clientNum].ghoul2 ); CG_CopyG2WeaponInstance( &cg_entities[snap->ps.clientNum], FIRST_WEAPON, cg_entities[snap->ps.clientNum].ghoul2 ); // check now to see if we have this bone for setting anims and such if ( trap->G2API_AddBolt( cg_entities[snap->ps.clientNum].ghoul2, 0, "face" ) == -1 ) cg_entities[snap->ps.clientNum].noFace = qtrue; } BG_PlayerStateToEntityState( &snap->ps, &cg_entities[snap->ps.clientNum].currentState, qfalse ); // sort out solid entities CG_BuildSolidList(); CG_ExecuteNewServerCommands( snap->serverCommandSequence ); // set our local weapon selection pointer to // what the server has indicated the current weapon is CG_Respawn(); for ( i = 0; i < cg.snap->numEntities; i++ ) { state = &cg.snap->entities[i]; cent = &cg_entities[state->number]; memcpy( ¢->currentState, state, sizeof(entityState_t) ); // cent->currentState = *state; cent->interpolate = qfalse; cent->currentValid = qtrue; CG_ResetEntity( cent ); // check for events CG_CheckEvents( cent ); } // auto record demo if ( cg_autoRecordDemo.integer & (1 << cgs.gametype) && cg.warmup <= 0 && !cg.demoPlayback ) { time_t rawtime; char buf[256] = { 0 }, timeStr[64] = { 0 }, mapName[MAX_QPATH] = { 0 }; time( &rawtime ); strftime( timeStr, sizeof(timeStr), "%Y-%m-%d_%H-%M-%S", localtime( &rawtime ) ); Q_strncpyz( mapName, cgs.mapname + 5, sizeof(mapName) ); Q_strstrip( mapName, "/", "-" ); COM_StripExtension( mapName, mapName, sizeof(mapName) ); Com_sprintf( buf, sizeof(buf), "%s_%s_%s_%s", timeStr, gametypeStringShort[cgs.gametype], mapName, cgs.clientinfo[cg.clientNum].name ); Q_strstrip( buf, "\n\r;?*<>|\\/\"", NULL ); Q_strstrip( buf, " ", "_" ); Q_CleanString( buf, STRIP_COLOUR | STRIP_EXTASCII ); trap->SendConsoleCommand( va( "stoprecord; record %s\n", buf ) ); } }
/* =============== CG_TransitionPlayerState =============== */ void CG_TransitionPlayerState( playerState_t *ps, playerState_t *ops ) { // check for changing follow mode if ( ps->clientNum != ops->clientNum ) { cg.thisFrameTeleport = qtrue; // make sure we don't get any unwanted transition effects *ops = *ps; // DHM - Nerve :: After Limbo, make sure and do a CG_Respawn if ( ps->clientNum == cg.clientNum ) { ops->persistant[PERS_SPAWN_COUNT]--; } } // damage events (player is getting wounded) if ( ps->damageEvent != ops->damageEvent && ps->damageCount ) { CG_DamageFeedback( ps->damageYaw, ps->damagePitch, ps->damageCount ); } // respawning if ( ps->persistant[PERS_SPAWN_COUNT] != ops->persistant[PERS_SPAWN_COUNT] ) { CG_Respawn(); } if ( cg.mapRestart ) { CG_Respawn(); cg.mapRestart = qfalse; } if ( cg.snap->ps.pm_type != PM_INTERMISSION && ps->persistant[PERS_TEAM] != TEAM_SPECTATOR ) { CG_CheckLocalSounds( ps, ops ); } // check for going low on ammo CG_CheckAmmo(); // run events CG_CheckPlayerstateEvents( ps, ops ); // smooth the ducking viewheight change if ( ps->viewheight != ops->viewheight ) { cg.duckChange = ps->viewheight - ops->viewheight; cg.duckTime = cg.time; } }
/*=============== CG_TransitionPlayerState ===============*/ void CG_TransitionPlayerState( playerState_t *ps, playerState_t *ops ) { if(ps->clientNum != ops->clientNum){ cg.thisFrameTeleport = qtrue; *ops = *ps; } if(ps->persistant[PERS_SPAWN_COUNT] != ops->persistant[PERS_SPAWN_COUNT]){ CG_Respawn(); } if(cg.mapRestart){ CG_Respawn(); cg.mapRestart = qfalse; } if(cg.snap->ps.pm_type != PM_INTERMISSION && ps->persistant[PERS_TEAM] != TEAM_SPECTATOR){ CG_CheckLocalSounds(ps,ops); } CG_CheckPlayerstateEvents(ps,ops); if(ps->viewheight != ops->viewheight){ cg.duckChange = ps->viewheight - ops->viewheight; cg.duckTime = cg.time; } cg.tierSelectionMode = 0; cg.tierSelect = -1; if(ps->powerLevel[plTierChanged] == 1 && ops->powerLevel[plTierChanged] != 1) { cg.tierCurrent = ps->powerLevel[plTierCurrent]; cg.weaponDesired = -1; cg.weaponSelectionMode = 0; } if(ps->currentSkill[WPSTAT_CHANGED] != 0){ //If the server validated a weapon change, changes it cg.weaponSelectionMode = 0; cg.weaponDesired = -1; cg.weaponSelect = ps->weapon; if(ps->currentSkill[WPSTAT_CHANGED] != -1) { cg.drawWeaponBar = 1; } } }
/* ================== CG_SetInitialSnapshot This will only happen on the very first snapshot, or on tourney restarts. All other times will use CG_TransitionSnapshot instead. FIXME: Also called by map_restart? ================== */ void CG_SetInitialSnapshot( snapshot_t *snap ) { int i; centity_t *cent; entityState_t *state; lua_State *L = GetClientLuaState(); cg.snap = snap; BG_PlayerStateToEntityState( &snap->ps, &cg_entities[ snap->ps.clientNum ].currentState, qfalse ); // sort out solid entities CG_BuildSolidList(); CG_ExecuteNewServerCommands( snap->serverCommandSequence ); // set our local weapon selection pointer to // what the server has indicated the current weapon is CG_Respawn(); for ( i = 0 ; i < cg.snap->numEntities ; i++ ) { state = &cg.snap->entities[ i ]; cent = &cg_entities[ state->number ]; memcpy(¢->currentState, state, sizeof(entityState_t)); //cent->currentState = *state; cent->interpolate = qfalse; cent->currentValid = qtrue; CG_ResetEntity( cent ); // check for events CG_CheckEvents( cent ); if(L != NULL && cent->linked == qfalse && cent->currentState.eType <= ET_LUA && cent->currentState.eType != ET_GENERAL) { qlua_gethook(L,"EntityLinked"); lua_pushentity(L,cent); qlua_pcall(L,1,0,qtrue); cent->linked = qtrue; } } if(L != NULL && !playBack) { qlua_gethook(L,"InitialSnapshot"); qlua_pcall(L,0,0,qtrue); } }
/* ================== CG_SetInitialSnapshot This will only happen on the very first snapshot. At all other times, CG_TransitionSnapshot is used instead. FIXME: Also called by map_restart? ================== */ void CG_SetInitialSnapshot( snapshot_t *snap ) { int i; centity_t *cent; entityState_t *state; cg.snap = snap; BG_PlayerStateToEntityState( &snap->ps, &cg_entities[ snap->ps.clientNum ].currentState, qfalse ); // sort out solid entities CG_BuildSolidList(); CG_ExecuteNewServerCommands( snap->serverCommandSequence ); // set our local weapon selection pointer to // what the server has indicated the current weapon is CG_Respawn(); for ( i = 0; i < cg.snap->numEntities; i++ ) { state = &cg.snap->entities[ i ]; cent = &cg_entities[ state->number ]; memcpy( ¢->currentState, state, sizeof( entityState_t ) ); //cent->currentState = *state; cent->interpolate = qfalse; cent->currentValid = qtrue; CG_ResetEntity( cent ); // check for events CG_CheckEvents( cent ); } // Need this check because the initial weapon for spec isn't always WP_NONE if ( snap->ps.persistant[ PERS_TEAM ] == TEAM_NONE ) { trap_Rocket_ShowHud( WP_NONE ); } else { trap_Rocket_ShowHud( BG_GetPlayerWeapon( &snap->ps ) ); } }
/* ================== CG_SetInitialSnapshot This will only happen on the very first snapshot, or on tourney restarts. All other times will use CG_TransitionSnapshot instead. FIXME: Also called by map_restart? ================== */ void CG_SetInitialSnapshot( snapshot_t *snap ) { int i; centity_t *cent; entityState_t *state; cg.snap = snap; if ((cg_entities[snap->ps.clientNum].ghoul2 == NULL) && trap_G2_HaveWeGhoul2Models(cgs.clientinfo[snap->ps.clientNum].ghoul2Model)) { trap_G2API_DuplicateGhoul2Instance(cgs.clientinfo[snap->ps.clientNum].ghoul2Model, &cg_entities[snap->ps.clientNum].ghoul2); CG_CopyG2WeaponInstance(FIRST_WEAPON, cg_entities[snap->ps.clientNum].ghoul2); } BG_PlayerStateToEntityState( &snap->ps, &cg_entities[ snap->ps.clientNum ].currentState, qfalse ); // sort out solid entities CG_BuildSolidList(); CG_ExecuteNewServerCommands( snap->serverCommandSequence ); // set our local weapon selection pointer to // what the server has indicated the current weapon is CG_Respawn(); for ( i = 0 ; i < cg.snap->numEntities ; i++ ) { state = &cg.snap->entities[ i ]; cent = &cg_entities[ state->number ]; memcpy(¢->currentState, state, sizeof(entityState_t)); //cent->currentState = *state; cent->interpolate = qfalse; cent->currentValid = qtrue; if ( jk2startversion == VERSION_1_02 ) { // MVSDK: Version Magic! cent->currentState.torsoAnim = MV_MapAnimation104( cent->currentState.torsoAnim ); cent->currentState.legsAnim = MV_MapAnimation104( cent->currentState.legsAnim ); } CG_ResetEntity( cent ); // check for events CG_CheckEvents( cent ); } }
/* ================== CG_SetInitialSnapshot This will only happen on the very first snapshot, or on tourney restarts. All other times will use CG_TransitionSnapshot instead. FIXME: Also called by map_restart? ================== */ void CG_SetInitialSnapshot( snapshot_t *snap ) { int i; centity_t *cent; entityState_t *state; cg.snap = snap; if ((cg_entities[snap->ps.clientNum].ghoul2 == NULL) && trap->G2_HaveWeGhoul2Models(cgs.clientinfo[snap->ps.clientNum].ghoul2Model)) { trap->G2API_DuplicateGhoul2Instance(cgs.clientinfo[snap->ps.clientNum].ghoul2Model, &cg_entities[snap->ps.clientNum].ghoul2); CG_CopyG2WeaponInstance(&cg_entities[snap->ps.clientNum], FIRST_WEAPON, 0, cg_entities[snap->ps.clientNum].ghoul2); if (trap->G2API_AddBolt(cg_entities[snap->ps.clientNum].ghoul2, 0, "face") == -1) { //check now to see if we have this bone for setting anims and such cg_entities[snap->ps.clientNum].noFace = qtrue; } } BG_PlayerStateToEntityState( &snap->ps, &cg_entities[ snap->ps.clientNum ].currentState, qfalse ); // sort out solid entities CG_BuildSolidList(); CG_ExecuteNewServerCommands( snap->serverCommandSequence ); // set our local weapon selection pointer to // what the server has indicated the current weapon is CG_Respawn(); for ( i = 0 ; i < cg.snap->numEntities ; i++ ) { state = &cg.snap->entities[ i ]; cent = &cg_entities[ state->number ]; memcpy(¢->currentState, state, sizeof(entityState_t)); //cent->currentState = *state; cent->interpolate = qfalse; cent->currentValid = qtrue; CG_ResetEntity( cent ); // check for events CG_CheckEvents( cent ); } }
/* =============== CG_TransitionPlayerState =============== */ void CG_TransitionPlayerState( playerState_t *ps, playerState_t *ops ) { // teleporting if ( ( ps->eFlags ^ ops->eFlags ) & EF_TELEPORT_BIT ) { cg.thisFrameTeleport = qtrue; } else { cg.thisFrameTeleport = qfalse; } // check for changing follow mode if ( ps->clientNum != ops->clientNum ) { cg.thisFrameTeleport = qtrue; // make sure we don't get any unwanted transition effects *ops = *ps; } // damage events (player is getting wounded) if ( ps->damageEvent != ops->damageEvent && ps->damageCount ) { CG_DamageFeedback( ps->damageYaw, ps->damagePitch, ps->damageCount ); } // respawning if ( ps->persistant[PERS_SPAWN_COUNT] != ops->persistant[PERS_SPAWN_COUNT] ) { CG_Respawn(); } // check for going low on ammo CG_CheckAmmo(); // run events CG_CheckPlayerstateEvents( ps, ops ); // smooth the ducking viewheight change if ( ps->viewheight != ops->viewheight ) { if ( !cg.nextFrameTeleport ) {//when we crouch/uncrouch in mid-air, our viewhieght doesn't actually change in //absolute world coordinates, just locally. cg.duckChange = ps->viewheight - ops->viewheight; cg.duckTime = cg.time; } } }
void firstReplayFrame() { int i; snapshot_t *snap; centity_t *cent; entityState_t *state; lua_State *L = GetClientLuaState(); snap = &replaySnaps[0]; cg.snap = snap; cg.snap->serverTime += cg.time; BG_PlayerStateToEntityState( &snap->ps, &cg_entities[ snap->ps.clientNum ].currentState, qfalse ); CG_BuildSolidList(); CG_ExecuteNewServerCommands( snap->serverCommandSequence ); CG_Respawn(); for ( i = 0 ; i < sizeof(cg_entities) / sizeof(cg_entities[0]); i++ ) { CG_ResetEntity(&cg_entities[i]); } for ( i = 0 ; i < cg.snap->numEntities ; i++ ) { state = &cg.snap->entities[ i ]; cent = &cg_entities[ state->number ]; if(state->time != 0) state->time += cg.time; if(state->time2 != 0) state->time2 += cg.time; state->pos.trTime += cg.time; state->apos.trTime += cg.time; memcpy(¢->currentState, state, sizeof(entityState_t)); cent->interpolate = qtrue; cent->currentValid = qtrue; CG_ResetEntity( cent ); CG_CheckEvents( cent ); cent->previousEvent = 0; } //cg.time = snap->serverTime; }
/* ================== CG_SetInitialSnapshot This will only happen on the very first snapshot, or on tourney restarts. All other times will use CG_TransitionSnapshot instead. FIXME: Also called by map_restart? ================== */ void CG_SetInitialSnapshot( snapshot_t *snap ) { int i; centity_t *cent; entityState_t *state; char buff[16]; cg.snap = snap; // trap_S_ClearSounds( qtrue ); BG_PlayerStateToEntityState( &snap->ps, &cg_entities[ snap->ps.clientNum ].currentState, qfalse ); // sort out solid entities CG_BuildSolidList(); CG_ExecuteNewServerCommands( snap->serverCommandSequence ); // set our local weapon selection pointer to // what the server has indicated the current weapon is CG_Respawn( qfalse ); for ( i = 0 ; i < cg.snap->numEntities ; i++ ) { state = &cg.snap->entities[ i ]; cent = &cg_entities[ state->number ]; memcpy(¢->currentState, state, sizeof(entityState_t)); //cent->currentState = *state; cent->interpolate = qfalse; cent->currentValid = qtrue; CG_ResetEntity( cent ); // check for events CG_CheckEvents( cent ); } cg_fxflags = 0; trap_Cvar_VariableStringBuffer( "r_oldMode", buff, sizeof(buff) ); if( atoi(buff) ) { // Arnout: confirmation screen trap_UI_Popup( UIMENU_INGAME ); } else if(cg.demoPlayback) { ccInitial = qtrue; } else { static char prevmap[64] = { 0 }; char curmap[64]; trap_Cvar_VariableStringBuffer( "mapname", curmap, 64 ); if ( Q_stricmp( curmap, prevmap ) ) { strcpy( prevmap, curmap ); if(cgs.campaignInfoLoaded) { if( !cg.showGameView ) { CG_LimboMenu_f(); } /* } else { ccInitial = qtrue; // Start the Initial Camera if specified CG_StartInitialCamera(); */ } } } // OSP - remove motd window if(cg.motdWindow != NULL) { CG_windowFree(cg.motdWindow); cg.motdWindow = NULL; } // Activate alternate input handler during demo playback if(cg.demoPlayback) { CG_keyOn_f(); if(demo_infoWindow.integer > 0) { CG_ShowHelp_On(&cg.demohelpWindow); } } // OSP #if __MACOS__ #ifdef GAMERANGER // LBO 12/13/04. Add support for GameRanger team voice IDs GRSetMyTeamID(cg.snap->ps.persistant[PERS_TEAM]); #endif #endif }
/* =============== CG_TransitionPlayerState =============== */ void CG_TransitionPlayerState(playerState_t *ps, playerState_t *ops) { #if FEATURE_MULTIVIEW // MV client handling if (cg.mvTotalClients > 0) { if (ps->clientNum != ops->clientNum) { cg.thisFrameTeleport = qtrue; // clear voicechat cg.predictedPlayerEntity.voiceChatSpriteTime = 0; // CHECKME: should we do this here? cg_entities[ps->clientNum].voiceChatSpriteTime = 0; *ops = *ps; } CG_CheckLocalSounds(ps, ops); return; } #endif // check for changing follow mode if (ps->clientNum != ops->clientNum) { cg.thisFrameTeleport = qtrue; // clear voicechat cg.predictedPlayerEntity.voiceChatSpriteTime = 0; cg_entities[ps->clientNum].voiceChatSpriteTime = 0; // make sure we don't get any unwanted transition effects *ops = *ps; // After Limbo, make sure and do a CG_Respawn if (ps->clientNum == cg.clientNum) { ops->persistant[PERS_SPAWN_COUNT]--; } } if (ps->eFlags & EF_FIRING) { cg.lastFiredWeaponTime = 0; cg.weaponFireTime += cg.frametime; } else { if (cg.weaponFireTime > 500 && cg.weaponFireTime) { cg.lastFiredWeaponTime = cg.time; } cg.weaponFireTime = 0; } // damage events (player is getting wounded) if (ps->damageEvent != ops->damageEvent && ps->damageCount) { CG_DamageFeedback(ps->damageYaw, ps->damagePitch, ps->damageCount); } // respawning if (ps->persistant[PERS_SPAWN_COUNT] != ops->persistant[PERS_SPAWN_COUNT]) { CG_Respawn(ps->persistant[PERS_REVIVE_COUNT] != ops->persistant[PERS_REVIVE_COUNT] ? qtrue : qfalse); } if (cg.mapRestart) { CG_Respawn(qfalse); cg.mapRestart = qfalse; } if (cg.snap->ps.pm_type != PM_INTERMISSION && ps->persistant[PERS_TEAM] != TEAM_SPECTATOR) { CG_CheckLocalSounds(ps, ops); } if (ps->eFlags & EF_PRONE_MOVING) { if (ps->weapon == WP_BINOCULARS) { if (ps->eFlags & EF_ZOOMING) { trap_SendConsoleCommand("-zoom\n"); } } if (!(ops->eFlags & EF_PRONE_MOVING)) { // this screws up auto-switching when dynamite planted or grenade thrown/out of ammo //CG_FinishWeaponChange( cg.weaponSelect, ps->nextWeapon ); cg.proneMovingTime = cg.time; } } else if (ops->eFlags & EF_PRONE_MOVING) { cg.proneMovingTime = -cg.time; } if (!(ps->eFlags & EF_PRONE) && (ops->eFlags & EF_PRONE)) { if (cg.weaponSelect == WP_MOBILE_MG42_SET || cg.weaponSelect == WP_MOBILE_BROWNING_SET) { CG_FinishWeaponChange(cg.weaponSelect, ps->nextWeapon); } } // run events CG_CheckPlayerstateEvents(ps, ops); // smooth the ducking viewheight change if (ps->viewheight != ops->viewheight) { cg.duckChange = ps->viewheight - ops->viewheight; cg.duckTime = cg.time; } }
/* ================== CG_SetInitialSnapshot This will only happen on the very first snapshot, or on tourney restarts. All other times will use CG_TransitionSnapshot instead. FIXME: Also called by map_restart? ================== */ void CG_SetInitialSnapshot(snapshot_t *snap) { int i; centity_t *cent; entityState_t *state; char buff[16]; cg.snap = snap; // trap_S_ClearSounds( qtrue ); BG_PlayerStateToEntityState(&snap->ps, &cg_entities[snap->ps.clientNum].currentState, cg.time, qfalse); // sort out solid entities CG_BuildSolidList(); CG_ExecuteNewServerCommands(snap->serverCommandSequence); // set our local weapon selection pointer to // what the server has indicated the current weapon is CG_Respawn(qfalse); for (i = 0 ; i < cg.snap->numEntities ; i++) { state = &cg.snap->entities[i]; cent = &cg_entities[state->number]; memcpy(¢->currentState, state, sizeof(entityState_t)); //cent->currentState = *state; cent->interpolate = qfalse; cent->currentValid = qtrue; CG_ResetEntity(cent); // check for events CG_CheckEvents(cent); } trap_Cvar_VariableStringBuffer("r_oldMode", buff, sizeof(buff)); if (atoi(buff)) { // confirmation screen trap_UI_Popup(UIMENU_INGAME); } else if (cg.demoPlayback) { ccInitial = qtrue; } else { static char prevmap[64] = { 0 }; char curmap[64]; trap_Cvar_VariableStringBuffer("mapname", curmap, 64); if (Q_stricmp(curmap, prevmap)) { strcpy(prevmap, curmap); if (cgs.campaignInfoLoaded) { if (!cg.showGameView) { CG_LimboMenu_f(); } /* } else { ccInitial = qtrue; // Start the Initial Camera if specified CG_StartInitialCamera(); */ } } } // remove motd window if (cg.motdWindow != NULL) { CG_windowFree(cg.motdWindow); cg.motdWindow = NULL; } // Activate alternate input handler during demo playback if (cg.demoPlayback) { CG_keyOn_f(); if (demo_infoWindow.integer > 0) { CG_ShowHelp_On(&cg.demohelpWindow); } } // update client XP for spectator frames if (cg.snap->ps.clientNum == cg.clientNum) // sanity check { int cXP = (32768 * cg.snap->ps.stats[STAT_XP_OVERFLOW]) + cg.snap->ps.stats[STAT_XP]; if (cg.xp < cXP) { cg.xpChangeTime = cg.time; } cg.xp = cXP; } }
/* ================== CG_SetInitialSnapshot This will only happen on the very first snapshot, or on tourney restarts. All other times will use CG_TransitionSnapshot instead. ================== */ void CG_SetInitialSnapshot(snapshot_t *snap) { int i; centity_t *cent; char buff[16]; cg.snap = snap; BG_PlayerStateToEntityState(&snap->ps, &cg_entities[snap->ps.clientNum].currentState, qfalse); // sort out solid entities CG_BuildSolidList(); CG_ExecuteNewServerCommands(snap->serverCommandSequence); // set our local weapon selection pointer to // what the server has indicated the current weapon is CG_Respawn(); for (i = 0 ; i < cg.snap->numEntities ; ++i) { entityState_t *state = &cg.snap->entities[i]; cent = &cg_entities[state->number]; memcpy(¢->currentState, state, sizeof (entityState_t)); cent->interpolate = qfalse; cent->currentValid = qtrue; CG_ResetEntity(cent); // check for events CG_CheckEvents(cent); } cg_fxflags = 0; trap_Cvar_VariableStringBuffer("r_oldMode", buff, sizeof (buff)); if (atoi(buff)) { // Arnout: confirmation screen trap_UI_Popup(UIMENU_INGAME); } else if (!cg.demoPlayback) { static char prevmap[64] = { 0 }; char curmap[64]; trap_Cvar_VariableStringBuffer("mapname", curmap, 64); if (Q_stricmp(curmap, prevmap)) { strcpy(prevmap, curmap); if (cgs.campaignInfoLoaded) { if (!cg.showGameView) { CG_LimboMenu_f(); } } } } // OSP - remove motd window if (cg.motdWindow != NULL) { CG_windowFree(cg.motdWindow); cg.motdWindow = NULL; } // Activate alternate input handler during demo playback if (cg.demoPlayback) { CG_keyOn_f(); if (demo_infoWindow.integer > 0) { CG_ShowHelp_On(&cg.demohelpWindow); } } }
/* =============== CG_TransitionPlayerState =============== */ void CG_TransitionPlayerState(playerState_t *ps, playerState_t *ops) { // check for changing follow mode if (ps->clientNum != ops->clientNum) { cg.thisFrameTeleport = qtrue; // clear voicechat cg.predictedPlayerEntity.voiceChatSpriteTime = 0; cg_entities[ps->clientNum].voiceChatSpriteTime = 0; // make sure we don't get any unwanted transition effects *ops = *ps; // DHM - Nerve :: After Limbo, make sure and do a CG_Respawn if (ps->clientNum == cg.clientNum) { ops->persistant[PERS_SPAWN_COUNT]--; } } if (ps->eFlags & EF_FIRING) { cg.lastFiredWeaponTime = 0; cg.weaponFireTime += cg.frametime; } else { if (cg.weaponFireTime > 500 && cg.weaponFireTime) { cg.lastFiredWeaponTime = cg.time; } cg.weaponFireTime = 0; } // damage events (player is getting wounded) if (ps->damageEvent != ops->damageEvent && ps->damageCount) { CG_DamageFeedback(ps->damageYaw, ps->damagePitch, ps->damageCount); } // respawning if (ps->persistant[PERS_SPAWN_COUNT] != ops->persistant[PERS_SPAWN_COUNT]) { CG_Respawn(); } CG_CheckLocalSounds(ps, ops); if (ps->eFlags & EF_PRONE_MOVING) { if (ps->weapon == WP_BINOCULARS && ps->eFlags & EF_ZOOMING) { trap_SendConsoleCommand("-zoom\n"); } if (!(ops->eFlags & EF_PRONE_MOVING)) { cg.proneMovingTime = cg.time; } } else if (ops->eFlags & EF_PRONE_MOVING) { cg.proneMovingTime = -cg.time; } if (!(ps->eFlags & EF_PRONE) && ops->eFlags & EF_PRONE && cg.weaponSelect == WP_MOBILE_MG42_SET) { CG_FinishWeaponChange(cg.weaponSelect, ps->nextWeapon); } // run events CG_CheckPlayerstateEvents(ps, ops); // smooth the ducking viewheight change if (ps->viewheight != ops->viewheight) { cg.duckChange = ps->viewheight - ops->viewheight; cg.duckTime = cg.time; } }
/* ================== CG_SetInitialSnapshot This will only happen on the very first snapshot, or on tourney restarts. All other times will use CG_TransitionSnapshot instead. FIXME: Also called by map_restart? ================== */ void CG_SetInitialSnapshot( snapshot_t *snap ) { char buf[64]; int i; centity_t *cent; entityState_t *state; cg.snap = snap; BG_PlayerStateToEntityState( &snap->ps, &cg_entities[ snap->ps.clientNum ].currentState, qfalse ); // sort out solid entities CG_BuildSolidList(); CG_ExecuteNewServerCommands( snap->serverCommandSequence ); trap_SendClientCommand( "fogswitch 0" ); // clear it out so the set below will take trap_Cvar_VariableStringBuffer( "r_savegameFogColor", buf, sizeof( buf ) ); trap_Cvar_Set( "r_savegameFogColor", "0" ); if ( strlen( buf ) > 1 ) { if ( !Q_stricmp( buf, "none" ) ) { trap_SendClientCommand( "fogswitch 0" ); // 'off' } else { trap_SendClientCommand( va( "fogswitch %s", buf ) ); } } else { trap_Cvar_VariableStringBuffer( "r_mapFogColor", buf, sizeof( buf ) ); trap_SendClientCommand( va( "fogswitch %s", buf ) ); } // set our local weapon selection pointer to // what the server has indicated the current weapon is CG_Respawn(); for ( i = 0 ; i < cg.snap->numEntities ; i++ ) { state = &cg.snap->entities[ i ]; cent = &cg_entities[ state->number ]; memcpy( ¢->currentState, state, sizeof( entityState_t ) ); //cent->currentState = *state; cent->interpolate = qfalse; cent->currentValid = qtrue; CG_ResetEntity( cent ); // check for events CG_CheckEvents( cent ); } // DHM - Nerve :: Set cg.clientNum so that it may be used elsewhere cg.clientNum = snap->ps.clientNum; // NERVE - SMF { static char prevmap[64] = { 0 }; char curmap[64]; trap_Cvar_VariableStringBuffer( "mapname", curmap, 64 ); if ( cgs.gametype == GT_WOLF && Q_stricmp( curmap, prevmap ) ) { strcpy( prevmap, curmap ); trap_SendConsoleCommand( "openLimboMenu\n" ); } } // -NERVE - SMF }