mirror of
https://github.com/a2-4am/pitch-dark.git
synced 2025-01-19 09:31:39 +00:00
set On Beyond restore slot properly based on resume dialog
This commit is contained in:
parent
af84a96823
commit
fc73f51afe
@ -5,8 +5,6 @@
|
||||
;
|
||||
; Public functions
|
||||
; - ClearInterpreterOptions
|
||||
; - SetInterpreterOptions
|
||||
; - SetInterpreterOptionsExceptForce40
|
||||
; - LaunchInterpreterWithGame
|
||||
; - LaunchInterpreterWithHints
|
||||
;
|
||||
@ -45,6 +43,74 @@ ClearInterpreterOptions
|
||||
bpl -
|
||||
rts
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; LaunchInterpreterWithNewGame
|
||||
; load interpreter and launch it with a game based on global preferences store
|
||||
;
|
||||
; in: current ProDOS prefix is the same as the PITCH.DARK file
|
||||
; out: returns with C set if interpreter could not be loaded or game
|
||||
; directory could not be found
|
||||
; otherwise does not return (calls ExitWeeGUI and jumps to interpreter)
|
||||
; gPathname clobbered
|
||||
;------------------------------------------------------------------------------
|
||||
LaunchInterpreterWithNewGame
|
||||
lda #$FF
|
||||
; execution falls through here
|
||||
;------------------------------------------------------------------------------
|
||||
; LaunchInterpreterWithSavedGame
|
||||
; load interpreter and launch it with a game based on global preferences store,
|
||||
; and tell it to restore from a specific saved game slot
|
||||
; in: A = saved game slot, or #$FF for none
|
||||
LaunchInterpreterWithSavedGame
|
||||
sta iRestoreSlot
|
||||
jsr SaveGlobalPreferences
|
||||
jsr LoadInterpreter
|
||||
bcs .launchError
|
||||
jsr SetStartupPathToCurrentVersionOfCurrentGame
|
||||
jsr ExitWeeGUI ; shut down WeeGUI
|
||||
jsr SetInterpreterOptions ; set options struct at $300
|
||||
jmp kSystemAddress ; exit via interpreter
|
||||
.launchError
|
||||
jmp SoftBell
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; LaunchInterpreterWithHints
|
||||
; load interpreter and launch it with the hints file for the current game
|
||||
;
|
||||
; in: current ProDOS prefix is the same as the PITCH.DARK file
|
||||
; out: returns with C set if interpreter could not be loaded or hints
|
||||
; directory could not be found
|
||||
; otherwise does not return (calls ExitWeeGUI and jumps to interpreter)
|
||||
; gPathname clobbered
|
||||
;------------------------------------------------------------------------------
|
||||
LaunchInterpreterWithHints
|
||||
lda #$FF
|
||||
sta iRestoreSlot ; no saved game to restore
|
||||
jsr SaveGlobalPreferences
|
||||
jsr LoadInterpreter
|
||||
bcs .launchError
|
||||
|
||||
jsr ResetPath
|
||||
|
||||
+LDADDR kHintsRootDirectory
|
||||
jsr AddToPath
|
||||
|
||||
jsr SetPrefix
|
||||
!word gPathname
|
||||
bcs .launchError
|
||||
|
||||
jsr okvs_get
|
||||
!word gGlobalPrefsStore
|
||||
!word kLastPlayed
|
||||
jsr SetStartupPath ; store hints filename at $2006
|
||||
|
||||
jsr ExitWeeGUI
|
||||
jsr SetInterpreterOptionsExceptForce40
|
||||
jmp kSystemAddress
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; internal functions
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; SetInterpreterOptions
|
||||
; set options struct based on global preferences store
|
||||
@ -84,7 +150,8 @@ SetInterpreterOptionsExceptForce40
|
||||
+ lda #1
|
||||
sta kOnBeyondCase
|
||||
|
||||
lda #$FF ; TODO this will eventually be set based on 'Resume Game' screen
|
||||
iRestoreSlot=*+1
|
||||
lda #$FD ; SMC
|
||||
sta kOnBeyondAutoRestore
|
||||
|
||||
jsr okvs_get
|
||||
@ -120,60 +187,6 @@ SetInterpreterOptionsExceptForce40
|
||||
sta kOnBeyondChecksum
|
||||
rts
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; LaunchInterpreterWithGame
|
||||
; load interpreter and launch it with a game based on global preferences store
|
||||
;
|
||||
; in: current ProDOS prefix is the same as the PITCH.DARK file
|
||||
; out: returns with C set if interpreter could not be loaded or game
|
||||
; directory could not be found
|
||||
; otherwise does not return (calls ExitWeeGUI and jumps to interpreter)
|
||||
; gPathname clobbered
|
||||
;------------------------------------------------------------------------------
|
||||
LaunchInterpreterWithGame
|
||||
jsr SaveGlobalPreferences
|
||||
jsr LoadInterpreter
|
||||
bcs .launchError
|
||||
jsr SetStartupPathToCurrentVersionOfCurrentGame
|
||||
jsr ExitWeeGUI ; shut down WeeGUI
|
||||
jsr SetInterpreterOptions ; set options struct at $300
|
||||
jmp kSystemAddress ; exit via interpreter
|
||||
.launchError
|
||||
jmp SoftBell
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; LaunchInterpreterWithHints
|
||||
; load interpreter and launch it with the hints file for the current game
|
||||
;
|
||||
; in: current ProDOS prefix is the same as the PITCH.DARK file
|
||||
; out: returns with C set if interpreter could not be loaded or hints
|
||||
; directory could not be found
|
||||
; otherwise does not return (calls ExitWeeGUI and jumps to interpreter)
|
||||
; gPathname clobbered
|
||||
;------------------------------------------------------------------------------
|
||||
LaunchInterpreterWithHints
|
||||
jsr SaveGlobalPreferences
|
||||
jsr LoadInterpreter
|
||||
bcs .launchError
|
||||
|
||||
jsr ResetPath
|
||||
|
||||
+LDADDR kHintsRootDirectory
|
||||
jsr AddToPath
|
||||
|
||||
jsr SetPrefix
|
||||
!word gPathname
|
||||
bcs .launchError
|
||||
|
||||
jsr okvs_get
|
||||
!word gGlobalPrefsStore
|
||||
!word kLastPlayed
|
||||
jsr SetStartupPath ; store hints filename at $2006
|
||||
|
||||
jsr ExitWeeGUI
|
||||
jsr SetInterpreterOptionsExceptForce40
|
||||
jmp kSystemAddress
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; LoadInterpreter
|
||||
; load interpreter and launch it with the hints file for the current game
|
||||
|
@ -209,7 +209,7 @@ callback_next
|
||||
}
|
||||
|
||||
callback_options = OptionsDialog
|
||||
callback_play = LaunchInterpreterWithGame
|
||||
callback_play = LaunchInterpreterWithNewGame
|
||||
callback_resume = ResumeDialog
|
||||
callback_boxart = DisplayArtwork
|
||||
callback_hints = LaunchInterpreterWithHints
|
||||
|
@ -58,13 +58,21 @@ ID_RESUME_NEXT = $82
|
||||
; call WeeGUI to create and paint 'resume game' screen, and run to completion
|
||||
;
|
||||
; in: WeeGUI initialized
|
||||
; out: exits via MainScreen or LaunchInterpreterWithGame
|
||||
; all registers and flags clobbered
|
||||
; out: exits via MainScreen, LaunchInterpreterWithSavedGame, or LaunchInterpreterWithNewGame
|
||||
;------------------------------------------------------------------------------
|
||||
ResumeDialog
|
||||
ldx #$FF
|
||||
txs
|
||||
ldx #WGResetAll ; reset WeeGUI
|
||||
lda #15
|
||||
sta kDummyView
|
||||
.hardReset
|
||||
+LDAY kDummyView
|
||||
+STAY PARAM0
|
||||
ldx #WGCreateView
|
||||
jsr WeeGUI ; create dummy views to reset state on all views
|
||||
dec kDummyView
|
||||
bpl .hardReset
|
||||
ldx #WGResetAll ; reset WeeGUI (destroys everything we just created)
|
||||
jsr WeeGUI
|
||||
|
||||
jsr LoadSavedGameInfo
|
||||
@ -211,7 +219,16 @@ HandleResumeKey
|
||||
jsr WeeGUI
|
||||
jmp SimulateClick
|
||||
|
||||
callback_resume_ok = LaunchInterpreterWithGame
|
||||
callback_resume_ok
|
||||
lda #ID_RESUME_SLOT0
|
||||
ldy #ID_RESUME_NEWGAME+1
|
||||
jsr GetCheckedRadioButton ; returns A = WeeGUI view ID
|
||||
cmp #ID_RESUME_NEWGAME
|
||||
bne +
|
||||
lda #0
|
||||
+ dec ; A = saved game slot (which is WeeGUI view ID - 1) or #$FF
|
||||
jmp LaunchInterpreterWithSavedGame
|
||||
|
||||
callback_resume_cancel = MainScreen
|
||||
|
||||
kViewResumeFrame
|
||||
@ -260,4 +277,7 @@ kViewResumeNewGameTop
|
||||
|
||||
kStringNewGame
|
||||
!text " Start ",110,"ew game",0
|
||||
|
||||
kDummyView
|
||||
!byte 0,0,0,0,0,0,0,0
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user