diff --git a/src/otclient/core/tile.cpp b/src/otclient/core/tile.cpp index 2e236e7d..b4f45d49 100644 --- a/src/otclient/core/tile.cpp +++ b/src/otclient/core/tile.cpp @@ -42,10 +42,24 @@ void Tile::draw(int x, int y) // first bottom items for(const ThingPtr& thing : m_things) { const ThingType& type = thing->getType(); - if(thing->asCreature() || type.isOnTop) - continue; + if(!type.isGround && !type.isGroundClip && !type.isOnBottom) + break; thing->draw(x - m_drawElevation, y - m_drawElevation); m_drawElevation += type.elevation; + if(m_drawElevation > MAX_DRAW_ELEVATION) + m_drawElevation = MAX_DRAW_ELEVATION; + } + + // now common items + for(auto it = m_things.rbegin(); it != m_things.rend(); ++it) { + const ThingPtr& thing = *it; + const ThingType& type = thing->getType(); + if(type.isOnTop || type.isOnBottom || type.isGround || type.isGroundClip) + break; + thing->draw(x - m_drawElevation, y - m_drawElevation); + m_drawElevation += type.elevation; + if(m_drawElevation > MAX_DRAW_ELEVATION) + m_drawElevation = MAX_DRAW_ELEVATION; } // creatures @@ -164,7 +178,7 @@ bool Tile::isFullyOpaque() ThingPtr firstObject = getThing(0); if(firstObject) { const ThingType& type = firstObject->getType(); - if(type.isGround && !type.isTranslucent) + if(type.isFullGround) return true; } return false; diff --git a/src/otclient/core/tile.h b/src/otclient/core/tile.h index b7056ef2..62dde733 100644 --- a/src/otclient/core/tile.h +++ b/src/otclient/core/tile.h @@ -28,6 +28,9 @@ class Tile : public LuaObject { + enum { + MAX_DRAW_ELEVATION = 24 + }; public: Tile(const Position& position); diff --git a/src/otclient/net/protocolgameparse.cpp b/src/otclient/net/protocolgameparse.cpp index d4284de8..6e840f16 100644 --- a/src/otclient/net/protocolgameparse.cpp +++ b/src/otclient/net/protocolgameparse.cpp @@ -903,7 +903,7 @@ void ProtocolGame::setTileDescription(InputMessage& msg, Position position) logWarning("Too many things!"); ThingPtr thing = internalGetThing(msg); - g_map.addThing(thing, position); + g_map.addThing(thing, position, 255); } stackPos++; }