Compare commits

...

2 Commits

Author SHA1 Message Date
Randy Thiemann e2abbe77de Improve scoring, add dark mode, allow intro animation to be skipped. 2023-11-23 06:19:08 +01:00
Randy Thiemann 4ce49d6d94 Add light/dark modes. 2023-11-23 05:13:02 +01:00
19 changed files with 5666 additions and 5022 deletions

View File

@ -87,7 +87,7 @@ Lines = Lines cleared.
Level = The level before the lines were cleared.
Soft = Amount of frames the down button was held during this piece + 10 if the piece was sonic or hard dropped.
Soft = Amount of frames the down button was held during this piece + double the rows the piece was sonic or hard dropped.
Combo = Old combo + (2 x Lines) - 2

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

@ -1,90 +0,0 @@
; DMGTRIS
; Copyright (C) 2023 - Randy Thiemann <randy.thiemann@gmail.com>
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <https://www.gnu.org/licenses/>.
IF !DEF(DMGFX_ASM)
DEF DMGFX_ASM EQU 1
INCLUDE "globals.asm"
SECTION "DMG Intro Effect", ROM0
; Does a small effect on boot with the nintendo logo.
DoDMGEffect::
ld a, [wInitialA]
cp a, $11
ret z
; Yeet the logo
ld c, 10
.loop0
wait_vblank
ldh a, [rSCY]
dec a
ldh [rSCY], a
wait_vblank_end
dec c
jr nz, .loop0
ld c, 45
.loop1
wait_vblank
ldh a, [rSCY]
inc a
inc a
ldh [rSCY], a
wait_vblank_end
dec c
jr nz, .loop1
; Fade
wait_vblank
ld a, PALETTE_MONO_2
ldh [rBGP], a
ld c, 20
.loop2
wait_vblank
wait_vblank_end
dec c
jr nz, .loop2
wait_vblank
ld a, PALETTE_MONO_1
ldh [rBGP], a
ld c, 20
.loop3
wait_vblank
wait_vblank_end
dec c
jr nz, .loop3
wait_vblank
ld a, PALETTE_MONO_0
ldh [rBGP], a
ld c, 20
.loop4
wait_vblank
wait_vblank_end
dec c
jr nz, .loop4
ret
ENDC

View File

@ -1559,6 +1559,11 @@ FieldProcess::
ldh a, [hCurrentPieceY]
add a, b
ldh [hCurrentPieceY], a
ldh a, [hAwardDownBonus]
cp a, $FF
jr nz, .postgrav
ld a, b
ldh [hAwardDownBonus], a
jr .postgrav
; No. Smaller distance.
@ -1568,6 +1573,11 @@ FieldProcess::
ldh a, [hCurrentPieceY]
add a, b
ldh [hCurrentPieceY], a
ldh a, [hAwardDownBonus]
cp a, $FF
jr nz, .postgrav
ld a, b
ldh [hAwardDownBonus], a
; **************************************************************
@ -2067,16 +2077,12 @@ FieldDelay::
; Add soft drop points.
ldh a, [hDownFrames]
ld c, a
xor a, a
ld b, a
; Lock bonus?
ldh a, [hAwardDownBonus]
cp a, $FF
jr nz, .premultiplier
ld a, 10
add a, a
add a, c
ld c, a
xor a, a
ld b, a
; Final total pre-multipliers.
.premultiplier
@ -3807,6 +3813,11 @@ BigFieldProcess::
ldh a, [hCurrentPieceY]
add a, b
ldh [hCurrentPieceY], a
ldh a, [hAwardDownBonus]
cp a, $FF
jr nz, .postgrav
ld a, b
ldh [hAwardDownBonus], a
jr .postgrav
; No. Smaller distance.
@ -3816,6 +3827,11 @@ BigFieldProcess::
ldh a, [hCurrentPieceY]
add a, b
ldh [hCurrentPieceY], a
ldh a, [hAwardDownBonus]
cp a, $FF
jr nz, .postgrav
ld a, b
ldh [hAwardDownBonus], a
; **************************************************************
@ -4317,16 +4333,12 @@ BigFieldDelay::
; Add soft drop points.
ldh a, [hDownFrames]
ld c, a
xor a, a
ld b, a
; Lock bonus?
ldh a, [hAwardDownBonus]
cp a, $FF
jr nz, .premultiplier
ld a, 10
add a, a
add a, c
ld c, a
xor a, a
ld b, a
; Final total pre-multipliers.
.premultiplier

