Add toggle.

This commit is contained in:
Randy Thiemann 2023-10-21 14:33:18 +02:00
parent 33e1bf3520
commit fa73dc3a2b
6 changed files with 90 additions and 14 deletions

View File

@ -40,14 +40,20 @@ CHARMAP "Y", 100
CHARMAP "Z", 101
CHARMAP "!", 102
CHARMAP "?", 103
CHARMAP "[", 129
CHARMAP "]", 130
CHARMAP "/", 128
CHARMAP "-", 127
CHARMAP "|", 126
CHARMAP "#", 125
SECTION "Static Data", ROM0
sLeady:: db " READY? "
sGo:: db " GO "
sGameOver:: db "GAME OVER!"
sGameOver2:: db " RETRY A "
sGameOver3:: db " QUIT B "
sGameOver2:: db " RETRY[A] "
sGameOver3:: db " QUIT [B] "
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

@ -91,12 +91,16 @@ 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 FIELD_TOP_LEFT EQU $9800+1
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_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

View File

@ -53,7 +53,7 @@ OAMDMA::
ldh a, [hGameState]
cp a, b
jp nz, BlitField
jp EventLoop
jp TitleVBlankHandler
ENDL
OAMDMAEnd::

View File

@ -191,7 +191,7 @@ fetchPieceMode:
.cp1
cp a, 0
jr z, .checkIRSB
ld a, 1
ld a, 3
ldh [hCurrentPieceRotationState], a
ld a, SFX_IRS
call SFXEnqueue
@ -202,13 +202,13 @@ fetchPieceMode:
jr z, .ldb2
.lda2
ld a, [hAState]
jr .cp1
jr .cp2
.ldb2
ld a, [hBState]
.cp2
cp a, 0
jr z, .checkJingle
ld a, 3
ld a, 1
ldh [hCurrentPieceRotationState], a
ld a, SFX_IRS
call SFXEnqueue
@ -359,19 +359,35 @@ DoHold:
; Check if IRS is requested.
; Apply the rotation if so.
.checkIRSHA
ld a, [hSwapAB]
cp a, 0
jr z, .lda3
.ldb3
ld a, [hBState]
jr .cp3
.lda3
ld a, [hAState]
.cp3
cp a, 0
jr z, .checkIRSHB
ld a, 1
ld a, 3
ldh [hCurrentPieceRotationState], a
ld a, SFX_IRS
call SFXEnqueue
.checkIRSHB
ld a, [hSwapAB]
cp a, 0
jr z, .ldb4
.lda4
ld a, [hAState]
jr .cp4
.ldb4
ld a, [hBState]
.cp4
cp a, 0
jr z, .noRotation
ld a, 3
ld a, 1
ldh [hCurrentPieceRotationState], a
ld a, SFX_IRS
call SFXEnqueue

View File

@ -46,6 +46,7 @@ SwitchToTitle::
TitleEventLoopHandler::
; Start game?
ldh a, [hStartState]
ld b, a
ldh a, [hAState]
@ -54,9 +55,58 @@ TitleEventLoopHandler::
or a, b
or a, c
cp a, 1
jp nz, EventLoopPostHandler
jr nz, :+
call SwitchToGameplay
jp EventLoopPostHandler
; Toggle A/B?
: ldh a, [hLeftState]
ld b, a
ldh a, [hRightState]
or a, b
cp a, 1
jr nz, :+
ldh a, [hSwapAB]
cpl
ldh [hSwapAB], a
jp EventLoopPostHandler
; Start level up?
: ldh a, [hUpState]
cp a, 1
jr nz, :+
; TODO
jp EventLoopPostHandler
; Start level down?
: ldh a, [hDownState]
cp a, 1
jr nz, :+
; TODO
: jp EventLoopPostHandler
TitleVBlankHandler::
ldh a, [hSwapAB]
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
: ld hl, TITLE_A
ld a, TILE_B
ld [hl+], a
inc hl
dec a
ld [hl], a
wait_vblank_end
jp EventLoop
ENDC

View File

@ -1,5 +1,5 @@
#Emulicious settings file
#Sat Oct 21 14:06:55 CEST 2023
#Sat Oct 21 14:31:03 CEST 2023
WindowProfilerWindowOpen=false
WindowEventViewerWindowHeight=1416
WindowEventViewerWindowDivider=876
@ -7,7 +7,7 @@ WindowMemoryTracerWindowY=631
WindowMemoryTracerWindowX=383
Update=2
AudioSync=false
DebuggerMemoryTabVisibleRect=0,0,687,128
DebuggerMemoryTabVisibleRect=0,0,0,0
WindowProfilerWindowWidth=1073
UninitializedMemoryBreakpointSuspend=true
GameBoyErrorBreakpointEnabled32=false
@ -92,7 +92,7 @@ GameBoyErrorBreakpointSuspend2=true
GameBoyErrorBreakpointSuspend1=true
GameBoyErrorBreakpointSuspend0=true
DebuggerConsoleLogBreakpoints=true
WindowDebuggerOpen=true
WindowDebuggerOpen=false
Gamepad1Key37=-1
Gamepad1Key36=-1
Gamepad1Key35=-1
@ -271,8 +271,8 @@ Gamepad0Key3=-1
Gamepad0Key2=-1
Gamepad0Key1=-1
Gamepad0Key0=-1
WindowDebuggerY=-8
WindowDebuggerX=-8
WindowDebuggerY=544
WindowDebuggerX=210
InterruptBreakpointSuspend=true
SMSGamepadAKeyboard=false
GameBoyErrorBreakpointSuspend32=true