* Read Spline Movement part from Update Packets

Not used so far
This commit is contained in:
Shlainn 2011-11-25 10:04:47 +01:00
parent af476c9595
commit e41764e23c
2 changed files with 75 additions and 25 deletions

View File

@ -58,6 +58,37 @@ enum MovementFlags2
MOVEMENTFLAG2_UNK10 = 0x8000, MOVEMENTFLAG2_UNK10 = 0x8000,
MOVEMENTFLAG2_INTERP_MASK = MOVEMENTFLAG2_INTERP_MOVEMENT | MOVEMENTFLAG2_INTERP_TURNING | MOVEMENTFLAG2_INTERP_PITCHING MOVEMENTFLAG2_INTERP_MASK = MOVEMENTFLAG2_INTERP_MOVEMENT | MOVEMENTFLAG2_INTERP_TURNING | MOVEMENTFLAG2_INTERP_PITCHING
}; };
enum SplineFlags{
SF_None = 0x00000000,
// x00-xFF(first byte) used as animation Ids storage in pair with Animation flag
SF_Done = 0x00000100,
SF_Falling = 0x00000200, // Affects elevation computation, can't be combined with Parabolic flag
SF_No_Spline = 0x00000400,
SF_Parabolic = 0x00000800, // Affects elevation computation, can't be combined with Falling flag
SF_Walkmode = 0x00001000,
SF_Flying = 0x00002000, // Smooth movement(Catmullrom interpolation mode), flying animation
SF_OrientationFixed = 0x00004000, // Model orientation fixed
SF_Final_Point = 0x00008000,
SF_Final_Target = 0x00010000,
SF_Final_Angle = 0x00020000,
SF_Catmullrom = 0x00040000, // Used Catmullrom interpolation mode
SF_Cyclic = 0x00080000, // Movement by cycled spline
SF_Enter_Cycle = 0x00100000, // Everytimes appears with cyclic flag in monster move packet, erases first spline vertex after first cycle done
SF_Animation = 0x00200000, // Plays animation after some time passed
SF_Frozen = 0x00400000, // Will never arrive
SF_Unknown5 = 0x00800000,
SF_Unknown6 = 0x01000000,
SF_Unknown7 = 0x02000000,
SF_Unknown8 = 0x04000000,
SF_OrientationInversed = 0x08000000,
SF_Unknown10 = 0x10000000,
SF_Unknown11 = 0x20000000,
SF_Unknown12 = 0x40000000,
SF_Unknown13 = 0x80000000,
};
struct MovementInfo struct MovementInfo
{ {
static uint8 _c; //Version switch helper static uint8 _c; //Version switch helper

View File

@ -187,7 +187,7 @@ void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket)
Set.defaultarg = toString(uguid); Set.defaultarg = toString(uguid);
Set.arg[0] = toString(objtypeid); Set.arg[0] = toString(objtypeid);
GetInstance()->GetScripts()->RunScript("_onobjectcreate", &Set); GetInstance()->GetScripts()->RunScript("_onobjectcreate", &Set);
} }
// if our own character got finally created, we have successfully entered the world, // if our own character got finally created, we have successfully entered the world,
@ -198,23 +198,23 @@ void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket)
case UPDATETYPE_OUT_OF_RANGE_OBJECTS: case UPDATETYPE_OUT_OF_RANGE_OBJECTS:
{ {
recvPacket >> usize; recvPacket >> usize;
for(uint16 i=0;i<usize;i++) for(uint32 i=0;i<usize;i++)
{ {
uguid = recvPacket.readPackGUID(); // not 100% sure if this is correct uguid = recvPacket.readPackGUID(); // not 100% sure if this is correct
logdebug("GUID "I64FMT" out of range",uguid); logdebug("GUID "I64FMT" out of range",uguid);
// call script just before object removal // // call script just before object removal
if(GetInstance()->GetScripts()->ScriptExists("_onobjectdelete")) // if(GetInstance()->GetScripts()->ScriptExists("_onobjectdelete"))
{ // {
Object *del_obj = objmgr.GetObj(uguid); // Object *del_obj = objmgr.GetObj(uguid);
CmdSet Set; // CmdSet Set;
Set.defaultarg = toString(uguid); // Set.defaultarg = toString(uguid);
Set.arg[0] = del_obj ? toString(del_obj->GetTypeId()) : ""; // Set.arg[0] = del_obj ? toString(del_obj->GetTypeId()) : "";
Set.arg[1] = "true"; // out of range = true // Set.arg[1] = "true"; // out of range = true
GetInstance()->GetScripts()->RunScript("_onobjectdelete", &Set); // GetInstance()->GetScripts()->RunScript("_onobjectdelete", &Set);
} // }
//
objmgr.Remove(uguid, false); // objmgr.Remove(uguid, false);
} }
} }
break; break;
@ -252,7 +252,7 @@ void WorldSession::_MovementUpdate(uint8 objtypeid, uint64 uguid, WorldPacket& r
uint32 unk32; uint32 unk32;
uint16 client = GetInstance()->GetConf()->client; uint16 client = GetInstance()->GetConf()->client;
Object *obj = (Object*)objmgr.GetObj(uguid, true); // also depleted objects Object *obj = (Object*)objmgr.GetObj(uguid, true); // also depleted objects
Unit *u = NULL; Unit *u = NULL;
if(obj) if(obj)
@ -278,7 +278,7 @@ void WorldSession::_MovementUpdate(uint8 objtypeid, uint64 uguid, WorldPacket& r
if(flags & UPDATEFLAG_LIVING) if(flags & UPDATEFLAG_LIVING)
{ {
recvPacket >> mi; recvPacket >> mi;
logdev("MovementUpdate: TypeID=%u GUID="I64FMT" pObj=%X flags=%x mi.flags=%x",objtypeid,uguid,obj,flags,mi.flags); logdev("MovementUpdate: TypeID=%u GUID="I64FMT" pObj=%X flags=%x mi.flags=%x",objtypeid,uguid,obj,flags,mi.flags);
logdev("FLOATS: x=%f y=%f z=%f o=%f",mi.pos.x, mi.pos.y, mi.pos.z ,mi.pos.o); logdev("FLOATS: x=%f y=%f z=%f o=%f",mi.pos.x, mi.pos.y, mi.pos.z ,mi.pos.o);
if(obj && obj->IsWorldObject()) if(obj && obj->IsWorldObject())
@ -289,11 +289,11 @@ void WorldSession::_MovementUpdate(uint8 objtypeid, uint64 uguid, WorldPacket& r
logdev("TRANSPORT @ mi.flags: guid="I64FMT" x=%f y=%f z=%f o=%f", mi.t_guid, mi.t_pos.x, mi.t_pos.y, mi.t_pos.z, mi.t_pos.o); logdev("TRANSPORT @ mi.flags: guid="I64FMT" x=%f y=%f z=%f o=%f", mi.t_guid, mi.t_pos.x, mi.t_pos.y, mi.t_pos.z, mi.t_pos.o);
} }
if((mi.flags & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING)) || (mi.flags2 & MOVEMENTFLAG2_ALLOW_PITCHING)) if((mi.flags & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING)) || (mi.flags2 & MOVEMENTFLAG2_ALLOW_PITCHING))
{ {
logdev("MovementUpdate: MOVEMENTFLAG_SWIMMING or FLYING is set, angle = %f!", mi.s_angle); logdev("MovementUpdate: MOVEMENTFLAG_SWIMMING or FLYING is set, angle = %f!", mi.s_angle);
} }
logdev("MovementUpdate: FallTime = %u", mi.fallTime); logdev("MovementUpdate: FallTime = %u", mi.fallTime);
if(mi.flags & MOVEMENTFLAG_FALLING) if(mi.flags & MOVEMENTFLAG_FALLING)
@ -330,8 +330,27 @@ void WorldSession::_MovementUpdate(uint8 objtypeid, uint64 uguid, WorldPacket& r
// TODO: correct this one as soon as its meaning is known OR if it appears often and needs to be fixed // TODO: correct this one as soon as its meaning is known OR if it appears often and needs to be fixed
if(mi.flags & MOVEMENTFLAG_SPLINE_ENABLED) if(mi.flags & MOVEMENTFLAG_SPLINE_ENABLED)
{ {
logerror("MovementUpdate: MOVEMENTFLAG_SPLINE2 is set, if you see this message please report it!"); logdev("MovementUpdate: MOVEMENTFLAG_SPLINE_ENABLED!");
return; //checked for 3.3.5
//We do not do anything with the spline stuff so far, it just needs to be read to be skipped correctly
uint32 splineflags, timepassed, duration, id, effect_start_time, path_nodes;
uint8 spline_mode;
float facing_angle,facing_x,facing_y,facing_z, duration_mod, duration_next, vertical_acceleration;
float x,y,z;
uint64 facing_target;
recvPacket >> splineflags;
if(splineflags & SF_Final_Angle)
recvPacket >> facing_angle;
if(splineflags & SF_Final_Point)
recvPacket >> facing_x >> facing_y >> facing_z;
recvPacket >> timepassed >> duration >> id >> duration_mod >> duration_next >> vertical_acceleration >> effect_start_time;
recvPacket >> path_nodes;
for(uint32 i = 0;i<path_nodes;i++)
{
recvPacket >> x >> y >> z;
}
recvPacket >> spline_mode;
recvPacket >> x >> y >> z; // FinalDestination
} }
} }
else // !UPDATEFLAG_LIVING else // !UPDATEFLAG_LIVING
@ -346,7 +365,7 @@ void WorldSession::_MovementUpdate(uint8 objtypeid, uint64 uguid, WorldPacket& r
if (obj && obj->IsWorldObject()) if (obj && obj->IsWorldObject())
((WorldObject*)obj)->SetPosition(x, y, z, o); ((WorldObject*)obj)->SetPosition(x, y, z, o);
} }
else else
{ {
if(flags & UPDATEFLAG_HAS_POSITION) if(flags & UPDATEFLAG_HAS_POSITION)
@ -356,7 +375,7 @@ void WorldSession::_MovementUpdate(uint8 objtypeid, uint64 uguid, WorldPacket& r
{ {
recvPacket >> x >> y >> z >> o; recvPacket >> x >> y >> z >> o;
// only zeroes here // only zeroes here
} }
else else
{ {
recvPacket >> x >> y >> z >> o; recvPacket >> x >> y >> z >> o;
@ -382,7 +401,7 @@ void WorldSession::_MovementUpdate(uint8 objtypeid, uint64 uguid, WorldPacket& r
} }
if(client == CLIENT_CLASSIC_WOW && flags & UPDATEFLAG_ALL_6005) if(client == CLIENT_CLASSIC_WOW && flags & UPDATEFLAG_ALL_6005)
{ {
recvPacket >> unk32; recvPacket >> unk32;
// MaNGOS sends 1 always. // MaNGOS sends 1 always.
logdev("MovementUpdate: UPDATEFLAG_ALL is set, got %X", unk32); logdev("MovementUpdate: UPDATEFLAG_ALL is set, got %X", unk32);
} }
@ -402,7 +421,7 @@ void WorldSession::_MovementUpdate(uint8 objtypeid, uint64 uguid, WorldPacket& r
if(flags & UPDATEFLAG_VEHICLE) // unused for now if(flags & UPDATEFLAG_VEHICLE) // unused for now
{ {
uint32 vehicleId; uint32 vehicleId;
float facingAdj; float facingAdj;
recvPacket >> vehicleId >> facingAdj; recvPacket >> vehicleId >> facingAdj;
@ -462,7 +481,7 @@ void WorldSession::_ValuesUpdate(uint64 uguid, WorldPacket& recvPacket)
else else
{ {
recvPacket >> value; // drop the value, since object doesnt exist (always 4 bytes) recvPacket >> value; // drop the value, since object doesnt exist (always 4 bytes)
} }
} }
} }
} }