Add Line ARE. Improve tells and hold.

This commit is contained in:
Randy Thiemann 2023-10-26 14:29:06 +02:00
parent 9c762bf480
commit 9097a89bc9
13 changed files with 363 additions and 425 deletions

Binary file not shown.

Binary file not shown.

View File

@ -131,126 +131,135 @@ sPieceYOffsets:: ; How to draw each piece. Y-offsets of the sprites.
db 0, 7, 0, 7 ; O
db 0, 0, 7, 0 ; T
; Speed curve data is defined as follows:
; N blocks of:
; dw BCD_START_LEVEL, START_LEVEL, BCD_NEXT_100_LEVEL_BREAKPOINT
; db GRID_CELLS_PER_MOVE_ON_OVERFLOW, INCREMENT_PER_FRAME
; db NORMAL_ARE, LINE_ARE, DAS, LOCK_DELAY, CLEAR_DELAY
;
; Followed by one single:
; dw $FFFF
sTGM1SpeedCurve::
dw $0000, 0, $0100
db 1, 4
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0030, 30, $0100
db 1, 6
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0035, 35, $0100
db 1, 8
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0040, 40, $0100
db 1, 10
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0050, 50, $0100
db 1, 12
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0060, 60, $0100
db 1, 16
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0070, 70, $0100
db 1, 32
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0080, 80, $0100
db 1, 48
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0090, 90, $0100
db 1, 64
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0100, 100, $0200
db 1, 80
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0120, 120, $0200
db 1, 96
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0140, 140, $0200
db 1, 112
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0160, 160, $0200
db 1, 128
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0170, 170, $0200
db 1, 144
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0200, 200, $0300
db 1, 4
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0220, 220, $0300
db 1, 32
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0230, 230, $0300
db 1, 64
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0233, 233, $0300
db 1, 96
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0236, 236, $0300
db 1, 128
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0239, 239, $0300
db 1, 160
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0243, 243, $0300
db 1, 192
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0247, 239, $0300
db 1, 224
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0251, 251, $0300
db 1, $FF
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0300, 300, $0400
db 2, $FF
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0330, 330, $0400
db 3, $FF
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0360, 360, $0400
db 4, $FF
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0400, 400, $0500
db 5, $FF
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0420, 420, $0500
db 4, $FF
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0450, 450, $0500
db 3, $FF
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
dw $0500, 500, $0600
db 20, $FF
db 30, 16, 30, 41
db 30, 30, 16, 30, 41
sTGM1SpeedCurveEnd::
dw $FFFF
@ -259,91 +268,91 @@ sTGM1SpeedCurveEnd::
sCHILSpeedCurve::
dw $0000, 0, $0100
db 1, 5
db 10, 16, 25, 17
db 10, 10, 16, 25, 17
dw $0100, 100, $0200
db 1, 6
db 10, 16, 25, 17
db 10, 10, 16, 25, 17
dw $0200, 200, $0300
db 1, 7
db 10, 16, 25, 17
db 10, 10, 16, 25, 17
dw $0300, 300, $0400
db 1, 8
db 10, 16, 25, 17
db 10, 10, 16, 25, 17
dw $0400, 400, $0500
db 1, 9
db 10, 16, 25, 17
db 10, 10, 16, 25, 17
dw $0500, 500, $0600
db 1, 11
db 10, 16, 25, 17
db 10, 10, 16, 25, 17
dw $0600, 600, $0700
db 1, 14
db 10, 16, 25, 17
db 10, 10, 16, 25, 17
dw $0700, 700, $0800
db 1, 20
db 10, 16, 25, 17
db 10, 10, 16, 25, 17
dw $0800, 800, $0900
db 1, 32
db 10, 16, 25, 17
db 10, 10, 16, 25, 17
dw $0900, 900, $1000
db 1, 43
db 10, 16, 25, 17
db 10, 10, 16, 25, 17
dw $1000, 1000, $1100
db 1, 51
db 10, 16, 25, 17
db 10, 10, 16, 25, 17
dw $1300, 1300, $1400
db 1, 64
db 10, 16, 25, 17
db 10, 10, 16, 25, 17
dw $1600, 1600, $1700
db 1, 85
db 10, 16, 25, 17
db 10, 10, 16, 25, 17
dw $1900, 1900, $2000
db 1, 128
db 10, 16, 25, 17
db 10, 10, 16, 25, 17
dw $2900, 2900, $3000
db 1, $FF
db 10, 16, 25, 17
db 10, 10, 16, 25, 17
dw $3333, 3333, $3400
db 2, $FF
db 10, 12, 25, 17
db 10, 10, 12, 25, 17
dw $4444, 4444, $4500
db 3, $FF
db 10, 12, 25, 17
db 10, 10, 12, 25, 17
dw $5555, 5555, $5600
db 4, $FF
db 10, 12, 25, 17
db 10, 10, 12, 25, 17
dw $6666, 6666, $6700
db 5, $FF
db 10, 12, 25, 17
db 10, 10, 12, 25, 17
dw $7777, 7777, $7800
db 20, $FF
db 10, 8, 25, 17
db 10, 10, 8, 25, 17
dw $8888, 8888, $8900
db 20, $FF
db 10, 6, 18, 17
db 10, 10, 6, 18, 17
dw $9999, 9999, $9999
db 20, $FF
db 5, 6, 14, 10
db 5, 5, 6, 14, 10
sCHILSpeedCurveEnd::
dw $FFFF
@ -352,151 +361,151 @@ sCHILSpeedCurveEnd::
sTGM3SpeedCurve::
dw $0000, 0, $0100
db 1, 4
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0030, 30, $0100
db 1, 6
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0035, 35, $0100
db 1, 8
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0040, 40, $0100
db 1, 10
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0050, 50, $0100
db 1, 12
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0060, 60, $0100
db 1, 16
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0070, 70, $0100
db 1, 32
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0080, 80, $0100
db 1, 48
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0090, 90, $0100
db 1, 64
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0100, 100, $0200
db 1, 80
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0120, 120, $0200
db 1, 96
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0140, 140, $0200
db 1, 112
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0160, 160, $0200
db 1, 128
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0170, 170, $0200
db 1, 144
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0200, 200, $0300
db 1, 4
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0220, 220, $0300
db 1, 32
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0230, 230, $0300
db 1, 64
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0233, 233, $0300
db 1, 96
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0236, 236, $0300
db 1, 128
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0239, 239, $0300
db 1, 160
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0243, 243, $0300
db 1, 192
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0247, 239, $0300
db 1, 224
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0251, 251, $0300
db 1, $FF
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0300, 300, $0400
db 2, $FF
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0330, 330, $0400
db 3, $FF
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0360, 360, $0400
db 4, $FF
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0400, 400, $0500
db 5, $FF
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0420, 420, $0500
db 4, $FF
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0450, 450, $0500
db 3, $FF
db 27, 16, 30, 40
db 27, 27, 16, 30, 40
dw $0500, 500, $0600
db 20, $FF
db 27, 16, 30, 40
db 27, 27, 10, 30, 25
dw $0600, 600, $0700
db 20, $FF
db 27, 10, 30, 7
db 27, 18, 10, 30, 16
dw $0700, 700, $0800
db 20, $FF
db 18, 10, 30, 7
db 18, 14, 10, 30, 12
dw $0800, 800, $0900
db 20, $FF
db 14, 10, 30, 1
db 14, 8, 10, 30, 6
dw $0900, 900, $1000
db 20, $FF
db 14, 8, 18, 1
db 14, 8, 8, 17, 6
dw $1000, 1000, $1100
db 20, $FF
db 8, 8, 18, 6
db 8, 8, 8, 17, 6
dw $1100, 1000, $1200
db 20, $FF
db 7, 8, 14, 6
db 7, 7, 8, 15, 6
dw $1200, 1000, $1300
db 20, $FF
db 6, 8, 14, 6
db 6, 6, 8, 15, 6
sTGM3SpeedCurveEnd::
dw $FFFF
@ -504,27 +513,27 @@ sTGM3SpeedCurveEnd::
sDEATSpeedCurve::
dw $0000, 0, $0100
db 20, $FF
db 18, 12, 30, 12
db 18, 14, 12, 30, 12
dw $0100, 0, $0200
db 20, $FF
db 14, 12, 25, 1
db 14, 8, 12, 26, 6
dw $0200, 0, $0300
db 20, $FF
db 14, 11, 20, 1
db 14, 8, 11, 22, 6
dw $0300, 0, $0400
db 20, $FF
db 8, 10, 18, 6
db 8, 8, 10, 18, 6
dw $0400, 0, $0500
db 20, $FF
db 7, 8, 14, 5
db 7, 7, 8, 15, 5
dw $0500, 0, $0600
db 20, $FF
db 6, 8, 14, 4
db 6, 6, 8, 15, 4
sDEATSpeedCurveEnd::
dw $FFFF
@ -532,198 +541,199 @@ sDEATSpeedCurveEnd::
sSHIRSpeedCurve::
dw $0000, 0, $0100
db 20, $FF
db 12, 10, 18, 6
db 12, 8, 10, 18, 6
dw $0100, 100, $0200
db 20, $FF
db 12, 8, 18, 5
db 12, 7, 8, 18, 5
dw $0200, 200, $0300
db 20, $FF
db 12, 8, 16, 4
db 12, 6, 8, 17, 4
dw $0300, 300, $0400
db 20, $FF
db 6, 8, 14, 4
db 6, 6, 8, 15, 4
dw $0500, 500, $0600
db 20, $FF
db 6, 6, 12, 2
db 6, 5, 6, 13, 3
dw $1100, 1100, $1200
db 20, $FF
db 6, 6, 10, 2
db 6, 5, 6, 10, 3
dw $1200, 1200, $1300
db 20, $FF
db 6, 6, 8, 2
db 6, 5, 6, 8, 3
sSHIRSpeedCurveEnd::
dw $FFFF
sSpeedCurve:: ; Speed curve of the game.
sDMGTSpeedCurve:: ; Speed curve of the game.
dw $0000, 0, $0100 ; Level 0000
db 1, 16
db 25, 14, 30, 40
db 25, 15, 14, 30, 40
dw $0015, 15, $0100 ; Level 0015
db 1, 17
db 25, 14, 30, 40
db 25, 15, 14, 30, 40
dw $0030, 30, $0100 ; Level 0030
db 1, 18
db 25, 14, 30, 40
db 25, 15, 14, 30, 40
dw $0040, 40, $0100 ; Level 0040
db 1, 20
db 25, 14, 30, 40
db 25, 15, 14, 30, 40
dw $0050, 50, $0100 ; Level 0050
db 1, 21
db 25, 14, 30, 40
db 25, 15, 14, 30, 40
dw $0060, 60, $0100 ; Level 0060
db 1, 23
db 25, 14, 30, 40
db 25, 15, 14, 30, 40
dw $0070, 70, $0100 ; Level 0070
db 1, 26
db 25, 14, 30, 40
db 25, 15, 14, 30, 40
dw $0080, 80, $0100 ; Level 0080
db 1, 28
db 25, 14, 30, 40
db 25, 15, 14, 30, 40
dw $0090, 90, $0100 ; Level 0090
db 1, 32
db 25, 14, 30, 40
db 25, 15, 14, 30, 40
dw $0100, 100, $0200 ; Level 0100
db 1, 37
db 25, 14, 30, 40
db 25, 15, 14, 30, 40
dw $0150, 150, $0200 ; Level 0150
db 1, 43
db 25, 14, 30, 40
db 25, 15, 14, 30, 40
dw $0200, 200, $0300 ; Level 0200
db 1, 51
db 25, 14, 30, 40
db 25, 15, 14, 30, 40
dw $0225, 225, $0300 ; Level 0225
db 1, 64
db 25, 14, 30, 40
db 25, 15, 14, 30, 40
dw $0250, 250, $0300 ; Level 0250
db 1, 85
db 25, 14, 30, 40
db 25, 15, 14, 30, 40
dw $0275, 275, $0300 ; Level 0275
db 1, 128
db 25, 14, 30, 40
db 25, 15, 14, 30, 40
dw $0300, 300, $0400 ; Level 0300
db 1, $FF
db 25, 14, 30, 32
db 25, 7, 14, 30, 32
dw $0350, 350, $0350 ; Level 0350
db 2, $FF
db 25, 14, 30, 32
db 25, 7, 14, 30, 32
dw $0400, 400, $0400 ; Level 0400
db 3, $FF
db 25, 14, 30, 32
db 25, 7, 14, 30, 32
dw $0450, 450, $0500 ; Level 0450
db 4, $FF
db 25, 14, 30, 32
db 25, 7, 14, 30, 32
dw $0475, 475, $0500 ; Level 0475
db 5, $FF
db 25, 14, 30, 32
db 25, 7, 14, 30, 32
dw $0500, 500, $0600 ; Level 0500
db 20, $FF
db 25, 14, 30, 24
db 25, 6, 14, 30, 24
dw $0600, 600, $0700 ; Level 0600
db 20, $FF
db 25, 8, 30, 24
db 25, 6, 8, 30, 24
dw $0700, 700, $0800 ; Level 0700
db 20, $FF
db 20, 8, 30, 24
db 20, 6, 8, 30, 24
dw $0900, 900, $1000 ; Level 0900
db 20, $FF
db 16, 6, 25, 16
db 16, 4, 6, 25, 16
dw $1100, 1100, $1200 ; Level 1100
db 20, $FF
db 12, 6, 25, 16
db 12, 4, 6, 25, 16
dw $1200, 1200, $1300 ; Level 1200
db 20, $FF
db 12, 6, 25, 8
db 12, 4, 6, 25, 8
dw $1300, 1300, $1400 ; Level 1300
db 20, $FF
db 10, 6, 20, 7
db 10, 4, 6, 20, 7
dw $1400, 1400, $1500 ; Level 1400
db 20, $FF
db 10, 6, 18, 6
db 10, 4, 6, 18, 6
dw $1500, 1500, $1600 ; Level 1500
db 20, $FF
db 8, 4, 16, 5
db 8, 4, 4, 16, 5
dw $1600, 1600, $1700 ; Level 1600
db 20, $FF
db 8, 4, 14, 4
db 8, 4, 4, 14, 4
dw $1700, 1700, $1800 ; Level 1700
db 20, $FF
db 6, 4, 12, 3
db 6, 4, 4, 12, 3
dw $1800, 1800, $1900 ; Level 1800
db 20, $FF
db 6, 4, 10, 3
db 6, 4, 4, 10, 3
dw $1900, 1900, $2000 ; Level 1900
db 20, $FF
db 4, 4, 8, 3
db 4, 4, 4, 8, 3
dw $2000, 2000, $2100 ; Level 2000
db 20, $FF
db 4, 3, 8, 3
db 4, 4, 3, 8, 3
dw $2500, 2500, $2600 ; Level 2500
db 20, $FF
db 2, 1, 8, 2
db 2, 2, 1, 8, 2
dw $3000, 3000, $3100 ; Level 3000
db 20, $FF
db 1, 1, 8, 1
db 1, 1, 1, 8, 1
dw $4000, 4000, $4100 ; Level 4000
db 20, $FF
db 1, 1, 6, 1
db 1, 1, 1, 6, 1
dw $5000, 5000, $5100 ; Level 5000
db 20, $FF
db 1, 1, 4, 1
db 1, 1, 1, 4, 1
dw $6666, 6666, $6700 ; Level 6666
db 20, $FF
db 1, 1, 2, 1
db 1, 1, 1, 2, 1
dw $9999, 9999, $9999 ; Level 9999
db 20, $FF
db 1, 1, 1, 1
db 1, 1, 1, 1, 1
sDMGTSpeedCurveEnd::
dw $FFFF ; End.
sSpeedCurveEnd::
dw $FFFF ; End.
sPieceFastRotationStates::

