Add d-pad filtering and improve score rendering.

This commit is contained in:
Randy Thiemann 2023-11-12 02:07:28 +01:00
parent 1695175cb1
commit 4e0aa5b374
12 changed files with 2119 additions and 1335 deletions

View File

@ -67,6 +67,14 @@ Whether you want instant-drop gravity to be active at any level.
### Start Level ### Start Level
Choose any of the speed breakpoints to start the game at. Choose any of the speed breakpoints to start the game at.
### D-Pad Filter
Choose which D-Pad buttons get priority.
- DLRU: Down > Left/Right > Up
- ULRD: Up > Left/Right > Down
- LRUD: Left/Right > Up/Down
- UDLR: Up/Down > Left/Right
- NONE: No filtering or priority.
## Scoring ## Scoring
After each piece is dropped, a check is made: After each piece is dropped, a check is made:

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

@ -440,13 +440,13 @@ UpdateGradeDMGT::
; What is our single/double/triple multiplier? ; What is our single/double/triple multiplier?
.combomult .combomult
ld a, [hComboCt] ld a, [hComboCt]
cp a, 10 cp a, 13
jr nc, .combo10 jr nc, .combo13
cp a, 5 cp a, 8
jr nc, .combo5 jr nc, .combo8
jr .combo1 jr .combo1
.combo10 .combo13
ld a, 2 ld a, 2
ld [wSMult], a ld [wSMult], a
ld a, 3 ld a, 3
@ -455,7 +455,7 @@ UpdateGradeDMGT::
ld [wTMult], a ld [wTMult], a
jr .prelevel jr .prelevel
.combo5 .combo8
ld a, 1 ld a, 1
ld [wSMult], a ld [wSMult], a
ld a, 2 ld a, 2

View File

@ -293,6 +293,13 @@ DEF HIG_MODE_OFF EQU 0
DEF HIG_MODE_ON EQU 1 DEF HIG_MODE_ON EQU 1
DEF HIG_MODE_COUNT EQU 2 DEF HIG_MODE_COUNT EQU 2
DEF FILTER_MODE_DLRU EQU 0
DEF FILTER_MODE_ULRD EQU 1
DEF FILTER_MODE_LRUD EQU 2
DEF FILTER_MODE_UDLR EQU 3
DEF FILTER_MODE_NONE EQU 4
DEF FILTER_MODE_COUNT EQU 5
; VRAM Offsets for title screen tiles ; VRAM Offsets for title screen tiles
DEF TITLE_OPTIONS EQU 7 DEF TITLE_OPTIONS EQU 7
DEF TITLE_OPTION_0 EQU $9900 DEF TITLE_OPTION_0 EQU $9900
@ -432,7 +439,7 @@ DEF TITLE_MAIN_SEL_RECORDS EQU 4
DEF TITLE_MAIN_SEL_CREDITS EQU 5 DEF TITLE_MAIN_SEL_CREDITS EQU 5
DEF TITLE_SETTINGS_OPTION_BASE EQU $9840 DEF TITLE_SETTINGS_OPTION_BASE EQU $9840
DEF TITLE_SETTINGS_OPTIONS EQU 8 DEF TITLE_SETTINGS_OPTIONS EQU 9
DEF TITLE_SETTINGS_BUTTONS EQU $984F DEF TITLE_SETTINGS_BUTTONS EQU $984F
DEF TITLE_SETTINGS_RNG EQU $986F DEF TITLE_SETTINGS_RNG EQU $986F
DEF TITLE_SETTINGS_ROT EQU $988F DEF TITLE_SETTINGS_ROT EQU $988F
@ -440,8 +447,9 @@ DEF TITLE_SETTINGS_DROP EQU $98AF
DEF TITLE_SETTINGS_SCURVE EQU $98CF DEF TITLE_SETTINGS_SCURVE EQU $98CF
DEF TITLE_SETTINGS_HIG EQU $98EF DEF TITLE_SETTINGS_HIG EQU $98EF
DEF TITLE_SETTINGS_START EQU $990F DEF TITLE_SETTINGS_START EQU $990F
DEF TITLE_SETTINGS_FILTER EQU $992F
DEF TITLE_SETTINGS_TETRY EQU $99C0 DEF TITLE_SETTINGS_TETRY EQU $99C0
DEF TITLE_SETTINGS_SEL_BACK EQU 7 DEF TITLE_SETTINGS_SEL_BACK EQU 8
DEF TITLE_PROFILE_OPTION_BASE EQU $9842 DEF TITLE_PROFILE_OPTION_BASE EQU $9842
DEF TITLE_PROFILE_OPTIONS EQU 6 DEF TITLE_PROFILE_OPTIONS EQU 6

