Improve scoring, add dark mode, allow intro animation to be skipped.

This commit is contained in:
Randy Thiemann 2023-11-23 06:19:08 +01:00
parent 4ce49d6d94
commit e2abbe77de
14 changed files with 5508 additions and 5009 deletions

View File

@ -87,7 +87,7 @@ Lines = Lines cleared.
Level = The level before the lines were 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 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] ldh a, [hCurrentPieceY]
add a, b add a, b
ldh [hCurrentPieceY], a ldh [hCurrentPieceY], a
ldh a, [hAwardDownBonus]
cp a, $FF
jr nz, .postgrav
ld a, b
ldh [hAwardDownBonus], a
jr .postgrav jr .postgrav
; No. Smaller distance. ; No. Smaller distance.
@ -1568,6 +1573,11 @@ FieldProcess::
ldh a, [hCurrentPieceY] ldh a, [hCurrentPieceY]
add a, b add a, b
ldh [hCurrentPieceY], a 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. ; Add soft drop points.
ldh a, [hDownFrames] ldh a, [hDownFrames]
ld c, a ld c, a
xor a, a
ld b, a
; Lock bonus?
ldh a, [hAwardDownBonus] ldh a, [hAwardDownBonus]
cp a, $FF add a, a
jr nz, .premultiplier
ld a, 10
add a, c add a, c
ld c, a ld c, a
xor a, a
ld b, a
; Final total pre-multipliers. ; Final total pre-multipliers.
.premultiplier .premultiplier
@ -3807,6 +3813,11 @@ BigFieldProcess::
ldh a, [hCurrentPieceY] ldh a, [hCurrentPieceY]
add a, b add a, b
ldh [hCurrentPieceY], a ldh [hCurrentPieceY], a
ldh a, [hAwardDownBonus]
cp a, $FF
jr nz, .postgrav
ld a, b
ldh [hAwardDownBonus], a
jr .postgrav jr .postgrav
; No. Smaller distance. ; No. Smaller distance.
@ -3816,6 +3827,11 @@ BigFieldProcess::
ldh a, [hCurrentPieceY] ldh a, [hCurrentPieceY]
add a, b add a, b
ldh [hCurrentPieceY], a 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. ; Add soft drop points.
ldh a, [hDownFrames] ldh a, [hDownFrames]
ld c, a ld c, a
xor a, a
ld b, a
; Lock bonus?
ldh a, [hAwardDownBonus] ldh a, [hAwardDownBonus]
cp a, $FF add a, a
jr nz, .premultiplier
ld a, 10
add a, c add a, c
ld c, a ld c, a
xor a, a
ld b, a
; Final total pre-multipliers. ; Final total pre-multipliers.
.premultiplier .premultiplier

View File

@ -103,7 +103,6 @@ INCLUDE "globals.asm"
DEF_RGB555_FROM24 TITLE_PAL4_3, 155, 173, 183 DEF_RGB555_FROM24 TITLE_PAL4_3, 155, 173, 183
SECTION "GBC Shadow Tilemap", WRAM0, ALIGN[8] SECTION "GBC Shadow Tilemap", WRAM0, ALIGN[8]
wShadowTilemap:: ds 32*32 wShadowTilemap:: ds 32*32

View File

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

@ -79,8 +79,10 @@ Main::
; Harvest entropy ; Harvest entropy
call HarvestEntropy call HarvestEntropy
; Let the DMG have some fun with the initial screen. ; Let the console have some fun with the initial screen.
call DoDMGEffect call InputInit
call BankingInit
call DoIntroEffect
; Turn off LCD during initialization. ; Turn off LCD during initialization.
wait_vram wait_vram
@ -94,8 +96,8 @@ Main::
; Other initialization. ; Other initialization.
call RestoreSRAM call RestoreSRAM
call TimeInit
call InputInit call InputInit
call TimeInit
call SFXInit call SFXInit
call BankingInit call BankingInit

View File

@ -1014,8 +1014,8 @@ sTitleTiles::
DB $00,$00,$01,$00,$00,$00,$00,$00 DB $00,$00,$01,$00,$00,$00,$00,$00
DB $80,$80,$C0,$C0,$60,$60,$60,$60 DB $80,$80,$C0,$C0,$60,$60,$60,$60
DB $F0,$F0,$F0,$F0,$E0,$E0,$C0,$C0 DB $F0,$F0,$F0,$F0,$E0,$E0,$C0,$C0
DB $00,$00,$85,$00,$85,$00,$87,$00 DB $00,$00,$87,$00,$84,$00,$87,$00
DB $81,$00,$D1,$00,$00,$00,$00,$00 DB $81,$00,$D7,$00,$00,$00,$00,$00
DB $C0,$C0,$F0,$F0,$FC,$FC,$FF,$FF DB $C0,$C0,$F0,$F0,$FC,$FC,$FF,$FF
DB $FC,$FC,$F0,$F0,$C0,$C0,$00,$00 DB $FC,$FC,$F0,$F0,$C0,$C0,$00,$00
DB $C0,$00,$F0,$00,$FC,$00,$FF,$00 DB $C0,$00,$F0,$00,$FC,$00,$FF,$00

Binary file not shown.

View File

@ -106,29 +106,78 @@ RestoreSRAM::
jp nz, InitializeSRAM jp nz, InitializeSRAM
; SRAM is initialized and for this build, so we can load the data. ; 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: TrustedLoad:
ld a, [rSwapABState] ld a, [rSwapABState]
ld [wSwapABState], a 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 [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 [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 [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 [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 [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 [wProfileName], a
ld a, [rProfileName+1] ld a, [rProfileName+1]
ld [wProfileName+1], a ld [wProfileName+1], a
ld a, [rProfileName+2] ld a, [rProfileName+2]
ld [wProfileName+2], a ld [wProfileName+2], a
ld a, [rFilterMode]
ldh [hFilterMode], a
ld a, [rBGMode]
ld [wBGMode], a
; Restore the start level. ; Restore the start level.
ld b, BANK_OTHER ld b, BANK_OTHER