MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / HeavyGuardControl

Function HeavyGuardControl

TombEngine/Objects/TR5/Entity/HeavyGuard.cpp:195–522  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193 }
194
195 void HeavyGuardControl(short itemNumber)
196 {
197 if (!CreatureActive(itemNumber))
198 return;
199
200 auto& item = g_Level.Items[itemNumber];
201 auto& creature = *GetCreatureInfo(&item);
202
203 short headingAngle = 0;
204 auto headOrient = EulerAngles::Identity;
205 auto torsoOrient = EulerAngles::Identity;
206
207 AI_INFO ai;
208 CreatureAIInfo(&item, &ai);
209
210 if (item.ItemFlags[0] || item.ItemFlags[1])
211 {
212 for (int i = 0; i < 2; i++)
213 {
214 if (item.ItemFlags[i])
215 {
216 FireHeavyGuardRaygun(item, (bool)i, true);
217
218 if (item.ItemFlags[i] > 0)
219 {
220 auto pos1 = GetJointPosition(&item, HeavyGuardHandJoints[i], HeavyGuardRaygunLaserOffsets[i]);
221 short blue = item.ItemFlags[i] << 4;
222 short green = blue >> 2;
223 short red = 0;
224
225 SpawnDynamicLight(pos1.x, pos1.y, pos1.z, item.ItemFlags[i] + 8, red, green, blue);
226 item.ItemFlags[i]--;
227 }
228 else
229 {
230 item.ItemFlags[i]++;
231 }
232 }
233 }
234 }
235
236 if (item.HitPoints <= 0)
237 {
238 if (item.Animation.ActiveState != HEAVY_GUARD_STATE_DEATH && item.TriggerFlags != 1)
239 {
240 SetAnimation(item, HEAVY_GUARD_ANIM_DEATH);
241 }
242 else if (item.TriggerFlags == 1)
243 {
244 switch (item.Animation.ActiveState)
245 {
246 case HEAVY_GUARD_STATE_FALL_START:
247 {
248 int frame = item.Animation.FrameNumber;
249 int frameStart = 0;
250
251 if (frame == 48 || frame == 15)
252 {

Callers

nothing calls this directly

Calls 15

CreatureActiveFunction · 0.85
GetCreatureInfoFunction · 0.85
CreatureAIInfoFunction · 0.85
FireHeavyGuardRaygunFunction · 0.85
GetJointPositionFunction · 0.85
SpawnDynamicLightFunction · 0.85
SetAnimationFunction · 0.85
GetFloorFunction · 0.85
TestTriggersFunction · 0.85
CreatureEffect2Function · 0.85
GetAITargetFunction · 0.85
phd_atanFunction · 0.85

Tested by

no test coverage detected