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/hl2/hl2_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/hl2/hl2_client.cpp')
| -rw-r--r-- | mp/src/game/server/hl2/hl2_client.cpp | 354 |
1 files changed, 177 insertions, 177 deletions
diff --git a/mp/src/game/server/hl2/hl2_client.cpp b/mp/src/game/server/hl2/hl2_client.cpp index 122c3e44..6125de82 100644 --- a/mp/src/game/server/hl2/hl2_client.cpp +++ b/mp/src/game/server/hl2/hl2_client.cpp @@ -1,177 +1,177 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-// $NoKeywords: $
-//
-//=============================================================================//
-/*
-
-===== tf_client.cpp ========================================================
-
- HL2 client/server game specific stuff
-
-*/
-
-#include "cbase.h"
-#include "hl2_player.h"
-#include "hl2_gamerules.h"
-#include "gamerules.h"
-#include "teamplay_gamerules.h"
-#include "entitylist.h"
-#include "physics.h"
-#include "game.h"
-#include "player_resource.h"
-#include "engine/IEngineSound.h"
-
-#include "tier0/vprof.h"
-
-// memdbgon must be the last include file in a .cpp file!!!
-#include "tier0/memdbgon.h"
-
-void Host_Say( edict_t *pEdict, bool teamonly );
-
-extern CBaseEntity* FindPickerEntityClass( CBasePlayer *pPlayer, char *classname );
-extern bool g_fGameOver;
-
-/*
-===========
-ClientPutInServer
-
-called each time a player is spawned into the game
-============
-*/
-void ClientPutInServer( edict_t *pEdict, const char *playername )
-{
- // Allocate a CBasePlayer for pev, and call spawn
- CHL2_Player *pPlayer = CHL2_Player::CreatePlayer( "player", pEdict );
- pPlayer->SetPlayerName( playername );
-}
-
-
-void ClientActive( edict_t *pEdict, bool bLoadGame )
-{
- CHL2_Player *pPlayer = dynamic_cast< CHL2_Player* >( CBaseEntity::Instance( pEdict ) );
- Assert( pPlayer );
-
- if ( !pPlayer )
- {
- return;
- }
-
- pPlayer->InitialSpawn();
-
- if ( !bLoadGame )
- {
- pPlayer->Spawn();
- }
-}
-
-
-/*
-===============
-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 "Half-Life 2";
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Given a player and optional name returns the entity of that
-// classname that the player is nearest facing
-//
-// Input :
-// Output :
-//-----------------------------------------------------------------------------
-CBaseEntity* FindEntity( edict_t *pEdict, char *classname)
-{
- // If no name was given set bits based on the picked
- if (FStrEq(classname,""))
- {
- return (FindPickerEntityClass( static_cast<CBasePlayer*>(GetContainingEntity(pEdict)), classname ));
- }
- return NULL;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Precache game-specific models & sounds
-//-----------------------------------------------------------------------------
-void ClientGamePrecache( void )
-{
- CBaseEntity::PrecacheModel("models/player.mdl");
- CBaseEntity::PrecacheModel( "models/gibs/agibs.mdl" );
- CBaseEntity::PrecacheModel ("models/weapons/v_hands.mdl");
-
- CBaseEntity::PrecacheScriptSound( "HUDQuickInfo.LowAmmo" );
- CBaseEntity::PrecacheScriptSound( "HUDQuickInfo.LowHealth" );
-
- CBaseEntity::PrecacheScriptSound( "FX_AntlionImpact.ShellImpact" );
- CBaseEntity::PrecacheScriptSound( "Missile.ShotDown" );
- CBaseEntity::PrecacheScriptSound( "Bullets.DefaultNearmiss" );
- CBaseEntity::PrecacheScriptSound( "Bullets.GunshipNearmiss" );
- CBaseEntity::PrecacheScriptSound( "Bullets.StriderNearmiss" );
-
- CBaseEntity::PrecacheScriptSound( "Geiger.BeepHigh" );
- CBaseEntity::PrecacheScriptSound( "Geiger.BeepLow" );
-}
-
-
-// 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
- ((CHL2_Player *)pEdict)->CreateCorpse();
- }
-
- // respawn player
- pEdict->Spawn();
- }
- else
- { // restart the entire server
- engine->ServerCommand("reload\n");
- }
-}
-
-void GameStartFrame( void )
-{
- VPROF("GameStartFrame()");
- if ( g_fGameOver )
- return;
-
- gpGlobals->teamplay = (teamplay.GetInt() != 0);
-}
-
-#ifdef HL2_EPISODIC
-extern ConVar gamerules_survival;
-#endif
-
-//=========================================================
-// instantiate the proper game rules object
-//=========================================================
-void InstallGameRules()
-{
-#ifdef HL2_EPISODIC
- if ( gamerules_survival.GetBool() )
- {
- // Survival mode
- CreateGameRulesObject( "CHalfLife2Survival" );
- }
- else
-#endif
- {
- // generic half-life
- CreateGameRulesObject( "CHalfLife2" );
- }
-}
-
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +/* + +===== tf_client.cpp ======================================================== + + HL2 client/server game specific stuff + +*/ + +#include "cbase.h" +#include "hl2_player.h" +#include "hl2_gamerules.h" +#include "gamerules.h" +#include "teamplay_gamerules.h" +#include "entitylist.h" +#include "physics.h" +#include "game.h" +#include "player_resource.h" +#include "engine/IEngineSound.h" + +#include "tier0/vprof.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +void Host_Say( edict_t *pEdict, bool teamonly ); + +extern CBaseEntity* FindPickerEntityClass( CBasePlayer *pPlayer, char *classname ); +extern bool g_fGameOver; + +/* +=========== +ClientPutInServer + +called each time a player is spawned into the game +============ +*/ +void ClientPutInServer( edict_t *pEdict, const char *playername ) +{ + // Allocate a CBasePlayer for pev, and call spawn + CHL2_Player *pPlayer = CHL2_Player::CreatePlayer( "player", pEdict ); + pPlayer->SetPlayerName( playername ); +} + + +void ClientActive( edict_t *pEdict, bool bLoadGame ) +{ + CHL2_Player *pPlayer = dynamic_cast< CHL2_Player* >( CBaseEntity::Instance( pEdict ) ); + Assert( pPlayer ); + + if ( !pPlayer ) + { + return; + } + + pPlayer->InitialSpawn(); + + if ( !bLoadGame ) + { + pPlayer->Spawn(); + } +} + + +/* +=============== +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 "Half-Life 2"; +} + +//----------------------------------------------------------------------------- +// Purpose: Given a player and optional name returns the entity of that +// classname that the player is nearest facing +// +// Input : +// Output : +//----------------------------------------------------------------------------- +CBaseEntity* FindEntity( edict_t *pEdict, char *classname) +{ + // If no name was given set bits based on the picked + if (FStrEq(classname,"")) + { + return (FindPickerEntityClass( static_cast<CBasePlayer*>(GetContainingEntity(pEdict)), classname )); + } + return NULL; +} + +//----------------------------------------------------------------------------- +// Purpose: Precache game-specific models & sounds +//----------------------------------------------------------------------------- +void ClientGamePrecache( void ) +{ + CBaseEntity::PrecacheModel("models/player.mdl"); + CBaseEntity::PrecacheModel( "models/gibs/agibs.mdl" ); + CBaseEntity::PrecacheModel ("models/weapons/v_hands.mdl"); + + CBaseEntity::PrecacheScriptSound( "HUDQuickInfo.LowAmmo" ); + CBaseEntity::PrecacheScriptSound( "HUDQuickInfo.LowHealth" ); + + CBaseEntity::PrecacheScriptSound( "FX_AntlionImpact.ShellImpact" ); + CBaseEntity::PrecacheScriptSound( "Missile.ShotDown" ); + CBaseEntity::PrecacheScriptSound( "Bullets.DefaultNearmiss" ); + CBaseEntity::PrecacheScriptSound( "Bullets.GunshipNearmiss" ); + CBaseEntity::PrecacheScriptSound( "Bullets.StriderNearmiss" ); + + CBaseEntity::PrecacheScriptSound( "Geiger.BeepHigh" ); + CBaseEntity::PrecacheScriptSound( "Geiger.BeepLow" ); +} + + +// 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 + ((CHL2_Player *)pEdict)->CreateCorpse(); + } + + // respawn player + pEdict->Spawn(); + } + else + { // restart the entire server + engine->ServerCommand("reload\n"); + } +} + +void GameStartFrame( void ) +{ + VPROF("GameStartFrame()"); + if ( g_fGameOver ) + return; + + gpGlobals->teamplay = (teamplay.GetInt() != 0); +} + +#ifdef HL2_EPISODIC +extern ConVar gamerules_survival; +#endif + +//========================================================= +// instantiate the proper game rules object +//========================================================= +void InstallGameRules() +{ +#ifdef HL2_EPISODIC + if ( gamerules_survival.GetBool() ) + { + // Survival mode + CreateGameRulesObject( "CHalfLife2Survival" ); + } + else +#endif + { + // generic half-life + CreateGameRulesObject( "CHalfLife2" ); + } +} + |