Skip to content

Commit

Permalink
[jak2] graphic options menu proof of concept (#2849)
Browse files Browse the repository at this point in the history
  • Loading branch information
ManDude committed Jul 29, 2023
1 parent 748a9f3 commit a626b6b
Show file tree
Hide file tree
Showing 16 changed files with 789 additions and 78 deletions.
23 changes: 19 additions & 4 deletions decompiler/config/jak2/all-types.gc
Expand Up @@ -7242,6 +7242,21 @@
(discord-rpc-dark-gun-training #x1105)
(discord-rpc-onin-game #x1106)
(discord-rpc-whack #x1107)
(progress-display-mode #x1200)
(progress-windowed #x1201)
(progress-fullscreen #x1202)
(progress-borderless #x1203)
(progress-aspect-ratio-auto #x1204)
(progress-aspect-ratio-custom #x1205)
(progress-aspect-ratio-4x3 #x1206)
(progress-aspect-ratio-16x9 #x1207)
(progress-aspect-ratio-custom-title #x1208)
(progress-aspect-ratio-custom-pad-x #x1209)
(progress-aspect-ratio-custom-pad-circle #x120a)
(progress-aspect-ratio-custom-warn #x120b)
(progress-aspect-ratio-custom-ratio #x120c)
(progress-vsync #x120d)
(progress-text-language #x120e)
)
;; ---text-id-h:text-id

Expand Down Expand Up @@ -22146,7 +22161,7 @@
(idle () _type_ :state 21)
(go-away () _type_ :state 22)
(gone () _type_ :state 23)
(init-defaults "Initialize default menu settings." (_type_) connection 24)
(init-defaults "Initialize default menu settings." (_type_) object 24)
(respond-to-cpad (_type_) none 25)
(gone? (_type_) object 26)
(can-go-back? (_type_) symbol 27)
Expand Down Expand Up @@ -31016,8 +31031,8 @@
(game-options-language-index int32 :offset-assert 152)
(game-options-subtitle-language-index int32 :offset-assert 156)
(graphic-options-item-selected int32 :offset-assert 160)
(graphic-options-item-picked basic :offset-assert 164)
(graphic-options-last-move uint64 :offset-assert 168)
(graphic-options-item-picked symbol :offset-assert 164)
(graphic-options-last-move time-frame :offset-assert 168)
(graphic-options-aspect-ratio symbol :offset-assert 176)
(graphic-options-progressive-scan symbol :offset-assert 180)
(qr-options-item-selected int32 :offset-assert 184)
Expand Down Expand Up @@ -31069,7 +31084,7 @@
(define-extern begin-scan (function hud-box progress int))
(define-extern end-scan (function hud-box float int))
(define-extern progress-post (function none :behavior progress))
(define-extern update-center-screen (function int))
(define-extern update-center-screen (function menu-graphic-option progress symbol int))
(define-extern update-restart-quit (function menu-option progress symbol int))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Expand Down
21 changes: 18 additions & 3 deletions game/assets/jak2/text/game_custom_text_en-US.json
@@ -1,10 +1,25 @@
{
"1100": "Not in a mission",
"1101": "Playing a side mission",
"1101": "Playing a bonus mission",
"1102": "Playing Scatter Gun Training",
"1103": "Playing Blaster Training",
"1104": "Playing Vulcan Fury Training",
"1105": "Playing Peace Maker Training",
"1106": "Playing Onin's Game",
"1107": "Playing Metal Head Mash"
"1106": "Playing Onin Game",
"1107": "Playing Metal Head Mash",
"1200": "Display Mode",
"1201": "Windowed",
"1202": "Fullscreen",
"1203": "Borderless",
"1204": "Automatic",
"1205": "Custom",
"1206": "4x3 (PS2)",
"1207": "16x9 (PS2)",
"1208": "Select the custom width and height ratio.",
"1209": "Press <PAD_X> to confirm and exit.",
"120a": "Press <PAD_CIRCLE> to confirm and exit.",
"120b": "Ratio must not be lower than 4x3 (~f).",
"120c": "Current ratio is ~f.",
"120d": "V-Sync",
"120e": "Text Language"
}
1 change: 0 additions & 1 deletion game/graphics/opengl_renderer/debug_gui.cpp
Expand Up @@ -164,7 +164,6 @@ void OpenGlDebugGui::draw(const DmaStats& dma_stats) {
}
ImGui::EndMenu();
}
ImGui::Text("Press F11 to toggle this toolbar");
ImGui::Text("%s", fmt::format("Press {} to toggle this toolbar",
sdl_util::get_keyboard_button_name(
Gfx::g_debug_settings.hide_imgui_key, InputModifiers()))
Expand Down
3 changes: 3 additions & 0 deletions goal_src/jak2/dgos/game.gd
Expand Up @@ -161,6 +161,7 @@
"cam-update-h.o"
"hud-h.o"
"progress-h.o"
"progress-h-pc.o" ;; added
"rpc-h.o"
"path-h.o"
"nav-mesh-h.o"
Expand Down Expand Up @@ -357,7 +358,9 @@
"hud.o"
"hud-classes.o"
"progress-static.o"
"progress-static-pc.o" ;; added
"progress.o"
"progress-pc.o" ;; added
"progress-draw.o"
"progress-draw-pc.o" ;; added
"ocean.o"
Expand Down
2 changes: 1 addition & 1 deletion goal_src/jak2/engine/game/settings-h.gc
Expand Up @@ -342,5 +342,5 @@

(defmacro language? (&rest langs)
"is the current language any of the ones specified?"
`(or ,(apply (lambda (x) `(= (-> *setting-control* user-default language) (language-enum ,x))) langs)))
`(or ,@(apply (lambda (x) `(= (-> *setting-control* user-default language) (language-enum ,x))) langs)))

2 changes: 1 addition & 1 deletion goal_src/jak2/engine/ui/progress/progress-draw.gc
Expand Up @@ -3342,7 +3342,7 @@
(none)
)

(defglobalconstant COMPACT_SELECT_START #t)
(defglobalconstant COMPACT_SELECT_START #f)
;; WARN: disable def twice: 147. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare.
(defmethod draw-option menu-select-start-option ((obj menu-select-start-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
(local-vars
Expand Down
2 changes: 1 addition & 1 deletion goal_src/jak2/engine/ui/progress/progress-h.gc
Expand Up @@ -59,7 +59,7 @@
(idle () _type_ :state 21)
(go-away () _type_ :state 22)
(gone () _type_ :state 23)
(init-defaults (_type_) connection 24)
(init-defaults (_type_) object 24)
(respond-to-cpad (_type_) none 25)
(gone? (_type_) object 26)
(can-go-back? (_type_) symbol 27)
Expand Down
30 changes: 12 additions & 18 deletions goal_src/jak2/engine/ui/progress/progress.gc
Expand Up @@ -40,8 +40,8 @@
(game-options-language-index int32 :offset-assert 152)
(game-options-subtitle-language-index int32 :offset-assert 156)
(graphic-options-item-selected int32 :offset-assert 160)
(graphic-options-item-picked basic :offset-assert 164)
(graphic-options-last-move uint64 :offset-assert 168)
(graphic-options-item-picked symbol :offset-assert 164)
(graphic-options-last-move time-frame :offset-assert 168)
(graphic-options-aspect-ratio symbol :offset-assert 176)
(graphic-options-progressive-scan symbol :offset-assert 180)
(qr-options-item-selected int32 :offset-assert 184)
Expand Down Expand Up @@ -3407,7 +3407,7 @@
0
)

(defun update-center-screen ()
(defun update-center-screen ((arg0 menu-graphic-option) (arg1 progress) (arg2 symbol))
(let ((v1-0 #f))
(cond
(#t
Expand Down Expand Up @@ -3469,10 +3469,10 @@
(cond
((or (cpad-pressed? 0 down l-analog-down)
(and (cpad-hold? 0 down l-analog-down)
(>= (- (current-time) (the-as int (-> *progress-state* graphic-options-last-move))) (seconds 0.5))
(>= (- (current-time) (-> *progress-state* graphic-options-last-move)) (seconds 0.5))
)
)
(set! (-> *progress-state* graphic-options-last-move) (the-as uint (current-time)))
(set! (-> *progress-state* graphic-options-last-move) (current-time))
(set! (-> arg0 selected-option) #f)
(cond
((< (-> *progress-state* graphic-options-item-selected) (if (= (scf-get-territory) 1)
Expand All @@ -3491,10 +3491,10 @@
)
((or (cpad-pressed? 0 up l-analog-up)
(and (cpad-hold? 0 up l-analog-up)
(>= (- (current-time) (the-as int (-> *progress-state* graphic-options-last-move))) (seconds 0.5))
(>= (- (current-time) (-> *progress-state* graphic-options-last-move)) (seconds 0.5))
)
)
(set! (-> *progress-state* graphic-options-last-move) (the-as uint (current-time)))
(set! (-> *progress-state* graphic-options-last-move) (current-time))
(set! (-> arg0 selected-option) #f)
(cond
((> (-> *progress-state* graphic-options-item-selected) 0)
Expand All @@ -3514,8 +3514,8 @@
((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))
(set! (-> *progress-state* graphic-options-last-move) (the-as uint (current-time)))
(set! (-> *progress-state* graphic-options-item-picked) (the-as basic #t))
(set! (-> *progress-state* graphic-options-last-move) (current-time))
(set! (-> *progress-state* graphic-options-item-picked) #t)
(set! (-> arg0 selected-option) #f)
(sound-play "generic-beep")
)
Expand Down Expand Up @@ -3552,10 +3552,7 @@
((and (zero? (-> *progress-state* graphic-options-item-selected))
(cpad-pressed? 0 up right down left l-analog-up l-analog-right l-analog-down l-analog-left)
)
(let ((t9-13 update-center-screen))
#t
(t9-13)
)
(update-center-screen obj arg0 #t)
)
((and (= (-> *progress-state* graphic-options-item-selected) 1) (cpad-pressed? 0 left l-analog-left))
(sound-play "generic-beep")
Expand Down Expand Up @@ -3594,11 +3591,8 @@
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons confirm))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons confirm))
(sound-play "generic-beep")
(when (zero? (-> *progress-state* graphic-options-item-selected))
(let ((t9-28 update-center-screen))
#t
(t9-28)
)
(if (zero? (-> *progress-state* graphic-options-item-selected))
(update-center-screen obj arg0 #t)
)
(when (= (-> *progress-state* graphic-options-item-selected) 1)
(if (!= (-> *progress-state* graphic-options-aspect-ratio) (-> *setting-control* user-default aspect-ratio))
Expand Down
15 changes: 15 additions & 0 deletions goal_src/jak2/engine/ui/text-id-h.gc
Expand Up @@ -578,6 +578,21 @@
(discord-rpc-dark-gun-training #x1105)
(discord-rpc-onin-game #x1106)
(discord-rpc-whack #x1107)
(progress-display-mode #x1200)
(progress-windowed #x1201)
(progress-fullscreen #x1202)
(progress-borderless #x1203)
(progress-aspect-ratio-auto #x1204)
(progress-aspect-ratio-custom #x1205)
(progress-aspect-ratio-4x3 #x1206)
(progress-aspect-ratio-16x9 #x1207)
(progress-aspect-ratio-custom-title #x1208)
(progress-aspect-ratio-custom-pad-x #x1209)
(progress-aspect-ratio-custom-pad-circle #x120a)
(progress-aspect-ratio-custom-warn #x120b)
(progress-aspect-ratio-custom-ratio #x120c)
(progress-vsync #x120d)
(progress-text-language #x120e)
)
;; ---text-id

Expand Down
2 changes: 1 addition & 1 deletion goal_src/jak2/pc/pckernel-impl.gc
Expand Up @@ -2,7 +2,7 @@
(in-package goal)

#|
This file has the game-specific implementation of the pckernel (see pckernel-h.gc and pckernel.gc).
This file has the game-specific implementation of the pckernel (see pckernel-h.gc and pckernel.gc).
|#


Expand Down

0 comments on commit a626b6b

Please sign in to comment.