Fix bug in how the old scores are pushed down. They must be copied backwards.

This commit is contained in:
Jeremy Rand 2020-12-31 15:03:08 -05:00
parent 4c7e52af58
commit 767a8ba9ab

View File

@ -350,23 +350,23 @@ checkHighScore_next anop
blt checkHighScore_loop blt checkHighScore_loop
rtl rtl
checkHighScore_isHighScore anop checkHighScore_isHighScore anop
phy sty scoreIndex
tya ldx #SETTINGS_HIGH_SCORE_SIZE*10-2
clc ldy #SETTINGS_HIGH_SCORE_SIZE*9-2
adc #SETTINGS_HIGH_SCORE_SIZE cpy scoreIndex
tax blt checkHighScore_doneCopy
checkHighScore_copyLoop anop checkHighScore_copyLoop anop
cpx #SETTINGS_HIGH_SCORE_SIZE*10
bge checkHighScore_doneCopy
lda settings+SETTINGS_HIGH_SCORE_OFFSET,y lda settings+SETTINGS_HIGH_SCORE_OFFSET,y
sta settings+SETTINGS_HIGH_SCORE_OFFSET,x sta settings+SETTINGS_HIGH_SCORE_OFFSET,x
iny cpy scoreIndex
iny beq checkHighScore_doneCopy
inx dey
inx dey
dex
dex
bra checkHighScore_copyLoop bra checkHighScore_copyLoop
checkHighScore_doneCopy anop checkHighScore_doneCopy anop
ply ldy scoreIndex
lda gameScore lda gameScore
sta settings+SETTINGS_HIGH_SCORE_OFFSET+HIGH_SCORE_SCORE_OFFSET,y sta settings+SETTINGS_HIGH_SCORE_OFFSET+HIGH_SCORE_SCORE_OFFSET,y
lda gameScore+2 lda gameScore+2
@ -442,4 +442,6 @@ checkHighScore_doneCopy anop
jmp updateHighScore jmp updateHighScore
scoreIndex dc i2'0'
end end