Merge branch 'feature/restore-sneak-between-maps'

Minor edit to documents.
This commit is contained in:
NovaRain
2024-07-31 08:21:41 +08:00
3 changed files with 21 additions and 2 deletions
+1 -1
View File
@@ -702,7 +702,7 @@
opcode: 0x8236
- name: party_member_list
detail: array party_member_list(int includeHidden)
doc: Returns an array of all current party members (0 - only critter-type, alive and visible will be returned, 1 - all object, including Trunk, etc.)
doc: Returns an array of all current party members (0 - only critters that are alive and visible will be returned, 1 - all objects, including the car trunk, etc.)
opcode: 0x8271
- name: Explosions
+1 -1
View File
@@ -450,7 +450,7 @@ FUNCTION REFERENCE
-----
##### `array party_member_list(int includeHidden)`
- Returns an array of all current party members (0 - only critter-type, alive and visible will be returned, 1 - all object, including Trunk, etc.)
- Returns an array of all current party members (0 - only critters that are alive and visible will be returned, 1 - all objects, including the car trunk, etc.)
-----
##### `array path_find_to(object objFrom, int tileTo, int blockingType)`
+19
View File
@@ -867,12 +867,17 @@ void SetGlobals(GlobalVar* globals) {
}
}
static DWORD pcFlagSneak;
static __declspec(naked) void map_save_in_game_hook() {
__asm {
test cl, 1;
jz skip;
mov ScriptExtender::OnMapLeave, 1;
call fo::funcoffs::scr_exec_map_exit_scripts_;
xor eax, eax;
call fo::funcoffs::is_pc_flag_;
mov pcFlagSneak, eax; // save sneak state
mov ScriptExtender::OnMapLeave, 0;
retn;
skip:
@@ -880,6 +885,18 @@ skip:
}
}
static __declspec(naked) void map_load_file_hook() {
__asm {
cmp pcFlagSneak, 0;
jz skip;
xor eax, eax;
mov pcFlagSneak, eax;
call fo::funcoffs::pc_flag_on_;
skip:
jmp fo::funcoffs::scr_exec_map_enter_scripts_;
}
}
static void ClearEventsOnMapExit() {
using namespace fo;
__asm {
@@ -985,6 +1002,8 @@ void ScriptExtender::init() {
HookCall(0x483CC3, (void*)fo::funcoffs::partyMemberSaveProtos_);
HookCall(0x483CC8, (void*)fo::funcoffs::partyMemberPrepLoad_);
HookCall(0x483CCD, (void*)fo::funcoffs::partyMemberPrepItemSaveAll_);
// Tweak for restoring the sneak state when switching between maps
HookCall(0x4830B6, map_load_file_hook);
// Set the DAM_BACKWASH flag for the attacker before calling compute_damage_
SafeWrite32(0x423DE7, 0x40164E80); // or [esi+ctd.flags3Source], DAM_BACKWASH_