Moved spiral warp point during dark transition (fixed $53 logic)
More spiral layers fixed by adding a 'from layer' bit. Several edge cases addressed (a couple stairs crossed quadrant boundaries during transition)
This commit is contained in:
@@ -27,9 +27,10 @@ NotLinkDoor2:
|
||||
|
||||
|
||||
; Staircase routine
|
||||
;org $02a1e7 ;(PC: 121e7)
|
||||
org $01c3d4 ;(PC: c3d4)
|
||||
jsl SpiralWarp : nop #4
|
||||
jsl RecordStairType : nop
|
||||
org $02a1e7 ;(PC: 121e7)
|
||||
jsl SpiralWarp
|
||||
|
||||
|
||||
; Graphics fix
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
RecordStairType: {
|
||||
lda $0e : sta $045e
|
||||
lda $a0 : lda $063d, x
|
||||
rtl
|
||||
}
|
||||
|
||||
SpiralWarp: {
|
||||
pha : lda $040c : cmp.b #$ff : beq .abort ; abort if not in dungeon
|
||||
lda $040c : cmp.b #$ff : beq .abort ; abort if not in dungeon
|
||||
cmp #$06 : bcs .abort ; abort if not supported yet -- todo: this needs to be altered/removed as more dungeons are implemented
|
||||
lda $0e : 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
|
||||
.abort pla : sta $a0 : bra .end
|
||||
.abort
|
||||
lda $a2 : and #$0f : rtl ; run highjack code and get out
|
||||
|
||||
.gtg
|
||||
pla
|
||||
phb : phk : plb : phx : phy ; push stuff
|
||||
jsr LookupSpiralOffset
|
||||
rep #$30 : and #$00FF : asl #2 : tax
|
||||
@@ -28,9 +34,15 @@ SpiralWarp: {
|
||||
|
||||
.skipYQuad
|
||||
lda $01 : and #$04 : lsr : sta $048a ;fix layer calc 0->0 2->1
|
||||
lda $01 : and #$08 : lsr #2 : sta $0492 ;fix from layer calc 0->0 2->1
|
||||
; shift lower coordinates
|
||||
lda $02 : sta $22
|
||||
lda $03 : sta $20
|
||||
lda $02 : sta $22 : bne .adjY : inc $23
|
||||
.adjY lda $03 : sta $20 : bne .set53 : inc $21
|
||||
.set53 ldx #$08
|
||||
lda $0462 : and #$04 : beq .upStairs
|
||||
ldx #$fd
|
||||
.upStairs
|
||||
txa : !add $22 : sta $53
|
||||
|
||||
lda $01 : and #$10 : sta $07 ; zeroHzCam check
|
||||
ldy #$00 : jsr SetCamera
|
||||
@@ -38,12 +50,8 @@ SpiralWarp: {
|
||||
ldy #$01 : jsr SetCamera
|
||||
|
||||
ply : plx : plb ; pull the stuff we pushed
|
||||
|
||||
.end rtl
|
||||
; this is the code we are hijacking
|
||||
; lda $a0 - we overwrote all this behavior
|
||||
; lda $063d, x
|
||||
; sta $048a
|
||||
lda $a2 : and #$0f ; this is the code we are hijacking
|
||||
rtl
|
||||
}
|
||||
|
||||
;Sets the offset in A
|
||||
@@ -86,7 +94,9 @@ LookupSpiralOffset: {
|
||||
|
||||
ShiftQuadSimple: {
|
||||
lda CoordIndex,y : tax
|
||||
lda $20,x : beq .skip
|
||||
lda $21,x : !add $06 : sta $21,x ; coordinate update
|
||||
.skip
|
||||
lda CamQuadIndex,y : tax
|
||||
lda $0601,x : !add $06 : sta $0601,x
|
||||
lda $0605,x : !add $06 : sta $0605,x ; high bytes of these guys
|
||||
@@ -94,8 +104,7 @@ ShiftQuadSimple: {
|
||||
}
|
||||
|
||||
SetCamera: {
|
||||
stz $04 : sty $05
|
||||
|
||||
stz $04
|
||||
tyx : lda $a9,x : bne .nonZeroHalf
|
||||
lda CamQuadIndex,y : tax : lda $607,x : pha
|
||||
lda CameraIndex,y : tax : pla : cmp $e3, x : bne .noQuadAdj
|
||||
@@ -104,27 +113,30 @@ SetCamera: {
|
||||
.noQuadAdj
|
||||
lda $07 : bne .adj0
|
||||
lda CoordIndex,y : tax
|
||||
lda $20,x : cmp #$79 : bcc .adj0
|
||||
lda $20,x : beq .oddQuad
|
||||
cmp #$79 : bcc .adj0
|
||||
!sub #$78 : sta $04
|
||||
tya : asl : !add #$04 : tax : jsr AdjCamBounds : bra .done
|
||||
.oddQuad
|
||||
lda #$80 : sta $04 : bra .adj1 ; this is such a weird case - quad cross boundary
|
||||
.adj0
|
||||
tya : asl : tax : jsr AdjCamBounds : bra .done
|
||||
|
||||
.nonZeroHalf ;meaning either right half or bottom half
|
||||
lda $07 : bne .setQuad
|
||||
lda CoordIndex,y : tax
|
||||
lda $20,x : cmp #$78 : bcs .setQuad
|
||||
lda $07 : bne .adj1
|
||||
!add #$78 : sta $04
|
||||
.adj1
|
||||
tya : asl : !add #$08 : tax : jsr AdjCamBounds : bra .done
|
||||
|
||||
.setQuad
|
||||
lda CamQuadIndex,y : tax : lda $0607, x : pha
|
||||
lda CameraIndex,y : tax : pla : sta $e3, x
|
||||
.adj1
|
||||
tya : asl : !add #$0c : tax : jsr AdjCamBounds : bra .done
|
||||
|
||||
.done
|
||||
lda CameraIndex,y : tax : lda $e2, x
|
||||
lda CameraIndex,y : tax
|
||||
lda $04 : sta $e2, x
|
||||
rts
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user