Decoupled release.

This commit is contained in:
Randy Thiemann 2023-10-23 12:16:16 +02:00
parent 246b760bfb
commit 3576cb9bc6
14 changed files with 774 additions and 376 deletions

Binary file not shown.

View File

@ -6,7 +6,7 @@ The game is heavily inspired by the TGM series of games and has the following fe
- IRS (initial rotation system).
- IHS (initial hold system) as well as holds.
- Faithful implementations of concepts such are lock delay, piece spawn delay and DAS.
- Several RNG options available. You can choose between pure RNG, 4 history with 4 retries, 4 history with 6 retries, 4 history with infinite retries, or a 35bag with 4 history and 6 retries with drought prevention.
- Several RNG options available. You can choose between pure RNG, 4 history with 4 retries, 4 history with 6 retries, 4 history with infinite retries, a 35bag with 4 history and 6 retries with drought prevention, NES style RNG, or pure RNG.
- A choice between sonic drop (pressing up grounds the piece but does not lock it), hard drop (pressing up locks the piece), or neither (pressing up does nothing at all.)
- A choice between traditional ARS for rotation, or TGM3 era ARS with extra kicks.
- Scoring is a hybrid between TGM1 and TGM2.
@ -14,16 +14,34 @@ The game is heavily inspired by the TGM series of games and has the following fe
- A rock solid 60FPS with a traditional 20x10 grid.
## Modes
There are eight available game modes:
- TGM1: 4 history w/ 4 rerolls, never start with O, S or Z.
- TGM2: 4 history w/ 6 rerolls, never start with O, S or Z. Sonic drop.
- TGM3: 4 history w/ 6 rerolls and drought protection, never start with O, S or Z. Sonic drop. Extra floor and wall kicks for I and T pieces.
- HELL: Pure random piece generation.
- EASY: 4 history w/ 256 rerolls, never start with O, S or Z. Sonic drop.
- TGW2: TGM2 but with hard drop.
- TGW3: TGM3 but with hard drop.
- EAWY: EASY but with hard drop.
## Options
### Buttons
Switch between whether A or B rotates clockwise and vice versa.
### RNG Mode
Choose between a few randomizer options:
- TGM1: 4 history, 4 rerolls.
- TGM2: 4 history, 6 rerolls.
- TGM3: The TGM3 RNG system.
- HELL: Pure Random.
- NES: Reroll once if you get the same piece as the previous one.
### Rot Mode
Select the rotation rules:
- ARS1: Classic ARS from TGM1 and TGM2.
- ARS2: ARS from TGM3.
### Drop Mode
Select whether up performs a sonic drop, a hard drop, or nothing at all.
### Speed Curve
Check back later! For now you're stuck with the default.
### Always 20G
Whether you want instant-drop gravity to be active at any level.
### Start Level
Choose any of the speed breakpoints to start the game at.
## Scoring
@ -59,9 +77,8 @@ Please do not try running it on older emulators such as VBA, since this game use
## Controls
### Menu
- A/B/Start — Start the game
- Left/Right — Switch A/B rotation direction
- Up/Down — Select starting level
- Select — Select game mode
- Up/Down — Change which option is selected
- Left/Right — Change the value of the option
### Gameplay
- A — Rotate 1
@ -86,8 +103,6 @@ The game can be built using gnu make and the RGBDS toolchain.
## Future Goals
- Improve main menu.
- Decouple rotation rules, rng rules, and speed curve from each other.
- Multiplayer with items.
- Colorization.
- ...

View File

@ -89,10 +89,31 @@ sPause::
db " P A U S E"
db "P A U S E "
db " P A U S E"
sEaster0:: db $D4, $D6, $D8, $DA, $DC
sEaster1:: db $D5, $D7, $D9, $DB, $DD
sEaster2:: db $DE, $E0, $D8, $DA, $DC
sEaster3:: db $DF, $E1, $D9, $DB, $DD
sOption0::
db "NORM"
db " INV"
sOption1::
db "TGM1"
db "TGM2"
db "TGM3"
db "HELL"
db " NES"
sOption2::
db "ARS1"
db "ARS2"
sOption3::
db "SNIC"
db "HARD"
db "NONE"
sOption4::
db "DMGT"
sOption5::
db " NO"
db " YES"
sEaster0:: db $C4, $C6, $C8, $CA, $CC
sEaster1:: db $C5, $C7, $C9, $CB, $CD
sEaster2:: db $CE, $D0, $C8, $CA, $CC
sEaster3:: db $CF, $D1, $C9, $CB, $CD
sPieceXOffsets:: ; How to draw each piece. X-offsets of the sprites.
db 0, 8, 16, 24 ; I
db 0, 8, 8, 16 ; Z

View File

