Files
jak-project/goal_src/jak2/pc/progress/progress-draw-pc.gc
Tyler Wilding 5eeaffcde0 scripts: new linter script to detect goal_src files with trailing whitespace (#3387)
Removes trailing whitespace from goal_src files, eventually the
formatter will do this as well but it's not ready yet so this is a
decent interim solution.

A competent text editor will also do this / flag it for you.
2024-02-24 14:27:56 -05:00

3280 lines
147 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
#|
Additional PC port specific file for overriding/expanding the progress menu
This gives us more freedom to write code how we want.
|#
(defun draw-previous-next ((arg0 menu-highscores-option) (arg1 font-context) (arg2 symbol))
(local-vars (sv-16 string) (sv-32 int))
(let ((s3-0 370))
(case (get-aspect-ratio)
(('aspect4x3)
(set! (-> arg1 origin x) 73.0)
(set! (-> arg1 origin y) 308.0)
(set! (-> arg1 width) 359.0)
(set! (-> arg1 height) 185.0)
)
(('aspect16x9)
(set! (-> arg1 origin x) 82.0)
(set! (-> arg1 origin y) 328.0)
(set! (-> arg1 width) 355.0)
(set! (-> arg1 height) 185.0)
(set! s3-0 350)
)
)
(when (not (-> *pc-settings* use-vis?))
(set! s3-0 (the int (* (-> *pc-settings* aspect-ratio-reciprocal) s3-0)))
(*! (-> arg1 width) (-> *pc-settings* aspect-ratio-reciprocal))
(set! (-> arg1 origin x) (the float (adjust-game-x (-> arg1 origin x))))
)
(set-flags! arg1 (font-flags kerning large))
(set-color! arg1 (progress-selected 200))
(set-scale! arg1 0.6)
(when (or (> (-> arg0 page-index) 0) arg2)
(print-game-text (string-format "~C~S" 163 (lookup-text! *common-text* (text-id progress-next) #f)) arg1 #f 44 (bucket-id progress))
)
(set! arg2 (or (!= (-> arg0 page-index) (+ (-> arg0 num-pages) -1)) arg2))
(when arg2
(set-flags! arg1 (font-flags kerning right large))
(+! (-> arg1 origin x) (the float s3-0))
(print-game-text (string-format "~S~C" (lookup-text! *common-text* (text-id progress-next) #f) 161) arg1 #f 44 (bucket-id progress))
)
)
0
(none)
)
(deftype highscore-cup-draw-params (structure)
((cup-scale float)
(cup-y int16)
(y-on-later-pages int16)
(cup-x int16)
(font-scale float)
(font-scale-on-later-pages float)))
(define *highscore-cup-draw-params* (new 'static 'inline-array highscore-cup-draw-params 8
(new 'static 'highscore-cup-draw-params :cup-scale 0.25 :cup-y 174 :y-on-later-pages 180 :cup-x 112 :font-scale -1.0 :font-scale-on-later-pages 0.4)
(new 'static 'highscore-cup-draw-params :cup-scale 0.22 :cup-y 197 :y-on-later-pages 195 :cup-x 111 :font-scale 0.5 :font-scale-on-later-pages 0.4)
(new 'static 'highscore-cup-draw-params :cup-scale 0.20 :cup-y 217 :y-on-later-pages 210 :cup-x 110 :font-scale 0.4 :font-scale-on-later-pages 0.4)
(new 'static 'highscore-cup-draw-params :cup-scale 0.15 :cup-y 232 :y-on-later-pages 225 :cup-x 109 :font-scale 0.3 :font-scale-on-later-pages 0.4)
(new 'static 'highscore-cup-draw-params :cup-scale 0.15 :cup-y 244 :y-on-later-pages 239 :cup-x 109 :font-scale -1.0 :font-scale-on-later-pages 0.4)
(new 'static 'highscore-cup-draw-params :cup-scale 0.15 :cup-y 256 :y-on-later-pages 253 :cup-x 109 :font-scale -1.0 :font-scale-on-later-pages 0.4)
(new 'static 'highscore-cup-draw-params :cup-scale 0.15 :cup-y 268 :y-on-later-pages 266 :cup-x 109 :font-scale -1.0 :font-scale-on-later-pages 0.4)
(new 'static 'highscore-cup-draw-params :cup-scale 0.15 :cup-y 280 :y-on-later-pages 280 :cup-x 109 :font-scale -1.0 :font-scale-on-later-pages 0.4)))
(defun str-print-time-pc ((time float) (omit-milliseconds? symbol))
"Basically the same as str-print-time, but with hours support and can omit milliseconds
uses letters for the units instead of colons which can be ambiguous"
(let* ((hours (the int (/ time 3600)))
(minutes (the int (/ (- time (* 3600.0 hours)) 60)))
(seconds (the int (- time (* 3600.0 hours) (* 60.0 minutes))))
(milliseconds (the int (* 1000.0 (- time (the int time))))))
(clear *temp-string*)
(when (> hours 0)
(format *temp-string* "~Dh" hours))
(format *temp-string* "~Dm" minutes)
(format *temp-string* "~Ds" seconds)
(when (not omit-milliseconds?)
(format *temp-string* "~Dms" milliseconds)))
*temp-string*)
(defun get-highscore-type ((highscore-index-arg int))
"Given a highscore index, return it's type as a symbol
@param highscore-index-arg something
@returns The type, as as symbol."
(let ((highscore-type 'game))
(let ((highscore-index highscore-index-arg))
(cond
((and (>= highscore-index 0) (<= highscore-index 4)) (set! highscore-type 'game))
((and (>= highscore-index 5) (<= highscore-index 12)) (set! highscore-type 'race))
((= highscore-index 13) (set! highscore-type 'game))
((and (>= highscore-index 15) (<= highscore-index 20)) (set! highscore-type 'speedrun))))
highscore-type))
(defun print-highscore-pc ((highscore-row print-highscore-obj) (name string))
(local-vars (font-ctx font-context) (cup-x-offset float) (sv-24 int) (sv-32 int))
(set! font-ctx (-> highscore-row context))
(set! cup-x-offset (-> highscore-row interp))
(set! sv-24 50)
(set! sv-32 (if (= (get-aspect-ratio) 'aspect4x3)
320
300))
(when (not (-> *pc-settings* use-vis?))
(set! sv-32 (the int (* (-> *pc-settings* aspect-ratio-reciprocal) sv-32)))
(set! sv-24 (the int (* (-> *pc-settings* aspect-ratio-reciprocal) sv-24))))
(set-flags! font-ctx (font-flags kerning large))
(+! (-> font-ctx origin x) (the float sv-24))
(let* ((draw-params (-> *highscore-cup-draw-params* (-> highscore-row place)))
(cup-x (-> draw-params cup-x)))
;; correct cup x
(when (not (-> *pc-settings* use-vis?))
(set! cup-x (adjust-game-x (the float cup-x))))
;; set font scale
(if (> (-> *progress-pc-generic-store* current-highscore-page-index) 0)
(set-scale! font-ctx (-> draw-params font-scale-on-later-pages))
(if (> (-> draw-params font-scale) 0)
(set-scale! font-ctx (-> draw-params font-scale))))
;; move font down
(when (< 0 (-> highscore-row place))
(if (> (-> *progress-pc-generic-store* current-highscore-page-index) 0)
(+! (-> font-ctx origin y) (the float (- (-> draw-params y-on-later-pages) (-> *highscore-cup-draw-params* (1- (-> highscore-row place)) y-on-later-pages))))
(+! (-> font-ctx origin y) (the float (- (-> draw-params cup-y) (-> *highscore-cup-draw-params* (1- (-> highscore-row place)) cup-y))))))
;; print highscore text
(if (and (nonzero? name) (!= name #f))
(print-game-text (string-format "~S" name) font-ctx #f 44 (bucket-id progress))
(print-game-text (string-format "~S" (lookup-text! *common-text* (-> (new 'static 'boxed-array :type text-id (text-id progress-highscores-1st)
(text-id progress-highscores-2nd)
(text-id progress-highscores-3rd)
(text-id progress-highscores-4th)
(text-id progress-highscores-5th)
(text-id progress-highscores-6th)
(text-id progress-highscores-7th)
(text-id progress-highscores-8th))
(-> highscore-row place)) #f)) font-ctx #f 44 (bucket-id progress)))
;; draw cup icon if we're not the previous page
(cond
;; Just draw the cup based on the index if we're involving external times, it's not that complicated
((and (-> *pc-settings* speedrunner-mode?)
(= (-> *progress-pc-generic-store* current-highscore-page-index) 0))
;; TODO - enum
(let ((place (case (-> highscore-row place)
((0) 3)
((1) 2)
((2) 1)
(else 0))))
(draw-highscore-cup (-> highscore-row self) place (+ (the int cup-x-offset) cup-x) (-> draw-params cup-y) (-> draw-params cup-scale) (-> highscore-row local-scale))))
(else
(when (and (= (-> *progress-pc-generic-store* current-highscore-page-index) 0)
(not (-> highscore-row previous)))
(draw-highscore-cup (-> highscore-row self) (eval-highscore highscore-row) (+ (the int cup-x-offset) cup-x) (-> draw-params cup-y) (-> draw-params cup-scale) (-> highscore-row local-scale))))))
(+! (-> font-ctx origin x) (the float sv-32))
(set-flags! font-ctx (font-flags kerning right large))
(cond
((-> highscore-row game-score)
(print-game-text (string-format "~D" (the int (-> highscore-row score))) font-ctx #f 44 (bucket-id progress)))
(else
(print-game-text (str-print-time-pc (-> highscore-row score) (= 'speedrun (get-highscore-type (-> highscore-row index)))) font-ctx #f 44 (bucket-id progress))))
(set-flags! font-ctx (font-flags kerning large))
(set! (-> font-ctx origin x) (- (-> font-ctx origin x) (the float (+ sv-24 sv-32)))))
(defun highscore-available? ((highscore-index int))
(let ((available? #f))
(let ((index highscore-index))
(cond
((zero? index) (set! available? #t))
((= index 1) (set! available? (logtest? (-> *game-info* sub-task-list (game-task-node city-yellow-gun-training-introduction) flags) (game-task-node-flag closed))))
((= index 2) (set! available? (logtest? (-> *game-info* secrets) (game-secrets gungame-blue))))
((= index 3) (set! available? (logtest? (-> *game-info* secrets) (game-secrets gungame-dark))))
((= index 4) (set! available? (logtest? (-> *game-info* sub-task-list (game-task-node stadium-board1-introduction) flags) (game-task-node-flag closed))))
((= index 5) (set! available? (logtest? (-> *game-info* sub-task-list (game-task-node stadium-race-class3-introduction) flags) (game-task-node-flag closed))))
((= index 6) (set! available? (logtest? (-> *game-info* sub-task-list (game-task-node stadium-race-class2-introduction) flags) (game-task-node-flag closed))))
((= index 7) (set! available? (logtest? (-> *game-info* sub-task-list (game-task-node stadium-race-class1-introduction) flags) (game-task-node-flag closed))))
((= index 8) (set! available? (or (logtest? (-> *game-info* sub-task-list (game-task-node city-burning-bush-race-port-introduction) flags) (game-task-node-flag closed)) (open? (-> *game-info* sub-task-list (game-task-node city-burning-bush-race-port-introduction))))))
((= index 9) (set! available? (or (logtest? (-> *game-info* sub-task-list (game-task-node city-burning-bush-race-errol-introduction) flags) (game-task-node-flag closed)) (open? (-> *game-info* sub-task-list (game-task-node city-burning-bush-race-errol-introduction))))))
((= index 10) (set! available? (logtest? (-> *game-info* secrets) (game-secrets reverse-races))))
((= index 11) (set! available? (logtest? (-> *game-info* secrets) (game-secrets reverse-races))))
((= index 12) (set! available? (logtest? (-> *game-info* secrets) (game-secrets reverse-races))))
((= index 13) (set! available? (logtest? (-> *game-info* sub-task-list (game-task-node city-play-onin-game-introduction) flags) (game-task-node-flag closed))))
((= index 14) (set! available? (logtest? (-> *game-info* sub-task-list (game-task-node city-whack-introduction) flags) (game-task-node-flag closed))))
((and (>= index 15) (<= index 20)) (set! available? (and (-> *pc-settings* speedrunner-mode?))))))
available?))
(defun get-highscore-text ((highscore-index int))
(let ((id (text-id progress-highscores-header-race)))
(let ((index highscore-index))
(cond
((and (>= index 0) (<= index 3)) (set! id (text-id progress-highscores-header-guncourse)))
((= index 4) (set! id (text-id progress-highscores-header-jetboard)))
((and (>= index 5) (<= index 12)) (set! id (text-id progress-highscores-header-race)))
((= index 13) (set! id (text-id progress-highscores-header-onin)))
((= index 14) (set! id (text-id progress-highscores-header-metalhead-mash)))
((and (>= index 15) (<= index 20)) (set! id (text-id progress-highscores-header-speedrun)))))
(the-as text-id id)))
(defun get-highscore-text-sub ((highscore-index int))
(let ((id (text-id progress-highscores-subheader-class1)))
(let ((index highscore-index))
(cond
((zero? index) (set! id (text-id progress-highscores-subheader-scattergun)))
((= index 1) (set! id (text-id progress-highscores-subheader-blaster)))
((= index 2) (set! id (text-id progress-highscores-subheader-vulcan)))
((= index 3) (set! id (text-id progress-highscores-subheader-peacemaker)))
((= index 4) (set! id (text-id progress-highscores-subheader-stadium)))
((= index 5) (set! id (text-id progress-highscores-subheader-class3)))
((= index 6) (set! id (text-id progress-highscores-subheader-class2)))
((= index 7) (set! id (text-id progress-highscores-subheader-class1)))
((= index 8) (set! id (text-id progress-highscores-subheader-portrace)))
((= index 9) (set! id (text-id progress-highscores-subheader-cityrace)))
((= index 10) (set! id (text-id progress-highscores-subheader-class3-reverse)))
((= index 11) (set! id (text-id progress-highscores-subheader-class2-reverse)))
((= index 12) (set! id (text-id progress-highscores-subheader-class1-reverse)))
((= index 13) (set! id (text-id progress-highscores-subheader-oninstent)))
((= index 14) (set! id (text-id progress-highscores-subheader-hiphog)))
((= index 15) (set! id (text-id progress-highscores-subheader-speedrun-any)))
((= index 16) (set! id (text-id progress-highscores-subheader-speedrun-anyhoverless)))
((= index 17) (set! id (text-id progress-highscores-subheader-speedrun-allmissions)))
((= index 18) (set! id (text-id progress-highscores-subheader-speedrun-100)))
((= index 19) (set! id (text-id progress-highscores-subheader-speedrun-anyorbs)))
((= index 20) (set! id (text-id progress-highscores-subheader-speedrun-anyhero)))))
(the-as text-id id)))
(defun get-highscore-icon ((highscore-index int))
(let ((texture (new 'static 'texture-id :index #x10 :page #xc93)))
(let ((index highscore-index))
(cond
((zero? index) (set! texture (new 'static 'texture-id :index #x10 :page #xc93)))
((= index 1) (set! texture (new 'static 'texture-id :index #x12 :page #xc93)))
((= index 2) (set! texture (new 'static 'texture-id :index #x13 :page #xc93)))
((= index 3) (set! texture (new 'static 'texture-id :index #x11 :page #xc93)))
((= index 4) (set! texture (new 'static 'texture-id :index #xe :page #xc93)))
((and (>= index 5) (<= index 12)) (set! texture (new 'static 'texture-id :index #x1 :page #xc93)))
((= index 13) (set! texture (new 'static 'texture-id :index #x16 :page #xc93)))
((= index 14) (set! texture (new 'static 'texture-id :index #x17 :page #xc93)))
;; TODO - maybe i can lookup some unique icons for the categories? Maybe some of the bigmap ones? for now just the jetboard because fast
((and (>= index 15) (<= index 20)) (set! texture (new 'static 'texture-id :index #xe :page #xc93)))))
(the-as texture-id texture)))
(defun get-num-highscores ()
(let ((count 0))
(dotimes (max-highscores (if (-> *pc-settings* speedrunner-mode?) 21 15))
(when (highscore-available? max-highscores)
(+! count 1)))
count))
(defun get-next-highscore ((current-highscore-index int))
(let ((max-highscores (if (-> *pc-settings* speedrunner-mode?) 21 15))
(index-change 1)
(selected-index -1))
(+ current-highscore-index index-change)
(while (and (= selected-index -1) (< index-change max-highscores))
(let ((s2-0 (+ current-highscore-index index-change)))
(+! index-change 1)
(when (highscore-available? (mod s2-0 max-highscores))
(set! selected-index (mod s2-0 max-highscores)))))
(when (= selected-index -1)
(set! selected-index current-highscore-index))
selected-index))
(defun get-prev-highscore ((current-highscore-index int))
(let ((max-highscores (if (-> *pc-settings* speedrunner-mode?) 21 15))
(index-change 1)
(selected-index -1))
(+ current-highscore-index index-change)
(while (and (= selected-index -1) (< index-change max-highscores))
(let ((curr-index (- current-highscore-index index-change)))
(+! index-change 1)
(when (< curr-index 0)
(set! curr-index (+ max-highscores curr-index)))
(let ((highscore-available-fn highscore-available?)
(normalized-index (abs curr-index)))
(when (highscore-available-fn normalized-index)
(set! selected-index (abs curr-index))))))
(when (= selected-index -1)
(set! selected-index current-highscore-index))
selected-index))
(defun get-highscore-icon-scale ((highscore-index int))
(let ((scale 1.0)
(guncourse-scale 0.6)
(race-scale 0.8))
(cond
((and (>= highscore-index 0) (<= highscore-index 3)) (set! scale guncourse-scale))
((= highscore-index 4) (set! scale 0.5))
((and (>= highscore-index 5) (<= highscore-index 12)) (set! scale race-scale))
((= highscore-index 13) (set! scale 0.7))
((= highscore-index 14) (set! scale 0.7))
((and (>= highscore-index 15) (<= highscore-index 20)) (set! scale 0.5)))
scale))
(defun get-highscore-icon-xoffset ((highscore-index int))
(cond
((not (-> *pc-settings* use-vis?)) (adjust-game-x 435.0))
((= (get-aspect-ratio) 'aspect4x3) 435)
(else 410)))
;; TODO:
;; - nothing found
;; - API error
(defun progress-pc-get-external-time ((highscore-index int) (row-index int))
(case highscore-index
((0) (pc-get-external-highscore "scatter" row-index *pc-cpp-temp-string* (&-> *progress-pc-generic-store* custom-highscore-score)))
((1) (pc-get-external-highscore "blaster" row-index *pc-cpp-temp-string* (&-> *progress-pc-generic-store* custom-highscore-score)))
((2) (pc-get-external-highscore "vulcan" row-index *pc-cpp-temp-string* (&-> *progress-pc-generic-store* custom-highscore-score)))
((3) (pc-get-external-highscore "peacemaker" row-index *pc-cpp-temp-string* (&-> *progress-pc-generic-store* custom-highscore-score)))
((4) (pc-get-external-highscore "jetboard" row-index *pc-cpp-temp-string* (&-> *progress-pc-generic-store* custom-highscore-score)))
((5) (pc-get-external-race-time "class3" row-index *pc-cpp-temp-string* (&-> *progress-pc-generic-store* custom-highscore-score)))
((6) (pc-get-external-race-time "class2" row-index *pc-cpp-temp-string* (&-> *progress-pc-generic-store* custom-highscore-score)))
((7) (pc-get-external-race-time "class1" row-index *pc-cpp-temp-string* (&-> *progress-pc-generic-store* custom-highscore-score)))
((8) (pc-get-external-race-time "port" row-index *pc-cpp-temp-string* (&-> *progress-pc-generic-store* custom-highscore-score)))
((9) (pc-get-external-race-time "erol" row-index *pc-cpp-temp-string* (&-> *progress-pc-generic-store* custom-highscore-score)))
((10) (pc-get-external-race-time "class3rev" row-index *pc-cpp-temp-string* (&-> *progress-pc-generic-store* custom-highscore-score)))
((11) (pc-get-external-race-time "class2rev" row-index *pc-cpp-temp-string* (&-> *progress-pc-generic-store* custom-highscore-score)))
((12) (pc-get-external-race-time "class1rev" row-index *pc-cpp-temp-string* (&-> *progress-pc-generic-store* custom-highscore-score)))
((13) (pc-get-external-highscore "onin" row-index *pc-cpp-temp-string* (&-> *progress-pc-generic-store* custom-highscore-score)))
((14) (pc-get-external-highscore "mash" row-index *pc-cpp-temp-string* (&-> *progress-pc-generic-store* custom-highscore-score)))
((15) (pc-get-external-speedrun-time "any" row-index *pc-cpp-temp-string* (&-> *progress-pc-generic-store* custom-highscore-score)))
((16) (pc-get-external-speedrun-time "anyhoverless" row-index *pc-cpp-temp-string* (&-> *progress-pc-generic-store* custom-highscore-score)))
((17) (pc-get-external-speedrun-time "allmissions" row-index *pc-cpp-temp-string* (&-> *progress-pc-generic-store* custom-highscore-score)))
((18) (pc-get-external-speedrun-time "100" row-index *pc-cpp-temp-string* (&-> *progress-pc-generic-store* custom-highscore-score)))
((19) (pc-get-external-speedrun-time "anyorbs" row-index *pc-cpp-temp-string* (&-> *progress-pc-generic-store* custom-highscore-score)))
((20) (pc-get-external-speedrun-time "anyhero" row-index *pc-cpp-temp-string* (&-> *progress-pc-generic-store* custom-highscore-score)))))
(defun draw-highscore-page-up-down-arrows ((font-ctx font-context) (draw-up? symbol) (draw-down? symbol))
(let ((new-x-pos 58.0)
(new-y-pos-up 105)
(new-y-pos-down 190)
(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))
(defun progress-pc-local-entry-label ((highscore-index int))
(if (and (>= highscore-index 5) (<= highscore-index 12))
(text-id progress-highscores-local-time)
(text-id progress-highscores-local-score)))
(defun progress-pc-get-next-score ((highscore-index int) (rows-already-printed int))
"Fetches the next valid score, merges with local scores. Score will be returned, name will be in [[*pc-cpp-temp-string*]]
this is a bit inefficient, but it lets us avoid keeping track of state"
(let ((return-next-value? #f)
(local-index 0)
(external-index 0)
(max-local-times (progress-pc-get-num-nonzero-local-scores highscore-index))
(max-external-times (progress-pc-max-external-scores highscore-index))
(times-enumerated 0)
(local-score-ptr (get-game-score-ref *game-info* (get-highscore-score highscore-index))))
;; first check if we should return the next value
(while (< times-enumerated (progress-pc-max-highscore-rows highscore-index))
(when (>= times-enumerated rows-already-printed)
(set! return-next-value? #t))
(cond
;; case where both arrays have times remaining
((and (< local-index max-local-times) (< external-index max-external-times))
(progress-pc-get-external-time highscore-index external-index)
(cond
((> (-> local-score-ptr local-index) (-> *progress-pc-generic-store* custom-highscore-score))
;; local score is higher, use the local one
(if return-next-value?
(begin
(clear *pc-cpp-temp-string*)
(format *pc-cpp-temp-string* "~S~S" "~[~1L" (lookup-text! *common-text* (progress-pc-local-entry-label highscore-index) #f))
(return (-> local-score-ptr local-index)))
(inc! local-index)))
(else
;; otherwise, use the external one
(if return-next-value?
(begin
(return (-> *progress-pc-generic-store* custom-highscore-score)))
(inc! external-index)))))
;; case where we only have local times left
((< local-index max-local-times)
(if return-next-value?
(begin
(clear *pc-cpp-temp-string*)
(format *pc-cpp-temp-string* "~S~S" "~[~1L" (lookup-text! *common-text* (progress-pc-local-entry-label highscore-index) #f))
(return (-> local-score-ptr local-index)))
(inc! local-index)))
;; case where we only have external times left
((< external-index max-external-times)
(progress-pc-get-external-time highscore-index external-index)
(if return-next-value?
(return (-> *progress-pc-generic-store* custom-highscore-score))
(inc! external-index))))
(inc! times-enumerated))
-1.0))
(defmethod draw-option ((this menu-highscores-option) (progress progress) (font-ctx font-context) (option-index int) (selected? symbol))
(let ((alpha (fmax 0.0 (* 2.0 (- 0.5 (-> progress menu-transition)))))
(padding 20.0)
(icon-scale 0.22)
(line-width 395.0)
(old-font-origin-x (-> font-ctx origin x))
(ui-boundary (new 'stack-no-clear 'hud-box))
(highscore-row (new 'stack 'print-highscore-obj))
(row-width 0.0)
(unknown-todo 0.0))
(if (not (-> *pc-settings* use-vis?))
(*! padding (-> *pc-settings* aspect-ratio-reciprocal)))
(if (not (-> *pc-settings* use-vis?))
(*! line-width (-> *pc-settings* aspect-ratio-reciprocal)))
(set! row-width (* (-> progress sliding) line-width))
(set! unknown-todo (* (-> progress sliding-off) (-> this slide-dir) line-width))
(cond
((or (= *pc-waiting-on-rpc?* #t) (not (-> *bigmap* progress-minimap)))
(draw-busy-loading font-ctx))
(else
;; initial font parameters
(set! (-> font-ctx alpha) alpha)
(set-scale! font-ctx 1.0)
(set-flags! font-ctx (font-flags kerning middle large))
(set-color! font-ctx (font-color progress))
;; set up for decoration text
(set! (-> font-ctx origin x) 59.0)
(if (not (-> *pc-settings* use-vis?))
(set! (-> font-ctx origin x) (the float (adjust-game-x (-> font-ctx origin x)))))
(set! (-> font-ctx origin y) 78.0)
(set! (-> font-ctx width) line-width)
(set! (-> font-ctx height) 215.0)
;; set the scissor region
(begin-scissor ui-boundary progress)
;; set up for highscore icon
(set! (-> this sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x3 :page #xc93)))
(set! (-> this sprites 0 flags) (the-as uint 4))
(set! (-> this sprites 0 scale-x) icon-scale)
(set! (-> this sprites 0 scale-y) icon-scale)
(let ((icon-sprite (-> this sprites 0 color2)))
(set! (-> icon-sprite 0) 128)
(set! (-> icon-sprite 1) 128)
(set! (-> icon-sprite 2) 128)
(set! (-> icon-sprite 3) (the int (* 128.0 alpha)))
)
(set! (-> this sprites 0 pos z) #xfffff0)
(set! (-> this sprites 0 pos w) 0)
;; draw decoration text
(if (text-language? spanish)
(draw-decoration this font-ctx alpha (text-id progress-root-highscores) #t 0.8)
(draw-decoration this font-ctx alpha (text-id progress-root-highscores) #t 0.95))
;; draw scrolling arrows if applicable
(when (> (progress-pc-max-highscore-rows (-> this page-index)) 8)
(draw-highscore-page-up-down-arrows font-ctx
(> (-> *progress-pc-generic-store* current-highscore-page-index) 0)
(< (* (inc (-> *progress-pc-generic-store* current-highscore-page-index)) 8) (progress-pc-max-highscore-rows (-> this page-index)))))
;; draw highscore title (e.g 'Gun Course')
(set-scale! font-ctx 0.6)
(set! (-> font-ctx height) 185.0)
(+! (-> font-ctx origin y) 46.0)
(set! (-> font-ctx origin x) 65.0)
(if (not (-> *pc-settings* use-vis?))
(set! (-> font-ctx origin x) (the float (adjust-game-x (-> font-ctx origin x)))))
(set-width! font-ctx 367)
(set-flags! font-ctx (font-flags kerning large))
(set-color! font-ctx (font-color progress-force-selected))
(set! (-> font-ctx origin x) (+ padding row-width (-> font-ctx origin x)))
(set-scale! font-ctx 0.75)
(when (text-language? german)
(set-scale! font-ctx 0.69))
(when (text-language? french)
(set-scale! font-ctx 0.72))
(when (text-language? spanish)
(set-scale! font-ctx 0.65))
(print-game-text (string-format "~S" (lookup-text! *common-text* (get-highscore-text (-> this page-index)) #f)) font-ctx #f 44 (bucket-id progress))
;; now draw highscore subtitle (e.g 'Scatter Gun')
(+! (-> font-ctx origin y) 25.0)
(set-scale! font-ctx 0.6)
(when (text-language? french spanish)
(set-scale! font-ctx 0.58))
(print-game-text (string-format "~S" (lookup-text! *common-text* (get-highscore-text-sub (-> this page-index)) #f)) font-ctx #f 44 (bucket-id progress))
;; draw highscore icon
(set! (-> font-ctx origin x) (- (-> font-ctx origin x) (+ padding row-width)))
(+! (-> font-ctx origin y) 25.0)
(draw-highscore-icon
this
(get-highscore-icon (-> this page-index))
(the int (+ (the float (get-highscore-icon-xoffset (-> this page-index))) row-width))
(get-highscore-icon-yoffset (-> this page-index))
(get-highscore-icon-scale (-> this page-index)))
;; print the scores now.
(set! old-font-origin-x (-> font-ctx origin x))
(set-color! font-ctx (font-color progress))
(+! (-> font-ctx origin x) row-width)
(set-scale! font-ctx 0.6)
(let ((score-ptr (get-game-score-ref *game-info* (get-highscore-score (-> this page-index)))))
(set! (-> highscore-row index) (-> this page-index))
(set! (-> highscore-row previous) #f)
(set! (-> highscore-row self) this)
(case (get-highscore-type (-> this page-index))
(('game) (set! (-> highscore-row game-score) #t))
(('race) (set! (-> highscore-row game-score) #f))
(('speedrun) (set! (-> highscore-row game-score) #f)))
(set! (-> highscore-row context) font-ctx)
(set! (-> highscore-row local-scale) alpha)
(set! (-> highscore-row interp) row-width)
;; retrieve the scores and draw them
(if (-> *pc-settings* speedrunner-mode?)
(cond
((= (get-highscore-type (-> this page-index)) 'speedrun)
;; speedruns are easy, there are no local times
(dotimes (row-index 8)
(let ((run-index (+ row-index (* (-> *progress-pc-generic-store* current-highscore-page-index) 8))))
;; fetch the info
(progress-pc-get-external-time (-> this page-index) run-index)
(set! (-> highscore-row place) row-index)
(set! (-> highscore-row score) (-> *progress-pc-generic-store* custom-highscore-score))
(when (> (-> *progress-pc-generic-store* custom-highscore-score) 0)
(print-highscore-pc highscore-row *pc-cpp-temp-string*)))))
(else
;; races and highscores are a bit more tricky as they may have local times
;; so we merge them so you can see how you locally stack up against the competition
(dotimes (row-index 8)
(let* ((num-rows-already-printed (+ row-index (* (-> *progress-pc-generic-store* current-highscore-page-index) 8)))
(score (progress-pc-get-next-score (-> this page-index) num-rows-already-printed)))
(set! (-> highscore-row place) row-index)
(set! (-> highscore-row score) score)
(when (> score 0)
(print-highscore-pc highscore-row *pc-cpp-temp-string*))))))
(dotimes (row-index 8)
(set! (-> highscore-row place) row-index)
(set! (-> highscore-row score) (-> score-ptr row-index))
(print-highscore-pc highscore-row (the-as string #f)))))
(set! (-> font-ctx origin x) old-font-origin-x)
;; draw the previous highscore that was seen
;; note that we only need to know what the last one was
;; since the screen only needs to draw 2 highscores at any given time anyway
;; reset font parameters
(set-scale! font-ctx 0.6)
(set! (-> font-ctx origin x) 59.0)
(if (not (-> *pc-settings* use-vis?))
(set! (-> font-ctx origin x) (the float (adjust-game-x (-> font-ctx origin x)))))
(set! (-> font-ctx origin y) 78.0)
(set! (-> font-ctx width) line-width)
(set! (-> font-ctx height) 215.0)
(set-scale! font-ctx 0.5)
(set! (-> font-ctx height) 185.0)
(+! (-> font-ctx origin y) 46.0)
(set! (-> font-ctx origin x) 80.0)
(if (not (-> *pc-settings* use-vis?))
(set! (-> font-ctx origin x) (the float (adjust-game-x (-> font-ctx origin x)))))
(set! (-> this sprites 0 pos z) #xffffff)
(set! (-> font-ctx width) line-width)
(set-flags! font-ctx (font-flags kerning large))
(set-color! font-ctx (font-color progress-force-selected))
(set! (-> font-ctx origin x) (+ padding unknown-todo (-> font-ctx origin x)))
(set-scale! font-ctx 0.75)
(when (text-language? german)
(set-scale! font-ctx 0.69))
(when (text-language? french)
(set-scale! font-ctx 0.72))
(when (text-language? spanish)
(set-scale! font-ctx 0.65))
(print-game-text (string-format "~S" (lookup-text! *common-text* (get-highscore-text (-> this prev-page-index)) #f)) font-ctx #f 44 (bucket-id progress))
(+! (-> font-ctx origin y) 25.0)
(set-scale! font-ctx 0.6)
(when (text-language? french spanish)
(set-scale! font-ctx 0.58))
(print-game-text (string-format "~S" (lookup-text! *common-text* (get-highscore-text-sub (-> this prev-page-index)) #f)) font-ctx #f 44 (bucket-id progress))
(set! (-> font-ctx origin x) (- (-> font-ctx origin x) (+ padding unknown-todo)))
(+! (-> font-ctx origin y) 25.0)
(draw-highscore-icon
this
(get-highscore-icon (-> this prev-page-index))
(the int (+ (the float (get-highscore-icon-xoffset (-> this page-index))) unknown-todo))
(get-highscore-icon-yoffset (-> this page-index))
(get-highscore-icon-scale (-> this page-index)))
(set! old-font-origin-x (-> font-ctx origin x))
(set-color! font-ctx (font-color progress))
(+! (-> font-ctx origin x) unknown-todo)
(set-scale! font-ctx 0.6)
(when (< 1 (get-num-highscores))
(let ((gp-11 (get-game-score-ref *game-info* (get-highscore-score (-> this prev-page-index)))))
(set! (-> highscore-row index) (-> this prev-page-index))
(set! (-> highscore-row previous) #t)
(set! (-> highscore-row self) this)
(case (get-highscore-type (-> this prev-page-index))
(('game)
(set! (-> highscore-row game-score) #t))
(('race)
(set! (-> highscore-row game-score) #f)))
(set! (-> highscore-row context) font-ctx)
(set! (-> highscore-row local-scale) alpha)
(set! (-> highscore-row interp) row-width)
;; TODO - update this section
(dotimes (s5-10 8)
(set! (-> highscore-row place) s5-10)
(set! (-> highscore-row score) (-> gp-11 s5-10))
(print-highscore-pc highscore-row (the-as string #f))))
(set! (-> font-ctx origin x) old-font-origin-x)
(set-scale! font-ctx 0.6))
(when (< 1 (get-num-highscores))
(draw-previous-next this font-ctx #t))
(end-scissor ui-boundary 1.0))))
(none))
(defmethod draw-option ((obj menu-slider-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
(local-vars
(sv-48 int)
(sv-64 int)
(sv-80 int)
(sv-96 int)
(sv-112 int)
(sv-128 pointer)
(sv-160 rgba)
(sv-176 dma-buffer)
(sv-208 pointer)
(sv-240 rgba)
(sv-256 dma-buffer)
)
(let ((s5-0 arg1)
(gp-0 arg2)
(bar-width 230.0)
(bar-width-max 240)
(icon-right-offset 242)
)
(let ((f30-0 (* 2.0 (- 0.5 (-> arg0 menu-transition)))))
(set! sv-48 128)
(let ((s1-0 sv-48)
(s0-0 9)
(s2-0 157)
(f28-0 2.0)
(s3-0 252)
)
(set! sv-64 20)
(set! sv-80 0)
(set! sv-96 112)
(set! sv-112 127)
(if (< f30-0 0.0)
(set! f30-0 0.0)
)
(set! (-> s5-0 alpha) f30-0)
(cond
((not (-> *bigmap* progress-minimap))
(draw-busy-loading s5-0)
(return 0)
)
(else
(set-scale! s5-0 0.6)
(+! (-> s5-0 origin y) 20.0)
(case (get-aspect-ratio)
(('aspect4x3)
(set! s2-0 157)
(let ((v1-17 gp-0))
(cond
((zero? v1-17)
(+! (-> s5-0 origin y) -24.0)
(+! s2-0 -9)
)
((= v1-17 1)
(+! (-> s5-0 origin y) -9.0)
(+! s2-0 43)
)
((= v1-17 2)
(+! (-> s5-0 origin y) 6.0)
(+! s2-0 96)
)
)
)
)
(('aspect16x9)
(set! s2-0 172)
(set! f28-0 2.62)
(set! s0-0 5)
(set! s3-0 250)
(let ((v1-28 gp-0))
(cond
((zero? v1-28)
(+! (-> s5-0 origin y) -20.0)
(+! s2-0 -20)
)
((= v1-28 1)
(+! (-> s5-0 origin y) 2.0)
(+! s2-0 40)
)
((= v1-28 2)
(+! (-> s5-0 origin y) 30.0)
(+! s2-0 105)
)
)
)
)
)
(when (not (-> *pc-settings* use-vis?))
(set! sv-48 (adjust-game-x (the float sv-48)))
(set! s1-0 (adjust-game-x (the float s1-0)))
(*! bar-width (-> *pc-settings* aspect-ratio-reciprocal))
(set! bar-width-max (the int (* (-> *pc-settings* aspect-ratio-reciprocal) bar-width-max)))
(set! icon-right-offset (the int (* (-> *pc-settings* aspect-ratio-reciprocal) icon-right-offset)))
(set! sv-64 (the int (* (-> *pc-settings* aspect-ratio-reciprocal) sv-64)))
(set! s0-0 (the int (* (-> *pc-settings* aspect-ratio-reciprocal) s0-0)))
(set! s3-0 (the int (* (-> *pc-settings* aspect-ratio-reciprocal) s3-0)))
)
(set-flags! s5-0 (font-flags kerning large))
(set! (-> s5-0 origin x) (the float sv-48))
(cond
(arg3
(set! sv-128 (-> obj value-to-modify))
(+! (-> s5-0 origin y) -8.0)
(set-color! s5-0 (font-color progress-force-selected))
(draw-highlight (the int (+ -2.0 (-> s5-0 origin y))) 52 f30-0)
(print-game-text (lookup-text! *common-text* (-> obj name) #f) s5-0 #f 44 (bucket-id progress))
(set! sv-160 (new 'static 'rgba :r (the int (* 0.0 f30-0 (-> (the-as (pointer float) sv-128))))
:g (the int (* 0.0 f30-0 (-> (the-as (pointer float) sv-128))))
:b (the int (* 0.0 f30-0 (-> (the-as (pointer float) sv-128))))
:a (the int (* 128.0 f30-0))))
(set! (-> obj sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #xb :page #xc93)))
(set! (-> obj sprites 0 scale-x) f28-0)
(set! (-> obj sprites 0 scale-y) 0.7)
(let ((v1-57 (-> obj sprites 0 color2)))
(set! (-> v1-57 0) 128)
(set! (-> v1-57 1) 128)
(set! (-> v1-57 2) 128)
(set! (-> v1-57 3) (the int (* 128.0 f30-0)))
)
(set! (-> obj sprites 0 pos z) #x3fffff)
(set! (-> obj sprites 0 pos w) 0)
(set! (-> obj sprites 1 tex) (lookup-texture-by-id (new 'static 'texture-id :index #xc :page #xc93)))
(set! (-> obj sprites 1 scale-x) 0.2)
(set! (-> obj sprites 1 scale-y) 1.33)
(let ((v1-62 (-> obj sprites 1 color2)))
(set! (-> v1-62 0) 128)
(set! (-> v1-62 1) 128)
(set! (-> v1-62 2) 128)
(set! (-> v1-62 3) (the int (* 128.0 f30-0)))
)
(set! (-> obj sprites 1 pos z) #x3fffff)
(set! (-> obj sprites 1 pos w) 0)
(set! (-> obj sprites 2 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x3e :page #xc93)))
(set! (-> obj sprites 2 scale-x) 1.0)
(set! (-> obj sprites 2 scale-y) 1.0)
(let ((v1-67 (-> obj sprites 2 color2)))
(set! (-> v1-67 0) sv-80)
(set! (-> v1-67 1) sv-96)
(set! (-> v1-67 2) sv-112)
(set! (-> v1-67 3) (the int (* 128.0 f30-0)))
)
(set! (-> obj sprites 2 pos z) #xffffff)
(set! (-> obj sprites 2 pos w) 0)
(set! (-> obj sprites 3 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x3f :page #xc93)))
(set! (-> obj sprites 3 scale-x) 1.0)
(set! (-> obj sprites 3 scale-y) 1.0)
(let ((v1-72 (-> obj sprites 3 color2)))
(set! (-> v1-72 0) sv-80)
(set! (-> v1-72 1) sv-96)
(set! (-> v1-72 2) sv-112)
(set! (-> v1-72 3) (the int (* 128.0 f30-0)))
)
(set! (-> obj sprites 3 pos z) #xffffff)
(set! (-> obj sprites 3 pos w) 0)
(set-hud-piece-position! (-> obj sprites 0) s1-0 s2-0)
(set-hud-piece-position!
(-> obj sprites 1)
(+ s1-0 (the int (* bar-width (-> (the-as (pointer float) sv-128)))))
(+ s2-0 -4)
)
(set-hud-piece-position! (-> obj sprites 2) (- s1-0 sv-64) (+ s2-0 -4))
(set-hud-piece-position! (-> obj sprites 3) (+ sv-64 icon-right-offset s1-0) (+ s2-0 -4))
(with-dma-buffer-add-bucket ((sv-176 (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress))
(draw (-> obj sprites 0) sv-176 (-> *level* default-level))
(draw-sprite2d-xy
sv-176
(+ s1-0 s0-0 (the int (* bar-width (-> (the-as (pointer float) sv-128)))))
(+ s2-0 7)
(- bar-width-max (the int (* bar-width (-> (the-as (pointer float) sv-128)))))
9
sv-160
)
(draw (-> obj sprites 1) sv-176 (-> *level* default-level))
(draw (-> obj sprites 2) sv-176 (-> *level* default-level))
(draw (-> obj sprites 3) sv-176 (-> *level* default-level))
)
(+! (-> s5-0 origin x) (the float s3-0))
(set-flags! s5-0 (font-flags kerning right large))
(print-game-text (string-format "~D%" (the int (* 100.0 (-> (the-as (pointer float) sv-128))))) s5-0 #f 44 (bucket-id progress))
(set-flags! s5-0 (font-flags kerning large))
)
(else
(set! sv-208 (-> obj value-to-modify))
(+! (-> s5-0 origin y) -8.0)
(when (text-language? german french)
(set-scale! s5-0 0.56)
)
(if (= (-> arg0 option-index) gp-0)
(draw-highlight (the int (+ -2.0 (-> s5-0 origin y))) 24 f30-0)
)
(print-game-text (lookup-text! *common-text* (-> obj name) #f) s5-0 #f 44 (bucket-id progress))
(set! sv-240 (new 'static 'rgba :r (the int (* 0.0 f30-0 (-> (the-as (pointer float) sv-208))))
:g (the int (* 0.0 f30-0 (-> (the-as (pointer float) sv-208))))
:b (the int (* 0.0 f30-0 (-> (the-as (pointer float) sv-208))))
:a (the int (* 128.0 f30-0))))
(set! (-> obj sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #xb :page #xc93)))
(set! (-> obj sprites 0 scale-x) f28-0)
(set! (-> obj sprites 0 scale-y) 0.7)
(let ((v1-140 (-> obj sprites 0 color2)))
(set! (-> v1-140 0) 128)
(set! (-> v1-140 1) 128)
(set! (-> v1-140 2) 128)
(set! (-> v1-140 3) (the int (* 128.0 f30-0)))
)
(set! (-> obj sprites 0 pos z) #x3fffff)
(set! (-> obj sprites 0 pos w) 0)
(set! (-> obj sprites 1 tex) (lookup-texture-by-id (new 'static 'texture-id :index #xc :page #xc93)))
(set! (-> obj sprites 1 scale-x) 0.2)
(set! (-> obj sprites 1 scale-y) 1.33)
(let ((v1-145 (-> obj sprites 1 color2)))
(set! (-> v1-145 0) 128)
(set! (-> v1-145 1) 128)
(set! (-> v1-145 2) 128)
(set! (-> v1-145 3) (the int (* 128.0 f30-0)))
)
(set! (-> obj sprites 1 pos z) #x3fffff)
(set! (-> obj sprites 1 pos w) 0)
(set! (-> obj sprites 2 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x3e :page #xc93)))
(set! (-> obj sprites 2 scale-x) 1.0)
(set! (-> obj sprites 2 scale-y) 1.0)
(let ((v1-150 (-> obj sprites 2 color2)))
(set! (-> v1-150 0) sv-80)
(set! (-> v1-150 1) sv-96)
(set! (-> v1-150 2) sv-112)
(set! (-> v1-150 3) (the int (* 128.0 f30-0)))
)
(set! (-> obj sprites 2 pos z) #xffffff)
(set! (-> obj sprites 2 pos w) 0)
(set! (-> obj sprites 3 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x3f :page #xc93)))
(set! (-> obj sprites 3 scale-x) 1.0)
(set! (-> obj sprites 3 scale-y) 1.0)
(let ((v1-155 (-> obj sprites 3 color2)))
(set! (-> v1-155 0) sv-80)
(set! (-> v1-155 1) sv-96)
(set! (-> v1-155 2) sv-112)
(set! (-> v1-155 3) (the int (* 128.0 f30-0)))
)
(set! (-> obj sprites 3 pos z) #xffffff)
(set! (-> obj sprites 3 pos w) 0)
(set-hud-piece-position! (-> obj sprites 0) s1-0 s2-0)
(set-hud-piece-position!
(-> obj sprites 1)
(+ s1-0 (the int (* bar-width (-> (the-as (pointer float) sv-208)))))
(+ s2-0 -4)
)
(set-hud-piece-position! (-> obj sprites 2) (- s1-0 sv-64) (+ s2-0 -4))
(set-hud-piece-position! (-> obj sprites 3) (+ sv-64 icon-right-offset s1-0) (+ s2-0 -4))
(with-dma-buffer-add-bucket ((sv-256 (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress))
(draw (-> obj sprites 0) sv-256 (-> *level* default-level))
(draw-sprite2d-xy
sv-256
(+ s1-0 s0-0 (the int (* bar-width (-> (the-as (pointer float) sv-208)))))
(+ s2-0 7)
(- bar-width-max (the int (* bar-width (-> (the-as (pointer float) sv-208)))))
9
sv-240
)
(draw (-> obj sprites 1) sv-256 (-> *level* default-level))
(draw (-> obj sprites 2) sv-256 (-> *level* default-level))
(draw (-> obj sprites 3) sv-256 (-> *level* default-level))
)
(+! (-> s5-0 origin x) (the float s3-0))
(set-flags! s5-0 (font-flags kerning right large))
(print-game-text (string-format "~D%" (the int (* 100.0 (-> (the-as (pointer float) sv-208))))) s5-0 #f 44 (bucket-id progress))
(set-flags! s5-0 (font-flags kerning large))
)
)
(if (zero? gp-0)
(draw-sound-options-decoration obj s5-0 f30-0 (text-id progress-root-sound-options) #f)
)
)
)
)
)
)
0
(none)
)
;; TODO - some naming is bad here in a few spots, cleanup once i understand it more
(defmethod draw-option ((obj menu-missions-option) (progress progress) (font-ctx font-context) (arg3 int) (arg4 symbol))
(local-vars
(f0-50 float)
(font-alpha float)
(task-info-idx int)
(game-task-idx int)
(sv-32 int)
(sv-40 int)
(num-task-info int)
(default-y-origin-4x3 int)
(sv-256 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! 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! 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))
(set! (-> *progress-state* first-closed-line-index) -1)
(set! (-> *progress-state* extra-text-state) -1)
(set! (-> *progress-state* num-open-tasks-found) 0)
(set! (-> *progress-state* num-closed-tasks-found) 0)
(if (< font-alpha 0.0)
(set! font-alpha (the-as float 0.0))
)
(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 (!= 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! (-> game-task-info-array task-info-idx) task-info)
(set! task-info-idx (+ task-info-idx 1))
)
)
(set! game-task-idx (+ game-task-idx 1))
)
(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
(*! (-> font-ctx width) (-> *pc-settings* aspect-ratio-reciprocal))
(set! (-> font-ctx origin x) (the float (adjust-game-x (-> font-ctx origin x))))
)
(let ((page-idx (-> obj page-index)))
(cond
((zero? page-idx)
(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)
)
(('aspect4x3)
(set! (-> font-ctx origin y) (the float default-y-origin-4x3))
)
)
(let ((font-ctx-4 font-ctx))
(set! (-> font-ctx-4 scale) font-scale)
)
(when (zero? (-> obj page-index))
(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! (-> 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 (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)
)
)
(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" line-text)
(set! (-> *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! default-y-origin-4x3 (- default-y-origin-4x3 (the int (-> *progress-state* missions-total-spacing))))
(cond
((< (-> 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 ((line-padding-2 3.0)
(print-game-text-fn-2 print-game-text)
)
(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 (+ 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)
(-> s4-4 description)
)
)
(s4-5 (lookup-text! *common-text* a1-27 #f))
)
0.0
(let ((f30-2 3.0)
(s3-4 print-game-text)
)
(format (clear *temp-string*) "~S" s4-5)
(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! (-> 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)
(-> s4-6 description)
)
)
(s5-1 (lookup-text! *common-text* s3-5 #f))
)
0.0
(set! f0-50
(cond
((>= 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!
*common-text*
(if (logtest? (-> s4-6 flags) (game-task-node-flag closed))
(text-id progress-missions-icon-completed)
(text-id progress-missions-icon-todo)
)
#f
)
)
(s3-6 *temp-string* font-ctx #f 44 (bucket-id progress))
)
)
(if (-> *pc-settings* use-vis?)
(+! (-> 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* font-ctx #f 44 (bucket-id progress))))
)
(if (-> *pc-settings* use-vis?)
(+! (-> font-ctx origin x) -20.0)
(+! (-> font-ctx origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) -20.0)))
f0-50
)
(else
(let ((f30-4 3.0)
(s4-8 print-game-text)
)
(format (clear *temp-string*) "~S" s5-1)
(+ f30-4 (s4-8 *temp-string* font-ctx #t 44 (bucket-id progress)))
)
)
)
)
)
(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! 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)
font-ctx
#f
44
(bucket-id progress)
)
)
)
(end-scissor-missions hud-bounds 1.0)
(draw-missions-up-down font-ctx)
0
(none)
)
(defun draw-secret-list ((arg0 secret-item-option) (arg1 progress) (arg2 font-context) (arg3 int) (arg4 symbol) (arg5 float))
(let ((s4-0 (and arg4 (= arg3 1))))
380.0
270.0
(set! (-> arg2 origin x) 100.0)
(if (not (-> *pc-settings* use-vis?))
(set! (-> arg2 origin x) (the float (adjust-game-x (-> arg2 origin x)))))
(cond
((= s4-0 #t)
(cond
((= (-> arg0 can-toggle) 'auto)
)
((not (-> arg0 can-toggle))
(case (get-aspect-ratio)
(('aspect4x3)
(if (not (-> *pc-settings* use-vis?))
(+! (-> arg2 origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) -25.0))
(+! (-> arg2 origin x) -25.0))
)
(('aspect16x9)
(+! (-> arg2 origin x) -10.0)
)
)
(when (text-language? german)
(set-scale! arg2 0.43)
)
(print-game-text
(lookup-text! *common-text* (text-id progress-secrets-go-to-title-screen) #f)
arg2
#f
44
(bucket-id progress)
)
)
((and (= (-> arg0 can-toggle) #t) (logtest? (-> *game-info* secrets) (-> arg0 flag)))
(set! (-> arg1 selected-option) #f)
(logclear! (-> *game-info* secrets) (-> arg0 flag))
)
((and (= (-> arg0 can-toggle) #t) (not (logtest? (-> *game-info* secrets) (-> arg0 flag))))
(logior! (-> *game-info* secrets) (-> arg0 flag))
(set! (-> arg1 selected-option) #f)
)
)
)
(else
(set-color! arg2 (if (= arg3 1)
(progress-selected 0)
(font-color progress)))
(set! (-> arg2 origin x) (the float (if (= (get-aspect-ratio) 'aspect4x3)
75
90
)
)
)
(if (not (-> *pc-settings* use-vis?))
(set! (-> arg2 origin x) (the float (adjust-game-x (-> arg2 origin x)))))
(cond
((logtest? (-> *game-info* sub-task-list (-> arg0 avail-after) flags) (game-task-node-flag closed))
(print-game-text (string-format "~S" (lookup-text! *common-text* (-> arg0 name) #f)) arg2 #f 44 (bucket-id progress))
)
(else
(print-game-text (string-format "????????") arg2 #f 44 (bucket-id progress))
)
)
(set! (-> arg2 origin x) 360.0)
(if (not (-> *pc-settings* use-vis?))
(set! (-> arg2 origin x) (the float (adjust-game-x (-> arg2 origin x)))))
(set-color! arg2 (font-color progress))
)
)
(cond
((and (not s4-0) (not (logtest? (-> *game-info* purchase-secrets) (-> arg0 flag))))
(if (not (-> *pc-settings* use-vis?))
(+! (-> arg2 origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) 50))
(+! (-> arg2 origin x) (the float (if (= (get-aspect-ratio) 'aspect4x3)
50
45
))))
(print-game-text (string-format "~D" (-> arg0 cost)) arg2 #f 44 (bucket-id progress))
)
((and (not s4-0) (= (-> arg0 can-toggle) #t) (logtest? (-> *game-info* secrets) (-> arg0 flag)))
(if (not (-> *pc-settings* use-vis?))
(+! (-> arg2 origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) 50))
(+! (-> arg2 origin x) (the float (if (= (get-aspect-ratio) 'aspect4x3)
50
45
))))
(print-game-text (string-format "~S" (lookup-text! *common-text* (text-id progress-on) #f)) arg2 #f 44 (bucket-id progress))
)
((and (not s4-0) (= (-> arg0 can-toggle) #t) (not (logtest? (-> *game-info* secrets) (-> arg0 flag))))
(if (not (-> *pc-settings* use-vis?))
(+! (-> arg2 origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) 50))
(+! (-> arg2 origin x) (the float (if (= (get-aspect-ratio) 'aspect4x3)
50
45
))))
(print-game-text (string-format "~S" (lookup-text! *common-text* (text-id progress-off) #f)) arg2 #f 44 (bucket-id progress))
)
((and (not s4-0) (!= (-> arg0 can-toggle) #t))
(if (not (-> *pc-settings* use-vis?))
(+! (-> arg2 origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) 80))
(+! (-> arg2 origin x) (the float (if (= (get-aspect-ratio) 'aspect4x3)
80
70
))))
(set-flags! arg2 (font-flags kerning right large))
(print-game-text (string-format "~S" (lookup-text! *common-text* (text-id progress-secrets-unlocked) #f)) arg2 #f 44 (bucket-id progress))
(set-flags! arg2 (font-flags kerning large))
)
)
)
(none)
)
(defun draw-cheat-list ((info pc-cheat-info) (progress progress) (font font-context) (draw-selected int) (selected? symbol) (sliding-y float))
(let ((selected-page? (and selected? (= draw-selected 1)))
(revealed? (logtest? (-> *pc-settings* cheats-revealed) (-> info flag)))
(purchased? (logtest? (-> *pc-settings* cheats-purchased) (-> info flag)))
(unlocked? (logtest? (-> *pc-settings* cheats-unlocked) (-> info flag)))
)
380.0
270.0
(set! (-> font origin x) 100.0)
(if (not (-> *pc-settings* use-vis?))
(set! (-> font origin x) (the float (adjust-game-x (-> font origin x)))))
(cond
((= selected-page? #t)
(set! (-> font origin y) 180.0)
(set-height! font 116)
(set-flags! font (font-flags kerning large middle middle-vert))
(case (get-aspect-ratio)
(('aspect4x3)
(if (not (-> *pc-settings* use-vis?))
(+! (-> font origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) -25.0))
(+! (-> font origin x) -25.0))
)
(('aspect16x9)
(+! (-> font origin x) -10.0)
)
)
(cond
((and purchased? (not unlocked?))
(let ((unlock-text (lookup-text! *common-text* (-> info unlock) #f)))
(print-game-text
(case (-> info unlock)
(((text-id progress-cheats-turbo-board-unlock))
(string-format unlock-text (lookup-text! *common-text* (text-id progress-missions-sewer-board) #f) (-> *pc-cheat-state* sewer-valve-target-seconds)))
(((text-id progress-cheats-health-bars-unlock))
(string-format unlock-text (-> *pc-cheat-state* kill-civvie-target)))
(((text-id progress-cheats-vehicle-health-bars-unlock))
(string-format unlock-text (-> *pc-cheat-state* kill-car-target)))
(else
unlock-text)
)
font #f 44 (bucket-id progress)))
)
((= (-> info can-toggle) 'auto)
)
(unlocked?
(print-game-text (lookup-text! *common-text* (text-id progress-secrets-go-to-title-screen) #f) font #f 44 (bucket-id progress))
)
)
(set-flags! font (font-flags kerning large))
)
(else
(set-color! font (if (= draw-selected 1)
(progress-selected 0)
(font-color progress)))
(set! (-> font origin x) (the float (if (= (get-aspect-ratio) 'aspect4x3)
75
90
)
)
)
(if (not (-> *pc-settings* use-vis?))
(set! (-> font origin x) (the float (adjust-game-x (-> font origin x)))))
(cond
(revealed?
(print-game-text (string-format "~S" (lookup-text! *common-text* (-> info name) #f)) font #f 44 (bucket-id progress))
)
(else
(print-game-text (string-format "????????") font #f 44 (bucket-id progress))
)
)
(set! (-> font origin x) 360.0)
(if (not (-> *pc-settings* use-vis?))
(set! (-> font origin x) (the float (adjust-game-x (-> font origin x)))))
(set-color! font (font-color progress))
)
)
(when (not selected-page?)
(cond
((and (= (-> info skill) 0) (not revealed?))
;; no cost, not discovered yet
;; draw nothing!
)
((or (not revealed?) (not purchased?))
;; has cost, but not discovered yet OR discovered, but needs more skill
;; show cost.
(if (not (-> *pc-settings* use-vis?))
(+! (-> font origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) 50))
(+! (-> font origin x) (the float (if (= (get-aspect-ratio) 'aspect4x3)
50
45
))))
(print-game-text (string-format "~D" (-> info skill)) font #f 44 (bucket-id progress))
)
((not unlocked?)
;; revealed and can afford, but not unlocked
(if (not (-> *pc-settings* use-vis?))
(+! (-> font origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) 80))
(+! (-> font origin x) (the float (if (= (get-aspect-ratio) 'aspect4x3)
80
70
))))
(set-flags! font (font-flags kerning right large))
(print-game-text (lookup-text! *common-text* (text-id progress-cheats-locked) #f) font #f 44 (bucket-id progress))
(set-flags! font (font-flags kerning large))
)
;; --- from here on, the cheat is fully unlocked! ---
((= (-> info can-toggle) #t)
;; simple on-off switch
(if (not (-> *pc-settings* use-vis?))
(+! (-> font origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) 50))
(+! (-> font origin x) (the float (if (= (get-aspect-ratio) 'aspect4x3)
50
45
))))
(print-game-text (string-format "~S" (lookup-text! *common-text* (if (logtest? (-> *pc-settings* cheats) (-> info flag)) (text-id progress-on) (text-id progress-off)) #f)) font #f 44 (bucket-id progress))
)
(else
;; automatically unlocked cheat, e.g. extra menu
(if (not (-> *pc-settings* use-vis?))
(+! (-> font origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) 80))
(+! (-> font origin x) (the float (if (= (get-aspect-ratio) 'aspect4x3)
80
70
))))
(set-flags! font (font-flags kerning right large))
(print-game-text (string-format "~S" (lookup-text! *common-text* (text-id progress-secrets-unlocked) #f)) font #f 44 (bucket-id progress))
(set-flags! font (font-flags kerning large))
)
)
)
)
0)
(defmethod draw-option ((this menu-secret-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
(let* (
(sv-16 (* 2.0 (- 0.5 (-> arg0 menu-transition))))
(hero? (logtest? (-> *game-info* secrets) (game-secrets hero-mode)))
(sv-24 (the int (-> *game-info* skill-total)))
(sv-32 395.0)
(sv-36 25.0)
(min-item (if (not hero?)
0
(-> this num-items)
)
)
(max-item (if (not hero?)
(-> this num-items)
(+ (-> this num-items) (-> this num-hero-items))
)
)
(sliding-y (* (-> arg0 sliding) sv-36))
(item (-> this item-index))
(prev (-> this prev-item-index))
(num-pc-items (-> *pc-cheats-list* length))
(sv-120 (new 'stack-no-clear 'hud-box))
(item-y 205)
(cheats-pad 1.3))
(if (< sv-16 0.0)
(set! sv-16 (the-as float 0.0))
)
(cond
((or (not (-> *bigmap* progress-minimap)) (< (-> this item-index) min-item) (< (+ max-item num-pc-items) (-> this item-index)))
(draw-busy-loading arg1)
)
(else
(if (not (-> *pc-settings* use-vis?))
(*! sv-32 (-> *pc-settings* aspect-ratio-reciprocal)))
(set! (-> this sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x5 :page #xc93)))
(set! (-> this sprites 0 flags) (the-as uint 4))
(set! (-> this sprites 0 scale-x) 0.64)
(set! (-> this sprites 0 scale-y) 0.64)
(let ((v1-32 (-> this sprites 0 color2)))
(set! (-> v1-32 0) 128)
(set! (-> v1-32 1) 128)
(set! (-> v1-32 2) 128)
(set! (-> v1-32 3) (the int (* 128.0 sv-16)))
)
(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))
(with-dma-buffer-add-bucket ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress)
)
(draw (-> this sprites 0) s3-0 (-> *level* default-level))
)
(set! (-> arg1 alpha) sv-16)
(set-flags! arg1 (font-flags kerning middle large))
(set-color! arg1 (font-color progress))
(set! (-> arg1 origin x) 59.0)
(set! (-> arg1 width) sv-32)
(set! (-> arg1 height) sv-36)
(set-scale! arg1 1.0)
(set! (-> arg1 origin y) 82.0)
(if (not (-> *pc-settings* use-vis?))
(set! (-> arg1 origin x) (the float (adjust-game-x (-> arg1 origin x)))))
(draw-decoration-secrets this arg1 sv-16 (text-id progress-root-secrets))
(set-scale! arg1 0.45)
(when (text-language? japanese korean) ;; og:preserve-this text-language patch
(set-scale! arg1 0.53)
)
(case (get-aspect-ratio)
(('aspect4x3)
(set-height! arg1 185)
(set! (-> arg1 origin y) 133.0)
)
(('aspect16x9)
(set-height! arg1 185)
(set! (-> arg1 origin y) 133.0)
)
)
(set-flags! arg1 (font-flags kerning large))
(set! (-> arg1 origin x) 100.0)
(if (not (-> *pc-settings* use-vis?))
(set! (-> arg1 origin x) (the float (adjust-game-x (-> arg1 origin x)))))
(print-game-text (string-format "x~D ~S" sv-24 (lookup-text! *common-text* (text-id progress-secrets-orb-label) #f)) arg1 #f 44 (bucket-id progress))
(set! (-> arg1 origin x) 100.0)
(if (not (-> *pc-settings* use-vis?))
(set! (-> arg1 origin x) (the float (adjust-game-x (-> arg1 origin x)))))
(set! (-> arg1 width) (if (= (get-aspect-ratio) 'aspect16x9) 332.0 366.0))
(if (not (-> *pc-settings* use-vis?))
(*! (-> arg1 width) (-> *pc-settings* aspect-ratio-reciprocal)))
(begin-scissor-secret sv-120 arg0)
(case (get-aspect-ratio)
(('aspect16x9)
(set! item-y 195)
)
)
(cond
(arg3
(set! (-> arg1 origin y) (the float (+ (the int sliding-y) 25 item-y)))
(if (< item max-item)
(draw-secret-list (-> this secret-items item) arg0 arg1 1 arg3 sliding-y)
(draw-cheat-list (-> *pc-cheats-list* (- item max-item)) arg0 arg1 1 arg3 sliding-y))
)
((>= (- item prev) 0)
(draw-highlight (+ item-y 22) 22 sv-16)
(dotimes (i 7)
(let* ((this-item (+ item -3 i)))
(when (and (>= this-item min-item) (< this-item (+ max-item num-pc-items)))
(set! (-> arg1 origin y) (the float (+ (the int sliding-y) (+ -50 (* i 25)) item-y)))
(cond
((and (< this-item max-item) (= item max-item))
;; slide more when transitioning between secrets and cheats
(-! (-> arg1 origin y) (* (- 1.0 (-> arg0 sliding)) sv-36 cheats-pad))
)
((and (< this-item max-item) (> item max-item))
;; otherwise just offset, if we're in the cheats page.
(-! (-> arg1 origin y) (* cheats-pad 25))
)
((and (>= this-item max-item) (= item max-item))
;; slide more when transitioning
(+! (-> arg1 origin y) (* (-> arg0 sliding) sv-36 cheats-pad))
)
((and (>= this-item max-item) (< item max-item))
;; for the cheats - offset when not in them
(+! (-> arg1 origin y) (* cheats-pad 25))
)
)
(when (= this-item max-item)
;; also draw section header
(protect ((-> arg1 origin x) (-> arg1 origin y))
(if (not (-> *pc-settings* use-vis?))
(set! (-> arg1 origin x) (the float (adjust-game-x 100.0)))
(set! (-> arg1 origin x) (if (= (get-aspect-ratio) 'aspect4x3) 100.0 115.0)))
(-! (-> arg1 origin y) (+ (* (/ (- cheats-pad 1.0) 2) 25) 25))
(print-game-text (string-format "~S" (lookup-text! *common-text* (text-id progress-cheats) #f)) arg1 #f 44 (bucket-id progress))
)
)
(if (< this-item max-item)
(draw-secret-list (-> this secret-items this-item) arg0 arg1 0 arg3 sliding-y)
(draw-cheat-list (-> *pc-cheats-list* (- this-item max-item)) arg0 arg1 0 arg3 sliding-y)))
))
)
(else
(draw-highlight (+ item-y 22) 22 sv-16)
(dotimes (i 7)
(let* ((this-item (+ item -2 i)))
(when (and (>= this-item min-item) (< this-item (+ max-item num-pc-items)))
(set! (-> arg1 origin y) (the float (+ (the int sliding-y) (+ -25 (* i 25)) item-y)))
(cond
((and (< this-item max-item) (= item (1- max-item)))
;; slide more when transitioning between secrets and cheats
(-! (-> arg1 origin y) (* (- (-> arg0 sliding)) sv-36 cheats-pad))
)
((and (< this-item max-item) (>= item max-item))
;; otherwise just offset, if we're in the cheats page.
(-! (-> arg1 origin y) (* cheats-pad 25))
)
((and (>= this-item max-item) (= item (1- max-item)))
;; slide more when transitioning
(+! (-> arg1 origin y) (* (- 1.0 (- (-> arg0 sliding))) sv-36 cheats-pad))
)
((and (>= this-item max-item) (< item max-item))
;; for the cheats - offset when not in them
(+! (-> arg1 origin y) (* cheats-pad 25))
)
)
(when (= this-item max-item)
;; also draw section header
(protect ((-> arg1 origin x) (-> arg1 origin y))
(if (not (-> *pc-settings* use-vis?))
(set! (-> arg1 origin x) (the float (adjust-game-x 100.0)))
(set! (-> arg1 origin x) (if (= (get-aspect-ratio) 'aspect4x3) 100.0 115.0)))
(-! (-> arg1 origin y) (+ (* (/ (- cheats-pad 1.0) 2) 25) 25))
(print-game-text (string-format "~S" (lookup-text! *common-text* (text-id progress-cheats) #f)) arg1 #f 44 (bucket-id progress))
)
)
(if (< this-item max-item)
(draw-secret-list (-> this secret-items this-item) arg0 arg1 0 arg3 sliding-y)
(draw-cheat-list (-> *pc-cheats-list* (- this-item max-item)) arg0 arg1 0 arg3 sliding-y)))
))
)
)
(end-scissor-secret sv-120 1.0)
(draw-up-down arg1)
)
)
0
(none)
))
(defmethod draw-option ((this menu-unlocked-menu-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
(let ((secrets (memcard-unlocked-secrets? #t))
(cheats (-> *pc-settings* cheats))
(alpha (* 2.0 (- 0.5 (-> arg0 menu-transition))))
)
(if (< alpha 0.0)
(set! alpha 0.0)
)
(set-scale! arg1 0.6)
(set-alpha! arg1 alpha)
(when (nonzero? (-> this name))
(cond
((= arg2 (-> arg0 option-index))
(progress-selected 0)
(draw-highlight (the int (+ 8.0 (-> arg1 origin y))) 24 alpha)
)
(else
(font-color progress)
)
)
(+! (-> arg1 origin y) 8.0)
(let ((available-text (lookup-text! *common-text* (-> this name) #f))
(locked-text (string-format "?????????")))
(case (-> this name)
(((text-id progress-main-secrets-scrapbook))
(if (logtest? secrets (game-secrets scrap-book-1))
(print-game-text available-text arg1 #f 44 (bucket-id progress))
(print-game-text locked-text arg1 #f 44 (bucket-id progress)))
)
(((text-id progress-main-secrets-mega-scrapbook))
(if (logtest? secrets (game-secrets scrap-book-2))
(print-game-text available-text arg1 #f 44 (bucket-id progress))
(print-game-text locked-text arg1 #f 44 (bucket-id progress)))
)
(((text-id progress-main-secrets-scrapbook-3))
(if (logtest? secrets (game-secrets scrap-book-3))
(print-game-text available-text arg1 #f 44 (bucket-id progress))
(print-game-text locked-text arg1 #f 44 (bucket-id progress)))
)
(((text-id progress-main-secrets-sceneplayer-1))
(if (logtest? secrets (game-secrets scene-player-1))
(print-game-text available-text arg1 #f 44 (bucket-id progress))
(print-game-text locked-text arg1 #f 44 (bucket-id progress)))
)
(((text-id progress-main-secrets-sceneplayer-2))
(if (logtest? secrets (game-secrets scene-player-2))
(print-game-text available-text arg1 #f 44 (bucket-id progress))
(print-game-text locked-text arg1 #f 44 (bucket-id progress)))
)
(((text-id progress-main-secrets-sceneplayer-3))
(if (logtest? secrets (game-secrets scene-player-3))
(print-game-text available-text arg1 #f 44 (bucket-id progress))
(print-game-text locked-text arg1 #f 44 (bucket-id progress)))
)
(((text-id progress-main-secrets-hero-mode))
(if (logtest? secrets (game-secrets hero-mode))
(print-game-text available-text arg1 #f 44 (bucket-id progress))
(print-game-text locked-text arg1 #f 44 (bucket-id progress)))
)
(((text-id progress-main-secrets-levelselect))
(if (logtest? secrets (game-secrets level-select))
(print-game-text available-text arg1 #f 44 (bucket-id progress))
(print-game-text locked-text arg1 #f 44 (bucket-id progress)))
)
(((text-id progress-music-player))
(if (pc-cheats? cheats music-player)
(print-game-text available-text arg1 #f 44 (bucket-id progress))
(print-game-text locked-text arg1 #f 44 (bucket-id progress)))
)
))
)
)
0
(none)
)
(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)
(sv-20 int)
(sv-24 float)
(sv-28 float)
(sv-32 float)
(sv-36 float)
(sv-40 int)
(sv-48 int)
(sv-56 int)
(sv-64 int)
(sv-72 int)
(sv-80 int)
(sv-88 int)
(sv-96 string)
(sv-112 int)
)
(set! sv-16 (* 2.0 (- 0.5 (-> arg0 menu-transition))))
(set! sv-20 (-> arg0 option-index))
(set! sv-24 (-> arg1 origin x))
(set! sv-28 (-> arg1 origin y))
(set! sv-32 (-> arg1 width))
(set! sv-36 (-> arg1 height))
(set! sv-40 (if (= (get-aspect-ratio) 'aspect4x3)
300
305
)
)
(set! sv-48 (if (= (get-aspect-ratio) 'aspect4x3)
140
140
)
)
(set! sv-56 (if (= (get-aspect-ratio) 'aspect4x3)
64
48
)
)
(set! sv-64 69)
(set! sv-72 110)
(set! sv-80 176)
(set! sv-88 54)
(if (< sv-16 0.0)
(set! sv-16 (the-as float 0.0))
)
(set! (-> arg1 alpha) sv-16)
(cond
((not (-> *bigmap* progress-minimap))
(draw-busy-loading arg1)
(return 0)
)
(else
(when (not (-> *pc-settings* use-vis?))
(set! sv-40 (the int (adjust-game-x (the float sv-40))))
(set! sv-56 (the int (* (-> *pc-settings* aspect-ratio-reciprocal) sv-56)))
)
(let ((s2-3 arg1))
(set! (-> s2-3 color) (if (= arg2 sv-20)
(the-as font-color (the-as int (progress-selected 0)))
(font-color progress)
)
)
)
(cond
((= *save-options-title* (-> arg0 current-options))
(set! (-> arg1 origin y) 80.0)
(set! (-> arg1 height) 52.0)
(+! (-> arg1 origin y) (the float (* 42 (+ arg2 1))))
(if (not (-> *pc-settings* use-vis?))
(+! (-> arg1 origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) -100.0))
(+! (-> arg1 origin x) -100.0))
)
(else
(case (get-aspect-ratio)
(('aspect16x9)
(set! (-> arg1 origin y) 74.0)
(set! (-> arg1 height) 42.0)
(+! (-> arg1 origin y) (the float (* 60 (+ arg2 1))))
(if (not (-> *pc-settings* use-vis?))
(+! (-> arg1 origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) -90.0))
(+! (-> arg1 origin x) -90.0))
)
(('aspect4x3)
(set! (-> arg1 origin y) 74.0)
(set! (-> arg1 height) 42.0)
(+! (-> arg1 origin y) (the float (* 54 (+ arg2 1))))
(if (not (-> *pc-settings* use-vis?))
(+! (-> arg1 origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) -90.0))
(+! (-> arg1 origin x) -90.0))
)
)
)
)
(set-vector! (-> obj box 0 color) 64 128 128 (the int (* 128.0 sv-16)))
(when (= arg2 sv-20)
(cond
((!= *save-options-title* (-> arg0 current-options))
(case (get-aspect-ratio)
(('aspect16x9)
(set! sv-64 79)
(set! sv-72 110)
(set! sv-80 166)
(set! sv-88 62)
)
)
(when (not (-> *pc-settings* use-vis?))
(set! sv-64 (the int (adjust-game-x (the float sv-64))))
(set! sv-80 (the int (* (-> *pc-settings* aspect-ratio-reciprocal) sv-80)))
)
(draw-savegame-box
obj
(the float sv-64)
(the float (+ sv-64 sv-80))
(the float (+ sv-72 (* sv-88 arg2)))
(the float (+ sv-72 (* sv-88 arg2)))
)
(when (!= arg2 3)
(draw-savegame-box
obj
(the float sv-64)
(the float (+ sv-64 sv-80))
(the float (+ sv-72 sv-88 (* sv-88 arg2)))
(the float (+ sv-72 sv-88 (* sv-88 arg2)))
)
(draw-savegame-box
obj
(the float (+ sv-64 sv-80))
(the float (+ sv-64 sv-80))
(the float (+ sv-72 sv-88 (* sv-88 arg2)))
(the float (+ (* sv-88 4) 2 sv-72))
)
)
(draw-savegame-box
obj
(the float (+ sv-64 sv-80))
(the float (+ sv-64 sv-80))
(the float sv-72)
(the float (+ sv-72 (* sv-88 arg2)))
)
(with-dma-buffer-add-bucket ((s1-0 (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id particles)
)
(draw-sprite2d-xy
s1-0
sv-64
(+ sv-72 (* sv-88 arg2))
sv-80
sv-88
(new 'static 'rgba :r #x40 :g #x40 :b #x40 :a (the int (* 64.0 sv-16)))
)
)
)
((= *save-options-title* (-> arg0 current-options))
(set! sv-88 42)
(let ((v0-13 (get-aspect-ratio)))
(when (= v0-13 'aspect16x9)
(set! sv-64 79)
(set! sv-72 110)
(set! sv-80 166)
(set! sv-88 42)
(draw-savegame-box
obj
(the float (+ sv-64 sv-80))
(the float (+ sv-64 sv-80))
(the float (+ sv-72 sv-88 (* sv-88 arg2)))
(the float (+ sv-72 (* 6 sv-88)))
)
)
)
(when (not (-> *pc-settings* use-vis?))
(set! sv-64 (the int (adjust-game-x (the float sv-64))))
(set! sv-80 (the int (* (-> *pc-settings* aspect-ratio-reciprocal) sv-80)))
)
(draw-savegame-box
obj
(the float sv-64)
(the float (+ sv-64 sv-80))
(the float (+ sv-72 (* sv-88 arg2)))
(the float (+ sv-72 (* sv-88 arg2)))
)
(when (!= arg2 4)
(draw-savegame-box
obj
(the float sv-64)
(the float (+ sv-64 sv-80))
(the float (+ sv-72 sv-88 (* sv-88 arg2)))
(the float (+ sv-72 sv-88 (* sv-88 arg2)))
)
(draw-savegame-box
obj
(the float (+ sv-64 sv-80))
(the float (+ sv-64 sv-80))
(the float (+ sv-72 sv-88 (* sv-88 arg2)))
(the float (+ (* 5 sv-88) 2 sv-72))
)
)
(draw-savegame-box
obj
(the float (+ sv-64 sv-80))
(the float (+ sv-64 sv-80))
(the float sv-72)
(the float (+ sv-72 (* sv-88 arg2)))
)
(with-dma-buffer-add-bucket ((s1-1 (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id particles)
)
(draw-sprite2d-xy
s1-1
sv-64
(+ sv-72 (* sv-88 arg2))
sv-80
sv-88
(new 'static 'rgba :r #x40 :g #x40 :b #x40 :a (the int (* 64.0 sv-16)))
)
)
)
)
)
(cond
((and *progress-save-info*
(= (-> *progress-save-info* formatted) 1)
(= (-> *progress-save-info* inited) 1)
(= (-> *progress-save-info* file arg2 present) 1)
)
(cond
((= arg2 sv-20)
(set-scale! arg1 0.8)
)
(else
(set-scale! arg1 0.6)
)
)
(set-flags! arg1 (font-flags kerning large))
(if (not (-> *pc-settings* use-vis?))
(+! (-> arg1 origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) 100))
(+! (-> arg1 origin x) (the float (if (= (get-aspect-ratio) 'aspect4x3)
100
105
))))
(print-game-text (string-format "~S ~D" (lookup-text! *common-text* (text-id progress-unknown-game) #f) (+ arg2 1))
arg1 #f 44 (bucket-id progress))
(set-color! arg1 (font-color progress))
(set! (-> arg1 origin x) 250.0)
(set! (-> arg1 origin y) 110.0)
(set! (-> arg1 width) 170.0)
(set! (-> arg1 height) 190.0)
(when (not (-> *pc-settings* use-vis?))
(*! (-> arg1 width) (-> *pc-settings* aspect-ratio-reciprocal))
(set! (-> arg1 origin x) (the float (adjust-game-x (-> arg1 origin x)))))
(let ((s2-8 (-> *progress-save-info* file arg2 level-index)))
(when (= arg2 sv-20)
(let ((v1-199 (-> obj sprites 0 color2)))
(set! (-> v1-199 0) 128)
(set! (-> v1-199 1) 128)
(set! (-> v1-199 2) 128)
(set! (-> v1-199 3) (the int (* 128.0 sv-16)))
)
(let ((v1-200 (-> obj sprites 1 color2)))
(set! (-> v1-200 0) 128)
(set! (-> v1-200 1) 128)
(set! (-> v1-200 2) 128)
(set! (-> v1-200 3) (the int (* 128.0 sv-16)))
)
(set! (-> obj sprites 1 pos z) #xffffff)
(set! (-> obj sprites 1 pos w) 1)
(set! (-> obj sprites 1 tex) (lookup-texture-by-id (get-level-icon-id-01 s2-8)))
(set! (-> obj sprites 1 scale-x) 1.0)
(set! (-> obj sprites 1 scale-y) 1.0)
(set-hud-piece-position! (-> obj sprites 1) sv-40 sv-48)
(let ((v1-205 (-> obj sprites 2 color2)))
(set! (-> v1-205 0) 128)
(set! (-> v1-205 1) 128)
(set! (-> v1-205 2) 128)
(set! (-> v1-205 3) (the int (* 128.0 sv-16)))
)
(set! (-> obj sprites 2 pos z) #xffffff)
(set! (-> obj sprites 2 pos w) 1)
(set! (-> obj sprites 2 tex) (lookup-texture-by-id (get-level-icon-id-02 s2-8)))
(set! (-> obj sprites 2 scale-x) 1.0)
(set! (-> obj sprites 2 scale-y) 1.0)
(set-hud-piece-position! (-> obj sprites 2) (+ sv-40 sv-56) sv-48)
(let ((v1-211 (-> obj sprites 3 color2)))
(set! (-> v1-211 0) 128)
(set! (-> v1-211 1) 128)
(set! (-> v1-211 2) 128)
(set! (-> v1-211 3) (the int (* 128.0 sv-16)))
)
(set! (-> obj sprites 3 pos z) #xffffff)
(set! (-> obj sprites 3 pos w) 1)
(set! (-> obj sprites 3 tex) (lookup-texture-by-id (get-level-icon-id-03 s2-8)))
(set! (-> obj sprites 3 scale-x) 1.0)
(set! (-> obj sprites 3 scale-y) 1.0)
(set-hud-piece-position! (-> obj sprites 3) sv-40 (+ sv-48 64))
(let ((v1-217 (-> obj sprites 4 color2)))
(set! (-> v1-217 0) 128)
(set! (-> v1-217 1) 128)
(set! (-> v1-217 2) 128)
(set! (-> v1-217 3) (the int (* 128.0 sv-16)))
)
(set! (-> obj sprites 4 pos z) #xffffff)
(set! (-> obj sprites 4 pos w) 1)
(set! (-> obj sprites 4 tex) (lookup-texture-by-id (get-level-icon-id-04 s2-8)))
(set! (-> obj sprites 4 scale-x) 1.0)
(set! (-> obj sprites 4 scale-y) 1.0)
(set-hud-piece-position! (-> obj sprites 4) (+ sv-40 sv-56) (+ sv-48 64))
(with-dma-buffer-add-bucket ((s1-7 (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress)
)
(draw (-> obj sprites 1) s1-7 (-> *level* default-level))
(draw (-> obj sprites 2) s1-7 (-> *level* default-level))
(draw (-> obj sprites 3) s1-7 (-> *level* default-level))
(draw (-> obj sprites 4) s1-7 (-> *level* default-level))
)
(set-scale! arg1 0.6)
(set! (-> arg1 origin x) 265.0)
(set! (-> arg1 origin y) 263.0)
(set! (-> arg1 width) 170.0)
(set! (-> arg1 height) 52.0)
(when (not (-> *pc-settings* use-vis?))
(*! (-> arg1 width) (-> *pc-settings* aspect-ratio-reciprocal))
(set! (-> arg1 origin x) (the float (adjust-game-x (-> arg1 origin x)))))
(set! (-> obj sprites 0 scale-x) 0.7)
(set! (-> obj sprites 0 scale-y) 0.7)
(set! (-> obj sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x4 :page #xc93)))
(set-hud-piece-position! (-> obj sprites 0) (adjust-x-if-needed 265) 263)
(with-dma-buffer-add-bucket ((s1-8 (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress)
)
(draw (-> obj sprites 0) s1-8 (-> *level* default-level))
)
(+! (-> arg1 origin y) 1.0)
(if (not (-> *pc-settings* use-vis?))
(+! (-> arg1 origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) 28))
(+! (-> arg1 origin x) 28.0))
(let* ((v1-272 (-> *progress-save-info* file arg2 game-time0))
(v1-273 (logior (shl (-> *progress-save-info* file arg2 game-time1) 32) v1-272))
(s2-11 (/ (the-as int v1-273) #x107ac0))
)
(set! sv-112 (/ (mod (the-as int v1-273) #x107ac0) #x4650))
(print-game-text (string-format "~2,'0D:~2,'0D" s2-11 sv-112) arg1 #f 44 (bucket-id progress))
)
(set! (-> obj sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x6 :page #xc93)))
(set-hud-piece-position! (-> obj sprites 0) (adjust-x-if-needed 368) 263)
(with-dma-buffer-add-bucket ((s1-10 (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress)
)
(draw (-> obj sprites 0) s1-10 (-> *level* default-level))
)
(if (not (-> *pc-settings* use-vis?))
(+! (-> arg1 origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) 100))
(+! (-> arg1 origin x) 100.0))
(print-game-text (string-format "~D%" (the int (-> *progress-save-info* file arg2 completion-percentage))) arg1 #f 44 (bucket-id progress))
(set! (-> obj sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x5 :page #xc93)))
(set-hud-piece-position! (-> obj sprites 0) (adjust-x-if-needed 368) 289)
(with-dma-buffer-add-bucket ((s1-12 (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress)
)
(draw (-> obj sprites 0) s1-12 (-> *level* default-level))
)
(+! (-> arg1 origin y) 28.0)
(print-game-text (string-format "~D" (the int (-> *progress-save-info* file arg2 skill-count))) arg1 #f 44 (bucket-id progress))
(set! (-> obj sprites 0 scale-x) 0.6)
(set! (-> obj sprites 0 scale-y) 0.6)
(set! (-> obj sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x82 :page #xc93)))
(set-hud-piece-position! (-> obj sprites 0) (adjust-x-if-needed 253) 290)
(with-dma-buffer-add-bucket ((s1-14 (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress)
)
(draw (-> obj sprites 0) s1-14 (-> *level* default-level))
)
(if (not (-> *pc-settings* use-vis?))
(+! (-> arg1 origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) -100))
(+! (-> arg1 origin x) -100.0))
(print-game-text (string-format "~D" (the int (-> *progress-save-info* file arg2 gem-count))) arg1 #f 44 (bucket-id progress))
)
)
)
((and *progress-save-info*
(= (-> *progress-save-info* formatted) 1)
(= (-> *progress-save-info* inited) 1)
(zero? (-> *progress-save-info* file arg2 present))
)
(cond
((= arg2 sv-20)
(set-scale! arg1 0.8)
)
(else
(set-scale! arg1 0.6)
)
)
(set-flags! arg1 (font-flags kerning large))
(if (not (-> *pc-settings* use-vis?))
(+! (-> arg1 origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) 100))
(+! (-> arg1 origin x) (the float (if (= (get-aspect-ratio) 'aspect4x3)
100
105
))))
(print-game-text
(lookup-text! *common-text* (text-id progress-slot-empty) #f)
arg1
#f
44
(bucket-id progress)
)
)
)
(set! (-> arg1 origin x) sv-24)
(set! (-> arg1 origin y) sv-28)
(set! (-> arg1 width) sv-32)
(set! (-> arg1 height) sv-36)
(if (zero? arg2)
(draw-decoration-load-save obj arg1 sv-16 (if (= (-> arg0 current) 'select-load)
(text-id progress-select-file-to-load)
(text-id progress-select-file-to-save)
)
)
)
)
)
0
(none)
)
(defmethod draw-option ((this menu-sub-menu-option) (arg0 progress) (fnt font-context) (arg2 int) (arg3 symbol))
(let ((alpha (* 2.0 (- 0.5 (-> arg0 menu-transition))))
(y (the int (+ -1.0 (-> fnt origin y))))
(height 22)
)
(if (< alpha 0.0)
(set! alpha 0.0)
)
(set! (-> fnt alpha) alpha)
(set-scale! fnt 0.6)
(cond
((= *title-pc* (-> arg0 current-options))
(set-scale! fnt 0.65)
(set! (-> fnt height) 25.0)
(set! height 28)
(-! y 4)
(when (memcard-unlocked-secrets? #f)
(-! (-> fnt origin y) 30.0)
(set! height 28)
(-! y 31)
)
)
((= *options-pc* (-> arg0 current-options))
(-! (-> fnt origin y) 20.0)
(set-scale! fnt 0.85)
(set! (-> fnt height) 40.0)
(set! height 37)
(-! y 28)
)
)
(when (nonzero? (-> this name))
(set-color! fnt (if (= arg2 (-> arg0 option-index))
(the font-color (the int (progress-selected 0)))
(font-color progress)
)
)
(cond
((= arg2 (-> arg0 option-index))
(set-color! fnt (progress-selected 0))
)
(else
(set-color! fnt (font-color progress))
)
)
(if (and (and (= arg2 (-> arg0 option-index)) (!= 298 (-> this name)))
(not (and (= (-> this name) (text-id progress-root-secrets))
(= *title-pc* (-> arg0 current-options))
(not (memcard-unlocked-secrets? #f))
(= (-> arg0 option-index) 3)
)
)
)
(draw-highlight y height alpha)
)
(cond
((= *save-options-title* (-> arg0 current-options))
(cond
((= (-> this name) (text-id progress-continue-without-saving))
(cond
((= arg2 (-> arg0 option-index))
(set-scale! fnt 0.5)
)
(else
(set-scale! fnt 0.45)
)
)
(+! (-> fnt origin y) -120.0)
(if (not (-> *pc-settings* use-vis?))
(-! (-> fnt origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) 10))
(-! (-> fnt origin x) (the float (if (= (get-aspect-ratio) 'aspect4x3)
10
5
))))
(set! (-> fnt width) (the float (if (= (get-aspect-ratio) 'aspect4x3)
180
170
)
)
)
(set! (-> fnt height) 260.0)
(if (not (-> *pc-settings* use-vis?))
(*! (-> fnt width) (-> *pc-settings* aspect-ratio-reciprocal)))
(print-game-text (lookup-text! *common-text* (-> this name) #f) fnt #f 44 (bucket-id progress))
(when (= arg2 (-> arg0 option-index))
(let ((s4-1 69)
(s2-4 110)
(s3-1 176)
(s1-1 42)
)
(case (get-aspect-ratio)
(('aspect16x9)
(set! s4-1 79)
(set! s2-4 110)
(set! s3-1 166)
(set! s1-1 42)
(with-dma-buffer-add-bucket ((sv-16 (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress)
)
(draw-sprite2d-xy
sv-16
s4-1
(+ (* s1-1 arg2) 8 s1-1 s2-4)
s3-1
(+ s1-1 -8)
(new 'static 'rgba :r #x40 :g #x40 :b #x40 :a (the int (* 64.0 alpha)))
)
)
)
)
(when (not (-> *pc-settings* use-vis?))
(set! s4-1 (adjust-game-x (the float s4-1)))
(set! s3-1 (the int (* (-> *pc-settings* aspect-ratio-reciprocal) s3-1)))
)
(set-vector! (-> this box 0 color) 64 128 128 (the int (* 128.0 alpha)))
(draw-savegame-box
this
(the float s4-1)
(the float (+ s4-1 s3-1))
(the float (+ s2-4 (* s1-1 arg2)))
(the float (+ s2-4 (* s1-1 arg2)))
)
(draw-savegame-box
this
(the float (+ s4-1 s3-1))
(the float (+ s4-1 s3-1))
(the float s2-4)
(the float (+ s2-4 (* s1-1 arg2)))
)
(with-dma-buffer-add-bucket ((s0-3 (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id particles)
)
(draw-sprite2d-xy
s0-3
s4-1
(+ s2-4 (* s1-1 arg2))
s3-1
(+ s1-1 8)
(new 'static 'rgba :r #x40 :g #x40 :b #x40 :a (the int (* 64.0 alpha)))
)
)
)
)
)
(else
(if (not (-> *pc-settings* use-vis?))
(+! (-> fnt origin x) (* (-> *pc-settings* aspect-ratio-reciprocal) -100.0))
(+! (-> fnt origin x) -100.0))
(set! (-> fnt origin y) (+ -35.0 (-> fnt origin y)))
)
)
)
((= *load-save-options* (-> arg0 current-options))
(+! (-> fnt origin x) -100.0)
(+! (-> fnt origin y) -25.0)
(print-menu-text (lookup-text! *common-text* (-> this name) #f) (-> this scale) fnt arg0)
)
((and (= *title-pc* (-> arg0 current-options))
(= (text-id progress-root-secrets) (-> this name))
(memcard-unlocked-secrets? #f)
)
(print-game-text (lookup-text! *common-text* (-> this name) #f) fnt #f 44 (bucket-id progress))
)
((!= (-> this name) (text-id progress-root-secrets))
(print-game-text (lookup-text! *common-text* (-> this name) #f) fnt #f 44 (bucket-id progress))
)
)
)
)
0
(none)
)
(defmethod draw-option ((obj menu-icon-info-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
(set! (-> arg1 alpha) (- 1.0 (-> arg0 menu-transition)))
(set-color! arg1 (font-color progress))
(set-scale! arg1 0.5)
(set! (-> *bigmap* auto-save-icon-flag) #t)
(set! (-> obj sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x48 :page #x67a)))
(set! (-> obj sprites 0 scale-x) 1.0)
(set! (-> obj sprites 0 scale-y) 1.0)
(let ((v1-6 (-> obj sprites 0 color2)))
(set! (-> v1-6 0) 128)
(set! (-> v1-6 1) 128)
(set! (-> v1-6 2) 128)
(set! (-> v1-6 3) (the int (* 128.0 (- 1.0 (-> arg0 menu-transition)))))
)
(set! (-> obj sprites 0 pos z) #xffffff)
(set! (-> obj sprites 0 pos w) 0)
(set-hud-piece-position! (the-as hud-sprite (-> obj sprites)) (adjust-x-if-needed 240) 160)
(with-dma-buffer-add-bucket ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress)
)
(draw (-> obj sprites 0) s3-0 (-> *level* default-level))
)
(set-flags! arg1 (font-flags kerning middle middle-vert large))
(set! (-> arg1 origin x) 90.0)
(set! (-> arg1 origin y) 80.0)
(set-width! arg1 330)
(set-height! arg1 85)
(when (not (-> *pc-settings* use-vis?))
(set! (-> arg1 origin x) (the float (adjust-game-x (-> arg1 origin x))))
(*! (-> arg1 width) (-> *pc-settings* aspect-ratio-reciprocal))
)
(print-game-text
(lookup-text! *common-text* (text-id progress-autosave-explanation) #f)
arg1
#f
44
(bucket-id progress)
)
(+! (-> arg1 origin y) 115.0)
(set-height! arg1 95)
(print-game-text
(lookup-text! *common-text* (text-id progress-autosave-dont-remove) #f)
arg1
#f
44
(bucket-id progress)
)
(+! (-> arg1 origin y) 90.0)
(set-height! arg1 50)
(set-color! arg1 (progress-selected 0))
(draw-highlight (the int (+ 12.0 (-> arg1 origin y))) 24 (-> arg1 alpha))
(print-game-text
(lookup-text! *common-text* (text-id progress-unknown-continue) #f)
arg1
#f
44
(bucket-id progress)
)
0
(none)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; CUSTOM MENU OPTIONS
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun draw-decoration-aspect-ratio-custom ((arg0 menu-option) (arg1 font-context) (arg2 float) (arg3 text-id) (arg5 float))
(let ((gp-0 70)
(s5-0 120)
(sv-48 87)
(s3-0 375)
(s2-0 210)
(sv-64 0)
)
(case (get-aspect-ratio)
(('aspect4x3)
(set! gp-0 69)
(set! s5-0 129)
(set! sv-48 80)
(set! s3-0 375)
(set! s2-0 210)
)
(('aspect16x9)
(set! gp-0 79)
(set! s5-0 129)
(set! sv-48 68)
(set! s3-0 356)
(set! s2-0 244)
)
)
(when (not (-> *pc-settings* use-vis?))
(set! gp-0 (the int (adjust-game-x (the float gp-0))))
(set! s3-0 (the int (* (-> *pc-settings* aspect-ratio-reciprocal) s3-0)))
)
(set-scale! arg1 arg5)
(set! (-> arg1 origin y) (the float sv-48))
(set! (-> arg1 height) 50.0)
(set-color! arg1 (font-color progress))
(set-flags! arg1 (font-flags kerning middle middle-vert large))
(print-game-text (lookup-text! *common-text* arg3 #f) arg1 #f 44 (bucket-id progress))
(set-vector! (-> arg0 box 0 color) 64 128 128 (the int (* 128.0 arg2)))
(draw-savegame-box arg0 (the float gp-0) (the float (+ gp-0 s3-0)) (the float s5-0) (the float s5-0))
(with-dma-buffer-add-bucket ((s0-1 (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id particles)
)
(draw-sprite2d-xy
s0-1
gp-0
s5-0
s3-0
s2-0
(new 'static 'rgba :r #x40 :g #x40 :b #x40 :a (the int (* 64.0 arg2)))
)
)
)
)
(defun draw-highlight-aspect ((x int) (y int) (w int) (h int) (alpha float))
"draw the highlight for a number in the aspect ratio screen"
(with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress)
)
(when (not (-> *pc-settings* use-vis?))
(set! x (adjust-game-x (the float x)))
(set! w (the int (* (-> *pc-settings* aspect-ratio-reciprocal) w)))
)
(draw-sprite2d-xy buf x y w h (new 'static 'rgba :r #x40 :g #x80 :b #x80 :a (the int (* 64.0 alpha))))
)
)
(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"
(with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress)
)
(draw-sprite2d-xy buf x y w h (new 'static 'rgba :r #x40 :g #x80 :b #x80 :a (the int (* 64.0 alpha))))
)
)
(defun draw-up-down-aspect ((font font-context) (y-up float) (y-down float))
(protect ((-> font origin x) (-> font origin y) (-> font scale))
(let ((start-y (-> font origin y)))
(set-scale! font 0.5)
(set! (-> font origin y) (- start-y y-up))
(print-game-text (string-format "~33L~C" 160) font #f 44 (bucket-id progress))
(set! (-> font origin y) (+ start-y y-down))
(print-game-text (string-format "~33L~C" 162) font #f 44 (bucket-id progress))
)
)
0)
(defmacro swap-confirm? ()
"is the confirm button swapped from X?"
`(and (language? japanese korean)
(case (scf-get-territory)
((GAME_TERRITORY_SCEI GAME_TERRITORY_SCEK) #t)
(else #f))))
(defmethod draw-option ((obj menu-aspect-ratio-custom-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
(let* ((alpha (* 2.0 (- 0.5 (-> arg0 menu-transition))))
(middle-pad 15.0)
(middle-pad-uncorrected middle-pad)
(numbers-y 206.0)
(numbers-text-y (- numbers-y 44.0))
(hilite-width 36)
(hilite-height 16)
(hilite-y-ofs 6)
(hilite-height-total (+ hilite-height (* 2 hilite-y-ofs)))
(font-w 100)
(font-w-corrected (if (not (-> *pc-settings* use-vis?)) (the int (* (-> *pc-settings* aspect-ratio-reciprocal) font-w))
font-w))
)
(max! alpha 0.0)
(set! (-> arg1 alpha) alpha)
(set-flags! arg1 (font-flags kerning middle large))
(set-scale! arg1 0.65)
(set-color! arg1 (font-color progress))
(set! (-> arg1 origin y) 80.0)
(if (not (-> *pc-settings* use-vis?))
(*! middle-pad (-> *pc-settings* aspect-ratio-reciprocal)))
(protect ((-> arg1 origin x) (-> arg1 width))
(set-scale! arg1 0.6)
(set-width! arg1 50)
(set! (-> arg1 origin y) numbers-y)
(set! (-> arg1 origin x) (- 256.0 25))
(print-game-text "x" arg1 #f 44 (bucket-id progress))
(set-width! arg1 font-w-corrected)
(set-scale! arg1 0.6)
(set! (-> arg1 origin y) numbers-y)
(set! (-> arg1 origin x) (- 256.0 middle-pad font-w-corrected))
(cond
((= 0 (-> *progress-state-pc* aspect-ratio-ratio-index))
(draw-highlight-aspect
(- (the int (+ (- 256.0 middle-pad-uncorrected font-w) (/ font-w 2))) (/ hilite-width 2))
(- (the int (-> arg1 origin y)) hilite-y-ofs)
hilite-width hilite-height-total
alpha)
(set-color! arg1 (progress-selected 0))
(draw-up-down-aspect arg1 21.0 25.0))
(else
(set-color! arg1 (font-color progress)))
)
(print-game-text (string-format "~D" (-> *pc-settings* aspect-custom-x)) arg1 #f 44 (bucket-id progress))
(set-scale! arg1 0.55)
(set-color! arg1 (font-color progress))
(set! (-> arg1 origin y) numbers-text-y)
(print-game-text (lookup-text! *common-text* (text-id progress-aspect-ratio-custom-width) #f) arg1 #f 44 (bucket-id progress))
(set-scale! arg1 0.6)
(set! (-> arg1 origin y) numbers-y)
(set! (-> arg1 origin x) (+ 256.0 middle-pad))
(cond
((= 1 (-> *progress-state-pc* aspect-ratio-ratio-index))
(draw-highlight-aspect
(- (the int (+ (+ 256.0 middle-pad-uncorrected) (/ font-w 2))) (/ hilite-width 2))
(- (the int (-> arg1 origin y)) hilite-y-ofs)
hilite-width hilite-height-total
alpha)
(set-color! arg1 (progress-selected 0))
(draw-up-down-aspect arg1 21.0 25.0))
(else
(set-color! arg1 (font-color progress)))
)
(print-game-text (string-format "~D" (-> *pc-settings* aspect-custom-y)) arg1 #f 44 (bucket-id progress))
(set-scale! arg1 0.55)
(set-color! arg1 (font-color progress))
(set! (-> arg1 origin y) numbers-text-y)
(print-game-text (lookup-text! *common-text* (text-id progress-aspect-ratio-custom-height) #f) arg1 #f 44 (bucket-id progress))
)
(set! (-> arg1 origin y) 289.0)
(cond
((< (/ (the float (-> *pc-settings* aspect-custom-x)) (the float (-> *pc-settings* aspect-custom-y))) (/ 4.0 3.0))
(set-scale! arg1 0.5)
(set-color! arg1 (font-color red))
(when (and (< (/ (the float (-> *pc-settings* aspect-custom-x)) (the float (-> *pc-settings* aspect-custom-y))) (/ 4.0 3.0))
(< (mod (-> *display* real-clock frame-counter) (seconds 1.2)) (seconds 1.0)))
(print-game-text (lookup-text! *common-text* (text-id progress-aspect-ratio-custom-warn) #f) arg1 #f 44 (bucket-id progress))
)
)
(else
(set-scale! arg1 0.55)
(set-color! arg1 (font-color progress))
(print-game-text (lookup-text! *common-text* (if (not (swap-confirm?))
(text-id progress-aspect-ratio-custom-pad-x)
(text-id progress-aspect-ratio-custom-pad-circle)) #f) arg1 #f 44 (bucket-id progress))
)
)
(when-not-drawn-decoration
(draw-decoration-aspect-ratio-custom obj arg1 alpha (text-id progress-aspect-ratio-custom-title) 0.55))
)
0
(none)
)
(defmethod draw-option ((obj menu-frame-rate-disclaimer-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
(set! (-> arg1 alpha) (- 1.0 (-> arg0 menu-transition)))
(set-color! arg1 (font-color red))
(set-scale! arg1 0.8)
(set-flags! arg1 (font-flags kerning middle middle-vert large))
(set! (-> arg1 origin x) 90.0)
(set! (-> arg1 origin y) 72.0)
(set-width! arg1 330)
(set-height! arg1 85)
(when (not (-> *pc-settings* use-vis?))
(set! (-> arg1 origin x) (the float (adjust-game-x (-> arg1 origin x))))
(*! (-> arg1 width) (-> *pc-settings* aspect-ratio-reciprocal))
)
(when (< (mod (-> *display* real-clock frame-counter) (seconds 1.2)) (seconds 1.0))
(print-game-text (lookup-text! *common-text* (text-id progress-fps-disclaimer-warning) #f) arg1 #f 44 (bucket-id progress)))
(+! (-> arg1 origin y) 80.0)
(set-scale! arg1 0.45)
(set-color! arg1 (font-color progress))
(print-game-text (lookup-text! *common-text* (text-id progress-fps-disclaimer) #f) arg1 #f 44 (bucket-id progress))
(+! (-> arg1 origin y) 65.0)
(set-scale! arg1 0.55)
(set-height! arg1 95)
(print-game-text (lookup-text! *common-text* (text-id progress-memcard-continue?) #f) arg1 #f 44 (bucket-id progress))
(+! (-> arg1 origin y) 58.0)
(set-scale! arg1 0.5)
(set-height! arg1 50)
(set-color! arg1 (progress-selected 0))
(when (time-elapsed? (-> *progress-state-pc* frame-rate-disclaimer-time) (seconds 3))
(draw-highlight (the int (+ 13.0 (-> arg1 origin y))) 18 (-> arg1 alpha))
(draw-yes-no arg0 arg1))
0
(none)
)
(defmethod draw-option ((this menu-exit-game-option) (progress progress) (fnt font-context) (arg2 int) (selected symbol))
(let ((alpha (* 2.0 (- 0.5 (-> progress menu-transition))))
(y (the int (+ -1.0 (-> fnt origin y))))
(height 22)
)
(if (< alpha 0.0)
(set! alpha 0.0)
)
(set! (-> fnt alpha) alpha)
(set-scale! fnt 0.65)
(set! (-> fnt height) 25.0)
(set! height 28)
(when (not (memcard-unlocked-secrets? #f))
(-! (-> fnt origin y) 45.0)
(-! y 49)
)
(when (memcard-unlocked-secrets? #f)
(-! (-> fnt origin y) 35.0)
(-! y 38)
)
(when (nonzero? (-> this name))
(set-color! fnt (if (= arg2 (-> progress option-index))
(the font-color (the int (progress-selected 0)))
(font-color progress)
)
)
(cond
((= arg2 (-> progress option-index))
(set-color! fnt (progress-selected 0))
(draw-highlight y height alpha)
)
(else
(set-color! fnt (font-color progress))
)
)
(if selected (set-color! fnt (font-color progress-force-selected)))
(print-game-text (lookup-text! *common-text* (-> this name) #f) fnt #f 44 (bucket-id progress))
(let ((choice (&-> *progress-state* yes-no-choice)) (str (the string #f)))
(set! str
(cond
(selected
(set-color! fnt (font-color progress-force-selected))
(when (memcard-unlocked-secrets? #f)
(draw-highlight (the int (+ 24.0 (-> fnt origin y))) 24 (-> fnt alpha))
(+! (-> fnt origin y) 24.0)
(set-scale! fnt 0.55)
)
(when (not (memcard-unlocked-secrets? #f))
(draw-highlight (the int (+ 23.0 (-> fnt origin y))) 23 (-> fnt alpha))
(+! (-> fnt origin y) 23.0)
(set-scale! fnt 0.60)
)
(cond
((-> choice 0)
(format
(clear *temp-string*)
"~33L~S~32L ~S"
(lookup-text! *common-text* (text-id progress-yes) #f)
(lookup-text! *common-text* (text-id progress-no) #f)
)
(set! str *temp-string*)
)
(else
(format
(clear *temp-string*)
"~32L~S ~33L~S~1L"
(lookup-text! *common-text* (text-id progress-yes) #f)
(lookup-text! *common-text* (text-id progress-no) #f)
)
(set! str *temp-string*)
)
)
str
)
(else
(clear *temp-string*)
)
)
)
(print-game-text str fnt #f 44 (bucket-id progress))
)
)
)
(none)
)
(defun begin-scissor-music-player ((box hud-box))
(cond
((= (get-aspect-ratio) 'aspect16x9)
(set! (-> box min x) 19.0)
(set! (-> box min y) 129.0)
(set! (-> box max x) 274.0)
(set! (-> box max y) 304.0)
)
(else
(set! (-> box min x) 70.0)
(set! (-> box min y) 129.0)
(set! (-> box max x) 268.0)
(set! (-> box max y) 270.0)
)
)
(#when PC_PORT
(set! (-> box min x) (the float (the int (adjust-game-x (-> box min x)))))
(set! (-> box max x) (the float (the int (adjust-game-x (-> box max x)))))
)
(with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress)
)
(setup-scissor box buf)
)
0
)
(defun end-scissor-music-player ((box hud-box))
(with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress)
)
(restore-scissor box buf)
)
0
)
(defun draw-decoration-music-player ((arg0 menu-option) (arg1 font-context) (arg2 float) (arg3 text-id) (arg5 float) (box hud-box))
(let ((list-x (the int (-> box min x)))
(list-y (the int (-> box min y)))
(title-x 70)
(title-y 80)
(list-w (the int (- (-> box max x) (-> box min x))))
(list-h (the int (- (-> box max y) (-> box min y))))
(full-w 375)
(full-h 199)
)
(case (get-aspect-ratio)
(('aspect16x9)
(set! title-y 69)
(set! full-w 355)
(set! full-h 233)
(*! arg5 1.25)
)
)
(when (not (-> *pc-settings* use-vis?))
(set! title-x (the int (adjust-game-x (the float title-x))))
(set! full-w (the int (* (-> *pc-settings* aspect-ratio-reciprocal) full-w)))
)
(set-scale! arg1 arg5)
(set-origin! arg1 title-x title-y)
(set! (-> arg1 width) 375.0)
(set! (-> arg1 height) 48.0)
(when (not (-> *pc-settings* use-vis?))
(*! (-> arg1 width) (-> *pc-settings* aspect-ratio-reciprocal))
)
(set-color! arg1 (font-color progress))
(set-flags! arg1 (font-flags kerning middle middle-vert large))
(print-game-text (lookup-text! *common-text* arg3 #f) arg1 #f 44 (bucket-id progress))
(set-vector! (-> arg0 box 0 color) 64 128 128 (the int (* 128.0 arg2)))
(draw-savegame-box arg0 (the float list-x) (the float (+ list-x full-w)) (the float list-y) (the float list-y))
(draw-savegame-box arg0 (the float list-x) (the float (+ list-x list-w)) (the float (+ list-y list-h)) (the float (+ list-y list-h)))
(draw-savegame-box arg0 (the float (+ list-x list-w)) (the float (+ list-x list-w)) (the float list-y) (the float (+ list-y full-h)))
(with-dma-buffer-add-bucket ((s0-1 (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id particles)
)
(draw-sprite2d-xy
s0-1
list-x
list-y
list-w
list-h
(new 'static 'rgba :r #x40 :g #x40 :b #x40 :a (the int (* 64.0 arg2)))
)
)
)
)
(defun draw-up-down-music-player ((font font-context) (box hud-box))
(protect ((-> font origin x) (-> font origin y) (-> font scale) (-> font width) (-> font height))
(let ((start-y (-> font origin y)))
(set-scale! font 0.5)
(set! (-> font width) (- (-> box max x) (-> box min x)))
(set! (-> font height) 16.0)
(set-flags! font (font-flags kerning large middle))
(set! (-> font origin x) (-> box min x))
(set! (-> font origin y) (- (-> box min y) (-> font height)))
(print-game-text (string-format "~33L~C" 160) font #f 44 (bucket-id progress))
(set! (-> font origin y) (+ 3.0 (-> box max y)))
(print-game-text (string-format "~33L~C" 162) font #f 44 (bucket-id progress))
)
)
0)
(defmacro set-hud-sprite-attributes! (sprite
&key (r 128)
&key (g 128)
&key (b 128)
&key (a 1.0)
&key x
&key y
&key (z #xffffff)
&key (w 1)
&key tex
&key (scale-x 1.0)
&key (scale-y 1.0)
)
(with-gensyms (col)
`(begin
(let ((,col (-> ,sprite color2)))
(set! (-> ,col 0) ,r)
(set! (-> ,col 1) ,g)
(set! (-> ,col 2) ,b)
(set! (-> ,col 3) (the int (* 128.0 ,a)))
)
(set! (-> ,sprite pos z) ,z)
(set! (-> ,sprite pos w) ,w)
(set! (-> ,sprite tex) ,tex)
(set! (-> ,sprite scale-x) ,scale-x)
(set! (-> ,sprite scale-y) ,scale-y)
(set-hud-piece-position! ,sprite ,x ,y)
)))
(defmethod draw-option ((obj menu-music-player-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
(let* ((alpha (* 2.0 (- 0.5 (-> arg0 menu-transition))))
(y-pad-top 11)
(text-height 23)
(old-y 0.0)
(list-text-y (+ (- (-> obj current-scroll)) y-pad-top))
(max-lines 8)
(tab-music 6.0)
(tab-flava 12.0)
(box (new 'stack 'hud-box))
(flava-text-list (new 'static 'boxed-array :type text-id
(text-id progress-music-player-flava-default)
(text-id progress-music-player-flava-gun)
(text-id progress-music-player-flava-board)
(text-id progress-music-player-flava-mech)
(text-id progress-music-player-flava-darkjak)
(text-id progress-music-player-flava-pilot)
)))
(max! alpha 0.0)
(set! (-> arg1 alpha) alpha)
(when (not (-> *pc-settings* use-vis?))
(*! tab-music (-> *pc-settings* aspect-ratio-reciprocal))
(*! tab-flava (-> *pc-settings* aspect-ratio-reciprocal))
;(set! danger-w (the int (* (-> *pc-settings* aspect-ratio-reciprocal) danger-w)))
)
(set-flags! arg1 (font-flags kerning large))
(set-scale! arg1 0.6)
(set-color! arg1 (font-color progress))
(begin-scissor-music-player box)
(+! list-text-y (-> box min y))
(set-scale! arg1 0.45)
(set! (-> arg1 origin x) (+ (-> box min x) tab-music))
;(format *stdcon* "m: ~D f: ~D scroll: ~f~%" (-> obj music-index) (-> obj flava-index) (-> obj current-scroll))
(dotimes (i (-> *music-player-tracks* length))
(set! (-> arg1 origin y) (set! old-y list-text-y))
(set! (-> arg1 width) (- (-> box max x) (-> box min x)))
(cond
((= i (-> obj music-index))
(+! list-text-y text-height)
(cond
((-> *progress-state-pc* music-player-selected)
;; restore these later
(let* ((flava-bits (the-as int (-> *music-player-tracks* i flava)))
(flava-count (count-bits flava-bits))
(flava-text-height (the int (* (/ 0.42 0.45) text-height))))
;; draw highlight first
(draw-highlight-music-player (the int (-> box min x)) (the int (+ -6.0 (-> arg1 origin y)))
(the int (- (-> box max x) (-> box min x))) (+ text-height (* flava-count flava-text-height))
alpha)
;; draw text for each flava!
(protect ((-> arg1 origin x) (-> arg1 origin y) (-> arg1 scale))
(set-scale! arg1 0.42)
(+! (-> arg1 origin x) tab-flava)
(set! (-> arg1 origin y) list-text-y)
(dotimes (f flava-count)
(if (= f (-> obj flava-index))
(set-color! arg1 (progress-selected 0))
(set-color! arg1 (font-color progress)))
(let ((flava (bit-on-offset flava-bits f)))
(if (flava-unlocked? flava)
(print-game-text (lookup-text! *common-text* (-> flava-text-list (bit-on-offset flava-bits f)) #f) arg1 #f 44 (bucket-id progress))
(print-game-text (lookup-text! *common-text* (text-id progress-music-player-locked) #f) arg1 #f 44 (bucket-id progress)))
)
(+! (-> arg1 origin y) flava-text-height)
)
)
;; advance list height
(+! list-text-y (* flava-count flava-text-height))
;; set color to selected
(set-color! arg1 (font-color progress-force-selected))
))
(else
(set-color! arg1 (progress-selected 0))
(draw-highlight-music-player (the int (-> box min x)) (the int (+ -6.0 (-> arg1 origin y)))
(the int (- (-> box max x) (-> box min x))) text-height
alpha)
))
(when (< (-> arg1 origin y) (+ (-> box min y) y-pad-top))
(set! (-> obj current-scroll) (seek-ease (-> obj current-scroll) (+ (-> obj current-scroll) (- (-> arg1 origin y) (+ (-> box min y) y-pad-top)))
(if (-> *progress-state-pc* music-player-selected) 999999.0 (* 0.1 text-height (-> arg0 clock time-adjust-ratio)))
(* 0.3 text-height)
(* 0.01 text-height (-> arg0 clock time-adjust-ratio)))))
(when (> list-text-y (-> box max y))
(set! (-> obj current-scroll) (seek-ease (-> obj current-scroll) (+ (-> obj current-scroll) (- list-text-y (-> box max y)))
(if (-> *progress-state-pc* music-player-selected) 999999.0 (* 0.1 text-height (-> arg0 clock time-adjust-ratio)))
(* 0.3 text-height)
(* 0.01 text-height (-> arg0 clock time-adjust-ratio)))))
)
(else
(+! list-text-y text-height)
(set-color! arg1 (font-color progress))
)
)
(if (get-bit (-> *pc-settings* music-unlocked) i)
(print-game-text (lookup-text! *common-text* (-> *music-player-tracks* i text) #f) arg1 #f 44 (bucket-id progress))
(print-game-text (lookup-text! *common-text* (text-id progress-music-player-locked) #f) arg1 #f 44 (bucket-id progress)))
)
(if (< (- list-text-y (-> box max y)) 0.0)
(+! (-> obj current-scroll) (- list-text-y (-> box max y))))
(unless (-> *progress-state-pc* music-player-selected)
(max! (-> obj max-scroll) (-> obj current-scroll)))
(end-scissor-music-player box)
;; draw right panel text
(let ((icon-x 0)
(icon-y 174)
(icon-w (if (= (get-aspect-ratio) 'aspect4x3)
64
48))
(icon-h 64)
(icon-scale 0.7)
(icon-id 0)
(danger-pad 8.0)
(danger-w 73)
(arrow-w 14)
(danger-text-list (new 'static 'boxed-array :type text-id
(text-id progress-music-player-danger-0)
(text-id progress-music-player-danger-1)
(text-id progress-music-player-danger-2)
(text-id progress-music-player-danger-3)
)))
(set-flags! arg1 (font-flags kerning middle large))
(case (get-aspect-ratio)
(('aspect16x9)
(set-origin! arg1 281 160)
(set-width! arg1 144)
(set! icon-y 190)
)
(else
(set-origin! arg1 278 144)
(set-width! arg1 158)
)
)
(when (not (-> *pc-settings* use-vis?))
(set! (-> arg1 origin x) (the float (adjust-game-x (-> arg1 origin x))))
(*! danger-pad (-> *pc-settings* aspect-ratio-reciprocal))
(*! (-> arg1 width) (-> *pc-settings* aspect-ratio-reciprocal))
(set! icon-w (the int (* (-> *pc-settings* aspect-ratio-reciprocal) icon-w)))
(set! danger-w (the int (* (-> *pc-settings* aspect-ratio-reciprocal) danger-w)))
(set! arrow-w (the int (* (-> *pc-settings* aspect-ratio-reciprocal) arrow-w)))
)
(set-height! arg1 40)
(set-scale! arg1 0.42)
(set-color! arg1 (font-color progress))
(when (-> *progress-state-pc* music-player-track)
(print-game-text (lookup-text! *common-text* (text-id progress-music-player-now-playing) #f) arg1 #f 44 (bucket-id progress)))
(set-flags! arg1 (font-flags kerning middle middle-vert large))
(+! (-> arg1 origin y) 110.0)
(set-scale! arg1 0.48)
(cond
((-> *progress-state-pc* music-player-track)
(set! icon-id (-> *progress-state-pc* music-player-track icon)) ;; use this icon ID
(print-game-text (lookup-text! *common-text* (-> *progress-state-pc* music-player-track text) #f) arg1 #f 44 (bucket-id progress))
;; print flava if needed too
(when (nonzero? (-> *progress-state-pc* music-player-track flava))
(+! (-> arg1 origin y) 36.0)
(set-scale! arg1 0.42)
(print-game-text (lookup-text! *common-text* (-> flava-text-list (-> *progress-state-pc* music-player-flava)) #f) arg1 #f 44 (bucket-id progress))
)
)
(else
(print-game-text (lookup-text! *common-text* (text-id progress-music-player-no-track) #f) arg1 #f 44 (bucket-id progress))
)
)
;; draw right panel icon
(set! icon-x (the int (+ (-> arg1 origin x) (/ (-> arg1 width) 2))))
(set! icon-w (the int (* icon-scale icon-w)))
(set! icon-h (the int (* icon-scale icon-h)))
;; center icon. the icon is 96x96 but each sprite is 64x64, hence 1.5
(-! icon-x (the int (/ (* 1.5 icon-w) 2)))
(set-hud-sprite-attributes! (-> obj sprites 0) :tex (lookup-texture-by-id (get-level-icon-id-01 icon-id)) :a alpha :scale-x icon-scale :scale-y icon-scale :x icon-x :y icon-y)
(set-hud-sprite-attributes! (-> obj sprites 1) :tex (lookup-texture-by-id (get-level-icon-id-02 icon-id)) :a alpha :scale-x icon-scale :scale-y icon-scale :x (+ icon-x icon-w) :y icon-y)
(set-hud-sprite-attributes! (-> obj sprites 2) :tex (lookup-texture-by-id (get-level-icon-id-03 icon-id)) :a alpha :scale-x icon-scale :scale-y icon-scale :x icon-x :y (+ icon-y icon-h))
(set-hud-sprite-attributes! (-> obj sprites 3) :tex (lookup-texture-by-id (get-level-icon-id-04 icon-id)) :a alpha :scale-x icon-scale :scale-y icon-scale :x (+ icon-x icon-w) :y (+ icon-y icon-h))
;; danger scroller
(set-scale! arg1 0.42)
(set! (-> arg1 origin y) (+ 26.0 (-> box max y)))
(set! (-> arg1 origin x) (+ danger-pad (-> box min x)))
(set-width! arg1 danger-w)
(set-flags! arg1 (font-flags kerning large))
(print-game-text (lookup-text! *common-text* (text-id progress-music-player-danger) #f) arg1 #f 44 (bucket-id progress))
(+! (-> arg1 origin x) (-> arg1 width))
(set-flags! arg1 (font-flags kerning large right))
(set-width! arg1 arrow-w)
(+! (-> arg1 origin x) (-> arg1 width))
(set-color! arg1 (progress-selected (seconds 0.5)))
(print-game-text (string-format "~33L~C" 163) arg1 #f 44 (bucket-id progress))
(set-flags! arg1 (font-flags kerning large middle))
(set-width! arg1 (the int (- (-> box max x) (-> box min x) danger-w (* arrow-w 2) (* danger-pad 2))))
(set-color! arg1 (font-color progress))
(print-game-text (lookup-text! *common-text* (-> danger-text-list (-> obj excitement)) #f) arg1 #f 44 (bucket-id progress))
(+! (-> arg1 origin x) (-> arg1 width))
(set-flags! arg1 (font-flags kerning large))
(set-width! arg1 arrow-w)
(set-color! arg1 (progress-selected (seconds 0.5)))
(print-game-text (string-format "~33L~C" 161) arg1 #f 44 (bucket-id progress))
(with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress)
)
(draw (-> obj sprites 0) buf (-> *level* default-level))
(draw (-> obj sprites 1) buf (-> *level* default-level))
(draw (-> obj sprites 2) buf (-> *level* default-level))
(draw (-> obj sprites 3) buf (-> *level* default-level))
)
)
(when-not-drawn-decoration
(draw-up-down-music-player arg1 box)
(draw-decoration-music-player obj arg1 alpha (-> obj name) 0.7 box))
)
0
(none))
(defun draw-decoration-resolution ((arg0 menu-option) (arg1 font-context) (arg2 float) (arg3 text-id) (arg5 float))
(let ((gp-0 70)
(s5-0 120)
(sv-48 87)
(s3-0 375)
(s2-0 210)
(sv-64 0)
)
(case (get-aspect-ratio)
(('aspect4x3)
(set! gp-0 70)
(set! s5-0 116)
(set! sv-48 84)
(set! s3-0 375)
(set! s2-0 179)
)
(('aspect16x9)
(set! gp-0 79)
(set! s5-0 108)
(set! sv-48 58)
(set! s3-0 356)
(set! s2-0 185)
(set! sv-64 20)
)
)
(#when PC_PORT
;; added for better widescreen handling
(when (not (-> *pc-settings* use-vis?))
(set! gp-0 (the int (adjust-game-x (the float gp-0))))
(set! s3-0 (the int (* (-> *pc-settings* aspect-ratio-reciprocal) s3-0)))
)
)
(set-scale! arg1 arg5)
(set! (-> arg1 origin y) (the float sv-48))
(set! (-> arg1 height) 50.0)
(set-color! arg1 (font-color progress))
(set-flags! arg1 (font-flags kerning middle large))
(print-game-text (lookup-text! *common-text* arg3 #f) arg1 #f 44 (bucket-id progress))
(set-vector! (-> arg0 box 0 color) 64 128 128 (the int (* 128.0 arg2)))
(draw-savegame-box arg0 (the float gp-0) (the float (+ gp-0 s3-0)) (the float s5-0) (the float s5-0))
(+! (-> arg1 origin y) (the float sv-64))
(draw-savegame-box
arg0
(the float gp-0)
(the float (+ gp-0 s3-0))
(the float (+ s5-0 s2-0))
(the float (+ s5-0 s2-0))
)
(with-dma-buffer-add-bucket ((s0-1 (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id particles)
)
(draw-sprite2d-xy s0-1 gp-0 s5-0 s3-0 s2-0
(new 'static 'rgba :r #x40 :g #x40 :b #x40 :a (the int (* 64.0 arg2)))
)
)
)
)
(defun begin-scissor-resolution ((arg0 hud-box))
(cond
((= (get-aspect-ratio) 'aspect16x9)
(set! (-> arg0 min x) 79.0)
(set! (-> arg0 min y) 108.0)
(set! (-> arg0 max x) 434.0)
(set! (-> arg0 max y) 293.0)
)
(else
(set! (-> arg0 min x) 70.0)
(set! (-> arg0 min y) 116.0)
(set! (-> arg0 max x) 444.0)
(set! (-> arg0 max y) 295.0)
)
)
(with-dma-buffer-add-bucket ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress)
)
(setup-scissor arg0 s4-0)
)
0
)
(defun end-scissor-resolution ((arg0 hud-box) (arg1 float))
(with-dma-buffer-add-bucket ((s5-0 (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress)
)
(restore-scissor arg0 s5-0)
)
0
)
(defmethod draw-option ((this menu-resolution-option) (the-progress progress) (font font-context) (arg2 int) (arg3 symbol))
(let* ((alpha (* 2.0 (- 0.5 (-> the-progress menu-transition))))
(box (new 'stack 'hud-box))
(height 22)
(text-pad 1)
(text-height (+ height (* text-pad 2))))
(max! alpha 0.0)
(set! (-> font alpha) alpha)
(draw-decoration-resolution this font alpha (if (fullscreen?) (text-id progress-game-res-decoration) (text-id progress-window-size-decoration)) 0.65)
(begin-scissor-resolution box)
(set-flags! font (font-flags kerning large middle))
(cond
((< (-> this selected-index) 0)
;; not sure.
)
((-> this valid?)
(set-scale! font 0.6)
(set-color! font (font-color progress))
(set! (-> font origin x) (+ (-> box min x) 16))
(set! (-> font width) (- (-> box max x) (-> box min x) (* 16 2)))
(set-height! font 60)
;; draw the highlight first
(draw-highlight 193 (- height 1) alpha)
;; now scroll and offset the list
(if (> (abs (- (-> this scroll-index) (the float (-> this selected-index)))) 2.0)
(set! (-> this scroll-index) (the float (-> this selected-index)))
(seek-ease! (-> this scroll-index) (the float (-> this selected-index)) (* 0.15 (-> PP clock time-adjust-ratio)) 0.3 (* 0.0015 (-> PP clock time-adjust-ratio))))
(set! (-> font origin y) (- 194.0 (* (-> this scroll-index) text-height) (- text-pad)))
;; now draw the list!
(let ((valid-index 0))
(dotimes (i (-> this num-resolutions))
;; count "valid" resolutions
(let ((this-w 0) (this-h 0) (this-aspect 0.0))
(pc-get-resolution i (& this-w) (& this-h))
(set! this-aspect (/ (the float this-w) (the float this-h)))
(when (or (= (pc-get-display-mode) 'windowed)
(< (fabs (- (-> this win-aspect) this-aspect)) 0.05))
(if (= valid-index (-> this selected-index))
(set-color! font (progress-selected 0))
(set-color! font (font-color progress)))
(print-game-text (string-format "~D x ~D" this-w this-h) font #f 44 (bucket-id progress))
(+! (-> font origin y) text-height)
(1+! valid-index)
))
)
(when (fullscreen?)
;; draw extra hardcoded cases
(if (= valid-index (-> this selected-index))
(set-color! font (progress-selected 0))
(set-color! font (font-color progress)))
(print-game-text (string-format "~D x ~D" 512 416) font #f 44 (bucket-id progress))
(+! (-> font origin y) text-height)
(1+! valid-index)
(if (= valid-index (-> this selected-index))
(set-color! font (progress-selected 0))
(set-color! font (font-color progress)))
(print-game-text (string-format "~D x ~D" 512 208) font #f 44 (bucket-id progress))
(+! (-> font origin y) text-height)
(1+! valid-index)
))
)
(else
;; wtf?? just print an ominous warning.
(set-scale! font 0.6)
(set-color! font (font-color red))
(set! (-> font origin x) (+ (-> box min x) 16))
(set! (-> font origin y) (+ (-> box min y) 120))
(set! (-> font width) (- (-> box max x) (-> box min x) (* 16 2)))
(set-height! font 60)
(print-game-text (lookup-text! *common-text* (text-id progress-error-no-resolutions) #f) font #f 44 (bucket-id progress))
)
)
(end-scissor-resolution box 1.0)
)
0
(none))
(#when PC_PORT
(defun-debug draw-mouse ()
"draw some extra mouse info"
(let ((mx (+ (the int (-> *mouse* posx)) 256))
(my (+ (the int (-> *mouse* posy)) 208)))
(format *stdcon* "mouse pos: (~D,~D)~%" mx my)
(with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id debug-no-zbuf2)
)
(draw-sprite2d-xy buf 0 my 512 1 (static-rgba #xff #xff #xff #x40))
(draw-sprite2d-xy buf mx 0 1 416 (static-rgba #xff #xff #xff #x40))
)
)
)
(defmacro spawn-draw-mouse-proc ()
`(process-spawn-function process :name "draw-mouse" :to *display-pool*
(lambda :behavior process ()
(loop
(suspend)
(draw-mouse))
)))
)