* assign WorldObject position on _MovementUpdate()

* disabled SSE-support, might fix problems on older machines (you can still enable it to increase speed)
This commit is contained in:
False.Genesis 2007-03-01 18:16:11 +00:00
parent bc74818daa
commit 0379c2ccf0
5 changed files with 81 additions and 6 deletions

View File

@ -43,12 +43,17 @@ WorldObject::WorldObject()
_m = 0; _m = 0;
} }
void WorldObject::SetPosition(float x, float y, float z, float o, uint16 _map) void WorldObject::SetPosition(float x, float y, float z, float o)
{ {
_x = x; _x = x;
_y = y; _y = y;
_z = z; _z = z;
_o = o; _o = o;
}
void WorldObject::SetPosition(float x, float y, float z, float o, uint16 _map)
{
SetPosition(x,y,z,o);
_m = _map; _m = _map;
} }

View File

@ -92,6 +92,7 @@ class WorldObject : public Object
public: public:
virtual ~WorldObject ( ) {} virtual ~WorldObject ( ) {}
void SetPosition(float x, float y, float z, float o, uint16 _map); void SetPosition(float x, float y, float z, float o, uint16 _map);
void SetPosition(float x, float y, float z, float o);
inline float GetX(void) { return _x; } inline float GetX(void) { return _x; }
inline float GetY(void) { return _y; } inline float GetY(void) { return _y; }
inline float GetZ(void) { return _z; } inline float GetZ(void) { return _z; }

View File

@ -3,13 +3,44 @@
#include "Object.h" #include "Object.h"
enum UnitMoveType
{
MOVE_WALK =0,
MOVE_RUN =1,
MOVE_WALKBACK =2,
MOVE_SWIM =3,
MOVE_SWIMBACK =4,
MOVE_TURN =5,
MAX_MOVE_TYPE =6
};
enum UnitFlags
{
UNIT_FLAG_NONE = 0x00000000,
UNIT_FLAG_DISABLE_MOVE = 0x00000004,
UNIT_FLAG_UNKNOWN1 = 0x00000008, // essential for all units..
UNIT_FLAG_RENAME = 0x00000010, // rename creature
UNIT_FLAG_RESTING = 0x00000020,
UNIT_FLAG_PVP = 0x00001000,
UNIT_FLAG_MOUNT = 0x00002000,
UNIT_FLAG_DISABLE_ROTATE = 0x00040000,
UNIT_FLAG_IN_COMBAT = 0x00080000,
UNIT_FLAG_SKINNABLE = 0x04000000,
UNIT_FLAG_SHEATHE = 0x40000000
};
class Unit : public WorldObject class Unit : public WorldObject
{ {
public: public:
Unit(); Unit();
void Create(uint64); void Create(uint64);
uint8 GetGender(void); uint8 GetGender(void);
private: void SetSpeed(uint8 speednr, float speed) { _speed[speednr] = speed; }
float GetSpeed(uint8 speednr) { return _speed[speednr]; }
protected:
float _speed[MAX_MOVE_TYPE];
}; };

View File