View File

@ -73,6 +73,8 @@ INCLUDE "globals.asm"
DEF_RGB555_FROM24 BLACK_F, $20, $20, $20
DEF_RGB555_FROM24 GOLD_0, $36, $2C, $05
DEF_RGB555_FROM24 GOLD_1, $99, $73, $16
DEF_RGB555_FROM24 WHITE_F, $FF, $FF, $FF
; Title Palettes.
DEF_RGB555_FROM24 TITLE_PAL0_0, 0, 0, 0
@ -101,7 +103,6 @@ INCLUDE "globals.asm"
DEF_RGB555_FROM24 TITLE_PAL4_3, 155, 173, 183
SECTION "GBC Shadow Tilemap", WRAM0, ALIGN[8]
wShadowTilemap:: ds 32*32
@ -214,7 +215,19 @@ GBCGameplayInit::
WRITEPAL_A 5, YELLOW_3_C, YELLOW_2_C, YELLOW_1_C, YELLOW_0_C
WRITEPAL_A 6, CYAN_3_C, CYAN_2_C, CYAN_1_C, CYAN_0_C
WRITEPAL_A 7, WHITE_C, GRAY_1_C, GRAY_0_C, BLACK_C
ld a, [wBGMode]
cp a, BG_MODE_DARK
jp nz, .postpalettes
WRITEPAL_B 0, BLACK_C, RED_2_C, RED_1_C, RED_0_C
WRITEPAL_B 1, BLACK_C, GREEN_2_C, GREEN_1_C, GREEN_0_C
WRITEPAL_B 2, BLACK_C, PURPLE_2_C, PURPLE_1_C, PURPLE_0_C
WRITEPAL_B 3, BLACK_C, BLUE_2_C, BLUE_1_C, BLUE_0_C
WRITEPAL_B 4, BLACK_C, ORANGE_2_C, ORANGE_1_C, ORANGE_0_C
WRITEPAL_B 5, BLACK_C, YELLOW_2_C, YELLOW_1_C, YELLOW_0_C
WRITEPAL_B 6, BLACK_C, CYAN_2_C, CYAN_1_C, CYAN_0_C
WRITEPAL_A 7, BLACK_C, GRAY_0_C, GRAY_1_C, WHITE_C
jp .postpalettes
.agb
WRITEPAL_A 0, RED_3_A, RED_2_A, RED_1_A, RED_0_A
WRITEPAL_A 1, GREEN_3_A, GREEN_2_A, GREEN_1_A, GREEN_0_A
@ -224,8 +237,36 @@ GBCGameplayInit::
WRITEPAL_A 5, YELLOW_3_A, YELLOW_2_A, YELLOW_1_A, YELLOW_0_A
WRITEPAL_A 6, CYAN_3_A, CYAN_2_A, CYAN_1_A, CYAN_0_A
WRITEPAL_A 7, WHITE_A, GRAY_1_A, GRAY_0_A, BLACK_A
ld a, [wBGMode]
cp a, BG_MODE_DARK
jp nz, .postpalettes
WRITEPAL_B 0, BLACK_A, RED_2_A, RED_1_A, RED_0_A
WRITEPAL_B 1, BLACK_A, GREEN_2_A, GREEN_1_A, GREEN_0_A
WRITEPAL_B 2, BLACK_A, PURPLE_2_A, PURPLE_1_A, PURPLE_0_A
WRITEPAL_B 3, BLACK_A, BLUE_2_A, BLUE_1_A, BLUE_0_A
WRITEPAL_B 4, BLACK_A, ORANGE_2_A, ORANGE_1_A, ORANGE_0_A
WRITEPAL_B 5, BLACK_A, YELLOW_2_A, YELLOW_1_A, YELLOW_0_A
WRITEPAL_B 6, BLACK_A, CYAN_2_A, CYAN_1_A, CYAN_0_A
WRITEPAL_A 7, BLACK_A, GRAY_1_A, GRAY_0_A, WHITE_A
.postpalettes
ldh a, [hBState]
and a, a
jp z, .skip
WRITEPAL_B 0, BLACK_C, RED_2_C, RED_1_C, RED_0_C
WRITEPAL_B 1, BLACK_C, GREEN_2_C, GREEN_1_C, GREEN_0_C
WRITEPAL_B 2, BLACK_C, PURPLE_2_C, PURPLE_1_C, PURPLE_0_C
WRITEPAL_B 3, BLACK_C, BLUE_2_C, BLUE_1_C, BLUE_0_C
WRITEPAL_B 4, BLACK_C, ORANGE_2_C, ORANGE_1_C, ORANGE_0_C
WRITEPAL_B 5, BLACK_C, YELLOW_2_C, YELLOW_1_C, YELLOW_0_C
WRITEPAL_B 6, BLACK_C, CYAN_2_C, CYAN_1_C, CYAN_0_C
WRITEPAL_B 7, BLACK_C, GRAY_0_C, GRAY_1_C, WHITE_C
.skip
; Copy the tilemap to shadow.
ld de, $9800
ld hl, wShadowTilemap
@ -528,6 +569,9 @@ GBCGameplayProcess::
ret
.black
ld a, [wBGMode]
cp a, BG_MODE_DARK
jr z, .white
ld a, OCPSF_AUTOINC | (7*8)+(3*2)
ldh [rOCPS], a
ld bc, BLACK_F_C
@ -538,6 +582,17 @@ GBCGameplayProcess::
ldh [rOCPD], a
ret
.white
ld a, OCPSF_AUTOINC | (7*8)+(3*2)
ldh [rOCPS], a
ld bc, WHITE_F_C
wait_vram
ld a, c
ldh [rOCPD], a
ld a, b
ldh [rOCPD], a
ret
GBCBigGameplayProcess::
ld a, [wInitialA]

