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

Function TroopsControl

TombEngine/Objects/TR4/Entity/tr4_troops.cpp:72–453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70 }
71
72 void TroopsControl(short itemNumber)
73 {
74 if (!CreatureActive(itemNumber))
75 return;
76
77 auto* item = &g_Level.Items[itemNumber];
78 auto* object = &Objects[item->ObjectNumber];
79 auto* creature = GetCreatureInfo(item);
80
81 short angle = 0;
82 short tilt = 0;
83 short rot = 0;
84 short joint0 = 0;
85 short joint1 = 0;
86 short joint2 = 0;
87
88 int dx = 0;
89 int dy = 0;
90 int dz = 0;
91
92 if (creature->MuzzleFlash[0].Delay != 0)
93 creature->MuzzleFlash[0].Delay--;
94
95 if (item->HitPoints <= 0)
96 {
97 if (item->Animation.ActiveState != TROOP_STATE_DEATH &&
98 item->Animation.ActiveState != TROOP_STATE_KILLED_BY_SCORPION)
99 {
100 if (creature->Enemy &&
101 creature->Enemy->ObjectNumber == ID_BIG_SCORPION &&
102 item->ItemFlags[0] < 80)
103 {
104 if (creature->Enemy->Animation.AnimNumber == 6)
105 {
106 item->Animation.AnimNumber = 23;
107
108 if (item->Animation.ActiveState == TROOP_STATE_ATTACKED_BY_SCORPION)
109 item->Animation.FrameNumber = 37;
110 else
111 item->Animation.FrameNumber = 0;
112
113 item->Animation.ActiveState = TROOP_STATE_KILLED_BY_SCORPION;
114 item->Animation.TargetState = TROOP_STATE_KILLED_BY_SCORPION;
115
116 angle = 0;
117
118 item->Pose.Position = creature->Enemy->Pose.Position;
119 item->Pose.Orientation = creature->Enemy->Pose.Orientation;
120
121 creature->Enemy->TriggerFlags = 99;
122 }
123 else
124 {
125 item->ItemFlags[0]++;
126 angle = 0;
127 }
128 }
129 else

Callers

nothing calls this directly

Calls 15

CreatureActiveFunction · 0.85
GetCreatureInfoFunction · 0.85
GenerateIntFunction · 0.85
PerformFinalAttackFunction · 0.85
GetAITargetFunction · 0.85
TargetNearestEntityFunction · 0.85
CreatureAIInfoFunction · 0.85
phd_atanFunction · 0.85
GetCreatureMoodFunction · 0.85
CreatureMoodFunction · 0.85
CreatureTurnFunction · 0.85
AlertAllGuardsFunction · 0.85

Tested by

no test coverage detected