fix some pc settings not being saved/loaded correctly (#1815)

* Update default-menu.gc

* make fog hack slightly less aggressive

* add `reload-text` back but kinda fixed

* more unlocks for non-guaranteed musics

* smarter language save & load

* also save pc settings on autosave

* more special music log cases

* one more
This commit is contained in:
ManDude
2022-08-30 00:05:36 +01:00
committed by GitHub
parent e7b1a2d292
commit 0d16a52854
6 changed files with 63 additions and 26 deletions
@@ -67,14 +67,14 @@ void main() {
// time of day lookup
fragment_color = texelFetch(tex_T1, time_of_day_index, 0);
// fog hack
if (fragment_color.r < 0.0075 && fragment_color.g < 0.0075 && fragment_color.b < 0.0075) {
fogginess = 0;
}
// color adjustment
fragment_color *= 2;
fragment_color.a *= 2;
// fog hack
if (fragment_color.r < 0.005 && fragment_color.g < 0.005 && fragment_color.b < 0.005) {
fogginess = 0;
}
tex_coord = tex_coord_in;
}
+1 -1
View File
@@ -4826,7 +4826,7 @@
))
(other-menu (-> (the-as debug-menu-item-submenu other-menu-node) submenu))
)
(dotimes (i 35)
(dotimes (i (progress-screen max))
(debug-menu-append-item prog-menu
(new-dm-func (new 'debug 'string 0 (enum->string progress-screen i)) i
(lambda ((val progress-screen))
+3
View File
@@ -1288,6 +1288,9 @@
(set! (-> self part matrix) (sprite-allocate-user-hvdf))
(cond
((= desired-mode 'auto-save)
;; also save pc settings.
(with-pc
(commit-to-file *pc-settings*))
(if (not (-> *setting-control* current auto-save))
(go-virtual error (mc-status-code no-auto-save))
)
+20 -15
View File
@@ -28,17 +28,21 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defglobalconstant PC_KERNEL_VERSION_BUILD #x0001)
(defglobalconstant PC_KERNEL_VERSION_REVISION #x0001)
(deftype pckernel-version (int64)
((build int16 :offset 0)
(revision int16 :offset 16)
(minor int16 :offset 32)
(major int16 :offset 48)
)
)
(defmacro static-pckernel-version (major minor rev build)
`(new 'static 'pckernel-version :major ,major :minor ,minor :revision ,rev :build ,build))
;; version: 1.10.2.1
(defglobalconstant PC_KERNEL_VERSION (static-pckernel-version 1 10 2 1))
(defconstant PC_KERNEL_VER_MAJOR (-> PC_KERNEL_VERSION major))
(defconstant PC_KERNEL_VER_MINOR (-> PC_KERNEL_VERSION minor))
(defglobalconstant PC_KERNEL_VERSION_MINOR #x000a)
(defglobalconstant PC_KERNEL_VERSION_MAJOR #x0001)
(defglobalconstant PC_KERNEL_VERSION (logior
(ash PC_KERNEL_VERSION_MAJOR 48)
(ash PC_KERNEL_VERSION_MINOR 32)
(ash PC_KERNEL_VERSION_REVISION 16)
(ash PC_KERNEL_VERSION_BUILD 0)
))
(defconstant PS2_VOICE_AMOUNT 48)
(defconstant PC_VOICE_AMOUNT 256)
@@ -203,7 +207,7 @@
;; All of the configuration for the PC port in GOAL. Access things from here!
;; Includes some methods to change parameters.
(deftype pc-settings (basic)
((version uint64) ;; version of this settings
((version pckernel-version) ;; version of this settings
;; "generic" graphics settings
(target-fps int16) ;; the target framerate of the game
@@ -382,11 +386,11 @@
)
(defconstant PC_TEMP_STRING_LEN 512)
(define *pc-temp-string* (new 'global 'string PC_TEMP_STRING_LEN (the-as string #f)))
(define *pc-settings* (the-as pc-settings #f))
(format 0 "PC kernel version: ~D.~D~%" PC_KERNEL_VERSION_MAJOR PC_KERNEL_VERSION_MINOR)
(define *pc-temp-string* (new 'global 'string PC_TEMP_STRING_LEN (the string #f)))
(define *pc-settings* (the pc-settings #f))
(format 0 "PC kernel version: ~D.~D~%" PC_KERNEL_VER_MAJOR PC_KERNEL_VER_MINOR)
(define *pc-temp-string-1* (new 'global 'string 2048 (the-as string #f)))
(define *pc-temp-string-1* (new 'global 'string 2048 (the string #f)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; resets
@@ -496,6 +500,7 @@
(set! (-> obj hinttitles?) #t)
(set! (-> obj subtitle-speaker?) 'auto)
(set! (-> obj subtitle-language) (pc-subtitle-lang english))
(set! (-> obj text-language) (pc-subtitle-lang english))
(reset-original-camera obj)
(set! (-> obj money-starburst?) #f)
(set! (-> obj extra-hud?) #f)
+26 -5
View File
@@ -525,8 +525,16 @@
(add-to-music-log obj (-> *setting-control* current music) (the int (-> *setting-control* current sound-flava)))
;; special cases. for example, npc's that despawn and you can't hear their music anymore.
(if (task-closed? (game-task beach-ecorocks) (task-status need-introduction))
(add-to-music-log obj 'village1 1))
(if (task-closed? (game-task village1-buzzer) (task-status need-resolution))
(add-to-music-log obj 'village1 (flava-lookup 'village1 (music-flava assistant))))
(if (task-closed? (game-task village2-buzzer) (task-status need-resolution))
(add-to-music-log obj 'village2 (flava-lookup 'village2 (music-flava assistant))))
(if (task-closed? (game-task village3-buzzer) (task-status need-resolution))
(add-to-music-log obj 'village3 (flava-lookup 'village3 (music-flava assistant))))
(when (task-closed? (game-task beach-ecorocks) (task-status need-introduction))
(add-to-music-log obj 'village1 1)
(add-to-music-log obj 'village1 (flava-lookup 'village1 (music-flava sage)))
)
(if (task-closed? (game-task jungle-plant) (task-status need-resolution))
(add-to-music-log obj 'jungleb 2))
(if (task-closed? (game-task beach-flutflut) (task-status need-resolution))
@@ -539,10 +547,14 @@
(add-to-music-log obj 'misty 4))
(if (task-closed? (game-task firecanyon-end) (task-status need-resolution))
(add-to-music-log obj 'firecanyon 2))
(if (task-closed? (game-task village2-levitator) (task-status need-hint))
(add-to-music-log obj 'village2 (flava-lookup 'village2 (music-flava sage))))
(if (task-closed? (game-task swamp-billy) (task-status need-resolution))
(add-to-music-log obj 'swamp 1))
(if (task-closed? (game-task swamp-battle) (task-status need-resolution))
(add-to-music-log obj 'swamp (flava-lookup 'swamp (music-flava swamp-battle))))
(if (task-closed? (game-task village3-button) (task-status need-hint))
(add-to-music-log obj 'village3 (flava-lookup 'village3 (music-flava sage))))
(if (task-closed? (game-task snow-bunnies) (task-status need-resolution))
(add-to-music-log obj 'snow (flava-lookup 'snow (music-flava snow-battle))))
(if (task-closed? (game-task citadel-sage-yellow) (task-status need-resolution))
@@ -555,6 +567,10 @@
(add-to-music-log obj 'citadel (flava-lookup 'citadel (music-flava sage))))
(if (task-closed? (game-task citadel-buzzer) (task-status need-resolution))
(add-to-music-log obj 'citadel (flava-lookup 'citadel (music-flava assistant))))
(when (task-closed? (game-task finalboss-movies) (task-status unknown))
(add-to-music-log obj 'finalboss (flava-lookup 'finalboss (music-flava finalboss-middle)))
(add-to-music-log obj 'finalboss (flava-lookup 'finalboss (music-flava finalboss-end)))
)
(when (and *target* (>= (float->int (send-event *target* 'query 'pickup (pickup-type fuel-cell))) 100))
(add-to-music-log obj 'credits 0)
(add-to-music-log obj 'credits 1)
@@ -782,14 +798,15 @@
(with-settings-scope (file)
(case-str (file-stream-read-word file)
(("settings")
(set! version (file-stream-read-int file))
(set! version (the pckernel-version (file-stream-read-int file)))
(cond
((= (logand version #xffffffff00000000) (logand PC_KERNEL_VERSION #xffffffff00000000))
((and (= (-> version major) PC_KERNEL_VER_MAJOR)
(= (-> version minor) PC_KERNEL_VER_MINOR))
;; minor difference
)
(else
;; major difference
(format 0 "PC kernel version mismatch! Got ~D.~D vs ~D.~D~%" PC_KERNEL_VERSION_MAJOR PC_KERNEL_VERSION_MINOR (bit-field int version 32 16) (bit-field int version 48 16))
(format 0 "PC kernel version mismatch! Got ~D.~D vs ~D.~D~%" PC_KERNEL_VER_MAJOR PC_KERNEL_VER_MINOR (-> version major) (-> version minor))
(file-stream-close file)
(return #f)
)
@@ -837,6 +854,8 @@
(("lod-force-tie") (set! (-> obj lod-force-tie) (file-stream-read-int file)))
(("lod-force-ocean") (set! (-> obj lod-force-ocean) (file-stream-read-int file)))
(("lod-force-actor") (set! (-> obj lod-force-actor) (file-stream-read-int file)))
(("game-language") (set! (-> *setting-control* default language) (the-as language-enum (file-stream-read-int file))))
(("text-language") (set! (-> obj text-language) (the-as pc-subtitle-lang (file-stream-read-int file))))
(("subtitle-language") (set! (-> obj subtitle-language) (the-as pc-subtitle-lang (file-stream-read-int file))))
(("subtitle-speaker") (set! (-> obj subtitle-speaker?) (file-stream-read-symbol file)))
(("stick-deadzone") (set! (-> obj stick-deadzone) (file-stream-read-float file)))
@@ -992,6 +1011,8 @@
(format file " (music-fadeout? ~A)~%" (-> obj music-fadeout?))
(format file " (subtitles? ~A)~%" (-> obj subtitles?))
(format file " (hinttitles? ~A)~%" (-> obj hinttitles?))
(format file " (game-language ~D)~%" (-> *setting-control* default language))
(format file " (text-language ~D)~%" (-> obj text-language))
(format file " (subtitle-language ~D)~%" (-> obj subtitle-language))
(format file " (subtitle-speaker ~A)~%" (-> obj subtitle-speaker?))
+8
View File
@@ -299,6 +299,14 @@
(+! (-> *subtitle-text* lang) (the-as pc-subtitle-lang 1)))
(load-level-subtitle-files 0)))
(defmacro reload-text ()
"rebuild and reload text."
`(begin
(mng)
(if *common-text*
(+! (-> *common-text* language-id) 1))
(load-level-text-files 0)))