Skip to content

Commit

Permalink
jak2 pckernel: save pc-settings on cheat progress and regular auto-…
Browse files Browse the repository at this point in the history
…saves (#3396)

Fixes #3392
  • Loading branch information
ManDude authored Mar 4, 2024
1 parent 258fd75 commit 7b926b5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
2 changes: 2 additions & 0 deletions goal_src/jak2/engine/game/game-save.gc
Original file line number Diff line number Diff line change
Expand Up @@ -2304,6 +2304,8 @@ auto-save-post
(defun auto-save-user ()
(case *kernel-boot-message*
(('play 'preview)
(#when PC_PORT
(pc-settings-save))
(auto-save-command 'auto-save 0 0 *default-pool* #f)
)
)
Expand Down
24 changes: 18 additions & 6 deletions goal_src/jak2/pc/pckernel.gc
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,11 @@

;; check unlocked cheats
;;;;;;;;;;;;;;;;;;;;;;;;
(let ((old (-> *pc-settings* cheats))
(old-unlocked (-> *pc-settings* cheats-unlocked))
(old-purchased (-> *pc-settings* cheats-purchased))
(old-revealed (-> *pc-settings* cheats-revealed)))

(dotimes (i (-> *pc-cheats-list* length))

;; reveals cheats if they have been purchased, purchases cheats if they have been unlocked, unlocks cheats if they have been enabled.
Expand Down Expand Up @@ -669,6 +674,13 @@
)
)))

(when (or (!= old (-> *pc-settings* cheats))
(!= old-unlocked (-> *pc-settings* cheats-unlocked))
(!= old-purchased (-> *pc-settings* cheats-purchased))
(!= old-revealed (-> *pc-settings* cheats-revealed)))
;; save pc-settings if we made new progress
(pc-settings-save)))

0)


Expand Down Expand Up @@ -807,12 +819,12 @@
(format file " (kill-stats~%")
(dotimes (i KILL_STATS_MAX_ENEMY_TYPES)
(when (-> obj stats kill-stats enemies i name)
(format file " (~A~%" (-> obj stats kill-stats enemies i name))
(dotimes (ii KILL_STATS_MAX_SOURCE)
(when (nonzero? (-> obj stats kill-stats enemies i sources ii))
(format file " (~A ~D)~%" (string->symbol (kill-source->string (the kill-stats-source ii))) (-> obj stats kill-stats enemies i sources ii))
))
(format file " )~%")
(format file " (~A~%" (-> obj stats kill-stats enemies i name))
(dotimes (ii KILL_STATS_MAX_SOURCE)
(when (nonzero? (-> obj stats kill-stats enemies i sources ii))
(format file " (~A ~D)~%" (string->symbol (kill-source->string (the kill-stats-source ii))) (-> obj stats kill-stats enemies i sources ii))
))
(format file " )~%")
))
(format file " )~%")
(format file " )~%")
Expand Down

0 comments on commit 7b926b5

Please sign in to comment.