@ -781,7 +781,7 @@ FieldProcess::
; HANDLE ROTATION
; Want rotate CCW?
.wantrotccw
ldh a, [hSwapAB]
ld a, [wSwapABState]
cp a, 0
jr z, .ldb1
.lda1
@ -800,7 +800,7 @@ FieldProcess::
; Want rotate CW?
.wantrotcw
ldh a, [hSwapAB]
ld a, [wSwapABState]
cp a, 0
jr z, .lda2
.ldb2
@ -862,13 +862,9 @@ FieldProcess::
; I piece only kicks in TGM3/TGW3/EASY/EAWY
cp a, PIECE_I
jr nz, :+
ldh a, [hSimulationMode]
cp a, MODE_TGM1
jp z, .norot
cp a, MODE_TGM2
jp z, .norot
cp a, MODE_HELL
jp z, .norot
ld a, [wRotModeState]
cp a, ROT_MODE_ARSTI
jp nz, .norot
jr .trykickright
; T/L/J only kick if not through the middle axis.
@ -948,13 +944,9 @@ FieldProcess::
; In TGM3, TGW3, EASY, and EAWY modes, there are a few other kicks possible.
.maybetgm3rot
ldh a, [hSimulationMode]
cp a, MODE_TGM1
jp z, .norot
cp a, MODE_TGM2
jp z, .norot
cp a, MODE_HELL
jp z, .norot
ld a, [wRotModeState]
cp a, ROT_MODE_ARSTI
jp nz, .norot
; In the case of a T piece, try the space above.
.checkt
@ -1179,16 +1171,10 @@ FieldProcess::
jr z, .postdrop
; What kind, if any?
ldh a, [hSimulationMode]
cp a, MODE_TGM1
ld a, [wDropModeState]
cp a, DROP_MODE_NONE
jr z, .postdrop
cp a, MODE_HELL
jr z, .postdrop
cp a, MODE_TGW2
jr z, .harddrop
cp a, MODE_TGW3
jr z, .harddrop
cp a, MODE_EAWY
cp a, DROP_MODE_HARD
jr z, .harddrop
; Sonic drop.
@ -1793,10 +1779,8 @@ FieldDelay::
; Check if we are in a TGM3 mode and thus need to handle line counts of 3 and 4 differently.
ldh a, [hLineClearCt]
ld e, a
ldh a, [hSimulationMode]
cp a, MODE_TGM3
jr z, .modifylines
cp a, MODE_TGW3
ld a, [wRotModeState]
cp a, ROT_MODE_ARSTI
jr z, .modifylines
jr .applylines
.modifylines

View File

@ -108,23 +108,7 @@ DEF PALETTE_LIGHTER_0 EQU %11100100
DEF PALETTE_LIGHTER_1 EQU %10010000
DEF PALETTE_LIGHTER_2 EQU %01000000
DEF PALETTE_LIGHTER_3 EQU %00000000
DEF TITLE_A EQU $99CD
DEF TITLE_B EQU $99CF
DEF TITLE_LEVEL EQU $996C
DEF TITLE_MODE EQU $9A2E
DEF FIELD_MODE EQU $9811
DEF FIELD_TOP_LEFT EQU $9800+1
DEF EASTER_0 EQU $9885
DEF EASTER_1 EQU $98A5
DEF TILE_FIELD_EMPTY EQU 4
DEF TILE_PIECE_0 EQU 10
DEF TILE_0 EQU 66
DEF TILE_MODE_FAINT_0 EQU 196
DEF TILE_MODE_0 EQU 234
DEF TILE_CLEARING EQU 124
DEF TILE_GHOST EQU 125
DEF TILE_A EQU 76
DEF TILE_B EQU 77
DEF NEXT_BASE_X EQU 120
DEF NEXT_BASE_Y EQU 40
DEF HOLD_BASE_X EQU 120
@ -134,8 +118,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 SCURVE_N_ENTRIES EQU 32
DEF SCURVE_ENTRY_SIZE EQU 8
DEF PIECE_I EQU 0
DEF PIECE_Z EQU 1
DEF PIECE_S EQU 2
@ -144,6 +129,7 @@ DEF PIECE_L EQU 4
DEF PIECE_O EQU 5
DEF PIECE_T EQU 6
DEF PIECE_NONE EQU 255
DEF SFX_IRS EQU 7
DEF SFX_DROP EQU 8
DEF SFX_LOCK EQU 9
@ -153,20 +139,71 @@ DEF SFX_RANK_UP EQU 12
DEF SFX_LEVEL_UP EQU 13
DEF SFX_IHS EQU 14
DEF SFX_READY_GO EQU 15
DEF STACK_SIZE EQU 64
DEF GAME_OVER_R10 EQU 133
DEF GAME_OVER_R12 EQU 153
DEF GAME_OVER_R14 EQU 173
DEF GAME_OVER_OTHER EQU 131
DEF LEADY_GO_TIME EQU 90
DEF MODE_TGM1 EQU 0
DEF MODE_TGM2 EQU 1
DEF MODE_TGM3 EQU 2
DEF MODE_HELL EQU 3
DEF MODE_EASY EQU 4
DEF MODE_TGW2 EQU 5
DEF MODE_TGW3 EQU 6
DEF MODE_EAWY EQU 7
DEF BUTTON_MODE_NORM EQU 0
DEF BUTTON_MODE_INVR EQU 1
DEF BUTTON_MODE_COUNT EQU 2
DEF TILE_RNG_MODE_BASE EQU 217
DEF RNG_MODE_TGM1 EQU 0
DEF RNG_MODE_TGM2 EQU 1
DEF RNG_MODE_TGM3 EQU 2
DEF RNG_MODE_HELL EQU 3
DEF RNG_MODE_NES EQU 4
DEF RNG_MODE_COUNT EQU 5
DEF TILE_ROT_MODE_BASE EQU 225
DEF ROT_MODE_ARS EQU 0
DEF ROT_MODE_ARSTI EQU 1
DEF ROT_MODE_COUNT EQU 2
DEF TILE_DROP_MODE_BASE EQU 229
DEF DROP_MODE_SONIC EQU 0
DEF DROP_MODE_HARD EQU 1
DEF DROP_MODE_NONE EQU 2
DEF DROP_MODE_COUNT EQU 3
DEF SCURVE_DMGT EQU 0
DEF SCURVE_COUNT EQU 1
DEF TILE_HIG_MODE_BASE EQU 232
DEF HIG_MODE_OFF EQU 0
DEF HIG_MODE_ON EQU 1
DEF HIG_MODE_COUNT EQU 2
DEF TILE_FIELD_EMPTY EQU 4
DEF TILE_PIECE_0 EQU 10
DEF TILE_0 EQU 66
DEF TILE_CLEARING EQU 124
DEF TILE_GHOST EQU 125
DEF TILE_SELECTED EQU 193
DEF TILE_UNSELECTED EQU 194
DEF TITLE_OPTIONS EQU 7
DEF TITLE_OPTION_0 EQU $98E0
DEF TITLE_OPTION_1 EQU $9920
DEF TITLE_OPTION_2 EQU $9960
DEF TITLE_OPTION_3 EQU $99A0
DEF TITLE_OPTION_4 EQU $99E0
DEF TITLE_OPTION_5 EQU $9A20
DEF TITLE_OPTION_6 EQU $9A60
DEF TITLE_OPTION_OFFSET EQU 15
DEF FIELD_RNG EQU $9852
DEF FIELD_ROT EQU $9892
DEF FIELD_DROP EQU $9912
DEF FIELD_HIG EQU $9952
DEF FIELD_TOP_LEFT EQU $9800+1
DEF EASTER_0 EQU $9845
DEF EASTER_1 EQU $9865
ENDC