View File

@ -166,6 +166,7 @@ DEF BANK_MUSIC_3 EQU 9
; Some useful palettes.
DEF PALETTE_REGULAR EQU %11100100
DEF PALETTE_INVERTED EQU %00011011
DEF PALETTE_INVERTED_L EQU %01101111
DEF PALETTE_MONO_0 EQU %11111111
DEF PALETTE_MONO_1 EQU %10101010
DEF PALETTE_MONO_2 EQU %01010101
@ -346,6 +347,10 @@ DEF FILTER_MODE_UDLR EQU 3
DEF FILTER_MODE_NONE EQU 4
DEF FILTER_MODE_COUNT EQU 5
DEF BG_MODE_LITE EQU 0
DEF BG_MODE_DARK EQU 1
DEF BG_MODE_COUNT EQU 2
; VRAM Offsets for gameplay tiles
DEF FIELD_RNG EQU $9852
DEF FIELD_ROT EQU $9892
@ -490,18 +495,19 @@ DEF TITLE_SETTINGS_TETRY EQU $99C0
DEF TITLE_SETTINGS_SEL_BACK EQU 6
DEF TITLE_PROFILE_OPTION_BASE EQU $9840
DEF TITLE_PROFILE_OPTIONS EQU 8
DEF TITLE_PROFILE_OPTIONS EQU 9
DEF TITLE_PROFILE_INDEX EQU $984F
DEF TITLE_PROFILE_NAME_0 EQU $986F
DEF TITLE_PROFILE_NAME_1 EQU $988F
DEF TITLE_PROFILE_NAME_2 EQU $98AF
DEF TITLE_PROFILE_BUTTONS EQU $98CF
DEF TITLE_PROFILE_FILTER EQU $98EF
DEF TITLE_PROFILE_RESET EQU $990F
DEF TITLE_PROFILE_BACK EQU $992F
DEF TITLE_PROFILE_BG EQU $990F
DEF TITLE_PROFILE_RESET EQU $992F
DEF TITLE_PROFILE_BACK EQU $994F
DEF TITLE_PROFILE_TETRY EQU $99C0
DEF TITLE_PROFILE_SEL_RESET EQU 6
DEF TITLE_PROFILE_SEL_BACK EQU 7
DEF TITLE_PROFILE_SEL_RESET EQU 7
DEF TITLE_PROFILE_SEL_BACK EQU 8
DEF TITLE_RECORDS_MODE EQU $9848
DEF TITLE_RECORDS_SCORE_BASE EQU $98A2

