g/j2: Start adding game options to jak 2's menu (#2968)

This commit is contained in:
Tyler Wilding
2023-09-09 13:58:57 -06:00
committed by GitHub
parent ec058221b5
commit 8154c4659d
19 changed files with 1474 additions and 587 deletions
+14 -10
View File
@@ -6755,13 +6755,13 @@
(progress-on #x10e)
(progress-off #x10f)
(progress-move-dpad #x110)
(text-x111 #x111)
(text-x112 #x112)
(text-x113 #x113)
(text-x114 #x114)
(text-x115 #x115)
(text-x116 #x116)
(text-x117 #x117)
(language-name-english #x111)
(language-name-french #x112)
(language-name-german #x113)
(language-name-spanish #x114)
(language-name-italian #x115)
(language-name-korean #x116)
(language-name-japanese #x117)
(progress-aspect-ratio #x118)
(progress-progressive-scan #x119)
(progress-video-mode #x11a)
@@ -7234,7 +7234,7 @@
(scene-nest-boss-intro #x306)
(scene-intro #x307)
(scene-outro #x308)
(text-x30b #x30b)
(language-name-english-uk #x30b)
(scene-subtitles-hint #x30c)
(scene-subtitles-enabled #x30d)
(scene-subtitles-disabled #x30e)
@@ -7363,6 +7363,8 @@
(progress-lod-high #x128c)
(progress-credits #x128d)
(progress-frame-rate #x128e)
(progress-misc-game-options #x128f)
(progress-speedrunner-mode #x1290)
)
;; ---text-id-h:text-id
@@ -31174,7 +31176,7 @@
(stereo-mode-backup int32 :offset-assert 216)
(secrets-unlocked symbol :offset-assert 220)
(missions-total-spacing float :offset-assert 224)
(clear-screen basic :offset-assert 228)
(clear-screen symbol :offset-assert 228)
)
:method-count-assert 9
:size-assert #xe8
@@ -31273,7 +31275,9 @@
(define-extern draw-sound-options-decoration (function menu-slider-option font-context float text-id symbol pointer))
(define-extern draw-decoration-secrets (function menu-option font-context float text-id pointer))
(define-extern draw-decoration-load-save (function menu-option font-context float text-id pointer))
(define-extern sort-task-node-result (function int none))
(define-extern sort-task-node-result
"Sorts the [[*game-info*]]'s `mission-list` by if they are closed and their `closed-time`. Just bubble-sort and therefore O(n^2)"
(function int none))
(define-extern find-mission-text-at-index (function int game-task-node-info))
(define-extern draw-secret-list (function secret-item-option progress font-context int symbol float none))
(define-extern draw-highscore-icon (function menu-highscores-option uint int int float pointer))
@@ -4390,5 +4390,113 @@
"vars": {
"s3-1": ["points", "(inline-array vector)"]
}
},
"(method 10 menu-missions-option)": {
"args": ["obj", "progress", "font-ctx", "arg3", "arg4"],
"vars": {
"sv-16": "font-alpha",
"v1-26": "task-info",
"a0-15": "game-task-info-array",
"sv-284": "font-scale",
"sv-280": "font-y-pos",
"sv-24": "game-task-idx",
"sv-272": "found-closed-task?",
"sv-268": "completed-task-info",
"sv-264": "inprogress-task-info",
"sv-20": "task-info-idx",
"sv-48": "num-task-info",
"v1-36": "font-ctx-1",
"a0-21": "font-ctx-2",
"v1-40": "page-idx",
"sv-276": "hud-bounds",
"a0-27": "font-ctx-3",
"v1-52": "font-ctx-4",
"sv-56": "default-y-origin-4x3",
"v1-57": "y-offset",
"sv-260": "line-height",
"s4-1": "game-task-idx-2",
"s3-1": "game-task-info-2",
"a1-19": "task-text-id",
"f30-0": "line-padding",
"s3-2": "line-text",
"s2-0": "print-game-text-fn",
"s4-2": "game-task-info-3",
"a1-23": "task-text-id-2",
"s4-3": "line-text-2",
"f30-1": "line-padding-2",
"s3-3": "print-game-text-fn-2"
}
},
"sort-task-node-result": {
"vars": {
"v1-1": "game-task-info-array",
"a1-1": "i",
"a0-3": "j",
"a2-19": "task-info"
}
},
"draw-missions-up-down": {
"args": ["font-ctx"],
"vars": {
"f30-0": "old-x-pos",
"f28-0": "old-y-pos",
"s3-0": "new-x-pos",
"s5-0": "new-y-pos-up",
"s4-0": "new-y-pos-down",
"s2-0": "print-text-fn",
"s5-1": "print-text-fn-1"
}
},
"begin-scissor-missions": {
"args": ["hud-bounds"],
"vars": {
"s4-0": "buffer"
}
},
"end-scissor-missions": {
"args": ["hud-bounds", "arg1"],
"vars": {
"s5-0": "buffer"
}
},
"(method 25 progress)": {
"vars": {
"s5-0": "option-array"
}
},
"(method 10 menu-language-game-option)": {
"args": ["obj", "progress", "font-ctx", "option-index", "selected"],
"vars": {
"f30-0": "alpha",
"v1-2": "font-ctx-1",
"a0-5": "font-ctx-2",
"s4-0": "curr-language-ptr",
"a0-7": "font-ctx-3",
"s3-0": "print-game-text-fn-1",
"s4-1": "curr-language",
"a0-14": "font-ctx-4",
"v1-33": "font-ctx-5",
"a0-16": "font-ctx-6",
"s5-1": "print-game-text-fn-2",
"s5-2": "print-game-text-fn-3",
"s5-3": "font-ctx-7",
"v1-43": "language-name-idx",
"s3-1": "font-ctx-8",
"a0-33": "font-ctx-9",
"v1-52": "font-ctx-10",
"s3-2": "print-game-text-fn-4",
"v1-54": "font-ctx-11",
"a0-40": "font-ctx-12",
"a0-44": "font-ctx-13",
"v1-66": "language-name-idx-2"
}
},
"draw-highlight": {
"vars": {
"s2-0": "buffer",
"a3-0": "width",
"s3-0": "x-pos"
},
"args": ["y-pos", "height", "alpha"]
}
}
@@ -121,5 +121,7 @@
"128b": "Low",
"128c": "High",
"128d": "Credits",
"128e": "Frame Rate (Experimental)"
"128e": "Frame Rate (Experimental)",
"128f": "Misc. Options",
"1290": "Speedrunner Mode"
}
+8
View File
@@ -540,6 +540,10 @@
`(+! ,place 1)
)
(defmacro inc! (place)
`(+! ,place 1)
)
(defmacro 1- (var)
`(+ ,var -1)
)
@@ -556,6 +560,10 @@
`(-! ,place 1)
)
(defmacro dec! (place)
`(-! ,place 1)
)
(defmacro *! (place amount)
`(set! ,place (* ,place ,amount))
)
+3
View File
@@ -162,6 +162,7 @@
"hud-h.o"
"progress-h.o"
"progress-h-pc.o" ;; added
"progress-generic-h-pc.o" ;; added
"rpc-h.o"
"path-h.o"
"nav-mesh-h.o"
@@ -361,8 +362,10 @@
"progress-static-pc.o" ;; added
"progress.o"
"progress-pc.o" ;; added
"progress-generic-pc.o" ;; added
"progress-draw.o"
"progress-draw-pc.o" ;; added
"progress-generic-draw-pc.o" ;; added
"ocean.o"
"ocean-vu0.o"
"ocean-texture.o"
+145 -136
View File
@@ -68,35 +68,36 @@
(none)
)
(defun draw-highlight ((arg0 int) (arg1 int) (arg2 float))
(let ((s3-0 (if (= (get-aspect-ratio) 'aspect4x3)
70
79
)
)
(a3-0 (if (= (get-aspect-ratio) 'aspect4x3)
374
355
)
)
(defun draw-highlight ((y-pos int) (height int) (alpha float))
(let ((x-pos (if (= (get-aspect-ratio) 'aspect4x3)
70
79
)
)
(width (if (= (get-aspect-ratio) 'aspect4x3)
374
355
)
)
)
;; og:preserve-this
(#when PC_PORT
;; added for better widescreen handling
(when (not (-> *pc-settings* use-vis?))
(set! s3-0 (the int (adjust-game-x (the float s3-0))))
(set! a3-0 (the int (* (-> *pc-settings* aspect-ratio-reciprocal) a3-0)))
(set! x-pos (the int (adjust-game-x (the float x-pos))))
(set! width (the int (* (-> *pc-settings* aspect-ratio-reciprocal) width)))
)
)
(with-dma-buffer-add-bucket ((s2-0 (-> *display* frames (-> *display* on-screen) global-buf))
(with-dma-buffer-add-bucket ((buffer (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress)
)
(draw-sprite2d-xy
s2-0
s3-0
arg0
a3-0
arg1
(new 'static 'rgba :r #x40 :g #x80 :b #x80 :a (the int (* 64.0 arg2)))
buffer
x-pos
y-pos
width
height
(new 'static 'rgba :r #x40 :g #x80 :b #x80 :a (the int (* 64.0 alpha)))
)
)
)
@@ -227,31 +228,27 @@
)
;; WARN: Return type mismatch float vs none.
(defun draw-missions-up-down ((arg0 font-context))
(let ((s3-0 250)
(s5-0 116)
(s4-0 191)
(f30-0 (-> arg0 origin x))
(f28-0 (-> arg0 origin y))
(defun draw-missions-up-down ((font-ctx font-context))
(let ((new-x-pos 250)
(new-y-pos-up 116)
(new-y-pos-down 191)
(old-x-pos (-> font-ctx origin x))
(old-y-pos (-> font-ctx origin y))
)
(#when PC_PORT
(when (not (-> *pc-settings* use-vis?))
(set! s3-0 (adjust-game-x (the float s3-0)))
))
(set! (-> arg0 origin x) (the float s3-0))
(set! (-> arg0 origin y) (the float s5-0))
(let ((s2-0 print-game-text))
(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)
(s2-0 *temp-string* arg0 #f 44 (bucket-id progress))
(print-text-fn *temp-string* font-ctx #f 44 (bucket-id progress))
)
(set! (-> arg0 origin x) (the float s3-0))
(set! (-> arg0 origin y) (the float (+ s5-0 s4-0)))
(let ((s5-1 print-game-text))
(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)
(s5-1 *temp-string* arg0 #f 44 (bucket-id progress))
(print-text-fn-1 *temp-string* font-ctx #f 44 (bucket-id progress))
)
(set! (-> arg0 origin x) f30-0)
(set! (-> arg0 origin y) f28-0)
(set! (-> font-ctx origin x) old-x-pos)
(set! (-> font-ctx origin y) old-y-pos)
)
(none)
)
@@ -366,34 +363,34 @@
0
)
(defun begin-scissor-missions ((arg0 hud-box))
(defun begin-scissor-missions ((hud-bounds hud-box))
(cond
((= (get-aspect-ratio) 'aspect16x9)
(set! (-> arg0 min x) 79.0)
(set! (-> arg0 min y) 130.0)
(set! (-> arg0 max x) 434.0)
(set! (-> arg0 max y) 305.0)
(set! (-> hud-bounds min x) 79.0)
(set! (-> hud-bounds min y) 130.0)
(set! (-> hud-bounds max x) 434.0)
(set! (-> hud-bounds max y) 305.0)
)
(else
(set! (-> arg0 min x) 70.0)
(set! (-> arg0 min y) 130.0)
(set! (-> arg0 max x) 444.0)
(set! (-> arg0 max y) 305.0)
(set! (-> hud-bounds min x) 70.0)
(set! (-> hud-bounds min y) 130.0)
(set! (-> hud-bounds max x) 444.0)
(set! (-> hud-bounds max y) 305.0)
)
)
(with-dma-buffer-add-bucket ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf))
(with-dma-buffer-add-bucket ((buffer (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress)
)
(setup-scissor arg0 s4-0)
(setup-scissor hud-bounds buffer)
)
0
)
(defun end-scissor-missions ((arg0 hud-box) (arg1 float))
(with-dma-buffer-add-bucket ((s5-0 (-> *display* frames (-> *display* on-screen) global-buf))
(defun end-scissor-missions ((hud-bounds hud-box) (arg1 float))
(with-dma-buffer-add-bucket ((buffer (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress)
)
(restore-scissor arg0 s5-0)
(restore-scissor hud-bounds buffer)
)
0
)
@@ -3590,25 +3587,26 @@
;; WARN: Return type mismatch symbol vs none.
(defun sort-task-node-result ((arg0 int))
(let ((v1-1 (-> *game-info* mission-list))
(a1-1 (max 0 (+ arg0 -1)))
"Sorts the [[*game-info*]]'s `mission-list` by if they are closed and their `closed-time`. Just bubble-sort and therefore O(n^2)"
(let ((game-task-info-array (-> *game-info* mission-list))
(i (max 0 (+ arg0 -1)))
)
(let ((a0-3 0))
(while (> a1-1 0)
(while (< a0-3 a1-1)
(when (and (logtest? (-> v1-1 a0-3 flags) (game-task-node-flag closed))
(logtest? (-> v1-1 (+ a0-3 1) flags) (game-task-node-flag closed))
(< (-> v1-1 a0-3 close-time) (-> v1-1 (+ a0-3 1) close-time))
(let ((j 0))
(while (> i 0)
(while (< j i)
(when (and (logtest? (-> game-task-info-array j flags) (game-task-node-flag closed))
(logtest? (-> game-task-info-array (+ j 1) flags) (game-task-node-flag closed))
(< (-> game-task-info-array j close-time) (-> game-task-info-array (+ j 1) close-time))
)
(let ((a2-19 (-> v1-1 a0-3)))
(set! (-> v1-1 a0-3) (-> v1-1 (+ a0-3 1)))
(set! (-> v1-1 (+ a0-3 1)) a2-19)
(let ((task-info (-> game-task-info-array j)))
(set! (-> game-task-info-array j) (-> game-task-info-array (+ j 1)))
(set! (-> game-task-info-array (+ j 1)) task-info)
)
)
(+! a0-3 1)
(+! j 1)
)
(+! a1-1 -1)
(set! a0-3 0)
(+! i -1)
(set! j 0)
)
)
)
@@ -5766,85 +5764,91 @@
)
)
(defmethod draw-option menu-language-game-option ((obj menu-language-game-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
(defmethod draw-option menu-language-game-option ((obj menu-language-game-option)
(progress progress)
(font-ctx font-context)
(option-index int)
(selected symbol)
)
(with-pp
(let ((f30-0 (* 2.0 (- 0.5 (-> arg0 menu-transition)))))
(let ((v1-2 arg1))
(set! (-> v1-2 scale) 0.65)
(let ((alpha (* 2.0 (- 0.5 (-> progress menu-transition)))))
(let ((font-ctx-1 font-ctx))
(set! (-> font-ctx-1 scale) 0.65)
)
(case arg2
(case option-index
((2)
(+! (-> arg1 origin y) 20.0)
(+! (-> font-ctx origin y) 20.0)
)
((3)
(+! (-> arg1 origin y) 32.0)
(+! (-> font-ctx origin y) 32.0)
)
)
(if (< f30-0 0.0)
(set! f30-0 0.0)
(if (< alpha 0.0)
(set! alpha 0.0)
)
(set! (-> arg1 alpha) f30-0)
(let ((a0-5 arg1))
(set! (-> a0-5 flags) (font-flags kerning middle large))
(set! (-> font-ctx alpha) alpha)
(let ((font-ctx-2 font-ctx))
(set! (-> font-ctx-2 flags) (font-flags kerning middle large))
)
(let ((s4-0 (&-> *setting-control* user-default language)))
(let ((curr-language-ptr (&-> *setting-control* user-default language)))
(cond
((and (= (-> *progress-state* game-options-item-selected) 3) (-> *progress-state* game-options-item-picked))
(let ((a0-7 arg1))
(set! (-> a0-7 color) (font-color progress-force-selected))
(let ((font-ctx-3 font-ctx))
(set! (-> font-ctx-3 color) (font-color progress-force-selected))
)
(draw-highlight (the int (-> arg1 origin y)) 44 f30-0)
(let ((s3-0 print-game-text))
(draw-highlight (the int (-> font-ctx origin y)) 44 alpha)
(let ((print-game-text-fn-1 print-game-text))
(format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> obj name) #f))
(s3-0 *temp-string* arg1 #f 44 (bucket-id progress))
(print-game-text-fn-1 *temp-string* font-ctx #f 44 (bucket-id progress))
)
(+! (-> arg1 origin y) 24.0)
(+! (-> font-ctx origin y) 24.0)
(-> obj language-selection)
(let ((s4-1 (-> s4-0 0)))
(let ((curr-language (-> curr-language-ptr 0)))
7
(if (-> obj language-transition)
(seekl! (-> obj language-x-offset) 150 (the int (* 10.0 (-> pp clock time-adjust-ratio))))
)
(when (>= (-> obj language-x-offset) 75)
(set! (-> obj language-selection) (the-as uint s4-1))
(set! (-> obj language-selection) (the-as uint curr-language))
(set! (-> obj language-transition) #f)
(set! (-> obj language-x-offset) 0)
0
)
)
(let ((a0-14 arg1))
(set! (-> a0-14 color) (font-color progress))
(let ((font-ctx-4 font-ctx))
(set! (-> font-ctx-4 color) (font-color progress))
)
(let ((v1-33 arg1))
(set! (-> v1-33 scale) 0.5)
(let ((font-ctx-5 font-ctx))
(set! (-> font-ctx-5 scale) 0.5)
)
(let ((a0-16 arg1))
(set! (-> a0-16 color) (font-color progress))
(let ((font-ctx-6 font-ctx))
(set! (-> font-ctx-6 color) (font-color progress))
)
(+! (-> arg1 origin x) -70.0)
(let ((s5-1 print-game-text))
(+! (-> font-ctx origin x) -70.0)
(let ((print-game-text-fn-2 print-game-text))
(format (clear *temp-string*) "~33L~C" 163)
(s5-1 *temp-string* arg1 #f 44 (bucket-id progress))
(print-game-text-fn-2 *temp-string* font-ctx #f 44 (bucket-id progress))
)
(+! (-> arg1 origin x) 70.0)
(+! (-> arg1 origin x) 70.0)
(let ((s5-2 print-game-text))
(+! (-> font-ctx origin x) 70.0)
(+! (-> font-ctx origin x) 70.0)
(let ((print-game-text-fn-3 print-game-text))
(format (clear *temp-string*) "~33L~C" 161)
(s5-2 *temp-string* arg1 #f 44 (bucket-id progress))
(print-game-text-fn-3 *temp-string* font-ctx #f 44 (bucket-id progress))
)
(+! (-> arg1 origin x) -70.0)
(let ((s5-3 arg1))
(set! (-> s5-3 color) (progress-selected 0))
(+! (-> font-ctx origin x) -70.0)
(let ((font-ctx-7 font-ctx))
(set! (-> font-ctx-7 color) (progress-selected 0))
)
(let ((v1-43 (if (and (= (scf-get-territory) GAME_TERRITORY_SCEE) (zero? (-> *progress-state* game-options-language-index)))
7
(-> *progress-state* game-options-language-index)
)
)
(let ((language-name-idx
(if (and (= (scf-get-territory) 1) (zero? (-> *progress-state* game-options-language-index)))
7
(-> *progress-state* game-options-language-index)
)
)
)
(print-game-text
(lookup-text! *common-text* (-> *language-name-remap* v1-43) #f)
arg1
(lookup-text! *common-text* (-> *language-name-remap* language-name-idx) #f)
font-ctx
#f
44
(bucket-id progress)
@@ -5854,45 +5858,50 @@
(else
(cond
((= (-> *progress-state* game-options-item-selected) 3)
(let ((s3-1 arg1))
(set! (-> s3-1 color) (progress-selected 0))
(let ((font-ctx-8 font-ctx))
(set! (-> font-ctx-8 color) (progress-selected 0))
)
(draw-highlight (the int (-> arg1 origin y)) 24 f30-0)
(draw-highlight (the int (-> font-ctx origin y)) 24 alpha)
)
(else
(let ((a0-33 arg1))
(set! (-> a0-33 color) (font-color progress))
(let ((font-ctx-9 font-ctx))
(set! (-> font-ctx-9 color) (font-color progress))
)
)
)
(let ((v1-52 arg1))
(set! (-> v1-52 scale) 0.65)
(let ((font-ctx-10 font-ctx))
(set! (-> font-ctx-10 scale) 0.65)
)
(let ((s3-2 print-game-text))
(let ((print-game-text-fn-4 print-game-text))
(format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> obj name) #f))
(s3-2 *temp-string* arg1 #f 44 (bucket-id progress))
(print-game-text-fn-4 *temp-string* font-ctx #f 44 (bucket-id progress))
)
(let ((v1-54 arg1))
(set! (-> v1-54 scale) 0.5)
(let ((font-ctx-11 font-ctx))
(set! (-> font-ctx-11 scale) 0.5)
)
(let ((a0-40 arg1))
(set! (-> a0-40 color) (font-color progress))
(let ((font-ctx-12 font-ctx))
(set! (-> font-ctx-12 color) (font-color progress))
)
(format
(clear *temp-string*)
"~S"
(lookup-text! *common-text* (-> *language-name-remap* (-> curr-language-ptr 0)) #f)
)
(format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> *language-name-remap* (-> s4-0 0)) #f))
*temp-string*
(+! (-> arg1 origin y) 24.0)
(let ((a0-44 arg1))
(set! (-> a0-44 flags) (font-flags kerning middle large))
(+! (-> font-ctx origin y) 24.0)
(let ((font-ctx-13 font-ctx))
(set! (-> font-ctx-13 flags) (font-flags kerning middle large))
)
(let ((v1-66 (if (and (= (scf-get-territory) GAME_TERRITORY_SCEE) (zero? (-> *progress-state* game-options-language-index)))
7
(-> *progress-state* game-options-language-index)
)
)
(let ((language-name-idx-2
(if (and (= (scf-get-territory) 1) (zero? (-> *progress-state* game-options-language-index)))
7
(-> *progress-state* game-options-language-index)
)
)
)
(print-game-text
(lookup-text! *common-text* (-> *language-name-remap* v1-66) #f)
arg1
(lookup-text! *common-text* (-> *language-name-remap* language-name-idx-2) #f)
font-ctx
#f
44
(bucket-id progress)
@@ -807,14 +807,14 @@
)
(define *language-name-remap* (new 'static 'boxed-array :type text-id
(text-id text-x111)
(text-id text-x112)
(text-id text-x113)
(text-id text-x114)
(text-id text-x115)
(text-id text-x117)
(text-id text-x116)
(text-id text-x30b)
(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)
)
)
+8 -9
View File
@@ -54,7 +54,7 @@
(stereo-mode-backup int32 :offset-assert 216)
(secrets-unlocked symbol :offset-assert 220)
(missions-total-spacing float :offset-assert 224)
(clear-screen basic :offset-assert 228)
(clear-screen symbol :offset-assert 228)
)
:method-count-assert 9
:size-assert #xe8
@@ -967,10 +967,10 @@
(defmethod respond-to-cpad progress ((obj progress))
(mc-get-slot-info 0 *progress-save-info*)
(when (-> obj current-options)
(let ((s5-0 (-> obj current-options options)))
(when (and s5-0 (= (-> obj menu-transition) 0.0))
(let ((option-array (-> obj current-options options)))
(when (and option-array (= (-> obj menu-transition) 0.0))
(respond-progress
(the-as menu-option (-> s5-0 (-> obj option-index)))
(the-as menu-option (-> option-array (-> obj option-index)))
obj
(and (= (-> obj menu-transition) 0.0) (-> obj selected-option))
)
@@ -996,7 +996,7 @@
((= (-> obj current-options) *main-options*)
(sound-play "ring-select")
)
((!= (length s5-0) 1)
((!= (length option-array) 1)
(sound-play "roll-over")
)
)
@@ -1017,7 +1017,7 @@
((= (-> obj current-options) *main-options*)
(sound-play "ring-select")
)
((!= (length s5-0) 1)
((!= (length option-array) 1)
(sound-play "roll-over")
)
)
@@ -1060,8 +1060,7 @@
)
(defbehavior progress-trans progress ()
;; pc port note : added variable
;; og:preserve-this pc port note : added variable
(let ((speed-mod (if (-> *pc-settings* fast-progress?) (-> *pc-cheat-state* progress-speed) 1.0)))
(cond
((and (= (-> self next) 'none)
@@ -2385,7 +2384,7 @@
((and (cpad-pressed? 0 confirm) (!= (-> arg0 current) 'none))
(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* clear-screen) (the-as basic #t))
(set! (-> *progress-state* clear-screen) #t)
(cond
((-> s5-0 0)
(sound-play "generic-beep")
+10 -8
View File
@@ -83,13 +83,13 @@
(progress-on #x10e)
(progress-off #x10f)
(progress-move-dpad #x110)
(text-x111 #x111)
(text-x112 #x112)
(text-x113 #x113)
(text-x114 #x114)
(text-x115 #x115)
(text-x116 #x116)
(text-x117 #x117)
(language-name-english #x111)
(language-name-french #x112)
(language-name-german #x113)
(language-name-spanish #x114)
(language-name-italian #x115)
(language-name-korean #x116)
(language-name-japanese #x117)
(progress-aspect-ratio #x118)
(progress-progressive-scan #x119)
(progress-video-mode #x11a)
@@ -562,7 +562,7 @@
(scene-nest-boss-intro #x306)
(scene-intro #x307)
(scene-outro #x308)
(text-x30b #x30b)
(language-name-english-uk #x30b)
(scene-subtitles-hint #x30c)
(scene-subtitles-enabled #x30d)
(scene-subtitles-disabled #x30e)
@@ -691,6 +691,8 @@
(progress-lod-high #x128c)
(progress-credits #x128d)
(progress-frame-rate #x128e)
(progress-misc-game-options #x128f)
(progress-speedrunner-mode #x1290)
)
;; ---text-id
+131 -123
View File
@@ -655,42 +655,41 @@
(none)
)
(defmethod draw-option menu-missions-option ((obj menu-missions-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
;; TODO - some naming is bad here in a few spots, cleanup once i understand it more
(defmethod draw-option menu-missions-option ((obj menu-missions-option) (progress progress) (font-ctx font-context) (arg3 int) (arg4 symbol))
(local-vars
(f0-50 float)
(sv-16 float)
(sv-20 int)
(sv-24 int)
(font-alpha float)
(task-info-idx int)
(game-task-idx int)
(sv-32 int)
(sv-40 int)
(sv-48 int)
(sv-56 int)
(num-task-info int)
(default-y-origin-4x3 int)
(sv-256 float)
(sv-260 float)
(sv-264 game-task-node-info)
(sv-268 game-task-node-info)
(sv-272 symbol)
(sv-276 hud-box)
(sv-280 float)
(sv-284 float)
(line-height float)
(inprogress-task-info game-task-node-info)
(completed-task-info game-task-node-info)
(found-closed-task? symbol)
(hud-bounds hud-box)
(font-y-pos float)
(font-scale float)
)
(set! sv-16 (* 2.0 (- 0.5 (-> arg0 menu-transition))))
(set! sv-20 1)
(set! sv-24 0)
(set! font-alpha (* 2.0 (- 0.5 (-> progress menu-transition))))
(set! task-info-idx 1)
(set! game-task-idx 0)
(set! sv-32 0)
(set! sv-40 0)
(set! sv-48 0)
(set! sv-56 95)
(set! sv-256 (* 395.0 (-> arg0 sliding)))
(set! sv-260 (* 44.0 (-> arg0 sliding-height)))
(set! sv-264 (new 'stack 'game-task-node-info))
(set! sv-268 (new 'stack 'game-task-node-info))
(set! sv-272 #t)
(set! sv-276 (new 'stack-no-clear 'hud-box))
(set! sv-280 (-> arg1 origin y))
(set! sv-284 (-> arg1 scale))
(set! num-task-info 0)
(set! default-y-origin-4x3 95)
(set! sv-256 (* 395.0 (-> progress sliding)))
(set! line-height (* 44.0 (-> progress sliding-height)))
(set! inprogress-task-info (new 'stack 'game-task-node-info))
(set! completed-task-info (new 'stack 'game-task-node-info))
(set! found-closed-task? #t)
(set! hud-bounds (new 'stack-no-clear 'hud-box))
(set! font-y-pos (-> font-ctx origin y))
(set! font-scale (-> font-ctx scale))
(set! (-> *progress-state* current-task-index) (length (-> *game-info* sub-task-list)))
(set! (-> *progress-state* current-line-index) -1)
(set! (-> *progress-state* current-task) (the-as uint -1))
@@ -698,120 +697,131 @@
(set! (-> *progress-state* extra-text-state) -1)
(set! (-> *progress-state* num-open-tasks-found) 0)
(set! (-> *progress-state* num-closed-tasks-found) 0)
(if (< sv-16 0.0)
(set! sv-16 (the-as float 0.0))
(if (< font-alpha 0.0)
(set! font-alpha (the-as float 0.0))
)
(set! (-> arg1 alpha) sv-16)
(set! (-> *game-info* mission-list 0) sv-264)
(set! (-> sv-264 description) (text-id progress-missions-in-progress))
(set! (-> sv-268 description) (text-id progress-missions-completed))
(while (< sv-24 (length (-> *game-info* sub-task-list)))
(let ((v1-26 (find-mission-text-at-index sv-24))
(a0-15 (-> *game-info* mission-list))
(set! (-> font-ctx alpha) font-alpha)
(set! (-> *game-info* mission-list 0) inprogress-task-info)
(set! (-> inprogress-task-info description) (text-id progress-missions-in-progress))
(set! (-> completed-task-info description) (text-id progress-missions-completed))
(while (< game-task-idx (length (-> *game-info* sub-task-list)))
(let ((task-info (find-mission-text-at-index game-task-idx))
(game-task-info-array (-> *game-info* mission-list))
)
(when (!= v1-26 #f)
(when (and (logtest? (-> v1-26 flags) (game-task-node-flag closed)) sv-272)
(set! sv-272 (the-as symbol #f))
(set! (-> a0-15 sv-20) sv-268)
(set! sv-20 (+ sv-20 1))
(when (!= task-info #f)
(when (and (logtest? (-> task-info flags) (game-task-node-flag closed)) found-closed-task?)
(set! found-closed-task? (the-as symbol #f))
(set! (-> game-task-info-array task-info-idx) completed-task-info)
(set! task-info-idx (+ task-info-idx 1))
)
(set! (-> a0-15 sv-20) v1-26)
(set! sv-20 (+ sv-20 1))
(set! (-> game-task-info-array task-info-idx) task-info)
(set! task-info-idx (+ task-info-idx 1))
)
)
(set! sv-24 (+ sv-24 1))
(set! game-task-idx (+ game-task-idx 1))
)
(set! sv-48 sv-20)
(set! (-> *progress-state* total-num-tasks) sv-20)
(sort-task-node-result sv-48)
(set! (-> arg1 width) 395.0)
(set! (-> arg1 origin x) 60.0)
(set! (-> arg1 origin y) 80.0)
(set-color! arg1 (font-color progress))
(set! num-task-info task-info-idx)
(set! (-> *progress-state* total-num-tasks) task-info-idx)
(sort-task-node-result num-task-info)
(let ((font-ctx-1 font-ctx))
(set! (-> font-ctx-1 width) 395.0)
)
(set! (-> font-ctx origin x) 60.0)
(set! (-> font-ctx origin y) 80.0)
(set-color! font-ctx (font-color progress))
(when (not (-> *pc-settings* use-vis?))
;; added to fix widescreen
(*! (-> arg1 width) (-> *pc-settings* aspect-ratio-reciprocal))
(set! (-> arg1 origin x) (the float (adjust-game-x (-> arg1 origin x))))
(*! (-> font-ctx width) (-> *pc-settings* aspect-ratio-reciprocal))
(set! (-> font-ctx origin x) (the float (adjust-game-x (-> font-ctx origin x))))
)
(let ((v1-40 (-> obj page-index)))
(let ((page-idx (-> obj page-index)))
(cond
((zero? v1-40)
(draw-missions-decoration obj arg1 sv-16 (text-id progress-root-missions))
((zero? page-idx)
(draw-missions-decoration obj font-ctx font-alpha (text-id progress-root-missions))
)
((= v1-40 1)
(draw-missions-decoration obj arg1 sv-16 (text-id progress-root-missions))
((= page-idx 1)
(draw-missions-decoration obj font-ctx font-alpha (text-id progress-root-missions))
)
)
)
(begin-scissor-missions sv-276)
(set-flags! arg1 (font-flags kerning large))
(begin-scissor-missions hud-bounds)
(set-flags! font-ctx (font-flags kerning large))
(if (-> *pc-settings* use-vis?)
(+! (-> arg1 origin x) 20.0)
(+! (-> arg1 origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) 20.0)))
(+! (-> font-ctx origin x) 20.0)
(+! (-> font-ctx origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) 20.0)))
(+! (-> font-ctx origin x) 20.0)
(case (get-aspect-ratio)
(('aspect16x9)
(set! (-> arg1 origin y) 80.0)
(set! (-> font-ctx origin y) 80.0)
)
(('aspect4x3)
(set! (-> arg1 origin y) (the float sv-56))
(set! (-> font-ctx origin y) (the float default-y-origin-4x3))
)
)
(set-scale! arg1 sv-284)
(let ((font-ctx-4 font-ctx))
(set! (-> font-ctx-4 scale) font-scale)
)
(when (zero? (-> obj page-index))
(set! sv-24 (-> obj task-line-index))
(set! sv-20 0)
(let ((v1-57 (+ sv-56 44)))
(set! sv-56 v1-57)
(set! (-> arg1 origin y) (the float (+ v1-57 (the int sv-260))))
(set! game-task-idx (-> obj task-line-index))
(set! task-info-idx 0)
(let ((y-offset (+ default-y-origin-4x3 44)))
(set! default-y-origin-4x3 y-offset)
(set! (-> font-ctx origin y) (the float (+ y-offset (the int line-height))))
)
(set! (-> arg1 width) 340.0)
(set! (-> arg1 height) 44.0)
(when (!= sv-260 0.0)
(set! (-> font-ctx width) 340.0)
(set! (-> font-ctx height) 44.0)
(when (!= line-height 0.0)
(set! (-> *progress-state* missions-total-spacing) 0.0)
(dotimes (s4-1 sv-24)
(let* ((s3-1 (-> *game-info* mission-list s4-1))
(a1-19
(if (and (logtest? (-> s3-1 flags) (game-task-node-flag closed)) (task-complete? *game-info* (-> s3-1 task)))
(-> *game-info* play-list (-> s3-1 task) text-name)
(-> s3-1 description)
(dotimes (game-task-idx-2 game-task-idx)
(let* ((game-task-info-2 (-> *game-info* mission-list game-task-idx-2))
(task-text-id
(if (and (logtest? (-> game-task-info-2 flags) (game-task-node-flag closed))
(task-complete? *game-info* (-> game-task-info-2 task))
)
(-> *game-info* play-list (-> game-task-info-2 task) text-name)
(-> game-task-info-2 description)
)
)
(s3-2 (lookup-text! *common-text* a1-19 #f))
(f30-0 3.0)
(s2-0 print-game-text)
(line-text (lookup-text! *common-text* task-text-id #f))
(line-padding 3.0)
(print-game-text-fn print-game-text)
)
(format (clear *temp-string*) "~S" s3-2)
(format (clear *temp-string*) "~S" line-text)
(set! (-> *progress-state* missions-total-spacing)
(+ f30-0 (s2-0 *temp-string* arg1 #t 44 (bucket-id progress)) (-> *progress-state* missions-total-spacing))
(+ line-padding
(print-game-text-fn *temp-string* font-ctx #t 44 (bucket-id progress))
(-> *progress-state* missions-total-spacing)
)
)
)
)
)
(set! sv-56 (- sv-56 (the int (-> *progress-state* missions-total-spacing))))
(set! default-y-origin-4x3 (- default-y-origin-4x3 (the int (-> *progress-state* missions-total-spacing))))
(cond
((< (-> arg0 sliding-height) 0.0)
(let* ((s4-2 (-> *game-info* mission-list sv-24))
(a1-23
(if (and (logtest? (-> s4-2 flags) (game-task-node-flag closed)) (task-complete? *game-info* (-> s4-2 task)))
(-> *game-info* play-list (-> s4-2 task) text-name)
(-> s4-2 description)
)
)
(s4-3 (lookup-text! *common-text* a1-23 #f))
((< (-> progress sliding-height) 0.0)
(let* ((game-task-info-3 (-> *game-info* mission-list game-task-idx))
(task-text-id-2 (if (and (logtest? (-> game-task-info-3 flags) (game-task-node-flag closed))
(task-complete? *game-info* (-> game-task-info-3 task))
)
(-> *game-info* play-list (-> game-task-info-3 task) text-name)
(-> game-task-info-3 description)
)
)
(line-text-2 (lookup-text! *common-text* task-text-id-2 #f))
)
0.0
(let ((f30-1 3.0)
(s3-3 print-game-text)
(let ((line-padding-2 3.0)
(print-game-text-fn-2 print-game-text)
)
(format (clear *temp-string*) "~S" s4-3)
(let ((f0-36 (+ f30-1 (s3-3 *temp-string* arg1 #t 44 (bucket-id progress)))))
(set! sv-260 (* (-> arg0 sliding-height) f0-36))
(format (clear *temp-string*) "~S" line-text-2)
(let ((f0-36 (+ line-padding-2 (print-game-text-fn-2 *temp-string* font-ctx #t 44 (bucket-id progress)))))
(set! line-height (* (-> progress sliding-height) f0-36))
)
)
)
)
(else
(let* ((s4-4 (-> *game-info* mission-list (+ sv-24 -1)))
(let* ((s4-4 (-> *game-info* mission-list (+ game-task-idx -1)))
(a1-27
(if (and (logtest? (-> s4-4 flags) (game-task-node-flag closed)) (task-complete? *game-info* (-> s4-4 task)))
(-> *game-info* play-list (-> s4-4 task) text-name)
@@ -825,16 +835,16 @@
(s3-4 print-game-text)
)
(format (clear *temp-string*) "~S" s4-5)
(let ((f0-40 (+ f30-2 (s3-4 *temp-string* arg1 #t 44 (bucket-id progress)))))
(set! sv-260 (* (-> arg0 sliding-height) f0-40))
(let ((f0-40 (+ f30-2 (s3-4 *temp-string* font-ctx #t 44 (bucket-id progress)))))
(set! line-height (* (-> progress sliding-height) f0-40))
)
)
)
)
)
(set! (-> arg1 origin y) (the float (+ sv-56 (the int sv-260))))
(while (and (< sv-20 sv-48) (< sv-20 (+ sv-24 10)))
(let* ((s4-6 (-> *game-info* mission-list sv-20))
(set! (-> font-ctx origin y) (the float (+ default-y-origin-4x3 (the int line-height))))
(while (and (< task-info-idx num-task-info) (< task-info-idx (+ game-task-idx 10)))
(let* ((s4-6 (-> *game-info* mission-list task-info-idx))
(s3-5
(if (and (logtest? (-> s4-6 flags) (game-task-node-flag closed)) (task-complete? *game-info* (-> s4-6 task)))
(-> *game-info* play-list (-> s4-6 task) text-name)
@@ -846,7 +856,7 @@
0.0
(set! f0-50
(cond
((>= sv-20 (+ sv-24 -1))
((>= task-info-idx (+ game-task-idx -1))
(when (and (!= s3-5 381) (!= s3-5 380))
(let ((s3-6 print-game-text))
(format (clear *temp-string*) "~S" (lookup-text!
@@ -858,21 +868,21 @@
#f
)
)
(s3-6 *temp-string* arg1 #f 44 (bucket-id progress))
(s3-6 *temp-string* font-ctx #f 44 (bucket-id progress))
)
)
(if (-> *pc-settings* use-vis?)
(+! (-> arg1 origin x) 20.0)
(+! (-> arg1 origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) 20.0)))
(+! (-> font-ctx origin x) 20.0)
(+! (-> font-ctx origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) 20.0)))
(let ((f30-3 3.0)
(s4-7 print-game-text)
)
(format (clear *temp-string*) "~S" s5-1)
(set! f0-50 (+ f30-3 (s4-7 *temp-string* arg1 #f 44 (bucket-id progress))))
(set! f0-50 (+ f30-3 (s4-7 *temp-string* font-ctx #f 44 (bucket-id progress))))
)
(if (-> *pc-settings* use-vis?)
(+! (-> arg1 origin x) -20.0)
(+! (-> arg1 origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) -20.0)))
(+! (-> font-ctx origin x) -20.0)
(+! (-> font-ctx origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) -20.0)))
f0-50
)
(else
@@ -880,30 +890,30 @@
(s4-8 print-game-text)
)
(format (clear *temp-string*) "~S" s5-1)
(+ f30-4 (s4-8 *temp-string* arg1 #t 44 (bucket-id progress)))
(+ f30-4 (s4-8 *temp-string* font-ctx #t 44 (bucket-id progress)))
)
)
)
)
)
(let ((v1-142 (+ sv-56 (the int f0-50))))
(set! sv-56 v1-142)
(set! (-> arg1 origin y) (the float (+ v1-142 (the int sv-260))))
(let ((v1-142 (+ default-y-origin-4x3 (the int f0-50))))
(set! default-y-origin-4x3 v1-142)
(set! (-> font-ctx origin y) (the float (+ v1-142 (the int line-height))))
)
(set! sv-20 (+ sv-20 1))
(set! task-info-idx (+ task-info-idx 1))
)
(if (zero? (-> *progress-state* total-num-tasks))
(print-game-text
(lookup-text! *common-text* (text-id progress-missions-none) #f)
arg1
font-ctx
#f
44
(bucket-id progress)
)
)
)
(end-scissor-missions sv-276 1.0)
(draw-missions-up-down arg1)
(end-scissor-missions hud-bounds 1.0)
(draw-missions-up-down font-ctx)
0
(none)
)
@@ -2521,5 +2531,3 @@
(draw-mouse))
)))
)
@@ -0,0 +1,312 @@
;;-*-Lisp-*-
(in-package goal)
(defun draw-page-border ((hud-bounds hud-box) (alpha float))
(let ((x-pos 70)
(y-pos 112)
(width 375)
(background-height 200))
(when (= (get-aspect-ratio) 'aspect16x9)
(set! x-pos 79)
(set! y-pos 86)
(set! width 356)
(set! background-height 255))
(#when PC_PORT
;; added for better widescreen handling
(when (not (-> *pc-settings* use-vis?))
(set! x-pos (the int (adjust-game-x (the float x-pos))))
(set! width (the int (* (-> *pc-settings* aspect-ratio-reciprocal) width)))))
(set-vector! (-> hud-bounds color) 64 128 128 (the int (* 128.0 alpha)))
;; Top Line
(set! (-> hud-bounds min x) (the float x-pos))
(set! (-> hud-bounds max x) (the float (+ x-pos width)))
(set! (-> hud-bounds min y) (the float y-pos))
(set! (-> hud-bounds max y) (the float y-pos))
(with-dma-buffer-add-bucket ((buffer-1 (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress))
((method-of-type hud-box draw-box-prim-only) hud-bounds buffer-1))
;; Bottom Line
(set! (-> hud-bounds min x) (the float x-pos))
(set! (-> hud-bounds max x) (the float (+ x-pos width)))
(set! (-> hud-bounds min y) (the float (+ y-pos background-height)))
(set! (-> hud-bounds max y) (the float (+ y-pos background-height)))
(with-dma-buffer-add-bucket ((buffer-2 (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress))
((method-of-type hud-box draw-box-prim-only) hud-bounds buffer-2)))
(none))
(defun draw-page-background ((alpha float))
(let ((x-pos 70)
(y-pos 112)
(width 375)
(background-height 200))
(when (= (get-aspect-ratio) 'aspect16x9)
(set! x-pos 79)
(set! y-pos 86)
(set! width 356)
(set! background-height 256))
(#when PC_PORT
;; added for better widescreen handling
(when (not (-> *pc-settings* use-vis?))
(set! x-pos (the int (adjust-game-x (the float x-pos))))
(set! width (the int (* (-> *pc-settings* aspect-ratio-reciprocal) width)))))
(with-dma-buffer-add-bucket ((buffer (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id particles))
(draw-sprite2d-xy buffer x-pos y-pos width background-height
(new 'static 'rgba :r #x40 :g #x40 :b #x40 :a (the int (* 64.0 alpha))))))
(none))
(defun draw-page-header ((font-ctx font-context) (text text-id))
(let ((x-pos 70)
(y-pos 85)
(width 375))
(when (= (get-aspect-ratio) 'aspect16x9)
(set! x-pos 79)
(set! y-pos 55)
(set! width 356))
(set-scale! font-ctx 0.75)
(set! (-> font-ctx height) 20.0)
(set! (-> font-ctx origin y) (the float y-pos))
(set-color! font-ctx (font-color progress))
(print-game-text (lookup-text! *common-text* text #f) font-ctx #f 44 (bucket-id progress)))
(none))
(defun draw-scrolling-page-up-down-arrows ((font-ctx font-context) (draw-up? symbol) (draw-down? symbol))
(let ((new-x-pos 250.0)
(new-y-pos-up 100)
(new-y-pos-down 211)
(new-scale 0.5)
(old-scale (-> font-ctx scale))
(old-x-pos (-> font-ctx origin x))
(old-y-pos (-> font-ctx origin y)))
(when (= (get-aspect-ratio) 'aspect16x9)
(set! new-x-pos 251.5)
(set! new-y-pos-up 75)
(set! new-y-pos-down 265))
(set! (-> font-ctx scale) new-scale)
(when draw-up?
(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))))
(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))))
(set! (-> font-ctx origin x) old-x-pos)
(set! (-> font-ctx origin y) old-y-pos)
(set! (-> font-ctx scale) old-scale))
(none))
;; The boundary info could be moved to the menu-option, every one of these is duplicate code
(defun begin-scissor-scrolling-page ((hud-bounds hud-box))
(cond
((= (get-aspect-ratio) 'aspect16x9)
(set! (-> hud-bounds min x) 19.0)
(set! (-> hud-bounds min y) 86.0)
(set! (-> hud-bounds max x) 494.0)
(set! (-> hud-bounds max y) 340.0))
(else
(set! (-> hud-bounds min x) 70.0)
(set! (-> hud-bounds min y) 112.0)
(set! (-> hud-bounds max x) 444.0)
(set! (-> hud-bounds max y) 312.0)))
(#when PC_PORT
(set! (-> hud-bounds min x) (the float (the int (adjust-game-x (-> hud-bounds min x)))))
(set! (-> hud-bounds max x) (the float (the int (adjust-game-x (-> hud-bounds max x))))))
(with-dma-buffer-add-bucket ((buffer (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress))
(setup-scissor hud-bounds buffer))
(none))
(defun end-scissor-scrolling-page ((hud-bounds hud-box) (arg1 float))
(with-dma-buffer-add-bucket ((buffer (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress)
)
(restore-scissor hud-bounds buffer))
(none))
(defmethod draw-option menu-generic-scrolling-page ((obj menu-generic-scrolling-page) (progress progress) (font-ctx font-context) (arg3 int) (arg4 symbol))
;; (inspect obj)
(when (or (zero? (-> obj mounted?)) (not (-> obj mounted?)))
(on-mount! obj))
;; the list has a total of 200px of y-height
;; with 10px of margin at the top and bottom, that leaves 180 / 4 = 45px per item
;; it's the responsibility of each generic component to center itself within these 45px lines
(when (not (-> *progress-pc-generic-store* clear-screen?))
(let ((font-alpha (fmax 0.0 (* 2.0 (- 0.5 (-> progress menu-transition)))))
(hud-bounds (new 'stack-no-clear 'hud-box))
(max-page-size (if (= (get-aspect-ratio) 'aspect16x9) 5 4))
(margin-top-bottom 10.0)
(line-height 45.0))
(set! (-> font-ctx alpha) font-alpha)
(set-color! font-ctx (font-color progress))
;; header
(draw-page-header font-ctx (-> obj name))
;; background borders
(draw-page-border (-> obj box 0) font-alpha)
;; background
(draw-page-background font-alpha)
(begin-scissor-scrolling-page hud-bounds)
(if (= (get-aspect-ratio) 'aspect16x9)
(set! (-> font-ctx origin y) (+ 86.0 margin-top-bottom))
(set! (-> font-ctx origin y) (+ 112.0 margin-top-bottom)))
;; render items
(let* ((menu-option-index (if (< (-> *progress-pc-generic-store* current-menu-hover-index) max-page-size)
0
(-> *progress-pc-generic-store* current-menu-hover-index)))
(end-index (min (-> obj menu-options length) (+ menu-option-index max-page-size))))
(while (< menu-option-index end-index)
(let ((menu-option (-> obj menu-options menu-option-index)))
(when (nonzero? menu-option)
;; save the y position as who knows where it will end up after the component finishes rendering
(let ((old-y-pos (-> font-ctx origin y)))
(draw-option menu-option progress font-ctx menu-option-index
(= (-> obj selected-option-index) menu-option-index))
;; move to the next line
(set! (-> font-ctx origin y) (+ old-y-pos line-height))
;; reset the font color
(set-color! font-ctx (font-color progress)))))
(+! menu-option-index 1)))
;; end
(end-scissor-scrolling-page hud-bounds 1.0)
(set-flags! font-ctx (font-flags kerning large))
(let* ((draw-up-arrow? (and (not (zero? (-> *progress-pc-generic-store* current-menu-hover-index)))
(>= (-> *progress-pc-generic-store* current-menu-hover-index) max-page-size)))
(last-page-remainder (mod (-> obj menu-options length) max-page-size))
(last-page-starting-index (if (zero? last-page-remainder)
(- (-> obj menu-options length) max-page-size)
(- (-> obj menu-options length) last-page-remainder)))
(draw-down-arrow? (and (> (-> obj menu-options length) max-page-size)
(< (-> *progress-pc-generic-store* current-menu-hover-index) last-page-starting-index))))
(draw-scrolling-page-up-down-arrows font-ctx draw-up-arrow? draw-down-arrow?))))
(none))
(defun draw-generic-highlight ((y-pos int) (height int) (alpha float))
(let ((x-pos (if (= (get-aspect-ratio) 'aspect4x3)
70
50))
(width (if (= (get-aspect-ratio) 'aspect4x3)
374
500)))
;; og:preserve-this
(#when PC_PORT
;; added for better widescreen handling
(when (not (-> *pc-settings* use-vis?))
(set! x-pos (the int (adjust-game-x (the float x-pos))))
(set! width (the int (* (-> *pc-settings* aspect-ratio-reciprocal) width)))))
(with-dma-buffer-add-bucket ((buffer (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress)
)
(draw-sprite2d-xy buffer x-pos y-pos width height
(new 'static 'rgba :r #x40 :g #x80 :b #x80 :a (the int (* 64.0 alpha)))))))
(defmethod draw-option menu-generic-boolean-option ((obj menu-generic-boolean-option) (arg0 progress) (arg1 font-context) (option-index int) (selected? symbol))
(when (not (-> obj mounted?))
(on-mount! obj))
(let ((alpha (* 2.0 (- 0.5 (-> arg0 menu-transition))))
(line-height 23.0))
(max! alpha 0.0)
(set! (-> arg1 alpha) alpha)
(set-flags! arg1 (font-flags kerning middle large))
(set-scale! arg1 0.65)
(+! (-> arg1 origin y) 5.0)
(cond
(selected?
(set-color! arg1 (font-color progress-force-selected))
(draw-generic-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) line-height)
(set! *temp-string* (clear *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))))
;; hover case
(else
(cond
((= option-index (-> *progress-pc-generic-store* current-menu-hover-index))
(set-color! arg1 (progress-selected 0))
(draw-generic-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) line-height)
(set! *temp-string* (clear *temp-string*))
(let ((actual-value (if (and (nonzero? (-> obj get-value-fn)) (!= (-> obj get-value-fn) #f))
((-> obj get-value-fn))
#f)))
(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))))))
(set-scale! arg1 0.5)
(print-game-text *temp-string* arg1 #f 44 (bucket-id progress)))
(none))
(defmethod draw-option menu-generic-carousel-option ((obj menu-generic-carousel-option)
(progress progress)
(font-ctx font-context)
(option-index int)
(selected? symbol))
(when (not (-> obj mounted?))
(on-mount! obj))
(let ((alpha (fmax (* 2.0 (- 0.5 (-> progress menu-transition))) 0.0)))
(set! (-> font-ctx scale) 0.65)
(set! (-> font-ctx alpha) alpha)
(+! (-> font-ctx origin y) 2.5)
(set-flags! font-ctx (font-flags kerning middle large))
;; the item label
(cond
(selected?
(set! (-> font-ctx color) (font-color progress-force-selected))
(draw-generic-highlight (the int (-> font-ctx origin y)) 44 alpha))
((= option-index (-> *progress-pc-generic-store* current-menu-hover-index))
(set! (-> font-ctx color) (progress-selected 0))
(draw-generic-highlight (the int (-> font-ctx origin y)) 24 alpha)))
(format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> obj name) #f))
(print-game-text *temp-string* font-ctx #f 44 (bucket-id progress))
(+! (-> font-ctx origin y) 24.0)
(set! (-> font-ctx scale) 0.5)
(set! (-> font-ctx color) (font-color progress))
(when selected?
;; left arrow
(+! (-> font-ctx origin x) -70.0)
(format (clear *temp-string*) "~33L~C" 163)
(print-game-text *temp-string* font-ctx #f 44 (bucket-id progress))
(+! (-> font-ctx origin x) 70.0)
(+! (-> font-ctx origin x) 70.0)
;; right arrow
(format (clear *temp-string*) "~33L~C" 161)
(print-game-text *temp-string* font-ctx #f 44 (bucket-id progress))
(+! (-> font-ctx origin x) -70.0)
(set! (-> font-ctx color) (progress-selected 0)))
;; the value
;; TODO - bounds checking would be smart
(if selected?
(print-game-text (lookup-text! *common-text* (-> obj items (-> obj item-index)) #f) font-ctx #f 44 (bucket-id progress))
(let ((actual-index (if (and (nonzero? (-> obj get-item-index-fn)) (!= (-> obj get-item-index-fn) #f))
((-> obj get-item-index-fn))
0)))
(print-game-text (lookup-text! *common-text* (-> obj items actual-index) #f) font-ctx #f 44 (bucket-id progress)))))
(none))
(defmethod draw-option menu-generic-link-option ((obj menu-generic-link-option) (arg0 progress) (arg1 font-context) (option-index int) (selected? symbol))
(when (not (-> obj mounted?))
(on-mount! obj))
(let ((alpha (* 2.0 (- 0.5 (-> arg0 menu-transition))))
(line-height 23.0))
(max! alpha 0.0)
(set! (-> arg1 alpha) alpha)
(set-flags! arg1 (font-flags kerning middle large))
(set-scale! arg1 0.65)
(+! (-> arg1 origin y) 12.5)
(cond
((= option-index (-> *progress-pc-generic-store* current-menu-hover-index))
(set-color! arg1 (progress-selected 0))
(draw-generic-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)))
(none))
@@ -0,0 +1,94 @@
;;-*-Lisp-*-
(in-package goal)
;; TODO:
;; - slider
;; - disabled options
;; - detail list
(deftype generic-progress-state-entry (structure)
"All info that is pushed onto a 'stack' when navigating to a sub-menu with
the new generic menu options"
(;; what needs to be drawn now, the normal progress code figures this out with a hard-coded switch statement, this avoids that
(ref menu-option-list)
;; generic function to potentially run some setup code when the entry is loaded
(on-load (function none))
;; so we can restore back to the same menu position
(hover-index int32)
;; symbol used normally for progress stuff
(progress-id symbol)))
(deftype progress-pc-generic-store (structure)
"Isolated type for keeping track of some global state, as re-using the normal [[*progress*]] object
can lead to unexpected behaviour -- they change some values all over the place"
((current-menu-hover-index int32)
(clear-screen? symbol)
(history-stack generic-progress-state-entry 10 :inline)
(history-stack-index int32))
(:methods
(init! (_type_) none)
(navigate! (_type_ progress menu-option-list (function none)) none)
(back! (_type_ progress) none)
(has-history? (_type_) symbol)
(clear-history-if-empty! (_type_) none)))
(define *progress-pc-generic-store* (new 'static 'progress-pc-generic-store))
(deftype menu-generic-option (menu-option)
((mounted? symbol))
(:methods
(on-mount! "Called when the menu item is first drawn as a means to initialize defaults, etc" (_type_) none)))
;; TODO - make methods for calling the lambdas just to reduce duplication (checking if the value is set, etc)
(deftype menu-generic-boolean-option (menu-generic-option)
"Generic two option menu entry (ie. yes/no)"
(;; props
(truthy-text text-id)
(falsey-text text-id)
;; state
(value symbol)
;; lambdas
(get-value-fn (function symbol))
(on-confirm (function symbol none))))
;; TODO - make methods for calling the lambdas just to reduce duplication (checking if the value is set, etc)
(deftype menu-generic-carousel-option (menu-generic-option)
"Generic left-right menu entry (ie. language selection)"
(;; props
(items (array text-id))
;; state
(item-index int32)
;; lambdas
(get-item-index-fn (function int))
(on-confirm (function int none))))
(deftype menu-generic-scrolling-page (menu-generic-option)
"A menu option that holds menu options"
(;; props
(menu-options (array menu-option))
(header text-id)
;; state
(selected-option-item menu-option)
(selected-option-index int32)
(last-move time-frame)))
;; TODO - make methods for calling the lambdas just to reduce duplication (checking if the value is set, etc)
(deftype menu-generic-link-option (menu-generic-option)
"A very simple link option that allows you to link to any other menu-option"
(;; props
(target menu-option-list)
;; generic function to potentially run some setup code when the entry is loaded
(on-load (function none))))
(defmacro progress-new-generic-scrolling-page (title &rest options)
`(new 'static 'menu-option-list
:options (new 'static 'boxed-array :type menu-option
(new 'static 'menu-generic-scrolling-page
:name ,title ; (text-id progress-misc-game-options)
:menu-options (new 'static 'boxed-array :type menu-option
,@options)))))
(defmacro progress-new-generic-link (text target)
`(new 'static 'menu-generic-link-option
:name ,text
:target ,target))
@@ -0,0 +1,268 @@
;;-*-Lisp-*-
(in-package goal)
(defmethod init! progress-pc-generic-store ((this progress-pc-generic-store))
(set! (-> this clear-screen?) #f)
(none))
(defmethod navigate! progress-pc-generic-store ((this progress-pc-generic-store) (progress progress) (target menu-option-list) (on-load (function none)))
(when (< (-> this history-stack-index) 9) ;; hard-coded length
;; if this is the first history entry, we push the current page as well
;; if it's not, then we update the current entry before proceeding to the next page
(if (has-history? this)
(let ((stack-entry (-> this history-stack (-> this history-stack-index))))
(set! (-> stack-entry hover-index) (-> this current-menu-hover-index))
(set! (-> stack-entry progress-id) (-> progress current)))
(let ((stack-entry (-> this history-stack (-> this history-stack-index))))
(set! (-> stack-entry ref) (-> progress current-options))
(set! (-> stack-entry on-load) on-load)
(set! (-> stack-entry hover-index) (-> this current-menu-hover-index))
(set! (-> stack-entry progress-id) (-> progress current))))
;; push the target history entry now
(inc! (-> this history-stack-index))
;; Create a new stack entry
(let ((stack-entry (-> this history-stack (-> this history-stack-index))))
(set! (-> stack-entry ref) target)
(set! (-> stack-entry on-load) on-load)
(set! (-> stack-entry hover-index) 0)
(set! (-> stack-entry progress-id) 'generic-menu))
;; Update global state
(set! (-> this clear-screen?) #t)
(set! (-> progress next) 'generic-menu)
(set! (-> progress selected-option) #f))
(none))
(defmethod back! progress-pc-generic-store ((this progress-pc-generic-store) (progress progress))
(set! (-> this history-stack-index) (max 0 (dec (-> this history-stack-index))))
(set! (-> this clear-screen?) #t)
(set! (-> progress next) 'generic-menu)
(set! (-> progress selected-option) #f)
(none))
(defmethod has-history? progress-pc-generic-store ((this progress-pc-generic-store))
(> (-> this history-stack-index) 0))
(defmethod clear-history-if-empty! progress-pc-generic-store ((this progress-pc-generic-store))
;; if we are have no history, just reset the entry. This is so we don't preserve state
;; after completely exiting the menu
(when (not (has-history? this))
(set! (-> this history-stack-index) 0)
(set! (-> this clear-screen?) #f)
(set! (-> this current-menu-hover-index) 0)
(let ((stack-entry (-> this history-stack (-> this history-stack-index))))
(set! (-> stack-entry hover-index) 0)
(set! (-> stack-entry ref) #f)
(set! (-> stack-entry on-load) #f)
(set! (-> stack-entry progress-id) #f)))
(none))
(defmethod on-mount! menu-generic-option ((this menu-generic-option))
(set! (-> this mounted?) #t)
(none))
(defmethod on-mount! menu-generic-carousel-option ((this menu-generic-carousel-option))
(set! (-> this mounted?) #t)
(set! (-> this item-index) 0)
(none))
(defmethod on-mount! menu-generic-scrolling-page ((this menu-generic-scrolling-page))
(set! (-> this mounted?) #t)
(set! (-> this selected-option-item) #f)
(set! (-> this selected-option-index) -1)
(none))
;; Progress Code Overrides
(defmethod respond-to-cpad progress ((obj 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))
(has-generic-history? (has-history? *progress-pc-generic-store*)))
(when (and option-array (= (-> obj menu-transition) 0.0))
(let ((in-generic-page? (and (= (-> option-array length) 1)
(type? (-> option-array 0) menu-generic-scrolling-page))))
(cond
;; If it's a scrolling menu, we have to pull from it's list of items
(in-generic-page?
;; update the scrolling list
(respond-progress
(the-as menu-option (-> option-array 0))
obj
(and (= (-> obj menu-transition) 0.0) (-> obj 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)))
(else
(respond-progress
(the-as menu-option (-> option-array (-> obj option-index)))
obj
(and (= (-> obj menu-transition) 0.0) (-> obj selected-option)))))
(cond
((-> obj selected-option)
(cond
((cpad-pressed? 0 confirm)
(set! (-> obj selected-option) #f)
)
((cpad-pressed? 0 triangle)
(when (not in-generic-page?)
(if (= (-> obj current-options) *main-options*)
(sound-play "window-contract")
(sound-play "generic-beep")))
(set! (-> obj selected-option) #f))))
(else
(cond
((cpad-pressed? 0 up l-analog-up)
(cond
((= (-> obj 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))
(cond
((> (-> obj want-option-index) 0)
(set! (-> obj want-option-index) -1))
((< -2 (-> obj want-option-index))
(+! (-> obj want-option-index) -1))))
((cpad-pressed? 0 down l-analog-down)
(cond
((= (-> obj current-options) *main-options*)
(sound-play "ring-select"))
((!= (length option-array) 1)
(sound-play "roll-over")))
(cond
((< (-> obj want-option-index) 0)
(set! (-> obj want-option-index) 1))
((< (-> obj want-option-index) 2)
(+! (-> obj 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))
(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)))
((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*))
(sound-play "window-contract")
(sound-play "generic-beep"))
(clear-history-if-empty! *progress-pc-generic-store*)
(pop-state obj))))))))))
(none))
;; Component implementation
(defmethod respond-progress menu-generic-scrolling-page ((obj menu-generic-scrolling-page) (progress progress) (selected? symbol))
"Handle progress menu navigation logic."
(if (or (= (-> obj selected-option-item) #f)
(zero? (-> obj selected-option-item)))
(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))
(cond
((< (-> *progress-pc-generic-store* current-menu-hover-index) (dec (-> obj menu-options length)))
(+! (-> *progress-pc-generic-store* current-menu-hover-index) 1)
(sound-play "roll-over"))
(else
(set! (-> *progress-pc-generic-store* current-menu-hover-index) 0)
(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))
(+! (-> *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)))))
((cpad-pressed? 0 confirm)
;; ignore confirm if it's a link
(when (and (< (-> *progress-pc-generic-store* current-menu-hover-index) (-> obj menu-options length))
(not (type? (-> obj menu-options (-> *progress-pc-generic-store* current-menu-hover-index)) menu-generic-link-option)))
(set! (-> obj selected-option-index) (-> *progress-pc-generic-store* current-menu-hover-index))
(set! (-> obj selected-option-item) (-> obj menu-options (-> *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
(when (has-history? *progress-pc-generic-store*)
(back! *progress-pc-generic-store* progress)
(sound-play "score-slide")))
)
(cond
((cpad-pressed? 0 confirm)
(set! (-> obj selected-option-index) -1)
(set! (-> obj selected-option-item) #f))
((cpad-pressed? 0 triangle)
(set! (-> obj selected-option-index) -1)
(set! (-> obj selected-option-item) #f))))
;; 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 selected?))
0)
(defmethod respond-progress menu-generic-boolean-option ((obj 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))
(sound-play "generic-beep"))
((cpad-pressed? 0 confirm)
(when (and (nonzero? (-> obj on-confirm)) (!= (-> obj on-confirm) #f))
((-> obj on-confirm) (-> obj 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!
(when (and (nonzero? (-> obj get-value-fn))
(!= (-> obj get-value-fn) #f))
(set! (-> obj value) ((-> obj get-value-fn)))))))
0)
(defmethod respond-progress menu-generic-carousel-option ((obj 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 (-> obj items length))))
(sound-play "generic-beep"))
((cpad-pressed? 0 right l-analog-right)
(inc! (-> obj item-index))
(when (>= (-> obj item-index) (-> obj items length))
(set! (-> obj item-index) 0))
(sound-play "generic-beep"))
((cpad-pressed? 0 confirm)
(when (and (nonzero? (-> obj on-confirm)) (!= (-> obj on-confirm) #f))
((-> obj on-confirm) (-> obj 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!
(when (and (nonzero? (-> obj get-item-index-fn)) (!= (-> obj get-item-index-fn) #f))
(set! (-> obj item-index) ((-> obj get-item-index-fn)))))))
0)
(defmethod respond-progress menu-generic-link-option ((obj menu-generic-link-option) (progress progress) (selected? symbol))
(when (>= (-> *progress-pc-generic-store* current-menu-hover-index) 0)
(cond
((cpad-pressed? 0 confirm)
(navigate! *progress-pc-generic-store* progress (-> obj target) (-> obj on-load))
(set! (-> progress selected-option) #f)
(sound-play "score-slide"))))
0)
+3 -3
View File
@@ -41,7 +41,7 @@
(deftype menu-music-player-option (menu-option)
((last-move time-frame)
;; player params
(music-index int16)
(flava-index int8)
@@ -50,7 +50,7 @@
;; scroll
(current-scroll float)
(max-scroll float)
;; sprites 0-3 used to show level icon
(sprites hud-sprite 4 :inline)
)
@@ -61,7 +61,7 @@
((name text-id)
(unlock text-id)
(flag pc-cheats)
(avail-after game-task-node)
(avail-after-hero game-task-node)
)
+23 -22
View File
@@ -12,9 +12,9 @@
(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)
@@ -149,6 +149,7 @@
;; PC STATE BEGIN
;; --------------
(init! *progress-pc-generic-store*)
;; set aspect ratio options
(set-progress-aspect-ratio-pc-index)
@@ -185,21 +186,7 @@
)
(('game-options)
(set! (-> obj current-options)
(cond
((demo?)
(if (= (scf-get-territory) GAME_TERRITORY_SCEE)
*game-options*
*game-options-demo*
)
)
((and (= (scf-get-territory) GAME_TERRITORY_SCEI) (not (and (= *progress-cheat* 'language) (cpad-hold? 0 l2) (cpad-hold? 0 r2))))
*game-options*
)
(else
*game-options*
)
)
)
(if (demo?) *game-options-demo* *game-options-pc*))
)
(('graphic-options)
(set! (-> obj current-options) *graphic-options-pc*)
@@ -362,6 +349,22 @@
(set! (-> (the-as menu-music-player-option (-> *music-player-options* options 0)) excitement) 0)
(set! (-> obj current-options) *music-player-options*)
)
(('generic-menu)
;; a single condition to handle all generic menu links
(let ((curr-history-entry (-> *progress-pc-generic-store* history-stack
(-> *progress-pc-generic-store* history-stack-index))))
;; call the on-load function is appropriate, this can be used to perform some kind of generic setup
;; for the particular route
(when (and (nonzero? (-> curr-history-entry on-load)) (!= (-> curr-history-entry on-load) #f))
((-> curr-history-entry on-load)))
;; restore state from the history entry
(set! (-> *progress-pc-generic-store* clear-screen?) #f)
(set! (-> *progress-pc-generic-store* current-menu-hover-index) (-> curr-history-entry hover-index))
(if (!= (-> curr-history-entry progress-id) 'generic-menu)
;; do a recursive call to hit the relevant case in this switch
(set-menu-options obj (-> curr-history-entry progress-id))
;; otherwise, set the options
(set! (-> obj current-options) (-> curr-history-entry ref)))))
)
(when (= (-> obj current-options) #f)
(format #t "Didn't find new menu settings!!~%")
@@ -372,7 +375,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; CUSTOM MENU OPTIONS
@@ -426,7 +428,7 @@
(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")))
)
@@ -459,7 +461,7 @@
(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")))
)
@@ -587,7 +589,7 @@
(defun count-bits ((val int))
"return the number of bits set to 1."
(let ((bits 0))
(dotimes (i 64)
(if (logtest? val (ash 1 i))
@@ -753,4 +755,3 @@
0
(none)
)
@@ -11,6 +11,61 @@
(set! (-> *main-options-debug* options 9) (new 'static 'menu-main-menu-option :name (text-id progress-music-player) :scale #t :next-state 'music-player))
(define *game-options-pc*
(progress-new-generic-scrolling-page (text-id progress-root-game-options)
(new 'static 'menu-generic-boolean-option
:name (text-id progress-vibration)
: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-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 (text-id progress-misc-game-options)
(progress-new-generic-scrolling-page (text-id progress-misc-game-options)
(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*)))))))
(define *graphic-options-pc*
(new 'static 'menu-option-list
+266 -252
View File
@@ -66,28 +66,28 @@
)
;; definition for function draw-highlight
(defun draw-highlight ((arg0 int) (arg1 int) (arg2 float))
(let ((s3-0 (if (= (get-aspect-ratio) 'aspect4x3)
70
79
)
)
(a3-0 (if (= (get-aspect-ratio) 'aspect4x3)
374
355
)
)
(defun draw-highlight ((y-pos int) (height int) (alpha float))
(let ((x-pos (if (= (get-aspect-ratio) 'aspect4x3)
70
79
)
)
(width (if (= (get-aspect-ratio) 'aspect4x3)
374
355
)
)
)
(with-dma-buffer-add-bucket ((s2-0 (-> *display* frames (-> *display* on-screen) global-buf))
(with-dma-buffer-add-bucket ((buffer (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress)
)
(draw-sprite2d-xy
s2-0
s3-0
arg0
a3-0
arg1
(new 'static 'rgba :r #x40 :g #x80 :b #x80 :a (the int (* 64.0 arg2)))
buffer
x-pos
y-pos
width
height
(new 'static 'rgba :r #x40 :g #x80 :b #x80 :a (the int (* 64.0 alpha)))
)
)
)
@@ -220,27 +220,27 @@
;; definition for function draw-missions-up-down
;; WARN: Return type mismatch float vs none.
(defun draw-missions-up-down ((arg0 font-context))
(let ((s3-0 250)
(s5-0 116)
(s4-0 191)
(f30-0 (-> arg0 origin x))
(f28-0 (-> arg0 origin y))
(defun draw-missions-up-down ((font-ctx font-context))
(let ((new-x-pos 250)
(new-y-pos-up 116)
(new-y-pos-down 191)
(old-x-pos (-> font-ctx origin x))
(old-y-pos (-> font-ctx origin y))
)
(set! (-> arg0 origin x) (the float s3-0))
(set! (-> arg0 origin y) (the float s5-0))
(let ((s2-0 print-game-text))
(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)
(s2-0 *temp-string* arg0 #f 44 (bucket-id progress))
(print-text-fn *temp-string* font-ctx #f 44 (bucket-id progress))
)
(set! (-> arg0 origin x) (the float s3-0))
(set! (-> arg0 origin y) (the float (+ s5-0 s4-0)))
(let ((s5-1 print-game-text))
(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)
(s5-1 *temp-string* arg0 #f 44 (bucket-id progress))
(print-text-fn-1 *temp-string* font-ctx #f 44 (bucket-id progress))
)
(set! (-> arg0 origin x) f30-0)
(set! (-> arg0 origin y) f28-0)
(set! (-> font-ctx origin x) old-x-pos)
(set! (-> font-ctx origin y) old-y-pos)
)
(none)
)
@@ -353,35 +353,35 @@
)
;; definition for function begin-scissor-missions
(defun begin-scissor-missions ((arg0 hud-box))
(defun begin-scissor-missions ((hud-bounds hud-box))
(cond
((= (get-aspect-ratio) 'aspect16x9)
(set! (-> arg0 min x) 79.0)
(set! (-> arg0 min y) 130.0)
(set! (-> arg0 max x) 434.0)
(set! (-> arg0 max y) 305.0)
(set! (-> hud-bounds min x) 79.0)
(set! (-> hud-bounds min y) 130.0)
(set! (-> hud-bounds max x) 434.0)
(set! (-> hud-bounds max y) 305.0)
)
(else
(set! (-> arg0 min x) 70.0)
(set! (-> arg0 min y) 130.0)
(set! (-> arg0 max x) 444.0)
(set! (-> arg0 max y) 305.0)
(set! (-> hud-bounds min x) 70.0)
(set! (-> hud-bounds min y) 130.0)
(set! (-> hud-bounds max x) 444.0)
(set! (-> hud-bounds max y) 305.0)
)
)
(with-dma-buffer-add-bucket ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf))
(with-dma-buffer-add-bucket ((buffer (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress)
)
(setup-scissor arg0 s4-0)
(setup-scissor hud-bounds buffer)
)
0
)
;; definition for function end-scissor-missions
(defun end-scissor-missions ((arg0 hud-box) (arg1 float))
(with-dma-buffer-add-bucket ((s5-0 (-> *display* frames (-> *display* on-screen) global-buf))
(defun end-scissor-missions ((hud-bounds hud-box) (arg1 float))
(with-dma-buffer-add-bucket ((buffer (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress)
)
(restore-scissor arg0 s5-0)
(restore-scissor hud-bounds buffer)
)
0
)
@@ -3972,25 +3972,26 @@
;; definition for function sort-task-node-result
;; WARN: Return type mismatch symbol vs none.
(defun sort-task-node-result ((arg0 int))
(let ((v1-1 (-> *game-info* mission-list))
(a1-1 (max 0 (+ arg0 -1)))
"Sorts the [[*game-info*]]'s `mission-list` by if they are closed and their `closed-time`. Just bubble-sort and therefore O(n^2)"
(let ((game-task-info-array (-> *game-info* mission-list))
(i (max 0 (+ arg0 -1)))
)
(let ((a0-3 0))
(while (> a1-1 0)
(while (< a0-3 a1-1)
(when (and (logtest? (-> v1-1 a0-3 flags) (game-task-node-flag closed))
(logtest? (-> v1-1 (+ a0-3 1) flags) (game-task-node-flag closed))
(< (-> v1-1 a0-3 close-time) (-> v1-1 (+ a0-3 1) close-time))
(let ((j 0))
(while (> i 0)
(while (< j i)
(when (and (logtest? (-> game-task-info-array j flags) (game-task-node-flag closed))
(logtest? (-> game-task-info-array (+ j 1) flags) (game-task-node-flag closed))
(< (-> game-task-info-array j close-time) (-> game-task-info-array (+ j 1) close-time))
)
(let ((a2-19 (-> v1-1 a0-3)))
(set! (-> v1-1 a0-3) (-> v1-1 (+ a0-3 1)))
(set! (-> v1-1 (+ a0-3 1)) a2-19)
(let ((task-info (-> game-task-info-array j)))
(set! (-> game-task-info-array j) (-> game-task-info-array (+ j 1)))
(set! (-> game-task-info-array (+ j 1)) task-info)
)
)
(+! a0-3 1)
(+! j 1)
)
(+! a1-1 -1)
(set! a0-3 0)
(+! i -1)
(set! j 0)
)
)
)
@@ -4183,40 +4184,40 @@
;; WARN: Stack slot offset 20 signed mismatch
;; WARN: Stack slot offset 20 signed mismatch
;; WARN: Return type mismatch int vs none.
(defmethod draw-option menu-missions-option ((obj menu-missions-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
(defmethod draw-option menu-missions-option ((obj menu-missions-option) (progress progress) (font-ctx font-context) (arg3 int) (arg4 symbol))
(local-vars
(f0-50 float)
(sv-16 float)
(sv-20 int)
(sv-24 int)
(font-alpha float)
(task-info-idx int)
(game-task-idx int)
(sv-32 int)
(sv-40 int)
(sv-48 int)
(sv-56 int)
(num-task-info int)
(default-y-origin-4x3 int)
(sv-256 float)
(sv-260 float)
(sv-264 game-task-node-info)
(sv-268 game-task-node-info)
(sv-272 symbol)
(sv-276 hud-box)
(sv-280 float)
(sv-284 float)
(line-height float)
(inprogress-task-info game-task-node-info)
(completed-task-info game-task-node-info)
(found-closed-task? symbol)
(hud-bounds hud-box)
(font-y-pos float)
(font-scale float)
)
(set! sv-16 (* 2.0 (- 0.5 (-> arg0 menu-transition))))
(set! sv-20 1)
(set! sv-24 0)
(set! font-alpha (* 2.0 (- 0.5 (-> progress menu-transition))))
(set! task-info-idx 1)
(set! game-task-idx 0)
(set! sv-32 0)
(set! sv-40 0)
(set! sv-48 0)
(set! sv-56 95)
(set! sv-256 (* 395.0 (-> arg0 sliding)))
(set! sv-260 (* 44.0 (-> arg0 sliding-height)))
(set! sv-264 (new 'stack 'game-task-node-info))
(set! sv-268 (new 'stack 'game-task-node-info))
(set! sv-272 #t)
(set! sv-276 (new 'stack-no-clear 'hud-box))
(set! sv-280 (-> arg1 origin y))
(set! sv-284 (-> arg1 scale))
(set! num-task-info 0)
(set! default-y-origin-4x3 95)
(set! sv-256 (* 395.0 (-> progress sliding)))
(set! line-height (* 44.0 (-> progress sliding-height)))
(set! inprogress-task-info (new 'stack 'game-task-node-info))
(set! completed-task-info (new 'stack 'game-task-node-info))
(set! found-closed-task? #t)
(set! hud-bounds (new 'stack-no-clear 'hud-box))
(set! font-y-pos (-> font-ctx origin y))
(set! font-scale (-> font-ctx scale))
(set! (-> *progress-state* current-task-index) (length (-> *game-info* sub-task-list)))
(set! (-> *progress-state* current-line-index) -1)
(set! (-> *progress-state* current-task) (the-as uint -1))
@@ -4224,121 +4225,127 @@
(set! (-> *progress-state* extra-text-state) -1)
(set! (-> *progress-state* num-open-tasks-found) 0)
(set! (-> *progress-state* num-closed-tasks-found) 0)
(if (< sv-16 0.0)
(set! sv-16 (the-as float 0.0))
(if (< font-alpha 0.0)
(set! font-alpha (the-as float 0.0))
)
(set! (-> arg1 alpha) sv-16)
(set! (-> *game-info* mission-list 0) sv-264)
(set! (-> sv-264 description) (text-id progress-missions-in-progress))
(set! (-> sv-268 description) (text-id progress-missions-completed))
(while (< sv-24 (length (-> *game-info* sub-task-list)))
(let ((v1-26 (find-mission-text-at-index sv-24))
(a0-15 (-> *game-info* mission-list))
(set! (-> font-ctx alpha) font-alpha)
(set! (-> *game-info* mission-list 0) inprogress-task-info)
(set! (-> inprogress-task-info description) (text-id progress-missions-in-progress))
(set! (-> completed-task-info description) (text-id progress-missions-completed))
(while (< game-task-idx (length (-> *game-info* sub-task-list)))
(let ((task-info (find-mission-text-at-index game-task-idx))
(game-task-info-array (-> *game-info* mission-list))
)
(when (!= v1-26 #f)
(when (and (logtest? (-> v1-26 flags) (game-task-node-flag closed)) sv-272)
(set! sv-272 (the-as symbol #f))
(set! (-> a0-15 sv-20) sv-268)
(set! sv-20 (+ sv-20 1))
(when (!= task-info #f)
(when (and (logtest? (-> task-info flags) (game-task-node-flag closed)) found-closed-task?)
(set! found-closed-task? (the-as symbol #f))
(set! (-> game-task-info-array task-info-idx) completed-task-info)
(set! task-info-idx (+ task-info-idx 1))
)
(set! (-> a0-15 sv-20) v1-26)
(set! sv-20 (+ sv-20 1))
(set! (-> game-task-info-array task-info-idx) task-info)
(set! task-info-idx (+ task-info-idx 1))
)
)
(set! sv-24 (+ sv-24 1))
(set! game-task-idx (+ game-task-idx 1))
)
(set! sv-48 sv-20)
(set! (-> *progress-state* total-num-tasks) sv-20)
(sort-task-node-result sv-48)
(let ((v1-36 arg1))
(set! (-> v1-36 width) 395.0)
(set! num-task-info task-info-idx)
(set! (-> *progress-state* total-num-tasks) task-info-idx)
(sort-task-node-result num-task-info)
(let ((font-ctx-1 font-ctx))
(set! (-> font-ctx-1 width) 395.0)
)
(set! (-> arg1 origin x) 60.0)
(set! (-> arg1 origin y) 80.0)
(let ((a0-21 arg1))
(set! (-> a0-21 color) (font-color progress))
(set! (-> font-ctx origin x) 60.0)
(set! (-> font-ctx origin y) 80.0)
(let ((font-ctx-2 font-ctx))
(set! (-> font-ctx-2 color) (font-color progress))
)
(let ((v1-40 (-> obj page-index)))
(let ((page-idx (-> obj page-index)))
(cond
((zero? v1-40)
(draw-missions-decoration obj arg1 sv-16 (text-id progress-root-missions))
((zero? page-idx)
(draw-missions-decoration obj font-ctx font-alpha (text-id progress-root-missions))
)
((= v1-40 1)
(draw-missions-decoration obj arg1 sv-16 (text-id progress-root-missions))
((= page-idx 1)
(draw-missions-decoration obj font-ctx font-alpha (text-id progress-root-missions))
)
)
)
(begin-scissor-missions sv-276)
(let ((a0-27 arg1))
(set! (-> a0-27 flags) (font-flags kerning large))
(begin-scissor-missions hud-bounds)
(let ((font-ctx-3 font-ctx))
(set! (-> font-ctx-3 flags) (font-flags kerning large))
)
(+! (-> arg1 origin x) 20.0)
(+! (-> font-ctx origin x) 20.0)
(case (get-aspect-ratio)
(('aspect16x9)
(set! (-> arg1 origin y) 80.0)
(set! (-> font-ctx origin y) 80.0)
)
(('aspect4x3)
(set! (-> arg1 origin y) (the float sv-56))
(set! (-> font-ctx origin y) (the float default-y-origin-4x3))
)
)
(let ((v1-52 arg1))
(set! (-> v1-52 scale) sv-284)
(let ((font-ctx-4 font-ctx))
(set! (-> font-ctx-4 scale) font-scale)
)
(when (zero? (-> obj page-index))
(set! sv-24 (-> obj task-line-index))
(set! sv-20 0)
(let ((v1-57 (+ sv-56 44)))
(set! sv-56 v1-57)
(set! (-> arg1 origin y) (the float (+ v1-57 (the int sv-260))))
(set! game-task-idx (-> obj task-line-index))
(set! task-info-idx 0)
(let ((y-offset (+ default-y-origin-4x3 44)))
(set! default-y-origin-4x3 y-offset)
(set! (-> font-ctx origin y) (the float (+ y-offset (the int line-height))))
)
(set! (-> arg1 width) 340.0)
(set! (-> arg1 height) 44.0)
(when (!= sv-260 0.0)
(set! (-> font-ctx width) 340.0)
(set! (-> font-ctx height) 44.0)
(when (!= line-height 0.0)
(set! (-> *progress-state* missions-total-spacing) 0.0)
(dotimes (s4-1 sv-24)
(let* ((s3-1 (-> *game-info* mission-list s4-1))
(a1-19
(if (and (logtest? (-> s3-1 flags) (game-task-node-flag closed)) (task-complete? *game-info* (-> s3-1 task)))
(-> *game-info* play-list (-> s3-1 task) text-name)
(-> s3-1 description)
(dotimes (game-task-idx-2 game-task-idx)
(let* ((game-task-info-2 (-> *game-info* mission-list game-task-idx-2))
(task-text-id
(if (and (logtest? (-> game-task-info-2 flags) (game-task-node-flag closed))
(task-complete? *game-info* (-> game-task-info-2 task))
)
(-> *game-info* play-list (-> game-task-info-2 task) text-name)
(-> game-task-info-2 description)
)
)
(s3-2 (lookup-text! *common-text* a1-19 #f))
(f30-0 3.0)
(s2-0 print-game-text)
(line-text (lookup-text! *common-text* task-text-id #f))
(line-padding 3.0)
(print-game-text-fn print-game-text)
)
(format (clear *temp-string*) "~S" s3-2)
(format (clear *temp-string*) "~S" line-text)
(set! (-> *progress-state* missions-total-spacing)
(+ f30-0 (s2-0 *temp-string* arg1 #t 44 (bucket-id progress)) (-> *progress-state* missions-total-spacing))
(+ line-padding
(print-game-text-fn *temp-string* font-ctx #t 44 (bucket-id progress))
(-> *progress-state* missions-total-spacing)
)
)
)
)
)
(set! sv-56 (- sv-56 (the int (-> *progress-state* missions-total-spacing))))
(set! default-y-origin-4x3 (- default-y-origin-4x3 (the int (-> *progress-state* missions-total-spacing))))
(cond
((< (-> arg0 sliding-height) 0.0)
(let* ((s4-2 (-> *game-info* mission-list sv-24))
(a1-23
(if (and (logtest? (-> s4-2 flags) (game-task-node-flag closed)) (task-complete? *game-info* (-> s4-2 task)))
(-> *game-info* play-list (-> s4-2 task) text-name)
(-> s4-2 description)
)
)
(s4-3 (lookup-text! *common-text* a1-23 #f))
((< (-> progress sliding-height) 0.0)
(let* ((game-task-info-3 (-> *game-info* mission-list game-task-idx))
(task-text-id-2 (if (and (logtest? (-> game-task-info-3 flags) (game-task-node-flag closed))
(task-complete? *game-info* (-> game-task-info-3 task))
)
(-> *game-info* play-list (-> game-task-info-3 task) text-name)
(-> game-task-info-3 description)
)
)
(line-text-2 (lookup-text! *common-text* task-text-id-2 #f))
)
0.0
(let ((f30-1 3.0)
(s3-3 print-game-text)
(let ((line-padding-2 3.0)
(print-game-text-fn-2 print-game-text)
)
(format (clear *temp-string*) "~S" s4-3)
(let ((f0-36 (+ f30-1 (s3-3 *temp-string* arg1 #t 44 (bucket-id progress)))))
(set! sv-260 (* (-> arg0 sliding-height) f0-36))
(format (clear *temp-string*) "~S" line-text-2)
(let ((f0-36 (+ line-padding-2 (print-game-text-fn-2 *temp-string* font-ctx #t 44 (bucket-id progress)))))
(set! line-height (* (-> progress sliding-height) f0-36))
)
)
)
)
(else
(let* ((s4-4 (-> *game-info* mission-list (+ sv-24 -1)))
(let* ((s4-4 (-> *game-info* mission-list (+ game-task-idx -1)))
(a1-27
(if (and (logtest? (-> s4-4 flags) (game-task-node-flag closed)) (task-complete? *game-info* (-> s4-4 task)))
(-> *game-info* play-list (-> s4-4 task) text-name)
@@ -4352,16 +4359,16 @@
(s3-4 print-game-text)
)
(format (clear *temp-string*) "~S" s4-5)
(let ((f0-40 (+ f30-2 (s3-4 *temp-string* arg1 #t 44 (bucket-id progress)))))
(set! sv-260 (* (-> arg0 sliding-height) f0-40))
(let ((f0-40 (+ f30-2 (s3-4 *temp-string* font-ctx #t 44 (bucket-id progress)))))
(set! line-height (* (-> progress sliding-height) f0-40))
)
)
)
)
)
(set! (-> arg1 origin y) (the float (+ sv-56 (the int sv-260))))
(while (and (< sv-20 sv-48) (< sv-20 (+ sv-24 10)))
(let* ((s4-6 (-> *game-info* mission-list sv-20))
(set! (-> font-ctx origin y) (the float (+ default-y-origin-4x3 (the int line-height))))
(while (and (< task-info-idx num-task-info) (< task-info-idx (+ game-task-idx 10)))
(let* ((s4-6 (-> *game-info* mission-list task-info-idx))
(s3-5
(if (and (logtest? (-> s4-6 flags) (game-task-node-flag closed)) (task-complete? *game-info* (-> s4-6 task)))
(-> *game-info* play-list (-> s4-6 task) text-name)
@@ -4373,7 +4380,7 @@
0.0
(set! f0-50
(cond
((>= sv-20 (+ sv-24 -1))
((>= task-info-idx (+ game-task-idx -1))
(when (and (!= s3-5 381) (!= s3-5 380))
(let ((s3-6 print-game-text))
(format (clear *temp-string*) "~S" (lookup-text!
@@ -4385,17 +4392,17 @@
#f
)
)
(s3-6 *temp-string* arg1 #f 44 (bucket-id progress))
(s3-6 *temp-string* font-ctx #f 44 (bucket-id progress))
)
)
(+! (-> arg1 origin x) 20.0)
(+! (-> font-ctx origin x) 20.0)
(let ((f30-3 3.0)
(s4-7 print-game-text)
)
(format (clear *temp-string*) "~S" s5-1)
(set! f0-50 (+ f30-3 (s4-7 *temp-string* arg1 #f 44 (bucket-id progress))))
(set! f0-50 (+ f30-3 (s4-7 *temp-string* font-ctx #f 44 (bucket-id progress))))
)
(+! (-> arg1 origin x) -20.0)
(+! (-> font-ctx origin x) -20.0)
f0-50
)
(else
@@ -4403,30 +4410,30 @@
(s4-8 print-game-text)
)
(format (clear *temp-string*) "~S" s5-1)
(+ f30-4 (s4-8 *temp-string* arg1 #t 44 (bucket-id progress)))
(+ f30-4 (s4-8 *temp-string* font-ctx #t 44 (bucket-id progress)))
)
)
)
)
)
(let ((v1-142 (+ sv-56 (the int f0-50))))
(set! sv-56 v1-142)
(set! (-> arg1 origin y) (the float (+ v1-142 (the int sv-260))))
(let ((v1-142 (+ default-y-origin-4x3 (the int f0-50))))
(set! default-y-origin-4x3 v1-142)
(set! (-> font-ctx origin y) (the float (+ v1-142 (the int line-height))))
)
(set! sv-20 (+ sv-20 1))
(set! task-info-idx (+ task-info-idx 1))
)
(if (zero? (-> *progress-state* total-num-tasks))
(print-game-text
(lookup-text! *common-text* (text-id progress-missions-none) #f)
arg1
font-ctx
#f
44
(bucket-id progress)
)
)
)
(end-scissor-missions sv-276 1.0)
(draw-missions-up-down arg1)
(end-scissor-missions hud-bounds 1.0)
(draw-missions-up-down font-ctx)
0
(none)
)
@@ -6677,85 +6684,91 @@
;; definition for method 10 of type menu-language-game-option
;; WARN: Return type mismatch int vs none.
(defmethod draw-option menu-language-game-option ((obj menu-language-game-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
(defmethod draw-option menu-language-game-option ((obj menu-language-game-option)
(progress progress)
(font-ctx font-context)
(option-index int)
(selected symbol)
)
(with-pp
(let ((f30-0 (* 2.0 (- 0.5 (-> arg0 menu-transition)))))
(let ((v1-2 arg1))
(set! (-> v1-2 scale) 0.65)
(let ((alpha (* 2.0 (- 0.5 (-> progress menu-transition)))))
(let ((font-ctx-1 font-ctx))
(set! (-> font-ctx-1 scale) 0.65)
)
(case arg2
(case option-index
((2)
(+! (-> arg1 origin y) 20.0)
(+! (-> font-ctx origin y) 20.0)
)
((3)
(+! (-> arg1 origin y) 32.0)
(+! (-> font-ctx origin y) 32.0)
)
)
(if (< f30-0 0.0)
(set! f30-0 0.0)
(if (< alpha 0.0)
(set! alpha 0.0)
)
(set! (-> arg1 alpha) f30-0)
(let ((a0-5 arg1))
(set! (-> a0-5 flags) (font-flags kerning middle large))
(set! (-> font-ctx alpha) alpha)
(let ((font-ctx-2 font-ctx))
(set! (-> font-ctx-2 flags) (font-flags kerning middle large))
)
(let ((s4-0 (&-> *setting-control* user-default language)))
(let ((curr-language-ptr (&-> *setting-control* user-default language)))
(cond
((and (= (-> *progress-state* game-options-item-selected) 3) (-> *progress-state* game-options-item-picked))
(let ((a0-7 arg1))
(set! (-> a0-7 color) (font-color progress-force-selected))
(let ((font-ctx-3 font-ctx))
(set! (-> font-ctx-3 color) (font-color progress-force-selected))
)
(draw-highlight (the int (-> arg1 origin y)) 44 f30-0)
(let ((s3-0 print-game-text))
(draw-highlight (the int (-> font-ctx origin y)) 44 alpha)
(let ((print-game-text-fn-1 print-game-text))
(format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> obj name) #f))
(s3-0 *temp-string* arg1 #f 44 (bucket-id progress))
(print-game-text-fn-1 *temp-string* font-ctx #f 44 (bucket-id progress))
)
(+! (-> arg1 origin y) 24.0)
(+! (-> font-ctx origin y) 24.0)
(-> obj language-selection)
(let ((s4-1 (-> s4-0 0)))
(let ((curr-language (-> curr-language-ptr 0)))
7
(if (-> obj language-transition)
(seekl! (-> obj language-x-offset) 150 (the int (* 10.0 (-> pp clock time-adjust-ratio))))
)
(when (>= (-> obj language-x-offset) 75)
(set! (-> obj language-selection) (the-as uint s4-1))
(set! (-> obj language-selection) (the-as uint curr-language))
(set! (-> obj language-transition) #f)
(set! (-> obj language-x-offset) 0)
0
)
)
(let ((a0-14 arg1))
(set! (-> a0-14 color) (font-color progress))
(let ((font-ctx-4 font-ctx))
(set! (-> font-ctx-4 color) (font-color progress))
)
(let ((v1-33 arg1))
(set! (-> v1-33 scale) 0.5)
(let ((font-ctx-5 font-ctx))
(set! (-> font-ctx-5 scale) 0.5)
)
(let ((a0-16 arg1))
(set! (-> a0-16 color) (font-color progress))
(let ((font-ctx-6 font-ctx))
(set! (-> font-ctx-6 color) (font-color progress))
)
(+! (-> arg1 origin x) -70.0)
(let ((s5-1 print-game-text))
(+! (-> font-ctx origin x) -70.0)
(let ((print-game-text-fn-2 print-game-text))
(format (clear *temp-string*) "~33L~C" 163)
(s5-1 *temp-string* arg1 #f 44 (bucket-id progress))
(print-game-text-fn-2 *temp-string* font-ctx #f 44 (bucket-id progress))
)
(+! (-> arg1 origin x) 70.0)
(+! (-> arg1 origin x) 70.0)
(let ((s5-2 print-game-text))
(+! (-> font-ctx origin x) 70.0)
(+! (-> font-ctx origin x) 70.0)
(let ((print-game-text-fn-3 print-game-text))
(format (clear *temp-string*) "~33L~C" 161)
(s5-2 *temp-string* arg1 #f 44 (bucket-id progress))
(print-game-text-fn-3 *temp-string* font-ctx #f 44 (bucket-id progress))
)
(+! (-> arg1 origin x) -70.0)
(let ((s5-3 arg1))
(set! (-> s5-3 color) (progress-selected 0))
(+! (-> font-ctx origin x) -70.0)
(let ((font-ctx-7 font-ctx))
(set! (-> font-ctx-7 color) (progress-selected 0))
)
(let ((v1-43 (if (and (= (scf-get-territory) 1) (zero? (-> *progress-state* game-options-language-index)))
7
(-> *progress-state* game-options-language-index)
)
)
(let ((language-name-idx
(if (and (= (scf-get-territory) 1) (zero? (-> *progress-state* game-options-language-index)))
7
(-> *progress-state* game-options-language-index)
)
)
)
(print-game-text
(lookup-text! *common-text* (-> *language-name-remap* v1-43) #f)
arg1
(lookup-text! *common-text* (-> *language-name-remap* language-name-idx) #f)
font-ctx
#f
44
(bucket-id progress)
@@ -6765,45 +6778,50 @@
(else
(cond
((= (-> *progress-state* game-options-item-selected) 3)
(let ((s3-1 arg1))
(set! (-> s3-1 color) (progress-selected 0))
(let ((font-ctx-8 font-ctx))
(set! (-> font-ctx-8 color) (progress-selected 0))
)
(draw-highlight (the int (-> arg1 origin y)) 24 f30-0)
(draw-highlight (the int (-> font-ctx origin y)) 24 alpha)
)
(else
(let ((a0-33 arg1))
(set! (-> a0-33 color) (font-color progress))
(let ((font-ctx-9 font-ctx))
(set! (-> font-ctx-9 color) (font-color progress))
)
)
)
(let ((v1-52 arg1))
(set! (-> v1-52 scale) 0.65)
(let ((font-ctx-10 font-ctx))
(set! (-> font-ctx-10 scale) 0.65)
)
(let ((s3-2 print-game-text))
(let ((print-game-text-fn-4 print-game-text))
(format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> obj name) #f))
(s3-2 *temp-string* arg1 #f 44 (bucket-id progress))
(print-game-text-fn-4 *temp-string* font-ctx #f 44 (bucket-id progress))
)
(let ((v1-54 arg1))
(set! (-> v1-54 scale) 0.5)
(let ((font-ctx-11 font-ctx))
(set! (-> font-ctx-11 scale) 0.5)
)
(let ((a0-40 arg1))
(set! (-> a0-40 color) (font-color progress))
(let ((font-ctx-12 font-ctx))
(set! (-> font-ctx-12 color) (font-color progress))
)
(format
(clear *temp-string*)
"~S"
(lookup-text! *common-text* (-> *language-name-remap* (-> curr-language-ptr 0)) #f)
)
(format (clear *temp-string*) "~S" (lookup-text! *common-text* (-> *language-name-remap* (-> s4-0 0)) #f))
*temp-string*
(+! (-> arg1 origin y) 24.0)
(let ((a0-44 arg1))
(set! (-> a0-44 flags) (font-flags kerning middle large))
(+! (-> font-ctx origin y) 24.0)
(let ((font-ctx-13 font-ctx))
(set! (-> font-ctx-13 flags) (font-flags kerning middle large))
)
(let ((v1-66 (if (and (= (scf-get-territory) 1) (zero? (-> *progress-state* game-options-language-index)))
7
(-> *progress-state* game-options-language-index)
)
)
(let ((language-name-idx-2
(if (and (= (scf-get-territory) 1) (zero? (-> *progress-state* game-options-language-index)))
7
(-> *progress-state* game-options-language-index)
)
)
)
(print-game-text
(lookup-text! *common-text* (-> *language-name-remap* v1-66) #f)
arg1
(lookup-text! *common-text* (-> *language-name-remap* language-name-idx-2) #f)
font-ctx
#f
44
(bucket-id progress)
@@ -7986,7 +8004,3 @@
0
(none)
)
+8 -8
View File
@@ -844,14 +844,14 @@
;; definition for symbol *language-name-remap*, type (array text-id)
(define *language-name-remap* (new 'static 'boxed-array :type text-id
(text-id text-x111)
(text-id text-x112)
(text-id text-x113)
(text-id text-x114)
(text-id text-x115)
(text-id text-x117)
(text-id text-x116)
(text-id text-x30b)
(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)
)
)
+7 -7
View File
@@ -49,7 +49,7 @@
(stereo-mode-backup int32 :offset-assert 216)
(secrets-unlocked symbol :offset-assert 220)
(missions-total-spacing float :offset-assert 224)
(clear-screen basic :offset-assert 228)
(clear-screen symbol :offset-assert 228)
)
:method-count-assert 9
:size-assert #xe8
@@ -1069,10 +1069,10 @@
(defmethod respond-to-cpad progress ((obj progress))
(mc-get-slot-info 0 *progress-save-info*)
(when (-> obj current-options)
(let ((s5-0 (-> obj current-options options)))
(when (and s5-0 (= (-> obj menu-transition) 0.0))
(let ((option-array (-> obj current-options options)))
(when (and option-array (= (-> obj menu-transition) 0.0))
(respond-progress
(the-as menu-option (-> s5-0 (-> obj option-index)))
(the-as menu-option (-> option-array (-> obj option-index)))
obj
(and (= (-> obj menu-transition) 0.0) (-> obj selected-option))
)
@@ -1098,7 +1098,7 @@
((= (-> obj current-options) *main-options*)
(sound-play "ring-select")
)
((!= (length s5-0) 1)
((!= (length option-array) 1)
(sound-play "roll-over")
)
)
@@ -1119,7 +1119,7 @@
((= (-> obj current-options) *main-options*)
(sound-play "ring-select")
)
((!= (length s5-0) 1)
((!= (length option-array) 1)
(sound-play "roll-over")
)
)
@@ -2510,7 +2510,7 @@
((and (cpad-pressed? 0 confirm) (!= (-> arg0 current) 'none))
(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* clear-screen) (the-as basic #t))
(set! (-> *progress-state* clear-screen) #t)
(cond
((-> s5-0 0)
(sound-play "generic-beep")