View File

@ -345,6 +345,15 @@ DoSpeedUp:
ldh [hSpeedCurvePtr], a
ld a, h
ldh [hSpeedCurvePtr+1], a
; Do we want to force 20G?
ld a, [wAlways20GState]
cp a, 0
ret z
ld a, 20
ldh [hCurrentGravityPerTick], a
ld a, 1
ldh [hCurrentFramesPerGravityTick], a
ret

View File

@ -27,10 +27,15 @@ INCLUDE "res/title_map.inc"
SECTION "High Globals", HRAM
hGameState:: ds 1
hSwapAB:: ds 1
hSimulationMode:: ds 1
SECTION "Globals", WRAM0
wSwapABState:: ds 1
wRNGModeState:: ds 1
wRotModeState:: ds 1
wDropModeState:: ds 1
wSpeedCurveState:: ds 1
wAlways20GState:: ds 1
wInitialA:: ds 1
wInitialB:: ds 1
wInitialC:: ds 1
@ -41,9 +46,13 @@ wInitialL:: ds 1
SECTION "Persistent Globals", SRAM
rMagic:: ds 3
rSwapAB:: ds 1
rSimulationMode:: ds 1
rMagic:: ds 4
rSwapABState:: ds 1
rRNGModeState:: ds 1
rRotModeState:: ds 1
rDropModeState:: ds 1
rSpeedCurveState:: ds 1
rAlways20GState:: ds 1
SECTION "Stack", WRAM0
@ -95,35 +104,70 @@ Main::
; Check for save data.
ld a, [rMagic]
cp a, "T"
jr nz, .nosavedata
ld a, [rMagic+1]
cp a, "G"
cp a, "D"
jr nz, .nosavedata
ld a, [rMagic+1]
cp a, "M"
jr nz, .nosavedata
ld a, [rMagic+2]
cp a, "G"
jr nz, .nosavedata
ld a, [rMagic+3]
cp a, "0"
jr nz, .nosavedata
.savedata
ld a, [rSwapAB]
ldh [hSwapAB], a
ld a, [rSimulationMode]
ldh [hSimulationMode], a
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
jr .otherinit
.nosavedata
ld a, "T"
ld a, "D"
ld [rMagic], a
ld a, "G"
ld [rMagic+1], a
ld a, "M"
ld [rMagic+1], a
ld a, "G"
ld [rMagic+2], a
xor a, a
ldh [hSwapAB], a
ld [rSwapAB], a
ld a, MODE_TGM2
ldh [hSimulationMode], a
ld [rSimulationMode], a
ld a, "0"
ld [rMagic+3], a
ld a, BUTTON_MODE_NORM
ld [rSwapABState], a
ld [wSwapABState], a
ld a, RNG_MODE_TGM3
ld [rRNGModeState], a
ld [wRNGModeState], a
ld a, RNG_MODE_TGM3
ld [rRNGModeState], a
ld [wRNGModeState], a
ld a, ROT_MODE_ARSTI
ld [rRotModeState], a
ld [wRotModeState], a
ld a, DROP_MODE_SONIC
ld [rDropModeState], a
ld [wDropModeState], a
ld a, SCURVE_DMGT
ld [rSpeedCurveState], a
ld [wSpeedCurveState], a
ld a, HIG_MODE_OFF
ld [rAlways20GState], a
ld [wAlways20GState], a
.otherinit
ld hl, sSpeedCurve

Binary file not shown.

Binary file not shown.

View File

