// 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_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 ); } }
void CG_CheckPlayerG2Weapons( playerState_t *ps, centity_t *cent ) { if ( !ps ) { assert( !"CG_CheckPlayerG2Weapons: NULL ps" ); return; } if ( CG_IsSpectating() ) return; if ( cent->currentState.eType == ET_NPC ) { assert( !"CG_CheckPlayerG2Weapons on NPC" ); return; } // should we change the gun model on this player? if ( cent->currentState.saberInFlight ) cent->ghoul2weapon = CG_G2WeaponInstance( cent, WP_SABER ); if ( cent->currentState.eFlags & EF_DEAD ) { // no updating weapons when dead cent->ghoul2weapon = NULL; return; } if ( cent->torsoBolt ) { // got our limb cut off, no updating weapons until it's restored cent->ghoul2weapon = NULL; return; } if ( cgs.clientinfo[ps->clientNum].team == TEAM_SPECTATOR || ps->persistant[PERS_TEAM] == TEAM_SPECTATOR ) { cent->ghoul2weapon = cg_entities[ps->clientNum].ghoul2weapon = NULL; cent->weapon = cg_entities[ps->clientNum].weapon = 0; return; } if ( cent->ghoul2 && cent->ghoul2weapon != CG_G2WeaponInstance( cent, ps->weapon ) && ps->clientNum == cent->currentState.number ) //don't want spectator mode forcing one client's weapon instance over another's { CG_CopyG2WeaponInstance( cent, ps->weapon, cent->ghoul2 ); cent->ghoul2weapon = CG_G2WeaponInstance( cent, ps->weapon ); if ( cent->weapon == WP_SABER && cent->weapon != ps->weapon && !ps->saberHolstered ) { // switching away from the saber // trap->S_StartSound( cent->lerpOrigin, cent->currentState.number, CHAN_AUTO, trap->S_RegisterSound( "sound/weapons/saber/saberoffquick.wav" ) ); if ( cgs.clientinfo[ps->clientNum].saber[0].soundOff && !ps->saberHolstered ) trap->S_StartSound( ¢->lerpOrigin, cent->currentState.number, CHAN_AUTO, cgs.clientinfo[ps->clientNum].saber[0].soundOff ); if ( cgs.clientinfo[ps->clientNum].saber[1].soundOff && cgs.clientinfo[ps->clientNum].saber[1].model[0] && !ps->saberHolstered ) { trap->S_StartSound( ¢->lerpOrigin, cent->currentState.number, CHAN_AUTO, cgs.clientinfo[ps->clientNum].saber[1].soundOff ); } } else if ( ps->weapon == WP_SABER && cent->weapon != ps->weapon && !cent->saberWasInFlight ) { // switching to the saber // trap->S_StartSound( cent->lerpOrigin, cent->currentState.number, CHAN_AUTO, trap->S_RegisterSound( "sound/weapons/saber/saberon.wav" ) ); if ( cgs.clientinfo[ps->clientNum].saber[0].soundOn ) trap->S_StartSound( ¢->lerpOrigin, cent->currentState.number, CHAN_AUTO, cgs.clientinfo[ps->clientNum].saber[0].soundOn ); if ( cgs.clientinfo[ps->clientNum].saber[1].soundOn ) trap->S_StartSound( ¢->lerpOrigin, cent->currentState.number, CHAN_AUTO, cgs.clientinfo[ps->clientNum].saber[1].soundOn ); BG_SI_SetDesiredLength( &cgs.clientinfo[ps->clientNum].saber[0], 0, -1 ); BG_SI_SetDesiredLength( &cgs.clientinfo[ps->clientNum].saber[1], 0, -1 ); } cent->weapon = ps->weapon; } }