diff options
Diffstat (limited to 'game/client/tf/bot_npc')
| -rw-r--r-- | game/client/tf/bot_npc/c_bot_npc.cpp | 120 | ||||
| -rw-r--r-- | game/client/tf/bot_npc/c_bot_npc.h | 42 | ||||
| -rw-r--r-- | game/client/tf/bot_npc/c_bot_npc_minion.cpp | 115 | ||||
| -rw-r--r-- | game/client/tf/bot_npc/c_bot_npc_minion.h | 41 | ||||
| -rw-r--r-- | game/client/tf/bot_npc/map_entities/c_tf_bot_hint_engineer_nest.cpp | 77 | ||||
| -rw-r--r-- | game/client/tf/bot_npc/map_entities/c_tf_bot_hint_engineer_nest.h | 32 |
6 files changed, 427 insertions, 0 deletions
diff --git a/game/client/tf/bot_npc/c_bot_npc.cpp b/game/client/tf/bot_npc/c_bot_npc.cpp new file mode 100644 index 0000000..f71d051 --- /dev/null +++ b/game/client/tf/bot_npc/c_bot_npc.cpp @@ -0,0 +1,120 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// c_bot_npc.cpp + +#include "cbase.h" +#include "NextBot/C_NextBot.h" +#include "c_bot_npc.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +#undef NextBot + +//----------------------------------------------------------------------------- +IMPLEMENT_CLIENTCLASS_DT( C_BotNPC, DT_BotNPC, CBotNPC ) + + RecvPropEHandle( RECVINFO( m_laserTarget ) ), + RecvPropBool( RECVINFO( m_isNuking ) ), + +END_RECV_TABLE() + + +//----------------------------------------------------------------------------- +C_BotNPC::C_BotNPC() +{ +} + + +//----------------------------------------------------------------------------- +C_BotNPC::~C_BotNPC() +{ + if ( m_laserBeamEffect ) + { + ParticleProp()->StopEmissionAndDestroyImmediately( m_laserBeamEffect ); + m_laserBeamEffect = NULL; + } + + if ( m_nukeEffect ) + { + ParticleProp()->StopEmissionAndDestroyImmediately( m_nukeEffect ); + m_nukeEffect = NULL; + } +} + + +//----------------------------------------------------------------------------- +void C_BotNPC::Spawn( void ) +{ + BaseClass::Spawn(); + + m_vecViewOffset = Vector( 0, 0, 180.0f ); + + SetNextClientThink( CLIENT_THINK_ALWAYS ); +} + + +//----------------------------------------------------------------------------- +void C_BotNPC::ClientThink( void ) +{ + if ( m_laserTarget ) + { + if ( !m_laserBeamEffect ) + { + m_laserBeamEffect = ParticleProp()->Create( "laser_sight_beam", PATTACH_POINT_FOLLOW, LookupAttachment( "head" ) ); + } + + if ( m_laserBeamEffect ) + { + m_laserBeamEffect->SetSortOrigin( m_laserBeamEffect->GetRenderOrigin() ); + m_laserBeamEffect->SetControlPoint( 2, Vector( 0, 255, 0 ) ); + m_laserBeamEffect->SetControlPoint( 1, m_laserTarget->WorldSpaceCenter() ); + } + } + else + { + // shut off the laser + if ( m_laserBeamEffect ) + { + ParticleProp()->StopEmissionAndDestroyImmediately( m_laserBeamEffect ); + m_laserBeamEffect = NULL; + } + } + + if ( m_isNuking ) + { + if ( !m_nukeEffect ) + { + m_nukeEffect = ParticleProp()->Create( "charge_up", PATTACH_POINT_FOLLOW, LookupAttachment( "head" ) ); + } + } + else + { + if ( m_nukeEffect ) + { + ParticleProp()->StopEmissionAndDestroyImmediately( m_nukeEffect ); + m_nukeEffect = NULL; + } + } +} + + +//----------------------------------------------------------------------------- +// Return the origin for player observers tracking this target +Vector C_BotNPC::GetObserverCamOrigin( void ) +{ + return EyePosition(); +} + + +//----------------------------------------------------------------------------- +void C_BotNPC::FireEvent( const Vector& origin, const QAngle& angles, int event, const char *options ) +{ + if ( event == 7001 ) + { + EmitSound( "RobotBoss.Footstep" ); + +/* + ParticleProp()->Create( "halloween_boss_foot_impact", PATTACH_ABSORIGIN, 0 ); +*/ + } +} diff --git a/game/client/tf/bot_npc/c_bot_npc.h b/game/client/tf/bot_npc/c_bot_npc.h new file mode 100644 index 0000000..66609da --- /dev/null +++ b/game/client/tf/bot_npc/c_bot_npc.h @@ -0,0 +1,42 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +#ifndef C_BOT_NPC_H +#define C_BOT_NPC_H + +#include "c_ai_basenpc.h" + + +//-------------------------------------------------------------------------------------------------------- +/** + * The client-side implementation of Bot NPC + */ +class C_BotNPC : public C_NextBotCombatCharacter +{ +public: + DECLARE_CLASS( C_BotNPC, C_NextBotCombatCharacter ); + DECLARE_CLIENTCLASS(); + + C_BotNPC(); + virtual ~C_BotNPC(); + +public: + virtual void Spawn( void ); + virtual bool IsNextBot() { return true; } + + virtual Vector GetObserverCamOrigin( void ); // Return the origin for player observers tracking this target + + virtual void FireEvent( const Vector& origin, const QAngle& angles, int event, const char *options ); + + virtual void ClientThink(); + +private: + C_BotNPC( const C_BotNPC & ); // not defined, not accessible + + CNetworkHandle( C_BaseEntity, m_laserTarget ); + HPARTICLEFFECT m_laserBeamEffect; + + CNetworkVar( bool, m_isNuking ); + HPARTICLEFFECT m_nukeEffect; +}; + + +#endif // C_BOT_NPC_H diff --git a/game/client/tf/bot_npc/c_bot_npc_minion.cpp b/game/client/tf/bot_npc/c_bot_npc_minion.cpp new file mode 100644 index 0000000..4302b7a --- /dev/null +++ b/game/client/tf/bot_npc/c_bot_npc_minion.cpp @@ -0,0 +1,115 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// c_bot_npc_minion.cpp + +#include "cbase.h" +#include "NextBot/C_NextBot.h" +#include "c_bot_npc_minion.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +#undef NextBot + +//----------------------------------------------------------------------------- +IMPLEMENT_CLIENTCLASS_DT( C_BotNPCMinion, DT_BotNPCMinion, CBotNPCMinion ) + + RecvPropEHandle( RECVINFO( m_stunTarget ) ), + +END_RECV_TABLE() + + +//----------------------------------------------------------------------------- +C_BotNPCMinion::C_BotNPCMinion() +{ + m_stunEffect = NULL; + m_stunBeamEffect = NULL; + m_scanEffect = NULL; +} + + +//----------------------------------------------------------------------------- +C_BotNPCMinion::~C_BotNPCMinion() +{ + if ( m_stunEffect ) + { + ParticleProp()->StopEmissionAndDestroyImmediately( m_stunEffect ); + m_stunEffect = NULL; + } + + if ( m_stunBeamEffect ) + { + ParticleProp()->StopEmissionAndDestroyImmediately( m_stunBeamEffect ); + m_stunBeamEffect = NULL; + } + + if ( m_scanEffect ) + { + ParticleProp()->StopEmissionAndDestroyImmediately( m_scanEffect ); + m_scanEffect = NULL; + } +} + + +//----------------------------------------------------------------------------- +void C_BotNPCMinion::Spawn( void ) +{ + BaseClass::Spawn(); + + SetNextClientThink( CLIENT_THINK_ALWAYS ); + + //m_scanEffect = ParticleProp()->Create( "minion_scan", PATTACH_ABSORIGIN_FOLLOW ); +} + + +//----------------------------------------------------------------------------- +void C_BotNPCMinion::ClientThink( void ) +{ + if ( m_stunTarget ) + { + if ( !m_stunEffect ) + { + m_stunEffect = ParticleProp()->Create( "cart_flashinglight", PATTACH_ABSORIGIN_FOLLOW ); + } + + if ( !m_stunBeamEffect ) + { + m_stunBeamEffect = ParticleProp()->Create( "laser_sight_beam", PATTACH_ABSORIGIN_FOLLOW ); + } + + if ( m_stunBeamEffect ) + { + m_stunBeamEffect->SetSortOrigin( m_stunBeamEffect->GetRenderOrigin() ); + m_stunBeamEffect->SetControlPoint( 2, Vector( 255, 0, 255 ) ); + m_stunBeamEffect->SetControlPoint( 1, m_stunTarget->WorldSpaceCenter() ); + } + } + else + { + // shut off the effect + if ( m_stunEffect ) + { + ParticleProp()->StopEmissionAndDestroyImmediately( m_stunEffect ); + m_stunEffect = NULL; + } + + if ( m_stunBeamEffect ) + { + ParticleProp()->StopEmissionAndDestroyImmediately( m_stunBeamEffect ); + m_stunBeamEffect = NULL; + } + } +} + + +//----------------------------------------------------------------------------- +// Return the origin for player observers tracking this target +Vector C_BotNPCMinion::GetObserverCamOrigin( void ) +{ + return GetAbsOrigin(); +} + + +//----------------------------------------------------------------------------- +void C_BotNPCMinion::FireEvent( const Vector& origin, const QAngle& angles, int event, const char *options ) +{ +} diff --git a/game/client/tf/bot_npc/c_bot_npc_minion.h b/game/client/tf/bot_npc/c_bot_npc_minion.h new file mode 100644 index 0000000..0f0be2d --- /dev/null +++ b/game/client/tf/bot_npc/c_bot_npc_minion.h @@ -0,0 +1,41 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +#ifndef C_BOT_NPC_MINION_H +#define C_BOT_NPC_MINION_H + +#include "c_ai_basenpc.h" + + +//-------------------------------------------------------------------------------------------------------- +/** + * The client-side implementation of Bot NPC Minion + */ +class C_BotNPCMinion : public C_NextBotCombatCharacter +{ +public: + DECLARE_CLASS( C_BotNPCMinion, C_NextBotCombatCharacter ); + DECLARE_CLIENTCLASS(); + + C_BotNPCMinion(); + virtual ~C_BotNPCMinion(); + +public: + virtual void Spawn( void ); + virtual bool IsNextBot() { return true; } + + virtual Vector GetObserverCamOrigin( void ); // Return the origin for player observers tracking this target + + virtual void FireEvent( const Vector& origin, const QAngle& angles, int event, const char *options ); + + virtual void ClientThink(); + +private: + C_BotNPCMinion( const C_BotNPCMinion & ); // not defined, not accessible + + CNetworkHandle( C_BaseEntity, m_stunTarget ); + HPARTICLEFFECT m_stunEffect; + HPARTICLEFFECT m_stunBeamEffect; + HPARTICLEFFECT m_scanEffect; +}; + + +#endif // C_BOT_NPC_MINION_H diff --git a/game/client/tf/bot_npc/map_entities/c_tf_bot_hint_engineer_nest.cpp b/game/client/tf/bot_npc/map_entities/c_tf_bot_hint_engineer_nest.cpp new file mode 100644 index 0000000..f192643 --- /dev/null +++ b/game/client/tf/bot_npc/map_entities/c_tf_bot_hint_engineer_nest.cpp @@ -0,0 +1,77 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// +// +//============================================================================= +#include "cbase.h" +#include "c_tf_bot_hint_engineer_nest.h" + +IMPLEMENT_CLIENTCLASS_DT(C_TFBotHintEngineerNest, DT_TFBotHintEngineerNest, CTFBotHintEngineerNest) + RecvPropBool( RECVINFO(m_bHasActiveTeleporter) ), +END_RECV_TABLE() + +//------------------------------------------------------------------------------ +C_TFBotHintEngineerNest::C_TFBotHintEngineerNest( void ) +{ + m_bHasActiveTeleporter = false; + m_bHadActiveTeleporter = false; + m_pMvMActiveTeleporter = NULL; +} + + +C_TFBotHintEngineerNest::~C_TFBotHintEngineerNest() +{ + +} + + +void C_TFBotHintEngineerNest::UpdateOnRemove() +{ + StopEffect(); + BaseClass::UpdateOnRemove(); +} + + +void C_TFBotHintEngineerNest::OnPreDataChanged( DataUpdateType_t type ) +{ + BaseClass::OnPreDataChanged( type ); + + m_bHadActiveTeleporter = m_bHasActiveTeleporter; +} + + +void C_TFBotHintEngineerNest::OnDataChanged( DataUpdateType_t type ) +{ + BaseClass::OnDataChanged( type ); + + if ( m_bHadActiveTeleporter != m_bHasActiveTeleporter ) + { + if ( m_bHasActiveTeleporter ) + { + StartEffect(); + } + else + { + StopEffect(); + } + } +} + + +void C_TFBotHintEngineerNest::StartEffect() +{ + if ( !m_pMvMActiveTeleporter ) + { + m_pMvMActiveTeleporter = ParticleProp()->Create( "teleporter_mvm_bot_persist", PATTACH_ABSORIGIN ); + } +} + + +void C_TFBotHintEngineerNest::StopEffect() +{ + if ( m_pMvMActiveTeleporter ) + { + ParticleProp()->StopEmission( m_pMvMActiveTeleporter ); + m_pMvMActiveTeleporter = NULL; + } +} diff --git a/game/client/tf/bot_npc/map_entities/c_tf_bot_hint_engineer_nest.h b/game/client/tf/bot_npc/map_entities/c_tf_bot_hint_engineer_nest.h new file mode 100644 index 0000000..bc0249f --- /dev/null +++ b/game/client/tf/bot_npc/map_entities/c_tf_bot_hint_engineer_nest.h @@ -0,0 +1,32 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// +// +//============================================================================= +#ifndef TF_BOT_HINT_ENGINEER_NEST_H +#define TF_BOT_HINT_ENGINEER_NEST_H + +#include "c_baseentity.h" + +class C_TFBotHintEngineerNest : public C_BaseEntity +{ + DECLARE_CLASS( C_TFBotHintEngineerNest, C_BaseEntity ); +public: + DECLARE_CLIENTCLASS(); + + C_TFBotHintEngineerNest( void ); + virtual ~C_TFBotHintEngineerNest(); + + virtual void UpdateOnRemove() OVERRIDE; + virtual void OnPreDataChanged( DataUpdateType_t type ) OVERRIDE; + virtual void OnDataChanged( DataUpdateType_t type ) OVERRIDE; +private: + bool m_bHadActiveTeleporter; + CNetworkVar( bool, m_bHasActiveTeleporter ); + + void StartEffect(); + void StopEffect(); + CNewParticleEffect *m_pMvMActiveTeleporter; +}; + +#endif // TF_BOT_HINT_ENGINEER_NEST_H |