diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index a147a09fbb..bd7313a585 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -1528,6 +1528,8 @@ (cheat-invinc #x1095) (cheat-tunes #x1096) (cheat-sky #x1097) + (cheat-req-100-percent #x1098) + (cheat-req-beat-game #x1099) (music-player #x10c0) (scene-player #x10c1) (play-credits #x10c2) diff --git a/decompiler/extractor/extractor_util.hpp b/decompiler/extractor/extractor_util.hpp index 0aea716a9d..d5a623e155 100644 --- a/decompiler/extractor/extractor_util.hpp +++ b/decompiler/extractor/extractor_util.hpp @@ -5,12 +5,14 @@ #include #include "common/log/log.h" +#include "common/util/Assert.h" #include "common/util/FileUtil.h" -#include -#include +#include "common/util/json_util.h" +#include "common/util/read_iso_file.h" -#include +#include "game/kernel/common/kboot.h" +#include "third-party/json.hpp" #include "third-party/xxhash.hpp" enum class ExtractorErrorCode { @@ -34,12 +36,23 @@ enum GameIsoFlags { FLAG_JAK1_BLACK_LABEL = (1 << 0) }; static const std::unordered_map sGameIsoFlagNames = { {"jak1-black-label", FLAG_JAK1_BLACK_LABEL}}; +static const std::unordered_map sGameIsoTerritoryMap = { + {GAME_TERRITORY_SCEA, "NTSC-U"}, + {GAME_TERRITORY_SCEE, "PAL"}, + {GAME_TERRITORY_SCEI, "NTSC-J"}}; + +std::string get_territory_name(int territory) { + ASSERT_MSG(sGameIsoTerritoryMap.count(territory), + fmt::format("territory {} not found in territory name map")); + return sGameIsoTerritoryMap.at(territory); +} + // used for - decompiler_out/ and iso_data/ std::unordered_map data_subfolders = {{"jak1", "jak1"}}; struct ISOMetadata { std::string canonical_name; - std::string region; + int region; // territory code int num_files; xxh::hash64_t contents_hash; std::string decomp_config; @@ -80,7 +93,7 @@ std::optional get_buildinfo_from_path(fs::path iso_data_path) { static const ISOMetadata jak1_ntsc_black_label_info = { "Jak & Daxter™: The Precursor Legacy (Black Label)", - "NTSC-U", + GAME_TERRITORY_SCEA, 337, 11363853835861842434U, "jak1_ntsc_black_label", @@ -93,7 +106,7 @@ static const std::unordered_map, ExtractorErrorCode> validate( // Print out some information lg::info("Detected Game Metadata:"); lg::info("\tDetected - {}", version_info.canonical_name); - lg::info("\tRegion - {}", version_info.region); + lg::info("\tRegion - {}", get_territory_name(version_info.region)); lg::info("\tSerial - {}", dbEntry->first); lg::info("\tUses Decompiler Config - {}", version_info.decomp_config); @@ -204,6 +204,7 @@ ExtractorErrorCode compile(const fs::path& iso_data_path, const std::string& dat if (version_info.game_name == "jak1") { compiler.make_system().set_constant("*jak1-full-game*", !(flags & FLAG_JAK1_BLACK_LABEL)); + compiler.make_system().set_constant("*jak1-territory*", version_info.region); } auto project_path = file_util::get_jak_project_dir() / "goal_src" / data_subfolder / "game.gp"; diff --git a/game/assets/jak1/subtitle/game_subtitle_en.gd b/game/assets/jak1/subtitle/game_subtitle_en.gd index 2cada97747..b3312ae433 100644 --- a/game/assets/jak1/subtitle/game_subtitle_en.gd +++ b/game/assets/jak1/subtitle/game_subtitle_en.gd @@ -1107,12 +1107,21 @@ ) ("sksp0064" :hint #x245 (0 "DAXTER" "WATCH YOUR BACK! YOU REMEMBER WHAT HAPPENED THE LAST TIME WE WERE HERE.")) -("sksp0067" :hint #x249 (0 "DAXTER" "DON'T FALL INTO THE MIST BELOW US! 'CAUSE I DON'T THINK WE'LL MAKE IT BACK.")) -("sksp0059" :hint #x26e (0 "DAXTER" "THIS PLACE GIVES ME THE WILLIES! LET'S KEEP YOU OUT OF THE OOZE, OKAY?")) +("sksp0067" :hint #x249 + (0 "DAXTER" "DON'T FALL INTO THE MIST BELOW US!") + (125 "DAXTER" "'CAUSE I DON'T THINK WE'LL MAKE IT BACK.") + ) + +("sksp0059" :hint #x26e + (0 "DAXTER" "THIS PLACE GIVES ME THE WILLIES!") + (110) + (125 "DAXTER" "LET'S KEEP YOU OUT OF THE OOZE, OKAY?") + ) ("sksp0060" :hint #x26f - (0 "DAXTER" "(WHIMPERS) THIS PLACE GIVES ME THE CREEPS! AND TRUST ME, IT'S A WHOLE NEW EXPERIENCE") - (337 "DAXTER" "WHEN YOU'RE COVERED IN FUZZ!") + (0 "DAXTER" "(WHIMPERS) THIS PLACE GIVES ME THE CREEPS!") + (170 "DAXTER" "AND TRUST ME, IT'S A WHOLE NEW EXPERIENCE") + (335 "DAXTER" "WHEN YOU'RE COVERED IN FUZZ!") ) ("sksp0056" :hint #x27b (0 "DAXTER" "HEY! I SEE THE SCULPTOR'S MUSE!")) @@ -1126,12 +1135,14 @@ ("sagevb02" :hint #x28a (6 "SAGE" "I HAVE TO ADMIT, I'M IMPRESSED. YOU TWO DIDN'T SCREW UP!") - (385) - (400 "SAGE" "NOW THAT THE LURKERS CAN'T OPEN THAT SILO, THEY CAN'T FLOOD THE WORLD WITH DARK ECO") + (390) + (410 "SAGE" "NOW THAT THE LURKERS CAN'T OPEN THAT SILO") + (555 "SAGE" "THEY CAN'T FLOOD THE WORLD WITH DARK ECO") (710 "SAGE" "AND CAUSE UNTOLD DESTRUCTION.") (863) - (880 "SAGE" "WIPE THAT RIDICULOUS GRIN OFF YOUR FACE, DAXTER! THE TWO OF YOU HAVE PLENTY TO DO.") - (1191 "SAGE" "GET ON WITH IT!") + (880 "SAGE" "WIPE THAT RIDICULOUS GRIN OFF YOUR FACE, DAXTER!") + (1065 "SAGE" "THE TWO OF YOU HAVE PLENTY TO DO.") + (1188 "SAGE" "GET ON WITH IT!") ) ("asstvb03" :hint #x28b diff --git a/game/assets/jak1/text/game_text_en.gs b/game/assets/jak1/text/game_text_en.gs index 21379c33d4..40a0364618 100644 --- a/game/assets/jak1/text/game_text_en.gs +++ b/game/assets/jak1/text/game_text_en.gs @@ -200,6 +200,10 @@ "ALL MUSIC TRACKS") (#x1097 "REAL TIME OF DAY" "REAL TIME OF DAY") +(#x1098 "REACH 100% COMPLETION" + "REACH 100% COMPLETION") +(#x1099 "BEAT THE GAME" + "BEAT THE GAME") (#x10c0 "MUSIC PLAYER" "MUSIC PLAYER") diff --git a/game/graphics/display.h b/game/graphics/display.h index ee54d0c91e..91e9833e22 100644 --- a/game/graphics/display.h +++ b/game/graphics/display.h @@ -15,7 +15,7 @@ // a GfxDisplay class is equivalent to a window that displays stuff. This holds an actual internal // window pointer used by whichever renderer. It also contains functions for setting and // retrieving certain window parameters. -// Maybe this is better implemented as an abstract class and renderers would have overrides? +// specific renderers should override this class, the methods are abstract. class GfxDisplay { const char* m_title; @@ -62,6 +62,9 @@ class GfxDisplay { m_fullscreen_mode = m_fullscreen_target_mode; m_fullscreen_screen = m_fullscreen_target_screen; + + // hack, force a vsync update. + Gfx::g_global_settings.old_vsync = !Gfx::g_global_settings.vsync; } bool is_active() const { return get_window() != nullptr; } diff --git a/game/graphics/opengl_renderer/foreground/Merc2.cpp b/game/graphics/opengl_renderer/foreground/Merc2.cpp index 6abceea364..3ba76b6328 100644 --- a/game/graphics/opengl_renderer/foreground/Merc2.cpp +++ b/game/graphics/opengl_renderer/foreground/Merc2.cpp @@ -575,7 +575,7 @@ void Merc2::flush_draw_buckets(SharedRenderState* /*render_state*/, ScopedProfil ); glVertexAttribIPointer(5, // location 0 in the - 3, // 3 floats per vert + 4, // 3 floats per vert GL_UNSIGNED_BYTE, // u8's sizeof(tfrag3::MercVertex), // (void*)offsetof(tfrag3::MercVertex, mats[0]) // offset in array diff --git a/game/graphics/opengl_renderer/ocean/CommonOceanRenderer.cpp b/game/graphics/opengl_renderer/ocean/CommonOceanRenderer.cpp index 2f8ff68fb2..b5e00a239d 100644 --- a/game/graphics/opengl_renderer/ocean/CommonOceanRenderer.cpp +++ b/game/graphics/opengl_renderer/ocean/CommonOceanRenderer.cpp @@ -54,7 +54,7 @@ CommonOceanRenderer::CommonOceanRenderer() { // byte data glEnableVertexAttribArray(3); glVertexAttribIPointer(3, // location 3 in the shader - 1, // + 4, // GL_UNSIGNED_BYTE, // u8's sizeof(Vertex), // (void*)offsetof(Vertex, fog) // offset in array diff --git a/goal_src/goos-lib.gs b/goal_src/goos-lib.gs index 5370c6707a..37d4f00793 100644 --- a/goal_src/goos-lib.gs +++ b/goal_src/goos-lib.gs @@ -456,5 +456,10 @@ ;; build system ;; ;;;;;;;;;;;;;;;;;;;;;;;; -(define *jak1-full-game* (if (user? dass) #t #f)) +(define GAME_TERRITORY_SCEA 0) +(define GAME_TERRITORY_SCEE 1) +(define GAME_TERRITORY_SCEI 2) + +(define *jak1-full-game* (if (user? dass) #t #f)) +(define *jak1-territory* GAME_TERRITORY_SCEA) diff --git a/goal_src/jak1/compiler-setup.gc b/goal_src/jak1/compiler-setup.gc index 2c68a0018d..2ccf93246a 100644 --- a/goal_src/jak1/compiler-setup.gc +++ b/goal_src/jak1/compiler-setup.gc @@ -13,6 +13,8 @@ (defmacro __get_jak1_full_game () *jak1-full-game*) (defconstant *jak1-full-game* (__get_jak1_full_game)) +(defmacro __get_jak1_territory () *jak1-territory*) +(defconstant *jak1-territory* (__get_jak1_territory)) (defmacro load-art-import (name) `(asm-file ,(string-append "goal_src/jak1/import/" (symbol->string name) "-ag.gc") :no-code :no-throw)) diff --git a/goal_src/jak1/engine/common-obs/collectables-part.gc b/goal_src/jak1/engine/common-obs/collectables-part.gc index cd7c76030b..ccea3a8ad6 100644 --- a/goal_src/jak1/engine/common-obs/collectables-part.gc +++ b/goal_src/jak1/engine/common-obs/collectables-part.gc @@ -2067,7 +2067,7 @@ :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x2c :page #x2)) (sp-flt spt-num 1.0) - (sp-flt spt-scale-x (meters 1.22)) + (sp-flt spt-scale-x (meters 1.28)) (sp-copy-from-other spt-scale-y -4) (sp-flt spt-r 128.0) (sp-flt spt-g 128.0) diff --git a/goal_src/jak1/engine/entity/entity.gc b/goal_src/jak1/engine/entity/entity.gc index d86550aae7..98b2f93d38 100644 --- a/goal_src/jak1/engine/entity/entity.gc +++ b/goal_src/jak1/engine/entity/entity.gc @@ -1964,7 +1964,7 @@ ) ;; text id (can be hint ambient) ((and (= (-> e tag i name) 'text-id) (= (-> e tag i elt-count) 1) (= (-> e tag i elt-type) int32)) - (format *debug-temp-string* " (game-text-id ~S)" (enum->string game-text-id (-> (the (pointer int32) data) 0))) + (format *debug-temp-string* " (game-text-id ~S)" (game-text-id->string (-> (the (pointer game-text-id) data) 0))) ) ;; eco-info, like in vents, crates, or collectables in general ((and (= (-> e tag i name) 'eco-info) (= (-> e tag i elt-count) 2) (= (-> e tag i elt-type) int32)) diff --git a/goal_src/jak1/engine/game/main.gc b/goal_src/jak1/engine/game/main.gc index c7d192b6a3..2c229d05b8 100644 --- a/goal_src/jak1/engine/game/main.gc +++ b/goal_src/jak1/engine/game/main.gc @@ -345,10 +345,18 @@ ;;;;;;;;;;;;;;;;;;;;;; (defun scf-get-territory () - "this overrides the kernel version." - (if (and *jak1-full-game* (= (language-enum japanese) (-> *setting-control* default language))) - GAME_TERRITORY_SCEI + "this overrides the kernel version which usually has a hardcoded value." + + (if (not *debug-segment*) + (return *jak1-territory*)) + (case (-> *setting-control* default language) + (((language-enum japanese)) + GAME_TERRITORY_SCEI) + (((language-enum english)) GAME_TERRITORY_SCEA) + (else + GAME_TERRITORY_SCEE) + ) ) ;;;;;;;;;;;;;;;;;;;;;; diff --git a/goal_src/jak1/engine/sound/gsound.gc b/goal_src/jak1/engine/sound/gsound.gc index eae737b55a..57625dddec 100644 --- a/goal_src/jak1/engine/sound/gsound.gc +++ b/goal_src/jak1/engine/sound/gsound.gc @@ -151,7 +151,7 @@ ) (case (scf-get-territory) - ((2) + ((GAME_TERRITORY_SCEI) (sound-bank-load (static-sound-name "commonj")) ) (else diff --git a/goal_src/jak1/engine/ui/credits.gc b/goal_src/jak1/engine/ui/credits.gc index 7433eef742..979d88d25f 100644 --- a/goal_src/jak1/engine/ui/credits.gc +++ b/goal_src/jak1/engine/ui/credits.gc @@ -82,10 +82,10 @@ ) (when (= s2-0 3841) (case (scf-get-territory) - ((1) + ((GAME_TERRITORY_SCEE) (set! s3-0 (lookup-text! *common-text* (game-text-id europe) #t)) ) - ((2) + ((GAME_TERRITORY_SCEI) (set! s3-0 (lookup-text! *common-text* (game-text-id inc) #t)) ) ) diff --git a/goal_src/jak1/engine/ui/progress/progress-draw.gc b/goal_src/jak1/engine/ui/progress/progress-draw.gc index e068e4cfc8..a3a29c875b 100644 --- a/goal_src/jak1/engine/ui/progress/progress-draw.gc +++ b/goal_src/jak1/engine/ui/progress/progress-draw.gc @@ -857,7 +857,7 @@ (set! (-> v1-133 width) (the float 350)) ) (cond - ((= (scf-get-territory) 1) + ((= (scf-get-territory) GAME_TERRITORY_SCEE) (let ((s0-10 print-game-text)) (set! sv-128 format) (let ((a0-69 (clear *temp-string*)) diff --git a/goal_src/jak1/engine/ui/progress/progress.gc b/goal_src/jak1/engine/ui/progress/progress.gc index b7e436b7de..1ec474f0bd 100644 --- a/goal_src/jak1/engine/ui/progress/progress.gc +++ b/goal_src/jak1/engine/ui/progress/progress.gc @@ -1303,7 +1303,7 @@ (if (> (the-as int (-> (the-as (pointer uint64) (-> s5-0 (-> obj option-index) value-to-modify)))) 0) (+! (-> (the-as (pointer uint64) (-> s5-0 (-> obj option-index) value-to-modify))) -1) (set! (-> (the-as (pointer int64) (-> s5-0 (-> obj option-index) value-to-modify))) - (if (and (zero? (scf-get-territory)) + (if (and (= (scf-get-territory) GAME_TERRITORY_SCEA) (not (and (= *progress-cheat* 'language) (cpad-hold? 0 l2) (cpad-hold? 0 r2))) ) 4 @@ -1390,7 +1390,7 @@ (set! (-> (the-as (pointer symbol) (-> s5-0 (-> obj option-index) value-to-modify)) 0) 'ntsc) ) (((game-option-type language)) - (let ((v1-243 (if (and (zero? (scf-get-territory)) + (let ((v1-243 (if (and (= (scf-get-territory) GAME_TERRITORY_SCEA) (not (and (= *progress-cheat* 'language) (cpad-hold? 0 l2) (cpad-hold? 0 r2))) ) 4 diff --git a/goal_src/jak1/engine/ui/text-h.gc b/goal_src/jak1/engine/ui/text-h.gc index 2a12ef73b1..1b650ad45a 100644 --- a/goal_src/jak1/engine/ui/text-h.gc +++ b/goal_src/jak1/engine/ui/text-h.gc @@ -678,6 +678,8 @@ (cheat-invinc #x1095) (cheat-tunes #x1096) (cheat-sky #x1097) + (cheat-req-100-percent #x1098) + (cheat-req-beat-game #x1099) (music-player #x10c0) (scene-player #x10c1) (play-credits #x10c2) diff --git a/goal_src/jak1/levels/demo/demo-obs.gc b/goal_src/jak1/levels/demo/demo-obs.gc index 1b7dd64ae4..3aa1e1faea 100644 --- a/goal_src/jak1/levels/demo/demo-obs.gc +++ b/goal_src/jak1/levels/demo/demo-obs.gc @@ -23,7 +23,7 @@ (load-state-want-levels 'demo 'village1) (load-state-want-vis 'vi1) (case (scf-get-territory) - ((2) + ((GAME_TERRITORY_SCEI) (let ((gp-0 (ppointer->handle (static-screen-spawn 6 (new 'static 'texture-id :page #x27c) @@ -73,7 +73,7 @@ ) ) ) - ((1) + ((GAME_TERRITORY_SCEE) (case (-> *setting-control* current language) (((language-enum french)) (let ((gp-3 (ppointer->handle (static-screen-spawn diff --git a/goal_src/jak1/levels/title/title-obs.gc b/goal_src/jak1/levels/title/title-obs.gc index 1620f9d2ff..8ee15cbe6e 100644 --- a/goal_src/jak1/levels/title/title-obs.gc +++ b/goal_src/jak1/levels/title/title-obs.gc @@ -242,7 +242,7 @@ ) (send-event (handle->process (-> self camera)) 'mask 0) (case (scf-get-territory) - ((2) + ((GAME_TERRITORY_SCEI) (set! (-> self volumes) (ppointer->handle (process-spawn logo-slave (-> self entity) *logo-volumes-japan-sg* :to self)) ) @@ -577,7 +577,7 @@ (set! (-> *time-of-day-context* title-light-group dir1 levels x) 0.0) (set! (-> *time-of-day-context* title-light-group ambi levels x) 0.444) (case (scf-get-territory) - ((2) + ((GAME_TERRITORY_SCEI) (initialize-skeleton self *logo-japan-sg* '()) ) (else @@ -687,7 +687,7 @@ (let ((gp-0 (the-as handle #f))) ;; PAL patch here (cond - ((and (= (scf-get-territory) 2) *first-boot*) + ((and (= (scf-get-territory) GAME_TERRITORY_SCEI) *first-boot*) (set! *first-boot* #f) (set! gp-0 (ppointer->handle (static-screen-spawn 5 diff --git a/goal_src/jak1/pc/progress-pc.gc b/goal_src/jak1/pc/progress-pc.gc index 6f5762e900..81041cac71 100644 --- a/goal_src/jak1/pc/progress-pc.gc +++ b/goal_src/jak1/pc/progress-pc.gc @@ -326,16 +326,16 @@ -(defmacro def-language-remap-info (langs) - `(quote ,(apply (lambda (x) `((the binteger (game-text-id ,x)) (the binteger (pc-subtitle-lang ,x)))) langs)) +(defmacro def-language-remap-info (name langs) + `(define ,name (quote ,(apply (lambda (x) `((the binteger (game-text-id ,x)) (the binteger (pc-subtitle-lang ,x)))) langs))) ) -(define *language-remap-info-pc* (def-language-remap-info - (english uk-english french german spanish italian japanese portuguese br-portuguese swedish finnish danish norwegian))) +(def-language-remap-info *language-remap-info-pc* + (english uk-english french german spanish italian japanese portuguese br-portuguese swedish finnish danish norwegian)) (define *text-languages* (static-text-list-array - english uk-english french german spanish italian japanese)) + english uk-english french german spanish italian japanese)) (define *subtitle-languages* (static-text-list-array - english german spanish)) + english german spanish)) @@ -403,7 +403,7 @@ ) (defmacro add-flava-player-option (text-id flava) - "add a resolution button to *temp-options* with specified size" + "add a music player w/ flava button to *temp-options* with specified size" `(let ((option (-> *temp-options* (length *temp-options*)))) (set! (-> option option-type) (game-option-type button-flava)) (set! (-> option name) ,text-id) @@ -414,6 +414,18 @@ ) ) +(defmacro add-monitor-option (text-id monitor) + "add a display button to *temp-options* with specified size" + `(let ((option (-> *temp-options* (length *temp-options*)))) + (set! (-> option option-type) (game-option-type monitor)) + (set! (-> option name) ,text-id) + (set! (-> option param1) (the float ,monitor)) + (set! (-> option scale) #t) + + (1+! (-> *temp-options* length)) + ) + ) + (defmacro add-back-option () "add *back-button* to *temp-options*" `(let ((option (-> *temp-options* (length *temp-options*)))) @@ -434,7 +446,8 @@ ;; hack - do not use screen resolution in windowed mode, taskbar etc. messes it up and makes it useless! (skip? (= 'windowed display-mode)) ;; shortcut - (max-options (1- (-> *temp-options* allocated-length)))) + ;; we reserve 3 options. + (max-options (+ -3 (-> *temp-options* allocated-length)))) ;; get screen size (for capping) (pc-get-screen-size -1 (the (pointer int32) (& sx)) (the (pointer int32) (& sy))) @@ -476,16 +489,13 @@ (true! done?)) )) ;; extra funny options - (when (and (!= display-mode 'windowed) - (< (length *temp-options*) (- (-> *temp-options* allocated-length) 3))) + (when (!= display-mode 'windowed) (add-resolution-option 512 224) - (add-resolution-option 512 448) - ) + (add-resolution-option 512 448)) (add-back-option) ) - *temp-options* ) @@ -507,18 +517,11 @@ (set! (-> *temp-options* length) 0) (dotimes (i (pc-get-monitor-count)) - (let ((option (-> *temp-options* (length *temp-options*)))) - (set! (-> option option-type) (game-option-type monitor)) - (set! (-> option name) (game-text-id display-fmt)) - (set! (-> option param1) (the float i)) - (set! (-> option scale) #t) - - (1+! (-> *temp-options* length)) - ) + (add-monitor-option (game-text-id display-fmt) i) ) (add-back-option) - ) + *temp-options*) @@ -635,10 +638,13 @@ (set! (-> *options-remap* i) #f) ) + ;; give cheats + (when (task-closed? (game-task finalboss-movies) (task-status need-reminder)) + (logior! (-> *pc-settings* cheats-known) (pc-cheats sidekick-blue invinc tunes sky)) + (when (>= (calculate-completion (the progress #f)) 100.0) + (logior! (-> *pc-settings* cheats-known) (pc-cheats eco-blue eco-red eco-green eco-yellow)))) + ;; set up options for each screen - (when (>= (calculate-completion (the progress #f)) 100.0) - (logior! (-> *pc-settings* cheats-known) (pc-cheats eco-blue eco-red eco-green eco-yellow sidekick-blue invinc tunes sky)) - ) (set! (-> *options-remap* (progress-screen settings)) (if (or *cheat-mode* (nonzero? (-> *pc-settings* cheats-known))) *main-options-secrets* *main-options-pc*)) @@ -1671,6 +1677,7 @@ (unkx 27) (unk2 0) (font (new 'stack 'font-context *font-default-matrix* 0 0 0.0 (font-color default) (font-flags shadow kerning))) + (locked-str (lookup-text! *common-text* (game-text-id locked) #f)) ) ;; set the common params for the text drawing (set-width! font 370) @@ -1717,6 +1724,7 @@ (let ((option-str (the string #f)) ;; the option text (option-x 17) (option-y y-off) + (locked? #f) ) (case (-> options index option-type) (((game-option-type yes-no)) @@ -1730,24 +1738,25 @@ ;; menu option or simple button. just draw its text! (if (nonzero? (-> options index name)) (set! option-str (lookup-text! *common-text* (-> options index name) #f)) - (set! option-str (the-as string #f)) + (set! option-str #f) ) - (if (and (not (-> *setting-control* default auto-save)) + (when (and (not (-> *setting-control* default auto-save)) (= (game-text-id disable-auto-save) (-> options index name))) - (set! option-str (lookup-text! *common-text* (game-text-id auto-save-disabled) #f))) + (set! option-str (lookup-text! *common-text* (game-text-id auto-save-disabled) #f)) + (true! locked?)) ) (((game-option-type button-music)) ;; a button for the music player. has the text "locked" sometimes! (if (and (nonzero? (-> options index name)) (find-music-log (progress-get-music-by-index index))) (set! option-str (lookup-text! *common-text* (-> options index name) #f)) - (set! option-str (lookup-text! *common-text* (game-text-id locked) #f)) + (set! option-str locked-str) ) ) (((game-option-type button-flava)) ;; a button for the flava player. has the text "locked" sometimes! (if (and (nonzero? (-> options index name)) (find-flava-log (progress-get-music-by-index *progress-music*) (the int (-> options index param1)))) (set! option-str (lookup-text! *common-text* (-> options index name) #f)) - (set! option-str (lookup-text! *common-text* (game-text-id locked) #f)) + (set! option-str locked-str) ) ) (((game-option-type resolution) (game-option-type aspect-new)) @@ -1812,17 +1821,10 @@ ) ) (((game-option-type cheat-toggle)) - (cond - ((not (logtest? (-> *pc-settings* cheats-known) (ash 1 (the int (-> options index param1))))) - (set! option-str (lookup-text! *common-text* (game-text-id locked) #f)) + (if (-> (the-as (pointer symbol) (-> options index value-to-modify))) + (set! option-str (string-format "~30L~S~0L ~S" (lookup-text! *common-text* (game-text-id on) #f) (lookup-text! *common-text* (game-text-id off) #f))) + (set! option-str (string-format "~0L~S ~30L~S" (lookup-text! *common-text* (game-text-id on) #f) (lookup-text! *common-text* (game-text-id off) #f))) ) - (else - (if (-> (the-as (pointer symbol) (-> options index value-to-modify))) - (set! option-str (string-format "~30L~S~0L ~S" (lookup-text! *common-text* (game-text-id on) #f) (lookup-text! *common-text* (game-text-id off) #f))) - (set! option-str (string-format "~0L~S ~30L~S" (lookup-text! *common-text* (game-text-id on) #f) (lookup-text! *common-text* (game-text-id off) #f))) - ) - ) - ) ) (((game-option-type display-mode) (game-option-type msaa) @@ -1938,7 +1940,21 @@ (((game-option-type cheat-toggle)) (cond ((not (logtest? (-> *pc-settings* cheats-known) (ash 1 (the int (-> options index param1))))) - (set! option-str (lookup-text! *common-text* (game-text-id locked) #f)) + (true! locked?) + (case (ash 1 (the int (-> options index param1))) + (((pc-cheats eco-blue) + (pc-cheats eco-green) + (pc-cheats eco-red) + (pc-cheats eco-yellow)) + (set! option-str (lookup-text! *common-text* (game-text-id cheat-req-100-percent) #f))) + (((pc-cheats sky) + (pc-cheats sidekick-blue) + (pc-cheats tunes) + (pc-cheats invinc)) + (set! option-str (lookup-text! *common-text* (game-text-id cheat-req-beat-game) #f))) + (else + (set! option-str locked-str)) + ) ) (else (set! option-str (string-format "~S: ~S" (lookup-text! *common-text* (-> options index name) #f) @@ -1995,13 +2011,9 @@ ) (set-color! font (cond ((and (!= index (-> obj option-index)) - (string= (lookup-text! *common-text* (game-text-id locked) #f) option-str)) ;; hacky.. + (or locked? (= locked-str option-str))) ;; for "locked" options! (font-color flat-dark-purple)) - ((and (!= index (-> obj option-index)) - (not (-> *setting-control* default auto-save)) - (= (game-text-id disable-auto-save) (-> options index name))) - (font-color flat-dark-purple)) ((and (= index (-> obj option-index)) (not (or (progress-scrolling?) (-> obj in-transition)))) (font-color yellow-green-2))