@ -406,44 +406,12 @@ Tiles::
DB $03,$03,$03,$03,$0F,$0F,$00,$00
DB $00,$00,$00,$00,$00,$00,$00,$00
DB $00,$00,$00,$00,$00,$00,$00,$00
DB $03,$03,$02,$02,$02,$02,$03,$03
DB $00,$00,$00,$00,$03,$03,$00,$00
DB $BA,$BA,$22,$22,$22,$22,$B2,$B2
DB $A2,$A2,$A2,$A2,$BB,$BB,$00,$00
DB $00,$00,$00,$00,$00,$00,$00,$00
DB $00,$00,$00,$00,$80,$80,$00,$00
DB $00,$00,$EE,$00,$48,$00,$4A,$00
DB $4A,$00,$4E,$00,$00,$00,$00,$00
DB $00,$00,$A4,$00,$EC,$00,$A4,$00
DB $A4,$00,$AE,$00,$00,$00,$00,$00
DB $00,$00,$EE,$00,$48,$00,$4A,$00
DB $4A,$00,$4E,$00,$00,$00,$00,$00
DB $00,$00,$AC,$00,$E2,$00,$A4,$00
DB $A8,$00,$AE,$00,$00,$00,$00,$00
DB $00,$00,$EE,$00,$48,$00,$4A,$00
DB $4A,$00,$4E,$00,$00,$00,$00,$00
DB $00,$00,$AC,$00,$E2,$00,$A4,$00
DB $A2,$00,$AC,$00,$00,$00,$00,$00
DB $00,$00,$AE,$00,$A8,$00,$EE,$00
DB $A8,$00,$AE,$00,$00,$00,$00,$00
DB $00,$00,$88,$00,$88,$00,$88,$00
DB $88,$00,$EE,$00,$00,$00,$00,$00
DB $00,$00,$E4,$00,$8A,$00,$CE,$00
DB $8A,$00,$EA,$00,$00,$00,$00,$00
DB $00,$00,$6A,$00,$8A,$00,$44,$00
DB $24,$00,$C4,$00,$00,$00,$00,$00
DB $00,$00,$EE,$00,$48,$00,$4A,$00
DB $4A,$00,$4E,$00,$00,$00,$00,$00
DB $00,$00,$AC,$00,$A2,$00,$A4,$00
DB $E8,$00,$AE,$00,$00,$00,$00,$00
DB $00,$00,$EE,$00,$48,$00,$4A,$00
DB $4A,$00,$4E,$00,$00,$00,$00,$00
DB $00,$00,$AC,$00,$A2,$00,$A4,$00
DB $E2,$00,$AC,$00,$00,$00,$00,$00
DB $00,$00,$E4,$00,$8A,$00,$CE,$00
DB $8A,$00,$EA,$00,$00,$00,$00,$00
DB $00,$00,$AA,$00,$AA,$00,$A4,$00
DB $E4,$00,$A4,$00,$00,$00,$00,$00
DB $C0,$C0,$F0,$F0,$FC,$FC,$FF,$FF
DB $FC,$FC,$F0,$F0,$C0,$C0,$00,$00
DB $C0,$00,$F0,$00,$FC,$00,$FF,$00
DB $FC,$00,$F0,$00,$C0,$00,$00,$00
DB $38,$38,$44,$44,$9A,$9A,$A2,$A2
DB $9A,$9A,$44,$44,$38,$38,$00,$00
DB $7C,$7C,$42,$42,$41,$41,$5D,$48
DB $6E,$4C,$5B,$4A,$79,$49,$00,$00
DB $68,$58,$58,$68,$68,$58,$48,$78
@ -472,6 +440,54 @@ Tiles::
DB $2D,$25,$3D,$3D,$01,$01,$00,$00
DB $01,$01,$3D,$3D,$2D,$35,$C5,$FD
DB $08,$F8,$10,$F0,$E0,$E0,$00,$00
DB $00,$00,$7C,$7C,$44,$44,$7C,$7C
DB $44,$44,$44,$44,$00,$00,$00,$00
DB $00,$00,$7C,$7C,$40,$40,$5C,$5C
DB $44,$44,$7C,$7C,$00,$00,$00,$00
DB $00,$00,$7C,$7C,$44,$44,$78,$78
DB $44,$44,$7C,$7C,$00,$00,$00,$00
DB $00,$00,$7C,$7C,$10,$10,$10,$10
DB $10,$10,$10,$10,$00,$00,$00,$00
DB $00,$00,$7C,$7C,$40,$40,$7C,$7C
DB $04,$04,$7C,$7C,$00,$00,$00,$00
DB $00,$00,$7C,$7C,$40,$40,$5C,$5C
DB $44,$44,$7C,$7C,$00,$00,$00,$00
DB $00,$00,$7C,$7C,$44,$44,$78,$78
DB $44,$44,$7C,$7C,$00,$00,$00,$00
DB $00,$75,$00,$47,$00,$55,$00,$55
DB $00,$75,$00,$00,$00,$3E,$00,$00
DB $00,$75,$00,$47,$00,$55,$00,$55
DB $00,$75,$00,$00,$00,$36,$00,$00
DB $00,$75,$00,$47,$00,$55,$00,$55
DB $00,$75,$00,$00,$00,$2A,$00,$00
DB $00,$00,$00,$3E,$00,$7F,$00,$6B
DB $00,$3E,$00,$2A,$00,$00,$00,$00
DB $00,$00,$00,$FF,$20,$81,$76,$81
DB $20,$81,$00,$FF,$00,$00,$00,$00
DB $00,$00,$00,$00,$28,$28,$10,$10
DB $28,$28,$00,$00,$00,$00,$00,$00
DB $00,$00,$00,$00,$28,$28,$10,$10
DB $28,$28,$00,$00,$00,$00,$00,$00
DB $00,$00,$00,$00,$28,$28,$10,$10
DB $28,$28,$00,$00,$00,$00,$00,$00
DB $00,$26,$00,$55,$00,$76,$00,$55
DB $00,$55,$00,$00,$00,$3E,$00,$00
DB $00,$26,$00,$55,$00,$76,$00,$55
DB $00,$55,$00,$00,$00,$2A,$00,$00
DB $00,$00,$00,$00,$28,$28,$10,$10
DB $28,$28,$00,$00,$00,$00,$00,$00
DB $00,$00,$00,$00,$28,$28,$10,$10
DB $28,$28,$00,$00,$00,$00,$00,$00
DB $02,$70,$02,$40,$02,$70,$07,$10
DB $07,$70,$02,$00,$00,$1F,$00,$00
DB $02,$50,$02,$50,$02,$70,$07,$50
DB $07,$50,$02,$00,$00,$1F,$00,$00
DB $02,$50,$02,$50,$02,$20,$07,$50
DB $07,$50,$02,$00,$00,$1F,$00,$00
DB $00,$3E,$02,$61,$04,$51,$24,$49
DB $00,$45,$30,$43,$00,$3E,$00,$00
DB $00,$00,$00,$62,$00,$15,$00,$25
DB $00,$45,$00,$72,$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
@ -488,50 +504,34 @@ Tiles::
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,$EE,$EE,$48,$48,$4A,$4A
DB $4A,$4A,$4E,$4E,$00,$00,$00,$00
DB $00,$00,$A4,$A4,$EC,$EC,$A4,$A4
DB $A4,$A4,$AE,$AE,$00,$00,$00,$00
DB $00,$00,$EE,$EE,$48,$48,$4A,$4A
DB $4A,$4A,$4E,$4E,$00,$00,$00,$00
DB $00,$00,$AC,$AC,$E2,$E2,$A4,$A4
DB $A8,$A8,$AE,$AE,$00,$00,$00,$00
DB $00,$00,$EE,$EE,$48,$48,$4A,$4A
DB $4A,$4A,$4E,$4E,$00,$00,$00,$00
DB $00,$00,$AC,$AC,$E2,$E2,$A4,$A4
DB $A2,$A2,$AC,$AC,$00,$00,$00,$00
DB $00,$00,$AE,$AE,$A8,$A8,$EE,$EE
DB $A8,$A8,$AE,$AE,$00,$00,$00,$00
DB $00,$00,$88,$88,$88,$88,$88,$88
DB $88,$88,$EE,$EE,$00,$00,$00,$00
DB $00,$00,$E4,$E4,$8A,$8A,$CE,$CE
DB $8A,$8A,$EA,$EA,$00,$00,$00,$00
DB $00,$00,$6A,$6A,$8A,$8A,$44,$44
DB $24,$24,$C4,$C4,$00,$00,$00,$00
DB $00,$00,$EE,$EE,$48,$48,$4A,$4A
DB $4A,$4A,$4E,$4E,$00,$00,$00,$00
DB $00,$00,$AC,$AC,$A2,$A2,$A4,$A4
DB $E8,$E8,$AE,$AE,$00,$00,$00,$00
DB $00,$00,$EE,$EE,$48,$48,$4A,$4A
DB $4A,$4A,$4E,$4E,$00,$00,$00,$00
DB $00,$00,$AC,$AC,$A2,$A2,$A4,$A4
DB $E2,$E2,$AC,$AC,$00,$00,$00,$00
DB $00,$00,$E4,$E4,$8A,$8A,$CE,$CE
DB $8A,$8A,$EA,$EA,$00,$00,$00,$00
DB $00,$00,$AA,$AA,$AA,$AA,$A4,$A4
DB $E4,$E4,$A4,$A4,$00,$00,$00,$00
DB $00,$00,$00,$00,$A0,$A0,$A0,$A0
DB $A0,$A0,$A0,$A0,$48,$48,$00,$00
DB $00,$00,$00,$00,$C4,$C4,$2A,$2A
DB $4A,$4A,$8A,$8A,$E4,$E4,$00,$00
DB $00,$00,$00,$00,$CC,$CC,$22,$22
DB $4C,$4C,$82,$82,$EC,$EC,$00,$00
DB $00,$00,$00,$00,$44,$44,$CA,$CA
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
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
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 $44,$44,$44,$44,$28,$28,$28,$28
DB $28,$28,$10,$10,$12,$12,$00,$00
DB $C4,$C4,$2A,$2A,$2A,$2A,$4A,$4A
DB $8A,$8A,$8A,$8A,$E4,$E4,$00,$00
DB $CC,$CC,$22,$22,$22,$22,$44,$44
DB $82,$82,$82,$82,$EC,$EC,$00,$00
DB $44,$44,$CA,$CA,$4A,$4A,$4A,$4A
DB $4A,$4A,$4A,$4A,$E4,$E4,$00,$00
DB $00,$00,$00,$00,$CC,$CC,$22,$22
DB $44,$44,$82,$82,$EC,$EC,$00,$00
DB $00,$00,$00,$00,$0C,$0C,$0A,$0A
DB $0C,$0C,$0A,$0A,$0C,$0C,$00,$00
DB $CC,$CC,$22,$22,$22,$22,$44,$44
DB $82,$82,$82,$82,$EC,$EC,$00,$00
DB $0C,$0C,$0A,$0A,$0A,$0A,$0A,$0A
DB $0A,$0A,$0A,$0A,$0C,$0C,$00,$00
TilesEnd::

