From 2b49e4edcf7937bf5536e3e79a67ef640604d956 Mon Sep 17 00:00:00 2001 From: Nemoel-Tomo Date: Fri, 21 Apr 2023 20:14:32 +0200 Subject: [PATCH] fixed targeting (#1080) --- TombEngine/Objects/TR5/Entity/tr5_laser_head.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/TombEngine/Objects/TR5/Entity/tr5_laser_head.cpp b/TombEngine/Objects/TR5/Entity/tr5_laser_head.cpp index 96ee8725b..cd42c503c 100644 --- a/TombEngine/Objects/TR5/Entity/tr5_laser_head.cpp +++ b/TombEngine/Objects/TR5/Entity/tr5_laser_head.cpp @@ -327,9 +327,9 @@ namespace TEN::Entities::Creatures::TR5 GameVector eye = GameVector::Zero; eye.RoomNumber = item->RoomNumber; - int cosX = MAX_VISIBILITY_DISTANCE * phd_cos(targetOrient.x); - - eye.x = origin1.x + (cosX * phd_sin(item->Pose.Orientation.y)); + int cosX = MAX_VISIBILITY_DISTANCE * phd_cos(targetOrient.x - ANGLE(23.45f)); + + eye.x = origin1.x + (cosX * phd_sin(item->Pose.Orientation.y )); eye.y = origin1.y + (MAX_VISIBILITY_DISTANCE * phd_sin(-(targetOrient.x - GUARDIAN_ORIENT_OFFSET.x))); eye.z = origin1.z + (cosX * phd_cos(item->Pose.Orientation.y)); @@ -360,7 +360,7 @@ namespace TEN::Entities::Creatures::TR5 origin1.RoomNumber = item->RoomNumber; guardian->LOS[i] = LOS(&origin1, &eye); SpawnElectricity(origin1.ToVector3(), eye.ToVector3(), (GetRandomControl() & 1) + 3, color.x, color.y, color.z, 46, (int)ElectricityFlags::Spline | (int)ElectricityFlags::ThinIn | (int)ElectricityFlags::ThinOut, 6, 10); - guardian->fireArcs[i] = &ElectricityArcs.back(); + guardian->fireArcs[i] = &ElectricityArcs.back(); StopSoundEffect(SFX_TR5_GOD_HEAD_CHARGE); SoundEffect(SFX_TR5_GOD_HEAD_BLAST, &item->Pose); } @@ -399,7 +399,7 @@ namespace TEN::Entities::Creatures::TR5 if (adx < 280 && ady < 280 && adz < 280) farAway = 2; - Vector3i hitPos; + Vector3i hitPos = Vector3i::Zero; MESH_INFO* hitMesh = nullptr; GameVector start = GameVector(guardian->fireArcs[i]->pos1.x, guardian->fireArcs[i]->pos1.y, guardian->fireArcs[i]->pos1.z);