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

Function HarpyControl

TombEngine/Objects/TR4/Entity/tr4_harpy.cpp:176–494  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174 }
175
176 void HarpyControl(short itemNumber)
177 {
178 if (!CreatureActive(itemNumber))
179 return;
180
181 auto* item = &g_Level.Items[itemNumber];
182 auto* creature = GetCreatureInfo(item);
183
184 short angle = 0;
185 short joint0 = 0;
186 short joint1 = 0;
187 short joint2 = 0;
188
189 if (item->HitPoints <= 0)
190 {
191 item->HitPoints = 0;
192
193 int state = item->Animation.ActiveState - 9;
194 if (state)
195 {
196 state--;
197 if (state)
198 {
199 if (state == HARPY_STATE_IDLE)
200 {
201 item->Pose.Position.y = item->Floor;
202 item->Pose.Orientation.x = 0;
203 }
204 else
205 {
206 SetAnimation(item, HARPY_ANIM_DEATH_START);
207 item->Animation.IsAirborne = true;
208 item->Animation.Velocity.z = 0;
209 item->Pose.Orientation.x = 0;
210 }
211
212 CreatureTilt(item, 0);
213
214 CreatureJoint(item, 0, joint0);
215 CreatureJoint(item, 1, joint1);
216 CreatureJoint(item, 2, joint2);
217
218 CreatureAnimation(itemNumber, angle, 0);
219 return;
220 }
221 }
222 else
223 item->Animation.TargetState = HARPY_STATE_DEATH_FALL;
224
225 if (item->Pose.Position.y >= item->Floor)
226 {
227 item->Animation.TargetState = HARPY_STATE_DEATH_END;
228 item->Animation.IsAirborne = false;
229 item->Animation.Velocity.y = 0.0f;
230 item->Pose.Position.y = item->Floor;
231 AlignEntityToSurface(item, Vector2(Objects[item->ObjectNumber].radius));
232 }
233

Callers

nothing calls this directly

Calls 15

CreatureActiveFunction · 0.85
GetCreatureInfoFunction · 0.85
SetAnimationFunction · 0.85
CreatureTiltFunction · 0.85
CreatureJointFunction · 0.85
CreatureAnimationFunction · 0.85
AlignEntityToSurfaceFunction · 0.85
GetAITargetFunction · 0.85
CreatureAIInfoFunction · 0.85
phd_atanFunction · 0.85
GetCreatureMoodFunction · 0.85
CreatureMoodFunction · 0.85

Tested by

no test coverage detected