View File

@ -1527,36 +1527,14 @@ FieldProcess::
GetTileShade:
; Possible values for tile delay:
; 30, 25, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 1
; We don't need to handle the 1 case.
ld a, 0
ld b, a
: ldh a, [hCurrentLockDelay]
ldh a, [hCurrentLockDelay]
cp a, 30
jr z, .max30
: cp a, 25
jr z, .max25
: cp a, 20
jr z, .max20
: cp a, 18
jp z, .max18
: cp a, 16
jp z, .max16
: cp a, 14
jp z, .max14
: cp a, 12
jp z, .max12
: cp a, 10
jp z, .max10
: cp a, 8
jp z, .max8
: cp a, 6
jp z, .max6
: cp a, 4
jp z, .max4
: cp a, 2
jp z, .max2
jr nc, .max30
cp a, 20
jr nc, .max20
cp a, 10
jr nc, .max10
jr .max0
ret
.max30
ldh a, [hCurrentLockDelayRemaining]
@ -1565,136 +1543,34 @@ GetTileShade:
cp a, 8
jp c, .s6
cp a, 12
jp c, .s5
jr c, .s5
cp a, 16
jp c, .s4
jr c, .s4
cp a, 20
jp c, .s3
jr c, .s3
cp a, 24
jp c, .s2
jr c, .s2
cp a, 28
jp c, .s1
jp .s0
.max25
ldh a, [hCurrentLockDelayRemaining]
cp a, 3
ret c
cp a, 6
jp c, .s6
cp a, 9
jp c, .s5
cp a, 12
jp c, .s4
cp a, 15
jp c, .s3
cp a, 18
jp c, .s2
cp a, 21
jp c, .s1
jp .s0
jr c, .s1
jr .s0
.max20
ldh a, [hCurrentLockDelayRemaining]
cp a, 2
ret c
cp a, 5
jp c, .s6
jr c, .s6
cp a, 7
jp c, .s5
cp a, 10
jp c, .s4
cp a, 12
jp c, .s3
cp a, 15
jp c, .s2
cp a, 17
jp c, .s1
jp .s0
.max18
ldh a, [hCurrentLockDelayRemaining]
cp a, 2
ret c
cp a, 4
jp c, .s6
cp a, 6
jp c, .s5
cp a, 9
jp c, .s4
cp a, 11
jp c, .s3
cp a, 13
jp c, .s2
cp a, 15
jp c, .s1
jp .s0
.max16
ldh a, [hCurrentLockDelayRemaining]
cp a, 2
ret c
cp a, 4
jp c, .s6
cp a, 6
jp c, .s5
cp a, 8
jp c, .s4
cp a, 10
jp c, .s3
cp a, 12
jp c, .s2
cp a, 14
jp c, .s1
jp .s0
.max14
ldh a, [hCurrentLockDelayRemaining]
cp a, 2
ret c
cp a, 4
jp c, .s6
cp a, 6
jp c, .s5
cp a, 7
jp c, .s4
cp a, 9
jp c, .s3
cp a, 11
jp c, .s2
cp a, 13
jp c, .s1
jp .s0
.max12
ldh a, [hCurrentLockDelayRemaining]
cp a, 1
ret c
cp a, 3
jp c, .s6
cp a, 4
jp c, .s5
cp a, 6
jp c, .s4
cp a, 7
jp c, .s3
cp a, 9
jp c, .s2
cp a, 10
jp c, .s1
jp .s0
.max10
ldh a, [hCurrentLockDelayRemaining]
cp a, 1
ret c
cp a, 2
jp c, .s6
cp a, 3
jr c, .s5
cp a, 5
cp a, 10
jr c, .s4
cp a, 6
cp a, 12
jr c, .s3
cp a, 7
cp a, 15
jr c, .s2
cp a, 8
cp a, 17
jr c, .s1
jr .s0
.max8
.max10
ldh a, [hCurrentLockDelayRemaining]
cp a, 1
ret c
@ -1702,36 +1578,16 @@ GetTileShade:
jr c, .s6
cp a, 3
jr c, .s5
cp a, 4
jr c, .s4
cp a, 5
jr c, .s3
jr c, .s4
cp a, 6
jr c, .s2
cp a, 7
jr c, .s1
jr .s0
.max6
ldh a, [hCurrentLockDelayRemaining]
cp a, 1
ret c
cp a, 2
jr c, .s5
cp a, 3
jr c, .s3
cp a, 4
cp a, 7
jr c, .s2
cp a, 5
cp a, 8
jr c, .s1
jr .s0
.max4
ldh a, [hCurrentLockDelayRemaining]
cp a, 1
ret c
cp a, 2
jr c, .s4
jr .s0
.max2
.max0
jr .s4
.s0
ldh a, [hCurrentPiece]
@ -1974,7 +1830,7 @@ FieldDelay::
ld a, SFX_LINE_CLEAR
call SFXEnqueue
: ldh a, [hCurrentARE]
: ldh a, [hCurrentLineARE]
ldh [hRemainingDelay], a

