diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index ea8d7a8ea77..2d9313daddb 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -7419,6 +7419,10 @@ (progress-highscores-subheader-speedrun-anyorbs #x1311) (progress-highscores-subheader-speedrun-anyhero #x1312) (progress-highscores-local-time #x1313) + (progress-fps-disclaimer-warning #x1314) + (progress-fps-disclaimer #x1315) + (progress-fps-disclaimer-1 #x1316) + (progress-fps-disclaimer-confirm #x1317) ) ;; ---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 929d80224c3..77b3ad1cb2c 100644 --- a/game/assets/jak2/text/game_custom_text_en-US.json +++ b/game/assets/jak2/text/game_custom_text_en-US.json @@ -121,7 +121,7 @@ "128b": "Low", "128c": "High", "128d": "Credits", - "128e": "Frame Rate (Experimental)", + "128e": "Frame Rate", "128f": "Miscellaneous", "1290": "Speedrunner Mode", "1291": "Input Options", @@ -158,5 +158,9 @@ "1310": "100%", "1311": "Any% - All Orbs", "1312": "Any% - Hero Mode", - "1313": "Local Time" + "1313": "Local Time", + "1314": "Warning!", + "1315": "This setting is highly experimental. While the game can be completed with it, going past 60 FPS is known to cause (mostly minor) issues that may impact your experience.", + "1316": "The game may also start to lag and slow down as a result if you can't keep the selected frame rate up, so ensure your PC can handle it.", + "1317": "Confirm" } diff --git a/goal_src/jak2/engine/ui/text-id-h.gc b/goal_src/jak2/engine/ui/text-id-h.gc index 75981281dd3..0566f4c6300 100644 --- a/goal_src/jak2/engine/ui/text-id-h.gc +++ b/goal_src/jak2/engine/ui/text-id-h.gc @@ -747,6 +747,10 @@ (progress-highscores-subheader-speedrun-anyorbs #x1311) (progress-highscores-subheader-speedrun-anyhero #x1312) (progress-highscores-local-time #x1313) + (progress-fps-disclaimer-warning #x1314) + (progress-fps-disclaimer #x1315) + (progress-fps-disclaimer-1 #x1316) + (progress-fps-disclaimer-confirm #x1317) ) ;; ---text-id diff --git a/goal_src/jak2/pc/debug/default-menu-pc.gc b/goal_src/jak2/pc/debug/default-menu-pc.gc index 573d88e831d..8f0b0ee4a61 100644 --- a/goal_src/jak2/pc/debug/default-menu-pc.gc +++ b/goal_src/jak2/pc/debug/default-menu-pc.gc @@ -920,6 +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?))) ) (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 718e11ca57f..a61e4515c7c 100644 --- a/goal_src/jak2/pc/pckernel-impl.gc +++ b/goal_src/jak2/pc/pckernel-impl.gc @@ -134,13 +134,13 @@ "Set the default misc settings" ((method-of-type pc-settings reset-misc) obj call-handlers) - (set! (-> obj jetboard-trick-text?) #t) + (true! (-> obj jetboard-trick-text?)) - (set! (-> obj fast-airlock?) #t) - (set! (-> obj fast-elevator?) #t) - (set! (-> obj fast-progress?) #f) - (set! (-> obj smooth-minimap?) #t) - (set! (-> obj hires-clouds?) #t) + (true! (-> obj fast-airlock?)) + (true! (-> obj fast-elevator?)) + (false! (-> obj fast-progress?)) + (true! (-> obj smooth-minimap?)) + (true! (-> obj hires-clouds?)) 0) (defmethod reset-extra pc-settings-jak2 ((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 c06d6924114..4cb2fb7b554 100644 --- a/goal_src/jak2/pc/progress/progress-draw-pc.gc +++ b/goal_src/jak2/pc/progress/progress-draw-pc.gc @@ -2408,6 +2408,58 @@ (none) ) +(defmethod draw-option menu-frame-rate-disclaimer-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.4) + (set-flags! arg1 (font-flags kerning middle middle-vert large)) + (set! (-> arg1 origin x) 90.0) + (set! (-> arg1 origin y) 55.0) + (set-width! arg1 330) + (set-height! arg1 85) + (when (not (-> *pc-settings* use-vis?)) + (set! (-> arg1 origin x) (the float (adjust-game-x (-> arg1 origin x)))) + (*! (-> arg1 width) (-> *pc-settings* aspect-ratio-reciprocal)) + ) + (when (< (mod (-> *display* real-clock frame-counter) (seconds 1.2)) (seconds 1.0)) + (print-game-text (lookup-text! *common-text* (text-id progress-fps-disclaimer-warning) #f) arg1 #f 44 (bucket-id progress)) + ) + (+! (-> arg1 origin y) 60.0) + (set-color! arg1 (font-color progress)) + (print-game-text + (lookup-text! *common-text* (text-id progress-fps-disclaimer) #f) + arg1 + #f + 44 + (bucket-id progress) + ) + (+! (-> arg1 origin y) 80.0) + (set-height! arg1 95) + (print-game-text + (lookup-text! *common-text* (text-id progress-fps-disclaimer-1) #f) + arg1 + #f + 44 + (bucket-id progress) + ) + (+! (-> arg1 origin y) 95.0) + (set-height! arg1 50) + (set-color! arg1 (progress-selected 0)) + (draw-highlight (the int (+ 13.0 (-> arg1 origin y))) 18 (-> arg1 alpha)) + (print-game-text + (if (time-elapsed? (-> *progress-state-pc* frame-rate-disclaimer-time) (seconds 5)) + (lookup-text! *common-text* (text-id progress-fps-disclaimer-confirm) #f) + (string-format "~Ds" (inc (/ (- (seconds 5) (- (current-time) (-> *progress-state-pc* frame-rate-disclaimer-time))) TICKS_PER_SECOND))) + ) + arg1 + #f + 44 + (bucket-id progress) + ) + 0 + (none) + ) + (defun begin-scissor-music-player ((box hud-box)) diff --git a/goal_src/jak2/pc/progress/progress-h-pc.gc b/goal_src/jak2/pc/progress/progress-h-pc.gc index 13a97691392..b28420bb9ba 100644 --- a/goal_src/jak2/pc/progress/progress-h-pc.gc +++ b/goal_src/jak2/pc/progress/progress-h-pc.gc @@ -39,6 +39,10 @@ () ) +(deftype menu-frame-rate-disclaimer-option (menu-option) + () + ) + (deftype menu-music-player-option (menu-option) ((last-move time-frame) diff --git a/goal_src/jak2/pc/progress/progress-pc.gc b/goal_src/jak2/pc/progress/progress-pc.gc index 25cc5eb43b7..a7788f79277 100644 --- a/goal_src/jak2/pc/progress/progress-pc.gc +++ b/goal_src/jak2/pc/progress/progress-pc.gc @@ -19,6 +19,8 @@ (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) @@ -157,6 +159,7 @@ (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)) @@ -376,6 +379,9 @@ (set! (-> (the-as menu-music-player-option (-> *music-player-options* options 0)) excitement) 0) (set! (-> obj current-options) *music-player-options*) ) + (('fps-disclaimer) + (set! (-> obj current-options) *frame-rate-disclaimer-options*) + ) (('generic-menu) ;; a single condition to handle all generic menu links (let ((curr-history-entry (-> *progress-pc-generic-store* history-stack @@ -561,18 +567,21 @@ ((cpad-pressed? 0 confirm) (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*) + (when (and (not (-> *progress-state-pc* frame-rate-disclaimer-seen?)) (> (-> *pc-settings* target-fps) 60)) + (set-time! (-> *progress-state-pc* frame-rate-disclaimer-time)) + (push-and-set-state arg0 'fps-disclaimer) + ) ) (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))) - (set-frame-rate! *pc-settings* (-> *frame-rate-options* (-> *progress-state-pc* frame-rate-choice-index)) #t) ) (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))) - (set-frame-rate! *pc-settings* (-> *frame-rate-options* (-> *progress-state-pc* frame-rate-choice-index)) #t) ) (if sound-beep? (sound-play "generic-beep") @@ -584,6 +593,17 @@ 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 (and (time-elapsed? (-> *progress-state-pc* frame-rate-disclaimer-time) (seconds 5)) (cpad-pressed? 0 confirm)) + (cpad-clear! 0 confirm) + (sound-play "generic-beep") + (true! (-> *progress-state-pc* frame-rate-disclaimer-seen?)) + (pop-state arg0) + ) + 0 + ) + (defbehavior play-music-player progress ((info music-player-track-info) (flava int)) "play a music track using music player track info." diff --git a/goal_src/jak2/pc/progress/progress-static-pc.gc b/goal_src/jak2/pc/progress/progress-static-pc.gc index b15a247c438..0bc42a39486 100644 --- a/goal_src/jak2/pc/progress/progress-static-pc.gc +++ b/goal_src/jak2/pc/progress/progress-static-pc.gc @@ -344,6 +344,15 @@ This gives us more freedom to write code how we want. (define *frame-rate-options* (new 'static 'boxed-array :type int16 30 50 60 75 120 144 165 240)) +(define *frame-rate-disclaimer-options* + (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-frame-rate-disclaimer-option)) + ) + ) + (define *aspect-ratio-custom-options* (new 'static 'menu-option-list :y-center 198