| 90 | const std::vector<GAME_OBJECT_ID> RaptorIgnoredObjectIds = { ID_RAPTOR, ID_COMPSOGNATHUS }; |
| 91 | |
| 92 | void RaptorControl(short itemNumber) |
| 93 | { |
| 94 | if (!CreatureActive(itemNumber)) |
| 95 | return; |
| 96 | |
| 97 | auto& item = g_Level.Items[itemNumber]; |
| 98 | auto& creature = *GetCreatureInfo(&item); |
| 99 | |
| 100 | short headingAngle = 0; |
| 101 | short tiltAngle = 0; |
| 102 | short headYOrient = 0; |
| 103 | short neckYOrient = 0; |
| 104 | |
| 105 | bool canJump = item.TestOcb(OCB_ENABLE_JUMP); |
| 106 | if (!canJump) |
| 107 | { |
| 108 | creature.LOT.Step = CLICK(1); |
| 109 | creature.LOT.Drop = -CLICK(2); |
| 110 | creature.LOT.Zone = ZoneType::Basic; |
| 111 | creature.LOT.CanJump = false; |
| 112 | } |
| 113 | |
| 114 | bool canJump1block = (canJump && CanCreatureJump(item, JumpDistance::Block1)); |
| 115 | bool canJump2blocks = (canJump && !canJump1block && CanCreatureJump(item, JumpDistance::Block2)); |
| 116 | |
| 117 | // Require Idle state. |
| 118 | if (item.HitPoints <= 0 && item.Animation.ActiveState == RAPTOR_STATE_IDLE) |
| 119 | { |
| 120 | if (item.Animation.ActiveState != RAPTOR_STATE_DEATH) |
| 121 | SetAnimation(item, RaptorDeathAnims[Random::GenerateInt(0, (int)RaptorDeathAnims.size() - 1)]); |
| 122 | } |
| 123 | else |
| 124 | { |
| 125 | // NOTE: Ignores other small dinosaurs. |
| 126 | TargetNearestEntity(item, RaptorIgnoredObjectIds); |
| 127 | |
| 128 | AI_INFO ai; |
| 129 | if (item.AIBits) |
| 130 | GetAITarget(&creature); |
| 131 | CreatureAIInfo(&item, &ai); |
| 132 | |
| 133 | GetCreatureMood(&item, &ai, true); |
| 134 | CreatureMood(&item, &ai, true); |
| 135 | if (creature.Mood == MoodType::Bored) |
| 136 | creature.MaxTurn /= 2; |
| 137 | |
| 138 | headingAngle = CreatureTurn(&item, creature.MaxTurn); |
| 139 | if (ai.ahead) |
| 140 | { |
| 141 | headYOrient = ai.angle; |
| 142 | neckYOrient = -headingAngle * 6; |
| 143 | } |
| 144 | |
| 145 | switch (item.Animation.ActiveState) |
| 146 | { |
| 147 | case RAPTOR_STATE_IDLE: |
| 148 | creature.MaxTurn = 0; |
| 149 | creature.LOT.IsJumping = false; |
nothing calls this directly
no test coverage detected