View File

@ -21,69 +21,69 @@ DEF TITLE_MAP_INC EQU 1
SECTION "Title Screen Tilemap", ROM0
TitleScreenTilemap::
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$FA,$FB,$FC,$FD,$FE,$FF
DB $C3,$5B,$4C,$59,$4F,$5A,$5D,$4C,$01,$59
DB $5A,$61,$4C,$01,$FA,$FB,$FC,$FD,$FE,$FF
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$68
DB $6A,$6C,$6E,$70,$72,$74,$76,$78,$7A,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$69,$6B,$6D,$6F,$71,$73,$75,$77,$79
DB $7B,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$68,$6A,$6C,$6E,$70,$72,$74
DB $76,$78,$7A,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$69,$6B,$6D,$6F,$71
DB $73,$75,$77,$79,$7B,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$5B,$5D,$50,$5E,$5E,$01
DB $5E,$5F,$4C,$5D,$5F,$66,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$C1,$01,$4D,$60,$5F,$5F
DB $5A,$59,$5E,$01,$01,$01,$01,$01,$81,$01
DB $01,$01,$01,$82,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$C2,$01
DB $5D,$59,$52,$01,$58,$5A,$4F,$50,$01,$01
DB $01,$01,$81,$01,$01,$01,$01,$82,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $5B,$5D,$50,$5E,$5E,$01,$5E,$5F,$4C,$5D
DB $5F,$66,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$C2,$01,$5D,$5A,$5F,$01,$58,$5A
DB $4F,$50,$01,$01,$01,$01,$81,$01,$01,$01
DB $01,$82,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$C2,$01,$4F,$5D
DB $5A,$5B,$01,$58,$5A,$4F,$50,$01,$01,$01
DB $81,$01,$01,$01,$01,$82,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$7E,$01,$57,$50,$61,$50
DB $57,$01,$01,$81,$42,$42,$42,$42,$82,$01
DB $C2,$01,$5E,$5B,$50,$50,$4F,$01,$4E,$60
DB $5D,$61,$50,$01,$81,$01,$01,$01,$01,$82
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$C2,$01,$4C,$57,$62,$4C
DB $64,$5E,$01,$44,$42,$52,$01,$01,$81,$01
DB $01,$01,$01,$82,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $7F,$01,$4D,$60,$5F,$5F,$5A,$59,$5E,$01
DB $81,$4C,$80,$4D,$82,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$C1,$C2,$C3,$58,$5A
DB $4F,$50,$01,$01,$01,$01,$01,$81,$C4,$C5
DB $82,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$C2,$01
DB $5E,$5F,$4C,$5D,$5F,$01,$57,$50,$61,$50
DB $57,$01,$81,$01,$01,$01,$01,$82,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01

