fix some elevation issues

This commit is contained in:
Eduardo Bart 2012-02-02 21:01:57 -02:00
parent 8c8749520d
commit 30330d1d2e
2 changed files with 5 additions and 4 deletions

View File

@ -216,8 +216,9 @@ void MapView::updateVisibleTilesCache(int start)
for(int iz = m_cachedLastVisibleFloor; iz >= m_cachedFirstVisibleFloor && !stop; --iz) {
if(m_viewRange <= FAR_VIEW) {
const int numDiagonals = m_drawDimension.width() + m_drawDimension.height() - 1;
// loop through / diagonals beginning at top left and going to top right
for(int diagonal = 0; diagonal < numDiagonals && !stop; ++diagonal) {
// loop through / diagonals beginning at top left and going to top right
// loop current diagonal tiles
for(int iy = std::min(diagonal, m_drawDimension.width() - 1), ix = std::max(diagonal - m_drawDimension.width() + 1, 0); iy >= 0 && ix < m_drawDimension.width() && !stop; --iy, ++ix) {
// only start really looking tiles in the desired start
if(count < start) {

View File

@ -109,21 +109,21 @@ void Tile::draw(const Point& dest, float scaleFactor, int drawFlags)
for(auto it = m_things.rbegin(); it != m_things.rend(); ++it) {
CreaturePtr creature = (*it)->asCreature();
if(creature && (!creature->isWalking() || !animate))
creature->draw(dest - m_drawElevation, scaleFactor, animate);
creature->draw(dest - m_drawElevation*scaleFactor, scaleFactor, animate);
}
}
// effects
if(drawFlags & Otc::DrawEffects) {
for(const EffectPtr& effect : m_effects)
effect->draw(dest, scaleFactor, animate);
effect->draw(dest - m_drawElevation*scaleFactor, scaleFactor, animate);
}
// top items
if(drawFlags & Otc::DrawOnTop) {
for(const ThingPtr& thing : m_things) {
if(thing->isOnTop())
thing->draw(dest - m_drawElevation, scaleFactor, animate);
thing->draw(dest, scaleFactor, animate);
}
}
}