From 72e8d73277d03be4ef99335f11288223e841004e Mon Sep 17 00:00:00 2001 From: aerinon Date: Thu, 2 Mar 2023 16:21:02 -0700 Subject: [PATCH 1/2] Fix for lower layer blocked doors in standard --- doorrando/entrance_fixes.asm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doorrando/entrance_fixes.asm b/doorrando/entrance_fixes.asm index faf42f6..ea5223a 100644 --- a/doorrando/entrance_fixes.asm +++ b/doorrando/entrance_fixes.asm @@ -30,6 +30,9 @@ warnpc $018939 org $01BF43 JSL AdjustEscapeDoorCollision +org $01C132 ; ADC.w #$0040 : TAX : LDA.b $00 + JSL AdjustEscapeDoorCollision_LowEntrance : NOP #2 + pullpc ;=================================================================================================== @@ -211,6 +214,7 @@ BlockedEntrance: AdjustEscapeDoorCollision: LSR ; vanilla shift +AdjustEscapeDoorCollisionShared: ; save our parameters ; but one or both of these may not be necessary depending on how you detect these doors ; all that matters is that after identifying blockage, we have: @@ -236,6 +240,10 @@ AdjustEscapeDoorCollision: RTL +AdjustEscapeDoorCollision_LowEntrance: + ADC.w #$0040 ; vanilla add + JMP AdjustEscapeDoorCollisionShared + ;=================================================================================================== ; Enter with: From 5c213477bccd66e4e916c8881b77fbec33108605 Mon Sep 17 00:00:00 2001 From: aerinon Date: Mon, 6 Mar 2023 16:10:41 -0700 Subject: [PATCH 2/2] Cave state fixes --- doorrando/normal.asm | 16 ++++++++++++---- doorrando/spiral.asm | 12 ++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/doorrando/normal.asm b/doorrando/normal.asm index 3c482b3..e1fc8ee 100644 --- a/doorrando/normal.asm +++ b/doorrando/normal.asm @@ -1,6 +1,6 @@ WarpLeft: lda.l DRMode : beq .end - lda $040c : cmp.b #$ff : beq .end + JSR CheckIfCave : BCS .end lda $20 : ldx $aa jsr CalcIndex !add #$06 : ldy #$01 ; offsets in A, Y @@ -11,7 +11,7 @@ WarpLeft: WarpRight: lda.l DRMode : beq .end - lda $040c : cmp.b #$ff : beq .end + JSR CheckIfCave : BCS .end lda $20 : ldx $aa jsr CalcIndex !add #$12 : ldy #$ff ; offsets in A, Y @@ -22,7 +22,7 @@ WarpRight: WarpUp: lda.l DRMode : beq .end - lda $040c : cmp.b #$ff : beq .end + JSR CheckIfCave : BCS .end lda $22 : ldx $a9 jsr CalcIndex ldy #$02 ; offsets in A, Y @@ -40,7 +40,7 @@ endmacro WarpDown: lda.l DRMode : beq .end - lda $040c : cmp.b #$ff : beq .end + JSR CheckIfCave : BCS .end lda $22 : ldx $a9 jsr CalcIndex !add #$0c : ldy #$ff ; offsets in A, Y @@ -79,6 +79,14 @@ Cleanup: lda $ef rts +; carry set if cave, clear otherwise +CheckIfCave: + REP #$30 + LDA.b $A2 : CMP.w #$00E1 : BCS .invalid + SEP #$30 : CLC : RTS + .invalid + SEP #$30 : SEC : RTS + ;A needs be to the low coordinate, x needs to be either 0 for left,upper or non-zero for right,down ; This sets A (00,02,04) and stores half that at $04 for later use, (src door) CalcIndex: ; A->low byte of Link's Coord, X-> Link's quadrant, DoorOffset x 2 -> A, DoorOffset -> $04 (vert/horz agnostic) diff --git a/doorrando/spiral.asm b/doorrando/spiral.asm index 4ce37e2..81f8533 100644 --- a/doorrando/spiral.asm +++ b/doorrando/spiral.asm @@ -1,24 +1,28 @@ RecordStairType: { pha lda.l DRMode : beq .norm - lda $040c : cmp #$ff : beq .norm + REP #$30 : LDA.b $A2 : CMP.w #$00E1 : BCS .norm + CMP #$00DF : BEQ .norm + SEP #$30 lda $0e cmp #$25 : bcc ++ ; don't record straight staircases sta $045e ++ pla : bra + - .norm pla : sta $a0 + .norm SEP #$30 : pla : sta $a0 + lda $063d, x rtl } SpiralWarp: { lda.l DRMode : beq .abort ; abort if not DR - lda $040c : cmp.b #$ff : beq .abort ; abort if not in dungeon + REP #$30 : LDA.b $A2 : CMP.w #$00E1 : BCS .abort + CMP #$00DF : BEQ .abort + SEP #$30 lda $045e : cmp #$5e : beq .gtg ; abort if not spiral - intended room is in A! cmp #$5f : beq .gtg cmp #$26 : beq .inroom .abort - stz $045e : lda $a2 : and #$0f : rtl ; clear,run hijacked code and get out + SEP #$30 : stz $045e : lda $a2 : and.b #$0f : rtl ; clear,run hijacked code and get out .inroom jsr InroomStairsWarp lda $a2 : and #$0f ; this is the code we are hijacking