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

202 lines
7.2 KiB
Plaintext
Raw Permalink Normal View History

2019-01-15 00:06:58 +00:00
;license:MIT
2021-10-08 06:28:11 +00:00
;(c) 2018-2021 by 4am & qkumba
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-10-14 02:22:47 +00:00
;------------------------------------------------------------------------------
; HGRTitleSlideshow
; execute a slideshow of hi-res title screenshots
;
; in: none
; out: everything clobbered
; graphics mode still displaying hi-res screen with last picture visible
;------------------------------------------------------------------------------
2019-01-15 00:06:58 +00:00
HGRTitleSlideshow
2019-10-08 03:47:36 +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-10-08 03:47:36 +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
2019-10-14 02:22:47 +00:00
;------------------------------------------------------------------------------
; HGRActionSlideshow
; execute a slideshow of hi-res action screenshots
;
; in: none
; out: everything clobbered
; graphics mode still displaying hi-res screen with last picture visible
;------------------------------------------------------------------------------
2019-01-15 00:06:58 +00:00
HGRActionSlideshow
2019-10-08 03:47:36 +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-10-08 03:47:36 +00:00
!word HGRActionCallback ; address of callback (called on each file)
2021-10-13 22:04:56 +00:00
rts ; exit with last picture still visible
2019-01-15 00:06:58 +00:00
2019-10-14 02:22:47 +00:00
;------------------------------------------------------------------------------
; HGRSingle
; display a single hi-res screenshot, with transition effect
;
; in: none
; out: everything clobbered
; graphics mode still displaying hi-res screen with last picture visible
;------------------------------------------------------------------------------
2019-06-26 02:44:39 +00:00
HGRSingle
2021-10-24 05:29:48 +00:00
+ST16 IndexedHGRFilename
jsr LoadIndexedHGRFile
2020-03-12 00:41:16 +00:00
jsr DecompressHGR
2019-10-08 03:47:36 +00:00
jsr LoadHGRTransition ; load transition effect code at $6000
2019-10-10 02:21:46 +00:00
jmp ExecuteTransitionAt6000AndWait
2019-01-15 00:06:58 +00:00
;------------------------------------------------------------------------------
2019-10-08 03:47:36 +00:00
; LoadHGRTransition [private]
; looks up name of next HGR transition effect in FX.CONF and loads that file
; at $6000
; in: gGlobalPrefsStore has been initialized
; out: all registers and flags clobbered
; $6000..$BFFF contains transition effect code
;------------------------------------------------------------------------------
LoadHGRTransition
2021-11-13 01:46:05 +00:00
jsr LoadIndexedFile ; load HGR transition effects list into $6000
2021-10-12 23:37:45 +00:00
- !word $6000
2021-11-13 01:46:05 +00:00
!word kFXIndexRecord
2019-10-08 03:47:36 +00:00
jsr pref_get ; get HGR transition effect from prefs
!word kNextFX
2021-10-12 23:37:45 +00:00
!word -
2021-10-13 22:04:56 +00:00
+ST16 @indexRecordPtr ; A/Y = filename (don't load file yet)
2020-03-24 20:30:14 +00:00
; $WINDEX = index of the transition in FX store
2021-10-12 23:37:45 +00:00
+LDADDR -
2019-10-08 03:47:36 +00:00
jsr okvs_next ; get transition after this one
2020-03-24 20:30:14 +00:00
+ST16 +
2019-10-08 03:47:36 +00:00
jsr pref_set ; update prefs store and save to disk
!word kNextFX
+ !word $FDFD ; SMC
2021-10-13 22:04:56 +00:00
jsr LoadIndexedFile
2021-10-12 23:37:45 +00:00
!word $6000
2021-10-13 22:04:56 +00:00
@indexRecordPtr
!word $FDFD ; SMC
HGRRTS rts
2019-10-08 03:47:36 +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/)
2020-03-24 20:30:14 +00:00
; $WINDEX contains 0-based index of the current record in gSlideshowStore (word)
2019-01-15 00:06:58 +00:00
; 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-10-08 03:47:36 +00:00
HGRTitleCallback
2019-09-10 02:38:17 +00:00
bit KBD
2019-10-08 18:54:52 +00:00
bmi HGRRTS
2019-10-08 03:47:36 +00:00
+ST16 @fname
2021-11-03 01:49:41 +00:00
+ST16 gLastMegaAttractGame
2019-01-15 00:06:58 +00:00
jsr FindGame
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
2019-10-08 18:54:52 +00:00
bcs HGRRTS
2020-03-24 20:30:14 +00:00
+LD16 WINDEX ; save game index in case user hits RETURN
+ST16 gGameToLaunch ; while it's visible (we'll launch it)
jsr LoadIndexedFile ; load index file into $4000
- !word $4000
!word kHGRTitleIndexRecord
jsr okvs_find
!word -
@fname !word $FDFD ; SMC
+ST16 @indexRecordPtr
lda #$00
sta $5FFD
jsr LoadIndexedFile ; load HGR graphic at $4000
2019-09-10 02:38:17 +00:00
!word $4000
@indexRecordPtr
!word $FDFD ; SMC
2019-01-15 00:06:58 +00:00
lda $5FFD
cmp #$4C ; Check if screen hole now contains a JMP
beq @noUnpack ; if so, file was not packed, so skip unpack
jsr UnpackHGRTitle
@noUnpack
2019-10-10 02:21:46 +00:00
jmp ExecuteTransitionAt6000AndWait
2019-01-15 00:06:58 +00:00
;------------------------------------------------------------------------------
2019-10-08 03:47:36 +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/)
2020-03-24 20:30:14 +00:00
; $WINDEX contains 0-based index of the current record in gSlideshowStore (word)
2019-01-15 00:06:58 +00:00
; 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-10-08 03:47:36 +00:00
HGRActionCallback
2019-09-10 02:38:17 +00:00
bit KBD
2019-10-08 19:13:05 +00:00
bmi HGRRTS
2019-10-08 03:47:36 +00:00
2021-10-24 05:29:48 +00:00
+ST16 IndexedHGRFilename
2019-01-15 00:06:58 +00:00
jsr FindGame
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
2019-10-08 19:13:05 +00:00
bcs HGRRTS
2021-10-24 05:29:48 +00:00
jsr LoadIndexedHGRFile
2020-03-12 00:41:16 +00:00
jsr DecompressHGR
2020-04-01 15:57:21 +00:00
jmp DrawGameTitleInActionSlideshow
2021-10-20 03:07:56 +00:00
2021-10-24 05:29:48 +00:00
LoadIndexedHGRFile
; in: caller has set IndexedHGRFilename
; out: all flags & registers clobbered
+LD16 IndexedHGRFilename
2021-10-20 03:07:56 +00:00
+ST16 PTR
ldy #1
lda (PTR), y
sec
2021-11-13 22:11:26 +00:00
sbc #$41 ; A in [0..25]
lsr ; A in [0..15]
lsr ; A in [0..7]
tax
lda kHGRActionIndexLo, x
sta HGRActionIndexRecord
lda kHGRActionIndexHi, x
sta HGRActionIndexRecord+1
jsr LoadIndexedFile ; load index file into $4000
2021-10-20 03:07:56 +00:00
HGRActionIndexPtr
!word $4000
2021-11-13 22:11:26 +00:00
HGRActionIndexRecord
!word $FDFD ; SMC
2021-10-24 05:29:48 +00:00
jsr okvs_find
!word HGRActionIndexPtr
IndexedHGRFilename
!word $FDFD ; SMC
+ST16 @indexRecordPtr
jsr LoadIndexedFile ; load compressed HGR screenshot at $3FF8
!word $3FF8
@indexRecordPtr
!word $FDFD ; SMC
2021-10-20 03:07:56 +00:00
rts