diff --git a/worlds/lufia2ac/basepatch/basepatch.asm b/worlds/lufia2ac/basepatch/basepatch.asm index 923ee6a2..f298a112 100644 --- a/worlds/lufia2ac/basepatch/basepatch.asm +++ b/worlds/lufia2ac/basepatch/basepatch.asm @@ -1127,6 +1127,53 @@ pullpc +; door stairs fix +pushpc +org $839453 + ; DB=$7F, x=0, m=1 + JSL DoorStairsFix ; overwrites JSR $9B18 : JSR $9D11 + NOP #2 +pullpc + +DoorStairsFix: + CLC + LDY.w #$0000 +--: LDX.w #$00FF ; loop through floor layout starting from the bottom right +-: LDA $EA00,X ; read node contents + BEQ + ; always skip empty nodes + BCC ++ ; 1st pass: skip all blocked nodes (would cause door stairs or rare stairs) + LDA $E9F0,X ; 2nd pass: skip only if the one above is also blocked (would cause door stairs) +++: BMI + + INY ; count usable nodes ++: DEX + BPL - + TYA + BNE ++ ; all nodes blocked? + SEC ; set up 2nd, less restrictive pass + BRA -- +++: JSL $8082C7 ; advance RNG + STA $00211B + TDC + STA $00211B ; M7A; first factor = random number from 0 to 255 + TYA + STA $00211C ; M7B; second factor = number of possible stair positions + LDA $002135 ; MPYM; calculate random number from 0 to number of possible stair positions - 1 + TAY + LDX.w #$00FF ; loop through floor layout starting from the bottom right +-: LDA $EA00,X ; read node contents + BEQ + ; always skip empty nodes + BCC ++ ; if 1st pass was sufficient: skip all blocked nodes (prevent door stairs and rare stairs) + LDA $E9F0,X ; if 2nd pass was needed: skip only if the one above is also blocked (prevent door stairs) +++: BMI + + DEY ; count down to locate the (Y+1)th usable node + BMI ++ ++: DEX + BPL - +++: TXA ; return selected stair node coordinate + RTL + + + ; equipment text fix pushpc org $81F2E3 diff --git a/worlds/lufia2ac/basepatch/basepatch.bsdiff4 b/worlds/lufia2ac/basepatch/basepatch.bsdiff4 index aee1c712..4ed18150 100644 Binary files a/worlds/lufia2ac/basepatch/basepatch.bsdiff4 and b/worlds/lufia2ac/basepatch/basepatch.bsdiff4 differ diff --git a/worlds/lufia2ac/docs/en_Lufia II Ancient Cave.md b/worlds/lufia2ac/docs/en_Lufia II Ancient Cave.md index 849a9f9c..d24c4ef9 100644 --- a/worlds/lufia2ac/docs/en_Lufia II Ancient Cave.md +++ b/worlds/lufia2ac/docs/en_Lufia II Ancient Cave.md @@ -76,7 +76,7 @@ Your Party Leader will hold up the item they received when not in a fight or in ###### Bug fixes: -- Vanilla game bugs that could result in softlocks or save file corruption have been fixed +- Vanilla game bugs that could result in anomalous floors, softlocks, or save file corruption have been fixed - (optional) Bugfix for the algorithm that determines the item pool for red chest gear. Enabling this allows the cave to generate shields, headgear, rings, and jewels in red chests even after floor B9 - (optional) Bugfix for the outlandish cravings of capsule monsters in the US version. Enabling this makes feeding work