pitch-dark/src/ui.artwork.a

91 lines
2.5 KiB
Plaintext
Raw Normal View History

2018-04-02 19:43:11 +00:00
;license:MIT
;(c) 2018 by 4am
;
; User interface - functions to load and display double hi-res artwork
;
; Public functions
; - DisplayArtwork
;
2018-04-17 20:25:38 +00:00
2018-04-02 19:43:11 +00:00
kArtworkRootDirectory ; length-prefixed pathname of DHGR graphic files
!byte 8
!raw "ARTWORK/"
2018-06-20 02:41:48 +00:00
kArtworkGSRootDirectory ; length-prefixed pathname of SHGR graphic files
!byte 10
!raw "ARTWORKGS/"
2018-04-02 19:43:11 +00:00
;------------------------------------------------------------------------------
; 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
2018-06-20 02:41:48 +00:00
ldx #0 ; set Z flag always
2018-04-02 19:43:11 +00:00
!cpu 65816
rep #2 ; clear Z flag on 65816 only
!cpu 65c02
2019-01-11 01:28:01 +00:00
PatchVidHD1
2018-04-02 19:43:11 +00:00
beq + ; skip GS-specific code on non-GS machines (required, will crash on //c, grr)
lda $C029
ora #$40
2018-04-02 19:43:11 +00:00
sta $C029 ; set GS NEWVIDEO mode to turn off linearize
2018-06-20 02:41:48 +00:00
inx
2018-04-19 02:01:24 +00:00
+ jsr ResetPath
2018-04-02 19:43:11 +00:00
+LDADDR kArtworkRootDirectory
2018-06-20 02:41:48 +00:00
dex
bne +
+LDADDR kArtworkGSRootDirectory
+ phx
2018-04-02 19:43:11 +00:00
jsr AddToPath
jsr okvs_get
!word gGlobalPrefsStore
!word kLastPlayed
2018-06-20 02:41:48 +00:00
jsr AddToPath ; gPathname = 'ARTWORK[GS]/<game shortname>'
plx
phx
beq @loadSHR
2018-04-02 19:43:11 +00:00
2018-04-19 02:01:24 +00:00
jsr LoadDHRFile ; load artwork from file
2018-04-02 19:43:11 +00:00
!word gPathname
!word kProDOSFileBuffer
2018-06-20 02:41:48 +00:00
plx
2018-04-19 02:01:24 +00:00
bcc +
2018-06-20 02:41:48 +00:00
- jmp SoftBell
2018-04-19 02:01:24 +00:00
+ sta $C000 ; display double hi-res page 1
2018-04-02 19:43:11 +00:00
sta $C00D
sta $C05E
sta $C001
sta $C057
sta $C052
sta $C054
sta $C050
2018-06-20 02:41:48 +00:00
bcc @waitKey
@loadSHR
jsr LoadSHRFile ; load artwork from file
!word gPathname
!word kProDOSFileBuffer
plx
bcs -
lda $C029
ora #$C1
sta $C029 ; set GS NEWVIDEO mode to turn on SHR mode
2018-04-11 19:12:36 +00:00
2018-07-06 22:29:15 +00:00
@waitKey
phx
jsr ClearPendingInput
2018-07-06 22:29:15 +00:00
- jsr AnyKeyOrClick
bcc -
sta $C051 ; back to text
2018-06-20 02:41:48 +00:00
plx
bne +
lda $C029
and #$3F
sta $C029 ; back to text GS-style
+ jmp ClearPendingInput