1.8: Fixed maps.

master
Howaner 2014-09-13 02:20:04 +02:00
parent 69afc4dbba
commit b462416e1f
12 changed files with 43 additions and 45 deletions

View File

@ -2337,18 +2337,18 @@ void cClientHandle::SendInventorySlot(char a_WindowID, short a_SlotNum, const cI
void cClientHandle::SendMapColumn(int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length) void cClientHandle::SendMapColumn(int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length, unsigned int m_Scale)
{ {
m_Protocol->SendMapColumn(a_ID, a_X, a_Y, a_Colors, a_Length); m_Protocol->SendMapColumn(a_ID, a_X, a_Y, a_Colors, a_Length, m_Scale);
} }
void cClientHandle::SendMapDecorators(int a_ID, const cMapDecoratorList & a_Decorators) void cClientHandle::SendMapDecorators(int a_ID, const cMapDecoratorList & a_Decorators, unsigned int m_Scale)
{ {
m_Protocol->SendMapDecorators(a_ID, a_Decorators); m_Protocol->SendMapDecorators(a_ID, a_Decorators, m_Scale);
} }

View File

@ -148,8 +148,8 @@ public:
void SendGameMode (eGameMode a_GameMode); void SendGameMode (eGameMode a_GameMode);
void SendHealth (void); void SendHealth (void);
void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item); void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item);
void SendMapColumn (int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length); void SendMapColumn (int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length, unsigned int m_Scale);
void SendMapDecorators (int a_ID, const cMapDecoratorList & a_Decorators); void SendMapDecorators (int a_ID, const cMapDecoratorList & a_Decorators, unsigned int m_Scale);
void SendMapInfo (int a_ID, unsigned int a_Scale); void SendMapInfo (int a_ID, unsigned int a_Scale);
void SendPaintingSpawn (const cPainting & a_Painting); void SendPaintingSpawn (const cPainting & a_Painting);
void SendPickupSpawn (const cPickup & a_Pickup); void SendPickupSpawn (const cPickup & a_Pickup);

View File

@ -432,7 +432,7 @@ void cMap::StreamNext(cMapClient & a_Client)
// This is dangerous as the player object may have been destroyed before the decorator is erased from the list // This is dangerous as the player object may have been destroyed before the decorator is erased from the list
UpdateDecorators(); UpdateDecorators();
Handle->SendMapDecorators(m_ID, m_Decorators); Handle->SendMapDecorators(m_ID, m_Decorators, m_Scale);
a_Client.m_NextDecoratorUpdate = 0; a_Client.m_NextDecoratorUpdate = 0;
} }
@ -444,7 +444,7 @@ void cMap::StreamNext(cMapClient & a_Client)
const Byte * Colors = &m_Data[Y * m_Height]; const Byte * Colors = &m_Data[Y * m_Height];
Handle->SendMapColumn(m_ID, Y, 0, Colors, m_Height); Handle->SendMapColumn(m_ID, Y, 0, Colors, m_Height, m_Scale);
} }
} }
@ -595,10 +595,10 @@ void cMap::SendTo(cClientHandle & a_Client)
{ {
const Byte* Colors = &m_Data[i * m_Height]; const Byte* Colors = &m_Data[i * m_Height];
a_Client.SendMapColumn(m_ID, i, 0, Colors, m_Height); a_Client.SendMapColumn(m_ID, i, 0, Colors, m_Height, m_Scale);
} }
a_Client.SendMapDecorators(m_ID, m_Decorators); a_Client.SendMapDecorators(m_ID, m_Decorators, m_Scale);
} }

View File

