| 242 | } |
| 243 | |
| 244 | void ControlWingedMutant(short itemNumber) |
| 245 | { |
| 246 | if (!CreatureActive(itemNumber)) |
| 247 | return; |
| 248 | |
| 249 | auto& item = g_Level.Items[itemNumber]; |
| 250 | auto& creature = *GetCreatureInfo(&item); |
| 251 | |
| 252 | short headingAngle = 0; |
| 253 | short headYOrient = 0; |
| 254 | short torsoYOrient = 0; // Only when shooting. |
| 255 | |
| 256 | bool enableFlying = item.TestFlagField(WMUTANT_CONF_CAN_FLY, true); |
| 257 | bool isFlying = item.TestFlagField(WMUTANT_CONF_PATHFINDING_MODE, WMUTANT_PATH_AERIAL); |
| 258 | |
| 259 | InitializeWingedMutantOCB(item); |
| 260 | |
| 261 | if (item.HitPoints <= 0) |
| 262 | { |
| 263 | CreatureDie(itemNumber, true, BODY_DO_EXPLOSION | BODY_PART_EXPLODE | BODY_NO_SMOKE | BODY_NO_SHATTER_EFFECT); |
| 264 | |
| 265 | auto pos = item.Pose; |
| 266 | pos.Position.y -= CLICK(3); |
| 267 | TriggerExplosionSparks(pos.Position.x, pos.Position.y, pos.Position.z, 3, -2, 0, item.RoomNumber); |
| 268 | TriggerExplosionSparks(pos.Position.x, pos.Position.y, pos.Position.z, 3, -1, 0, item.RoomNumber); |
| 269 | TriggerShockwave(&pos, 48, 304, (GetRandomControl() & 0x1F) + 112, 128, 32, 32, 32, EulerAngles(2048, 0.0f, 0.0f), 0, true, false, false, (int)ShockwaveStyle::Normal); |
| 270 | |
| 271 | SoundEffect(SFX_TR1_ATLANTEAN_EXPLODE, &item.Pose); |
| 272 | return; |
| 273 | } |
| 274 | else |
| 275 | { |
| 276 | AI_INFO ai; |
| 277 | SwitchPathfinding(item, WMUTANT_PATH_GROUND); |
| 278 | CreatureAIInfo(&item, &ai); |
| 279 | |
| 280 | bool isSameZoneInGroundMode = (ai.zoneNumber == ai.enemyZone); |
| 281 | auto projectileType = CanTargetPlayer(item, ai); |
| 282 | |
| 283 | if (enableFlying && item.Animation.ActiveState == WMUTANT_STATE_FLY) |
| 284 | { |
| 285 | SwitchPathfinding(item, WMUTANT_PATH_AERIAL); |
| 286 | CreatureAIInfo(&item, &ai); |
| 287 | } |
| 288 | |
| 289 | if (ai.ahead) |
| 290 | { |
| 291 | headYOrient = ai.angle; |
| 292 | } |
| 293 | else |
| 294 | { |
| 295 | headYOrient = 0; |
| 296 | torsoYOrient = 0; |
| 297 | } |
| 298 | |
| 299 | GetCreatureMood(&item, &ai, isFlying); |
| 300 | CreatureMood(&item, &ai, isFlying); |
| 301 | headingAngle = CreatureTurn(&item, creature.MaxTurn); |
nothing calls this directly
no test coverage detected