mirror of
https://github.com/a2-4am/4cade.git
synced 2024-12-24 22:31:40 +00:00
draw cheat overlays in DHGR mode
This commit is contained in:
parent
7c97a5ce79
commit
72814ee3a4
@ -122,6 +122,10 @@ EnableAccelerator = DisableAccelerator+3
|
||||
MOCKINGBOARD_SLOT = %00001111
|
||||
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
|
||||
HAS_JOYSTICK = %10000000
|
||||
HAS_128K = %01000000
|
||||
|
@ -64,7 +64,7 @@ ParseGamesList
|
||||
pha
|
||||
@parseCheatsAvailable
|
||||
jsr IncAndGetChar ; get fourth character (cheat category, int)
|
||||
and #$0F
|
||||
and #CHEAT_CATEGORY
|
||||
pha
|
||||
@swallowComma
|
||||
jsr IncAndGetChar
|
||||
|
@ -9,6 +9,7 @@
|
||||
; - DHGRSingle
|
||||
; - BlankHGR
|
||||
; - HGRMode
|
||||
; - RedrawForDHGR
|
||||
;
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
@ -209,7 +210,7 @@ DHGRActionCallback
|
||||
+HIDE_NEXT_2_BYTES
|
||||
DrawGameTitleInActionSlideshowHGR
|
||||
lda #$60 ; RTS
|
||||
sta @fallThroughForDHGR
|
||||
sta @fallthroughForDHGR
|
||||
|
||||
; display game name in the bottom-left corner
|
||||
lda #22
|
||||
@ -247,15 +248,27 @@ DrawGameTitleInActionSlideshowHGR
|
||||
@drawline
|
||||
ldy gPathname
|
||||
sta gPathname,y
|
||||
lda HTAB
|
||||
pha
|
||||
+LDADDR gPathname
|
||||
sec
|
||||
jsr DrawString
|
||||
pla
|
||||
@fallThroughForDHGR
|
||||
@fallthroughForDHGR
|
||||
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
|
||||
+LDAY DBIRow0+1
|
||||
+STAY $FE
|
||||
|
@ -107,6 +107,8 @@ BlankDHGR
|
||||
|
||||
sta DHIRESON ; then turn DHGR on
|
||||
bit PAGE1
|
||||
lda #1
|
||||
sta OffscreenPage
|
||||
jmp HGRMode
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
|
@ -83,14 +83,34 @@ LoadOffscreenFromAY
|
||||
LoadGameTitleOffscreen
|
||||
; in: gGameToLaunch = index into gGamesListStore
|
||||
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
|
||||
sta ++
|
||||
sta @addrhi
|
||||
jsr LoadFile
|
||||
!word kHGRTitleDirectory
|
||||
+ !word $FDFD ; SMC
|
||||
@fname !word $FDFD ; SMC
|
||||
!byte $00
|
||||
++ !byte $FD ; SMC
|
||||
@addrhi !byte $FD ; SMC
|
||||
rts
|
||||
@dhgr
|
||||
jsr BlankDHGR
|
||||
+LDAY @fname
|
||||
+STAY +
|
||||
jsr LoadDHRFile
|
||||
!word kDHGRTitleDirectory
|
||||
+ !word $FDFD
|
||||
rts
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
|
@ -82,13 +82,18 @@ DrawUI
|
||||
php
|
||||
|
||||
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
|
||||
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
|
||||
bpl -
|
||||
sta gGameToLaunchInfo ; reset gGameToLaunchInfo
|
||||
lda #40
|
||||
sta gPathname ; hack, used by first RedrawForDHGR which follows
|
||||
; Draw40Chars which doesn't set gPathname
|
||||
|
||||
ldx gGameToLaunch
|
||||
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
|
||||
bne @dotloop
|
||||
@doneHighlight
|
||||
|
||||
lda #22
|
||||
sta VTAB
|
||||
lda OffscreenPage
|
||||
@ -185,10 +189,11 @@ DrawUI
|
||||
php
|
||||
+LDADDR UILine1
|
||||
jsr Draw40Chars ; draw UI line 1 on offscreen page
|
||||
jsr MaybeRedrawUIForDHGR ; transform for DHGR if this is a DHGR title screen
|
||||
plp
|
||||
+LDADDR UILine2
|
||||
jsr Draw40Chars ; draw UI line 2 on offscreen page
|
||||
|
||||
jsr MaybeRedrawUIForDHGR ; transform for DHGR if this is a DHGR title screen
|
||||
lda MachineStatus
|
||||
and #CHEATS_ENABLED
|
||||
beq @uidone ; if cheats are disabled, then we're done drawing UI
|
||||
@ -211,7 +216,7 @@ DrawUI
|
||||
php
|
||||
+LDADDR gPathname
|
||||
jsr DrawCenteredString ; draw cheat UI line 1
|
||||
|
||||
jsr MaybeRedrawUIForDHGR ; transform for DHGR if this is a DHGR title screen
|
||||
jsr CheckCheats
|
||||
; (SAVE) -> length-prefixed cheat description
|
||||
+LDADDR sCheatDescriptionPrefix
|
||||
@ -224,7 +229,7 @@ DrawUI
|
||||
plp
|
||||
+LDADDR gPathname
|
||||
jsr DrawCenteredString ; draw cheat UI line 2
|
||||
|
||||
jsr MaybeRedrawUIForDHGR ; transform for DHGR if this is a DHGR title screen
|
||||
@uidone clc
|
||||
jmp ShowOtherPage
|
||||
|
||||
@ -235,11 +240,16 @@ CheckCheats
|
||||
beq +
|
||||
gGameToLaunchInfo=*+1
|
||||
lda #$FD ; SMC
|
||||
and #$03
|
||||
and #CHEAT_CATEGORY
|
||||
tay
|
||||
+
|
||||
lda kCheatDescriptionLo,y
|
||||
sta SAVE
|
||||
lda kCheatDescriptionHi,y
|
||||
sta SAVE+1
|
||||
rts
|
||||
- rts
|
||||
|
||||
MaybeRedrawUIForDHGR
|
||||
bit gGameToLaunchInfo
|
||||
bpl -
|
||||
jmp RedrawForDHGR
|
||||
|
Loading…
Reference in New Issue
Block a user