@ -86,8 +86,8 @@ public:
virtual void SendKeepAlive (int a_PingID) = 0; virtual void SendKeepAlive (int a_PingID) = 0;
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) = 0; virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) = 0;
virtual void SendLoginSuccess (void) = 0; virtual void SendLoginSuccess (void) = 0;
virtual void SendMapColumn (int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length) = 0; virtual void SendMapColumn (int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length, unsigned int m_Scale) = 0;
virtual void SendMapDecorators (int a_ID, const cMapDecoratorList & a_Decorators) = 0; virtual void SendMapDecorators (int a_ID, const cMapDecoratorList & a_Decorators, unsigned int m_Scale) = 0;
virtual void SendMapInfo (int a_ID, unsigned int a_Scale) = 0; virtual void SendMapInfo (int a_ID, unsigned int a_Scale) = 0;
virtual void SendPaintingSpawn (const cPainting & a_Painting) = 0; virtual void SendPaintingSpawn (const cPainting & a_Painting) = 0;
virtual void SendPickupSpawn (const cPickup & a_Pickup) = 0; virtual void SendPickupSpawn (const cPickup & a_Pickup) = 0;

View File

@ -608,7 +608,7 @@ void cProtocol125::SendLoginSuccess(void)
void cProtocol125::SendMapColumn(int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length) void cProtocol125::SendMapColumn(int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length, unsigned int m_Scale)
{ {
cCSLock Lock(m_CSPacket); cCSLock Lock(m_CSPacket);
@ -630,7 +630,7 @@ void cProtocol125::SendMapColumn(int a_ID, int a_X, int a_Y, const Byte * a_Colo
void cProtocol125::SendMapDecorators(int a_ID, const cMapDecoratorList & a_Decorators) void cProtocol125::SendMapDecorators(int a_ID, const cMapDecoratorList & a_Decorators, unsigned int m_Scale)
{ {
cCSLock Lock(m_CSPacket); cCSLock Lock(m_CSPacket);

View File

@ -57,8 +57,8 @@ public:
virtual void SendKeepAlive (int a_PingID) override; virtual void SendKeepAlive (int a_PingID) override;
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override; virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
virtual void SendLoginSuccess (void) override; virtual void SendLoginSuccess (void) override;
virtual void SendMapColumn (int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length) override; virtual void SendMapColumn (int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length, unsigned int m_Scale) override;
virtual void SendMapDecorators (int a_ID, const cMapDecoratorList & a_Decorators) override; virtual void SendMapDecorators (int a_ID, const cMapDecoratorList & a_Decorators, unsigned int m_Scale) override;
virtual void SendMapInfo (int a_ID, unsigned int a_Scale) override; virtual void SendMapInfo (int a_ID, unsigned int a_Scale) override;
virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) override; virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) override;
virtual void SendPaintingSpawn (const cPainting & a_Painting) override; virtual void SendPaintingSpawn (const cPainting & a_Painting) override;

View File

@ -715,7 +715,7 @@ void cProtocol172::SendPaintingSpawn(const cPainting & a_Painting)
void cProtocol172::SendMapColumn(int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length) void cProtocol172::SendMapColumn(int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length, unsigned int m_Scale)
{ {
ASSERT(m_State == 3); // In game mode? ASSERT(m_State == 3); // In game mode?
@ -737,7 +737,7 @@ void cProtocol172::SendMapColumn(int a_ID, int a_X, int a_Y, const Byte * a_Colo
void cProtocol172::SendMapDecorators(int a_ID, const cMapDecoratorList & a_Decorators) void cProtocol172::SendMapDecorators(int a_ID, const cMapDecoratorList & a_Decorators, unsigned int m_Scale)
{ {
ASSERT(m_State == 3); // In game mode? ASSERT(m_State == 3); // In game mode?
@ -775,7 +775,6 @@ void cProtocol172::SendMapInfo(int a_ID, unsigned int a_Scale)
void cProtocol172::SendPickupSpawn(const cPickup & a_Pickup) void cProtocol172::SendPickupSpawn(const cPickup & a_Pickup)
{ {
ASSERT(m_State == 3); // In game mode? ASSERT(m_State == 3); // In game mode?

View File

@ -94,8 +94,8 @@ public:
virtual void SendKeepAlive (int a_PingID) override; virtual void SendKeepAlive (int a_PingID) override;
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override; virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
virtual void SendLoginSuccess (void) override; virtual void SendLoginSuccess (void) override;
virtual void SendMapColumn (int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length) override; virtual void SendMapColumn (int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length, unsigned int m_Scale) override;
virtual void SendMapDecorators (int a_ID, const cMapDecoratorList & a_Decorators) override; virtual void SendMapDecorators (int a_ID, const cMapDecoratorList & a_Decorators, unsigned int m_Scale) override;
virtual void SendMapInfo (int a_ID, unsigned int a_Scale) override; virtual void SendMapInfo (int a_ID, unsigned int a_Scale) override;
virtual void SendPaintingSpawn (const cPainting & a_Painting) override; virtual void SendPaintingSpawn (const cPainting & a_Painting) override;
virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) override; virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) override;

View File

@ -728,18 +728,21 @@ void cProtocol180::SendPaintingSpawn(const cPainting & a_Painting)
void cProtocol180::SendMapColumn(int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length) void cProtocol180::SendMapColumn(int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length, unsigned int m_Scale)
{ {
ASSERT(m_State == 3); // In game mode? ASSERT(m_State == 3); // In game mode?
cPacketizer Pkt(*this, 0x34); cPacketizer Pkt(*this, 0x34);
Pkt.WriteVarInt(a_ID); Pkt.WriteVarInt(a_ID);
Pkt.WriteShort (3 + a_Length); Pkt.WriteByte(m_Scale);
Pkt.WriteByte(0); Pkt.WriteVarInt(0);
Pkt.WriteByte(1);
Pkt.WriteByte(a_Length);
Pkt.WriteByte(a_X); Pkt.WriteByte(a_X);
Pkt.WriteByte(a_Y); Pkt.WriteByte(a_Y);
Pkt.WriteVarInt(a_Length);
for (unsigned int i = 0; i < a_Length; ++i) for (unsigned int i = 0; i < a_Length; ++i)
{ {
Pkt.WriteByte(a_Colors[i]); Pkt.WriteByte(a_Colors[i]);
@ -750,15 +753,14 @@ void cProtocol180::SendMapColumn(int a_ID, int a_X, int a_Y, const Byte * a_Colo
void cProtocol180::SendMapDecorators(int a_ID, const cMapDecoratorList & a_Decorators) void cProtocol180::SendMapDecorators(int a_ID, const cMapDecoratorList & a_Decorators, unsigned int m_Scale)
{ {
ASSERT(m_State == 3); // In game mode? ASSERT(m_State == 3); // In game mode?
cPacketizer Pkt(*this, 0x34); cPacketizer Pkt(*this, 0x34);
Pkt.WriteVarInt(a_ID); Pkt.WriteVarInt(a_ID);
Pkt.WriteShort ((short)(1 + (3 * a_Decorators.size()))); Pkt.WriteByte(m_Scale);
Pkt.WriteVarInt(a_Decorators.size());
Pkt.WriteByte(1);
for (cMapDecoratorList::const_iterator it = a_Decorators.begin(); it != a_Decorators.end(); ++it) for (cMapDecoratorList::const_iterator it = a_Decorators.begin(); it != a_Decorators.end(); ++it)
{ {
@ -766,6 +768,8 @@ void cProtocol180::SendMapDecorators(int a_ID, const cMapDecoratorList & a_Decor
Pkt.WriteByte(it->GetPixelX()); Pkt.WriteByte(it->GetPixelX());
Pkt.WriteByte(it->GetPixelZ()); Pkt.WriteByte(it->GetPixelZ());
} }
Pkt.WriteByte(0);
} }
@ -774,21 +778,16 @@ void cProtocol180::SendMapDecorators(int a_ID, const cMapDecoratorList & a_Decor
void cProtocol180::SendMapInfo(int a_ID, unsigned int a_Scale) void cProtocol180::SendMapInfo(int a_ID, unsigned int a_Scale)
{ {
ASSERT(m_State == 3); // In game mode? UNUSED(a_ID);
UNUSED(a_Scale);
cPacketizer Pkt(*this, 0x34); // This packet was removed in 1.8
Pkt.WriteVarInt(a_ID);
Pkt.WriteShort (2);
Pkt.WriteByte(2);
Pkt.WriteByte(a_Scale);
} }
void cProtocol180::SendPickupSpawn(const cPickup & a_Pickup) void cProtocol180::SendPickupSpawn(const cPickup & a_Pickup)
{ {
ASSERT(m_State == 3); // In game mode? ASSERT(m_State == 3); // In game mode?

View File

@ -89,8 +89,8 @@ public:
virtual void SendKeepAlive (int a_PingID) override; virtual void SendKeepAlive (int a_PingID) override;
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override; virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
virtual void SendLoginSuccess (void) override; virtual void SendLoginSuccess (void) override;
virtual void SendMapColumn (int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length) override; virtual void SendMapColumn (int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length, unsigned int m_Scale) override;
virtual void SendMapDecorators (int a_ID, const cMapDecoratorList & a_Decorators) override; virtual void SendMapDecorators (int a_ID, const cMapDecoratorList & a_Decorators, unsigned int m_Scale) override;
virtual void SendMapInfo (int a_ID, unsigned int a_Scale) override; virtual void SendMapInfo (int a_ID, unsigned int a_Scale) override;
virtual void SendPaintingSpawn (const cPainting & a_Painting) override; virtual void SendPaintingSpawn (const cPainting & a_Painting) override;
virtual void SendPickupSpawn (const cPickup & a_Pickup) override; virtual void SendPickupSpawn (const cPickup & a_Pickup) override;

View File

@ -411,20 +411,20 @@ void cProtocolRecognizer::SendLoginSuccess(void)
void cProtocolRecognizer::SendMapColumn(int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length) void cProtocolRecognizer::SendMapColumn(int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length, unsigned int m_Scale)
{ {
ASSERT(m_Protocol != NULL); ASSERT(m_Protocol != NULL);
m_Protocol->SendMapColumn(a_ID, a_X, a_Y, a_Colors, a_Length); m_Protocol->SendMapColumn(a_ID, a_X, a_Y, a_Colors, a_Length, m_Scale);
} }
void cProtocolRecognizer::SendMapDecorators(int a_ID, const cMapDecoratorList & a_Decorators) void cProtocolRecognizer::SendMapDecorators(int a_ID, const cMapDecoratorList & a_Decorators, unsigned int m_Scale)
{ {
ASSERT(m_Protocol != NULL); ASSERT(m_Protocol != NULL);
m_Protocol->SendMapDecorators(a_ID, a_Decorators); m_Protocol->SendMapDecorators(a_ID, a_Decorators, m_Scale);
} }

View File

@ -93,8 +93,8 @@ public:
virtual void SendKeepAlive (int a_PingID) override; virtual void SendKeepAlive (int a_PingID) override;
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override; virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
virtual void SendLoginSuccess (void) override; virtual void SendLoginSuccess (void) override;
virtual void SendMapColumn (int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length) override; virtual void SendMapColumn (int a_ID, int a_X, int a_Y, const Byte * a_Colors, unsigned int a_Length, unsigned int m_Scale) override;
virtual void SendMapDecorators (int a_ID, const cMapDecoratorList & a_Decorators) override; virtual void SendMapDecorators (int a_ID, const cMapDecoratorList & a_Decorators, unsigned int m_Scale) override;
virtual void SendMapInfo (int a_ID, unsigned int a_Scale) override; virtual void SendMapInfo (int a_ID, unsigned int a_Scale) override;
virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) override; virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) override;
virtual void SendPaintingSpawn (const cPainting & a_Painting) override; virtual void SendPaintingSpawn (const cPainting & a_Painting) override;