check initial radio button in resume dialog based on last save slot

This commit is contained in:
4am 2018-04-17 21:49:48 -04:00
parent 6f87481f55
commit 820d75fac2
2 changed files with 18 additions and 3 deletions

View File

@ -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

View File

@ -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