From b2a1afddd9ad68847e57f462c0dab0d9162c5894 Mon Sep 17 00:00:00 2001 From: ManDude <7569514+ManDude@users.noreply.github.com> Date: Wed, 1 Jun 2022 03:19:37 +0100 Subject: [PATCH] add an extra hud element for `battlecontroller` battles (#1397) * update hud decomp * properly * pc hud element experiment + hud decomp fixes * bug fixes * extra hud elements toggle * first frame weirdness fixes + comments * Update game_subtitle_en.gs * Update hud-classes-pc.gc --- decompiler/config/all-types.gc | 35 +- game/assets/jak1/subtitle/game_subtitle_en.gs | 2 +- goal_src/dgos/game.gd | 1 + goal_src/engine/debug/default-menu.gc | 1 + goal_src/engine/game/collectables.gc | 3 - goal_src/engine/game/generic-obs-h.gc | 2 +- goal_src/engine/game/generic-obs.gc | 6 +- goal_src/engine/ui/hud-classes.gc | 102 ++--- goal_src/engine/ui/hud-h.gc | 42 +- goal_src/engine/ui/hud.gc | 97 +++-- goal_src/game.gp | 11 +- goal_src/kernel/gkernel-h.gc | 15 + goal_src/levels/racer_common/racer-part.gc | 12 +- goal_src/pc/README.md | 4 +- goal_src/pc/hud-classes-pc.gc | 383 ++++++++++++++++++ goal_src/pc/pckernel-h.gc | 4 +- goal_src/pc/pckernel.gc | 6 +- goal_src/pc/progress-pc.gc | 10 +- .../reference/engine/game/collectables_REF.gc | 3 - .../engine/game/generic-obs-h_REF.gc | 2 +- .../reference/engine/game/generic-obs_REF.gc | 4 +- .../reference/engine/ui/hud-classes_REF.gc | 102 ++--- .../reference/engine/ui/hud-h_REF.gc | 24 +- .../decompiler/reference/engine/ui/hud_REF.gc | 97 +++-- .../levels/racer_common/racer-part_REF.gc | 8 +- 25 files changed, 681 insertions(+), 295 deletions(-) create mode 100644 goal_src/pc/hud-classes-pc.gc diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index d7e0b09432..04e8670202 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -10728,7 +10728,7 @@ (joint joint-mod 4 :offset-assert 240) (new-post-hook (function none) :offset-assert 256) ;; TODO - no idea on these types (cur-post-hook (function none) :offset-assert 260) ;; TODO - no idea on these types - (clone-copy-trans basic :offset-assert 264) + (clone-copy-trans symbol :offset-assert 264) (shadow-backup basic :offset-assert 268) (draw? symbol :offset-assert 272) ) @@ -15362,19 +15362,19 @@ :flag-assert #x1b00b00118 ;; inherited inspect of process (:methods - (dummy-14 (_type_) symbol 14) - (dummy-15 (_type_) none 15) - (TODO-RENAME-16 (_type_ int int) none 16) - (dummy-17 (_type_) none 17) - (dummy-18 (_type_) none 18) - (TODO-RENAME-19 (_type_) none 19) + (hidden? (_type_) symbol 14) + (draw-hud (_type_) none 15) + (tally-value (_type_ int int) none 16) + (draw-icons (_type_) none 17) + (draw-particles (_type_) none 18) + (hud-update (_type_) none 19) (init-particles! (_type_ int) none 20) - (first-icon-x (_type_) int 21) - (first-icon-y (_type_) int 22) - (dummy-23 (_type_) none 23) - (animate! (_type_ symbol symbol) none 24) ;; not sure what the flags are / what the purpose is yet - (inc-value (_type_) float 25) - (dec-value (_type_) float 26) + (get-icon-pos-x (_type_) int 21) + (get-icon-pos-y (_type_) int 22) + (dummy-23 (_type_) none 23) ;; unused + (set-pos-and-scale (_type_ symbol symbol) none 24) + (get-icon-scale-x (_type_) float 25) + (get-icon-scale-y (_type_) float 26) ) (:states hud-arriving @@ -15403,7 +15403,7 @@ (bike-speed (pointer hud-bike-speed) :offset-assert 24) (bike-heat (pointer hud-bike-heat) :offset-assert 28) (money-all (pointer hud-money-all) :offset-assert 32) - (parts (pointer process) 9 :offset 0) + (parts (pointer hud) 9 :offset 0) ) :method-count-assert 9 :size-assert #x24 @@ -20414,7 +20414,7 @@ (define-extern manipy-init (function vector entity skeleton-group vector none :behavior manipy)) ;; TODO - not confirmed yet (define-extern part-tracker-notify (function object :behavior part-tracker)) (define-extern clone-anim-once (function handle int symbol string none :behavior process-drawable)) -(define-extern convert-to-hud-object (function process-drawable hud none :behavior hud)) +(define-extern convert-to-hud-object (function process-drawable hud none :behavior process-drawable)) (define-extern clone-anim (function handle int symbol string none :behavior process-drawable)) (define-extern merc-eye-anim (function process-drawable none)) (define-extern ja-anim-done? (function process symbol)) @@ -21481,8 +21481,6 @@ (initialize (_type_) _type_ 20) (initialize-params (_type_ time-frame float) none 21) ) - (:states - (hud-collecting handle)) ) (deftype eco-collectable (collectable) @@ -21891,6 +21889,9 @@ ;; - Unknowns +(define-extern hud-collecting (state handle process-drawable)) + + ;; ---------------------- ;; File - hud-classes diff --git a/game/assets/jak1/subtitle/game_subtitle_en.gs b/game/assets/jak1/subtitle/game_subtitle_en.gs index ffa6f25278..4566d797e7 100644 --- a/game/assets/jak1/subtitle/game_subtitle_en.gs +++ b/game/assets/jak1/subtitle/game_subtitle_en.gs @@ -486,7 +486,7 @@ (125 "DAXTER" "AND SEE IF WE SCRAMBLED THAT FLUT FLUT EGG.") ) ("sagevb01" :hint #x288 - (0 "SAGE" "WELL, I SEE THAT YOU TWO HAVE FINALLY DECIDED TO UNBLOCKED MY COLLECTORS.") + (0 "SAGE" "WELL, I SEE THAT YOU TWO HAVE FINALLY DECIDED TO UNBLOCK MY COLLECTORS.") (347) (352 "SAGE" "I WOULD OFFER MY CONGRATULATIONS, BUT YOU HAVE SO MUCH TO DO I WON'T WASTE YOUR TIME.") (705) diff --git a/goal_src/dgos/game.gd b/goal_src/dgos/game.gd index 2df3d5ff89..36f2ef82c0 100644 --- a/goal_src/dgos/game.gd +++ b/goal_src/dgos/game.gd @@ -332,4 +332,5 @@ ("plat-eco.o" "plat-eco") ("ropebridge.o" "ropebridge") ("ticky.o" "ticky") + ("hud-classes-pc.o" "hud-classes-pc") ;; added ) diff --git a/goal_src/engine/debug/default-menu.gc b/goal_src/engine/debug/default-menu.gc index b0c24c6f7a..70eb13bca3 100644 --- a/goal_src/engine/debug/default-menu.gc +++ b/goal_src/engine/debug/default-menu.gc @@ -4603,6 +4603,7 @@ (flag "All actors" #f ,(dm-lambda-boolean-flag (-> *pc-settings* force-actors?))) (flag "Display actor counts" #f ,(dm-lambda-boolean-flag (-> *pc-settings* display-actor-counts))) (flag "Display git commit" #f ,(dm-lambda-boolean-flag (-> *pc-settings* display-sha))) + (flag "Extra hud elements" #f ,(dm-lambda-boolean-flag (-> *pc-settings* extra-hud?))) (function "Reset" #f (lambda () (reset *pc-settings*))) (function "Save" #f (lambda () (commit-to-file *pc-settings*))) (function "Load" #f (lambda () (load-settings *pc-settings*))) diff --git a/goal_src/engine/game/collectables.gc b/goal_src/engine/game/collectables.gc index 8f86de0106..e3d4de31a2 100644 --- a/goal_src/engine/game/collectables.gc +++ b/goal_src/engine/game/collectables.gc @@ -54,9 +54,6 @@ (initialize (_type_) _type_ 20) (initialize-params (_type_ time-frame float) none 21) ) - (:states - (hud-collecting handle) - ) ) diff --git a/goal_src/engine/game/generic-obs-h.gc b/goal_src/engine/game/generic-obs-h.gc index b3eb83d260..c7e6989f81 100644 --- a/goal_src/engine/game/generic-obs-h.gc +++ b/goal_src/engine/game/generic-obs-h.gc @@ -48,7 +48,7 @@ (joint joint-mod 4 :offset-assert 240) (new-post-hook (function none) :offset-assert 256) (cur-post-hook (function none) :offset-assert 260) - (clone-copy-trans basic :offset-assert 264) + (clone-copy-trans symbol :offset-assert 264) (shadow-backup basic :offset-assert 268) (draw? symbol :offset-assert 272) ) diff --git a/goal_src/engine/game/generic-obs.gc b/goal_src/engine/game/generic-obs.gc index 7c21d54782..c73b002d59 100644 --- a/goal_src/engine/game/generic-obs.gc +++ b/goal_src/engine/game/generic-obs.gc @@ -5,7 +5,7 @@ ;; name in dgo: generic-obs ;; dgos: GAME, ENGINE -(define-extern convert-to-hud-object (function process-drawable hud none :behavior hud)) +(define-extern convert-to-hud-object (function process-drawable hud none :behavior process-drawable)) ;; TODO - temporary @@ -324,7 +324,7 @@ ) ((= v1-0 'clone-copy-trans) (set! v0-0 (the-as none (-> arg3 param 0))) - (set! (-> self clone-copy-trans) (the-as basic v0-0)) + (set! (-> self clone-copy-trans) (the-as symbol v0-0)) v0-0 ) ((= v1-0 'release) @@ -474,7 +474,7 @@ ) ) (the-as int (-> self draw origin-joint-index)) - (the-as symbol (-> self clone-copy-trans)) + (-> self clone-copy-trans) "" ) ) diff --git a/goal_src/engine/ui/hud-classes.gc b/goal_src/engine/ui/hud-classes.gc index dfb81445e9..dd4d05b669 100644 --- a/goal_src/engine/ui/hud-classes.gc +++ b/goal_src/engine/ui/hud-classes.gc @@ -140,8 +140,8 @@ ) -(defmethod dummy-15 hud-pickups ((obj hud-pickups)) - (let ((t9-0 (method-of-type hud dummy-15))) +(defmethod draw-hud hud-pickups ((obj hud-pickups)) + (let ((t9-0 (method-of-type hud draw-hud))) (t9-0 obj) ) (let* ((s5-0 (-> *display* frames (-> *display* on-screen) frame global-buf)) @@ -181,9 +181,9 @@ (none) ) -(defmethod TODO-RENAME-19 hud-pickups ((obj hud-pickups)) +(defmethod hud-update hud-pickups ((obj hud-pickups)) (if *target* - (TODO-RENAME-16 obj (the int (+ 0.5 (-> *target* fact-info-target eco-pill))) 0) + (tally-value obj (the int (+ 0.5 (-> *target* fact-info-target eco-pill))) 0) ) 0 (none) @@ -354,15 +354,15 @@ (none) ) -(defmethod dummy-15 hud-health ((obj hud-health)) - ((method-of-type hud dummy-15) obj) +(defmethod draw-hud hud-health ((obj hud-health)) + ((method-of-type hud draw-hud) obj) 0 (none) ) -(defmethod TODO-RENAME-19 hud-health ((obj hud-health)) +(defmethod hud-update hud-health ((obj hud-health)) (if *target* - (TODO-RENAME-16 + (tally-value obj (the int (-> *target* fact-info-target health)) (the-as int (-> *target* fact-info-target health-pickup-time)) @@ -411,7 +411,7 @@ (set! (-> obj particles s5-3 part matrix) (sprite-allocate-user-hvdf)) ) ) - (animate! obj (= (get-aspect-ratio) 'aspect16x9) (= (get-video-mode) 'pal)) + (set-pos-and-scale obj (= (get-aspect-ratio) 'aspect16x9) (= (get-video-mode) 'pal)) (set! (-> obj x-sgn) -1) (set! (-> obj y-sgn) -1) (set! (-> obj friend) 0) @@ -419,7 +419,7 @@ (none) ) -(defmethod animate! hud-health ((obj hud-health) (arg0 symbol) (arg1 symbol)) +(defmethod set-pos-and-scale hud-health ((obj hud-health) (arg0 symbol) (arg1 symbol)) (cond (arg0 (set! (-> obj particles 0 init-pos x) 65.0) @@ -490,8 +490,8 @@ ) -(defmethod dummy-15 hud-money-all ((obj hud-money-all)) - (let ((t9-0 (method-of-type hud dummy-15))) +(defmethod draw-hud hud-money-all ((obj hud-money-all)) + (let ((t9-0 (method-of-type hud draw-hud))) (t9-0 obj) ) 0 @@ -577,7 +577,7 @@ (none) ) -(defmethod TODO-RENAME-19 hud-money-all ((obj hud-money-all)) +(defmethod hud-update hud-money-all ((obj hud-money-all)) (when *target* (hide-bottom-hud) (when (!= *master-mode* 'pause) @@ -595,7 +595,7 @@ ) (if (>= (+ (-> *display* base-frame-counter) (seconds -5)) (-> obj start-time)) (set! (-> obj deactivate-when-hidden) #t) - (TODO-RENAME-16 obj (the-as int (-> *display* base-frame-counter)) 0) + (tally-value obj (the-as int (-> *display* base-frame-counter)) 0) ) ) 0 @@ -650,7 +650,7 @@ ) (+! (-> obj nb-of-particles) 1) ) - (animate! obj (= (get-aspect-ratio) 'aspect16x9) (= (get-video-mode) 'pal)) + (set-pos-and-scale obj (= (get-aspect-ratio) 'aspect16x9) (= (get-video-mode) 'pal)) (dotimes (s4-3 (-> obj nb-of-particles)) (if (= (-> obj particles s4-3 part matrix) -1) (set! (-> obj particles s4-3 part matrix) (sprite-allocate-user-hvdf)) @@ -698,7 +698,7 @@ (none) ) -(defmethod animate! hud-money-all ((obj hud-money-all) (arg0 symbol) (arg1 symbol)) +(defmethod set-pos-and-scale hud-money-all ((obj hud-money-all) (arg0 symbol) (arg1 symbol)) (cond (arg0 (set! (-> obj x-scale) 0.01845) @@ -759,8 +759,8 @@ ) -(defmethod dummy-15 hud-money ((obj hud-money)) - (let ((t9-0 (method-of-type hud dummy-15))) +(defmethod draw-hud hud-money ((obj hud-money)) + (let ((t9-0 (method-of-type hud draw-hud))) (t9-0 obj) ) (let* ((s5-0 (-> *display* frames (-> *display* on-screen) frame global-buf)) @@ -800,7 +800,7 @@ (none) ) -(defmethod TODO-RENAME-19 hud-money ((obj hud-money)) +(defmethod hud-update hud-money ((obj hud-money)) (when *target* (when (!= *master-mode* 'pause) (when (and (!= (-> obj icons 0) 0) (-> obj icons 0 icon)) @@ -815,7 +815,7 @@ ) ) ) - (TODO-RENAME-16 obj (the int (+ 0.5 (-> *target* game money))) 0) + (tally-value obj (the int (+ 0.5 (-> *target* game money))) 0) ) 0 (none) @@ -869,7 +869,7 @@ ) (+! (-> obj nb-of-particles) 1) ) - (animate! obj (= (get-aspect-ratio) 'aspect16x9) (= (get-video-mode) 'pal)) + (set-pos-and-scale obj (= (get-aspect-ratio) 'aspect16x9) (= (get-video-mode) 'pal)) (dotimes (s5-3 (-> obj nb-of-particles)) (if (= (-> obj particles s5-3 part matrix) -1) (set! (-> obj particles s5-3 part matrix) (sprite-allocate-user-hvdf)) @@ -884,7 +884,7 @@ (none) ) -(defmethod animate! hud-money ((obj hud-money) (arg0 symbol) (arg1 symbol)) +(defmethod set-pos-and-scale hud-money ((obj hud-money) (arg0 symbol) (arg1 symbol)) (cond (arg0 (set! (-> obj x-scale) 0.0123) @@ -912,19 +912,19 @@ (none) ) -(defmethod first-icon-x hud-money ((obj hud-money)) +(defmethod get-icon-pos-x hud-money ((obj hud-money)) (-> obj icons 0 icon-x) ) -(defmethod first-icon-y hud-money ((obj hud-money)) +(defmethod get-icon-pos-y hud-money ((obj hud-money)) (-> obj icons 0 icon-y) ) -(defmethod inc-value hud-money ((obj hud-money)) +(defmethod get-icon-scale-x hud-money ((obj hud-money)) 0.01 ) -(defmethod dec-value hud-money ((obj hud-money)) +(defmethod get-icon-scale-y hud-money ((obj hud-money)) -0.011 ) @@ -1159,8 +1159,8 @@ ) -(defmethod dummy-15 hud-fuel-cell ((obj hud-fuel-cell)) - (let ((t9-0 (method-of-type hud dummy-15))) +(defmethod draw-hud hud-fuel-cell ((obj hud-fuel-cell)) + (let ((t9-0 (method-of-type hud draw-hud))) (t9-0 obj) ) (let* ((s5-0 (-> *display* frames (-> *display* on-screen) frame global-buf)) @@ -1244,7 +1244,7 @@ (none) ) -(defmethod TODO-RENAME-19 hud-fuel-cell ((obj hud-fuel-cell)) +(defmethod hud-update hud-fuel-cell ((obj hud-fuel-cell)) (when *target* (when (!= *master-mode* 'pause) (let ((a0-2 (-> obj icons 0 icon 0 root))) @@ -1255,7 +1255,7 @@ ) ) (set! (-> obj icons 0 icon-y) (-> obj icon-pos-y)) - (TODO-RENAME-16 obj (the int (+ 0.5 (-> *target* game fuel))) 0) + (tally-value obj (the int (+ 0.5 (-> *target* game fuel))) 0) (let ((s5-1 (new 'stack-no-clear 'vector))) (vector<-cspace! s5-1 (-> obj icons 0 icon 0 node-list data 3)) (set! (-> obj particles 0 pos x) (-> s5-1 x)) @@ -1326,7 +1326,7 @@ (set! (-> obj y-sgn) -1) (set! (-> obj increment-on-event) #t) (set! (-> obj skip-particle) -2) - (animate! obj (= (get-aspect-ratio) 'aspect16x9) (= (get-video-mode) 'pal)) + (set-pos-and-scale obj (= (get-aspect-ratio) 'aspect16x9) (= (get-video-mode) 'pal)) (let ((s5-4 (new 'stack-no-clear 'quaternion))) (quaternion-axis-angle! s5-4 0.0 1.0 0.0 16384.0) (quaternion*! (-> obj icons 0 icon 0 root quat) s5-4 (-> obj icons 0 icon 0 root quat)) @@ -1335,7 +1335,7 @@ (none) ) -(defmethod animate! hud-fuel-cell ((obj hud-fuel-cell) (arg0 symbol) (arg1 symbol)) +(defmethod set-pos-and-scale hud-fuel-cell ((obj hud-fuel-cell) (arg0 symbol) (arg1 symbol)) (cond (arg0 (set! (-> obj scale-starburst-3-x) 10240.0) @@ -1433,8 +1433,8 @@ (none) ) -(defmethod dummy-15 hud-buzzers ((obj hud-buzzers)) - (let ((t9-0 (method-of-type hud dummy-15))) +(defmethod draw-hud hud-buzzers ((obj hud-buzzers)) + (let ((t9-0 (method-of-type hud draw-hud))) (t9-0 obj) ) (set! (-> obj text-y) (+ (if (nonzero? (-> obj next-y-offset)) @@ -1481,9 +1481,9 @@ (none) ) -(defmethod TODO-RENAME-19 hud-buzzers ((obj hud-buzzers)) +(defmethod hud-update hud-buzzers ((obj hud-buzzers)) (if *target* - (TODO-RENAME-16 obj (the int (+ 0.5 (-> *target* fact-info-target buzzer))) 0) + (tally-value obj (the int (+ 0.5 (-> *target* fact-info-target buzzer))) 0) ) 0 (none) @@ -1506,7 +1506,7 @@ (set! (-> obj particles s5-1 part matrix) (sprite-allocate-user-hvdf)) ) ) - (animate! obj (= (get-aspect-ratio) 'aspect16x9) (= (get-video-mode) 'pal)) + (set-pos-and-scale obj (= (get-aspect-ratio) 'aspect16x9) (= (get-video-mode) 'pal)) (set! (-> obj text-x) 85) (set! (-> obj text-y) 362) (set! (-> obj x-sgn) -1) @@ -1517,11 +1517,11 @@ (none) ) -(defmethod first-icon-x hud-buzzers ((obj hud-buzzers)) +(defmethod get-icon-pos-x hud-buzzers ((obj hud-buzzers)) (-> obj text-x) ) -(defmethod first-icon-y hud-buzzers ((obj hud-buzzers)) +(defmethod get-icon-pos-y hud-buzzers ((obj hud-buzzers)) (+ (if (= (-> *setting-control* current video-mode) 'pal) (+ (-> obj text-y) 120) (+ (-> obj text-y) 50) @@ -1530,15 +1530,15 @@ ) ) -(defmethod inc-value hud-buzzers ((obj hud-buzzers)) +(defmethod get-icon-scale-x hud-buzzers ((obj hud-buzzers)) 0.008 ) -(defmethod dec-value hud-buzzers ((obj hud-buzzers)) +(defmethod get-icon-scale-y hud-buzzers ((obj hud-buzzers)) -0.008 ) -(defmethod animate! hud-buzzers ((obj hud-buzzers) (arg0 symbol) (arg1 symbol)) +(defmethod set-pos-and-scale hud-buzzers ((obj hud-buzzers) (arg0 symbol) (arg1 symbol)) (cond (arg0 (set! (-> obj scale) 6553.6) @@ -1860,9 +1860,9 @@ (none) ) -(defmethod TODO-RENAME-19 hud-power ((obj hud-power)) +(defmethod hud-update hud-power ((obj hud-power)) (if *target* - (TODO-RENAME-16 + (tally-value obj (max 0 @@ -1922,14 +1922,14 @@ (set! (-> obj particles s5-3 part matrix) (sprite-allocate-user-hvdf)) ) ) - (animate! obj (= (get-aspect-ratio) 'aspect16x9) (= (get-video-mode) 'pal)) + (set-pos-and-scale obj (= (get-aspect-ratio) 'aspect16x9) (= (get-video-mode) 'pal)) (set! (-> obj x-sgn) 1) (set! (-> obj y-sgn) 1) 0 (none) ) -(defmethod animate! hud-power ((obj hud-power) (arg0 symbol) (arg1 symbol)) +(defmethod set-pos-and-scale hud-power ((obj hud-power) (arg0 symbol) (arg1 symbol)) (cond (arg0 (set! (-> obj scale-blue) 7168.0) @@ -2136,7 +2136,7 @@ (when *target* (dotimes (s4-0 9) (if (-> *hud-parts* parts s4-0) - (animate! (-> (the-as (pointer hud) (-> *hud-parts* parts s4-0)) 0) gp-0 s5-0) + (set-pos-and-scale (-> (the-as (pointer hud) (-> *hud-parts* parts s4-0)) 0) gp-0 s5-0) ) ) ) @@ -2152,7 +2152,7 @@ (set! gp-0 #t) (dotimes (s5-0 9) (when (-> *hud-parts* parts s5-0) - (if (not (dummy-14 (-> (the-as (pointer hud) (-> *hud-parts* parts s5-0)) 0))) + (if (not (hidden? (-> (the-as (pointer hud) (-> *hud-parts* parts s5-0)) 0))) (set! gp-0 #f) ) ) @@ -2172,7 +2172,7 @@ (set! gp-0 #t) (dotimes (s5-0 4) (when (-> *hud-parts* parts (+ s5-0 4)) - (if (not (dummy-14 (-> (the-as (pointer hud) (-> *hud-parts* parts (+ s5-0 4))) 0))) + (if (not (hidden? (-> (the-as (pointer hud) (-> *hud-parts* parts (+ s5-0 4))) 0))) (set! gp-0 #f) ) ) @@ -2205,7 +2205,7 @@ 0 ) -(defbehavior convert-to-hud-object hud ((arg0 process-drawable) (arg1 hud)) +(defbehavior convert-to-hud-object process-drawable ((arg0 process-drawable) (arg1 hud)) (when arg1 (logclear! (-> arg0 mask) (process-mask actor-pause)) (let ((s4-0 (new 'stack-no-clear 'vector))) @@ -2215,7 +2215,7 @@ ) (set! (-> arg0 root trans z) 9999999.0) (set! (-> arg0 root trans w) 1.0) - (set-vector! (-> arg0 root scale) (inc-value arg1) (dec-value arg1) (inc-value arg1) 1.0) + (set-vector! (-> arg0 root scale) (get-icon-scale-x arg1) (get-icon-scale-y arg1) (get-icon-scale-x arg1) 1.0) (set! (-> arg0 draw dma-add-func) dma-add-process-drawable-hud) (go hud-collecting (process->handle arg1)) ) diff --git a/goal_src/engine/ui/hud-h.gc b/goal_src/engine/ui/hud-h.gc index cc3e73dfca..49a777bdd4 100644 --- a/goal_src/engine/ui/hud-h.gc +++ b/goal_src/engine/ui/hud-h.gc @@ -5,17 +5,15 @@ ;; name in dgo: hud-h ;; dgos: GAME, ENGINE -;; TODO - for assistant-firecanyon | process-taskable -(define-extern hide-hud (function none)) -;; TODO - for static-screen -(define-extern hide-hud-quick (function none)) -;; TODO - for process-taskable -(define-extern hud-hidden? (function symbol)) - (define-extern activate-hud (function process none)) (define-extern activate-orb-all (function int int)) +(define-extern hide-hud (function none)) +(define-extern hide-hud-quick (function none)) (define-extern hide-bottom-hud (function none)) +(define-extern hud-hidden? (function symbol)) (define-extern bottom-hud-hidden? (function symbol)) +(define-extern enable-hud (function none)) +(define-extern disable-hud (function int none)) (declare-type hud process) (declare-type hud-pickups hud) @@ -28,10 +26,6 @@ (declare-type hud-bike-heat hud) (declare-type hud-money-all hud) -;; TODO - for target2 -(define-extern enable-hud (function none)) -(define-extern disable-hud (function int none)) - ;; DECOMP BEGINS (deftype hud-icon (basic) @@ -93,19 +87,19 @@ :size-assert #x118 :flag-assert #x1b00b00118 (:methods - (dummy-14 (_type_) symbol 14) - (dummy-15 (_type_) none 15) - (TODO-RENAME-16 (_type_ int int) none 16) - (dummy-17 (_type_) none 17) - (dummy-18 (_type_) none 18) - (TODO-RENAME-19 (_type_) none 19) + (hidden? (_type_) symbol 14) + (draw-hud (_type_) none 15) + (tally-value (_type_ int int) none 16) + (draw-icons (_type_) none 17) + (draw-particles (_type_) none 18) + (hud-update (_type_) none 19) (init-particles! (_type_ int) none 20) - (first-icon-x (_type_) int 21) - (first-icon-y (_type_) int 22) - (dummy-23 (_type_) none 23) - (animate! (_type_ symbol symbol) none 24) - (inc-value (_type_) float 25) - (dec-value (_type_) float 26) + (get-icon-pos-x (_type_) int 21) + (get-icon-pos-y (_type_) int 22) + (dummy-23 (_type_) none 23) ;; unused + (set-pos-and-scale (_type_ symbol symbol) none 24) + (get-icon-scale-x (_type_) float 25) + (get-icon-scale-y (_type_) float 26) ) (:states hud-arriving @@ -126,7 +120,7 @@ (bike-speed (pointer hud-bike-speed) :offset-assert 24) (bike-heat (pointer hud-bike-heat) :offset-assert 28) (money-all (pointer hud-money-all) :offset-assert 32) - (parts (pointer process) 9 :offset 0) + (parts (pointer hud) 9 :offset 0) ) :method-count-assert 9 :size-assert #x24 diff --git a/goal_src/engine/ui/hud.gc b/goal_src/engine/ui/hud.gc index 1cc372d31a..1dd6856060 100644 --- a/goal_src/engine/ui/hud.gc +++ b/goal_src/engine/ui/hud.gc @@ -19,7 +19,7 @@ (defmethod deactivate hud ((obj hud)) (dotimes (v1-0 9) (if (and (-> *hud-parts* parts v1-0) (= (ppointer->process (-> *hud-parts* parts v1-0)) obj)) - (set! (-> *hud-parts* parts v1-0) (the-as (pointer process) #f)) + (set! (-> *hud-parts* parts v1-0) (the-as (pointer hud) #f)) ) ) (dotimes (s5-0 (-> obj nb-of-particles)) @@ -30,8 +30,8 @@ (none) ) -(defmethod dummy-15 hud ((obj hud)) - (when (and (not (dummy-14 obj)) (not (paused?))) +(defmethod draw-hud hud ((obj hud)) + (when (and (not (hidden? obj)) (not (paused?))) (dotimes (s5-0 (-> obj nb-of-particles)) (when (!= s5-0 (-> obj skip-particle)) (if (or (!= (-> obj particles 0 pos x) 0.0) (!= (-> obj particles 0 pos y) 0.0)) @@ -44,7 +44,7 @@ (none) ) -(defmethod TODO-RENAME-16 hud ((obj hud) (arg0 int) (arg1 int)) +(defmethod tally-value hud ((obj hud) (arg0 int) (arg1 int)) (if (= arg0 (-> obj target-value)) (set! (-> obj last-target-equal-time) (-> *display* base-frame-counter)) ) @@ -104,7 +104,7 @@ (none) ) -(defmethod dummy-17 hud ((obj hud)) +(defmethod draw-icons hud ((obj hud)) (dotimes (v1-0 (-> obj nb-of-icons)) (set-vector! (-> obj icons v1-0 icon 0 root scale) @@ -133,7 +133,7 @@ (none) ) -(defmethod dummy-18 hud ((obj hud)) +(defmethod draw-particles hud ((obj hud)) (dotimes (s5-0 (-> obj nb-of-particles)) (when (!= (-> obj skip-particle) -2) (set! (-> obj particles s5-0 pos x) @@ -174,7 +174,7 @@ (none) ) -(defmethod TODO-RENAME-19 hud ((obj hud)) +(defmethod hud-update hud ((obj hud)) 0 (none) ) @@ -184,28 +184,28 @@ (none) ) -(defmethod first-icon-x hud ((obj hud)) +(defmethod get-icon-pos-x hud ((obj hud)) 0 ) -(defmethod first-icon-y hud ((obj hud)) +(defmethod get-icon-pos-y hud ((obj hud)) 0 ) -(defmethod inc-value hud ((obj hud)) +(defmethod get-icon-scale-x hud ((obj hud)) 0.0 ) -(defmethod dec-value hud ((obj hud)) +(defmethod get-icon-scale-y hud ((obj hud)) 0.0 ) -(defmethod animate! hud ((obj hud) (arg0 symbol) (arg1 symbol)) +(defmethod set-pos-and-scale hud ((obj hud) (arg0 symbol) (arg1 symbol)) 0 (none) ) -(defmethod dummy-14 hud ((obj hud)) +(defmethod hidden? hud ((obj hud)) (= (-> obj next-state name) 'hud-hidden) ) @@ -253,8 +253,8 @@ :enter (behavior () (set! (-> self offset) 128) - (dummy-17 self) - (dummy-18 self) + (draw-icons self) + (draw-particles self) (let ((gp-0 (-> self child))) (while gp-0 (send-event (ppointer->process gp-0) 'draw #f) @@ -285,7 +285,7 @@ (if (-> self deactivate-when-hidden) (deactivate self) ) - (TODO-RENAME-19 self) + (hud-update self) (none) ) ) @@ -299,9 +299,9 @@ (set! (-> self last-hide-time) (-> *display* base-frame-counter)) (set! (-> self force-on-screen) #f) (set! (-> self offset) 128) - (dummy-18 self) - (dummy-17 self) - (TODO-RENAME-19 self) + (draw-particles self) + (draw-icons self) + (hud-update self) (go hud-hidden) ) (('hide) @@ -356,7 +356,7 @@ (if (not (paused?)) (seekl! (-> self offset) 0 (the int (* 15.0 (-> *display* time-adjust-ratio)))) ) - (dummy-17 self) + (draw-icons self) (if (<= (-> self offset) 0) (go hud-in) ) @@ -364,9 +364,9 @@ (set! (-> self last-hide-time) (-> *display* base-frame-counter)) (set! (-> self force-on-screen) #f) (set! (-> self offset) 128) - (dummy-18 self) - (dummy-17 self) - (TODO-RENAME-19 self) + (draw-particles self) + (draw-icons self) + (hud-update self) (go hud-hidden) ) (suspend) @@ -375,9 +375,9 @@ ) :post (behavior () - (TODO-RENAME-19 self) - (dummy-18 self) - (dummy-15 self) + (hud-update self) + (draw-particles self) + (draw-hud self) (none) ) ) @@ -390,16 +390,16 @@ (set! (-> self trigger-time) (-> *display* base-frame-counter)) (while (and (< (- (-> *display* base-frame-counter) (-> self trigger-time)) (seconds 2)) (not (movie?))) (set! (-> self offset) 0) - (dummy-17 self) + (draw-icons self) (suspend) ) (when (movie?) (set! (-> self last-hide-time) (-> *display* base-frame-counter)) (set! (-> self force-on-screen) #f) (set! (-> self offset) 128) - (dummy-18 self) - (dummy-17 self) - (TODO-RENAME-19 self) + (draw-particles self) + (draw-icons self) + (hud-update self) (go hud-hidden) ) (go hud-leaving 5) @@ -418,14 +418,14 @@ (if (not (paused?)) (seekl! (-> self offset) 128 (the int (* (the float arg0) (-> *display* time-adjust-ratio)))) ) - (dummy-17 self) + (draw-icons self) (when (movie?) (set! (-> self last-hide-time) (-> *display* base-frame-counter)) (set! (-> self force-on-screen) #f) (set! (-> self offset) 128) - (dummy-18 self) - (dummy-17 self) - (TODO-RENAME-19 self) + (draw-particles self) + (draw-icons self) + (hud-update self) (go hud-hidden) ) (if (>= (-> self offset) 128) @@ -458,8 +458,8 @@ (logior! (-> self mask) (process-mask menu)) (logclear! (-> self mask) (process-mask pause progress)) (init-particles! self arg0) - (dummy-17 self) - (dummy-18 self) + (draw-icons self) + (draw-particles self) (go hud-hidden) (none) ) @@ -470,7 +470,7 @@ ) ) -(defstate hud-collecting (collectable) +(defstate hud-collecting (process-drawable) :trans (behavior () (case (-> self type) @@ -484,17 +484,16 @@ (behavior ((arg0 handle)) (let ((s5-0 (new 'stack-no-clear 'vector))) (let ((s4-0 (handle->process arg0))) - (set! (-> s5-0 x) (- (the float (+ (first-icon-x (the-as hud s4-0)) -256)) (-> self root-override trans x))) - (set! (-> s5-0 y) (- (the float (- (first-icon-y (the-as hud s4-0)) (-> *video-parms* screen-sy))) - (-> self root-override trans y) - ) + (set! (-> s5-0 x) (- (the float (+ (get-icon-pos-x (the-as hud s4-0)) -256)) (-> self root trans x))) + (set! (-> s5-0 y) + (- (the float (- (get-icon-pos-y (the-as hud s4-0)) (-> *video-parms* screen-sy))) (-> self root trans y)) ) ) (let ((f30-0 4.0) (f26-0 0.0) - (f28-0 (-> self root-override scale x)) - (f24-0 (-> self root-override scale y)) - (f22-0 (-> self root-override scale z)) + (f28-0 (-> self root scale x)) + (f24-0 (-> self root scale y)) + (f22-0 (-> self root scale z)) ) (loop (let ((f0-7 (* f30-0 (-> *display* seconds-per-frame)))) @@ -505,17 +504,17 @@ ) (set! f26-0 1.0) ) - (+! (-> self root-override trans x) (* f0-7 (-> s5-0 x))) - (+! (-> self root-override trans y) (* f0-7 (-> s5-0 y))) + (+! (-> self root trans x) (* f0-7 (-> s5-0 x))) + (+! (-> self root trans y) (* f0-7 (-> s5-0 y))) ) (set-vector! - (-> self root-override scale) + (-> self root scale) (* f28-0 (-> *video-parms* relative-x-scale)) (* f24-0 (-> *video-parms* relative-y-scale) (-> *video-parms* relative-y-scale)) (* f22-0 (-> *video-parms* relative-x-scale)) 1.0 ) - (let ((a0-12 (-> self root-override))) + (let ((a0-12 (-> self root))) (set-yaw-angle-clear-roll-pitch! a0-12 (- (y-angle a0-12) (* 182.04445 (* 8.0 (-> *display* time-adjust-ratio)))) @@ -532,7 +531,7 @@ (none) ) :post - (the-as (function none :behavior collectable) ja-post) + ja-post ) diff --git a/goal_src/game.gp b/goal_src/game.gp index 0ae8dad6ee..151f12b475 100644 --- a/goal_src/game.gp +++ b/goal_src/game.gp @@ -1614,7 +1614,7 @@ ) - (goal-src "engine/ps2/pad.gc" "pckernel-h") +(goal-src "engine/ps2/pad.gc" "pckernel-h") (goal-src-sequence ;; prefix @@ -1841,9 +1841,9 @@ "game/video.gc" ) - (goal-src "engine/game/main.gc" "pckernel" "video") +(goal-src "engine/game/main.gc" "pckernel" "video") - (goal-src-sequence +(goal-src-sequence ;; prefix "engine/" @@ -1938,9 +1938,7 @@ (fmt #t "found {} spools\n" (count *all-str*)) -(group-list "spools" - `(,@(reverse *all-str*)) - ) +(group-list "spools" (reverse *all-str*)) (group-list "text" @@ -1955,6 +1953,7 @@ (goal-src "pc/subtitle.gc" "text" "pckernel" "hint-control" "loader-h" "gsound" "ambient") (goal-src "pc/progress-pc.gc" "progress" "pckernel") (goal-src "pc/anim-tester-x.gc" "pckernel" "gstring" "joint" "process-drawable" "art-h" "effect-control") +(goal-src "pc/hud-classes-pc.gc" "pckernel" "hud" "battlecontroller" "generic-obs") ;; the debug menu is modified to include PC specific options: (goal-src "engine/debug/default-menu.gc" "anim-tester-x" "part-tester") diff --git a/goal_src/kernel/gkernel-h.gc b/goal_src/kernel/gkernel-h.gc index 2a4f604430..45d19e44ca 100644 --- a/goal_src/kernel/gkernel-h.gc +++ b/goal_src/kernel/gkernel-h.gc @@ -618,6 +618,8 @@ ) ) +(defconstant INVALID_HANDLE (the handle #f)) + (defmacro handle->name (handle) "get the name of a process using a handle. #f is the result if the handle was invalid." @@ -630,6 +632,19 @@ ) ) +(defmacro with-children (bindings &rest body) + "run body for each child. not recursive. + bindings are: (child proc); proc = process we do this on; child = var name for the current child ptr." + `(let ((,(first bindings) (-> ,(second bindings) child))) + (while ,(first bindings) + + ,@body + + (set! ,(first bindings) (-> ,(first bindings) 0 brother)) + ) + ) + ) + (defmacro kheap-alloc (heap size) "allocate space for a kheap" `(let ((heap ,heap) (size ,size)) diff --git a/goal_src/levels/racer_common/racer-part.gc b/goal_src/levels/racer_common/racer-part.gc index b49e31507f..ddae382680 100644 --- a/goal_src/levels/racer_common/racer-part.gc +++ b/goal_src/levels/racer_common/racer-part.gc @@ -336,9 +336,9 @@ ) -(defmethod TODO-RENAME-19 hud-bike-heat ((obj hud-bike-heat)) +(defmethod hud-update hud-bike-heat ((obj hud-bike-heat)) (if *target* - (TODO-RENAME-16 obj (the int (-> *target* racer heat)) 0) + (tally-value obj (the int (-> *target* racer heat)) 0) ) 0 (none) @@ -413,9 +413,9 @@ ) -(defmethod TODO-RENAME-19 hud-bike-speed ((obj hud-bike-speed)) +(defmethod hud-update hud-bike-speed ((obj hud-bike-speed)) (if *target* - (TODO-RENAME-16 obj (the int (-> *target* control unknown-float01)) 0) + (tally-value obj (the int (-> *target* control unknown-float01)) 0) ) 0 (none) @@ -472,7 +472,7 @@ (#when PC_PORT ;; extra methods needed for aspect ratio in pc port -(defmethod animate! hud-bike-heat ((obj hud-bike-heat) (arg0 symbol) (arg1 symbol)) +(defmethod set-pos-and-scale hud-bike-heat ((obj hud-bike-heat) (arg0 symbol) (arg1 symbol)) (with-pc (let ((base-x (-> obj particles 0 init-pos x))) (*! base-x (-> *pc-settings* aspect-ratio-reciprocal)) @@ -492,7 +492,7 @@ (none) ) -(defmethod animate! hud-bike-speed ((obj hud-bike-speed) (arg0 symbol) (arg1 symbol)) +(defmethod set-pos-and-scale hud-bike-speed ((obj hud-bike-speed) (arg0 symbol) (arg1 symbol)) (with-pc (let ((base-x (-> obj particles 1 init-pos x))) (+! base-x (* (- 512.0 base-x) (- 1.0 (-> *pc-settings* aspect-ratio-reciprocal)))) diff --git a/goal_src/pc/README.md b/goal_src/pc/README.md index 763908b3cb..84091e8cd8 100644 --- a/goal_src/pc/README.md +++ b/goal_src/pc/README.md @@ -1,3 +1 @@ -This directory contains either completely new source code files OR files we've significantly modified from the original - -Please try to preserve the original file path (with the addition of `pc/`) to make regression testing easy if it falls into the category of the latter. +This directory contains new source code files used for the PC port diff --git a/goal_src/pc/hud-classes-pc.gc b/goal_src/pc/hud-classes-pc.gc new file mode 100644 index 0000000000..705886d53e --- /dev/null +++ b/goal_src/pc/hud-classes-pc.gc @@ -0,0 +1,383 @@ +;;-*-Lisp-*- +(in-package goal) + +#| + + Code for extra HUD elements in the PC port. + + |# + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;; constants +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + +(defconstant HUD_ICON_COUNT 6) +(defconstant HUD_PART_PC_AMOUNT 1) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;; hud processes and parts +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + +;; a pc hud element +(deftype hud-pc (hud) + () + ) + +;; hud element for battles +(deftype hud-battle-enemy (hud) + ((want-skel symbol) + + (last-battle handle) + (battle-entity entity) + (battle-max int32) + (battle-alive int32) + (battle-mode symbol) + + (has-icons symbol) + (kicked symbol) + ) + (:methods + (make-enemy-icon (_type_ int symbol) int) + (kill-enemy-icons (_type_) int) + ) + ) + + +;; all pc hud elements +(deftype hud-parts-pc (structure) + ((battle-enemy (pointer hud-battle-enemy)) + + (parts (pointer hud-pc) HUD_PART_PC_AMOUNT :offset 0) + ) + ) + + + +;;;---------------------------------------------- +;; globals +;;;---------------------------------------------- + + +;; all of the pc hud elements +(define *hud-parts-pc* (new 'static 'hud-parts-pc + :battle-enemy #f + )) + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;; hud macros +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + +(defmacro hud-pc-make-icon (obj max &key skel + &key x + &key y + &key z + &key scale-x + &key scale-y + &key (entity #f) + ) + `(when (< (-> ,obj nb-of-icons) 6) + (let ((icon-idx (-> ,obj nb-of-icons))) + (set! (-> ,obj icons icon-idx) (new 'static 'hud-icon)) + (let ((new-manipy (process-new manipy manipy-init (new 'static 'vector :w 1.0) ,entity ,skel #f + :to ,obj + :stack *scratch-memory-top* + ))) + (when new-manipy + (set! (-> (-> new-manipy) draw dma-add-func) dma-add-process-drawable-hud) + (set-vector! (-> (-> new-manipy) root trans) 0.0 0.0 0.0 1.0) + (set-vector! (-> (-> new-manipy) root scale) ,scale-x ,scale-y ,scale-x 1.0) + (when #f + (send-event (ppointer->process new-manipy) 'trans-hook #f) + ) + ) + (set! (-> ,obj icons icon-idx icon) new-manipy) + (when new-manipy + (logior! (-> new-manipy 0 mask) (process-mask pause)) + (logclear! (-> new-manipy 0 mask) (process-mask menu progress)) + (set! (-> (-> new-manipy) root trans z) ,z) + (set! (-> ,obj icons icon-idx icon-x) ,x) + (set! (-> ,obj icons icon-idx icon-y) ,y) + (set! (-> ,obj icons icon-idx icon-z) 0) + (set! (-> ,obj icons icon-idx scale-x) ,scale-x) + (set! (-> ,obj icons icon-idx scale-y) ,scale-y) + ) + ) + ) + (+! (-> ,obj nb-of-icons) 1) + ) + ) + +(defmacro hud-pc-replace-icon (obj idx &key skel + &key z + &key (entity #f) + ) + `(let ((new-manipy (process-new manipy manipy-init (new 'static 'vector :w 1.0) ,entity ,skel #f + :to ,obj + :stack *scratch-memory-top* + ))) + (when new-manipy + (set! (-> (-> new-manipy) draw dma-add-func) dma-add-process-drawable-hud) + (set-vector! (-> (-> new-manipy) root trans) 0.0 0.0 0.0 1.0) + (set-vector! (-> (-> new-manipy) root scale) (-> ,obj icons ,idx scale-x) (-> ,obj icons ,idx scale-y) (-> ,obj icons ,idx scale-x) 1.0) + (when #f + (send-event (ppointer->process new-manipy) 'trans-hook #f) + ) + ) + (set! (-> ,obj icons ,idx icon) new-manipy) + (when new-manipy + (logior! (-> new-manipy 0 mask) (process-mask pause)) + (logclear! (-> new-manipy 0 mask) (process-mask menu progress)) + (set! (-> (-> new-manipy) root trans z) ,z) + ) + ) + ) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;; hud methods +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + + +(defmethod deactivate hud-pc ((obj hud-pc)) + (dotimes (i HUD_PART_PC_AMOUNT) + (if (and (-> *hud-parts-pc* parts i) (= (ppointer->process (-> *hud-parts-pc* parts i)) obj)) + (set! (-> *hud-parts-pc* parts i) (the (pointer hud-pc) #f)) + ) + ) + ((method-of-type hud deactivate) obj) + (none) + ) + + +(defmethod kill-enemy-icons hud-battle-enemy ((obj hud-battle-enemy)) + "kill all hud icons" + + (when (-> obj has-icons) + (dotimes (i (-> obj nb-of-icons)) + (when (and (nonzero? (-> obj icons i)) (nonzero? (-> obj icons i icon)) (-> obj icons i icon)) + (deactivate (ppointer->process (-> obj icons i icon))) + (set! (-> obj icons i icon) #f) + (hud-pc-replace-icon obj i :skel *fuelcell-naked-sg* :z (meters 0.5)) + ) + ) + + (false! (-> obj has-icons)) + ) + 0) + +(defmethod make-enemy-icon hud-battle-enemy ((obj hud-battle-enemy) (idx int) (skel-sym symbol)) + "make a new icon for the hud" + + ;; make new manipy + (hud-pc-replace-icon obj 0 :skel (-> skel-sym value) :entity (-> obj battle-entity) :z (meters 0.5)) + + (true! (-> obj has-icons)) + + 0) + + +(defmethod hud-update hud-battle-enemy ((obj hud-battle-enemy)) + + (when (not (-> *pc-settings* extra-hud?)) + (kill-enemy-icons obj) + (return #f)) + + (let ((battle (the battlecontroller #f))) + ;; default params + (set! (-> obj battle-entity) #f) + (set! (-> obj battle-mode) 'dead) + + ;; find an entity for a battlecontroller, check current level + (awhen (level-get-target-inside *level*) + (case (-> it name) + (('swamp) + (set! (-> obj battle-entity) (entity-by-name "swamp-battlecontroller-1")) + (set! (-> obj want-skel) '*babak-sg*) + ) + (('misty) + (set! (-> obj battle-entity) (entity-by-name "misty-battlecontroller-1")) + (set! (-> obj want-skel) '*babak-sg*) + ) + (('citadel) + (set! (-> obj battle-entity) (entity-by-name "citb-battlecontroller-1")) + (set! (-> obj want-skel) '*citb-bunny-sg*) + (set! (-> obj battle-mode) 'alive) + ) + ) + ) + + ;; have an entity, grab its process + (if (-> obj battle-entity) + (set! battle (the battlecontroller (-> obj battle-entity extra process)))) + + (cond + ;; check if we have a battle process + (battle + ;; if its a different process, panic and restart the whole sequence. it's OK + (when (!= (handle->process (-> obj last-battle)) battle) + (set! (-> obj last-battle) (process->handle battle)) + (kill-enemy-icons obj) + (send-event obj 'hide-quick) + ) + + ;; wait until battle is active + (when (= 'battlecontroller-active (-> battle next-state name)) + ;; get battle stats + (let ((alive-count 0)) + (with-children (child battle) + (1+! alive-count)) + (set! (-> obj value) (- (-> battle spawn-count) alive-count)) + (set! (-> obj battle-max) (-> battle max-spawn-count)) + (set! (-> obj battle-alive) alive-count) + ) + + ;; do stuff depending on our current state + (case (-> obj next-state name) + (('hud-hidden) + ;; we're hidden, so let's make our new icons and see if we are allowed to show + ;; if we have icons, show! + (when (-> obj has-icons) + (set! (-> obj kicked) #f) + (send-event obj 'show) + ) + ;; no icons, make new ones but keep them hidden for now + (when (and (not (-> obj has-icons)) (-> obj want-skel) (not *progress-process*)) + (make-enemy-icon obj 0 (-> obj want-skel)) + (let ((icon0 (ppointer->process (-> obj icons 0 icon)))) + (case (-> obj want-skel) + (('*babak-sg*) + (send-event icon0 'art-joint-anim "babak-idle" (seconds 0.05)) + (send-event icon0 'rot-quat (quaternion-axis-angle! (new-stack-quaternion0) 0.0 1.0 0.15 (degrees 210))) + ) + (('*citb-bunny-sg*) + (send-event icon0 'art-joint-anim "citb-bunny-idle" (seconds 0.05)) + (send-event icon0 'rot-quat (quaternion-axis-angle! (new-stack-quaternion0) 0.0 1.0 0.15 (degrees 210))) + ) + ) + (send-event icon0 'draw #f) + ) + ) + ) + (else + ;; we want to be shown! + + ;; progress is open, let's leave. + (when (and (not (-> obj kicked)) (= *master-mode* 'progress)) + (true! (-> obj kicked)) + (kill-enemy-icons obj) + (send-event obj 'hide-quick) + ) + + ;; set the trigger time so we don't automatically go away + (set! (-> obj trigger-time) (current-time)) + ) + ) + ) + ) + (else + ;; no battle. kill everything we have. + (when (-> obj has-icons) + (kill-enemy-icons obj) + (set! (-> obj last-battle) INVALID_HANDLE) + (send-event obj 'hide-quick) + ) + ) + ) + ) + 0 + (none) + ) + + +(defmethod draw-hud hud-battle-enemy ((obj hud-battle-enemy)) + (let ((t9-0 (method-of-type hud draw-hud))) + (t9-0 obj) + ) + (with-dma-buffer-add-bucket ((buf (-> (current-frame) global-buf)) + (bucket-id debug)) + (let ((str-x (+ (-> obj text-x) (* (-> obj x-sgn) (-> obj offset)))) + (str-y (/ (* (+ (-> obj text-y) (* (-> obj y-sgn) (-> obj offset)) (-> obj y-offset)) + (the int (-> *video-parms* relative-y-scale))) + 2)) + ) + + (case (-> obj battle-mode) + (('dead) + (draw-string-xy (string-format "~D/~D" (-> obj value) (-> obj battle-max)) + buf str-x str-y (font-color white) (font-flags shadow kerning large)) + ) + (('alive) + (draw-string-xy (string-format "~D" (-> obj battle-alive)) + buf str-x str-y (font-color white) (font-flags shadow kerning large)) + ) + ) + ) + ) + 0 + (none) + ) + + +(defmethod init-particles! hud-battle-enemy ((obj hud-battle-enemy) (arg0 int)) + (hud-pc-make-icon obj HUD_ICON_COUNT :skel *fuelcell-naked-sg* + :x (the int (* 0.84 512)) :y (the int (* 0.52 448)) :z (meters 0.5) + :scale-x 0.004 :scale-y (* -0.004 (/ 512.0 448.0))) + (set! (-> obj text-x) (the int (* 0.78 512))) + (set! (-> obj text-y) (the int (* 0.5 448))) + (set! (-> obj x-sgn) 1) + (set! (-> obj y-sgn) 0) + (set! (-> obj increment-on-event) #t) + (set-pos-and-scale obj (= (get-aspect-ratio) 'aspect16x9) (= (get-video-mode) 'pal)) + + (set! (-> obj last-battle) INVALID_HANDLE) + (set! (-> obj want-skel) #f) + (set! (-> obj battle-max) 0) + + (set! (-> obj kicked) #f) + (set! (-> obj has-icons) #f) + 0 + (none) + ) + + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;; hud helper funcs +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + +(defun deactivate-hud-pc () + "kill the pc hud" + + (dotimes (i HUD_PART_PC_AMOUNT) + (if (-> *hud-parts-pc* parts i) + (deactivate (ppointer->process (-> *hud-parts-pc* parts i)))) + ) + 0) + +(defun activate-hud-pc ((tree process-tree)) + "make the pc hud" + + (deactivate-hud-pc) + + (set! (-> *hud-parts-pc* battle-enemy) (process-new hud-battle-enemy hud-init-by-other 0 + :from *pc-dead-pool* :to tree + :stack-size PC_PROC_DEFAULT_STACK_SIZE)) + 0) + + +(activate-hud-pc *display-pool*) + + + + + diff --git a/goal_src/pc/pckernel-h.gc b/goal_src/pc/pckernel-h.gc index 72c55952e9..ef440d87c6 100644 --- a/goal_src/pc/pckernel-h.gc +++ b/goal_src/pc/pckernel-h.gc @@ -29,7 +29,7 @@ (defglobalconstant PC_KERNEL_VERSION_BUILD #x0001) -(defglobalconstant PC_KERNEL_VERSION_REVISION #x0003) +(defglobalconstant PC_KERNEL_VERSION_REVISION #x0004) (defglobalconstant PC_KERNEL_VERSION_MINOR #x0001) (defglobalconstant PC_KERNEL_VERSION_MAJOR #x0001) @@ -259,6 +259,7 @@ (third-camera-h-inverted? symbol) ;; third-person horizontal camera inverted (third-camera-v-inverted? symbol) ;; third-person vertical camera inverted (money-starburst? symbol) ;; add a starburst to the money + (extra-hud? symbol) ;; extra hud elements. (bingo pc-bingo-info :inline) ;; bingo integration. does nothing for now. @@ -435,6 +436,7 @@ (set! (-> obj subtitle-language) (pc-subtitle-lang english)) (reset-original-camera obj) (set! (-> obj money-starburst?) #f) + (set! (-> obj extra-hud?) #f) (none)) (defmethod reset-original-camera pc-settings ((obj pc-settings)) diff --git a/goal_src/pc/pckernel.gc b/goal_src/pc/pckernel.gc index 980e5c989d..1e14ba96a0 100644 --- a/goal_src/pc/pckernel.gc +++ b/goal_src/pc/pckernel.gc @@ -589,6 +589,7 @@ (("third-camera-h-inverted?") (set! (-> obj third-camera-h-inverted?) (file-stream-read-symbol file))) (("third-camera-v-inverted?") (set! (-> obj third-camera-v-inverted?) (file-stream-read-symbol file))) (("money-starburst?") (set! (-> obj money-starburst?) (file-stream-read-symbol file))) + (("extra-hud?") (set! (-> obj extra-hud?) (file-stream-read-symbol file))) (("scenes-seen") (dotimes (i 197) (set! (-> obj scenes-seen i) (file-stream-read-int file)) @@ -680,6 +681,7 @@ (format file " (stick-deadzone ~f)~%" (-> obj stick-deadzone)) + (format file " (extra-hud? ~A)~%" (-> obj extra-hud?)) (format file " (ps2-read-speed? ~A)~%" (-> obj ps2-read-speed?)) (format file " (ps2-parts? ~A)~%" (-> obj ps2-parts?)) (format file " (ps2-music? ~A)~%" (-> obj ps2-music?)) @@ -854,9 +856,9 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; the actor pool for PC processes! it has space for 2 processes, with 16K of space. +;; the actor pool for PC processes! it has space for 4 processes, with 16K of space. (defconstant PC_PROC_DEFAULT_STACK_SIZE 1024) -(define *pc-dead-pool* (new 'global 'dead-pool 2 (* 16 1024) '*pc-dead-pool*)) +(define *pc-dead-pool* (new 'global 'dead-pool 4 (* 16 1024) '*pc-dead-pool*)) diff --git a/goal_src/pc/progress-pc.gc b/goal_src/pc/progress-pc.gc index f129cebaed..90845b4987 100644 --- a/goal_src/pc/progress-pc.gc +++ b/goal_src/pc/progress-pc.gc @@ -8,9 +8,6 @@ |# -(#when PC_PORT - - ;;--------------------------- ;;--------------------------- ;; pc menu extra stuff @@ -1548,9 +1545,10 @@ (none) )) - - -) +;; these need to be overridden as well +(set! (-> progress-going-out post) (-> progress-normal post)) +(set! (-> progress-coming-in post) (-> progress-normal post)) + diff --git a/test/decompiler/reference/engine/game/collectables_REF.gc b/test/decompiler/reference/engine/game/collectables_REF.gc index 3e0f124fbc..2ed1fc7010 100644 --- a/test/decompiler/reference/engine/game/collectables_REF.gc +++ b/test/decompiler/reference/engine/game/collectables_REF.gc @@ -36,9 +36,6 @@ (initialize (_type_) _type_ 20) (initialize-params (_type_ time-frame float) none 21) ) - (:states - (hud-collecting handle) - ) ) ;; definition for method 3 of type collectable diff --git a/test/decompiler/reference/engine/game/generic-obs-h_REF.gc b/test/decompiler/reference/engine/game/generic-obs-h_REF.gc index 198df89ed9..22f38cddb2 100644 --- a/test/decompiler/reference/engine/game/generic-obs-h_REF.gc +++ b/test/decompiler/reference/engine/game/generic-obs-h_REF.gc @@ -15,7 +15,7 @@ (joint joint-mod 4 :offset-assert 240) (new-post-hook (function none) :offset-assert 256) (cur-post-hook (function none) :offset-assert 260) - (clone-copy-trans basic :offset-assert 264) + (clone-copy-trans symbol :offset-assert 264) (shadow-backup basic :offset-assert 268) (draw? symbol :offset-assert 272) ) diff --git a/test/decompiler/reference/engine/game/generic-obs_REF.gc b/test/decompiler/reference/engine/game/generic-obs_REF.gc index 2c74e151f9..8b9ffc8b77 100644 --- a/test/decompiler/reference/engine/game/generic-obs_REF.gc +++ b/test/decompiler/reference/engine/game/generic-obs_REF.gc @@ -386,7 +386,7 @@ ) ((= v1-0 'clone-copy-trans) (set! v0-0 (the-as none (-> arg3 param 0))) - (set! (-> self clone-copy-trans) (the-as basic v0-0)) + (set! (-> self clone-copy-trans) (the-as symbol v0-0)) v0-0 ) ((= v1-0 'release) @@ -536,7 +536,7 @@ ) ) (the-as int (-> self draw origin-joint-index)) - (the-as symbol (-> self clone-copy-trans)) + (-> self clone-copy-trans) "" ) ) diff --git a/test/decompiler/reference/engine/ui/hud-classes_REF.gc b/test/decompiler/reference/engine/ui/hud-classes_REF.gc index 2d707ddcb8..89d995dd03 100644 --- a/test/decompiler/reference/engine/ui/hud-classes_REF.gc +++ b/test/decompiler/reference/engine/ui/hud-classes_REF.gc @@ -152,8 +152,8 @@ ;; definition for method 15 of type hud-pickups ;; INFO: Return type mismatch int vs none. -(defmethod dummy-15 hud-pickups ((obj hud-pickups)) - (let ((t9-0 (method-of-type hud dummy-15))) +(defmethod draw-hud hud-pickups ((obj hud-pickups)) + (let ((t9-0 (method-of-type hud draw-hud))) (t9-0 obj) ) (let* ((s5-0 (-> *display* frames (-> *display* on-screen) frame global-buf)) @@ -195,9 +195,9 @@ ;; definition for method 19 of type hud-pickups ;; INFO: Return type mismatch int vs none. -(defmethod TODO-RENAME-19 hud-pickups ((obj hud-pickups)) +(defmethod hud-update hud-pickups ((obj hud-pickups)) (if *target* - (TODO-RENAME-16 obj (the int (+ 0.5 (-> *target* fact-info-target eco-pill))) 0) + (tally-value obj (the int (+ 0.5 (-> *target* fact-info-target eco-pill))) 0) ) 0 (none) @@ -393,17 +393,17 @@ ;; definition for method 15 of type hud-health ;; INFO: Return type mismatch int vs none. -(defmethod dummy-15 hud-health ((obj hud-health)) - ((method-of-type hud dummy-15) obj) +(defmethod draw-hud hud-health ((obj hud-health)) + ((method-of-type hud draw-hud) obj) 0 (none) ) ;; definition for method 19 of type hud-health ;; INFO: Return type mismatch int vs none. -(defmethod TODO-RENAME-19 hud-health ((obj hud-health)) +(defmethod hud-update hud-health ((obj hud-health)) (if *target* - (TODO-RENAME-16 + (tally-value obj (the int (-> *target* fact-info-target health)) (the-as int (-> *target* fact-info-target health-pickup-time)) @@ -454,7 +454,7 @@ (set! (-> obj particles s5-3 part matrix) (sprite-allocate-user-hvdf)) ) ) - (animate! obj (= (get-aspect-ratio) 'aspect16x9) (= (get-video-mode) 'pal)) + (set-pos-and-scale obj (= (get-aspect-ratio) 'aspect16x9) (= (get-video-mode) 'pal)) (set! (-> obj x-sgn) -1) (set! (-> obj y-sgn) -1) (set! (-> obj friend) 0) @@ -464,7 +464,7 @@ ;; definition for method 24 of type hud-health ;; INFO: Return type mismatch int vs none. -(defmethod animate! hud-health ((obj hud-health) (arg0 symbol) (arg1 symbol)) +(defmethod set-pos-and-scale hud-health ((obj hud-health) (arg0 symbol) (arg1 symbol)) (cond (arg0 (set! (-> obj particles 0 init-pos x) 65.0) @@ -545,8 +545,8 @@ ;; definition for method 15 of type hud-money-all ;; INFO: Return type mismatch int vs none. -(defmethod dummy-15 hud-money-all ((obj hud-money-all)) - (let ((t9-0 (method-of-type hud dummy-15))) +(defmethod draw-hud hud-money-all ((obj hud-money-all)) + (let ((t9-0 (method-of-type hud draw-hud))) (t9-0 obj) ) 0 @@ -634,7 +634,7 @@ ;; definition for method 19 of type hud-money-all ;; INFO: Return type mismatch int vs none. -(defmethod TODO-RENAME-19 hud-money-all ((obj hud-money-all)) +(defmethod hud-update hud-money-all ((obj hud-money-all)) (when *target* (hide-bottom-hud) (when (!= *master-mode* 'pause) @@ -652,7 +652,7 @@ ) (if (>= (+ (-> *display* base-frame-counter) (seconds -5)) (-> obj start-time)) (set! (-> obj deactivate-when-hidden) #t) - (TODO-RENAME-16 obj (the-as int (-> *display* base-frame-counter)) 0) + (tally-value obj (the-as int (-> *display* base-frame-counter)) 0) ) ) 0 @@ -709,7 +709,7 @@ ) (+! (-> obj nb-of-particles) 1) ) - (animate! obj (= (get-aspect-ratio) 'aspect16x9) (= (get-video-mode) 'pal)) + (set-pos-and-scale obj (= (get-aspect-ratio) 'aspect16x9) (= (get-video-mode) 'pal)) (dotimes (s4-3 (-> obj nb-of-particles)) (if (= (-> obj particles s4-3 part matrix) -1) (set! (-> obj particles s4-3 part matrix) (sprite-allocate-user-hvdf)) @@ -759,7 +759,7 @@ ;; definition for method 24 of type hud-money-all ;; INFO: Return type mismatch int vs none. -(defmethod animate! hud-money-all ((obj hud-money-all) (arg0 symbol) (arg1 symbol)) +(defmethod set-pos-and-scale hud-money-all ((obj hud-money-all) (arg0 symbol) (arg1 symbol)) (cond (arg0 (set! (-> obj x-scale) 0.01845) @@ -835,8 +835,8 @@ ;; definition for method 15 of type hud-money ;; INFO: Return type mismatch int vs none. -(defmethod dummy-15 hud-money ((obj hud-money)) - (let ((t9-0 (method-of-type hud dummy-15))) +(defmethod draw-hud hud-money ((obj hud-money)) + (let ((t9-0 (method-of-type hud draw-hud))) (t9-0 obj) ) (let* ((s5-0 (-> *display* frames (-> *display* on-screen) frame global-buf)) @@ -878,7 +878,7 @@ ;; definition for method 19 of type hud-money ;; INFO: Return type mismatch int vs none. -(defmethod TODO-RENAME-19 hud-money ((obj hud-money)) +(defmethod hud-update hud-money ((obj hud-money)) (when *target* (when (!= *master-mode* 'pause) (when (and (!= (-> obj icons 0) 0) (-> obj icons 0 icon)) @@ -893,7 +893,7 @@ ) ) ) - (TODO-RENAME-16 obj (the int (+ 0.5 (-> *target* game money))) 0) + (tally-value obj (the int (+ 0.5 (-> *target* game money))) 0) ) 0 (none) @@ -949,7 +949,7 @@ ) (+! (-> obj nb-of-particles) 1) ) - (animate! obj (= (get-aspect-ratio) 'aspect16x9) (= (get-video-mode) 'pal)) + (set-pos-and-scale obj (= (get-aspect-ratio) 'aspect16x9) (= (get-video-mode) 'pal)) (dotimes (s5-3 (-> obj nb-of-particles)) (if (= (-> obj particles s5-3 part matrix) -1) (set! (-> obj particles s5-3 part matrix) (sprite-allocate-user-hvdf)) @@ -966,7 +966,7 @@ ;; definition for method 24 of type hud-money ;; INFO: Return type mismatch int vs none. -(defmethod animate! hud-money ((obj hud-money) (arg0 symbol) (arg1 symbol)) +(defmethod set-pos-and-scale hud-money ((obj hud-money) (arg0 symbol) (arg1 symbol)) (cond (arg0 (set! (-> obj x-scale) 0.0123) @@ -995,22 +995,22 @@ ) ;; definition for method 21 of type hud-money -(defmethod first-icon-x hud-money ((obj hud-money)) +(defmethod get-icon-pos-x hud-money ((obj hud-money)) (-> obj icons 0 icon-x) ) ;; definition for method 22 of type hud-money -(defmethod first-icon-y hud-money ((obj hud-money)) +(defmethod get-icon-pos-y hud-money ((obj hud-money)) (-> obj icons 0 icon-y) ) ;; definition for method 25 of type hud-money -(defmethod inc-value hud-money ((obj hud-money)) +(defmethod get-icon-scale-x hud-money ((obj hud-money)) 0.01 ) ;; definition for method 26 of type hud-money -(defmethod dec-value hud-money ((obj hud-money)) +(defmethod get-icon-scale-y hud-money ((obj hud-money)) -0.011 ) @@ -1275,8 +1275,8 @@ ;; definition for method 15 of type hud-fuel-cell ;; INFO: Return type mismatch int vs none. -(defmethod dummy-15 hud-fuel-cell ((obj hud-fuel-cell)) - (let ((t9-0 (method-of-type hud dummy-15))) +(defmethod draw-hud hud-fuel-cell ((obj hud-fuel-cell)) + (let ((t9-0 (method-of-type hud draw-hud))) (t9-0 obj) ) (let* ((s5-0 (-> *display* frames (-> *display* on-screen) frame global-buf)) @@ -1370,7 +1370,7 @@ ;; definition for method 19 of type hud-fuel-cell ;; INFO: Return type mismatch int vs none. -(defmethod TODO-RENAME-19 hud-fuel-cell ((obj hud-fuel-cell)) +(defmethod hud-update hud-fuel-cell ((obj hud-fuel-cell)) (when *target* (when (!= *master-mode* 'pause) (let ((a0-2 (-> obj icons 0 icon 0 root))) @@ -1381,7 +1381,7 @@ ) ) (set! (-> obj icons 0 icon-y) (-> obj icon-pos-y)) - (TODO-RENAME-16 obj (the int (+ 0.5 (-> *target* game fuel))) 0) + (tally-value obj (the int (+ 0.5 (-> *target* game fuel))) 0) (let ((s5-1 (new 'stack-no-clear 'vector))) (vector<-cspace! s5-1 (-> obj icons 0 icon 0 node-list data 3)) (set! (-> obj particles 0 pos x) (-> s5-1 x)) @@ -1454,7 +1454,7 @@ (set! (-> obj y-sgn) -1) (set! (-> obj increment-on-event) #t) (set! (-> obj skip-particle) -2) - (animate! obj (= (get-aspect-ratio) 'aspect16x9) (= (get-video-mode) 'pal)) + (set-pos-and-scale obj (= (get-aspect-ratio) 'aspect16x9) (= (get-video-mode) 'pal)) (let ((s5-4 (new 'stack-no-clear 'quaternion))) (quaternion-axis-angle! s5-4 0.0 1.0 0.0 16384.0) (quaternion*! (-> obj icons 0 icon 0 root quat) s5-4 (-> obj icons 0 icon 0 root quat)) @@ -1465,7 +1465,7 @@ ;; definition for method 24 of type hud-fuel-cell ;; INFO: Return type mismatch int vs none. -(defmethod animate! hud-fuel-cell ((obj hud-fuel-cell) (arg0 symbol) (arg1 symbol)) +(defmethod set-pos-and-scale hud-fuel-cell ((obj hud-fuel-cell) (arg0 symbol) (arg1 symbol)) (cond (arg0 (set! (-> obj scale-starburst-3-x) 10240.0) @@ -1580,8 +1580,8 @@ ;; definition for method 15 of type hud-buzzers ;; INFO: Return type mismatch int vs none. -(defmethod dummy-15 hud-buzzers ((obj hud-buzzers)) - (let ((t9-0 (method-of-type hud dummy-15))) +(defmethod draw-hud hud-buzzers ((obj hud-buzzers)) + (let ((t9-0 (method-of-type hud draw-hud))) (t9-0 obj) ) (set! (-> obj text-y) (+ (if (nonzero? (-> obj next-y-offset)) @@ -1630,9 +1630,9 @@ ;; definition for method 19 of type hud-buzzers ;; INFO: Return type mismatch int vs none. -(defmethod TODO-RENAME-19 hud-buzzers ((obj hud-buzzers)) +(defmethod hud-update hud-buzzers ((obj hud-buzzers)) (if *target* - (TODO-RENAME-16 obj (the int (+ 0.5 (-> *target* fact-info-target buzzer))) 0) + (tally-value obj (the int (+ 0.5 (-> *target* fact-info-target buzzer))) 0) ) 0 (none) @@ -1657,7 +1657,7 @@ (set! (-> obj particles s5-1 part matrix) (sprite-allocate-user-hvdf)) ) ) - (animate! obj (= (get-aspect-ratio) 'aspect16x9) (= (get-video-mode) 'pal)) + (set-pos-and-scale obj (= (get-aspect-ratio) 'aspect16x9) (= (get-video-mode) 'pal)) (set! (-> obj text-x) 85) (set! (-> obj text-y) 362) (set! (-> obj x-sgn) -1) @@ -1669,12 +1669,12 @@ ) ;; definition for method 21 of type hud-buzzers -(defmethod first-icon-x hud-buzzers ((obj hud-buzzers)) +(defmethod get-icon-pos-x hud-buzzers ((obj hud-buzzers)) (-> obj text-x) ) ;; definition for method 22 of type hud-buzzers -(defmethod first-icon-y hud-buzzers ((obj hud-buzzers)) +(defmethod get-icon-pos-y hud-buzzers ((obj hud-buzzers)) (+ (if (= (-> *setting-control* current video-mode) 'pal) (+ (-> obj text-y) 120) (+ (-> obj text-y) 50) @@ -1684,18 +1684,18 @@ ) ;; definition for method 25 of type hud-buzzers -(defmethod inc-value hud-buzzers ((obj hud-buzzers)) +(defmethod get-icon-scale-x hud-buzzers ((obj hud-buzzers)) 0.008 ) ;; definition for method 26 of type hud-buzzers -(defmethod dec-value hud-buzzers ((obj hud-buzzers)) +(defmethod get-icon-scale-y hud-buzzers ((obj hud-buzzers)) -0.008 ) ;; definition for method 24 of type hud-buzzers ;; INFO: Return type mismatch int vs none. -(defmethod animate! hud-buzzers ((obj hud-buzzers) (arg0 symbol) (arg1 symbol)) +(defmethod set-pos-and-scale hud-buzzers ((obj hud-buzzers) (arg0 symbol) (arg1 symbol)) (cond (arg0 (set! (-> obj scale) 6553.6) @@ -2050,9 +2050,9 @@ ;; definition for method 19 of type hud-power ;; INFO: Return type mismatch int vs none. -(defmethod TODO-RENAME-19 hud-power ((obj hud-power)) +(defmethod hud-update hud-power ((obj hud-power)) (if *target* - (TODO-RENAME-16 + (tally-value obj (max 0 @@ -2114,7 +2114,7 @@ (set! (-> obj particles s5-3 part matrix) (sprite-allocate-user-hvdf)) ) ) - (animate! obj (= (get-aspect-ratio) 'aspect16x9) (= (get-video-mode) 'pal)) + (set-pos-and-scale obj (= (get-aspect-ratio) 'aspect16x9) (= (get-video-mode) 'pal)) (set! (-> obj x-sgn) 1) (set! (-> obj y-sgn) 1) 0 @@ -2123,7 +2123,7 @@ ;; definition for method 24 of type hud-power ;; INFO: Return type mismatch int vs none. -(defmethod animate! hud-power ((obj hud-power) (arg0 symbol) (arg1 symbol)) +(defmethod set-pos-and-scale hud-power ((obj hud-power) (arg0 symbol) (arg1 symbol)) (cond (arg0 (set! (-> obj scale-blue) 7168.0) @@ -2330,7 +2330,7 @@ (when *target* (dotimes (s4-0 9) (if (-> *hud-parts* parts s4-0) - (animate! (-> (the-as (pointer hud) (-> *hud-parts* parts s4-0)) 0) gp-0 s5-0) + (set-pos-and-scale (-> (the-as (pointer hud) (-> *hud-parts* parts s4-0)) 0) gp-0 s5-0) ) ) ) @@ -2347,7 +2347,7 @@ (set! gp-0 #t) (dotimes (s5-0 9) (when (-> *hud-parts* parts s5-0) - (if (not (dummy-14 (-> (the-as (pointer hud) (-> *hud-parts* parts s5-0)) 0))) + (if (not (hidden? (-> (the-as (pointer hud) (-> *hud-parts* parts s5-0)) 0))) (set! gp-0 #f) ) ) @@ -2368,7 +2368,7 @@ (set! gp-0 #t) (dotimes (s5-0 4) (when (-> *hud-parts* parts (+ s5-0 4)) - (if (not (dummy-14 (-> (the-as (pointer hud) (-> *hud-parts* parts (+ s5-0 4))) 0))) + (if (not (hidden? (-> (the-as (pointer hud) (-> *hud-parts* parts (+ s5-0 4))) 0))) (set! gp-0 #f) ) ) @@ -2404,7 +2404,7 @@ ;; definition for function convert-to-hud-object ;; INFO: Return type mismatch int vs none. -(defbehavior convert-to-hud-object hud ((arg0 process-drawable) (arg1 hud)) +(defbehavior convert-to-hud-object process-drawable ((arg0 process-drawable) (arg1 hud)) (when arg1 (logclear! (-> arg0 mask) (process-mask actor-pause)) (let ((s4-0 (new 'stack-no-clear 'vector))) @@ -2414,7 +2414,7 @@ ) (set! (-> arg0 root trans z) 9999999.0) (set! (-> arg0 root trans w) 1.0) - (set-vector! (-> arg0 root scale) (inc-value arg1) (dec-value arg1) (inc-value arg1) 1.0) + (set-vector! (-> arg0 root scale) (get-icon-scale-x arg1) (get-icon-scale-y arg1) (get-icon-scale-x arg1) 1.0) (set! (-> arg0 draw dma-add-func) dma-add-process-drawable-hud) (go hud-collecting (process->handle arg1)) ) diff --git a/test/decompiler/reference/engine/ui/hud-h_REF.gc b/test/decompiler/reference/engine/ui/hud-h_REF.gc index 6f5b0892a2..a6ae4662de 100644 --- a/test/decompiler/reference/engine/ui/hud-h_REF.gc +++ b/test/decompiler/reference/engine/ui/hud-h_REF.gc @@ -83,19 +83,19 @@ :size-assert #x118 :flag-assert #x1b00b00118 (:methods - (dummy-14 (_type_) symbol 14) - (dummy-15 (_type_) none 15) - (TODO-RENAME-16 (_type_ int int) none 16) - (dummy-17 (_type_) none 17) - (dummy-18 (_type_) none 18) - (TODO-RENAME-19 (_type_) none 19) + (hidden? (_type_) symbol 14) + (draw-hud (_type_) none 15) + (tally-value (_type_ int int) none 16) + (draw-icons (_type_) none 17) + (draw-particles (_type_) none 18) + (hud-update (_type_) none 19) (init-particles! (_type_ int) none 20) - (first-icon-x (_type_) int 21) - (first-icon-y (_type_) int 22) + (get-icon-pos-x (_type_) int 21) + (get-icon-pos-y (_type_) int 22) (dummy-23 (_type_) none 23) - (animate! (_type_ symbol symbol) none 24) - (inc-value (_type_) float 25) - (dec-value (_type_) float 26) + (set-pos-and-scale (_type_ symbol symbol) none 24) + (get-icon-scale-x (_type_) float 25) + (get-icon-scale-y (_type_) float 26) ) (:states hud-arriving @@ -150,7 +150,7 @@ (bike-speed (pointer hud-bike-speed) :offset-assert 24) (bike-heat (pointer hud-bike-heat) :offset-assert 28) (money-all (pointer hud-money-all) :offset-assert 32) - (parts (pointer process) 9 :offset 0) + (parts (pointer hud) 9 :offset 0) ) :method-count-assert 9 :size-assert #x24 diff --git a/test/decompiler/reference/engine/ui/hud_REF.gc b/test/decompiler/reference/engine/ui/hud_REF.gc index 4c0721e6b1..7abf092f67 100644 --- a/test/decompiler/reference/engine/ui/hud_REF.gc +++ b/test/decompiler/reference/engine/ui/hud_REF.gc @@ -16,7 +16,7 @@ (defmethod deactivate hud ((obj hud)) (dotimes (v1-0 9) (if (and (-> *hud-parts* parts v1-0) (= (ppointer->process (-> *hud-parts* parts v1-0)) obj)) - (set! (-> *hud-parts* parts v1-0) (the-as (pointer process) #f)) + (set! (-> *hud-parts* parts v1-0) (the-as (pointer hud) #f)) ) ) (dotimes (s5-0 (-> obj nb-of-particles)) @@ -29,8 +29,8 @@ ;; definition for method 15 of type hud ;; INFO: Return type mismatch int vs none. -(defmethod dummy-15 hud ((obj hud)) - (when (and (not (dummy-14 obj)) (not (paused?))) +(defmethod draw-hud hud ((obj hud)) + (when (and (not (hidden? obj)) (not (paused?))) (dotimes (s5-0 (-> obj nb-of-particles)) (when (!= s5-0 (-> obj skip-particle)) (if (or (!= (-> obj particles 0 pos x) 0.0) (!= (-> obj particles 0 pos y) 0.0)) @@ -45,7 +45,7 @@ ;; definition for method 16 of type hud ;; INFO: Return type mismatch int vs none. -(defmethod TODO-RENAME-16 hud ((obj hud) (arg0 int) (arg1 int)) +(defmethod tally-value hud ((obj hud) (arg0 int) (arg1 int)) (if (= arg0 (-> obj target-value)) (set! (-> obj last-target-equal-time) (-> *display* base-frame-counter)) ) @@ -107,7 +107,7 @@ ;; definition for method 17 of type hud ;; INFO: Return type mismatch int vs none. -(defmethod dummy-17 hud ((obj hud)) +(defmethod draw-icons hud ((obj hud)) (dotimes (v1-0 (-> obj nb-of-icons)) (set-vector! (-> obj icons v1-0 icon 0 root scale) @@ -138,7 +138,7 @@ ;; definition for method 18 of type hud ;; INFO: Return type mismatch int vs none. -(defmethod dummy-18 hud ((obj hud)) +(defmethod draw-particles hud ((obj hud)) (dotimes (s5-0 (-> obj nb-of-particles)) (when (!= (-> obj skip-particle) -2) (set! (-> obj particles s5-0 pos x) @@ -173,7 +173,7 @@ ;; definition for method 19 of type hud ;; INFO: Return type mismatch int vs none. -(defmethod TODO-RENAME-19 hud ((obj hud)) +(defmethod hud-update hud ((obj hud)) 0 (none) ) @@ -186,34 +186,34 @@ ) ;; definition for method 21 of type hud -(defmethod first-icon-x hud ((obj hud)) +(defmethod get-icon-pos-x hud ((obj hud)) 0 ) ;; definition for method 22 of type hud -(defmethod first-icon-y hud ((obj hud)) +(defmethod get-icon-pos-y hud ((obj hud)) 0 ) ;; definition for method 25 of type hud -(defmethod inc-value hud ((obj hud)) +(defmethod get-icon-scale-x hud ((obj hud)) 0.0 ) ;; definition for method 26 of type hud -(defmethod dec-value hud ((obj hud)) +(defmethod get-icon-scale-y hud ((obj hud)) 0.0 ) ;; definition for method 24 of type hud ;; INFO: Return type mismatch int vs none. -(defmethod animate! hud ((obj hud) (arg0 symbol) (arg1 symbol)) +(defmethod set-pos-and-scale hud ((obj hud) (arg0 symbol) (arg1 symbol)) 0 (none) ) ;; definition for method 14 of type hud -(defmethod dummy-14 hud ((obj hud)) +(defmethod hidden? hud ((obj hud)) (= (-> obj next-state name) 'hud-hidden) ) @@ -262,8 +262,8 @@ :enter (behavior () (set! (-> self offset) 128) - (dummy-17 self) - (dummy-18 self) + (draw-icons self) + (draw-particles self) (let ((gp-0 (-> self child))) (while gp-0 (send-event (ppointer->process gp-0) 'draw #f) @@ -294,7 +294,7 @@ (if (-> self deactivate-when-hidden) (deactivate self) ) - (TODO-RENAME-19 self) + (hud-update self) (none) ) ) @@ -309,9 +309,9 @@ (set! (-> self last-hide-time) (-> *display* base-frame-counter)) (set! (-> self force-on-screen) #f) (set! (-> self offset) 128) - (dummy-18 self) - (dummy-17 self) - (TODO-RENAME-19 self) + (draw-particles self) + (draw-icons self) + (hud-update self) (go hud-hidden) ) (('hide) @@ -366,7 +366,7 @@ (if (not (paused?)) (seekl! (-> self offset) 0 (the int (* 15.0 (-> *display* time-adjust-ratio)))) ) - (dummy-17 self) + (draw-icons self) (if (<= (-> self offset) 0) (go hud-in) ) @@ -374,9 +374,9 @@ (set! (-> self last-hide-time) (-> *display* base-frame-counter)) (set! (-> self force-on-screen) #f) (set! (-> self offset) 128) - (dummy-18 self) - (dummy-17 self) - (TODO-RENAME-19 self) + (draw-particles self) + (draw-icons self) + (hud-update self) (go hud-hidden) ) (suspend) @@ -385,9 +385,9 @@ ) :post (behavior () - (TODO-RENAME-19 self) - (dummy-18 self) - (dummy-15 self) + (hud-update self) + (draw-particles self) + (draw-hud self) (none) ) ) @@ -401,16 +401,16 @@ (set! (-> self trigger-time) (-> *display* base-frame-counter)) (while (and (< (- (-> *display* base-frame-counter) (-> self trigger-time)) (seconds 2)) (not (movie?))) (set! (-> self offset) 0) - (dummy-17 self) + (draw-icons self) (suspend) ) (when (movie?) (set! (-> self last-hide-time) (-> *display* base-frame-counter)) (set! (-> self force-on-screen) #f) (set! (-> self offset) 128) - (dummy-18 self) - (dummy-17 self) - (TODO-RENAME-19 self) + (draw-particles self) + (draw-icons self) + (hud-update self) (go hud-hidden) ) (go hud-leaving 5) @@ -430,14 +430,14 @@ (if (not (paused?)) (seekl! (-> self offset) 128 (the int (* (the float arg0) (-> *display* time-adjust-ratio)))) ) - (dummy-17 self) + (draw-icons self) (when (movie?) (set! (-> self last-hide-time) (-> *display* base-frame-counter)) (set! (-> self force-on-screen) #f) (set! (-> self offset) 128) - (dummy-18 self) - (dummy-17 self) - (TODO-RENAME-19 self) + (draw-particles self) + (draw-icons self) + (hud-update self) (go hud-hidden) ) (if (>= (-> self offset) 128) @@ -472,8 +472,8 @@ (logior! (-> self mask) (process-mask menu)) (logclear! (-> self mask) (process-mask pause progress)) (init-particles! self arg0) - (dummy-17 self) - (dummy-18 self) + (draw-icons self) + (draw-particles self) (go hud-hidden) (none) ) @@ -486,7 +486,7 @@ ) ;; failed to figure out what this is: -(defstate hud-collecting (collectable) +(defstate hud-collecting (process-drawable) :trans (behavior () (case (-> self type) @@ -500,17 +500,16 @@ (behavior ((arg0 handle)) (let ((s5-0 (new 'stack-no-clear 'vector))) (let ((s4-0 (handle->process arg0))) - (set! (-> s5-0 x) (- (the float (+ (first-icon-x (the-as hud s4-0)) -256)) (-> self root-override trans x))) - (set! (-> s5-0 y) (- (the float (- (first-icon-y (the-as hud s4-0)) (-> *video-parms* screen-sy))) - (-> self root-override trans y) - ) + (set! (-> s5-0 x) (- (the float (+ (get-icon-pos-x (the-as hud s4-0)) -256)) (-> self root trans x))) + (set! (-> s5-0 y) + (- (the float (- (get-icon-pos-y (the-as hud s4-0)) (-> *video-parms* screen-sy))) (-> self root trans y)) ) ) (let ((f30-0 4.0) (f26-0 0.0) - (f28-0 (-> self root-override scale x)) - (f24-0 (-> self root-override scale y)) - (f22-0 (-> self root-override scale z)) + (f28-0 (-> self root scale x)) + (f24-0 (-> self root scale y)) + (f22-0 (-> self root scale z)) ) (loop (let ((f0-7 (* f30-0 (-> *display* seconds-per-frame)))) @@ -521,17 +520,17 @@ ) (set! f26-0 1.0) ) - (+! (-> self root-override trans x) (* f0-7 (-> s5-0 x))) - (+! (-> self root-override trans y) (* f0-7 (-> s5-0 y))) + (+! (-> self root trans x) (* f0-7 (-> s5-0 x))) + (+! (-> self root trans y) (* f0-7 (-> s5-0 y))) ) (set-vector! - (-> self root-override scale) + (-> self root scale) (* f28-0 (-> *video-parms* relative-x-scale)) (* f24-0 (-> *video-parms* relative-y-scale) (-> *video-parms* relative-y-scale)) (* f22-0 (-> *video-parms* relative-x-scale)) 1.0 ) - (let ((a0-12 (-> self root-override))) + (let ((a0-12 (-> self root))) (set-yaw-angle-clear-roll-pitch! a0-12 (- (y-angle a0-12) (* 182.04445 (* 8.0 (-> *display* time-adjust-ratio)))) @@ -548,5 +547,5 @@ (none) ) :post - (the-as (function none :behavior collectable) ja-post) + ja-post ) diff --git a/test/decompiler/reference/levels/racer_common/racer-part_REF.gc b/test/decompiler/reference/levels/racer_common/racer-part_REF.gc index 921682b503..9fa208e6f5 100644 --- a/test/decompiler/reference/levels/racer_common/racer-part_REF.gc +++ b/test/decompiler/reference/levels/racer_common/racer-part_REF.gc @@ -365,9 +365,9 @@ ;; definition for method 19 of type hud-bike-heat ;; INFO: Return type mismatch int vs none. -(defmethod TODO-RENAME-19 hud-bike-heat ((obj hud-bike-heat)) +(defmethod hud-update hud-bike-heat ((obj hud-bike-heat)) (if *target* - (TODO-RENAME-16 obj (the int (-> *target* racer heat)) 0) + (tally-value obj (the int (-> *target* racer heat)) 0) ) 0 (none) @@ -454,9 +454,9 @@ ;; definition for method 19 of type hud-bike-speed ;; INFO: Return type mismatch int vs none. -(defmethod TODO-RENAME-19 hud-bike-speed ((obj hud-bike-speed)) +(defmethod hud-update hud-bike-speed ((obj hud-bike-speed)) (if *target* - (TODO-RENAME-16 obj (the int (-> *target* control unknown-float01)) 0) + (tally-value obj (the int (-> *target* control unknown-float01)) 0) ) 0 (none)