draw cheat overlays in DHGR mode

This commit is contained in:
4am 2020-03-09 17:24:30 -04:00
parent 7c97a5ce79
commit 72814ee3a4
6 changed files with 69 additions and 20 deletions

View File

@ -122,6 +122,10 @@ EnableAccelerator = DisableAccelerator+3
MOCKINGBOARD_SLOT = %00001111 MOCKINGBOARD_SLOT = %00001111
HAS_SPEECH = %10000000 HAS_SPEECH = %10000000
; AND masks for game info bitfield (after game title in gGamesList)
HAS_DHGR_TITLE = %10000000
CHEAT_CATEGORY = %00001111
; AND masks for MachineStatus ; AND masks for MachineStatus
HAS_JOYSTICK = %10000000 HAS_JOYSTICK = %10000000
HAS_128K = %01000000 HAS_128K = %01000000

View File

@ -64,7 +64,7 @@ ParseGamesList
pha pha
@parseCheatsAvailable @parseCheatsAvailable
jsr IncAndGetChar ; get fourth character (cheat category, int) jsr IncAndGetChar ; get fourth character (cheat category, int)
and #$0F and #CHEAT_CATEGORY
pha pha
@swallowComma @swallowComma
jsr IncAndGetChar jsr IncAndGetChar

View File

@ -9,6 +9,7 @@
; - DHGRSingle ; - DHGRSingle
; - BlankHGR ; - BlankHGR
; - HGRMode ; - HGRMode
; - RedrawForDHGR
; ;
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -209,7 +210,7 @@ DHGRActionCallback
+HIDE_NEXT_2_BYTES +HIDE_NEXT_2_BYTES
DrawGameTitleInActionSlideshowHGR DrawGameTitleInActionSlideshowHGR
lda #$60 ; RTS lda #$60 ; RTS
sta @fallThroughForDHGR sta @fallthroughForDHGR
; display game name in the bottom-left corner ; display game name in the bottom-left corner
lda #22 lda #22
@ -247,15 +248,27 @@ DrawGameTitleInActionSlideshowHGR
@drawline @drawline
ldy gPathname ldy gPathname
sta gPathname,y sta gPathname,y
lda HTAB
pha
+LDADDR gPathname +LDADDR gPathname
sec sec
jsr DrawString jsr DrawString
pla @fallthroughForDHGR
@fallThroughForDHGR
nop ; SMC nop ; SMC
sta HTAB ; /!\ execution sometimes falls through here to RedrawForDHGR
;------------------------------------------------------------------------------
; RedrawForDHGR
; After drawing text on HGR screen, this will transform the low-level bytes
; to display properly on the DHGR screen.
;
; /!\ must be called immediately after calling one of the font drawing routines
; (Draw40Chars, DrawCenteredString, DrawString, DrawBuffer)
;
; in: gPathname contains number of bytes to transform
; DBIRow0 set (this will be true if you just called DrawBufferInternal
; or something that calls it, see above)
; out: clobbers zero page $00,$01,$02,$03,SAVE,$FE,$FF
;------------------------------------------------------------------------------
RedrawForDHGR
jsr SwitchToBank2 jsr SwitchToBank2
+LDAY DBIRow0+1 +LDAY DBIRow0+1
+STAY $FE +STAY $FE

View File

@ -107,6 +107,8 @@ BlankDHGR
sta DHIRESON ; then turn DHGR on sta DHIRESON ; then turn DHGR on
bit PAGE1 bit PAGE1
lda #1
sta OffscreenPage
jmp HGRMode jmp HGRMode
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------

View File

@ -83,14 +83,34 @@ LoadOffscreenFromAY
LoadGameTitleOffscreen LoadGameTitleOffscreen
; in: gGameToLaunch = index into gGamesListStore ; in: gGameToLaunch = index into gGamesListStore
jsr GetGameToLaunch jsr GetGameToLaunch
+STAY + +STAY @fname
bit MachineStatus ; if < 128K, don't bother checking for DHGR title
bvc @hgr
jsr okvs_get_current
; (PTR) -> game title + bitfield of game info
; Y = 0
lda (PTR),y ; A = game title length + 1
sta SAVE
tay
lda (PTR),y ; A = game info bitfield
and #HAS_DHGR_TITLE
bne @dhgr
@hgr
jsr GetOffscreenAddress jsr GetOffscreenAddress
sta ++ sta @addrhi
jsr LoadFile jsr LoadFile
!word kHGRTitleDirectory !word kHGRTitleDirectory
+ !word $FDFD ; SMC @fname !word $FDFD ; SMC
!byte $00 !byte $00
++ !byte $FD ; SMC @addrhi !byte $FD ; SMC
rts
@dhgr
jsr BlankDHGR
+LDAY @fname
+STAY +
jsr LoadDHRFile
!word kDHGRTitleDirectory
+ !word $FDFD
rts rts
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------

