mirror of
https://github.com/open-goal/jak-project
synced 2026-09-13 05:05:48 -04:00
deftype and defmethod syntax major changes (#3094)
Major change to how `deftype` shows up in our code: - the decompiler will no longer emit the `offset-assert`, `method-count-assert`, `size-assert` and `flag-assert` parameters. There are extremely few cases where having this in the decompiled code is helpful, as the types there come from `all-types` which already has those parameters. This also doesn't break type consistency because: - the asserts aren't compared. - the first step of the test uses `all-types`, which has the asserts, which will throw an error if they're bad. - the decompiler won't emit the `heap-base` parameter unless necessary now. - the decompiler will try its hardest to turn a fixed-offset field into an `overlay-at` field. It falls back to the old offset if all else fails. - `overlay-at` now supports field "dereferencing" to specify the offset that's within a field that's a structure, e.g.: ```lisp (deftype foobar (structure) ((vec vector :inline) (flags int32 :overlay-at (-> vec w)) ) ) ``` in this structure, the offset of `flags` will be 12 because that is the final offset of `vec`'s `w` field within this structure. - **removed ID from all method declarations.** IDs are only ever automatically assigned now. Fixes #3068. - added an `:overlay` parameter to method declarations, in order to declare a new method that goes on top of a previously-defined method. Syntax is `:overlay <method-name>`. Please do not ever use this. - added `state-methods` list parameter. This lets you quickly specify a list of states to be put in the method table. Same syntax as the `states` list parameter. The decompiler will try to put as many states in this as it can without messing with the method ID order. Also changes `defmethod` to make the first type definition (before the arguments) optional. The type can now be inferred from the first argument. Fixes #3093. --------- Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
This commit is contained in:
@@ -422,7 +422,7 @@
|
||||
(inc! external-index)))))
|
||||
-1.0))
|
||||
|
||||
(defmethod draw-option menu-highscores-option ((this menu-highscores-option) (progress progress) (font-ctx font-context) (option-index int) (selected? symbol))
|
||||
(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)
|
||||
@@ -642,7 +642,7 @@
|
||||
(none))
|
||||
|
||||
|
||||
(defmethod draw-option menu-slider-option ((obj menu-slider-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
|
||||
(defmethod draw-option ((obj menu-slider-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
|
||||
(local-vars
|
||||
(sv-48 int)
|
||||
(sv-64 int)
|
||||
@@ -926,7 +926,7 @@
|
||||
)
|
||||
|
||||
;; TODO - some naming is bad here in a few spots, cleanup once i understand it more
|
||||
(defmethod draw-option menu-missions-option ((obj menu-missions-option) (progress progress) (font-ctx font-context) (arg3 int) (arg4 symbol))
|
||||
(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)
|
||||
@@ -1309,7 +1309,7 @@
|
||||
`(if (not (-> *pc-settings* use-vis?)) (adjust-game-x (the float ,x)) ,x))
|
||||
|
||||
|
||||
(defmethod draw-option menu-memcard-slot-option ((obj menu-memcard-slot-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
|
||||
(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)
|
||||
@@ -1734,7 +1734,7 @@
|
||||
)
|
||||
|
||||
|
||||
(defmethod draw-option menu-sub-menu-option ((obj menu-sub-menu-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
|
||||
(defmethod draw-option ((obj menu-sub-menu-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
|
||||
(let ((f30-0 (* 2.0 (- 0.5 (-> arg0 menu-transition))))
|
||||
(s2-0 (the int (+ -1.0 (-> arg1 origin y))))
|
||||
(s1-0 22)
|
||||
@@ -1910,7 +1910,7 @@
|
||||
|
||||
|
||||
|
||||
(defmethod draw-option menu-icon-info-option ((obj menu-icon-info-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
|
||||
(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)
|
||||
@@ -1981,7 +1981,7 @@
|
||||
|
||||
|
||||
|
||||
(defmethod draw-option menu-aspect-ratio-pc-option ((obj menu-aspect-ratio-pc-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
|
||||
(defmethod draw-option ((obj menu-aspect-ratio-pc-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
|
||||
(let ((alpha (* 2.0 (- 0.5 (-> arg0 menu-transition)))))
|
||||
(max! alpha 0.0)
|
||||
(set! (-> arg1 alpha) alpha)
|
||||
@@ -2045,7 +2045,7 @@
|
||||
)
|
||||
|
||||
|
||||
(defmethod draw-option menu-display-mode-option ((obj menu-display-mode-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
|
||||
(defmethod draw-option ((obj menu-display-mode-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
|
||||
(let ((alpha (* 2.0 (- 0.5 (-> arg0 menu-transition)))))
|
||||
(max! alpha 0.0)
|
||||
(set! (-> arg1 alpha) alpha)
|
||||
@@ -2108,7 +2108,7 @@
|
||||
)
|
||||
|
||||
|
||||
(defmethod draw-option menu-on-off-vsync-option ((obj menu-on-off-vsync-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
|
||||
(defmethod draw-option ((obj menu-on-off-vsync-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
|
||||
(let ((alpha (* 2.0 (- 0.5 (-> arg0 menu-transition)))))
|
||||
(max! alpha 0.0)
|
||||
(set! (-> arg1 alpha) alpha)
|
||||
@@ -2262,7 +2262,7 @@
|
||||
(else #f))))
|
||||
|
||||
|
||||
(defmethod draw-option menu-aspect-ratio-custom-option ((obj menu-aspect-ratio-custom-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
|
||||
(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)
|
||||
@@ -2364,7 +2364,7 @@
|
||||
(none)
|
||||
)
|
||||
|
||||
(defmethod draw-option menu-frame-rate-option ((obj menu-frame-rate-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
|
||||
(defmethod draw-option ((obj menu-frame-rate-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
|
||||
(let ((alpha (* 2.0 (- 0.5 (-> arg0 menu-transition)))))
|
||||
(set-scale! arg1 0.65)
|
||||
(max! alpha 0.0)
|
||||
@@ -2600,7 +2600,7 @@
|
||||
)))
|
||||
|
||||
|
||||
(defmethod draw-option menu-music-player-option ((obj menu-music-player-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
|
||||
(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)
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
(bucket-id debug-no-zbuf2))
|
||||
(draw-sprite2d-xy buf 0 y-coord 512 1 (static-rgba #xff #xff #xff #x40))))
|
||||
|
||||
(defmethod draw-option menu-generic-scrolling-page ((obj menu-generic-scrolling-page) (progress progress) (font-ctx font-context) (arg3 int) (arg4 symbol))
|
||||
(defmethod draw-option ((obj menu-generic-scrolling-page) (progress progress) (font-ctx font-context) (arg3 int) (arg4 symbol))
|
||||
(when (or (zero? (-> obj mounted?)) (not (-> obj mounted?)))
|
||||
(on-mount! obj))
|
||||
;; the list has a total of 200px of y-height
|
||||
@@ -206,7 +206,7 @@
|
||||
(draw-sprite2d-xy buffer x-pos y-pos width height
|
||||
(new 'static 'rgba :r #x40 :g #x80 :b #x80 :a (the int (* 64.0 alpha)))))))
|
||||
|
||||
(defmethod draw-option menu-generic-boolean-option ((obj menu-generic-boolean-option) (arg0 progress) (font-ctx font-context) (option-index int) (selected? symbol))
|
||||
(defmethod draw-option ((obj menu-generic-boolean-option) (arg0 progress) (font-ctx font-context) (option-index int) (selected? symbol))
|
||||
(when (not (-> obj mounted?))
|
||||
(on-mount! obj))
|
||||
(let ((alpha (* 2.0 (- 0.5 (-> arg0 menu-transition))))
|
||||
@@ -251,7 +251,7 @@
|
||||
(print-game-text *temp-string* font-ctx #f 44 (bucket-id progress)))
|
||||
(none))
|
||||
|
||||
(defmethod draw-option menu-generic-carousel-option ((obj menu-generic-carousel-option)
|
||||
(defmethod draw-option ((obj menu-generic-carousel-option)
|
||||
(progress progress)
|
||||
(font-ctx font-context)
|
||||
(option-index int)
|
||||
@@ -316,13 +316,13 @@
|
||||
(print-game-text str font-ctx #f 44 (bucket-id progress)))
|
||||
(none))
|
||||
|
||||
(defmethod draw-option menu-generic-link-option ((obj menu-generic-link-option) (progress progress) (font-ctx font-context) (option-index int) (selected? symbol))
|
||||
(defmethod draw-option ((obj menu-generic-link-option) (progress progress) (font-ctx font-context) (option-index int) (selected? symbol))
|
||||
(when (not (-> obj mounted?))
|
||||
(on-mount! obj))
|
||||
(draw-generic-simple-string-option obj progress font-ctx option-index (lookup-text! *common-text* (-> obj name) #f))
|
||||
(none))
|
||||
|
||||
(defmethod draw-option menu-generic-confirm-option ((obj menu-generic-confirm-option) (progress progress) (font-ctx font-context) (option-index int) (selected? symbol))
|
||||
(defmethod draw-option ((obj menu-generic-confirm-option) (progress progress) (font-ctx font-context) (option-index int) (selected? symbol))
|
||||
(when (not (-> obj mounted?))
|
||||
(on-mount! obj))
|
||||
;; drawn different depending on whether or not the confirmation prompt is open
|
||||
@@ -372,7 +372,7 @@
|
||||
(draw-generic-simple-string-option obj progress font-ctx option-index (lookup-text! *common-text* (-> obj name) #f))))
|
||||
(none))
|
||||
|
||||
(defmethod draw-option menu-generic-slider-option ((obj menu-generic-slider-option) (arg0 progress) (font-ctx font-context) (option-index int) (selected? symbol))
|
||||
(defmethod draw-option ((obj menu-generic-slider-option) (arg0 progress) (font-ctx font-context) (option-index int) (selected? symbol))
|
||||
(when (not (-> obj mounted?))
|
||||
(on-mount! obj))
|
||||
(let ((alpha (max 0.0 (* 2.0 (- 0.5 (-> arg0 menu-transition)))))
|
||||
@@ -458,7 +458,7 @@
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod draw-option menu-generic-details-page ((obj menu-generic-details-page) (progress progress) (font-ctx font-context) (option-index int) (selected? symbol))
|
||||
(defmethod draw-option ((obj menu-generic-details-page) (progress progress) (font-ctx font-context) (option-index int) (selected? symbol))
|
||||
(when (or (zero? (-> obj mounted?)) (not (-> obj mounted?)))
|
||||
(on-mount! obj))
|
||||
;; the list has a total of 200px of y-height
|
||||
@@ -515,7 +515,7 @@
|
||||
(draw-scrolling-page-up-down-arrows font-ctx draw-up-arrow? draw-down-arrow?))))
|
||||
(none))
|
||||
|
||||
(defmethod draw-option menu-generic-details-keybind-entry ((obj menu-generic-details-keybind-entry) (progress progress) (font-ctx font-context) (option-index int) (selected? symbol))
|
||||
(defmethod draw-option ((obj menu-generic-details-keybind-entry) (progress progress) (font-ctx font-context) (option-index int) (selected? symbol))
|
||||
(when (or (zero? (-> obj mounted?)) (not (-> obj mounted?)))
|
||||
(on-mount! obj))
|
||||
;; TODO - implement `should-disable?` if it's ever relevant (its not right now)
|
||||
@@ -554,7 +554,7 @@
|
||||
(print-game-text *pc-cpp-temp-string* font-ctx #f 44 (bucket-id progress))))))
|
||||
(none))
|
||||
|
||||
(defmethod draw-option menu-generic-details-confirm-entry ((obj menu-generic-details-confirm-entry) (progress progress) (font-ctx font-context) (option-index int) (selected? symbol))
|
||||
(defmethod draw-option ((obj menu-generic-details-confirm-entry) (progress progress) (font-ctx font-context) (option-index int) (selected? symbol))
|
||||
(when (or (zero? (-> obj mounted?)) (not (-> obj mounted?)))
|
||||
(on-mount! obj))
|
||||
;; TODO - implement `should-disable?` if it's ever relevant (its not right now)
|
||||
|
||||
@@ -1,58 +1,58 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
(defmethod call-on-load generic-progress-state-entry ((this generic-progress-state-entry))
|
||||
(defmethod call-on-load ((this generic-progress-state-entry))
|
||||
(when (and (nonzero? (-> this on-load)) (!= (-> this on-load) #f))
|
||||
((-> this on-load)))
|
||||
(none))
|
||||
|
||||
(defmethod call-get-value-fn menu-generic-boolean-option ((this menu-generic-boolean-option))
|
||||
(defmethod call-get-value-fn ((this menu-generic-boolean-option))
|
||||
(if (and (nonzero? (-> this get-value-fn)) (!= (-> this get-value-fn) #f))
|
||||
((-> this get-value-fn))
|
||||
#f))
|
||||
|
||||
(defmethod call-on-confirm menu-generic-boolean-option ((this menu-generic-boolean-option) (val symbol))
|
||||
(defmethod call-on-confirm ((this menu-generic-boolean-option) (val symbol))
|
||||
(when (and (nonzero? (-> this on-confirm)) (!= (-> this on-confirm) #f))
|
||||
((-> this on-confirm) val))
|
||||
(none))
|
||||
|
||||
(defmethod call-get-item-index-fn menu-generic-carousel-option ((this menu-generic-carousel-option))
|
||||
(defmethod call-get-item-index-fn ((this menu-generic-carousel-option))
|
||||
(if (and (nonzero? (-> this get-item-index-fn)) (!= (-> this get-item-index-fn) #f))
|
||||
((-> this get-item-index-fn))
|
||||
0))
|
||||
|
||||
(defmethod call-on-confirm menu-generic-carousel-option ((this menu-generic-carousel-option) (val int))
|
||||
(defmethod call-on-confirm ((this menu-generic-carousel-option) (val int))
|
||||
(when (and (nonzero? (-> this on-confirm)) (!= (-> this on-confirm) #f))
|
||||
((-> this on-confirm) val))
|
||||
(none))
|
||||
|
||||
(defmethod call-on-confirm menu-generic-confirm-option ((this menu-generic-confirm-option))
|
||||
(defmethod call-on-confirm ((this menu-generic-confirm-option))
|
||||
(when (and (nonzero? (-> this on-confirm)) (!= (-> this on-confirm) #f))
|
||||
((-> this on-confirm)))
|
||||
(none))
|
||||
|
||||
(defmethod call-get-value-fn menu-generic-slider-option ((this menu-generic-slider-option))
|
||||
(defmethod call-get-value-fn ((this menu-generic-slider-option))
|
||||
(if (and (nonzero? (-> this get-value-fn)) (!= (-> this get-value-fn) #f))
|
||||
((-> this get-value-fn))
|
||||
0.0))
|
||||
|
||||
(defmethod call-on-confirm menu-generic-slider-option ((this menu-generic-slider-option) (val float))
|
||||
(defmethod call-on-confirm ((this menu-generic-slider-option) (val float))
|
||||
(when (and (nonzero? (-> this on-confirm)) (!= (-> this on-confirm) #f))
|
||||
((-> this on-confirm) val))
|
||||
(none))
|
||||
|
||||
(defmethod init! progress-pc-generic-store ((this progress-pc-generic-store))
|
||||
(defmethod init! ((this progress-pc-generic-store))
|
||||
(set! (-> this clear-screen?) #f)
|
||||
(set! (-> this keybind-select-time) 0)
|
||||
(set! (-> this current-highscore-page-index) 0)
|
||||
(none))
|
||||
|
||||
(defmethod call-on-confirm menu-generic-details-confirm-entry ((this menu-generic-details-confirm-entry))
|
||||
(defmethod call-on-confirm ((this menu-generic-details-confirm-entry))
|
||||
(when (and (nonzero? (-> this on-confirm)) (!= (-> this on-confirm) #f))
|
||||
((-> this on-confirm)))
|
||||
(none))
|
||||
|
||||
(defmethod navigate! progress-pc-generic-store ((this progress-pc-generic-store) (progress progress) (target menu-option-list) (on-load (function none)))
|
||||
(defmethod navigate! ((this progress-pc-generic-store) (progress progress) (target menu-option-list) (on-load (function none)))
|
||||
(when (< (-> this history-stack-index) 9) ;; hard-coded length
|
||||
;; if this is the first history entry, we push the current page as well
|
||||
;; if it's not, then we update the current entry before proceeding to the next page
|
||||
@@ -79,17 +79,17 @@
|
||||
(set! (-> progress selected-option) #f))
|
||||
(none))
|
||||
|
||||
(defmethod back! progress-pc-generic-store ((this progress-pc-generic-store) (progress progress))
|
||||
(defmethod back! ((this progress-pc-generic-store) (progress progress))
|
||||
(set! (-> this history-stack-index) (max 0 (dec (-> this history-stack-index))))
|
||||
(set! (-> this clear-screen?) #t)
|
||||
(set! (-> progress next) 'generic-menu)
|
||||
(set! (-> progress selected-option) #f)
|
||||
(none))
|
||||
|
||||
(defmethod has-history? progress-pc-generic-store ((this progress-pc-generic-store))
|
||||
(defmethod has-history? ((this progress-pc-generic-store))
|
||||
(> (-> this history-stack-index) 0))
|
||||
|
||||
(defmethod clear-history-if-empty! progress-pc-generic-store ((this progress-pc-generic-store))
|
||||
(defmethod clear-history-if-empty! ((this progress-pc-generic-store))
|
||||
"if we have no history, just reset the entry. This is so we don't preserve state after completely exiting the menu"
|
||||
(when (not (has-history? this))
|
||||
(set! (-> this history-stack-index) 0)
|
||||
@@ -102,34 +102,34 @@
|
||||
(set! (-> stack-entry progress-id) #f)))
|
||||
(none))
|
||||
|
||||
(defmethod clear-history! progress-pc-generic-store ((this progress-pc-generic-store))
|
||||
(defmethod clear-history! ((this progress-pc-generic-store))
|
||||
(set! (-> this history-stack-index) 0)
|
||||
(set! (-> this clear-screen?) #t)
|
||||
(set! (-> this current-menu-hover-index) 0)
|
||||
(none))
|
||||
|
||||
(defmethod on-mount! menu-generic-option ((this menu-generic-option))
|
||||
(defmethod on-mount! ((this menu-generic-option))
|
||||
(set! (-> this mounted?) #t)
|
||||
(none))
|
||||
|
||||
;; TODO - call the parent methods, when there is an elegant way to do so (not having to know the ID)
|
||||
|
||||
(defmethod on-mount! menu-generic-carousel-option ((this menu-generic-carousel-option))
|
||||
(defmethod on-mount! ((this menu-generic-carousel-option))
|
||||
(set! (-> this mounted?) #t)
|
||||
(set! (-> this item-index) 0)
|
||||
(none))
|
||||
|
||||
(defmethod on-mount! menu-generic-scrolling-page ((this menu-generic-scrolling-page))
|
||||
(defmethod on-mount! ((this menu-generic-scrolling-page))
|
||||
(set! (-> this mounted?) #t)
|
||||
(set! (-> this selected-option-index) -1)
|
||||
(none))
|
||||
|
||||
(defmethod on-mount! menu-generic-details-page ((this menu-generic-details-page))
|
||||
(defmethod on-mount! ((this menu-generic-details-page))
|
||||
(set! (-> this mounted?) #t)
|
||||
(set! (-> this selected-entry-index) -1)
|
||||
(none))
|
||||
|
||||
(defmethod on-mount! menu-generic-confirm-option ((this menu-generic-confirm-option))
|
||||
(defmethod on-mount! ((this menu-generic-confirm-option))
|
||||
(set! (-> this mounted?) #t)
|
||||
(set! (-> this confirmed?) #f)
|
||||
(none))
|
||||
@@ -146,7 +146,7 @@
|
||||
(((controller-keybind r-analog-right)) 2)
|
||||
(else (the int bind))))
|
||||
|
||||
(defmethod on-mount! menu-generic-details-keybind-entry ((this menu-generic-details-keybind-entry))
|
||||
(defmethod on-mount! ((this menu-generic-details-keybind-entry))
|
||||
(set! (-> this mounted?) #t)
|
||||
(set! (-> this bind-info port) 0) ;; always port 0 for now
|
||||
(set! (-> this bind-info device-type) (the int (-> this device-type)))
|
||||
@@ -164,7 +164,7 @@
|
||||
|
||||
;; Progress Code Overrides
|
||||
|
||||
(defmethod respond-to-cpad progress ((obj progress))
|
||||
(defmethod respond-to-cpad ((obj progress))
|
||||
(mc-get-slot-info 0 *progress-save-info*)
|
||||
;; ND originally did this...called this every frame in the game options, looked like a hack
|
||||
;; there's probably a way to consistently do it synchronously
|
||||
@@ -257,7 +257,7 @@
|
||||
|
||||
;; - input handling
|
||||
|
||||
(defmethod respond-progress menu-generic-scrolling-page ((obj menu-generic-scrolling-page) (progress progress) (selected? symbol))
|
||||
(defmethod respond-progress ((obj menu-generic-scrolling-page) (progress progress) (selected? symbol))
|
||||
"Handle progress menu navigation logic."
|
||||
(let ((selected-item? #f))
|
||||
(if (= (-> obj selected-option-index) -1)
|
||||
@@ -316,7 +316,7 @@
|
||||
(respond-progress (-> obj menu-options (-> *progress-pc-generic-store* current-menu-hover-index)) progress (or selected? selected-item?))))
|
||||
0)
|
||||
|
||||
(defmethod respond-progress menu-generic-boolean-option ((obj menu-generic-boolean-option) (progress progress) (selected? symbol))
|
||||
(defmethod respond-progress ((obj menu-generic-boolean-option) (progress progress) (selected? symbol))
|
||||
(if selected?
|
||||
(cond
|
||||
((cpad-pressed? 0 left l-analog-left right l-analog-right)
|
||||
@@ -334,7 +334,7 @@
|
||||
(set! (-> obj value) (call-get-value-fn obj)))))
|
||||
0)
|
||||
|
||||
(defmethod respond-progress menu-generic-carousel-option ((obj menu-generic-carousel-option) (progress progress) (selected? symbol))
|
||||
(defmethod respond-progress ((obj menu-generic-carousel-option) (progress progress) (selected? symbol))
|
||||
(if selected?
|
||||
(cond
|
||||
((cpad-pressed? 0 left l-analog-left)
|
||||
@@ -357,14 +357,14 @@
|
||||
(set! (-> obj item-index) (call-get-item-index-fn obj)))))
|
||||
0)
|
||||
|
||||
(defmethod respond-progress menu-generic-link-option ((obj menu-generic-link-option) (progress progress) (selected? symbol))
|
||||
(defmethod respond-progress ((obj menu-generic-link-option) (progress progress) (selected? symbol))
|
||||
(when (and selected? (cpad-pressed? 0 confirm))
|
||||
(navigate! *progress-pc-generic-store* progress (-> obj target) (-> obj on-load))
|
||||
(set! (-> progress selected-option) #f)
|
||||
(sound-play "score-slide"))
|
||||
0)
|
||||
|
||||
(defmethod respond-progress menu-generic-confirm-option ((obj menu-generic-confirm-option) (progress progress) (selected? symbol))
|
||||
(defmethod respond-progress ((obj menu-generic-confirm-option) (progress progress) (selected? symbol))
|
||||
(if selected?
|
||||
(cond
|
||||
((cpad-pressed? 0 left l-analog-left right l-analog-right)
|
||||
@@ -380,7 +380,7 @@
|
||||
(set! (-> obj confirmed?) #f))))
|
||||
0)
|
||||
|
||||
(defmethod respond-progress menu-generic-slider-option ((obj menu-generic-slider-option) (progress progress) (selected? symbol))
|
||||
(defmethod respond-progress ((obj menu-generic-slider-option) (progress progress) (selected? symbol))
|
||||
(if selected?
|
||||
(cond
|
||||
((and (> (-> obj value) (-> obj min-value))
|
||||
@@ -407,7 +407,7 @@
|
||||
(set! (-> obj value) (call-get-value-fn obj)))))
|
||||
0)
|
||||
|
||||
(defmethod respond-progress menu-generic-details-page ((obj menu-generic-details-page) (progress progress) (selected? symbol))
|
||||
(defmethod respond-progress ((obj menu-generic-details-page) (progress progress) (selected? symbol))
|
||||
(if (= (-> obj selected-entry-index) -1)
|
||||
(cond
|
||||
((or (cpad-pressed? 0 down l-analog-down)
|
||||
@@ -463,7 +463,7 @@
|
||||
(respond-progress (-> obj entries (-> *progress-pc-generic-store* current-menu-hover-index)) progress selected?))
|
||||
0)
|
||||
|
||||
(defmethod respond-progress menu-generic-details-keybind-entry ((obj menu-generic-details-keybind-entry) (progress progress) (selected? symbol))
|
||||
(defmethod respond-progress ((obj menu-generic-details-keybind-entry) (progress progress) (selected? symbol))
|
||||
(when (not selected?)
|
||||
(cond
|
||||
((cpad-pressed? 0 confirm)
|
||||
@@ -472,7 +472,7 @@
|
||||
(set! (-> *progress-pc-generic-store* keybind-select-time) (current-time)))))
|
||||
0)
|
||||
|
||||
(defmethod respond-progress menu-generic-details-confirm-entry ((obj menu-generic-details-confirm-entry) (progress progress) (selected? symbol))
|
||||
(defmethod respond-progress ((obj menu-generic-details-confirm-entry) (progress progress) (selected? symbol))
|
||||
(if selected?
|
||||
(cond
|
||||
((cpad-pressed? 0 left l-analog-left right l-analog-right)
|
||||
@@ -490,7 +490,7 @@
|
||||
|
||||
;; - rest of component logic
|
||||
|
||||
(defmethod num-items menu-generic-carousel-option ((this menu-generic-carousel-option))
|
||||
(defmethod num-items ((this menu-generic-carousel-option))
|
||||
"Get the number of items in the carousel"
|
||||
(if (and (nonzero? (-> this items)) (!= (-> this items) #f))
|
||||
(-> this items length)
|
||||
@@ -499,7 +499,7 @@
|
||||
((-> this get-max-size-fn))
|
||||
0)))
|
||||
|
||||
(defmethod get-item-label menu-generic-carousel-option ((this menu-generic-carousel-option) (item-index int))
|
||||
(defmethod get-item-label ((this menu-generic-carousel-option) (item-index int))
|
||||
"Gets the string label of the currently choosen item, preferring the `items` array if it exists"
|
||||
(if (and (nonzero? (-> this items)) (!= (-> this items) #f))
|
||||
(lookup-text! *common-text* (-> this items item-index) #f)
|
||||
@@ -508,7 +508,7 @@
|
||||
"#ERROR")))
|
||||
|
||||
;; TODO - it could be possible to map certain controllers to buttons (ie. dualshock controllers could have nice mappings instead of SDL named ones)
|
||||
(defmethod get-keybind-string menu-generic-details-keybind-entry ((this menu-generic-details-keybind-entry))
|
||||
(defmethod get-keybind-string ((this menu-generic-details-keybind-entry))
|
||||
(case (-> this keybind)
|
||||
(((controller-keybind cross))
|
||||
"~Y~22L<~Z~Y~27L*~Z~Y~1L>~Z~Y~23L[~Z~+26H Cross")
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
)
|
||||
|
||||
|
||||
(defmethod init-defaults progress ((obj progress))
|
||||
(defmethod init-defaults ((obj progress))
|
||||
"Initialize default menu settings."
|
||||
(set! (-> *progress-state* aspect-ratio-choice) (get-aspect-ratio))
|
||||
(set! (-> *progress-state* video-mode-choice) (get-video-mode))
|
||||
@@ -187,7 +187,7 @@
|
||||
((19) (pc-fetch-external-speedrun-times "anyorbs"))
|
||||
((20) (pc-fetch-external-speedrun-times "anyhero")))))
|
||||
|
||||
(defmethod set-menu-options progress ((obj progress) (arg0 symbol))
|
||||
(defmethod set-menu-options ((obj progress) (arg0 symbol))
|
||||
"Set the menu options for the menu state specified by arg0."
|
||||
(set! (-> obj current-options) #f)
|
||||
(case arg0
|
||||
@@ -419,7 +419,7 @@
|
||||
|
||||
|
||||
|
||||
(defmethod respond-progress menu-aspect-ratio-pc-option ((obj menu-aspect-ratio-pc-option) (arg0 progress) (arg1 symbol))
|
||||
(defmethod respond-progress ((obj menu-aspect-ratio-pc-option) (arg0 progress) (arg1 symbol))
|
||||
"Handle progress menu navigation logic."
|
||||
|
||||
(when arg1
|
||||
@@ -470,7 +470,7 @@
|
||||
)
|
||||
|
||||
|
||||
(defmethod respond-progress menu-display-mode-option ((obj menu-display-mode-option) (arg0 progress) (arg1 symbol))
|
||||
(defmethod respond-progress ((obj menu-display-mode-option) (arg0 progress) (arg1 symbol))
|
||||
"Handle progress menu navigation logic."
|
||||
|
||||
(when arg1
|
||||
@@ -503,7 +503,7 @@
|
||||
)
|
||||
|
||||
|
||||
(defmethod respond-progress menu-aspect-ratio-custom-option ((obj menu-aspect-ratio-custom-option) (arg0 progress) (arg1 symbol))
|
||||
(defmethod respond-progress ((obj menu-aspect-ratio-custom-option) (arg0 progress) (arg1 symbol))
|
||||
"Handle progress menu navigation logic."
|
||||
|
||||
(let ((aspect-custom-val-ptr (case (-> *progress-state-pc* aspect-ratio-ratio-index)
|
||||
@@ -557,7 +557,7 @@
|
||||
0
|
||||
)
|
||||
|
||||
(defmethod respond-progress menu-frame-rate-option ((obj menu-frame-rate-option) (arg0 progress) (arg1 symbol))
|
||||
(defmethod respond-progress ((obj menu-frame-rate-option) (arg0 progress) (arg1 symbol))
|
||||
"Handle progress menu navigation logic."
|
||||
|
||||
(when arg1
|
||||
@@ -657,7 +657,7 @@
|
||||
-1)
|
||||
|
||||
|
||||
(defmethod respond-progress menu-music-player-option ((obj menu-music-player-option) (arg0 progress) (arg1 symbol))
|
||||
(defmethod respond-progress ((obj menu-music-player-option) (arg0 progress) (arg1 symbol))
|
||||
"Handle progress menu navigation logic."
|
||||
|
||||
(if (= 0.0 (-> obj max-scroll))
|
||||
|
||||
Reference in New Issue
Block a user