pitch-dark/src/ui.artwork.a

88 lines
2.4 KiB
Plaintext

;license:MIT
;(c) 2018 by 4am
;
; User interface - functions to load and display double hi-res artwork
;
; Public functions
; - DisplayArtwork
;
kArtworkRootDirectory ; length-prefixed pathname of DHGR graphic files
!byte 8
!raw "ARTWORK/"
kArtworkGSRootDirectory ; length-prefixed pathname of SHGR graphic files
!byte 10
!raw "ARTWORKGS/"
;------------------------------------------------------------------------------
; DisplayArtwork
; load and display double hi-res artwork, then wait for key or mouse click
;
; in: WeeGUI initialized
; out: all registers and flags clobbered
;------------------------------------------------------------------------------
DisplayArtwork
WeCanHazSHR
ldx #0 ; SMC
- jsr ResetPath
+LDADDR kArtworkRootDirectory
dex
bne +
lda $C029
ora #$40
sta $C029 ; set GS NEWVIDEO mode to turn off linearize
+LDADDR kArtworkGSRootDirectory
+ phx
jsr AddToPath
jsr okvs_get
!word gGlobalPrefsStore
!word kLastPlayed
jsr AddToPath ; gPathname = 'ARTWORK[GS]/<game shortname>'
plx
phx
beq @loadSHR
jsr LoadDHRFile ; load artwork from file
!word gPathname
!word kProDOSFileBuffer
plx
bcc +
jmp SoftBell
+ sta $C000 ; display double hi-res page 1
sta $C00D
sta $C05E
sta $C001
sta $C057
sta $C052
sta $C054
sta $C050
bcc @waitKey
@loadSHR
jsr LoadSHRFile ; load artwork from file
!word gPathname
!word kProDOSFileBuffer
plx
bcc +
ldx #0
bra -
+ lda $C029
ora #$81
sta $C029 ; set GS NEWVIDEO mode to turn on SHR mode
@waitKey
phx
jsr ClearPendingInput
- jsr AnyKeyOrClick
bcc -
sta $C051 ; back to text
sta $C056 ; turn off hires
plx
bne +
lda $C029
and #$7F
sta $C029 ; back to text GS-style
+ jmp ClearPendingInput