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')
|
local clientVersionLabel = background:getChildById('clientVersionLabel')
|
||||||
clientVersionLabel:setText('OTClient ' .. g_app.getVersion() .. '\n' ..
|
clientVersionLabel:setText('OTClient ' .. g_app.getVersion() .. '\n' ..
|
||||||
'Rev ' .. g_app.getBuildRevision() .. '\n' ..
|
'Rev ' .. g_app.getBuildRevision() .. '\n' ..
|
||||||
|
'Protocol ' .. g_game.getProtocolVersion() .. '\n' ..
|
||||||
'Built on ' .. g_app.getBuildDate())
|
'Built on ' .. g_app.getBuildDate())
|
||||||
|
|
||||||
if not g_game.isOnline() then
|
if not g_game.isOnline() then
|
||||||
|
|
|
@ -16,7 +16,7 @@ Panel
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
text-align: center
|
text-align: center
|
||||||
height: 48
|
text-auto-resize: true
|
||||||
width: 120
|
width: 120
|
||||||
color: #ffffff
|
color: #ffffff
|
||||||
font: verdana-11px-monochrome
|
font: verdana-11px-monochrome
|
||||||
|
|
|
@ -8,7 +8,6 @@ SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake;${CMAKE_MODULE_PATH}")
|
||||||
|
|
||||||
# framework options
|
# framework options
|
||||||
OPTION(WINDOWS_CONSOLE "Enables console window on Windows platform" OFF)
|
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)
|
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)
|
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")
|
IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
||||||
ADD_DEFINITIONS(-DDEBUG)
|
ADD_DEFINITIONS(-DDEBUG)
|
||||||
MESSAGE(STATUS "Debug information: ON")
|
MESSAGE(STATUS "Debug information: ON")
|
||||||
|
OPTION(CRASH_HANDLER "Generate crash reports" ON)
|
||||||
ELSE()
|
ELSE()
|
||||||
MESSAGE(STATUS "Debug information: OFF")
|
MESSAGE(STATUS "Debug information: OFF")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
|
@ -5,7 +5,7 @@ ENDIF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6)
|
||||||
|
|
||||||
# otclient options
|
# otclient options
|
||||||
OPTION(BOT_PROTECTION "Enable bot protection" ON)
|
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})
|
ADD_DEFINITIONS(-DPROTOCOL=${PROTOCOL})
|
||||||
MESSAGE(STATUS "Protocol: " ${PROTOCOL})
|
MESSAGE(STATUS "Protocol: " ${PROTOCOL})
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,6 @@ MapView::MapView()
|
||||||
m_lockedFirstVisibleFloor = -1;
|
m_lockedFirstVisibleFloor = -1;
|
||||||
m_cachedFirstVisibleFloor = 0;
|
m_cachedFirstVisibleFloor = 0;
|
||||||
m_cachedLastVisibleFloor = 7;
|
m_cachedLastVisibleFloor = 7;
|
||||||
m_customCameraPosition.z = 7;
|
|
||||||
|
|
||||||
Size frameBufferSize(std::min(g_graphics.getMaxTextureSize(), (int)DEFAULT_FRAMBUFFER_WIDTH),
|
Size frameBufferSize(std::min(g_graphics.getMaxTextureSize(), (int)DEFAULT_FRAMBUFFER_WIDTH),
|
||||||
std::min(g_graphics.getMaxTextureSize(), (int)DEFAULT_FRAMBUFFER_HEIGHT));
|
std::min(g_graphics.getMaxTextureSize(), (int)DEFAULT_FRAMBUFFER_HEIGHT));
|
||||||
|
@ -472,50 +471,53 @@ int MapView::calcFirstVisibleFloor()
|
||||||
} else {
|
} else {
|
||||||
Position cameraPosition = getCameraPosition();
|
Position cameraPosition = getCameraPosition();
|
||||||
|
|
||||||
// avoid rendering multifloors in far views
|
// this could happens if the player is not known yet
|
||||||
if(m_viewRange >= FAR_VIEW) {
|
if(cameraPosition.isValid()) {
|
||||||
z = cameraPosition.z;
|
// avoid rendering multifloors in far views
|
||||||
} else {
|
if(m_viewRange >= FAR_VIEW) {
|
||||||
// if nothing is limiting the view, the first visible floor is 0
|
z = cameraPosition.z;
|
||||||
int firstFloor = 0;
|
} else {
|
||||||
|
// if nothing is limiting the view, the first visible floor is 0
|
||||||
|
int firstFloor = 0;
|
||||||
|
|
||||||
// limits to underground floors while under sea level
|
// limits to underground floors while under sea level
|
||||||
if(cameraPosition.z > Otc::SEA_FLOOR)
|
if(cameraPosition.z > Otc::SEA_FLOOR)
|
||||||
firstFloor = std::max(cameraPosition.z - Otc::AWARE_UNDEGROUND_FLOOR_RANGE, (int)Otc::UNDERGROUND_FLOOR);
|
firstFloor = std::max(cameraPosition.z - Otc::AWARE_UNDEGROUND_FLOOR_RANGE, (int)Otc::UNDERGROUND_FLOOR);
|
||||||
|
|
||||||
// loop in 3x3 tiles around the camera
|
// loop in 3x3 tiles around the camera
|
||||||
for(int ix = -1; ix <= 1 && firstFloor < cameraPosition.z; ++ix) {
|
for(int ix = -1; ix <= 1 && firstFloor < cameraPosition.z; ++ix) {
|
||||||
for(int iy = -1; iy <= 1 && firstFloor < cameraPosition.z; ++iy) {
|
for(int iy = -1; iy <= 1 && firstFloor < cameraPosition.z; ++iy) {
|
||||||
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()) {
|
||||||
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()) {
|
||||||
firstFloor = coveredPos.z + 1;
|
firstFloor = coveredPos.z + 1;
|
||||||
break;
|
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);
|
z = std::min(std::max(z, 0), (int)Otc::MAX_Z);
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
@ -525,17 +527,21 @@ int MapView::calcLastVisibleFloor()
|
||||||
int z = 7;
|
int z = 7;
|
||||||
|
|
||||||
Position cameraPosition = getCameraPosition();
|
Position cameraPosition = getCameraPosition();
|
||||||
// avoid rendering multifloors in far views
|
// this could happens if the player is not known yet
|
||||||
if(m_viewRange >= FAR_VIEW) {
|
if(cameraPosition.isValid()) {
|
||||||
z = cameraPosition.z;
|
// avoid rendering multifloors in far views
|
||||||
} else {
|
if(m_viewRange >= FAR_VIEW) {
|
||||||
// view only underground floors when below sea level
|
z = cameraPosition.z;
|
||||||
if(cameraPosition.z > Otc::SEA_FLOOR)
|
} else {
|
||||||
z = cameraPosition.z + Otc::AWARE_UNDEGROUND_FLOOR_RANGE;
|
// view only underground floors when below sea level
|
||||||
else
|
if(cameraPosition.z > Otc::SEA_FLOOR)
|
||||||
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);
|
z = std::min(std::max(z, 0), (int)Otc::MAX_Z);
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
@ -553,6 +559,10 @@ TilePtr MapView::getTile(const Point& mousePos, const Rect& mapRect)
|
||||||
Size visibleSize = getVisibleSize();
|
Size visibleSize = getVisibleSize();
|
||||||
Position cameraPosition = getCameraPosition();
|
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;
|
float scaleFactor = m_tileSize / (float)Otc::TILE_PIXELS;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue