Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jak2: add warning text when changing frame rate for the first time #3092

Merged
merged 6 commits into from Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions decompiler/config/jak2/all-types.gc
Expand Up @@ -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

Expand Down
8 changes: 6 additions & 2 deletions game/assets/jak2/text/game_custom_text_en-US.json
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
}
4 changes: 4 additions & 0 deletions goal_src/jak2/engine/ui/text-id-h.gc
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions goal_src/jak2/pc/debug/default-menu-pc.gc
Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions goal_src/jak2/pc/pckernel-impl.gc
Expand Up @@ -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))
Expand Down
52 changes: 52 additions & 0 deletions goal_src/jak2/pc/progress/progress-draw-pc.gc
Expand Up @@ -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))
Expand Down
4 changes: 4 additions & 0 deletions goal_src/jak2/pc/progress/progress-h-pc.gc
Expand Up @@ -39,6 +39,10 @@
()
)

(deftype menu-frame-rate-disclaimer-option (menu-option)
()
)

(deftype menu-music-player-option (menu-option)
((last-move time-frame)

Expand Down
24 changes: 22 additions & 2 deletions goal_src/jak2/pc/progress/progress-pc.gc
Expand Up @@ -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)
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand All @@ -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."

Expand Down
9 changes: 9 additions & 0 deletions goal_src/jak2/pc/progress/progress-static-pc.gc
Expand Up @@ -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
Expand Down