View File

@ -924,9 +924,11 @@ GBCGameplayProcess::
.black
ld a, OCPSF_AUTOINC | (7*8)+(3*2)
ldh [rOCPS], a
xor a, a
ld bc, R2 | B0
wait_vram
ld a, c
ldh [rOCPD], a
ld a, b
ldh [rOCPD], a
ret

View File

@ -119,6 +119,9 @@ DEF SCORE_BASE_Y EQU 115
DEF LEVEL_BASE_X EQU 120
DEF CLEVEL_BASE_Y EQU 136
DEF NLEVEL_BASE_Y EQU 148
DEF TELLS_BASE_X EQU 154
DEF TELLS_BASE_Y EQU 64
DEF TELLS_Y_DIST EQU 10
; Piece names
DEF PIECE_I EQU 0
@ -153,6 +156,7 @@ DEF TILE_CLEARING EQU 124
DEF TILE_GHOST EQU 125
DEF TILE_SELECTED EQU 193
DEF TILE_UNSELECTED EQU 194
DEF TILE_BLANK EQU 1
; Button mode.
DEF BUTTON_MODE_NORM EQU 0
@ -185,6 +189,7 @@ DEF DROP_MODE_NONE EQU 4
DEF DROP_MODE_COUNT EQU 5
; Speed curve selection.
DEF SCURVE_ENTRY_SIZE EQU 13
DEF SCURVE_DMGT EQU 0
DEF SCURVE_TGM1 EQU 1
DEF SCURVE_TGM3 EQU 2