View File

@ -33,12 +33,12 @@ MACRO DEF_RGB555
DEF COLOR EQUS "\1"
; Uncorrected
DEF RED_A EQU (\2 & $1F)
DEF GREEN_A EQU (\3 & $1F)
DEF BLUE_A EQU (\4 & $1F)
DEF R_A EQU (\2 & $1F)
DEF G_A EQU (\3 & $1F)
DEF B_A EQU (\4 & $1F)
DEF {COLOR} EQU (RED_A << 0) | (GREEN_A << 5) | (BLUE_A << 10)
DEF {COLOR}_A EQU (RED_A << 0) | (GREEN_A << 5) | (BLUE_A << 10)
DEF {COLOR} EQU (R_A << 0) | (G_A << 5) | (B_A << 10)
DEF {COLOR}_A EQU (R_A << 0) | (G_A << 5) | (B_A << 10)
; Transfer function.
DEF GAMMA EQU 2.0q25

192
src/intro.asm Normal file
View File

@ -0,0 +1,192 @@
; DMGTRIS
; Copyright (C) 2023 - Randy Thiemann <randy.thiemann@gmail.com>
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <https://www.gnu.org/licenses/>.
IF !DEF(INTRO_ASM)
DEF INTRO_ASM EQU 1
INCLUDE "globals.asm"
DEF_RGB555 FADE_0, 31, 31, 31
DEF_RGB555 FADE_1, 30, 30, 30
DEF_RGB555 FADE_2, 29, 29, 29
DEF_RGB555 FADE_3, 28, 28, 28
DEF_RGB555 FADE_4, 27, 27, 27
DEF_RGB555 FADE_5, 26, 26, 26
DEF_RGB555 FADE_6, 25, 25, 25
DEF_RGB555 FADE_7, 24, 24, 24
DEF_RGB555 FADE_8, 23, 23, 23
DEF_RGB555 FADE_9, 22, 22, 22
DEF_RGB555 FADE_10, 21, 21, 21
DEF_RGB555 FADE_11, 20, 20, 20
DEF_RGB555 FADE_12, 19, 19, 19
DEF_RGB555 FADE_13, 18, 18, 18
DEF_RGB555 FADE_14, 17, 17, 17
DEF_RGB555 FADE_15, 16, 16, 16
DEF_RGB555 FADE_16, 15, 15, 15
DEF_RGB555 FADE_17, 14, 14, 14
DEF_RGB555 FADE_18, 13, 13, 13
DEF_RGB555 FADE_19, 12, 12, 12
DEF_RGB555 FADE_20, 11, 11, 11
DEF_RGB555 FADE_21, 10, 10, 10
DEF_RGB555 FADE_22, 9, 9, 9
DEF_RGB555 FADE_23, 8, 8, 8
DEF_RGB555 FADE_24, 7, 7, 7
DEF_RGB555 FADE_25, 6, 6, 6
DEF_RGB555 FADE_26, 5, 5, 5
DEF_RGB555 FADE_27, 4, 4, 4
DEF_RGB555 FADE_28, 3, 3, 3
DEF_RGB555 FADE_29, 2, 2, 2
DEF_RGB555 FADE_30, 1, 1, 1
DEF_RGB555 FADE_31, 0, 0, 0
SECTION "Intro Effect Trampoline", ROM0
DoIntroEffect::
ld b, BANK_TITLE
rst RSTSwitchBank
ld a, [wInitialA]
cp a, $11
call nz, DoDMGEffect
call z, DoGBCEffect
jp RSTRestoreBank
SECTION "Intro Effects Banked", ROMX, BANK[BANK_TITLE]
DoDMGEffect:
; Yeet the logo
ld c, 10
.loop0
call GetInput
ldh a, [hStartState]
ld hl, hAState
or a, [hl]
ld hl, hBState
or a, [hl]
ret nz
wait_vblank
ldh a, [rSCY]
dec a
ldh [rSCY], a
wait_vblank_end
dec c
jr nz, .loop0
ld c, 45
.loop1
call GetInput
ldh a, [hStartState]
ld hl, hAState
or a, [hl]
ld hl, hBState
or a, [hl]
ret nz
wait_vblank
ldh a, [rSCY]
inc a
inc a
ldh [rSCY], a
wait_vblank_end
dec c
jr nz, .loop1
; Fade
wait_vblank
ld a, PALETTE_MONO_2
ldh [rBGP], a
ld c, 20
.loop2
call GetInput
ldh a, [hStartState]
ld hl, hAState
or a, [hl]
ld hl, hBState
or a, [hl]
ret nz
wait_vblank
wait_vblank_end
dec c
jr nz, .loop2
wait_vblank
ld a, PALETTE_MONO_1
ldh [rBGP], a
ld c, 20
.loop3
call GetInput
ldh a, [hStartState]
ld hl, hAState
or a, [hl]
ld hl, hBState
or a, [hl]
ret nz
wait_vblank
wait_vblank_end
dec c
jr nz, .loop3
wait_vblank
ld a, PALETTE_MONO_0
ldh [rBGP], a
ld c, 20
.loop4
call GetInput
ldh a, [hStartState]
ld hl, hAState
or a, [hl]
ld hl, hBState
or a, [hl]
ret nz
wait_vblank
wait_vblank_end
dec c
jr nz, .loop4
ret
DoGBCEffect:
; Fade the screen to black.
FOR I, 31, 0, -1
wait_vblank
WRITEPAL_B 0, (I << 10 | I << 5 | I), (I << 10 | I << 5 | I), (I << 10 | I << 5 | I), (I << 10 | I << 5 | I)
wait_vblank_end
wait_vblank
wait_vblank_end
call GetInput
ldh a, [hStartState]
ld hl, hAState
or a, [hl]
ld hl, hBState
or a, [hl]
ret nz
ENDR
wait_vblank
wait_vblank_end
wait_vblank
wait_vblank_end
wait_vblank
wait_vblank_end
wait_vblank
wait_vblank_end
wait_vblank
ret
ENDC

