-
Notifications
You must be signed in to change notification settings - Fork 0
/
DevilMarker.es
170 lines (154 loc) · 5.72 KB
/
DevilMarker.es
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/* Copyright (c) 2002-2012 Croteam Ltd.
This program is free software; you can redistribute it and/or modify
it under the terms of version 2 of the GNU General Public License as published by
the Free Software Foundation
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
338
%{
#include "StdH.h"
%}
uses "Entities/Marker";
uses "Entities/Devil";
enum DevilActionType {
0 DAT_NONE "None",
1 DAT_WALK "Walk",
2 DAT_RISE "Rise",
3 DAT_ROAR "Roar",
4 DAT_PUNCH_LEFT "Punch left - obsolete",
5 DAT_PUNCH_RIGHT "Punch right - obsolete",
6 DAT_HIT_GROUND "Hit ground",
7 DAT_JUMP "Jump",
8 DAT_WAIT "Wait",
9 DAT_STOP_DESTROYING "Stop destroying",
10 DAT_NEXT_ACTION "Next action",
11 DAT_GRAB_LOWER_WEAPONS "Grab lower weapons",
12 DAT_STOP_MOVING "Stop moving",
13 DAT_JUMP_INTO_PYRAMID "Jump into pyramid",
14 DAT_SMASH_LEFT "Smash left - obsolete",
15 DAT_SMASH_RIGHT "Smash right - obsolete",
16 DAT_PUNCH "Punch",
17 DAT_SMASH "Smash",
18 DAT_FORCE_ATTACK_RADIUS "Force attack radius",
19 DAT_TELEPORT_INTO_PYRAMID "Teleport into pyramid",
20 DAT_DECREASE_ATTACK_RADIUS "Decrease attack radius",
};
class CDevilMarker: CMarker {
name "Devil Marker";
thumbnail "Thumbnails\\EnemyMarker.tbn";
properties:
1 enum DevilActionType m_datType "Action" 'A' = DAT_NONE,
4 INDEX m_iWaitIdles "Wait idles" 'W' = 2,
5 CEntityPointer m_penDevil "Devil" 'D',
6 CEntityPointer m_penTrigger "Trigger" 'G',
7 CEntityPointer m_penToDestroy1 "Destroy target 1" 'E',
8 CEntityPointer m_penToDestroy2 "Destroy target 2" 'R',
9 RANGE m_fAttackRadius "Attack radius" 'S' = 100.0f,
components:
1 model MODEL_MARKER "Models\\Editor\\EnemyMarker.mdl",
2 texture TEXTURE_MARKER "Models\\Editor\\DevilMarker.tex"
functions:
void SetDefaultName(void)
{
m_strName = DevilActionType_enum.NameForValue(INDEX(m_datType));
}
const CTString &GetDescription(void) const {
CTString strAction = DevilActionType_enum.NameForValue(INDEX(m_datType));
if (m_penTarget==NULL) {
((CTString&)m_strDescription).PrintF("%s (%s)-><none>", m_strName, strAction);
} else {
((CTString&)m_strDescription).PrintF("%s (%s)->%s", m_strName, strAction,
m_penTarget->GetName());
}
return m_strDescription;
}
/* Check if entity is moved on a route set up by its targets. */
BOOL MovesByTargetedRoute(CTString &strTargetProperty) const {
strTargetProperty = "Target";
return TRUE;
};
/* Check if entity can drop marker for making linked route. */
BOOL DropsMarker(CTFileName &fnmMarkerClass, CTString &strTargetProperty) const {
fnmMarkerClass = CTFILENAME("Classes\\DevilMarker.ecl");
strTargetProperty = "Target";
return TRUE;
}
/* Handle an event, return false if the event is not handled. */
BOOL HandleEvent(const CEntityEvent &ee)
{
if (ee.ee_slEvent==EVENTCODE_ETrigger)
{
if(m_datType==DAT_NEXT_ACTION && m_penDevil!=NULL && m_penTarget!=NULL)
{
EDevilCommand eDevilCommand;
eDevilCommand.dctType = DC_FORCE_ACTION;
eDevilCommand.penForcedAction = m_penTarget;
m_penDevil->SendEvent(eDevilCommand);
return TRUE;
}
else if(m_datType==DAT_GRAB_LOWER_WEAPONS && m_penDevil!=NULL)
{
EDevilCommand eDevilCommand;
eDevilCommand.dctType = DC_GRAB_LOWER_WEAPONS;
m_penDevil->SendEvent(eDevilCommand);
return TRUE;
}
else if(m_datType==DAT_STOP_MOVING && m_penDevil!=NULL)
{
EDevilCommand eDevilCommand;
eDevilCommand.dctType = DC_STOP_MOVING;
m_penDevil->SendEvent(eDevilCommand);
return TRUE;
}
else if(m_datType==DAT_JUMP_INTO_PYRAMID && m_penDevil!=NULL)
{
EDevilCommand eDevilCommand;
eDevilCommand.dctType = DC_JUMP_INTO_PYRAMID;
eDevilCommand.penForcedAction = this;
m_penDevil->SendEvent(eDevilCommand);
return TRUE;
}
else if(m_datType==DAT_TELEPORT_INTO_PYRAMID && m_penDevil!=NULL)
{
EDevilCommand eDevilCommand;
eDevilCommand.dctType = DC_TELEPORT_INTO_PYRAMID;
eDevilCommand.penForcedAction = this;
m_penDevil->SendEvent(eDevilCommand);
return TRUE;
}
else if(m_datType==DAT_FORCE_ATTACK_RADIUS && m_penDevil!=NULL)
{
EDevilCommand eDevilCommand;
eDevilCommand.dctType = DC_FORCE_ATTACK_RADIUS;
eDevilCommand.fAttackRadius = m_fAttackRadius;
eDevilCommand.vCenterOfAttack = GetPlacement().pl_PositionVector;
m_penDevil->SendEvent(eDevilCommand);
return TRUE;
}
else if(m_datType==DAT_DECREASE_ATTACK_RADIUS && m_penDevil!=NULL)
{
EDevilCommand eDevilCommand;
eDevilCommand.dctType = DC_DECREASE_ATTACK_RADIUS;
m_penDevil->SendEvent(eDevilCommand);
return TRUE;
}
}
return FALSE;
}
procedures:
Main() {
InitAsEditorModel();
SetPhysicsFlags(EPF_MODEL_IMMATERIAL);
SetCollisionFlags(ECF_IMMATERIAL);
SetDefaultName();
// set appearance
SetModel(MODEL_MARKER);
SetModelMainTexture(TEXTURE_MARKER);
return;
}
};