diff options
| author | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:31:46 -0800 |
|---|---|---|
| committer | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:46:31 -0800 |
| commit | f56bb35301836e56582a575a75864392a0177875 (patch) | |
| tree | de61ddd39de3e7df52759711950b4c288592f0dc /mp/src/game/server/sdk/sdk_client.cpp | |
| parent | Mark some more files as text. (diff) | |
| download | source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip | |
Fix line endings. WHAMMY.
Diffstat (limited to 'mp/src/game/server/sdk/sdk_client.cpp')
| -rw-r--r-- | mp/src/game/server/sdk/sdk_client.cpp | 328 |
1 files changed, 164 insertions, 164 deletions
diff --git a/mp/src/game/server/sdk/sdk_client.cpp b/mp/src/game/server/sdk/sdk_client.cpp index d7329758..7b4e6986 100644 --- a/mp/src/game/server/sdk/sdk_client.cpp +++ b/mp/src/game/server/sdk/sdk_client.cpp @@ -1,164 +1,164 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-// $NoKeywords: $
-//
-//=============================================================================//
-/*
-
-===== tf_client.cpp ========================================================
-
- HL2 client/server game specific stuff
-
-*/
-
-#include "cbase.h"
-#include "player.h"
-#include "gamerules.h"
-#include "entitylist.h"
-#include "physics.h"
-#include "game.h"
-#include "ai_network.h"
-#include "ai_node.h"
-#include "ai_hull.h"
-#include "shake.h"
-#include "player_resource.h"
-#include "engine/IEngineSound.h"
-#include "sdk_player.h"
-#include "sdk_gamerules.h"
-#include "tier0/vprof.h"
-#include "sdk_bot_temp.h"
-
-// memdbgon must be the last include file in a .cpp file!!!
-#include "tier0/memdbgon.h"
-
-
-extern CBaseEntity *FindPickerEntity( CBasePlayer *pPlayer );
-
-extern bool g_fGameOver;
-
-
-void FinishClientPutInServer( CSDKPlayer *pPlayer )
-{
- pPlayer->InitialSpawn();
- pPlayer->Spawn();
-
- if (!pPlayer->IsBot())
- {
- // When the player first joins the server, they
- pPlayer->m_takedamage = DAMAGE_YES;
- pPlayer->pl.deadflag = false;
- pPlayer->m_lifeState = LIFE_ALIVE;
- pPlayer->RemoveEffects( EF_NODRAW );
- pPlayer->ChangeTeam( TEAM_UNASSIGNED );
- pPlayer->SetThink( NULL );
- }
-
- char sName[128];
- Q_strncpy( sName, pPlayer->GetPlayerName(), sizeof( sName ) );
-
- // First parse the name and remove any %'s
- for ( char *pApersand = sName; pApersand != NULL && *pApersand != 0; pApersand++ )
- {
- // Replace it with a space
- if ( *pApersand == '%' )
- *pApersand = ' ';
- }
-
- // notify other clients of player joining the game
- UTIL_ClientPrintAll( HUD_PRINTNOTIFY, "#Game_connected", sName[0] != 0 ? sName : "<unconnected>" );
-}
-
-/*
-===========
-ClientPutInServer
-
-called each time a player is spawned into the game
-============
-*/
-void ClientPutInServer( edict_t *pEdict, const char *playername )
-{
- // Allocate a CBaseTFPlayer for pev, and call spawn
- CSDKPlayer *pPlayer = CSDKPlayer::CreatePlayer( "player", pEdict );
- pPlayer->SetPlayerName( playername );
-}
-
-
-void ClientActive( edict_t *pEdict, bool bLoadGame )
-{
- // Can't load games in CS!
- Assert( !bLoadGame );
-
- CSDKPlayer *pPlayer = ToSDKPlayer( CBaseEntity::Instance( pEdict ) );
- FinishClientPutInServer( pPlayer );
-}
-
-
-/*
-===============
-const char *GetGameDescription()
-
-Returns the descriptive name of this .dll. E.g., Half-Life, or Team Fortress 2
-===============
-*/
-const char *GetGameDescription()
-{
- if ( g_pGameRules ) // this function may be called before the world has spawned, and the game rules initialized
- return g_pGameRules->GetGameDescription();
- else
- return "CounterStrike";
-}
-
-
-//-----------------------------------------------------------------------------
-// Purpose: Precache game-specific models & sounds
-//-----------------------------------------------------------------------------
-void ClientGamePrecache( void )
-{
- // Materials used by the client effects
- CBaseEntity::PrecacheModel( "sprites/white.vmt" );
- CBaseEntity::PrecacheModel( "sprites/physbeam.vmt" );
-}
-
-
-// called by ClientKill and DeadThink
-void respawn( CBaseEntity *pEdict, bool fCopyCorpse )
-{
- if (gpGlobals->coop || gpGlobals->deathmatch)
- {
- if ( fCopyCorpse )
- {
- // make a copy of the dead body for appearances sake
- dynamic_cast< CBasePlayer* >( pEdict )->CreateCorpse();
- }
-
- // respawn player
- pEdict->Spawn();
- }
- else
- { // restart the entire server
- engine->ServerCommand("reload\n");
- }
-}
-
-void GameStartFrame( void )
-{
- VPROF( "GameStartFrame" );
-
- if ( g_pGameRules )
- g_pGameRules->Think();
-
- if ( g_fGameOver )
- return;
-
- gpGlobals->teamplay = teamplay.GetInt() ? true : false;
-}
-
-//=========================================================
-// instantiate the proper game rules object
-//=========================================================
-void InstallGameRules()
-{
- CreateGameRulesObject( "CSDKGameRules" );
-}
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +/* + +===== tf_client.cpp ======================================================== + + HL2 client/server game specific stuff + +*/ + +#include "cbase.h" +#include "player.h" +#include "gamerules.h" +#include "entitylist.h" +#include "physics.h" +#include "game.h" +#include "ai_network.h" +#include "ai_node.h" +#include "ai_hull.h" +#include "shake.h" +#include "player_resource.h" +#include "engine/IEngineSound.h" +#include "sdk_player.h" +#include "sdk_gamerules.h" +#include "tier0/vprof.h" +#include "sdk_bot_temp.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + + +extern CBaseEntity *FindPickerEntity( CBasePlayer *pPlayer ); + +extern bool g_fGameOver; + + +void FinishClientPutInServer( CSDKPlayer *pPlayer ) +{ + pPlayer->InitialSpawn(); + pPlayer->Spawn(); + + if (!pPlayer->IsBot()) + { + // When the player first joins the server, they + pPlayer->m_takedamage = DAMAGE_YES; + pPlayer->pl.deadflag = false; + pPlayer->m_lifeState = LIFE_ALIVE; + pPlayer->RemoveEffects( EF_NODRAW ); + pPlayer->ChangeTeam( TEAM_UNASSIGNED ); + pPlayer->SetThink( NULL ); + } + + char sName[128]; + Q_strncpy( sName, pPlayer->GetPlayerName(), sizeof( sName ) ); + + // First parse the name and remove any %'s + for ( char *pApersand = sName; pApersand != NULL && *pApersand != 0; pApersand++ ) + { + // Replace it with a space + if ( *pApersand == '%' ) + *pApersand = ' '; + } + + // notify other clients of player joining the game + UTIL_ClientPrintAll( HUD_PRINTNOTIFY, "#Game_connected", sName[0] != 0 ? sName : "<unconnected>" ); +} + +/* +=========== +ClientPutInServer + +called each time a player is spawned into the game +============ +*/ +void ClientPutInServer( edict_t *pEdict, const char *playername ) +{ + // Allocate a CBaseTFPlayer for pev, and call spawn + CSDKPlayer *pPlayer = CSDKPlayer::CreatePlayer( "player", pEdict ); + pPlayer->SetPlayerName( playername ); +} + + +void ClientActive( edict_t *pEdict, bool bLoadGame ) +{ + // Can't load games in CS! + Assert( !bLoadGame ); + + CSDKPlayer *pPlayer = ToSDKPlayer( CBaseEntity::Instance( pEdict ) ); + FinishClientPutInServer( pPlayer ); +} + + +/* +=============== +const char *GetGameDescription() + +Returns the descriptive name of this .dll. E.g., Half-Life, or Team Fortress 2 +=============== +*/ +const char *GetGameDescription() +{ + if ( g_pGameRules ) // this function may be called before the world has spawned, and the game rules initialized + return g_pGameRules->GetGameDescription(); + else + return "CounterStrike"; +} + + +//----------------------------------------------------------------------------- +// Purpose: Precache game-specific models & sounds +//----------------------------------------------------------------------------- +void ClientGamePrecache( void ) +{ + // Materials used by the client effects + CBaseEntity::PrecacheModel( "sprites/white.vmt" ); + CBaseEntity::PrecacheModel( "sprites/physbeam.vmt" ); +} + + +// called by ClientKill and DeadThink +void respawn( CBaseEntity *pEdict, bool fCopyCorpse ) +{ + if (gpGlobals->coop || gpGlobals->deathmatch) + { + if ( fCopyCorpse ) + { + // make a copy of the dead body for appearances sake + dynamic_cast< CBasePlayer* >( pEdict )->CreateCorpse(); + } + + // respawn player + pEdict->Spawn(); + } + else + { // restart the entire server + engine->ServerCommand("reload\n"); + } +} + +void GameStartFrame( void ) +{ + VPROF( "GameStartFrame" ); + + if ( g_pGameRules ) + g_pGameRules->Think(); + + if ( g_fGameOver ) + return; + + gpGlobals->teamplay = teamplay.GetInt() ? true : false; +} + +//========================================================= +// instantiate the proper game rules object +//========================================================= +void InstallGameRules() +{ + CreateGameRulesObject( "CSDKGameRules" ); +} |