View File

@ -34,6 +34,7 @@ wRotModeState:: ds 1
wDropModeState:: ds 1
wSpeedCurveState:: ds 1
wAlways20GState:: ds 1
wBGMode:: ds 1
wInitialA:: ds 1
wInitialB:: ds 1
wInitialC:: ds 1
@ -78,8 +79,10 @@ Main::
; Harvest entropy
call HarvestEntropy
; Let the DMG have some fun with the initial screen.
call DoDMGEffect
; Let the console have some fun with the initial screen.
call InputInit
call BankingInit
call DoIntroEffect
; Turn off LCD during initialization.
wait_vram
@ -93,8 +96,8 @@ Main::
; Other initialization.
call RestoreSRAM
call TimeInit
call InputInit
call TimeInit
call SFXInit
call BankingInit

View File

@ -1014,8 +1014,8 @@ sTitleTiles::
DB $00,$00,$01,$00,$00,$00,$00,$00
DB $80,$80,$C0,$C0,$60,$60,$60,$60
DB $F0,$F0,$F0,$F0,$E0,$E0,$C0,$C0
DB $00,$00,$85,$00,$85,$00,$87,$00
DB $81,$00,$D1,$00,$00,$00,$00,$00
DB $00,$00,$87,$00,$84,$00,$87,$00
DB $81,$00,$D7,$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

Binary file not shown.

View File

