* added some more SMSG_(COMPRESSED_)UPDATE_OBJECT stuff.
* we have year 2007 now
This commit is contained in:
parent
f7415df6e3
commit
c00ad9aae3
@ -1,11 +1,15 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "ZCompressor.h"
|
#include "ZCompressor.h"
|
||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
|
#include "Object.h"
|
||||||
#include "UpdateData.h"
|
#include "UpdateData.h"
|
||||||
|
#include "UpdateFields.h"
|
||||||
|
#include "UpdateMask.h"
|
||||||
|
|
||||||
|
|
||||||
void WorldSession::_HandleCompressedUpdateObjectOpcode(WorldPacket& recvPacket)
|
void WorldSession::_HandleCompressedUpdateObjectOpcode(WorldPacket& recvPacket)
|
||||||
{
|
{
|
||||||
printf("-> COMPRESSED_UPDATE_OBJECT, pktlen=%u\n",recvPacket.size());
|
//printf("-> COMPRESSED_UPDATE_OBJECT, pktlen=%u\n",recvPacket.size());
|
||||||
//recvPacket.hexlike();
|
//recvPacket.hexlike();
|
||||||
uint32 realsize;
|
uint32 realsize;
|
||||||
recvPacket >> realsize;
|
recvPacket >> realsize;
|
||||||
@ -14,10 +18,9 @@ void WorldSession::_HandleCompressedUpdateObjectOpcode(WorldPacket& recvPacket)
|
|||||||
z.Compressed(true);
|
z.Compressed(true);
|
||||||
z.RealSize(realsize);
|
z.RealSize(realsize);
|
||||||
z.Inflate();
|
z.Inflate();
|
||||||
printf("-> Uncompressed to %u bytes\n",z.size());
|
|
||||||
if(z.Compressed())
|
if(z.Compressed())
|
||||||
{
|
{
|
||||||
log("ERROR: _HandleCompressedUpdateObjectOpcode(): Inflate() failed!");
|
logerror("_HandleCompressedUpdateObjectOpcode(): Inflate() failed!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
WorldPacket wp;
|
WorldPacket wp;
|
||||||
@ -29,25 +32,71 @@ void WorldSession::_HandleCompressedUpdateObjectOpcode(WorldPacket& recvPacket)
|
|||||||
|
|
||||||
void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket)
|
void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket)
|
||||||
{
|
{
|
||||||
printf("-> UPDATE_OBJECT, pktlen=%u\n",recvPacket.size());
|
|
||||||
//recvPacket.hexlike();
|
//recvPacket.hexlike();
|
||||||
uint8 utype;
|
uint8 utype;
|
||||||
uint32 usize;
|
uint8 unk8;
|
||||||
|
uint32 usize, ublocks;
|
||||||
uint64 uguid;
|
uint64 uguid;
|
||||||
//while(true)
|
recvPacket >> ublocks >> unk8;
|
||||||
|
logdebug("UpdateObject: ublocks=%u unk=%u",ublocks,unk8);
|
||||||
|
//while(true) // need to read full packet as soon as the structure is 100% known & implemented
|
||||||
|
// for now reading first object is enough
|
||||||
{
|
{
|
||||||
recvPacket >> utype >> usize;
|
recvPacket >> utype;
|
||||||
|
logdebug("UpdateObject: utype=%u",utype);
|
||||||
switch(utype)
|
switch(utype)
|
||||||
{
|
{
|
||||||
case UPDATETYPE_OUT_OF_RANGE_OBJECTS:
|
case UPDATETYPE_OUT_OF_RANGE_OBJECTS:
|
||||||
|
recvPacket >> usize;
|
||||||
for(uint16 i=0;i<usize;i++)
|
for(uint16 i=0;i<usize;i++)
|
||||||
{
|
{
|
||||||
recvPacket >> uguid;
|
uguid = recvPacket.GetPackedGuid(); // not 100% sure if this is correct
|
||||||
printf("DEBUG: GUID "I64FMT" out of range\n",uguid);
|
logdebug("GUID "I64FMT" out of range",uguid);
|
||||||
// TODO: delete object from known objects list
|
// TODO: delete object from known objects list
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case UPDATETYPE_VALUES:
|
||||||
|
{
|
||||||
|
uguid = recvPacket.GetPackedGuid(); // not 100% sure if this is correct
|
||||||
|
uint8 maskblocks;
|
||||||
|
recvPacket >> maskblocks;
|
||||||
|
logdebug("UPDATETYPE_VALUES: guid="I64FMT" maskblocks=%u",uguid,maskblocks);
|
||||||
|
// need some help with the lines below, got no idea what to do now.
|
||||||
|
UpdateMask umask;
|
||||||
|
umask.SetCount(maskblocks*8); // ??
|
||||||
|
std::vector<uint8> udata;
|
||||||
|
//udata.resize(?)
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UPDATETYPE_CREATE_OBJECT:
|
||||||
|
case UPDATETYPE_CREATE_OBJECT2:
|
||||||
|
{
|
||||||
|
uguid = recvPacket.GetPackedGuid();
|
||||||
|
uint8 objtypeid;
|
||||||
|
recvPacket >> objtypeid;
|
||||||
|
logdebug("Create Object type %u with guid "I64FMT,objtypeid,uguid);
|
||||||
|
if(objtypeid==TYPEID_PLAYER)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
if(objtypeid==TYPEID_UNIT)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
if( (objtypeid==TYPEID_CORPSE) || (objtypeid==TYPEID_GAMEOBJECT) || (objtypeid==TYPEID_DYNAMICOBJECT))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// (TODO) and then: Add object to objmgr
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
124
src/Client/World/UpdateMask.h
Normal file
124
src/Client/World/UpdateMask.h
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005,2006,2007 MaNGOS <http://www.mangosproject.org/>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __UPDATEMASK_H
|
||||||
|
#define __UPDATEMASK_H
|
||||||
|
|
||||||
|
//#include "UpdateFields.h"
|
||||||
|
//#include "Errors.h"
|
||||||
|
|
||||||
|
class UpdateMask
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
UpdateMask( ) : mCount( 0 ), mBlocks( 0 ), mUpdateMask( 0 ) { }
|
||||||
|
UpdateMask( const UpdateMask& mask ) : mUpdateMask( 0 ) { *this = mask; }
|
||||||
|
|
||||||
|
~UpdateMask( )
|
||||||
|
{
|
||||||
|
if(mUpdateMask)
|
||||||
|
delete [] mUpdateMask;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void SetBit (uint32 index)
|
||||||
|
{
|
||||||
|
( (uint8 *)mUpdateMask )[ index >> 3 ] |= 1 << ( index & 0x7 );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void UnsetBit (uint32 index)
|
||||||
|
{
|
||||||
|
( (uint8 *)mUpdateMask )[ index >> 3 ] &= (0xff ^ (1 << ( index & 0x7 ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool GetBit (uint32 index)
|
||||||
|
{
|
||||||
|
return ( ( (uint8 *)mUpdateMask)[ index >> 3 ] & ( 1 << ( index & 0x7 ) )) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline uint32 GetBlockCount() { return mBlocks; }
|
||||||
|
inline uint32 GetLength() { return mBlocks << 2; }
|
||||||
|
inline uint32 GetCount() { return mCount; }
|
||||||
|
inline uint8* GetMask() { return (uint8*)mUpdateMask; }
|
||||||
|
|
||||||
|
inline void SetCount (uint32 valuesCount)
|
||||||
|
{
|
||||||
|
if(mUpdateMask)
|
||||||
|
delete [] mUpdateMask;
|
||||||
|
|
||||||
|
mCount = valuesCount;
|
||||||
|
mBlocks = (valuesCount + 31) / 32;
|
||||||
|
|
||||||
|
mUpdateMask = new uint32[mBlocks];
|
||||||
|
memset(mUpdateMask, 0, mBlocks << 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Clear()
|
||||||
|
{
|
||||||
|
if (mUpdateMask)
|
||||||
|
memset(mUpdateMask, 0, mBlocks << 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline UpdateMask& operator = ( const UpdateMask& mask )
|
||||||
|
{
|
||||||
|
SetCount(mask.mCount);
|
||||||
|
memcpy(mUpdateMask, mask.mUpdateMask, mBlocks << 2);
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void operator &= ( const UpdateMask& mask )
|
||||||
|
{
|
||||||
|
//ASSERT(mask.mCount <= mCount);
|
||||||
|
for (uint32 i = 0; i < mBlocks; i++)
|
||||||
|
mUpdateMask[i] &= mask.mUpdateMask[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void operator |= ( const UpdateMask& mask )
|
||||||
|
{
|
||||||
|
//ASSERT(mask.mCount <= mCount);
|
||||||
|
for (uint32 i = 0; i < mBlocks; i++)
|
||||||
|
mUpdateMask[i] |= mask.mUpdateMask[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline UpdateMask operator & ( const UpdateMask& mask ) const
|
||||||
|
{
|
||||||
|
//ASSERT(mask.mCount <= mCount);
|
||||||
|
|
||||||
|
UpdateMask newmask;
|
||||||
|
newmask = *this;
|
||||||
|
newmask &= mask;
|
||||||
|
|
||||||
|
return newmask;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline UpdateMask operator | ( const UpdateMask& mask ) const
|
||||||
|
{
|
||||||
|
//ASSERT(mask.mCount <= mCount);
|
||||||
|
|
||||||
|
UpdateMask newmask;
|
||||||
|
newmask = *this;
|
||||||
|
newmask |= mask;
|
||||||
|
|
||||||
|
return newmask;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint32 mCount;
|
||||||
|
uint32 mBlocks;
|
||||||
|
uint32 *mUpdateMask;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
@ -71,7 +71,7 @@ void abortproc(void)
|
|||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
printf("\n (C) 2006, Snowstorm Software\n\n\n");
|
printf("\n (C) 2006,2007 Snowstorm Software\n\n\n");
|
||||||
|
|
||||||
_HookSignals();
|
_HookSignals();
|
||||||
|
|
||||||
|
|||||||
@ -305,6 +305,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\Client\World\UpdateFields.h">
|
RelativePath=".\Client\World\UpdateFields.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\World\UpdateMask.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Client\World\WorldPacket.cpp">
|
RelativePath=".\Client\World\WorldPacket.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user