aboutsummaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authortartalo <none@none>2009-11-07 18:47:11 +0100
committertartalo <none@none>2009-11-07 18:47:11 +0100
commit5b7ef6fd2fd95e944807f07dcf181b9f1e4ea573 (patch)
treefa91e4f72eed68a5b7198dbbf031ceb7d288c444 /src/game
parentc922e2a3052b5353d4a64dbe140e3d5bb291c805 (diff)
Set proper orientation after being teleported by spell, by Spp. Closes #100
--HG-- branch : trunk
Diffstat (limited to 'src/game')
-rw-r--r--src/game/Spell.cpp14
-rw-r--r--src/game/Spell.h2
-rw-r--r--src/game/SpellEffects.cpp13
-rw-r--r--src/game/Unit.cpp2
4 files changed, 16 insertions, 15 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index c9d84d2cb41..9ec20a11c40 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -159,9 +159,9 @@ void SpellCastTargets::setSrc(Position *pos)
}
}
-void SpellCastTargets::setDst(float x, float y, float z, uint32 mapId)
+void SpellCastTargets::setDst(float x, float y, float z, float orientation, uint32 mapId)
{
- m_dstPos.Relocate(x, y, z);
+ m_dstPos.Relocate(x, y, z, orientation);
m_targetMask |= TARGET_FLAG_DEST_LOCATION;
if(mapId != MAPID_INVALID)
m_dstPos.m_mapId = mapId;
@@ -1831,7 +1831,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
float dis = rand_norm() * (max_dis - min_dis) + min_dis;
float x, y, z;
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE, dis);
- m_targets.setDst(x, y, z);
+ m_targets.setDst(x, y, z, m_caster->GetOrientation());
break;
}
case TARGET_UNIT_MASTER:
@@ -2095,9 +2095,9 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
if(m_spellInfo->Effect[0] == SPELL_EFFECT_TELEPORT_UNITS
|| m_spellInfo->Effect[1] == SPELL_EFFECT_TELEPORT_UNITS
|| m_spellInfo->Effect[2] == SPELL_EFFECT_TELEPORT_UNITS)
- m_targets.setDst(st->target_X, st->target_Y, st->target_Z, (int32)st->target_mapId);
+ m_targets.setDst(st->target_X, st->target_Y, st->target_Z, st->target_Orientation, (int32)st->target_mapId);
else if(st->target_mapId == m_caster->GetMapId())
- m_targets.setDst(st->target_X, st->target_Y, st->target_Z);
+ m_targets.setDst(st->target_X, st->target_Y, st->target_Z, st->target_Orientation);
}
else
{
@@ -2110,7 +2110,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
break;
case TARGET_DST_HOME:
if(m_caster->GetTypeId() == TYPEID_PLAYER)
- m_targets.setDst(((Player*)m_caster)->m_homebindX,((Player*)m_caster)->m_homebindY,((Player*)m_caster)->m_homebindZ, ((Player*)m_caster)->m_homebindMapId);
+ m_targets.setDst(((Player*)m_caster)->m_homebindX,((Player*)m_caster)->m_homebindY,((Player*)m_caster)->m_homebindZ, ((Player*)m_caster)->GetOrientation(), ((Player*)m_caster)->m_homebindMapId);
break;
case TARGET_DST_NEARBY_ENTRY:
{
@@ -6717,7 +6717,7 @@ void Spell::SelectTrajTargets()
}
}
- m_targets.setDst(x, y, z);
+ m_targets.setDst(x, y, z, m_caster->GetOrientation());
}
}
diff --git a/src/game/Spell.h b/src/game/Spell.h
index ecf6ed90c2a..85d8c46771e 100644
--- a/src/game/Spell.h
+++ b/src/game/Spell.h
@@ -149,7 +149,7 @@ class SpellCastTargets
void setUnitTarget(Unit *target);
void setSrc(float x, float y, float z);
void setSrc(Position *pos);
- void setDst(float x, float y, float z, uint32 mapId = MAPID_INVALID);
+ void setDst(float x, float y, float z, float orientation, uint32 mapId = MAPID_INVALID);
void setDst(Position *pos);
uint64 getGOTargetGUID() const { return m_GOTargetGUID; }
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index c55001a2d84..eec4fd837bf 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -2493,14 +2493,15 @@ void Spell::EffectTeleportUnits(uint32 i)
// Init dest coordinates
uint32 mapid = m_targets.m_dstPos.GetMapId();
- if(mapid == MAPID_INVALID)
+ if (mapid == MAPID_INVALID)
mapid = unitTarget->GetMapId();
- float x, y, z;
- m_targets.m_dstPos.GetPosition(x, y, z);
- float orientation = m_targets.getUnitTarget() ? m_targets.getUnitTarget()->GetOrientation() : unitTarget->GetOrientation();
- sLog.outDebug("Spell::EffectTeleportUnits - teleport unit to %u %f %f %f\n", mapid, x, y, z);
+ float x, y, z, orientation;
+ m_targets.m_dstPos.GetPosition(x, y, z, orientation);
+ if (!orientation && m_targets.getUnitTarget())
+ orientation = m_targets.getUnitTarget()->GetOrientation();
+ sLog.outDebug("Spell::EffectTeleportUnits - teleport unit to %u %f %f %f %f\n", mapid, x, y, z, orientation);
- if(mapid == unitTarget->GetMapId())
+ if (mapid == unitTarget->GetMapId())
unitTarget->NearTeleportTo(x, y, z, orientation, unitTarget == m_caster);
else if(unitTarget->GetTypeId() == TYPEID_PLAYER)
((Player*)unitTarget)->TeleportTo(mapid, x, y, z, orientation, unitTarget == m_caster ? TELE_TO_SPELL : 0);
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 6492abaf3a6..76d93255f34 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -1070,7 +1070,7 @@ void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered,
Spell *spell = new Spell(this, spellInfo, triggered, originalCaster );
SpellCastTargets targets;
- targets.setDst(x, y, z);
+ targets.setDst(x, y, z, GetOrientation());
if(OriginalVictim)
targets.setUnitTarget(OriginalVictim);
spell->m_CastItem = castItem;