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

Function SkeletonControl

TombEngine/Objects/TR4/Entity/tr4_skeleton.cpp:199–792  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197 }
198
199 void SkeletonControl(short itemNumber)
200 {
201 if (!CreatureActive(itemNumber))
202 return;
203
204 auto* item = &g_Level.Items[itemNumber];
205 auto* creature = GetCreatureInfo(item);
206 auto* enemyItem = creature->Enemy;
207
208 bool jumpLeft = false;
209 bool jumpRight = false;
210
211 short angle = 0;
212 short tilt = 0;
213 short joint1 = 0;
214 short joint2 = 0;
215 short joint3 = 0;
216 short rotation = 0;
217 int distance = 0;
218
219 // Can skeleton jump? Check for a distance of 1 and 2 blocks.
220 int x = item->Pose.Position.x;
221 int y = item->Pose.Position.y;
222 int z = item->Pose.Position.z;
223
224 int dx = 870 * phd_sin(item->Pose.Orientation.y);
225 int dz = 870 * phd_cos(item->Pose.Orientation.y);
226
227 x += dx;
228 z += dz;
229 int height1 = GetPointCollision(Vector3i(x, y, z), item->RoomNumber).GetFloorHeight();
230
231 x += dx;
232 z += dz;
233 int height2 = GetPointCollision(Vector3i(x, y, z), item->RoomNumber).GetFloorHeight();
234
235 x += dx;
236 z += dz;
237 int height3 = GetPointCollision(Vector3i(x, y, z), item->RoomNumber).GetFloorHeight();
238
239 int height = 0;
240 bool canJump1Block = true;
241 if (enemyItem && item->BoxNumber == LaraItem->BoxNumber && (item->MeshBits & 0x200) ||
242 y >= (height1 - CLICK(1.5f)) ||
243 y >= (height2 + CLICK(2)) ||
244 y <= (height2 - CLICK(2)))
245 {
246 height = height2;
247 canJump1Block = false;
248 }
249
250 bool canJump2Blocks = true;
251 if (enemyItem && item->BoxNumber == LaraItem->BoxNumber && (item->MeshBits & 0x200) ||
252 y >= (height1 - CLICK(1.5f)) ||
253 y >= (height - CLICK(1.5f)) ||
254 y >= (height3 + CLICK(2)) ||
255 y <= (height3 - CLICK(2)))
256 {

Callers

nothing calls this directly

Calls 15

CreatureActiveFunction · 0.85
GetCreatureInfoFunction · 0.85
phd_sinFunction · 0.85
phd_cosFunction · 0.85
GetPointCollisionFunction · 0.85
GetAITargetFunction · 0.85
CreatureAIInfoFunction · 0.85
ANGLEFunction · 0.85
phd_atanFunction · 0.85
GetCreatureMoodFunction · 0.85
CreatureMoodFunction · 0.85
CreatureTurnFunction · 0.85

Tested by

no test coverage detected