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

189 lines
6.1 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
;
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-09-10 02:38:17 +00:00
+STAY @fname
2019-06-27 02:51:34 +00:00
jsr LoadFile ; load HGR screenshot at $4000
2019-09-10 02:38:17 +00:00
!word kRootDirectory
@fname !word $FDFD ; SMC
!word $4000
2019-06-27 02:51:34 +00:00
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
2019-09-10 02:38:17 +00:00
bit KBD
2019-01-15 00:06:58 +00:00
bpl +
@exit rts
2019-01-15 00:06:58 +00:00
+
2019-09-10 02:38:17 +00:00
+STAY @tfname
2019-01-15 00:06:58 +00:00
2019-09-21 03:26:32 +00:00
; find this game in gGamesListStore
ldx #$60
jsr GetGameDisplayName
2019-09-10 02:38:17 +00:00
; 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
2019-09-21 03:26:32 +00:00
stx gGameToLaunch
2019-09-10 02:38:17 +00:00
jsr LoadFile ; load HGR screenshot at $4000
!word kHGRTitleDirectory
@tfname !word $FDFD ; SMC
!word $4000
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
2019-09-10 02:38:17 +00:00
bit KBD
2019-01-15 00:06:58 +00:00
bpl +
@actionExit
2019-01-15 00:06:58 +00:00
rts
+
2019-09-10 02:38:17 +00:00
+STAY @afname
2019-01-15 00:06:58 +00:00
2019-09-21 03:26:32 +00:00
; find this game in gGamesListStore or gSlideshowStore
ldx #$EA
jsr GetGameDisplayName
2019-09-10 02:38:17 +00:00
; 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
2019-09-10 02:38:17 +00:00
; found the game
+STAY SAVE
2019-09-21 03:26:32 +00:00
stx gGameToLaunch
2019-09-10 02:38:17 +00:00
jsr LoadFile ; load HGR screenshot at $4000
!word kHGRActionDirectory
@afname !word $FDFD ; SMC
!word $4000
; display game name in the bottom-left corner
2019-09-21 22:15:33 +00:00
ldx #39
lda #0
- sta UILine1,x
dex
bpl -
sta HTAB
2019-01-15 00:06:58 +00:00
ldx #22
stx VTAB
2019-09-21 22:15:33 +00:00
tay
lda (SAVE),y
2019-01-15 00:06:58 +00:00
tax
2019-09-21 22:15:33 +00:00
+LDADDR UILine1
2019-01-15 00:06:58 +00:00
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
@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-09-10 02:58:16 +00:00
jsr LoadFile ; load HGR transition effects list into $8000
2019-09-10 02:38:17 +00:00
!word kRootDirectory
!word kFXConfFile
2019-09-10 02:58:16 +00:00
- !word $8000
2019-01-15 00:06:58 +00:00
jsr ParseKeyValueList ; parse HGR transition effects list into $6000
!word gFXStore
2019-09-10 02:58:16 +00:00
!word -
2019-01-15 00:06:58 +00:00
!byte 0
2019-09-16 16:36:10 +00:00
jsr pref_get ; get HGR transition effect from prefs
2019-01-15 00:06:58 +00:00
!word kNextFX
!word gFXStore
2019-09-16 16:36:10 +00:00
+STAY @filename ; A/Y = filename (don't load file yet)
; X = index of the transition in FX store
+LDADDR gFXStore
jsr okvs_next ; get transition after this one
+STAY +
2019-01-15 00:06:58 +00:00
2019-09-16 16:36:10 +00:00
jsr pref_set ; update prefs store and save to disk
2019-01-15 00:06:58 +00:00
!word kNextFX
2019-09-16 16:36:10 +00:00
+ !word $FDFD ; SMC
2019-01-15 00:06:58 +00:00
2019-09-16 16:36:10 +00:00
jsr LoadFile ; now load transition effect code into $6000
2019-09-10 02:38:17 +00:00
!word kFXDirectory
2019-09-16 16:36:10 +00:00
@filename !word $FDFD ; SMC
2019-09-10 02:38:17 +00:00
!word $6000
2019-01-15 00:06:58 +00:00
rts