Working on spiral problems

This commit is contained in:
randall.rupper
2019-09-05 21:09:26 -06:00
parent c6a1e90043
commit eb3b1eaa44
8 changed files with 62 additions and 21 deletions

View File

@@ -122,6 +122,26 @@ c2 21 ae b6 0a bf 1b
Trap doors:
0468 - flag is set when doors are down (1 = down? 0 = up?)
$690 - 7 for open - 0 for down
IntraRoom: ->
Dungeon_IntraRoomTransShutDoors (maybe should be Open)
stz $0468
#$07 -> $0690
Dungeon_IntraRoomTransOpenDoors (maybe should be Shut)
10D71 -> A
A -> 0468
0468++
0 -> 0690
Other transition stuff
Overworld_LoadTransGfx -> LoadTransAuxGfx

View File

@@ -29,7 +29,7 @@ NotLinkDoor2:
; Staircase routine
;org $02a1e7 ;(PC: 121e7)
org $01c3d4 ;(PC: c3d4)
jsl SpiralWarp : nop
jsl SpiralWarp : nop #4
; Graphics fix
@@ -333,5 +333,7 @@ ShiftQuadIndex:
db 2, 1 ; see ShiftQuad func (relates to $a9,$aa)
CamBoundIndex: ; Horizontal 1st
db 0, 4 ; Camera Bounds $0618-$61f
OppCamBoundIndex: ; Horizontal 1st
db 4, 0 ; Camera Bounds $0618-$61f
incsrc doortables.asm

View File

@@ -29,20 +29,21 @@ SpiralWarp:
ldy #$01 : jsr ShiftQuadSimple
.skipYQuad
lda $01 : and #$04 : lsr : sta $048a ;fix layer calc 0->0 2->1
; shift lower coordinates
lda $02 : sta $22
lda $03 : sta $20
ldy #$00 : jsr SetCamera ; todo: figure out camera jazz
ldy #$00 : jsr SetCamera
ldy #$01 : jsr SetCamera
ply : plx : plb ; pull the stuff we pushed
.end
.end rtl
; this is the code we are hijacking
; lda $a0 - we overwrote this behavior
lda $063d, x
rtl
; lda $a0 - we overwrote all this behavior
; lda $063d, x
; sta $048a
}
;Sets the offset in A
@@ -97,8 +98,6 @@ ShiftQuadSimple:
SetCamera:
{
stz $04 : sty $05
lda $01 : and #$10 : !add $05 : cmp #$10 : beq .done ; zeroHzCam check (10+0 = 10)
lda $01 : and #$20 : !add $05 : cmp #$21 : beq .done ; zeroVtCam check (20+1 = 21)
tyx : lda $a9,x : bne .nonZeroHalf
lda CamQuadIndex,y : tax : lda $607,x : pha
@@ -106,21 +105,40 @@ SetCamera:
dec $e3,x
.noQuadAdj
lda $01 : and #$10 : !add $05 : cmp #$10 : beq .done ; zeroHzCam check (10+0 = 10)
lda $01 : and #$20 : !add $05 : cmp #$21 : beq .done ; zeroVtCam check (20+1 = 21)
lda CoordIndex,y : tax
lda $20,x : cmp #$79 : bcc .adjust
!sub #$78 : sta $04 : bra .adjust
lda $20,x : cmp #$79 : bcc .done
!sub #$78 : sta $04 : bra .done
.nonZeroHalf ;meaning either right half or bottom half
lda CoordIndex,y : tax
lda $20,x : cmp #$78 : bcs .setQuad
!add #$78 : sta $04 : bra .adjust
lda $01 : and #$10 : !add $05 : cmp #$10 : beq .done ; zeroHzCam check (10+0 = 10)
lda $01 : and #$20 : !add $05 : cmp #$21 : beq .done ; zeroVtCam check (20+1 = 21)
!add #$78 : sta $04 : bra .done
.setQuad
lda CamQuadIndex,y : tax : lda $0607, x : pha
lda CameraIndex,y : tax : pla : sta $e3, x : bra .done
lda CameraIndex,y : tax : pla : sta $e3, x
bra .done
.adjust
lda CameraIndex,y : tax
.done lda $04 : sta $e2,x
.done
lda CameraIndex,y : tax : lda $e2, x : phx
jsr AdjCamBounds
plx : lda $e2, x : !sub $04 : sta $e2, x
rts
}
;input : A should be loaded with current camera low byte
; $04 should be loaded with what we want the low byte to become (00-ff)
AdjCamBounds:
{
stz $05 : rep #$30 : and #$00FF ; sanitize input for 16 bit
!sub $04 : sta $04
lda OppCamBoundIndex,y : tax
lda $0618, x : !sub $04 : sta $0618, x
lda $061A, x : !sub $04 : sta $061A, x
sep #$30
rts
}