From d080432e142d980ae0e642ad85c7a8ed9ed413be Mon Sep 17 00:00:00 2001 From: conde2 Date: Mon, 24 Feb 2014 15:33:29 -0300 Subject: [PATCH] Support for newer versions and light draw fix Avoid drawing light under covered tiles. --- modules/gamelib/game.lua | 2 +- src/client/const.h | 1 + src/client/game.cpp | 4 ++++ src/client/mapview.cpp | 5 ++++- src/client/protocolgameparse.cpp | 5 ++++- 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/modules/gamelib/game.lua b/modules/gamelib/game.lua index 0b96349c..719753e1 100644 --- a/modules/gamelib/game.lua +++ b/modules/gamelib/game.lua @@ -54,7 +54,7 @@ function g_game.getSupportedClients() 940, 944, 953, 954, 960, 961, 963, 970, 980, 981, 982, 983, 984, 985, 986, 1001, 1002, 1010, 1020, 1021, - 1022, 1031 + 1022, 1031, 1034, 1035 } end diff --git a/src/client/const.h b/src/client/const.h index 3e94ecfc..59ff9e7d 100644 --- a/src/client/const.h +++ b/src/client/const.h @@ -376,6 +376,7 @@ namespace Otc GamePVPMode = 50, GameWritableDate = 51, GameAdditionalVipInfo = 52, + GameBaseSkillU16 = 53, LastGameFeature = 101 }; diff --git a/src/client/game.cpp b/src/client/game.cpp index 3083c2da..26701ddb 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -1562,6 +1562,10 @@ void Game::setProtocolVersion(int version) enableFeature(Otc::GamePVPMode); } + if (version >= 1035) { + enableFeature(Otc::GameDoubleSkills); + enableFeature(Otc::GameBaseSkillU16); + } m_protocolVersion = version; Proto::buildMessageModesMap(version); diff --git a/src/client/mapview.cpp b/src/client/mapview.cpp index 7ed5529e..6d2f5895 100644 --- a/src/client/mapview.cpp +++ b/src/client/mapview.cpp @@ -139,7 +139,10 @@ void MapView::draw(const Rect& rect) else ++it; - tile->draw(transformPositionTo2D(tilePos, cameraPosition), scaleFactor, drawFlags, m_lightView.get()); + if (g_map.isCovered(tilePos, m_cachedFirstVisibleFloor)) + tile->draw(transformPositionTo2D(tilePos, cameraPosition), scaleFactor, drawFlags); + else + tile->draw(transformPositionTo2D(tilePos, cameraPosition), scaleFactor, drawFlags, m_lightView.get()); } if(drawFlags & Otc::DrawMissiles) { diff --git a/src/client/protocolgameparse.cpp b/src/client/protocolgameparse.cpp index b40f2711..579c8989 100644 --- a/src/client/protocolgameparse.cpp +++ b/src/client/protocolgameparse.cpp @@ -1125,7 +1125,10 @@ void ProtocolGame::parsePlayerSkills(const InputMessagePtr& msg) int baseLevel; if(g_game.getFeature(Otc::GameSkillsBase)) - baseLevel = msg->getU8(); + if (g_game.getFeature(Otc::GameBaseSkillU16)) + baseLevel = msg->getU16(); + else + baseLevel = msg->getU8(); else baseLevel = level;