aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2016-08-01 14:55:13 -0300
committerjoschiwald <joschiwald.trinity@gmail.com>2017-02-11 21:37:40 +0100
commit9c0f2c49457930bf4a0dc27a51e5c22b2013dbfd (patch)
tree7b6ee83e7f90ef060ffa79d63622d0765ff1e838 /src
parentaf11f48356475a516c0cc0b6ca972c64e8dab93b (diff)
Core/PvP: Gameobject rotation in BGs and Wintergrasp.
- Add a workaround in BattleGround correcting for bad rotations in BG scripts - Calculate rotation from rotation in Wintergrasp, this function hasn't a rotation parameter and should be added in the future. - Also removed an ugly hardcode in Battlefield::SpawnGameObject Closes #17711 (cherry picked from commit 33fbc453d236d943c24fb10522ac0720c3174c3d) # Conflicts: # src/server/game/Battlefield/Battlefield.cpp # src/server/game/Battlegrounds/Battleground.cpp
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Battlefield/Battlefield.cpp5
-rw-r--r--src/server/game/Battlegrounds/Battleground.cpp13
2 files changed, 16 insertions, 2 deletions
diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp
index 90db806ad28..cd037f8002d 100644
--- a/src/server/game/Battlefield/Battlefield.cpp
+++ b/src/server/game/Battlefield/Battlefield.cpp
@@ -826,9 +826,12 @@ GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z
return nullptr;
}
+ // Calculate rotation
+ G3D::Quat rot = G3D::Matrix3::fromEulerAnglesZYX(o, 0.f, 0.f);
+
// Create gameobject
GameObject* go = new GameObject;
- if (!go->Create(entry, map, PHASEMASK_NORMAL, Position(x, y, z, o), G3D::Quat(), 255, GO_STATE_READY))
+ if (!go->Create(entry, map, PHASEMASK_NORMAL, Position(x, y, z, o), rot, 255, GO_STATE_READY))
{
TC_LOG_ERROR("bg.battlefield", "Battlefield::SpawnGameObject: Could not create gameobject template %u! Battlefield has not been created!", entry);
delete go;
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index 32c964d171d..86c6b5d8cc5 100644
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -1458,11 +1458,22 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float
Map* map = FindBgMap();
if (!map)
return false;
+
+ G3D::Quat rot(rotation0, rotation1, rotation2, rotation3);
+ // Temporally add safety check for bad spawns and send log (object rotations need to be rechecked in sniff)
+ if (!rotation0 && !rotation1 && !rotation2 && !rotation3)
+ {
+ TC_LOG_DEBUG("bg.battleground", "Battleground::AddObject: gameoobject [entry: %u, object type: %u] for BG (map: %u) has zeroed rotation fields, "
+ "orientation used temporally, but please fix the spawn", entry, type, m_MapId);
+
+ rot = G3D::Matrix3::fromEulerAnglesZYX(o, 0.f, 0.f);
+ }
+
// Must be created this way, adding to godatamap would add it to the base map of the instance
// and when loading it (in go::LoadFromDB()), a new guid would be assigned to the object, and a new object would be created
// So we must create it specific for this instance
GameObject* go = new GameObject;
- if (!go->Create(entry, GetBgMap(), PHASEMASK_NORMAL, Position(x, y, z, o), G3D::Quat(rotation0, rotation1, rotation2, rotation3), 255, goState))
+ if (!go->Create(entry, GetBgMap(), PHASEMASK_NORMAL, Position(x, y, z, o), rot, 255, goState))
{
TC_LOG_ERROR("bg.battleground", "Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!",
entry, m_MapId, m_InstanceID);