Properly Fix #301

This commit is contained in:
Joao Pasqualini Costa 2013-03-14 20:57:02 -03:00
parent a71e07f063
commit 6ef3508362
3 changed files with 17 additions and 8 deletions

View File

@ -608,21 +608,21 @@ int MapView::calcFirstVisibleFloor()
Position pos = cameraPosition.translated(ix, iy); Position pos = cameraPosition.translated(ix, iy);
// process tiles that we can look through, e.g. windows, doors // 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 upperPos = pos;
Position coveredPos = pos; Position coveredPos = pos;
while(coveredPos.coveredUp() && upperPos.up() && upperPos.z >= firstFloor) { while(coveredPos.coveredUp() && upperPos.up() && upperPos.z >= firstFloor) {
// check tiles physically above // check tiles physically above
TilePtr tile = g_map.getTile(upperPos); TilePtr tile = g_map.getTile(upperPos);
if(tile && tile->limitsFloorsView()) { if(tile && tile->limitsFloorsView(!g_map.isLookPossible(pos))) {
firstFloor = upperPos.z + 1; firstFloor = upperPos.z + 1;
break; break;
} }
// check tiles geometrically above // check tiles geometrically above
tile = g_map.getTile(coveredPos); tile = g_map.getTile(coveredPos);
if(tile && tile->limitsFloorsView()) { if(tile && tile->limitsFloorsView(g_map.isLookPossible(pos))) {
firstFloor = coveredPos.z + 1; firstFloor = coveredPos.z + 1;
break; break;
} }

View File

@ -590,15 +590,24 @@ bool Tile::hasCreature()
return false; return false;
} }
bool Tile::limitsFloorsView() bool Tile::limitsFloorsView(bool isFreeView)
{ {
// ground and walls limits the view // ground and walls limits the view
ThingPtr firstThing = getThing(0); ThingPtr firstThing = getThing(0);
if(isFreeView){
if(firstThing && !firstThing->isDontHide() && (firstThing->isGround() || firstThing->isOnBottom())) if(firstThing && !firstThing->isDontHide() && (firstThing->isGround() || firstThing->isOnBottom()))
return true; return true;
}
else
{
if(firstThing && !firstThing->isDontHide() && (firstThing->isGround() || (firstThing->isOnBottom() && firstThing->blockProjectile())))
return true;
}
return false; return false;
} }
bool Tile::canErase() bool Tile::canErase()
{ {
return m_walkingCreatures.empty() && m_effects.empty() && m_things.empty() && m_flags == 0 && m_minimapColor == 0; return m_walkingCreatures.empty() && m_effects.empty() && m_things.empty() && m_flags == 0 && m_minimapColor == 0;

View File

@ -105,7 +105,7 @@ public:
bool mustHookSouth(); bool mustHookSouth();
bool mustHookEast(); bool mustHookEast();
bool hasCreature(); bool hasCreature();
bool limitsFloorsView(); bool limitsFloorsView(bool isFreeView = false);
bool canErase(); bool canErase();
bool hasElevation(int elevation = 1); bool hasElevation(int elevation = 1);
void overwriteMinimapColor(uint8 color) { m_minimapColor = color; } void overwriteMinimapColor(uint8 color) { m_minimapColor = color; }