Add special mode endings.

This commit is contained in:
Randy Thiemann 2023-11-08 22:35:08 +01:00
parent 61dcceb09c
commit eda0b6353c
15 changed files with 3472 additions and 3201 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1771,17 +1771,26 @@ FieldProcess::
pop de pop de
call DrawPiece call DrawPiece
; Bones?
.postghost .postghost
; Draw pieces as bones past 1000 when in Shirase. ld a, [wBonesActive]
ld a, [wSpeedCurveState] cp a, $FF
cp a, SCURVE_SHIR
jr nz, .nobone jr nz, .nobone
ldh a, [hCLevel+CLEVEL_THOUSANDS]
cp a, 1
jr c, .nobone
ld a, TILE_BONE ld a, TILE_BONE
ld [hWantedTile], a ld [hWantedTile], a
jp .drawpiece
; Is lock delay 0 and is invis mode active?
ld a, [wInvisActive]
cp a, $FF
jr nz, .drawpiece
ldh a, [hCurrentLockDelayRemaining]
cp a, 0
jr nz, .drawpiece
; Then bones are made invis.
ld a, TILE_INVIS
ld [hWantedTile], a
jr .drawpiece
; If the lock delay is at the highest value, draw the piece normally. ; If the lock delay is at the highest value, draw the piece normally.
.nobone .nobone
@ -1806,9 +1815,18 @@ FieldProcess::
ldh [hWantedTile], a ldh [hWantedTile], a
ldh a, [hCurrentLockDelayRemaining] ldh a, [hCurrentLockDelayRemaining]
cp a, 0 cp a, 0
jr z, .drawpiece jr nz, .notlocked
; This might be invisible!
ld a, [wInvisActive]
cp a, $FF
jr nz, .drawpiece
ld a, TILE_INVIS
ld [hWantedTile], a
jr .drawpiece
; Otherwise, look it up. ; Otherwise, look it up.
.notlocked
call GetTileShade call GetTileShade
.drawpiece .drawpiece
@ -4007,17 +4025,26 @@ BigFieldProcess::
pop de pop de
call BigDrawPiece call BigDrawPiece
; Bones?
.postghost .postghost
; Draw pieces as bones past 1000 when in Shirase. ld a, [wBonesActive]
ld a, [wSpeedCurveState] cp a, $FF
cp a, SCURVE_SHIR
jr nz, .nobone jr nz, .nobone
ld a, [hCLevel+CLEVEL_THOUSANDS]
cp a, 1
jr c, .nobone
ld a, TILE_BONE ld a, TILE_BONE
ld [hWantedTile], a ld [hWantedTile], a
jp .drawpiece
; Is lock delay 0 and is invis mode active?
ld a, [wInvisActive]
cp a, $FF
jr nz, .drawpiece
ldh a, [hCurrentLockDelayRemaining]
cp a, 0
jr nz, .drawpiece
; Then bones are made invis.
ld a, TILE_INVIS
ld [hWantedTile], a
jr .drawpiece
; If the lock delay is at the highest value, draw the piece normally. ; If the lock delay is at the highest value, draw the piece normally.
.nobone .nobone
@ -4042,9 +4069,18 @@ BigFieldProcess::
ldh [hWantedTile], a ldh [hWantedTile], a
ldh a, [hCurrentLockDelayRemaining] ldh a, [hCurrentLockDelayRemaining]
cp a, 0 cp a, 0
jr z, .drawpiece jr nz, .notlocked
; This might be invisible!
ld a, [wInvisActive]
cp a, $FF
jr nz, .drawpiece
ld a, TILE_INVIS
ld [hWantedTile], a
jr .drawpiece
; Otherwise, look it up. ; Otherwise, look it up.
.notlocked
call BigGetTileShade call BigGetTileShade
.drawpiece .drawpiece

View File

