4cade/src/ui.attract.hgr.a

219 lines
6.7 KiB
Plaintext
Raw Normal View History

2019-01-15 00:06:58 +00:00
;license:MIT
;(c) 2018-9 by 4am
2019-01-15 00:06:58 +00:00
;
; HGR title and action slideshows
;
; Public functions
; - HGRTitleSlideshow
; - HGRActionSlideshow
2019-06-26 02:44:39 +00:00
; - HGRSingle
2019-01-15 00:06:58 +00:00
;
2019-06-26 02:44:39 +00:00
!zone {
2019-01-15 00:06:58 +00:00
HGRTitleSlideshow
2019-06-26 02:44:39 +00:00
jsr .LoadHGRTransition ; load transition effect code at $6000
2019-01-15 00:06:58 +00:00
jsr okvs_iter ; cycle through all listed HGR files
!word gSlideshowStore
2019-06-26 02:44:39 +00:00
!word .HGRTitleCallback ; address of callback (called on each file)
2019-01-15 00:06:58 +00:00
rts ; exit with last picture still visible
HGRActionSlideshow
2019-06-26 02:44:39 +00:00
jsr .LoadHGRTransition ; load transition effect code at $6000
2019-01-15 00:06:58 +00:00
jsr okvs_iter ; cycle through all listed HGR files
!word gSlideshowStore
2019-06-26 02:44:39 +00:00
!word .HGRActionCallback ; address of callback (called on each file)
2019-01-15 00:06:58 +00:00
rts ; exit with last picture still visible
2019-06-26 02:44:39 +00:00
HGRSingle
2019-06-27 02:51:34 +00:00
jsr SetPath
jsr LoadFile ; load HGR screenshot at $4000
jsr .LoadHGRTransition ; load transition effect code at $6000
+LDADDR $6000
jmp ExecuteTransitionAndWait
2019-01-15 00:06:58 +00:00
;------------------------------------------------------------------------------
2019-06-26 02:44:39 +00:00
; .HGRTitleCallback [private]
2019-01-15 00:06:58 +00:00
; callback called by okvs_iter on gSlideshowStore
; to load and display a single HGR title screenshot
; in: A/Y contains address of filename (name only, path is always /TITLE.HGR/)
2019-01-15 00:06:58 +00:00
; X contains 0-based index of the current record in gSlideshowStore
; out: all registers and flags clobbered
; $0800..$1EFF preserved (this contains the gSlideshowStore OKVS data)
; $2000..$BFFF clobbered by graphics data and transition code
;------------------------------------------------------------------------------
2019-06-26 02:44:39 +00:00
.HGRTitleCallback
+STAY SAVE
2019-01-15 00:06:58 +00:00
2019-06-27 14:55:07 +00:00
lda KBD
2019-01-15 00:06:58 +00:00
bpl +
@exit rts
2019-01-15 00:06:58 +00:00
+
stx gCurrentlyVisibleSlideshowIndex
; try to get the human-readable name of this game from gGamesListStore
+LDAY SAVE
ldx #$60
jsr GetGameDisplayName
; if game is not found (C will be set here), it means it can't be played on
; this machine due to memory or joystick requirements, so we don't display
; it in slideshows
bcs @exit
; (we don't actually use the display name in the title slideshow, we just
; reuse the function for convenience)
2019-01-15 00:06:58 +00:00
; load HGR screenshot at $4000
+LOAD_FILE kHGRTitleDirectory, SAVE
2019-01-15 00:06:58 +00:00
2019-06-26 02:44:39 +00:00
+LDADDR $6000
jmp ExecuteTransitionAndWait
2019-01-15 00:06:58 +00:00
;------------------------------------------------------------------------------
2019-06-26 02:44:39 +00:00
; .HGRActionCallback [private]
2019-01-15 00:06:58 +00:00
; callback called by okvs_iter on gSlideshowStore
; to load and display a single HGR action screenshot
; in: A/Y contains address of filename (name only, path is always /ACTION.HGR/)
2019-01-15 00:06:58 +00:00
; X contains 0-based index of the current record in gSlideshowStore
; gGamesListStore must be initialized
; out: all registers and flags clobbered
; $0800..$1EFF preserved (this contains the gSlideshowStore OKVS data)
; $2000..$BFFF clobbered by graphics data and transition code
;------------------------------------------------------------------------------
2019-06-26 02:44:39 +00:00
.HGRActionCallback
+STAY SAVE
2019-01-15 00:06:58 +00:00
2019-06-27 14:55:07 +00:00
lda KBD
2019-01-15 00:06:58 +00:00
bpl +
@actionExit
2019-01-15 00:06:58 +00:00
rts
+
stx gCurrentlyVisibleSlideshowIndex
; load HGR screenshot at $4000
+LOAD_FILE kHGRActionDirectory, SAVE
2019-01-15 00:06:58 +00:00
; try to get the human-readable name of this game from gGamesListStore
; or gSlideshowStore
+LDAY SAVE
ldx #$EA
jsr GetGameDisplayName
; if game name is not found (C will be set here), it means the game
; can't be played due to memory or joystick requirements, so we hide
; it from slideshows
bcs @actionExit
; found the game, display its name in the bottom-left corner
+STAY SAVE
2019-01-15 00:06:58 +00:00
ldx #0
stx HTAB
ldx #22
stx VTAB
ldy #0
lda (SAVE),y
2019-01-15 00:06:58 +00:00
tax
+LDADDR @topline
sec
jsr DrawBuffer
ldx #3
+LDADDR @toprightcorner
sec
jsr DrawBuffer
inc VTAB
ldx #0
stx HTAB
inx
+LDADDR @rightline
sec
jsr DrawBuffer
+LDAY SAVE
jsr SetPath
+LDADDR gPathname
2019-01-15 00:06:58 +00:00
sec
jsr DrawString
ldx #2
+LDADDR @rightline
sec
jsr DrawBuffer
2019-06-26 02:44:39 +00:00
+LDADDR $6000
jmp ExecuteTransitionAndWait
2019-01-15 00:06:58 +00:00
@topline
!byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
!byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
@toprightcorner
!byte 0,0,7
@rightline
!text " "
!byte 3
;------------------------------------------------------------------------------
2019-06-26 02:44:39 +00:00
; .LoadHGRTransition [private]
2019-01-15 00:06:58 +00:00
; looks up name of next HGR transition effect in FX.CONF and loads that file
; at $6000
2019-06-27 02:51:34 +00:00
; in: gGlobalPrefsStore has been initialized
2019-01-15 00:06:58 +00:00
; out: all registers and flags clobbered
; $6000..$BFFF contains transition effect code
;------------------------------------------------------------------------------
2019-06-26 02:44:39 +00:00
.LoadHGRTransition
2019-06-19 02:40:17 +00:00
+LDADDR kFXConfFile
jsr SetPath
2019-01-15 00:06:58 +00:00
jsr LoadFile ; load HGR transition effects list into $8000
jsr ParseKeyValueList ; parse HGR transition effects list into $6000
!word gFXStore
!word ldrlo2 ; (ldrlo2) points to last load address
!byte 0
jsr okvs_get ; get next HGR transition effect from prefs
!word gGlobalPrefsStore
!word kNextFX
bcs @nofx
+STAY @fx
jsr okvs_get
!word gFXStore
@fx !word $FDFD ; SMC
bcc +
@nofx ldx #0
+ stx gFXIndex
jsr okvs_nth ; get filename of transition effect code
!word gFXStore
gFXIndex
!byte 0
+STAY @fxkey
inc gFXIndex ; increment transition effect index
jsr okvs_len
!word gFXStore
cmp gFXIndex
bne +
lda #0
sta gFXIndex
+
lda gFXIndex
sta @nexti
jsr okvs_nth ; get name of next HGR transition
!word gFXStore
@nexti !byte $FD ; SMC
+STAY @nextfx
jsr okvs_update ; save name of next HGR transition in prefs store
!word gGlobalPrefsStore
!word kNextFX
@nextfx !word $FDFD ; SMC
jsr SaveGlobalPreferences ; write prefs store to disk
; load transition effect code at $6000
+LOAD_FILE kFXDirectory, @fxkey
rts
@fxkey !word $FDFD
kFXConfFile
!byte @kFXConfFile_e-*-1
!text "FX.CONF"
@kFXConfFile_e
2019-06-26 02:44:39 +00:00
}