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 6eac7a5: Multiplayer headers: include <cstdint> (GCC 13 doesn't pull it in)

Isowindb4a2fea29d5d
diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml
index 1738341..f512d2a 100644
--- a/.github/workflows/android.yml
+++ b/.github/workflows/android.yml
@@ -1,7 +1,9 @@
name: Android
on:
+ # Branches only: tags (like the bundled-mods release's) don't build
push:
+ branches: ['**']
workflow_dispatch:
# A newer push replaces a run still going
@@ -44,7 +46,20 @@ jobs:
key: android-deps-${{ github.run_id }}
restore-keys: android-deps-
+ # The bundled mods (third-party, so not in git): bundled-mods.zip on this repository's "bundled-mods" release
+ - name: Bundled mods
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ if gh release download bundled-mods -p bundled-mods.zip; then
+ unzip -q bundled-mods.zip -d bundled-mods
+ else
+ echo "::warning::No bundled-mods release: the APK goes without the bundled mods"
+ fi
+
- name: Engine and libraries (arm64)
+ env:
+ ISOWIND_MODS: ${{ github.workspace }}/bundled-mods
run: |
rm -rf android/buildscripts/build/arm64/openmw-prefix
cd android/buildscripts && ./build.sh --arch arm64
diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
index 6a4ddfa..b573a5e 100644
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -1,7 +1,9 @@
name: Linux
on:
+ # Branches only: tags (like the bundled-mods release's) don't build
push:
+ branches: ['**']
workflow_dispatch:
# A newer push replaces a run still going
diff --git a/android/app/src/main/java/constants/Constants.kt b/android/app/src/main/java/constants/Constants.kt
index f8fd534..33fdae0 100644
--- a/android/app/src/main/java/constants/Constants.kt
+++ b/android/app/src/main/java/constants/Constants.kt
@@ -61,4 +61,9 @@ object Constants {
// Contains app version code for currently deployed internal resources.
var VERSION_STAMP = ""
+
+ // Isowind's files copied from APK assets: the mod, the bundled mods, pixel art and the profiles, laid out as in
+ // the desktop packages (the profiles' openmw.cfg data paths are relative to their own folder).
+ // e.g. /data/user/0/tf.pw.isowind/files/isowind
+ var ISOWIND = ""
}
diff --git a/android/app/src/main/java/ui/activity/MainActivity.kt b/android/app/src/main/java/ui/activity/MainActivity.kt
index 8c9e4d2..36b3bf0 100644
--- a/android/app/src/main/java/ui/activity/MainActivity.kt
+++ b/android/app/src/main/java/ui/activity/MainActivity.kt
@@ -574,6 +574,8 @@ class MainActivity : AppCompatActivity() {
groundcovers.mods
.filter { it.enabled && ModsPaths.fileExistsIn(it.filename, activeDataFilesList) }
.forEach { append("groundcover=${it.filename}\n") }
+
+ append(isowindCfgLines())
}
// Write only the real launcher configuration. Keep unrelated
@@ -590,6 +592,56 @@ class MainActivity : AppCompatActivity() {
}
}
+ // Isowind's look on Android: pixel art (the engine renders at low resolution, which also suits phones; the retro
+ // textures the desktop launchers build aren't made here yet)
+ private val isowindLook = "pixelart"
+
+ // What the Android launcher sets itself, so the Isowind profile leaves it alone
+ private val isowindLauncherSections = setOf("Post Processing", "Shadows")
+
+ /**
+ * Isowind: the profile's data folders (its mod and the bundled mods) after every other one, and its plugins after
+ * Morrowind's, in the order the multiplayer server expects. Its data paths are relative to the profile's folder.
+ */
+ private fun isowindCfgLines(): String {
+ val profile = File(Constants.ISOWIND, "profiles/$isowindLook")
+ val cfg = File(profile, "openmw.cfg")
+ if (!cfg.isFile) return ""
+ return buildString {
+ cfg.readLines().map { it.trim() }.forEach { line ->
+ when {
+ line.startsWith("data=") ->
+ append("data=\"${File(profile, line.removePrefix("data=").trim('"')).canonicalPath}\"\n")
+ line.startsWith("content=") -> append(line).append('\n')
+ }
+ }
+ }
+ }
+
+ /**
+ * Isowind: the profile's settings (what the top-down camera, the pixel art look and the HUD need) over the
+ * user's settings.cfg on every start, except what the Android launcher owns: post-processing, shadows, the GUI
+ * scaling it works out for the screen.
+ */
+ private fun applyIsowindSettings() {
+ val profileSettings = File(Constants.ISOWIND, "profiles/$isowindLook/settings.cfg")
+ if (!profileSettings.isFile) return
+ val sections = linkedMapOf<String, LinkedHashMap<String, String?>>()
+ var section = ""
+ profileSettings.readLines().map { it.trim() }.forEach { line ->
+ when {
+ line.isEmpty() || line.startsWith("#") -> {}
+ line.startsWith("[") && line.endsWith("]") -> section = line.substring(1, line.length - 1)
+ "=" in line && section !in isowindLauncherSections
+ && !(section == "GUI" && line.startsWith("scaling factor")) ->
+ sections.getOrPut(section) { linkedMapOf() }[line.substringBefore('=').trim()] =
+ line.substringAfter('=').trim()
+ }
+ }
+ val settingsFile = File(Constants.USER_CONFIG, "settings.cfg")
+ sections.forEach { (name, values) -> updateSettingsSection(settingsFile, name, values) }
+ }
+
/**
* Determines required screen scaling based on resolution and physical size of the device
*/
@@ -782,6 +834,7 @@ class MainActivity : AppCompatActivity() {
val assetCopier = CopyFilesFromAssets(this)
assetCopier.copy("libopenmw/resources", Constants.RESOURCES)
assetCopier.copy("libopenmw/openmw", Constants.GLOBAL_CONFIG)
+ assetCopier.copy("isowind", Constants.ISOWIND)
// The non-OMWFX path uses OpenMW 0.51's bundled adjustments.omwfx.
// The standalone Android/OMWFX shader assets remain isolated and are
@@ -798,6 +851,11 @@ class MainActivity : AppCompatActivity() {
File(Constants.USER_CONFIG).mkdirs()
if (!File(Constants.USER_OPENMW_CFG).exists())
File(Constants.USER_OPENMW_CFG).writeText("# This is the user openmw.cfg. Feel free to modify it as you wish.\n")
+ // Isowind's key and controller bindings, unless the player has their own
+ val isowindBindings = File(Constants.ISOWIND, "profiles/input_v3.xml")
+ val userBindings = File(Constants.USER_CONFIG, "input_v3.xml")
+ if (!userBindings.exists() && isowindBindings.isFile)
+ isowindBindings.copyTo(userBindings)
// create user custom icon folder as a hint
File(Constants.USER_FILE_STORAGE + "/icons").mkdirs()
@@ -818,6 +876,7 @@ class MainActivity : AppCompatActivity() {
deleteRecursive(File(Constants.GLOBAL_CONFIG))
deleteRecursive(File(Constants.RESOURCES))
+ deleteRecursive(File(Constants.ISOWIND))
}
/**
@@ -2167,6 +2226,9 @@ class MainActivity : AppCompatActivity() {
// transparent postpass for WetWorld and the optical stack.
applyOpenMw051RuntimeSettings()
+ // Isowind's look and HUD over the user's settings
+ applyIsowindSettings()
+
//val displayInCutoutArea = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("pref_display_cutout_area", false)
obtainFixedScreenResolution()
val dm = DisplayMetrics()
diff --git a/android/app/src/main/java/utils/MyApp.kt b/android/app/src/main/java/utils/MyApp.kt
index cd51443..50fb01d 100644
--- a/android/app/src/main/java/utils/MyApp.kt
+++ b/android/app/src/main/java/utils/MyApp.kt
@@ -66,6 +66,7 @@ class MyApp : Application() {
Constants.RESOURCES = File(filesDir, "resources").absolutePath
Constants.GLOBAL_CONFIG = File(filesDir, "config").absolutePath
Constants.VERSION_STAMP = File(filesDir, "stamp").absolutePath
+ Constants.ISOWIND = File(filesDir, "isowind").absolutePath
Log.i(TAG, "OpenMW user storage: ${Constants.USER_FILE_STORAGE}")
}
diff --git a/android/buildscripts/build.sh b/android/buildscripts/build.sh
index 96ee783..a3ac61a 100755
--- a/android/buildscripts/build.sh
+++ b/android/buildscripts/build.sh
@@ -231,6 +231,20 @@ EOF
# licensing info
cp "$DIR/../3rdparty-licenses.txt" "$DST"
+
+ # Isowind: the mod, pixel art and profiles, plus the bundled mods from $ISOWIND_MODS when given, laid out as in
+ # the desktop packages (MainActivity copies them out and adds the profile to openmw.cfg)
+ echo "==> Deploying Isowind"
+ ISO="$DIR/../../isowind"
+ ISO_DST="$DIR/../app/src/main/assets/isowind"
+ rm -rf "$ISO_DST" && mkdir -p "$ISO_DST/profiles"
+ cp -r "$ISO/mod" "$ISO/pixelart" "$ISO_DST/"
+ cp -r "$ISO/profiles/pixelart" "$ISO/profiles/normal" "$ISO/profiles/input_v3.xml" "$ISO_DST/profiles/"
+ if [[ -n "$ISOWIND_MODS" && -d "$ISOWIND_MODS" ]]; then
+ cp -r "$ISOWIND_MODS" "$ISO_DST/mods"
+ else
+ echo "warning: no bundled mods (ISOWIND_MODS); servers require their plugins"
+ fi
fi
echo "==> Making your debugging life easier"
diff --git a/components/openmw-mp/Base/BasePlayer.hpp b/components/openmw-mp/Base/BasePlayer.hpp
index 73e924f..a8293bc 100644
--- a/components/openmw-mp/Base/BasePlayer.hpp
+++ b/components/openmw-mp/Base/BasePlayer.hpp
@@ -1,6 +1,7 @@
#ifndef OPENMW_BASEPLAYER_HPP
#define OPENMW_BASEPLAYER_HPP
+#include <cstdint>
#include <components/esm3/loadcell.hpp>
#include <components/esm3/loadcrea.hpp>
#include <components/esm3/loadnpc.hpp>
diff --git a/components/openmw-mp/Master/PacketMasterAnnounce.hpp b/components/openmw-mp/Master/PacketMasterAnnounce.hpp
index 6c67ad8..ad4fcb6 100644
--- a/components/openmw-mp/Master/PacketMasterAnnounce.hpp
+++ b/components/openmw-mp/Master/PacketMasterAnnounce.hpp
@@ -1,6 +1,7 @@
#ifndef OPENMW_PACKETMASTERANNOUNCE_HPP
#define OPENMW_PACKETMASTERANNOUNCE_HPP
+#include <cstdint>
#include "../Packets/BasePacket.hpp"
#include "MasterData.hpp"
diff --git a/components/openmw-mp/Master/ProxyMasterPacket.hpp b/components/openmw-mp/Master/ProxyMasterPacket.hpp
index 14a0733..b2bf744 100644
--- a/components/openmw-mp/Master/ProxyMasterPacket.hpp
+++ b/components/openmw-mp/Master/ProxyMasterPacket.hpp
@@ -5,6 +5,7 @@
#ifndef OPENMW_PROXYMASTERPACKET_HPP
#define OPENMW_PROXYMASTERPACKET_HPP
+#include <cstdint>
#include <components/openmw-mp/Packets/BasePacket.hpp>
#include "MasterData.hpp"
#include <iostream>
diff --git a/components/openmw-mp/Packets/BasePacket.hpp b/components/openmw-mp/Packets/BasePacket.hpp
index 897c15b..1409f04 100644
--- a/components/openmw-mp/Packets/BasePacket.hpp
+++ b/components/openmw-mp/Packets/BasePacket.hpp
@@ -1,6 +1,7 @@
#ifndef OPENMW_BASEPACKET_HPP
#define OPENMW_BASEPACKET_HPP
+#include <cstdint>
#include <string>
#include <type_traits>
#include <variant>
diff --git a/components/openmw-mp/Packets/PacketPreInit.hpp b/components/openmw-mp/Packets/PacketPreInit.hpp
index 3af2182..be7e000 100644
--- a/components/openmw-mp/Packets/PacketPreInit.hpp
+++ b/components/openmw-mp/Packets/PacketPreInit.hpp
@@ -1,6 +1,7 @@
#ifndef OPENMW_PACKETPREINIT_HPP
#define OPENMW_PACKETPREINIT_HPP
+#include <cstdint>
#include <vector>
#include "BasePacket.hpp"
diff --git a/components/openmw-mp/Packets/System/PacketSystemHandshake.hpp b/components/openmw-mp/Packets/System/PacketSystemHandshake.hpp
index eec8974..c5d40f5 100644
--- a/components/openmw-mp/Packets/System/PacketSystemHandshake.hpp
+++ b/components/openmw-mp/Packets/System/PacketSystemHandshake.hpp
@@ -1,6 +1,7 @@
#ifndef OPENMW_PACKETSYSTEMHANDSHAKE_HPP
#define OPENMW_PACKETSYSTEMHANDSHAKE_HPP
+#include <cstdint>
#include <components/openmw-mp/Packets/System/SystemPacket.hpp>
namespace mwmp
diff --git a/components/openmw-mp/Utils.hpp b/components/openmw-mp/Utils.hpp
index 804248f..a5b51c9 100644
--- a/components/openmw-mp/Utils.hpp
+++ b/components/openmw-mp/Utils.hpp
@@ -1,6 +1,7 @@
#ifndef UTILS_HPP
#define UTILS_HPP
+#include <cstdint>
#include <algorithm>
#include <string>
#include <sstream>
diff --git a/files/shaders/lib/light/lighting.glsl b/files/shaders/lib/light/lighting.glsl
index 3712431..ea891e6 100644
--- a/files/shaders/lib/light/lighting.glsl
+++ b/files/shaders/lib/light/lighting.glsl
@@ -20,7 +20,13 @@ float calcLambert(vec3 viewNormal, vec3 lightDir, vec3 viewDir)
return lambert;
}
-// 'light bands': snap light intensity to a few hard steps (toon / pixel art lighting).
+// Isowind: how much farther than Morrowind's own radius point lights (torches, lanterns, spells) reach, their falloff
+// stretched to match, so their light spreads wide and fades softly. Objects only receive a light within 'light bounds
+// multiplier' times its radius, so the profiles set that to twice this (where the light has faded out).
+#define ISOWIND_LIGHT_REACH 1.75
+
+// 'light bands': snap light intensity to a few hard steps (toon / pixel art lighting). Sunlight only: point lights
+// stay smooth.
float lightBand(float x)
{
#if @lightBands > 0
@@ -77,16 +83,16 @@ void doLighting(vec3 viewPos, vec3 viewNormal, float shininess, out vec3 diffuse
// cull point lighting by radius, light is guaranteed to not fall outside this bound with our cutoff
#if !@classicFalloff
- if (lightDistance > lcalcRadius(lightIndex) * 2.0)
+ if (lightDistance > lcalcRadius(lightIndex) * 2.0 * ISOWIND_LIGHT_REACH)
continue;
#endif
vec3 lightDir = lightPos / lightDistance;
- float illumination = lcalcIllumination(lightIndex, lightDistance);
- diffuseLight += lcalcDiffuse(lightIndex) * lightBand(calcLambert(viewNormal, lightDir, viewDir) * illumination);
- ambientLight += lcalcAmbient(lightIndex) * lightBand(illumination);
- specularLight += lcalcSpecular(lightIndex).xyz * lightBand(calcSpecIntensity(viewNormal, viewDir, shininess, lightDir) * illumination);
+ float illumination = lcalcIllumination(lightIndex, lightDistance / ISOWIND_LIGHT_REACH);
+ diffuseLight += lcalcDiffuse(lightIndex) * calcLambert(viewNormal, lightDir, viewDir) * illumination;
+ ambientLight += lcalcAmbient(lightIndex) * illumination;
+ specularLight += lcalcSpecular(lightIndex).xyz * calcSpecIntensity(viewNormal, viewDir, shininess, lightDir) * illumination;
}
}
diff --git a/isowind/profiles/normal/settings.cfg b/isowind/profiles/normal/settings.cfg
index 9bae42e..0ce2dc1 100644
--- a/isowind/profiles/normal/settings.cfg
+++ b/isowind/profiles/normal/settings.cfg
@@ -14,6 +14,10 @@ pixel art scale = 1
pixel art animation fps = 0
[Shaders]
+# Isowind: point lights reach farther and fade softly (ISOWIND_LIGHT_REACH in shaders/lib/light/lighting.glsl):
+# objects get a light out to where it has faded (twice the reach), and more of them overlap
+light bounds multiplier = 3.5
+max lights = 16
minimum interior brightness = 0.0
light bands = 0
diff --git a/isowind/profiles/pixelart/settings.cfg b/isowind/profiles/pixelart/settings.cfg
index 34f0f12..79b16b3 100644
--- a/isowind/profiles/pixelart/settings.cfg
+++ b/isowind/profiles/pixelart/settings.cfg
@@ -18,6 +18,10 @@ pixel art animation fps = 12
pixel art animation near distance = 768
[Shaders]
+# Isowind: point lights reach farther and fade softly (ISOWIND_LIGHT_REACH in shaders/lib/light/lighting.glsl):
+# objects get a light out to where it has faded (twice the reach), and more of them overlap
+light bounds multiplier = 3.5
+max lights = 16
minimum interior brightness = 0.0
force per pixel lighting = true
light bands = 1