Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ MODE_TRANSITION
MODE_MARATHON
MODE_TAPQTY
MODE_CHECKERBOARD
MODE_TETRISONLY
MODE_GARBAGE
MODE_DROUGHT
MODE_DAS
Expand Down Expand Up @@ -134,7 +135,7 @@ CRASH_CRASH := 3
LINECAP_WHEN_STRING_OFFSET := $10
LINECAP_HOW_STRING_OFFSET := $12

MENU_SPRITE_Y_BASE := $46
MENU_SPRITE_Y_BASE := $3E
MENU_MAX_Y_SCROLL := $A0
MENU_TOP_MARGIN_SCROLL := 7 ; in blocks

Expand All @@ -155,6 +156,7 @@ MENU_TOP_MARGIN_SCROLL := 7 ; in blocks
.byte $4 ; MODE_MARATHON
.byte $1F ; MODE_TAPQTY
.byte $8 ; MODE_CHECKERBOARD
.byte $0 ; MODE_TETRISONLY
.byte $4 ; MODE_GARBAGE
.byte $12 ; MODE_DROUGHT
.byte $10 ; MODE_DAS
Expand Down Expand Up @@ -197,6 +199,7 @@ MENU_TOP_MARGIN_SCROLL := 7 ; in blocks
.byte "MARTHN"
.byte "TAPQTY"
.byte "CKRBRD"
.byte "TETONL"
.byte "GARBGE"
.byte "LOBARS"
.byte "DASDLY"
Expand Down
2 changes: 1 addition & 1 deletion src/gamemode/gametypemenu/menu.asm
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ menuYTmp := tmp2
ldx crashModifier
lda crashOptions, x
sta spriteIndexInOamContentLookup
lda #(MODE_CRASH*8) + MENU_SPRITE_Y_BASE + 1
lda #<((MODE_CRASH*8) + MENU_SPRITE_Y_BASE + 1)
jmp @renderOption

@renderDarkMode:
Expand Down
2 changes: 1 addition & 1 deletion src/nametables/game_type_menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ drawTiles(buffer, lookup, `
#a d#
#a d#
#a d#
#a d#
#a TETRIS d#
#a T-SPINS d#
#a SEED d#
Expand All @@ -53,6 +52,7 @@ drawTiles(buffer, lookup, `
#a MARATHON d#
#a TAP QUANTITY d#
#a CHECKERBOARD d#
#a TETRIS ONLY d#
#a GARBAGE d#
#a DROUGHT d#
#a DAS DELAY d#
Expand Down
127 changes: 97 additions & 30 deletions src/playstate/updatestats.asm
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ addPoints:
lda practiseType
cmp #MODE_CHECKERBOARD
beq handlePointsCheckerboard
cmp #MODE_TETRISONLY
beq handlePointsTetrisOnly
cmp #MODE_TAPQTY
bne @notTapQuantity
lda completedLines
Expand Down Expand Up @@ -252,6 +254,62 @@ handlePointsCheckerboard:
checkerboardPoints:
.byte 0, 10, 20, 30, 40

handlePointsTetrisOnly:
jsr calcScaledLineClearPoints ; -> product24 = pointsTable[completedLines] * (level+1)

lda completedLines
cmp #4
beq @addPoints

; 1-3 lines: subtract the same scaled points a normal
; clear would have earned, clamped at zero
sec
lda binScore
sbc product24
sta binScore
lda binScore+1
sbc product24+1
sta binScore+1
lda binScore+2
sbc product24+2
sta binScore+2
lda binScore+3
sbc #0
sta binScore+3
bcs @finish
lda #0
sta binScore
sta binScore+1
sta binScore+2
sta binScore+3
jmp @finish

@addPoints:
clc
lda binScore
adc product24
sta binScore
lda binScore+1
adc product24+1
sta binScore+1
lda binScore+2
adc product24+2
sta binScore+2
lda binScore+3
adc #0
sta binScore+3

@finish:
jsr setupScoreForRender
lda renderFlags
ora #RENDER_SCORE
sta renderFlags
lda #$0
sta completedLines
lda #$0
sta holdDownPoints
rts

ones := tmpX
hundredths := tmpY
low := tmpZ
Expand Down Expand Up @@ -342,36 +400,7 @@ div16mul10:
rts

addLineClearPoints:
lda #0
sta factorA24+1
sta factorA24+2
lda levelNumber
ldy practiseType
cpy #MODE_MARATHON
bne @notMarathon
ldy marathonModifier
cpy #3 ; Marathon modes 3 + 4 score normally
bcs @notMarathon
lda startLevel
@notMarathon:
sta factorA24+0
inc factorA24+0
bne @noverflow
inc factorA24+1
@noverflow:

lda completedLines
beq addLineClearPoints_end ; skip with 0 completed lines
asl
tax
lda pointsTable, x
sta factorB24+0
lda pointsTable+1, x
sta factorB24+1
lda #0
sta factorB24+2

jsr unsigned_mul24 ; points to add in product24
jsr calcScaledLineClearPoints

clc
lda binScore
Expand Down Expand Up @@ -426,6 +455,44 @@ clearPoints:
sta binScore+3
rts

calcScaledLineClearPoints:
lda #0
sta factorA24+1
sta factorA24+2
lda levelNumber
ldy practiseType
cpy #MODE_MARATHON
bne @notMarathon
ldy marathonModifier
cpy #3 ; Marathon modes 3 + 4 score normally
bcs @notMarathon
lda startLevel
@notMarathon:
sta factorA24+0
inc factorA24+0
bne @noverflow
inc factorA24+1
@noverflow:

lda completedLines
bne @hasLines
lda #0
sta product24
sta product24+1
sta product24+2
rts
@hasLines:
asl
tax
lda pointsTable, x
sta factorB24+0
lda pointsTable+1, x
sta factorB24+1
lda #0
sta factorB24+2

jmp unsigned_mul24 ; tail call - product24 set, rts returns to our caller

pointsTable:
.word 0,40,100,300,1200
.word 1000 ; used in btype score calc
Expand Down