From b2453fe23b620d4edca1f83bf4e95c369e0effa1 Mon Sep 17 00:00:00 2001 From: Hat Kid <6624576+Hat-Kid@users.noreply.github.com> Date: Thu, 9 Nov 2023 17:24:50 +0100 Subject: [PATCH] jak2: add missing pc options to progress menu (#3167) --- decompiler/config/jak2/all-types.gc | 17 +- .../jak2/text/game_custom_text_en-US.json | 11 +- goal_src/jak2/engine/camera/cam-states-dbg.gc | 5 +- goal_src/jak2/engine/camera/cam-states.gc | 51 +- .../jak2/engine/common_objs/generic-obs.gc | 6 +- goal_src/jak2/engine/game/main.gc | 3 +- goal_src/jak2/engine/ps2/pad.gc | 37 ++ goal_src/jak2/engine/ui/progress/progress.gc | 7 +- goal_src/jak2/engine/ui/text-id-h.gc | 7 + goal_src/jak2/kernel-defs.gc | 14 +- goal_src/jak2/kernel/gstring.gc | 8 + goal_src/jak2/pc/debug/default-menu-pc.gc | 2 +- goal_src/jak2/pc/pckernel-impl.gc | 2 +- goal_src/jak2/pc/progress/progress-draw-pc.gc | 437 ++++-------- .../pc/progress/progress-generic-draw-pc.gc | 48 +- .../jak2/pc/progress/progress-generic-h-pc.gc | 2 + .../jak2/pc/progress/progress-generic-pc.gc | 218 +++--- goal_src/jak2/pc/progress/progress-h-pc.gc | 21 +- goal_src/jak2/pc/progress/progress-pc.gc | 273 +++----- .../jak2/pc/progress/progress-static-pc.gc | 621 +++++++++++++++++- .../reference/jak2/engine/game/main_REF.gc | 2 +- 21 files changed, 1122 insertions(+), 670 deletions(-) diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index dc9fa715f5..7f8848476e 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -62,6 +62,14 @@ (uk-english) ) +(defenum runtime-exit-status + :type uint32 + (running) + (restart-runtime) + (exit) + (restart-in-debug) + ) + (define-extern *debug-segment* symbol) (define-extern nothing (function none)) (define-extern _format (function _varargs_ object)) @@ -92,7 +100,7 @@ (define-extern file-stream-write (function file-stream pointer uint uint)) (define-extern file-stream-close (function file-stream file-stream)) (define-extern new-dynamic-structure (function symbol type int structure)) -(define-extern kernel-shutdown (function none)) +(define-extern kernel-shutdown (function runtime-exit-status none)) (define-extern scf-get-timeout (function int)) (define-extern scf-get-inactive-timeout (function int)) (define-extern syncv (function int int)) @@ -7445,6 +7453,13 @@ (trick-darkjak-bomb0 #x1330) (trick-darkjak-bomb1 #x1331) (trick-darkjak-giant #x1332) + (progress-graphics-ps2 #x1333) + (progress-graphics-actor-culling #x1334) + (progress-graphics-force-envmap #x1335) + (progress-fast-progress #x1336) + (progress-graphics-ps2-lod-dist #x1337) + (progress-graphics-msaa-off #x1338) + (progress-graphics-display #x1339) ) ;; ---text-id-h:text-id 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 244b5cfeab..67c4e9ac8b 100644 --- a/game/assets/jak2/text/game_custom_text_en-US.json +++ b/game/assets/jak2/text/game_custom_text_en-US.json @@ -81,7 +81,7 @@ "1246": "Japan (SCEI)", "1247": "Korea (SCEK)", "1248": "MSAA", - "1249": "~DX", + "1249": "~Dx", "124a": "Controller LED Options", "124b": "Show Player State", "124c": "Show Amount of Health", @@ -179,5 +179,12 @@ "132f": "Dark Jak", "1330": "Dark Bomb", "1331": "Dark Blast", - "1332": "Dark Giant" + "1332": "Dark Giant", + "1333": "PS2 Options", + "1334": "Actor Culling", + "1335": "Force Environment Mapping", + "1336": "Fast Progress Menu", + "1337": "PS2 LOD Distance", + "1338": "Off", + "1339": "Display" } diff --git a/goal_src/jak2/engine/camera/cam-states-dbg.gc b/goal_src/jak2/engine/camera/cam-states-dbg.gc index b7d1b03ea6..a2735e1254 100644 --- a/goal_src/jak2/engine/camera/cam-states-dbg.gc +++ b/goal_src/jak2/engine/camera/cam-states-dbg.gc @@ -340,8 +340,9 @@ (when (not (logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))) (let ((f28-14 (analog-input (the-as int (-> *cpad-list* cpads arg3 leftx)) 128.0 48.0 110.0 -1.0)) (f30-14 (analog-input (the-as int (-> *cpad-list* cpads arg3 lefty)) 128.0 48.0 110.0 -1.0)) - (f26-0 (analog-input (the-as int (-> *cpad-list* cpads arg3 rightx)) 128.0 48.0 110.0 -1.0)) - (f0-60 (analog-input (the-as int (-> *cpad-list* cpads arg3 righty)) 128.0 48.0 110.0 -1.0)) + ;; og:preserve-this + (f26-0 (analog-input-horizontal-first (the-as int (-> *cpad-list* cpads arg3 rightx)) 128.0 48.0 110.0 -1.0)) + (f0-60 (analog-input-vertical-first (the-as int (-> *cpad-list* cpads arg3 righty)) 128.0 48.0 110.0 -1.0)) ) (cond ((and (not s3-0) (cpad-hold? arg3 r2)) diff --git a/goal_src/jak2/engine/camera/cam-states.gc b/goal_src/jak2/engine/camera/cam-states.gc index 38ea11e340..3ba8a349f4 100644 --- a/goal_src/jak2/engine/camera/cam-states.gc +++ b/goal_src/jak2/engine/camera/cam-states.gc @@ -500,7 +500,8 @@ (s5-0 (new-stack-matrix0)) ) (when (not (logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))) - (let ((f30-0 (analog-input + ;; og:preserve-this + (let ((f30-0 (analog-input-horizontal-first (the-as int (+ (-> *cpad-list* cpads 0 rightx) -256 (-> *cpad-list* cpads 0 leftx))) 0.0 48.0 @@ -508,7 +509,7 @@ -1.0 ) ) - (f0-0 (analog-input + (f0-0 (analog-input-vertical-first (the-as int (+ (-> *cpad-list* cpads 0 righty) -256 (-> *cpad-list* cpads 0 lefty))) 0.0 48.0 @@ -517,24 +518,27 @@ ) ) ) - (set! (-> s4-0 y) (- (-> s4-0 y) (* (- f30-0) (-> *CAM_EYE-bank* rot-speed)))) - (set! (-> s4-0 x) (- (-> s4-0 x) (* (- f0-0) (-> *CAM_EYE-bank* rot-speed)))) + ;; og:preserve-this changed for high fps + (set! (-> s4-0 y) (- (-> s4-0 y) (* (- f30-0) (* (-> *display* base-clock time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed))))) + (set! (-> s4-0 x) (- (-> s4-0 x) (* (- f0-0) (* (-> *display* base-clock time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed))))) ) ) + ;; og:preserve-this changed for high fps (cond - ((< (-> *CAM_EYE-bank* rot-speed) (-> s4-0 x)) - (set! (-> s4-0 x) (-> *CAM_EYE-bank* rot-speed)) + ((< (* (-> *display* base-clock time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed)) (-> s4-0 x)) + (set! (-> s4-0 x) (* (-> *display* base-clock time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed))) ) - ((< (-> s4-0 x) (- (-> *CAM_EYE-bank* rot-speed))) - (set! (-> s4-0 x) (- (-> *CAM_EYE-bank* rot-speed))) + ((< (-> s4-0 x) (- (* (-> *display* base-clock time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed)))) + (set! (-> s4-0 x) (- (* (-> *display* base-clock time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed)))) ) ) + ;; og:preserve-this changed for high fps (cond - ((< (-> *CAM_EYE-bank* rot-speed) (-> s4-0 y)) - (set! (-> s4-0 y) (-> *CAM_EYE-bank* rot-speed)) + ((< (* (-> *display* base-clock time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed)) (-> s4-0 y)) + (set! (-> s4-0 y) (* (-> *display* base-clock time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed))) ) - ((< (-> s4-0 y) (- (-> *CAM_EYE-bank* rot-speed))) - (set! (-> s4-0 y) (- (-> *CAM_EYE-bank* rot-speed))) + ((< (-> s4-0 y) (- (* (-> *display* base-clock time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed)))) + (set! (-> s4-0 y) (- (* (-> *display* base-clock time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed)))) ) ) (cond @@ -821,11 +825,12 @@ (s4-0 (new 'stack-no-clear 'matrix)) ) (when (not (logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))) + ;; og:preserve-this (let ((f24-0 - (analog-input (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 32.0 110.0 (* 8192.0 (seconds-per-frame))) + (analog-input-horizontal-third (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 32.0 110.0 (* 8192.0 (seconds-per-frame))) ) (f1-2 - (analog-input (the-as int (-> *cpad-list* cpads 0 righty)) 128.0 32.0 110.0 (* 8192.0 (seconds-per-frame))) + (analog-input-vertical-third (the-as int (-> *cpad-list* cpads 0 righty)) 128.0 32.0 110.0 (* 8192.0 (seconds-per-frame))) ) (s2-0 (new-stack-matrix0)) ) @@ -2221,7 +2226,8 @@ ) (defun cam-dist-analog-input ((arg0 int) (arg1 float)) - (let ((f0-0 (the-as number 0.0))) + ;; og:preserve-this + (let ((f0-0 0.0)) (cond ((< arg0 28) (set! f0-0 (- (fmin arg1 (* 0.083333336 (- 28.0 (the float arg0)) arg1)))) @@ -2230,7 +2236,11 @@ (set! f0-0 (fmin arg1 (* 0.0125 (+ -160.0 (the float arg0)) arg1))) ) ) - (the-as float f0-0) + ;; og:preserve-this + (#if PC_PORT + (* (if (-> *pc-settings* third-camera-v-inverted?) 1.0 -1.0) f0-0) + f0-0 + ) ) ) @@ -2411,7 +2421,8 @@ ) ) (when (not (logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))) - (let ((f30-2 (analog-input + ;; og:preserve-this + (let ((f30-2 (analog-input-horizontal-third (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 32.0 @@ -3317,7 +3328,8 @@ ) (when (not (paused?)) (when (not (logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))) - (let ((f0-0 (analog-input (the-as int (-> *cpad-list* cpads 0 righty)) 128.0 32.0 110.0 0.05))) + ;; og:preserve-this + (let ((f0-0 (analog-input-vertical-third (the-as int (-> *cpad-list* cpads 0 righty)) 128.0 32.0 110.0 0.05))) (cond ((< (* 0.05 (- 1.0 (-> self view-off-param))) f0-0) (+! (-> self view-off-param) (* 0.05 (- 1.0 (-> self view-off-param)))) @@ -3338,8 +3350,9 @@ (lerp (-> *CAM_STICK-bank* min-z) (-> *CAM_STICK-bank* max-z) (-> self view-off-param)) ) (when (not (logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))) + ;; og:preserve-this (let ((f0-16 - (analog-input (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 32.0 110.0 (* 21845.334 (seconds-per-frame))) + (analog-input-horizontal-third (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 32.0 110.0 (* 21845.334 (seconds-per-frame))) ) (gp-0 (new-stack-matrix0)) (s3-0 (new-stack-vector0)) diff --git a/goal_src/jak2/engine/common_objs/generic-obs.gc b/goal_src/jak2/engine/common_objs/generic-obs.gc index a7c6dc452e..3b371cdc8f 100644 --- a/goal_src/jak2/engine/common_objs/generic-obs.gc +++ b/goal_src/jak2/engine/common_objs/generic-obs.gc @@ -2137,7 +2137,8 @@ This commonly includes things such as: (let ((s5-0 (new-stack-matrix0)) (gp-0 (vector-reset! (new 'stack-no-clear 'vector))) ) - (let* ((f0-0 (analog-input (the-as int (+ (-> *cpad-list* cpads 0 rightx) -128)) 0.0 48.0 110.0 -1.0)) + ;; og:preserve-this + (let* ((f0-0 (analog-input-horizontal-third (the-as int (+ (-> *cpad-list* cpads 0 rightx) -128)) 0.0 48.0 110.0 -1.0)) (f0-1 (* -546.13336 f0-0)) (f0-3 (fmin 546.13336 (fmax -546.13336 f0-1))) ) @@ -2206,7 +2207,8 @@ This commonly includes things such as: (defbehavior cam-launcher-long-joystick camera-slave () (when (not (logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))) (let ((gp-0 (new-stack-matrix0))) - (let* ((f0-0 (analog-input (the-as int (+ (-> *cpad-list* cpads 0 rightx) -128)) 0.0 48.0 110.0 -1.0)) + ;; og:preserve-this + (let* ((f0-0 (analog-input-horizontal-third (the-as int (+ (-> *cpad-list* cpads 0 rightx) -128)) 0.0 48.0 110.0 -1.0)) (f0-1 (* -546.13336 f0-0)) (f0-3 (fmin 546.13336 (fmax -546.13336 f0-1))) ) diff --git a/goal_src/jak2/engine/game/main.gc b/goal_src/jak2/engine/game/main.gc index 785b3edf65..b361ffdea8 100644 --- a/goal_src/jak2/engine/game/main.gc +++ b/goal_src/jak2/engine/game/main.gc @@ -611,7 +611,8 @@ (suspend) ) ) - (kernel-shutdown) + ;; og:preserve-this + (kernel-shutdown (runtime-exit-status exit)) (none) ) (if (= *master-exit* 'movie) diff --git a/goal_src/jak2/engine/ps2/pad.gc b/goal_src/jak2/engine/ps2/pad.gc index bce30f60d7..8bc8c66e5f 100644 --- a/goal_src/jak2/engine/ps2/pad.gc +++ b/goal_src/jak2/engine/ps2/pad.gc @@ -254,6 +254,43 @@ The cpad-set-buzz! function can be used for vibration. ) ) +;; og:preserve-this macros +(defmacro analog-input-horizontal-first (in offset center-val max-val out-range) + "Same as analog-input but respects First-Person Horizontal camera control setting." + `(#if PC_PORT ;; first-person horizontal is NOT inverted in original game + (* (if (-> *pc-settings* first-camera-h-inverted?) -1.0 1.0) + (analog-input ,in ,offset ,center-val ,max-val ,out-range)) + (analog-input ,in ,offset ,center-val ,max-val ,out-range) + ) + ) + +(defmacro analog-input-vertical-first (in offset center-val max-val out-range) + "Same as analog-input but respects First-Person Vertical camera control setting." + `(#if PC_PORT ;; first-person vertical is already inverted in original game + (* (if (-> *pc-settings* first-camera-v-inverted?) 1.0 -1.0) + (analog-input ,in ,offset ,center-val ,max-val ,out-range)) + (analog-input ,in ,offset ,center-val ,max-val ,out-range) + ) + ) + +(defmacro analog-input-horizontal-third (in offset center-val max-val out-range) + "Same as analog-input but respects Third-Person Horizontal camera control setting." + `(#if PC_PORT ;; third-person horizontal is already inverted in original game + (* (if (-> *pc-settings* third-camera-h-inverted?) 1.0 -1.0) + (analog-input ,in ,offset ,center-val ,max-val ,out-range)) + (analog-input ,in ,offset ,center-val ,max-val ,out-range) + ) + ) + +(defmacro analog-input-vertical-third (in offset center-val max-val out-range) + "Same as analog-input but respects Third-Person Vertical camera control setting." + `(#if PC_PORT ;; third-person vertical is already inverted in original game + (* (if (-> *pc-settings* third-camera-v-inverted?) 1.0 -1.0) + (analog-input ,in ,offset ,center-val ,max-val ,out-range)) + (analog-input ,in ,offset ,center-val ,max-val ,out-range) + ) + ) + (defun cpad-set-buzz! ((arg0 cpad-info) (arg1 int) (arg2 int) (arg3 time-frame)) "Turn on vibration motor 'buzz-idx' for duration, at magnitude buzz-amount." (cond diff --git a/goal_src/jak2/engine/ui/progress/progress.gc b/goal_src/jak2/engine/ui/progress/progress.gc index 8d15530e6e..bf1da0b7c0 100644 --- a/goal_src/jak2/engine/ui/progress/progress.gc +++ b/goal_src/jak2/engine/ui/progress/progress.gc @@ -1301,8 +1301,9 @@ (if sv-156 (begin-scan sv-152 self) ) - (if (or (= (-> self current-options) *title*) (= (-> self current-options) *options*)) - (+! s5-0 20) + ;; og:preserve-this + (if (or (= (-> self current-options) *title-pc*) (= (-> self current-options) *options-pc*)) + (+! s5-0 10) ) (dotimes (s4-1 (length gp-0)) (let ((v1-24 sv-144)) @@ -1324,7 +1325,7 @@ ) ) ) - ;; added for proper aspect ratio-ing + ;; og:preserve-this added for proper aspect ratio-ing (#when PC_PORT (when (not (-> *pc-settings* use-vis?)) (set! (-> sv-144 origin x) (the float (the int (adjust-game-x (-> sv-144 origin x))))) diff --git a/goal_src/jak2/engine/ui/text-id-h.gc b/goal_src/jak2/engine/ui/text-id-h.gc index d8576f93fb..5cb5cb2e5e 100644 --- a/goal_src/jak2/engine/ui/text-id-h.gc +++ b/goal_src/jak2/engine/ui/text-id-h.gc @@ -770,6 +770,13 @@ (trick-darkjak-bomb0 #x1330) (trick-darkjak-bomb1 #x1331) (trick-darkjak-giant #x1332) + (progress-graphics-ps2 #x1333) + (progress-graphics-actor-culling #x1334) + (progress-graphics-force-envmap #x1335) + (progress-fast-progress #x1336) + (progress-graphics-ps2-lod-dist #x1337) + (progress-graphics-msaa-off #x1338) + (progress-graphics-display #x1339) ) ;; ---text-id diff --git a/goal_src/jak2/kernel-defs.gc b/goal_src/jak2/kernel-defs.gc index d642d843a8..67cf2f3c5a 100644 --- a/goal_src/jak2/kernel-defs.gc +++ b/goal_src/jak2/kernel-defs.gc @@ -38,6 +38,14 @@ (uk-english) ) +(defenum runtime-exit-status + :type uint32 + (running) + (restart-runtime) + (exit) + (restart-in-debug) + ) + ;; fixed symbols (define-extern #f symbol) (define-extern #t symbol) @@ -124,7 +132,7 @@ (define-extern scf-get-aspect "Defined in the kernel" (function uint)) (define-extern scf-get-timeout (function int)) (define-extern scf-get-inactive-timeout (function int)) -(define-extern kernel-shutdown (function none)) +(define-extern kernel-shutdown (function runtime-exit-status none)) (define-extern *boot-video-mode* "Defined in the kernel" int) (define-extern *kernel-boot-message* symbol) @@ -189,13 +197,15 @@ (define-extern pc-get-active-display-size (function (pointer int32) (pointer int32) none)) (define-extern pc-get-active-display-refresh-rate (function int)) (define-extern pc-get-display-count (function int)) -(define-extern pc-get-display-name (function int string)) +(define-extern pc-get-display-name (function int string symbol)) (define-extern pc-get-os (function symbol)) (define-extern pc-get-window-size (function (pointer int32) (pointer int32) none)) (define-extern pc-get-window-scale (function (pointer float) (pointer float) none)) (define-extern pc-set-window-size (function int int none)) (define-extern pc-set-fullscreen-display (function int none)) (define-extern pc-set-display-mode (function symbol none)) +(define-extern pc-get-num-resolutions (function int)) +(define-extern pc-get-resolution (function int (pointer int64) (pointer int64) none)) (define-extern pc-set-frame-rate (function int none)) (define-extern pc-set-vsync (function symbol none)) diff --git a/goal_src/jak2/kernel/gstring.gc b/goal_src/jak2/kernel/gstring.gc index 10a4b5b5bb..33dd6f600b 100644 --- a/goal_src/jak2/kernel/gstring.gc +++ b/goal_src/jak2/kernel/gstring.gc @@ -814,6 +814,14 @@ ) ) +(defmacro temp-string-format (buf &rest args) + "Like [[string-format]], but takes a string as an argument." + `(begin + (format (clear ,buf) ,@args) + ,buf + ) + ) + (define *pc-encoded-temp-string* (new 'global 'string 2048 (the-as string #f))) (kmemclose) diff --git a/goal_src/jak2/pc/debug/default-menu-pc.gc b/goal_src/jak2/pc/debug/default-menu-pc.gc index 8f0b0ee4a6..c5982f3789 100644 --- a/goal_src/jak2/pc/debug/default-menu-pc.gc +++ b/goal_src/jak2/pc/debug/default-menu-pc.gc @@ -920,7 +920,7 @@ (flag "144" 144 dm-frame-rate-pick-func) (flag "165" 165 dm-frame-rate-pick-func) (flag "240" 240 dm-frame-rate-pick-func) - (flag "disclaimer" #f ,(dm-lambda-boolean-flag (-> *progress-state-pc* frame-rate-disclaimer-seen?))) + (flag "disclaimer" #f ,(dm-lambda-boolean-flag *frame-rate-disclaimer-seen?*)) ) (menu "MSAA" (flag "Off" 1 dm-msaa-pick-func) diff --git a/goal_src/jak2/pc/pckernel-impl.gc b/goal_src/jak2/pc/pckernel-impl.gc index 1575373ccd..58e3464dc3 100644 --- a/goal_src/jak2/pc/pckernel-impl.gc +++ b/goal_src/jak2/pc/pckernel-impl.gc @@ -141,7 +141,7 @@ (true! (-> obj fast-elevator?)) (false! (-> obj fast-progress?)) (true! (-> obj smooth-minimap?)) - (true! (-> obj hires-clouds?)) + (false! (-> obj hires-clouds?)) 0) (defmethod reset-extra ((obj pc-settings-jak2) (call-handlers symbol)) diff --git a/goal_src/jak2/pc/progress/progress-draw-pc.gc b/goal_src/jak2/pc/progress/progress-draw-pc.gc index 85be3ecf27..a8ec510190 100644 --- a/goal_src/jak2/pc/progress/progress-draw-pc.gc +++ b/goal_src/jak2/pc/progress/progress-draw-pc.gc @@ -1734,91 +1734,89 @@ ) -(defmethod draw-option ((obj menu-sub-menu-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) - (let ((f30-0 (* 2.0 (- 0.5 (-> arg0 menu-transition)))) - (s2-0 (the int (+ -1.0 (-> arg1 origin y)))) - (s1-0 22) +(defmethod draw-option ((this menu-sub-menu-option) (arg0 progress) (fnt font-context) (arg2 int) (arg3 symbol)) + (let ((alpha (* 2.0 (- 0.5 (-> arg0 menu-transition)))) + (y (the int (+ -1.0 (-> fnt origin y)))) + (height 22) ) - (if (< f30-0 0.0) - (set! f30-0 0.0) + (if (< alpha 0.0) + (set! alpha 0.0) ) - (set! (-> arg1 alpha) f30-0) - (set-scale! arg1 0.6) + (set! (-> fnt alpha) alpha) + (set-scale! fnt 0.6) (cond - ((= *title* (-> arg0 current-options)) - (set-scale! arg1 0.85) - (set! (-> arg1 height) 40.0) - (set! s1-0 36) - (+! s2-0 -8) + ((= *title-pc* (-> arg0 current-options)) + (set-scale! fnt 0.65) + (set! (-> fnt height) 25.0) + (set! height 28) + (-! y 4) (when (memcard-unlocked-secrets? #f) - (+! (-> arg1 origin y) -35.0) - (set! s1-0 36) - (+! s2-0 -34) + (-! (-> fnt origin y) 30.0) + (set! height 28) + (-! y 31) ) ) - ((= *options* (-> arg0 current-options)) - (+! (-> arg1 origin y) -20.0) - (set-scale! arg1 0.85) - (set! (-> arg1 height) 40.0) - (set! s1-0 37) - (+! s2-0 -28) + ((= *options-pc* (-> arg0 current-options)) + (-! (-> fnt origin y) 20.0) + (set-scale! fnt 0.85) + (set! (-> fnt height) 40.0) + (set! height 37) + (-! y 28) ) ) - (when (nonzero? (-> obj name)) - (let ((s0-0 arg1)) - (set! (-> s0-0 color) (if (= arg2 (-> arg0 option-index)) - (the-as font-color (the-as int (progress-selected 0))) - (font-color progress) - ) - ) - ) + (when (nonzero? (-> this name)) + (set-color! fnt (if (= arg2 (-> arg0 option-index)) + (the font-color (the int (progress-selected 0))) + (font-color progress) + ) + ) (cond ((= arg2 (-> arg0 option-index)) - (set-color! arg1 (progress-selected 0)) + (set-color! fnt (progress-selected 0)) ) (else - (set-color! arg1 (font-color progress)) + (set-color! fnt (font-color progress)) ) ) - (if (and (and (= arg2 (-> arg0 option-index)) (!= 298 (-> obj name))) - (not (and (= (-> obj name) (text-id progress-root-secrets)) - (= *title* (-> arg0 current-options)) + (if (and (and (= arg2 (-> arg0 option-index)) (!= 298 (-> this name))) + (not (and (= (-> this name) (text-id progress-root-secrets)) + (= *title-pc* (-> arg0 current-options)) (not (memcard-unlocked-secrets? #f)) (= (-> arg0 option-index) 3) ) ) ) - (draw-highlight s2-0 s1-0 f30-0) + (draw-highlight y height alpha) ) (cond ((= *save-options-title* (-> arg0 current-options)) (cond - ((= (-> obj name) (text-id progress-continue-without-saving)) + ((= (-> this name) (text-id progress-continue-without-saving)) (cond ((= arg2 (-> arg0 option-index)) - (set-scale! arg1 0.5) + (set-scale! fnt 0.5) ) (else - (set-scale! arg1 0.45) + (set-scale! fnt 0.45) ) ) - (+! (-> arg1 origin y) -120.0) + (+! (-> fnt origin y) -120.0) (if (not (-> *pc-settings* use-vis?)) - (-! (-> arg1 origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) 10)) - (-! (-> arg1 origin x) (the float (if (= (get-aspect-ratio) 'aspect4x3) + (-! (-> fnt origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) 10)) + (-! (-> fnt origin x) (the float (if (= (get-aspect-ratio) 'aspect4x3) 10 5 )))) - (set! (-> arg1 width) (the float (if (= (get-aspect-ratio) 'aspect4x3) + (set! (-> fnt width) (the float (if (= (get-aspect-ratio) 'aspect4x3) 180 170 ) ) ) - (set! (-> arg1 height) 260.0) + (set! (-> fnt height) 260.0) (if (not (-> *pc-settings* use-vis?)) - (*! (-> arg1 width) (-> *pc-settings* aspect-ratio-reciprocal))) - (print-game-text (lookup-text! *common-text* (-> obj name) #f) arg1 #f 44 (bucket-id progress)) + (*! (-> fnt width) (-> *pc-settings* aspect-ratio-reciprocal))) + (print-game-text (lookup-text! *common-text* (-> this name) #f) fnt #f 44 (bucket-id progress)) (when (= arg2 (-> arg0 option-index)) (let ((s4-1 69) (s2-4 110) @@ -1840,7 +1838,7 @@ (+ (* s1-1 arg2) 8 s1-1 s2-4) s3-1 (+ s1-1 -8) - (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a (the int (* 64.0 f30-0))) + (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a (the int (* 64.0 alpha))) ) ) ) @@ -1849,16 +1847,16 @@ (set! s4-1 (adjust-game-x (the float s4-1))) (set! s3-1 (the int (* (-> *pc-settings* aspect-ratio-reciprocal) s3-1))) ) - (set-vector! (-> obj box 0 color) 64 128 128 (the int (* 128.0 f30-0))) + (set-vector! (-> this box 0 color) 64 128 128 (the int (* 128.0 alpha))) (draw-savegame-box - obj + this (the float s4-1) (the float (+ s4-1 s3-1)) (the float (+ s2-4 (* s1-1 arg2))) (the float (+ s2-4 (* s1-1 arg2))) ) (draw-savegame-box - obj + this (the float (+ s4-1 s3-1)) (the float (+ s4-1 s3-1)) (the float s2-4) @@ -1873,7 +1871,7 @@ (+ s2-4 (* s1-1 arg2)) s3-1 (+ s1-1 8) - (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a (the int (* 64.0 f30-0))) + (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a (the int (* 64.0 alpha))) ) ) ) @@ -1881,25 +1879,25 @@ ) (else (if (not (-> *pc-settings* use-vis?)) - (+! (-> arg1 origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) -100.0)) - (+! (-> arg1 origin x) -100.0)) - (set! (-> arg1 origin y) (+ -35.0 (-> arg1 origin y))) + (+! (-> fnt origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) -100.0)) + (+! (-> fnt origin x) -100.0)) + (set! (-> fnt origin y) (+ -35.0 (-> fnt origin y))) ) ) ) ((= *load-save-options* (-> arg0 current-options)) - (+! (-> arg1 origin x) -100.0) - (+! (-> arg1 origin y) -25.0) - (print-menu-text (lookup-text! *common-text* (-> obj name) #f) (-> obj scale) arg1 arg0) + (+! (-> fnt origin x) -100.0) + (+! (-> fnt origin y) -25.0) + (print-menu-text (lookup-text! *common-text* (-> this name) #f) (-> this scale) fnt arg0) ) - ((and (= *title* (-> arg0 current-options)) - (= (text-id progress-root-secrets) (-> obj name)) + ((and (= *title-pc* (-> arg0 current-options)) + (= (text-id progress-root-secrets) (-> this name)) (memcard-unlocked-secrets? #f) ) - (print-game-text (lookup-text! *common-text* (-> obj name) #f) arg1 #f 44 (bucket-id progress)) + (print-game-text (lookup-text! *common-text* (-> this name) #f) fnt #f 44 (bucket-id progress)) ) - ((!= (-> obj name) (text-id progress-root-secrets)) - (print-game-text (lookup-text! *common-text* (-> obj name) #f) arg1 #f 44 (bucket-id progress)) + ((!= (-> this name) (text-id progress-root-secrets)) + (print-game-text (lookup-text! *common-text* (-> this name) #f) fnt #f 44 (bucket-id progress)) ) ) ) @@ -1979,190 +1977,6 @@ ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - - -(defmethod draw-option ((obj menu-aspect-ratio-pc-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) - (let ((alpha (* 2.0 (- 0.5 (-> arg0 menu-transition))))) - (max! alpha 0.0) - (set! (-> arg1 alpha) alpha) - (set-flags! arg1 (font-flags kerning middle large)) - (set-scale! arg1 0.65) - (+! (-> arg1 origin y) 15.0) - (+! (-> arg1 origin y) -8.0) - (let ((ar-names (new 'static 'boxed-array :type text-id - (text-id progress-aspect-ratio-4x3) - (text-id progress-aspect-ratio-16x9) - (text-id progress-aspect-ratio-auto) - (text-id progress-aspect-ratio-custom) - ))) - (cond - (arg3 - (set-color! arg1 (font-color progress-force-selected)) - (draw-highlight (the int (+ -1.0 (-> arg1 origin y))) 41 alpha) - (print-game-text (lookup-text! *common-text* (-> obj name) #f) arg1 #f 44 (bucket-id progress)) - (+! (-> arg1 origin y) 23.0) - (set! *temp-string* (clear *temp-string*)) - (dotimes (i (-> ar-names length)) - (if (> i 0) - (format *temp-string* " ")) - (if (= i (-> *progress-state-pc* aspect-ratio-choice-index)) - (format *temp-string* "~33L~S" (lookup-text! *common-text* (-> ar-names i) #f)) - (format *temp-string* "~35L~S" (lookup-text! *common-text* (-> ar-names i) #f))) - ) - (format *temp-string* "~1L") - ) - (else - (cond - ((= arg2 (-> arg0 option-index)) - (set-color! arg1 (progress-selected 0)) - (draw-highlight (the int (+ -1.0 (-> arg1 origin y))) 22 alpha) - ) - (else - (set-color! arg1 (font-color progress)) - ) - ) - (print-game-text (lookup-text! *common-text* (-> obj name) #f) arg1 #f 44 (bucket-id progress)) - (+! (-> arg1 origin y) 23.0) - (set! *temp-string* (clear *temp-string*)) - (dotimes (i (-> ar-names length)) - (if (> i 0) - (format *temp-string* " ")) - (if (= i (-> *progress-state-pc* aspect-ratio-choice-index)) - (format *temp-string* "~1L~S" (lookup-text! *common-text* (-> ar-names i) #f)) - (format *temp-string* "~35L~S" (lookup-text! *common-text* (-> ar-names i) #f))) - ) - (format *temp-string* "~1L") - ) - ) - ) - (set-scale! arg1 0.45) - (print-game-text *temp-string* arg1 #f 44 (bucket-id progress)) - (when-not-drawn-decoration - (draw-decoration obj arg1 alpha (text-id progress-root-graphic-options) #f 0.95)) - ) - 0 - (none) - ) - - -(defmethod draw-option ((obj menu-display-mode-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) - (let ((alpha (* 2.0 (- 0.5 (-> arg0 menu-transition))))) - (max! alpha 0.0) - (set! (-> arg1 alpha) alpha) - (set-flags! arg1 (font-flags kerning middle large)) - (set-scale! arg1 0.65) - (+! (-> arg1 origin y) 15.0) - (+! (-> arg1 origin y) -8.0) - (let ((names (new 'static 'boxed-array :type text-id - (text-id progress-windowed) - (text-id progress-fullscreen) - (text-id progress-borderless) - ))) - (cond - (arg3 - (set-color! arg1 (font-color progress-force-selected)) - (draw-highlight (the int (+ -1.0 (-> arg1 origin y))) 41 alpha) - (print-game-text (lookup-text! *common-text* (-> obj name) #f) arg1 #f 44 (bucket-id progress)) - (+! (-> arg1 origin y) 23.0) - (set! *temp-string* (clear *temp-string*)) - (dotimes (i (-> names length)) - (if (> i 0) - (format *temp-string* " ")) - (if (= i (-> *progress-state-pc* display-mode-choice-index)) - (format *temp-string* "~33L~S" (lookup-text! *common-text* (-> names i) #f)) - (format *temp-string* "~35L~S" (lookup-text! *common-text* (-> names i) #f))) - ) - (format *temp-string* "~1L") - ) - (else - (cond - ((= arg2 (-> arg0 option-index)) - (set-color! arg1 (progress-selected 0)) - (draw-highlight (the int (+ -1.0 (-> arg1 origin y))) 22 alpha) - ) - (else - (set-color! arg1 (font-color progress)) - ) - ) - (print-game-text (lookup-text! *common-text* (-> obj name) #f) arg1 #f 44 (bucket-id progress)) - (+! (-> arg1 origin y) 23.0) - (set! *temp-string* (clear *temp-string*)) - (dotimes (i (-> names length)) - (if (> i 0) - (format *temp-string* " ")) - (if (= i (-> *progress-state-pc* display-mode-choice-index)) - (format *temp-string* "~1L~S" (lookup-text! *common-text* (-> names i) #f)) - (format *temp-string* "~35L~S" (lookup-text! *common-text* (-> names i) #f))) - ) - (format *temp-string* "~1L") - ) - ) - ) - (set-scale! arg1 0.5) - (print-game-text *temp-string* arg1 #f 44 (bucket-id progress)) - (when-not-drawn-decoration - (draw-decoration obj arg1 alpha (text-id progress-root-graphic-options) #f 0.95)) - ) - 0 - (none) - ) - - -(defmethod draw-option ((obj menu-on-off-vsync-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) - (let ((alpha (* 2.0 (- 0.5 (-> arg0 menu-transition))))) - (max! alpha 0.0) - (set! (-> arg1 alpha) alpha) - (set-flags! arg1 (font-flags kerning middle large)) - (set-scale! arg1 0.65) - (+! (-> arg1 origin y) 15.0) - (+! (-> arg1 origin y) -8.0) - (let ((names (new 'static 'boxed-array :type text-id - (text-id progress-windowed) - (text-id progress-fullscreen) - (text-id progress-borderless) - ))) - (cond - (arg3 - (set-color! arg1 (font-color progress-force-selected)) - (draw-highlight (the int (+ -1.0 (-> arg1 origin y))) 41 alpha) - (print-game-text (lookup-text! *common-text* (-> obj name) #f) arg1 #f 44 (bucket-id progress)) - (+! (-> arg1 origin y) 23.0) - (set! *temp-string* (clear *temp-string*)) - (if (-> *progress-state* on-off-choice) - (format *temp-string* "~33L~S~35L ~S" (lookup-text! *common-text* (text-id progress-on) #f) (lookup-text! *common-text* (text-id progress-off) #f)) - (format *temp-string* "~35L~S ~33L~S~1L" (lookup-text! *common-text* (text-id progress-on) #f) (lookup-text! *common-text* (text-id progress-off) #f))) - ) - (else - (cond - ((= arg2 (-> arg0 option-index)) - (set-color! arg1 (progress-selected 0)) - (draw-highlight (the int (+ -1.0 (-> arg1 origin y))) 22 alpha) - ) - (else - (set-color! arg1 (font-color progress)) - ) - ) - (print-game-text (lookup-text! *common-text* (-> obj name) #f) arg1 #f 44 (bucket-id progress)) - (+! (-> arg1 origin y) 23.0) - (set! *temp-string* (clear *temp-string*)) - (if (-> *progress-state* on-off-choice) - (format *temp-string* "~1L~S~35L ~S" (lookup-text! *common-text* (text-id progress-on) #f) (lookup-text! *common-text* (text-id progress-off) #f)) - (format *temp-string* "~35L~S ~1L~S~1L" (lookup-text! *common-text* (text-id progress-on) #f) (lookup-text! *common-text* (text-id progress-off) #f))) - ) - ) - ) - (set-scale! arg1 0.5) - (print-game-text *temp-string* arg1 #f 44 (bucket-id progress)) - (when-not-drawn-decoration - (draw-decoration obj arg1 alpha (text-id progress-root-graphic-options) #f 0.95)) - ) - 0 - (none) - ) - - - - (defun draw-decoration-aspect-ratio-custom ((arg0 menu-option) (arg1 font-context) (arg2 float) (arg3 text-id) (arg5 float)) (let ((gp-0 70) (s5-0 120) @@ -2364,51 +2178,7 @@ (none) ) -(defmethod draw-option ((obj menu-frame-rate-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) - (let ((alpha (* 2.0 (- 0.5 (-> arg0 menu-transition))))) - (set-scale! arg1 0.65) - (max! alpha 0.0) - (set! (-> arg1 alpha) alpha) - (set-flags! arg1 (font-flags kerning middle large)) - (+! (-> arg1 origin y) 8.0) - (cond - (arg3 - (set-color! arg1 (font-color progress-force-selected)) - (draw-highlight (the int (+ -1.0 (-> arg1 origin y))) 42 alpha) - (print-game-text (lookup-text! *common-text* (-> obj name) #f) arg1 #f 44 (bucket-id progress)) - (+! (-> arg1 origin y) 22.0) - (set-color! arg1 (font-color progress)) - (set-scale! arg1 0.5) - (set-color! arg1 (font-color progress)) - (+! (-> arg1 origin x) -25.0) - (print-game-text (string-format "~33L~C" 163) arg1 #f 44 (bucket-id progress)) - (+! (-> arg1 origin x) 50.0) - (print-game-text (string-format "~33L~C" 161) arg1 #f 44 (bucket-id progress)) - (+! (-> arg1 origin x) -25.0) - (set-color! arg1 (progress-selected 0)) - (set-flags! arg1 (font-flags kerning middle large)) - (print-game-text (string-format "~D" (-> *frame-rate-options* (-> *progress-state-pc* frame-rate-choice-index))) arg1 #f 44 (bucket-id progress)) - ) - (else - (if (= (-> arg0 option-index) arg2) - (draw-highlight (the int (-> arg1 origin y)) 21 alpha) - ) - (set-scale! arg1 0.65) - (print-game-text (lookup-text! *common-text* (-> obj name) #f) arg1 #f 44 (bucket-id progress)) - (set-scale! arg1 0.5) - (set-color! arg1 (font-color progress)) - (+! (-> arg1 origin y) 22.0) - (set-flags! arg1 (font-flags kerning middle large)) - (print-game-text (string-format "~D" (-> *frame-rate-options* (-> *progress-state-pc* frame-rate-choice-index))) arg1 #f 44 (bucket-id progress)) - ) - ) - (when-not-drawn-decoration - (draw-decoration obj arg1 alpha (text-id progress-root-graphic-options) #f 0.95)) - ) - (none) - ) - -(defmethod draw-option menu-frame-rate-disclaimer-option ((obj menu-frame-rate-disclaimer-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) +(defmethod draw-option ((obj menu-frame-rate-disclaimer-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) (set! (-> arg1 alpha) (- 1.0 (-> arg0 menu-transition))) (set-color! arg1 (font-color red)) (set-scale! arg1 0.8) @@ -2446,6 +2216,91 @@ (none) ) +(defmethod draw-option ((this menu-exit-game-option) (progress progress) (fnt font-context) (arg2 int) (selected symbol)) + (let ((alpha (* 2.0 (- 0.5 (-> progress menu-transition)))) + (y (the int (+ -1.0 (-> fnt origin y)))) + (height 22) + ) + (if (< alpha 0.0) + (set! alpha 0.0) + ) + (set! (-> fnt alpha) alpha) + (set-scale! fnt 0.65) + (set! (-> fnt height) 25.0) + (set! height 28) + (when (not (memcard-unlocked-secrets? #f)) + (-! (-> fnt origin y) 45.0) + (-! y 49) + ) + (when (memcard-unlocked-secrets? #f) + (-! (-> fnt origin y) 35.0) + (-! y 38) + ) + (when (nonzero? (-> this name)) + (set-color! fnt (if (= arg2 (-> progress option-index)) + (the font-color (the int (progress-selected 0))) + (font-color progress) + ) + ) + (cond + ((= arg2 (-> progress option-index)) + (set-color! fnt (progress-selected 0)) + (draw-highlight y height alpha) + ) + (else + (set-color! fnt (font-color progress)) + ) + ) + (if selected (set-color! fnt (font-color progress-force-selected))) + (print-game-text (lookup-text! *common-text* (-> this name) #f) fnt #f 44 (bucket-id progress)) + (let ((choice (&-> *progress-state* yes-no-choice)) (str (the string #f))) + (set! str + (cond + (selected + (set-color! fnt (font-color progress-force-selected)) + (when (memcard-unlocked-secrets? #f) + (draw-highlight (the int (+ 24.0 (-> fnt origin y))) 24 (-> fnt alpha)) + (+! (-> fnt origin y) 24.0) + (set-scale! fnt 0.55) + ) + (when (not (memcard-unlocked-secrets? #f)) + (draw-highlight (the int (+ 23.0 (-> fnt origin y))) 23 (-> fnt alpha)) + (+! (-> fnt origin y) 23.0) + (set-scale! fnt 0.60) + ) + (cond + ((-> choice 0) + (format + (clear *temp-string*) + "~33L~S~32L ~S" + (lookup-text! *common-text* (text-id progress-yes) #f) + (lookup-text! *common-text* (text-id progress-no) #f) + ) + (set! str *temp-string*) + ) + (else + (format + (clear *temp-string*) + "~32L~S ~33L~S~1L" + (lookup-text! *common-text* (text-id progress-yes) #f) + (lookup-text! *common-text* (text-id progress-no) #f) + ) + (set! str *temp-string*) + ) + ) + str + ) + (else + (clear *temp-string*) + ) + ) + ) + (print-game-text str fnt #f 44 (bucket-id progress)) + ) + ) + ) + (none) + ) (defun begin-scissor-music-player ((box hud-box)) diff --git a/goal_src/jak2/pc/progress/progress-generic-draw-pc.gc b/goal_src/jak2/pc/progress/progress-generic-draw-pc.gc index def0892c6a..84ed8890c0 100644 --- a/goal_src/jak2/pc/progress/progress-generic-draw-pc.gc +++ b/goal_src/jak2/pc/progress/progress-generic-draw-pc.gc @@ -87,14 +87,14 @@ (set! (-> font-ctx origin x) (the float new-x-pos)) (set! (-> font-ctx origin y) (the float new-y-pos-up)) (let ((print-text-fn print-game-text)) - (format (clear *temp-string*) "~33L~C" 160) - (print-text-fn *temp-string* font-ctx #f 44 (bucket-id progress)))) + (format (clear *progress-generic-temp-string*) "~33L~C" 160) + (print-text-fn *progress-generic-temp-string* font-ctx #f 44 (bucket-id progress)))) (when draw-down? (set! (-> font-ctx origin x) (the float new-x-pos)) (set! (-> font-ctx origin y) (the float (+ new-y-pos-up new-y-pos-down))) (let ((print-text-fn-1 print-game-text)) - (format (clear *temp-string*) "~33L~C" 162) - (print-text-fn-1 *temp-string* font-ctx #f 44 (bucket-id progress)))) + (format (clear *progress-generic-temp-string*) "~33L~C" 162) + (print-text-fn-1 *progress-generic-temp-string* font-ctx #f 44 (bucket-id progress)))) (set! (-> font-ctx origin x) old-x-pos) (set! (-> font-ctx origin y) old-y-pos) (set! (-> font-ctx scale) old-scale)) @@ -222,10 +222,10 @@ (draw-generic-highlight (the int (- (-> font-ctx origin y) 2.0)) 32 alpha) (print-game-text (lookup-text! *common-text* (-> obj name) #f) font-ctx #f 44 (bucket-id progress)) (+! (-> font-ctx origin y) line-height) - (set! *temp-string* (clear *temp-string*)) + (set! *progress-generic-temp-string* (clear *progress-generic-temp-string*)) (if (-> obj value) - (format *temp-string* "~33L~S~35L ~S" (lookup-text! *common-text* (-> obj truthy-text) #f) (lookup-text! *common-text* (-> obj falsey-text) #f)) - (format *temp-string* "~35L~S ~33L~S~1L" (lookup-text! *common-text* (-> obj truthy-text) #f) (lookup-text! *common-text* (-> obj falsey-text) #f)))) + (format *progress-generic-temp-string* "~33L~S~35L ~S" (lookup-text! *common-text* (-> obj truthy-text) #f) (lookup-text! *common-text* (-> obj falsey-text) #f)) + (format *progress-generic-temp-string* "~35L~S ~33L~S~1L" (lookup-text! *common-text* (-> obj truthy-text) #f) (lookup-text! *common-text* (-> obj falsey-text) #f)))) ;; hover case (else (cond @@ -242,13 +242,13 @@ (set-color! font-ctx (font-color progress)))) (print-game-text (lookup-text! *common-text* (-> obj name) #f) font-ctx #f 44 (bucket-id progress)) (+! (-> font-ctx origin y) line-height) - (set! *temp-string* (clear *temp-string*)) + (set! *progress-generic-temp-string* (clear *progress-generic-temp-string*)) (let ((actual-value (call-get-value-fn obj))) (if actual-value - (format *temp-string* "~1L~S~35L ~S" (lookup-text! *common-text* (-> obj truthy-text) #f) (lookup-text! *common-text* (-> obj falsey-text) #f)) - (format *temp-string* "~35L~S ~1L~S~1L" (lookup-text! *common-text* (-> obj truthy-text) #f) (lookup-text! *common-text* (-> obj falsey-text) #f)))))) + (format *progress-generic-temp-string* "~1L~S~35L ~S" (lookup-text! *common-text* (-> obj truthy-text) #f) (lookup-text! *common-text* (-> obj falsey-text) #f)) + (format *progress-generic-temp-string* "~35L~S ~1L~S~1L" (lookup-text! *common-text* (-> obj truthy-text) #f) (lookup-text! *common-text* (-> obj falsey-text) #f)))))) (set-scale! font-ctx 0.35) - (print-game-text *temp-string* font-ctx #f 44 (bucket-id progress))) + (print-game-text *progress-generic-temp-string* font-ctx #f 44 (bucket-id progress))) (none)) (defmethod draw-option ((obj menu-generic-carousel-option) @@ -286,8 +286,8 @@ ((or (< (-> obj item-index) 0) (> (-> obj item-index) (num-items obj))) (print-game-text (lookup-text! *common-text* (text-id progress-multiselect-no-items-found) #f) font-ctx #f 44 (bucket-id progress))) ((and selected? (>= (-> obj item-index) 0) (< (-> obj item-index) (num-items obj))) - (format (clear *temp-string*) "~33L~C ~S ~33L~C" 163 (get-item-label obj (-> obj item-index)) 161) - (print-game-text *temp-string* font-ctx #f 44 (bucket-id progress))) + (format (clear *progress-generic-temp-string*) "~33L~C ~S ~33L~C" 163 (get-item-label obj (-> obj item-index)) 161) + (print-game-text *progress-generic-temp-string* font-ctx #f 44 (bucket-id progress))) (else (let ((actual-index (call-get-item-index-fn obj))) (print-game-text (get-item-label obj actual-index) font-ctx #f 44 (bucket-id progress)))))) @@ -342,10 +342,10 @@ (draw-generic-highlight (the int (- (-> font-ctx origin y) 2.0)) 32 alpha) (print-game-text (lookup-text! *common-text* (-> obj name) #f) font-ctx #f 44 (bucket-id progress)) (+! (-> font-ctx origin y) line-height) - (set! *temp-string* (clear *temp-string*)) + (set! *progress-generic-temp-string* (clear *progress-generic-temp-string*)) (if (-> obj confirmed?) - (format *temp-string* "~33L~S~35L ~S" (lookup-text! *common-text* (text-id progress-yes) #f) (lookup-text! *common-text* (text-id progress-no) #f)) - (format *temp-string* "~35L~S ~33L~S~1L" (lookup-text! *common-text* (text-id progress-yes) #f) (lookup-text! *common-text* (text-id progress-no) #f)))) + (format *progress-generic-temp-string* "~33L~S~35L ~S" (lookup-text! *common-text* (text-id progress-yes) #f) (lookup-text! *common-text* (text-id progress-no) #f)) + (format *progress-generic-temp-string* "~35L~S ~33L~S~1L" (lookup-text! *common-text* (text-id progress-yes) #f) (lookup-text! *common-text* (text-id progress-no) #f)))) ;; hover case (else (cond @@ -362,12 +362,12 @@ (set-color! font-ctx (font-color progress)))) (print-game-text (lookup-text! *common-text* (-> obj name) #f) font-ctx #f 44 (bucket-id progress)) (+! (-> font-ctx origin y) line-height) - (set! *temp-string* (clear *temp-string*)) + (set! *progress-generic-temp-string* (clear *progress-generic-temp-string*)) (if (-> obj confirmed?) - (format *temp-string* "~1L~S~35L ~S" (lookup-text! *common-text* (text-id progress-yes) #f) (lookup-text! *common-text* (text-id progress-no) #f)) - (format *temp-string* "~35L~S ~1L~S~1L" (lookup-text! *common-text* (text-id progress-yes) #f) (lookup-text! *common-text* (text-id progress-no) #f))))) + (format *progress-generic-temp-string* "~1L~S~35L ~S" (lookup-text! *common-text* (text-id progress-yes) #f) (lookup-text! *common-text* (text-id progress-no) #f)) + (format *progress-generic-temp-string* "~35L~S ~1L~S~1L" (lookup-text! *common-text* (text-id progress-yes) #f) (lookup-text! *common-text* (text-id progress-no) #f))))) (set-scale! font-ctx 0.35) - (print-game-text *temp-string* font-ctx #f 44 (bucket-id progress)))) + (print-game-text *progress-generic-temp-string* font-ctx #f 44 (bucket-id progress)))) (else (draw-generic-simple-string-option obj progress font-ctx option-index (lookup-text! *common-text* (-> obj name) #f)))) (none)) @@ -580,9 +580,9 @@ (set! (-> font-ctx origin x) (the float (adjust-game-x (if (= (get-aspect-ratio) 'aspect16x9) 430.0 438.0)))) (+! (-> font-ctx origin y) 6.0) (set-flags! font-ctx (font-flags kerning right large)) - (clear *temp-string*) + (clear *progress-generic-temp-string*) (if (-> obj confirmed?) - (format *temp-string* "~33L~S~35L ~S" (lookup-text! *common-text* (text-id progress-yes) #f) (lookup-text! *common-text* (text-id progress-no) #f)) - (format *temp-string* "~35L~S ~33L~S~1L" (lookup-text! *common-text* (text-id progress-yes) #f) (lookup-text! *common-text* (text-id progress-no) #f))) - (print-game-text *temp-string* font-ctx #f 44 (bucket-id progress)))) + (format *progress-generic-temp-string* "~33L~S~35L ~S" (lookup-text! *common-text* (text-id progress-yes) #f) (lookup-text! *common-text* (text-id progress-no) #f)) + (format *progress-generic-temp-string* "~35L~S ~33L~S~1L" (lookup-text! *common-text* (text-id progress-yes) #f) (lookup-text! *common-text* (text-id progress-no) #f))) + (print-game-text *progress-generic-temp-string* font-ctx #f 44 (bucket-id progress)))) (none)) diff --git a/goal_src/jak2/pc/progress/progress-generic-h-pc.gc b/goal_src/jak2/pc/progress/progress-generic-h-pc.gc index b4e7b893ec..2697c0cb58 100644 --- a/goal_src/jak2/pc/progress/progress-generic-h-pc.gc +++ b/goal_src/jak2/pc/progress/progress-generic-h-pc.gc @@ -222,3 +222,5 @@ :name ,title :entries (new 'static 'boxed-array :type menu-generic-details-entry ,@entries)))))) + +(define *progress-generic-temp-string* (new 'global 'string 512 (the string #f))) \ No newline at end of file diff --git a/goal_src/jak2/pc/progress/progress-generic-pc.gc b/goal_src/jak2/pc/progress/progress-generic-pc.gc index e54aa520ad..569acde068 100644 --- a/goal_src/jak2/pc/progress/progress-generic-pc.gc +++ b/goal_src/jak2/pc/progress/progress-generic-pc.gc @@ -164,15 +164,15 @@ ;; Progress Code Overrides -(defmethod respond-to-cpad ((obj progress)) +(defmethod respond-to-cpad ((this progress)) (mc-get-slot-info 0 *progress-save-info*) ;; ND originally did this...called this every frame in the game options, looked like a hack ;; there's probably a way to consistently do it synchronously (load-level-text-files (the-as int (-> *setting-control* user-current language))) - (when (-> obj current-options) - (let ((option-array (-> obj current-options options)) + (when (-> this current-options) + (let ((option-array (-> this current-options options)) (has-generic-history? (has-history? *progress-pc-generic-store*))) - (when (and option-array (= (-> obj menu-transition) 0.0)) + (when (and option-array (= (-> this menu-transition) 0.0)) (let ((in-generic-page? (and (= (-> option-array length) 1) (or (type? (-> option-array 0) menu-generic-scrolling-page) (type? (-> option-array 0) menu-generic-details-page))))) @@ -182,92 +182,94 @@ ;; update the scrolling list (respond-progress (the-as menu-option (-> option-array 0)) - obj - (and (= (-> obj menu-transition) 0.0) (-> obj selected-option)))) + this + (and (= (-> this menu-transition) 0.0) (-> this selected-option)))) ;; Do a bounds check to avoid crashing - ((>= (-> obj option-index) (-> option-array length)) - (format 0 "respond-to-cpad:progress: Option index ~D out of bounds~%" (-> obj option-index))) + ((>= (-> this option-index) (-> option-array length)) + (format 0 "respond-to-cpad:progress: Option index ~D out of bounds~%" (-> this option-index))) (else (respond-progress - (the-as menu-option (-> option-array (-> obj option-index))) - obj - (and (= (-> obj menu-transition) 0.0) (-> obj selected-option))))) + (the-as menu-option (-> option-array (-> this option-index))) + this + (and (= (-> this menu-transition) 0.0) (-> this selected-option))))) (cond - ((-> obj selected-option) + ((-> this selected-option) (cond ((cpad-pressed? 0 confirm) - (set! (-> obj selected-option) #f) + (set! (-> this selected-option) #f) ) ((cpad-pressed? 0 triangle) (when (not in-generic-page?) - (if (= (-> obj current-options) *main-options*) + (if (= (-> this current-options) *main-options*) (sound-play "window-contract") (sound-play "generic-beep"))) - (set! (-> obj selected-option) #f)))) + (set! (-> this selected-option) #f)))) (else (cond ((cpad-pressed? 0 up l-analog-up) (cond - ((= (-> obj current-options) *main-options*) + ((= (-> this current-options) *main-options*) (sound-play "ring-select")) ((!= (length option-array) 1) (sound-play "roll-over"))) - (if (and (= *title* (-> obj current-options)) (not (memcard-unlocked-secrets? #f)) (zero? (-> obj option-index))) - (set! (-> obj option-index) 3)) + ;; skip over hidden secrets menu + (if (and (= *title-pc* (-> this current-options)) (not (memcard-unlocked-secrets? #f)) (= (-> this option-index) 4)) + (set! (-> this option-index) 3)) (cond - ((> (-> obj want-option-index) 0) - (set! (-> obj want-option-index) -1)) - ((< -2 (-> obj want-option-index)) - (+! (-> obj want-option-index) -1)))) + ((> (-> this want-option-index) 0) + (set! (-> this want-option-index) -1)) + ((< -2 (-> this want-option-index)) + (+! (-> this want-option-index) -1)))) ((cpad-pressed? 0 down l-analog-down) (cond - ((= (-> obj current-options) *main-options*) + ((= (-> this current-options) *main-options*) (sound-play "ring-select")) ((!= (length option-array) 1) (sound-play "roll-over"))) + ;; skip over hidden secrets menu + (if (and (= *title-pc* (-> this current-options)) (not (memcard-unlocked-secrets? #f)) (= (-> this option-index) 2)) + (set! (-> this option-index) 3)) (cond - ((< (-> obj want-option-index) 0) - (set! (-> obj want-option-index) 1)) - ((< (-> obj want-option-index) 2) - (+! (-> obj want-option-index) 1)))) + ((< (-> this want-option-index) 0) + (set! (-> this want-option-index) 1)) + ((< (-> this want-option-index) 2) + (+! (-> this want-option-index) 1)))) ((cpad-pressed? 0 confirm) - (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm)) - (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm)) + (cpad-clear! 0 confirm) (when (and (not in-generic-page?) (not (-> *progress-state* clear-screen))) (sound-play "generic-beep")) ;; don't "select" the page link - (when (!= (-> obj next) 'generic-menu) - (set! (-> obj selected-option) #t))) + (when (!= (-> this next) 'generic-menu) + (set! (-> this selected-option) #t))) ((cpad-pressed? 0 triangle) ;; if we are within a generic managed menu option, handle the stack elsewhere ;; TODO - this likely has issues if we have a nested-non-generic menu, but deal with that use-case if it's ever ;; actually employed - (when (and (not has-generic-history?) (can-go-back? obj)) - (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle)) - (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle)) - (if (and (= (-> *progress-state* starting-state) 'main) (!= (-> obj current-options) *main-options*)) + (when (and (not has-generic-history?) (can-go-back? this)) + (cpad-clear! 0 triangle) + (if (and (= (-> *progress-state* starting-state) 'main) (!= (-> this current-options) *main-options*)) (sound-play "window-contract") (sound-play "generic-beep")) (clear-history-if-empty! *progress-pc-generic-store*) - (pop-state obj)))))))))) + (pop-state this)))))))))) (none)) ;; Component implementation ;; - input handling -(defmethod respond-progress ((obj menu-generic-scrolling-page) (progress progress) (selected? symbol)) +(defmethod respond-progress ((this menu-generic-scrolling-page) (progress progress) (selected? symbol)) "Handle progress menu navigation logic." (let ((selected-item? #f)) - (if (= (-> obj selected-option-index) -1) + (if (= (-> this selected-option-index) -1) (cond ((or (cpad-pressed? 0 down l-analog-down) (and (cpad-hold? 0 down l-analog-down) - (>= (- (current-time) (the-as int (-> obj last-move))) (seconds 0.5)))) - (set! (-> obj last-move) (current-time)) + (>= (- (current-time) (the-as int (-> this last-move))) (seconds 0.5)))) + (set! (-> this last-move) (current-time)) (cond - ((< (-> *progress-pc-generic-store* current-menu-hover-index) (dec (-> obj menu-options length))) + ((< (-> *progress-pc-generic-store* current-menu-hover-index) (dec (-> this menu-options length))) (+! (-> *progress-pc-generic-store* current-menu-hover-index) 1) (sound-play "roll-over")) (else @@ -275,15 +277,15 @@ (sound-play "roll-over")))) ((or (cpad-pressed? 0 up l-analog-up) (and (cpad-hold? 0 up l-analog-up) - (>= (- (current-time) (the-as int (-> obj last-move))) (seconds 0.5)))) - (set! (-> obj last-move) (current-time)) + (>= (- (current-time) (the-as int (-> this last-move))) (seconds 0.5)))) + (set! (-> this last-move) (current-time)) (+! (-> *progress-pc-generic-store* current-menu-hover-index) -1) (sound-play "roll-over") (when (< (-> *progress-pc-generic-store* current-menu-hover-index) 0) - (set! (-> *progress-pc-generic-store* current-menu-hover-index) (dec (-> obj menu-options length))))) + (set! (-> *progress-pc-generic-store* current-menu-hover-index) (dec (-> this menu-options length))))) ((cpad-pressed? 0 confirm) - (when (< (-> *progress-pc-generic-store* current-menu-hover-index) (-> obj menu-options length)) - (let ((menu-option (-> obj menu-options (-> *progress-pc-generic-store* current-menu-hover-index)))) + (when (< (-> *progress-pc-generic-store* current-menu-hover-index) (-> this menu-options length)) + (let ((menu-option (-> this menu-options (-> *progress-pc-generic-store* current-menu-hover-index)))) ;; if the option is disabled, return early (when (and (type? menu-option menu-generic-option) (nonzero? (-> (the-as menu-generic-option menu-option) should-disable?)) @@ -298,7 +300,7 @@ ((type? menu-option menu-generic-link-option) (set! selected-item? #t)) (else - (set! (-> obj selected-option-index) (-> *progress-pc-generic-store* current-menu-hover-index)) + (set! (-> this selected-option-index) (-> *progress-pc-generic-store* current-menu-hover-index)) (sound-play "generic-beep")))))) ((cpad-pressed? 0 triangle) ;; we are in a sub-page, time to go back @@ -308,114 +310,114 @@ ;; menu option already selected (cond ((cpad-pressed? 0 confirm) - (set! (-> obj selected-option-index) -1)) + (set! (-> this selected-option-index) -1)) ((cpad-pressed? 0 triangle) - (set! (-> obj selected-option-index) -1)))) + (set! (-> this selected-option-index) -1)))) ;; propagate event to menu-option - (when (< (-> *progress-pc-generic-store* current-menu-hover-index) (-> obj menu-options length)) - (respond-progress (-> obj menu-options (-> *progress-pc-generic-store* current-menu-hover-index)) progress (or selected? selected-item?)))) + (when (< (-> *progress-pc-generic-store* current-menu-hover-index) (-> this menu-options length)) + (respond-progress (-> this menu-options (-> *progress-pc-generic-store* current-menu-hover-index)) progress (or selected? selected-item?)))) 0) -(defmethod respond-progress ((obj menu-generic-boolean-option) (progress progress) (selected? symbol)) +(defmethod respond-progress ((this menu-generic-boolean-option) (progress progress) (selected? symbol)) (if selected? (cond ((cpad-pressed? 0 left l-analog-left right l-analog-right) - (if (-> obj value) - (set! (-> obj value) #f) - (set! (-> obj value) #t)) + (if (-> this value) + (set! (-> this value) #f) + (set! (-> this value) #t)) (sound-play "generic-beep")) ((cpad-pressed? 0 confirm) - (call-on-confirm obj (-> obj value)) + (call-on-confirm this (-> this value)) (sound-play "generic-beep"))) (cond ((cpad-pressed? 0 confirm) ;; set the value, this is so we edit the component's state and not the actual underlying value ;; in other words, don't change the setting until the user has actually confirmed the change! - (set! (-> obj value) (call-get-value-fn obj))))) + (set! (-> this value) (call-get-value-fn this))))) 0) -(defmethod respond-progress ((obj menu-generic-carousel-option) (progress progress) (selected? symbol)) +(defmethod respond-progress ((this menu-generic-carousel-option) (progress progress) (selected? symbol)) (if selected? (cond ((cpad-pressed? 0 left l-analog-left) - (dec! (-> obj item-index)) - (when (< (-> obj item-index) 0) - (set! (-> obj item-index) (dec (num-items obj)))) + (dec! (-> this item-index)) + (when (< (-> this item-index) 0) + (set! (-> this item-index) (dec (num-items this)))) (sound-play "generic-beep")) ((cpad-pressed? 0 right l-analog-right) - (inc! (-> obj item-index)) - (when (>= (-> obj item-index) (num-items obj)) - (set! (-> obj item-index) 0)) + (inc! (-> this item-index)) + (when (>= (-> this item-index) (num-items this)) + (set! (-> this item-index) 0)) (sound-play "generic-beep")) ((cpad-pressed? 0 confirm) - (call-on-confirm obj (-> obj item-index)) + (call-on-confirm this (-> this item-index)) (sound-play "generic-beep"))) (cond ((cpad-pressed? 0 confirm) ;; set the value, this is so we edit the component's state and not the actual underlying value ;; in other words, don't change the setting until the user has actually confirmed the change! - (set! (-> obj item-index) (call-get-item-index-fn obj))))) + (set! (-> this item-index) (call-get-item-index-fn this))))) 0) -(defmethod respond-progress ((obj menu-generic-link-option) (progress progress) (selected? symbol)) +(defmethod respond-progress ((this menu-generic-link-option) (progress progress) (selected? symbol)) (when (and selected? (cpad-pressed? 0 confirm)) - (navigate! *progress-pc-generic-store* progress (-> obj target) (-> obj on-load)) + (navigate! *progress-pc-generic-store* progress (-> this target) (-> this on-load)) (set! (-> progress selected-option) #f) (sound-play "score-slide")) 0) -(defmethod respond-progress ((obj menu-generic-confirm-option) (progress progress) (selected? symbol)) +(defmethod respond-progress ((this menu-generic-confirm-option) (progress progress) (selected? symbol)) (if selected? (cond ((cpad-pressed? 0 left l-analog-left right l-analog-right) - (if (-> obj confirmed?) - (set! (-> obj confirmed?) #f) - (set! (-> obj confirmed?) #t)) + (if (-> this confirmed?) + (set! (-> this confirmed?) #f) + (set! (-> this confirmed?) #t)) (sound-play "generic-beep")) ((cpad-pressed? 0 confirm) - (call-on-confirm obj) + (call-on-confirm this) (sound-play "generic-beep"))) (cond ((cpad-pressed? 0 confirm) - (set! (-> obj confirmed?) #f)))) + (set! (-> this confirmed?) #f)))) 0) -(defmethod respond-progress ((obj menu-generic-slider-option) (progress progress) (selected? symbol)) +(defmethod respond-progress ((this menu-generic-slider-option) (progress progress) (selected? symbol)) (if selected? (cond - ((and (> (-> obj value) (-> obj min-value)) + ((and (> (-> this value) (-> this min-value)) (cpad-hold? 0 left l-analog-left)) ;; TODO - might not work well on higher frame-rates - (set! (-> obj value) (fmax (- (-> obj value) (-> obj step)) (-> obj min-value))) - (when (< (seconds 0.03) (- (current-time) (-> obj last-sound-played))) - (set! (-> obj last-sound-played) (current-time)) + (set! (-> this value) (fmax (- (-> this value) (-> this step)) (-> this min-value))) + (when (< (seconds 0.03) (- (current-time) (-> this last-sound-played))) + (set! (-> this last-sound-played) (current-time)) (sound-play-by-name (static-sound-name "menu-slide") (new-sound-id) 512 0 0 (sound-group sfx) #t))) - ((and (< (-> obj value) (-> obj max-value)) + ((and (< (-> this value) (-> this max-value)) (cpad-hold? 0 right l-analog-right)) ;; TODO - might not work well on higher frame-rates - (set! (-> obj value) (fmin (+ (-> obj value) (-> obj step)) (-> obj max-value))) - (when (< (seconds 0.03) (- (current-time) (-> obj last-sound-played))) - (set! (-> obj last-sound-played) (current-time)) + (set! (-> this value) (fmin (+ (-> this value) (-> this step)) (-> this max-value))) + (when (< (seconds 0.03) (- (current-time) (-> this last-sound-played))) + (set! (-> this last-sound-played) (current-time)) (sound-play-by-name (static-sound-name "menu-slide") (new-sound-id) 512 0 0 (sound-group sfx) #t))) ((cpad-pressed? 0 confirm) - (call-on-confirm obj (-> obj value)) + (call-on-confirm this (-> this value)) (sound-play "generic-beep"))) (cond ((cpad-pressed? 0 confirm) ;; set the value, this is so we edit the component's state and not the actual underlying value ;; in other words, don't change the setting until the user has actually confirmed the change! - (set! (-> obj value) (call-get-value-fn obj))))) + (set! (-> this value) (call-get-value-fn this))))) 0) -(defmethod respond-progress ((obj menu-generic-details-page) (progress progress) (selected? symbol)) - (if (= (-> obj selected-entry-index) -1) +(defmethod respond-progress ((this menu-generic-details-page) (progress progress) (selected? symbol)) + (if (= (-> this selected-entry-index) -1) (cond ((or (cpad-pressed? 0 down l-analog-down) (and (cpad-hold? 0 down l-analog-down) - (>= (- (current-time) (the-as int (-> obj last-move))) (seconds 0.5)))) - (set! (-> obj last-move) (current-time)) + (>= (- (current-time) (the-as int (-> this last-move))) (seconds 0.5)))) + (set! (-> this last-move) (current-time)) (cond - ((< (-> *progress-pc-generic-store* current-menu-hover-index) (dec (-> obj entries length))) + ((< (-> *progress-pc-generic-store* current-menu-hover-index) (dec (-> this entries length))) (+! (-> *progress-pc-generic-store* current-menu-hover-index) 1) (sound-play "roll-over")) (else @@ -423,15 +425,15 @@ (sound-play "roll-over")))) ((or (cpad-pressed? 0 up l-analog-up) (and (cpad-hold? 0 up l-analog-up) - (>= (- (current-time) (the-as int (-> obj last-move))) (seconds 0.5)))) - (set! (-> obj last-move) (current-time)) + (>= (- (current-time) (the-as int (-> this last-move))) (seconds 0.5)))) + (set! (-> this last-move) (current-time)) (+! (-> *progress-pc-generic-store* current-menu-hover-index) -1) (sound-play "roll-over") (when (< (-> *progress-pc-generic-store* current-menu-hover-index) 0) - (set! (-> *progress-pc-generic-store* current-menu-hover-index) (dec (-> obj entries length))))) + (set! (-> *progress-pc-generic-store* current-menu-hover-index) (dec (-> this entries length))))) ((cpad-pressed? 0 confirm) - (when (< (-> *progress-pc-generic-store* current-menu-hover-index) (-> obj entries length)) - (set! (-> obj selected-entry-index) (-> *progress-pc-generic-store* current-menu-hover-index)) + (when (< (-> *progress-pc-generic-store* current-menu-hover-index) (-> this entries length)) + (set! (-> this selected-entry-index) (-> *progress-pc-generic-store* current-menu-hover-index)) (sound-play "generic-beep"))) ((cpad-pressed? 0 triangle) ;; we are in a sub-page, time to go back @@ -441,16 +443,16 @@ ;; menu option already selected (cond ((cpad-pressed? 0 confirm) - (set! (-> obj selected-entry-index) -1)) + (set! (-> this selected-entry-index) -1)) ((cpad-pressed? 0 triangle) - (set! (-> obj selected-entry-index) -1)) + (set! (-> this selected-entry-index) -1)) ;; keybinds ((nonzero? (-> *progress-pc-generic-store* keybind-select-time)) ;; when the bind has been set, or it's expired (when (or (not (pc-waiting-for-bind?)) (>= (- (current-time) (the-as int (-> *progress-pc-generic-store* keybind-select-time))) (seconds 5.0))) (set! (-> *progress-pc-generic-store* keybind-select-time) 0) - (set! (-> obj selected-entry-index) -1) + (set! (-> this selected-entry-index) -1) (set! (-> progress selected-option) #f) (cond ((not (pc-waiting-for-bind?)) @@ -459,33 +461,33 @@ (pc-stop-waiting-for-bind!) (sound-play "roll-over"))))))) ;; propagate event to menu-option - (when (< (-> *progress-pc-generic-store* current-menu-hover-index) (-> obj entries length)) - (respond-progress (-> obj entries (-> *progress-pc-generic-store* current-menu-hover-index)) progress selected?)) + (when (< (-> *progress-pc-generic-store* current-menu-hover-index) (-> this entries length)) + (respond-progress (-> this entries (-> *progress-pc-generic-store* current-menu-hover-index)) progress selected?)) 0) -(defmethod respond-progress ((obj menu-generic-details-keybind-entry) (progress progress) (selected? symbol)) +(defmethod respond-progress ((this menu-generic-details-keybind-entry) (progress progress) (selected? symbol)) (when (not selected?) (cond ((cpad-pressed? 0 confirm) - (let ((bind-info (-> obj bind-info))) + (let ((bind-info (-> this bind-info))) (pc-set-waiting-for-bind! (-> bind-info device-type) (not (-> bind-info for-buttons?)) (-> bind-info analog-min-range?) (-> bind-info input-idx))) (set! (-> *progress-pc-generic-store* keybind-select-time) (current-time))))) 0) -(defmethod respond-progress ((obj menu-generic-details-confirm-entry) (progress progress) (selected? symbol)) +(defmethod respond-progress ((this menu-generic-details-confirm-entry) (progress progress) (selected? symbol)) (if selected? (cond ((cpad-pressed? 0 left l-analog-left right l-analog-right) - (if (-> obj confirmed?) - (set! (-> obj confirmed?) #f) - (set! (-> obj confirmed?) #t)) + (if (-> this confirmed?) + (set! (-> this confirmed?) #f) + (set! (-> this confirmed?) #t)) (sound-play "generic-beep")) ((cpad-pressed? 0 confirm) - (call-on-confirm obj) + (call-on-confirm this) (sound-play "generic-beep"))) (cond ((cpad-pressed? 0 confirm) - (set! (-> obj confirmed?) #f)))) + (set! (-> this confirmed?) #f)))) 0) ;; - rest of component logic diff --git a/goal_src/jak2/pc/progress/progress-h-pc.gc b/goal_src/jak2/pc/progress/progress-h-pc.gc index b28420bb9b..53a0217ebe 100644 --- a/goal_src/jak2/pc/progress/progress-h-pc.gc +++ b/goal_src/jak2/pc/progress/progress-h-pc.gc @@ -14,32 +14,15 @@ (push-state ,progress) (set-next-state ,progress ,state 0))) - - -(deftype menu-display-mode-option (menu-option) - () - ) - - -(deftype menu-aspect-ratio-pc-option (menu-option) - () - ) - - -(deftype menu-on-off-vsync-option (menu-on-off-option) - () - ) - - (deftype menu-aspect-ratio-custom-option (menu-option) () ) -(deftype menu-frame-rate-option (menu-option) +(deftype menu-frame-rate-disclaimer-option (menu-option) () ) -(deftype menu-frame-rate-disclaimer-option (menu-option) +(deftype menu-exit-game-option (menu-yes-no-option) () ) diff --git a/goal_src/jak2/pc/progress/progress-pc.gc b/goal_src/jak2/pc/progress/progress-pc.gc index 7262bb42c4..38936350b1 100644 --- a/goal_src/jak2/pc/progress/progress-pc.gc +++ b/goal_src/jak2/pc/progress/progress-pc.gc @@ -13,14 +13,10 @@ (deftype progress-global-state-pc (basic) ((decoration-draw-time uint64) - (display-mode-choice-index int8) - - (aspect-ratio-choice-index int8) (aspect-ratio-ratio-index int8) (frame-rate-choice-index int8) (frame-rate-disclaimer-time time-frame) - (frame-rate-disclaimer-seen? symbol) (music-player-track music-player-track-info) (music-player-flava int8) @@ -31,41 +27,17 @@ (define *progress-state-pc* (new 'static 'progress-global-state-pc :music-player-track #f)) - (defmacro when-not-drawn-decoration (&rest body) `(when (> (-> *display* real-clock integral-frame-counter) (-> *progress-state-pc* decoration-draw-time)) ,@body (set! (-> *progress-state-pc* decoration-draw-time) (-> *display* real-clock integral-frame-counter)))) - - -(defun set-progress-aspect-ratio-pc-index () - "set the progress aspect ratio option index accordingly" - (cond - ((not (-> *pc-settings* use-vis?)) - (if (-> *pc-settings* aspect-ratio-auto?) - (set! (-> *progress-state-pc* aspect-ratio-choice-index) 2) - (set! (-> *progress-state-pc* aspect-ratio-choice-index) 3)) - ) - (else - (case (get-aspect-ratio) - (('aspect16x9) - (set! (-> *progress-state-pc* aspect-ratio-choice-index) 1)) - (else - (set! (-> *progress-state-pc* aspect-ratio-choice-index) 0))) - ) - )) - -(defun set-progress-display-mode-index () - "set the progress display mode option index accordingly" - (case (-> *pc-settings* display-mode) - (('windowed #f) (set! (-> *progress-state-pc* display-mode-choice-index) 0)) - (('fullscreen) (set! (-> *progress-state-pc* display-mode-choice-index) 1)) - (('borderless) (set! (-> *progress-state-pc* display-mode-choice-index) 2)) - )) - -(defun set-progress-frame-rate-index () +(defun set-progress-frame-rate-index ((idx int)) "Set the frame rate option index accordingly." + (when idx + (set! (-> *progress-state-pc* frame-rate-choice-index) idx) + (return 0) + ) ;; default to 60 fps (set! (-> *progress-state-pc* frame-rate-choice-index) 0) ;; lookup entry that matches @@ -147,14 +119,7 @@ ;; PC STATE BEGIN ;; -------------- (init! *progress-pc-generic-store*) - - ;; set aspect ratio options - (set-progress-aspect-ratio-pc-index) - (set-progress-display-mode-index) - (set-progress-frame-rate-index) - (set! (-> (the menu-on-off-option (-> *graphic-options-pc* options 3)) value-to-modify) (&-> *pc-settings* vsync?)) (set! (-> *progress-state-pc* music-player-track) #f) - (false! (-> *progress-state-pc* frame-rate-disclaimer-seen?)) ) (defun progress-pc-fetch-external-times ((highscore-index int)) @@ -210,6 +175,10 @@ (set! (-> obj current-options) (if (demo?) *game-options-demo* *game-options-pc*)) ) + (('game-options-title) + (set! (-> obj current-options) + (if (demo?) *game-options-demo* *game-options-title-pc*)) + ) (('graphic-options) (set! (-> obj current-options) *graphic-options-pc*) ) @@ -282,10 +251,10 @@ (set! (-> obj current-options) *quit-options*) ) (('title) - (set! (-> obj current-options) *title*) + (set! (-> obj current-options) *title-pc*) ) (('title-options) - (set! (-> obj current-options) *options*) + (set! (-> obj current-options) *options-pc*) ) (('select-start 'select-pre-start 'select-kiosk-start) (set! (-> obj current-options) *select-start-options*) @@ -375,6 +344,7 @@ (set! (-> obj current-options) *music-player-options*) ) (('fps-disclaimer) + (set-time! (-> *progress-state-pc* frame-rate-disclaimer-time)) (set! (-> obj current-options) *frame-rate-disclaimer-options*) ) (('generic-menu) @@ -412,92 +382,6 @@ (defmacro min-max-wrap-around+! (var inc minimum maximum) `(set! ,var (min-max-wrap-around (+ ,var ,inc) ,minimum ,maximum))) - - -(defmethod respond-progress ((obj menu-aspect-ratio-pc-option) (arg0 progress) (arg1 symbol)) - "Handle progress menu navigation logic." - - (when arg1 - (cond - ((cpad-pressed? 0 triangle) - (set-progress-aspect-ratio-pc-index)) - ((cpad-pressed? 0 confirm) - (sound-play "generic-beep") - (case (-> *progress-state-pc* aspect-ratio-choice-index) - ((0) - (if (not (-> *pc-settings* use-vis?)) - (set! (-> *setting-control* user-current aspect-ratio) #f)) - (set! (-> *setting-control* user-default aspect-ratio) 'aspect4x3) - (true! (-> *pc-settings* use-vis?)) - ) - ((1) - (if (not (-> *pc-settings* use-vis?)) - (set! (-> *setting-control* user-current aspect-ratio) #f)) - (set! (-> *setting-control* user-default aspect-ratio) 'aspect16x9) - (true! (-> *pc-settings* use-vis?)) - ) - ((2) - (set! (-> *setting-control* user-default aspect-ratio) 'aspect4x3) - (true! (-> *pc-settings* aspect-ratio-auto?)) - (false! (-> *pc-settings* use-vis?)) - ) - ((3) - (cpad-clear! 0 confirm) - (push-and-set-state arg0 'aspect-ratio-custom) - ) - ) - ) - (else - (let ((sound-beep? #f)) - (when (cpad-pressed? 0 left l-analog-left) - (true! sound-beep?) - (min-max-wrap-around+! (-> *progress-state-pc* aspect-ratio-choice-index) -1 0 3)) - (when (cpad-pressed? 0 right l-analog-right) - (true! sound-beep?) - (min-max-wrap-around+! (-> *progress-state-pc* aspect-ratio-choice-index) 1 0 3)) - - (if sound-beep? - (sound-play "generic-beep"))) - ) - ) - ) - 0 - ) - - -(defmethod respond-progress ((obj menu-display-mode-option) (arg0 progress) (arg1 symbol)) - "Handle progress menu navigation logic." - - (when arg1 - (cond - ((cpad-pressed? 0 triangle) - (set-progress-display-mode-index)) - ((cpad-pressed? 0 confirm) - (sound-play "generic-beep") - (case (-> *progress-state-pc* display-mode-choice-index) - ((0) (set-display-mode! *pc-settings* 'windowed #t)) - ((1) (set-display-mode! *pc-settings* 'fullscreen #t)) - ((2) (set-display-mode! *pc-settings* 'borderless #t)) - ) - ) - (else - (let ((sound-beep? #f)) - (when (cpad-pressed? 0 left l-analog-left) - (true! sound-beep?) - (min-max-wrap-around+! (-> *progress-state-pc* display-mode-choice-index) -1 0 2)) - (when (cpad-pressed? 0 right l-analog-right) - (true! sound-beep?) - (min-max-wrap-around+! (-> *progress-state-pc* display-mode-choice-index) 1 0 2)) - - (if sound-beep? - (sound-play "generic-beep"))) - ) - ) - ) - 0 - ) - - (defmethod respond-progress ((obj menu-aspect-ratio-custom-option) (arg0 progress) (arg1 symbol)) "Handle progress menu navigation logic." @@ -552,45 +436,6 @@ 0 ) -(defmethod respond-progress ((obj menu-frame-rate-option) (arg0 progress) (arg1 symbol)) - "Handle progress menu navigation logic." - - (when arg1 - (cond - ((cpad-pressed? 0 triangle) - (set-progress-frame-rate-index)) - ((cpad-pressed? 0 confirm) - (sound-play "generic-beep") - (cond - ((not (-> *progress-state-pc* frame-rate-disclaimer-seen?)) - (set-time! (-> *progress-state-pc* frame-rate-disclaimer-time)) - (push-and-set-state arg0 'fps-disclaimer) - ) - (else - (set-frame-rate! *pc-settings* (-> *frame-rate-options* (-> *progress-state-pc* frame-rate-choice-index)) #t) - (commit-to-file *pc-settings*) - )) - ) - (else - (let ((sound-beep? #f)) - (when (cpad-pressed? 0 left l-analog-left) - (true! sound-beep?) - (min-max-wrap-around+! (-> *progress-state-pc* frame-rate-choice-index) -1 0 (1- (-> *frame-rate-options* length))) - ) - (when (cpad-pressed? 0 right l-analog-right) - (true! sound-beep?) - (min-max-wrap-around+! (-> *progress-state-pc* frame-rate-choice-index) 1 0 (1- (-> *frame-rate-options* length))) - ) - (if sound-beep? - (sound-play "generic-beep") - ) - ) - ) - ) - ) - 0 - ) - (defmethod respond-progress menu-frame-rate-disclaimer-option ((this menu-frame-rate-disclaimer-option) (arg0 progress) (arg1 symbol)) "Handle progress menu navigation logic." (when (time-elapsed? (-> *progress-state-pc* frame-rate-disclaimer-time) (seconds 3)) @@ -610,7 +455,7 @@ (cpad-clear! 0 confirm) (cond ((-> *progress-state* yes-no-choice) - (true! (-> *progress-state-pc* frame-rate-disclaimer-seen?)) + (true! *frame-rate-disclaimer-seen?*) (sound-play "generic-beep") (set-frame-rate! *pc-settings* (-> *frame-rate-options* (-> *progress-state-pc* frame-rate-choice-index)) #t) (commit-to-file *pc-settings*) @@ -618,7 +463,7 @@ ) (else (sound-play "generic-beep") - (set-progress-frame-rate-index) + (set-progress-frame-rate-index (the int #f)) (pop-state arg0) ) ) @@ -944,3 +789,93 @@ (when play-sound? (sound-play "score-slide")))) 0) + +(defmethod respond-progress ((this menu-sub-menu-option) (arg0 progress) (arg1 symbol)) + "Handle progress menu navigation logic." + (when (and (-> *progress-state* secrets-unlocked) + (not (memcard-unlocked-secrets? #f)) + (or (= (-> arg0 current-options) *title-pc*) + (= (-> arg0 current-options) *unlocked-secrets*) + (= (-> arg0 current-options) *select-scene-options*) + (= (-> arg0 current-options) *select-start-options*) + (= (-> arg0 current-options) *save-options-title*) + ) + ) + (set! (-> *progress-state* secrets-unlocked) #f) + (set! (-> arg0 state-pos) 0) + (set-next-state arg0 'secrets-insufficient-space 0) + ) + (when (= (-> this name) (text-id progress-continue-without-saving)) + (let ((a1-3 (get-state-check-card arg0 (-> arg0 current)))) + (set-next-state arg0 a1-3 0) + ) + ) + (when (and (= (-> this name) (text-id progress-root-secrets)) + (= *title-pc* (-> arg0 current-options)) + (not (memcard-unlocked-secrets? #f)) + (= (-> arg0 option-index) 4) + ) + (set! (-> arg0 option-index) 0) + 0 + ) + (when (cpad-pressed? 0 confirm) + (cpad-clear! 0 confirm) + (cond + ((= (-> this name) (text-id progress-demo-exit)) + (case *kernel-boot-message* + (('demo-shared) + (set! *master-exit* 'force) + (set-master-mode 'game) + ) + (('demo) + (set! (-> *game-info* mode) 'play) + (initialize! *game-info* 'game (the-as game-save #f) "demo-restart") + ) + ) + ) + ((= (-> this name) (text-id progress-continue-without-saving)) + (progress-intro-start (logtest? (-> *game-info* purchase-secrets) (game-secrets hero-mode))) + ) + ((= (-> this next-state) 'back) + (pop-state arg0) + ) + (else + (sound-play "generic-beep") + (push-state arg0) + (set-next-state arg0 (-> this next-state) 0) + ) + ) + ) + 0 + ) + +(defmethod respond-progress ((this menu-exit-game-option) (arg0 progress) (selected? symbol)) + "Handle progress menu navigation logic." + (let ((choice (&-> *progress-state* yes-no-choice)) + (gp-0 #f) + ) + (when selected? + (cond + ((cpad-pressed? 0 left l-analog-left) + (when (not (-> choice 0)) + (set! gp-0 #t) + (set! (-> choice 0) #t) + ) + ) + ((cpad-pressed? 0 right l-analog-right) + (set! gp-0 (-> choice 0)) + (set! (-> choice 0) #f) + ) + ((cpad-pressed? 0 confirm) + (if (-> choice 0) + (kernel-shutdown (runtime-exit-status exit)) + ) + ) + ) + ) + (if gp-0 + (sound-play "generic-beep") + ) + ) + 0 + ) \ No newline at end of file diff --git a/goal_src/jak2/pc/progress/progress-static-pc.gc b/goal_src/jak2/pc/progress/progress-static-pc.gc index e31b6dcb59..47b981109a 100644 --- a/goal_src/jak2/pc/progress/progress-static-pc.gc +++ b/goal_src/jak2/pc/progress/progress-static-pc.gc @@ -11,6 +11,60 @@ This gives us more freedom to write code how we want. ;; in jak 2, the options dont have to be all-caps anymore! ;; encode controller/display names - current bug waiting to happen +(define *title-pc* + (new 'static 'menu-option-list + :y-center #xc6 + :y-space 30 + :scale 0.82 + :options (new 'static 'boxed-array :type menu-option + (new 'static 'menu-sub-menu-option + :name (text-id progress-title-new-game) + :scale #t + :next-state 'select-save-title + ) + (new 'static 'menu-sub-menu-option :name (text-id progress-load-game) :scale #t :next-state 'select-load) + (new 'static 'menu-sub-menu-option + :name (text-id progress-title-options) + :scale #t + :next-state 'title-options + ) + (new 'static 'menu-sub-menu-option + :name (text-id progress-root-secrets) + :scale #t + :next-state 'unlocked-secrets + ) + (new 'static 'menu-exit-game-option + :name (text-id progress-quit) + :scale #f + ) + ) + ) + ) + +(define *options-pc* (new 'static 'menu-option-list + :y-center #xc6 + :y-space 30 + :scale 0.82 + :options (new 'static 'boxed-array :type menu-option + (new 'static 'menu-sub-menu-option + :name (text-id progress-root-game-options) + :scale #t + :next-state 'game-options-title + ) + (new 'static 'menu-sub-menu-option + :name (text-id progress-root-graphic-options) + :scale #t + :next-state 'graphic-options + ) + (new 'static 'menu-sub-menu-option + :name (text-id progress-root-sound-options) + :scale #t + :next-state 'sound-options + ) + ) + ) + ) + (define *game-options-pc* (progress-new-generic-scrolling-page (text-id progress-root-game-options) (progress-new-generic-link-to-scrolling-page (text-id progress-menu-input-options) @@ -310,40 +364,559 @@ This gives us more freedom to write code how we want. :get-value-fn (lambda () (-> *pc-settings* speedrunner-mode?)) :on-confirm (lambda ((val symbol)) (set! (-> *pc-settings* speedrunner-mode?) val) - (commit-to-file *pc-settings*)))))) + (commit-to-file *pc-settings*))) + (new 'static 'menu-generic-boolean-option + :name (text-id progress-fast-progress) + :truthy-text (text-id progress-on) + :falsey-text (text-id progress-off) + :get-value-fn (lambda () (-> *pc-settings* fast-progress?)) + :on-confirm (lambda ((val symbol)) + (set! (-> *pc-settings* fast-progress?) val) + (commit-to-file *pc-settings*)))))) + +(define *game-options-title-pc* + (progress-new-generic-scrolling-page (text-id progress-root-game-options) + (progress-new-generic-link-to-scrolling-page (text-id progress-menu-input-options) + (progress-new-generic-link-to-scrolling-page (text-id progress-camera-options) + (new 'static 'menu-generic-boolean-option + :name (text-id progress-camera-options-first-horz) + :truthy-text (text-id progress-normal) + :falsey-text (text-id progress-inverted) + :get-value-fn (lambda () (-> *pc-settings* first-camera-h-inverted?)) + :on-confirm (lambda ((val symbol)) + (set! (-> *pc-settings* first-camera-h-inverted?) val) + (commit-to-file *pc-settings*))) + (new 'static 'menu-generic-boolean-option + :name (text-id progress-camera-options-first-vert) + :truthy-text (text-id progress-normal) + :falsey-text (text-id progress-inverted) + :get-value-fn (lambda () (-> *pc-settings* first-camera-v-inverted?)) + :on-confirm (lambda ((val symbol)) + (set! (-> *pc-settings* first-camera-v-inverted?) val) + (commit-to-file *pc-settings*))) + (new 'static 'menu-generic-boolean-option + :name (text-id progress-camera-options-third-horz) + :truthy-text (text-id progress-normal) + :falsey-text (text-id progress-inverted) + :get-value-fn (lambda () (-> *pc-settings* third-camera-h-inverted?)) + :on-confirm (lambda ((val symbol)) + (set! (-> *pc-settings* third-camera-h-inverted?) val) + (commit-to-file *pc-settings*))) + (new 'static 'menu-generic-boolean-option + :name (text-id progress-camera-options-third-vert) + :truthy-text (text-id progress-normal) + :falsey-text (text-id progress-inverted) + :get-value-fn (lambda () (-> *pc-settings* third-camera-v-inverted?)) + :on-confirm (lambda ((val symbol)) + (set! (-> *pc-settings* third-camera-v-inverted?) val) + (commit-to-file *pc-settings*))) + (new 'static 'menu-generic-confirm-option + :name (text-id progress-restore-defaults) + :on-confirm (lambda ((val symbol)) + (reset-camera *pc-settings* #t) + (commit-to-file *pc-settings*)))) + (progress-new-generic-link-to-scrolling-page (text-id progress-menu-controller-options) :should-disable? (lambda () (<= (pc-get-controller-count) 0)) + (new 'static 'menu-generic-carousel-option + :name (text-id progress-controller-options-select-controller) + :get-max-size-fn (lambda () (pc-get-controller-count)) + :get-item-label-fn (lambda ((index int)) + (pc-get-controller-name index *pc-cpp-temp-string*) + *pc-cpp-temp-string*) + :get-item-index-fn (lambda () 0) + :on-confirm (lambda ((index int)) (pc-set-controller! 0 index))) + (new 'static 'menu-generic-boolean-option + :name (text-id progress-vibration) + :should-disable? (lambda () (not (pc-current-controller-has-rumble?))) + :truthy-text (text-id progress-on) + :falsey-text (text-id progress-off) + :get-value-fn (lambda () (-> *setting-control* user-default vibration)) + :on-confirm (lambda ((val symbol)) (set! (-> *setting-control* user-default vibration) val))) + (new 'static 'menu-generic-slider-option + :name (text-id progress-controller-options-analog-deadzone) + :min-value 0.0 + :max-value 1.0 + :step 0.01 + :show-decimal? #t + :get-value-fn (lambda () (-> *pc-settings* stick-deadzone)) + :on-confirm (lambda ((val float)) + (set! (-> *pc-settings* stick-deadzone) val) + (commit-to-file *pc-settings*))) + (new 'static 'menu-generic-boolean-option + :name (text-id progress-controller-options-ignore-if-unfocused) + :truthy-text (text-id progress-on) + :falsey-text (text-id progress-off) + :get-value-fn (lambda () (-> *pc-settings* ignore-controller-win-unfocused?)) + :on-confirm (lambda ((val symbol)) + (set! (-> *pc-settings* ignore-controller-win-unfocused?) val) + (commit-to-file *pc-settings*))) + (new 'static 'menu-generic-boolean-option + :name (text-id progress-controller-options-led-hp) + :should-disable? (lambda () (not (pc-current-controller-has-led?))) + :truthy-text (text-id progress-on) + :falsey-text (text-id progress-off) + :get-value-fn (lambda () (-> *pc-settings* controller-led-hp?)) + :on-confirm (lambda ((val symbol)) + (set! (-> *pc-settings* controller-led-hp?) val) + (commit-to-file *pc-settings*))) + (new 'static 'menu-generic-boolean-option + :name (text-id progress-controller-options-led-state) + :should-disable? (lambda () (not (pc-current-controller-has-led?))) + :truthy-text (text-id progress-on) + :falsey-text (text-id progress-off) + :get-value-fn (lambda () (-> *pc-settings* controller-led-eco?)) + :on-confirm (lambda ((val symbol)) + (set! (-> *pc-settings* controller-led-eco?) val) + (commit-to-file *pc-settings*))) + (new 'static 'menu-generic-confirm-option + :name (text-id progress-restore-defaults) + :on-confirm (lambda ((val symbol)) + (reset-input *pc-settings* 'controller #t) + (set-ignore-controller-in-bg! *pc-settings* (-> *pc-settings* ignore-controller-win-unfocused?)) + (commit-to-file *pc-settings*)))) + (new 'static 'menu-generic-boolean-option + :name (text-id progress-input-options-enable-keyboard) + :truthy-text (text-id progress-on) + :falsey-text (text-id progress-off) + :get-value-fn (lambda () (-> *pc-settings* keyboard-enabled?)) + :on-confirm (lambda ((val symbol)) + (set! (-> *pc-settings* keyboard-enabled?) val) + (commit-to-file *pc-settings*))) + (new 'static 'menu-generic-boolean-option + :name (text-id progress-input-options-enable-mouse) + :truthy-text (text-id progress-on) + :falsey-text (text-id progress-off) + :get-value-fn (lambda () (-> *pc-settings* mouse-enabled?)) + :on-confirm (lambda ((val symbol)) + (set! (-> *pc-settings* mouse-enabled?) val) + (commit-to-file *pc-settings*))) + (progress-new-generic-link-to-scrolling-page (text-id progress-menu-mouse-options) :should-disable? (lambda () (not (-> *pc-settings* mouse-enabled?))) + (new 'static 'menu-generic-boolean-option + :name (text-id progress-mouse-options-track-camera) + :truthy-text (text-id progress-on) + :falsey-text (text-id progress-off) + :get-value-fn (lambda () (-> *pc-settings* mouse-camera?)) + :on-confirm (lambda ((val symbol)) + (set! (-> *pc-settings* mouse-camera?) val) + (commit-to-file *pc-settings*))) + (new 'static 'menu-generic-slider-option + :name (text-id progress-mouse-options-horz-sens) + :should-disable? (lambda () (not (-> *pc-settings* mouse-camera?))) + :min-value -30.0 + :max-value 30.0 + :step 0.10 + :show-decimal? #t + :get-value-fn (lambda () (-> *pc-settings* mouse-xsens)) + :on-confirm (lambda ((val float)) + (set! (-> *pc-settings* mouse-xsens) val) + (commit-to-file *pc-settings*))) + (new 'static 'menu-generic-slider-option + :name (text-id progress-mouse-options-vert-sens) + :should-disable? (lambda () (not (-> *pc-settings* mouse-camera?))) + :min-value -30.0 + :max-value 30.0 + :step 0.10 + :show-decimal? #t + :get-value-fn (lambda () (-> *pc-settings* mouse-ysens)) + :on-confirm (lambda ((val float)) + (set! (-> *pc-settings* mouse-ysens) val) + (commit-to-file *pc-settings*))) + (new 'static 'menu-generic-boolean-option + :name (text-id progress-mouse-options-player-movement) + :truthy-text (text-id progress-on) + :falsey-text (text-id progress-off) + :get-value-fn (lambda () (-> *pc-settings* mouse-movement?)) + :on-confirm (lambda ((val symbol)) + (set! (-> *pc-settings* mouse-movement?) val) + (commit-to-file *pc-settings*))) + (new 'static 'menu-generic-confirm-option + :name (text-id progress-restore-defaults) + :on-confirm (lambda ((val symbol)) + (reset-input *pc-settings* 'mouse #t) + (update-mouse-controls! *pc-settings*) + (commit-to-file *pc-settings*)))) + (new 'static 'menu-generic-boolean-option + :name (text-id progress-input-options-auto-hide-cursor) + :truthy-text (text-id progress-on) + :falsey-text (text-id progress-off) + :get-value-fn (lambda () (-> *pc-settings* auto-hide-cursor?)) + :on-confirm (lambda ((val symbol)) + (set! (-> *pc-settings* auto-hide-cursor?) val) + (update-mouse-controls! *pc-settings*) + (commit-to-file *pc-settings*))) + ;; TODO - there is a bug where if you restore default binds and that changes your `X` bind, + ;; the next X input is ignored, figure this out eventually / make an issue for it. + (progress-new-generic-link-to-scrolling-page (text-id progress-menu-reassign-binds) + (progress-new-generic-link-to-details-page (text-id progress-reassign-binds-controller) :should-disable? (lambda () (<= (pc-get-controller-count) 0)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind select) :device-type (input-device-type controller)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind l3) :device-type (input-device-type controller)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind r3) :device-type (input-device-type controller)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind start) :device-type (input-device-type controller)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind dpad-up) :device-type (input-device-type controller)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind dpad-right) :device-type (input-device-type controller)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind dpad-down) :device-type (input-device-type controller)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind dpad-left) :device-type (input-device-type controller)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind l2) :device-type (input-device-type controller)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind r2) :device-type (input-device-type controller)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind l1) :device-type (input-device-type controller)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind r1) :device-type (input-device-type controller)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind triangle) :device-type (input-device-type controller)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind circle) :device-type (input-device-type controller)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind cross) :device-type (input-device-type controller)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind square) :device-type (input-device-type controller)) + (new 'static 'menu-generic-details-confirm-entry + :name (text-id progress-restore-defaults) + :on-confirm (lambda () (pc-reset-bindings-to-defaults! 0 0)))) + (progress-new-generic-link-to-details-page (text-id progress-reassign-binds-keyboard) :should-disable? (lambda () (not (-> *pc-settings* keyboard-enabled?))) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind l-analog-up) :device-type (input-device-type keyboard)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind l-analog-down) :device-type (input-device-type keyboard)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind l-analog-left) :device-type (input-device-type keyboard)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind l-analog-right) :device-type (input-device-type keyboard)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind r-analog-up) :device-type (input-device-type keyboard)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind r-analog-down) :device-type (input-device-type keyboard)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind r-analog-left) :device-type (input-device-type keyboard)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind r-analog-right) :device-type (input-device-type keyboard)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind select) :device-type (input-device-type keyboard)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind l3) :device-type (input-device-type keyboard)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind r3) :device-type (input-device-type keyboard)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind start) :device-type (input-device-type keyboard)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind dpad-up) :device-type (input-device-type keyboard)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind dpad-right) :device-type (input-device-type keyboard)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind dpad-down) :device-type (input-device-type keyboard)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind dpad-left) :device-type (input-device-type keyboard)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind l2) :device-type (input-device-type keyboard)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind r2) :device-type (input-device-type keyboard)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind l1) :device-type (input-device-type keyboard)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind r1) :device-type (input-device-type keyboard)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind triangle) :device-type (input-device-type keyboard)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind circle) :device-type (input-device-type keyboard)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind cross) :device-type (input-device-type keyboard)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind square) :device-type (input-device-type keyboard)) + (new 'static 'menu-generic-details-confirm-entry + :name (text-id progress-restore-defaults) + :on-confirm (lambda () (pc-reset-bindings-to-defaults! 0 1)))) + (progress-new-generic-link-to-details-page (text-id progress-reassign-binds-mouse) :should-disable? (lambda () (not (-> *pc-settings* mouse-enabled?))) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind select) :device-type (input-device-type mouse)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind l3) :device-type (input-device-type mouse)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind r3) :device-type (input-device-type mouse)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind start) :device-type (input-device-type mouse)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind dpad-up) :device-type (input-device-type mouse)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind dpad-right) :device-type (input-device-type mouse)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind dpad-down) :device-type (input-device-type mouse)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind dpad-left) :device-type (input-device-type mouse)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind l2) :device-type (input-device-type mouse)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind r2) :device-type (input-device-type mouse)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind l1) :device-type (input-device-type mouse)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind r1) :device-type (input-device-type mouse)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind triangle) :device-type (input-device-type mouse)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind circle) :device-type (input-device-type mouse)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind cross) :device-type (input-device-type mouse)) + (new 'static 'menu-generic-details-keybind-entry :keybind (controller-keybind square) :device-type (input-device-type mouse)) + (new 'static 'menu-generic-details-confirm-entry + :name (text-id progress-restore-defaults) + :on-confirm (lambda () (pc-reset-bindings-to-defaults! 0 2))))) + (new 'static 'menu-generic-confirm-option + :name (text-id progress-restore-defaults) + :on-confirm (lambda ((val symbol)) + (reset-input *pc-settings* 'input #t) + (set-enable-keyboard! *pc-settings* (-> *pc-settings* keyboard-enabled?)) + (update-mouse-controls! *pc-settings*) + (commit-to-file *pc-settings*)))) + (new 'static 'menu-generic-boolean-option + :name (text-id progress-subtitles) + :truthy-text (text-id progress-on) + :falsey-text (text-id progress-off) + :get-value-fn (lambda () (-> *setting-control* user-default subtitle)) + :on-confirm (lambda ((val symbol)) (set! (-> *setting-control* user-default subtitle) val))) + (new 'static 'menu-generic-carousel-option + :name (text-id progress-sound-subtitle-language) + :items (new 'static 'boxed-array :type text-id + (text-id language-name-english) + (text-id language-name-french) + (text-id language-name-german) + (text-id language-name-spanish) + (text-id language-name-italian) + (text-id language-name-japanese) + (text-id language-name-korean) + (text-id language-name-english-uk)) + :get-item-index-fn (lambda () (-> *setting-control* user-default subtitle-language)) + :on-confirm (lambda ((index int)) (set! (-> *setting-control* user-default subtitle-language) + (the-as language-enum index)))) + (new 'static 'menu-generic-carousel-option + :name (text-id progress-sound-language) + :items (new 'static 'boxed-array :type text-id + (text-id language-name-english) + (text-id language-name-french) + (text-id language-name-german) + (text-id language-name-spanish) + (text-id language-name-italian) + (text-id language-name-japanese) + (text-id language-name-korean) + (text-id language-name-english-uk)) + :get-item-index-fn (lambda () (-> *setting-control* user-default language)) + :on-confirm (lambda ((index int)) (set! (-> *setting-control* user-default language) (the-as language-enum index)) + ;; NOTE - this doesn't actually work (naughty dog tried it too in their progress code) + ;; fix it eventually + (load-level-text-files (the-as int (-> *setting-control* user-default language))))) + (progress-new-generic-link-to-scrolling-page (text-id progress-misc-game-options) + (new 'static 'menu-generic-boolean-option + :name (text-id progress-discord-rpc) + :truthy-text (text-id progress-on) + :falsey-text (text-id progress-off) + :get-value-fn (lambda () (-> *pc-settings* discord-rpc?)) + :on-confirm (lambda ((val symbol)) + (set! (-> *pc-settings* discord-rpc?) val) + (commit-to-file *pc-settings*))) + (new 'static 'menu-generic-boolean-option + :name (text-id progress-speedrunner-mode) + :truthy-text (text-id progress-on) + :falsey-text (text-id progress-off) + :get-value-fn (lambda () (-> *pc-settings* speedrunner-mode?)) + :on-confirm (lambda ((val symbol)) + (set! (-> *pc-settings* speedrunner-mode?) val) + (commit-to-file *pc-settings*))) + (new 'static 'menu-generic-boolean-option + :name (text-id progress-fast-airlock) + :truthy-text (text-id progress-on) + :falsey-text (text-id progress-off) + :get-value-fn (lambda () (-> *pc-settings* fast-airlock?)) + :on-confirm (lambda ((val symbol)) + (set! (-> *pc-settings* fast-airlock?) val) + (commit-to-file *pc-settings*))) + (new 'static 'menu-generic-boolean-option + :name (text-id progress-fast-elevator) + :truthy-text (text-id progress-on) + :falsey-text (text-id progress-off) + :get-value-fn (lambda () (-> *pc-settings* fast-elevator?)) + :on-confirm (lambda ((val symbol)) + (set! (-> *pc-settings* fast-elevator?) val) + (commit-to-file *pc-settings*))) + (new 'static 'menu-generic-boolean-option + :name (text-id progress-fast-progress) + :truthy-text (text-id progress-on) + :falsey-text (text-id progress-off) + :get-value-fn (lambda () (-> *pc-settings* fast-progress?)) + :on-confirm (lambda ((val symbol)) + (set! (-> *pc-settings* fast-progress?) val) + (commit-to-file *pc-settings*)))))) ;; TODO - migrate this menu as well ;; graphic options ;; resolution -;; display mode -;; display select (disable if windowed) -;; vsync -;; aspect ratio -;; msaa -;; frame rate (dont go beyond refresh rate) (disable if SRMode) -;; ps2 options -;; lod bg -;; lod fg -;; particle culling -;; force env mapping -;; actor culling + +(define *msaa-options* (new 'static 'boxed-array :type int16 1 2 4 8 16)) +(define *frame-rate-options* (new 'static 'boxed-array :type int16 60 75 120 144 165 240)) +(define *frame-rate-disclaimer-seen?* #f) + (define *graphic-options-pc* - (new 'static 'menu-option-list - :y-center 198 - :y-space 34 - :scale 0.82 - :options (new 'static 'boxed-array :type menu-option - (new 'static 'menu-display-mode-option :name (text-id progress-display-mode)) - (new 'static 'menu-aspect-ratio-pc-option :name (text-id progress-aspect-ratio)) - (new 'static 'menu-frame-rate-option :name (text-id progress-frame-rate)) - (new 'static 'menu-on-off-vsync-option :name (text-id progress-vsync)) + (progress-new-generic-scrolling-page (text-id progress-root-graphic-options) + (progress-new-generic-link-to-scrolling-page (text-id progress-graphics-ps2) + (new 'static 'menu-generic-carousel-option + :name (text-id progress-lod-bg) + :items (new 'static 'boxed-array :type text-id + (text-id progress-lod-high) + (text-id progress-lod-default) + (text-id progress-lod-low) + ) + :get-item-index-fn (lambda () (-> *pc-settings* lod-force-tfrag)) + :on-confirm (lambda ((index int)) + (set! (-> *pc-settings* lod-force-tfrag) index) + (set! (-> *pc-settings* lod-force-tie) index) + (commit-to-file *pc-settings*) + ) + ) + (new 'static 'menu-generic-carousel-option + :name (text-id progress-lod-fg) + :items (new 'static 'boxed-array :type text-id + (text-id progress-lod-high) + (text-id progress-lod-default) + (text-id progress-lod-low) + ) + :get-item-index-fn (lambda () (-> *pc-settings* lod-force-actor)) + :on-confirm (lambda ((index int)) + (set! (-> *pc-settings* lod-force-actor) index) + (commit-to-file *pc-settings*) + ) + ) + (new 'static 'menu-generic-boolean-option + :name (text-id progress-graphics-ps2-lod-dist) + :truthy-text (text-id progress-on) + :falsey-text (text-id progress-off) + :get-value-fn (lambda () (-> *pc-settings* ps2-lod-dist?)) + :on-confirm (lambda ((val symbol)) + (set! (-> *pc-settings* ps2-lod-dist?) val) + (commit-to-file *pc-settings*))) + (new 'static 'menu-generic-boolean-option + :name (text-id progress-ps2-parts) + :truthy-text (text-id progress-on) + :falsey-text (text-id progress-off) + :get-value-fn (lambda () (-> *pc-settings* ps2-parts?)) + :on-confirm (lambda ((val symbol)) + (set! (-> *pc-settings* ps2-parts?) val) + (commit-to-file *pc-settings*))) + (new 'static 'menu-generic-boolean-option + :name (text-id progress-hires-sky) + :truthy-text (text-id progress-on) + :falsey-text (text-id progress-off) + :get-value-fn (lambda () (-> *pc-settings* hires-clouds?)) + :on-confirm (lambda ((val symbol)) + (set! (-> *pc-settings* hires-clouds?) val) + (commit-to-file *pc-settings*))) + ) + (new 'static 'menu-generic-carousel-option + :name (text-id progress-graphics-display) + :get-item-index-fn (lambda () (-> *pc-settings* monitor)) + :get-max-size-fn (lambda () (pc-get-display-count)) + :get-item-label-fn (lambda ((index int)) + (let ((name (pc-get-display-name index *pc-cpp-temp-string*))) + (if name + (string-format "(~D) ~S" index *pc-cpp-temp-string*) + (string-format "Display ~D" index) + ) + ) + ) + :on-confirm (lambda ((index int)) + (set-monitor! *pc-settings* index) + (commit-to-file *pc-settings*) + ) + :should-disable? (lambda () (nmember (the basic (-> *pc-settings* display-mode)) '(windowed #f))) + ) + (new 'static 'menu-generic-carousel-option + :name (text-id progress-display-mode) + :items (new 'static 'boxed-array :type text-id + (text-id progress-windowed) + (text-id progress-fullscreen) + (text-id progress-borderless) + ) + :get-item-index-fn (lambda () + (case (-> *pc-settings* display-mode) + (('windowed #f) 0) + (('fullscreen) 1) + (('borderless) 2) + ) + ) + :on-confirm (lambda ((index int)) + (case index + ((0) (set-display-mode! *pc-settings* 'windowed #t)) + ((1) (set-display-mode! *pc-settings* 'fullscreen #t)) + ((2) (set-display-mode! *pc-settings* 'borderless #t)) + ) + (commit-to-file *pc-settings*) + ) + ) + (new 'static 'menu-generic-carousel-option + :name (text-id progress-aspect-ratio) + :items (new 'static 'boxed-array :type text-id + (text-id progress-aspect-ratio-4x3) + (text-id progress-aspect-ratio-16x9) + (text-id progress-aspect-ratio-auto) + (text-id progress-aspect-ratio-custom) + ) + :get-item-index-fn (lambda () + (cond + ((not (-> *pc-settings* use-vis?)) + (if (-> *pc-settings* aspect-ratio-auto?) 2 3) + ) + (else + (case (get-aspect-ratio) + (('aspect16x9) 1) + (else 0) + ) + ) + ) + ) + :on-confirm (lambda ((index int)) + (case index + ((0) + (if (not (-> *pc-settings* use-vis?)) + (false! (-> *setting-control* user-current aspect-ratio)) + ) + (set! (-> *setting-control* user-default aspect-ratio) 'aspect4x3) + (true! (-> *pc-settings* use-vis?)) + (commit-to-file *pc-settings*) + ) + ((1) + (if (not (-> *pc-settings* use-vis?)) + (false! (-> *setting-control* user-current aspect-ratio)) + ) + (set! (-> *setting-control* user-default aspect-ratio) 'aspect16x9) + (true! (-> *pc-settings* use-vis?)) + (commit-to-file *pc-settings*) + ) + ((2) + (set! (-> *setting-control* user-default aspect-ratio) 'aspect4x3) + (true! (-> *pc-settings* aspect-ratio-auto?)) + (false! (-> *pc-settings* use-vis?)) + (commit-to-file *pc-settings*) + ) + ((3) + (push-and-set-state (-> *progress-process* 0) 'aspect-ratio-custom) + ) + ) + ) + ) + (new 'static 'menu-generic-carousel-option + :name (text-id progress-frame-rate) + :get-item-index-fn (lambda () + (case (-> *pc-settings* target-fps) + ((60) 0) + ((75) 1) + ((120) 2) + ((144) 3) + ((165) 4) + ((240) 5) + ) + ) + :get-max-size-fn (lambda () (-> *frame-rate-options* length)) + :get-item-label-fn (lambda ((index int)) (string-format "~D" (-> *frame-rate-options* index))) + :on-confirm (lambda ((index int)) + (cond + ((or (zero? index) (= (-> *frame-rate-options* index) (-> *pc-settings* target-fps)) *frame-rate-disclaimer-seen?*) + (set-frame-rate! *pc-settings* (-> *frame-rate-options* index) #t) + (commit-to-file *pc-settings*) + ) + (else + (defun-extern set-progress-frame-rate-index int int) + (set-progress-frame-rate-index index) + (push-and-set-state (-> *progress-process* 0) 'fps-disclaimer) + ) + ) + ) + ) + (new 'static 'menu-generic-boolean-option + :name (text-id progress-vsync) + :truthy-text (text-id progress-on) + :falsey-text (text-id progress-off) + :get-value-fn (lambda () (-> *pc-settings* vsync?)) + :on-confirm (lambda ((val symbol)) + (set! (-> *pc-settings* vsync?) val) + (commit-to-file *pc-settings*))) + (new 'static 'menu-generic-carousel-option + :name (text-id progress-msaa) + :get-item-index-fn (lambda () + (case (-> *pc-settings* gfx-msaa) + ((1) 0) + ((2) 1) + ((4) 2) + ((8) 3) + ((16) 4) + ) + ) + :get-max-size-fn (lambda () (-> *msaa-options* length)) + :get-item-label-fn (lambda ((index int)) + (if (zero? index) + (lookup-text! *common-text* (text-id progress-graphics-msaa-off) #f) + (string-format (lookup-text! *common-text* (text-id progress-msaa-x) #f) (-> *msaa-options* index)) + ) + ) + :on-confirm (lambda ((index int)) + (set! (-> *pc-settings* gfx-msaa) (the int (pow 2.0 (the float index)))) + (commit-to-file *pc-settings*) + ) ) ) ) -(define *frame-rate-options* (new 'static 'boxed-array :type int16 60 75 120 144 165 240)) - (define *frame-rate-disclaimer-options* (new 'static 'menu-option-list :y-center 198 diff --git a/test/decompiler/reference/jak2/engine/game/main_REF.gc b/test/decompiler/reference/jak2/engine/game/main_REF.gc index ef375bed15..825067cbb3 100644 --- a/test/decompiler/reference/jak2/engine/game/main_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/main_REF.gc @@ -1178,7 +1178,7 @@ (suspend) ) ) - (kernel-shutdown) + (kernel-shutdown (the-as runtime-exit-status arg0)) (none) ) (if (= *master-exit* 'movie)