mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Removed FadeBackgroundMusic option
Removed unused "type" parameter from Tilemap::make_path_func. Edits to documents and README.md.
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
# sfall
|
||||
[](https://github.com/phobos2077/sfall/actions/workflows/gh-pages.yml)
|
||||
|
||||
A set of engine modifications for the classic game Fallout 2 in form of a DLL, which modifies executable in memory without changing anything in EXE file itself.
|
||||
[](https://www.gnu.org/licenses/gpl-3.0)
|
||||
[](https://github.com/phobos2077/sfall/actions/workflows/build.yml)
|
||||
[](https://github.com/phobos2077/sfall/actions/workflows/gh-pages.yml)
|
||||
|
||||
A set of engine modifications for the classic game Fallout 2 in the form of a DLL, which modifies executable in memory without changing anything in EXE file itself.
|
||||
|
||||
**Engine modifications include:**
|
||||
- Better support for modern operating systems
|
||||
@@ -11,7 +14,10 @@ A set of engine modifications for the classic game Fallout 2 in form of a DLL, w
|
||||
- Extended scripting capabilities for modders (many new opcodes to control sfall features as well as previously unavailable vanilla engine functions)
|
||||
|
||||
|
||||
Original author: timeslip
|
||||
Original author: **Timeslip**
|
||||
|
||||
Original description: A set of engine modifications for the classic game Fallout 2 by Interplay. Includes fixes for bugs in the original engine, allows fallout to run correctly on modern operating systems, and adds additional features for modders.
|
||||
|
||||
---
|
||||
#### Fallout Engine IDA Database
|
||||
**[Download](https://www.dropbox.com/s/tm0nyx0lnk4yui0/Fallout_1_and_2_IDA68.rar "Download from Dropbox")** (comments are in Russian)
|
||||
|
||||
+1
-4
@@ -1,5 +1,5 @@
|
||||
;sfall configuration settings
|
||||
;v4.3.3.1
|
||||
;v4.3.3.2
|
||||
|
||||
[Main]
|
||||
;Set to 1 to enable the built-in High Resolution Patch mode that is similar to the hi-res patch by Mash
|
||||
@@ -134,9 +134,6 @@ WorldMapTerrainInfo=0
|
||||
;Set to 0 to leave the default unchanged (i.e. 4). The maximum is 32
|
||||
NumSoundBuffers=0
|
||||
|
||||
;Set to 1 to enable fade effects for background music when stopping and starting the playback
|
||||
FadeBackgroundMusic=1
|
||||
|
||||
;Set to 1 to allow attaching sound files to combat float messages
|
||||
AllowSoundForFloats=0
|
||||
|
||||
|
||||
@@ -21,5 +21,5 @@ This folder contains documentation about sfall scripting extensions.
|
||||
hookscripts.md - detailed manual for using hook scripts to modify engine behavior
|
||||
arrays.md - manual for sfall arrays
|
||||
|
||||
If you are/will be using sfall Script Editor, don't forget to check out new compiler documentation in **.\compiler\sslc_readme.txt**.
|
||||
There are numerious new syntax features and extensions to SSL (Star-Trek Scripting language).
|
||||
If you are/will be using sfall Script Editor, don't forget to check out new compiler documentation in **.\compiler\sslc_readme.md**.
|
||||
There are numerious new syntax features and extensions to SSL (Star-Trek Scripting Language).
|
||||
|
||||
@@ -21,5 +21,5 @@ This folder contains documentation about sfall scripting extensions.
|
||||
hookscripts.html - detailed manual for using hook scripts to modify engine behavior
|
||||
arrays.html - manual for sfall arrays
|
||||
|
||||
If you are/will be using sfall Script Editor, don't forget to check out new compiler documentation in .\compiler\sslc_readme.txt.
|
||||
There are numerious new syntax features and extensions to SSL (Star-Trek Scripting language).
|
||||
If you are/will be using sfall Script Editor, don't forget to check out new compiler documentation in .\compiler\sslc_readme.html.
|
||||
There are numerious new syntax features and extensions to SSL (Star-Trek Scripting Language).
|
||||
|
||||
@@ -356,7 +356,7 @@
|
||||
int arg2 - skill being used
|
||||
int arg3 - skill bonus from items such as first aid kits
|
||||
|
||||
int ret0 - overrides hard-coded handler (-1 - use engine handler, any other value - override)
|
||||
int ret0 - overrides hard-coded handler (-1 - use engine handler, any other value - override; if it is 0, there will be a 10% chance of removing the used medical item)
|
||||
```
|
||||
|
||||
- name: Steal
|
||||
|
||||
@@ -449,7 +449,7 @@ Obj arg1 - The target object
|
||||
int arg2 - skill being used
|
||||
int arg3 - skill bonus from items such as first aid kits
|
||||
|
||||
int ret0 - overrides hard-coded handler (-1 - use engine handler, any other value - override, with a zero value having a 10% chance of removing the used medical item)
|
||||
int ret0 - overrides hard-coded handler (-1 - use engine handler, any other value - override; if it is 0, there will be a 10% chance of removing the used medical item)
|
||||
```
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
+2
-2
@@ -11,7 +11,7 @@ nav_order: 1
|
||||
* TOC
|
||||
{: toc}
|
||||
|
||||
Sfall is a set of engine modifications for the classic game Fallout 2 in form of a DLL, which modifies executable in memory without changing anything in EXE file itself.
|
||||
sfall is a set of engine modifications for the classic game Fallout 2 in the form of a DLL, which modifies executable in memory without changing anything in EXE file itself.
|
||||
|
||||
Engine modifications include:
|
||||
|
||||
@@ -38,4 +38,4 @@ Next, proceed to discover new functions. They are categorized, use the menu to f
|
||||
|
||||
## Questions and problems
|
||||
* Report bugs and suggest features on [Github](https://github.com/phobos2077/sfall/issues).
|
||||
* Ask questions and discuss on the [forum](http://nma-fallout.com/threads/fo2-engine-tweaks-sfall.178390/).
|
||||
* Ask questions and discuss on the [forum](https://nma-fallout.com/threads/fo2-engine-tweaks-sfall.178390/).
|
||||
|
||||
+3
-19
@@ -221,9 +221,8 @@ static __inline long DistanceFromPositions(long sX, long sY, long tX, long tY) {
|
||||
}
|
||||
|
||||
// Optimized and fixed version of make_path_func_ engine function with added arguments
|
||||
// type: 0 - rotation path, 1 - tile path
|
||||
// maxNodes: limiting the building of a path
|
||||
long __fastcall Tilemap::make_path_func(fo::GameObject* srcObject, long sourceTile, long targetTile, long type, long maxNodes, void* arrayRef, long checkTargetTile, void* blockFunc) {
|
||||
long __fastcall Tilemap::make_path_func(fo::GameObject* srcObject, long sourceTile, long targetTile, long maxNodes, void* arrayRef, long checkTargetTile, void* blockFunc) {
|
||||
if (checkTargetTile && fo::func::obj_blocking_at_wrapper(srcObject, targetTile, srcObject->elevation, blockFunc)) return 0;
|
||||
|
||||
bool inCombat = fo::var::combat_state & fo::CombatStateFlag::InCombat;
|
||||
@@ -346,7 +345,6 @@ long __fastcall Tilemap::make_path_func(fo::GameObject* srcObject, long sourceTi
|
||||
}
|
||||
|
||||
BYTE* arrayR = reinterpret_cast<BYTE*>(arrayRef);
|
||||
WORD* arrayT = reinterpret_cast<WORD*>(arrayRef);
|
||||
size_t pathLen = 0;
|
||||
|
||||
//fo::func::debug_printf("\nmake_path_func: tiles [to %d]", childData.tile);
|
||||
@@ -355,11 +353,7 @@ long __fastcall Tilemap::make_path_func(fo::GameObject* srcObject, long sourceTi
|
||||
do {
|
||||
if (childData.tile == sourceTile) break; // reached the source tile
|
||||
if (arrayRef) {
|
||||
if (type) {
|
||||
*arrayT++ = (WORD)childData.tile;
|
||||
} else {
|
||||
*arrayR++ = childData.rotation;
|
||||
}
|
||||
//fo::func::debug_printf(" <- %d", childData.tile);
|
||||
}
|
||||
// search a linked tile 'from -> tile'
|
||||
@@ -374,14 +368,6 @@ long __fastcall Tilemap::make_path_func(fo::GameObject* srcObject, long sourceTi
|
||||
if (arrayRef && pathLen > 1) {
|
||||
// reverse the array values
|
||||
size_t count = pathLen >> 1;
|
||||
if (type) {
|
||||
WORD* arrayFront = reinterpret_cast<WORD*>(arrayRef);
|
||||
do {
|
||||
WORD last = *--arrayT;
|
||||
*arrayT = *arrayFront; // last < front
|
||||
*arrayFront++ = last;
|
||||
} while (--count);
|
||||
} else {
|
||||
BYTE* arrayFront = reinterpret_cast<BYTE*>(arrayRef);
|
||||
do {
|
||||
BYTE last = *--arrayR;
|
||||
@@ -389,15 +375,13 @@ long __fastcall Tilemap::make_path_func(fo::GameObject* srcObject, long sourceTi
|
||||
*arrayFront++ = last;
|
||||
} while (--count);
|
||||
}
|
||||
}
|
||||
return pathLen;
|
||||
}
|
||||
|
||||
static void __declspec(naked) make_path_func_replacement() {
|
||||
static void __declspec(naked) make_path_func_hack_replacement() {
|
||||
__asm {
|
||||
xchg [esp], ecx; // ret addr <> array
|
||||
push maxPathNodes; // (sfall addition)
|
||||
push 0; // type rotation (sfall addition)
|
||||
push ebx; // target tile
|
||||
push ecx; // ret addr
|
||||
mov ecx, eax;
|
||||
@@ -412,7 +396,7 @@ void Tilemap::SetPathMaxNodes(long maxNodes) {
|
||||
|
||||
if (!replaced) {
|
||||
replaced = true;
|
||||
sf::MakeJump(fo::funcoffs::make_path_func_, make_path_func_replacement); // 0x415EFC
|
||||
sf::MakeJump(fo::funcoffs::make_path_func_, make_path_func_hack_replacement); // 0x415EFC
|
||||
} else {
|
||||
m_pathData.resize(maxNodes);
|
||||
m_dadData.resize(maxNodes);
|
||||
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
|
||||
static long __fastcall tile_num_beyond(long sourceTile, long targetTile, long maxRange);
|
||||
|
||||
static long __fastcall make_path_func(fo::GameObject* srcObject, long sourceTile, long targetTile, long type, long maxNodes, void* arrayRef, long checkTargetTile, void* blockFunc);
|
||||
static long __fastcall make_path_func(fo::GameObject* srcObject, long sourceTile, long targetTile, long maxNodes, void* arrayRef, long checkTargetTile, void* blockFunc);
|
||||
|
||||
static void SetPathMaxNodes(long maxNodes);
|
||||
};
|
||||
|
||||
@@ -975,75 +975,6 @@ static void __declspec(naked) sfxl_init_hook() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) internalSoundFade_hack() {
|
||||
__asm {
|
||||
mov ebp, ds:[FO_VAR_deviceInit];
|
||||
test ebp, ebp;
|
||||
jz skip;
|
||||
cmp dword ptr ds:[FO_VAR_masterVol], 0; // check current master volume
|
||||
je stop;
|
||||
test ebx, ebx;
|
||||
jg skip; // to volume > 0
|
||||
// for fade-out, perform a callback function
|
||||
cmp dword ptr [eax + 0x88], 0;
|
||||
je skip;
|
||||
mov edx, 1;
|
||||
call dword ptr [eax + 0x88]; // perform callback function
|
||||
mov dword ptr [eax + 0x88], 0; // remove callback function
|
||||
mov edx, ebx;
|
||||
skip:
|
||||
retn;
|
||||
stop:
|
||||
add esp, 4;
|
||||
mov eax, 0x4AE9AA; // error result
|
||||
jmp eax;
|
||||
}
|
||||
}
|
||||
|
||||
static bool fadeProcess = false;
|
||||
|
||||
static void __stdcall sf_doTimerEvent(UINT uTimerID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2) {
|
||||
if (!fadeProcess && dwUser) {
|
||||
fadeProcess = true;
|
||||
__asm call dwUser; // fadeSounds_
|
||||
fadeProcess = false;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) internalSoundFade_hack_timer() {
|
||||
__asm {
|
||||
mov dword ptr [esp + 8], TIME_PERIODIC | TIME_KILL_SYNCHRONOUS;
|
||||
lea eax, sf_doTimerEvent;
|
||||
xchg [esp], eax;
|
||||
jmp eax;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fadeSounds_hook() {
|
||||
__asm {
|
||||
//mov dword ptr [eax + 0x88], 0; // remove sound callback function
|
||||
or word ptr [eax + 0x40], 0x10; // set 'AfterFade' state flag
|
||||
jmp fo::funcoffs::soundVolume_; // set mute
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) soundContinue_hack() {
|
||||
__asm {
|
||||
mov dx, [ebx + 0x40];
|
||||
test dx, 0x10; // check 'AfterFade' state flag (fix flag set in fadeSounds_hook)
|
||||
jz skip;
|
||||
cmp fadeProcess, 1;
|
||||
je skip;
|
||||
call fo::funcoffs::soundDelete_;
|
||||
xor edx, edx;
|
||||
mov dword ptr [esp], 0x4AD99E;
|
||||
retn;
|
||||
skip:
|
||||
test dl, 0x8; // InPaused flag
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
constexpr int SampleRate = 44100; // 44.1kHz
|
||||
|
||||
void Sound::init() {
|
||||
@@ -1127,22 +1058,6 @@ void Sound::init() {
|
||||
if (IniReader::GetConfigInt("Sound", "AutoSearchSFX", 1)) {
|
||||
HookCalls(sfxl_init_hook, {0x4A9999, 0x4A9B34});
|
||||
}
|
||||
|
||||
if (IniReader::GetConfigInt("Sound", "FadeBackgroundMusic", 1)) {
|
||||
SafeMemSet(0x45020C, CodeType::Nop, 6); // gsound_reset_
|
||||
SafeWrite32(0x45212C, 250); // delay start
|
||||
SafeWrite32(0x450ADE, 500); // delay stop
|
||||
// fixes
|
||||
MakeCall(0x4AE991, internalSoundFade_hack, 1);
|
||||
MakeCall(0x4AEAC6, internalSoundFade_hack_timer);
|
||||
HookCall(0x4AE929, fadeSounds_hook);
|
||||
BlockCall(0x4AE910); // fadeSounds_ (block soundStop_)
|
||||
MakeCall(0x4AD991, soundContinue_hack, 1);
|
||||
|
||||
LoadGameHook::OnAfterGameInit() += []() {
|
||||
fo::var::setInt(FO_VAR_gsound_background_fade) = 1;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
void Sound::exit() {
|
||||
|
||||
Reference in New Issue
Block a user