| 57 | } |
| 58 | |
| 59 | void ControlKold(short itemNumber) |
| 60 | { |
| 61 | if (!CreatureActive(itemNumber)) |
| 62 | return; |
| 63 | |
| 64 | auto& item = g_Level.Items[itemNumber]; |
| 65 | auto& creature = *GetCreatureInfo(&item); |
| 66 | |
| 67 | short headingAngle = 0; |
| 68 | short tiltAngle = 0; |
| 69 | auto extraHeadRot = EulerAngles::Identity; |
| 70 | auto extraTorsoRot = EulerAngles::Identity; |
| 71 | |
| 72 | if (creature.MuzzleFlash[0].Delay != 0) |
| 73 | creature.MuzzleFlash[0].Delay--; |
| 74 | |
| 75 | if (item.HitPoints <= 0) |
| 76 | { |
| 77 | if (item.Animation.ActiveState != KOLD_STATE_DEATH) |
| 78 | SetAnimation(item, KOLD_ANIM_DEATH); |
| 79 | } |
| 80 | else |
| 81 | { |
| 82 | AI_INFO ai; |
| 83 | CreatureAIInfo(&item, &ai); |
| 84 | |
| 85 | if (ai.ahead) |
| 86 | { |
| 87 | extraHeadRot.y = ai.angle / 2; |
| 88 | extraTorsoRot.x = ai.xAngle / 2; |
| 89 | extraTorsoRot.y = ai.angle / 2; |
| 90 | } |
| 91 | |
| 92 | GetCreatureMood(&item, &ai, true); |
| 93 | CreatureMood(&item, &ai, true); |
| 94 | headingAngle = CreatureTurn(&item, creature.MaxTurn); |
| 95 | |
| 96 | switch (item.Animation.ActiveState) |
| 97 | { |
| 98 | case KOLD_STATE_IDLE: |
| 99 | creature.MaxTurn = 0; |
| 100 | |
| 101 | if (item.Animation.RequiredState != NO_VALUE) |
| 102 | { |
| 103 | item.Animation.TargetState = item.Animation.RequiredState; |
| 104 | } |
| 105 | else if (Targetable(&item, &ai)) |
| 106 | { |
| 107 | item.Animation.TargetState = KOLD_STATE_AIM; |
| 108 | } |
| 109 | else if (creature.Mood == MoodType::Bored) |
| 110 | { |
| 111 | item.Animation.TargetState = KOLD_STATE_WALK; |
| 112 | } |
| 113 | else |
| 114 | { |
| 115 | item.Animation.TargetState = KOLD_STATE_RUN; |
| 116 | } |
nothing calls this directly
no test coverage detected