moved Color to Defines.h

This commit is contained in:
2023-01-02 12:21:27 +01:00
parent 386ea5b6ad
commit 7d30017742
6 changed files with 27 additions and 20 deletions

View File

@@ -20,7 +20,7 @@ WorldClient::WorldClient(ClientGame* game) : game::World(game), protocol::Packet
void WorldClient::HandlePacket(const protocol::WorldBeginDataPacket* packet) {
LoadMap(packet);
if (m_Game->GetGameState() == game::GameState::Game) {
const game::Color& backgroundColor = GetBackgroundColor();
const Color& backgroundColor = GetBackgroundColor();
m_Game->GetRenderer()->SetBackgroundColor({ static_cast<float>(backgroundColor.r / 255.0f), static_cast<float>(backgroundColor.g / 255.0f),
static_cast<float>(backgroundColor.b / 255.0f) });
}

View File

@@ -96,7 +96,7 @@ void PlayerLoginPacket::Deserialize(DataBuffer& data) {
DataBuffer WorldBeginDataPacket::Serialize(bool packetID) const {
DataBuffer data;
const game::TowerTileColorPalette& towerTilePalette = m_Header.m_World->GetTowerTileColorPalette();
const std::vector<game::Color>& decoTilePalette = m_Header.m_World->GetDecorationPalette();
const std::vector<Color>& decoTilePalette = m_Header.m_World->GetDecorationPalette();
WritePacketID(data, packetID);
@@ -105,9 +105,9 @@ DataBuffer WorldBeginDataPacket::Serialize(bool packetID) const {
// deco color palette
std::size_t bufferSize = data.GetSize();
data.Resize(bufferSize + decoTilePalette.size() * sizeof(game::Color));
data.Resize(bufferSize + decoTilePalette.size() * sizeof(Color));
memcpy(reinterpret_cast<std::uint8_t*>(data.data()) + bufferSize, decoTilePalette.data(), decoTilePalette.size() * sizeof(game::Color));
memcpy(reinterpret_cast<std::uint8_t*>(data.data()) + bufferSize, decoTilePalette.data(), decoTilePalette.size() * sizeof(Color));
data << m_Header.m_World->GetBackgroundColor();
@@ -135,7 +135,7 @@ void WorldBeginDataPacket::Deserialize(DataBuffer& data) {
std::uint16_t decoPaletteSize;
data >> decoPaletteSize;
std::size_t decoPalletteSizeByte = decoPaletteSize * sizeof(game::Color);
std::size_t decoPalletteSizeByte = decoPaletteSize * sizeof(Color);
m_Header.m_DecorationPalette.resize(decoPaletteSize);

View File

@@ -78,7 +78,7 @@ GL::VertexArray LoadWorldModel(const td::game::World* world) {
static_cast<float>(chunkX + tileX + 1), static_cast<float>(chunkY + tileY + 1),
});
const td::game::Color* tileColor = world->GetTileColor(tile);
const td::Color* tileColor = world->GetTileColor(tile);
for (int i = 0; i < 6; i++) {
int color = 255;