Tested a lot of north edges
This commit is contained in:
@@ -89,6 +89,7 @@ LoadRoomHorz:
|
||||
jsr ShiftQuad
|
||||
jsr ShiftCameraBounds
|
||||
ldy #$01 : jsr ShiftVariablesSubDir ; flip direction
|
||||
jsr SetupScrollIndicator
|
||||
lda $01 : sta $fe : and #$04 : lsr #2
|
||||
sta $ee
|
||||
lda $01 : and #$10 : beq .end : stz $0468
|
||||
@@ -116,6 +117,7 @@ LoadRoomVert:
|
||||
jsr ShiftQuad
|
||||
jsr ShiftCameraBounds
|
||||
ldy #$00 : jsr ShiftVariablesSubDir ; flip direction
|
||||
jsr SetupScrollIndicator
|
||||
lda $01 : sta $fe : and #$04 : lsr #2
|
||||
sta $ee
|
||||
.end
|
||||
@@ -123,6 +125,12 @@ LoadRoomVert:
|
||||
rts
|
||||
}
|
||||
|
||||
SetupScrollIndicator:
|
||||
lda $ab : and #$01 : asl : sta $ac
|
||||
lda $ab : and #$40 : clc : rol #3 : ora $ac : sta $ac
|
||||
lda $ab : and #$20 : asl #2 : sta $ab
|
||||
rts
|
||||
|
||||
LookupNewRoom: ; expects data offset to be in A
|
||||
{
|
||||
rep #$30 : and #$00FF ;sanitize A reg (who knows what is in the high byte)
|
||||
@@ -157,7 +165,7 @@ ShiftLowCoord:
|
||||
{
|
||||
lda $01 : and.b #$03 ; high byte index
|
||||
jsr CalcOpposingShift
|
||||
lda $fe : and.b #$f0 : cmp.b #$20 : bne .lowDone
|
||||
lda $ab : and.b #$f0 : cmp.b #$20 : bne .lowDone
|
||||
lda OppCoordIndex,y : tax
|
||||
lda #$80 : !add $20,x : sta $20,x
|
||||
.lowDone
|
||||
@@ -165,13 +173,13 @@ ShiftLowCoord:
|
||||
}
|
||||
|
||||
; expects A to be (0,1,2) (dest number) and (0,1,2) (src door number) to be stored in $04
|
||||
; $0127 will be set to a bitmask aaaa qxxf
|
||||
; $ab will be set to a bitmask aaaa qxxf
|
||||
; a - amount of adjust
|
||||
; f - flag, if set, then amount is pos, otherwise neg.
|
||||
; q - quadrant, if set, then quadrant needs to be modified
|
||||
CalcOpposingShift:
|
||||
{
|
||||
stz $fe ; set up (can you zero out 127 alone?)
|
||||
stz $ab : stz $ac ; set up
|
||||
cmp.b $04 : beq .noOffset ; (equal, no shifts to do)
|
||||
phy : tay ; reserve these
|
||||
lda $04 : tax : tya : !sub $04 : sta $04 : cmp.b #$00 : bpl .shiftPos
|
||||
@@ -179,8 +187,8 @@ CalcOpposingShift:
|
||||
cpx.b #$01 : beq .skipNegQuad
|
||||
ora #$08
|
||||
.skipNegQuad
|
||||
sta $fe : lda $04 : cmp.b #$FE : beq .done ;already set $0127
|
||||
lda $fe : eor #$60
|
||||
sta $ab : lda $04 : cmp.b #$FE : beq .done ;already set $ab
|
||||
lda $ab : eor #$60
|
||||
bra .setDone
|
||||
|
||||
.shiftPos
|
||||
@@ -188,10 +196,10 @@ CalcOpposingShift:
|
||||
cpy.b #$01 : beq .skipPosQuad
|
||||
ora #$08
|
||||
.skipPosQuad
|
||||
sta $fe : lda $04 : cmp.b #$02 : bcs .done ;already set $0127
|
||||
lda $fe : eor #$60
|
||||
sta $ab : lda $04 : cmp.b #$02 : bcs .done ;already set $ab
|
||||
lda $ab : eor #$60
|
||||
|
||||
.setDone sta $fe
|
||||
.setDone sta $ab
|
||||
.done ply
|
||||
.noOffset rts
|
||||
}
|
||||
@@ -199,9 +207,9 @@ CalcOpposingShift:
|
||||
|
||||
ShiftQuad:
|
||||
{
|
||||
lda $fe : and #$08 : cmp.b #$00 : beq .quadDone
|
||||
lda $ab : and #$08 : beq .quadDone
|
||||
lda ShiftQuadIndex,y : tax ; X should be set to either 1 (vertical) or 2 (horizontal) (for a9,aa quadrant)
|
||||
lda $fe : and #$01 : cmp.b #$00 : beq .decQuad
|
||||
lda $ab : and #$01 : beq .decQuad
|
||||
inc $02
|
||||
txa : sta $a8, x ; alter a9/aa
|
||||
bra .quadDone
|
||||
@@ -229,8 +237,8 @@ ShiftCameraBounds:
|
||||
{
|
||||
lda CamBoundIndex,y : tax ; should be 0 for horz travel (vert bounds) or 4 for vert travel (horz bounds)
|
||||
rep #$30
|
||||
lda $fe : and #$00f0 : asl #2 : sta $06
|
||||
lda $fe : and #$0001 : cmp #$0000 : beq .subIt
|
||||
lda $ab : and #$00f0 : asl #2 : sta $06
|
||||
lda $ab : and #$0001 : cmp #$0000 : beq .subIt
|
||||
lda $0618, x : !add $06 : sta $0618, x
|
||||
lda $061A, x : !add $06 : sta $061A, x
|
||||
sep #$30
|
||||
@@ -244,19 +252,26 @@ ShiftCameraBounds:
|
||||
|
||||
AdjustTransition:
|
||||
{
|
||||
lda $fe : and #$00f0 : lsr
|
||||
sep #$20 : cmp $0126 : bcc .reset
|
||||
rep #$20
|
||||
lda $ab : and #$01ff : beq .reset
|
||||
phy : ldy #$06 ; operating on vertical registers during horizontal trans
|
||||
cpx.b #$02 : bcs .horizontalScrolling
|
||||
ldy #$00 ; operate on horizontal regs during vert trans
|
||||
.horizontalScrolling
|
||||
lda $fe : and #$0001 : asl : tax
|
||||
lda.l OffsetTable,x : adc $00E2,y : and.w #$FFFE : sta $00E2,y : sta $00E0,y
|
||||
cmp #$0008 : bcs +
|
||||
pha : lda $ab : and #$0200 : beq ++
|
||||
pla : bra .add
|
||||
++ pla : eor #$ffff : inc ; convert to negative
|
||||
.add jsr AdjustCamAdd : ply : bra .reset
|
||||
+ lda $ab : and #$0200 : xba : tax
|
||||
lda.l OffsetTable,x : jsr AdjustCamAdd
|
||||
lda $ab : !sub #$0008 : sta $ab
|
||||
ply : bra .done
|
||||
.reset ; clear the $ab variable so to not disturb intra-tile doors
|
||||
stz $fe
|
||||
stz $ab
|
||||
.done
|
||||
rep #$20 : lda $00 : and #$01fc
|
||||
lda $00 : and #$01fc
|
||||
rtl
|
||||
}
|
||||
}
|
||||
|
||||
AdjustCamAdd:
|
||||
!add $00E2,y : sta $00E2,y : sta $00E0,y : rts
|
||||
Reference in New Issue
Block a user