@ -199,12 +199,12 @@ sDMGTGrading:
db 15, 2, 12, 15, 30 ; Grade m5 — frames/decay, single base, double base, triple base, tetris base db 15, 2, 12, 15, 30 ; Grade m5 — frames/decay, single base, double base, triple base, tetris base
db 15, 2, 12, 15, 30 ; Grade m6 — frames/decay, single base, double base, triple base, tetris base db 15, 2, 12, 15, 30 ; Grade m6 — frames/decay, single base, double base, triple base, tetris base
db 15, 2, 12, 15, 30 ; Grade m7 — frames/decay, single base, double base, triple base, tetris base db 15, 2, 12, 15, 30 ; Grade m7 — frames/decay, single base, double base, triple base, tetris base
db 15, 2, 12, 15, 30 ; Grade m8 — frames/decay, single base, double base, triple base, tetris base db 10, 2, 12, 15, 30 ; Grade m8 — frames/decay, single base, double base, triple base, tetris base
db 15, 2, 12, 15, 30 ; Grade m9 — frames/decay, single base, double base, triple base, tetris base db 5, 2, 12, 15, 30 ; Grade m9 — frames/decay, single base, double base, triple base, tetris base
db 10, 2, 12, 13, 30 ; Grade M — frames/decay, single base, double base, triple base, tetris base db 5, 2, 12, 13, 30 ; Grade M — frames/decay, single base, double base, triple base, tetris base
db 10, 2, 12, 13, 30 ; Grade MK — frames/decay, single base, double base, triple base, tetris base db 5, 2, 12, 13, 30 ; Grade MK — frames/decay, single base, double base, triple base, tetris base
db 10, 2, 12, 13, 30 ; Grade MV — frames/decay, single base, double base, triple base, tetris base db 5, 2, 12, 13, 30 ; Grade MV — frames/decay, single base, double base, triple base, tetris base
db 10, 2, 12, 13, 30 ; Grade MO — frames/decay, single base, double base, triple base, tetris base db 5, 2, 12, 13, 30 ; Grade MO — frames/decay, single base, double base, triple base, tetris base
db 5, 2, 8, 10, 20 ; Grade MM — frames/decay, single base, double base, triple base, tetris base db 5, 2, 8, 10, 20 ; Grade MM — frames/decay, single base, double base, triple base, tetris base
; No entry for GM. We're done there. ; No entry for GM. We're done there.
@ -304,8 +304,6 @@ DecayGradeProcess::
no_jump ;MYCO no_jump ;MYCO
; Jumps to the grade decay function for the current mode. ; Jumps to the grade decay function for the current mode.
; Called once per frame during ARE and line clear delay. ; Called once per frame during ARE and line clear delay.
DecayGradeDelay:: DecayGradeDelay::

View File

@ -74,6 +74,10 @@ CHARMAP "c", 209
CHARMAP "d", 210 CHARMAP "d", 210
CHARMAP "m", 211 CHARMAP "m", 211
CHARMAP ":", 212 CHARMAP ":", 212
CHARMAP "k", 47
CHARMAP "v", 45
CHARMAP "o", 44
CHARMAP "n", 46
; Waits for PPU mode to be 0 or 1. ; Waits for PPU mode to be 0 or 1.
@ -232,6 +236,7 @@ DEF TILE_PIECE_SMALL_0 EQU 116
DEF TILE_PIECE_BONE EQU 104 DEF TILE_PIECE_BONE EQU 104
DEF TILE_SMALL_0 EQU 213 DEF TILE_SMALL_0 EQU 213
DEF TILE_BONE EQU 104 DEF TILE_BONE EQU 104
DEF TILE_INVIS EQU 255
DEF TILE_QUEUE_BONE EQU 105 DEF TILE_QUEUE_BONE EQU 105
DEF TILE_ROT_MODE_MYCO EQU 253 DEF TILE_ROT_MODE_MYCO EQU 253
DEF GAME_OVER_R10 EQU 147 DEF GAME_OVER_R10 EQU 147

View File

