Merge branch 'DRUnstable' into OWMain

This commit is contained in:
codemann8
2023-03-07 18:46:25 -06:00
3 changed files with 28 additions and 8 deletions

View File

@@ -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:

View File

@@ -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)

View File

@@ -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