Esempio n. 1
0
/*
==================
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( &cent->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 ) );
	}
}
Esempio n. 2
0
/*
=========================
CG_OnPlayerWeaponChange

Called on weapon change
=========================
*/
void CG_OnPlayerWeaponChange( weapon_t oldWeapon )
{
	playerState_t *ps = &cg.snap->ps;

	// Change the HUD to match the weapon. Close the old hud first
	trap_Rocket_ShowHud( ps->weapon );

	// Rebuild weapon lists if UI is in focus.
	if ( trap_Key_GetCatcher() == KEYCATCH_UI && ps->persistant[ PERS_TEAM ] == TEAM_HUMANS )
	{
		CG_Rocket_BuildArmourySellList( "default" );
		CG_Rocket_BuildArmouryBuyList( "default" );
	}

	cg.weaponOffsetsFilter.Reset( );

	cg.predictedPlayerEntity.pe.weapon.animationNumber = -1; //force weapon lerpframe recalculation
}