| 70 | } |
| 71 | |
| 72 | void SphinxControl(short itemNumber) |
| 73 | { |
| 74 | if (!CreatureActive(itemNumber)) |
| 75 | return; |
| 76 | |
| 77 | auto* item = &g_Level.Items[itemNumber]; |
| 78 | auto* creature = GetCreatureInfo(item); |
| 79 | |
| 80 | int x = item->Pose.Position.x + 614 * phd_sin(item->Pose.Orientation.y); |
| 81 | int y = item->Pose.Position.y; |
| 82 | int z = item->Pose.Position.z + 614 * phd_cos(item->Pose.Orientation.y); |
| 83 | |
| 84 | auto pointColl = GetPointCollision(Vector3i(x, y, z), item->RoomNumber); |
| 85 | |
| 86 | int height1 = pointColl.GetFloorHeight(); |
| 87 | |
| 88 | if (item->Animation.ActiveState == SPHINX_STATE_RUN_FORWARD && pointColl.GetSector().Stopper) |
| 89 | { |
| 90 | auto* room = &g_Level.Rooms[item->RoomNumber]; |
| 91 | |
| 92 | for (int i = 0; i < room->mesh.size(); i++) |
| 93 | { |
| 94 | auto* mesh = &room->mesh[i]; |
| 95 | |
| 96 | if (((mesh->Pose.Position.z / BLOCK(1)) == (z / BLOCK(1))) && |
| 97 | ((mesh->Pose.Position.x / BLOCK(1)) == (x / BLOCK(1))) && |
| 98 | Statics[mesh->Slot].shatterType != ShatterType::None) |
| 99 | { |
| 100 | ShatterObject(nullptr, mesh, -64, item->RoomNumber, 0); |
| 101 | SoundEffect(SFX_TR4_SMASH_ROCK, &item->Pose); |
| 102 | |
| 103 | TestTriggers(x, y, z, item->RoomNumber, true); |
| 104 | } |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | x = item->Pose.Position.x - 614 * phd_sin(item->Pose.Orientation.y); |
| 109 | y = item->Pose.Position.y; |
| 110 | z = item->Pose.Position.z - 614 * phd_cos(item->Pose.Orientation.y); |
| 111 | |
| 112 | int height2 = GetPointCollision(Vector3i(x, y, z), item->RoomNumber).GetFloorHeight(); |
| 113 | |
| 114 | phd_atan(1228, height2 - height1); |
| 115 | |
| 116 | if (item->AIBits) |
| 117 | { |
| 118 | GetAITarget(creature); |
| 119 | } |
| 120 | else |
| 121 | { |
| 122 | creature->Enemy = LaraItem; |
| 123 | } |
| 124 | |
| 125 | AI_INFO ai; |
| 126 | CreatureAIInfo(item, &ai); |
| 127 | |
| 128 | if (!creature->Enemy->IsLara()) |
| 129 | phd_atan(LaraItem->Pose.Position.z - item->Pose.Position.z, LaraItem->Pose.Position.x - item->Pose.Position.x); |
nothing calls this directly
no test coverage detected