From ffa4a06c4b6577d90668981afd22f36024235fb8 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Wed, 31 Aug 2011 19:42:52 -0300 Subject: [PATCH] creatures walk almost there --- src/otclient/core/tile.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/otclient/core/tile.cpp b/src/otclient/core/tile.cpp index 4de916d1..869a314b 100644 --- a/src/otclient/core/tile.cpp +++ b/src/otclient/core/tile.cpp @@ -63,9 +63,18 @@ void Tile::draw(int x, int y) } // creatures - for(const ThingPtr& thing : m_things) { - if(thing->asCreature()) - thing->draw(x - m_drawElevation, y - m_drawElevation); + for(int xi = -1; xi <= 0; ++xi) { + for(int yi = -1; yi <= 0; ++yi) { + for(CreaturePtr creature : g_map.getTile(m_position + Position(xi, yi, 0))->getCreatures()) { + // own creatures that are walking east/south + if(xi == 0 && yi == 0 && creature->getWalkOffsetX() <= 0 && creature->getWalkOffsetY() <= 0) { + creature->draw(x - m_drawElevation, y - m_drawElevation); + // creatures from other tiles that are walking to north/west + } else if(xi != 0 && yi != 0 && (creature->getWalkOffsetX() > 0 || creature->getWalkOffsetY() > 0)) { + creature->draw(x - m_drawElevation + xi*32, y - m_drawElevation + yi*32); + } + } + } } // effects