diff --git a/DMGTRIS.GB b/DMGTRIS.GB index a1ef998..8864c42 100644 Binary files a/DMGTRIS.GB and b/DMGTRIS.GB differ diff --git a/README.md b/README.md index 538dc9b..41ad8a2 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ Please do not try running it on older emulators such as VBA, since this game use - A/B/Start — Start the game - Left/Right — Switch A/B rotation direction - Up/Down — Select starting level +- Select — Select amount of times a piece will be rerolled if it was given to you in the previous 4 pieces. TGM2 uses 6 for this value, TGM1 uses 4 for this value. You can set this to 0 (pure RNG except you'll never start with O, S, or Z), to 16 (F. Basically never get duplicates.) ### Gameplay - A — Rotate 1 diff --git a/src/include/globals.asm b/src/include/globals.asm index cb256e0..33af7e4 100644 --- a/src/include/globals.asm +++ b/src/include/globals.asm @@ -108,9 +108,10 @@ 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 $99ED -DEF TITLE_B EQU $99EF -DEF TITLE_LEVEL EQU $998C +DEF TITLE_A EQU $99CD +DEF TITLE_B EQU $99CF +DEF TITLE_LEVEL EQU $996C +DEF TITLE_ROLLS EQU $9A2F DEF FIELD_TOP_LEFT EQU $9800+1 DEF TILE_FIELD_EMPTY EQU 4 DEF TILE_PIECE_0 EQU 10 diff --git a/src/main.asm b/src/main.asm index 47abd62..64476f0 100644 --- a/src/main.asm +++ b/src/main.asm @@ -65,6 +65,8 @@ Main:: ldh [hStartSpeed], a ld a, h ldh [hStartSpeed+1], a + ld a, 6 + ldh [hRNGRerolls], a call TimeInit call IntrInit call InputInit diff --git a/src/res/sources/tiles.gbr b/src/res/sources/tiles.gbr index 32a1650..49b3803 100644 Binary files a/src/res/sources/tiles.gbr and b/src/res/sources/tiles.gbr differ diff --git a/src/res/sources/title_map.gbm b/src/res/sources/title_map.gbm index 97f5d59..6e461f8 100644 Binary files a/src/res/sources/title_map.gbm and b/src/res/sources/title_map.gbm differ diff --git a/src/res/tiles.inc b/src/res/tiles.inc index be97356..4cf7cb7 100644 --- a/src/res/tiles.inc +++ b/src/res/tiles.inc @@ -406,132 +406,10 @@ 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 $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 $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 $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 $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 $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 $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 $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 $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 $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 TilesEnd:: diff --git a/src/res/title_map.inc b/src/res/title_map.inc index 52422c8..1c794b6 100644 --- a/src/res/title_map.inc +++ b/src/res/title_map.inc @@ -21,74 +21,74 @@ 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,$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,$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,$68,$6A,$6C,$6E,$70 -DB $72,$74,$76,$78,$7A,$01,$01,$01,$01,$01 -DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01 -DB $01,$01,$01,$01,$01,$01,$01,$69,$6B,$6D -DB $6F,$71,$73,$75,$77,$79,$7B,$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,$01,$01,$01,$01,$01 -DB $01,$01,$5B,$5D,$50,$5E,$5E,$01,$5E,$5F -DB $4C,$5D,$5F,$66,$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,$01,$01,$01,$7E,$01,$57,$50 -DB $61,$50,$57,$01,$01,$81,$42,$42,$42,$42 -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,$01,$01 -DB $01,$01,$7F,$01,$4D,$60,$5F,$5F,$5A,$59 -DB $5E,$01,$81,$4C,$80,$4D,$82,$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,$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,$01,$01,$01,$01,$01 -DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01 -DB $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,$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,$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 $5B,$5D,$50,$5E,$5E,$01,$5E,$5F,$4C,$5D + DB $5F,$66,$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,$01,$7E,$01,$57,$50,$61,$50 + DB $57,$01,$01,$81,$42,$42,$42,$42,$82,$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,$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,$5D,$59 + DB $52,$01,$5D,$5A,$57,$57,$5E,$01,$81,$48 + 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,$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 TitleScreenTilemapEnd:: diff --git a/src/rng.asm b/src/rng.asm index 2bac82d..63189b9 100644 --- a/src/rng.asm +++ b/src/rng.asm @@ -26,6 +26,7 @@ SECTION "High RNG Variables", HRAM hRNGSeed: ds 4 hPieceHistory: ds 4 hNextPiece:: ds 1 +hRNGRerolls:: ds 1 section "RNG Functions", ROM0 @@ -71,9 +72,15 @@ RNGInit:: GetNextPiece:: - ld e, 7 + ldh a, [hRNGRerolls] + cp a, 0 + jr nz, :+ + call NextPiece + jr .donerolling +: inc a + ld e, a : dec e - jr z, :+ + jr z, .donerolling call NextPiece ld hl, hPieceHistory @@ -89,7 +96,8 @@ GetNextPiece:: cp a, [hl] jr z, :- -: ldh [hNextPiece], a +.donerolling + ldh [hNextPiece], a ld b, a ldh a, [hPieceHistory+2] ldh [hPieceHistory+3], a diff --git a/src/state_title.asm b/src/state_title.asm index 2aa8486..7a0cdd3 100644 --- a/src/state_title.asm +++ b/src/state_title.asm @@ -63,8 +63,18 @@ SwitchToTitle:: TitleEventLoopHandler:: + ; Increment RNG leniency? + ldh a, [hSelectState] + cp a, 1 + jr nz, :+ + ldh a, [hRNGRerolls] + inc a + and a, $0F + ldh [hRNGRerolls], a + jp EventLoopPostHandler + ; Start game? - ldh a, [hStartState] +: ldh a, [hStartState] ld b, a ldh a, [hAState] ld c, a @@ -219,6 +229,12 @@ TitleVBlankHandler:: ld hl, TITLE_LEVEL+1 ld [hl], a + ; Draw RNG + ldh a, [hRNGRerolls] + add a, TILE_0 + ld hl, TITLE_ROLLS + ld [hl], a + ; Draw A/B ldh a, [hSwapAB] cp a, 0