View File

@ -31,6 +31,7 @@ hAState:: ds 1
hBState:: ds 1 hBState:: ds 1
hStartState:: ds 1 hStartState:: ds 1
hSelectState:: ds 1 hSelectState:: ds 1
hFilterMode:: ds 1
@ -195,18 +196,92 @@ GetInput::
; If left or right are pressed, zero out up and down. ; If left or right are pressed, zero out up and down.
.priorities .priorities
ldh a, [hFilterMode]
ld b, a
add a, b
add a, b
ld c, a
ld b, 0
ld hl, .jumps
add hl, bc
jp hl
.jumps
jp .dlru
jp .ulrd
jp .lrud
jp .udlr
no_jump
.dlru
ldh a, [hDownState]
cp a, 0
jr nz, .zerolru
ldh a, [hLeftState]
cp a, 0
jr nz, .zeroud
ldh a, [hRightState] ldh a, [hRightState]
cp a, 0 cp a, 0
jr nz, .zero ret z
jr .zeroud
.ulrd
ldh a, [hUpState]
cp a, 0
jr nz, .zerolrd
ldh a, [hLeftState]
cp a, 0
jr nz, .zeroud
ldh a, [hRightState]
cp a, 0
ret z
jr .zeroud
.lrud
ldh a, [hRightState]
cp a, 0
jr nz, .zeroud
ldh a, [hLeftState] ldh a, [hLeftState]
cp a, 0 cp a, 0
ret z ret z
jr .zeroud
.zero .udlr
ldh a, [hUpState]
cp a, 0
jr nz, .zerolr
ldh a, [hLeftState]
cp a, 0
ret z
jr .zerolr
.zeroud
xor a, a xor a, a
ldh [hUpState], a ldh [hUpState], a
ldh [hDownState], a ldh [hDownState], a
ret ret
.zerolr
xor a, a
ldh [hLeftState], a
ldh [hRightState], a
ret
.zerolrd
xor a, a
ldh [hLeftState], a
ldh [hRightState], a
ldh [hDownState], a
ret
.zerolru
xor a, a
ldh [hLeftState], a
ldh [hRightState], a
ldh [hUpState], a
ret
ENDC ENDC

View File

@ -75,6 +75,13 @@ sHIGMode::
sDisabled:: sDisabled::
db "----" db "----"
sFilterMode::
db "DLRU"
db "ULRD"
db "LRUD"
db "UDLR"
db "NONE"
sTetryButtons:: sTetryButtons::
db "THIS OPTION WILL" db "THIS OPTION WILL"
db "CHANGE WHICH WAY" db "CHANGE WHICH WAY"
@ -117,6 +124,12 @@ sTetrySTART::
db "START IN THE SP-" db "START IN THE SP-"
db "EED CURVE " db "EED CURVE "
sTetryFILTER::
db "THIS OPTION WILL"
db "DETERMINE WHICH "
db "D-PAD BUTTONS "
db "HAVE PRIORITY "
sTetryEXIT:: sTetryEXIT::
db "OH OKAY THEN- " db "OH OKAY THEN- "
db "BYE BYE! " db "BYE BYE! "
@ -224,10 +237,10 @@ sTitleScreenSettingsMap::
DB $0C,$1D,$1F,$01,$17,$10,$21,$10,$17,$01 DB $0C,$1D,$1F,$01,$17,$10,$21,$10,$17,$01
DB $28,$01,$01,$01,$01,$29,$00,$00,$00,$00 DB $28,$01,$01,$01,$01,$29,$00,$00,$00,$00
DB $00,$00,$00,$00,$00,$00,$00,$00,$5D,$01 DB $00,$00,$00,$00,$00,$00,$00,$00,$5D,$01
DB $0D,$0C,$0E,$16,$6F,$01,$01,$01,$01,$01 DB $0F,$2A,$1B,$0C,$0F,$01,$11,$14,$17,$1F
DB $01,$01,$01,$01,$01,$01,$01,$01,$00,$00 DB $10,$1D,$28,$01,$01,$01,$01,$29,$00,$00
DB $00,$00,$00,$00,$00,$00,$00,$00,$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,$6F,$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 $00,$00,$00,$00,$00,$00,$00,$00,$00,$00 DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
DB $00,$00,$01,$01,$01,$01,$01,$01,$01,$01 DB $00,$00,$01,$01,$01,$01,$01,$01,$01,$01