View File

@ -69,8 +69,8 @@ RNGInit::
ldh [hHeldPiece], a
; If we're in HELL mode, we don't care about anything but a random piece to start with.
ldh a, [hSimulationMode]
cp a, MODE_HELL
ld a, [wRNGModeState]
cp a, RNG_MODE_HELL
jr nz, .complexinit
call Next7Piece
ld [hNextPiece], a
@ -84,8 +84,8 @@ RNGInit::
ldh [hPieceHistory+2], a
ldh [hPieceHistory+3], a
ldh a, [hSimulationMode]
cp a, MODE_TGM1
ld a, [wRNGModeState]
cp a, RNG_MODE_TGM1
jr z, :+
ld a, PIECE_S
ldh [hPieceHistory+2], a
@ -177,29 +177,14 @@ GetNextTGM2Piece:
: jr ShiftHistory
; 4 History, (basically) infinite rerolls.
GetNextEasyPiece:
ld a, 0
ld e, a
: dec e
jr z, :+
; 1 history, 1 reroll.
GetNextNesPiece:
call Next7Piece
ld hl, hPieceHistory
cp a, [hl]
jr z, :-
inc hl
cp a, [hl]
jr z, :-
inc hl
cp a, [hl]
jr z, :-
inc hl
cp a, [hl]
jr z, :-
: jr ShiftHistory
jr nz, ShiftHistory
call Next7Piece
jr nz, ShiftHistory
; TGM3 mode... It's complex.
@ -355,23 +340,17 @@ GetNextTGM3Piece:
GetNextPiece::
ldh a, [hSimulationMode]
cp a, MODE_HELL
ld a, [wRNGModeState]
cp a, RNG_MODE_HELL
jp z, GetNextHellPiece
cp a, MODE_TGM1
cp a, RNG_MODE_TGM1
jp z, GetNextTGM1Piece
cp a, MODE_TGM2
cp a, RNG_MODE_TGM2
jp z, GetNextTGM2Piece
cp a, MODE_TGW2
jp z, GetNextTGM2Piece
cp a, MODE_TGM3
cp a, RNG_MODE_TGM3
jp z, GetNextTGM3Piece
cp a, MODE_TGW3
jp z, GetNextTGM3Piece
cp a, MODE_EASY
jp z, GetNextEasyPiece
cp a, MODE_EAWY
jp z, GetNextEasyPiece
cp a, RNG_MODE_NES
jp z, GetNextNesPiece
Next35Piece:

View File

@ -63,13 +63,22 @@ SwitchToGameplay::
ld bc, GameplayTilemapEnd - GameplayTilemap
call UnsafeMemCopy
; Place a tell on the screen for mode.
ld hl, FIELD_MODE
ldh a, [hSimulationMode]
sla a
add a, TILE_MODE_FAINT_0
ld [hl+], a
inc a
; 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.
@ -214,7 +223,7 @@ fetchPieceMode:
; Check if IRS is requested.
; Apply the rotation if so.
.checkIRSA
ldh a, [hSwapAB]
ld a, [wSwapABState]
cp a, 0
jr z, .lda1
.ldb1
@ -237,7 +246,7 @@ fetchPieceMode:
call SFXEnqueue
.checkIRSB
ldh a, [hSwapAB]
ld a, [wSwapABState]
cp a, 0
jr z, .ldb2
.lda2
@ -530,7 +539,7 @@ DoHold:
; Check if IRS is requested.
; Apply the rotation if so.
.checkIRSHA
ldh a, [hSwapAB]
ld a, [wSwapABState]
cp a, 0
jr z, .lda3
.ldb3
@ -554,7 +563,7 @@ DoHold:
jr .doHoldOperation
.checkIRSHB
ldh a, [hSwapAB]
ld a, [wSwapABState]
cp a, 0
jr z, .ldb4
.lda4

View File

