Skip to content

Commit 5aff303

Browse files
committed
Optimization of clear count stats
1 parent 68a7f59 commit 5aff303

File tree

1 file changed

+14
-23
lines changed

1 file changed

+14
-23
lines changed

src/playstate/updatestats.asm

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,10 @@ playState_updateLinesAndStatistics:
66

77
@linesCleared:
88
tax
9-
dex
10-
lda lineClearStatsByType,x
11-
clc
12-
adc #$01
13-
sta lineClearStatsByType,x
14-
and #$0F
15-
cmp #$0A
16-
bmi @noCarry
17-
lda crashFlag
18-
ora #$04
19-
sta crashFlag
20-
lda lineClearStatsByType,x
21-
clc
22-
adc #$06
23-
sta lineClearStatsByType,x
9+
dec lineClearStatsByType-1,x
10+
bpl @noCarry
11+
lda #$09
12+
sta lineClearStatsByType-1,x
2413
@noCarry:
2514
lda outOfDateRenderFlags
2615
ora #$01
@@ -561,15 +550,8 @@ testCrash:
561550
@digit2:
562551
lda crashFlag
563552
and #$02
564-
beq @clearStats
565-
lda #$0C ; add 12 cycles for lines 100s place
566-
adc allegroIndex
567-
sta allegroIndex
568-
@clearStats:
569-
lda crashFlag
570-
and #$04
571553
beq @newLevel
572-
lda #$0B ; 11 cycles for clearcount 10s place
554+
lda #$0C ; add 12 cycles for lines 100s place
573555
adc allegroIndex
574556
sta allegroIndex
575557
@newLevel:
@@ -596,6 +578,15 @@ testCrash:
596578
bcc @scoreCycles
597579
@single:
598580
lda completedLines
581+
beq @dontClearCount
582+
tax
583+
ldy lineClearStatsByType-1,x
584+
beq @dontClearCount
585+
lda #$0B ; 11 cycles for clearcount 10s place
586+
adc allegroIndex
587+
sta allegroIndex
588+
txa
589+
@dontClearCount:
599590
cmp #$01
600591
bne @notsingle
601592
lda #$34 ; 53 for singles, carry is set

0 commit comments

Comments
 (0)