| 1140 | } |
| 1141 | |
| 1142 | void Mafia2Control(short itemNumber) |
| 1143 | { |
| 1144 | if (!CreatureActive(itemNumber)) |
| 1145 | return; |
| 1146 | |
| 1147 | auto* item = &g_Level.Items[itemNumber]; |
| 1148 | auto* creature = GetCreatureInfo(item); |
| 1149 | |
| 1150 | short angle = 0; |
| 1151 | short joint0 = 0; |
| 1152 | short joint1 = 0; |
| 1153 | short joint2 = 0; |
| 1154 | |
| 1155 | // Can mafia jump? Check for a distances of 1 and 2 sectors. |
| 1156 | int x = item->Pose.Position.x; |
| 1157 | int y = item->Pose.Position.y; |
| 1158 | int z = item->Pose.Position.z; |
| 1159 | |
| 1160 | int dx = 870 * phd_sin(item->Pose.Orientation.y); |
| 1161 | int dz = 870 * phd_cos(item->Pose.Orientation.y); |
| 1162 | |
| 1163 | x += dx; |
| 1164 | z += dz; |
| 1165 | int height1 = GetPointCollision(Vector3i(x, y, z), item->RoomNumber).GetFloorHeight(); |
| 1166 | |
| 1167 | x += dx; |
| 1168 | z += dz; |
| 1169 | int height2 = GetPointCollision(Vector3i(x, y, z), item->RoomNumber).GetFloorHeight(); |
| 1170 | |
| 1171 | x += dx; |
| 1172 | z += dz; |
| 1173 | int height3 = GetPointCollision(Vector3i(x, y, z), item->RoomNumber).GetFloorHeight(); |
| 1174 | |
| 1175 | int height = 0; |
| 1176 | bool canJump1Sector = true; |
| 1177 | if (item->BoxNumber == LaraItem->BoxNumber || |
| 1178 | y >= (height1 - CLICK(1.5f)) || |
| 1179 | y >= (height2 + CLICK(1)) || |
| 1180 | y <= (height2 - CLICK(1))) |
| 1181 | { |
| 1182 | height = height2; |
| 1183 | canJump1Sector = false; |
| 1184 | } |
| 1185 | |
| 1186 | bool canJump2Sectors = true; |
| 1187 | if (item->BoxNumber == LaraItem->BoxNumber || |
| 1188 | y >= (height1 - CLICK(1.5f)) || |
| 1189 | y >= (height - CLICK(1.5f)) || |
| 1190 | y >= (height3 + CLICK(1)) || |
| 1191 | y <= (height3 - CLICK(1))) |
| 1192 | { |
| 1193 | canJump2Sectors = false; |
| 1194 | } |
| 1195 | |
| 1196 | if (creature->MuzzleFlash[0].Delay != 0) |
| 1197 | creature->MuzzleFlash[0].Delay--; |
| 1198 | |
| 1199 | if (creature->MuzzleFlash[1].Delay != 0) |
nothing calls this directly
no test coverage detected