View File

@ -25,6 +25,7 @@ INCLUDE "globals.asm"
SECTION "High Level Variables", HRAM
hCurrentDAS:: ds 1
hCurrentARE:: ds 1
hCurrentLineARE:: ds 1
hCurrentLockDelay:: ds 1
hCurrentLineClearDelay:: ds 1
hCurrentIntegerGravity:: ds 1
@ -336,6 +337,8 @@ DoSpeedUp:
ld a, [hl+]
ldh [hCurrentARE], a
ld a, [hl+]
ldh [hCurrentLineARE], a
ld a, [hl+]
ldh [hCurrentDAS], a
ld a, [hl+]
ldh [hCurrentLockDelay], a

Binary file not shown.

View File

@ -270,7 +270,7 @@ Tiles::
DB $24,$3C,$24,$3C,$18,$18,$00,$00
DB $FF,$FF,$AA,$FF,$00,$FF,$AA,$55
DB $00,$FF,$55,$FF,$FF,$FF,$00,$00
DB $DB,$E7,$A5,$C3,$42,$81,$81,$00
DB $DB,$E7,$A5,$C3,$42,$81,$91,$00
DB $42,$81,$A5,$C3,$DB,$E7,$00,$00
DB $44,$44,$FE,$FE,$44,$44,$44,$44
DB $44,$44,$FE,$FE,$44,$44,$00,$00

