diff --git a/patches/ips/fix_kraid_door.ips b/patches/ips/fix_kraid_door.ips new file mode 100644 index 000000000..c4a29d327 Binary files /dev/null and b/patches/ips/fix_kraid_door.ips differ diff --git a/patches/rom_map/Bank A7.txt b/patches/rom_map/Bank A7.txt index 0fb852e6f..b0dcfbb35 100644 --- a/patches/rom_map/Bank A7.txt +++ b/patches/rom_map/Bank A7.txt @@ -1,4 +1,5 @@ 0000 - FF82: used by vanilla game FF82 - FFC0: escape.asm (for dachora) -FFC0 - FFDF: map_area (for kraid) +FFC0 - FFD0: fix_kraid_door.asm +FFD0 - FFE0: [FREE] FFE0 - FFFF: flashing_placebo (for phantoon) diff --git a/patches/rom_map/vanilla_hooks.txt b/patches/rom_map/vanilla_hooks.txt index 33ab55fbe..ab422032b 100644 --- a/patches/rom_map/vanilla_hooks.txt +++ b/patches/rom_map/vanilla_hooks.txt @@ -1096,6 +1096,7 @@ $a6b2ba - gray_doors.asm $a6b297 - gray_doors.asm [BANK A7] +$a7b0fb - fix_kraid_door.asm $a7c81e - escape.asm $a7f892 - escape.asm $a7dd7f - flashing_placebo.asm diff --git a/patches/src/fix_kraid_door.asm b/patches/src/fix_kraid_door.asm new file mode 100644 index 000000000..45dc6c509 --- /dev/null +++ b/patches/src/fix_kraid_door.asm @@ -0,0 +1,27 @@ +; Fix bug when entering Kraid from right door and leaving just as he +; finishes ascending. The boss AI checks that Samus is left of Kraid, +; and will adjust her X coordinate if needed. This can lead to a bugged +; Samus position or OOB error if it occurs during the door transition. +; +; Reported by P.JBoy, fix by Stag Shot + +lorom + +!bank_a7_free_space_start = $a7ffc0 +!bank_a7_free_space_end = $a7ffd0 + +org $a7b0fb + jmp fix_kraid_door + +org !bank_a7_free_space_start +fix_kraid_door: + lda $795 ; door transition flag + beq .resume + rts ; skip rest of func + +.resume + lda $af6 ; replaced code + clc ; + jmp $b0ff ; resume func + +assert pc() < !bank_a7_free_space_end diff --git a/rust/maprando/src/patch.rs b/rust/maprando/src/patch.rs index e67dc7430..04ccc13e9 100644 --- a/rust/maprando/src/patch.rs +++ b/rust/maprando/src/patch.rs @@ -492,6 +492,7 @@ impl Patcher<'_> { "fast_big_boy_cutscene", "fix_kraid_vomit", "fix_kraid_hud", + "fix_kraid_door", "escape_autosave", "boss_exit", "load_plms_early",