Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
2.5 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. // C_HeadlessHatman.cpp
  3. #include "cbase.h"
  4. #include "NextBot/C_NextBot.h"
  5. #include "c_headless_hatman.h"
  6. // memdbgon must be the last include file in a .cpp file!!!
  7. #include "tier0/memdbgon.h"
  8. #undef NextBot
  9. //-----------------------------------------------------------------------------
  10. IMPLEMENT_CLIENTCLASS_DT( C_HeadlessHatman, DT_HeadlessHatman, CHeadlessHatman )
  11. END_RECV_TABLE()
  12. //-----------------------------------------------------------------------------
  13. C_HeadlessHatman::C_HeadlessHatman()
  14. {
  15. m_ghostEffect = NULL;
  16. m_leftEyeEffect = NULL;
  17. m_rightEyeEffect = NULL;
  18. }
  19. //-----------------------------------------------------------------------------
  20. C_HeadlessHatman::~C_HeadlessHatman()
  21. {
  22. if ( m_ghostEffect )
  23. {
  24. ParticleProp()->StopEmission( m_ghostEffect );
  25. m_ghostEffect = NULL;
  26. }
  27. if ( m_leftEyeEffect )
  28. {
  29. ParticleProp()->StopEmission( m_leftEyeEffect );
  30. m_leftEyeEffect = NULL;
  31. }
  32. if ( m_rightEyeEffect )
  33. {
  34. ParticleProp()->StopEmission( m_rightEyeEffect );
  35. m_rightEyeEffect = NULL;
  36. }
  37. }
  38. //-----------------------------------------------------------------------------
  39. void C_HeadlessHatman::Spawn( void )
  40. {
  41. BaseClass::Spawn();
  42. m_vecViewOffset = Vector( 0, 0, 100.0f );
  43. if ( !m_ghostEffect )
  44. {
  45. m_ghostEffect = ParticleProp()->Create( "ghost_pumpkin", PATTACH_ABSORIGIN_FOLLOW );
  46. }
  47. SetNextClientThink( gpGlobals->curtime + 1.0f );
  48. }
  49. //-----------------------------------------------------------------------------
  50. void C_HeadlessHatman::ClientThink( void )
  51. {
  52. if ( !m_leftEyeEffect )
  53. {
  54. m_leftEyeEffect = ParticleProp()->Create( "halloween_boss_eye_glow", PATTACH_POINT_FOLLOW, "lefteye" );
  55. }
  56. if ( !m_rightEyeEffect )
  57. {
  58. m_rightEyeEffect = ParticleProp()->Create( "halloween_boss_eye_glow", PATTACH_POINT_FOLLOW, "righteye" );
  59. }
  60. SetNextClientThink( CLIENT_THINK_NEVER );
  61. }
  62. //-----------------------------------------------------------------------------
  63. // Return the origin for player observers tracking this target
  64. Vector C_HeadlessHatman::GetObserverCamOrigin( void )
  65. {
  66. return EyePosition();
  67. }
  68. //-----------------------------------------------------------------------------
  69. void C_HeadlessHatman::FireEvent( const Vector& origin, const QAngle& angles, int event, const char *options )
  70. {
  71. if ( event == 7001 )
  72. {
  73. // footstep event
  74. EmitSound( "Halloween.HeadlessBossFootfalls" );
  75. ParticleProp()->Create( "halloween_boss_foot_impact", PATTACH_ABSORIGIN, 0 );
  76. }
  77. }