summaryrefslogtreecommitdiff
path: root/game/client/tf/halloween/c_headless_hatman.cpp
blob: d8b63f53c0882252e29ef6c2a2b74b31eeae3726 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//========= Copyright Valve Corporation, All rights reserved. ============//
// C_HeadlessHatman.cpp

#include "cbase.h"
#include "NextBot/C_NextBot.h"
#include "c_headless_hatman.h"

// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

#undef NextBot

//-----------------------------------------------------------------------------
IMPLEMENT_CLIENTCLASS_DT( C_HeadlessHatman, DT_HeadlessHatman, CHeadlessHatman )
END_RECV_TABLE()


//-----------------------------------------------------------------------------
C_HeadlessHatman::C_HeadlessHatman()
{
	m_ghostEffect = NULL;
	m_leftEyeEffect = NULL;
	m_rightEyeEffect = NULL;
}


//-----------------------------------------------------------------------------
C_HeadlessHatman::~C_HeadlessHatman()
{
	if ( m_ghostEffect )
	{
		ParticleProp()->StopEmission( m_ghostEffect );
		m_ghostEffect = NULL;
	}

	if ( m_leftEyeEffect )
	{
		ParticleProp()->StopEmission( m_leftEyeEffect );
		m_leftEyeEffect = NULL;
	}

	if ( m_rightEyeEffect )
	{
		ParticleProp()->StopEmission( m_rightEyeEffect );
		m_rightEyeEffect = NULL;
	}
}


//-----------------------------------------------------------------------------
void C_HeadlessHatman::Spawn( void )
{
	BaseClass::Spawn();

	m_vecViewOffset = Vector( 0, 0, 100.0f );

	if ( !m_ghostEffect )
	{
		m_ghostEffect = ParticleProp()->Create( "ghost_pumpkin", PATTACH_ABSORIGIN_FOLLOW );
	}

	SetNextClientThink( gpGlobals->curtime + 1.0f );
}


//-----------------------------------------------------------------------------
void C_HeadlessHatman::ClientThink( void )
{
	if ( !m_leftEyeEffect )
	{
		m_leftEyeEffect = ParticleProp()->Create( "halloween_boss_eye_glow", PATTACH_POINT_FOLLOW, "lefteye" );
	}

	if ( !m_rightEyeEffect )
	{
		m_rightEyeEffect = ParticleProp()->Create( "halloween_boss_eye_glow", PATTACH_POINT_FOLLOW, "righteye" );
	}

	SetNextClientThink( CLIENT_THINK_NEVER );
}


//-----------------------------------------------------------------------------
// Return the origin for player observers tracking this target
Vector C_HeadlessHatman::GetObserverCamOrigin( void ) 
{ 
	return EyePosition();
}


//-----------------------------------------------------------------------------
void C_HeadlessHatman::FireEvent( const Vector& origin, const QAngle& angles, int event, const char *options )
{
	if ( event == 7001 )
	{
		// footstep event
		EmitSound( "Halloween.HeadlessBossFootfalls" );

		ParticleProp()->Create( "halloween_boss_foot_impact", PATTACH_ABSORIGIN, 0 );
	}
}