View File

@ -30,25 +30,42 @@ wSPRNext1:: ds 4
wSPRNext2:: ds 4
wSPRNext3:: ds 4
wSPRNext4:: ds 4
wUnused0:: ds 4
wUnused1:: ds 4
wSPRHold1:: ds 4
wSPRHold2:: ds 4
wSPRHold3:: ds 4
wSPRHold4:: ds 4
wUnused2:: ds 4
wUnused3:: ds 4
wSPRScore1:: ds 4
wSPRScore2:: ds 4
wSPRScore3:: ds 4
wSPRScore4:: ds 4
wSPRScore5:: ds 4
wSPRScore6:: ds 4
wUnused4:: ds 4
wUnused5:: ds 4
wSPRCLevel1:: ds 4
wSPRCLevel2:: ds 4
wSPRCLevel3:: ds 4
wSPRCLevel4:: ds 4
wUnused6:: ds 4
wUnused7:: ds 4
wSPRNLevel1:: ds 4
wSPRNLevel2:: ds 4
wSPRNLevel3:: ds 4
wSPRNLevel4:: ds 4
wSPRUnused:: ds (16 * 4)
wUnused8:: ds 4
wUnused9:: ds 4
wUnusedA:: ds 4
wUnusedB:: ds 4
wUnusedC:: ds 4
wUnusedD:: ds 4
wSPRModeRNG:: ds 4
wSPRModeRot:: ds 4
wSPRModeDrop:: ds 4
wSPRModeHiG:: ds 4
ENDU
@ -95,6 +112,49 @@ ClearOAM::
SECTION "Domain Specific Functions", ROM0
ApplyTells::
ld a, TELLS_BASE_Y
ld [wSPRModeRNG], a
add a, TELLS_Y_DIST
ld [wSPRModeRot], a
add a, TELLS_Y_DIST
ld [wSPRModeDrop], a
add a, TELLS_Y_DIST
ld [wSPRModeHiG], a
ld a, TELLS_BASE_X
ld [wSPRModeRNG+1], a
ld [wSPRModeRot+1], a
ld [wSPRModeDrop+1], a
ld [wSPRModeHiG+1], a
ld a, [wRNGModeState]
add a, TILE_RNG_MODE_BASE
ld [wSPRModeRNG+2], a
ld a, [wRotModeState]
add a, TILE_ROT_MODE_BASE
ld [wSPRModeRot+2], a
ld a, [wDropModeState]
add a, TILE_DROP_MODE_BASE
ld [wSPRModeDrop+2], a
ld a, [wAlways20GState]
add a, TILE_HIG_MODE_BASE
ld [wSPRModeHiG+2], a
ld a, 1
ld [wSPRModeRNG+3], a
ld a, 3
ld [wSPRModeRot+3], a
ld a, 4
ld [wSPRModeDrop+3], a
ld a, 0
ld [wSPRModeHiG+3], a
ret
; Index of next piece in A.
ApplyNext::
; Correct color
@ -105,11 +165,13 @@ ApplyNext::
; Correct tile
add a, TILE_PIECE_0
add a, 7
ld [wSPRNext1+2], a
ld [wSPRNext2+2], a
ld [wSPRNext3+2], a
ld [wSPRNext4+2], a
sub a, TILE_PIECE_0
sub a, 7
; X positions
ld hl, sPieceXOffsets
@ -176,6 +238,28 @@ ApplyHold::
ld [wSPRHold4+3], a
; Correct tile
ld b, a
ld a, [wInitialA]
cp a, $11
ld a, b
jr z, .show
ldh a, [hEvenFrame]
cp a, 0
ld a, b
jr z, .show
.hide
ld b, a
ld a, TILE_BLANK
ld [wSPRHold1+2], a
ld [wSPRHold2+2], a
ld [wSPRHold3+2], a
ld [wSPRHold4+2], a
ld a, b
jr .x
.show
add a, TILE_PIECE_0
ld [wSPRHold1+2], a
ld [wSPRHold2+2], a
@ -184,6 +268,7 @@ ApplyHold::
sub a, TILE_PIECE_0
; X positions
.x
ld hl, sPieceXOffsets
ld de, sPieceYOffsets
cp 0

