Cave state fixes
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
WarpLeft:
|
WarpLeft:
|
||||||
lda.l DRMode : beq .end
|
lda.l DRMode : beq .end
|
||||||
lda $040c : cmp.b #$ff : beq .end
|
JSR CheckIfCave : BCS .end
|
||||||
lda $20 : ldx $aa
|
lda $20 : ldx $aa
|
||||||
jsr CalcIndex
|
jsr CalcIndex
|
||||||
!add #$06 : ldy #$01 ; offsets in A, Y
|
!add #$06 : ldy #$01 ; offsets in A, Y
|
||||||
@@ -11,7 +11,7 @@ WarpLeft:
|
|||||||
|
|
||||||
WarpRight:
|
WarpRight:
|
||||||
lda.l DRMode : beq .end
|
lda.l DRMode : beq .end
|
||||||
lda $040c : cmp.b #$ff : beq .end
|
JSR CheckIfCave : BCS .end
|
||||||
lda $20 : ldx $aa
|
lda $20 : ldx $aa
|
||||||
jsr CalcIndex
|
jsr CalcIndex
|
||||||
!add #$12 : ldy #$ff ; offsets in A, Y
|
!add #$12 : ldy #$ff ; offsets in A, Y
|
||||||
@@ -22,7 +22,7 @@ WarpRight:
|
|||||||
|
|
||||||
WarpUp:
|
WarpUp:
|
||||||
lda.l DRMode : beq .end
|
lda.l DRMode : beq .end
|
||||||
lda $040c : cmp.b #$ff : beq .end
|
JSR CheckIfCave : BCS .end
|
||||||
lda $22 : ldx $a9
|
lda $22 : ldx $a9
|
||||||
jsr CalcIndex
|
jsr CalcIndex
|
||||||
ldy #$02 ; offsets in A, Y
|
ldy #$02 ; offsets in A, Y
|
||||||
@@ -40,7 +40,7 @@ endmacro
|
|||||||
|
|
||||||
WarpDown:
|
WarpDown:
|
||||||
lda.l DRMode : beq .end
|
lda.l DRMode : beq .end
|
||||||
lda $040c : cmp.b #$ff : beq .end
|
JSR CheckIfCave : BCS .end
|
||||||
lda $22 : ldx $a9
|
lda $22 : ldx $a9
|
||||||
jsr CalcIndex
|
jsr CalcIndex
|
||||||
!add #$0c : ldy #$ff ; offsets in A, Y
|
!add #$0c : ldy #$ff ; offsets in A, Y
|
||||||
@@ -79,6 +79,14 @@ Cleanup:
|
|||||||
lda $ef
|
lda $ef
|
||||||
rts
|
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
|
;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)
|
; 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)
|
CalcIndex: ; A->low byte of Link's Coord, X-> Link's quadrant, DoorOffset x 2 -> A, DoorOffset -> $04 (vert/horz agnostic)
|
||||||
|
|||||||
@@ -1,24 +1,28 @@
|
|||||||
RecordStairType: {
|
RecordStairType: {
|
||||||
pha
|
pha
|
||||||
lda.l DRMode : beq .norm
|
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
|
lda $0e
|
||||||
cmp #$25 : bcc ++ ; don't record straight staircases
|
cmp #$25 : bcc ++ ; don't record straight staircases
|
||||||
sta $045e
|
sta $045e
|
||||||
++ pla : bra +
|
++ pla : bra +
|
||||||
.norm pla : sta $a0
|
.norm SEP #$30 : pla : sta $a0
|
||||||
+ lda $063d, x
|
+ lda $063d, x
|
||||||
rtl
|
rtl
|
||||||
}
|
}
|
||||||
|
|
||||||
SpiralWarp: {
|
SpiralWarp: {
|
||||||
lda.l DRMode : beq .abort ; abort if not DR
|
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!
|
lda $045e : cmp #$5e : beq .gtg ; abort if not spiral - intended room is in A!
|
||||||
cmp #$5f : beq .gtg
|
cmp #$5f : beq .gtg
|
||||||
cmp #$26 : beq .inroom
|
cmp #$26 : beq .inroom
|
||||||
.abort
|
.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
|
.inroom
|
||||||
jsr InroomStairsWarp
|
jsr InroomStairsWarp
|
||||||
lda $a2 : and #$0f ; this is the code we are hijacking
|
lda $a2 : and #$0f ; this is the code we are hijacking
|
||||||
|
|||||||
Reference in New Issue
Block a user