From b317ed71ce43e62114745b83a4f787aaf6d04a4c Mon Sep 17 00:00:00 2001 From: NovaRain Date: Mon, 5 Jun 2023 11:37:58 +0800 Subject: [PATCH] Added options to override the names of sound files for game modes Remove the worldmap/credits music override from Fallout1Behavior. (was added in commit 00b85be) Minor edits to ddraw.ini. --- artifacts/ddraw.ini | 20 +++++++++++----- sfall/Modules/MiscPatches.cpp | 2 -- sfall/Modules/Scripting/Handlers/Combat.cpp | 3 +-- sfall/Modules/Sound.cpp | 26 +++++++++++++++++++++ 4 files changed, 41 insertions(+), 10 deletions(-) diff --git a/artifacts/ddraw.ini b/artifacts/ddraw.ini index a67eec46..34f3b961 100644 --- a/artifacts/ddraw.ini +++ b/artifacts/ddraw.ini @@ -85,7 +85,7 @@ TextureFilter=1 GPUBlt=0 ;Set to 1 to allow using 32-bit textures for talking heads -;The texture files should be placed in art\heads\\ (w/o extension) +;The texture files should be placed in art\heads\\ (without extension) ;The files in the folder should be numbered according to the number of frames in the talking head FRM file (0.png, 1.png, etc.) ;See the text file in the modders pack for a detailed description ;Requires DX9 graphics mode and v2.0 pixel shader support (see GPUBlt option) @@ -150,6 +150,15 @@ OverrideMusicDir=1 ;This will slightly increase the startup time of the game on older computers AutoSearchSFX=1 +;Uncomment these lines to override the names of sound files for game modes +;Filenames are limited to 8 characters (without extension) +;MainMenuMusic=07desert +;WorldMapMusic=23world +;WorldMapCarMusic=20car +;EndGameMovieMusic0=akiss +;EndGameMovieMusic1=10labone +;MapLoadingSound=wind2 + ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX [Input] ;Set to 1 to enable the mouse scroll wheel to scroll through the inventory, barter, and loot screens @@ -230,7 +239,6 @@ DebugEditorKey=0 ;- disables playing the final movie/credits after the endgame slideshow ;- disables halving the weight for power armor items ;- endgame_movie script function plays movie 10 or 11 based on the player's gender before the credits -;- changes the world map music to '03wrldmp.acm' and the credits music to 'maybe.acm' Fallout1Behavior=0 ;Time limit in years. Must be between -3 and 13 @@ -294,15 +302,15 @@ FemaleDialogMsgs=0 DialogGenderWords=0 ;To change the default and starting player models, uncomment the next four lines. -;The default models can also be changed ingame via script +;The default models can also be changed in-game via script ;MaleStartModel=hmwarr ;MaleDefaultModel=hmjmps ;FemaleStartModel=hfprim ;FemaleDefaultModel=hfjmps -;To change the various ingame movies, modify the next 17 lines +;To change the various in-game movies, modify the next 17 lines ;You can also define additional movies by adding Movie18 - Movie32 lines -;Most of these can also be changed ingame via script +;Most of these can also be changed in-game via script Movie1=iplogo.mve Movie2=intro.mve Movie3=elder.mve @@ -742,7 +750,7 @@ AIBestWeaponFix=1 ;Set to 1 to fix NPCs not taking chem_primary_desire in AI.txt as a preference list when using drugs in their inventory ;Set to 2 to allow NPCs to use only the drugs listed in chem_primary_desire and healing drugs (stimpaks and healing powder) -;Note: chem_primary_desire w/o fixes prevents the specified item PID from being consumed if all three values in the list are the same PID +;Note: chem_primary_desire without fixes prevents the specified item from being consumed if all three values in the list are the same PID ;chem_primary_desire also works as a priority list of drug items the NPC will try to pick up in combat when they are on the ground AIDrugUsePerfFix=0 diff --git a/sfall/Modules/MiscPatches.cpp b/sfall/Modules/MiscPatches.cpp index 4b4e6473..248cd1ec 100644 --- a/sfall/Modules/MiscPatches.cpp +++ b/sfall/Modules/MiscPatches.cpp @@ -761,8 +761,6 @@ static void F1EngineBehaviorPatch() { BlockCall(0x4A4343); // disable playing the final movie/credits after the endgame slideshow SafeWrite8(0x477C71, CodeType::JumpShort); // disable halving the weight for power armor items HookCall(0x43F872, endgame_movie_hook); // play movie 10 or 11 based on the player's gender before the credits - SafeWrite32(0x4C2361, (DWORD)&"03wrldmp"); // change the world map music to 03wrldmp.acm - SafeWriteStr(0x501A40, "maybe"); // change the credits music to maybe.acm } } diff --git a/sfall/Modules/Scripting/Handlers/Combat.cpp b/sfall/Modules/Scripting/Handlers/Combat.cpp index 53e6c118..b894f942 100644 --- a/sfall/Modules/Scripting/Handlers/Combat.cpp +++ b/sfall/Modules/Scripting/Handlers/Combat.cpp @@ -267,8 +267,7 @@ void mf_set_spray_settings(OpcodeContext& ctx) { void mf_set_combat_free_move(OpcodeContext& ctx) { long value = ctx.arg(0).rawValue(); - if (value < 0) - value = 0; + if (value < 0) value = 0; fo::var::combat_free_move = value; if (fo::var::main_ctd.attacker == fo::var::obj_dude) { diff --git a/sfall/Modules/Sound.cpp b/sfall/Modules/Sound.cpp index 135b1d9a..c2bf838c 100644 --- a/sfall/Modules/Sound.cpp +++ b/sfall/Modules/Sound.cpp @@ -977,6 +977,13 @@ static void __declspec(naked) sfxl_init_hook() { constexpr int SampleRate = 44100; // 44.1kHz +static char mainMenuMusic[12] = {}; +static char worldMapMusic[12] = {}; +static char worldMapCarMusic[12] = {}; +static char endGameMovieMusic0[12] = {}; +static char endGameMovieMusic1[12] = {}; +static char mapLoadingSound[12] = {}; + void Sound::init() { // Set the 44.1kHz sample rate for the primary sound buffer SafeWrite32(0x44FDBC, SampleRate); @@ -1054,6 +1061,25 @@ void Sound::init() { if (IniReader::GetConfigInt("Sound", "AutoSearchSFX", 1)) { HookCalls(sfxl_init_hook, {0x4A9999, 0x4A9B34}); } + + if (IniReader::GetConfigString("Sound", "MainMenuMusic", "", mainMenuMusic, 9)) { + SafeWrite32(0x480A04, (DWORD)&mainMenuMusic); + } + if (IniReader::GetConfigString("Sound", "WorldMapMusic", "", worldMapMusic, 9)) { + SafeWrite32(0x4C2361, (DWORD)&worldMapMusic); + } + if (IniReader::GetConfigString("Sound", "WorldMapCarMusic", "", worldMapCarMusic, 9)) { + SafeWrite32(0x4C236D, (DWORD)&worldMapCarMusic); + } + if (IniReader::GetConfigString("Sound", "EndGameMovieMusic0", "", endGameMovieMusic0, 9)) { + SafeWrite32(0x43F853, (DWORD)&endGameMovieMusic0); + } + if (IniReader::GetConfigString("Sound", "EndGameMovieMusic1", "", endGameMovieMusic1, 9)) { + SafeWrite32(0x440750, (DWORD)&endGameMovieMusic1); + } + if (IniReader::GetConfigString("Sound", "MapLoadingSound", "", mapLoadingSound, 9)) { + SafeWrite32(0x482B9C, (DWORD)&mapLoadingSound); + } } void Sound::exit() {