/* =============== CG_TransitionEntity cent->nextState is moved to cent->currentState and events are fired =============== */ static void CG_TransitionEntity( centity_t *cent ) { cent->currentState = cent->nextState; cent->currentValid = qtrue; // reset if the entity wasn't in the last frame or was teleported if ( !cent->interpolate ) { CG_ResetEntity( cent ); } else { //mme int newHeight; int maxs = ((cent->currentState.solid >> 16) & 255) - 32; if ( maxs > 16 ) newHeight = DEFAULT_VIEWHEIGHT; else newHeight = CROUCH_VIEWHEIGHT; if ( newHeight != cent->pe.viewHeight ) { cent->pe.duckTime = cg.snap->serverTime; cent->pe.duckChange = newHeight - cent->pe.viewHeight; cent->pe.viewHeight = newHeight; } } // clear the next state. if will be set by the next CG_SetNextSnap cent->interpolate = qfalse; // 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; 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 ) ); } }
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; }
static void CG_TransitionEntity( centity_t *cent ) { frameInfo_t *fi0, *fi1; tiki_t *tiki0,*tiki1; tikiAnim_t *a0, *a1; int f0, f1; int i,j; tiki0 = cgs.gameTIKIs[cent->currentState.modelindex]; tiki1 = cgs.gameTIKIs[cent->nextState.modelindex]; if(tiki0 || tiki1) { // su44: It should be placed somewhere else soon fi0 = cent->currentState.frameInfo; fi1 = cent->nextState.frameInfo; for(i = 0; i < 16; i++,fi0++,fi1++) { if(fi0->weight && tiki0 && fi0->index < tiki0->numAnims) { a0 = tiki0->anims[fi0->index]; f0 = TIKI_FrameNumForTime(tiki0,fi0->index,fi0->time); if(fi1->weight && tiki1 && fi1->index < tiki1->numAnims) { if(fi0->index != fi1->index || tiki0 != tiki1) { a1 = tiki1->anims[fi1->index]; CG_ExecuteFrameCommands(cent,a0,TIKI_FRAME_EXIT); CG_ExecuteFrameCommands(cent,a1,TIKI_FRAME_ENTRY); } else { f1 = TIKI_FrameNumForTime(tiki1,fi1->index,fi1->time); if(f1 > f0) { CG_ExecuteFramesCommands(cent,a0,f0,f1); } else { CG_ExecuteFramesCommands(cent,a0,f1,f0); } } } else { // anim has stopped //CG_ExecuteFramesCommands(cent,anim,fi0-> CG_ExecuteFrameCommands(cent,a0,TIKI_FRAME_EXIT); } } else if(fi1->weight && tiki1 && fi1->index < tiki1->numAnims) { // anim is starting a1 = tiki1->anims[fi1->index]; f1 = TIKI_FrameNumForTime(tiki1,fi1->index,fi1->time); CG_ExecuteFrameCommands(cent,a1,TIKI_FRAME_ENTRY); } } } cent->currentState = cent->nextState; cent->currentValid = qtrue; // reset if the entity wasn't in the last frame or was teleported if ( !cent->interpolate ) { CG_ResetEntity( cent ); } // clear the next state. if will be set by the next CG_SetNextSnap cent->interpolate = qfalse; }
// cent->nextState is moved to cent->currentState and events are fired static void CG_TransitionEntity( centity_t *cent ) { cent->currentState = cent->nextState; cent->currentValid = qtrue; // reset if the entity wasn't in the last frame or was teleported if ( !cent->interpolate ) CG_ResetEntity( cent ); // clear the next state. if will be set by the next CG_SetNextSnap cent->interpolate = qfalse; // 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; 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_TransitionEntity cent->nextState is moved to cent->currentState and events are fired =============== */ static void CG_TransitionEntity( centity_t *cent ) { // Ridah, update the fireDir if it's on fire if ( CG_EntOnFire( cent ) ) { vec3_t newDir, newPos, oldPos; float adjust; // BG_EvaluateTrajectory( ¢->nextState.pos, cg.snap->serverTime, newPos ); BG_EvaluateTrajectory( ¢->currentState.pos, cg.snap->serverTime, oldPos ); // update the fireRiseDir VectorSubtract( oldPos, newPos, newDir ); // fire should go upwards if travelling slow newDir[2] += 2; if ( VectorNormalize( newDir ) < 1 ) { VectorClear( newDir ); newDir[2] = 1; } // now move towards the newDir adjust = 0.3; VectorMA( cent->fireRiseDir, adjust, newDir, cent->fireRiseDir ); if ( VectorNormalize( cent->fireRiseDir ) <= 0.1 ) { VectorCopy( newDir, cent->fireRiseDir ); } } //----(SA) the ent lost or gained some part(s), do any necessary effects //TODO: check for ai first if ( cent->currentState.dmgFlags != cent->nextState.dmgFlags ) { CG_AttachedPartChange( cent ); } cent->currentState = cent->nextState; cent->currentValid = qtrue; // reset if the entity wasn't in the last frame or was teleported if ( !cent->interpolate ) { CG_ResetEntity( cent ); } // clear the next state. if will be set by the next CG_SetNextSnap cent->interpolate = qfalse; // check for events CG_CheckEvents( cent ); }
/* ================== 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_TransitionEntity cent->nextState is moved to cent->currentState and events are fired =============== */ static void CG_TransitionEntity( centity_t *cent ) { cent->currentState = cent->nextState; 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 ); } // reset if the entity wasn't in the last frame or was teleported if ( !cent->interpolate ) { CG_ResetEntity( cent ); } // clear the next state. if will be set by the next CG_SetNextSnap cent->interpolate = qfalse; // check for events CG_CheckEvents( cent ); }
/* =============== CG_TransitionEntity cent->nextState is moved to cent->currentState and events are fired =============== */ static void CG_TransitionEntity( centity_t *cent ) { lua_State *L = GetClientLuaState(); cent->currentState = cent->nextState; cent->currentValid = qtrue; // reset if the entity wasn't in the last frame or was teleported if ( !cent->interpolate ) { CG_ResetEntity( 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; } } // clear the next state. if will be set by the next CG_SetNextSnap cent->interpolate = qfalse; // 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 ) { 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 }
/* =================== CG_TransitionSnapshot The transition point from snap to nextSnap has passed =================== */ static void CG_TransitionSnapshot( void ) { centity_t *cent; snapshot_t *oldFrame; int i, id; if ( !cg.snap ) { CG_Error( "CG_TransitionSnapshot: NULL cg.snap" ); } if ( !cg.nextSnap ) { CG_Error( "CG_TransitionSnapshot: NULL cg.nextSnap" ); } // execute any server string commands before transitioning entities CG_ExecuteNewServerCommands( cg.nextSnap->serverCommandSequence ); // if we had a map_restart, set everthing with initial if ( !(cg.snap) || !(cg.nextSnap) ) { return; } // rain - I hate doing things like this for enums. Oh well. memset(&oldValid, 0, sizeof(oldValid)); // clear the currentValid flag for all entities in the existing snapshot for ( i = 0 ; i < cg.snap->numEntities ; i++ ) { cent = &cg_entities[ cg.snap->entities[ i ].number ]; cent->currentValid = qfalse; oldValid[cg.snap->entities[i].number] = qtrue; } // OSP -- check for MV updates from new snapshot info #ifdef MV_SUPPORT if(cg.snap->ps.powerups[PW_MVCLIENTLIST] != cg.mvClientList) { CG_mvProcessClientList(); } #endif // move nextSnap to snap and do the transitions oldFrame = cg.snap; cg.snap = cg.nextSnap; if( cg.snap->ps.clientNum == cg.clientNum ) { if( cg.xp < cg.snap->ps.stats[STAT_XP] ) { cg.xpChangeTime = cg.time; } cg.xp = cg.snap->ps.stats[STAT_XP]; } BG_PlayerStateToEntityState( &cg.snap->ps, &cg_entities[ cg.snap->ps.clientNum ].currentState, qfalse ); cg_entities[ cg.snap->ps.clientNum ].interpolate = qfalse; for ( i = 0 ; i < cg.snap->numEntities ; i++ ) { id = cg.snap->entities[ i ].number; CG_TransitionEntity( &cg_entities[ id ] ); // rain - #374 - ent doesn't exist in this frame, reset it. // this is to fix the silent landmines bug, which is caused // by a stale miscTime in the cent if (cg_entities[id].currentValid == qfalse && oldValid[id] == qtrue) { CG_ResetEntity(&cg_entities[id]); } if(cg.mvTotalClients > 0 && CG_mvMergedClientLocate(id)) { CG_mvUpdateClientInfo(id); } } if(cg.mvTotalClients > 0) { CG_mvTransitionPlayerState(&cg.snap->ps); } cg.nextSnap = NULL; // check for playerstate transition events if ( oldFrame ) { playerState_t *ops, *ps; ops = &oldFrame->ps; ps = &cg.snap->ps; // teleporting checks are irrespective of prediction if ( ( ps->eFlags ^ ops->eFlags ) & EF_TELEPORT_BIT ) { cg.thisFrameTeleport = qtrue; // will be cleared by prediction code } // if we are not doing client side movement prediction for any // reason, then the client events and view changes will be issued now if ( cg.demoPlayback || (cg.snap->ps.pm_flags & PMF_FOLLOW) || cg_nopredict.integer #ifdef ALLOW_GSYNC || cg_synchronousClients.integer #endif // ALLOW_GSYNC ) { CG_TransitionPlayerState( ps, ops ); } } }
/* ================== 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_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_TransitionSnapshot The transition point from snap to nextSnap has passed =================== */ static void CG_TransitionSnapshot(void) { snapshot_t *oldFrame; int i; if (!cg.snap) { CG_Error("CG_TransitionSnapshot: NULL cg.snap"); } if (!cg.nextSnap) { CG_Error("CG_TransitionSnapshot: NULL cg.nextSnap"); } // execute any server string commands before transitioning entities CG_ExecuteNewServerCommands(cg.nextSnap->serverCommandSequence); // if we had a map_restart, set everthing with initial if (!cg.snap || !cg.nextSnap) { return; } // rain - I hate doing things like this for enums. Oh well. memset(&oldValid, 0, sizeof (oldValid)); // clear the currentValid flag for all entities in the existing snapshot for (i = 0 ; i < cg.snap->numEntities ; ++i) { centity_t *cent = &cg_entities[cg.snap->entities[i].number]; cent->currentValid = qfalse; oldValid[cg.snap->entities[i].number] = qtrue; } // move nextSnap to snap and do the transitions oldFrame = cg.snap; cg.snap = cg.nextSnap; BG_PlayerStateToEntityState(&cg.snap->ps, &cg_entities[cg.snap->ps.clientNum].currentState, qfalse); cg_entities[cg.snap->ps.clientNum].interpolate = qfalse; for (i = 0 ; i < cg.snap->numEntities ; ++i) { int id = cg.snap->entities[i].number; CG_TransitionEntity(&cg_entities[id]); // rain - #374 - ent doesn't exist in this frame, reset it. // this is to fix the silent landmines bug, which is caused // by a stale miscTime in the cent if (cg_entities[id].currentValid == qfalse && oldValid[id] == qtrue) { CG_ResetEntity(&cg_entities[id]); } } cg.nextSnap = NULL; // check for playerstate transition events if (oldFrame) { playerState_t *ops, *ps; ops = &oldFrame->ps; ps = &cg.snap->ps; // teleporting checks are irrespective of prediction if ((ps->eFlags ^ ops->eFlags) & EF_TELEPORT_BIT) { cg.thisFrameTeleport = qtrue; // will be cleared by prediction code } // if we are not doing client side movement prediction for any // reason, then the client events and view changes will be issued now if (cg.demoPlayback || (cg.snap->ps.pm_flags & PMF_FOLLOW) || cg_nopredict.integer) { CG_TransitionPlayerState(ps, ops); } } }
/* ================== 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); } } }