View File

@ -23,7 +23,6 @@ INCLUDE "globals.asm"
SECTION "Persistent Globals", SRAM
rMagic:: ds 4
rCheck:: ds 6
rSwapABState:: ds 1
rRNGModeState:: ds 1
@ -35,16 +34,61 @@ rSelectedStartLevel:: ds 2
SECTION "SRAM Functions", ROM0
RestoreSRAM::
; Check if our SRAM is initialized and of the correct version.
ld a, [rCheck]
cp a, LOW(__UTC_YEAR__)
jr nz, InitializeSRAM
ld a, [rCheck+1]
cp a, __UTC_MONTH__
jr nz, InitializeSRAM
ld a, [rCheck+2]
cp a, __UTC_DAY__
jr nz, InitializeSRAM
ld a, [rCheck+3]
cp a, __UTC_HOUR__
jr nz, InitializeSRAM
ld a, [rCheck+4]
cp a, __UTC_MINUTE__
jr nz, InitializeSRAM
ld a, [rCheck+5]
cp a, __UTC_SECOND__
jr nz, InitializeSRAM
; SRAM is initialized and for this build, so we can load the data.
ld a, [rSwapABState]
ld [wSwapABState], a
ld a, [rRNGModeState]
ld [wRNGModeState], a
ld a, [rRotModeState]
ld [wRotModeState], a
ld a, [rDropModeState]
ld [wDropModeState], a
ld a, [rSpeedCurveState]
ld [wSpeedCurveState], a
ld a, [rAlways20GState]
ld [wAlways20GState], a
ld a, [rSelectedStartLevel]
ldh [hStartSpeed], a
ld a, [rSelectedStartLevel+1]
ldh [hStartSpeed+1], a
ret
InitializeSRAM:
; Set the magic id.
ld a, SAVE_MAGIC_0
ld [rMagic], a
ld a, SAVE_MAGIC_1
ld [rMagic+1], a
ld a, SAVE_MAGIC_2
ld [rMagic+2], a
ld a, SAVE_MAGIC_3
ld [rMagic+3], a
ld a, LOW(__UTC_YEAR__)
ld [rCheck], a
ld a, __UTC_MONTH__
ld [rCheck+1], a
ld a, __UTC_DAY__
ld [rCheck+2], a
ld a, __UTC_HOUR__
ld [rCheck+3], a
ld a, __UTC_MINUTE__
ld [rCheck+4], a
ld a, __UTC_SECOND__
ld [rCheck+5], a
; Load defaults.
ld a, BUTTON_MODE_NORM
@ -70,26 +114,9 @@ InitializeSRAM:
ld a, HIG_MODE_OFF
ld [rAlways20GState], a
ld [wAlways20GState], a
; Falls through to the next label!
PartiallyInitializeSRAM:
; Save build data.
ld a, LOW(__UTC_YEAR__)
ld [rCheck], a
ld a, __UTC_MONTH__
ld [rCheck+1], a
ld a, __UTC_DAY__
ld [rCheck+2], a
ld a, __UTC_HOUR__
ld [rCheck+3], a
ld a, __UTC_MINUTE__
ld [rCheck+4], a
ld a, __UTC_SECOND__
ld [rCheck+5], a
; Set to the default start level.
ld hl, sSpeedCurve
ld hl, sDMGTSpeedCurve
ld a, l
ldh [hStartSpeed], a
ld [rSelectedStartLevel], a
@ -98,63 +125,4 @@ PartiallyInitializeSRAM:
ld [rSelectedStartLevel+1], a
ret
RestoreSRAM::
; Check if our SRAM is initialized at all.
; If not, we load all the defaults.
ld a, [rMagic]
cp a, SAVE_MAGIC_0
jr nz, InitializeSRAM
ld a, [rMagic+1]
cp a, SAVE_MAGIC_1
jr nz, InitializeSRAM
ld a, [rMagic+2]
cp a, SAVE_MAGIC_2
jp nz, InitializeSRAM
ld a, [rMagic+3]
cp a, SAVE_MAGIC_3
jp nz, InitializeSRAM
; If SRAM is initialized, we still need to check if it's for this exact build.
; If not, wipe data that is no longer valid.
ld a, [rCheck]
cp a, LOW(__UTC_YEAR__)
jr nz, PartiallyInitializeSRAM
ld a, [rCheck+1]
cp a, __UTC_MONTH__
jr nz, PartiallyInitializeSRAM
ld a, [rCheck+2]
cp a, __UTC_DAY__
jr nz, PartiallyInitializeSRAM
ld a, [rCheck+3]
cp a, __UTC_HOUR__
jr nz, PartiallyInitializeSRAM
ld a, [rCheck+4]
cp a, __UTC_MINUTE__
jr nz, PartiallyInitializeSRAM
ld a, [rCheck+5]
cp a, __UTC_SECOND__
jr nz, PartiallyInitializeSRAM
; SRAM is initialized and for this build, so we can load the data.
ld a, [rSwapABState]
ld [wSwapABState], a
ld a, [rRNGModeState]
ld [wRNGModeState], a
ld a, [rRotModeState]
ld [wRotModeState], a
ld a, [rDropModeState]
ld [wDropModeState], a
ld a, [rSpeedCurveState]
ld [wSpeedCurveState], a
ld a, [rAlways20GState]
ld [wAlways20GState], a
ld a, [rSelectedStartLevel]
ldh [hStartSpeed], a
ld a, [rSelectedStartLevel+1]
ldh [hStartSpeed+1], a
ret
ENDC

