From 39d989cfccf4427acf72a0b1dfc1993ffb3e5b60 Mon Sep 17 00:00:00 2001 From: ManDude <7569514+ManDude@users.noreply.github.com> Date: Tue, 8 Aug 2023 17:21:29 +0100 Subject: [PATCH] [jak2] prepare `scf-get-territory` usage (#2890) --- decompiler/config/jak2/all-types.gc | 32 +- .../jak2/text/game_custom_text_en-US.json | 2 +- goal_src/jak2/engine/game/main.gc | 732 ++---------------- goal_src/jak2/engine/game/settings.gc | 6 +- goal_src/jak2/engine/ps2/pad.gc | 39 +- goal_src/jak2/engine/scene/scene.gc | 2 +- goal_src/jak2/engine/sound/gsound.gc | 2 +- .../jak2/engine/ui/progress/progress-draw.gc | 10 +- goal_src/jak2/engine/ui/progress/progress.gc | 10 +- goal_src/jak2/engine/ui/text-id-h.gc | 2 +- goal_src/jak2/engine/ui/text.gc | 2 +- goal_src/jak2/kernel-defs.gc | 4 + .../levels/city/traffic/citizen/civilian.gc | 2 +- goal_src/jak2/levels/demo/demo-obs.gc | 101 +-- goal_src/jak2/levels/intro/intro-scenes.gc | 10 +- goal_src/jak2/levels/title/title-obs.gc | 34 +- goal_src/jak2/pc/debug/default-menu-pc.gc | 12 + goal_src/jak2/pc/progress/progress-draw-pc.gc | 7 +- goal_src/jak2/pc/progress/progress-pc.gc | 4 +- .../jak2/levels/demo/demo-obs_REF.gc | 84 +- .../jak2/levels/title/title-obs_REF.gc | 26 +- 21 files changed, 264 insertions(+), 859 deletions(-) diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index 0f5f12d537..250edfa66f 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -7254,7 +7254,7 @@ (progress-aspect-ratio-custom-pad-x #x1209) (progress-aspect-ratio-custom-pad-circle #x120a) (progress-aspect-ratio-custom-warn #x120b) - (progress-aspect-ratio-custom-ratio #x120c) + (progress-music-player #x120c) (progress-vsync #x120d) (progress-text-language #x120e) (progress-cheats #x120f) @@ -43592,8 +43592,8 @@ ;; TODO - defined in the kernel (define-extern *demo-control* (pointer demo-control)) (define-extern demo-plug-lightning (function process-drawable vector cspace none)) -(define-extern demo-screen-change (function symbol int symbol int none :behavior demo-control)) -(define-extern demo-wait-for-press (function time-frame time-frame symbol symbol)) +(define-extern demo-screen-change (function int int symbol symbol int :behavior demo-control)) +(define-extern demo-wait-for-press (function time-frame time-frame symbol)) (define-extern demo-menu (function object :behavior demo-control)) (define-extern demo-control-init (function none :behavior demo-control)) @@ -44886,19 +44886,19 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (deftype title-control (process) - ((selected int32 :offset-assert 128) - (sprites hud-sprite 2 :inline :offset-assert 144) - (sprite-pos vector :inline :offset-assert 272) + ((selected int32 :offset-assert 128) + (sprites hud-sprite 2 :inline :offset-assert 144) + (sprite-pos vector :inline :offset-assert 272) (sprite-draw uint32 :offset-assert 288) - (buffer external-art-buffer 2 :offset-assert 292) - (want int32 2 :offset-assert 300) - (want-name basic 2 :offset-assert 308) - (have int32 2 :offset-assert 316) - (draw int32 :offset-assert 324) - (draw-name basic :offset-assert 328) - (active symbol :offset-assert 332) - (spark-time time-frame :offset-assert 336) - (gui-id sound-id :offset-assert 344) + (buffer external-art-buffer 2 :offset-assert 292) + (want int32 2 :offset-assert 300) + (want-name string 2 :offset-assert 308) + (have int32 2 :offset-assert 316) + (draw int32 :offset-assert 324) + (draw-name string :offset-assert 328) + (active symbol :offset-assert 332) + (spark-time time-frame :offset-assert 336) + (gui-id sound-id :offset-assert 344) ) :method-count-assert 18 :size-assert #x15c @@ -44913,7 +44913,7 @@ ) (define-extern title-plug-lightning (function process-drawable vector cspace none)) -(define-extern title-screen-change (function symbol int symbol int symbol symbol none :behavior title-control)) +(define-extern title-screen-change (function string int string int symbol symbol none :behavior title-control)) (define-extern wait-for-press (function time-frame time-frame symbol symbol)) (define-extern title-menu (function object :behavior title-control)) (define-extern title-fade-out (function float none)) diff --git a/game/assets/jak2/text/game_custom_text_en-US.json b/game/assets/jak2/text/game_custom_text_en-US.json index 3b431a5f04..2f0d759f43 100644 --- a/game/assets/jak2/text/game_custom_text_en-US.json +++ b/game/assets/jak2/text/game_custom_text_en-US.json @@ -19,7 +19,7 @@ "1209": "Press to confirm and exit.", "120a": "Press to confirm and exit.", "120b": "Ratio must not be lower than 4x3!", - "120c": "Current ratio is ~f.", + "120c": "Music Player", "120d": "V-Sync", "120e": "Text Language", "120f": "OpenGOAL Secrets", diff --git a/goal_src/jak2/engine/game/main.gc b/goal_src/jak2/engine/game/main.gc index 12fdc5a15b..05d1efdc8a 100644 --- a/goal_src/jak2/engine/game/main.gc +++ b/goal_src/jak2/engine/game/main.gc @@ -376,6 +376,18 @@ (none) ) +(#when PC_PORT + +;; redefined from C kernel +(define *scf-territory-debug* GAME_TERRITORY_SCEA) +(defun scf-get-territory () + "redefined from C kernel for convenience" + (if *debug-segment* + *scf-territory-debug* + *scf-territory-debug*) + ) +) + (define *cheat-temp* (the-as (pointer int32) (malloc 'global 20))) (define *master-exit* #f) @@ -385,684 +397,76 @@ (defun main-cheats () (when (and (cpad-hold? 0 l3) (or *cheat-mode* (not (demo?)))) ((lambda () - (when (nonzero? (-> *cpad-list* cpads 0 button0-rel 0)) - (let ((v1-5 (-> *cheat-temp* 0))) - (cond - ((zero? v1-5) - (cond - ((cpad-pressed? 0 up) - (+! (-> *cheat-temp* 0) 1) - ) - (else - (set! (-> *cheat-temp* 0) 0) - 0 - ) - ) - ) - ((= v1-5 1) - (cond - ((cpad-pressed? 0 up) - (+! (-> *cheat-temp* 0) 1) - ) - (else - (set! (-> *cheat-temp* 0) 0) - 0 - ) - ) - ) - ((= v1-5 2) - (cond - ((cpad-pressed? 0 down) - (+! (-> *cheat-temp* 0) 1) - ) - (else - (set! (-> *cheat-temp* 0) 0) - 0 - ) - ) - ) - ((= v1-5 3) - (cond - ((cpad-pressed? 0 down) - (+! (-> *cheat-temp* 0) 1) - ) - (else - (set! (-> *cheat-temp* 0) 0) - 0 - ) - ) - ) - ((= v1-5 4) - (cond - ((cpad-pressed? 0 left) - (+! (-> *cheat-temp* 0) 1) - ) - (else - (set! (-> *cheat-temp* 0) 0) - 0 - ) - ) - ) - ((= v1-5 5) - (cond - ((cpad-pressed? 0 right) - (+! (-> *cheat-temp* 0) 1) - ) - (else - (set! (-> *cheat-temp* 0) 0) - 0 - ) - ) - ) - ((= v1-5 6) - (cond - ((cpad-pressed? 0 left) - (+! (-> *cheat-temp* 0) 1) - ) - (else - (set! (-> *cheat-temp* 0) 0) - 0 - ) - ) - ) - ((= v1-5 7) - (cond - ((cpad-pressed? 0 right) - (+! (-> *cheat-temp* 0) 1) - ) - (else - (set! (-> *cheat-temp* 0) 0) - 0 - ) - ) - ) - ((= v1-5 8) - (cond - ((cpad-pressed? 0 x) - (+! (-> *cheat-temp* 0) 1) - ) - (else - (set! (-> *cheat-temp* 0) 0) - 0 - ) - ) - ) - ((= v1-5 9) - (cond - ((cpad-pressed? 0 x) - (+! (-> *cheat-temp* 0) 1) - ) - (else - (set! (-> *cheat-temp* 0) 0) - 0 - ) - ) - ) - ((= v1-5 10) - (cond - ((cpad-pressed? 0 square) - (+! (-> *cheat-temp* 0) 1) - ) - (else - (set! (-> *cheat-temp* 0) 0) - 0 - ) - ) - ) - ((= v1-5 11) - (cond - ((cpad-pressed? 0 circle) - (+! (-> *cheat-temp* 0) 1) - ) - (else - (set! (-> *cheat-temp* 0) 0) - 0 - ) - ) - ) - ((= v1-5 12) - (cond - ((cpad-pressed? 0 square) - (+! (-> *cheat-temp* 0) 1) - ) - (else - (set! (-> *cheat-temp* 0) 0) - 0 - ) - ) - ) - ((= v1-5 13) - (cond - ((cpad-pressed? 0 circle) - (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons r1)) - (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons r1)) - (set! *cheat-mode* (not *cheat-mode*)) - (if *cheat-mode* - (sound-play-by-spec (static-sound-spec "menu-pick" :fo-curve 1) (new-sound-id) (the-as vector #t)) - (sound-play-by-spec (static-sound-spec "menu-back" :fo-curve 1) (new-sound-id) (the-as vector #t)) - ) - (set! (-> *cheat-temp* 0) 0) - 0 - ) - (else - (set! (-> *cheat-temp* 0) 0) - 0 - ) - ) - ) - ) - ) - ) + (check-cheat-code (-> *cheat-temp* 0) 0 + (up up down down left right left right x x square circle square circle) + (cpad-clear! 0 r1) + ;; toggle! + (not! *cheat-mode*) + (cheats-sound-play *cheat-mode*) + ) (when *cheat-mode* - (when (nonzero? (-> *cpad-list* cpads 0 button0-rel 0)) - (let ((v1-146 (-> *cheat-temp* 1))) - (cond - ((zero? v1-146) - (cond - ((cpad-pressed? 0 circle) - (+! (-> *cheat-temp* 1) 1) - ) - (else - (set! (-> *cheat-temp* 1) 0) - 0 - ) - ) - ) - ((= v1-146 1) - (cond - ((cpad-pressed? 0 square) - (+! (-> *cheat-temp* 1) 1) - ) - (else - (set! (-> *cheat-temp* 1) 0) - 0 - ) - ) - ) - ((= v1-146 2) - (cond - ((cpad-pressed? 0 circle) - (+! (-> *cheat-temp* 1) 1) - ) - (else - (set! (-> *cheat-temp* 1) 0) - 0 - ) - ) - ) - ((= v1-146 3) - (cond - ((cpad-pressed? 0 square) - (+! (-> *cheat-temp* 1) 1) - ) - (else - (set! (-> *cheat-temp* 1) 0) - 0 - ) - ) - ) - ((= v1-146 4) - (cond - ((cpad-pressed? 0 x) - (+! (-> *cheat-temp* 1) 1) - ) - (else - (set! (-> *cheat-temp* 1) 0) - 0 - ) - ) - ) - ((= v1-146 5) - (cond - ((cpad-pressed? 0 x) - (+! (-> *cheat-temp* 1) 1) - ) - (else - (set! (-> *cheat-temp* 1) 0) - 0 - ) - ) - ) - ((= v1-146 6) - (cond - ((cpad-pressed? 0 right) - (+! (-> *cheat-temp* 1) 1) - ) - (else - (set! (-> *cheat-temp* 1) 0) - 0 - ) - ) - ) - ((= v1-146 7) - (cond - ((cpad-pressed? 0 left) - (+! (-> *cheat-temp* 1) 1) - ) - (else - (set! (-> *cheat-temp* 1) 0) - 0 - ) - ) - ) - ((= v1-146 8) - (cond - ((cpad-pressed? 0 right) - (+! (-> *cheat-temp* 1) 1) - ) - (else - (set! (-> *cheat-temp* 1) 0) - 0 - ) - ) - ) - ((= v1-146 9) - (cond - ((cpad-pressed? 0 left) - (+! (-> *cheat-temp* 1) 1) - ) - (else - (set! (-> *cheat-temp* 1) 0) - 0 - ) - ) - ) - ((= v1-146 10) - (cond - ((cpad-pressed? 0 down) - (+! (-> *cheat-temp* 1) 1) - ) - (else - (set! (-> *cheat-temp* 1) 0) - 0 - ) - ) - ) - ((= v1-146 11) - (cond - ((cpad-pressed? 0 down) - (+! (-> *cheat-temp* 1) 1) - ) - (else - (set! (-> *cheat-temp* 1) 0) - 0 - ) - ) - ) - ((= v1-146 12) - (cond - ((cpad-pressed? 0 up) - (+! (-> *cheat-temp* 1) 1) - ) - (else - (set! (-> *cheat-temp* 1) 0) - 0 - ) - ) - ) - ((= v1-146 13) - (cond - ((cpad-pressed? 0 up) - (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons r1)) - (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons r1)) - (set! *cheat-mode* (if (= *cheat-mode* 'debug) - #t - 'debug - ) - ) - (if (= *cheat-mode* 'debug) - (sound-play-by-spec (static-sound-spec "menu-pick" :fo-curve 1) (new-sound-id) (the-as vector #t)) - (sound-play-by-spec (static-sound-spec "menu-back" :fo-curve 1) (new-sound-id) (the-as vector #t)) - ) - (set! (-> *cheat-temp* 1) 0) - 0 - ) - (else - (set! (-> *cheat-temp* 1) 0) - 0 - ) - ) - ) - ) - ) - ) - ) + (check-cheat-code (-> *cheat-temp* 1) 0 + (circle square circle square x x right left right left down down up up) + (cpad-clear! 0 r1) + (set! *cheat-mode* (if (= *cheat-mode* 'debug) + #t + 'debug + ) + ) + (cheats-sound-play *cheat-mode*) + ) + ) (none) ) ) ((lambda () (case (scf-get-territory) - ((2) - (when (nonzero? (-> *cpad-list* cpads 0 button0-rel 0)) - (let ((v1-7 (-> *cheat-temp* 2))) - (cond - ((zero? v1-7) - (cond - ((cpad-pressed? 0 l1) - (+! (-> *cheat-temp* 2) 1) - ) - (else - (set! (-> *cheat-temp* 2) 0) - 0 - ) - ) - ) - ((= v1-7 1) - (cond - ((cpad-pressed? 0 r1) - (+! (-> *cheat-temp* 2) 1) - ) - (else - (set! (-> *cheat-temp* 2) 0) - 0 - ) - ) - ) - ((= v1-7 2) - (cond - ((cpad-pressed? 0 l1) - (+! (-> *cheat-temp* 2) 1) - ) - (else - (set! (-> *cheat-temp* 2) 0) - 0 - ) - ) - ) - ((= v1-7 3) - (cond - ((cpad-pressed? 0 r1) - (+! (-> *cheat-temp* 2) 1) - ) - (else - (set! (-> *cheat-temp* 2) 0) - 0 - ) - ) - ) - ((= v1-7 4) - (cond - ((cpad-pressed? 0 triangle) - (+! (-> *cheat-temp* 2) 1) - ) - (else - (set! (-> *cheat-temp* 2) 0) - 0 - ) - ) - ) - ((= v1-7 5) - (cond - ((cpad-pressed? 0 circle) - (+! (-> *cheat-temp* 2) 1) - ) - (else - (set! (-> *cheat-temp* 2) 0) - 0 - ) - ) - ) - ((= v1-7 6) - (cond - ((cpad-pressed? 0 x) - (+! (-> *cheat-temp* 2) 1) - ) - (else - (set! (-> *cheat-temp* 2) 0) - 0 - ) - ) - ) - ((= v1-7 7) - (cond - ((cpad-pressed? 0 square) - (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons r1)) - (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons r1)) - (set! *progress-cheat* (if *progress-cheat* - #f - 'language - ) - ) - (if *progress-cheat* - (sound-play-by-spec (static-sound-spec "menu-pick" :fo-curve 1) (new-sound-id) (the-as vector #t)) - (sound-play-by-spec (static-sound-spec "menu-back" :fo-curve 1) (new-sound-id) (the-as vector #t)) - ) - (set! (-> *cheat-temp* 2) 0) - 0 - ) - (else - (set! (-> *cheat-temp* 2) 0) - 0 - ) - ) - ) - ) + ((GAME_TERRITORY_SCEI) + (check-cheat-code (-> *cheat-temp* 2) 0 + (l1 r1 l1 r1 triangle circle x square) + (cpad-clear! 0 r1) + (set! *progress-cheat* (if *progress-cheat* + #f + 'language + ) + ) + (cheats-sound-play *progress-cheat*) ) - ) ) ) (when *debug-segment* - (when (nonzero? (-> *cpad-list* cpads 0 button0-rel 0)) - (let ((v1-95 (-> *cheat-temp* 3))) - (cond - ((zero? v1-95) + (check-cheat-code (-> *cheat-temp* 3) 0 + (x square triangle circle x square triangle circle) + (cpad-clear! 0 r1) + (set! *progress-cheat* (if *progress-cheat* + #f + 'pal + ) + ) + (cheats-sound-play *progress-cheat*) + ) + (check-cheat-code (-> *cheat-temp* 5) 1 + (triangle x circle square triangle x circle square) + (cpad-clear! 0 r1) + (set! *cheat-mode* (if (= *cheat-mode* 'camera) + #f + 'camera + ) + ) (cond - ((cpad-pressed? 0 x) - (+! (-> *cheat-temp* 3) 1) - ) + (*cheat-mode* + (if (not *external-cam-mode*) + (external-cam-reset!) + ) + (set! *external-cam-mode* 'pad-1) + (sound-play-by-spec (static-sound-spec "menu-pick" :fo-curve 1) (new-sound-id) (the-as vector #t)) + ) (else - (set! (-> *cheat-temp* 3) 0) - 0 + (set! *external-cam-mode* #f) + (sound-play-by-spec (static-sound-spec "menu-back" :fo-curve 1) (new-sound-id) (the-as vector #t)) ) ) - ) - ((= v1-95 1) - (cond - ((cpad-pressed? 0 square) - (+! (-> *cheat-temp* 3) 1) - ) - (else - (set! (-> *cheat-temp* 3) 0) - 0 - ) - ) - ) - ((= v1-95 2) - (cond - ((cpad-pressed? 0 triangle) - (+! (-> *cheat-temp* 3) 1) - ) - (else - (set! (-> *cheat-temp* 3) 0) - 0 - ) - ) - ) - ((= v1-95 3) - (cond - ((cpad-pressed? 0 circle) - (+! (-> *cheat-temp* 3) 1) - ) - (else - (set! (-> *cheat-temp* 3) 0) - 0 - ) - ) - ) - ((= v1-95 4) - (cond - ((cpad-pressed? 0 x) - (+! (-> *cheat-temp* 3) 1) - ) - (else - (set! (-> *cheat-temp* 3) 0) - 0 - ) - ) - ) - ((= v1-95 5) - (cond - ((cpad-pressed? 0 square) - (+! (-> *cheat-temp* 3) 1) - ) - (else - (set! (-> *cheat-temp* 3) 0) - 0 - ) - ) - ) - ((= v1-95 6) - (cond - ((cpad-pressed? 0 triangle) - (+! (-> *cheat-temp* 3) 1) - ) - (else - (set! (-> *cheat-temp* 3) 0) - 0 - ) - ) - ) - ((= v1-95 7) - (cond - ((cpad-pressed? 0 circle) - (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons r1)) - (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons r1)) - (set! *progress-cheat* (if *progress-cheat* - #f - 'pal - ) - ) - (if *progress-cheat* - (sound-play-by-spec (static-sound-spec "menu-pick" :fo-curve 1) (new-sound-id) (the-as vector #t)) - (sound-play-by-spec (static-sound-spec "menu-back" :fo-curve 1) (new-sound-id) (the-as vector #t)) - ) - (set! (-> *cheat-temp* 3) 0) - 0 - ) - (else - (set! (-> *cheat-temp* 3) 0) - 0 - ) - ) - ) - ) - ) - ) - (when (nonzero? (-> *cpad-list* cpads 1 button0-rel 0)) - (let ((v1-181 (-> *cheat-temp* 5))) - (cond - ((zero? v1-181) - (cond - ((cpad-pressed? 1 triangle) - (+! (-> *cheat-temp* 5) 1) - ) - (else - (set! (-> *cheat-temp* 5) 0) - 0 - ) - ) - ) - ((= v1-181 1) - (cond - ((cpad-pressed? 1 x) - (+! (-> *cheat-temp* 5) 1) - ) - (else - (set! (-> *cheat-temp* 5) 0) - 0 - ) - ) - ) - ((= v1-181 2) - (cond - ((cpad-pressed? 1 circle) - (+! (-> *cheat-temp* 5) 1) - ) - (else - (set! (-> *cheat-temp* 5) 0) - 0 - ) - ) - ) - ((= v1-181 3) - (cond - ((cpad-pressed? 1 square) - (+! (-> *cheat-temp* 5) 1) - ) - (else - (set! (-> *cheat-temp* 5) 0) - 0 - ) - ) - ) - ((= v1-181 4) - (cond - ((cpad-pressed? 1 triangle) - (+! (-> *cheat-temp* 5) 1) - ) - (else - (set! (-> *cheat-temp* 5) 0) - 0 - ) - ) - ) - ((= v1-181 5) - (cond - ((cpad-pressed? 1 x) - (+! (-> *cheat-temp* 5) 1) - ) - (else - (set! (-> *cheat-temp* 5) 0) - 0 - ) - ) - ) - ((= v1-181 6) - (cond - ((cpad-pressed? 1 circle) - (+! (-> *cheat-temp* 5) 1) - ) - (else - (set! (-> *cheat-temp* 5) 0) - 0 - ) - ) - ) - ((= v1-181 7) - (cond - ((cpad-pressed? 1 square) - (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons r1)) - (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons r1)) - (set! *cheat-mode* (if (= *cheat-mode* 'camera) - #f - 'camera - ) - ) - (cond - (*cheat-mode* - (if (not *external-cam-mode*) - (external-cam-reset!) - ) - (set! *external-cam-mode* 'pad-1) - (sound-play-by-spec (static-sound-spec "menu-pick" :fo-curve 1) (new-sound-id) (the-as vector #t)) - ) - (else - (set! *external-cam-mode* #f) - (sound-play-by-spec (static-sound-spec "menu-back" :fo-curve 1) (new-sound-id) (the-as vector #t)) - ) - ) - (set! (-> *cheat-temp* 5) 0) - 0 - ) - (else - (set! (-> *cheat-temp* 5) 0) - 0 - ) - ) - ) - ) - ) - ) + ) ) (none) ) diff --git a/goal_src/jak2/engine/game/settings.gc b/goal_src/jak2/engine/game/settings.gc index d85a8a87dc..eb56aa846b 100644 --- a/goal_src/jak2/engine/game/settings.gc +++ b/goal_src/jak2/engine/game/settings.gc @@ -1414,7 +1414,7 @@ (set! (-> gp-0 display-dx) 0) (set! (-> gp-0 display-dy) 0) (set! (-> gp-0 vibration) - (if (or (= *kernel-boot-message* 'demo) (= *kernel-boot-message* 'demo-shared) (nonzero? (scf-get-territory))) + (if (or (= *kernel-boot-message* 'demo) (= *kernel-boot-message* 'demo-shared) (!= (scf-get-territory) GAME_TERRITORY_SCEA)) #f #t ) @@ -1424,13 +1424,13 @@ (set! (-> gp-0 play-hints) #t) (set! (-> gp-0 sound-bank-load) #t) (set! (-> gp-0 subtitle) - (if (or (= *kernel-boot-message* 'demo) (or (= *kernel-boot-message* 'demo-shared) (!= (scf-get-territory) 1))) + (if (or (= *kernel-boot-message* 'demo) (or (= *kernel-boot-message* 'demo-shared) (!= (scf-get-territory) GAME_TERRITORY_SCEE))) #f #t ) ) (let ((v1-31 (scf-get-territory))) - (set! (-> gp-0 beard) (if (or (= v1-31 2) (= v1-31 3)) + (set! (-> gp-0 beard) (if (or (= v1-31 GAME_TERRITORY_SCEI) (= v1-31 GAME_TERRITORY_SCEK)) #f #t ) diff --git a/goal_src/jak2/engine/ps2/pad.gc b/goal_src/jak2/engine/ps2/pad.gc index f640af84b7..92d6ec9a0a 100644 --- a/goal_src/jak2/engine/ps2/pad.gc +++ b/goal_src/jak2/engine/ps2/pad.gc @@ -435,7 +435,7 @@ The cpad-set-buzz! function can be used for vibration. (cond ((or (= v1-123 (language-enum japanese)) (= v1-123 (language-enum korean))) (case (scf-get-territory) - ((2 3) + ((GAME_TERRITORY_SCEI GAME_TERRITORY_SCEK) (if (logtest? buttons-pushed (pad-buttons circle)) (set! buttons-pushed (logior (pad-buttons confirm) buttons-pushed)) ) @@ -448,7 +448,7 @@ The cpad-set-buzz! function can be used for vibration. ) ) ((let ((v1-135 (scf-get-territory))) - (or (= v1-135 2) (= v1-135 3)) + (or (= v1-135 GAME_TERRITORY_SCEI) (= v1-135 GAME_TERRITORY_SCEK)) ) (if (logtest? buttons-pushed (pad-buttons circle x)) (set! buttons-pushed (logior (pad-buttons confirm) buttons-pushed)) @@ -634,3 +634,38 @@ The cpad-set-buzz! function can be used for vibration. ) (none) ) + + +(defmacro check-cheat-code (cheat-var pad-idx buttons &rest body) + "execute body when a cheat code made up of sequential inputs has been inputted" + + `(when (nonzero? (cpad-pressed ,pad-idx)) ;; only check when some button has been pressed + (case ,cheat-var + ,@(apply-i + (lambda (x i) + `((,i) + (if (cpad-pressed? ,pad-idx ,x) + ,(if (< i (- (length buttons) 1)) + `(1+! ,cheat-var) + + `(begin ,@body (set! ,cheat-var 0)) + ) + + (set! ,cheat-var 0) + ) + ) + ) + buttons) + ) + ) + ) + +(defmacro cheats-sound-play (cheat?) + "play the appropriate sound for inputting a cheat code" + + `(if ,cheat? + (sound-play-by-spec (static-sound-spec "menu-pick" :fo-curve 1) (new-sound-id) (the-as vector #t)) + (sound-play-by-spec (static-sound-spec "menu-back" :fo-curve 1) (new-sound-id) (the-as vector #t)) + ) + ) + diff --git a/goal_src/jak2/engine/scene/scene.gc b/goal_src/jak2/engine/scene/scene.gc index a13412918f..ac0b3dc96c 100644 --- a/goal_src/jak2/engine/scene/scene.gc +++ b/goal_src/jak2/engine/scene/scene.gc @@ -682,7 +682,7 @@ (let ((f30-0 (ja-aframe-num 0)) (s5-0 (the-as int (-> *setting-control* user-current subtitle-language))) ) - (if (and (= (the-as language-enum s5-0) (language-enum english)) (= (scf-get-territory) 1)) + (if (and (= (the-as language-enum s5-0) (language-enum english)) (= (scf-get-territory) GAME_TERRITORY_SCEE)) (set! s5-0 7) ) (dotimes (s4-0 (-> gp-0 length)) diff --git a/goal_src/jak2/engine/sound/gsound.gc b/goal_src/jak2/engine/sound/gsound.gc index 5968476bdc..9d01ea1957 100644 --- a/goal_src/jak2/engine/sound/gsound.gc +++ b/goal_src/jak2/engine/sound/gsound.gc @@ -937,7 +937,7 @@ otherwise, an explicit [[vector]] can be provided" (check-irx-version) (case (scf-get-territory) - ((2) + ((GAME_TERRITORY_SCEI) (sound-bank-load (static-sound-name "commonj")) ) (else diff --git a/goal_src/jak2/engine/ui/progress/progress-draw.gc b/goal_src/jak2/engine/ui/progress/progress-draw.gc index 99157ab9d9..8f475b8be4 100644 --- a/goal_src/jak2/engine/ui/progress/progress-draw.gc +++ b/goal_src/jak2/engine/ui/progress/progress-draw.gc @@ -5700,7 +5700,7 @@ (let ((s5-3 arg1)) (set! (-> s5-3 color) (progress-selected 0)) ) - (let ((v1-43 (if (and (= (scf-get-territory) 1) (zero? (-> *progress-state* game-options-subtitle-language-index))) + (let ((v1-43 (if (and (= (scf-get-territory) GAME_TERRITORY_SCEE) (zero? (-> *progress-state* game-options-subtitle-language-index))) 7 (-> *progress-state* game-options-subtitle-language-index) ) @@ -5743,7 +5743,7 @@ (let ((a0-37 arg1)) (set! (-> a0-37 flags) (font-flags kerning middle large)) ) - (let ((v1-61 (if (and (= (scf-get-territory) 1) (zero? (-> *progress-state* game-options-subtitle-language-index))) + (let ((v1-61 (if (and (= (scf-get-territory) GAME_TERRITORY_SCEE) (zero? (-> *progress-state* game-options-subtitle-language-index))) 7 (-> *progress-state* game-options-subtitle-language-index) ) @@ -5836,7 +5836,7 @@ (let ((s5-3 arg1)) (set! (-> s5-3 color) (progress-selected 0)) ) - (let ((v1-43 (if (and (= (scf-get-territory) 1) (zero? (-> *progress-state* game-options-language-index))) + (let ((v1-43 (if (and (= (scf-get-territory) GAME_TERRITORY_SCEE) (zero? (-> *progress-state* game-options-language-index))) 7 (-> *progress-state* game-options-language-index) ) @@ -5884,7 +5884,7 @@ (let ((a0-44 arg1)) (set! (-> a0-44 flags) (font-flags kerning middle large)) ) - (let ((v1-66 (if (and (= (scf-get-territory) 1) (zero? (-> *progress-state* game-options-language-index))) + (let ((v1-66 (if (and (= (scf-get-territory) GAME_TERRITORY_SCEE) (zero? (-> *progress-state* game-options-language-index))) 7 (-> *progress-state* game-options-language-index) ) @@ -6196,7 +6196,7 @@ (s5-3 *temp-string* arg1 #f 44 (bucket-id progress)) ) (+! (-> arg1 origin y) - (the float (if (and (= (-> *progress-state* starting-state) 'title) (= (scf-get-territory) 1)) + (the float (if (and (= (-> *progress-state* starting-state) 'title) (= (scf-get-territory) GAME_TERRITORY_SCEE)) 100 80 ) diff --git a/goal_src/jak2/engine/ui/progress/progress.gc b/goal_src/jak2/engine/ui/progress/progress.gc index 6b2e722889..016cf6aa87 100644 --- a/goal_src/jak2/engine/ui/progress/progress.gc +++ b/goal_src/jak2/engine/ui/progress/progress.gc @@ -785,12 +785,12 @@ (set! (-> obj current-options) (cond ((demo?) - (if (= (scf-get-territory) 1) + (if (= (scf-get-territory) GAME_TERRITORY_SCEE) *game-options* *game-options-demo* ) ) - ((and (= (scf-get-territory) 2) (not (and (= *progress-cheat* 'language) (cpad-hold? 0 l2) (cpad-hold? 0 r2)))) + ((and (= (scf-get-territory) GAME_TERRITORY_SCEI) (not (and (= *progress-cheat* 'language) (cpad-hold? 0 l2) (cpad-hold? 0 r2)))) *game-options* ) (else @@ -801,7 +801,7 @@ ) (('graphic-options) (set! (-> obj current-options) - (if (or (= (scf-get-territory) 1) (and (= *progress-cheat* 'pal) (cpad-hold? 0 l2) (cpad-hold? 0 r2))) + (if (or (= (scf-get-territory) GAME_TERRITORY_SCEE) (and (= *progress-cheat* 'pal) (cpad-hold? 0 l2) (cpad-hold? 0 r2))) *graphic-title-options-pal* *graphic-options* ) @@ -3475,7 +3475,7 @@ (set! (-> *progress-state* graphic-options-last-move) (current-time)) (set! (-> arg0 selected-option) #f) (cond - ((< (-> *progress-state* graphic-options-item-selected) (if (= (scf-get-territory) 1) + ((< (-> *progress-state* graphic-options-item-selected) (if (= (scf-get-territory) GAME_TERRITORY_SCEE) 3 2 ) @@ -3502,7 +3502,7 @@ (set! (-> arg0 option-index) (-> *progress-state* graphic-options-item-selected)) ) (else - (set! (-> *progress-state* graphic-options-item-selected) (if (= (scf-get-territory) 1) + (set! (-> *progress-state* graphic-options-item-selected) (if (= (scf-get-territory) GAME_TERRITORY_SCEE) 3 2 ) diff --git a/goal_src/jak2/engine/ui/text-id-h.gc b/goal_src/jak2/engine/ui/text-id-h.gc index 74cd1fbcff..e0043e8d4d 100644 --- a/goal_src/jak2/engine/ui/text-id-h.gc +++ b/goal_src/jak2/engine/ui/text-id-h.gc @@ -590,7 +590,7 @@ (progress-aspect-ratio-custom-pad-x #x1209) (progress-aspect-ratio-custom-pad-circle #x120a) (progress-aspect-ratio-custom-warn #x120b) - (progress-aspect-ratio-custom-ratio #x120c) + (progress-music-player #x120c) (progress-vsync #x120d) (progress-text-language #x120e) (progress-cheats #x120f) diff --git a/goal_src/jak2/engine/ui/text.gc b/goal_src/jak2/engine/ui/text.gc index eebe033f5a..4bd7cabc0d 100644 --- a/goal_src/jak2/engine/ui/text.gc +++ b/goal_src/jak2/engine/ui/text.gc @@ -234,7 +234,7 @@ the game-text-info, and heap is the heap to load to. The heap will be cleared." (set! sv-24 (the-as int (-> *setting-control* user-current language))) (set! sv-32 0) (set! sv-40 (&- (-> arg2 top) (the-as uint (-> arg2 base)))) - (if (and (= (scf-get-territory) 1) (= sv-24 (language-enum english)) (not (demo?))) + (if (and (= (scf-get-territory) GAME_TERRITORY_SCEE) (= sv-24 (language-enum english)) (not (demo?))) (set! sv-24 7) ) (when (or (= sv-16 #f) (!= (-> sv-16 language-id) sv-24) (not (string= (-> sv-16 group-name) arg0))) diff --git a/goal_src/jak2/kernel-defs.gc b/goal_src/jak2/kernel-defs.gc index 9f45365bcf..77fde029a1 100644 --- a/goal_src/jak2/kernel-defs.gc +++ b/goal_src/jak2/kernel-defs.gc @@ -112,6 +112,10 @@ (declare-type mouse-info basic) (define-extern mouse-get-data (function mouse-info none)) +(defconstant GAME_TERRITORY_SCEA 0) +(defconstant GAME_TERRITORY_SCEE 1) +(defconstant GAME_TERRITORY_SCEI 2) +(defconstant GAME_TERRITORY_SCEK 3) (define-extern scf-get-territory (function int)) ;; not actually a scf function... diff --git a/goal_src/jak2/levels/city/traffic/citizen/civilian.gc b/goal_src/jak2/levels/city/traffic/citizen/civilian.gc index 055454f153..7a19d5e987 100644 --- a/goal_src/jak2/levels/city/traffic/citizen/civilian.gc +++ b/goal_src/jak2/levels/city/traffic/citizen/civilian.gc @@ -150,7 +150,7 @@ (defmethod damage-amount-from-attack civilian ((obj civilian) (arg0 process) (arg1 event-message-block)) "@returns the amount of damage taken from an attack. This can come straight off the [[attack-info]] or via [[penetrate-using->damage]]" (cond - ((= (scf-get-territory) 2) + ((= (scf-get-territory) GAME_TERRITORY_SCEI) (let ((a1-1 (-> arg1 param 1)) (a0-1 arg0) ) diff --git a/goal_src/jak2/levels/demo/demo-obs.gc b/goal_src/jak2/levels/demo/demo-obs.gc index f1284bce26..3ecefc254a 100644 --- a/goal_src/jak2/levels/demo/demo-obs.gc +++ b/goal_src/jak2/levels/demo/demo-obs.gc @@ -146,7 +146,7 @@ ,(lambda ((arg0 process-drawable)) (logior! (-> arg0 draw global-effect) (draw-control-global-effect title-light)) (case (scf-get-territory) - ((1) + ((GAME_TERRITORY_SCEE) (case (-> *setting-control* user-current language) (((language-enum spanish)) (send-event arg0 'segment 32 0) @@ -429,21 +429,21 @@ ) ) -(defbehavior demo-screen-change demo-control ((arg0 symbol) (arg1 int) (arg2 symbol) (arg3 int)) +(defbehavior demo-screen-change demo-control ((arg0 int) (arg1 int) (arg2 symbol) (arg3 symbol)) (when arg3 (let ((s3-0 (the-as int (-> *setting-control* user-current language)))) - (if (and (= (the-as language-enum s3-0) (language-enum english)) (= (scf-get-territory) 1)) + (if (and (= (the-as language-enum s3-0) (language-enum english)) (= (scf-get-territory) GAME_TERRITORY_SCEE)) (set! s3-0 7) ) - (if (>= (the-as int arg0) 0) - (set! arg0 (the-as symbol (+ (the-as uint arg0) (* 3 s3-0)))) + (if (>= arg0 0) + (+! arg0 (* 3 s3-0)) ) (if (>= arg1 0) (+! arg1 (* 3 s3-0)) ) ) ) - (set! (-> self want 0) (the-as int arg0)) + (set! (-> self want 0) arg0) (set! (-> self want 1) (-> self draw)) (when arg2 (set-setting! 'bg-a 'abs 1.0 0) @@ -457,7 +457,7 @@ (suspend) ) ) - (set! (-> self draw) (the-as int arg0)) + (set! (-> self draw) arg0) (set! (-> self active) #f) (while (and (>= (-> self draw) 0) (not (-> self active))) (suspend) @@ -465,10 +465,9 @@ (remove-setting! 'bg-a) (set! (-> self want 1) arg1) 0 - (none) ) -(defun demo-wait-for-press ((arg0 time-frame) (arg1 time-frame) (arg2 symbol)) +(defun demo-wait-for-press ((arg0 time-frame) (arg1 time-frame)) (let ((s4-0 (current-time)) (s3-0 #f) ) @@ -495,7 +494,7 @@ (text-id progress-demo-exit) ) ) - ((= (scf-get-territory) 1) + ((= (scf-get-territory) GAME_TERRITORY_SCEE) (new 'static 'boxed-array :type text-id (text-id atoll-unknown) (text-id strip-unknown)) ) (else @@ -570,33 +569,21 @@ ((or (zero? v1-1) (= v1-1 1)) (when (zero? (-> *game-info* demo-state)) (case (scf-get-territory) - ((2) - (let ((t9-1 demo-screen-change) - (a0-3 25) - (a1-1 26) - (a2-0 #t) - ) - (t9-1 (the-as symbol a0-3) a1-1 a2-0 (the-as int #f)) - (let ((a1-2 (new 'stack-no-clear 'array 'symbol 6))) - (set! (-> a1-2 5) #f) - (set! (-> a1-2 4) #f) - (set! (-> a1-2 3) #f) - (set! (-> a1-2 2) 'ctywide) - (set! (-> a1-2 1) 'ctysluma) - (set! (-> a1-2 0) 'demo) - (want-levels *load-state* a1-2) - ) - (demo-wait-for-press (seconds 1) (seconds 5) a2-0) + ((GAME_TERRITORY_SCEI) + (demo-screen-change 25 26 #t #f) + (let ((a1-2 (new 'stack-no-clear 'array 'symbol 6))) + (set! (-> a1-2 5) #f) + (set! (-> a1-2 4) #f) + (set! (-> a1-2 3) #f) + (set! (-> a1-2 2) 'ctywide) + (set! (-> a1-2 1) 'ctysluma) + (set! (-> a1-2 0) 'demo) + (want-levels *load-state* a1-2) ) - (let ((t9-4 demo-screen-change) - (a0-6 26) - (a1-4 -1) - (a2-1 #f) - ) - (t9-4 (the-as symbol a0-6) a1-4 a2-1 (the-as int #f)) - (demo-wait-for-press (seconds 1) (seconds 5) a2-1) - ) - (demo-screen-change (the-as symbol -1) -1 #f (the-as int #t)) + (demo-wait-for-press (seconds 1) (seconds 5)) + (demo-screen-change 26 -1 #f #f) + (demo-wait-for-press (seconds 1) (seconds 5)) + (demo-screen-change -1 -1 #f #t) ) ) ) @@ -620,9 +607,9 @@ (set! (-> self gui-id) (add-process *gui-control* self (gui-channel jak) (gui-action queue) "demoend" -99.0 0) ) - (if (and (!= (scf-get-territory) 2) (= (-> *setting-control* user-current language) (language-enum japanese))) - (demo-screen-change (the-as symbol 2) -1 #t (the-as int #f)) - (demo-screen-change (the-as symbol 2) -1 #t (the-as int #t)) + (if (and (!= (scf-get-territory) GAME_TERRITORY_SCEI) (= (-> *setting-control* user-current language) (language-enum japanese))) + (demo-screen-change 2 -1 #t #f) + (demo-screen-change 2 -1 #t #t) ) (while (!= (get-status *gui-control* (-> self gui-id)) (gui-status ready)) (suspend) @@ -638,7 +625,7 @@ (the-as process #f) ) (cond - ((zero? (scf-get-territory)) + ((= (scf-get-territory) GAME_TERRITORY_SCEA) (let ((gp-3 (current-time))) (until (>= (- (current-time) gp-3) (seconds 0.38)) (suspend) @@ -776,7 +763,7 @@ (suspend) ) ) - (demo-screen-change (the-as symbol -1) -1 #f (the-as int #t)) + (demo-screen-change -1 -1 #f #t) (set! (-> *game-info* demo-state) (the-as uint 1)) (start 'play (get-continue-by-name *game-info* "demo-start")) (sleep-code) @@ -820,15 +807,9 @@ ) (set-setting! 'allow-timeout #f 0.0 0) (set-setting! 'allow-pause #f 0.0 0) - (let ((t9-49 demo-screen-change) - (a0-81 0) - (a1-39 -1) - (a2-30 #t) - ) - (t9-49 (the-as symbol a0-81) a1-39 a2-30 (the-as int #t)) - (demo-wait-for-press (seconds 1) (seconds 15) a2-30) - ) - (demo-screen-change (the-as symbol -1) -1 #f (the-as int #t)) + (demo-screen-change 0 -1 #t #t) + (demo-wait-for-press (seconds 1) (seconds 15)) + (demo-screen-change -1 -1 #f #t) (start 'play (get-continue-by-name *game-info* "atoll-start")) ) ((= gp-24 1) @@ -857,21 +838,15 @@ ) (set-setting! 'allow-timeout #f 0.0 0) (set-setting! 'allow-pause #f 0.0 0) - (let ((t9-63 demo-screen-change) - (a0-105 1) - (a1-54 -1) - (a2-42 #t) - ) - (t9-63 (the-as symbol a0-105) a1-54 a2-42 (the-as int #t)) - (demo-wait-for-press (seconds 1) (seconds 15) a2-42) - ) - (demo-screen-change (the-as symbol -1) -1 #f (the-as int #t)) + (demo-screen-change 1 -1 #t #t) + (demo-wait-for-press (seconds 1) (seconds 15)) + (demo-screen-change -1 -1 #f #t) (start 'play (get-continue-by-name *game-info* "strip-warp")) ) ((= gp-24 2) (set-setting! 'allow-timeout #f 0.0 0) (set-setting! 'allow-pause #f 0.0 0) - (demo-screen-change (the-as symbol -1) -1 #f (the-as int #t)) + (demo-screen-change -1 -1 #f #t) (set! (-> *setting-control* user-default music-volume) 0.0) (case *kernel-boot-message* (('demo-shared) @@ -1408,7 +1383,7 @@ ) ) -(when (= (scf-get-territory) 1) +(when (= (scf-get-territory) GAME_TERRITORY_SCEE) (let ((v1-40 (get-field-spec-by-id (-> *part-id-table* 5483) (sp-field-id spt-userdata)))) (if v1-40 (set! (-> v1-40 initial-valuef) @@ -1431,7 +1406,7 @@ ) ) -(when (= (scf-get-territory) 2) +(when (= (scf-get-territory) GAME_TERRITORY_SCEI) (let ((v1-47 (get-field-spec-by-id (-> *part-id-table* 5483) (sp-field-id spt-userdata)))) (if v1-47 (set! (-> v1-47 initial-valuef) @@ -1454,7 +1429,7 @@ ) ) -(when (= (scf-get-territory) 3) +(when (= (scf-get-territory) GAME_TERRITORY_SCEK) (let ((v1-54 (get-field-spec-by-id (-> *part-id-table* 5483) (sp-field-id spt-userdata)))) (if v1-54 (set! (-> v1-54 initial-valuef) diff --git a/goal_src/jak2/levels/intro/intro-scenes.gc b/goal_src/jak2/levels/intro/intro-scenes.gc index 53666951cb..45a801e823 100644 --- a/goal_src/jak2/levels/intro/intro-scenes.gc +++ b/goal_src/jak2/levels/intro/intro-scenes.gc @@ -2214,13 +2214,13 @@ (0 (apply ,(lambda () (case (scf-get-territory) - ((1) + ((GAME_TERRITORY_SCEE) (talker-spawn-func (-> *talker-speech* 119) *entity-pool* (target-pos 0) (the-as region #f)) ) - ((2) + ((GAME_TERRITORY_SCEI) (talker-spawn-func (-> *talker-speech* 120) *entity-pool* (target-pos 0) (the-as region #f)) ) - ((3) + ((GAME_TERRITORY_SCEK) (talker-spawn-func (-> *talker-speech* 121) *entity-pool* (target-pos 0) (the-as region #f)) ) (else @@ -2340,7 +2340,7 @@ (set! (-> v1-8 3) 128) ) (case (scf-get-territory) - ((1) + ((GAME_TERRITORY_SCEE) (set-vector! (-> gp-0 pos) 256 170 #xffffff 0) (set! (-> gp-0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #xa :page #xdbc))) (set! (-> s5-0 flags) (the-as uint 8)) @@ -2367,7 +2367,7 @@ ) ) ) - ((2) + ((GAME_TERRITORY_SCEI) (set-vector! (-> gp-0 pos) 256 188 #xffffff 0) (set! (-> gp-0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x7 :page #xdbc))) (set! (-> s5-0 tex) #f) diff --git a/goal_src/jak2/levels/title/title-obs.gc b/goal_src/jak2/levels/title/title-obs.gc index 7dd95e6598..0aee72a06e 100644 --- a/goal_src/jak2/levels/title/title-obs.gc +++ b/goal_src/jak2/levels/title/title-obs.gc @@ -17,10 +17,10 @@ (sprite-draw uint32 :offset-assert 288) (buffer external-art-buffer 2 :offset-assert 292) (want int32 2 :offset-assert 300) - (want-name basic 2 :offset-assert 308) + (want-name string 2 :offset-assert 308) (have int32 2 :offset-assert 316) (draw int32 :offset-assert 324) - (draw-name basic :offset-assert 328) + (draw-name string :offset-assert 328) (active symbol :offset-assert 332) (spark-time time-frame :offset-assert 336) (gui-id sound-id :offset-assert 344) @@ -153,7 +153,7 @@ ,(lambda ((arg0 process-drawable) (arg1 vector) (arg2 cspace)) (logior! (-> arg0 draw global-effect) (draw-control-global-effect title-light)) (case (scf-get-territory) - ((1) + ((GAME_TERRITORY_SCEE) (case (-> *setting-control* user-current language) (((language-enum spanish)) (send-event arg0 'segment 32 0) @@ -432,7 +432,7 @@ ) ) -(defbehavior title-screen-change title-control ((arg0 symbol) (arg1 int) (arg2 symbol) (arg3 int) (arg4 symbol) (arg5 symbol)) +(defbehavior title-screen-change title-control ((arg0 string) (arg1 int) (arg2 string) (arg3 int) (arg4 symbol) (arg5 symbol)) (when arg5 (let ((s1-0 (the-as int (-> *setting-control* user-current language)))) (if (and (= (the-as language-enum s1-0) (language-enum english)) (= (scf-get-territory) 1)) @@ -446,7 +446,7 @@ ) ) ) - (set! (-> self want-name 0) (the-as basic arg0)) + (set! (-> self want-name 0) arg0) (set! (-> self want 0) arg1) (set! (-> self want-name 1) (-> self draw-name)) (set! (-> self want 1) (-> self draw)) @@ -464,13 +464,13 @@ ) ) (set! (-> self draw) arg1) - (set! (-> self draw-name) (the-as basic arg0)) + (set! (-> self draw-name) arg0) (set! (-> self active) #f) (while (and (>= (-> self draw) 0) (not (-> self active))) (suspend) ) (remove-setting! 'bg-a) - (set! (-> self want-name 1) (the-as basic arg2)) + (set! (-> self want-name 1) arg2) (set! (-> self want 1) arg3) 0 (none) @@ -648,12 +648,12 @@ (want-display-level *load-state* 'ctysluma 'display) (want-display-level *load-state* 'ctywide 'display) (when (zero? (-> *game-info* demo-state)) - (title-screen-change (the-as symbol "demo-screens") 27 #f -1 #t #f) + (title-screen-change "demo-screens" 27 (the-as string #f) -1 #t #f) (wait-for-press (seconds 1) (seconds 5) #f) (while (not (and (= (level-status *level* 'ctysluma) 'active) (= (level-status *level* 'ctywide) 'active))) (suspend) ) - (title-screen-change #f -1 #f -1 #f #f) + (title-screen-change (the-as string #f) -1 (the-as string #f) -1 #f #f) (set-blackout-frames (seconds 0.2)) ) (label cfg-12) @@ -747,7 +747,7 @@ ) (when (>= s5-1 0) (dotimes (s3-0 2) - (case (file-status (-> self buffer s3-0) (the-as string s4-0) s5-1) + (case (file-status (-> self buffer s3-0) s4-0 s5-1) (('locked 'active) (set! (-> self buffer s3-0 frame-lock) #t) (set! (-> self have gp-2) s3-0) @@ -764,7 +764,7 @@ (when (and (>= a2-1 0) (< (-> self have gp-3) 0)) (dotimes (v1-46 2) (when (not (-> self buffer v1-46 frame-lock)) - (set-pending-file (-> self buffer v1-46) (the-as string a1-9) a2-1 (process->handle self) -1.0) + (set-pending-file (-> self buffer v1-46) a1-9 a2-1 (process->handle self) -1.0) (goto cfg-45) ) ) @@ -778,7 +778,7 @@ (set! (-> self active) #f) (when (>= (-> self draw) 0) (dotimes (gp-5 2) - (when (file-status (-> self buffer gp-5) (the-as string (-> self draw-name)) (-> self draw)) + (when (file-status (-> self buffer gp-5) (-> self draw-name) (-> self draw)) (set! v1-73 (-> self buffer gp-5)) (goto cfg-58) ) @@ -880,14 +880,14 @@ ) ) ) - (t9-1 (the-as symbol a0-4) a1-0 (the-as symbol a2-0) a3-0 (= s4-0 gp-0) #f) + (t9-1 a0-4 a1-0 a2-0 a3-0 (= s4-0 gp-0) #f) ) (set! v1-6 (wait-for-press (seconds 1) (seconds 5) #t)) (+! s4-0 1) (set! a3-0 (+ s4-0 1)) ) ) - (title-screen-change #f -1 #f -1 #f #f) + (title-screen-change (the-as string #f) -1 (the-as string #f) -1 #f #f) (set-blackout-frames (seconds 0.2)) (set! (-> *game-info* demo-state) (the-as uint 1)) (go-virtual idle) @@ -1319,7 +1319,7 @@ ) ) -(when (= (scf-get-territory) 1) +(when (= (scf-get-territory) GAME_TERRITORY_SCEE) (let ((v1-82 (get-field-spec-by-id (-> *part-id-table* 5469) (sp-field-id spt-userdata)))) (if v1-82 (set! (-> v1-82 initial-valuef) @@ -1342,7 +1342,7 @@ ) ) -(when (= (scf-get-territory) 2) +(when (= (scf-get-territory) GAME_TERRITORY_SCEI) (let ((v1-89 (get-field-spec-by-id (-> *part-id-table* 5469) (sp-field-id spt-userdata)))) (if v1-89 (set! (-> v1-89 initial-valuef) @@ -1365,7 +1365,7 @@ ) ) -(when (= (scf-get-territory) 3) +(when (= (scf-get-territory) GAME_TERRITORY_SCEK) (let ((v1-96 (get-field-spec-by-id (-> *part-id-table* 5469) (sp-field-id spt-userdata)))) (if v1-96 (set! (-> v1-96 initial-valuef) diff --git a/goal_src/jak2/pc/debug/default-menu-pc.gc b/goal_src/jak2/pc/debug/default-menu-pc.gc index 203bb3cd44..7f305a576e 100644 --- a/goal_src/jak2/pc/debug/default-menu-pc.gc +++ b/goal_src/jak2/pc/debug/default-menu-pc.gc @@ -762,6 +762,12 @@ (set! (-> *pc-settings* gfx-msaa) msaa)) (= (-> *pc-settings* gfx-msaa) msaa))) +(defun dm-territory-pick-func ((bterr int) (msg debug-menu-msg)) + (let ((terr (/ bterr 8))) + (when (= msg (debug-menu-msg press)) + (set! *scf-territory-debug* terr)) + (= *scf-territory-debug* terr))) + (when (-> *debug-menu-context* root-menu) ;; (debug-menu-append-item (-> *debug-menu-context* root-menu) (debug-menu-make-load-menu *debug-menu-context*)) (debug-menu-append-item (-> *debug-menu-context* root-menu) (debug-menu-make-part-menu *debug-menu-context*)) @@ -891,6 +897,12 @@ (flag "eco" #f ,(dm-lambda-boolean-flag (-> *pc-settings* controller-eco-led?))) (flag "heat" #f ,(dm-lambda-boolean-flag (-> *pc-settings* controller-heat-led?))) ) + (menu "Territory" + (flag "GAME_TERRITORY_SCEA" (the binteger GAME_TERRITORY_SCEA) dm-territory-pick-func) + (flag "GAME_TERRITORY_SCEE" (the binteger GAME_TERRITORY_SCEE) dm-territory-pick-func) + (flag "GAME_TERRITORY_SCEI" (the binteger GAME_TERRITORY_SCEI) dm-territory-pick-func) + (flag "GAME_TERRITORY_SCEK" (the binteger GAME_TERRITORY_SCEK) dm-territory-pick-func) + ) (flag "V-sync" #f ,(dm-lambda-boolean-flag (-> *pc-settings* vsync?))) (flag "PS2 actor vis" #f ,(dm-lambda-boolean-flag (-> *pc-settings* ps2-actor-vis?))) (flag "Display actor counts" *display-actor-counts* dm-boolean-toggle-pick-func) diff --git a/goal_src/jak2/pc/progress/progress-draw-pc.gc b/goal_src/jak2/pc/progress/progress-draw-pc.gc index 96a70a47b6..d0540ac7cc 100644 --- a/goal_src/jak2/pc/progress/progress-draw-pc.gc +++ b/goal_src/jak2/pc/progress/progress-draw-pc.gc @@ -1965,9 +1965,10 @@ (defmacro swap-confirm? () "is the confirm button swapped from X?" - `(case (scf-get-territory) - ((2 3) #t) - (else #f))) + `(and (language? japanese korean) + (case (scf-get-territory) + ((GAME_TERRITORY_SCEI GAME_TERRITORY_SCEK) #t) + (else #f)))) (defmethod draw-option menu-aspect-ratio-custom-option ((obj menu-aspect-ratio-custom-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) diff --git a/goal_src/jak2/pc/progress/progress-pc.gc b/goal_src/jak2/pc/progress/progress-pc.gc index c14c758c6b..b18f3da485 100644 --- a/goal_src/jak2/pc/progress/progress-pc.gc +++ b/goal_src/jak2/pc/progress/progress-pc.gc @@ -164,12 +164,12 @@ (set! (-> obj current-options) (cond ((demo?) - (if (= (scf-get-territory) 1) + (if (= (scf-get-territory) GAME_TERRITORY_SCEE) *game-options* *game-options-demo* ) ) - ((and (= (scf-get-territory) 2) (not (and (= *progress-cheat* 'language) (cpad-hold? 0 l2) (cpad-hold? 0 r2)))) + ((and (= (scf-get-territory) GAME_TERRITORY_SCEI) (not (and (= *progress-cheat* 'language) (cpad-hold? 0 l2) (cpad-hold? 0 r2)))) *game-options* ) (else diff --git a/test/decompiler/reference/jak2/levels/demo/demo-obs_REF.gc b/test/decompiler/reference/jak2/levels/demo/demo-obs_REF.gc index 9f586a8358..3c2b51dad1 100644 --- a/test/decompiler/reference/jak2/levels/demo/demo-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/demo/demo-obs_REF.gc @@ -455,22 +455,21 @@ ) ;; definition for function demo-screen-change -;; WARN: Return type mismatch int vs none. -(defbehavior demo-screen-change demo-control ((arg0 symbol) (arg1 int) (arg2 symbol) (arg3 int)) +(defbehavior demo-screen-change demo-control ((arg0 int) (arg1 int) (arg2 symbol) (arg3 symbol)) (when arg3 (let ((s3-0 (the-as int (-> *setting-control* user-current language)))) (if (and (= (the-as language-enum s3-0) (language-enum english)) (= (scf-get-territory) 1)) (set! s3-0 7) ) - (if (>= (the-as int arg0) 0) - (set! arg0 (the-as symbol (+ (the-as uint arg0) (* 3 s3-0)))) + (if (>= arg0 0) + (+! arg0 (* 3 s3-0)) ) (if (>= arg1 0) (+! arg1 (* 3 s3-0)) ) ) ) - (set! (-> self want 0) (the-as int arg0)) + (set! (-> self want 0) arg0) (set! (-> self want 1) (-> self draw)) (when arg2 (set-setting! 'bg-a 'abs 1.0 0) @@ -484,7 +483,7 @@ (suspend) ) ) - (set! (-> self draw) (the-as int arg0)) + (set! (-> self draw) arg0) (set! (-> self active) #f) (while (and (>= (-> self draw) 0) (not (-> self active))) (suspend) @@ -492,11 +491,10 @@ (remove-setting! 'bg-a) (set! (-> self want 1) arg1) 0 - (none) ) ;; definition for function demo-wait-for-press -(defun demo-wait-for-press ((arg0 time-frame) (arg1 time-frame) (arg2 symbol)) +(defun demo-wait-for-press ((arg0 time-frame) (arg1 time-frame)) (let ((s4-0 (current-time)) (s3-0 #f) ) @@ -601,32 +599,20 @@ (when (zero? (-> *game-info* demo-state)) (case (scf-get-territory) ((2) - (let ((t9-1 demo-screen-change) - (a0-3 25) - (a1-1 26) - (a2-0 #t) - ) - (t9-1 (the-as symbol a0-3) a1-1 a2-0 (the-as int #f)) - (let ((a1-2 (new 'stack-no-clear 'array 'symbol 6))) - (set! (-> a1-2 5) #f) - (set! (-> a1-2 4) #f) - (set! (-> a1-2 3) #f) - (set! (-> a1-2 2) 'ctywide) - (set! (-> a1-2 1) 'ctysluma) - (set! (-> a1-2 0) 'demo) - (want-levels *load-state* a1-2) - ) - (demo-wait-for-press (seconds 1) (seconds 5) a2-0) + (demo-screen-change 25 26 #t #f) + (let ((a1-2 (new 'stack-no-clear 'array 'symbol 6))) + (set! (-> a1-2 5) #f) + (set! (-> a1-2 4) #f) + (set! (-> a1-2 3) #f) + (set! (-> a1-2 2) 'ctywide) + (set! (-> a1-2 1) 'ctysluma) + (set! (-> a1-2 0) 'demo) + (want-levels *load-state* a1-2) ) - (let ((t9-4 demo-screen-change) - (a0-6 26) - (a1-4 -1) - (a2-1 #f) - ) - (t9-4 (the-as symbol a0-6) a1-4 a2-1 (the-as int #f)) - (demo-wait-for-press (seconds 1) (seconds 5) a2-1) - ) - (demo-screen-change (the-as symbol -1) -1 #f (the-as int #t)) + (demo-wait-for-press (seconds 1) (seconds 5)) + (demo-screen-change 26 -1 #f #f) + (demo-wait-for-press (seconds 1) (seconds 5)) + (demo-screen-change -1 -1 #f #t) ) ) ) @@ -651,8 +637,8 @@ (add-process *gui-control* self (gui-channel jak) (gui-action queue) "demoend" -99.0 0) ) (if (and (!= (scf-get-territory) 2) (= (-> *setting-control* user-current language) (language-enum japanese))) - (demo-screen-change (the-as symbol 2) -1 #t (the-as int #f)) - (demo-screen-change (the-as symbol 2) -1 #t (the-as int #t)) + (demo-screen-change 2 -1 #t #f) + (demo-screen-change 2 -1 #t #t) ) (while (!= (get-status *gui-control* (-> self gui-id)) (gui-status ready)) (suspend) @@ -806,7 +792,7 @@ (suspend) ) ) - (demo-screen-change (the-as symbol -1) -1 #f (the-as int #t)) + (demo-screen-change -1 -1 #f #t) (set! (-> *game-info* demo-state) (the-as uint 1)) (start 'play (get-continue-by-name *game-info* "demo-start")) (sleep-code) @@ -850,15 +836,9 @@ ) (set-setting! 'allow-timeout #f 0.0 0) (set-setting! 'allow-pause #f 0.0 0) - (let ((t9-49 demo-screen-change) - (a0-81 0) - (a1-39 -1) - (a2-30 #t) - ) - (t9-49 (the-as symbol a0-81) a1-39 a2-30 (the-as int #t)) - (demo-wait-for-press (seconds 1) (seconds 15) a2-30) - ) - (demo-screen-change (the-as symbol -1) -1 #f (the-as int #t)) + (demo-screen-change 0 -1 #t #t) + (demo-wait-for-press (seconds 1) (seconds 15)) + (demo-screen-change -1 -1 #f #t) (start 'play (get-continue-by-name *game-info* "atoll-start")) ) ((= gp-24 1) @@ -887,21 +867,15 @@ ) (set-setting! 'allow-timeout #f 0.0 0) (set-setting! 'allow-pause #f 0.0 0) - (let ((t9-63 demo-screen-change) - (a0-105 1) - (a1-54 -1) - (a2-42 #t) - ) - (t9-63 (the-as symbol a0-105) a1-54 a2-42 (the-as int #t)) - (demo-wait-for-press (seconds 1) (seconds 15) a2-42) - ) - (demo-screen-change (the-as symbol -1) -1 #f (the-as int #t)) + (demo-screen-change 1 -1 #t #t) + (demo-wait-for-press (seconds 1) (seconds 15)) + (demo-screen-change -1 -1 #f #t) (start 'play (get-continue-by-name *game-info* "strip-warp")) ) ((= gp-24 2) (set-setting! 'allow-timeout #f 0.0 0) (set-setting! 'allow-pause #f 0.0 0) - (demo-screen-change (the-as symbol -1) -1 #f (the-as int #t)) + (demo-screen-change -1 -1 #f #t) (set! (-> *setting-control* user-default music-volume) 0.0) (case *kernel-boot-message* (('demo-shared) diff --git a/test/decompiler/reference/jak2/levels/title/title-obs_REF.gc b/test/decompiler/reference/jak2/levels/title/title-obs_REF.gc index e47c2db027..6928bc20c0 100644 --- a/test/decompiler/reference/jak2/levels/title/title-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/title/title-obs_REF.gc @@ -9,10 +9,10 @@ (sprite-draw uint32 :offset-assert 288) (buffer external-art-buffer 2 :offset-assert 292) (want int32 2 :offset-assert 300) - (want-name basic 2 :offset-assert 308) + (want-name string 2 :offset-assert 308) (have int32 2 :offset-assert 316) (draw int32 :offset-assert 324) - (draw-name basic :offset-assert 328) + (draw-name string :offset-assert 328) (active symbol :offset-assert 332) (spark-time time-frame :offset-assert 336) (gui-id sound-id :offset-assert 344) @@ -461,7 +461,7 @@ ;; definition for function title-screen-change ;; WARN: Return type mismatch int vs none. -(defbehavior title-screen-change title-control ((arg0 symbol) (arg1 int) (arg2 symbol) (arg3 int) (arg4 symbol) (arg5 symbol)) +(defbehavior title-screen-change title-control ((arg0 string) (arg1 int) (arg2 string) (arg3 int) (arg4 symbol) (arg5 symbol)) (when arg5 (let ((s1-0 (the-as int (-> *setting-control* user-current language)))) (if (and (= (the-as language-enum s1-0) (language-enum english)) (= (scf-get-territory) 1)) @@ -475,7 +475,7 @@ ) ) ) - (set! (-> self want-name 0) (the-as basic arg0)) + (set! (-> self want-name 0) arg0) (set! (-> self want 0) arg1) (set! (-> self want-name 1) (-> self draw-name)) (set! (-> self want 1) (-> self draw)) @@ -493,13 +493,13 @@ ) ) (set! (-> self draw) arg1) - (set! (-> self draw-name) (the-as basic arg0)) + (set! (-> self draw-name) arg0) (set! (-> self active) #f) (while (and (>= (-> self draw) 0) (not (-> self active))) (suspend) ) (remove-setting! 'bg-a) - (set! (-> self want-name 1) (the-as basic arg2)) + (set! (-> self want-name 1) arg2) (set! (-> self want 1) arg3) 0 (none) @@ -684,12 +684,12 @@ (want-display-level *load-state* 'ctysluma 'display) (want-display-level *load-state* 'ctywide 'display) (when (zero? (-> *game-info* demo-state)) - (title-screen-change (the-as symbol "demo-screens") 27 #f -1 #t #f) + (title-screen-change "demo-screens" 27 (the-as string #f) -1 #t #f) (wait-for-press (seconds 1) (seconds 5) #f) (while (not (and (= (level-status *level* 'ctysluma) 'active) (= (level-status *level* 'ctywide) 'active))) (suspend) ) - (title-screen-change #f -1 #f -1 #f #f) + (title-screen-change (the-as string #f) -1 (the-as string #f) -1 #f #f) (set-blackout-frames (seconds 0.2)) ) (label cfg-12) @@ -783,7 +783,7 @@ ) (when (>= s5-1 0) (dotimes (s3-0 2) - (case (file-status (-> self buffer s3-0) (the-as string s4-0) s5-1) + (case (file-status (-> self buffer s3-0) s4-0 s5-1) (('locked 'active) (set! (-> self buffer s3-0 frame-lock) #t) (set! (-> self have gp-2) s3-0) @@ -800,7 +800,7 @@ (when (and (>= a2-1 0) (< (-> self have gp-3) 0)) (dotimes (v1-46 2) (when (not (-> self buffer v1-46 frame-lock)) - (set-pending-file (-> self buffer v1-46) (the-as string a1-9) a2-1 (process->handle self) -1.0) + (set-pending-file (-> self buffer v1-46) a1-9 a2-1 (process->handle self) -1.0) (goto cfg-45) ) ) @@ -814,7 +814,7 @@ (set! (-> self active) #f) (when (>= (-> self draw) 0) (dotimes (gp-5 2) - (when (file-status (-> self buffer gp-5) (the-as string (-> self draw-name)) (-> self draw)) + (when (file-status (-> self buffer gp-5) (-> self draw-name) (-> self draw)) (set! v1-73 (-> self buffer gp-5)) (goto cfg-58) ) @@ -919,14 +919,14 @@ ) ) ) - (t9-1 (the-as symbol a0-4) a1-0 (the-as symbol a2-0) a3-0 (= s4-0 gp-0) #f) + (t9-1 a0-4 a1-0 a2-0 a3-0 (= s4-0 gp-0) #f) ) (set! v1-6 (wait-for-press (seconds 1) (seconds 5) #t)) (+! s4-0 1) (set! a3-0 (+ s4-0 1)) ) ) - (title-screen-change #f -1 #f -1 #f #f) + (title-screen-change (the-as string #f) -1 (the-as string #f) -1 #f #f) (set-blackout-frames (seconds 0.2)) (set! (-> *game-info* demo-state) (the-as uint 1)) (go-virtual idle)