Skip to content

An OpenMW mod that lets you play the whole Elder Scrolls III: Morrowind as a top-down isometric game — with full online co-op or MMO modes.

C++

Isowind dccfbc5: Builds with GCC 13: server script table, LuaBridge, action bar include; Linux CI keeps its compiler cache

Isowind3a83cbaf83a2
diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
index b573a5e..2910658 100644
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -22,10 +22,11 @@ jobs:
- name: Dependencies
run: sudo CI/install_debian_deps.sh gcc openmw-deps openmw-deps-dynamic
- - uses: actions/cache@v4
+ # The compiler cache, saved after every run, failed or not, so a failing build doesn't start over next time
+ - uses: actions/cache/restore@v4
with:
path: .ccache
- key: linux-ccache-${{ github.sha }}
+ key: linux-ccache-${{ github.run_id }}
restore-keys: linux-ccache-
# The multiplayer's networking (TES3MP's CrabNet), at the commit the Windows build uses
@@ -54,6 +55,12 @@ jobs:
# -k: report every file that fails, not just the first
run: cmake --build build -j$(nproc) -- -k
+ - uses: actions/cache/save@v4
+ if: always()
+ with:
+ path: .ccache
+ key: linux-ccache-${{ github.run_id }}
+
# The bundled mods (third-party, so not in git): bundled-mods.zip on this repository's "bundled-mods" release
- name: Bundled mods
env:
diff --git a/android/buildscripts/patches/openmw051-final/apply-android-graphics-followup.py b/android/buildscripts/patches/openmw051-final/apply-android-graphics-followup.py
index 7a3eac5..a6c6749 100644
--- a/android/buildscripts/patches/openmw051-final/apply-android-graphics-followup.py
+++ b/android/buildscripts/patches/openmw051-final/apply-android-graphics-followup.py
@@ -148,15 +148,13 @@ text = pingpong_cpp.read_text(encoding='utf-8').replace('\r\n', '\n')
if GAMMA_MARKER not in text:
text = replace_once(
text,
+ # Isowind: anchored on <cassert> alone (Isowind includes <cmath> after it)
'''#include <cassert>
-
-#include <components/shader/shadermanager.hpp>''',
+''',
'''#include <cassert>
#include <cstdlib>
-
#include <osg/Shader>
-
-#include <components/shader/shadermanager.hpp>''',
+''',
'pingpongcanvas.cpp/gamma includes',
)
diff --git a/android/buildscripts/patches/openmw051-final/apply-android-runtime-baseline.py b/android/buildscripts/patches/openmw051-final/apply-android-runtime-baseline.py
index 28518d6..ff5b879 100644
--- a/android/buildscripts/patches/openmw051-final/apply-android-runtime-baseline.py
+++ b/android/buildscripts/patches/openmw051-final/apply-android-runtime-baseline.py
@@ -152,10 +152,9 @@ if pp_init_marker not in text:
)
text = replace_once(
text,
- ''' {
- auto& shaderManager = mRendering.getResourceSystem()->getSceneManager()->getShaderManager();''',
- ''' {
-#ifdef ANDROID
+ # Isowind: anchored on the line alone (Isowind sets up its pixel art scale just before it)
+ ''' auto& shaderManager = mRendering.getResourceSystem()->getSceneManager()->getShaderManager();''',
+ '''#ifdef ANDROID
// OPENMW_ANDROID_051_GATE_G_PP_INIT
// Establish the actual Android render size before setViewport()
// and before createObjectsForFrame() allocates PP textures/FBOs.
@@ -240,9 +239,9 @@ if wetworld_water_marker not in text:
)
text = replace_once(
text,
+ # Isowind: anchored on the line alone (Isowind's noCutaway uniform follows it)
''' osg::ref_ptr<osg::StateSet> stateset = SceneUtil::createSimpleWaterStateSet(alpha, MWRender::RenderBin_Water);
-
- node->setStateSet(stateset);''',
+''',
''' osg::ref_ptr<osg::StateSet> stateset = SceneUtil::createSimpleWaterStateSet(alpha, MWRender::RenderBin_Water);
#ifdef ANDROID
@@ -253,8 +252,7 @@ if wetworld_water_marker not in text:
osg::BlendFunc::ZERO, osg::BlendFunc::ZERO),
osg::StateAttribute::ON);
#endif
-
- node->setStateSet(stateset);''',
+''',
'water.cpp/simple-water alpha marker',
)
text = replace_once(
diff --git a/apps/openmw-mp/Script/LangLua/LangLua.cpp b/apps/openmw-mp/Script/LangLua/LangLua.cpp
index d88cf6e..4079043 100644
--- a/apps/openmw-mp/Script/LangLua/LangLua.cpp
+++ b/apps/openmw-mp/Script/LangLua/LangLua.cpp
@@ -77,10 +77,9 @@ struct LuaFunctionDispatcher<0, FunctionIndex> {
// Dispatch Lua function with the given arguments
template <typename ReturnType, typename... Args>
inline static ReturnType Dispatch(lua_State*&&, Args&&... args) noexcept {
- // Retrieve function data
- constexpr ScriptFunctionData const& functionData = ScriptFunctions::functions[FunctionIndex];
// Call the C++ function using reinterpret_cast
- return reinterpret_cast<FunctionEllipsis<ReturnType>>(functionData.func.addr)(std::forward<Args>(args)...);
+ return reinterpret_cast<FunctionEllipsis<ReturnType>>(ScriptFunctions::addresses[FunctionIndex].addr)(
+ std::forward<Args>(args)...);
}
};
diff --git a/apps/openmw-mp/Script/LangNative/LangNative.cpp b/apps/openmw-mp/Script/LangNative/LangNative.cpp
index 134cab9..bd8f3e7 100644
--- a/apps/openmw-mp/Script/LangNative/LangNative.cpp
+++ b/apps/openmw-mp/Script/LangNative/LangNative.cpp
@@ -2,6 +2,7 @@
#include <dlfcn.h>
#endif
+#include <iterator>
#include <stdexcept>
#include "LangNative.hpp"
#include <Script/SystemInterface.hpp>
@@ -42,9 +43,12 @@ void LangNative::LoadProgram(const char *filename)
const char *prefix = SystemInterface<const char *>(lib, "prefix").result;
std::string pf(prefix);
- for (const auto &function : ScriptFunctions::functions)
- if (!SetScript(lib, std::string(pf + function.name).c_str(), function.func.addr))
- LOG_MESSAGE_SIMPLE(TimedLog::LOG_WARN, "Script function pointer not found: %s", function.name);
+ for (size_t i = 0; i < std::size(ScriptFunctions::functions); ++i)
+ {
+ const char *name = ScriptFunctions::functions[i].name;
+ if (!SetScript(lib, std::string(pf + name).c_str(), ScriptFunctions::addresses[i].addr))
+ LOG_MESSAGE_SIMPLE(TimedLog::LOG_WARN, "Script function pointer not found: %s", name);
+ }
}
catch (...)
{
diff --git a/apps/openmw-mp/Script/ScriptFunctions.hpp b/apps/openmw-mp/Script/ScriptFunctions.hpp
index 715434d..e4652d1 100644
--- a/apps/openmw-mp/Script/ScriptFunctions.hpp
+++ b/apps/openmw-mp/Script/ScriptFunctions.hpp
@@ -117,40 +117,41 @@ public:
static bool IsTimerElapsed(int timerId) noexcept;
- static constexpr ScriptFunctionData functions[]{
- {"CreateTimer", ScriptFunctions::CreateTimer},
- {"CreateTimerEx", ScriptFunctions::CreateTimerEx},
- {"MakePublic", ScriptFunctions::MakePublic},
- {"CallPublic", ScriptFunctions::CallPublic},
-
- {"StartTimer", ScriptFunctions::StartTimer},
- {"StopTimer", ScriptFunctions::StopTimer},
- {"RestartTimer", ScriptFunctions::RestartTimer},
- {"FreeTimer", ScriptFunctions::FreeTimer},
- {"IsTimerElapsed", ScriptFunctions::IsTimerElapsed},
-
- ACTORAPI,
- BOOKAPI,
- CELLAPI,
- CHARCLASSAPI,
- CHATAPI,
- DIALOGUEAPI,
- FACTIONAPI,
- GUIAPI,
- ITEMAPI,
- MECHANICSAPI,
- MISCELLANEOUSAPI,
- POSITIONAPI,
- QUESTAPI,
- RECORDSDYNAMICAPI,
- SHAPESHIFTAPI,
- SERVERAPI,
- SETTINGSAPI,
- SPELLAPI,
- STATAPI,
- OBJECTAPI,
+#define ISOWIND_SCRIPT_FUNCTION_LIST \
+ {"CreateTimer", ScriptFunctions::CreateTimer}, \
+ {"CreateTimerEx", ScriptFunctions::CreateTimerEx}, \
+ {"MakePublic", ScriptFunctions::MakePublic}, \
+ {"CallPublic", ScriptFunctions::CallPublic}, \
+ {"StartTimer", ScriptFunctions::StartTimer}, \
+ {"StopTimer", ScriptFunctions::StopTimer}, \
+ {"RestartTimer", ScriptFunctions::RestartTimer}, \
+ {"FreeTimer", ScriptFunctions::FreeTimer}, \
+ {"IsTimerElapsed", ScriptFunctions::IsTimerElapsed}, \
+ ACTORAPI, \
+ BOOKAPI, \
+ CELLAPI, \
+ CHARCLASSAPI, \
+ CHATAPI, \
+ DIALOGUEAPI, \
+ FACTIONAPI, \
+ GUIAPI, \
+ ITEMAPI, \
+ MECHANICSAPI, \
+ MISCELLANEOUSAPI, \
+ POSITIONAPI, \
+ QUESTAPI, \
+ RECORDSDYNAMICAPI, \
+ SHAPESHIFTAPI, \
+ SERVERAPI, \
+ SETTINGSAPI, \
+ SPELLAPI, \
+ STATAPI, \
+ OBJECTAPI, \
WORLDSTATEAPI
- };
+
+ static constexpr ScriptFunctionData functions[]{ ISOWIND_SCRIPT_FUNCTION_LIST };
+ // Their addresses, in the same order (filled in at startup; see ScriptFunctionAddress)
+ static inline const ScriptFunctionAddress addresses[]{ ISOWIND_SCRIPT_FUNCTION_LIST };
static constexpr ScriptCallbackData callbacks[]{
{"OnServerInit", Callback<>()},
diff --git a/apps/openmw-mp/Script/Types.hpp b/apps/openmw-mp/Script/Types.hpp
index 88590d6..41683bf 100644
--- a/apps/openmw-mp/Script/Types.hpp
+++ b/apps/openmw-mp/Script/Types.hpp
@@ -98,14 +98,20 @@ struct CallbackIdentity
struct ScriptFunctionPointer : public ScriptIdentity
{
- void *addr;
-#if (!defined(__clang__) && defined(__GNUC__))
+ // Isowind: only what the function takes and returns. A constexpr table can't hold a function pointer cast to
+ // void* (only MSVC and older GCC let that through), so the addresses are in ScriptFunctions::addresses.
template<typename R, typename... Types>
- constexpr ScriptFunctionPointer(Function<R, Types...> addr) : ScriptIdentity(addr), addr((void*)(addr)) {}
-#else
+ constexpr ScriptFunctionPointer(Function<R, Types...> addr) : ScriptIdentity(addr) {}
+};
+
+// A script function's address, for calling it: ScriptFunctions::addresses, in the order of ScriptFunctions::functions,
+// filled in at startup from the same list
+struct ScriptFunctionAddress
+{
+ void *addr;
+
template<typename R, typename... Types>
- constexpr ScriptFunctionPointer(Function<R, Types...> addr) : ScriptIdentity(addr), addr(addr) {}
-#endif
+ ScriptFunctionAddress(const char*, Function<R, Types...> function) : addr(reinterpret_cast<void*>(function)) {}
};
struct ScriptFunctionData
diff --git a/apps/openmw/mwgui/actionbar.hpp b/apps/openmw/mwgui/actionbar.hpp
index ea9e0f6..f5dbb92 100644
--- a/apps/openmw/mwgui/actionbar.hpp
+++ b/apps/openmw/mwgui/actionbar.hpp
@@ -7,6 +7,8 @@
#include <components/esm/refid.hpp>
#include <components/esm3/quickkeys.hpp>
+#include <MyGUI_MouseButton.h>
+
#include "../mwworld/ptr.hpp"
namespace MyGUI
diff --git a/extern/LuaBridge/detail/Userdata.h b/extern/LuaBridge/detail/Userdata.h
index fde9017..abd1744 100644
--- a/extern/LuaBridge/detail/Userdata.h
+++ b/extern/LuaBridge/detail/Userdata.h
@@ -344,7 +344,7 @@ template <class T>
class UserdataValue : public Userdata
{
private:
- UserdataValue <T> (UserdataValue <T> const&);
+ UserdataValue (UserdataValue <T> const&);
UserdataValue <T> operator= (UserdataValue <T> const&);
char m_storage [sizeof (T)];