diff --git a/TODO b/TODO index 512a9c28..91e88c6f 100644 --- a/TODO +++ b/TODO @@ -34,13 +34,14 @@ move up/down in lineedits select characters in lineedits scrolling multiline edit mouse wheel lineedits +onMapKnown event == OPTIMIZATIONS AND REWORKS * game do not redraw in MapView far zoom map zoom rendering could be optimized using framebuffer caches multisample option in map view -move redering of creatures names, skulls, etc to UI and scripts +move rendering of creatures names, skulls, etc to UI and scripts clean sprites cache periodically handle corrupt errors in dat/spr diff --git a/modules/core_styles/styles/buttons.otui b/modules/core_styles/styles/buttons.otui index 81369099..4d41f58f 100644 --- a/modules/core_styles/styles/buttons.otui +++ b/modules/core_styles/styles/buttons.otui @@ -1,23 +1,23 @@ Button < UIButton font: verdana-11px-antialised color: #f0ad4dff - size: 106 24 + size: 106 22 text-offset: 0 0 - image-color: white image-source: /core_styles/styles/images/button.png - image-border: 5 + image-color: white + image-clip: 0 0 20 20 + image-border: 2 padding: 5 10 5 10 $hover !disabled: - image-source: /core_styles/styles/images/button_hover.png + image-clip: 0 20 20 20 $pressed: + image-clip: 0 40 20 20 text-offset: 1 1 - image-source: /core_styles/styles/images/button_down.png $disabled: color: #f0ad4d88 - image-color: #ffffff88 TabButton < UIButton size: 20 20 diff --git a/modules/core_styles/styles/checkboxes.otui b/modules/core_styles/styles/checkboxes.otui index 14896c18..4c74171d 100644 --- a/modules/core_styles/styles/checkboxes.otui +++ b/modules/core_styles/styles/checkboxes.otui @@ -40,20 +40,21 @@ ColorBox < UICheckBox ButtonBox < UICheckBox font: verdana-11px-antialised - color: #f0ad4dff - size: 106 24 + color: #ffffffff + size: 106 22 text-offset: 0 0 text-align: center - image-source: /core_styles/styles/images/button.png + image-source: /core_styles/styles/images/tabbutton.png image-color: white - image-border: 5 + image-clip: 0 0 20 20 + image-border: 2 $hover !disabled: - image-source: /core_styles/styles/images/button_hover.png + image-clip: 0 20 20 20 $checked: - text-offset: 1 1 - image-source: /core_styles/styles/images/button_down.png + image-clip: 0 40 20 20 + color: #80c7f8 $disabled: color: #f0ad4d88 diff --git a/modules/core_styles/styles/images/button.png b/modules/core_styles/styles/images/button.png index 70727e0b..49c45dbd 100644 Binary files a/modules/core_styles/styles/images/button.png and b/modules/core_styles/styles/images/button.png differ diff --git a/modules/core_styles/styles/images/horizontal_separator.png b/modules/core_styles/styles/images/horizontal_separator.png index 16592583..ec557166 100644 Binary files a/modules/core_styles/styles/images/horizontal_separator.png and b/modules/core_styles/styles/images/horizontal_separator.png differ diff --git a/modules/core_styles/styles/images/scrollbar.png b/modules/core_styles/styles/images/scrollbar.png index 993d8af0..c8d4fd44 100644 Binary files a/modules/core_styles/styles/images/scrollbar.png and b/modules/core_styles/styles/images/scrollbar.png differ diff --git a/modules/core_styles/styles/images/window.png b/modules/core_styles/styles/images/window.png index c57da39f..2776f07b 100644 Binary files a/modules/core_styles/styles/images/window.png and b/modules/core_styles/styles/images/window.png differ diff --git a/modules/core_styles/styles/windows.otui b/modules/core_styles/styles/windows.otui index ec41553a..b265cf0e 100644 --- a/modules/core_styles/styles/windows.otui +++ b/modules/core_styles/styles/windows.otui @@ -3,13 +3,13 @@ Window < UIWindow size: 200 200 opacity: 1 color: white - text-offset: 0 2 + text-offset: 0 4 text-align: top image-source: /core_styles/styles/images/window.png - image-border: 4 - image-border-top: 20 + image-border: 5 + image-border-top: 22 opacity: 1 - padding-top: 28 + padding-top: 30 padding-left: 16 padding-right: 16 padding-bottom: 16 diff --git a/modules/game/images/miniwindow.png b/modules/game/images/miniwindow.png index 855daa5e..1db0bcd9 100644 Binary files a/modules/game/images/miniwindow.png and b/modules/game/images/miniwindow.png differ diff --git a/modules/game/images/miniwindowbuttons.png b/modules/game/images/miniwindowbuttons.png index 450a9780..bb6cc7b2 100644 Binary files a/modules/game/images/miniwindowbuttons.png and b/modules/game/images/miniwindowbuttons.png differ diff --git a/modules/game/styles/miniwindow.otui b/modules/game/styles/miniwindow.otui index 45e86847..07a990f9 100644 --- a/modules/game/styles/miniwindow.otui +++ b/modules/game/styles/miniwindow.otui @@ -8,7 +8,6 @@ MiniWindow < UIMiniWindow image-source: /game/images/miniwindow.png image-border: 4 image-border-top: 23 - image-border-left: 23 image-border-bottom: 4 focusable: false &minimizedHeight: 24 diff --git a/modules/game_minimap/minimap.lua b/modules/game_minimap/minimap.lua index 1c998b13..a9c922be 100644 --- a/modules/game_minimap/minimap.lua +++ b/modules/game_minimap/minimap.lua @@ -31,7 +31,7 @@ end -- public functions function Minimap.init() - connect(g_game, { onLogin = Minimap.reset }) + connect(g_game, { onGameStart = Minimap.reset }) Keyboard.bindKeyDown('Ctrl+M', Minimap.toggle) minimapButton = TopMenu.addGameToggleButton('minimapButton', tr('Minimap') .. ' (Ctrl+M)', 'minimap.png', Minimap.toggle) @@ -46,7 +46,7 @@ function Minimap.init() end function Minimap.terminate() - disconnect(g_game, { onLogin = Minimap.reset }) + disconnect(g_game, { onGameStart = Minimap.reset }) Keyboard.unbindKeyDown('Ctrl+M') minimapWidget:destroy() diff --git a/modules/game_ruleviolation/ruleviolation.lua b/modules/game_ruleviolation/ruleviolation.lua index d20b6ca8..8e406e9a 100644 --- a/modules/game_ruleviolation/ruleviolation.lua +++ b/modules/game_ruleviolation/ruleviolation.lua @@ -57,7 +57,7 @@ function RuleViolation.loadReasons() end function RuleViolation.init() - connect(g_game, { onLogin = RuleViolation.loadReasons }) + connect(g_game, { onGMActions = RuleViolation.loadReasons }) ruleViolationWindow = displayUI('ruleviolation.otui') ruleViolationWindow:setVisible(false) @@ -73,7 +73,7 @@ function RuleViolation.init() end function RuleViolation.terminate() - disconnect(g_game, { onLogin = RuleViolation.loadReasons }) + disconnect(g_game, { onGMActions = RuleViolation.loadReasons }) ruleViolationWindow:destroy() ruleViolationWindow = nil diff --git a/src/otclient/core/game.cpp b/src/otclient/core/game.cpp index a7b20285..f5e980dc 100644 --- a/src/otclient/core/game.cpp +++ b/src/otclient/core/game.cpp @@ -77,10 +77,6 @@ void Game::processConnectionError(const boost::system::error_code& error) void Game::processDisconnect() { if(isOnline()) { - // only process logout event if the player is known - if(m_localPlayer->isKnown()) - processLogout(); - m_localPlayer = nullptr; processGameEnd(); @@ -119,7 +115,7 @@ void Game::processGameStart(const LocalPlayerPtr& localPlayer, int serverBeat, b // synchronize fight modes with the server m_protocolGame->sendChangeFightModes(m_fightMode, m_chaseMode, m_safeFight); - // NOTE: the entire map description and local player informations is not known yet + // NOTE: the entire map description and local player information is not known yet g_lua.callGlobalField("g_game", "onGameStart"); } @@ -134,21 +130,6 @@ void Game::processGameEnd() g_map.cleanDynamicThings(); } -void Game::processLogin() -{ - // the game could be offline if the login was canceled - if(!isOnline()) - return; - - // by now the local player must be known - g_lua.callGlobalField("g_game", "onLogin", m_localPlayer); -} - -void Game::processLogout() -{ - g_lua.callGlobalField("g_game", "onLogout", m_localPlayer); -} - void Game::processDeath(int penality) { m_dead = true; @@ -1034,12 +1015,11 @@ bool Game::canPerformGameAction() { // we can only perform game actions if we meet these conditions: // - the local player exists - // - the local player is known // - the local player is not dead // - we have a game protocol // - the game protocol is connected // - its not a bot action - return m_localPlayer && m_localPlayer->isKnown() && !m_dead && m_protocolGame && m_protocolGame->isConnected() && checkBotProtection(); + return m_localPlayer && !m_dead && m_protocolGame && m_protocolGame->isConnected() && checkBotProtection(); } void Game::setAttackingCreature(const CreaturePtr& creature) diff --git a/src/otclient/core/game.h b/src/otclient/core/game.h index a2b93277..3f22d1ef 100644 --- a/src/otclient/core/game.h +++ b/src/otclient/core/game.h @@ -48,9 +48,6 @@ protected: void processLoginAdvice(const std::string& message); void processLoginWait(const std::string& message, int time); - void processLogin(); - void processLogout(); - void processGameStart(const LocalPlayerPtr& localPlayer, int serverBeat, bool canReportBugs); void processGameEnd(); void processDeath(int penality); diff --git a/src/otclient/core/map.cpp b/src/otclient/core/map.cpp index a6f6af09..517ba4db 100644 --- a/src/otclient/core/map.cpp +++ b/src/otclient/core/map.cpp @@ -304,8 +304,8 @@ void Map::setCentralPosition(const Position& centralPosition) LocalPlayerPtr localPlayer = g_game.getLocalPlayer(); if(!localPlayer || localPlayer->getPosition() == m_centralPosition) return; - TilePtr tile = getTile(localPlayer->getPosition()); - if(!tile || tile->hasThing(localPlayer)) + TilePtr tile = localPlayer->getTile(); + if(tile && tile->hasThing(localPlayer)) return; localPlayer->setPosition(m_centralPosition); }); diff --git a/src/otclient/net/protocolgame.cpp b/src/otclient/net/protocolgame.cpp index 1040e909..e027b8a6 100644 --- a/src/otclient/net/protocolgame.cpp +++ b/src/otclient/net/protocolgame.cpp @@ -25,11 +25,6 @@ #include #include -ProtocolGame::ProtocolGame() -{ - m_waitingLoginPacket = false; -} - void ProtocolGame::login(const std::string& accountName, const std::string& accountPassword, const std::string& host, uint16 port, const std::string& characterName) { if(accountName.empty() || accountPassword.empty()) { diff --git a/src/otclient/net/protocolgame.h b/src/otclient/net/protocolgame.h index bfac3180..86a2985a 100644 --- a/src/otclient/net/protocolgame.h +++ b/src/otclient/net/protocolgame.h @@ -30,9 +30,6 @@ class ProtocolGame : public Protocol { -public: - ProtocolGame(); - public: void login(const std::string& accountName, const std::string& accountPassword, const std::string& host, uint16 port, const std::string& characterName); @@ -198,7 +195,7 @@ private: Position parsePosition(InputMessage& msg); private: - bool m_waitingLoginPacket; + Boolean m_waitingLoginPacket; std::string m_accountName; std::string m_accountPassword; std::string m_characterName; diff --git a/src/otclient/net/protocolgameparse.cpp b/src/otclient/net/protocolgameparse.cpp index aa146f9e..0af5eeaf 100644 --- a/src/otclient/net/protocolgameparse.cpp +++ b/src/otclient/net/protocolgameparse.cpp @@ -1270,11 +1270,8 @@ ThingPtr ProtocolGame::internalGetThing(InputMessage& msg) creature->setEmblem(emblem); creature->setPassable(passable); - // now that the local player is known, we can schedule login event - if(creature == m_localPlayer && !m_localPlayer->isKnown()) { + if(creature == m_localPlayer && !m_localPlayer->isKnown()) m_localPlayer->setKnown(true); - g_eventDispatcher.addEvent([] { g_game.processLogin(); }); - } } thing = creature;