@ -22,6 +22,10 @@ DEF STATE_TITLE_ASM EQU 1
INCLUDE "globals.asm"
SECTION "Title Variables", WRAM0
wSelected: ds 1
SECTION "Title Functions", ROM0
SwitchToTitle::
; Turn the screen off if it's on.
@ -77,6 +81,7 @@ SwitchToTitle::
; Install the event loop handlers.
ld a, 0
ldh [hGameState], a
ld [wSelected], a
; And turn the LCD back on before we start.
ld a, LCDCF_ON | LCDCF_BGON | LCDCF_BLK01
@ -89,22 +94,9 @@ SwitchToTitle::
TitleEventLoopHandler::
; Increment mode?
ldh a, [hSelectState]
cp a, 1
jr nz, :+
ldh a, [hSimulationMode]
inc a
cp a, 8
jr nz, .write
xor a, a
.write
ldh [hSimulationMode], a
ld [rSimulationMode], a
jp EventLoopPostHandler
; Start game?
: ldh a, [hStartState]
.abstart
ldh a, [hStartState]
ld b, a
ldh a, [hAState]
ld c, a
@ -112,37 +104,149 @@ TitleEventLoopHandler::
or a, b
or a, c
cp a, 1
jr nz, :+
jr nz, .up
call SwitchToGameplay
jp EventLoopPostHandler
; Toggle A/B?
: ldh a, [hLeftState]
ld b, a
; Change menu selection?
.up
ldh a, [hUpState]
cp a, 1
jr nz, .down
ld a, [wSelected]
cp a, 0
jr z, :+
dec a
ld [wSelected], a
jp EventLoopPostHandler
: ld a, TITLE_OPTIONS-1
ld [wSelected], a
jp EventLoopPostHandler
.down
ldh a, [hDownState]
cp a, 1
jr nz, .left
ld a, [wSelected]
cp a, TITLE_OPTIONS-1
jr z, :+
inc a
ld [wSelected], a
jp EventLoopPostHandler
: xor a, a
ld [wSelected], a
jp EventLoopPostHandler
.left
ldh a, [hLeftState]
cp a, 1
jr nz, .right
jp DecrementOption
.right
ldh a, [hRightState]
or a, b
cp a, 1
jr nz, :+
ldh a, [hSwapAB]
cpl
ldh [hSwapAB], a
ld [rSwapAB], a
jr nz, .done
jp IncrementOption
.done
jp EventLoopPostHandler
; Start level up?
: ldh a, [hUpState]
cp a, 1
jr nz, :+
jr IncrementLevel
DecrementOption:
.opt0
ld a, [wSelected]
cp a, 0
jr nz, .opt1
ld a, [wSwapABState]
cp a, 0
jr z, :+
dec a
ld [wSwapABState], a
ld [rSwapABState], a
jp EventLoopPostHandler
: ld a, BUTTON_MODE_COUNT-1
ld [wSwapABState], a
ld [rSwapABState], a
jp EventLoopPostHandler
; Start level down?
: ldh a, [hDownState]
.opt1
cp a, 1
jr nz, :+
jr nz, .opt2
ld a, [wRNGModeState]
cp a, 0
jr z, :+
dec a
ld [wRNGModeState], a
ld [rRNGModeState], a
jp EventLoopPostHandler
: ld a, RNG_MODE_COUNT-1
ld [wRNGModeState], a
ld [rRNGModeState], a
jp EventLoopPostHandler
.opt2
cp a, 2
jr nz, .opt3
ld a, [wRotModeState]
cp a, 0
jr z, :+
dec a
ld [wRotModeState], a
ld [rRotModeState], a
jp EventLoopPostHandler
: ld a, ROT_MODE_COUNT-1
ld [wRotModeState], a
ld [rRotModeState], a
jp EventLoopPostHandler
.opt3
cp a, 3
jr nz, .opt4
ld a, [wDropModeState]
cp a, 0
jr z, :+
dec a
ld [wDropModeState], a
ld [rDropModeState], a
jp EventLoopPostHandler
: ld a, DROP_MODE_COUNT-1
ld [wDropModeState], a
ld [rDropModeState], a
jp EventLoopPostHandler
.opt4
cp a, 4
jr nz, .opt5
ld a, [wSpeedCurveState]
cp a, 0
jr z, :+
dec a
ld [wSpeedCurveState], a
ld [rSpeedCurveState], a
jp EventLoopPostHandler
: ld a, SCURVE_COUNT-1
ld [wSpeedCurveState], a
ld [rSpeedCurveState], a
jp EventLoopPostHandler
.opt5
cp a, 5
jr nz, .opt6
ld a, [wAlways20GState]
cp a, 0
jr z, :+
dec a
ld [wAlways20GState], a
ld [rAlways20GState], a
jp EventLoopPostHandler
: ld a, HIG_MODE_COUNT-1
ld [wAlways20GState], a
ld [rAlways20GState], a
jp EventLoopPostHandler
.opt6
jr DecrementLevel
: jp EventLoopPostHandler
jp EventLoopPostHandler
DecrementLevel:
; Decrement
@ -156,7 +260,104 @@ DecrementLevel:
ldh [hStartSpeed], a
ld a, h
ldh [hStartSpeed+1], a
jr CheckLevelRange
jp CheckLevelRange
IncrementOption:
.opt0
ld a, [wSelected]
cp a, 0
jr nz, .opt1
ld a, [wSwapABState]
cp a, BUTTON_MODE_COUNT-1
jr z, :+
inc a
ld [wSwapABState], a
ld [rSwapABState], a
jp EventLoopPostHandler
: xor a, a
ld [wSwapABState], a
ld [rSwapABState], a
jp EventLoopPostHandler
.opt1
cp a, 1
jr nz, .opt2
ld a, [wRNGModeState]
cp a, RNG_MODE_COUNT-1
jr z, :+
inc a
ld [wRNGModeState], a
ld [rRNGModeState], a
jp EventLoopPostHandler
: xor a, a
ld [wRNGModeState], a
ld [rRNGModeState], a
jp EventLoopPostHandler
.opt2
cp a, 2
jr nz, .opt3
ld a, [wRotModeState]
cp a, ROT_MODE_COUNT-1
jr z, :+
inc a
ld [wRotModeState], a
ld [rRotModeState], a
jp EventLoopPostHandler
: xor a, a
ld [wRotModeState], a
ld [rRotModeState], a
jp EventLoopPostHandler
.opt3
cp a, 3
jr nz, .opt4
ld a, [wDropModeState]
cp a, DROP_MODE_COUNT-1
jr z, :+
inc a
ld [wDropModeState], a
ld [rDropModeState], a
jp EventLoopPostHandler
: xor a, a
ld [wDropModeState], a
ld [rDropModeState], a
jp EventLoopPostHandler
.opt4
cp a, 4
jr nz, .opt5
ld a, [wSpeedCurveState]
cp a, SCURVE_COUNT-1
jr z, :+
inc a
ld [wSpeedCurveState], a
ld [rSpeedCurveState], a
jp EventLoopPostHandler
: xor a, a
ld [wSpeedCurveState], a
ld [rSpeedCurveState], a
jp EventLoopPostHandler
.opt5
cp a, 5
jr nz, .opt6
ld a, [wAlways20GState]
cp a, HIG_MODE_COUNT-1
jr z, :+
inc a
ld [wAlways20GState], a
ld [rAlways20GState], a
jp EventLoopPostHandler
: xor a, a
ld [wAlways20GState], a
ld [rAlways20GState], a
jp EventLoopPostHandler
.opt6
jr IncrementLevel
jp EventLoopPostHandler
IncrementLevel:
; Increment
@ -172,7 +373,6 @@ IncrementLevel:
ldh [hStartSpeed+1], a
jr CheckLevelRange
CheckLevelRange:
; At end?
ld bc, sSpeedCurveEnd
@ -207,88 +407,188 @@ CheckLevelRange:
TitleVBlankHandler::
; Draw level.
ldh a, [hStartSpeed]
ld l, a
ldh a, [hStartSpeed+1]
ld h, a
ld a, [hl]
swap a
and a, $0F
ld b, a
ld a, TILE_0
add a, b
ld hl, TITLE_LEVEL+2
ld a, TILE_UNSELECTED
ld hl, TITLE_OPTION_0
ld [hl], a
ld hl, TITLE_OPTION_1
ld [hl], a
ld hl, TITLE_OPTION_2
ld [hl], a
ld hl, TITLE_OPTION_3
ld [hl], a
ld hl, TITLE_OPTION_4
ld [hl], a
ld hl, TITLE_OPTION_5
ld [hl], a
ld hl, TITLE_OPTION_6
ld [hl], a
ldh a, [hStartSpeed]
ld l, a
ldh a, [hStartSpeed+1]
ld h, a
ld a, [hl]
and a, $0F
ld b, a
ld a, TILE_0
add a, b
ld hl, TITLE_LEVEL+3
ld [hl], a
ldh a, [hStartSpeed]
ld l, a
ldh a, [hStartSpeed+1]
ld h, a
inc hl
ld a, [hl]
swap a
and a, $0F
ld b, a
ld a, TILE_0
add a, b
ld hl, TITLE_LEVEL+0
ld [hl], a
ldh a, [hStartSpeed]
ld l, a
ldh a, [hStartSpeed+1]
ld h, a
inc hl
ld a, [hl]
and a, $0F
ld b, a
ld a, TILE_0
add a, b
ld hl, TITLE_LEVEL+1
ld [hl], a
; Draw Mode
ld hl, TITLE_MODE
ldh a, [hSimulationMode]
sla a
add a, TILE_MODE_0
ld [hl+], a
inc a
ld [hl], a
; Draw A/B
ldh a, [hSwapAB]
ld a, [wSelected]
ld hl, TITLE_OPTION_0
cp a, 0
jr nz, :+
ld hl, TITLE_A
ld a, TILE_A
ld [hl+], a
inc hl
inc a
ld [hl], a
wait_vblank_end
jp EventLoop
jr z, :+
ld hl, TITLE_OPTION_1
cp a, 1
jr z, :+
ld hl, TITLE_OPTION_2
cp a, 2
jr z, :+
ld hl, TITLE_OPTION_3
cp a, 3
jr z, :+
ld hl, TITLE_OPTION_4
cp a, 4
jr z, :+
ld hl, TITLE_OPTION_5
cp a, 5
jr z, :+
ld hl, TITLE_OPTION_6
: ld hl, TITLE_A
ld a, TILE_B
ld [hl+], a
inc hl
dec a
: ld a, TILE_SELECTED
ld [hl], a
; Draw option 0.
xor a, a
ld b, a
ld a, [wSwapABState]
rlc a
rlc a
ld c, a
ld hl, sOption0
add hl, bc
ld d, h
ld e, l
ld hl, TITLE_OPTION_0+TITLE_OPTION_OFFSET
ld bc, 4
call UnsafeMemCopy
; Draw option 1.
xor a, a
ld b, a
ld a, [wRNGModeState]
rlc a
rlc a
ld c, a
ld hl, sOption1
add hl, bc
ld d, h
ld e, l
ld hl, TITLE_OPTION_1+TITLE_OPTION_OFFSET
ld bc, 4
call UnsafeMemCopy
; Draw option 2.
xor a, a
ld b, a
ld a, [rRotModeState]
rlc a
rlc a
ld c, a
ld hl, sOption2
add hl, bc
ld d, h
ld e, l
ld hl, TITLE_OPTION_2+TITLE_OPTION_OFFSET
ld bc, 4
call UnsafeMemCopy
; Draw option 3.
xor a, a
ld b, a
ld a, [rDropModeState]
rlc a
rlc a
ld c, a
ld hl, sOption3
add hl, bc
ld d, h
ld e, l
ld hl, TITLE_OPTION_3+TITLE_OPTION_OFFSET
ld bc, 4
call UnsafeMemCopy
; Draw option 5.
xor a, a
ld b, a
ld a, [wSpeedCurveState]
rlc a
rlc a
ld c, a
ld hl, sOption4
add hl, bc
ld d, h
ld e, l
ld hl, TITLE_OPTION_4+TITLE_OPTION_OFFSET
ld bc, 4
call UnsafeMemCopy
; Draw option 5.
xor a, a
ld b, a
ld a, [wAlways20GState]
rlc a
rlc a
ld c, a
ld hl, sOption5
add hl, bc
ld d, h
ld e, l
ld hl, TITLE_OPTION_5+TITLE_OPTION_OFFSET
ld bc, 4
call UnsafeMemCopy
; Draw option 6.
ldh a, [hStartSpeed]
ld l, a
ldh a, [hStartSpeed+1]
ld h, a
ld a, [hl]
swap a
and a, $0F
ld b, a
ld a, TILE_0
add a, b
ld hl, TITLE_OPTION_6+TITLE_OPTION_OFFSET+2
ld [hl], a
ldh a, [hStartSpeed]
ld l, a
ldh a, [hStartSpeed+1]
ld h, a
ld a, [hl]
and a, $0F
ld b, a
ld a, TILE_0
add a, b
ld hl, TITLE_OPTION_6+TITLE_OPTION_OFFSET+3
ld [hl], a
ldh a, [hStartSpeed]
ld l, a
ldh a, [hStartSpeed+1]
ld h, a
inc hl
ld a, [hl]
swap a
and a, $0F
ld b, a
ld a, TILE_0
add a, b
ld hl, TITLE_OPTION_6+TITLE_OPTION_OFFSET+0
ld [hl], a
ldh a, [hStartSpeed]
ld l, a
ldh a, [hStartSpeed+1]
ld h, a
inc hl
ld a, [hl]
and a, $0F
ld b, a
ld a, TILE_0
add a, b
ld hl, TITLE_OPTION_6+TITLE_OPTION_OFFSET+1
ld [hl], a
wait_vblank_end
jp EventLoop