View File

@ -34,7 +34,8 @@ rDropModeState\1:: ds 1
rSpeedCurveState\1:: ds 1 rSpeedCurveState\1:: ds 1
rAlways20GState\1:: ds 1 rAlways20GState\1:: ds 1
rSelectedStartLevel\1:: ds 2 rSelectedStartLevel\1:: ds 2
rUnused\1:: ds (64-11) rFilterMode\1:: ds 1
rUnused\1:: ds (64-12)
ENDU ENDU
ENDM ENDM
@ -53,7 +54,8 @@ rDropModeState:: ds 1
rSpeedCurveState:: ds 1 rSpeedCurveState:: ds 1
rAlways20GState:: ds 1 rAlways20GState:: ds 1
rSelectedStartLevel:: ds 2 rSelectedStartLevel:: ds 2
rUnused:: ds (PROFILE_SIZE - 11) ; 11 = sum of the above rFilterMode:: ds 1
rUnused:: ds (PROFILE_SIZE - 12) ; 12 = sum of the above
ENDU ENDU
PROFILE 0 PROFILE 0
PROFILE 1 PROFILE 1
@ -121,6 +123,8 @@ TrustedLoad:
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
; Restore the start level. ; Restore the start level.
ld b, BANK_OTHER ld b, BANK_OTHER
@ -269,6 +273,10 @@ InitializeSRAM:
ld [rAlways20GState], a ld [rAlways20GState], a
ld [wAlways20GState], a ld [wAlways20GState], a
ld a, FILTER_MODE_DLRU
ld [rFilterMode], a
ldh [hFilterMode], a
; Set to the default start level. ; Set to the default start level.
ld hl, sDMGTSpeedCurve ld hl, sDMGTSpeedCurve
ld a, l ld a, l
@ -662,6 +670,10 @@ ResetProfile::
ld [rAlways20GState], a ld [rAlways20GState], a
ld [wAlways20GState], a ld [wAlways20GState], a
ld a, FILTER_MODE_DLRU
ld [rFilterMode], a
ldh [hFilterMode], a
; Set to the default start level. ; Set to the default start level.
ld hl, sDMGTSpeedCurve ld hl, sDMGTSpeedCurve
ld a, l ld a, l

View File

