Add profile screen.
This commit is contained in:
parent
7103fac524
commit
21691b1f52
BIN
bin/DMGTRIS.GBC
BIN
bin/DMGTRIS.GBC
Binary file not shown.
1314
bin/DMGTRIS.map
1314
bin/DMGTRIS.map
File diff suppressed because it is too large
Load Diff
Binary file not shown.
1025
bin/DMGTRIS.sym
1025
bin/DMGTRIS.sym
File diff suppressed because it is too large
Load Diff
34
src/gbc.asm
34
src/gbc.asm
|
@ -294,7 +294,39 @@ GBCTitleProcess::
|
|||
jp UnsafeMemSet
|
||||
|
||||
.eventLoopProfile
|
||||
ret
|
||||
; Palette for the title?
|
||||
ldh a, [hFrameCtr]
|
||||
and $0F
|
||||
cp a, $01
|
||||
jr nz, .noinc3
|
||||
ld a, [wTitlePal]
|
||||
inc a
|
||||
cp a, $07
|
||||
jr c, .nores3
|
||||
ld a, $00
|
||||
.nores3
|
||||
ld [wTitlePal], a
|
||||
.noinc3
|
||||
|
||||
; Set the palette for the title.
|
||||
ld a, [wTitlePal]
|
||||
ld d, a
|
||||
ld hl, wShadowTileAttrs + (0*32)
|
||||
ld bc, (1*32)
|
||||
call UnsafeMemSet
|
||||
|
||||
; And the selected row.
|
||||
ld a, [wSelected]
|
||||
inc a
|
||||
ld hl, wShadowTileAttrs + (1*32)
|
||||
ld bc, 32
|
||||
: add hl, bc
|
||||
dec a
|
||||
jr nz, :-
|
||||
ld a, 3
|
||||
ld d, a
|
||||
ld bc, 32
|
||||
jp UnsafeMemSet
|
||||
|
||||
.eventLoopSettings
|
||||
; Palette for the title?
|
||||
|
|
|
@ -444,4 +444,17 @@ DEF TITLE_SETTINGS_TETRY EQU $99C0
|
|||
DEF TITLE_SETTINGS_SEL_BACK EQU 7
|
||||
|
||||
|
||||
DEF TITLE_PROFILE_OPTION_BASE EQU $9842
|
||||
DEF TITLE_PROFILE_OPTIONS EQU 6
|
||||
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_SEL_RESET EQU 4
|
||||
DEF TITLE_PROFILE_SEL_BACK EQU 5
|
||||
|
||||
|
||||
DEF PROFILE_COUNT EQU 10
|
||||
|
||||
|
||||
ENDC
|
||||
|
|
Binary file not shown.
|
@ -336,5 +336,76 @@ sTitleScreenCreditsMap::
|
|||
DB $00,$00
|
||||
sTitleScreenCreditsMapEnd::
|
||||
|
||||
sTitleScreenProfileMap::
|
||||
DB $01,$01,$01,$01,$01,$01,$1B,$1D,$1A,$11
|
||||
DB $14,$17,$10,$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
|
||||
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
|
||||
DB $01,$01,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
DB $00,$00,$00,$00,$01,$01,$5D,$01,$19,$20
|
||||
DB $18,$0D,$10,$1D,$01,$01,$01,$01,$28,$01
|
||||
DB $29,$01,$01,$01,$00,$00,$00,$00,$00,$00
|
||||
DB $00,$00,$00,$00,$00,$00,$01,$01,$5D,$01
|
||||
DB $14,$19,$14,$1F,$14,$0C,$17,$01,$03,$01
|
||||
DB $28,$01,$29,$01,$01,$01,$00,$00,$00,$00
|
||||
DB $00,$00,$00,$00,$00,$00,$00,$00,$01,$01
|
||||
DB $5D,$01,$14,$19,$14,$1F,$14,$0C,$17,$01
|
||||
DB $04,$01,$28,$01,$29,$01,$01,$01,$00,$00
|
||||
DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
DB $01,$01,$5D,$01,$14,$19,$14,$1F,$14,$0C
|
||||
DB $17,$01,$05,$01,$28,$01,$29,$01,$01,$01
|
||||
DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
DB $00,$00,$01,$01,$5D,$01,$1D,$10,$1E,$10
|
||||
DB $1F,$01,$01,$01,$01,$01,$01,$01,$01,$01
|
||||
DB $01,$01,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
DB $00,$00,$00,$00,$01,$01,$5D,$01,$0D,$0C
|
||||
DB $0E,$16,$6F,$01,$01,$01,$01,$01,$01,$01
|
||||
DB $01,$01,$01,$01,$00,$00,$00,$00,$00,$00
|
||||
DB $00,$00,$00,$00,$00,$00,$01,$01,$01,$01
|
||||
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
|
||||
DB $01,$01,$01,$01,$01,$01,$00,$00,$00,$00
|
||||
DB $00,$00,$00,$00,$00,$00,$00,$00,$01,$01
|
||||
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
|
||||
DB $01,$01,$01,$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 $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
|
||||
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
|
||||
DB $01,$01,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
DB $00,$00,$00,$00,$01,$01,$01,$01,$01,$01
|
||||
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
|
||||
DB $01,$01,$01,$01,$00,$00,$00,$00,$00,$00
|
||||
DB $00,$00,$00,$00,$00,$00,$01,$01,$01,$01
|
||||
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
|
||||
DB $01,$01,$01,$01,$01,$01,$00,$00,$00,$00
|
||||
DB $00,$00,$00,$00,$00,$00,$00,$00,$01,$01
|
||||
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
|
||||
DB $01,$01,$01,$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 $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
|
||||
DB $01,$01,$01,$01,$01,$01,$01,$01,$01,$01
|
||||
DB $01,$01,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
DB $00,$00,$00,$00,$0C,$2A,$0E,$1A,$19,$11
|
||||
DB $01,$0D,$2A,$0D,$0C,$0E,$16,$01,$6D,$2A
|
||||
DB $19,$0C,$21,$14,$00,$00,$00,$00,$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 $00,$00,$00,$00,$00,$00,$00,$00,$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 $00,$00,$00,$00,$00,$00,$00,$00,$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 $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
DB $00,$00
|
||||
sTitleScreenProfileMapEnd::
|
||||
|
||||
|
||||
ENDC
|
||||
|
|
49
src/sram.asm
49
src/sram.asm
|
@ -535,4 +535,53 @@ ChangeProfile::
|
|||
jp TrustedLoad
|
||||
|
||||
|
||||
ResetProfile::
|
||||
ld a, "P"
|
||||
ld [rProfileName], a
|
||||
ld [wProfileName], a
|
||||
ld a, "R"
|
||||
ld [rProfileName+1], a
|
||||
ld [wProfileName+1], a
|
||||
ld a, [rLastProfile]
|
||||
add a, "0"
|
||||
ld [rProfileName+2], a
|
||||
ld [wProfileName+2], a
|
||||
|
||||
ld a, BUTTON_MODE_NORM
|
||||
ld [rSwapABState], a
|
||||
ld [wSwapABState], a
|
||||
|
||||
ld a, RNG_MODE_TGM3
|
||||
ld [rRNGModeState], a
|
||||
ld [wRNGModeState], a
|
||||
|
||||
ld a, ROT_MODE_ARSTI
|
||||
ld [rRotModeState], a
|
||||
ld [wRotModeState], a
|
||||
|
||||
ld a, DROP_MODE_FIRM
|
||||
ld [rDropModeState], a
|
||||
ld [wDropModeState], a
|
||||
|
||||
ld a, SCURVE_DMGT
|
||||
ld [rSpeedCurveState], a
|
||||
ld [wSpeedCurveState], a
|
||||
|
||||
ld a, HIG_MODE_OFF
|
||||
ld [rAlways20GState], a
|
||||
ld [wAlways20GState], a
|
||||
|
||||
; Set to the default start level.
|
||||
ld hl, sDMGTSpeedCurve
|
||||
ld a, l
|
||||
ldh [hStartSpeed], a
|
||||
ld a, h
|
||||
ldh [hStartSpeed+1], a
|
||||
|
||||
xor a, a
|
||||
ld [rSelectedStartLevel], a
|
||||
ld [rSelectedStartLevel+1], a
|
||||
ret
|
||||
|
||||
|
||||
ENDC
|
||||
|
|
|
@ -324,6 +324,10 @@ SwitchTitleMode:
|
|||
ret
|
||||
|
||||
.switchProfile
|
||||
ld de, sTitleScreenProfileMap
|
||||
ld hl, $9800
|
||||
ld bc, sTitleScreenProfileMapEnd - sTitleScreenProfileMap
|
||||
call UnsafeMemCopy
|
||||
call GBCTitleInit
|
||||
ld a, LCDCF_ON | LCDCF_BGON | LCDCF_BLK01
|
||||
ldh [rLCDC], a
|
||||
|
@ -413,6 +417,63 @@ TitleEventLoopHandlerB:
|
|||
jp MainHandleDown
|
||||
|
||||
.eventLoopProfile
|
||||
; A/Start?
|
||||
ldh a, [hAState]
|
||||
cp a, 1
|
||||
jp z, ProfileHandleA
|
||||
ldh a, [hStartState]
|
||||
cp a, 1
|
||||
jp z, ProfileHandleA
|
||||
|
||||
; B?
|
||||
ldh a, [hBState]
|
||||
cp a, 1
|
||||
jp z, ProfileHandleB
|
||||
|
||||
; Directions?
|
||||
ldh a, [hUpState]
|
||||
cp a, 1
|
||||
jp z, ProfileHandleUp
|
||||
cp a, 16
|
||||
jp c, .d2
|
||||
ldh a, [hFrameCtr]
|
||||
and 3
|
||||
cp a, 3
|
||||
jp z, ProfileHandleUp
|
||||
|
||||
.d2
|
||||
ldh a, [hDownState]
|
||||
cp a, 1
|
||||
jp z, ProfileHandleDown
|
||||
cp a, 16
|
||||
jp c, .l2
|
||||
ldh a, [hFrameCtr]
|
||||
and 3
|
||||
cp a, 3
|
||||
jp z, ProfileHandleDown
|
||||
|
||||
.l2
|
||||
ldh a, [hLeftState]
|
||||
cp a, 1
|
||||
jp z, ProfileHandleLeft
|
||||
cp a, 16
|
||||
jp c, .r2
|
||||
ldh a, [hLeftState]
|
||||
and 3
|
||||
cp a, 3
|
||||
jp z, ProfileHandleLeft
|
||||
|
||||
.r2
|
||||
ldh a, [hRightState]
|
||||
cp a, 1
|
||||
jp z, ProfileHandleRight
|
||||
cp a, 16
|
||||
ret c
|
||||
ldh a, [hRightState]
|
||||
and 3
|
||||
cp a, 3
|
||||
ret nz
|
||||
jp ProfileHandleRight
|
||||
ret
|
||||
|
||||
.eventLoopSettings
|
||||
|
@ -625,8 +686,43 @@ TitleVBlankHandlerB:
|
|||
jp DrawSpeedMain
|
||||
|
||||
.vblankProfile
|
||||
; What is the current option?
|
||||
DEF option = 0
|
||||
REPT TITLE_PROFILE_OPTIONS
|
||||
ld hl, TITLE_PROFILE_OPTION_BASE+(32*option)
|
||||
ld a, [wSelected]
|
||||
cp a, option
|
||||
jr z, .selected\@
|
||||
.notselected\@:
|
||||
ld a, TILE_UNSELECTED
|
||||
ld [hl], a
|
||||
jr .done\@
|
||||
.selected\@:
|
||||
ld a, TILE_SELECTED
|
||||
ld [hl], a
|
||||
.done\@:
|
||||
DEF option += 1
|
||||
ENDR
|
||||
|
||||
; Which profile.
|
||||
ld a, [rLastProfile]
|
||||
add a, "0"
|
||||
ld hl, TITLE_PROFILE_INDEX
|
||||
ld [hl], a
|
||||
|
||||
; Name.
|
||||
ld a, [wProfileName+0]
|
||||
ld hl, TITLE_PROFILE_NAME_0
|
||||
ld [hl], a
|
||||
ld a, [wProfileName+1]
|
||||
ld hl, TITLE_PROFILE_NAME_1
|
||||
ld [hl], a
|
||||
ld a, [wProfileName+2]
|
||||
ld hl, TITLE_PROFILE_NAME_2
|
||||
ld [hl], a
|
||||
ret
|
||||
|
||||
|
||||
.vblankSettings
|
||||
; What is the current option?
|
||||
DEF option = 0
|
||||
|
@ -791,7 +887,7 @@ MainHandleA:
|
|||
.jumps
|
||||
jp SwitchToGameplay
|
||||
jp SwitchToGameplayBig
|
||||
no_jump
|
||||
jp .toprofile
|
||||
jp .tosettings
|
||||
no_jump
|
||||
jp .tocredits
|
||||
|
@ -804,6 +900,10 @@ MainHandleA:
|
|||
ld a, TITLE_CREDITS
|
||||
jp SwitchTitleMode
|
||||
|
||||
.toprofile
|
||||
ld a, TITLE_PROFILE
|
||||
jp SwitchTitleMode
|
||||
|
||||
|
||||
MainHandleUp:
|
||||
ld a, [wSelected]
|
||||
|
@ -837,6 +937,7 @@ SettingsHandleA:
|
|||
jp SwitchTitleMode
|
||||
|
||||
|
||||
ProfileHandleB:
|
||||
SettingsHandleB:
|
||||
ld a, TITLE_MAIN
|
||||
jp SwitchTitleMode
|
||||
|
@ -1075,6 +1176,173 @@ SettingsHandleRight:
|
|||
ld [rAlways20GState], a
|
||||
ret
|
||||
|
||||
ProfileHandleA:
|
||||
ld a, [wSelected]
|
||||
cp a, TITLE_PROFILE_SEL_BACK
|
||||
ld b, a
|
||||
ld a, TITLE_MAIN
|
||||
jp z, SwitchTitleMode
|
||||
ld a, b
|
||||
cp a, TITLE_PROFILE_SEL_RESET
|
||||
jp z, ResetProfile
|
||||
jp ProfileHandleRight
|
||||
|
||||
|
||||
ProfileHandleRight:
|
||||
ld a, [wSelected]
|
||||
cp a, TITLE_PROFILE_SEL_BACK
|
||||
ret z
|
||||
cp a, TITLE_PROFILE_SEL_RESET
|
||||
ret z
|
||||
|
||||
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 .idx
|
||||
jp .l0
|
||||
jp .l1
|
||||
jp .l2
|
||||
no_jump
|
||||
|
||||
.idx
|
||||
ld a, [rLastProfile]
|
||||
inc a
|
||||
cp a, PROFILE_COUNT
|
||||
jr nz, .doit
|
||||
xor a, a
|
||||
.doit
|
||||
jp ChangeProfile
|
||||
|
||||
.l0
|
||||
ld a, [wProfileName+0]
|
||||
inc a
|
||||
cp a, "Z"+1
|
||||
jr nz, .doit1
|
||||
ld a, "0"-1
|
||||
.doit1
|
||||
ld [wProfileName+0], a
|
||||
ld [rProfileName+0], a
|
||||
ret
|
||||
|
||||
.l1
|
||||
ld a, [wProfileName+1]
|
||||
inc a
|
||||
cp a, "Z"+1
|
||||
jr nz, .doit2
|
||||
ld a, "0"-1
|
||||
.doit2
|
||||
ld [wProfileName+1], a
|
||||
ld [rProfileName+1], a
|
||||
ret
|
||||
|
||||
.l2
|
||||
ld a, [wProfileName+2]
|
||||
inc a
|
||||
cp a, "Z"+1
|
||||
jr nz, .doit3
|
||||
ld a, "0"-1
|
||||
.doit3
|
||||
ld [wProfileName+2], a
|
||||
ld [rProfileName+2], a
|
||||
ret
|
||||
|
||||
|
||||
ProfileHandleLeft:
|
||||
ld a, [wSelected]
|
||||
cp a, TITLE_PROFILE_SEL_BACK
|
||||
ret z
|
||||
cp a, TITLE_PROFILE_SEL_RESET
|
||||
ret z
|
||||
|
||||
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 .idx
|
||||
jp .l0
|
||||
jp .l1
|
||||
jp .l2
|
||||
no_jump
|
||||
|
||||
.idx
|
||||
ld a, [rLastProfile]
|
||||
dec a
|
||||
cp a, $FF
|
||||
jr nz, .doit
|
||||
ld a, PROFILE_COUNT-1
|
||||
.doit
|
||||
jp ChangeProfile
|
||||
|
||||
.l0
|
||||
ld a, [wProfileName+0]
|
||||
dec a
|
||||
cp a, "0"-2
|
||||
jr nz, .doit1
|
||||
ld a, "Z"
|
||||
.doit1
|
||||
ld [wProfileName+0], a
|
||||
ld [rProfileName+0], a
|
||||
ret
|
||||
|
||||
.l1
|
||||
ld a, [wProfileName+1]
|
||||
dec a
|
||||
cp a, "0"-2
|
||||
jr nz, .doit2
|
||||
ld a, "Z"
|
||||
.doit2
|
||||
ld [wProfileName+1], a
|
||||
ld [rProfileName+1], a
|
||||
ret
|
||||
|
||||
.l2
|
||||
ld a, [wProfileName+2]
|
||||
dec a
|
||||
cp a, "0"-2
|
||||
jr nz, .doit3
|
||||
ld a, "Z"
|
||||
.doit3
|
||||
ld [wProfileName+2], a
|
||||
ld [rProfileName+2], a
|
||||
ret
|
||||
|
||||
|
||||
ProfileHandleDown:
|
||||
ld a, [wSelected]
|
||||
cp a, TITLE_PROFILE_OPTIONS-1
|
||||
jr z, :+
|
||||
inc a
|
||||
ld [wSelected], a
|
||||
ret
|
||||
: xor a, a
|
||||
ld [wSelected], a
|
||||
ret
|
||||
|
||||
|
||||
ProfileHandleUp:
|
||||
ld a, [wSelected]
|
||||
cp a, 0
|
||||
jr z, :+
|
||||
dec a
|
||||
ld [wSelected], a
|
||||
ret
|
||||
: ld a, TITLE_PROFILE_OPTIONS-1
|
||||
ld [wSelected], a
|
||||
ret
|
||||
|
||||
|
||||
; Decrements start level.
|
||||
DecrementLevel:
|
||||
|
|
Loading…
Reference in New Issue