small changes
* show protocol version on background * make 860 the default protocol * avoid more crashes on mapview * activa crash handler by default
This commit is contained in:
parent
a4cef0d390
commit
58d9426be8
|
@ -11,6 +11,7 @@ function Background.init()
|
|||
local clientVersionLabel = background:getChildById('clientVersionLabel')
|
||||
clientVersionLabel:setText('OTClient ' .. g_app.getVersion() .. '\n' ..
|
||||
'Rev ' .. g_app.getBuildRevision() .. '\n' ..
|
||||
'Protocol ' .. g_game.getProtocolVersion() .. '\n' ..
|
||||
'Built on ' .. g_app.getBuildDate())
|
||||
|
||||
if not g_game.isOnline() then
|
||||
|
|
|
@ -16,7 +16,7 @@ Panel
|
|||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
text-align: center
|
||||
height: 48
|
||||
text-auto-resize: true
|
||||
width: 120
|
||||
color: #ffffff
|
||||
font: verdana-11px-monochrome
|
||||
|
|
|
@ -8,7 +8,6 @@ SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake;${CMAKE_MODULE_PATH}")
|
|||
|
||||
# framework options
|
||||
OPTION(WINDOWS_CONSOLE "Enables console window on Windows platform" OFF)
|
||||
OPTION(CRASH_HANDLER "Generate crash reports" OFF)
|
||||
OPTION(USE_OPENGL_ES2 "Use OpenGL ES 2.0 (for mobiles devices)" OFF)
|
||||
SET(BUILD_REVISION "custom" CACHE "Git revision string (intended for releases)" STRING)
|
||||
|
||||
|
@ -63,6 +62,7 @@ ENDIF()
|
|||
IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
||||
ADD_DEFINITIONS(-DDEBUG)
|
||||
MESSAGE(STATUS "Debug information: ON")
|
||||
OPTION(CRASH_HANDLER "Generate crash reports" ON)
|
||||
ELSE()
|
||||
MESSAGE(STATUS "Debug information: OFF")
|
||||
ENDIF()
|
||||
|
|
|
@ -5,7 +5,7 @@ ENDIF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6)
|
|||
|
||||
# otclient options
|
||||
OPTION(BOT_PROTECTION "Enable bot protection" ON)
|
||||
SET(PROTOCOL 861 CACHE "Protocol version" STRING)
|
||||
SET(PROTOCOL 860 CACHE "Protocol version" STRING)
|
||||
ADD_DEFINITIONS(-DPROTOCOL=${PROTOCOL})
|
||||
MESSAGE(STATUS "Protocol: " ${PROTOCOL})
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ MapView::MapView()
|
|||
m_lockedFirstVisibleFloor = -1;
|
||||
m_cachedFirstVisibleFloor = 0;
|
||||
m_cachedLastVisibleFloor = 7;
|
||||
m_customCameraPosition.z = 7;
|
||||
|
||||
Size frameBufferSize(std::min(g_graphics.getMaxTextureSize(), (int)DEFAULT_FRAMBUFFER_WIDTH),
|
||||
std::min(g_graphics.getMaxTextureSize(), (int)DEFAULT_FRAMBUFFER_HEIGHT));
|
||||
|
@ -472,50 +471,53 @@ int MapView::calcFirstVisibleFloor()
|
|||
} else {
|
||||
Position cameraPosition = getCameraPosition();
|
||||
|
||||
// avoid rendering multifloors in far views
|
||||
if(m_viewRange >= FAR_VIEW) {
|
||||
z = cameraPosition.z;
|
||||
} else {
|
||||
// if nothing is limiting the view, the first visible floor is 0
|
||||
int firstFloor = 0;
|
||||
// this could happens if the player is not known yet
|
||||
if(cameraPosition.isValid()) {
|
||||
// avoid rendering multifloors in far views
|
||||
if(m_viewRange >= FAR_VIEW) {
|
||||
z = cameraPosition.z;
|
||||
} else {
|
||||
// if nothing is limiting the view, the first visible floor is 0
|
||||
int firstFloor = 0;
|
||||
|
||||
// limits to underground floors while under sea level
|
||||
if(cameraPosition.z > Otc::SEA_FLOOR)
|
||||
firstFloor = std::max(cameraPosition.z - Otc::AWARE_UNDEGROUND_FLOOR_RANGE, (int)Otc::UNDERGROUND_FLOOR);
|
||||
// limits to underground floors while under sea level
|
||||
if(cameraPosition.z > Otc::SEA_FLOOR)
|
||||
firstFloor = std::max(cameraPosition.z - Otc::AWARE_UNDEGROUND_FLOOR_RANGE, (int)Otc::UNDERGROUND_FLOOR);
|
||||
|
||||
// loop in 3x3 tiles around the camera
|
||||
for(int ix = -1; ix <= 1 && firstFloor < cameraPosition.z; ++ix) {
|
||||
for(int iy = -1; iy <= 1 && firstFloor < cameraPosition.z; ++iy) {
|
||||
Position pos = cameraPosition.translated(ix, iy);
|
||||
// loop in 3x3 tiles around the camera
|
||||
for(int ix = -1; ix <= 1 && firstFloor < cameraPosition.z; ++ix) {
|
||||
for(int iy = -1; iy <= 1 && firstFloor < cameraPosition.z; ++iy) {
|
||||
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))) {
|
||||
Position upperPos = pos;
|
||||
Position coveredPos = pos;
|
||||
// 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))) {
|
||||
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()) {
|
||||
firstFloor = upperPos.z + 1;
|
||||
break;
|
||||
}
|
||||
while(coveredPos.coveredUp() && upperPos.up() && upperPos.z >= firstFloor) {
|
||||
// check tiles physically above
|
||||
TilePtr tile = g_map.getTile(upperPos);
|
||||
if(tile && tile->limitsFloorsView()) {
|
||||
firstFloor = upperPos.z + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
// check tiles geometrically above
|
||||
tile = g_map.getTile(coveredPos);
|
||||
if(tile && tile->limitsFloorsView()) {
|
||||
firstFloor = coveredPos.z + 1;
|
||||
break;
|
||||
// check tiles geometrically above
|
||||
tile = g_map.getTile(coveredPos);
|
||||
if(tile && tile->limitsFloorsView()) {
|
||||
firstFloor = coveredPos.z + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
z = firstFloor;
|
||||
}
|
||||
|
||||
z = firstFloor;
|
||||
}
|
||||
}
|
||||
|
||||
// just ensure the that the floor is in the valid range
|
||||
z = std::min(std::max(z, 0), (int)Otc::MAX_Z);
|
||||
return z;
|
||||
}
|
||||
|
@ -525,17 +527,21 @@ int MapView::calcLastVisibleFloor()
|
|||
int z = 7;
|
||||
|
||||
Position cameraPosition = getCameraPosition();
|
||||
// avoid rendering multifloors in far views
|
||||
if(m_viewRange >= FAR_VIEW) {
|
||||
z = cameraPosition.z;
|
||||
} else {
|
||||
// view only underground floors when below sea level
|
||||
if(cameraPosition.z > Otc::SEA_FLOOR)
|
||||
z = cameraPosition.z + Otc::AWARE_UNDEGROUND_FLOOR_RANGE;
|
||||
else
|
||||
z = Otc::SEA_FLOOR;
|
||||
// this could happens if the player is not known yet
|
||||
if(cameraPosition.isValid()) {
|
||||
// avoid rendering multifloors in far views
|
||||
if(m_viewRange >= FAR_VIEW) {
|
||||
z = cameraPosition.z;
|
||||
} else {
|
||||
// view only underground floors when below sea level
|
||||
if(cameraPosition.z > Otc::SEA_FLOOR)
|
||||
z = cameraPosition.z + Otc::AWARE_UNDEGROUND_FLOOR_RANGE;
|
||||
else
|
||||
z = Otc::SEA_FLOOR;
|
||||
}
|
||||
}
|
||||
|
||||
// just ensure the that the floor is in the valid range
|
||||
z = std::min(std::max(z, 0), (int)Otc::MAX_Z);
|
||||
return z;
|
||||
}
|
||||
|
@ -553,6 +559,10 @@ TilePtr MapView::getTile(const Point& mousePos, const Rect& mapRect)
|
|||
Size visibleSize = getVisibleSize();
|
||||
Position cameraPosition = getCameraPosition();
|
||||
|
||||
// if we have no camera, its impossible to get the tile
|
||||
if(!cameraPosition.isValid())
|
||||
return nullptr;
|
||||
|
||||
float scaleFactor = m_tileSize / (float)Otc::TILE_PIXELS;
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue