Changed LoadGame2_After to be called before LoadGame state is ended (backported from 4.0 development branch, commit c2e6d743a3)

Updated version number.
Minor edits to scripting documents.
This commit is contained in:
NovaRain
2017-05-23 21:05:04 +08:00
parent 31834fdfea
commit ec2d323f75
8 changed files with 29 additions and 21 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
;sfall configuration settings ;sfall configuration settings
;v3.8.4 ;v3.8.5
[Main] [Main]
;Change to 1 if you want to use command line args to tell sfall to use another ini file. ;Change to 1 if you want to use command line args to tell sfall to use another ini file.
@@ -83,6 +83,7 @@
#define PROTO_IT_SIZE (112) #define PROTO_IT_SIZE (112)
#define PROTO_IT_WEIGHT (116) #define PROTO_IT_WEIGHT (116)
#define PROTO_IT_COST (120) #define PROTO_IT_COST (120)
#define PROTO_IT_INV_FID (124)
// weapons // weapons
#define PROTO_WP_ANIM (36) #define PROTO_WP_ANIM (36)
+5 -5
View File
@@ -189,10 +189,10 @@
#define party_member_list_all party_member_list(1) #define party_member_list_all party_member_list(1)
#define spatial_radius(obj) sfall_func1("spatial_radius", obj)
#define critter_inven_obj2(obj, type) sfall_func2("critter_inven_obj2", obj, type) #define critter_inven_obj2(obj, type) sfall_func2("critter_inven_obj2", obj, type)
#define intface_redraw sfall_func0("intface_redraw")
#define intface_hide sfall_func0("intface_hide")
#define intface_show sfall_func0("intface_show")
#define intface_is_hidden sfall_func0("intface_is_hidden")
#define exec_map_update_scripts sfall_func0("exec_map_update_scripts") #define exec_map_update_scripts sfall_func0("exec_map_update_scripts")
#define intface_hide sfall_func0("intface_hide")
#define intface_is_hidden sfall_func0("intface_is_hidden")
#define intface_redraw sfall_func0("intface_redraw")
#define intface_show sfall_func0("intface_show")
#define spatial_radius(obj) sfall_func1("spatial_radius", obj)
+6 -6
View File
@@ -13,15 +13,15 @@ Example setup for a hook-script based mod:
procedure tohit_hook_handler begin procedure tohit_hook_handler begin
display_msg("Modifying hit_hook " + get_sfall_arg); display_msg("Modifying hit_hook " + get_sfall_arg);
set_hit_chance_max(100); set_hit_chance_max(100);
set_sfall_return(100); set_sfall_return(100);
end end
procedure start begin procedure start begin
if game_loaded then begin if game_loaded then begin
register_hook_proc(HOOK_TOHIT, tohit_hook_handler); register_hook_proc(HOOK_TOHIT, tohit_hook_handler);
end end
end end
+1
View File
@@ -318,6 +318,7 @@ const DWORD elapsed_time_ = 0x4C93E0;
const DWORD elevator_end_ = 0x43F6D0; const DWORD elevator_end_ = 0x43F6D0;
const DWORD elevator_start_ = 0x43F324; const DWORD elevator_start_ = 0x43F324;
const DWORD endgame_slideshow_ = 0x43F788; const DWORD endgame_slideshow_ = 0x43F788;
const DWORD EndLoad_ = 0x47F4C8;
const DWORD exec_script_proc_ = 0x4A4810; const DWORD exec_script_proc_ = 0x4A4810;
const DWORD executeProcedure_ = 0x46DD2C; const DWORD executeProcedure_ = 0x46DD2C;
const DWORD findCurrentProc_ = 0x467160; const DWORD findCurrentProc_ = 0x467160;
+1
View File
@@ -492,6 +492,7 @@ extern const DWORD elapsed_time_;
extern const DWORD elevator_end_; extern const DWORD elevator_end_;
extern const DWORD elevator_start_; extern const DWORD elevator_start_;
extern const DWORD endgame_slideshow_; extern const DWORD endgame_slideshow_;
extern const DWORD EndLoad_;
extern const DWORD exec_script_proc_; // unsigned int aScriptID<eax>, int aProcId<edx> extern const DWORD exec_script_proc_; // unsigned int aScriptID<eax>, int aProcId<edx>
extern const DWORD executeProcedure_; // <eax> - programPtr, <edx> - procNumber extern const DWORD executeProcedure_; // <eax> - programPtr, <edx> - procNumber
extern const DWORD fadeSystemPalette_; extern const DWORD fadeSystemPalette_;
+11 -6
View File
@@ -220,12 +220,6 @@ static void __declspec(naked) LoadGame() {
or InLoop, LOADGAME; or InLoop, LOADGAME;
call LoadGame_; call LoadGame_;
and InLoop, (-1^LOADGAME); and InLoop, (-1^LOADGAME);
cmp eax, 1;
jne end;
call LoadGame2_After;
mov eax, 1;
end:
pop edx; pop edx;
pop ecx; pop ecx;
pop ebx; pop ebx;
@@ -233,6 +227,16 @@ end:
} }
} }
static void __declspec(naked) EndLoadHook() {
__asm {
call EndLoad_;
pushad;
call LoadGame2_After;
popad;
retn;
}
}
static void NewGame2() { static void NewGame2() {
ResetState(0); ResetState(0);
@@ -460,6 +464,7 @@ void LoadGameHookInit() {
HookCall(0x443B89, LoadGame); HookCall(0x443B89, LoadGame);
HookCall(0x480B77, LoadGame); HookCall(0x480B77, LoadGame);
HookCall(0x48FD35, LoadGame); HookCall(0x48FD35, LoadGame);
SafeWrite32(0x5194C0, (DWORD)&EndLoadHook);
HookCall(0x443AAC, SaveGame); HookCall(0x443AAC, SaveGame);
HookCall(0x443B1C, SaveGame); HookCall(0x443B1C, SaveGame);
HookCall(0x48FCFF, SaveGame); HookCall(0x48FCFF, SaveGame);
+3 -3
View File
@@ -22,12 +22,12 @@
#define VERSION_MAJOR 3 #define VERSION_MAJOR 3
#define VERSION_MINOR 8 #define VERSION_MINOR 8
#define VERSION_BUILD 4 #define VERSION_BUILD 5
#define VERSION_REV 0 #define VERSION_REV 0
#ifdef WIN2K #ifdef WIN2K
#define VERSION_STRING "3.8.4 win2k" #define VERSION_STRING "3.8.5 win2k"
#else #else
#define VERSION_STRING "3.8.4" #define VERSION_STRING "3.8.5"
#endif #endif
#define CHECK_VAL (4) #define CHECK_VAL (4)