diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/server/episodic/npc_magnusson.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/server/episodic/npc_magnusson.cpp')
| -rw-r--r-- | game/server/episodic/npc_magnusson.cpp | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/game/server/episodic/npc_magnusson.cpp b/game/server/episodic/npc_magnusson.cpp new file mode 100644 index 0000000..3100835 --- /dev/null +++ b/game/server/episodic/npc_magnusson.cpp @@ -0,0 +1,127 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: Dr. Magnusson, a grumpy bastard who builds satellites and rockets +// at the White Forest missile silo. Instantly unlikeable, he is also +// the inventor of the Magnusson Device aka "strider buster", which +// is purported to resemble his cantelope-like head. +// +//============================================================================= + + +//----------------------------------------------------------------------------- +// Generic NPC - purely for scripted sequence work. +//----------------------------------------------------------------------------- +#include "cbase.h" +#include "npcevent.h" +#include "ai_basenpc.h" +#include "ai_hull.h" +#include "ai_baseactor.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +//----------------------------------------------------------------------------- +// NPC's Anim Events Go Here +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +class CNPC_Magnusson : public CAI_BaseActor +{ +public: + DECLARE_CLASS( CNPC_Magnusson, CAI_BaseActor ); + + void Spawn( void ); + void Precache( void ); + Class_T Classify ( void ); + void HandleAnimEvent( animevent_t *pEvent ); + int GetSoundInterests ( void ); +}; + +LINK_ENTITY_TO_CLASS( npc_magnusson, CNPC_Magnusson ); + + +//----------------------------------------------------------------------------- +// Classify - indicates this NPC's place in the +// relationship table. +//----------------------------------------------------------------------------- +Class_T CNPC_Magnusson::Classify ( void ) +{ + return CLASS_PLAYER_ALLY_VITAL; +} + + +//----------------------------------------------------------------------------- +// HandleAnimEvent - catches the NPC-specific messages +// that occur when tagged animation frames are played. +//----------------------------------------------------------------------------- +void CNPC_Magnusson::HandleAnimEvent( animevent_t *pEvent ) +{ + switch( pEvent->event ) + { + case 1: + default: + BaseClass::HandleAnimEvent( pEvent ); + break; + } +} + +//----------------------------------------------------------------------------- +// GetSoundInterests - generic NPC can't hear. +//----------------------------------------------------------------------------- +int CNPC_Magnusson::GetSoundInterests ( void ) +{ + return NULL; +} + +//----------------------------------------------------------------------------- +// Spawn +//----------------------------------------------------------------------------- +void CNPC_Magnusson::Spawn() +{ + // Allow custom model usage (mostly for monitors) + char *szModel = (char *)STRING( GetModelName() ); + if (!szModel || !*szModel) + { + szModel = "models/magnusson.mdl"; + SetModelName( AllocPooledString(szModel) ); + } + + Precache(); + SetModel( szModel ); + + BaseClass::Spawn(); + + SetHullType(HULL_HUMAN); + SetHullSizeNormal(); + + SetSolid( SOLID_BBOX ); + AddSolidFlags( FSOLID_NOT_STANDABLE ); + SetMoveType( MOVETYPE_STEP ); + SetBloodColor( BLOOD_COLOR_RED ); + m_iHealth = 8; + m_flFieldOfView = 0.5;// indicates the width of this NPC's forward view cone ( as a dotproduct result ) + m_NPCState = NPC_STATE_NONE; + + CapabilitiesAdd( bits_CAP_MOVE_GROUND | bits_CAP_OPEN_DOORS | bits_CAP_ANIMATEDFACE | bits_CAP_TURN_HEAD ); + CapabilitiesAdd( bits_CAP_FRIENDLY_DMG_IMMUNE ); + + AddEFlags( EFL_NO_DISSOLVE | EFL_NO_MEGAPHYSCANNON_RAGDOLL | EFL_NO_PHYSCANNON_INTERACTION ); + + NPCInit(); +} + +//----------------------------------------------------------------------------- +// Precache - precaches all resources this NPC needs +//----------------------------------------------------------------------------- +void CNPC_Magnusson::Precache() +{ + PrecacheModel( STRING( GetModelName() ) ); + + BaseClass::Precache(); +} + +//----------------------------------------------------------------------------- +// AI Schedules Specific to this NPC +//----------------------------------------------------------------------------- |