View File

@ -82,13 +82,18 @@ DrawUI
php php
ldy #39 ldy #39
- lda #$00 ; horizontal bar character -
sta UILine1,y ; reset UI line 1 to solid bar
sta gPathname,y ; reset cheat UI line 1 to solid bar
lda Instructions,y lda Instructions,y
sta UILine2,y ; copy instructions to UI line 2 sta UILine2,y ; copy instructions to UI line 2
lda #$00 ; horizontal bar character
sta UILine1,y ; reset UI line 1 to solid bar
sta gPathname,y ; reset cheat UI line 1 to solid bar
dey dey
bpl - bpl -
sta gGameToLaunchInfo ; reset gGameToLaunchInfo
lda #40
sta gPathname ; hack, used by first RedrawForDHGR which follows
; Draw40Chars which doesn't set gPathname
ldx gGameToLaunch ldx gGameToLaunch
inx ; if no game, nothing more to do on UI line 2 inx ; if no game, nothing more to do on UI line 2
@ -177,7 +182,6 @@ DrawUI
cpy SAVE ; if game name is exhausted, we're done drawing dots cpy SAVE ; if game name is exhausted, we're done drawing dots
bne @dotloop bne @dotloop
@doneHighlight @doneHighlight
lda #22 lda #22
sta VTAB sta VTAB
lda OffscreenPage lda OffscreenPage
@ -185,10 +189,11 @@ DrawUI
php php
+LDADDR UILine1 +LDADDR UILine1
jsr Draw40Chars ; draw UI line 1 on offscreen page jsr Draw40Chars ; draw UI line 1 on offscreen page
jsr MaybeRedrawUIForDHGR ; transform for DHGR if this is a DHGR title screen
plp plp
+LDADDR UILine2 +LDADDR UILine2
jsr Draw40Chars ; draw UI line 2 on offscreen page jsr Draw40Chars ; draw UI line 2 on offscreen page
jsr MaybeRedrawUIForDHGR ; transform for DHGR if this is a DHGR title screen
lda MachineStatus lda MachineStatus
and #CHEATS_ENABLED and #CHEATS_ENABLED
beq @uidone ; if cheats are disabled, then we're done drawing UI beq @uidone ; if cheats are disabled, then we're done drawing UI
@ -211,7 +216,7 @@ DrawUI
php php
+LDADDR gPathname +LDADDR gPathname
jsr DrawCenteredString ; draw cheat UI line 1 jsr DrawCenteredString ; draw cheat UI line 1
jsr MaybeRedrawUIForDHGR ; transform for DHGR if this is a DHGR title screen
jsr CheckCheats jsr CheckCheats
; (SAVE) -> length-prefixed cheat description ; (SAVE) -> length-prefixed cheat description
+LDADDR sCheatDescriptionPrefix +LDADDR sCheatDescriptionPrefix
@ -224,7 +229,7 @@ DrawUI
plp plp
+LDADDR gPathname +LDADDR gPathname
jsr DrawCenteredString ; draw cheat UI line 2 jsr DrawCenteredString ; draw cheat UI line 2
jsr MaybeRedrawUIForDHGR ; transform for DHGR if this is a DHGR title screen
@uidone clc @uidone clc
jmp ShowOtherPage jmp ShowOtherPage
@ -235,11 +240,16 @@ CheckCheats
beq + beq +
gGameToLaunchInfo=*+1 gGameToLaunchInfo=*+1
lda #$FD ; SMC lda #$FD ; SMC
and #$03 and #CHEAT_CATEGORY
tay tay
+ +
lda kCheatDescriptionLo,y lda kCheatDescriptionLo,y
sta SAVE sta SAVE
lda kCheatDescriptionHi,y lda kCheatDescriptionHi,y
sta SAVE+1 sta SAVE+1
rts - rts
MaybeRedrawUIForDHGR
bit gGameToLaunchInfo
bpl -
jmp RedrawForDHGR