Fix the drawing of the left cap to simplify the code and fix some drawing glitches.

This commit is contained in:
Jeremy Rand 2017-08-08 23:20:31 -04:00
parent abb01d1dfd
commit 5b686d5b47

View File

@ -1114,9 +1114,21 @@ yPos: .BYTE $00
lda gridLeft lda gridLeft
sec sec
sbc gridXPos sbc gridXPos
bpl @leftIsOnScreen bmi @leftIsOffScreen
beq @doneLeftAdjust
ldx gridXShift
beq @doneLeftAdjust
cpx #$4
bcs @doneLeftAdjust
sec
sbc #$1
jmp @doneLeftAdjust
@leftIsOffScreen:
lda #$0 lda #$0
@leftIsOnScreen:
@doneLeftAdjust:
sta gridScreenLeft sta gridScreenLeft
jsr drawGrid jsr drawGrid
@ -1215,6 +1227,7 @@ gridLeft: .BYTE $00
ldy #LEVEL_STRUCT_SIZE+LEVEL_STRUCT_WIDTH ldy #LEVEL_STRUCT_SIZE+LEVEL_STRUCT_WIDTH
lda (ZPADDR6),y lda (ZPADDR6),y
bne @notLastGrid bne @notLastGrid
lda evenVal lda evenVal
sta evenGridVal sta evenGridVal
lda oddVal lda oddVal
@ -1229,15 +1242,14 @@ gridLeft: .BYTE $00
sta oddRightCap sta oddRightCap
ldy gridScreenLeft ldy gridScreenLeft
beq @L1 beq @nextGridComponent
cpx #$0
beq @L1 ; Draw the left cap
jmp @L2 dey
@L1: tya
jmp @nextGridComponent and #$01
; Draw the left cap bne @leftCapOdd
@L2:
lda evenGridLeft,x lda evenGridLeft,x
and evenVal and evenVal
sta evenLeftCap sta evenLeftCap
@ -1245,6 +1257,15 @@ gridLeft: .BYTE $00
eor #$ff eor #$ff
sta evenLeftMask sta evenLeftMask
lda evenLeftCap
and evenGridVal
tax
lda evenLeftMask
and (ZPADDR0),y
ora evenLeftCap
jmp @drawLeftCapComponent
@leftCapOdd:
lda oddGridLeft,x lda oddGridLeft,x
and oddVal and oddVal
sta oddLeftCap sta oddLeftCap
@ -1252,57 +1273,16 @@ gridLeft: .BYTE $00
eor #$ff eor #$ff
sta oddLeftMask sta oddLeftMask
dey
tya
and #$01
bne @leftCapOdd1
lda evenLeftCap
and evenGridVal
tax
lda evenLeftMask
and (ZPADDR0),y
ora evenLeftCap
jmp @nextLeftCapComponent
@leftCapOdd1:
lda oddLeftCap lda oddLeftCap
and oddGridVal and oddGridVal
tax tax
lda oddLeftMask lda oddLeftMask
and (ZPADDR0),y and (ZPADDR0),y
ora oddLeftCap ora oddLeftCap
ldx oddGridVal
@nextLeftCapComponent: @drawLeftCapComponent:
jsr drawGridComponent
dey
bmi @drawBodyComponents
tya
and #$01
bne @leftCapOdd2
lda evenLeftCap
and evenGridVal
tax
lda evenLeftMask
and (ZPADDR0),y
ora evenLeftCap
jsr drawGridComponent
jmp @drawBodyComponents
@leftCapOdd2:
lda oddLeftCap
and oddGridVal
tax
lda oddLeftMask
and (ZPADDR0),y
ora oddLeftCap
jsr drawGridComponent jsr drawGridComponent
@drawBodyComponents:
ldy gridScreenLeft ldy gridScreenLeft
@nextGridComponent: @nextGridComponent:
cpy gridScreenRight cpy gridScreenRight