From 427c9525581d7e66530e7d5997f18cf0827466a7 Mon Sep 17 00:00:00 2001 From: Jordan Date: Fri, 28 Aug 2026 16:42:47 +0200 Subject: [PATCH] [Jak 2 and Jak 3]: Fixing menu text boundaries and drawing alignments for Automatic and Custom aspect ratios (#4380) This PR fixes the alignment of text and other elements in several menus of Jak 3 (as well as some of Jak 2) when using Automatic or Custom aspect ratios. It also cleans up some of the relevant functions which are used to draw these menus (although I'm still learning how to clean goal code). I mostly used french text for testing (since the french text seems to push the font boundaries to their limits a bit more). I used Automatic 16:9 and Custom 4:1 aspect ratios for testing to see if my changes scale to other aspect ratios properly, comparing with PS2 4:3 for reference. ### Jak 3 ### Image Color Scale Before: - The black/white color scale would get stretched (beyond the limits of the menu in 4x1) color-scale-16x9-broken color-scale-4x1-broken Reference (PS2 4:3 in OpenGoal): color-scale-reference After fixes: color-scale-16x9-fixed color-scale-4x1-fixed ### Secrets menu Before: - The secret titles touch their costs (#4233). - The alignment of the top line showing orbs available/cost and total orbs collected is broken (more noticeable in 4:1) - The alignment of the titles for groups of secrets is broken (more noticeable in 4:1) - The indentation for secret titles relative to the group of secrets is also broken (again, more noticeable in 4:1) secrets-broken-16x9 secrets-broken-4x1 Reference (PS2 4:3 in OpenGoal): Screenshot from 2026-08-16 22-58-22 After fixes: secrets-fixed-16x9 secrets-fixed-4x1 ### Secrets purchase menu Before: - The text for the secret you're purchasing can get cut off if too big. - As before, the top line showing orb cost/orbs collected is misaligned. secrets-purchase-broken-16x9 secrets-purchase-broken-4x1 Reference (PS2 4:3 in OpenGoal): secrets-purchase-reference After fixes: secrets-purchase-fixed-16x9 secrets-purchase-fixed-4x1 ### Save/Load/Create Hero Mode Save menu Here I show the load game screen only but the bugs were the same among all 3 as the code is shared. The fixes apply to all 3 as well :smiley: Before: - The header text is cut off in french. - There is a faint red rectangle to the right of the menu (look closely! It's a bit clearer and goes beyond the menu in 4x1). - The left yellow boxes around the save-games that are not selected do not scale properly (more noticeable in 4x1). load-broken-Automatic load-broken-4x1 Reference (PS2 4:3 in OpenGoal): load-screen-4x3 After Fixes: - Now headers that exceed the width of the menu screen will be shrunken down to fit. This will hopefully work for any other menus that need it as well :smiley: - No more red rectangle on the right, and the yellow box to the left around the save games scales properly. load-fixed-automatic load-fixed-4x1 ### Missions menu Before: - Mission text is sometimes cut off on the right - Mission text is shifted to the right (more noticeable in 4x1) missions-alignment-broken-16x9 missions-alignment-broken-16x9-2 missions-broken-4x1 missions-broken-4x1-2 Reference (PS2 4:3 in OpenGoal): missions-reference-1 missions-reference-2 After: missions-fixed-16x9 missions-fixed-16x9-2 missions-alignment-fixed-4x1 missions-alignment-fixed-4x1-2 ### Jak 2 ### Secrets menu orb icon Position was wrong in Automatic and some (but strangely, not all) Custom Aspect ratios. A correction for the aspect ratio was also being applied in the setter. Before: image After: image ### Missions menu - Indentation was not working, even in 4:3, due to a typo. - Width was broken in Automatic and Custom Before: Screenshot from 2026-08-19 01-05-54 After: image --- decompiler/config/jak3/all-types.gc | 4 +- goal_src/jak2/pc/progress/progress-draw-pc.gc | 27 +- .../jak3/engine/ui/progress/progress-draw.gc | 10 +- .../jak3/engine/ui/progress/progress-h.gc | 2 +- goal_src/jak3/engine/ui/text-h.gc | 2 +- goal_src/jak3/engine/ui/text.gc | 354 ++++---- goal_src/jak3/pc/progress/progress-draw-pc.gc | 805 +++++++++++++----- .../engine/ui/progress/progress-draw_REF.gc | 11 +- .../jak3/engine/ui/progress/progress-h_REF.gc | 2 +- 9 files changed, 812 insertions(+), 405 deletions(-) diff --git a/decompiler/config/jak3/all-types.gc b/decompiler/config/jak3/all-types.gc index 6195351a74..d1f664358a 100644 --- a/decompiler/config/jak3/all-types.gc +++ b/decompiler/config/jak3/all-types.gc @@ -8831,7 +8831,7 @@ (progress-subtitles #x006e) (progress-restart-mission #x006f) (text-0072 #x0072) - (text-0073 #x0073) + (progress-saved-game #x0073) (progress-qr #x0074) (text-0075 #x0075) (text-0076 #x0076) @@ -28091,7 +28091,7 @@ (draw-bg-box-outline (_type_ progress-box float) object) ;; 41 (draw-bg-box-alpha-2 (_type_ progress-box float) object) ;; 42 (draw-bg-box-alpha-1 (_type_ progress-box float) object) ;; 43 - (progress-method-44 (_type_ font-context string) object) ;; 44 + (draw-button-text (_type_ font-context string) object) ;; 44 (progress-method-45 (_type_ font-context float float string float float int) float) ;; 45 (draw-header (_type_ font-context float text-id) object) ;; 46 (progress-method-47 (_type_ font-context symbol symbol) object) ;; 47 diff --git a/goal_src/jak2/pc/progress/progress-draw-pc.gc b/goal_src/jak2/pc/progress/progress-draw-pc.gc index bdfdf8e017..ff3b4c09d9 100644 --- a/goal_src/jak2/pc/progress/progress-draw-pc.gc +++ b/goal_src/jak2/pc/progress/progress-draw-pc.gc @@ -9,6 +9,11 @@ |# +(defmacro adjust-x-if-needed (x) + "adjust an x screen coord if ps2 vis is disabled" + `(if (not (-> *pc-settings* use-vis?)) (adjust-game-x (the float ,x)) ,x)) + + (defun draw-previous-next ((arg0 menu-highscores-option) (arg1 font-context) (arg2 symbol)) (local-vars (sv-16 string) (sv-32 int)) @@ -993,20 +998,16 @@ ) (let ((page-idx (-> obj page-index))) (cond - ((zero? page-idx) + ((or (zero? page-idx) (= page-idx 1)) (draw-missions-decoration obj font-ctx font-alpha (text-id progress-root-missions)) ) - ((= page-idx 1) - (draw-missions-decoration obj font-ctx font-alpha (text-id progress-root-missions)) - ) - ) ) + ) (begin-scissor-missions hud-bounds) (set-flags! font-ctx (font-flags kerning large)) (if (-> *pc-settings* use-vis?) (+! (-> 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! (-> font-ctx origin y) 80.0) @@ -1026,6 +1027,9 @@ (set! (-> font-ctx origin y) (the float (+ y-offset (the int line-height)))) ) (set! (-> font-ctx width) 340.0) + (when (not (-> *pc-settings* use-vis?)) + (set! (-> font-ctx width) (- (* (-> font-ctx width) (-> *pc-settings* aspect-ratio-reciprocal) ) 8.0)) + ) (set! (-> font-ctx height) 44.0) (when (!= line-height 0.0) (set! (-> *progress-state* missions-total-spacing) 0.0) @@ -1473,9 +1477,9 @@ ) (set! (-> this sprites 0 pos z) #xffffff) (set! (-> this sprites 0 pos w) 0) - (if (not (-> *pc-settings* use-vis?)) - (set-hud-piece-position! (-> this sprites 0) (adjust-game-x 100.0) 128) - (set-hud-piece-position! (-> this sprites 0) 100 128)) + ;; Fixes orb position in Automatic and other aspect ratios + (set! (-> this sprites 0 pos x) (adjust-x-if-needed 100)) + (set! (-> this sprites 0 pos y) 128) (with-dma-buffer-add-bucket ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf)) (bucket-id progress) ) @@ -1700,11 +1704,6 @@ ) -(defmacro adjust-x-if-needed (x) - "adjust an x screen coord if ps2 vis is disabled" - `(if (not (-> *pc-settings* use-vis?)) (adjust-game-x (the float ,x)) ,x)) - - (defmethod draw-option ((obj menu-memcard-slot-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) (local-vars (sv-16 float) diff --git a/goal_src/jak3/engine/ui/progress/progress-draw.gc b/goal_src/jak3/engine/ui/progress/progress-draw.gc index 89eaf185e8..ad66baa8cf 100644 --- a/goal_src/jak3/engine/ui/progress/progress-draw.gc +++ b/goal_src/jak3/engine/ui/progress/progress-draw.gc @@ -175,7 +175,7 @@ ) ;; WARN: Return type mismatch int vs object. -(defmethod progress-method-44 ((this progress) (arg0 font-context) (arg1 string)) +(defmethod draw-button-text ((this progress) (arg0 font-context) (arg1 string)) (let ((f0-1 (- 1.0 (-> this menu-transition)))) (set-scale! arg0 0.5) (set! (-> arg0 alpha) f0-1) @@ -625,7 +625,7 @@ ) ) ) - (progress-method-44 this arg0 sv-20) + (draw-button-text this arg0 sv-20) (+! (-> arg0 origin y) f30-0) ) ) @@ -2459,7 +2459,11 @@ (cond ((= (-> s2-0 file arg2 present) 1) (let ((sv-48 print-game-text)) - (format (clear *temp-string*) "~S ~D" (lookup-text! *common-text* (text-id text-0073) #f) (+ arg2 1)) + (string-format + "~S ~D" + (lookup-text! *common-text* (text-id progress-saved-game) #f) + (+ arg2 1) + ) (sv-48 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) ) ) diff --git a/goal_src/jak3/engine/ui/progress/progress-h.gc b/goal_src/jak3/engine/ui/progress/progress-h.gc index c066b0c403..b00d858a9c 100644 --- a/goal_src/jak3/engine/ui/progress/progress-h.gc +++ b/goal_src/jak3/engine/ui/progress/progress-h.gc @@ -256,7 +256,7 @@ (draw-bg-box-outline (_type_ progress-box float) object) (draw-bg-box-alpha-2 (_type_ progress-box float) object) (draw-bg-box-alpha-1 (_type_ progress-box float) object) - (progress-method-44 (_type_ font-context string) object) + (draw-button-text (_type_ font-context string) object) (progress-method-45 (_type_ font-context float float string float float int) float) (draw-header (_type_ font-context float text-id) object) (progress-method-47 (_type_ font-context symbol symbol) object) diff --git a/goal_src/jak3/engine/ui/text-h.gc b/goal_src/jak3/engine/ui/text-h.gc index 43661f894e..e6c70bdc26 100644 --- a/goal_src/jak3/engine/ui/text-h.gc +++ b/goal_src/jak3/engine/ui/text-h.gc @@ -112,7 +112,7 @@ (progress-subtitles #x006e) (progress-restart-mission #x006f) (text-0072 #x0072) - (text-0073 #x0073) + (progress-saved-game #x0073) (progress-qr #x0074) (text-0075 #x0075) (text-0076 #x0076) diff --git a/goal_src/jak3/engine/ui/text.gc b/goal_src/jak3/engine/ui/text.gc index c1ecbd178f..7cf77d37ad 100644 --- a/goal_src/jak3/engine/ui/text.gc +++ b/goal_src/jak3/engine/ui/text.gc @@ -411,193 +411,225 @@ (none) ) -(defun print-game-text ((arg0 string) (arg1 font-context) (arg2 symbol) (arg3 int) (arg4 bucket-id)) + +;; display-text : text to print +;; font-ctx : the font to draw the text with +;; invisible : will actually print the text if true, otherwise will not print +;; arg3: height of text if text is supposed to be large +;; bucket-id: buffer used to draw? +;; Returns the height of the printed text. +(defun print-game-text ((display-text string) (font-ctx font-context) (invisible symbol) (large-font-size int) (bucket-id bucket-id)) (local-vars - (sv-16 float) - (sv-20 float) - (sv-24 font-flags) - (sv-28 font-color) - (sv-32 (pointer uint8)) - (sv-36 float) - (sv-40 float) - (sv-44 float) - (sv-48 float) - (sv-52 float) - (sv-56 float) - (sv-64 int) - (sv-72 uint) - (sv-80 int) - (sv-88 int) - (sv-96 int) - (sv-104 uint) - (sv-108 symbol) - (sv-112 int) - (sv-120 int) + (font-origin-x float) ;; Initial x and y position of font context + (font-origin-y float) + (font-flags font-flags) + (font-color font-color) + (cur-ch-ptr (pointer uint8)) ;; Char pointer used to traverse chars of display-text + (font-cur-position float) + (font-origin-x-copy float) + (right-side float) ;; Right boundary of where there is to draw + (bottom-side float) ;; Bottom boundary of where there is to draw + (whitespace-width float) ;; The width of a whitespace char using font-ctx + (line-height float) ;; The height of a line printed with font-ctx + (non-empty-lines int) ;; The number of lines printed so far + (cur-ch uint) ;; Current character inside display-text + (game-word-len int) ;;The current length of game-text-word + (game-line-len int) ;;The current length of game-text-line + (num-lines int) + (next-ch uint) ;;The next character inside display-text + (word-break symbol) ;; True if and only if game-text-word is complete and should be put in game-text-line + (num-lines-to-print int) ;;The number of outstanding lines that still need to be printed. + (game-text-word-width int) ) (cond - ((< 0.1 (-> arg1 scale)) - (set! sv-16 (-> arg1 origin x)) - (set! sv-20 (-> arg1 origin y)) - (set! sv-24 (-> arg1 flags)) - (set! sv-28 (-> arg1 color)) - (set-context! *font-work* arg1) - (set! (-> arg1 max-x) sv-16) - (when (logtest? (-> arg1 flags) (font-flags middle-vert)) - (logclear! (-> arg1 flags) (font-flags middle-vert)) - (+! (-> arg1 origin y) - (the float - (the int (* 0.5 (- (-> arg1 height) (print-game-text arg0 arg1 #t 44 (bucket-id hud-draw-hud-alpha))))) - ) - ) - ) - (set! sv-32 (-> arg0 data)) - (set! sv-36 (-> arg1 origin x)) - (set! sv-40 (-> arg1 origin x)) - (set! sv-44 (+ (-> arg1 origin x) (-> arg1 width))) - (set! sv-48 (+ (-> arg1 origin y) (-> arg1 height))) - (set! sv-52 (-> (get-string-length " " arg1) length)) - (set! sv-56 (* (if (logtest? (-> arg1 flags) (font-flags large)) - (the float arg3) - 28.0 - ) - (-> arg1 scale) - ) - ) - (set! sv-64 0) - (if (logtest? (-> arg1 flags) (font-flags middle)) - (+! (-> arg1 origin x) (/ (-> arg1 width) 2)) - ) - (set! sv-72 (-> sv-32 0)) - (set! sv-80 0) - (set! sv-88 0) - (set! sv-96 0) - (set! sv-104 (-> sv-32 1)) - (set! sv-108 (the-as symbol #f)) - (set! sv-112 0) - (set! sv-120 0) - (set! (-> *game-text-line* data 0) (the-as uint 0)) - (while (and (not (and (zero? sv-72) (zero? sv-80) (zero? sv-88))) (>= sv-48 (-> arg1 origin y))) - (set! sv-120 0) - (set! sv-32 (&-> sv-32 1)) - (set! sv-104 (-> sv-32 0)) - (set! sv-32 (&-> sv-32 -1)) + ((< 0.1 (-> font-ctx scale)) ;; Only print if font's scale is greater than 0.1 + ;;Storing font-ctx properties to restore them later. + (set! font-origin-x (-> font-ctx origin x)) + (set! font-origin-y (-> font-ctx origin y)) + (set! font-flags (-> font-ctx flags)) + (set! font-color (-> font-ctx color)) + (set-context! *font-work* font-ctx) + (set! (-> font-ctx max-x) (-> font-ctx origin x)) + (when (logtest? (-> font-ctx flags) (font-flags middle-vert)) ;; If middle-vert flag is set, + (logclear! (-> font-ctx flags) (font-flags middle-vert)) ;; Clear the flag + (+! (-> font-ctx origin y) ;; font's y-origin += 0.5 * (font-height - height needed to print display-text) + (the float + (the int (* 0.5 (- (-> font-ctx height) (print-game-text display-text font-ctx #t 44 (bucket-id hud-draw-hud-alpha))))) + ) + ) + ) + (set! cur-ch-ptr (-> display-text data)) + (set! font-cur-position (-> font-ctx origin x)) + (set! font-origin-x-copy (-> font-ctx origin x)) + (set! right-side (+ (-> font-ctx origin x) (-> font-ctx width))) + (set! bottom-side (+ (-> font-ctx origin y) (-> font-ctx height))) + (set! whitespace-width (-> (get-string-length " " font-ctx) length)) + + ;;line-height is set to font-ctx scale * (large-font-size if font-ctx has its large flat set or 28.0) + (set! line-height (* (-> font-ctx scale) + (if (logtest? (-> font-ctx flags) (font-flags large)) + (the float large-font-size) + 28.0 + ) + ) + ) + (set! non-empty-lines 0) + (if (logtest? (-> font-ctx flags) (font-flags middle)) + (+! (-> font-ctx origin x) (/ (-> font-ctx width) 2)) + ) + (set! cur-ch (-> cur-ch-ptr 0)) + (set! game-word-len 0) + (set! game-line-len 0) + (set! num-lines 0) + (set! next-ch (-> cur-ch-ptr 1)) ;;Following character in display-text + (set! word-break (the-as symbol #f)) ;;Set to false + (set! num-lines-to-print 0) + (set! game-text-word-width 0) + (set! (-> *game-text-line* data 0) (the-as uint 0)) ;;zero + ;; While there are more characters to read from display-text (cur-ch is not \0) into game-text-word, + ;; game-text-word hasn't been written to game-text-line or game-text-line hasn't been printed + ;; and the font context's vertical position isn't below the bottom of the drawing context. + (while (and (not (and (zero? cur-ch) (zero? game-word-len) (zero? game-line-len))) (>= bottom-side (-> font-ctx origin y))) + (set! game-text-word-width 0) + ;; (set! cur-ch-ptr (&-> cur-ch-ptr 1)) + ;; (set! next-ch (-> cur-ch-ptr 0)) + ;; (set! cur-ch-ptr (&-> cur-ch-ptr -1)) + (set! next-ch (-> cur-ch-ptr 1)) (cond - ((and (> sv-72 0) (< sv-72 (the-as uint 4))) - (set! (-> *game-text-word* data sv-80) sv-72) - (set! sv-80 (+ sv-80 1)) - (set! (-> *game-text-word* data sv-80) sv-104) - (set! sv-80 (+ sv-80 1)) - (set! sv-32 (&-> sv-32 1)) + ;; 0 < current character < 4 + ((and (> cur-ch 0) (< cur-ch (the-as uint 4))) + ;; Copy current and next character from display text into game-text-word + (set! (-> *game-text-word* data game-word-len) cur-ch) + (set! game-word-len (+ game-word-len 1)) + (set! (-> *game-text-word* data game-word-len) next-ch) + (set! game-word-len (+ game-word-len 1)) + (set! cur-ch-ptr (&-> cur-ch-ptr 1)) ;; Increment pointer within display-text ) - ((or (= sv-72 32) (= sv-72 47) (and (= sv-72 45) (!= (-> sv-32 -1) 126))) - (set! (-> *game-text-word* data sv-80) sv-72) - (set! sv-80 (+ sv-80 1)) - (set! sv-108 #t) + ;; Current character is a space or forward slash, or it's a minus and previous was a tilde. + ;; Might need to check that cur-ch-ptr - 1 is not out of bounds? + ((or (= cur-ch #\\s) (= cur-ch #\/) (and (= cur-ch #\-) (!= (-> cur-ch-ptr -1) #\~))) + (set! (-> *game-text-word* data game-word-len) cur-ch) ;;Write the character into the word + (set! game-word-len (+ game-word-len 1)) + (set! word-break #t) ;; Should copy current game-text-word into game-text-line ) - ((zero? sv-72) - (if (nonzero? sv-80) - (set! sv-108 #t) - ) - (set! sv-112 (+ sv-112 1)) + ;; Current character is 0 + ((zero? cur-ch) + (if (nonzero? game-word-len) ;;If game-text-word not empty + (set! word-break #t) ;; Should copy current game-text-word into game-text-line + ) + (set! num-lines-to-print (+ num-lines-to-print 1)) ) - ((and (= sv-72 92) (= sv-104 92)) - (set! sv-32 (&-> sv-32 1)) - (if (nonzero? sv-80) - (set! sv-108 #t) - ) - (set! sv-112 (+ sv-112 1)) + ;; Both current character and next are backslashes + ((and (= cur-ch #\\) (= next-ch #\\)) + (set! cur-ch-ptr (&-> cur-ch-ptr 1)) ;; Increment pointer within display-text + (if (nonzero? game-word-len) + (set! word-break #t) ;; Should copy current game-text-word into game-text-line + ) + (set! num-lines-to-print (+ num-lines-to-print 1)) ) - ((and (= sv-72 95) (= sv-104 95)) - (set! sv-32 (&-> sv-32 1)) - (set! (-> *game-text-word* data sv-80) (the-as uint 32)) - (set! sv-80 (+ sv-80 1)) + ;; Current character and next are underscores + ((and (= cur-ch #\_) (= next-ch #\_)) + (set! cur-ch-ptr (&-> cur-ch-ptr 1)) ;; Increment pointer within display-text + (set! (-> *game-text-word* data game-word-len) #\\s) ;;Write a space into the word + (set! game-word-len (+ game-word-len 1)) + ) + (else ;;Write character into word and increment word length + (set! (-> *game-text-word* data game-word-len) cur-ch) + (set! game-word-len (+ game-word-len 1)) ) - (else - (set! (-> *game-text-word* data sv-80) sv-72) - (set! sv-80 (+ sv-80 1)) - ) ) - (when sv-108 - (set! (-> *game-text-word* data sv-80) (the-as uint 0)) - (let ((f30-1 sv-36)) - (set! sv-120 (the int (-> (get-string-length *game-text-word* arg1) length))) - (let ((f0-27 (+ f30-1 (the float sv-120)))) - (if (= (-> *game-text-word* data (+ sv-80 -1)) 32) - (set! f0-27 (- f0-27 sv-52)) + (when word-break + (set! (-> *game-text-word* data game-word-len) (the-as uint 0)) ;;Null terminate word + (let ((word-start font-cur-position)) + ;;Set game-text-word-width to the length of game-text-word using font-ctx + (set! game-text-word-width (the int (-> (get-string-length *game-text-word* font-ctx) length))) + (let ((word-end (+ word-start (the float game-text-word-width)))) + (if (= (-> *game-text-word* data (+ game-word-len -1)) #\\s) ;; If last character is a space + (set! word-end (- word-end whitespace-width)) ) (cond - ((< sv-44 f0-27) - (set! (-> arg1 max-x) (fmax (-> arg1 max-x) sv-36)) - (set! sv-112 (+ sv-112 1)) + ((< right-side word-end) ;; If word would exceed right side of screen, + (set! (-> font-ctx max-x) (fmax (-> font-ctx max-x) font-cur-position)) + (set! num-lines-to-print (+ num-lines-to-print 1)) + ) + (else + ;;Append game-word to the end of game-line + (copy-charp<-charp (&-> *game-text-line* data game-line-len) (-> *game-text-word* data)) + (set! game-line-len (+ game-line-len game-word-len)) + (set! game-word-len 0) + (set! font-cur-position (+ font-cur-position (the float game-text-word-width))) ;; Add the word width to font-cur-position + (set! (-> font-ctx max-x) (fmax (-> font-ctx max-x) font-cur-position)) + (set! word-break (the-as symbol #f)) ) - (else - (copy-charp<-charp (&-> *game-text-line* data sv-88) (-> *game-text-word* data)) - (set! sv-88 (+ sv-88 sv-80)) - (set! sv-80 0) - (set! sv-36 (+ sv-36 (the float sv-120))) - (set! (-> arg1 max-x) (fmax (-> arg1 max-x) sv-36)) - (set! sv-108 (the-as symbol #f)) - ) ) ) ) ) - (while (> sv-112 0) - (let ((f30-2 (+ (-> arg1 origin y) sv-56))) - (when (and (>= sv-96 (the-as int (-> arg1 start-line))) #t) - (when (= (-> *game-text-line* data (+ sv-88 -1)) 32) - (set! (-> *game-text-line* data (+ sv-88 -1)) (the-as uint 0)) + (while (> num-lines-to-print 0) + ;; Store the position of the current line + line-height + (let ((next-line-origin-y (+ (-> font-ctx origin y) line-height))) + ;;Note: for now it seems like font-ctx start-line is always 0. + (when (>= num-lines (the-as int (-> font-ctx start-line))) + ;; If game-text-line ends in a space, replace the space with 0 + ;; (should probably decrement length too??) + (when (= (-> *game-text-line* data (+ game-line-len -1)) #\\s) + (set! (-> *game-text-line* data (+ game-line-len -1)) (the-as uint 0)) 0 - ) - (if (nonzero? (-> *game-text-line* data 0)) - (set! sv-64 (+ sv-64 1)) - ) - (when (not arg2) - (with-dma-buffer-add-bucket ((s2-1 (-> *display* frames (-> *display* on-screen) global-buf)) - arg4 + ) + ;;Actually print the text onscreen if the text is not meant to be invisible. + (when (not invisible) + (with-dma-buffer-add-bucket ((s2-1 (-> *display* frames (-> *display* on-screen) global-buf)) + bucket-id ) - (draw-string *game-text-line* s2-1 arg1) + (draw-string *game-text-line* s2-1 font-ctx) ) - ) - (set! (-> arg1 origin y) f30-2) - ) - ) - (set! sv-96 (+ sv-96 1)) - (set! (-> *game-text-line* data 0) (the-as uint 0)) - (set! sv-88 0) - (set! sv-112 (+ sv-112 -1)) - (set! sv-36 sv-40) - (when sv-108 - (copy-charp<-charp (&-> *game-text-line* data sv-88) (-> *game-text-word* data)) - (set! sv-88 (+ sv-88 sv-80)) - (set! sv-80 0) - (set! sv-108 (the-as symbol #f)) - (set! sv-36 (+ sv-36 (the float sv-120))) - ) - ) - (when (nonzero? sv-72) - (set! sv-32 (&-> sv-32 1)) - (set! sv-72 (-> sv-32 0)) - ) - ) - (set! (-> arg1 origin x) sv-16) - (set! (-> arg1 origin y) sv-20) - (set! (-> arg1 flags) sv-24) - (set! (-> arg1 color) sv-28) + ) + (if (nonzero? (-> *game-text-line* data 0)) + (set! non-empty-lines (+ non-empty-lines 1)) ;; Increment non-empty lines "printed" + ) + ;; Update the font-context to be positioned after the previous line + (set! (-> font-ctx origin y) next-line-origin-y) + ) + ) + (set! num-lines (+ num-lines 1)) + (set! (-> *game-text-line* data 0) (the-as uint 0)) + (set! game-line-len 0) + (set! num-lines-to-print (+ num-lines-to-print -1)) + (set! font-cur-position font-origin-x-copy) + (when word-break + ;;Copy game-text-word to the end of game-text-line + (copy-charp<-charp (&-> *game-text-line* data game-line-len) (-> *game-text-word* data)) + (set! game-line-len (+ game-line-len game-word-len)) + (set! game-word-len 0) + (set! word-break (the-as symbol #f)) ;; Reset + (set! font-cur-position (+ font-cur-position (the float game-text-word-width))) ;; Add word width to current position + ) + ) + (when (nonzero? cur-ch) + (set! cur-ch-ptr (&-> cur-ch-ptr 1)) + (set! cur-ch (-> cur-ch-ptr 0)) + ) + ) + ;; Restore font-ctx properties. + (set! (-> font-ctx origin x) font-origin-x) + (set! (-> font-ctx origin y) font-origin-y) + (set! (-> font-ctx flags) font-flags) + (set! (-> font-ctx color) font-color) ;; og:preserve-this (#when PC_PORT (if (and *debug-segment* *display-text-box*) - (draw-debug-text-box arg1))) - (if (> sv-64 0) - (* sv-56 (the float sv-64)) - 0.0 - ) - ) - (else - 0.0 + (draw-debug-text-box font-ctx))) + ;; + (if (> non-empty-lines 0) + (* line-height (the float non-empty-lines)) + 0.0 ) ) + (else + 0.0 + ) ) +) (defun disable-level-text-file-loading () (set! *level-text-file-load-flag* #f) diff --git a/goal_src/jak3/pc/progress/progress-draw-pc.gc b/goal_src/jak3/pc/progress/progress-draw-pc.gc index 9e379e137b..7e93ef8956 100644 --- a/goal_src/jak3/pc/progress/progress-draw-pc.gc +++ b/goal_src/jak3/pc/progress/progress-draw-pc.gc @@ -122,7 +122,9 @@ (#when PC_PORT (when (not (-> *pc-settings* use-vis?)) (set! (-> box1 min x) (the float (the int (adjust-game-x (-> box min x))))) - (set! (-> box1 max x) (the float (the int (adjust-game-x (-> box max x))))))) + (set! (-> box1 max x) (the float (the int (adjust-game-x (-> box max x))))) + ) + ) (draw-box-prim-only box1 s4-0))) 0) @@ -171,7 +173,10 @@ (#when PC_PORT (when (not (-> *pc-settings* use-vis?)) (set! s1-1 (the int (adjust-game-x (the float s1-1)))) - (set! f30-0 (* (-> *pc-settings* aspect-ratio-reciprocal) f30-0)))) + (set! f30-0 (* (-> *pc-settings* aspect-ratio-reciprocal) f30-0) + ) + ) + ) (set! sv-128 (the int (+ (-> sv-112 y) (* (- (-> sv-112 w) (-> sv-112 y)) sv-80)))) (let ((f28-0 f30-0)) (let ((f24-0 (-> *video-params* relative-x-scale-reciprical)) @@ -245,7 +250,7 @@ (draw-highlight-bar arg0 arg1 (the int (+ 2.0 (-> arg1 origin y))) (the int (+ -1.0 f0-3)) f30-0)))) (none)) -(defmethod draw-option ((this menu-secret-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) +(defmethod draw-option ((this menu-secret-option) (arg0 progress) (font-ctx font-context) (arg2 int) (arg3 symbol)) (local-vars (sv-16 float) (sv-24 int) @@ -258,91 +263,92 @@ (sv-288 int) (sv-352 string) (sv-368 string) - ) + ) (set! sv-16 (fmax 0.0 (* 2.0 (- 0.5 (-> arg0 menu-transition))))) - (set! (-> arg1 alpha) sv-16) + (set! (-> font-ctx alpha) sv-16) (cond ((not (loaded? *bigmap*)) - (progress-method-51 arg0 arg1) - ) + (progress-method-51 arg0 font-ctx) + ) (else (let ((s2-0 (get-texture hud-orb progress-minimap))) (when (and s2-0 (not (-> this available-title))) (progress-method-33 arg0 (-> *progress-work* sub-header)) (let ((s3-0 (get-scissor-stack-top arg0))) (let* ((f0-5 0.64) - (f30-0 (+ 10.0 (* (the float (-> s2-0 w)) f0-5 (-> *video-params* relative-x-scale)))) + (f30-0 (* (the float (-> s2-0 w)) f0-5 (-> *video-params* relative-x-scale))) ) (let ((f1-5 (* (the float (-> s2-0 h)) f0-5))) (draw-icon-array! (-> *progress-icon-arrays* 68) - (the int (+ 10.0 (adjust-x-if-needed (-> s3-0 x)))) + (the int (adjust-x-if-needed (+ 10.0 (-> s3-0 x)))) (the int (+ (-> s3-0 y) (* 0.5 (- 28.0 f1-5)))) f0-5 f0-5 (the rgba (logior #x808080 (shr (shl (the int (* 128.0 sv-16)) 56) 32))) sv-16 - ) - ) - (set! (-> arg1 height) 28.0) - (set-flags! arg1 (font-flags kerning large)) - (let ((f28-0 0.45)) - (set-color! arg1 (font-color font-color-34)) - (cond - ((-> this buy-menu) - (string-format "x~D ~S" (-> *menu-secrets-array* (-> this selected-index) cost) (lookup-text! *common-text* (text-id progress-secrets-price) #f)) - ) - (else - (string-format "x~D ~S" (the int (-> *game-info* skill)) (lookup-text! *common-text* (text-id progress-secrets-orbs-available) #f)) - ) - ) - (set-scale! arg1 f28-0) - (set! (-> arg1 origin x) (+ (adjust-x-if-needed (-> s3-0 x)) f30-0)) - (set! (-> arg1 origin y) (+ (-> s3-0 y) (* 0.5 (- 28.0 (* 32.0 f28-0))))) ) ) - (print-game-text *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) - (set-flags! arg1 (font-flags kerning right large)) - (set! (-> arg1 origin x) (+ -10.0 (adjust-x-if-needed (-> s3-0 z)))) - ) - (string-format "~D/600 ~S" (the int (-> *game-info* skill-total)) (lookup-text! *common-text* (text-id progress-secrets-orbs-collected) #f)) - (print-game-text *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) - (progress-method-34 arg0) + (set! (-> font-ctx height) 28.0) + (set-flags! font-ctx (font-flags kerning large)) + (let ((f28-0 0.45)) + (set-color! font-ctx (font-color font-color-34)) + (cond + ((-> this buy-menu) + (string-format "x~D ~S" (-> *menu-secrets-array* (-> this selected-index) cost) (lookup-text! *common-text* (text-id progress-secrets-price) #f)) + ) + (else + (string-format "x~D ~S" (the int (-> *game-info* skill)) (lookup-text! *common-text* (text-id progress-secrets-orbs-available) #f)) + ) + ) + (set-scale! font-ctx f28-0) + (set! (-> font-ctx origin x) (+ (adjust-x-if-needed (+ (-> s3-0 x) 10.0)) f30-0)) + (set! (-> font-ctx origin y) (+ (-> s3-0 y) (* 0.5 (- 28.0 (* 32.0 f28-0))))) + ) + ) + (print-game-text *temp-string* font-ctx #f 44 (bucket-id hud-draw-hud-alpha)) + (set-flags! font-ctx (font-flags kerning right large)) + (set! (-> font-ctx origin x) (adjust-x-if-needed (- (-> s3-0 z) 10.0))) ) + ;; This code draws the line in the secrets menu indicating the number of orbs obtained so far out of the total 600 in-game. + (string-format "~D/600 ~S" (the int (-> *game-info* skill-total)) (lookup-text! *common-text* (text-id progress-secrets-orbs-collected) #f)) + (print-game-text *temp-string* font-ctx #f 44 (bucket-id hud-draw-hud-alpha)) + (progress-method-34 arg0) ) - (set-scale! arg1 0.42) + ) + (set-scale! font-ctx 0.42) (cond ((-> this available-title) (progress-method-33 arg0 (-> *progress-work* body-footer)) - (progress-method-53 arg0 arg1) - (set-color! arg1 (font-color font-color-32)) - (set-flags! arg1 (font-flags kerning middle middle-vert large)) + (progress-method-53 arg0 font-ctx) + (set-color! font-ctx (font-color font-color-32)) + (set-flags! font-ctx (font-flags kerning middle middle-vert large)) (string-format (lookup-text! *common-text* (text-id text-0080) #f)) - (print-game-text *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + (print-game-text *temp-string* font-ctx #f 44 (bucket-id hud-draw-hud-alpha)) (progress-method-34 arg0) (progress-method-33 arg0 (-> *progress-work* footer)) - (set-flags! arg1 (font-flags kerning middle large)) - (adjust-font-origin-y arg0 arg1 0.1) - (set-color! arg1 (font-color font-color-33)) + (set-flags! font-ctx (font-flags kerning middle large)) + (adjust-font-origin-y arg0 font-ctx 0.1) + (set-color! font-ctx (font-color font-color-33)) (let ((f0-16 (print-game-text (lookup-text! *common-text* (text-id progress-continue) #f) - arg1 + font-ctx #f 32 (bucket-id hud-draw-hud-alpha) ) ) ) - (draw-highlight-bar arg0 arg1 (the int (+ -2.0 (-> arg1 origin y))) (the int (+ 4.0 f0-16)) (-> arg1 alpha)) + (draw-highlight-bar arg0 font-ctx (the int (+ -2.0 (-> font-ctx origin y))) (the int (+ 4.0 f0-16)) (-> font-ctx alpha)) ) (progress-method-34 arg0) ) ((-> this buy-menu) (progress-method-33 arg0 (-> *progress-work* body)) - (adjust-font-origin-y arg0 arg1 0.45) + (adjust-font-origin-y arg0 font-ctx 0.45) (progress-method-50 arg0 - arg1 + font-ctx (-> *menu-secrets-array* (-> this selected-index) name) (text-id progress-secrets-buy) (text-id progress-secrets-cancel) @@ -350,23 +356,28 @@ #t 0.65 ) - (draw-header arg0 arg1 sv-16 (text-id progress-secrets)) + (draw-header arg0 font-ctx sv-16 (text-id progress-secrets)) (draw-bg-box-outline arg0 (-> *progress-work* sub-header) (* 128.0 sv-16)) (progress-method-34 arg0) - ) + ) (else (progress-method-33 arg0 (-> *progress-work* sub-body-footer)) (let* ((s3-3 (get-scissor-stack-top arg0)) - (f22-0 (- (-> s3-3 w) (-> s3-3 y))) - (f30-1 (+ 10.0 (* 24.0 (-> *video-params* relative-x-scale) (-> arg1 scale)))) - (f28-1 (+ (- -10.0 (-> s3-3 x)) (-> s3-3 z))) - ) + (secret-menu-height (- (-> s3-3 w) (-> s3-3 y))) + (f30-1 (* 24.0 (-> *video-params* relative-x-scale) (-> font-ctx scale))) + (secret-menu-width (- (- (-> s3-3 z) (-> s3-3 x)) 10.0)) + ) (string-format "~32L~S~44L ~S" (lookup-text! *common-text* (text-id progress-on) #f) (lookup-text! *common-text* (text-id progress-off) #f)) - (let* ((f0-27 (-> (get-string-length *temp-string* arg1) length)) - (f26-0 (- (- (- f28-1 f30-1) f0-27) f30-1)) - ) - (set-flags! arg1 (font-flags kerning large)) - (set! (-> arg1 width) f26-0) + (let* ((string-width (-> (get-string-length *temp-string* font-ctx) length)) + (secret-text-width (- secret-menu-width 20.0)) + ) + (when (not (-> *pc-settings* use-vis?)) + (*! secret-text-width (-> *pc-settings* aspect-ratio-reciprocal)) + (set! (-> font-ctx origin x) (the float (adjust-game-x (+ 6.0 (-> s3-3 x))))) + ) + (-! secret-text-width (+ string-width (* f30-1 2.0))) + (set-flags! font-ctx (font-flags kerning large)) + (set-width! font-ctx (the int secret-text-width)) (let ((s1-5 (max 0 (the int (-> this current-index))))) (let* ((a0-61 (-> *menu-secrets-array* s1-5)) (s0-4 (-> a0-61 name)) @@ -381,85 +392,87 @@ ) ) (string-format "~S" sv-192) - (let ((f24-0 (print-game-text *temp-string* arg1 #t 40 (bucket-id hud-draw-hud-alpha)))) + (let ((f24-0 (print-game-text *temp-string* font-ctx #t 40 (bucket-id hud-draw-hud-alpha)))) (let ((f0-33 4.0) (f1-25 (-> this current-index)) ) - (set! (-> arg1 origin y) - (+ (- f0-33 (* f24-0 (- f1-25 (* (the float (the int (/ f1-25 1.0))) 1.0)))) (-> s3-3 y)) - ) + (set! (-> font-ctx origin y) + (+ (- f0-33 (* f24-0 (- f1-25 (* (the float (the int (/ f1-25 1.0))) 1.0)))) (-> s3-3 y)) ) - (set! (-> arg1 height) f22-0) - (while (and (< (-> arg1 origin y) (-> s3-3 w)) (< s1-5 (-> *menu-secrets-array* length))) + ) + (set! (-> font-ctx height) secret-menu-height) + ;; Continues printing lines in the secret menu while the font-context's origin is within the limits of the menu, + ;; And the index counter s1-5 still refers to a secret index that actually exists in the array. + (while (and (< (-> font-ctx origin y) (-> s3-3 w)) (< s1-5 (-> *menu-secrets-array* length))) (let ((s0-6 (-> *menu-secrets-array* s1-5))) (set! sv-208 (-> *menu-secrets-array* s1-5 name)) (set! sv-288 (secret-item-option-method-12 s0-6)) (case sv-288 ((4) (set! sv-240 "?????????") - ) + ) (else (set! sv-240 (lookup-text! *common-text* sv-208 #f)) - ) ) + ) (cond ((logtest? (-> *menu-secrets-array* s1-5 flags) (secret-item-option-flags sf0)) - (set! (-> arg1 origin x) (+ 10.0 (adjust-x-if-needed (-> s3-3 x)))) - (set! (-> arg1 width) f28-1) - (set-color! arg1 (font-color font-color-34)) - (set-flags! arg1 (font-flags kerning large)) - (let ((f22-1 (-> arg1 origin y))) + (set! (-> font-ctx origin x) (adjust-x-if-needed (+ 10.0 (-> s3-3 x)))) + (set-width! font-ctx (the int secret-menu-width)) + (set-color! font-ctx (font-color font-color-34)) + (set-flags! font-ctx (font-flags kerning large)) + (let ((f22-1 (-> font-ctx origin y))) (string-format "~S" sv-240) - (set! (-> arg1 origin y) (+ f22-1 (print-game-text *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)))) - ) - ) + (set! (-> font-ctx origin y) (+ f22-1 (print-game-text *temp-string* font-ctx #f 40 (bucket-id hud-draw-hud-alpha)))) + ) + ) ((not (and (logtest? (-> *menu-secrets-array* s1-5 flags) (secret-item-option-flags sf4)) (or (nonzero? (-> *setting-control* user-current subtitle-language)) (nonzero? (-> *setting-control* user-current language)) (nonzero? (-> *setting-control* user-current audio-language)) - ) ) ) - (set! (-> arg1 origin x) (adjust-x-if-needed (+ (-> s3-3 x) f30-1))) - (set! (-> arg1 width) f26-0) + ) + (set! (-> font-ctx origin x) (+ (adjust-x-if-needed (+ (-> s3-3 x) 10.0)) f30-1)) + (set-width! font-ctx (the int secret-text-width)) (let ((v1-148 sv-288)) (cond ((or (= v1-148 4) (= v1-148 3)) - (set-flags! arg1 (font-flags kerning large ff7)) - (set-color! arg1 (font-color font-color-44)) + (set-flags! font-ctx (font-flags kerning large ff7)) + (set-color! font-ctx (font-color font-color-44)) ) ((zero? v1-148) - (set-flags! arg1 (font-flags kerning large)) - (set-color! arg1 (font-color font-color-34)) + (set-flags! font-ctx (font-flags kerning large)) + (set-color! font-ctx (font-color font-color-34)) ) (else - (set-flags! arg1 (font-flags kerning large)) - (set-color! arg1 (font-color font-color-32)) - ) + (set-flags! font-ctx (font-flags kerning large)) + (set-color! font-ctx (font-color font-color-32)) + ) ) ) - (let ((f22-2 (-> arg1 origin y))) - (string-format "~S" sv-240) - (let ((f20-0 (print-game-text *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)))) + (let ((f22-2 (-> font-ctx origin y))) + (string-format "~S" sv-240) ;;Formatting secret text before printing it onscreen. + (let ((f20-0 (print-game-text *temp-string* font-ctx #f 40 (bucket-id hud-draw-hud-alpha)))) (when (not (logtest? (-> *menu-secrets-array* s1-5 flags) (secret-item-option-flags sf0))) - (set! (-> arg1 origin x) (adjust-x-if-needed (+ (-> s3-3 x) f28-1))) - (set-flags! arg1 (font-flags kerning right large)) + (set! (-> font-ctx origin x) (adjust-x-if-needed (+ (-> s3-3 x) secret-menu-width))) + (set-flags! font-ctx (font-flags kerning right large)) (set! sv-352 (lookup-text! *common-text* (text-id progress-on) #f)) (set! sv-368 (lookup-text! *common-text* (text-id progress-off) #f)) (cond ((or (zero? sv-288) (= sv-288 3)) - (string-format "~d" (-> s0-6 cost)) - (print-game-text *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)) + (string-format "~d" (-> s0-6 cost)) + (print-game-text *temp-string* font-ctx #f 40 (bucket-id hud-draw-hud-alpha)) ) ((= sv-288 1) - (cond - ((logtest? (-> *menu-secrets-array* s1-5 flags) (secret-item-option-flags sf1)) - (string-format "~32L~S~44L ~S" sv-352 sv-368) - (print-game-text *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)) + (cond + ((logtest? (-> *menu-secrets-array* s1-5 flags) (secret-item-option-flags sf1)) + (string-format "~32L~S~44L ~S" sv-352 sv-368) + (print-game-text *temp-string* font-ctx #f 40 (bucket-id hud-draw-hud-alpha)) ) - (else - (string-format "~S" sv-352) - (print-game-text *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)) + (else + (string-format "~S" sv-352) + (print-game-text *temp-string* font-ctx #f 40 (bucket-id hud-draw-hud-alpha)) ) ) ) @@ -467,19 +480,19 @@ (cond ((logtest? (-> *menu-secrets-array* s1-5 flags) (secret-item-option-flags sf1)) (string-format "~44L~S ~32L~S~1L" sv-352 sv-368) - (print-game-text *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)) + (print-game-text *temp-string* font-ctx #f 40 (bucket-id hud-draw-hud-alpha)) ) (else (string-format "~S" sv-368) - (print-game-text *temp-string* arg1 #f 40 (bucket-id hud-draw-hud-alpha)) + (print-game-text *temp-string* font-ctx #f 40 (bucket-id hud-draw-hud-alpha)) ) ) ) ) ) - (+! (-> arg1 origin y) f20-0) + (+! (-> font-ctx origin y) f20-0) (if (= s1-5 (-> this selected-index)) - (draw-highlight-bar arg0 arg1 (the int (+ -2.0 f22-2)) (the int (+ 3.0 f20-0)) sv-16) + (draw-highlight-bar arg0 font-ctx (the int (+ -2.0 f22-2)) (the int (+ 3.0 f20-0)) sv-16) ) ) ) @@ -494,25 +507,25 @@ ) ) (progress-method-34 arg0) - (draw-header arg0 arg1 sv-16 (text-id progress-secrets)) + (draw-header arg0 font-ctx sv-16 (text-id progress-secrets)) (draw-bg-box-outline arg0 (-> *progress-work* sub-header) (* 128.0 sv-16)) (draw-bg-box-alpha-2 arg0 (-> *progress-work* footer) (* 64.0 sv-16)) (draw-bg-box-outline arg0 (-> *progress-work* footer) (* 128.0 sv-16)) (progress-method-47 arg0 - arg1 + font-ctx (!= (-> this current-index) 0.0) (!= (-> this current-index) (the float (+ (-> *menu-secrets-array* length) -1))) - ) + ) ) ) ) ) 0 (none) - ) +) -(defmethod draw-option ((this menu-missions-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) +(defmethod draw-option ((this menu-missions-option) (arg0 progress) (font-ctx font-context) (arg2 int) (arg3 symbol)) (local-vars (sv-176 float) (sv-180 game-task-node-info) @@ -536,7 +549,7 @@ (set! (-> arg0 extra-text-state) -1) (set! (-> arg0 num-open-tasks-found) 0) (set! (-> arg0 num-closed-tasks-found) 0) - (set! (-> arg1 alpha) sv-176) + (set! (-> font-ctx alpha) sv-176) (set! (-> *game-info* mission-list 0) sv-180) (set! (-> sv-180 description) (text-id progress-missions-todo)) (set! (-> sv-184 description) (text-id progress-missions-completed)) @@ -561,68 +574,71 @@ ) (set! (-> arg0 total-num-tasks) sv-192) (sort-task-node-result (-> arg0 total-num-tasks)) - (set-flags! arg1 (font-flags kerning large)) - (set-scale! arg1 0.5) + (set-flags! font-ctx (font-flags kerning large)) + (set-scale! font-ctx 0.5) (string-format "~S" (lookup-text! *common-text* (text-id progress-missions-complete-icon) #f)) - (let ((f30-1 (+ 14.0 (-> (get-string-length *temp-string* arg1) length)))) - (set! (-> arg1 width) (+ (- (- -10.0 f30-1) (-> s3-0 x)) (-> s3-0 z))) + (let ((mission-circle-icon-width (-> (get-string-length *temp-string* font-ctx) length))) + (set-width! font-ctx (the int (- (-> s3-0 z) (-> s3-0 x) 24.0 ) ) ) + (when (not (-> *pc-settings* use-vis?)) + (set-width! font-ctx (- (the int (* (-> font-ctx width) (-> *pc-settings* aspect-ratio-reciprocal) ) ) 8 ) ) + ) + (set-width! font-ctx (the int (- (-> font-ctx width) mission-circle-icon-width))) (let ((s2-2 (-> *game-info* mission-list)) (s1-2 (max 0 (the int (-> this current-index)))) ) (let* ((s0-1 (-> s2-2 s1-2)) (a1-10 (if (and (logtest? (-> s0-1 flags) (game-task-node-flag closed)) (task-complete? *game-info* (-> s0-1 task))) - (-> *game-info* play-list (-> s0-1 task) text-name) - (-> s0-1 description) - ) + (-> *game-info* play-list (-> s0-1 task) text-name) + (-> s0-1 description) ) ) + ) (set! sv-256 (lookup-text! *common-text* a1-10 #f)) ) (string-format "~S" sv-256) - (let ((f28-0 (print-game-text *temp-string* arg1 #t 44 (bucket-id hud-draw-hud-alpha)))) - (let* ((v1-60 arg1) - (f0-14 (+ 10.0 (-> s3-0 x))) - (f1-6 4.0) + (let ((f28-0 (print-game-text *temp-string* font-ctx #t 44 (bucket-id hud-draw-hud-alpha))) + (text-start-x (adjust-x-if-needed (+ 10.0 (-> s3-0 x)))) + ) + (let* ((f1-6 4.0) (f2-2 (-> this current-index)) (f1-8 (+ (- f1-6 (* f28-0 (- f2-2 (* (the float (the int (/ f2-2 1.0))) 1.0)))) (-> s3-0 y))) - ) - (set! (-> v1-60 origin x) f0-14) - (set! (-> v1-60 origin y) f1-8) - ) - (set! (-> arg1 height) sv-188) - (while (and (< (-> arg1 origin y) (-> s3-0 w)) (< s1-2 (-> arg0 total-num-tasks))) + ) + (set! (-> font-ctx origin x) text-start-x) + (set! (-> font-ctx origin y) f1-8) + ) + (set! (-> font-ctx height) sv-188) + (while (and (< (-> font-ctx origin y) (-> s3-0 w)) (< s1-2 (-> arg0 total-num-tasks))) (set! sv-272 (-> s2-2 s1-2)) (if (and (logtest? (-> sv-272 flags) (game-task-node-flag closed)) (task-complete? *game-info* (-> sv-272 task))) (set! sv-288 (-> *game-info* play-list (-> sv-272 task) text-name)) (set! sv-288 (-> sv-272 description)) - ) - (set! (-> arg1 origin x) (+ 10.0 (adjust-x-if-needed (-> s3-0 x)))) + ) + (set! (-> font-ctx origin x) text-start-x) (cond ((or (= sv-288 (text-id progress-missions-todo)) (= sv-288 (text-id progress-missions-completed))) - (let ((a0-41 arg1)) - (set! (-> a0-41 color) (font-color font-color-34)) - ) - ) + (set! (-> font-ctx color) (font-color font-color-34)) + ) (else (string-format "~S" (lookup-text! *common-text* (if (logtest? (-> sv-272 flags) (game-task-node-flag closed)) (text-id progress-missions-complete-icon) (text-id progress-missions-todo-icon) - ) - #f)) - (print-game-text *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) - (set-color! arg1 (font-color font-color-32)) - (set! (-> arg1 origin x) (+ (adjust-x-if-needed (-> s3-0 x)) f30-1)) + ) + #f) ) + (print-game-text *temp-string* font-ctx #f 44 (bucket-id hud-draw-hud-alpha)) + (set-color! font-ctx (font-color font-color-32)) + (set! (-> font-ctx origin x) (+ mission-circle-icon-width (adjust-x-if-needed (+ 14.0 (-> s3-0 x))))) ) - (let ((f26-0 (-> arg1 origin y))) - (string-format "~S" (lookup-text! *common-text* sv-288 #f)) - (set! (-> arg1 origin y) (+ f26-0 (print-game-text *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)))) - ) - (1+! s1-2) ) - (set! (-> this on-screen) (< (-> arg1 origin y) (-> s3-0 w))) + (let ((f26-0 (-> font-ctx origin y))) + (string-format "~S" (lookup-text! *common-text* sv-288 #f)) + (set! (-> font-ctx origin y) (+ f26-0 (print-game-text *temp-string* font-ctx #f 44 (bucket-id hud-draw-hud-alpha)))) + ) + (1+! s1-2) + ) + (set! (-> this on-screen) (< (-> font-ctx origin y) (-> s3-0 w))) (seek! (-> this current-index) (-> this target-index) @@ -633,10 +649,10 @@ ) ) (progress-method-34 arg0) - (draw-header arg0 arg1 sv-176 (text-id progress-missions)) + (draw-header arg0 font-ctx sv-176 (text-id progress-missions)) (draw-bg-box-alpha-2 arg0 (-> *progress-work* footer) (* 64.0 sv-176)) (draw-bg-box-outline arg0 (-> *progress-work* footer) (* 128.0 sv-176)) - (progress-method-47 arg0 arg1 + (progress-method-47 arg0 font-ctx (!= (-> this current-index) 0.0) (and (not (-> this on-screen)) (!= (-> this current-index) (the float (+ (-> arg0 total-num-tasks) -1))))) (none) @@ -1097,31 +1113,42 @@ (none) ) -(defmethod draw-header ((this progress) (arg0 font-context) (arg1 float) (arg2 text-id)) +(defmethod draw-header ((this progress) (font-ctx font-context) (arg1 float) (header-text-id text-id)) (progress-method-33 this (-> *progress-work* header)) - (let ((s3-0 (get-scissor-stack-top this))) + (let* ((s3-0 (get-scissor-stack-top this)) + (header-text (lookup-text! *common-text* header-text-id #f)) + (header-area-width (+ (- -20.0 (-> s3-0 x)) (-> s3-0 z))) + (header-text-width (-> (get-string-length header-text font-ctx) length)) + ) (draw-bg-box-alpha-2 this (-> *progress-work* header) (* 64.0 arg1)) (draw-bg-box-outline this (-> *progress-work* header) (* 128.0 arg1)) - (set-flags! arg0 (font-flags kerning middle large)) - (set-color! arg0 (font-color font-color-32)) - (set! (-> arg0 origin x) (+ 10.0 (-> s3-0 x))) - (set! (-> arg0 origin y) (-> s3-0 y)) + (set-flags! font-ctx (font-flags kerning middle large)) + (set-color! font-ctx (font-color font-color-32)) + (set! (-> font-ctx origin x) (+ 10.0 (-> s3-0 x))) + (set! (-> font-ctx origin y) (-> s3-0 y)) + (when (not (-> *pc-settings* use-vis?)) + (*! header-area-width (-> *pc-settings* aspect-ratio-reciprocal)) + (set! (-> font-ctx origin x) (the float (adjust-game-x (-> font-ctx origin x)))) + ) (progress-method-45 this - arg0 - (+ (- -20.0 (-> s3-0 x)) (-> s3-0 z)) + font-ctx + header-area-width 45.0 - (lookup-text! *common-text* arg2 #f) - (if (not (-> *pc-settings* use-vis?)) 0.75 0.95) + header-text + (if (not (-> *pc-settings* use-vis?)) (* 0.75 (if (< header-area-width header-text-width) + (/ header-area-width header-text-width ) + 1.0 + )) 0.95) 0.1 32 ) ) (progress-method-34 this) 0 - ) +) -(defmethod draw-option ((this menu-memcard-slot-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) +(defmethod draw-option ((this menu-memcard-slot-option) (arg0 progress) (font-ctx font-context) (arg2 int) (arg3 symbol)) (let ((f30-0 (fmax 0.0 (* 2.0 (- 0.5 (-> arg0 menu-transition))))) (f28-0 (if (= (-> arg0 current) 'select-save-title) 0.2 @@ -1133,11 +1160,11 @@ ) (cond ((not (loaded? *bigmap*)) - (progress-method-51 arg0 arg1) + (progress-method-51 arg0 font-ctx) ) (else - (set! (-> arg1 alpha) f30-0) - (set-scale! arg1 0.6) + (set! (-> font-ctx alpha) f30-0) + (set-scale! font-ctx 0.6) (progress-method-33 arg0 (-> s3-0 body)) (let* ((s3-1 (get-scissor-stack-top arg0)) (s0-0 (new 'stack 'hud-box)) @@ -1146,31 +1173,31 @@ (f28-1 (+ f26-0 f0-4)) ) (let ((s2-0 *progress-save-info*)) - (set! (-> arg1 origin x) (adjust-x-if-needed (+ 10.0 (-> s3-1 x)))) - (set! (-> arg1 origin y) (+ f26-0 (* 0.5 (- f0-4 (* 32.0 (-> arg1 scale)))))) - (set! (-> arg1 height) f0-4) - (set-flags! arg1 (font-flags kerning large)) + (set! (-> font-ctx origin x) (adjust-x-if-needed (+ 10.0 (-> s3-1 x)))) + (set! (-> font-ctx origin y) (+ f26-0 (* 0.5 (- f0-4 (* 32.0 (-> font-ctx scale)))))) + (set! (-> font-ctx height) f0-4) + (set-flags! font-ctx (font-flags kerning large)) (when (and s2-0 (= (-> s2-0 formatted) 1) (= (-> s2-0 inited) 1)) (cond ((= (-> s2-0 file arg2 present) 1) - (string-format "~S ~D" (lookup-text! *common-text* (text-id text-0073) #f) (1+ arg2)) - (print-game-text *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + (string-format "~S ~D" (lookup-text! *common-text* (text-id progress-saved-game) #f) (1+ arg2)) + (print-game-text *temp-string* font-ctx #f 44 (bucket-id hud-draw-hud-alpha)) ) ((zero? (-> s2-0 file arg2 present)) - (print-game-text (lookup-text! *common-text* (text-id progress-empty) #f) arg1 #f 44 (bucket-id hud-draw-hud-alpha)) - ) + (print-game-text (lookup-text! *common-text* (text-id progress-empty) #f) font-ctx #f 44 (bucket-id hud-draw-hud-alpha)) ) + ) (when (= arg2 (-> arg0 option-index)) - (set-scale! arg1 0.8) + (set-scale! font-ctx 0.8) (with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) global-buf)) (bucket-id tex-hud-hud-alpha)) - (let ((f24-1 (+ (-> s3-1 x) (* 0.4 (- (-> s3-1 z) (-> s3-1 x)))))) + (let ((box-start (adjust-x-if-needed (-> s3-1 x))) + (box-end (adjust-x-if-needed (+ (-> s3-1 x) (* 0.4 (- (-> s3-1 z) (-> s3-1 x)))))) + ) (set-vector! (-> s0-0 color) 128 128 128 (the int (* 16.0 f30-0))) (vector-copy! (the vector (-> s0-0 box)) s3-1) - (set! (-> s0-0 box min x) f24-1) - (draw-box-alpha-1 s0-0 buf) - (set! (-> s0-0 box min x) (adjust-x-if-needed (-> s3-1 x))) - (set! (-> s0-0 box max x) f24-1) - ) + (set! (-> s0-0 box min x) box-start) + (set! (-> s0-0 box max x) box-end) + ) (set! (-> s0-0 box min y) f26-0) (set! (-> s0-0 box max y) f28-1) (draw-box-alpha-1 s0-0 buf) @@ -1179,14 +1206,14 @@ (set! (-> s0-0 box min y) (-> s3-1 y)) (set! (-> s0-0 box max y) f26-0) (draw-box-prim-only s0-0 buf) - ) + ) (when (!= f28-1 (-> s3-1 w)) (set! (-> s0-0 box min y) f28-1) (set! (-> s0-0 box max y) (-> s3-1 w)) (draw-box-prim-only s0-0 buf) - ) ) ) + ) (when (= (-> s2-0 file arg2 present) 1) (when (= arg2 (-> arg0 option-index)) (draw-icon-array! @@ -1197,87 +1224,93 @@ 1.0 1.0 (static-rgba #x80 #x80 #x80 #x80) - f30-0) - (set-scale! arg1 0.6) - (set-color! arg1 (font-color font-color-32)) - (adjust-font-origin-y arg0 arg1 0.675) - (set-flags! arg1 (font-flags kerning right large)) + f30-0 + ) + (set-scale! font-ctx 0.6) + (set-color! font-ctx (font-color font-color-32)) + (adjust-font-origin-y arg0 font-ctx 0.675) + (set-flags! font-ctx (font-flags kerning right large)) (let* ((v1-91 (-> s2-0 file arg2 game-time0)) (v1-92 (logior (shl (-> s2-0 file arg2 game-time1) 32) v1-91))) - (set! (-> arg1 origin x) (adjust-x-if-needed (+ (-> s3-1 x) (* 0.675 (- (-> s3-1 z) (-> s3-1 x)))))) + (set! (-> font-ctx origin x) (adjust-x-if-needed (+ (-> s3-1 x) (* 0.675 (- (-> s3-1 z) (-> s3-1 x)))))) (string-format "~2,'0D:~2,'0D" (/ (the-as int v1-92) #x107ac0) (/ (mod (the-as int v1-92) #x107ac0) #x4650)) ) - (print-game-text *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + (print-game-text *temp-string* font-ctx #f 44 (bucket-id hud-draw-hud-alpha)) (draw-icon-array! (-> *progress-icon-arrays* 66) (the int (adjust-x-if-needed (+ 10.0 (* 0.4 (- (-> s3-1 z) (-> s3-1 x))) (-> s3-1 x)))) - (the int (-> arg1 origin y)) + (the int (-> font-ctx origin y)) 0.65 0.65 (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) f30-0 - ) - (set! (-> arg1 origin x) (adjust-x-if-needed (+ (- (+ -10.0 (-> s3-1 z)) (-> s3-1 x)) (-> s3-1 x)))) + ) + (set! (-> font-ctx origin x) (adjust-x-if-needed (+ (- (+ -10.0 (-> s3-1 z)) (-> s3-1 x)) (-> s3-1 x)))) (string-format "~D%" (the int (-> s2-0 file arg2 completion-percentage))) - (print-game-text *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + (print-game-text *temp-string* font-ctx #f 44 (bucket-id hud-draw-hud-alpha)) (draw-icon-array! (-> *progress-icon-arrays* 67) (the int (adjust-x-if-needed (+ -8.0 (* 0.75 (- (-> s3-1 z) (-> s3-1 x))) (-> s3-1 x)))) - (the int (-> arg1 origin y)) + (the int (-> font-ctx origin y)) 0.7 0.7 (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) f30-0 - ) - (adjust-font-origin-y arg0 arg1 0.83) - (set! (-> arg1 origin x) (adjust-x-if-needed (+ (-> s3-1 x) (* 0.675 (- (-> s3-1 z) (-> s3-1 x)))))) + ) + (adjust-font-origin-y arg0 font-ctx 0.83) + (set! (-> font-ctx origin x) (adjust-x-if-needed (+ (-> s3-1 x) (* 0.675 (- (-> s3-1 z) (-> s3-1 x)))))) (string-format "~D" (the int (-> s2-0 file arg2 skill-count))) - (print-game-text *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + (print-game-text *temp-string* font-ctx #f 44 (bucket-id hud-draw-hud-alpha)) (draw-icon-array! (-> *progress-icon-arrays* 68) (the int (adjust-x-if-needed (+ 10.0 (* 0.4 (- (-> s3-1 z) (-> s3-1 x))) (-> s3-1 x)))) - (the int (+ -2.0 (-> arg1 origin y))) + (the int (+ -2.0 (-> font-ctx origin y))) 0.7 0.7 (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) f30-0 - ) - (set! (-> arg1 origin x) (adjust-x-if-needed (+ (- (+ -10.0 (-> s3-1 z)) (-> s3-1 x)) (-> s3-1 x)))) + ) + (set! (-> font-ctx origin x) (adjust-x-if-needed (- (-> s3-1 z) 10.0))) (string-format "~D" (the int (-> s2-0 file arg2 gem-count))) - (print-game-text *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + (print-game-text *temp-string* font-ctx #f 44 (bucket-id hud-draw-hud-alpha)) (draw-icon-array! (-> *progress-icon-arrays* 69) (the int (adjust-x-if-needed (+ -14.0 (* 0.75 (- (-> s3-1 z) (-> s3-1 x))) (-> s3-1 x)))) - (the int (-> arg1 origin y)) + (the int (-> font-ctx origin y)) 0.5 0.5 (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) f30-0 - ) + ) (when (logtest? (-> s2-0 file arg2 secrets) 1) - (set-flags! arg1 (font-flags kerning middle large)) - (set! (-> arg1 origin x) (adjust-x-if-needed (+ (-> s3-1 x) (* 0.4 (- (-> s3-1 z) (-> s3-1 x)))))) - (set! (-> arg1 origin y) (+ 8.0 (-> s3-1 y))) - (set-width! arg1 (the int (* 0.6 (- (-> s3-1 z) (-> s3-1 x))))) - (string-format "~S" (lookup-text! *common-text* (text-id progress-secrets-hero-mode) #f)) - (print-game-text *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + (set-flags! font-ctx (font-flags kerning middle large)) + (set-width! font-ctx (the int (* 0.6 (- (-> s3-1 z) (-> s3-1 x))))) + (set! (-> font-ctx origin x) (+ (-> s3-1 x) (* 0.4 (- (-> s3-1 z) (-> s3-1 x))))) + (when (not (-> *pc-settings* use-vis?)) + (set-width! font-ctx (the int (* (-> font-ctx width) (-> *pc-settings* aspect-ratio-reciprocal)))) + (set! (-> font-ctx origin x) (the float (adjust-game-x (-> font-ctx origin x)))) ) + (set! (-> font-ctx origin y) (+ 8.0 (-> s3-1 y))) + (string-format "~S" (lookup-text! *common-text* (text-id progress-secrets-hero-mode) #f)) + (print-game-text *temp-string* font-ctx #f 44 (bucket-id hud-draw-hud-alpha)) ) ) ) ) ) + ) (progress-method-34 arg0) + ;;Here are where the menu-headers are drawn (when (zero? arg2) (case (-> arg0 current) (('select-load) - (draw-header arg0 arg1 f30-0 (text-id progress-load-file-select)) + (draw-header arg0 font-ctx f30-0 (text-id progress-load-file-select)) ) (('select-save-hero) - (draw-header arg0 arg1 f30-0 (text-id save-hero-mode-file)) + (draw-header arg0 font-ctx f30-0 (text-id save-hero-mode-file)) ) (else - (draw-header arg0 arg1 f30-0 (text-id progress-save-file-select)) + (draw-header arg0 font-ctx f30-0 (text-id progress-save-file-select)) ) ) ) @@ -1285,9 +1318,9 @@ ) ) (none) - ) +) -(defmethod draw-option ((this menu-save-sub-menu-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) +(defmethod draw-option ((this menu-save-sub-menu-option) (arg0 progress) (font-ctx font-context) (arg2 int) (arg3 symbol)) (let ((f30-0 (fmax 0.0 (* 2.0 (- 0.5 (-> arg0 menu-transition)))))) (progress-method-33 arg0 (-> *progress-work* body)) (let* ((s2-0 (get-scissor-stack-top arg0)) @@ -1298,26 +1331,25 @@ ) ) ) - (set-width! arg1 width) - (set-flags! arg1 (font-flags kerning large)) - (set-scale! arg1 0.425) + (set-width! font-ctx width) + (set-flags! font-ctx (font-flags kerning large)) + (set-scale! font-ctx 0.425) (let* ((f24-0 (* (- (-> s2-0 w) (-> s2-0 y)) 0.2)) (f28-1 (+ (-> s2-0 y) (* f24-0 (the float arg2)))) (f26-0 (+ f28-1 f24-0)) ) (let* ((f0-7 - (print-game-text (lookup-text! *common-text* (-> this name) #f) arg1 #t 44 (bucket-id hud-draw-hud-alpha)) + (print-game-text (lookup-text! *common-text* (-> this name) #f) font-ctx #t 44 (bucket-id hud-draw-hud-alpha)) ) - (v1-11 arg1) (f1-9 (+ 10.0 (-> s2-0 x))) (f0-10 (+ f28-1 (* 0.5 (- f24-0 f0-7)))) ) - (set! (-> v1-11 origin x) (adjust-x-if-needed f1-9)) - (set! (-> v1-11 origin y) f0-10) + (set! (-> font-ctx origin x) (adjust-x-if-needed f1-9)) + (set! (-> font-ctx origin y) f0-10) ) - (set! (-> arg1 height) f24-0) + (set! (-> font-ctx height) f24-0) (when (= arg2 (-> arg0 option-index)) - (set-scale! arg1 0.45) + (set-scale! font-ctx 0.45) (with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) global-buf)) (bucket-id tex-hud-hud-alpha) ) @@ -1334,7 +1366,7 @@ ) ) ) - (print-game-text (lookup-text! *common-text* (-> this name) #f) arg1 #f 44 (bucket-id hud-draw-hud-alpha)) + (print-game-text (lookup-text! *common-text* (-> this name) #f) font-ctx #f 44 (bucket-id hud-draw-hud-alpha)) (progress-method-34 arg0) (none) ) @@ -1360,7 +1392,8 @@ (set-width! arg1 (the int (+ (- -20.0 (-> s1-1 x)) (-> s1-1 z)))) (when (not (-> *pc-settings* use-vis?)) (set! (-> arg1 origin x) (the float (adjust-game-x (-> arg1 origin x)))) - (*! (-> arg1 width) (-> *pc-settings* aspect-ratio-reciprocal))) + (*! (-> arg1 width) (-> *pc-settings* aspect-ratio-reciprocal)) + ) (set-height! arg1 (the int (- (-> s1-1 w) (-> s1-1 y)))) (while (and (< (-> arg1 origin y) (-> s1-1 w)) (< idx s3-0)) (cond @@ -2017,7 +2050,341 @@ (bucket-id hud-draw-hud-alpha)))) (end-scissor-resolution box 1.0)) 0 - (none)) + (none) +) + +;; WARN: Return type mismatch int vs object. +(defmethod draw-button-text ((this progress) (font-ctx font-context) (display-text string)) + (let ((f0-1 (- 1.0 (-> this menu-transition)))) + (set-scale! font-ctx 0.5) + (set! (-> font-ctx alpha) f0-1) + ) + (print-game-text display-text font-ctx #f 44 (bucket-id hud-draw-hud-alpha)) + 0 +) + +(defmethod progress-method-45 ((this progress) + (font-ctx font-context) + (text-area-width float) + (height-offset float) + (arg3 string) + (arg4 float) + (arg5 float) + (arg6 int) + ) + (set-width! font-ctx 10000) + (set-scale! font-ctx arg4) + (string-format "~S" arg3) + (let ((temp-string-width (-> (get-string-length *temp-string* font-ctx) length))) + (set-width! font-ctx (the int text-area-width)) + (cond + ((< text-area-width temp-string-width) + (if (< (/ text-area-width temp-string-width) arg5) + (set-scale! font-ctx arg4) + (set-scale! font-ctx (/ (* text-area-width arg4) temp-string-width)) + ) + ) + (else + (set-scale! font-ctx arg4) + ) + ) + ) + (string-format "~S" arg3) + (let ((f30-0 (print-game-text *temp-string* font-ctx #t arg6 (bucket-id hud-draw-hud-alpha)))) + (+! (-> font-ctx origin y) (* 0.5 (- height-offset f30-0))) + (let ((previous-origin-y (-> font-ctx origin y))) + (string-format "~S" arg3) + (print-game-text *temp-string* font-ctx #f arg6 (bucket-id hud-draw-hud-alpha)) + (set! (-> font-ctx origin y) previous-origin-y) + ) + f30-0 + ) +) + +;; WARN: Return type mismatch int vs object. +(defmethod draw-yes-no-style-footer ((this progress) (font-ctx font-context) (yes-text-id text-id) (no-text-id text-id)) + (string-format + (if (-> this yes-no-choice) + "~33L~S~44L ~S" + "~44L~S ~33L~S" + ) + (lookup-text! *common-text* yes-text-id #f) + (lookup-text! *common-text* no-text-id #f) + ) + (print-game-text *temp-string* font-ctx #f 44 (bucket-id hud-draw-hud-alpha)) + 0 +) + +;; ERROR: Stack slot load at 80 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 96 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 160 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 176 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 80 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 96 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 160 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 176 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 160 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 176 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 160 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 176 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 80 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 96 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 160 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 176 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 80 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 96 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 160 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 176 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 160 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 176 mismatch: defined as size 4, got size 16 +;; WARN: Return type mismatch int vs object. +;; two-choice-prompt +(defmethod progress-method-50 ((this progress) + (font-ctx font-context) + (title-text-id text-id) + (option1-text-id text-id) + (option2-text-id text-id) + (arg4 symbol) + (arg5 symbol) + (arg6 float) + ) + (let ((sv-16 (fmax 0.0 (* 2.0 (- 0.5 (-> this menu-transition))))) + (sv-20 (the-as string #f)) + (sv-24 (get-scissor-stack-top this)) + (option1-text (lookup-text! *common-text* option1-text-id #f)) + (option2-text (lookup-text! *common-text* option2-text-id #f)) + ) + (set! (-> font-ctx alpha) sv-16) + (set! (-> font-ctx flags) (font-flags kerning middle large)) + (let ((f30-0 0.0) + (text-height-offset (the-as float 24.5)) + (text-area-width (+ (- -20.0 (-> sv-24 x)) (-> sv-24 z))) + (title-text (the-as string (lookup-text! *common-text* title-text-id #f))) + ) + (set! (-> font-ctx origin x) (+ 10.0 (-> sv-24 x))) + (when (not (-> *pc-settings* use-vis?)) + (*! text-area-width (-> *pc-settings* aspect-ratio-reciprocal)) + (set! (-> font-ctx origin x) (the float (adjust-game-x (-> font-ctx origin x)))) + ) + (set! sv-20 + (cond + (arg5 + (set! (-> font-ctx color) (font-color font-color-32)) + (let ((f28-0 (progress-method-45 + this + font-ctx + text-area-width + text-height-offset + title-text + arg6 + 0.75 + 35 + ) + ) + ) + (set! f30-0 (/ f28-0 2)) + (set-scale! font-ctx (/ (-> font-ctx scale) 2)) + (draw-highlight-bar this font-ctx (the int (+ -1.0 (-> font-ctx origin y))) (the int (+ 2.0 f28-0)) sv-16) + (+! (-> font-ctx origin y) f28-0) + ) + (string-format + (if (-> this yes-no-choice) + "~33L~S ~44L~S" + "~44L~S~33L ~S" + ) + option1-text + option2-text + ) + *temp-string* + ) + (else + (set! (-> font-ctx color) + (if arg4 + (font-color font-color-33) + (font-color font-color-32) + ) + ) + (let ((f28-1 (progress-method-45 + this + font-ctx + text-area-width + text-height-offset + title-text + arg6 + 0.75 + 35 + ) + ) + ) + (when arg4 + (let* ((a2-12 (the int (+ -1.0 (-> font-ctx origin y)))) + (a3-6 (the int (+ 1.0 f28-1))) + ) + (draw-highlight-bar this font-ctx a2-12 a3-6 (the-as float sv-16)) + ) + ) + (+! (-> font-ctx origin y) f28-1) + ) + (string-format + (if (-> this yes-no-choice) + "~1L~S~44L ~S" + "~44L~S ~1L~S~1L" + ) + option1-text + option2-text + title-text + ) + *temp-string* + ) + ) + ) + (draw-button-text this font-ctx sv-20) + (+! (-> font-ctx origin y) f30-0) + ) + ) + 0 +) + +;; WARN: Return type mismatch int vs object. +(defmethod progress-method-51 ((this progress) (font-ctx font-context)) + (let ((v1-1 (get-scissor-stack-top this))) + (let ((f1-1 (+ (-> v1-1 y) (* 0.5 (- (-> v1-1 w) (-> v1-1 y)))))) + (set! (-> font-ctx origin x) (-> v1-1 x)) + (set! (-> font-ctx origin y) f1-1) + ) + (set! (-> font-ctx width) (- (-> v1-1 z) (-> v1-1 x))) + ) + (set-scale! font-ctx 0.6) + (set! (-> font-ctx flags) (font-flags kerning middle large)) + (if (< (mod (current-time) 300) 210) + (print-game-text + (lookup-text! *common-text* (text-id progress-memcard-loading) #f) + font-ctx + #f + 44 + (bucket-id hud-draw-hud-alpha) + ) + ) + 0 +) + +(defmethod draw-option ((this menu-picture-slider-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) + (let ((f30-0 (fmax 0.0 (* 2.0 (- 0.5 (-> arg0 menu-transition)))))) + (set! (-> arg1 alpha) f30-0) + (progress-method-33 arg0 (-> *progress-work* body)) + (cond + ((not (loaded? *bigmap*)) + (progress-method-51 arg0 arg1) + ) + (else + (let ((f28-0 (-> (the-as (pointer float) (&+ (the-as pointer *setting-control*) (-> this setting-offset)))))) + (draw-slider-option + arg0 + arg1 + (lookup-text! *common-text* (-> this name) #f) + f30-0 + (-> this offset-y) + 0.9 + f28-0 + (the-as float #f) + ) + ) + ) + ) + (when (zero? arg2) + (let ((s4-1 (get-scissor-stack-top arg0))) + (draw-header arg0 arg1 f30-0 (text-id progress-picture-options)) + (draw-icon-array! + (-> *progress-icon-arrays* 75) + 256 + (the int (+ (-> s4-1 y) (* 0.75 (- (-> s4-1 w) (-> s4-1 y))))) + (if (not (-> *pc-settings* use-vis?)) + (* (-> *video-params* relative-x-scale-reciprical) (-> *pc-settings* aspect-ratio-reciprocal)) + (-> *video-params* relative-x-scale-reciprical) + ) + 10.0 + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + f30-0 + ) + ) + ) + ) + (progress-method-34 arg0) + 0 + (none) +) + + +(defmethod draw-option ((this menu-hero-mode-message-option) (arg0 progress) (font-ctx font-context) (arg2 int) (arg3 symbol)) + (let ((f30-0 (fmax 0.0 (* 2.0 (- 0.5 (-> arg0 menu-transition))))) + (s4-0 *progress-work*) + ) + (progress-method-33 arg0 (-> s4-0 body-footer)) + (progress-method-53 arg0 font-ctx) + (set! (-> font-ctx alpha) f30-0) + (set-scale! font-ctx 0.5) + (set! (-> font-ctx color) (font-color font-color-32)) + (set! (-> font-ctx flags) (font-flags kerning middle middle-vert large)) + (when (not (-> *pc-settings* use-vis?)) + (set! (-> font-ctx origin x) (the float (adjust-game-x (-> font-ctx origin x)))) + (set-width! font-ctx (the int (* (-> font-ctx width) (-> *pc-settings* aspect-ratio-reciprocal)))) + ) + (string-format (lookup-text! *common-text* (text-id hero-mode-how-to) #f) (the-as none #f)) + (print-game-text *temp-string* font-ctx #f 44 (bucket-id hud-draw-hud-alpha)) + (progress-method-34 arg0) + (progress-method-33 arg0 (-> s4-0 footer)) + ) + (progress-method-53 arg0 font-ctx) + (set! (-> font-ctx color) (font-color font-color-33)) + (adjust-font-origin-y arg0 font-ctx 0.1) + (draw-highlight-bar arg0 font-ctx (the int (-> font-ctx origin y)) 18 (-> font-ctx alpha)) + (print-game-text + (lookup-text! *common-text* (text-id progress-continue) #f) + font-ctx + #f + 44 + (bucket-id hud-draw-hud-alpha) + ) + (progress-method-34 arg0) + 0 + (none) +) + +(defmethod draw-option ((this menu-already-exists-option) (arg0 progress) (font-ctx font-context) (arg2 int) (arg3 symbol)) + (set! (-> font-ctx alpha) (- 1.0 (-> arg0 menu-transition))) + (set! (-> font-ctx color) (font-color font-color-32)) + (set-scale! font-ctx 0.5) + (set! (-> font-ctx flags) (font-flags kerning middle middle-vert large)) + (set! (-> font-ctx origin x) 80.0) + (set! (-> font-ctx origin y) 120.0) + (set-width! font-ctx 360) + (set-height! font-ctx 85) + (when (not (-> *pc-settings* use-vis?)) + (set! (-> font-ctx origin x) (the float (adjust-game-x (-> font-ctx origin x)))) + (set-width! font-ctx (the int (* (-> font-ctx width) (-> *pc-settings* aspect-ratio-reciprocal)))) + ) + (print-game-text + (lookup-text! *common-text* (text-id progress-memcard-overwrite-warning) #f) + font-ctx + #f + 44 + (bucket-id hud-draw-hud-alpha) + ) + (+! (-> font-ctx origin y) 105.0) + (set-height! font-ctx 45) + (print-game-text + (lookup-text! *common-text* (text-id progress-memcard-overwrite-confirm?) #f) + font-ctx + #f + 44 + (bucket-id hud-draw-hud-alpha) + ) + (+! (-> font-ctx origin y) 45.0) + (draw-highlight-bar arg0 font-ctx (the int (+ 8.0 (-> font-ctx origin y))) 24 (-> font-ctx alpha)) + (draw-yes-no-style-footer arg0 font-ctx (text-id progress-yes) (text-id progress-no)) + 0 + (none) +) ; (defun draw-highlight-music-player ((x int) (y int) (w int) (h int) (alpha float)) ; "draw the highlight for a number in the music player screen" diff --git a/test/decompiler/reference/jak3/engine/ui/progress/progress-draw_REF.gc b/test/decompiler/reference/jak3/engine/ui/progress/progress-draw_REF.gc index 5310e7bfa4..a77864c1dd 100644 --- a/test/decompiler/reference/jak3/engine/ui/progress/progress-draw_REF.gc +++ b/test/decompiler/reference/jak3/engine/ui/progress/progress-draw_REF.gc @@ -176,7 +176,7 @@ ;; definition for method 44 of type progress ;; WARN: Return type mismatch int vs object. -(defmethod progress-method-44 ((this progress) (arg0 font-context) (arg1 string)) +(defmethod draw-button-text ((this progress) (arg0 font-context) (arg1 string)) (let ((f0-1 (- 1.0 (-> this menu-transition)))) (set-scale! arg0 0.5) (set! (-> arg0 alpha) f0-1) @@ -637,7 +637,7 @@ ) ) ) - (progress-method-44 this arg0 sv-20) + (draw-button-text this arg0 sv-20) (+! (-> arg0 origin y) f30-0) ) ) @@ -2565,7 +2565,12 @@ (cond ((= (-> s2-0 file arg2 present) 1) (let ((sv-48 print-game-text)) - (format (clear *temp-string*) "~S ~D" (lookup-text! *common-text* (text-id text-0073) #f) (+ arg2 1)) + (format + (clear *temp-string*) + "~S ~D" + (lookup-text! *common-text* (text-id progress-saved-game) #f) + (+ arg2 1) + ) (sv-48 *temp-string* arg1 #f 44 (bucket-id hud-draw-hud-alpha)) ) ) diff --git a/test/decompiler/reference/jak3/engine/ui/progress/progress-h_REF.gc b/test/decompiler/reference/jak3/engine/ui/progress/progress-h_REF.gc index 448a9edeff..978d279a68 100644 --- a/test/decompiler/reference/jak3/engine/ui/progress/progress-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/ui/progress/progress-h_REF.gc @@ -149,7 +149,7 @@ (draw-bg-box-outline (_type_ progress-box float) object) (draw-bg-box-alpha-2 (_type_ progress-box float) object) (draw-bg-box-alpha-1 (_type_ progress-box float) object) - (progress-method-44 (_type_ font-context string) object) + (draw-button-text (_type_ font-context string) object) (progress-method-45 (_type_ font-context float float string float float int) float) (draw-header (_type_ font-context float text-id) object) (progress-method-47 (_type_ font-context symbol symbol) object)