@ -70,6 +70,10 @@ sFilterMode::
db "UDLR"
db "NONE"
sBGMode::
db "LITE"
db "DARK"
sTetryRNG::
db "THIS OPTION WILL"
db "CHANGE THE WAY "
@ -140,13 +144,19 @@ sTetryButtons::
db "THIS OPTION WILL"
db "CHANGE WHICH WAY"
db "THE BUTTONS RO- "
db "TATE THE PIECE "
db "TATE THE PIECE! "
sTetryFILTER::
db "THIS OPTION WILL"
db "DETERMINE WHICH "
db "D-PAD BUTTONS "
db "HAVE PRIORITY "
db "HAVE PRIORITY! "
sTetryBG::
db "THIS OPTION WILL"
db "CHANGE THE BACK-"
db "GROUND COLOR IN-"
db "GAME! "
sTetryReset::
db "THIS OPTION WILL"
@ -406,14 +416,14 @@ sTitleScreenProfileMap::
DB $00,$00,$00,$00,$5D,$01,$0F,$2A,$1B,$0C
DB $0F,$01,$11,$14,$17,$1F,$10,$1D,$28,$01
DB $01,$01,$01,$29,$00,$00,$00,$00,$00,$00
DB $00,$00,$00,$00,$00,$00,$5D,$01,$1D,$10
DB $1E,$10,$1F,$01,$1B,$1D,$1A,$11,$14,$17
DB $10,$01,$01,$01,$01,$01,$00,$00,$00,$00
DB $00,$00,$00,$00,$00,$00,$5D,$01,$0D,$0C
DB $0E,$16,$12,$1D,$1A,$20,$19,$0F,$01,$01
DB $28,$01,$01,$01,$01,$29,$00,$00,$00,$00
DB $00,$00,$00,$00,$00,$00,$00,$00,$5D,$01
DB $0D,$0C,$0E,$16,$01,$01,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$00,$00
DB $1D,$10,$1E,$10,$1F,$01,$1B,$1D,$1A,$11
DB $14,$17,$10,$01,$01,$01,$01,$01,$00,$00
DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $5D,$01,$0D,$0C,$0E,$16,$01,$01,$01,$01
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
DB $00,$00,$01,$01,$01,$01,$01,$01,$01,$01

View File

@ -35,7 +35,8 @@ rSpeedCurveState\1:: ds 1
rAlways20GState\1:: ds 1
rSelectedStartLevel\1:: ds 2
rFilterMode\1:: ds 1
rUnused\1:: ds (64-12)
rBGMode\1:: ds 1
rUnused\1:: ds (64-13)
ENDU
ENDM
@ -55,7 +56,8 @@ rSpeedCurveState:: ds 1
rAlways20GState:: ds 1
rSelectedStartLevel:: ds 2
rFilterMode:: ds 1
rUnused:: ds (PROFILE_SIZE - 12) ; 12 = sum of the above
rBGMode:: ds 1
rUnused:: ds (PROFILE_SIZE - 13) ; 13 = sum of the above
ENDU
PROFILE 0
PROFILE 1
@ -104,27 +106,78 @@ RestoreSRAM::
jp nz, InitializeSRAM
; SRAM is initialized and for this build, so we can load the data.
; We do check for corruption and make sure all the values make sense.
TrustedLoad:
ld a, [rSwapABState]
ld [wSwapABState], a
ld a, [rRNGModeState]
cp a, BUTTON_MODE_COUNT
jr c, :+
xor a, a
ld [wSwapABState], a
ld [rSwapABState], a
: ld a, [rRNGModeState]
ld [wRNGModeState], a
ld a, [rRotModeState]
cp a, RNG_MODE_COUNT
jr c, :+
xor a, a
ld [wRNGModeState], a
ld [rRNGModeState], a
: ld a, [rRotModeState]
ld [wRotModeState], a
ld a, [rDropModeState]
cp a, ROT_MODE_COUNT
jr c, :+
xor a, a
ld [wRotModeState], a
ld [rRotModeState], a
: ld a, [rDropModeState]
ld [wDropModeState], a
ld a, [rSpeedCurveState]
cp a, DROP_MODE_COUNT
jr c, :+
xor a, a
ld [wDropModeState], a
ld [rDropModeState], a
: ld a, [rSpeedCurveState]
ld [wSpeedCurveState], a
ld a, [rAlways20GState]
cp a, SCURVE_COUNT
jr c, :+
xor a, a
ld [wSpeedCurveState], a
ld [rSpeedCurveState], a
: ld a, [rAlways20GState]
ld [wAlways20GState], a
ld a, [rProfileName]
cp a, HIG_MODE_COUNT
jr c, :+
xor a, a
ld [wAlways20GState], a
ld [rAlways20GState], a
: ld a, [rFilterMode]
ldh [hFilterMode], a
cp a, FILTER_MODE_COUNT
jr c, :+
xor a, a
ldh [hFilterMode], a
ld [rFilterMode], a
: ld a, [rBGMode]
ld [wBGMode], a
cp a, BG_MODE_COUNT
jr c, :+
xor a, a
ld [wBGMode], a
ld [rBGMode], a
: ld a, [rProfileName]
ld [wProfileName], a
ld a, [rProfileName+1]
ld [wProfileName+1], a
ld a, [rProfileName+2]
ld [wProfileName+2], a
ld a, [rFilterMode]
ldh [hFilterMode], a
; Restore the start level.
ld b, BANK_OTHER
@ -277,6 +330,10 @@ InitializeSRAM:
ld [rFilterMode], a
ldh [hFilterMode], a
ld a, BG_MODE_LITE
ld [rBGMode], a
ld [wBGMode], a
; Set to the default start level.
ld hl, sDMGTSpeedCurve
ld a, l

