From c6fdbc83b74a57bac91372f028f2dd9b8b74ffd6 Mon Sep 17 00:00:00 2001 From: BobTheBob Date: Tue, 7 Mar 2023 14:56:12 +0000 Subject: reload turret settings --- NorthstarDLL/NorthstarDLL.vcxproj | 1 + NorthstarDLL/NorthstarDLL.vcxproj.filters | 3 +++ NorthstarDLL/client/audio.cpp | 2 ++ NorthstarDLL/mods/modmanager.cpp | 3 +++ NorthstarDLL/mods/modmanager.h | 1 + NorthstarDLL/reloadturrets.cpp | 11 +++++++++++ 6 files changed, 21 insertions(+) create mode 100644 NorthstarDLL/reloadturrets.cpp diff --git a/NorthstarDLL/NorthstarDLL.vcxproj b/NorthstarDLL/NorthstarDLL.vcxproj index 3ed99d25..e26f5762 100644 --- a/NorthstarDLL/NorthstarDLL.vcxproj +++ b/NorthstarDLL/NorthstarDLL.vcxproj @@ -509,6 +509,7 @@ Create + diff --git a/NorthstarDLL/NorthstarDLL.vcxproj.filters b/NorthstarDLL/NorthstarDLL.vcxproj.filters index 10f6d796..44687ba6 100644 --- a/NorthstarDLL/NorthstarDLL.vcxproj.filters +++ b/NorthstarDLL/NorthstarDLL.vcxproj.filters @@ -1441,6 +1441,9 @@ Source Files\mods\reload + + Source Files\mods\reload + diff --git a/NorthstarDLL/client/audio.cpp b/NorthstarDLL/client/audio.cpp index ea1f6416..39327900 100644 --- a/NorthstarDLL/client/audio.cpp +++ b/NorthstarDLL/client/audio.cpp @@ -264,6 +264,8 @@ EventOverrideData::EventOverrideData(const std::string& data, const fs::path& pa bool CustomAudioManager::TryLoadAudioOverride(const fs::path& defPath) { + return true; + if (IsDedicatedServer()) return true; // silently fail diff --git a/NorthstarDLL/mods/modmanager.cpp b/NorthstarDLL/mods/modmanager.cpp index 6d36a975..0af73e04 100644 --- a/NorthstarDLL/mods/modmanager.cpp +++ b/NorthstarDLL/mods/modmanager.cpp @@ -1040,6 +1040,8 @@ void ModManager::ReloadNecessaryModAssets(bool bDeferred, const ModAssetsToReloa DeferredReloadWeaponSprings(); DeferredReloadWeapons(pAssetsToReload->setsWeaponSettings); + + // player/ai/turret settings and aibehaviors automatically reload themselves on level change already, don't need to reload here } else { @@ -1057,6 +1059,7 @@ void ModManager::ReloadNecessaryModAssets(bool bDeferred, const ModAssetsToReloa TryImmediateReloadWeapons(pAssetsToReload->setsWeaponSettings); + // TODO player/ai/turret settings and aibehavior // need to reimplement mat_reloadmaterials for this // if (m_AssetTypesToReload.bMaterials) diff --git a/NorthstarDLL/mods/modmanager.h b/NorthstarDLL/mods/modmanager.h index 9eccffc5..3002a099 100644 --- a/NorthstarDLL/mods/modmanager.h +++ b/NorthstarDLL/mods/modmanager.h @@ -153,6 +153,7 @@ class ModManager bool bMaterials = false; // vmts bool bPlayerSettings = false; bool bAiSettings = false; + bool bTurretSettings = false; bool bDamageDefs = false; // damagedefs bool bWeaponSprings = false; bool bAmmoSuckBehaviours = false; diff --git a/NorthstarDLL/reloadturrets.cpp b/NorthstarDLL/reloadturrets.cpp new file mode 100644 index 00000000..611f8ae3 --- /dev/null +++ b/NorthstarDLL/reloadturrets.cpp @@ -0,0 +1,11 @@ +ON_DLL_LOAD_CLIENT("client.dll", ClientModReloadTurretSettings, (CModule module)) +{ + // always reload turret settings on level load (ai and player settings do this already) + module.Offset(0x584B85).Patch("EB"); // jle => jmp +} + +ON_DLL_LOAD_CLIENT("server.dll", ServerModReloadTurretSettings, (CModule module)) +{ + // always reload turret settings on level load (ai and player settings do this already) + module.Offset(0x667115).Patch("EB"); // jle => jmp +} -- cgit v1.2.3