From 820d75fac2a330bbf058c911dbfd66ba3f1c7b7d Mon Sep 17 00:00:00 2001 From: 4am Date: Tue, 17 Apr 2018 21:49:48 -0400 Subject: [PATCH] check initial radio button in resume dialog based on last save slot --- src/parse.gameinfo.a | 14 +++++++++++++- src/ui.resume.a | 7 +++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/parse.gameinfo.a b/src/parse.gameinfo.a index af94c36..7d0c0fc 100644 --- a/src/parse.gameinfo.a +++ b/src/parse.gameinfo.a @@ -9,6 +9,7 @@ ; ; Public variables ; - gHasSavedGames 0=false, 1=true (set in CheckForSavedGames) +; - gLastSavedGameSlot 0-7 (only valid if gHasSavedGames=1) ; ; Public constants (keys in gOptionsStore) ; - kHasArtwork @@ -25,6 +26,8 @@ gOptionsStore !word $FDFD ; set in LoadGameInfo gHasSavedGames !byte 0 +gLastSavedGameSlot + !byte 0 kHasArtwork !byte 7 !raw "ARTWORK" @@ -191,7 +194,16 @@ CheckForSavedGames lda blocks cmp #$06 ; file exists but is small -> no saved games (.Z4/.Z5 files have a 5 block 'empty' .sav file) bcc .no -.yes lda #1 +.yes lda auxtype ; if low byte of auxtype is $3x, x is the last save slot + and #$F0 + cmp #$30 + bne + + lda auxtype + and #$0F + !byte $2C ++ lda #$FF ; no save slot + sta gLastSavedGameSlot + lda #1 !byte $2C .no lda #0 sta gHasSavedGames diff --git a/src/ui.resume.a b/src/ui.resume.a index 7873be3..1e669a9 100644 --- a/src/ui.resume.a +++ b/src/ui.resume.a @@ -107,8 +107,11 @@ ResumeDialog jsr CreateRadio !word kViewResumeNewGame - ; TODO set proper radio button based on ZINFO - lda #ID_RESUME_NEWGAME + lda gLastSavedGameSlot ; initial checked radio button = last save slot + 1 + bmi + + inc + !byte $2C ++ lda #ID_RESUME_NEWGAME ; if last save slot is invalid, just check 'new game' ldx #WGSelectView jsr WeeGUI lda #1