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_global_vars 0x51956C
|
||||||
#define FO_VAR_map_number 0x631D88
|
#define FO_VAR_map_number 0x631D88
|
||||||
#define FO_VAR_map_state 0x631D28
|
#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_db_handle 0x58E948
|
||||||
#define FO_VAR_master_volume 0x518E84
|
#define FO_VAR_master_volume 0x518E84
|
||||||
#define FO_VAR_max 0x56FB50
|
#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() {
|
static void __declspec(naked) obj_move_to_tile_hack() {
|
||||||
__asm {
|
__asm {
|
||||||
cmp ds:[FO_VAR_map_state], 0;
|
cmp dword ptr ds:[FO_VAR_map_state], 0; // map number, -1 exit to worldmap
|
||||||
jz map_leave;
|
jz mapLeave;
|
||||||
pop eax;
|
add esp, 4;
|
||||||
push 0x48A74E;
|
jmp obj_move_to_tile_Ret;
|
||||||
map_leave:
|
mapLeave:
|
||||||
mov ebx, 16;
|
mov ebx, 16;
|
||||||
retn;
|
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() {
|
static void __declspec(naked) ai_move_steps_closer_hook() {
|
||||||
__asm {
|
__asm {
|
||||||
call fo::funcoffs::combat_turn_run_;
|
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
|
// 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
|
// some exit hex in destination map
|
||||||
MakeCall(0x48A704, obj_move_to_tile_hack);
|
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
|
// 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
|
// in their AI packages is set to stay_close/charge, or NPCsTryToSpendExtraAP is enabled
|
||||||
|
|||||||
Reference in New Issue
Block a user