View File

@ -63,27 +63,10 @@ SwitchToGameplay::
ld bc, GameplayTilemapEnd - GameplayTilemap
call UnsafeMemCopy
; Place a tell on the screen for modes.
ld hl, FIELD_RNG
ld a, [wRNGModeState]
add a, TILE_RNG_MODE_BASE
ld [hl], a
ld hl, FIELD_ROT
ld a, [wRotModeState]
add a, TILE_ROT_MODE_BASE
ld [hl], a
ld hl, FIELD_DROP
ld a, [wDropModeState]
add a, TILE_DROP_MODE_BASE
ld [hl], a
ld hl, FIELD_HIG
ld a, [wAlways20GState]
add a, TILE_HIG_MODE_BASE
ld [hl], a
; Clear OAM.
call ClearOAM
call SetNumberSpritePositions
call ApplyTells
; Set up the palettes.
ld a, PALETTE_REGULAR
@ -473,6 +456,32 @@ preGameOverMode:
ld [hl+], a
.skip7\@
ENDR
; Place a tell on the screen for modes.
ld hl, FIELD_RNG
wait_vram
ld a, [wRNGModeState]
add a, TILE_RNG_MODE_BASE
ld [hl], a
ld hl, FIELD_ROT
wait_vram
ld a, [wRotModeState]
add a, TILE_ROT_MODE_BASE
ld [hl], a
ld hl, FIELD_DROP
wait_vram
ld a, [wDropModeState]
add a, TILE_DROP_MODE_BASE
ld [hl], a
ld hl, FIELD_HIG
wait_vram
ld a, [wAlways20GState]
add a, TILE_HIG_MODE_BASE
ld [hl], a
ld a, MODE_GAME_OVER
ldh [hMode], a

