Properly Fix #301
This commit is contained in:
parent
a71e07f063
commit
6ef3508362
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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(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;
|
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;
|
||||||
|
|
|
@ -48,7 +48,7 @@ enum tileflags_t
|
||||||
TILESTATE_TRASHHOLDER = 1 << 20,
|
TILESTATE_TRASHHOLDER = 1 << 20,
|
||||||
TILESTATE_BED = 1 << 21,
|
TILESTATE_BED = 1 << 21,
|
||||||
TILESTATE_DEPOT = 1 << 22,
|
TILESTATE_DEPOT = 1 << 22,
|
||||||
TILESTATE_TRANSLUECENT_LIGHT = 1 << 23
|
TILESTATE_TRANSLUECENT_LIGHT = 1 << 23
|
||||||
};
|
};
|
||||||
|
|
||||||
class Tile : public LuaObject
|
class Tile : public LuaObject
|
||||||
|
@ -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; }
|
||||||
|
|
Loading…
Reference in New Issue