View File

@ -125,11 +125,22 @@ SwitchToGameplayB:
call ApplyTells
; Set up the palettes.
ld a, [wBGMode]
cp a, BG_MODE_DARK
jr z, .dark
ld a, PALETTE_REGULAR
set_bg_palette
set_obj0_palette
ld a, PALETTE_LIGHTER_1
set_obj1_palette
jr .done
.dark
ld a, PALETTE_INVERTED
set_bg_palette
set_obj0_palette
ld a, PALETTE_INVERTED_L
set_obj1_palette
.done
; Initialize the RNG.
call RNGInit
@ -931,11 +942,22 @@ SwitchToGameplayBigB:
call ApplyTells
; Set up the palettes.
ld a, [wBGMode]
cp a, BG_MODE_DARK
jr z, .dark
ld a, PALETTE_REGULAR
set_bg_palette
set_obj0_palette
ld a, PALETTE_LIGHTER_1
set_obj1_palette
jr .done
.dark
ld a, PALETTE_INVERTED
set_bg_palette
set_obj0_palette
ld a, PALETTE_INVERTED_L
set_obj1_palette
.done
; Initialize the RNG.
call RNGInit

View File

@ -733,6 +733,20 @@ TitleVBlankHandlerB:
ld bc, 4
call UnsafeMemCopy
.bg
ld b, 0
ld a, [wBGMode]
add a, a
add a, a
ld c, a
ld hl, sBGMode
add hl, bc
ld d, h
ld e, l
ld hl, TITLE_PROFILE_BG
ld bc, 4
call UnsafeMemCopy
; Tetry!
ld a, [wSelected]
ld hl, sTetryProfileNumber
@ -1251,6 +1265,7 @@ ProfileHandleRight:
jp .l2
jp .buttons
jp .filter
jp .bg
no_jump
no_jump
@ -1322,6 +1337,19 @@ ProfileHandleRight:
ld [rFilterMode], a
ret
.bg
ld a, [wBGMode]
cp a, BG_MODE_COUNT-1
jr z, :+
inc a
ld [wBGMode], a
ld [rBGMode], a
ret
: xor a, a
ld [wBGMode], a
ld [rBGMode], a
ret
ProfileHandleLeft:
ld a, [wSelected]
@ -1346,6 +1374,7 @@ ProfileHandleLeft:
jp .l2
jp .buttons
jp .filter
jp .bg
no_jump
no_jump
@ -1417,6 +1446,19 @@ ProfileHandleLeft:
ld [rFilterMode], a
ret
.bg
ld a, [wBGMode]
or a, a
jr z, :+
dec a
ld [wBGMode], a
ld [rBGMode], a
ret
: ld a, BG_MODE_COUNT-1
ld [wBGMode], a
ld [rBGMode], a
ret
ProfileHandleDown:
ld a, [wSelected]