Correctly draw creatures bigger than 64x64
Battlelist icon
This commit is contained in:
parent
11990815a6
commit
6bd0e37670
|
@ -202,27 +202,27 @@ void Creature::drawOutfit(const Rect& destRect, bool resize)
|
||||||
|
|
||||||
if(g_graphics.canUseFBO()) {
|
if(g_graphics.canUseFBO()) {
|
||||||
const FrameBufferPtr& outfitBuffer = g_framebuffers.getTemporaryFrameBuffer();
|
const FrameBufferPtr& outfitBuffer = g_framebuffers.getTemporaryFrameBuffer();
|
||||||
outfitBuffer->resize(Size(2*Otc::TILE_PIXELS, 2*Otc::TILE_PIXELS));
|
outfitBuffer->resize(Size(exactSize, exactSize));
|
||||||
outfitBuffer->bind();
|
outfitBuffer->bind();
|
||||||
g_painter->setAlphaWriting(true);
|
g_painter->setAlphaWriting(true);
|
||||||
g_painter->clear(Color::alpha);
|
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();
|
outfitBuffer->release();
|
||||||
|
|
||||||
Rect srcRect;
|
Rect srcRect;
|
||||||
if(resize)
|
if(resize)
|
||||||
srcRect.resize(exactSize, exactSize);
|
srcRect.resize(exactSize, exactSize);
|
||||||
else
|
else
|
||||||
srcRect.resize(2*Otc::TILE_PIXELS*0.75f, 2*Otc::TILE_PIXELS*0.75f);
|
srcRect.resize(exactSize*0.75f, exactSize*0.75f);
|
||||||
srcRect.moveBottomRight(Point(2*Otc::TILE_PIXELS - 1, 2*Otc::TILE_PIXELS - 1));
|
srcRect.moveBottomRight(Point(exactSize - 1, exactSize - 1));
|
||||||
outfitBuffer->draw(destRect, srcRect);
|
outfitBuffer->draw(destRect, srcRect);
|
||||||
} else {
|
} else {
|
||||||
float scaleFactor;
|
float scaleFactor;
|
||||||
if(resize)
|
if(resize)
|
||||||
scaleFactor = destRect.width() / (float)exactSize;
|
scaleFactor = destRect.width() / (float)exactSize;
|
||||||
else
|
else
|
||||||
scaleFactor = destRect.width() / (float)(2*Otc::TILE_PIXELS*0.75f);
|
scaleFactor = destRect.width() / (float)(exactSize*0.75f);
|
||||||
Point dest = destRect.bottomRight() - (Point(Otc::TILE_PIXELS,Otc::TILE_PIXELS) - getDisplacement())*scaleFactor;
|
Point dest = destRect.bottomRight() - (Point(exactSize - Otc::TILE_PIXELS, exactSize - Otc::TILE_PIXELS) - getDisplacement()) * scaleFactor;
|
||||||
internalDrawOutfit(dest, scaleFactor, false, true, Otc::South);
|
internalDrawOutfit(dest, scaleFactor, false, true, Otc::South);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -341,12 +341,8 @@ bool Minimap::loadOtmm(const std::string& fileName)
|
||||||
pos.y = fin->getU16();
|
pos.y = fin->getU16();
|
||||||
pos.z = fin->getU8();
|
pos.z = fin->getU8();
|
||||||
|
|
||||||
// end of file
|
// end of file or file is corrupted
|
||||||
if(!pos.isValid())
|
if(!pos.isValid() || pos.z >= Otc::MAX_Z+1)
|
||||||
break;
|
|
||||||
|
|
||||||
// corrupted file
|
|
||||||
if(pos.z >= Otc::MAX_Z+1)
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
MinimapBlock& block = getBlock(pos);
|
MinimapBlock& block = getBlock(pos);
|
||||||
|
|
Loading…
Reference in New Issue