From 6ef35083620a77517dedcfc86c987436705988be Mon Sep 17 00:00:00 2001 From: Joao Pasqualini Costa Date: Thu, 14 Mar 2013 20:57:02 -0300 Subject: [PATCH] Properly Fix #301 --- src/client/mapview.cpp | 6 +++--- src/client/tile.cpp | 15 ++++++++++++--- src/client/tile.h | 4 ++-- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/client/mapview.cpp b/src/client/mapview.cpp index 10d5d1b2..3857c781 100644 --- a/src/client/mapview.cpp +++ b/src/client/mapview.cpp @@ -608,21 +608,21 @@ int MapView::calcFirstVisibleFloor() Position pos = cameraPosition.translated(ix, iy); // process tiles that we can look through, e.g. windows, doors - if((ix == 0 && iy == 0) || (/*(std::abs(ix) != std::abs(iy)) && */g_map.isLookPossible(pos))) { + if((ix == 0 && iy == 0) || ((std::abs(ix) != std::abs(iy)) && g_map.isLookPossible(pos))) { Position upperPos = pos; Position coveredPos = pos; while(coveredPos.coveredUp() && upperPos.up() && upperPos.z >= firstFloor) { // check tiles physically above TilePtr tile = g_map.getTile(upperPos); - if(tile && tile->limitsFloorsView()) { + if(tile && tile->limitsFloorsView(!g_map.isLookPossible(pos))) { firstFloor = upperPos.z + 1; break; } // check tiles geometrically above tile = g_map.getTile(coveredPos); - if(tile && tile->limitsFloorsView()) { + if(tile && tile->limitsFloorsView(g_map.isLookPossible(pos))) { firstFloor = coveredPos.z + 1; break; } diff --git a/src/client/tile.cpp b/src/client/tile.cpp index 8daaf189..bac2fa31 100644 --- a/src/client/tile.cpp +++ b/src/client/tile.cpp @@ -590,15 +590,24 @@ bool Tile::hasCreature() return false; } -bool Tile::limitsFloorsView() +bool Tile::limitsFloorsView(bool isFreeView) { // ground and walls limits the view ThingPtr firstThing = getThing(0); - if(firstThing && !firstThing->isDontHide() && (firstThing->isGround() || firstThing->isOnBottom())) - return true; + + if(isFreeView){ + if(firstThing && !firstThing->isDontHide() && (firstThing->isGround() || firstThing->isOnBottom())) + return true; + } + else + { + if(firstThing && !firstThing->isDontHide() && (firstThing->isGround() || (firstThing->isOnBottom() && firstThing->blockProjectile()))) + return true; + } return false; } + bool Tile::canErase() { return m_walkingCreatures.empty() && m_effects.empty() && m_things.empty() && m_flags == 0 && m_minimapColor == 0; diff --git a/src/client/tile.h b/src/client/tile.h index 3eda5ad2..c4d54f7a 100644 --- a/src/client/tile.h +++ b/src/client/tile.h @@ -48,7 +48,7 @@ enum tileflags_t TILESTATE_TRASHHOLDER = 1 << 20, TILESTATE_BED = 1 << 21, TILESTATE_DEPOT = 1 << 22, - TILESTATE_TRANSLUECENT_LIGHT = 1 << 23 + TILESTATE_TRANSLUECENT_LIGHT = 1 << 23 }; class Tile : public LuaObject @@ -105,7 +105,7 @@ public: bool mustHookSouth(); bool mustHookEast(); bool hasCreature(); - bool limitsFloorsView(); + bool limitsFloorsView(bool isFreeView = false); bool canErase(); bool hasElevation(int elevation = 1); void overwriteMinimapColor(uint8 color) { m_minimapColor = color; }