@ -355,7 +355,10 @@ SwitchTitleMode:
ldh [hSelectState], a ldh [hSelectState], a
ld [wDisplayingScoreMode], a ld [wDisplayingScoreMode], a
ld [wScoreFlipTimer], a ld [wScoreFlipTimer], a
jp RenderScores call RenderScores
ld a, LCDCF_ON | LCDCF_BGON | LCDCF_BLK01
ldh [rLCDC], a
ret
.switchCredits .switchCredits
ld de, sTitleScreenCreditsMap ld de, sTitleScreenCreditsMap
@ -875,6 +878,20 @@ TitleVBlankHandlerB:
ld bc, 4 ld bc, 4
call UnsafeMemCopy call UnsafeMemCopy
.filter
ld b, 0
ldh a, [hFilterMode]
sla a
sla a
ld c, a
ld hl, sFilterMode
add hl, bc
ld d, h
ld e, l
ld hl, TITLE_SETTINGS_FILTER
ld bc, 4
call UnsafeMemCopy
; START level. ; START level.
call DrawSpeedSettings call DrawSpeedSettings
@ -1030,6 +1047,7 @@ SettingsHandleLeft:
jp .curve jp .curve
jp .hig jp .hig
jp DecrementLevel jp DecrementLevel
jp .filter
no_jump no_jump
.buttons .buttons
@ -1112,6 +1130,20 @@ SettingsHandleLeft:
ld [rAlways20GState], a ld [rAlways20GState], a
ret ret
.filter
ldh a, [hFilterMode]
cp a, 0
jr z, :+
dec a
ldh [hFilterMode], a
ld [rFilterMode], a
ret
: ld a, FILTER_MODE_COUNT-1
ldh [hFilterMode], a
ld [rFilterMode], a
ret
SettingsHandleRight: SettingsHandleRight:
ld a, [wSelected] ld a, [wSelected]
@ -1135,6 +1167,7 @@ SettingsHandleRight:
jp .curve jp .curve
jp .hig jp .hig
jp IncrementLevel jp IncrementLevel
jp .filter
no_jump no_jump
.buttons .buttons
@ -1217,6 +1250,20 @@ SettingsHandleRight:
ld [rAlways20GState], a ld [rAlways20GState], a
ret ret
.filter
ldh a, [hFilterMode]
cp a, FILTER_MODE_COUNT-1
jr z, :+
inc a
ldh [hFilterMode], a
ld [rFilterMode], a
ret
: xor a, a
ldh [hFilterMode], a
ld [rFilterMode], a
ret
ProfileHandleA: ProfileHandleA:
ld a, [wSelected] ld a, [wSelected]
cp a, TITLE_PROFILE_SEL_BACK cp a, TITLE_PROFILE_SEL_BACK
@ -1571,14 +1618,6 @@ RecordsHandleSelect:
jp RenderScores jp RenderScores
RenderScores: RenderScores:
; Turn the screen off if it's on.
ldh a, [rLCDC]
and LCDCF_ON
jr z, :+ ; Screen is already off.
wait_vram
xor a, a
ldh [rLCDC], a
; Draw the mode. ; Draw the mode.
: ld b, 0 : ld b, 0
ld a, [wSelected] ld a, [wSelected]
@ -1591,7 +1630,7 @@ RenderScores:
ld e, l ld e, l
ld hl, TITLE_RECORDS_MODE ld hl, TITLE_RECORDS_MODE
ld bc, 4 ld bc, 4
call UnsafeMemCopy call SafeMemCopy
; Get the correct speed curve. ; Get the correct speed curve.
ld a, [wSelected] ld a, [wSelected]
@ -1613,35 +1652,59 @@ RenderScores:
ld a, [de] ld a, [de]
inc de inc de
add a, "0" add a, "0"
ld [hl+], a ld b, a
wait_vram
ld [hl], b
inc hl
ld a, [de] ld a, [de]
inc de inc de
add a, "0" add a, "0"
ld [hl+], a ld b, a
wait_vram
ld [hl], b
inc hl
ld a, [de] ld a, [de]
inc de inc de
add a, "0" add a, "0"
ld [hl+], a ld b, a
wait_vram
ld [hl], b
inc hl
ld a, [de] ld a, [de]
inc de inc de
add a, "0" add a, "0"
ld [hl+], a ld b, a
wait_vram
ld [hl], b
inc hl
ld a, [de] ld a, [de]
inc de inc de
add a, "0" add a, "0"
ld [hl+], a ld b, a
wait_vram
ld [hl], b
inc hl
ld a, [de] ld a, [de]
inc de inc de
add a, "0" add a, "0"
ld [hl+], a ld b, a
wait_vram
ld [hl], b
inc hl
ld a, [de] ld a, [de]
inc de inc de
add a, "0" add a, "0"
ld [hl+], a ld b, a
wait_vram
ld [hl], b
inc hl
ld a, [de] ld a, [de]
inc de inc de
add a, "0" add a, "0"
ld [hl+], a ld b, a
wait_vram
ld [hl], b
inc hl
; Go render the name. ; Go render the name.
jr .name\@ jr .name\@
@ -1659,29 +1722,53 @@ RenderScores:
; Render it. ; Render it.
ld a, "L" ld a, "L"
ld [hl+], a ld b, a
wait_vram
ld [hl], b
inc hl
ld a, "V" ld a, "V"
ld [hl+], a ld b, a
wait_vram
ld [hl], b
inc hl
ld a, "L" ld a, "L"
ld [hl+], a ld b, a
wait_vram
ld [hl], b
inc hl
ld a, 115 ld a, 115
ld [hl+], a ld b, a
wait_vram
ld [hl], b
inc hl
ld a, [de] ld a, [de]
inc de inc de
add a, "0" add a, "0"
ld [hl+], a ld b, a
wait_vram
ld [hl], b
inc hl
ld a, [de] ld a, [de]
inc de inc de
add a, "0" add a, "0"
ld [hl+], a ld b, a
wait_vram
ld [hl], b
inc hl
ld a, [de] ld a, [de]
inc de inc de
add a, "0" add a, "0"
ld [hl+], a ld b, a
wait_vram
ld [hl], b
inc hl
ld a, [de] ld a, [de]
inc de inc de
add a, "0" add a, "0"
ld [hl+], a ld b, a
wait_vram
ld [hl], b
inc hl
; And jump back to the name. ; And jump back to the name.
push hl push hl
@ -1702,13 +1789,22 @@ RenderScores:
; Render name. ; Render name.
ld a, [de] ld a, [de]
inc de inc de
ld [hl+], a ld b, a
wait_vram
ld [hl], b
inc hl
ld a, [de] ld a, [de]
inc de inc de
ld [hl+], a ld b, a
wait_vram
ld [hl], b
inc hl
ld a, [de] ld a, [de]
inc de inc de
ld [hl+], a ld b, a
wait_vram
ld [hl], b
inc hl
; Jump to tells. ; Jump to tells.
ld bc, 10 ld bc, 10
@ -1721,28 +1817,46 @@ RenderScores:
jr nz, .grade\@ jr nz, .grade\@
.nograde\@ .nograde\@
ld a, 197 ld a, 197
ld [hl+], a ld b, a
wait_vram
ld [hl], b
inc hl
jr .postgrade\@ jr .postgrade\@
.grade\@ .grade\@
add a, TITLE_RECORDS_GRADE_BASE add a, TITLE_RECORDS_GRADE_BASE
ld [hl+], a ld b, a
wait_vram
ld [hl], b
inc hl
.postgrade\@ .postgrade\@
ld a, [de] ld a, [de]
inc de inc de
add a, TITLE_RECORDS_RNG_BASE add a, TITLE_RECORDS_RNG_BASE
ld [hl+], a ld b, a
wait_vram
ld [hl], b
inc hl
ld a, [de] ld a, [de]
inc de inc de
add a, TITLE_RECORDS_ROT_BASE add a, TITLE_RECORDS_ROT_BASE
ld [hl+], a ld b, a
wait_vram
ld [hl], b
inc hl
ld a, [de] ld a, [de]
inc de inc de
add a, TITLE_RECORDS_DROP_BASE add a, TITLE_RECORDS_DROP_BASE
ld [hl+], a ld b, a
wait_vram
ld [hl], b
inc hl
ld a, [de] ld a, [de]
inc de inc de
add a, TITLE_RECORDS_HIG_BASE add a, TITLE_RECORDS_HIG_BASE
ld [hl+], a ld b, a
wait_vram
ld [hl], b
inc hl
; Jump to next line. ; Jump to next line.
push hl push hl
@ -1757,8 +1871,6 @@ RenderScores:
add hl, bc add hl, bc
ENDR ENDR
ld a, LCDCF_ON | LCDCF_BGON | LCDCF_BLK01
ldh [rLCDC], a
ret ret