From c27d1468ec61c35672059fff97ce2954a87eacaa Mon Sep 17 00:00:00 2001 From: NovaRain Date: Sun, 31 Jan 2021 00:48:04 +0800 Subject: [PATCH] Minor edits to code and document --- artifacts/scripting/compiler/sslc_readme.txt | 3 +-- sfall/Modules/BugFixes.cpp | 2 +- sfall/Modules/Combat.cpp | 2 +- sfall/Modules/LoadGameHook.cpp | 10 +++++----- sfall/Modules/Scripting/Handlers/Misc.cpp | 2 +- sfall/Modules/SubModules/CombatBlock.cpp | 4 ++-- sfall/Modules/SubModules/CombatBlock.h | 7 +++++-- sfall/Modules/SubModules/WindowRender.cpp | 3 +-- 8 files changed, 17 insertions(+), 16 deletions(-) diff --git a/artifacts/scripting/compiler/sslc_readme.txt b/artifacts/scripting/compiler/sslc_readme.txt index db9cf304..360921a7 100644 --- a/artifacts/scripting/compiler/sslc_readme.txt +++ b/artifacts/scripting/compiler/sslc_readme.txt @@ -197,7 +197,7 @@ old: end -> empty statements in blocks are allowed: This is just a convenience to save scripters a bit of memory. Some of the macros in the fallout headers include their own semicolons while others do not. With the original compiler you had to remember which was which, and if you got it wrong the script would not compile. Now it's always safe to include your own semicolon, even if the macro already had its own. For example, this would not compile with the original sslc, but will with the sfall edition: +> **Does not work currently** empty statements in blocks are allowed: This is just a convenience to save scripters a bit of memory. Some of the macros in the fallout headers include their own semicolons while others do not. With the original compiler you had to remember which was which, and if you got it wrong the script would not compile. Now it's always safe to include your own semicolon, even if the macro already had its own. For example, this would not compile with the original sslc, but will with the sfall edition: #define my_macro diplay_msg("foo"); @@ -221,7 +221,6 @@ new: callbackVar(); - > *arrays: In vanilla fallout arrays had to be constructed by reserving a block of global/map variables. Since sfall 2.7, specific array targeted functions have been available, but they are fairly messy and long winded to use. The compiler provides additional syntactic shorthand for accessing and setting array variables, as well as for array creation. When declaring an array variable, put a constant integer in []'s to give the number of elements in the array. (before sfall 3.4 you had to specify size in bytes for array elements, now it's not required, see "arrays.txt" for more information) new: diff --git a/sfall/Modules/BugFixes.cpp b/sfall/Modules/BugFixes.cpp index 03ea30f5..7097a746 100644 --- a/sfall/Modules/BugFixes.cpp +++ b/sfall/Modules/BugFixes.cpp @@ -3633,7 +3633,7 @@ void BugFixes::init() MakeCall(0x49CBF7, check_door_state_hack_close, 2); MakeCall(0x49CB30, check_door_state_hack_open, 1); - // Fix the "Leave" event procedure of the window region not being triggered when the cursor moves to a non-scripted window + // Fix for the "Leave" event procedure of the window region not being triggered when the cursor moves to a non-scripted window MakeJump(0x4B6C3B, checkAllRegions_hack); HookCall(0x4B6C13, checkAllRegions_hook); } diff --git a/sfall/Modules/Combat.cpp b/sfall/Modules/Combat.cpp index 8a941ae9..f139fd5d 100644 --- a/sfall/Modules/Combat.cpp +++ b/sfall/Modules/Combat.cpp @@ -494,7 +494,7 @@ static void Combat_OnGameLoad() { } void Combat::init() { - CombatBlockedInit(); + CombatBlock::init(); CombatProcFix(); MakeCall(0x424B76, compute_damage_hack, 2); // KnockbackMod diff --git a/sfall/Modules/LoadGameHook.cpp b/sfall/Modules/LoadGameHook.cpp index 0a629067..02104dec 100644 --- a/sfall/Modules/LoadGameHook.cpp +++ b/sfall/Modules/LoadGameHook.cpp @@ -383,7 +383,7 @@ static void __declspec(naked) game_reset_hook() { push 0; call GameReset; // reset all sfall modules before resetting the game data popadc; - jmp fo::funcoffs::game_reset_; + jmp fo::funcoffs::game_reset_; } } @@ -395,7 +395,7 @@ static void __declspec(naked) game_reset_on_load_hook() { test al, al; popadc; jnz errorLoad; - jmp fo::funcoffs::game_reset_; + jmp fo::funcoffs::game_reset_; errorLoad: mov eax, -1; add esp, 4; @@ -410,7 +410,7 @@ static void __declspec(naked) before_game_exit_hook() { push 1; call GameModeChange; popadc; - jmp fo::funcoffs::map_exit_; + jmp fo::funcoffs::map_exit_; } } @@ -419,7 +419,7 @@ static void __declspec(naked) after_game_exit_hook() { pushadc; call GameExit; popadc; - jmp fo::funcoffs::main_menu_create_; + jmp fo::funcoffs::main_menu_create_; } } @@ -428,7 +428,7 @@ static void __declspec(naked) game_close_hook() { pushadc; call GameClose; popadc; - jmp fo::funcoffs::game_exit_; + jmp fo::funcoffs::game_exit_; } } diff --git a/sfall/Modules/Scripting/Handlers/Misc.cpp b/sfall/Modules/Scripting/Handlers/Misc.cpp index 5e2a59fc..cef97153 100644 --- a/sfall/Modules/Scripting/Handlers/Misc.cpp +++ b/sfall/Modules/Scripting/Handlers/Misc.cpp @@ -738,7 +738,7 @@ void __declspec(naked) op_block_combat() { mov esi, ecx; _GET_ARG_INT(end); push eax; - call SetBlockCombat; + call CombatBlock::SetBlockCombat; end: mov ecx, esi; retn; diff --git a/sfall/Modules/SubModules/CombatBlock.cpp b/sfall/Modules/SubModules/CombatBlock.cpp index 791aa83f..f53a2f5c 100644 --- a/sfall/Modules/SubModules/CombatBlock.cpp +++ b/sfall/Modules/SubModules/CombatBlock.cpp @@ -60,11 +60,11 @@ end: } } -void __stdcall SetBlockCombat(long toggle) { +void __stdcall CombatBlock::SetBlockCombat(long toggle) { combatDisabled = toggle != 0; } -void CombatBlockedInit() { +void CombatBlock::init() { HookCall(0x45F626, intface_use_item_hook); // jnz hook HookCall(0x4432A6, game_handle_input_hook); diff --git a/sfall/Modules/SubModules/CombatBlock.h b/sfall/Modules/SubModules/CombatBlock.h index 133b84fa..ef10e50b 100644 --- a/sfall/Modules/SubModules/CombatBlock.h +++ b/sfall/Modules/SubModules/CombatBlock.h @@ -21,8 +21,11 @@ namespace sfall { -void CombatBlockedInit(); +class CombatBlock { +public: + static void init(); -void __stdcall SetBlockCombat(long toggle); + static void __stdcall SetBlockCombat(long toggle); +}; } diff --git a/sfall/Modules/SubModules/WindowRender.cpp b/sfall/Modules/SubModules/WindowRender.cpp index 478fc657..a9ba8817 100644 --- a/sfall/Modules/SubModules/WindowRender.cpp +++ b/sfall/Modules/SubModules/WindowRender.cpp @@ -26,8 +26,7 @@ namespace sfall { -class OverlaySurface -{ +class OverlaySurface { private: long size = 0; long surfWidth;