[jak2] graphic options menu proof of concept (#2849)

![imagem](https://github.com/open-goal/jak-project/assets/7569514/b8eaa0b6-7c51-4bd8-96ac-5fb2e0d08c4a)

![imagem](https://github.com/open-goal/jak-project/assets/7569514/d2742cef-98d4-43e4-a48d-cc1996e41612)

(The "Custom" option does not do anything right now.)
This commit is contained in:
ManDude
2023-07-29 18:08:44 +01:00
committed by GitHub
parent 748a9f3b41
commit a626b6b60d
16 changed files with 789 additions and 78 deletions
+19 -4
View File
@@ -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
@@ -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)
@@ -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)
@@ -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))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -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"
}
@@ -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()))
+3
View File
@@ -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"
@@ -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"
+1 -1
View File
@@ -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)))
@@ -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
@@ -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)
+12 -18
View File
@@ -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)
@@ -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
@@ -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)
@@ -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)
@@ -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")
)
@@ -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")
@@ -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))
+15
View File
@@ -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
+1 -1
View File
@@ -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).
|#
+216 -28
View File
@@ -4,7 +4,7 @@
#|
Additional PC port specific file for overriding/expanding the progress menu
This gives us more freedom to write code how we want.
This gives us more freedom to write code how we want.
|#
@@ -53,15 +53,15 @@
(defun get-highscore-icon-xoffset ((arg0 int))
(cond
((not (-> *pc-settings* use-vis?))
(cond
((not (-> *pc-settings* use-vis?))
(adjust-game-x 435.0)
)
((= (get-aspect-ratio) 'aspect4x3)
435)
(else
410)
)
((= (get-aspect-ratio) 'aspect4x3)
435)
(else
410)
)
)
(deftype highscore-cup-draw-params (structure)
@@ -174,23 +174,23 @@
(draw-busy-loading arg1)
)
(else
;; initial font parameters
;; initial font parameters
(set! (-> arg1 alpha) sv-96)
(set-scale! arg1 1.0)
(set-flags! arg1 (font-flags kerning middle large))
(set-color! arg1 (font-color progress))
;; set up for decoration text
;; set up for decoration text
(set! (-> arg1 origin x) 59.0)
(if (not (-> *pc-settings* use-vis?))
(set! (-> arg1 origin x) (the float (adjust-game-x (-> arg1 origin x)))))
(if (not (-> *pc-settings* use-vis?))
(set! (-> arg1 origin x) (the float (adjust-game-x (-> arg1 origin x)))))
(set! (-> arg1 origin y) 78.0)
(set! (-> arg1 width) sv-104)
(set! (-> arg1 height) 215.0)
;; set the scissor region
;; set the scissor region
(begin-scissor sv-112 arg0)
;; set up for highscore icon
;; set up for highscore icon
(set! (-> obj sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x3 :page #xc93)))
(set! (-> obj sprites 0 flags) (the-as uint 4))
(set! (-> obj sprites 0 scale-x) sv-100)
@@ -204,20 +204,20 @@
(set! (-> obj sprites 0 pos z) #xfffff0)
(set! (-> obj sprites 0 pos w) 0)
;; draw decoration text
;; draw decoration text
(if (= (-> *setting-control* user-default language) (language-enum spanish))
(draw-decoration obj arg1 sv-96 (text-id progress-root-highscores) #t 0.8)
(draw-decoration obj arg1 sv-96 (text-id progress-root-highscores) #t 0.95)
)
;; draw highscore title (e.g 'Gun Course')
;; draw highscore title (e.g 'Gun Course')
(set-scale! arg1 0.6)
(set! (-> arg1 height) 185.0)
(+! (-> arg1 origin y) 46.0)
(set! (-> arg1 origin x) 65.0)
(if (not (-> *pc-settings* use-vis?))
(set! (-> arg1 origin x) (the float (adjust-game-x (-> arg1 origin x)))))
(set-width! arg1 367)
(if (not (-> *pc-settings* use-vis?))
(set! (-> arg1 origin x) (the float (adjust-game-x (-> arg1 origin x)))))
(set-width! arg1 367)
(set-flags! arg1 (font-flags kerning large))
(set-color! arg1 (font-color progress-force-selected))
(set! (-> arg1 origin x) (+ padding sv-120 (-> arg1 origin x)))
@@ -231,9 +231,9 @@
(when (= (-> *setting-control* user-default language) (language-enum spanish))
(set-scale! arg1 0.65)
)
(print-game-text (string-format "~S" (lookup-text! *common-text* (get-highscore-text (-> obj page-index)) #f)) arg1 #f 44 (bucket-id progress))
(print-game-text (string-format "~S" (lookup-text! *common-text* (get-highscore-text (-> obj page-index)) #f)) arg1 #f 44 (bucket-id progress))
;; now draw highscore subtitle (e.g 'Scatter Gun')
;; now draw highscore subtitle (e.g 'Scatter Gun')
(+! (-> arg1 origin y) 25.0)
(set-scale! arg1 0.6)
(when (or (= (-> *setting-control* user-default language) (language-enum french))
@@ -241,7 +241,7 @@
)
(set-scale! arg1 0.58)
)
(print-game-text (string-format "~S" (lookup-text! *common-text* (get-highscore-text-sub (-> obj page-index)) #f)) arg1 #f 44 (bucket-id progress))
(print-game-text (string-format "~S" (lookup-text! *common-text* (get-highscore-text-sub (-> obj page-index)) #f)) arg1 #f 44 (bucket-id progress))
;; draw highscore icon
(set! (-> arg1 origin x) (- (-> arg1 origin x) (+ padding sv-120)))
@@ -288,8 +288,8 @@
;; reset font parameters
(set-scale! arg1 0.6)
(set! (-> arg1 origin x) 59.0)
(if (not (-> *pc-settings* use-vis?))
(set! (-> arg1 origin x) (the float (adjust-game-x (-> arg1 origin x)))))
(if (not (-> *pc-settings* use-vis?))
(set! (-> arg1 origin x) (the float (adjust-game-x (-> arg1 origin x)))))
(set! (-> arg1 origin y) 78.0)
(set! (-> arg1 width) sv-104)
(set! (-> arg1 height) 215.0)
@@ -297,8 +297,8 @@
(set! (-> arg1 height) 185.0)
(+! (-> arg1 origin y) 46.0)
(set! (-> arg1 origin x) 80.0)
(if (not (-> *pc-settings* use-vis?))
(set! (-> arg1 origin x) (the float (adjust-game-x (-> arg1 origin x)))))
(if (not (-> *pc-settings* use-vis?))
(set! (-> arg1 origin x) (the float (adjust-game-x (-> arg1 origin x)))))
(set! (-> obj sprites 0 pos z) #xffffff)
(set! (-> arg1 width) sv-104)
(set-flags! arg1 (font-flags kerning large))
@@ -314,7 +314,7 @@
(when (= (-> *setting-control* user-default language) (language-enum spanish))
(set-scale! arg1 0.65)
)
(print-game-text (string-format "~S" (lookup-text! *common-text* (get-highscore-text (-> obj prev-page-index)) #f)) arg1 #f 44 (bucket-id progress))
(print-game-text (string-format "~S" (lookup-text! *common-text* (get-highscore-text (-> obj prev-page-index)) #f)) arg1 #f 44 (bucket-id progress))
(+! (-> arg1 origin y) 25.0)
(set-scale! arg1 0.6)
(when (or (= (-> *setting-control* user-default language) (language-enum french))
@@ -322,7 +322,7 @@
)
(set-scale! arg1 0.58)
)
(print-game-text (string-format "~S" (lookup-text! *common-text* (get-highscore-text-sub (-> obj prev-page-index)) #f)) arg1 #f 44 (bucket-id progress))
(print-game-text (string-format "~S" (lookup-text! *common-text* (get-highscore-text-sub (-> obj prev-page-index)) #f)) arg1 #f 44 (bucket-id progress))
(set! (-> arg1 origin x) (- (-> arg1 origin x) (+ padding sv-124)))
(+! (-> arg1 origin y) 25.0)
(draw-highscore-icon
@@ -1693,3 +1693,191 @@
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; CUSTOM MENU OPTIONS
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defmethod draw-option menu-aspect-ratio-pc-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))
(draw-decoration obj arg1 alpha (text-id progress-root-graphic-options) #f 0.95)
)
0
(none)
)
(defmethod draw-option menu-display-mode-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 menu-on-off-vsync-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)
)
@@ -0,0 +1,43 @@
;;-*-Lisp-*-
(in-package goal)
#|
Additional PC port specific file for overriding/expanding the progress menu
This gives us more freedom to write code how we want.
|#
(deftype progress-global-state-pc (basic)
((decoration-draw-time uint64)
(display-mode-choice-index int8)
(aspect-ratio-choice-index int8)
)
)
(defmacro when-not-drawn-decoration (&rest body)
`(when (> (get-integral-current-time) (-> *progress-state-pc* decoration-draw-time))
,@body
(set! (-> *progress-state-pc* decoration-draw-time) (get-integral-current-time))))
(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)
()
)
+417
View File
@@ -0,0 +1,417 @@
;;-*-Lisp-*-
(in-package goal)
#|
Additional PC port specific file for overriding/expanding the progress menu
This gives us more freedom to write code how we want.
|#
(define *progress-state-pc* (new 'static 'progress-global-state-pc))
(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))
))
(defmethod init-defaults progress ((obj progress))
"Initialize default menu settings."
(set! (-> *progress-state* aspect-ratio-choice) (get-aspect-ratio))
(set! (-> *progress-state* video-mode-choice) (get-video-mode))
(set! (-> *progress-state* yes-no-choice) #f)
(set! (-> *progress-state* on-off-choice) #f)
(set! (-> *progress-state* color-flash-counter) 0)
(set! (-> *progress-state* game-options-item-selected) 0)
(set! (-> *progress-state* game-options-item-picked) #f)
(set! (-> *progress-state* game-options-vibrations) (-> *setting-control* user-default vibration))
(set! (-> *progress-state* game-options-subtitles) (-> *setting-control* user-default subtitle))
(set! (-> *progress-state* game-options-language-index)
(the-as int (-> *setting-control* user-default language))
)
(set! (-> *progress-state* game-options-subtitle-language-index)
(the-as int (-> *setting-control* user-default subtitle-language))
)
(set! (-> *progress-state* graphic-options-item-selected) 0)
(set! (-> *progress-state* graphic-options-item-picked) #f)
(set! (-> *progress-state* graphic-options-aspect-ratio) (get-aspect-ratio))
(set! (-> *progress-state* graphic-options-progressive-scan)
(-> *setting-control* user-default use-progressive-scan)
)
(set! (-> *progress-state* qr-options-item-selected) 0)
(set! (-> *progress-state* qr-options-item-picked) #f)
(set! (-> *progress-state* total-num-tasks) 0)
(set! (-> *progress-state* secrets-unlocked) #f)
(set! (-> *progress-state* clear-screen) #f)
(set! (-> obj sliding) 0.0)
(set! (-> obj sliding-height) 0.0)
(set! (-> obj sliding-off) 1.0)
(set! (-> obj scanlines-alpha) 0.0)
(set! (-> (the-as menu-on-off-game-vibrations-option (-> *game-options* options 0)) value-to-modify)
(&-> *setting-control* user-default vibration)
)
(set! (-> (the-as menu-on-off-game-subtitles-option (-> *game-options* options 1)) value-to-modify)
(&-> *setting-control* user-default subtitle)
)
(set! (-> (the-as menu-language-option (-> *game-options* options 2)) language-selection)
(-> *setting-control* user-current language)
)
(set! (-> (the-as menu-language-option (-> *game-options* options 2)) language-direction) #t)
(set! (-> (the-as menu-language-option (-> *game-options* options 2)) language-transition) #f)
(set! (-> (the-as menu-language-option (-> *game-options* options 2)) language-x-offset) 0)
(set! (-> (the-as menu-on-off-option (-> *game-options-japan* options 0)) value-to-modify)
(&-> *setting-control* user-default vibration)
)
(set! (-> (the-as menu-on-off-option (-> *game-options-demo* options 0)) value-to-modify)
(&-> *setting-control* user-default vibration)
)
(set! (-> (the-as menu-on-off-option (-> *graphic-options* options 2)) value-to-modify)
(&-> *setting-control* user-default use-progressive-scan)
)
(set! (-> (the-as menu-on-off-option (-> *graphic-title-options-pal* options 2)) value-to-modify)
(&-> *setting-control* user-default use-progressive-scan)
)
(set! (-> (the-as menu-slider-option (-> *sound-options* options 0)) value-to-modify)
(&-> *setting-control* user-default sfx-volume)
)
(set! (-> (the-as menu-slider-option (-> *sound-options* options 1)) value-to-modify)
(&-> *setting-control* user-default music-volume)
)
(set! (-> (the-as menu-slider-option (-> *sound-options* options 2)) value-to-modify)
(&-> *setting-control* user-default dialog-volume)
)
(set! (-> (the-as menu-missions-option (-> *missions-options* options 0)) task-line-index) 0)
(set-setting-by-param *setting-control* 'extra-bank '((force2 menu1)) 0 0)
;; PC STATE BEGIN
;; --------------
;; set aspect ratio options
(set-progress-aspect-ratio-pc-index)
(set-progress-display-mode-index)
(set! (-> (the menu-on-off-option (-> *graphic-options-pc* options 2)) value-to-modify) (&-> *pc-settings* vsync?))
)
(defmethod set-menu-options progress ((obj progress) (arg0 symbol))
"Set the menu options for the menu state specified by arg0."
(set! (-> obj current-options) #f)
(case arg0
(('go-away)
(go (method-of-object obj go-away))
)
(('main)
(set! (-> obj current-options) (cond
(*cheat-mode*
*main-options*
)
((= *kernel-boot-message* 'kiosk)
*main-kiosk-options*
)
((demo?)
*main-demo-options*
)
(else
*main-options*
)
)
)
)
(('game-options)
(set! (-> obj current-options)
(cond
((demo?)
(if (= (scf-get-territory) 1)
*game-options*
*game-options-demo*
)
)
((and (= (scf-get-territory) 2) (not (and (= *progress-cheat* 'language) (cpad-hold? 0 l2) (cpad-hold? 0 r2))))
*game-options*
)
(else
*game-options*
)
)
)
)
(('graphic-options)
(set! (-> obj current-options) *graphic-options-pc*)
)
(('sound-options)
(set! (-> obj current-options) *sound-options*)
)
(('select-load 'select-save)
(set! (-> obj current-options) *load-save-options*)
)
(('select-save-title)
(set! (-> obj current-options) *save-options-title*)
)
(('select-save-title-hero)
(logior! (-> *game-info* purchase-secrets) (game-secrets hero-mode))
(logior! (-> *game-info* secrets) (game-secrets hero-mode))
(set! (-> obj current-options) *save-options-title*)
)
(('loading 'saving 'creating 'formatting)
(set! (-> obj current-options) *loading-options*)
)
(('unformatted-card 'insufficient-space 'no-memory-card)
(set! (-> obj current-options) *insufficient-space-options*)
)
(('secrets-insufficient-space 'secrets-no-memory-card)
(set! (-> obj current-options) *secrets-insufficient-space-options*)
)
(('insert-card)
(set! (-> obj current-options) *insert-card-options*)
)
(('error-loading 'error-saving 'error-formatting 'error-creating)
(set! (-> obj current-options) *error-loading-options*)
)
(('error-auto-saving)
(set! (-> obj current-options) *error-auto-saving-options*)
)
(('card-removed)
(set! (-> obj current-options) *card-removed-options*)
)
(('error-disc-removed)
(set! (-> obj current-options) *error-disc-removed-options*)
)
(('error-reading)
(set! (-> obj current-options) *error-reading-options*)
)
(('icon-info)
(set! (-> obj current-options) *icon-info-options*)
)
(('format-card)
(set! (-> obj current-options) *format-card-options*)
)
(('already-exists)
(set! (-> obj current-options) *already-exists-options*)
)
(('create-game)
(set! (-> obj current-options) *create-game-options*)
)
(('video-mode-warning)
(set! (-> obj current-options) *video-mode-warning-options*)
)
(('video-mode-ok)
(set! (-> obj current-options) *video-mode-ok-options*)
)
(('progressive-mode-warning)
(set! (-> obj current-options) *progressive-mode-warning-options*)
)
(('progressive-mode-ok)
(set! (-> obj current-options) *progressive-mode-ok-options*)
)
(('quit)
(set! (-> obj current-options) *quit-options*)
)
(('title)
(set! (-> obj current-options) *title*)
)
(('title-options)
(set! (-> obj current-options) *options*)
)
(('select-start 'select-pre-start 'select-kiosk-start)
(set! (-> obj current-options) *select-start-options*)
(set! (-> (the-as menu-select-start-option (-> (the-as (array menu-option) (-> *select-start-options* options)) 0))
task-index
)
0
)
0
)
(('select-scene)
(set! (-> obj current-options) *select-scene-options*)
(set! (-> (the-as menu-select-scene-option (-> (the-as (array menu-option) (-> *select-scene-options* options)) 0))
task-index
)
0
)
0
)
(('select-scene-special)
(set! (-> *progress-state* starting-state) 'title)
(set! (-> obj state-pos) 0)
(let ((v1-67 (-> obj state-pos)))
(set! (-> obj state-stack v1-67) 'title)
(set! (-> obj option-index-stack v1-67) 3)
(let ((v1-68 (+ v1-67 1)))
(set! (-> obj state-stack v1-68) 'unlocked-secrets)
(set! (-> obj option-index-stack v1-68) (-> obj option-index))
(set! (-> obj state-pos) (+ v1-68 1))
)
)
(dotimes (s5-1 (-> obj state-pos))
(format
#t
"select-scene-special: ~S ~D~%"
(symbol->string (-> obj state-stack s5-1))
(-> obj option-index-stack s5-1)
)
)
(set! (-> obj current-options) *select-scene-options*)
)
(('bigmap)
(set! (-> obj current-options) *bigmap-options*)
)
(('missions)
(set! (-> *progress-state* missions-total-spacing) 0.0)
(set! (-> (the-as menu-missions-option (-> (the-as (array menu-option) (-> *missions-options* options)) 0))
task-line-index
)
0
)
(set! (-> obj current-options) *missions-options*)
)
(('highscores)
(set! (-> (the-as menu-highscores-option (-> (the-as (array menu-option) (-> *highscores-options* options)) 0))
page-index
)
0
)
(set! (-> (the-as menu-highscores-option (-> (the-as (array menu-option) (-> *highscores-options* options)) 0))
prev-page-index
)
0
)
(set! (-> obj current-options) *highscores-options*)
)
(('secret)
(set! (-> obj secret-buying) #f)
(set! (-> obj current-options) *secret-options*)
)
(('quit-restart)
(set! (-> obj current-options) *quit-restart-options*)
)
(('unlocked-secrets)
(set! (-> obj current-options) *unlocked-secrets*)
)
)
(when (= (-> obj current-options) #f)
(format #t "Didn't find new menu settings!!~%")
(pop-state obj)
)
0
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; CUSTOM MENU OPTIONS
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defmacro min-max-wrap-around+! (var inc minimum maximum)
`(set! ,var (min-max-wrap-around (+ ,var ,inc) ,minimum ,maximum)))
(defmethod respond-progress menu-aspect-ratio-pc-option ((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)
(format #t "nyi custom aspect-ratio~%")
)
)
)
(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 menu-display-mode-option ((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
)
@@ -0,0 +1,27 @@
;;-*-Lisp-*-
(in-package goal)
#|
Additional PC port specific file for overriding/expanding the progress menu
This gives us more freedom to write code how we want.
|#
(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-on-off-vsync-option :name (text-id progress-vsync))
)
)
)
+1 -1
View File
@@ -38,7 +38,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)
+14 -19
View File
@@ -35,8 +35,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)
@@ -157,6 +157,7 @@
)
;; definition for method 24 of type progress
;; WARN: Return type mismatch connection vs object.
(defmethod init-defaults progress ((obj progress))
"Initialize default menu settings."
(set! (-> *progress-state* aspect-ratio-choice) (get-aspect-ratio))
@@ -223,7 +224,7 @@
(&-> *setting-control* user-default dialog-volume)
)
(set! (-> (the-as menu-missions-option (-> *missions-options* options 0)) task-line-index) 0)
(set-setting-by-param *setting-control* 'extra-bank '((force2 menu1)) 0 0)
(the-as object (set-setting-by-param *setting-control* 'extra-bank '((force2 menu1)) 0 0))
)
;; definition of type hud-ring-cell
@@ -3553,7 +3554,7 @@
)
;; definition for function update-center-screen
(defun update-center-screen ()
(defun update-center-screen ((arg0 menu-graphic-option) (arg1 progress) (arg2 symbol))
(let ((v1-0 #f))
(cond
(#t
@@ -3616,10 +3617,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)
@@ -3638,10 +3639,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)
@@ -3661,8 +3662,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")
)
@@ -3699,10 +3700,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")
@@ -3741,12 +3739,9 @@
(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))
(set! (-> *setting-control* user-default aspect-ratio) (-> *progress-state* graphic-options-aspect-ratio))