@ -170,6 +170,7 @@ void WorldSession::_MovementUpdate(uint8 objtypeid, uint64 uguid, WorldPacket& r
if(objtypeid==TYPEID_PLAYER) if(objtypeid==TYPEID_PLAYER)
{ {
Unit *u = (Unit*)objmgr.GetObj(uguid);
recvPacket >> flags2 >> time; recvPacket >> flags2 >> time;
if (flags2 & 0x02000000) // On a transport if (flags2 & 0x02000000) // On a transport
@ -192,9 +193,24 @@ void WorldSession::_MovementUpdate(uint8 objtypeid, uint64 uguid, WorldPacket& r
recvPacket >> unkf; recvPacket >> unkf;
} }
recvPacket >> speedWalk >> speedRun >> speedSwimBack >> speedSwim >> speedWalkBack >> speedTurn; recvPacket >> speedWalk >> speedRun >> speedSwimBack >> speedSwim >> speedWalkBack >> speedTurn;
if(u)
{
u->SetPosition(x,y,z,o);
u->SetSpeed(MOVE_WALK,speedWalk);
u->SetSpeed(MOVE_RUN,speedRun);
u->SetSpeed(MOVE_SWIMBACK,speedSwimBack);
u->SetSpeed(MOVE_SWIM,speedSwim);
u->SetSpeed(MOVE_WALKBACK,speedWalkBack);
u->SetSpeed(MOVE_TURN,speedTurn);
}
else
{
logerror("WorldSession::_MovementUpdate for unknown guid "I64FMT" typeid=%u",uguid,objtypeid);
}
} }
if(objtypeid==TYPEID_UNIT) if(objtypeid==TYPEID_UNIT)
{ {
Unit *u = (Unit*)objmgr.GetObj(uguid);
recvPacket >> flags2 >> unk32 >> x >> y >> z >> o >> unkf; recvPacket >> flags2 >> unk32 >> x >> y >> z >> o >> unkf;
recvPacket >> speedWalk >> speedRun >> speedSwimBack >> speedSwim >> speedWalkBack >> speedTurn; recvPacket >> speedWalk >> speedRun >> speedSwimBack >> speedSwim >> speedWalkBack >> speedTurn;
@ -207,18 +223,41 @@ void WorldSession::_MovementUpdate(uint8 objtypeid, uint64 uguid, WorldPacket& r
recvPacket >> unkf >> unkf >> unkf; // Some x, y, z value recvPacket >> unkf >> unkf >> unkf; // Some x, y, z value
} }
} }
if(u)
{
u->SetPosition(x,y,z,o);
u->SetSpeed(MOVE_WALK,speedWalk);
u->SetSpeed(MOVE_RUN,speedRun);
u->SetSpeed(MOVE_SWIMBACK,speedSwimBack);
u->SetSpeed(MOVE_SWIM,speedSwim);
u->SetSpeed(MOVE_WALKBACK,speedWalkBack);
u->SetSpeed(MOVE_TURN,speedTurn);
}
else
{
logerror("WorldSession::_MovementUpdate for unknown guid "I64FMT" typeid=%u",uguid,objtypeid);
}
} }
if( (objtypeid==TYPEID_CORPSE) || (objtypeid==TYPEID_GAMEOBJECT) || (objtypeid==TYPEID_DYNAMICOBJECT)) if( (objtypeid==TYPEID_CORPSE) || (objtypeid==TYPEID_GAMEOBJECT) || (objtypeid==TYPEID_DYNAMICOBJECT))
{ {
Unit *u = (Unit*)objmgr.GetObj(uguid);
if(GUID_HIPART(uguid) != HIGHGUID_TRANSPORT) if(GUID_HIPART(uguid) != HIGHGUID_TRANSPORT)
{ {
recvPacket >> x >> y >> z; recvPacket >> x >> y >> z;
if(u)
u->SetPosition(x,y,z,u->GetO());
else
logerror("WorldSession::_MovementUpdate for unknown guid "I64FMT" typeid=%u",uguid,objtypeid);
} }
else else
{ {
recvPacket >> unk32 >> unk32 >> unk32; // should be 0? recvPacket >> unk32 >> unk32 >> unk32; // should be 0?
} }
recvPacket >> o; recvPacket >> o;
if(u)
u->SetPosition(u->GetX(),u->GetY(),u->GetZ(),o);
else
logerror("WorldSession::_MovementUpdate for unknown guid "I64FMT" typeid=%u",uguid,objtypeid);
} }
recvPacket >> unk32; // (uint32)0x1 recvPacket >> unk32; // (uint32)0x1

View File

@ -27,14 +27,13 @@
GlobalOptimizations="TRUE" GlobalOptimizations="TRUE"
InlineFunctionExpansion="2" InlineFunctionExpansion="2"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OptimizeForWindowsApplication="TRUE"
AdditionalIncludeDirectories="shared;Client;Client/World;Client/Realm;dep/include" AdditionalIncludeDirectories="shared;Client;Client/World;Client/Realm;dep/include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
StringPooling="FALSE" StringPooling="TRUE"
RuntimeLibrary="0" RuntimeLibrary="0"
BufferSecurityCheck="FALSE" BufferSecurityCheck="FALSE"
EnableFunctionLevelLinking="FALSE" EnableFunctionLevelLinking="FALSE"
EnableEnhancedInstructionSet="1" EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=".\Release/PseuWoW.pch" PrecompiledHeaderFile=".\Release/PseuWoW.pch"
AssemblerListingLocation="$(SolutionDir)/temp/$(ProjectName)/$(ConfigurationName)/" AssemblerListingLocation="$(SolutionDir)/temp/$(ProjectName)/$(ConfigurationName)/"
ObjectFile="$(SolutionDir)/temp/$(ProjectName)/$(ConfigurationName)/" ObjectFile="$(SolutionDir)/temp/$(ProjectName)/$(ConfigurationName)/"
@ -71,7 +70,7 @@
<Tool <Tool
Name="VCResourceCompilerTool" Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG" PreprocessorDefinitions="NDEBUG"
Culture="1031"/> Culture="0"/>
<Tool <Tool
Name="VCWebServiceProxyGeneratorTool"/> Name="VCWebServiceProxyGeneratorTool"/>
<Tool <Tool