|
|
|
@ -193,8 +193,10 @@ void MapView::updateVisibleTilesCache(int start)
|
|
|
|
|
m_updateTilesCacheEvent = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_cachedFirstVisibleFloor = getFirstVisibleFloor();
|
|
|
|
|
m_cachedLastVisibleFloor = getLastVisibleFloor();
|
|
|
|
|
m_cachedFirstVisibleFloor = calcFirstVisibleFloor();
|
|
|
|
|
m_cachedLastVisibleFloor = calcLastVisibleFloor();
|
|
|
|
|
assert(m_cachedFirstVisibleFloor >= 0 && m_cachedLastVisibleFloor >= 0 &&
|
|
|
|
|
m_cachedFirstVisibleFloor <= Otc::MAX_Z && m_cachedLastVisibleFloor <= Otc::MAX_Z);
|
|
|
|
|
|
|
|
|
|
if(m_cachedLastVisibleFloor < m_cachedFirstVisibleFloor)
|
|
|
|
|
m_cachedLastVisibleFloor = m_cachedFirstVisibleFloor;
|
|
|
|
@ -461,18 +463,19 @@ void MapView::setVisibleDimension(const Size& visibleDimension)
|
|
|
|
|
requestVisibleTilesCacheUpdate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int MapView::getFirstVisibleFloor()
|
|
|
|
|
int MapView::calcFirstVisibleFloor()
|
|
|
|
|
{
|
|
|
|
|
int z = 7;
|
|
|
|
|
// return forced first visible floor
|
|
|
|
|
if(m_lockedFirstVisibleFloor != -1)
|
|
|
|
|
return m_lockedFirstVisibleFloor;
|
|
|
|
|
|
|
|
|
|
if(m_lockedFirstVisibleFloor != -1) {
|
|
|
|
|
z = m_lockedFirstVisibleFloor;
|
|
|
|
|
} else {
|
|
|
|
|
Position cameraPosition = getCameraPosition();
|
|
|
|
|
|
|
|
|
|
// avoid rendering multifloors in far views
|
|
|
|
|
if(m_viewRange >= FAR_VIEW)
|
|
|
|
|
return cameraPosition.z;
|
|
|
|
|
|
|
|
|
|
if(m_viewRange >= FAR_VIEW) {
|
|
|
|
|
z = cameraPosition.z;
|
|
|
|
|
} else {
|
|
|
|
|
// if nothing is limiting the view, the first visible floor is 0
|
|
|
|
|
int firstFloor = 0;
|
|
|
|
|
|
|
|
|
@ -509,22 +512,32 @@ int MapView::getFirstVisibleFloor()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return firstFloor;
|
|
|
|
|
z = firstFloor;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
z = std::min(std::max(z, 0), (int)Otc::MAX_Z);
|
|
|
|
|
return z;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int MapView::getLastVisibleFloor()
|
|
|
|
|
int MapView::calcLastVisibleFloor()
|
|
|
|
|
{
|
|
|
|
|
Position cameraPosition = getCameraPosition();
|
|
|
|
|
int z = 7;
|
|
|
|
|
|
|
|
|
|
Position cameraPosition = getCameraPosition();
|
|
|
|
|
// avoid rendering multifloors in far views
|
|
|
|
|
if(m_viewRange >= FAR_VIEW)
|
|
|
|
|
return cameraPosition.z;
|
|
|
|
|
|
|
|
|
|
if(m_viewRange >= FAR_VIEW) {
|
|
|
|
|
z = cameraPosition.z;
|
|
|
|
|
} else {
|
|
|
|
|
// view only underground floors when below sea level
|
|
|
|
|
if(cameraPosition.z > Otc::SEA_FLOOR)
|
|
|
|
|
return std::min(cameraPosition.z + Otc::AWARE_UNDEGROUND_FLOOR_RANGE, (int)Otc::MAX_Z);
|
|
|
|
|
z = cameraPosition.z + Otc::AWARE_UNDEGROUND_FLOOR_RANGE;
|
|
|
|
|
else
|
|
|
|
|
return Otc::SEA_FLOOR;
|
|
|
|
|
z = Otc::SEA_FLOOR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
z = std::min(std::max(z, 0), (int)Otc::MAX_Z);
|
|
|
|
|
return z;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Position MapView::getCameraPosition()
|
|
|
|
|