| 34 | } |
| 35 | |
| 36 | void Tr5DogControl(short itemNumber) |
| 37 | { |
| 38 | if (!CreatureActive(itemNumber)) |
| 39 | return; |
| 40 | |
| 41 | short angle = 0; |
| 42 | short joint2 = 0; |
| 43 | short joint1 = 0; |
| 44 | short joint0 = 0; |
| 45 | |
| 46 | auto* item = &g_Level.Items[itemNumber]; |
| 47 | auto* creature = GetCreatureInfo(item); |
| 48 | auto* object = &Objects[item->ObjectNumber]; |
| 49 | |
| 50 | if (item->HitPoints <= 0) |
| 51 | { |
| 52 | if (item->Animation.AnimNumber == 1) |
| 53 | item->HitPoints = object->HitPoints; |
| 54 | else if (item->Animation.ActiveState != 11) |
| 55 | { |
| 56 | item->Animation.AnimNumber = DogAnims[GetRandomControl() & 3]; |
| 57 | item->Animation.FrameNumber = 0; |
| 58 | item->Animation.ActiveState = 11; |
| 59 | } |
| 60 | } |
| 61 | else |
| 62 | { |
| 63 | if (item->AIBits) |
| 64 | GetAITarget(creature); |
| 65 | else |
| 66 | creature->Enemy = LaraItem; |
| 67 | |
| 68 | AI_INFO AI; |
| 69 | CreatureAIInfo(item, &AI); |
| 70 | |
| 71 | int distance; |
| 72 | if (creature->Enemy == LaraItem) |
| 73 | distance = AI.distance; |
| 74 | else |
| 75 | { |
| 76 | int dx = LaraItem->Pose.Position.x - item->Pose.Position.x; |
| 77 | int dz = LaraItem->Pose.Position.z - item->Pose.Position.z; |
| 78 | phd_atan(dz, dx); |
| 79 | distance = pow(dx, 2) + pow(dz, 2); |
| 80 | } |
| 81 | |
| 82 | if (AI.ahead) |
| 83 | { |
| 84 | joint2 = AI.xAngle; // Maybe swapped |
| 85 | joint1 = AI.angle; |
| 86 | } |
| 87 | |
| 88 | GetCreatureMood(item, &AI, true); |
| 89 | CreatureMood(item, &AI, true); |
| 90 | |
| 91 | if (creature->Mood == MoodType::Bored) |
| 92 | creature->MaxTurn /= 2; |
| 93 |
nothing calls this directly
no test coverage detected