mirror of
https://github.com/a2-4am/4cade.git
synced 2024-06-28 10:29:31 +00:00
refactor DrawUI some more
This commit is contained in:
parent
6f1895c1a7
commit
d28a84a6f6
|
@ -9,7 +9,7 @@
|
||||||
; D000..E5F4 - persistent data structures (per-game cheat categories,
|
; D000..E5F4 - persistent data structures (per-game cheat categories,
|
||||||
; gGlobalPrefsStore, gGamesListStore)
|
; gGlobalPrefsStore, gGamesListStore)
|
||||||
; ...unused...
|
; ...unused...
|
||||||
; EBCF..FFF9 - main program code
|
; EBEE..FFF9 - main program code
|
||||||
; FFFA..FFFF - NMI, reset, IRQ vectors
|
; FFFA..FFFF - NMI, reset, IRQ vectors
|
||||||
;
|
;
|
||||||
; LC RAM BANK 2
|
; LC RAM BANK 2
|
||||||
|
|
|
@ -94,21 +94,9 @@ GameCount = *+1
|
||||||
ldx gGameToLaunch
|
ldx gGameToLaunch
|
||||||
; execution falls through here
|
; execution falls through here
|
||||||
.OnBrowseChanged
|
.OnBrowseChanged
|
||||||
+LDADDR gGamesListStore
|
; in: X = game index
|
||||||
jsr okvs_nth ; get the filename of the new game
|
jsr LoadGameTitleOffscreen
|
||||||
+STAY @key
|
jmp DrawUIWithoutDots
|
||||||
|
|
||||||
jsr GetOffscreenAddress ; load new title screenshot offscreen
|
|
||||||
sta + ; new title screenshot (offscreen)
|
|
||||||
jsr LoadFile
|
|
||||||
!word kHGRTitleDirectory
|
|
||||||
@key !word $FDFD ; SMC
|
|
||||||
!byte $00
|
|
||||||
+ !byte $FD ; SMC
|
|
||||||
|
|
||||||
clc
|
|
||||||
jsr DrawUIOffscreen
|
|
||||||
jmp ShowOtherPage
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,9 @@
|
||||||
; - GetOffscreenAddress
|
; - GetOffscreenAddress
|
||||||
; - LoadTitleOffscreen
|
; - LoadTitleOffscreen
|
||||||
; - LoadCoverOffscreen
|
; - LoadCoverOffscreen
|
||||||
; - DrawUIOffscreen
|
; - LoadGameTitleOffscreen
|
||||||
|
; - DrawBrowseUI
|
||||||
|
; - DrawSearchUI
|
||||||
; - ShowOtherPage
|
; - ShowOtherPage
|
||||||
; - ToggleOffscreenPage
|
; - ToggleOffscreenPage
|
||||||
; - CoverFade
|
; - CoverFade
|
||||||
|
@ -143,6 +145,20 @@ LoadCoverOffscreen
|
||||||
!byte 5
|
!byte 5
|
||||||
!text "COVER"
|
!text "COVER"
|
||||||
|
|
||||||
|
LoadGameTitleOffscreen
|
||||||
|
; in: X = game index
|
||||||
|
+LDADDR gGamesListStore
|
||||||
|
jsr okvs_nth
|
||||||
|
+STAY @fname
|
||||||
|
jsr GetOffscreenAddress
|
||||||
|
sta +
|
||||||
|
jsr LoadFile
|
||||||
|
!word kHGRTitleDirectory
|
||||||
|
@fname !word $FDFD ; SMC
|
||||||
|
!byte $00
|
||||||
|
+ !byte $FD ; SMC
|
||||||
|
rts
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
; CoverFade
|
; CoverFade
|
||||||
; load cover screen and animate per-character fade
|
; load cover screen and animate per-character fade
|
||||||
|
@ -168,24 +184,22 @@ CoverFade
|
||||||
!text "COVERFADE"
|
!text "COVERFADE"
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
; DrawUIOffscreen
|
; DrawUIWithoutDots/DrawUI
|
||||||
; draw 2- or 4-line search/browse UI on the HGR page that is not currently
|
; draw 2- or 4-line UI on the HGR page that is not currently showing, then
|
||||||
; showing
|
; show that HGR page
|
||||||
;
|
;
|
||||||
; in: gGameToLaunch = game index, or #$FF if no game is selected
|
; in: gGameToLaunch = game index, or #$FF if no game is selected
|
||||||
; C set = print block cursor after game title and print dots to
|
|
||||||
; highlight matching characters
|
|
||||||
; C clear = don't print either of those things
|
|
||||||
; out: all flags and registers clobbered
|
; out: all flags and registers clobbered
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
DrawUIOffscreen
|
DrawUIWithoutDots
|
||||||
php
|
|
||||||
bcc + ; set up cursor printing if caller wanted that
|
|
||||||
lda #$7F
|
|
||||||
+HIDE_NEXT_2_BYTES
|
|
||||||
+
|
|
||||||
lda #" "
|
lda #" "
|
||||||
sta @printCursor+1
|
clc
|
||||||
|
bcc +
|
||||||
|
DrawUI
|
||||||
|
lda #$7F
|
||||||
|
sec
|
||||||
|
+ sta @printCursor+1 ; set up cursor printing based on entry point
|
||||||
|
php
|
||||||
|
|
||||||
ldy #39
|
ldy #39
|
||||||
- lda #$00 ; horizontal bar character
|
- lda #$00 ; horizontal bar character
|
||||||
|
@ -307,7 +321,7 @@ DrawUIOffscreen
|
||||||
jsr Draw40Chars ; draw UI line 2 on offscreen page
|
jsr Draw40Chars ; draw UI line 2 on offscreen page
|
||||||
|
|
||||||
bit gCheatsEnabled ; if cheats are disabled, then we're done drawing UI
|
bit gCheatsEnabled ; if cheats are disabled, then we're done drawing UI
|
||||||
bpl OffscreenDone
|
bpl @uidone
|
||||||
; (SAVE) still points to length-prefixed cheat description
|
; (SAVE) still points to length-prefixed cheat description
|
||||||
ldy #0
|
ldy #0
|
||||||
lda (SAVE),y ; A = length of cheat description
|
lda (SAVE),y ; A = length of cheat description
|
||||||
|
@ -346,7 +360,9 @@ DrawUIOffscreen
|
||||||
inc VTAB
|
inc VTAB
|
||||||
plp
|
plp
|
||||||
+LDADDR gPathname
|
+LDADDR gPathname
|
||||||
jmp DrawCenteredString ; draw cheat UI line 2
|
jsr DrawCenteredString ; draw cheat UI line 2
|
||||||
|
|
||||||
|
@uidone jmp ShowOtherPage
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
; ClearOffscreen
|
; ClearOffscreen
|
||||||
|
@ -376,7 +392,6 @@ ClearOffscreen
|
||||||
inc @a+2
|
inc @a+2
|
||||||
dex
|
dex
|
||||||
bne @a
|
bne @a
|
||||||
OffscreenDone
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
|
|
|
@ -126,9 +126,7 @@ SearchMode
|
||||||
ldx #$FF
|
ldx #$FF
|
||||||
stx gGameToLaunch ; no game selected
|
stx gGameToLaunch ; no game selected
|
||||||
jsr LoadTitleOffscreen
|
jsr LoadTitleOffscreen
|
||||||
clc
|
jsr DrawUIWithoutDots
|
||||||
jsr DrawUIOffscreen
|
|
||||||
jsr ShowOtherPage
|
|
||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@ -147,30 +145,14 @@ SearchMode
|
||||||
+
|
+
|
||||||
ldx BestMatchIndex ; check if the new best match is the same
|
ldx BestMatchIndex ; check if the new best match is the same
|
||||||
cpx gGameToLaunch ; as the current best match
|
cpx gGameToLaunch ; as the current best match
|
||||||
php ; (we'll use this later to skip reloading)
|
|
||||||
stx gGameToLaunch
|
stx gGameToLaunch
|
||||||
+LDADDR gGamesListStore
|
|
||||||
jsr okvs_nth ; get the filename of the new best match
|
|
||||||
+STAY @key
|
|
||||||
plp
|
|
||||||
bne +
|
bne +
|
||||||
jsr ToggleOffscreenPage ; Since we're not loading a new screenshot
|
jsr ToggleOffscreenPage ; Since we're not loading a new screenshot
|
||||||
; we fake switching the 'offscreen' page
|
; we fake switching the 'offscreen' page
|
||||||
; in order to draw on the visible page.
|
; in order to draw on the visible page.
|
||||||
bpl @skipload ; always branches
|
bpl @noload ; (always branches)
|
||||||
+
|
+ jsr LoadGameTitleOffscreen
|
||||||
jsr GetOffscreenAddress ; we have a new best match, so load the
|
@noload jmp DrawUI
|
||||||
sta + ; new title screenshot (offscreen)
|
|
||||||
jsr LoadFile
|
|
||||||
!word kHGRTitleDirectory
|
|
||||||
@key !word $FDFD ; SMC
|
|
||||||
!byte $00
|
|
||||||
+ !byte $FD ; SMC
|
|
||||||
|
|
||||||
@skipload
|
|
||||||
sec
|
|
||||||
jsr DrawUIOffscreen
|
|
||||||
jmp ShowOtherPage
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user