View File

@ -313,7 +313,7 @@ DecrementLevel:
ld l, a
ldh a, [hStartSpeed+1]
ld h, a
ld bc, -12
ld bc, -SCURVE_ENTRY_SIZE
add hl, bc
ld a, l
ldh [hStartSpeed], a
@ -428,7 +428,7 @@ IncrementLevel:
ld l, a
ldh a, [hStartSpeed+1]
ld h, a
ld bc, 12
ld bc, SCURVE_ENTRY_SIZE
add hl, bc
ld a, l
ldh [hStartSpeed], a
@ -457,7 +457,7 @@ GetEnd:
ld a, [wSpeedCurveState]
cp a, SCURVE_DMGT
jr nz, :+
ld bc, sSpeedCurveEnd
ld bc, sDMGTSpeedCurveEnd
ret
: cp a, SCURVE_TGM1
jr nz, :+
@ -482,7 +482,7 @@ GetStart:
ld a, [wSpeedCurveState]
cp a, SCURVE_DMGT
jr nz, :+
ld hl, sSpeedCurve
ld hl, sDMGTSpeedCurve
ret
: cp a, SCURVE_TGM1
jr nz, :+
@ -521,7 +521,7 @@ CheckLevelRange:
ldh [hStartSpeed+1], a
.notatend
ld de, -12
ld de, -SCURVE_ENTRY_SIZE
call GetStart
add hl, de