From 2e7bbf21101617bcce7bbcbf17f427c1c412a55f Mon Sep 17 00:00:00 2001 From: Matt Dallmeyer Date: Thu, 20 Nov 2025 15:27:01 +0000 Subject: [PATCH] [jak3] Implement `city-peace` and `desert-peace` cheats (#4079) https://www.youtube.com/watch?v=VrEfiMFvUKU --- decompiler/config/jak3/all-types.gc | 15 +++++----- .../jak3/text/game_custom_text_en-US.json | 15 +++++----- goal_src/jak2/pc/pckernel.gc | 2 ++ goal_src/jak3/engine/debug/default-menu.gc | 29 +++++++++++++++++++ goal_src/jak3/engine/ui/text-h.gc | 15 +++++----- .../levels/city/common/ff-squad-control.gc | 17 +++++++++++ .../levels/city/common/kg-squad-control.gc | 22 ++++++++++++++ .../levels/city/common/mh-squad-control.gc | 26 +++++++++++++++++ goal_src/jak3/levels/city/ctywide-obs.gc | 18 ++++++++++++ .../desert/wvehicle/was-squad-control.gc | 18 ++++++++++++ goal_src/jak3/pc/pckernel-impl.gc | 1 + goal_src/jak3/pc/pckernel.gc | 20 +++++++++++++ 12 files changed, 177 insertions(+), 21 deletions(-) diff --git a/decompiler/config/jak3/all-types.gc b/decompiler/config/jak3/all-types.gc index ccd3eff626..aeb780513a 100644 --- a/decompiler/config/jak3/all-types.gc +++ b/decompiler/config/jak3/all-types.gc @@ -10142,13 +10142,14 @@ (progress-cheats-weather-bad #x1261) (progress-cheats-weather-good #x1262) (progress-cheats-hijack-lines #x1263) - (progress-cheats-locked #x1264) - (progress-cheats-turbo-board-unlock #x1265) - (progress-cheats-health-bars-unlock #x1266) - (progress-cheats-vehicle-health-bars-unlock #x1267) - (progress-cheats-statistics-unlock #x1268) - (progress-cheats-suck-in-all-unlock #x1269) - (progress-cheats-fast-travel-unlock #x126a) + (progress-cheats-desert-peace #x1264) + (progress-cheats-locked #x1265) + (progress-cheats-turbo-board-unlock #x1266) + (progress-cheats-health-bars-unlock #x1267) + (progress-cheats-vehicle-health-bars-unlock #x1268) + (progress-cheats-statistics-unlock #x1269) + (progress-cheats-suck-in-all-unlock #x126a) + (progress-cheats-fast-travel-unlock #x126b) ; (progress-camera-options #x1280) ; (progress-camera-options-first-horz #x1281) ; (progress-camera-options-first-vert #x1282) diff --git a/game/assets/jak3/text/game_custom_text_en-US.json b/game/assets/jak3/text/game_custom_text_en-US.json index ce37b4c894..a56c5a60a6 100644 --- a/game/assets/jak3/text/game_custom_text_en-US.json +++ b/game/assets/jak3/text/game_custom_text_en-US.json @@ -100,13 +100,14 @@ "1261": "Bad Weather", "1262": "Nice Weather", "1263": "Vehicle Hijack Voice Lines", - "1264": "Locked", - "1265": "Hit all 3 valves and find Mar's Statue in \"~S\" in under ~D seconds", - "1266": "Reduce Haven City's population count by ~D", - "1267": "Reduce Haven City's vehicle count by ~D", - "1268": "Hunt every species of Metal Head", - "1269": "Use the JET-Board to break open containers", - "126a": "Transport the Rift Rider while leaving Samos and Young Samos unscathed", + "1264": "Pacified Wasteland", + "1265": "Locked", + "1266": "Hit all 3 valves and find Mar's Statue in \"~S\" in under ~D seconds", + "1267": "Reduce Haven City's population count by ~D", + "1268": "Reduce Haven City's vehicle count by ~D", + "1269": "Hunt every species of Metal Head", + "126a": "Use the JET-Board to break open containers", + "126b": "Transport the Rift Rider while leaving Samos and Young Samos unscathed", "1280": "Camera Options", "1281": "Left/Right (1st Person)", "1282": "Up/Down (1st Person)", diff --git a/goal_src/jak2/pc/pckernel.gc b/goal_src/jak2/pc/pckernel.gc index 460a320a63..f4e1f2375f 100644 --- a/goal_src/jak2/pc/pckernel.gc +++ b/goal_src/jak2/pc/pckernel.gc @@ -149,6 +149,8 @@ ;(progress-cheats-fast-speed fast-speed #t nest-boss-resolution :skill 250) ;(progress-cheats-slow-speed slow-speed #t nest-boss-resolution :skill 250) ;(progress-cheats-statistics statistics auto atoll-water-introduction :unlock (progress-cheats-statistics-unlock pc-cheat-statistics-unlock)) + ;(progress-cheats-city-peace city-peace #t nest-boss-resolution :skill 200) + ;(progress-cheats-hijack-lines hijack-lines #t nest-boss-resolution :skill 200) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/goal_src/jak3/engine/debug/default-menu.gc b/goal_src/jak3/engine/debug/default-menu.gc index 4a4a532998..a82d26dea7 100644 --- a/goal_src/jak3/engine/debug/default-menu.gc +++ b/goal_src/jak3/engine/debug/default-menu.gc @@ -3175,6 +3175,13 @@ (send-event *target* 'change-mode 'pilot #f arg0 #t) ) +(defun dm-game-opengoal-cheat-toggle-pick-func ((arg0 int) (arg1 debug-menu-msg)) + (if (= arg1 (debug-menu-msg press)) + (logxor! (-> *pc-settings* cheats) (the-as uint (/ arg0 8))) + ) + (logtest? (-> *pc-settings* cheats) (/ arg0 8)) + ) + (defun stop-watch-display ((arg0 object) (arg1 object)) (let ((v1-3 (- (-> *display* base-clock frame-counter) (-> *game-info* stop-watch-start)))) (format arg1 "Stop watch ~D:~D:~D~%" (/ v1-3 #x4650) (/ (mod v1-3 #x4650) 300) (/ (* 100 (mod v1-3 300)) 300)) @@ -3469,6 +3476,28 @@ (flag "gun-upgrade-ammo-blue" 56 dm-game-secret-toggle-pick-func) (flag "gun-upgrade-ammo-dark" 57 dm-game-secret-toggle-pick-func) ) + ;; og:preserve-this new menu + (menu + "OpenGOAL Cheats" + (flag "turbo-board" 1 dm-game-opengoal-cheat-toggle-pick-func) + (flag "health-bars" 2 dm-game-opengoal-cheat-toggle-pick-func) + (flag "vehicle-health-bars" 4 dm-game-opengoal-cheat-toggle-pick-func) + (flag "vehicle-invuln" 8 dm-game-opengoal-cheat-toggle-pick-func) + (flag "statistics" 16 dm-game-opengoal-cheat-toggle-pick-func) + (flag "suck-in-all" 32 dm-game-opengoal-cheat-toggle-pick-func) + (flag "music-player" 64 dm-game-opengoal-cheat-toggle-pick-func) + (flag "no-textures" 128 dm-game-opengoal-cheat-toggle-pick-func) + (flag "fast-speed" 256 dm-game-opengoal-cheat-toggle-pick-func) + (flag "slow-speed" 512 dm-game-opengoal-cheat-toggle-pick-func) + (flag "fast-travel" 1024 dm-game-opengoal-cheat-toggle-pick-func) + (flag "orb-tracker" 2048 dm-game-opengoal-cheat-toggle-pick-func) + (flag "real-time-of-day" 4096 dm-game-opengoal-cheat-toggle-pick-func) + (flag "city-peace" 8192 dm-game-opengoal-cheat-toggle-pick-func) + (flag "board-tricks" 16384 dm-game-opengoal-cheat-toggle-pick-func) + (flag "weather-bad" 32768 dm-game-opengoal-cheat-toggle-pick-func) + (flag "weather-good" 65536 dm-game-opengoal-cheat-toggle-pick-func) + (flag "desert-peace" 131072 dm-game-opengoal-cheat-toggle-pick-func) + ) (function "Print Load State" #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (dotimes (gp-0 11) (let ((s5-0 (-> *level* level gp-0))) diff --git a/goal_src/jak3/engine/ui/text-h.gc b/goal_src/jak3/engine/ui/text-h.gc index efa8abd858..9bb48b6f10 100644 --- a/goal_src/jak3/engine/ui/text-h.gc +++ b/goal_src/jak3/engine/ui/text-h.gc @@ -1447,13 +1447,14 @@ (progress-cheats-weather-bad #x1261) (progress-cheats-weather-good #x1262) (progress-cheats-hijack-lines #x1263) - (progress-cheats-locked #x1264) - (progress-cheats-turbo-board-unlock #x1265) - (progress-cheats-health-bars-unlock #x1266) - (progress-cheats-vehicle-health-bars-unlock #x1267) - (progress-cheats-statistics-unlock #x1268) - (progress-cheats-suck-in-all-unlock #x1269) - (progress-cheats-fast-travel-unlock #x126a) + (progress-cheats-desert-peace #x1264) + (progress-cheats-locked #x1265) + (progress-cheats-turbo-board-unlock #x1266) + (progress-cheats-health-bars-unlock #x1267) + (progress-cheats-vehicle-health-bars-unlock #x1268) + (progress-cheats-statistics-unlock #x1269) + (progress-cheats-suck-in-all-unlock #x126a) + (progress-cheats-fast-travel-unlock #x126b) ; (progress-camera-options #x1280) ; (progress-camera-options-first-horz #x1281) ; (progress-camera-options-first-vert #x1282) diff --git a/goal_src/jak3/levels/city/common/ff-squad-control.gc b/goal_src/jak3/levels/city/common/ff-squad-control.gc index 7065e17d20..a9e17a8094 100644 --- a/goal_src/jak3/levels/city/common/ff-squad-control.gc +++ b/goal_src/jak3/levels/city/common/ff-squad-control.gc @@ -672,6 +672,23 @@ (-> a1-13 guard-info-normal min-target-count) ) ) + ;; og:preserve-this peaceful city cheat + (#when PC_PORT + (when (and (pc-cheats? (-> *pc-settings* cheats) city-peace) + (not (task-node-open? (game-task-node city-port-fight-resolution))) + (not (task-node-open? (game-task-node city-port-assault-resolution))) + (not (task-node-open? (game-task-node city-protect-hq-resolution))) + ) + (dotimes (guard-info-type 3) ;; normal/war/mission + (when (= (-> a1-13 data guard-info-type object-type) (traffic-type guard-a)) + (set! (-> a1-13 data guard-info-type target-count) (-> a1-13 data guard-info-type min-target-count)) + ;; (set! (-> this alert-level) 0) + (when (zero? (-> a1-13 data guard-info-type target-count)) + (send-event *traffic-manager* 'deactivate-by-type (-> a1-13 data guard-info-type object-type))) + ) + ) + ) + ) ) ) ) diff --git a/goal_src/jak3/levels/city/common/kg-squad-control.gc b/goal_src/jak3/levels/city/common/kg-squad-control.gc index 6fdfaacecd..b0cf7a1e4c 100644 --- a/goal_src/jak3/levels/city/common/kg-squad-control.gc +++ b/goal_src/jak3/levels/city/common/kg-squad-control.gc @@ -180,6 +180,25 @@ (dotimes (v1-3 3) (dotimes (a1-3 4) (let ((a2-12 (the-as kg-squad-settings (+ (+ (* a1-3 16) 860 (* v1-3 64)) (the-as int this))))) + ;; og:preserve-this peaceful city cheat + (#when PC_PORT + (when (and (pc-cheats? (-> *pc-settings* cheats) city-peace) + (not (task-node-open? (game-task-node city-port-fight-resolution))) + (not (task-node-open? (game-task-node city-port-assault-resolution))) + (not (task-node-open? (game-task-node city-protect-hq-resolution))) + ) + (dotimes (squad-setting-type 4) ;; roboguard/roboguard-giant/flying-turret/spydroid + (when (or (= (-> a2-12 kg-enemy-settings squad-setting-type object-type) (traffic-type roboguard)) + (= (-> a2-12 kg-enemy-settings squad-setting-type object-type) (traffic-type flying-turret)) + (= (-> a2-12 kg-enemy-settings squad-setting-type object-type) (traffic-type spydroid))) + (set! (-> a2-12 kg-enemy-settings squad-setting-type target-count) (-> a2-12 kg-enemy-settings squad-setting-type min-target-count)) + (set! (-> this alert-level) 0) + (when (zero? (-> a2-12 kg-enemy-settings squad-setting-type target-count)) + (send-event *traffic-manager* 'deactivate-by-type (-> a2-12 kg-enemy-settings squad-setting-type object-type))) + ) + ) + ) + ) (+! (-> this traffic object-type-info-array @@ -260,6 +279,9 @@ (copy-squad-settings-to-idx this *default-kg-squad-member-settings* 0) ) ) + ;; og:preserve-this - restore war/mission squad settings (e.g. if city-peace cheat is toggled on->off) + (copy-squad-settings-to-idx this *war-kg-squad-member-settings* 1) + (copy-squad-settings-to-idx this *default-kg-squad-member-settings* 2) (kg-squad-control-method-51 this) (kg-squad-control-method-53 this) (when *cty-faction-manager* diff --git a/goal_src/jak3/levels/city/common/mh-squad-control.gc b/goal_src/jak3/levels/city/common/mh-squad-control.gc index 207797475b..dd4e4e6849 100644 --- a/goal_src/jak3/levels/city/common/mh-squad-control.gc +++ b/goal_src/jak3/levels/city/common/mh-squad-control.gc @@ -109,6 +109,21 @@ (dotimes (v1-0 3) (dotimes (a1-0 3) (let ((a3-2 (the-as mh-squad-settings (+ (+ (* a1-0 16) 828 (* 48 v1-0)) (the-as int this))))) + ;; og:preserve-this peaceful city cheat + (#when PC_PORT + (when (and (pc-cheats? (-> *pc-settings* cheats) city-peace) + (not (task-node-open? (game-task-node city-port-fight-resolution))) + (not (task-node-open? (game-task-node city-port-assault-resolution))) + (not (task-node-open? (game-task-node city-protect-hq-resolution))) + ) + (dotimes (squad-setting-type 3) ;; grunt/flitter/predator + (set! (-> a3-2 mh-enemy-settings squad-setting-type target-count) (-> a3-2 mh-enemy-settings squad-setting-type min-target-count)) + (set! (-> this alert-level) 0) + (when (zero? (-> a3-2 mh-enemy-settings squad-setting-type target-count)) + (send-event *traffic-manager* 'deactivate-by-type (-> a3-2 mh-enemy-settings squad-setting-type object-type))) + ) + ) + ) (set! (-> this traffic object-type-info-array 0 target-counts (+ v1-0 (* (-> a3-2 grunt-settings object-type) 32))) (max (min (-> a3-2 grunt-settings target-count) (-> a3-2 grunt-settings max-target-count)) @@ -140,6 +155,17 @@ ) ) ) + ;; og:preserve-this - restore war/mission squad settings (e.g. if city-peace cheat is toggled on->off) + (copy-squad-settings-to-idx + this + (the-as (inline-array mh-squad-member-settings) *war-mh-squad-member-settings*) + 1 + ) + (copy-squad-settings-to-idx + this + (the-as (inline-array mh-squad-member-settings) *default-mh-squad-member-settings*) + 2 + ) (when *cty-faction-manager* (let ((a2-2 (if (-> *setting-control* user-current mh-enemy-settings) 7 diff --git a/goal_src/jak3/levels/city/ctywide-obs.gc b/goal_src/jak3/levels/city/ctywide-obs.gc index b09ff8470e..43db5dba18 100644 --- a/goal_src/jak3/levels/city/ctywide-obs.gc +++ b/goal_src/jak3/levels/city/ctywide-obs.gc @@ -2600,6 +2600,24 @@ (set-time! (-> self state-time)) ) :trans (behavior () + ;; og:preserve-this peaceful city cheat + (#when PC_PORT + (when (and (pc-cheats? (-> *pc-settings* cheats) city-peace) + (not (task-node-open? (game-task-node city-port-fight-resolution))) + (not (task-node-open? (game-task-node city-port-assault-resolution))) + (not (task-node-open? (game-task-node city-protect-hq-resolution))) + ) + (dotimes (s5-0 (-> self spawner records length)) + (let ((v1-11 (as-type (handle->process (-> self spawner records data s5-0 proc)) process-focusable))) + (when v1-11 + (if (not (focus-test? (the-as process-focusable v1-11) disable dead inactive)) + (send-event v1-11 'traffic-off-force) + ) + ) + ) + ) + ) + ) (when (time-elapsed? (-> self state-time) (seconds 1)) (set-time! (-> self state-time)) (let ((gp-0 0)) diff --git a/goal_src/jak3/levels/desert/wvehicle/was-squad-control.gc b/goal_src/jak3/levels/desert/wvehicle/was-squad-control.gc index 947e93c719..538754cc9a 100644 --- a/goal_src/jak3/levels/desert/wvehicle/was-squad-control.gc +++ b/goal_src/jak3/levels/desert/wvehicle/was-squad-control.gc @@ -334,6 +334,24 @@ ) ) ) + ;; og:preserve-this peaceful wasteland cheat + (#when PC_PORT + (when (pc-cheats? (-> *pc-settings* cheats) desert-peace) + (set! (-> this target-count) 0) + (dotimes (s4-1 10) + (let ((s3-0 (as-type (handle->process (-> this units s4-1)) process-focusable))) + (when (and s3-0 + (not (focus-test? (the-as process-focusable s3-0) dead)) + (send-event s3-0 'go-die)) + (+! (-> this reserve-count) 1) + (set! (-> this units s4-1) (the-as handle #f)) + ) + ) + ) + (remove-setting! 'dust-storm-sound-scalar) + (set-setting! 'fog-special-interp-targ #f 0.0 0) + ) + ) (let ((s5-2 0) (s4-2 0) ) diff --git a/goal_src/jak3/pc/pckernel-impl.gc b/goal_src/jak3/pc/pckernel-impl.gc index ccfd6c5112..68c79763fc 100644 --- a/goal_src/jak3/pc/pckernel-impl.gc +++ b/goal_src/jak3/pc/pckernel-impl.gc @@ -40,6 +40,7 @@ (board-tricks) (weather-bad) (weather-good) + (desert-peace) ) (defun pc-cheats->string ((cheats pc-cheats) (buf object)) diff --git a/goal_src/jak3/pc/pckernel.gc b/goal_src/jak3/pc/pckernel.gc index 9239b5546c..fce205f8ad 100644 --- a/goal_src/jak3/pc/pckernel.gc +++ b/goal_src/jak3/pc/pckernel.gc @@ -68,6 +68,26 @@ (def-pc-cheat-list *pc-cheats-list* ;; name cheat flag can-toggle avail-after ;(progress-cheats-music-player music-player #f fortress-escape-introduction) + ;(progress-cheats-real-time-of-day real-time-of-day #t fortress-escape-resolution) + ;(progress-cheats-board-tricks board-tricks #t stadium-board1-gold) + ;(progress-cheats-health-bars health-bars #t palace-boss-resolution :unlock (progress-cheats-health-bars-unlock pc-cheat-health-bars-unlock)) + ;(progress-cheats-vehicle-health-bars vehicle-health-bars #t palace-boss-resolution :unlock (progress-cheats-vehicle-health-bars-unlock pc-cheat-vehicle-health-bars-unlock)) + ;(progress-cheats-weather-bad weather-bad #t fortress-escape-resolution :skill 85) + ;(progress-cheats-weather-good weather-good #t fortress-escape-resolution :skill 85) + ;(progress-cheats-suck-in-all suck-in-all #t forest-scouts-get-board :unlock (progress-cheats-suck-in-all-unlock pc-cheat-suck-in-all-unlock)) + ;(progress-cheats-turbo-board turbo-board #t sewer-board-introduction :unlock (progress-cheats-turbo-board-unlock pc-cheat-board-fast-unlock)) + ;(progress-cheats-fast-travel fast-travel auto city-defend-stadium-introduction :unlock (progress-cheats-fast-travel-unlock pc-cheat-fast-travel-unlock)) + ;(progress-cheats-orb-tracker orb-tracker auto nest-boss-resolution) + ;(progress-cheats-no-textures no-textures #t nest-boss-resolution :skill 115) + ;(progress-cheats-vehicle-invuln vehicle-invuln #t nest-boss-resolution :skill 185) + ;(progress-cheats-fast-movies fast-movies #t nest-boss-resolution :skill 200) + ;(progress-cheats-slow-movies slow-movies #t nest-boss-resolution :skill 200) + ;(progress-cheats-fast-speed fast-speed #t nest-boss-resolution :skill 250) + ;(progress-cheats-slow-speed slow-speed #t nest-boss-resolution :skill 250) + ;(progress-cheats-statistics statistics auto atoll-water-introduction :unlock (progress-cheats-statistics-unlock pc-cheat-statistics-unlock)) + ;(progress-cheats-city-peace city-peace #t nest-boss-resolution :skill 200) + ;(progress-cheats-hijack-lines hijack-lines #t nest-boss-resolution :skill 200) + ;(progress-cheats-desert-peace desert-peace #t nest-boss-resolution :skill 200) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;