rendered paste bodyIndex: src/framework/Platform/CompilerDefs.h
===================================================================
--- src/framework/Platform/CompilerDefs.h (revision 5635)
+++ src/framework/Platform/CompilerDefs.h (working copy)
@@ -24,7 +24,7 @@
#define PLATFORM_APPLE 2
#define PLATFORM_INTEL 3
-// must be first (win 64 also define WIN32
+// must be first (win 64 also define WIN32)
#if defined( _WIN64 )
# define PLATFORM PLATFORM_WINDOWS
#elif defined( __WIN32__ ) || defined( WIN32 ) || defined( _WIN32 )
Index: src/game/ConfusedMovementGenerator.cpp
===================================================================
--- src/game/ConfusedMovementGenerator.cpp (revision 5635)
+++ src/game/ConfusedMovementGenerator.cpp (working copy)
@@ -64,7 +64,7 @@
}
unit.StopMoving();
- unit.setMoveRunFlag(true);
+ unit.SetUnitMovementFlag(MOVEMENT_FLAG_RUN);
}
template<>
Index: src/game/Creature.cpp
===================================================================
--- src/game/Creature.cpp (revision 5635)
+++ src/game/Creature.cpp (working copy)
@@ -204,7 +204,7 @@
else
{
RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
- setMoveRunFlag(false);
+ RemoveUnitMovementFlag(MOVEMENT_FLAG_RUN);
SetUInt32Value(UNIT_NPC_FLAGS, cinfo->npcflag);
SetHealth(GetMaxHealth());
@@ -896,7 +896,7 @@
m_gossipOptionLoaded = true;
}
-void Creature::AI_SendMoveToPacket(float x, float y, float z, uint32 time, bool run, uint8 type)
+void Creature::AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint32 MovementFlags, uint8 type)
{
/* uint32 timeElap = getMSTime();
if ((timeElap - m_startMove) < m_moveTime)
@@ -916,7 +916,7 @@
m_startMove = getMSTime();
m_moveTime = time;*/
- SendMonsterMove(x,y,z,type,run,time);
+ SendMonsterMove(x, y, z, type, MovementFlags, time);
}
Player *Creature::GetLootRecipient() const
@@ -1483,7 +1483,7 @@
CreatureInfo const *cinfo = objmgr.GetCreatureTemplate(this->GetEntry());
SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0);
RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
- setMoveRunFlag(false);
+ RemoveUnitMovementFlag(MOVEMENT_FLAG_RUN);
SetUInt32Value(UNIT_NPC_FLAGS, cinfo->npcflag);
clearUnitState(UNIT_STAT_ALL_STATE);
i_motionMaster.Clear();
Index: src/game/Creature.h
===================================================================
--- src/game/Creature.h (revision 5635)
+++ src/game/Creature.h (working copy)
@@ -360,7 +360,7 @@
bool AIM_Initialize();
- void AI_SendMoveToPacket(float x, float y, float z, uint32 time, bool run, uint8 type);
+ void AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint32 MovementFlags, uint8 type);
CreatureAI* AI() { return i_AI; }
uint32 GetShieldBlockValue() const //dunno mob block value
Index: src/game/HomeMovementGenerator.cpp
===================================================================
--- src/game/HomeMovementGenerator.cpp (revision 5635)
+++ src/game/HomeMovementGenerator.cpp (working copy)
@@ -28,7 +28,7 @@
void
HomeMovementGenerator<Creature>::Initialize(Creature & owner)
{
- owner.setMoveRunFlag(true);
+ owner.SetUnitMovementFlag(MOVEMENT_FLAG_RUN);
_setTargetLocation(owner);
}
@@ -64,7 +64,7 @@
if (time_diff > i_travel_timer)
{
- owner.setMoveRunFlag(false);
+ owner.RemoveUnitMovementFlag(MOVEMENT_FLAG_RUN);
// restore orientation of not moving creature at returning to home
if(owner.GetDefaultMovementType()==IDLE_MOTION_TYPE)
Index: src/game/Level3.cpp
===================================================================
--- src/game/Level3.cpp (revision 5635)
+++ src/game/Level3.cpp (working copy)
@@ -4648,6 +4648,22 @@
return true;
}
+ if (strncmp(args, "run", 3) == 0)
+ {
+ caster->SetUnitMovementFlag(MOVEMENT_FLAG_RUN);
+ caster->RemoveUnitMovementFlag(MOVEMENT_FLAG_SWIM_FLY);
+ }
+ else if (strncmp(args, "fly", 3) == 0)
+ {
+ caster->SetUnitMovementFlag(MOVEMENT_FLAG_RUN);
+ caster->SetUnitMovementFlag(MOVEMENT_FLAG_SWIM_FLY);
+ }
+ else
+ {
+ caster->RemoveUnitMovementFlag(MOVEMENT_FLAG_RUN);
+ caster->RemoveUnitMovementFlag(MOVEMENT_FLAG_SWIM_FLY);
+ }
+
if (caster->GetTypeId() == TYPEID_PLAYER)
caster->GetMotionMaster()->Mutate(new PointMovementGenerator<Player>(0, m_session->GetPlayer()->GetPositionX(), m_session->GetPlayer()->GetPositionY(), m_session->GetPlayer()->GetPositionZ()));
else caster->GetMotionMaster()->Mutate(new PointMovementGenerator<Creature>(0, m_session->GetPlayer()->GetPositionX(), m_session->GetPlayer()->GetPositionY(), m_session->GetPlayer()->GetPositionZ()));
Index: src/game/RandomMovementGenerator.cpp
===================================================================
--- src/game/RandomMovementGenerator.cpp (revision 5635)
+++ src/game/RandomMovementGenerator.cpp (working copy)
@@ -129,8 +129,11 @@
else
{
creature.StopMoving();
- creature.setMoveRunFlag(!urand(0,10));
+ if (!urand(0, 10))
+ creature.SetUnitMovementFlag(MOVEMENT_FLAG_RUN);
+ else creature.RemoveUnitMovementFlag(MOVEMENT_FLAG_RUN);
+
++i_nextMove;
if( i_nextMove == MAX_RAND_WAYPOINTS )
{
Index: src/game/SpellAuras.cpp
===================================================================
--- src/game/SpellAuras.cpp (revision 5635)
+++ src/game/SpellAuras.cpp (working copy)
@@ -530,7 +530,7 @@
//+vmaps
if((z<=pos_z+1.3 && z>=pos_z-1.3) && m_target->IsWithinLOS(x,y,z))
{
- m_target->SendMonsterMove(x,y,z,0,true,(diff*2));
+ m_target->SendMonsterMove(x, y, z, 0, m_target->GetUnitMovementFlags(), (diff*2));
if(m_target->GetTypeId() != TYPEID_PLAYER)
MapManager::Instance().GetMap(m_target->GetMapId(), m_target)->CreatureRelocation((Creature*)m_target,x,y,z,m_target->GetOrientation());
}
@@ -545,7 +545,7 @@
if((z<=pos_z+1.3 && z>=pos_z-1.3) && m_target->IsWithinLOS(x,y,z))
{
- m_target->SendMonsterMove(x,y,z,0,true,(diff*2));
+ m_target->SendMonsterMove(x, y, z, 0, m_target->GetUnitMovementFlags(), (diff*2));
if(m_target->GetTypeId() != TYPEID_PLAYER)
MapManager::Instance().GetMap(m_target->GetMapId(), m_target)->CreatureRelocation((Creature*)m_target,x,y,z,m_target->GetOrientation());
}
Index: src/game/SpellEffects.cpp
===================================================================
--- src/game/SpellEffects.cpp (revision 5635)
+++ src/game/SpellEffects.cpp (working copy)
@@ -4607,7 +4607,7 @@
if(unitTarget->GetTypeId() != TYPEID_PLAYER)
((Creature *)unitTarget)->StopMoving();
- m_caster->SendMonsterMove(x, y, z, 0, true,1);
+ m_caster->SendMonsterMove(x, y, z, 0, m_caster->GetUnitMovementFlags(), 1);
if(m_caster->GetTypeId() != TYPEID_PLAYER)
MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)->CreatureRelocation((Creature*)m_caster,x,y,z,m_caster->GetOrientation());
Index: src/game/TargetedMovementGenerator.cpp
===================================================================
--- src/game/TargetedMovementGenerator.cpp (revision 5635)
+++ src/game/TargetedMovementGenerator.cpp (working copy)
@@ -80,7 +80,7 @@
{
if(!&owner)
return;
- owner.setMoveRunFlag(true);
+ owner.SetUnitMovementFlag(MOVEMENT_FLAG_RUN);
_setTargetLocation(owner);
}
Index: src/game/Traveller.h
===================================================================
--- src/game/Traveller.h (revision 5635)
+++ src/game/Traveller.h (working copy)
@@ -59,7 +59,7 @@
template<>
inline float Traveller<Creature>::Speed()
{
- return i_traveller.GetSpeed(i_traveller.getMoveRunFlag() ? MOVE_RUN : MOVE_WALK);
+ return i_traveller.GetSpeed( i_traveller.HasUnitMovementFlag(MOVEMENT_FLAG_RUN) ? MOVE_RUN : MOVE_WALK);
}
template<>
@@ -71,7 +71,7 @@
template<>
inline void Traveller<Creature>::MoveTo(float x, float y, float z, uint32 t)
{
- i_traveller.AI_SendMoveToPacket(x, y, z, t, i_traveller.getMoveRunFlag(), 0);
+ i_traveller.AI_SendMoveToPacket(x, y, z, t, i_traveller.GetUnitMovementFlags(), 0);
}
// specialization for players
@@ -81,7 +81,7 @@
if (i_traveller.isInFlight())
return PLAYER_FLIGHT_SPEED;
else
- return i_traveller.GetSpeed(i_traveller.getMoveRunFlag() ? MOVE_RUN : MOVE_WALK);
+ return i_traveller.GetSpeed(i_traveller.HasUnitMovementFlag(MOVEMENT_FLAG_RUN) ? MOVE_RUN : MOVE_WALK);
}
template<>
@@ -93,7 +93,7 @@
template<>
inline void Traveller<Player>::MoveTo(float x, float y, float z, uint32 t)
{
- i_traveller.SendMonsterMove(x, y, z, 0, i_traveller.getMoveRunFlag(), t);
+ i_traveller.SendMonsterMove(x, y, z, 0, i_traveller.GetUnitMovementFlags(), t);
}
typedef Traveller<Creature> CreatureTraveller;
Index: src/game/Unit.cpp
===================================================================
--- src/game/Unit.cpp (revision 5635)
+++ src/game/Unit.cpp (working copy)
@@ -210,7 +210,7 @@
m_removedAuras = 0;
m_charmInfo = NULL;
- m_moveRun = false;
+ m_unit_movement_flags = 0;
// remove aurastates allowing special moves
for(int i=0; i < MAX_REACTIVE; ++i)
@@ -306,7 +306,7 @@
return false;
}
-void Unit::SendMoveToPacket(float x, float y, float z, bool run, uint32 transitTime)
+void Unit::SendMoveToPacket(float x, float y, float z, uint32 MovementFlags, uint32 transitTime)
{
float dx = x - GetPositionX();
float dy = y - GetPositionY();
@@ -318,17 +318,18 @@
dist = 0;
else
dist = sqrt(dist);
- double speed = GetSpeed(run ? MOVE_RUN : MOVE_WALK);
+
+ double speed = GetSpeed((MovementFlags & MOVEMENT_FLAG_RUN) ? MOVE_RUN : MOVE_WALK);
if(speed<=0)
speed = 2.5f;
speed *= 0.001f;
transitTime = static_cast<uint32>(dist / speed + 0.5);
}
//float orientation = (float)atan2((double)dy, (double)dx);
- SendMonsterMove(x,y,z,0,run,transitTime);
+ SendMonsterMove(x, y, z, 0, MovementFlags, transitTime);
}
-void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, bool Run, uint32 Time)
+void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time)
{
WorldPacket data( SMSG_MONSTER_MOVE, (41 + GetPackGUID().size()) );
data.append(GetPackGUID());
@@ -356,10 +357,9 @@
break;
}
- data << uint32(Run ? 0x00000100 : 0x00000000); // flags (0x100 - running, 0x200 - taxi)
- /* Flags:
- 512: Floating, moving without walking/running
- */
+ //Movement Flags (0x0 = walk, 0x100 = run, 0x200 = fly/swim)
+ data << uint32(MovementFlags);
+
data << Time; // Time in between points
data << uint32(1); // 1 single waypoint
data << NewPosX << NewPosY << NewPosZ; // the single waypoint Point B
@@ -9626,8 +9626,9 @@
void Unit::StopMoving()
{
clearUnitState(UNIT_STAT_MOVING);
+
// send explicit stop packet
- SendMonsterMove(GetPositionX(), GetPositionY(), GetPositionZ(),0,true,0);
+ SendMonsterMove(GetPositionX(), GetPositionY(), GetPositionZ(),0, GetUnitMovementFlags(), 0);
// update position and orientation;
WorldPacket data;
Index: src/game/Unit.h
===================================================================
--- src/game/Unit.h (revision 5635)
+++ src/game/Unit.h (working copy)
@@ -587,6 +587,15 @@
// delay time next attack to prevent client attack animation problems
#define ATTACK_DISPLAY_DELAY 200
+// MonsterMove packet movement flags
+enum MovementFlag
+{
+ MOVEMENT_FLAG_NONE = 0x00000000,
+ MOVEMENT_FLAG_RUN = 0x00000100,
+
+ MOVEMENT_FLAG_SWIM_FLY = 0x00000200,
+};
+
class MANGOS_DLL_SPEC Unit : public WorldObject
{
public:
@@ -834,7 +843,7 @@
void SendSpellNonMeleeDamageLog(Unit *target,uint32 SpellID,uint32 Damage, SpellSchools DamageType,uint32 AbsorbedDamage, uint32 Resist,bool PhysicalDamage, uint32 Blocked, bool CriticalHit = false);
void SendSpellMiss(Unit *target, uint32 spellID, SpellMissInfo missInfo);
- void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, bool Run, uint32 Time);
+ void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time);
virtual void MoveOutOfRange(Player &) { };
@@ -999,7 +1008,7 @@
AuraList const& GetAurasByType(AuraType type) const { return m_modAuras[type]; }
void ApplyAuraProcTriggerDamage(Aura* aura, bool apply);
int32 GetTotalAuraModifier(AuraType auratype) const;
- void SendMoveToPacket(float x, float y, float z, bool run, uint32 transitTime = 0);
+ void SendMoveToPacket(float x, float y, float z, uint32 MovementFlags, uint32 transitTime = 0);
uint32 GetDisplayId() { return GetUInt32Value(UNIT_FIELD_DISPLAYID); }
void SetDisplayId(uint32 modelId);
uint32 GetNativeDisplayId() { return GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID); }
@@ -1064,8 +1073,14 @@
bool IsStopped() const { return !(hasUnitState(UNIT_STAT_MOVING)); }
void StopMoving();
- void setMoveRunFlag(bool f) { m_moveRun = f; }
- bool getMoveRunFlag() const { return m_moveRun; }
+ void SetUnitMovementFlag(uint32 f) { m_unit_movement_flags |= f; }
+ void RemoveUnitMovementFlag(uint32 f)
+ {
+ uint32 oldval = m_unit_movement_flags;
+ m_unit_movement_flags = oldval & ~f;
+ }
+ uint32 HasUnitMovementFlag(uint32 f) const { return m_unit_movement_flags & f; }
+ uint32 GetUnitMovementFlags() const { return m_unit_movement_flags; }
void AddComboPointHolder(uint32 lowguid) { m_ComboPointHolders.insert(lowguid); }
void RemoveComboPointHolder(uint32 lowguid) { m_ComboPointHolders.erase(lowguid); }
@@ -1132,7 +1147,7 @@
SpellSchools GetMeleeDamageSchool() const;
MotionMaster i_motionMaster;
- bool m_moveRun;
+ uint32 m_unit_movement_flags;
uint32 m_reactiveTimer[MAX_REACTIVE];