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