From 6bd0e37670535af5a967013f7e00c88b4d90e0b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20Ku=C5=9Bnierz?= Date: Tue, 12 May 2015 10:16:14 +0200 Subject: [PATCH] Correctly draw creatures bigger than 64x64 Battlelist icon --- src/client/creature.cpp | 12 ++++++------ src/client/minimap.cpp | 8 ++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/client/creature.cpp b/src/client/creature.cpp index 6e6bb63c..e0740521 100644 --- a/src/client/creature.cpp +++ b/src/client/creature.cpp @@ -202,27 +202,27 @@ void Creature::drawOutfit(const Rect& destRect, bool resize) if(g_graphics.canUseFBO()) { const FrameBufferPtr& outfitBuffer = g_framebuffers.getTemporaryFrameBuffer(); - outfitBuffer->resize(Size(2*Otc::TILE_PIXELS, 2*Otc::TILE_PIXELS)); + outfitBuffer->resize(Size(exactSize, exactSize)); outfitBuffer->bind(); g_painter->setAlphaWriting(true); g_painter->clear(Color::alpha); - internalDrawOutfit(Point(Otc::TILE_PIXELS,Otc::TILE_PIXELS) + getDisplacement(), 1, false, true, Otc::South); + internalDrawOutfit(Point(exactSize - Otc::TILE_PIXELS, exactSize - Otc::TILE_PIXELS) + getDisplacement(), 1, false, true, Otc::South); outfitBuffer->release(); Rect srcRect; if(resize) srcRect.resize(exactSize, exactSize); else - srcRect.resize(2*Otc::TILE_PIXELS*0.75f, 2*Otc::TILE_PIXELS*0.75f); - srcRect.moveBottomRight(Point(2*Otc::TILE_PIXELS - 1, 2*Otc::TILE_PIXELS - 1)); + srcRect.resize(exactSize*0.75f, exactSize*0.75f); + srcRect.moveBottomRight(Point(exactSize - 1, exactSize - 1)); outfitBuffer->draw(destRect, srcRect); } else { float scaleFactor; if(resize) scaleFactor = destRect.width() / (float)exactSize; else - scaleFactor = destRect.width() / (float)(2*Otc::TILE_PIXELS*0.75f); - Point dest = destRect.bottomRight() - (Point(Otc::TILE_PIXELS,Otc::TILE_PIXELS) - getDisplacement())*scaleFactor; + scaleFactor = destRect.width() / (float)(exactSize*0.75f); + Point dest = destRect.bottomRight() - (Point(exactSize - Otc::TILE_PIXELS, exactSize - Otc::TILE_PIXELS) - getDisplacement()) * scaleFactor; internalDrawOutfit(dest, scaleFactor, false, true, Otc::South); } } diff --git a/src/client/minimap.cpp b/src/client/minimap.cpp index 734b76c6..304909a7 100644 --- a/src/client/minimap.cpp +++ b/src/client/minimap.cpp @@ -341,12 +341,8 @@ bool Minimap::loadOtmm(const std::string& fileName) pos.y = fin->getU16(); pos.z = fin->getU8(); - // end of file - if(!pos.isValid()) - break; - - // corrupted file - if(pos.z >= Otc::MAX_Z+1) + // end of file or file is corrupted + if(!pos.isValid() || pos.z >= Otc::MAX_Z+1) break; MinimapBlock& block = getBlock(pos);