@ -39,6 +39,13 @@ hCLevel:: ds 4
hNLevel:: ds 6 ; The extra 2 bytes will be clobbered by the sprite drawing functions. hNLevel:: ds 6 ; The extra 2 bytes will be clobbered by the sprite drawing functions.
hPrevHundreds:: ds 1 hPrevHundreds:: ds 1
SECTION "Level Variables", WRAM0
wBoneActivationLevel: ds 2
wInvisActivationLevel: ds 2
wKillScreenActivationLevel: ds 2
wBonesActive:: ds 1
wInvisActive:: ds 1
SECTION "Level Functions", ROM0 SECTION "Level Functions", ROM0
; Loads the initial state of the speed curve. ; Loads the initial state of the speed curve.
@ -49,6 +56,8 @@ LevelInit::
xor a, a xor a, a
ldh [hRequiresLineClear], a ldh [hRequiresLineClear], a
ld [wBonesActive], a
ld [wInvisActive], a
ldh a, [hStartSpeed] ldh a, [hStartSpeed]
ld l, a ld l, a
@ -102,12 +111,79 @@ LevelInit::
and a, $0F and a, $0F
ldh [hNLevel], a ldh [hNLevel], a
; Get special data.
call SpecialLevelInit
; Restore the bank before returning. ; Restore the bank before returning.
rst RSTRestoreBank rst RSTRestoreBank
jp DoSpeedUp jp DoSpeedUp
SpecialLevelInit:
ld a, [wSpeedCurveState]
ld b, a
add a, b
add a, b
ld b, 0
ld c, a
ld hl, .jumps
add hl, bc
jp hl
.jumps
jp .dmgt
jp .tgm1
jp .tgm3
jp .deat
jp .shir
jp .chil
jp .myco
.dmgt
ld hl, sDMGTSpeedCurveSpecialData
jr .loaddata
.tgm1
ld hl, sTGM1SpeedCurveSpecialData
jr .loaddata
.tgm3
ld hl, sTGM3SpeedCurveSpecialData
jr .loaddata
.deat
ld hl, sDEATSpeedCurveSpecialData
jr .loaddata
.shir
ld hl, sSHIRSpeedCurveSpecialData
jr .loaddata
.chil
ld hl, sCHILSpeedCurveSpecialData
jr .loaddata
.myco
ld hl, sMYCOSpeedCurveSpecialData
jr .loaddata
.loaddata
ld a, [hl+]
ld [wBoneActivationLevel], a
ld a, [hl+]
ld [wBoneActivationLevel+1], a
ld a, [hl+]
ld [wInvisActivationLevel], a
ld a, [hl+]
ld [wInvisActivationLevel+1], a
ld a, [hl+]
ld [wKillScreenActivationLevel], a
ld a, [hl]
ld [wKillScreenActivationLevel+1], a
ret
; Increment level and speed up if necessary. Level increment in E. ; Increment level and speed up if necessary. Level increment in E.
; Levels may only increment by single digits. ; Levels may only increment by single digits.
LevelUp:: LevelUp::
@ -194,6 +270,8 @@ LevelUp::
ld a, h ld a, h
ldh [hLevel+1], a ldh [hLevel+1], a
call DoSpeedUp call DoSpeedUp
call CheckSpecialLevelConditions
call SFXKill
ld a, SFX_RANKGM ld a, SFX_RANKGM
jp SFXEnqueue jp SFXEnqueue
@ -271,6 +349,7 @@ LevelUp::
call SFXEnqueue call SFXEnqueue
.checkspeedup .checkspeedup
call CheckSpecialLevelConditions
ldh a, [hNextSpeedUp] ldh a, [hNextSpeedUp]
and a, $F0 and a, $F0
jr z, :+ jr z, :+
@ -363,4 +442,116 @@ DoSpeedUp:
jp RSTRestoreBank jp RSTRestoreBank
CheckSpecialLevelConditions:
; Get our level in bc
ldh a, [hLevel]
ld c, a
ldh a, [hLevel+1]
ld b, a
; Bones?
.bones
ld hl, wBoneActivationLevel
ld a, [hl+]
cp a, $FF ; $FF means never.
jp z, .invis
; Load the level, binary in de.
ld e, a
ld d, [hl]
; Check if BC >= DE...
; Skip if B < D.
ld a, b
cp a, d
jr c, .invis
; We can confidently enter the bone zone if B > D.
jr nz, .enterthebonezone
; If B == D, we need to check C and E...
; Skip if C < E. Otherwise enter the bone zone.
ld a, c
cp a, e
jr c, .invis
.enterthebonezone
ld a, $FF
ld [wBonesActive], a
; Invis?
.invis
ld hl, wInvisActivationLevel
ld a, [hl+]
cp a, $FF ; $FF means never.
jp z, .killscreen
; Load the level, binary in de.
ld e, a
ld d, [hl]
; Check if BC >= DE...
; Skip if B < D.
ld a, b
cp a, d
jr c, .killscreen
; We can confidently vanish if B > D.
jr nz, .vanishoxyaction
; If B == D, we need to check C and E...
; Skip if C < E. Otherwise vanish.
ld a, c
cp a, e
jr c, .killscreen
.vanishoxyaction
ld a, $FF
ld [wInvisActive], a
; Kill screen?
.killscreen
ld hl, wKillScreenActivationLevel
ld a, [hl+]
cp a, $FF
ret z
; Load the level, binary in de.
ld e, a
ld d, [hl]
; Check if BC >= DE...
; Ret if B < D.
ld a, b
cp a, d
ret c
; We can confidently rip if B > D.
jr nz, .rip
; If B == D, we need to check C and E...
; Skip if C < E. Otherwise rip.
ld a, c
cp a, e
ret c
.rip
ld a, 1
ldh [hCurrentARE], a
ldh [hCurrentLineARE], a
ldh [hCurrentDAS], a
ldh [hCurrentLockDelay], a
ldh [hCurrentLineClearDelay], a
ld a, 20
ldh [hCurrentIntegerGravity], a
xor a, a
ldh [hCurrentFractionalGravity], a
ret
ENDC ENDC

