| 33 | constexpr auto KNIFE_DAMAGE = 50; |
| 34 | |
| 35 | void ShootAtEnemy(Vector3i target, ItemInfo* item, int index) |
| 36 | { |
| 37 | constexpr auto RANDOM_ORIENT = 1.4f; |
| 38 | |
| 39 | if (item == nullptr || index <= NO_VALUE) |
| 40 | return; |
| 41 | |
| 42 | // If target deviated too much from the item position, prefer item's own position. |
| 43 | if (Vector3i::Distance(item->Pose.Position, target) > TARGET_DEVIATION_THRESHOLD) |
| 44 | target = item->Pose.Position; |
| 45 | |
| 46 | auto bounds = GameBoundingBox(item); |
| 47 | auto yOffset = bounds.Y2 - (bounds.GetHeight() * 0.75f); |
| 48 | auto targetWithOffset = Vector3(target.x, item->Pose.Position.y + yOffset, target.z); |
| 49 | |
| 50 | // Apply slight random scatter. |
| 51 | auto randomOrient = EulerAngles( |
| 52 | Random::GenerateAngle(ANGLE(-RANDOM_ORIENT), ANGLE(RANDOM_ORIENT)), |
| 53 | Random::GenerateAngle(ANGLE(-RANDOM_ORIENT), ANGLE(RANDOM_ORIENT)), |
| 54 | 0); |
| 55 | |
| 56 | auto& fx = EffectList[index]; |
| 57 | fx.pos.Orientation = Geometry::GetOrientToPoint(fx.pos.Position.ToVector3(), targetWithOffset); |
| 58 | fx.pos.Orientation += randomOrient; |
| 59 | } |
| 60 | |
| 61 | // TODO: Make ControlMissile() not use LaraItem global. -- TokyoSU 5/8/2022 |
| 62 | void ControlMissile(short fxNumber) |
no test coverage detected