diff --git a/modules/old/game_battle/battle.lua b/modules/game_battle/battle.lua similarity index 100% rename from modules/old/game_battle/battle.lua rename to modules/game_battle/battle.lua diff --git a/modules/old/game_battle/battle.otmod b/modules/game_battle/battle.otmod similarity index 100% rename from modules/old/game_battle/battle.otmod rename to modules/game_battle/battle.otmod diff --git a/modules/old/game_battle/battle.otui b/modules/game_battle/battle.otui similarity index 100% rename from modules/old/game_battle/battle.otui rename to modules/game_battle/battle.otui diff --git a/modules/old/game_battle/battle.png b/modules/game_battle/battle.png similarity index 100% rename from modules/old/game_battle/battle.png rename to modules/game_battle/battle.png diff --git a/modules/old/game_battle/battleButton.otui b/modules/game_battle/battleButton.otui similarity index 100% rename from modules/old/game_battle/battleButton.otui rename to modules/game_battle/battleButton.otui diff --git a/modules/old/game_battle/battle_monsters.png b/modules/game_battle/battle_monsters.png similarity index 100% rename from modules/old/game_battle/battle_monsters.png rename to modules/game_battle/battle_monsters.png diff --git a/modules/old/game_battle/battle_npcs.png b/modules/game_battle/battle_npcs.png similarity index 100% rename from modules/old/game_battle/battle_npcs.png rename to modules/game_battle/battle_npcs.png diff --git a/modules/old/game_battle/battle_party.png b/modules/game_battle/battle_party.png similarity index 100% rename from modules/old/game_battle/battle_party.png rename to modules/game_battle/battle_party.png diff --git a/modules/old/game_battle/battle_players.png b/modules/game_battle/battle_players.png similarity index 100% rename from modules/old/game_battle/battle_players.png rename to modules/game_battle/battle_players.png diff --git a/modules/old/game_battle/battle_skulls.png b/modules/game_battle/battle_skulls.png similarity index 100% rename from modules/old/game_battle/battle_skulls.png rename to modules/game_battle/battle_skulls.png diff --git a/modules/old/game_combatcontrols/combatcontrols.lua b/modules/game_combatcontrols/combatcontrols.lua similarity index 100% rename from modules/old/game_combatcontrols/combatcontrols.lua rename to modules/game_combatcontrols/combatcontrols.lua diff --git a/modules/old/game_combatcontrols/combatcontrols.otmod b/modules/game_combatcontrols/combatcontrols.otmod similarity index 100% rename from modules/old/game_combatcontrols/combatcontrols.otmod rename to modules/game_combatcontrols/combatcontrols.otmod diff --git a/modules/old/game_combatcontrols/combatcontrols.otui b/modules/game_combatcontrols/combatcontrols.otui similarity index 100% rename from modules/old/game_combatcontrols/combatcontrols.otui rename to modules/game_combatcontrols/combatcontrols.otui diff --git a/modules/old/game_combatcontrols/combatcontrols.png b/modules/game_combatcontrols/combatcontrols.png similarity index 100% rename from modules/old/game_combatcontrols/combatcontrols.png rename to modules/game_combatcontrols/combatcontrols.png diff --git a/modules/old/game_combatcontrols/icons/chasemode.png b/modules/game_combatcontrols/icons/chasemode.png similarity index 100% rename from modules/old/game_combatcontrols/icons/chasemode.png rename to modules/game_combatcontrols/icons/chasemode.png diff --git a/modules/old/game_combatcontrols/icons/fightbalanced.png b/modules/game_combatcontrols/icons/fightbalanced.png similarity index 100% rename from modules/old/game_combatcontrols/icons/fightbalanced.png rename to modules/game_combatcontrols/icons/fightbalanced.png diff --git a/modules/old/game_combatcontrols/icons/fightdefensive.png b/modules/game_combatcontrols/icons/fightdefensive.png similarity index 100% rename from modules/old/game_combatcontrols/icons/fightdefensive.png rename to modules/game_combatcontrols/icons/fightdefensive.png diff --git a/modules/old/game_combatcontrols/icons/fightoffensive.png b/modules/game_combatcontrols/icons/fightoffensive.png similarity index 100% rename from modules/old/game_combatcontrols/icons/fightoffensive.png rename to modules/game_combatcontrols/icons/fightoffensive.png diff --git a/modules/old/game_combatcontrols/icons/safefight.png b/modules/game_combatcontrols/icons/safefight.png similarity index 100% rename from modules/old/game_combatcontrols/icons/safefight.png rename to modules/game_combatcontrols/icons/safefight.png diff --git a/modules/old/game_containers/container.otui b/modules/game_containers/container.otui similarity index 100% rename from modules/old/game_containers/container.otui rename to modules/game_containers/container.otui diff --git a/modules/old/game_containers/containers.lua b/modules/game_containers/containers.lua similarity index 100% rename from modules/old/game_containers/containers.lua rename to modules/game_containers/containers.lua diff --git a/modules/old/game_containers/containers.otmod b/modules/game_containers/containers.otmod similarity index 100% rename from modules/old/game_containers/containers.otmod rename to modules/game_containers/containers.otmod diff --git a/modules/old/game_healthbar/healthbar.lua b/modules/game_healthbar/healthbar.lua similarity index 100% rename from modules/old/game_healthbar/healthbar.lua rename to modules/game_healthbar/healthbar.lua diff --git a/modules/old/game_healthbar/healthbar.otmod b/modules/game_healthbar/healthbar.otmod similarity index 100% rename from modules/old/game_healthbar/healthbar.otmod rename to modules/game_healthbar/healthbar.otmod diff --git a/modules/old/game_healthbar/healthbar.otui b/modules/game_healthbar/healthbar.otui similarity index 100% rename from modules/old/game_healthbar/healthbar.otui rename to modules/game_healthbar/healthbar.otui diff --git a/modules/old/game_healthbar/healthbar.png b/modules/game_healthbar/healthbar.png similarity index 100% rename from modules/old/game_healthbar/healthbar.png rename to modules/game_healthbar/healthbar.png diff --git a/modules/old/game_hotkeys/hotkeys_manager.lua b/modules/game_hotkeys/hotkeys_manager.lua similarity index 100% rename from modules/old/game_hotkeys/hotkeys_manager.lua rename to modules/game_hotkeys/hotkeys_manager.lua diff --git a/modules/old/game_hotkeys/hotkeys_manager.otmod b/modules/game_hotkeys/hotkeys_manager.otmod similarity index 100% rename from modules/old/game_hotkeys/hotkeys_manager.otmod rename to modules/game_hotkeys/hotkeys_manager.otmod diff --git a/modules/old/game_hotkeys/hotkeys_manager.otui b/modules/game_hotkeys/hotkeys_manager.otui similarity index 100% rename from modules/old/game_hotkeys/hotkeys_manager.otui rename to modules/game_hotkeys/hotkeys_manager.otui diff --git a/modules/old/game_hotkeys/icon.png b/modules/game_hotkeys/icon.png similarity index 100% rename from modules/old/game_hotkeys/icon.png rename to modules/game_hotkeys/icon.png diff --git a/modules/old/game_interface/gameinterface.lua b/modules/game_interface/gameinterface.lua similarity index 100% rename from modules/old/game_interface/gameinterface.lua rename to modules/game_interface/gameinterface.lua diff --git a/modules/old/game_interface/gameinterface.otmod b/modules/game_interface/gameinterface.otmod similarity index 100% rename from modules/old/game_interface/gameinterface.otmod rename to modules/game_interface/gameinterface.otmod diff --git a/modules/old/game_interface/gameinterface.otui b/modules/game_interface/gameinterface.otui similarity index 100% rename from modules/old/game_interface/gameinterface.otui rename to modules/game_interface/gameinterface.otui diff --git a/modules/old/game_interface/uimap.lua b/modules/game_interface/uimap.lua similarity index 100% rename from modules/old/game_interface/uimap.lua rename to modules/game_interface/uimap.lua diff --git a/modules/old/game_inventory/inventory.lua b/modules/game_inventory/inventory.lua similarity index 100% rename from modules/old/game_inventory/inventory.lua rename to modules/game_inventory/inventory.lua diff --git a/modules/old/game_inventory/inventory.otmod b/modules/game_inventory/inventory.otmod similarity index 100% rename from modules/old/game_inventory/inventory.otmod rename to modules/game_inventory/inventory.otmod diff --git a/modules/old/game_inventory/inventory.otui b/modules/game_inventory/inventory.otui similarity index 100% rename from modules/old/game_inventory/inventory.otui rename to modules/game_inventory/inventory.otui diff --git a/modules/old/game_inventory/inventory.png b/modules/game_inventory/inventory.png similarity index 100% rename from modules/old/game_inventory/inventory.png rename to modules/game_inventory/inventory.png diff --git a/modules/old/game_outfit/outfit.lua b/modules/game_outfit/outfit.lua similarity index 100% rename from modules/old/game_outfit/outfit.lua rename to modules/game_outfit/outfit.lua diff --git a/modules/old/game_outfit/outfit.otmod b/modules/game_outfit/outfit.otmod similarity index 100% rename from modules/old/game_outfit/outfit.otmod rename to modules/game_outfit/outfit.otmod diff --git a/modules/old/game_outfit/outfit.otui b/modules/game_outfit/outfit.otui similarity index 100% rename from modules/old/game_outfit/outfit.otui rename to modules/game_outfit/outfit.otui diff --git a/modules/old/game_skills/skills.lua b/modules/game_skills/skills.lua similarity index 100% rename from modules/old/game_skills/skills.lua rename to modules/game_skills/skills.lua diff --git a/modules/old/game_skills/skills.otmod b/modules/game_skills/skills.otmod similarity index 100% rename from modules/old/game_skills/skills.otmod rename to modules/game_skills/skills.otmod diff --git a/modules/old/game_skills/skills.otui b/modules/game_skills/skills.otui similarity index 100% rename from modules/old/game_skills/skills.otui rename to modules/game_skills/skills.otui diff --git a/modules/old/game_viplist/addvip.otui b/modules/game_viplist/addvip.otui similarity index 100% rename from modules/old/game_viplist/addvip.otui rename to modules/game_viplist/addvip.otui diff --git a/modules/old/game_viplist/viplist.lua b/modules/game_viplist/viplist.lua similarity index 100% rename from modules/old/game_viplist/viplist.lua rename to modules/game_viplist/viplist.lua diff --git a/modules/old/game_viplist/viplist.otmod b/modules/game_viplist/viplist.otmod similarity index 100% rename from modules/old/game_viplist/viplist.otmod rename to modules/game_viplist/viplist.otmod diff --git a/modules/old/game_viplist/viplist.otui b/modules/game_viplist/viplist.otui similarity index 100% rename from modules/old/game_viplist/viplist.otui rename to modules/game_viplist/viplist.otui diff --git a/modules/old/game_viplist/viplist.png b/modules/game_viplist/viplist.png similarity index 100% rename from modules/old/game_viplist/viplist.png rename to modules/game_viplist/viplist.png diff --git a/src/framework/application.cpp b/src/framework/application.cpp index a3fabe97..2f4cbc02 100644 --- a/src/framework/application.cpp +++ b/src/framework/application.cpp @@ -115,10 +115,15 @@ void Application::init(const std::vector& args, int appFlags) if(m_appFlags & Fw::AppEnableModules) g_modules.discoverModulesPath(); + + m_initialized = true; } void Application::terminate() { + if(!m_initialized) + return; + g_lua.callGlobalField("g_app", "onTerminate"); // hide the window because there is no render anymore @@ -162,6 +167,9 @@ void Application::terminate() void Application::run() { + if(!m_initialized) + return; + ticks_t lastPollTicks = g_clock.updateTicks(); m_stopping = false; m_running = true; diff --git a/src/framework/application.h b/src/framework/application.h index 70f32e8e..a2c1448a 100644 --- a/src/framework/application.h +++ b/src/framework/application.h @@ -65,6 +65,7 @@ protected: std::string m_appBuildDate; int m_appFlags; int m_pollCycleDelay; + Boolean m_initialized; Boolean m_running; Boolean m_stopping; }; diff --git a/src/framework/graphics/coordsbuffer.cpp b/src/framework/graphics/coordsbuffer.cpp index e6dff913..f75d42fa 100644 --- a/src/framework/graphics/coordsbuffer.cpp +++ b/src/framework/graphics/coordsbuffer.cpp @@ -21,6 +21,7 @@ */ #include "coordsbuffer.h" +#include "graphics.h" CoordsBuffer::CoordsBuffer() { @@ -86,6 +87,9 @@ void CoordsBuffer::addRepeatedRects(const Rect& dest, const Rect& src) void CoordsBuffer::enableHardwareCaching(HardwareBuffer::UsagePattern usagePattern) { + if(!g_graphics.canUseHardwareBuffers()) + return; + #ifndef OPENGL_ES2 if(!GL_ARB_vertex_buffer_object) return; diff --git a/src/framework/graphics/graphics.cpp b/src/framework/graphics/graphics.cpp index 97738a1c..4c15cb03 100644 --- a/src/framework/graphics/graphics.cpp +++ b/src/framework/graphics/graphics.cpp @@ -62,6 +62,23 @@ void Graphics::terminate() m_emptyTexture.reset(); } +bool Graphics::parseOption(const std::string& option) +{ + if(option == "-no-fbos") + m_useFBO = false; + else if(option == "-no-mipmapping") + m_generateMipmaps = false; + else if(option == "-no-smoothing") + m_useBilinearFiltering = false; + else if(option == "-realtime-mipmapping") + m_generateRealtimeMipmaps = true; + else if(option == "-no-hardware-buffering") + m_useHardwareBuffers = false; + else + return false; + return true; +} + void Graphics::resize(const Size& size) { setViewportSize(size); diff --git a/src/framework/graphics/graphics.h b/src/framework/graphics/graphics.h index fdeaf89d..3699eeb9 100644 --- a/src/framework/graphics/graphics.h +++ b/src/framework/graphics/graphics.h @@ -31,9 +31,11 @@ class Graphics public: void init(); void terminate(); + bool parseOption(const std::string& option); bool canUseFBO() { return m_useFBO; } bool canUseBilinearFiltering() { return m_useBilinearFiltering; } + bool canUseHardwareBuffers() { return m_useHardwareBuffers; } bool canGenerateMipmaps() { return m_generateMipmaps; } bool canGenerateHardwareMipmaps() { return m_generateHardwareMipmaps; } bool canGenerateRealtimeMipmaps() { return m_generateRealtimeMipmaps; } @@ -53,6 +55,7 @@ private: TexturePtr m_emptyTexture; Boolean m_useFBO; + Boolean m_useHardwareBuffers; Boolean m_useBilinearFiltering; Boolean m_generateMipmaps; Boolean m_generateHardwareMipmaps; diff --git a/src/framework/graphics/texture.cpp b/src/framework/graphics/texture.cpp index feea83e2..a4ba3648 100644 --- a/src/framework/graphics/texture.cpp +++ b/src/framework/graphics/texture.cpp @@ -103,7 +103,9 @@ void Texture::generateMipmaps() generateHardwareMipmaps(); else { // fallback to software mipmaps generation, this can be slow - generateSoftwareMipmaps(getPixels()); + //FIXME: disable because mipmaps size needs to be in base of 2, + // and the current algorithmn does not support that + //generateSoftwareMipmaps(getPixels()); } } @@ -169,6 +171,7 @@ void Texture::generateSoftwareMipmaps(std::vector inPixels) Size outSize = inSize / 2; std::vector outPixels(outSize.area()*4); + dump << "yeah"; int mipmap = 1; while(true) { // this is a simple bilinear filtering algorithm, it combines every 4 pixels in one pixel diff --git a/src/framework/ui/uiwidgetimage.cpp b/src/framework/ui/uiwidgetimage.cpp index c56d763f..a6c14342 100644 --- a/src/framework/ui/uiwidgetimage.cpp +++ b/src/framework/ui/uiwidgetimage.cpp @@ -168,7 +168,7 @@ void UIWidget::drawImage(const Rect& screenCoords) m_imageTexture->setSmooth(m_imageSmooth); // this will increase fps when rendering larger images, like the background, and improve image quality - if(m_imageSmooth && g_graphics.canGenerateMipmaps() && !m_imageTexture->hasMipmaps()) + if(m_imageSmooth && !m_imageTexture->hasMipmaps() && g_graphics.canGenerateMipmaps()) m_imageTexture->generateMipmaps(); g_painter.setColor(m_imageColor); diff --git a/src/otclient/otclient.cpp b/src/otclient/otclient.cpp index 19cfa4d9..72ebc5c8 100644 --- a/src/otclient/otclient.cpp +++ b/src/otclient/otclient.cpp @@ -23,6 +23,7 @@ #include "otclient.h" #include #include +#include #include "core/game.h" #include "core/map.h" @@ -33,11 +34,49 @@ OTClient::OTClient() : Application(Otc::AppCompactName) void OTClient::init(const std::vector& args) { + std::string startupOptions; + for(uint i=1;i 0) + logInfo("Startup options:", startupOptions); g_logger.setLogFile(Fw::formatString("%s.txt", Otc::AppCompactName)); Application::init(args, Fw::AppEnableAll);