mirror of
https://github.com/edubart/otclient.git
synced 2025-04-30 09:39:21 +02:00
Merge pull request #1070 from Ochmar/master
Getting rid of redraw on lying corpse
This commit is contained in:
commit
066df4dd52
@ -94,9 +94,6 @@ void Tile::draw(const Point& dest, float scaleFactor, int drawFlags, LightView *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int redrawPreviousTopW = 0;
|
|
||||||
int redrawPreviousTopH = 0;
|
|
||||||
|
|
||||||
if(drawFlags & Otc::DrawItems) {
|
if(drawFlags & Otc::DrawItems) {
|
||||||
// now common items in reverse order
|
// now common items in reverse order
|
||||||
for(auto it = m_things.rbegin(); it != m_things.rend(); ++it) {
|
for(auto it = m_things.rbegin(); it != m_things.rend(); ++it) {
|
||||||
@ -104,34 +101,12 @@ void Tile::draw(const Point& dest, float scaleFactor, int drawFlags, LightView *
|
|||||||
if(thing->isOnTop() || thing->isOnBottom() || thing->isGroundBorder() || thing->isGround() || thing->isCreature())
|
if(thing->isOnTop() || thing->isOnBottom() || thing->isGroundBorder() || thing->isGround() || thing->isCreature())
|
||||||
break;
|
break;
|
||||||
thing->draw(dest - m_drawElevation*scaleFactor, scaleFactor, animate, lightView);
|
thing->draw(dest - m_drawElevation*scaleFactor, scaleFactor, animate, lightView);
|
||||||
|
|
||||||
if(thing->isLyingCorpse()) {
|
|
||||||
redrawPreviousTopW = std::max<int>(thing->getWidth(), redrawPreviousTopW);
|
|
||||||
redrawPreviousTopH = std::max<int>(thing->getHeight(), redrawPreviousTopH);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_drawElevation += thing->getElevation();
|
m_drawElevation += thing->getElevation();
|
||||||
if(m_drawElevation > Otc::MAX_ELEVATION)
|
if(m_drawElevation > Otc::MAX_ELEVATION)
|
||||||
m_drawElevation = Otc::MAX_ELEVATION;
|
m_drawElevation = Otc::MAX_ELEVATION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// after we render 2x2 lying corpses, we must redraw previous creatures/ontop above them
|
|
||||||
if(redrawPreviousTopH > 0 || redrawPreviousTopW > 0) {
|
|
||||||
int topRedrawFlags = drawFlags & (Otc::DrawCreatures | Otc::DrawEffects | Otc::DrawOnTop | Otc::DrawAnimations);
|
|
||||||
if(topRedrawFlags) {
|
|
||||||
for(int x=-redrawPreviousTopW;x<=0;++x) {
|
|
||||||
for(int y=-redrawPreviousTopH;y<=0;++y) {
|
|
||||||
if(x == 0 && y == 0)
|
|
||||||
continue;
|
|
||||||
const TilePtr& tile = g_map.getTile(m_position.translated(x,y));
|
|
||||||
if(tile)
|
|
||||||
tile->draw(dest + Point(x*Otc::TILE_PIXELS, y*Otc::TILE_PIXELS)*scaleFactor, scaleFactor, topRedrawFlags);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// creatures
|
// creatures
|
||||||
if(drawFlags & Otc::DrawCreatures) {
|
if(drawFlags & Otc::DrawCreatures) {
|
||||||
if(animate) {
|
if(animate) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user