View File

@ -192,9 +192,9 @@ sDMGTSpeedCurveEnd::
dw $FFFF ; End. dw $FFFF ; End.
sDMGTSpeedCurveSpecialData:: sDMGTSpeedCurveSpecialData::
dw $FFFF ; When do we get bones? dw 2000 ; When do we get bones?
dw $2000 ; When do blocks turn invisible? dw $FFFF ; When do blocks turn invisible?
dw $9999 ; When is the hard kill screen? dw 9999 ; When is the hard kill screen?
sTGM1SpeedCurve:: sTGM1SpeedCurve::
@ -322,9 +322,9 @@ sTGM1SpeedCurveEnd::
dw $FFFF dw $FFFF
sTGM1SpeedCurveSpecialData:: sTGM1SpeedCurveSpecialData::
dw $FFFF ; When do we get bones? dw 1000 ; When do we get bones?
dw $FFFF ; When do blocks turn invisible? dw $FFFF ; When do blocks turn invisible?
dw $0999 ; When is the hard kill screen? dw 1199 ; When is the hard kill screen?
sCHILSpeedCurve:: sCHILSpeedCurve::
@ -422,7 +422,7 @@ sCHILSpeedCurveEnd::
sCHILSpeedCurveSpecialData:: sCHILSpeedCurveSpecialData::
dw $FFFF ; When do we get bones? dw $FFFF ; When do we get bones?
dw $FFFF ; When do blocks turn invisible? dw $FFFF ; When do blocks turn invisible?
dw $9999 ; When is the hard kill screen? dw 9999 ; When is the hard kill screen?
sTGM3SpeedCurve:: sTGM3SpeedCurve::
@ -579,8 +579,8 @@ sTGM3SpeedCurveEnd::
sTGM3SpeedCurveSpecialData:: sTGM3SpeedCurveSpecialData::
dw $FFFF ; When do we get bones? dw $FFFF ; When do we get bones?
dw $1300 ; When do blocks turn invisible? dw 1300 ; When do blocks turn invisible?
dw $1500 ; When is the hard kill screen? dw 1499 ; When is the hard kill screen?
sDEATSpeedCurve:: sDEATSpeedCurve::
dw $0000, 0, $0100 dw $0000, 0, $0100
@ -612,8 +612,8 @@ sDEATSpeedCurveEnd::
sDEATSpeedCurveSpecialData:: sDEATSpeedCurveSpecialData::
dw $FFFF ; When do we get bones? dw $FFFF ; When do we get bones?
dw $0999 ; When do blocks turn invisible? dw 1000 ; When do blocks turn invisible?
dw $1200 ; When is the hard kill screen? dw 1199 ; When is the hard kill screen?
sSHIRSpeedCurve:: sSHIRSpeedCurve::
@ -649,9 +649,9 @@ sSHIRSpeedCurveEnd::
dw $FFFF dw $FFFF
sSHIRSpeedCurveSpecialData:: sSHIRSpeedCurveSpecialData::
dw $0900 ; When do we get bones? dw 900 ; When do we get bones?
dw $1300 ; When do blocks turn invisible? dw 1300 ; When do blocks turn invisible?
dw $1500 ; When is the hard kill screen? dw 1499 ; When is the hard kill screen?
sMYCOSpeedCurve:: sMYCOSpeedCurve::
@ -753,7 +753,7 @@ sMYCOSpeedCurveEnd::
sMYCOSpeedCurveSpecialData:: sMYCOSpeedCurveSpecialData::
dw $FFFF ; When do we get bones? dw $FFFF ; When do we get bones?
dw $FFFF ; When do blocks turn invisible? dw $FFFF ; When do blocks turn invisible?
dw $0300 ; When is the hard kill screen? dw 300 ; When is the hard kill screen?
sSharedTiles:: sSharedTiles::
@ -845,14 +845,14 @@ sSharedTiles::
DB $00,$00,$00,$00,$00,$00,$00,$00 DB $00,$00,$00,$00,$00,$00,$00,$00
DB $00,$00,$18,$18,$18,$18,$08,$08 DB $00,$00,$18,$18,$18,$18,$08,$08
DB $10,$10,$00,$00,$00,$00,$00,$00 DB $10,$10,$00,$00,$00,$00,$00,$00
DB $00,$00,$00,$00,$00,$00,$00,$00 DB $FF,$FF,$C3,$C3,$00,$00,$3C,$3C
DB $00,$00,$00,$00,$00,$00,$00,$00 DB $00,$00,$C3,$C3,$FF,$FF,$00,$00
DB $00,$00,$00,$00,$00,$00,$00,$00 DB $18,$18,$7E,$7E,$DB,$DB,$DB,$DB
DB $00,$00,$00,$00,$00,$00,$00,$00 DB $DB,$DB,$7E,$7E,$18,$18,$00,$00
DB $00,$00,$00,$00,$00,$00,$00,$00 DB $7E,$7E,$C3,$C3,$C3,$C3,$C3,$C3
DB $00,$00,$00,$00,$00,$00,$00,$00 DB $66,$66,$A5,$A5,$E7,$E7,$00,$00
DB $00,$00,$00,$00,$00,$00,$00,$00 DB $DB,$DB,$DB,$DB,$DB,$DB,$DB,$DB
DB $00,$00,$00,$00,$00,$00,$00,$00 DB $7E,$7E,$18,$18,$18,$18,$00,$00
sSharedTilesEnd:: sSharedTilesEnd::
sTitleTiles:: sTitleTiles::
@ -956,10 +956,10 @@ sTitleTiles::
DB $82,$82,$82,$82,$EC,$EC,$00,$00 DB $82,$82,$82,$82,$EC,$EC,$00,$00
DB $44,$44,$CC,$CC,$44,$44,$44,$44 DB $44,$44,$CC,$CC,$44,$44,$44,$44
DB $44,$44,$44,$44,$EE,$EE,$00,$00 DB $44,$44,$44,$44,$EE,$EE,$00,$00
DB $4E,$4E,$A2,$A2,$A2,$A2,$A4,$A4 DB $44,$44,$AA,$AA,$AA,$AA,$A4,$A4
DB $A4,$A4,$A4,$A4,$44,$44,$00,$00 DB $AA,$AA,$AA,$AA,$44,$44,$00,$00
DB $7F,$7F,$22,$22,$14,$14,$08,$08 DB $7F,$7F,$22,$22,$22,$22,$14,$14
DB $14,$14,$22,$22,$7F,$7F,$00,$00 DB $14,$14,$08,$08,$7F,$7F,$00,$00
DB $00,$00,$00,$00,$00,$00,$00,$00 DB $00,$00,$00,$00,$00,$00,$00,$00
DB $00,$00,$00,$00,$00,$00,$00,$00 DB $00,$00,$00,$00,$00,$00,$00,$00
DB $00,$00,$00,$00,$00,$00,$00,$00 DB $00,$00,$00,$00,$00,$00,$00,$00
@ -1689,7 +1689,7 @@ sGameplayTilesM::
DB $24,$3C,$24,$3C,$18,$18,$00,$00 DB $24,$3C,$24,$3C,$18,$18,$00,$00
DB $00,$00,$00,$00,$00,$00,$00,$00 DB $00,$00,$00,$00,$00,$00,$00,$00
DB $00,$00,$00,$00,$00,$00,$00,$00 DB $00,$00,$00,$00,$00,$00,$00,$00
DB $00,$00,$00,$00,$00,$00,$00,$00 DB $00,$00,$00,$00,$00,$00,$10,$00
DB $00,$00,$00,$00,$00,$00,$00,$00 DB $00,$00,$00,$00,$00,$00,$00,$00
sGameplayTilesMEnd:: sGameplayTilesMEnd::
@ -2108,7 +2108,7 @@ sGameplayTilesC::
DB $24,$3C,$24,$3C,$18,$18,$00,$00 DB $24,$3C,$24,$3C,$18,$18,$00,$00
DB $00,$00,$00,$00,$00,$00,$00,$00 DB $00,$00,$00,$00,$00,$00,$00,$00
DB $00,$00,$00,$00,$00,$00,$00,$00 DB $00,$00,$00,$00,$00,$00,$00,$00
DB $00,$00,$00,$00,$00,$00,$00,$00 DB $00,$00,$00,$00,$00,$00,$10,$00
DB $00,$00,$00,$00,$00,$00,$00,$00 DB $00,$00,$00,$00,$00,$00,$00,$00
sGameplayTilesCEnd:: sGameplayTilesCEnd::

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -432,8 +432,6 @@ Next35Piece:
; Tries generating bytes until it gets one in [0; 7) ; Tries generating bytes until it gets one in [0; 7)
Next7Piece: Next7Piece:
xor a, a
ret
: call NextByte : call NextByte
and a, $07 and a, $07
cp a, 7 cp a, 7

