mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Fixed player's position when entering a map.
This also fixed the issue with getting player's position in the map_enter_p_proc procedure.
This commit is contained in:
@@ -114,6 +114,8 @@
|
||||
#define FO_VAR_map_global_vars 0x51956C
|
||||
#define FO_VAR_map_number 0x631D88
|
||||
#define FO_VAR_map_state 0x631D28
|
||||
#define FO_VAR_mapEntranceElevation 0x519558
|
||||
#define FO_VAR_mapEntranceTileNum 0x51955C
|
||||
#define FO_VAR_master_db_handle 0x58E948
|
||||
#define FO_VAR_master_volume 0x518E84
|
||||
#define FO_VAR_max 0x56FB50
|
||||
|
||||
@@ -1393,18 +1393,33 @@ static void __declspec(naked) ResetPlayer_hook() {
|
||||
}
|
||||
}
|
||||
|
||||
static const DWORD obj_move_to_tile_Ret = 0x48A74E;
|
||||
static void __declspec(naked) obj_move_to_tile_hack() {
|
||||
__asm {
|
||||
cmp ds:[FO_VAR_map_state], 0;
|
||||
jz map_leave;
|
||||
pop eax;
|
||||
push 0x48A74E;
|
||||
map_leave:
|
||||
cmp dword ptr ds:[FO_VAR_map_state], 0; // map number, -1 exit to worldmap
|
||||
jz mapLeave;
|
||||
add esp, 4;
|
||||
jmp obj_move_to_tile_Ret;
|
||||
mapLeave:
|
||||
mov ebx, 16;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) map_load_file_hack() {
|
||||
__asm {
|
||||
cmp dword ptr ds:[FO_VAR_map_state], 0; // map number, -1 exit to worldmap
|
||||
jle skip;
|
||||
mov eax, ds:[FO_VAR_elevation];
|
||||
mov ds:[FO_VAR_mapEntranceElevation], eax;
|
||||
mov edx, ds:[FO_VAR_rotation];
|
||||
mov eax, ds:[FO_VAR_tile];
|
||||
skip:
|
||||
mov ds:[FO_VAR_mapEntranceTileNum], eax;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_move_steps_closer_hook() {
|
||||
__asm {
|
||||
call fo::funcoffs::combat_turn_run_;
|
||||
@@ -2320,6 +2335,8 @@ void BugFixes::init()
|
||||
// Fix for being at incorrect hex after map change when the exit hex in source map is at the same position as
|
||||
// some exit hex in destination map
|
||||
MakeCall(0x48A704, obj_move_to_tile_hack);
|
||||
// Fix for player's position when entering a map
|
||||
MakeCall(0x482C95, map_load_file_hack);
|
||||
|
||||
// Fix for critters killed in combat by scripting still being able to move in their combat turn if the distance parameter
|
||||
// in their AI packages is set to stay_close/charge, or NPCsTryToSpendExtraAP is enabled
|
||||
|
||||
Reference in New Issue
Block a user