View File

@ -173,12 +173,9 @@ ApplyTells::
ApplyNext:: ApplyNext::
; If we're in Shirase mode and past level 1000... ; If we're in Shirase mode and past level 1000...
ld b, a ld b, a
ld a, [wSpeedCurveState] ld a, [wBonesActive]
cp a, SCURVE_SHIR cp a, $FF
jr nz, .nobone jr nz, .nobone
ldh a, [hCLevel+CLEVEL_THOUSANDS]
cp a, 1
jr c, .nobone
.bone .bone
; Color ; Color
@ -336,12 +333,9 @@ ApplyNext::
ApplyHold:: ApplyHold::
; If we're in Shirase mode and past level 1000... ; If we're in Shirase mode and past level 1000...
ld b, a ld b, a
ld a, [wSpeedCurveState] ld a, [wBonesActive]
cp a, SCURVE_SHIR cp a, $FF
jr nz, .nobone jr nz, .nobone
ldh a, [hCLevel+CLEVEL_THOUSANDS]
cp a, 1
jr c, .nobone
.bone .bone
; Color ; Color
@ -1122,22 +1116,22 @@ GradeRendering::
jr .mm jr .mm
.mk .mk
ld a, "K" ld a, "k"
ld [wSPRGrade2+2], a ld [wSPRGrade2+2], a
ret ret
.mv .mv
ld a, "V" ld a, "v"
ld [wSPRGrade2+2], a ld [wSPRGrade2+2], a
ret ret
.mo .mo
ld a, "O" ld a, "o"
ld [wSPRGrade2+2], a ld [wSPRGrade2+2], a
ret ret
.mm .mm
ld a, "M" ld a, "n"
ld [wSPRGrade2+2], a ld [wSPRGrade2+2], a
ret ret