From 52bb1c491532bd73e8e2c0a5c414fe0311e725b0 Mon Sep 17 00:00:00 2001 From: Hat Kid <6624576+Hat-Kid@users.noreply.github.com> Date: Fri, 2 Sep 2022 00:25:42 +0200 Subject: [PATCH] decomp: `board-h`, `board-util`, `gun-util`, `darkjak-h` (#1817) * decomp: `board-util`, `gun-util`, `darkjak-h` * address changes and decompile `board-h` * fix `board-util` * remove `_type_` from `projectile` method * fix `gun-h.gc` * Update gun-h.gc --- decompiler/config/jak2/all-types.gc | 202 ++++--- decompiler/config/jak2/label_types.jsonc | 3 + decompiler/config/jak2/stack_structures.jsonc | 47 +- decompiler/config/jak2/type_casts.jsonc | 143 +++++ decompiler/util/data_decompile.cpp | 4 - goal_src/jak2/engine/anim/joint-h.gc | 68 +-- goal_src/jak2/engine/anim/joint-mod-h.gc | 14 +- goal_src/jak2/engine/anim/joint.gc | 4 +- .../jak2/engine/collide/collide-cache-h.gc | 10 +- goal_src/jak2/engine/collide/collide-h.gc | 4 +- goal_src/jak2/engine/data/art-h.gc | 3 +- goal_src/jak2/engine/entity/relocate.gc | 4 - goal_src/jak2/engine/game/game-h.gc | 4 +- goal_src/jak2/engine/level/level-h.gc | 2 +- goal_src/jak2/engine/target/board/board-h.gc | 288 ++++++++++ .../jak2/engine/target/board/board-util.gc | 256 +++++++++ goal_src/jak2/engine/target/darkjak-h.gc | 22 + goal_src/jak2/engine/target/gun/gun-h.gc | 194 ++++--- goal_src/jak2/engine/target/target-h.gc | 2 +- .../reference/jak2/engine/anim/joint-h_REF.gc | 68 +-- .../jak2/engine/anim/joint-mod-h_REF.gc | 1 + .../reference/jak2/engine/anim/joint_REF.gc | 8 +- .../engine/collide/collide-cache-h_REF.gc | 12 +- .../jak2/engine/collide/collide-h_REF.gc | 86 ++- .../engine/common_objs/projectile-h_REF.gc | 4 - .../reference/jak2/engine/data/art-h_REF.gc | 2 +- .../reference/jak2/engine/game/game-h_REF.gc | 4 +- .../jak2/engine/level/level-h_REF.gc | 2 +- .../jak2/engine/target/board/board-h_REF.gc | 492 ++++++++++++++++++ .../engine/target/board/board-util_REF.gc | 263 ++++++++++ .../jak2/engine/target/darkjak-h_REF.gc | 53 ++ .../jak2/engine/target/gun/gun-h_REF.gc | 188 +++---- test/offline/config/jak2/config.jsonc | 6 +- 33 files changed, 2012 insertions(+), 451 deletions(-) create mode 100644 test/decompiler/reference/jak2/engine/target/board/board-h_REF.gc create mode 100644 test/decompiler/reference/jak2/engine/target/board/board-util_REF.gc create mode 100644 test/decompiler/reference/jak2/engine/target/darkjak-h_REF.gc diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index 54c36dd63c..9b1ca9622b 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -5854,7 +5854,7 @@ (level-get-target-inside (_type_) level 20) ;; (art-group-get-by-name (_type_ string) art-group 20) (alloc-levels-if-needed (_type_ symbol) none 21) (load-commands-set! (_type_ pair) pair 22) ;; (update-vis-volumes (_type_) none 22) - (level-group-method-23 () none 23) ;; (update-vis-volumes-from-nav-mesh (_type_) none 23) + (art-group-get-by-name (_type_ string (pointer uint32)) art-group 23) ;; (update-vis-volumes-from-nav-mesh (_type_) none 23) (load-command-get-index (_type_ symbol int) pair 24) ;; (print-volume-sizes (_type_) none 24) (level-group-method-25 () none 25) ;; (level-status (_type_ symbol) symbol 25) (level-group-method-26 () none 26) @@ -10117,6 +10117,7 @@ (declare-type ripple-control basic) (declare-type shadow-control basic) +(declare-type shadow-geo basic) (deftype draw-control (basic) ((process process :offset-assert 4) @@ -10144,7 +10145,7 @@ (death-timer-org uint8) (death-vertex-skip uint16) (death-effect uint32) - (shadow uint32) + (shadow shadow-geo) (shadow-ctrl shadow-control :offset-assert 108) (distance meters) (origin vector :inline) @@ -12280,25 +12281,25 @@ (deftype top-anim-joint-control (basic) - ((process uint32 :offset-assert 4) - (interp-select uint64 2 :offset-assert 8) - (base-anim basic :offset-assert 24) - (base-anim-speed float :offset-assert 28) - (base-anim-blend float :offset-assert 32) - (interp float :offset-assert 36) - (frame-group basic :offset-assert 40) - (frame-group-push basic :offset-assert 44) - (frame-num float :offset-assert 48) - (frame-targ basic :offset-assert 52) - (frame-speed float :offset-assert 56) - (frame-blend float :offset-assert 60) - (frame-cur-blend float :offset-assert 64) - (frame-start float :offset-assert 68) - (frame-post-blend float :offset-assert 72) - (frame-post-end float :offset-assert 76) - (frame-push-time time-frame :offset-assert 80) - (frame-post-put-away basic :offset-assert 88) - (update-time time-frame :offset-assert 96) + ((process uint32 :offset-assert 4) + (interp-select uint64 2 :offset-assert 8) + (base-anim basic :offset-assert 24) + (base-anim-speed float :offset-assert 28) + (base-anim-blend float :offset-assert 32) + (interp float :offset-assert 36) + (frame-group art-joint-anim :offset-assert 40) + (frame-group-push basic :offset-assert 44) + (frame-num float :offset-assert 48) + (frame-targ basic :offset-assert 52) + (frame-speed float :offset-assert 56) + (frame-blend float :offset-assert 60) + (frame-cur-blend float :offset-assert 64) + (frame-start float :offset-assert 68) + (frame-post-blend float :offset-assert 72) + (frame-post-end float :offset-assert 76) + (frame-push-time time-frame :offset-assert 80) + (frame-post-put-away basic :offset-assert 88) + (update-time time-frame :offset-assert 96) ) :method-count-assert 13 :size-assert #x68 @@ -12331,7 +12332,7 @@ ((status joint-control-status) (allocated-length uint8) (active-channels uint8) - (root-channel (inline-array joint-control) :offset 16) + (root-channel (inline-array joint-control-channel) :offset 16) (blend-index uint8) (active-frame-interp uint8) (float-channels uint8) @@ -13582,8 +13583,8 @@ :size-assert #xc8 :flag-assert #x14005000c8 (:methods - (process-drawable-method-14 () none 14) ;; (initialize-skeleton (_type_ skeleton-group pair) none 14) - (process-drawable-method-15 () none 15) ;; (initialize-skeleton-by-name (_type_ string object) _type_ 15) + (initialize-skeleton (_type_ skeleton-group pair) none 14) + (initialize-skeleton-by-name (_type_ string object) draw-control 15) (process-drawable-method-16 () none 16) ;; (apply-alignment (_type_ align-opts transformq vector) collide-shape 16) (process-drawable-method-17 () none 17) ;; (do-joint-math! (_type_) none 17) (process-drawable-method-18 () none 18) ;; (cleanup-for-death (_type_) none 18) @@ -14296,9 +14297,16 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defenum joint-mod-mode - :bitfield #f - :type uint32 - + :bitfield #t + :type uint32 + (flex-blend 0) ;; 1 + (look-at 1) ;; 2 + (world-look-at 2) ;; 4 + (rotate 3) ;; 8 + (joint-set 4) ;; 16 + (joint-set* 5) ;; 32 + ;; ?? ;; 64 + (reset 7) ;; 128 ) ;; +++joint-mod-h:track-mode @@ -14360,7 +14368,7 @@ :flag-assert #x10000000b8 ;; Failed to read fields. (:methods - ;; (new (symbol type joint-mod-handler-mode process-drawable int) _type_ 0) + (new (symbol type joint-mod-mode process-drawable int) _type_ 0) (joint-mod-method-9 () none 9) ;; (set-mode! (_type_ joint-mod-handler-mode) _type_ 9) (joint-mod-method-10 () none 10) ;; (set-target! (_type_ vector) none 10) (joint-mod-method-11 () none 11) ;; (look-at-enemy! (_type_ vector symbol process) none 11) @@ -16185,6 +16193,7 @@ ;; missing ref test - there's a useless array defintion with a list of not-yet-defined types ;; and this doesn't work in goalc. +(declare-type shadow-geo basic) (declare-type sidekick basic) (declare-type racer-info basic) (declare-type tube-info basic) @@ -16196,7 +16205,7 @@ (deftype target (process-focusable) ((control control-info :score 1 :offset 128) ;; guessed by decompiler (skel2 basic :offset-assert 204) - (shadow-backup basic :offset-assert 208) + (shadow-backup shadow-geo :offset-assert 208) (target-flags uint32 :offset 188) (game game-info :offset-assert 212) ;; guessed by decompiler (neck joint-mod :offset-assert 216) ;; guessed by decompiler @@ -16608,6 +16617,8 @@ ) ) +(declare-type collide-query structure) + (deftype collide-cache (basic) ((num-tris int32 :offset-assert 4) (num-prims int32 :offset-assert 8) @@ -16626,13 +16637,13 @@ (:methods (collide-cache-method-9 () none 9) ;; (debug-draw (_type_) none 9) (fill-and-probe-using-line-sphere (_type_ vector vector float collide-spec process collide-tri-result pat-surface) float 10) - (collide-cache-method-11 () none 11) ;; (fill-and-probe-using-spheres (_type_ collide-using-spheres-params) symbol 11) - (collide-cache-method-12 () none 12) ;; (fill-and-probe-using-y-probe (_type_ vector float collide-kind process-drawable collide-tri-result pat-surface) float 12) + (fill-and-probe-using-spheres (_type_ collide-query) symbol 11) ;; (fill-and-probe-using-spheres (_type_ collide-using-spheres-params) symbol 11) + (collide-cache-method-12 (_type_ collide-query) none 12) ;; (fill-and-probe-using-y-probe (_type_ vector float collide-kind process-drawable collide-tri-result pat-surface) float 12) (collide-cache-method-13 () none 13) ;; (fill-using-bounding-box (_type_ bounding-box collide-kind process-drawable pat-surface) none 13) - (collide-cache-method-14 () none 14) ;; (fill-using-line-sphere (_type_ vector vector float collide-kind process-drawable pat-surface) none 14) + (fill-using-spheres (_type_ collide-query) none 14) ;; (fill-using-line-sphere (_type_ vector vector float collide-kind process-drawable pat-surface) none 14) (collide-cache-method-15 () none 15) ;; (fill-using-spheres (_type_ collide-using-spheres-params) none 15) (collide-cache-method-16 () none 16) ;; (fill-using-y-probe (_type_ vector float collide-kind process-drawable pat-surface) none 16) - (collide-cache-method-17 () none 17) ;; (initialize (_type_) none 17) + (probe-using-spheres (_type_ collide-query) symbol 17) ;; (initialize (_type_) none 17) (collide-cache-method-18 () none 18) ;; (probe-using-line-sphere (_type_ vector vector float collide-kind collide-tri-result pat-surface) float 18) (collide-cache-method-19 () none 19) ;; (probe-using-spheres (_type_ collide-using-spheres-params) symbol 19) (collide-cache-method-20 () none 20) ;; (probe-using-y-probe (_type_ vector float collide-kind collide-tri-result pat-surface) float 20) @@ -16688,14 +16699,14 @@ (exit-planes plane 2 :offset-assert 256) ;; ? (radius float :offset 268) (inv-mat matrix :inline :offset 288) - (spheres uint32 :offset 112) + (spheres (inline-array sphere) :offset 112 :score 1) (num-spheres uint32 :offset 116) - (solid-only basic :offset 120) - (best-dist float :offset 112 :score 1) + (solid-only symbol :offset 120) + (best-dist float :offset 112 :score -1) (best-other-prim basic :offset 116) (best-my-prim basic :offset 120) (move-vec vector :inline :offset 224) - (best-u float :offset 112) + (best-u float :offset 112 :score -1) (action-mask uint32 :offset-assert 352) (local-box4w bounding-box4w :inline :offset-assert 368) (search-box bounding-box4w :inline :offset-assert 400) @@ -22853,7 +22864,7 @@ ;; (define-extern sp-adjust-launch function) ;; (function sparticle-launchinfo sparticle-cpuinfo (inline-array sp-field-init-spec) none) ;; (define-extern sp-euler-convert function) ;; (function sparticle-launchinfo sparticle-cpuinfo none) ;; (define-extern sp-rotate-system function) ;; (function sparticle-launchinfo sparticle-cpuinfo transformq none) -;; (define-extern sp-launch-particles-var function) ;; (function sparticle-system sparticle-launcher vector sparticle-launch-state sparticle-launch-control float none) +(define-extern sp-launch-particles-var (function sparticle-system sparticle-launcher vector sparticle-launch-state sparticle-launch-control float none)) ;; (define-extern *death-adgif* object) ;; adgif-shader ;; (define-extern sp-launch-particles-death function) ;; (function sparticle-system sparticle-launcher vector none) ;; (define-extern sp-clear-queue function) ;; (function none) @@ -22884,7 +22895,7 @@ ;; (define-extern birth-func-y->userdata function) ;; (function sparticle-system sparticle-cpuinfo matrix none) ;; (define-extern birth-func-ocean-height function) ;; (function sparticle-system sparticle-cpuinfo matrix none) ;; (define-extern birth-func-camera-orient function) -;; (define-extern *particle-quat* object) ;; quaternion +(define-extern *particle-quat* quaternion) ;; (define-extern birth-func-set-quat function) ;; (function int sparticle-cpuinfo sparticle-launchinfo none) ;; (define-extern *particle-vel* object) ;; (define-extern birth-func-set-vel function) @@ -22895,8 +22906,8 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; (define-extern sp-particle-copy! function) ;; (function sparticle-cpuinfo sparticle-cpuinfo none) -;; (define-extern *sp-particle-system-2d* object) ;; sparticle-system -;; (define-extern *sp-particle-system-3d* object) ;; sparticle-system +(define-extern *sp-particle-system-2d* sparticle-system) +(define-extern *sp-particle-system-3d* sparticle-system) ;; (define-extern sp-get-block-size function) ;; (function sparticle-system int int) ;; (define-extern sp-get-approx-alloc-size function) ;; (function sparticle-system int int) ;; (define-extern sp-free-particle function) ;; (function sparticle-system int sparticle-cpuinfo sprite-vec-data-2d none) @@ -25611,24 +25622,24 @@ (define-extern process-drawable-art-error (state string process-drawable)) ;; (define-extern process-drawable-idle state) ;; (state process-drawable) ;; (define-extern skeleton-group->draw-control function) -;; (define-extern ja-done? function) ;; (function int symbol :behavior process-drawable) +(define-extern ja-done? (function int symbol :behavior process-drawable)) ;; (define-extern ja-min? function) ;; (function int symbol :behavior process-drawable) ;; (define-extern ja-max? function) ;; (function int symbol :behavior process-drawable) ;; (define-extern ja-num-frames function) ;; (function int int :behavior process-drawable) ;; (define-extern ja-frame-num function) ;; (function int float :behavior process-drawable) ;; (define-extern ja-aframe-num function) ;; (function int float :behavior process-drawable) -;; (define-extern ja-aframe function) ;; (function float int float :behavior process-drawable) +(define-extern ja-aframe (function float int float :behavior process-drawable)) ;; (define-extern ja-speed function) ;; (function int float :behavior process-drawable) ;; (define-extern ja-step function) ;; (function int float :behavior process-drawable) -;; (define-extern ja-channel-set! function) ;; (function int int :behavior process-drawable) -;; (define-extern ja-channel-push! function) ;; (function int time-frame int :behavior process-drawable) +(define-extern ja-channel-set! (function int int :behavior process-drawable)) +(define-extern ja-channel-push! (function int time-frame int :behavior process-drawable)) ;; (define-extern ja-channel-float! function) (define-extern joint-control-reset! (function joint-control joint-control-channel none :behavior process-drawable)) ;; (define-extern ja-group-size function) ;; (function int :behavior process-drawable) ;; (define-extern ja-eval function) ;; (function int :behavior process-drawable) ;; (define-extern ja-blend-eval function) ;; (function int :behavior process-drawable) -;; (define-extern ja-post function) ;; (function none :behavior process-drawable) -;; (define-extern sleep-code function) +(define-extern ja-post (function none :behavior process-drawable)) +(define-extern sleep-code (function symbol)) ;; (define-extern transform-and-sleep function) ;; (define-extern transform-and-sleep-code function) ;; (define-extern transform-post function) ;; (function int :behavior process-drawable) @@ -25919,28 +25930,28 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (deftype gun (process-drawable) - ((control basic :offset 128) - (shadow-backup basic :offset 208) + ((control control-info :offset 128) + (shadow-backup shadow-geo :offset 208) (read-scale basic :offset-assert 212) (gun-type pickup-type :offset-assert 216) - (barrel basic :offset-assert 220) - (mag basic 4 :offset-assert 224) ;; guessed type + (barrel joint-mod :offset-assert 220) + (mag joint-mod 4 :offset-assert 224) ;; guessed type (mag-scale float 4 :offset-assert 240) ) :method-count-assert 24 :size-assert #x100 :flag-assert #x1800800100 (:methods - (gun-method-20 () none 20) - (gun-method-21 () none 21) - (gun-method-22 () none 22) - (gun-method-23 () none 23) + (idle () _type_ :state 20) + (use (symbol) _type_ :state 21) + (hidden () _type_ :state 22) + (die () _type_ :state 23) ) ) (deftype gun-info (basic) - ((process uint32 :offset-assert 4) - (gun uint32 :offset-assert 8) + ((process (pointer target) :offset-assert 4) + (gun (pointer gun) :offset-assert 8) (gun-pos transformq :inline :offset-assert 16) (gun-trans vector :inline :offset 16) (gun-quat quaternion :inline :offset 32) @@ -26026,7 +26037,7 @@ :size-assert #x2c0 :flag-assert #xa000002c0 (:methods - (gun-info-method-9 () none 9) + (gun-info-method-9 (_type_) none 9) ) ) @@ -26041,17 +26052,17 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (deftype board (process-drawable) - ((control basic :score 1 :offset 128) - (shadow-backup basic :offset 208) - (main basic :offset 212) + ((control control-info :offset 128) + (shadow-backup shadow-geo :offset 208) + (main joint-mod :offset 212) ) :method-count-assert 23 :size-assert #xd8 :flag-assert #x17006000d8 (:methods - (board-method-20 () none 20) - (board-method-21 () none 21) - (board-method-22 () none 22) + (idle (symbol) _type_ :state 20) + (use () _type_ :state 21) + (hidden () _type_ :state 22) ) ) @@ -26062,7 +26073,7 @@ (board-trans vector :inline :offset-assert 16) (board-quat vector :inline :offset-assert 32) (board-scale vector :inline :offset-assert 48) - (main basic :offset-assert 64) + (main joint-mod :offset-assert 64) (upper-body basic :offset-assert 68) (sound-bank-knob float :offset-assert 72) (sound-air-knob float :offset-assert 76) @@ -26218,7 +26229,6 @@ ;; darkjak-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype darkjak-info (basic) ((process uint32 :offset-assert 4) (attack-id uint32 :offset-assert 8) @@ -26229,20 +26239,18 @@ (want-stage uint32 :offset-assert 44) (clock-pos float :offset-assert 48) (clock-vel float :offset-assert 52) - (clock-on basic :offset-assert 56) - (hud UNKNOWN 1 :offset-assert 64) - (tone uint32 :offset-assert 72) - (bomb uint32 :offset-assert 76) + (clock-on symbol :offset-assert 56) + (hud handle 1 :offset 64) + (tone uint32 :offset 72) + (bomb uint32 :offset 76) ) :method-count-assert 10 :size-assert #x50 :flag-assert #xa00000050 (:methods - (darkjak-info-method-9 () none 9) + (darkjak-info-method-9 (_type_ int) none :behavior target 9) ) ) -|# - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; target-util ;; @@ -26360,7 +26368,7 @@ ) |# -;; (define-extern *target-shadow-control* shadow-control) ;; shadow-control +(define-extern *target-shadow-control* shadow-control) ;; (define-extern *TARGET-bank* target-bank) ;; target-bank ;; (define-extern target-start-attack function) ;; (function none :behavior target) ;; (define-extern target-danger-set! function) ;; (function symbol symbol float :behavior target) @@ -26774,7 +26782,7 @@ ;; (define-extern target-hide state) ;; (define-extern target-launch state) ;; (state float symbol vector int target) ;; (define-extern target-play-anim state) ;; (state string handle target) -;; (define-extern target-clone-anim state) ;; (state handle target) +(define-extern target-clone-anim (state handle target)) ;; (define-extern *float-mods* object) ;; (define-extern target-float state) @@ -26885,10 +26893,10 @@ ;; (define-extern target-gun-combo-start function) ;; (define-extern target-gun-joint-pre0 function) ;; (define-extern target-gun-joint-pre function) -;; (define-extern target-gun-compute-pos function) +(define-extern target-gun-compute-pos (function matrix :behavior target)) ;; (define-extern target-gun-joint-points function) ;; (define-extern target-gun-fire function) -;; (define-extern target-gun-check function) +(define-extern target-gun-check (function none :behavior target)) ;; (define-extern camera-rotate-to-vector function) ;; (define-extern target-gun-real-post function) ;; (define-extern target-gun-post function) @@ -26897,7 +26905,6 @@ ;; gun-util ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype gun-eject (projectile-bounce) () :method-count-assert 42 @@ -26906,9 +26913,7 @@ (:methods ) ) -|# -#| (deftype gun-mag-yellow (projectile-bounce) () :method-count-assert 42 @@ -26917,9 +26922,7 @@ (:methods ) ) -|# -#| (deftype gun-mag-red (projectile-bounce) () :method-count-assert 42 @@ -26928,9 +26931,7 @@ (:methods ) ) -|# -#| (deftype gun-mag-blue (projectile-bounce) () :method-count-assert 42 @@ -26939,9 +26940,7 @@ (:methods ) ) -|# -#| (deftype gun-mag-dark (projectile-bounce) () :method-count-assert 42 @@ -26950,9 +26949,7 @@ (:methods ) ) -|# -#| (deftype beam-info (structure) ((y-scale float :offset-assert 0) ) @@ -26960,14 +26957,13 @@ :size-assert #x4 :flag-assert #x900000004 ) -|# -;; (define-extern *beam-info* object) -;; (define-extern birth-func-setup-beam function) -;; (define-extern birth-func-laser-pointer function) -;; (define-extern draw-beam function) -;; (define-extern gun-post function) -;; (define-extern gun-init function) +(define-extern *beam-info* beam-info) +(define-extern birth-func-setup-beam (function int sparticle-cpuinfo sparticle-launchinfo none)) +(define-extern birth-func-laser-pointer (function int sparticle-cpuinfo sparticle-launchinfo none)) +(define-extern draw-beam (function sparticle-launcher vector vector symbol symbol none)) ;; probably wrong args +(define-extern gun-post (function none :behavior gun)) +(define-extern gun-init (function none :behavior gun)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; gun-blue-shot ;; @@ -26995,11 +26991,10 @@ ;; gun-yellow-shot ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype gun-yellow-shot (projectile) - ((hit-actor? basic :offset-assert 468) - (tail-pos vector :inline :offset-assert 476) - (hit-pos vector :inline :offset-assert 492) + ((hit-actor? symbol :offset-assert 472) + (tail-pos vector :inline :offset-assert 480) + (hit-pos vector :inline :offset-assert 496) ) :method-count-assert 40 :size-assert #x200 @@ -27007,9 +27002,8 @@ (:methods ) ) -|# -;; (define-extern target-gun-fire-yellow function) +(define-extern target-gun-fire-yellow (function none :behavior target)) ;; (define-extern someone-fire-yellow function) ;; (define-extern gun-yellow-shot-move function) @@ -27094,8 +27088,8 @@ ;; board-util ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern board-post function) -;; (define-extern board-init function) +(define-extern board-post (function none :behavior board)) +(define-extern board-init (function none :behavior board)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; target-board ;; @@ -27408,7 +27402,7 @@ (define-extern sphere-cull (function vector symbol)) (define-extern guard-band-cull (function vector symbol)) (define-extern sphere-in-view-frustum? (function sphere symbol)) -;; (define-extern line-in-view-frustum? function) ;; (function vector vector symbol) +(define-extern line-in-view-frustum? (function vector vector symbol)) (define-extern vis-cull (function int symbol)) ;; (define-extern vis-cull-debug function) (define-extern error-sphere (function drawable-error string none)) diff --git a/decompiler/config/jak2/label_types.jsonc b/decompiler/config/jak2/label_types.jsonc index 977f739e80..fd258bcaea 100644 --- a/decompiler/config/jak2/label_types.jsonc +++ b/decompiler/config/jak2/label_types.jsonc @@ -108,5 +108,8 @@ ["L773", "(pointer uint64)", 1], ["L774", "(pointer uint64)", 1], ["L775", "(pointer uint64)", 1] + ], + "collide-cache": [ + ["L171", "vector"] ] } diff --git a/decompiler/config/jak2/stack_structures.jsonc b/decompiler/config/jak2/stack_structures.jsonc index ae30831e69..f3ce00f43b 100644 --- a/decompiler/config/jak2/stack_structures.jsonc +++ b/decompiler/config/jak2/stack_structures.jsonc @@ -182,11 +182,12 @@ ], "(method 22 rigid-body)": [[16, "vector"]], "want-to-board?": [ - [16, "vector"], - [560, "matrix"], + [16, "collide-query"], + [560, ["inline-array", "sphere", 3]], [608, "vector"] ], "(method 10 cam-setting-data)": [[16, "event-message-block"]], + "(method 18 tracking-spline)": [ [16, "tracking-spline-sampler"], [32, "tracking-spline-sampler"] @@ -301,6 +302,48 @@ [32, "vector4w"] ], "cam-debug-draw-tris": [[16, "vector4w"]], + + "(code die gun)": [ + [16, "matrix"], + [112, "vector"], + [128, "vector"], + [144, "vector"] + ], + + "draw-beam": [ + [16, "vector"], + [32, "vector"], + [48, "vector"] + ], + + "gun-post": [ + [16, "vector"], + [32, "vector"], + [48, "matrix"], + [144, "vector"], + [160, "vector"], + [176, "vector"] + ], + + "(method 9 gun-info)": [ + [16, "collide-query"], + [560, "vector"], + [576, "vector"], + [592, "vector"], + [608, "vector"], + [624, "vector"], + [640, "vector"], + [656, "vector"] + ], + + "target-gun-fire-yellow": [ + [16, "matrix"], + [112, "event-message-block"] + ], + + "(method 14 collide-cache)": [ + [16, "bounding-box"] + ], // placeholder "placeholder-do-not-add-below": [] } diff --git a/decompiler/config/jak2/type_casts.jsonc b/decompiler/config/jak2/type_casts.jsonc index f6d58b4662..467408e0a4 100644 --- a/decompiler/config/jak2/type_casts.jsonc +++ b/decompiler/config/jak2/type_casts.jsonc @@ -1239,6 +1239,149 @@ ], "cam-collision-record-save": [[[8, 56], "v1", "cam-collision-record"]], "(trans cam-stick)": [[157, "a0", "vector"]], + "(method 9 darkjak-info)": [ + [71, "v0", "sound-rpc-set-param"] + ], + "(trans idle board)": [ + [4, "a0", "target"] + ], + "(trans hidden board)": [ + [4, "a0", "target"] + ], + "(trans use board)": [ + [8, "a0", "target"], + [22, "a1", "target"] + ], + "board-post": [ + [[3, 79], "v1", "target"], + [38, "a0", "target"], + [44, "a0", "target"], + [50, "a0", "target"], + [56, "a0", "target"], + [62, "a0", "target"], + [94, "v1", "target"] + ], + "(code use board)": [ + [17, "v1", "art-joint-anim"] + ], + "(code idle board)": [ + [19, "v1", "art-joint-anim"], + [37, "v1", "art-joint-anim"] + ], + "gun-init": [ + [85, "a1", "target"] + ], + "gun-post": [ + [7, "a0", "target"], + [12, "gp", "target"], + [16, "gp", "target"], + [22, "gp", "target"], + [31, "gp", "target"], + [42, "gp", "target"], + [46, "gp", "target"], + [57, "gp", "target"], + [[64, 77], "gp", "target"], + [82, "v1", "target"], + [88, "v1", "target"], + [94, "v1", "target"], + [100, "v1", "target"], + [106, "v1", "target"], + [110, "gp", "target"], + [121, "gp", "target"], + [126, "gp", "target"], + [132, "gp", "target"], + [148, "gp", "target"], + [169, "a0", "target"] + ], + "(trans hidden gun)": [ + [4, "a0", "target"] + ], + "(code idle gun)": [ + [16, "v1", "art-joint-anim"] + ], + "(trans idle gun)": [ + [2, "v1", "target"], + [9, "a0", "target"], + [20, "v1", "target"] + ], + "(code die gun)": [ + [13, "v1", "target"], + [74, "v1", "target"] + ], + "(post use gun)": [ + [6, "gp", "target"], + [12, "gp", "target"], + [21, "gp", "target"], + [29, "gp", "target"], + [34, "gp", "target"], + [36, "gp", "target"], + [40, "gp", "target"], + [57, "gp", "target"], + [63, "gp", "target"], + [65, "gp", "target"], + [67, "gp", "target"], + [71, "gp", "target"], + [75, "gp", "target"], + [77, "gp", "target"], + [83, "gp", "target"], + [91, "gp", "target"], + [93, "gp", "target"], + [96, "a0", "vector"], + [99, "gp", "target"], + [101, "gp", "target"], + [103, "gp", "target"], + [109, "gp", "target"], + [114, "gp", "target"], + [116, "gp", "target"], + [120, "gp", "target"], + [122, "gp", "target"], + [127, "gp", "target"], + [129, "gp", "target"], + [132, "a0", "vector"], + [136, "s6", "target"] + ], + "(code use gun)": [ + [7, "a0", "target"], + [27, "v1", "art-joint-anim"], + [87, "v1", "art-joint-anim"], + [152, "v1", "art-joint-anim"], + [207, "v1", "art-joint-anim"], + [262, "v1", "art-joint-anim"], + [312, "v1", "art-joint-anim"], + [377, "v1", "art-joint-anim"], + [427, "v1", "art-joint-anim"], + [487, "v1", "art-joint-anim"], + [547, "v1", "art-joint-anim"], + [612, "v1", "art-joint-anim"], + [667, "v1", "art-joint-anim"], + [726, "s4", "target"], + [741, "s1", "pair"], + [753, "s4", "target"], + [774, "s4", "target"], + [795, "s1", "pair"], + [801, "s4", "target"], + [804, "s4", "target"] + ], + "(trans use gun)": [ + [8, "a1", "target"], + [19, "a0", "target"], + [23, "v1", "target"], + [28, "v1", "target"], + [44, "v1", "target"] + ], + "(method 31 gun-eject)": [ + [24, "a0", "gun"], + [36, "v1", "gun"], + [44, "v1", "collide-shape"] + ], + "(method 9 gun-info)": [ + [115, "s0", "collide-shape-prim"], + [133, "s0", "collide-shape-prim"] + ], + "(method 3 collide-query)": [ + [116, "f0", "float"], + [137, "f0", "float"] + ], // placeholder "placeholder-do-not-add-below": [] } diff --git a/decompiler/util/data_decompile.cpp b/decompiler/util/data_decompile.cpp index 268ac56904..64669e9827 100644 --- a/decompiler/util/data_decompile.cpp +++ b/decompiler/util/data_decompile.cpp @@ -1568,10 +1568,6 @@ goos::Object decompile_pair(const DecompilerLabel& label, fmt::format("Invalid alignment for pair {}\n", to_print.offset % 16)); } else { auto& word = words.at(to_print.target_segment).at(to_print.offset / 4); - if (word.kind() != LinkedWord::EMPTY_PTR) { - throw std::runtime_error( - fmt::format("Based on alignment, expected to get empty list for pair, but didn't")); - } // improper list lg::error( "There is an improper list. This is probably okay, but should be checked manually " diff --git a/goal_src/jak2/engine/anim/joint-h.gc b/goal_src/jak2/engine/anim/joint-h.gc index fa6d93e0ed..2c45faec38 100644 --- a/goal_src/jak2/engine/anim/joint-h.gc +++ b/goal_src/jak2/engine/anim/joint-h.gc @@ -53,25 +53,25 @@ ) (deftype top-anim-joint-control (basic) - ((process uint32 :offset-assert 4) - (interp-select uint64 2 :offset-assert 8) - (base-anim basic :offset-assert 24) - (base-anim-speed float :offset-assert 28) - (base-anim-blend float :offset-assert 32) - (interp float :offset-assert 36) - (frame-group basic :offset-assert 40) - (frame-group-push basic :offset-assert 44) - (frame-num float :offset-assert 48) - (frame-targ basic :offset-assert 52) - (frame-speed float :offset-assert 56) - (frame-blend float :offset-assert 60) - (frame-cur-blend float :offset-assert 64) - (frame-start float :offset-assert 68) - (frame-post-blend float :offset-assert 72) - (frame-post-end float :offset-assert 76) - (frame-push-time time-frame :offset-assert 80) - (frame-post-put-away basic :offset-assert 88) - (update-time time-frame :offset-assert 96) + ((process uint32 :offset-assert 4) + (interp-select uint64 2 :offset-assert 8) + (base-anim basic :offset-assert 24) + (base-anim-speed float :offset-assert 28) + (base-anim-blend float :offset-assert 32) + (interp float :offset-assert 36) + (frame-group art-joint-anim :offset-assert 40) + (frame-group-push basic :offset-assert 44) + (frame-num float :offset-assert 48) + (frame-targ basic :offset-assert 52) + (frame-speed float :offset-assert 56) + (frame-blend float :offset-assert 60) + (frame-cur-blend float :offset-assert 64) + (frame-start float :offset-assert 68) + (frame-post-blend float :offset-assert 72) + (frame-post-end float :offset-assert 76) + (frame-push-time time-frame :offset-assert 80) + (frame-post-put-away basic :offset-assert 88) + (update-time time-frame :offset-assert 96) ) :method-count-assert 13 :size-assert #x68 @@ -85,21 +85,21 @@ ) (deftype joint-control (basic) - ((status joint-control-status :offset-assert 4) - (allocated-length uint8 :offset-assert 6) - (active-channels uint8 :offset-assert 7) - (root-channel (inline-array joint-control) :offset 16) - (blend-index uint8 :offset-assert 20) - (active-frame-interp uint8 :offset-assert 21) - (float-channels uint8 :offset-assert 22) - (generate-frame-function function :offset-assert 24) - (prebind-function function :offset-assert 28) - (postbind-function function :offset-assert 32) - (effect basic :offset-assert 36) - (interp-select int64 2 :offset-assert 40) - (top-anim top-anim-joint-control :offset-assert 56) - (override basic :offset-assert 60) - (channel joint-control-channel :inline :dynamic :offset-assert 64) + ((status joint-control-status :offset-assert 4) + (allocated-length uint8 :offset-assert 6) + (active-channels uint8 :offset-assert 7) + (root-channel (inline-array joint-control-channel) :offset 16) + (blend-index uint8 :offset-assert 20) + (active-frame-interp uint8 :offset-assert 21) + (float-channels uint8 :offset-assert 22) + (generate-frame-function function :offset-assert 24) + (prebind-function function :offset-assert 28) + (postbind-function function :offset-assert 32) + (effect basic :offset-assert 36) + (interp-select int64 2 :offset-assert 40) + (top-anim top-anim-joint-control :offset-assert 56) + (override basic :offset-assert 60) + (channel joint-control-channel :inline :dynamic :offset-assert 64) ) :method-count-assert 12 :size-assert #x40 diff --git a/goal_src/jak2/engine/anim/joint-mod-h.gc b/goal_src/jak2/engine/anim/joint-mod-h.gc index d414ee66aa..35e962d582 100644 --- a/goal_src/jak2/engine/anim/joint-mod-h.gc +++ b/goal_src/jak2/engine/anim/joint-mod-h.gc @@ -6,9 +6,16 @@ ;; dgos: ENGINE, GAME (defenum joint-mod-mode - :bitfield #f - :type uint32 - + :bitfield #t + :type uint32 + (flex-blend 0) ;; 1 + (look-at 1) ;; 2 + (world-look-at 2) ;; 4 + (rotate 3) ;; 8 + (joint-set 4) ;; 16 + (joint-set* 5) ;; 32 + ;; ?? ;; 64 + (reset 7) ;; 128 ) ;; +++track-mode @@ -74,6 +81,7 @@ :size-assert #xb8 :flag-assert #x10000000b8 (:methods + (new (symbol type joint-mod-mode process-drawable int) _type_ 0) (joint-mod-method-9 () none 9) (joint-mod-method-10 () none 10) (joint-mod-method-11 () none 11) diff --git a/goal_src/jak2/engine/anim/joint.gc b/goal_src/jak2/engine/anim/joint.gc index ad4dfc0cd2..474ae129f1 100644 --- a/goal_src/jak2/engine/anim/joint.gc +++ b/goal_src/jak2/engine/anim/joint.gc @@ -158,7 +158,7 @@ (set! (-> v0-0 allocated-length) (the-as uint arg0)) (set! (-> v0-0 active-channels) (the-as uint 0)) (set! (-> v0-0 float-channels) (the-as uint 0)) - (set! (-> v0-0 root-channel) (the-as (inline-array joint-control) (-> v0-0 channel))) + (set! (-> v0-0 root-channel) (the-as (inline-array joint-control-channel) (-> v0-0 channel))) (set! (-> v0-0 generate-frame-function) create-interpolated-joint-animation-frame) (set! (-> v0-0 prebind-function) #f) (set! (-> v0-0 postbind-function) #f) @@ -667,7 +667,7 @@ (set! (-> arg0 float-channels) (the-as uint 0)) (set! (-> arg0 root-channel) (the-as - (inline-array joint-control) + (inline-array joint-control-channel) (-> arg0 channel (/ (the-as int (- (the-as uint (-> arg1 root-channel)) (the-as uint (the-as uint (-> arg1 channel))))) 64) diff --git a/goal_src/jak2/engine/collide/collide-cache-h.gc b/goal_src/jak2/engine/collide/collide-cache-h.gc index 0586c049c8..9a5753241e 100644 --- a/goal_src/jak2/engine/collide/collide-cache-h.gc +++ b/goal_src/jak2/engine/collide/collide-cache-h.gc @@ -5,6 +5,8 @@ ;; name in dgo: collide-cache-h ;; dgos: ENGINE, GAME +(declare-type collide-query structure) + ;; DECOMP BEGINS (deftype collide-puss-sphere (structure) @@ -90,13 +92,13 @@ (:methods (collide-cache-method-9 () none 9) (fill-and-probe-using-line-sphere (_type_ vector vector float collide-spec process collide-tri-result pat-surface) float 10) - (collide-cache-method-11 () none 11) - (collide-cache-method-12 () none 12) + (fill-and-probe-using-spheres (_type_ collide-query) symbol 11) + (collide-cache-method-12 (_type_ collide-query) none 12) (collide-cache-method-13 () none 13) - (collide-cache-method-14 () none 14) + (fill-using-spheres (_type_ collide-query) none 14) (collide-cache-method-15 () none 15) (collide-cache-method-16 () none 16) - (collide-cache-method-17 () none 17) + (probe-using-spheres (_type_ collide-query) symbol 17) (collide-cache-method-18 () none 18) (collide-cache-method-19 () none 19) (collide-cache-method-20 () none 20) diff --git a/goal_src/jak2/engine/collide/collide-h.gc b/goal_src/jak2/engine/collide/collide-h.gc index 3350f00687..495895f142 100644 --- a/goal_src/jak2/engine/collide/collide-h.gc +++ b/goal_src/jak2/engine/collide/collide-h.gc @@ -25,9 +25,9 @@ (exit-planes plane 2 :offset-assert 256) (radius float :offset 268) (inv-mat matrix :inline :offset 288) - (spheres uint32 :offset 112) + (spheres (inline-array sphere) :offset 112) (num-spheres uint32 :offset 116) - (solid-only basic :offset 120) + (solid-only symbol :offset 120) (best-dist float :offset 112) (best-other-prim basic :offset 116) (best-my-prim basic :offset 120) diff --git a/goal_src/jak2/engine/data/art-h.gc b/goal_src/jak2/engine/data/art-h.gc index b0bf3bfb45..fac097f91b 100644 --- a/goal_src/jak2/engine/data/art-h.gc +++ b/goal_src/jak2/engine/data/art-h.gc @@ -9,6 +9,7 @@ (declare-type merc-ctrl art-element) (declare-type ripple-control basic) (declare-type shadow-control basic) +(declare-type shadow-geo basic) (declare-type merc-eye-anim-block structure) (defenum draw-control-status @@ -364,7 +365,7 @@ (death-timer-org uint8 :offset-assert 97) (death-vertex-skip uint16 :offset-assert 98) (death-effect uint32 :offset-assert 100) - (shadow uint32 :offset-assert 104) + (shadow shadow-geo :offset-assert 104) (shadow-ctrl shadow-control :offset-assert 108) (distance meters :offset-assert 112) (origin vector :inline :offset-assert 128) diff --git a/goal_src/jak2/engine/entity/relocate.gc b/goal_src/jak2/engine/entity/relocate.gc index cc22887475..8d3e97014f 100644 --- a/goal_src/jak2/engine/entity/relocate.gc +++ b/goal_src/jak2/engine/entity/relocate.gc @@ -390,7 +390,3 @@ ) (the-as manipy ((method-of-type process-drawable relocate) obj arg0)) ) - - - - diff --git a/goal_src/jak2/engine/game/game-h.gc b/goal_src/jak2/engine/game/game-h.gc index 19aee8644d..9386c0de82 100644 --- a/goal_src/jak2/engine/game/game-h.gc +++ b/goal_src/jak2/engine/game/game-h.gc @@ -105,8 +105,8 @@ :size-assert #xc8 :flag-assert #x14005000c8 (:methods - (process-drawable-method-14 () none 14) - (process-drawable-method-15 () none 15) + (initialize-skeleton (_type_ skeleton-group pair) none 14) + (initialize-skeleton-by-name (_type_ string object) draw-control 15) (process-drawable-method-16 () none 16) (process-drawable-method-17 () none 17) (process-drawable-method-18 () none 18) diff --git a/goal_src/jak2/engine/level/level-h.gc b/goal_src/jak2/engine/level/level-h.gc index f5357d346e..d58ec8e940 100644 --- a/goal_src/jak2/engine/level/level-h.gc +++ b/goal_src/jak2/engine/level/level-h.gc @@ -361,7 +361,7 @@ (level-get-target-inside (_type_) level 20) (alloc-levels-if-needed (_type_ symbol) none 21) (load-commands-set! (_type_ pair) pair 22) - (level-group-method-23 () none 23) + (art-group-get-by-name (_type_ string (pointer uint32)) art-group 23) (load-command-get-index (_type_ symbol int) pair 24) (level-group-method-25 () none 25) (level-group-method-26 () none 26) diff --git a/goal_src/jak2/engine/target/board/board-h.gc b/goal_src/jak2/engine/target/board/board-h.gc index f49fcd65c7..60601dda92 100644 --- a/goal_src/jak2/engine/target/board/board-h.gc +++ b/goal_src/jak2/engine/target/board/board-h.gc @@ -7,3 +7,291 @@ ;; DECOMP BEGINS +(deftype board (process-drawable) + ((control control-info :offset 128) + (shadow-backup shadow-geo :offset 208) + (main joint-mod :offset 212) + ) + :heap-base #x60 + :method-count-assert 23 + :size-assert #xd8 + :flag-assert #x17006000d8 + (:methods + (idle (symbol) _type_ :state 20) + (use () _type_ :state 21) + (hidden () _type_ :state 22) + ) + ) + +(deftype board-info (basic) + ((board uint32 :offset-assert 4) + (camera-interp float :offset-assert 8) + (process uint32 :offset-assert 12) + (board-trans vector :inline :offset-assert 16) + (board-quat vector :inline :offset-assert 32) + (board-scale vector :inline :offset-assert 48) + (main joint-mod :offset-assert 64) + (upper-body basic :offset-assert 68) + (sound-bank-knob float :offset-assert 72) + (sound-air-knob float :offset-assert 76) + (wind-sound-id uint32 :offset-assert 80) + (wind-sound-pitch float :offset-assert 84) + (wind-sound-volume float :offset-assert 88) + (engine-sound-id uint32 :offset-assert 92) + (engine-sound-pitch float :offset-assert 96) + (engine-sound-volume float :offset-assert 100) + (bank-sound-id uint32 :offset-assert 104) + (bank-sound-pitch float :offset-assert 108) + (bank-sound-volume float :offset-assert 112) + (ride-sound-id uint32 :offset-assert 116) + (spin-sound-id uint32 :offset-assert 120) + (spin-sound-volume float :offset-assert 124) + (spin-sound-pitch float :offset-assert 128) + (up-vector vector 2 :inline :offset-assert 144) + (slow-transv vector :inline :offset-assert 176) + (board-time time-frame :offset-assert 192) + (board-get-on-time time-frame :offset-assert 200) + (in-air-time time-frame :offset-assert 208) + (stick-lock basic :offset 240) + (stick-off basic :offset-assert 244) + (stance-info ground-tween-info :inline :offset-assert 248) + (mods-backup basic :offset-assert 284) + (attack-id uint32 :offset-assert 288) + (latch? symbol :offset-assert 292) + (unstuck-time time-frame :offset 344) + (stuck-count int32 :offset-assert 352) + (thrust-scale float :offset-assert 356) + (flip-time time-frame :offset-assert 360) + (transv-max meters :offset-assert 368) + (turn-anim-tilt? symbol :offset-assert 372) + (turn-anim-mag float :offset-assert 376) + (turn-anim-targ float :offset-assert 380) + (turn-anim-frame float :offset-assert 384) + (turn-anim-vel float :offset-assert 388) + (turn-anim-duck float :offset-assert 392) + (turn-anim-duck-vel float :offset-assert 396) + (tilt-anim-frame vector :inline :offset-assert 400) + (tilt-anim-target vector :inline :offset-assert 416) + (smack-surface-time time-frame :offset-assert 432) + (smack-speed meters :offset-assert 440) + (smack-normal vector :inline :offset-assert 448) + (glance-time time-frame :offset-assert 464) + (glance-speed meters :offset-assert 472) + (glance-in-transv vector :inline :offset-assert 480) + (glance-out-transv vector :inline :offset-assert 496) + (glance-normal vector :inline :offset-assert 512) + (on-flat-time time-frame :offset-assert 528) + (jump-land-time time-frame :offset-assert 536) + (slip-factor float :offset-assert 544) + (ground-on-dir vector :inline :offset-assert 560) + (ride-time time-frame :offset-assert 576) + (ride-start-time time-frame :offset-assert 584) + (ride-button-time time-frame :offset-assert 592) + (ride-lean-targ float :offset-assert 600) + (ride-lean float :offset-assert 604) + (ride-leanv float :offset-assert 608) + (ride-lean-mag float :offset-assert 612) + (ride-tilt-targ float :offset-assert 616) + (ride-tilt float :offset-assert 620) + (ride-tiltv float :offset-assert 624) + (ride-tilt-mag float :offset-assert 628) + (ride-lock symbol :offset-assert 632) + (ride-lock-on symbol :offset-assert 636) + (ride-speed meters :offset-assert 640) + (ride-mode uint32 :offset-assert 644) + (ride-rot degrees :offset-assert 648) + (ride-rot-old degrees :offset-assert 652) + (ride-rot-abs degrees 2 :offset-assert 656) + (ride-rtv-abs degrees :offset-assert 664) + (ride-touch-segment vector 2 :inline :offset-assert 672) + (ride-dir vector :inline :offset-assert 704) + (ride-vertex-length int16 :offset-assert 720) + (ride-vertex-length-old int16 :offset-assert 722) + (ride-vertex-base int16 :offset-assert 724) + (ride-vertex-base2 int16 :offset-assert 726) + (ride-vertex-index float :offset-assert 728) + (ride-vertex-index2 float :offset-assert 732) + (ride-vertex-index-old float :offset-assert 736) + (ride-vertex vector 3 :inline :offset-assert 752) + (ride-segment vector :inline :offset-assert 800) + (ride-dir-lean vector :inline :offset-assert 816) + (ride-pad-vector vector 1 :inline :offset-assert 832) + (ride-vertex-old vector 3 :inline :offset-assert 848) + (ride-segment-old vector :inline :offset-assert 896) + (ride-vertex-trail vector 128 :inline :offset-assert 912) + (halfpipe-side-time time-frame :offset-assert 2960) + (halfpipe-jump-time time-frame :offset-assert 2968) + (halfpipe-lip-time time-frame :offset-assert 2976) + (halfpipe-time time-frame :offset-assert 2984) + (halfpipe-gspot-time time-frame :offset-assert 2992) + (halfpipe-lip-event symbol :offset-assert 3000) + (spin-check-time time-frame :offset-assert 3008) + (spin-time time-frame :offset-assert 3016) + (spin-start-time time-frame :offset-assert 3024) + (spin-start-dir vector :inline :offset-assert 3040) + (spin-control float :offset-assert 3056) + (spin-ground-start-time time-frame :offset-assert 3064) + (spin-ground-time time-frame :offset-assert 3072) + (spin-ground-press-time time-frame :offset-assert 3080) + (flip-control float :offset-assert 3088) + (flip-count int32 :offset-assert 3092) + (trickx-count int32 :offset 3144) + (trotyv-max degrees :offset-assert 3148) + (trotyv degrees :offset-assert 3152) + (troty degrees :offset-assert 3156) + (troty-cum degrees :offset-assert 3160) + (upper-body-rotyv-max degrees :offset 3168) + (upper-body-rotyv degrees :offset-assert 3172) + (upper-body-roty degrees :offset-assert 3176) + (cushion-base meters :offset-assert 3180) + (cushion-offset meters :offset-assert 3184) + (shock-offset meters :offset-assert 3188) + (shock-offsetv meters :offset-assert 3192) + (shock-rotx meters :offset-assert 3196) + (trick-count int32 :offset 3204) + (pad uint8 :offset 3399) + ) + :method-count-assert 11 + :size-assert #xd48 + :flag-assert #xb00000d48 + (:methods + (board-info-method-9 () none 9) + (board-info-method-10 () none 10) + ) + ) + +(deftype target-board-bank (basic) + ((jump-height-min meters :offset-assert 4) + (jump-height-max meters :offset-assert 8) + (duck-jump-height-min meters :offset-assert 12) + (duck-jump-height-max meters :offset-assert 16) + (turn-frames float :offset-assert 20) + (wall-kick-window seconds :offset-assert 24) + (cushion meters :offset-assert 32) + (trickx-jump-height-min meters :offset-assert 36) + (trickx-jump-height-max meters :offset-assert 40) + (tricky-jump-height-min meters :offset-assert 44) + (tricky-jump-height-max meters :offset-assert 48) + ) + :method-count-assert 9 + :size-assert #x34 + :flag-assert #x900000034 + ) + +(define *TARGET_BOARD-bank* (new 'static 'target-board-bank + :jump-height-min (meters 1.01) + :jump-height-max (meters 3.5) + :duck-jump-height-min (meters 2.5) + :duck-jump-height-max (meters 5) + :turn-frames 10.0 + :wall-kick-window (seconds 0.05) + :cushion (meters 1) + :trickx-jump-height-min (meters 0.9) + :trickx-jump-height-max (meters 1.2) + :tricky-jump-height-min (meters 0.9) + :tricky-jump-height-max (meters 1.2) + ) + ) + +(defbehavior want-to-board? target () + "Can we get on the jetboard?" + (and (logtest? (-> self game features) (game-feature board)) + (or (and (cpad-pressed? (-> self control unknown-cpad-info00 number) r2) + (or (!= *cheat-mode* 'debug) + (zero? (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons l2)) + ) + ) + (not *pause-lock*) + (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame01)) (seconds 0.1)) + (>= (the-as int (-> self control unknown-dword00)) (the-as int (-> self control unknown-dword01))) + ) + (-> self board latch?) + ) + (zero? (logand (focus-status fs1 fs6 fs7 fs8 fs12 fs13 fs18 fs20 fs21 fs22) (-> self focus-status))) + (or (zero? (-> self board)) (>= (- (-> self clock frame-counter) (-> self board board-time)) (seconds 0.5))) + (zero? (logand (state-flags sf17) (-> self state-flags))) + (< (-> self board board-time) (-> self control unknown-time-frame00)) + (zero? (logand (surface-flag no-board) (-> self control unknown-surface00 flags))) + (or (zero? (logand (-> self control unknown-surface00 flags) (surface-flag duck))) + (begin self (can-exit-duck?)) + ) + (not (and (logtest? (-> self water flags) (water-flags under-water)) + (zero? (logand (-> self water flags) (water-flags swim-ground))) + ) + ) + (not *artist-fix-visible*) + (let ((gp-0 (new 'stack-no-clear 'collide-query))) + (let ((s5-0 (new 'stack-no-clear 'inline-array 'sphere 3))) + (dotimes (s4-0 3) + ((method-of-type sphere new) (the-as symbol (-> s5-0 s4-0)) sphere) + ) + (let ((v1-51 (new 'stack-no-clear 'vector))) + (set! (-> v1-51 quad) (-> self control trans quad)) + (if (logtest? (-> self focus-status) (focus-status fs10)) + (set! (-> v1-51 y) (-> self water height)) + ) + (set! (-> s5-0 0 quad) (-> v1-51 quad)) + (set! (-> s5-0 0 y) (+ 8192.0 (-> s5-0 0 y))) + (set! (-> s5-0 0 w) 2867.2) + (set! (-> s5-0 1 quad) (-> v1-51 quad)) + (set! (-> s5-0 1 y) (+ 12288.0 (-> s5-0 1 y))) + (set! (-> s5-0 1 w) 2867.2) + (set! (-> s5-0 2 quad) (-> v1-51 quad)) + ) + (set! (-> s5-0 2 y) (+ 16384.0 (-> s5-0 2 y))) + (set! (-> s5-0 2 w) 2867.2) + (let ((v1-55 gp-0)) + (set! (-> v1-55 spheres) s5-0) + (set! (-> v1-55 num-spheres) (the-as uint 3)) + (set! (-> v1-55 collide-with) + (the-as collide-spec (logand -16561 (-> self control root-prim prim-core collide-with))) + ) + (set! (-> v1-55 ignore-process0) #f) + (set! (-> v1-55 ignore-process1) #f) + (set! (-> v1-55 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-55 solid-only) #t) + (set! (-> v1-55 action-mask) (the-as uint 1)) + ) + ) + (and (if (fill-and-probe-using-spheres *collide-cache* gp-0) + #f + #t + ) + (begin + (set! (-> self board latch?) #t) + (>= (- (-> self clock frame-counter) (-> self gun gun-time)) (seconds 0.4)) + ) + ) + ) + ) + ) + +(let ((a0-6 (new 'static 'skeleton-group + :name "skel-board" + :extra #f + :info #f + :art-group-name "board" + :bounds (new 'static 'vector :w 14336.0) + :version #x7 + :shadow 2 + :sort 1 + :origin-joint-index 3 + ) + ) + ) + (set! (-> a0-6 jgeo) 0) + (set! (-> a0-6 janim) 5) + (set! (-> a0-6 mgeo 0) 1) + (set! (-> a0-6 lod-dist 0) 4095996000.0) + (add-to-loading-level a0-6) + ) + +(define *board-shadow-control* + (new 'static 'shadow-control :settings (new 'static 'shadow-settings + :center (new 'static 'vector :w (the-as float #xa)) + :shadow-dir (new 'static 'vector :y -1.0 :w 614400.0) + :bot-plane (new 'static 'plane :y 1.0 :w 81920.0) + :top-plane (new 'static 'plane :y 1.0 :w 2048.0) + ) + ) + ) \ No newline at end of file diff --git a/goal_src/jak2/engine/target/board/board-util.gc b/goal_src/jak2/engine/target/board/board-util.gc index cb0d41d077..fa1b6245fb 100644 --- a/goal_src/jak2/engine/target/board/board-util.gc +++ b/goal_src/jak2/engine/target/board/board-util.gc @@ -5,5 +5,261 @@ ;; name in dgo: board-util ;; dgos: ENGINE, GAME +(define-extern ja-post (function none :behavior process-drawable)) +(define-extern ja-channel-set! (function int int :behavior process-drawable)) +(define-extern ja-channel-push! (function int time-frame int :behavior process-drawable)) +(define-extern ja-done? (function int symbol :behavior process-drawable)) +(define-extern sleep-code (function symbol)) +(define-extern *target-shadow-control* shadow-control) + ;; DECOMP BEGINS +(defmethod relocate board ((obj board) (arg0 int)) + (if (nonzero? (-> obj main)) + (&+! (-> obj main) arg0) + ) + (the-as board ((method-of-type process-drawable relocate) obj arg0)) + ) + +(defbehavior board-post board () + (let* ((a0-0 (-> self parent)) + (v1-0 (if a0-0 + (the-as target (-> (the-as target (-> a0-0 0)) self)) + ) + ) + ) + (set! (-> self root trans quad) (-> v1-0 board board-trans quad)) + (let ((a0-4 (-> v1-0 board board-quat quad))) + (set! (-> self root quat vec quad) a0-4) + ) + (set! (-> self root scale quad) (-> v1-0 board board-scale quad)) + (set! (-> self draw light-index) (-> v1-0 draw light-index)) + (let ((a0-10 (-> v1-0 draw color-mult quad))) + (set! (-> self draw color-mult quad) a0-10) + ) + (let ((a0-12 (-> v1-0 draw color-emissive quad))) + (set! (-> self draw color-emissive quad) a0-12) + ) + (set! (-> self draw force-fade) (-> v1-0 draw force-fade)) + (set! (-> self draw death-vertex-skip) (-> (the-as target (-> self parent 0)) draw death-vertex-skip)) + (set! (-> self draw death-effect) (-> (the-as target (-> self parent 0)) draw death-effect)) + (set! (-> self draw death-timer) (-> (the-as target (-> self parent 0)) draw death-timer)) + (set! (-> self draw death-timer-org) (-> (the-as target (-> self parent 0)) draw death-timer-org)) + (set! (-> self draw death-draw-overlap) (-> (the-as target (-> self parent 0)) draw death-draw-overlap)) + (let ((a0-37 (-> v1-0 draw shadow-ctrl settings shadow-dir quad))) + (set! (-> self draw shadow-ctrl settings shadow-dir quad) a0-37) + ) + (if (or (logtest? (-> v1-0 draw status) (draw-control-status no-draw no-draw-temp no-draw-bounds no-draw-bounds2)) + (zero? (-> v1-0 skel active-channels)) + ) + (logior! (-> self draw status) (draw-control-status no-draw)) + (logclear! (-> self draw status) (draw-control-status no-draw)) + ) + (if (logtest? (-> v1-0 draw status) (draw-control-status force-fade)) + (logior! (-> self draw status) (draw-control-status force-fade)) + (logclear! (-> self draw status) (draw-control-status force-fade)) + ) + ) + (ja-post) + 0 + (none) + ) + +(defstate hidden (board) + :virtual #t + :trans (behavior () + (let ((v1-0 (-> self parent))) + (if (zero? (logand (-> (the-as target (if v1-0 + (the-as target (-> v1-0 0 self)) + ) + ) + focus-status + ) + (focus-status fs8) + ) + ) + (go-virtual idle #f) + ) + ) + (none) + ) + :code (behavior () + (ja-channel-set! 0) + (ja-post) + (logior! (-> self mask) (process-mask sleep-code)) + (suspend) + 0 + (none) + ) + ) + +(defstate idle (board) + :virtual #t + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('open) + (go-virtual use) + ) + ) + ) + :trans (behavior () + (let ((v1-0 (-> self parent))) + (if (logtest? (-> (the-as target (if v1-0 + (the-as target (-> v1-0 0 self)) + ) + ) + focus-status + ) + (focus-status fs8) + ) + (go-virtual hidden) + ) + ) + (none) + ) + :code (behavior ((arg0 symbol)) + (ja-channel-push! 1 (seconds 0.1)) + (cond + (arg0 + (let ((gp-1 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 4)) + (the-as (function joint-control-channel float float float float) num-func-identity) + ) + (set! (-> gp-1 frame-num) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 4)) frames num-frames) -1)) + ) + ) + ) + (else + (let ((a0-3 (-> self skel root-channel 0))) + (set! (-> a0-3 frame-group) (the-as art-joint-anim (-> self draw art-group data 4))) + (set! (-> a0-3 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 4)) frames num-frames) -1)) + ) + (set! (-> a0-3 param 1) 1.0) + (set! (-> a0-3 frame-num) 0.0) + (joint-control-channel-group! + a0-3 + (the-as art-joint-anim (-> self draw art-group data 4)) + (the-as (function joint-control-channel float float float float) num-func-seek!) + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-4 (-> self skel root-channel 0))) + (set! (-> a0-4 param 0) (the float (+ (-> a0-4 frame-group frames num-frames) -1))) + (set! (-> a0-4 param 1) 1.0) + (joint-control-channel-group-eval! + a0-4 + (the-as art-joint-anim #f) + (the-as (function joint-control-channel float float float float) num-func-seek!) + ) + ) + ) + ) + ) + (set! (-> self draw shadow) #f) + (sleep-code) + (none) + ) + :post board-post + ) + +(defstate use (board) + :virtual #t + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('close) + (go-virtual idle #f) + ) + ) + ) + :trans (behavior () + (let ((v1-0 (-> self parent))) + (if v1-0 + (-> v1-0 0 self) + ) + ) + (let ((v1-2 (-> self parent))) + (cond + ((logtest? (-> (the-as target (if v1-2 + (the-as target (-> v1-2 0 self)) + ) + ) + focus-status + ) + (focus-status fs8) + ) + (go-virtual hidden) + ) + ((let ((v1-9 #x40000) + (a0-3 (-> self parent)) + ) + (zero? (logand (the-as focus-status v1-9) (-> (the-as target (if a0-3 + (the-as target (-> a0-3 0 self)) + ) + ) + focus-status + ) + ) + ) + ) + (go-virtual idle #f) + ) + ) + ) + (none) + ) + :code (behavior () + (set! (-> self draw shadow) (-> self shadow-backup)) + (ja-channel-push! 1 (seconds 0.1)) + (let ((a0-2 (-> self skel root-channel 0))) + (set! (-> a0-2 frame-group) (the-as art-joint-anim (-> self draw art-group data 3))) + (set! (-> a0-2 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) frames num-frames) -1)) + ) + (set! (-> a0-2 param 1) 1.0) + (set! (-> a0-2 frame-num) 0.0) + (joint-control-channel-group! + a0-2 + (the-as art-joint-anim (-> self draw art-group data 3)) + (the-as (function joint-control-channel float float float float) num-func-seek!) + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-3 (-> self skel root-channel 0))) + (set! (-> a0-3 param 0) (the float (+ (-> a0-3 frame-group frames num-frames) -1))) + (set! (-> a0-3 param 1) 1.0) + (joint-control-channel-group-eval! + a0-3 + (the-as art-joint-anim #f) + (the-as (function joint-control-channel float float float float) num-func-seek!) + ) + ) + ) + (sleep-code) + (none) + ) + :post board-post + ) + +(defbehavior board-init board () + (set! (-> self root) (new 'process 'trsqv)) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-board" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (let ((v1-5 (-> *target-shadow-control* settings shadow-dir quad))) + (set! (-> *board-shadow-control* settings shadow-dir quad) v1-5) + ) + (set! (-> self draw shadow-ctrl) *board-shadow-control*) + (set! (-> self shadow-backup) (-> self draw shadow)) + (set! (-> self main) (new 'process 'joint-mod (joint-mod-mode flex-blend) self 3)) + (ja-channel-set! 0) + (go-virtual idle #t) + (none) + ) diff --git a/goal_src/jak2/engine/target/darkjak-h.gc b/goal_src/jak2/engine/target/darkjak-h.gc index b2980d2647..8b99663276 100644 --- a/goal_src/jak2/engine/target/darkjak-h.gc +++ b/goal_src/jak2/engine/target/darkjak-h.gc @@ -7,3 +7,25 @@ ;; DECOMP BEGINS +(deftype darkjak-info (basic) + ((process uint32 :offset-assert 4) + (attack-id uint32 :offset-assert 8) + (start-time time-frame :offset-assert 16) + (attack-time time-frame :offset-assert 24) + (attack-count uint64 :offset-assert 32) + (stage uint32 :offset-assert 40) + (want-stage uint32 :offset-assert 44) + (clock-pos float :offset-assert 48) + (clock-vel float :offset-assert 52) + (clock-on symbol :offset-assert 56) + (hud handle 1 :offset 64) + (tone uint32 :offset 72) + (bomb uint32 :offset 76) + ) + :method-count-assert 10 + :size-assert #x50 + :flag-assert #xa00000050 + (:methods + (darkjak-info-method-9 (_type_ int) none :behavior target 9) + ) + ) \ No newline at end of file diff --git a/goal_src/jak2/engine/target/gun/gun-h.gc b/goal_src/jak2/engine/target/gun/gun-h.gc index a2e6af51c1..ffc0198a70 100644 --- a/goal_src/jak2/engine/target/gun/gun-h.gc +++ b/goal_src/jak2/engine/target/gun/gun-h.gc @@ -11,116 +11,116 @@ ;; DECOMP BEGINS (deftype gun (process-drawable) - ((control basic :offset 128) - (shadow-backup basic :offset 208) - (read-scale basic :offset-assert 212) - (gun-type pickup-type :offset-assert 216) - (barrel basic :offset-assert 220) - (mag basic 4 :offset-assert 224) - (mag-scale float 4 :offset-assert 240) + ((control control-info :offset 128) + (shadow-backup shadow-geo :offset 208) + (read-scale basic :offset-assert 212) + (gun-type pickup-type :offset-assert 216) + (barrel joint-mod :offset-assert 220) + (mag joint-mod 4 :offset-assert 224) + (mag-scale float 4 :offset-assert 240) ) :heap-base #x80 :method-count-assert 24 :size-assert #x100 :flag-assert #x1800800100 (:methods - (gun-method-20 () none 20) - (gun-method-21 () none 21) - (gun-method-22 () none 22) - (gun-method-23 () none 23) + (idle () _type_ :state 20) + (use (symbol) _type_ :state 21) + (hidden () _type_ :state 22) + (die () _type_ :state 23) ) ) + -;; definition of type gun-info (deftype gun-info (basic) - ((process uint32 :offset-assert 4) - (gun uint32 :offset-assert 8) - (gun-pos transformq :inline :offset-assert 16) - (gun-trans vector :inline :offset 16) - (gun-quat quaternion :inline :offset 32) - (gun-scale vector :inline :offset 48) - (gun-type pickup-type :offset-assert 64) - (using-gun-type pickup-type :offset-assert 68) - (active? symbol :offset-assert 72) - (latch? symbol :offset-assert 76) - (put-away? symbol :offset-assert 80) - (surpress-time time-frame :offset-assert 88) - (fire-time time-frame :offset-assert 96) - (gun-time time-frame :offset-assert 104) - (gun-get-on-time time-frame :offset-assert 112) - (active-time time-frame :offset-assert 120) - (fire-delay uint32 :offset-assert 128) - (gun-control uint32 :offset-assert 132) - (gun-target uint32 :offset-assert 136) - (gun-daxter float :offset-assert 140) - (gun-roty-rel degrees :offset-assert 144) - (gun-roty degrees :offset-assert 148) - (gun-roty-targ degrees :offset-assert 152) - (hips basic :offset-assert 156) - (upper-body basic :offset-assert 160) - (chest basic :offset-assert 164) - (fire-dir-rot degrees :offset-assert 168) - (fire-dir vector 2 :inline :offset-assert 176) - (fire-point vector :inline :offset-assert 208) - (fire-dir-backup vector :inline :offset-assert 224) - (fire-dir-out vector :inline :offset-assert 240) - (fire-pending int32 :offset-assert 256) - (fire-pending-time time-frame :offset-assert 264) - (fire-start-time time-frame :offset-assert 272) - (fire-charge float :offset-assert 280) - (fire-spin degrees :offset-assert 284) - (fire-spinv degrees :offset-assert 288) - (fire-chamber int32 :offset-assert 292) - (fire-range meters :offset-assert 296) - (laser-active? symbol :offset-assert 300) - (laser-point vector :inline :offset-assert 304) - (laser-dir vector 2 :inline :offset-assert 320) - (laser-hit-point vector :inline :offset-assert 352) - (track? uint16 :offset-assert 368) - (track-tilt degrees :offset-assert 372) - (track-turn degrees :offset-assert 376) - (track-find-range meters :offset-assert 380) - (track-turnv-range meters :offset-assert 384) - (track-tilt-range meters :offset-assert 388) - (track-turn-range meters :offset-assert 392) - (track-tilt-max degrees :offset-assert 396) - (track-turn-max degrees :offset-assert 400) - (track-angle-mult float :offset-assert 404) - (track-beam-size float :offset-assert 408) - (track-auto-fire symbol :offset-assert 412) - (track-require uint32 :offset-assert 416) - (track-target-hold-time time-frame :offset-assert 424) - (track-start-time time-frame :offset-assert 432) - (track-press-start-time time-frame :offset-assert 440) - (track-target focus 2 :inline :offset-assert 448) - (track-trans vector :inline :offset-assert 480) - (track-dir vector :inline :offset-assert 496) - (turn-fast-hold-time time-frame :offset-assert 512) - (blue-whine-sound-id uint32 :offset-assert 520) - (blue-whine-volume float :offset-assert 524) - (top-anim-twist vector :inline :offset-assert 528) - (top-anim-twist-targ vector :inline :offset-assert 544) - (top-anim-look-at vector :inline :offset-assert 560) - (top-anim-twist-reset uint64 :offset-assert 576) - (top-anim-gun-height meters :offset-assert 584) - (top-anim-blue-cycle float :offset-assert 588) - (top-anim-low-high float :offset-assert 592) - (top-anim-extra-twistv degrees :offset-assert 596) - (top-anim-tilt-up degrees :offset-assert 600) - (attack-combo combo-tracker :inline :offset-assert 608) - (combo-window-start time-frame :offset-assert 656) - (combo-window-state uint32 :offset-assert 664) - (combo-fire-delay uint32 :offset-assert 668) - (charge-ammo float :offset-assert 672) - (charge-start-time time-frame :offset-assert 680) - (charge-inc-time time-frame :offset-assert 688) - (charge-active? uint64 :offset-assert 696) + ((process (pointer target) :offset-assert 4) + (gun (pointer gun) :offset-assert 8) + (gun-pos transformq :inline :offset-assert 16) + (gun-trans vector :inline :offset 16) + (gun-quat quaternion :inline :offset 32) + (gun-scale vector :inline :offset 48) + (gun-type pickup-type :offset-assert 64) + (using-gun-type pickup-type :offset-assert 68) + (active? symbol :offset-assert 72) + (latch? symbol :offset-assert 76) + (put-away? symbol :offset-assert 80) + (surpress-time time-frame :offset-assert 88) + (fire-time time-frame :offset-assert 96) + (gun-time time-frame :offset-assert 104) + (gun-get-on-time time-frame :offset-assert 112) + (active-time time-frame :offset-assert 120) + (fire-delay uint32 :offset-assert 128) + (gun-control uint32 :offset-assert 132) + (gun-target uint32 :offset-assert 136) + (gun-daxter float :offset-assert 140) + (gun-roty-rel degrees :offset-assert 144) + (gun-roty degrees :offset-assert 148) + (gun-roty-targ degrees :offset-assert 152) + (hips basic :offset-assert 156) + (upper-body basic :offset-assert 160) + (chest basic :offset-assert 164) + (fire-dir-rot degrees :offset-assert 168) + (fire-dir vector 2 :inline :offset-assert 176) + (fire-point vector :inline :offset-assert 208) + (fire-dir-backup vector :inline :offset-assert 224) + (fire-dir-out vector :inline :offset-assert 240) + (fire-pending int32 :offset-assert 256) + (fire-pending-time time-frame :offset-assert 264) + (fire-start-time time-frame :offset-assert 272) + (fire-charge float :offset-assert 280) + (fire-spin degrees :offset-assert 284) + (fire-spinv degrees :offset-assert 288) + (fire-chamber int32 :offset-assert 292) + (fire-range meters :offset-assert 296) + (laser-active? symbol :offset-assert 300) + (laser-point vector :inline :offset-assert 304) + (laser-dir vector 2 :inline :offset-assert 320) + (laser-hit-point vector :inline :offset-assert 352) + (track? uint16 :offset-assert 368) + (track-tilt degrees :offset-assert 372) + (track-turn degrees :offset-assert 376) + (track-find-range meters :offset-assert 380) + (track-turnv-range meters :offset-assert 384) + (track-tilt-range meters :offset-assert 388) + (track-turn-range meters :offset-assert 392) + (track-tilt-max degrees :offset-assert 396) + (track-turn-max degrees :offset-assert 400) + (track-angle-mult float :offset-assert 404) + (track-beam-size float :offset-assert 408) + (track-auto-fire symbol :offset-assert 412) + (track-require uint32 :offset-assert 416) + (track-target-hold-time time-frame :offset-assert 424) + (track-start-time time-frame :offset-assert 432) + (track-press-start-time time-frame :offset-assert 440) + (track-target focus 2 :inline :offset-assert 448) + (track-trans vector :inline :offset-assert 480) + (track-dir vector :inline :offset-assert 496) + (turn-fast-hold-time time-frame :offset-assert 512) + (blue-whine-sound-id uint32 :offset-assert 520) + (blue-whine-volume float :offset-assert 524) + (top-anim-twist vector :inline :offset-assert 528) + (top-anim-twist-targ vector :inline :offset-assert 544) + (top-anim-look-at vector :inline :offset-assert 560) + (top-anim-twist-reset uint64 :offset-assert 576) + (top-anim-gun-height meters :offset-assert 584) + (top-anim-blue-cycle float :offset-assert 588) + (top-anim-low-high float :offset-assert 592) + (top-anim-extra-twistv degrees :offset-assert 596) + (top-anim-tilt-up degrees :offset-assert 600) + (attack-combo combo-tracker :inline :offset-assert 608) + (combo-window-start time-frame :offset-assert 656) + (combo-window-state uint32 :offset-assert 664) + (combo-fire-delay uint32 :offset-assert 668) + (charge-ammo float :offset-assert 672) + (charge-start-time time-frame :offset-assert 680) + (charge-inc-time time-frame :offset-assert 688) + (charge-active? uint64 :offset-assert 696) ) :method-count-assert 10 :size-assert #x2c0 :flag-assert #xa000002c0 (:methods - (gun-info-method-9 () none 9) + (gun-info-method-9 (_type_) none 9) ) ) @@ -313,7 +313,3 @@ (set! (-> a0-10 lod-dist 0) 4095996000.0) (add-to-loading-level a0-10) ) - - - - diff --git a/goal_src/jak2/engine/target/target-h.gc b/goal_src/jak2/engine/target/target-h.gc index 46f031dece..465eaefb42 100644 --- a/goal_src/jak2/engine/target/target-h.gc +++ b/goal_src/jak2/engine/target/target-h.gc @@ -21,7 +21,7 @@ (deftype target (process-focusable) ((control control-info :offset 128) (skel2 basic :offset-assert 204) - (shadow-backup basic :offset-assert 208) + (shadow-backup shadow-geo :offset-assert 208) (target-flags uint32 :offset 188) (game game-info :offset-assert 212) (neck joint-mod :offset-assert 216) diff --git a/test/decompiler/reference/jak2/engine/anim/joint-h_REF.gc b/test/decompiler/reference/jak2/engine/anim/joint-h_REF.gc index e9f48634bc..8649574936 100644 --- a/test/decompiler/reference/jak2/engine/anim/joint-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/anim/joint-h_REF.gc @@ -82,25 +82,25 @@ ;; definition of type top-anim-joint-control (deftype top-anim-joint-control (basic) - ((process uint32 :offset-assert 4) - (interp-select uint64 2 :offset-assert 8) - (base-anim basic :offset-assert 24) - (base-anim-speed float :offset-assert 28) - (base-anim-blend float :offset-assert 32) - (interp float :offset-assert 36) - (frame-group basic :offset-assert 40) - (frame-group-push basic :offset-assert 44) - (frame-num float :offset-assert 48) - (frame-targ basic :offset-assert 52) - (frame-speed float :offset-assert 56) - (frame-blend float :offset-assert 60) - (frame-cur-blend float :offset-assert 64) - (frame-start float :offset-assert 68) - (frame-post-blend float :offset-assert 72) - (frame-post-end float :offset-assert 76) - (frame-push-time time-frame :offset-assert 80) - (frame-post-put-away basic :offset-assert 88) - (update-time time-frame :offset-assert 96) + ((process uint32 :offset-assert 4) + (interp-select uint64 2 :offset-assert 8) + (base-anim basic :offset-assert 24) + (base-anim-speed float :offset-assert 28) + (base-anim-blend float :offset-assert 32) + (interp float :offset-assert 36) + (frame-group art-joint-anim :offset-assert 40) + (frame-group-push basic :offset-assert 44) + (frame-num float :offset-assert 48) + (frame-targ basic :offset-assert 52) + (frame-speed float :offset-assert 56) + (frame-blend float :offset-assert 60) + (frame-cur-blend float :offset-assert 64) + (frame-start float :offset-assert 68) + (frame-post-blend float :offset-assert 72) + (frame-post-end float :offset-assert 76) + (frame-push-time time-frame :offset-assert 80) + (frame-post-put-away basic :offset-assert 88) + (update-time time-frame :offset-assert 96) ) :method-count-assert 13 :size-assert #x68 @@ -145,21 +145,21 @@ ;; definition of type joint-control (deftype joint-control (basic) - ((status joint-control-status :offset-assert 4) - (allocated-length uint8 :offset-assert 6) - (active-channels uint8 :offset-assert 7) - (root-channel (inline-array joint-control) :offset 16) - (blend-index uint8 :offset-assert 20) - (active-frame-interp uint8 :offset-assert 21) - (float-channels uint8 :offset-assert 22) - (generate-frame-function function :offset-assert 24) - (prebind-function function :offset-assert 28) - (postbind-function function :offset-assert 32) - (effect basic :offset-assert 36) - (interp-select int64 2 :offset-assert 40) - (top-anim top-anim-joint-control :offset-assert 56) - (override basic :offset-assert 60) - (channel joint-control-channel :inline :dynamic :offset-assert 64) + ((status joint-control-status :offset-assert 4) + (allocated-length uint8 :offset-assert 6) + (active-channels uint8 :offset-assert 7) + (root-channel (inline-array joint-control-channel) :offset 16) + (blend-index uint8 :offset-assert 20) + (active-frame-interp uint8 :offset-assert 21) + (float-channels uint8 :offset-assert 22) + (generate-frame-function function :offset-assert 24) + (prebind-function function :offset-assert 28) + (postbind-function function :offset-assert 32) + (effect basic :offset-assert 36) + (interp-select int64 2 :offset-assert 40) + (top-anim top-anim-joint-control :offset-assert 56) + (override basic :offset-assert 60) + (channel joint-control-channel :inline :dynamic :offset-assert 64) ) :method-count-assert 12 :size-assert #x40 diff --git a/test/decompiler/reference/jak2/engine/anim/joint-mod-h_REF.gc b/test/decompiler/reference/jak2/engine/anim/joint-mod-h_REF.gc index b88ab2012b..8348613753 100644 --- a/test/decompiler/reference/jak2/engine/anim/joint-mod-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/anim/joint-mod-h_REF.gc @@ -45,6 +45,7 @@ :size-assert #xb8 :flag-assert #x10000000b8 (:methods + (new (symbol type joint-mod-mode process-drawable int) _type_ 0) (joint-mod-method-9 () none 9) (joint-mod-method-10 () none 10) (joint-mod-method-11 () none 11) diff --git a/test/decompiler/reference/jak2/engine/anim/joint_REF.gc b/test/decompiler/reference/jak2/engine/anim/joint_REF.gc index 946468f664..a739809f70 100644 --- a/test/decompiler/reference/jak2/engine/anim/joint_REF.gc +++ b/test/decompiler/reference/jak2/engine/anim/joint_REF.gc @@ -167,7 +167,7 @@ (set! (-> v0-0 allocated-length) (the-as uint arg0)) (set! (-> v0-0 active-channels) (the-as uint 0)) (set! (-> v0-0 float-channels) (the-as uint 0)) - (set! (-> v0-0 root-channel) (the-as (inline-array joint-control) (-> v0-0 channel))) + (set! (-> v0-0 root-channel) (-> v0-0 channel)) (set! (-> v0-0 generate-frame-function) create-interpolated-joint-animation-frame) (set! (-> v0-0 prebind-function) #f) (set! (-> v0-0 postbind-function) #f) @@ -709,7 +709,7 @@ (set! (-> arg0 float-channels) (the-as uint 0)) (set! (-> arg0 root-channel) (the-as - (inline-array joint-control) + (inline-array joint-control-channel) (-> arg0 channel (/ (the-as int (- (the-as uint (-> arg1 root-channel)) (the-as uint (the-as uint (-> arg1 channel))))) 64) @@ -2160,3 +2160,7 @@ ;; failed to figure out what this is: (kmemclose) + + + + diff --git a/test/decompiler/reference/jak2/engine/collide/collide-cache-h_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-cache-h_REF.gc index 3a50e611a9..89bcd46186 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-cache-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-cache-h_REF.gc @@ -154,13 +154,13 @@ (:methods (collide-cache-method-9 () none 9) (fill-and-probe-using-line-sphere (_type_ vector vector float collide-spec process collide-tri-result pat-surface) float 10) - (collide-cache-method-11 () none 11) - (collide-cache-method-12 () none 12) + (fill-and-probe-using-spheres (_type_ collide-query) symbol 11) + (collide-cache-method-12 (_type_ collide-query) none 12) (collide-cache-method-13 () none 13) - (collide-cache-method-14 () none 14) + (fill-using-spheres (_type_ collide-query) none 14) (collide-cache-method-15 () none 15) (collide-cache-method-16 () none 16) - (collide-cache-method-17 () none 17) + (probe-using-spheres (_type_ collide-query) symbol 17) (collide-cache-method-18 () none 18) (collide-cache-method-19 () none 19) (collide-cache-method-20 () none 20) @@ -251,3 +251,7 @@ ;; failed to figure out what this is: (kmemclose) + + + + diff --git a/test/decompiler/reference/jak2/engine/collide/collide-h_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-h_REF.gc index c9ce1fec45..96ae8cf5f0 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-h_REF.gc @@ -3,43 +3,43 @@ ;; definition of type collide-query (deftype collide-query (structure) - ((best-other-tri collide-tri-result :inline :offset-assert 0) - (best-my-tri collide-tri-result :inline :offset 0) - (ignore-processes process 2 :offset-assert 88) - (ignore-process0 process :offset 88) - (ignore-process1 process :offset 92) - (ignore-pat pat-surface :offset-assert 96) - (collide-with collide-spec :offset-assert 100) - (overlay-params uint32 3 :offset 112) - (bbox bounding-box :inline :offset-assert 128) - (bbox4w bounding-box4w :inline :offset-assert 160) - (bsphere sphere :inline :offset-assert 192) - (start-pos vector :inline :offset-assert 208) - (move-dist vector :inline :offset-assert 224) - (rlength vector :inline :offset-assert 240) - (exit-planes plane 2 :offset-assert 256) - (radius float :offset 268) - (inv-mat matrix :inline :offset 288) - (spheres uint32 :offset 112) - (num-spheres uint32 :offset 116) - (solid-only basic :offset 120) - (best-dist float :offset 112) - (best-other-prim basic :offset 116) - (best-my-prim basic :offset 120) - (move-vec vector :inline :offset 224) - (best-u float :offset 112) - (action-mask uint32 :offset-assert 352) - (local-box4w bounding-box4w :inline :offset-assert 368) - (search-box bounding-box4w :inline :offset-assert 400) - (search-vector vector4w :inline :offset-assert 432) - (instance-mat matrix :inline :offset-assert 448) - (instance-ptr basic :offset-assert 512) - (x-addr uint32 :offset-assert 516) - (x-step uint32 :offset-assert 520) - (y-addr uint32 :offset-assert 524) - (y-step uint32 :offset-assert 528) - (z-addr uint32 :offset-assert 532) - (z-step uint32 :offset-assert 536) + ((best-other-tri collide-tri-result :inline :offset-assert 0) + (best-my-tri collide-tri-result :inline :offset 0) + (ignore-processes process 2 :offset-assert 88) + (ignore-process0 process :offset 88) + (ignore-process1 process :offset 92) + (ignore-pat pat-surface :offset-assert 96) + (collide-with collide-spec :offset-assert 100) + (overlay-params uint32 3 :offset 112) + (bbox bounding-box :inline :offset-assert 128) + (bbox4w bounding-box4w :inline :offset-assert 160) + (bsphere sphere :inline :offset-assert 192) + (start-pos vector :inline :offset-assert 208) + (move-dist vector :inline :offset-assert 224) + (rlength vector :inline :offset-assert 240) + (exit-planes plane 2 :offset-assert 256) + (radius float :offset 268) + (inv-mat matrix :inline :offset 288) + (spheres (inline-array sphere) :offset 112) + (num-spheres uint32 :offset 116) + (solid-only symbol :offset 120) + (best-dist float :offset 112) + (best-other-prim basic :offset 116) + (best-my-prim basic :offset 120) + (move-vec vector :inline :offset 224) + (best-u float :offset 112) + (action-mask uint32 :offset-assert 352) + (local-box4w bounding-box4w :inline :offset-assert 368) + (search-box bounding-box4w :inline :offset-assert 400) + (search-vector vector4w :inline :offset-assert 432) + (instance-mat matrix :inline :offset-assert 448) + (instance-ptr basic :offset-assert 512) + (x-addr uint32 :offset-assert 516) + (x-step uint32 :offset-assert 520) + (y-addr uint32 :offset-assert 524) + (y-step uint32 :offset-assert 528) + (z-addr uint32 :offset-assert 532) + (z-step uint32 :offset-assert 536) ) :method-count-assert 9 :size-assert #x21c @@ -60,7 +60,7 @@ (format #t "~1Tignore-process1: ~A~%" (-> obj ignore-process1)) (format #t "~1Tignore-pat: ~D~%" (-> obj ignore-pat)) (format #t "~1Tcollide-with: ~D~%" (-> obj collide-with)) - (format #t "~1Toverlay-params[3] @ #x~X~%" (&-> obj best-dist)) + (format #t "~1Toverlay-params[3] @ #x~X~%" (&-> obj spheres)) (format #t "~1Tbbox: #~%" (-> obj bbox)) (format #t "~1Tbbox4w: #~%" (-> obj bbox4w)) (format #t "~1Tbsphere: #~%" (-> obj bsphere)) @@ -70,14 +70,14 @@ (format #t "~1Texit-planes[2] @ #x~X~%" (-> obj exit-planes)) (format #t "~1Tradius: ~f~%" (-> obj radius)) (format #t "~1Tinv-mat: #~%" (-> obj inv-mat)) - (format #t "~1Tspheres: #x~X~%" (-> obj best-dist)) + (format #t "~1Tspheres: #x~X~%" (-> obj spheres)) (format #t "~1Tnum-spheres: ~D~%" (-> obj num-spheres)) (format #t "~1Tsolid-only: ~A~%" (-> obj solid-only)) - (format #t "~1Tbest-dist: ~f~%" (-> obj best-dist)) + (format #t "~1Tbest-dist: ~f~%" (the-as float (-> obj spheres))) (format #t "~1Tbest-other-prim: ~A~%" (-> obj num-spheres)) (format #t "~1Tbest-my-prim: ~A~%" (-> obj solid-only)) (format #t "~1Tmove-vec: #~%" (-> obj move-dist)) - (format #t "~1Tbest-u: ~f~%" (-> obj best-dist)) + (format #t "~1Tbest-u: ~f~%" (the-as float (-> obj spheres))) (format #t "~1Taction-mask: ~D~%" (-> obj action-mask)) (format #t "~1Tlocal-box4w: #~%" (-> obj local-box4w)) (format #t "~1Tsearch-box: #~%" (-> obj search-box)) @@ -99,7 +99,3 @@ ;; failed to figure out what this is: 0 - - - - diff --git a/test/decompiler/reference/jak2/engine/common_objs/projectile-h_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/projectile-h_REF.gc index 4959f882b2..a09c397acd 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/projectile-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/projectile-h_REF.gc @@ -185,7 +185,3 @@ ;; failed to figure out what this is: 0 - - - - diff --git a/test/decompiler/reference/jak2/engine/data/art-h_REF.gc b/test/decompiler/reference/jak2/engine/data/art-h_REF.gc index 779ff04df8..913eabb851 100644 --- a/test/decompiler/reference/jak2/engine/data/art-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/data/art-h_REF.gc @@ -588,7 +588,7 @@ (death-timer-org uint8 :offset-assert 97) (death-vertex-skip uint16 :offset-assert 98) (death-effect uint32 :offset-assert 100) - (shadow uint32 :offset-assert 104) + (shadow shadow-geo :offset-assert 104) (shadow-ctrl shadow-control :offset-assert 108) (distance meters :offset-assert 112) (origin vector :inline :offset-assert 128) diff --git a/test/decompiler/reference/jak2/engine/game/game-h_REF.gc b/test/decompiler/reference/jak2/engine/game/game-h_REF.gc index 400280a9cd..6d03471766 100644 --- a/test/decompiler/reference/jak2/engine/game/game-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/game-h_REF.gc @@ -26,8 +26,8 @@ :size-assert #xc8 :flag-assert #x14005000c8 (:methods - (process-drawable-method-14 () none 14) - (process-drawable-method-15 () none 15) + (initialize-skeleton (_type_ skeleton-group pair) none 14) + (initialize-skeleton-by-name (_type_ string object) draw-control 15) (process-drawable-method-16 () none 16) (process-drawable-method-17 () none 17) (process-drawable-method-18 () none 18) diff --git a/test/decompiler/reference/jak2/engine/level/level-h_REF.gc b/test/decompiler/reference/jak2/engine/level/level-h_REF.gc index 785cd66888..fa72d01cbd 100644 --- a/test/decompiler/reference/jak2/engine/level/level-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/level/level-h_REF.gc @@ -698,7 +698,7 @@ (level-get-target-inside (_type_) level 20) (alloc-levels-if-needed (_type_ symbol) none 21) (load-commands-set! (_type_ pair) pair 22) - (level-group-method-23 () none 23) + (art-group-get-by-name (_type_ string (pointer uint32)) art-group 23) (load-command-get-index (_type_ symbol int) pair 24) (level-group-method-25 () none 25) (level-group-method-26 () none 26) diff --git a/test/decompiler/reference/jak2/engine/target/board/board-h_REF.gc b/test/decompiler/reference/jak2/engine/target/board/board-h_REF.gc new file mode 100644 index 0000000000..faeaecfaf8 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/target/board/board-h_REF.gc @@ -0,0 +1,492 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type board +(deftype board (process-drawable) + ((control control-info :offset 128) + (shadow-backup shadow-geo :offset 208) + (main joint-mod :offset 212) + ) + :heap-base #x60 + :method-count-assert 23 + :size-assert #xd8 + :flag-assert #x17006000d8 + (:methods + (idle (symbol) _type_ :state 20) + (use () _type_ :state 21) + (hidden () _type_ :state 22) + ) + ) + +;; definition for method 3 of type board +(defmethod inspect board ((obj board)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~2Tcontrol: ~A~%" (-> obj root)) + (format #t "~2Tstate-time: ~D~%" (-> obj state-time)) + (format #t "~2Tshadow-backup: ~A~%" (-> obj shadow-backup)) + (format #t "~2Tmain: ~A~%" (-> obj main)) + (label cfg-4) + obj + ) + +;; definition of type board-info +(deftype board-info (basic) + ((board uint32 :offset-assert 4) + (camera-interp float :offset-assert 8) + (process uint32 :offset-assert 12) + (board-trans vector :inline :offset-assert 16) + (board-quat vector :inline :offset-assert 32) + (board-scale vector :inline :offset-assert 48) + (main joint-mod :offset-assert 64) + (upper-body basic :offset-assert 68) + (sound-bank-knob float :offset-assert 72) + (sound-air-knob float :offset-assert 76) + (wind-sound-id uint32 :offset-assert 80) + (wind-sound-pitch float :offset-assert 84) + (wind-sound-volume float :offset-assert 88) + (engine-sound-id uint32 :offset-assert 92) + (engine-sound-pitch float :offset-assert 96) + (engine-sound-volume float :offset-assert 100) + (bank-sound-id uint32 :offset-assert 104) + (bank-sound-pitch float :offset-assert 108) + (bank-sound-volume float :offset-assert 112) + (ride-sound-id uint32 :offset-assert 116) + (spin-sound-id uint32 :offset-assert 120) + (spin-sound-volume float :offset-assert 124) + (spin-sound-pitch float :offset-assert 128) + (up-vector vector 2 :inline :offset-assert 144) + (slow-transv vector :inline :offset-assert 176) + (board-time time-frame :offset-assert 192) + (board-get-on-time time-frame :offset-assert 200) + (in-air-time time-frame :offset-assert 208) + (stick-lock basic :offset 240) + (stick-off basic :offset-assert 244) + (stance-info ground-tween-info :inline :offset-assert 248) + (mods-backup basic :offset-assert 284) + (attack-id uint32 :offset-assert 288) + (latch? symbol :offset-assert 292) + (unstuck-time time-frame :offset 344) + (stuck-count int32 :offset-assert 352) + (thrust-scale float :offset-assert 356) + (flip-time time-frame :offset-assert 360) + (transv-max meters :offset-assert 368) + (turn-anim-tilt? symbol :offset-assert 372) + (turn-anim-mag float :offset-assert 376) + (turn-anim-targ float :offset-assert 380) + (turn-anim-frame float :offset-assert 384) + (turn-anim-vel float :offset-assert 388) + (turn-anim-duck float :offset-assert 392) + (turn-anim-duck-vel float :offset-assert 396) + (tilt-anim-frame vector :inline :offset-assert 400) + (tilt-anim-target vector :inline :offset-assert 416) + (smack-surface-time time-frame :offset-assert 432) + (smack-speed meters :offset-assert 440) + (smack-normal vector :inline :offset-assert 448) + (glance-time time-frame :offset-assert 464) + (glance-speed meters :offset-assert 472) + (glance-in-transv vector :inline :offset-assert 480) + (glance-out-transv vector :inline :offset-assert 496) + (glance-normal vector :inline :offset-assert 512) + (on-flat-time time-frame :offset-assert 528) + (jump-land-time time-frame :offset-assert 536) + (slip-factor float :offset-assert 544) + (ground-on-dir vector :inline :offset-assert 560) + (ride-time time-frame :offset-assert 576) + (ride-start-time time-frame :offset-assert 584) + (ride-button-time time-frame :offset-assert 592) + (ride-lean-targ float :offset-assert 600) + (ride-lean float :offset-assert 604) + (ride-leanv float :offset-assert 608) + (ride-lean-mag float :offset-assert 612) + (ride-tilt-targ float :offset-assert 616) + (ride-tilt float :offset-assert 620) + (ride-tiltv float :offset-assert 624) + (ride-tilt-mag float :offset-assert 628) + (ride-lock symbol :offset-assert 632) + (ride-lock-on symbol :offset-assert 636) + (ride-speed meters :offset-assert 640) + (ride-mode uint32 :offset-assert 644) + (ride-rot degrees :offset-assert 648) + (ride-rot-old degrees :offset-assert 652) + (ride-rot-abs degrees 2 :offset-assert 656) + (ride-rtv-abs degrees :offset-assert 664) + (ride-touch-segment vector 2 :inline :offset-assert 672) + (ride-dir vector :inline :offset-assert 704) + (ride-vertex-length int16 :offset-assert 720) + (ride-vertex-length-old int16 :offset-assert 722) + (ride-vertex-base int16 :offset-assert 724) + (ride-vertex-base2 int16 :offset-assert 726) + (ride-vertex-index float :offset-assert 728) + (ride-vertex-index2 float :offset-assert 732) + (ride-vertex-index-old float :offset-assert 736) + (ride-vertex vector 3 :inline :offset-assert 752) + (ride-segment vector :inline :offset-assert 800) + (ride-dir-lean vector :inline :offset-assert 816) + (ride-pad-vector vector 1 :inline :offset-assert 832) + (ride-vertex-old vector 3 :inline :offset-assert 848) + (ride-segment-old vector :inline :offset-assert 896) + (ride-vertex-trail vector 128 :inline :offset-assert 912) + (halfpipe-side-time time-frame :offset-assert 2960) + (halfpipe-jump-time time-frame :offset-assert 2968) + (halfpipe-lip-time time-frame :offset-assert 2976) + (halfpipe-time time-frame :offset-assert 2984) + (halfpipe-gspot-time time-frame :offset-assert 2992) + (halfpipe-lip-event symbol :offset-assert 3000) + (spin-check-time time-frame :offset-assert 3008) + (spin-time time-frame :offset-assert 3016) + (spin-start-time time-frame :offset-assert 3024) + (spin-start-dir vector :inline :offset-assert 3040) + (spin-control float :offset-assert 3056) + (spin-ground-start-time time-frame :offset-assert 3064) + (spin-ground-time time-frame :offset-assert 3072) + (spin-ground-press-time time-frame :offset-assert 3080) + (flip-control float :offset-assert 3088) + (flip-count int32 :offset-assert 3092) + (trickx-count int32 :offset 3144) + (trotyv-max degrees :offset-assert 3148) + (trotyv degrees :offset-assert 3152) + (troty degrees :offset-assert 3156) + (troty-cum degrees :offset-assert 3160) + (upper-body-rotyv-max degrees :offset 3168) + (upper-body-rotyv degrees :offset-assert 3172) + (upper-body-roty degrees :offset-assert 3176) + (cushion-base meters :offset-assert 3180) + (cushion-offset meters :offset-assert 3184) + (shock-offset meters :offset-assert 3188) + (shock-offsetv meters :offset-assert 3192) + (shock-rotx meters :offset-assert 3196) + (trick-count int32 :offset 3204) + (pad uint8 :offset 3399) + ) + :method-count-assert 11 + :size-assert #xd48 + :flag-assert #xb00000d48 + (:methods + (board-info-method-9 () none 9) + (board-info-method-10 () none 10) + ) + ) + +;; definition for method 3 of type board-info +(defmethod inspect board-info ((obj board-info)) + (when (not obj) + (set! obj obj) + (goto cfg-19) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tboard: #x~X~%" (-> obj board)) + (format #t "~1Tcamera-interp: ~f~%" (-> obj camera-interp)) + (format #t "~1Tprocess: #x~X~%" (-> obj process)) + (format #t "~1Tboard-trans: ~`vector`P~%" (-> obj board-trans)) + (format #t "~1Tboard-quat: ~`vector`P~%" (-> obj board-quat)) + (format #t "~1Tboard-scale: ~`vector`P~%" (-> obj board-scale)) + (format #t "~1Tmain: ~A~%" (-> obj main)) + (format #t "~1Tupper-body: ~A~%" (-> obj upper-body)) + (format #t "~1Tsound-bank-knob: ~f~%" (-> obj sound-bank-knob)) + (format #t "~1Tsound-air-knob: ~f~%" (-> obj sound-air-knob)) + (format #t "~1Twind-sound-id: ~D~%" (-> obj wind-sound-id)) + (format #t "~1Twind-sound-pitch: ~f~%" (-> obj wind-sound-pitch)) + (format #t "~1Twind-sound-volume: ~f~%" (-> obj wind-sound-volume)) + (format #t "~1Tengine-sound-id: ~D~%" (-> obj engine-sound-id)) + (format #t "~1Tengine-sound-pitch: ~f~%" (-> obj engine-sound-pitch)) + (format #t "~1Tengine-sound-volume: ~f~%" (-> obj engine-sound-volume)) + (format #t "~1Tbank-sound-id: ~D~%" (-> obj bank-sound-id)) + (format #t "~1Tbank-sound-pitch: ~f~%" (-> obj bank-sound-pitch)) + (format #t "~1Tbank-sound-volume: ~f~%" (-> obj bank-sound-volume)) + (format #t "~1Tride-sound-id: ~D~%" (-> obj ride-sound-id)) + (format #t "~1Tspin-sound-id: ~D~%" (-> obj spin-sound-id)) + (format #t "~1Tspin-sound-volume: ~f~%" (-> obj spin-sound-volume)) + (format #t "~1Tspin-sound-pitch: ~f~%" (-> obj spin-sound-pitch)) + (format #t "~1Tup-vector[2] @ #x~X~%" (-> obj up-vector)) + (format #t "~1Tslow-transv: #~%" (-> obj slow-transv)) + (format #t "~1Tboard-time: ~D~%" (-> obj board-time)) + (format #t "~1Tboard-get-on-time: ~D~%" (-> obj board-get-on-time)) + (format #t "~1Tin-air-time: ~D~%" (-> obj in-air-time)) + (format #t "~1Tstick-lock: ~A~%" (-> obj stick-lock)) + (format #t "~1Tstick-off: ~A~%" (-> obj stick-off)) + (format #t "~1Tstance-info: #~%" (-> obj stance-info)) + (format #t "~1Tmods-backup: ~A~%" (-> obj mods-backup)) + (format #t "~1Tattack-id: ~D~%" (-> obj attack-id)) + (format #t "~1Tlatch?: ~A~%" (-> obj latch?)) + (format #t "~1Tunstuck-time: ~D~%" (-> obj unstuck-time)) + (format #t "~1Tstuck-count: ~D~%" (-> obj stuck-count)) + (format #t "~1Tthrust-scale: ~f~%" (-> obj thrust-scale)) + (format #t "~1Tflip-time: ~D~%" (-> obj flip-time)) + (format #t "~1Ttransv-max: (meters ~m)~%" (-> obj transv-max)) + (format #t "~1Tturn-anim-tilt?: ~A~%" (-> obj turn-anim-tilt?)) + (format #t "~1Tturn-anim-mag: ~f~%" (-> obj turn-anim-mag)) + (format #t "~1Tturn-anim-targ: ~f~%" (-> obj turn-anim-targ)) + (format #t "~1Tturn-anim-frame: ~f~%" (-> obj turn-anim-frame)) + (format #t "~1Tturn-anim-vel: ~f~%" (-> obj turn-anim-vel)) + (format #t "~1Tturn-anim-duck: ~f~%" (-> obj turn-anim-duck)) + (format #t "~1Tturn-anim-duck-vel: ~f~%" (-> obj turn-anim-duck-vel)) + (format #t "~1Ttilt-anim-frame: ~`vector`P~%" (-> obj tilt-anim-frame)) + (format #t "~1Ttilt-anim-targ: ~`vector`P~%" (-> obj tilt-anim-target)) + (format #t "~1Tsmack-surface-time: ~D~%" (-> obj smack-surface-time)) + (format #t "~1Tsmack-speed: (meters ~m)~%" (-> obj smack-speed)) + (format #t "~1Tsmack-normal: ~`vector`P~%" (-> obj smack-normal)) + (format #t "~1Tglance-time: ~D~%" (-> obj glance-time)) + (format #t "~1Tglance-speed: (meters ~m)~%" (-> obj glance-speed)) + (format #t "~1Tglance-in-transv: ~`vector`P~%" (-> obj glance-in-transv)) + (format #t "~1Tglance-out-transv: ~`vector`P~%" (-> obj glance-out-transv)) + (format #t "~1Tglance-normal: ~`vector`P~%" (-> obj glance-normal)) + (format #t "~1Ton-flat-time: ~D~%" (-> obj on-flat-time)) + (format #t "~1Tjump-land-time: ~D~%" (-> obj jump-land-time)) + (format #t "~1Tslip-factor: ~f~%" (-> obj slip-factor)) + (format #t "~1Tground-on-dir: ~`vector`P~%" (-> obj ground-on-dir)) + (format #t "~1Tride-time: ~D~%" (-> obj ride-time)) + (format #t "~1Tride-start-time: ~D~%" (-> obj ride-start-time)) + (format #t "~1Tride-button-time: ~D~%" (-> obj ride-button-time)) + (format #t "~1Tride-lean-targ: ~f~%" (-> obj ride-lean-targ)) + (format #t "~1Tride-lean: ~f~%" (-> obj ride-lean)) + (format #t "~1Tride-leanv: ~f~%" (-> obj ride-leanv)) + (format #t "~1Tride-lean-mag: ~f~%" (-> obj ride-lean-mag)) + (format #t "~1Tride-tilt-targ: ~f~%" (-> obj ride-tilt-targ)) + (format #t "~1Tride-tilt: ~f~%" (-> obj ride-tilt)) + (format #t "~1Tride-tiltv: ~f~%" (-> obj ride-tiltv)) + (format #t "~1Tride-tilt-mag: ~f~%" (-> obj ride-tilt-mag)) + (format #t "~1Tride-lock: ~A~%" (-> obj ride-lock)) + (format #t "~1Tride-lock-on: ~A~%" (-> obj ride-lock-on)) + (format #t "~1Tride-speed: (meters ~m)~%" (-> obj ride-speed)) + (format #t "~1Tride-mode: ~D~%" (-> obj ride-mode)) + (format #t "~1Tride-rot: (deg ~r)~%" (-> obj ride-rot)) + (format #t "~1Tride-rot-old: (deg ~r)~%" (-> obj ride-rot-old)) + (format #t "~1Tride-rot-abs[2] @ #x~X~%" (-> obj ride-rot-abs)) + (dotimes (s5-0 2) + (format #t "~T [~D]~1Tride-rot-abs: (deg ~r)~%" s5-0 (-> obj ride-rot-abs s5-0)) + ) + (format #t "~1Tride-rotv-abs: (deg ~r)~%" (-> obj ride-rtv-abs)) + (format #t "~1Tride-touch-segment[2] @ #x~X~%" (-> obj ride-touch-segment)) + (dotimes (s5-1 2) + (format #t "~T [~D]~1Tride-touch-segment: ~`vector`P~%" s5-1 (-> obj ride-touch-segment s5-1)) + ) + (format #t "~1Tride-dir: ~`vector`P~%" (-> obj ride-dir)) + (format #t "~1Tride-vertex-length: ~D~%" (-> obj ride-vertex-length)) + (format #t "~1Tride-vertex-length-old: ~D~%" (-> obj ride-vertex-length-old)) + (format #t "~1Tride-vertex-base: ~D~%" (-> obj ride-vertex-base)) + (format #t "~1Tride-vertex-base2: ~D~%" (-> obj ride-vertex-base2)) + (format #t "~1Tride-vertex-index: ~f~%" (-> obj ride-vertex-index)) + (format #t "~1Tride-vertex-index2: ~f~%" (-> obj ride-vertex-index2)) + (format #t "~1Tride-vertex-index-old: ~f~%" (-> obj ride-vertex-index-old)) + (format #t "~1Tride-vertex[3] @ #x~X~%" (-> obj ride-vertex)) + (dotimes (s5-2 3) + (format #t "~T [~D]~1Tride-vertex: ~`vector`P~%" s5-2 (-> obj ride-vertex s5-2)) + ) + (format #t "~1Tride-segment: ~`vector`P~%" (-> obj ride-segment)) + (format #t "~1Tride-dir-lean: ~`vector`P~%" (-> obj ride-dir-lean)) + (format #t "~1Tride-pad-vector[1] @ #x~X~%" (-> obj ride-pad-vector)) + (format #t "~1Tride-vertex-old[3] @ #x~X~%" (-> obj ride-vertex-old)) + (dotimes (s5-3 3) + (format #t "~T [~D]~1Tride-vertex-old: ~`vector`P~%" s5-3 (-> obj ride-vertex-old s5-3)) + ) + (format #t "~1Tride-segment-old: ~`vector`P~%" (-> obj ride-segment-old)) + (format #t "~1Tride-vertex-trail[128] @ #x~X~%" (-> obj ride-vertex-trail)) + (dotimes (s5-4 128) + (format #t "~T [~D]~1Tride-vertex-trail: ~`vector`P~%" s5-4 (-> obj ride-vertex-trail s5-4)) + ) + (format #t "~1Thalfpipe-side-time: ~D~%" (-> obj halfpipe-side-time)) + (format #t "~1Thalfpipe-jump-time: ~D~%" (-> obj halfpipe-jump-time)) + (format #t "~1Thalfpipe-lip-time: ~D~%" (-> obj halfpipe-lip-time)) + (format #t "~1Thalfpipe-time: ~D~%" (-> obj halfpipe-time)) + (format #t "~1Thalfpipe-gspot-time: ~D~%" (-> obj halfpipe-gspot-time)) + (format #t "~1Thalfpipe-lip-event: ~A~%" (-> obj halfpipe-lip-event)) + (format #t "~1Tspin-check-time: ~D~%" (-> obj spin-check-time)) + (format #t "~1Tspin-time: ~D~%" (-> obj spin-time)) + (format #t "~1Tspin-start-time: ~D~%" (-> obj spin-start-time)) + (format #t "~1Tspin-start-dir: ~`vector`P~%" (-> obj spin-start-dir)) + (format #t "~1Tspin-control: ~f~%" (-> obj spin-control)) + (format #t "~1Tspin-ground-start-time: ~D~%" (-> obj spin-ground-start-time)) + (format #t "~1Tspin-ground-time: ~D~%" (-> obj spin-ground-time)) + (format #t "~1Tspin-ground-press-time: ~D~%" (-> obj spin-ground-press-time)) + (format #t "~1Tflip-control: ~f~%" (-> obj flip-control)) + (format #t "~1Tflip-count: ~D~%" (-> obj flip-count)) + (format #t "~1Ttrickx-count: ~D~%" (-> obj trickx-count)) + (format #t "~1Trotyv-max: (deg ~r)~%" (-> obj trotyv-max)) + (format #t "~1Trotyv: (deg ~r)~%" (-> obj trotyv)) + (format #t "~1Troty: (deg ~r)~%" (-> obj troty)) + (format #t "~1Troty-cum: (deg ~r)~%" (&-> obj troty-cum)) + (format #t "~1Tupper-body-rotyv-max: (deg ~r)~%" (-> obj upper-body-rotyv-max)) + (format #t "~1Tupper-body-rotyv: (deg ~r)~%" (-> obj upper-body-rotyv)) + (format #t "~1Tupper-body-roty: (deg ~r)~%" (-> obj upper-body-roty)) + (format #t "~1Tcushion-base: (meters ~m)~%" (-> obj cushion-base)) + (format #t "~1Tcushion-offset: (meters ~m)~%" (-> obj cushion-offset)) + (format #t "~1Tshock-offset: (meters ~m)~%" (-> obj shock-offset)) + (format #t "~1Tshock-offsetv: (meters ~m)~%" (-> obj shock-offsetv)) + (format #t "~1Tshock-rotx: (meters ~m)~%" (-> obj shock-rotx)) + (format #t "~1Ttrick-count: ~D~%" (-> obj trick-count)) + (label cfg-19) + obj + ) + +;; definition of type target-board-bank +(deftype target-board-bank (basic) + ((jump-height-min meters :offset-assert 4) + (jump-height-max meters :offset-assert 8) + (duck-jump-height-min meters :offset-assert 12) + (duck-jump-height-max meters :offset-assert 16) + (turn-frames float :offset-assert 20) + (wall-kick-window seconds :offset-assert 24) + (cushion meters :offset-assert 32) + (trickx-jump-height-min meters :offset-assert 36) + (trickx-jump-height-max meters :offset-assert 40) + (tricky-jump-height-min meters :offset-assert 44) + (tricky-jump-height-max meters :offset-assert 48) + ) + :method-count-assert 9 + :size-assert #x34 + :flag-assert #x900000034 + ) + +;; definition for method 3 of type target-board-bank +(defmethod inspect target-board-bank ((obj target-board-bank)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tjump-height-min: (meters ~m)~%" (-> obj jump-height-min)) + (format #t "~1Tjump-height-max: (meters ~m)~%" (-> obj jump-height-max)) + (format #t "~1Tduck-jump-height-min: (meters ~m)~%" (-> obj duck-jump-height-min)) + (format #t "~1Tduck-jump-height-max: (meters ~m)~%" (-> obj duck-jump-height-max)) + (format #t "~1Tturn-frames: ~f~%" (-> obj turn-frames)) + (format #t "~1Twall-kick-window: (seconds ~e)~%" (-> obj wall-kick-window)) + (format #t "~1Tcushion: (meters ~m)~%" (-> obj cushion)) + (format #t "~1Ttrickx-jump-height-min: (meters ~m)~%" (-> obj trickx-jump-height-min)) + (format #t "~1Ttrickx-jump-height-max: (meters ~m)~%" (-> obj trickx-jump-height-max)) + (format #t "~1Ttricky-jump-height-min: (meters ~m)~%" (-> obj tricky-jump-height-min)) + (format #t "~1Ttricky-jump-height-max: (meters ~m)~%" (-> obj tricky-jump-height-max)) + (label cfg-4) + obj + ) + +;; definition for symbol *TARGET_BOARD-bank*, type target-board-bank +(define *TARGET_BOARD-bank* (new 'static 'target-board-bank + :jump-height-min (meters 1.01) + :jump-height-max (meters 3.5) + :duck-jump-height-min (meters 2.5) + :duck-jump-height-max (meters 5) + :turn-frames 10.0 + :wall-kick-window (seconds 0.05) + :cushion (meters 1) + :trickx-jump-height-min (meters 0.9) + :trickx-jump-height-max (meters 1.2) + :tricky-jump-height-min (meters 0.9) + :tricky-jump-height-max (meters 1.2) + ) + ) + +;; definition for function want-to-board? +;; INFO: Used lq/sq +(defbehavior want-to-board? target () + (and (logtest? (-> self game features) (game-feature board)) + (or (and (cpad-pressed? (-> self control unknown-cpad-info00 number) r2) + (or (!= *cheat-mode* 'debug) + (zero? (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons l2)) + ) + ) + (not *pause-lock*) + (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame01)) (seconds 0.1)) + (>= (the-as int (-> self control unknown-dword00)) (the-as int (-> self control unknown-dword01))) + ) + (-> self board latch?) + ) + (zero? (logand (focus-status fs1 fs6 fs7 fs8 fs12 fs13 fs18 fs20 fs21 fs22) (-> self focus-status))) + (or (zero? (-> self board)) (>= (- (-> self clock frame-counter) (-> self board board-time)) (seconds 0.5))) + (zero? (logand (state-flags sf17) (-> self state-flags))) + (< (-> self board board-time) (-> self control unknown-time-frame00)) + (zero? (logand (surface-flag no-board) (-> self control unknown-surface00 flags))) + (or (zero? (logand (-> self control unknown-surface00 flags) (surface-flag duck))) + (begin self (can-exit-duck?)) + ) + (not (and (logtest? (-> self water flags) (water-flags under-water)) + (zero? (logand (-> self water flags) (water-flags swim-ground))) + ) + ) + (not *artist-fix-visible*) + (let ((gp-0 (new 'stack-no-clear 'collide-query))) + (let ((s5-0 (new 'stack-no-clear 'inline-array 'sphere 3))) + (dotimes (s4-0 3) + ((method-of-type sphere new) (the-as symbol (-> s5-0 s4-0)) sphere) + ) + (let ((v1-51 (new 'stack-no-clear 'vector))) + (set! (-> v1-51 quad) (-> self control trans quad)) + (if (logtest? (-> self focus-status) (focus-status fs10)) + (set! (-> v1-51 y) (-> self water height)) + ) + (set! (-> s5-0 0 quad) (-> v1-51 quad)) + (set! (-> s5-0 0 y) (+ 8192.0 (-> s5-0 0 y))) + (set! (-> s5-0 0 w) 2867.2) + (set! (-> s5-0 1 quad) (-> v1-51 quad)) + (set! (-> s5-0 1 y) (+ 12288.0 (-> s5-0 1 y))) + (set! (-> s5-0 1 w) 2867.2) + (set! (-> s5-0 2 quad) (-> v1-51 quad)) + ) + (set! (-> s5-0 2 y) (+ 16384.0 (-> s5-0 2 y))) + (set! (-> s5-0 2 w) 2867.2) + (let ((v1-55 gp-0)) + (set! (-> v1-55 spheres) s5-0) + (set! (-> v1-55 num-spheres) (the-as uint 3)) + (set! (-> v1-55 collide-with) + (the-as collide-spec (logand -16561 (-> self control root-prim prim-core collide-with))) + ) + (set! (-> v1-55 ignore-process0) #f) + (set! (-> v1-55 ignore-process1) #f) + (set! (-> v1-55 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-55 solid-only) #t) + (set! (-> v1-55 action-mask) (the-as uint 1)) + ) + ) + (and (if (fill-and-probe-using-spheres *collide-cache* gp-0) + #f + #t + ) + (begin + (set! (-> self board latch?) #t) + (>= (- (-> self clock frame-counter) (-> self gun gun-time)) (seconds 0.4)) + ) + ) + ) + ) + ) + +;; failed to figure out what this is: +(let ((a0-6 (new 'static 'skeleton-group + :name "skel-board" + :extra #f + :info #f + :art-group-name "board" + :bounds (new 'static 'vector :w 14336.0) + :version #x7 + :shadow 2 + :sort 1 + :origin-joint-index 3 + ) + ) + ) + (set! (-> a0-6 jgeo) 0) + (set! (-> a0-6 janim) 5) + (set! (-> a0-6 mgeo 0) 1) + (set! (-> a0-6 lod-dist 0) 4095996000.0) + (add-to-loading-level a0-6) + ) + +;; definition for symbol *board-shadow-control*, type shadow-control +(define *board-shadow-control* + (new 'static 'shadow-control :settings (new 'static 'shadow-settings + :center (new 'static 'vector :w (the-as float #xa)) + :shadow-dir (new 'static 'vector :y -1.0 :w 614400.0) + :bot-plane (new 'static 'plane :y 1.0 :w 81920.0) + :top-plane (new 'static 'plane :y 1.0 :w 2048.0) + ) + ) + ) + + + + diff --git a/test/decompiler/reference/jak2/engine/target/board/board-util_REF.gc b/test/decompiler/reference/jak2/engine/target/board/board-util_REF.gc new file mode 100644 index 0000000000..d98a4adbb4 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/target/board/board-util_REF.gc @@ -0,0 +1,263 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 7 of type board +;; INFO: Return type mismatch process-drawable vs board. +(defmethod relocate board ((obj board) (arg0 int)) + (if (nonzero? (-> obj main)) + (&+! (-> obj main) arg0) + ) + (the-as board ((method-of-type process-drawable relocate) obj arg0)) + ) + +;; definition for function board-post +;; INFO: Used lq/sq +;; INFO: Return type mismatch int vs none. +(defbehavior board-post board () + (let* ((a0-0 (-> self parent)) + (v1-0 (if a0-0 + (the-as target (-> (the-as target (-> a0-0 0)) self)) + ) + ) + ) + (set! (-> self root trans quad) (-> v1-0 board board-trans quad)) + (let ((a0-4 (-> v1-0 board board-quat quad))) + (set! (-> self root quat vec quad) a0-4) + ) + (set! (-> self root scale quad) (-> v1-0 board board-scale quad)) + (set! (-> self draw light-index) (-> v1-0 draw light-index)) + (let ((a0-10 (-> v1-0 draw color-mult quad))) + (set! (-> self draw color-mult quad) a0-10) + ) + (let ((a0-12 (-> v1-0 draw color-emissive quad))) + (set! (-> self draw color-emissive quad) a0-12) + ) + (set! (-> self draw force-fade) (-> v1-0 draw force-fade)) + (set! (-> self draw death-vertex-skip) (-> (the-as target (-> self parent 0)) draw death-vertex-skip)) + (set! (-> self draw death-effect) (-> (the-as target (-> self parent 0)) draw death-effect)) + (set! (-> self draw death-timer) (-> (the-as target (-> self parent 0)) draw death-timer)) + (set! (-> self draw death-timer-org) (-> (the-as target (-> self parent 0)) draw death-timer-org)) + (set! (-> self draw death-draw-overlap) (-> (the-as target (-> self parent 0)) draw death-draw-overlap)) + (let ((a0-37 (-> v1-0 draw shadow-ctrl settings shadow-dir quad))) + (set! (-> self draw shadow-ctrl settings shadow-dir quad) a0-37) + ) + (if (or (logtest? (-> v1-0 draw status) (draw-control-status no-draw no-draw-temp no-draw-bounds no-draw-bounds2)) + (zero? (-> v1-0 skel active-channels)) + ) + (logior! (-> self draw status) (draw-control-status no-draw)) + (logclear! (-> self draw status) (draw-control-status no-draw)) + ) + (if (logtest? (-> v1-0 draw status) (draw-control-status force-fade)) + (logior! (-> self draw status) (draw-control-status force-fade)) + (logclear! (-> self draw status) (draw-control-status force-fade)) + ) + ) + (ja-post) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate hidden (board) + :virtual #t + :trans (behavior () + (let ((v1-0 (-> self parent))) + (if (zero? (logand (-> (the-as target (if v1-0 + (the-as target (-> v1-0 0 self)) + ) + ) + focus-status + ) + (focus-status fs8) + ) + ) + (go-virtual idle #f) + ) + ) + (none) + ) + :code (behavior () + (ja-channel-set! 0) + (ja-post) + (logior! (-> self mask) (process-mask sleep-code)) + (suspend) + 0 + (none) + ) + ) + +;; failed to figure out what this is: +(defstate idle (board) + :virtual #t + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('open) + (go-virtual use) + ) + ) + ) + :trans (behavior () + (let ((v1-0 (-> self parent))) + (if (logtest? (-> (the-as target (if v1-0 + (the-as target (-> v1-0 0 self)) + ) + ) + focus-status + ) + (focus-status fs8) + ) + (go-virtual hidden) + ) + ) + (none) + ) + :code (behavior ((arg0 symbol)) + (ja-channel-push! 1 (seconds 0.1)) + (cond + (arg0 + (let ((gp-1 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 4)) + (the-as (function joint-control-channel float float float float) num-func-identity) + ) + (set! (-> gp-1 frame-num) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 4)) frames num-frames) -1)) + ) + ) + ) + (else + (let ((a0-3 (-> self skel root-channel 0))) + (set! (-> a0-3 frame-group) (the-as art-joint-anim (-> self draw art-group data 4))) + (set! (-> a0-3 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 4)) frames num-frames) -1)) + ) + (set! (-> a0-3 param 1) 1.0) + (set! (-> a0-3 frame-num) 0.0) + (joint-control-channel-group! + a0-3 + (the-as art-joint-anim (-> self draw art-group data 4)) + (the-as (function joint-control-channel float float float float) num-func-seek!) + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-4 (-> self skel root-channel 0))) + (set! (-> a0-4 param 0) (the float (+ (-> a0-4 frame-group frames num-frames) -1))) + (set! (-> a0-4 param 1) 1.0) + (joint-control-channel-group-eval! + a0-4 + (the-as art-joint-anim #f) + (the-as (function joint-control-channel float float float float) num-func-seek!) + ) + ) + ) + ) + ) + (set! (-> self draw shadow) #f) + (sleep-code) + (none) + ) + :post board-post + ) + +;; failed to figure out what this is: +(defstate use (board) + :virtual #t + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('close) + (go-virtual idle #f) + ) + ) + ) + :trans (behavior () + (let ((v1-0 (-> self parent))) + (if v1-0 + (-> v1-0 0 self) + ) + ) + (let ((v1-2 (-> self parent))) + (cond + ((logtest? (-> (the-as target (if v1-2 + (the-as target (-> v1-2 0 self)) + ) + ) + focus-status + ) + (focus-status fs8) + ) + (go-virtual hidden) + ) + ((let ((v1-9 #x40000) + (a0-3 (-> self parent)) + ) + (zero? (logand (the-as focus-status v1-9) (-> (the-as target (if a0-3 + (the-as target (-> a0-3 0 self)) + ) + ) + focus-status + ) + ) + ) + ) + (go-virtual idle #f) + ) + ) + ) + (none) + ) + :code (behavior () + (set! (-> self draw shadow) (-> self shadow-backup)) + (ja-channel-push! 1 (seconds 0.1)) + (let ((a0-2 (-> self skel root-channel 0))) + (set! (-> a0-2 frame-group) (the-as art-joint-anim (-> self draw art-group data 3))) + (set! (-> a0-2 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) frames num-frames) -1)) + ) + (set! (-> a0-2 param 1) 1.0) + (set! (-> a0-2 frame-num) 0.0) + (joint-control-channel-group! + a0-2 + (the-as art-joint-anim (-> self draw art-group data 3)) + (the-as (function joint-control-channel float float float float) num-func-seek!) + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-3 (-> self skel root-channel 0))) + (set! (-> a0-3 param 0) (the float (+ (-> a0-3 frame-group frames num-frames) -1))) + (set! (-> a0-3 param 1) 1.0) + (joint-control-channel-group-eval! + a0-3 + (the-as art-joint-anim #f) + (the-as (function joint-control-channel float float float float) num-func-seek!) + ) + ) + ) + (sleep-code) + (none) + ) + :post board-post + ) + +;; definition for function board-init +;; INFO: Used lq/sq +;; INFO: Return type mismatch object vs none. +(defbehavior board-init board () + (set! (-> self root) (new 'process 'trsqv)) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-board" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (let ((v1-5 (-> *target-shadow-control* settings shadow-dir quad))) + (set! (-> *board-shadow-control* settings shadow-dir quad) v1-5) + ) + (set! (-> self draw shadow-ctrl) *board-shadow-control*) + (set! (-> self shadow-backup) (-> self draw shadow)) + (set! (-> self main) (new 'process 'joint-mod (joint-mod-mode flex-blend) self 3)) + (ja-channel-set! 0) + (go-virtual idle #t) + (none) + ) diff --git a/test/decompiler/reference/jak2/engine/target/darkjak-h_REF.gc b/test/decompiler/reference/jak2/engine/target/darkjak-h_REF.gc new file mode 100644 index 0000000000..c086700fc9 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/target/darkjak-h_REF.gc @@ -0,0 +1,53 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type darkjak-info +(deftype darkjak-info (basic) + ((process uint32 :offset-assert 4) + (attack-id uint32 :offset-assert 8) + (start-time time-frame :offset-assert 16) + (attack-time time-frame :offset-assert 24) + (attack-count uint64 :offset-assert 32) + (stage uint32 :offset-assert 40) + (want-stage uint32 :offset-assert 44) + (clock-pos float :offset-assert 48) + (clock-vel float :offset-assert 52) + (clock-on symbol :offset-assert 56) + (hud handle 1 :offset 64) + (tone uint32 :offset 72) + (bomb uint32 :offset 76) + ) + :method-count-assert 10 + :size-assert #x50 + :flag-assert #xa00000050 + (:methods + (darkjak-info-method-9 (_type_ int) none :behavior target 9) + ) + ) + +;; definition for method 3 of type darkjak-info +(defmethod inspect darkjak-info ((obj darkjak-info)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tprocess: #x~X~%" (-> obj process)) + (format #t "~1Tattack-id: ~D~%" (-> obj attack-id)) + (format #t "~1Tstart-time: ~D~%" (-> obj start-time)) + (format #t "~1Tattack-time: ~D~%" (-> obj attack-time)) + (format #t "~1Tattack-count: ~D~%" (-> obj attack-count)) + (format #t "~1Tstage: ~D~%" (-> obj stage)) + (format #t "~1Twant-stage: ~D~%" (-> obj want-stage)) + (format #t "~1Tclock-pos: ~f~%" (-> obj clock-pos)) + (format #t "~1Tclock-vel: ~f~%" (-> obj clock-vel)) + (format #t "~1Tclock-on: ~A~%" (-> obj clock-on)) + (format #t "~1Thud[1] @ #x~X~%" (-> obj hud)) + (format #t "~1Ttone: ~D~%" (-> obj tone)) + (format #t "~1Tbomb: ~D~%" (-> obj bomb)) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +0 diff --git a/test/decompiler/reference/jak2/engine/target/gun/gun-h_REF.gc b/test/decompiler/reference/jak2/engine/target/gun/gun-h_REF.gc index ade8421087..e5b7020602 100644 --- a/test/decompiler/reference/jak2/engine/target/gun/gun-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/gun/gun-h_REF.gc @@ -3,23 +3,23 @@ ;; definition of type gun (deftype gun (process-drawable) - ((control basic :offset 128) - (shadow-backup basic :offset 208) - (read-scale basic :offset-assert 212) - (gun-type pickup-type :offset-assert 216) - (barrel basic :offset-assert 220) - (mag basic 4 :offset-assert 224) - (mag-scale float 4 :offset-assert 240) + ((control control-info :offset 128) + (shadow-backup shadow-geo :offset 208) + (read-scale basic :offset-assert 212) + (gun-type pickup-type :offset-assert 216) + (barrel joint-mod :offset-assert 220) + (mag joint-mod 4 :offset-assert 224) + (mag-scale float 4 :offset-assert 240) ) :heap-base #x80 :method-count-assert 24 :size-assert #x100 :flag-assert #x1800800100 (:methods - (gun-method-20 () none 20) - (gun-method-21 () none 21) - (gun-method-22 () none 22) - (gun-method-23 () none 23) + (idle () _type_ :state 20) + (use (symbol) _type_ :state 21) + (hidden () _type_ :state 22) + (die () _type_ :state 23) ) ) @@ -46,94 +46,94 @@ ;; definition of type gun-info (deftype gun-info (basic) - ((process uint32 :offset-assert 4) - (gun uint32 :offset-assert 8) - (gun-pos transformq :inline :offset-assert 16) - (gun-trans vector :inline :offset 16) - (gun-quat quaternion :inline :offset 32) - (gun-scale vector :inline :offset 48) - (gun-type pickup-type :offset-assert 64) - (using-gun-type pickup-type :offset-assert 68) - (active? symbol :offset-assert 72) - (latch? symbol :offset-assert 76) - (put-away? symbol :offset-assert 80) - (surpress-time time-frame :offset-assert 88) - (fire-time time-frame :offset-assert 96) - (gun-time time-frame :offset-assert 104) - (gun-get-on-time time-frame :offset-assert 112) - (active-time time-frame :offset-assert 120) - (fire-delay uint32 :offset-assert 128) - (gun-control uint32 :offset-assert 132) - (gun-target uint32 :offset-assert 136) - (gun-daxter float :offset-assert 140) - (gun-roty-rel degrees :offset-assert 144) - (gun-roty degrees :offset-assert 148) - (gun-roty-targ degrees :offset-assert 152) - (hips basic :offset-assert 156) - (upper-body basic :offset-assert 160) - (chest basic :offset-assert 164) - (fire-dir-rot degrees :offset-assert 168) - (fire-dir vector 2 :inline :offset-assert 176) - (fire-point vector :inline :offset-assert 208) - (fire-dir-backup vector :inline :offset-assert 224) - (fire-dir-out vector :inline :offset-assert 240) - (fire-pending int32 :offset-assert 256) - (fire-pending-time time-frame :offset-assert 264) - (fire-start-time time-frame :offset-assert 272) - (fire-charge float :offset-assert 280) - (fire-spin degrees :offset-assert 284) - (fire-spinv degrees :offset-assert 288) - (fire-chamber int32 :offset-assert 292) - (fire-range meters :offset-assert 296) - (laser-active? symbol :offset-assert 300) - (laser-point vector :inline :offset-assert 304) - (laser-dir vector 2 :inline :offset-assert 320) - (laser-hit-point vector :inline :offset-assert 352) - (track? uint16 :offset-assert 368) - (track-tilt degrees :offset-assert 372) - (track-turn degrees :offset-assert 376) - (track-find-range meters :offset-assert 380) - (track-turnv-range meters :offset-assert 384) - (track-tilt-range meters :offset-assert 388) - (track-turn-range meters :offset-assert 392) - (track-tilt-max degrees :offset-assert 396) - (track-turn-max degrees :offset-assert 400) - (track-angle-mult float :offset-assert 404) - (track-beam-size float :offset-assert 408) - (track-auto-fire symbol :offset-assert 412) - (track-require uint32 :offset-assert 416) - (track-target-hold-time time-frame :offset-assert 424) - (track-start-time time-frame :offset-assert 432) - (track-press-start-time time-frame :offset-assert 440) - (track-target focus 2 :inline :offset-assert 448) - (track-trans vector :inline :offset-assert 480) - (track-dir vector :inline :offset-assert 496) - (turn-fast-hold-time time-frame :offset-assert 512) - (blue-whine-sound-id uint32 :offset-assert 520) - (blue-whine-volume float :offset-assert 524) - (top-anim-twist vector :inline :offset-assert 528) - (top-anim-twist-targ vector :inline :offset-assert 544) - (top-anim-look-at vector :inline :offset-assert 560) - (top-anim-twist-reset uint64 :offset-assert 576) - (top-anim-gun-height meters :offset-assert 584) - (top-anim-blue-cycle float :offset-assert 588) - (top-anim-low-high float :offset-assert 592) - (top-anim-extra-twistv degrees :offset-assert 596) - (top-anim-tilt-up degrees :offset-assert 600) - (attack-combo combo-tracker :inline :offset-assert 608) - (combo-window-start time-frame :offset-assert 656) - (combo-window-state uint32 :offset-assert 664) - (combo-fire-delay uint32 :offset-assert 668) - (charge-ammo float :offset-assert 672) - (charge-start-time time-frame :offset-assert 680) - (charge-inc-time time-frame :offset-assert 688) - (charge-active? uint64 :offset-assert 696) + ((process (pointer target) :offset-assert 4) + (gun (pointer gun) :offset-assert 8) + (gun-pos transformq :inline :offset-assert 16) + (gun-trans vector :inline :offset 16) + (gun-quat quaternion :inline :offset 32) + (gun-scale vector :inline :offset 48) + (gun-type pickup-type :offset-assert 64) + (using-gun-type pickup-type :offset-assert 68) + (active? symbol :offset-assert 72) + (latch? symbol :offset-assert 76) + (put-away? symbol :offset-assert 80) + (surpress-time time-frame :offset-assert 88) + (fire-time time-frame :offset-assert 96) + (gun-time time-frame :offset-assert 104) + (gun-get-on-time time-frame :offset-assert 112) + (active-time time-frame :offset-assert 120) + (fire-delay uint32 :offset-assert 128) + (gun-control uint32 :offset-assert 132) + (gun-target uint32 :offset-assert 136) + (gun-daxter float :offset-assert 140) + (gun-roty-rel degrees :offset-assert 144) + (gun-roty degrees :offset-assert 148) + (gun-roty-targ degrees :offset-assert 152) + (hips basic :offset-assert 156) + (upper-body basic :offset-assert 160) + (chest basic :offset-assert 164) + (fire-dir-rot degrees :offset-assert 168) + (fire-dir vector 2 :inline :offset-assert 176) + (fire-point vector :inline :offset-assert 208) + (fire-dir-backup vector :inline :offset-assert 224) + (fire-dir-out vector :inline :offset-assert 240) + (fire-pending int32 :offset-assert 256) + (fire-pending-time time-frame :offset-assert 264) + (fire-start-time time-frame :offset-assert 272) + (fire-charge float :offset-assert 280) + (fire-spin degrees :offset-assert 284) + (fire-spinv degrees :offset-assert 288) + (fire-chamber int32 :offset-assert 292) + (fire-range meters :offset-assert 296) + (laser-active? symbol :offset-assert 300) + (laser-point vector :inline :offset-assert 304) + (laser-dir vector 2 :inline :offset-assert 320) + (laser-hit-point vector :inline :offset-assert 352) + (track? uint16 :offset-assert 368) + (track-tilt degrees :offset-assert 372) + (track-turn degrees :offset-assert 376) + (track-find-range meters :offset-assert 380) + (track-turnv-range meters :offset-assert 384) + (track-tilt-range meters :offset-assert 388) + (track-turn-range meters :offset-assert 392) + (track-tilt-max degrees :offset-assert 396) + (track-turn-max degrees :offset-assert 400) + (track-angle-mult float :offset-assert 404) + (track-beam-size float :offset-assert 408) + (track-auto-fire symbol :offset-assert 412) + (track-require uint32 :offset-assert 416) + (track-target-hold-time time-frame :offset-assert 424) + (track-start-time time-frame :offset-assert 432) + (track-press-start-time time-frame :offset-assert 440) + (track-target focus 2 :inline :offset-assert 448) + (track-trans vector :inline :offset-assert 480) + (track-dir vector :inline :offset-assert 496) + (turn-fast-hold-time time-frame :offset-assert 512) + (blue-whine-sound-id uint32 :offset-assert 520) + (blue-whine-volume float :offset-assert 524) + (top-anim-twist vector :inline :offset-assert 528) + (top-anim-twist-targ vector :inline :offset-assert 544) + (top-anim-look-at vector :inline :offset-assert 560) + (top-anim-twist-reset uint64 :offset-assert 576) + (top-anim-gun-height meters :offset-assert 584) + (top-anim-blue-cycle float :offset-assert 588) + (top-anim-low-high float :offset-assert 592) + (top-anim-extra-twistv degrees :offset-assert 596) + (top-anim-tilt-up degrees :offset-assert 600) + (attack-combo combo-tracker :inline :offset-assert 608) + (combo-window-start time-frame :offset-assert 656) + (combo-window-state uint32 :offset-assert 664) + (combo-fire-delay uint32 :offset-assert 668) + (charge-ammo float :offset-assert 672) + (charge-start-time time-frame :offset-assert 680) + (charge-inc-time time-frame :offset-assert 688) + (charge-active? uint64 :offset-assert 696) ) :method-count-assert 10 :size-assert #x2c0 :flag-assert #xa000002c0 (:methods - (gun-info-method-9 () none 9) + (gun-info-method-9 (_type_) none 9) ) ) diff --git a/test/offline/config/jak2/config.jsonc b/test/offline/config/jak2/config.jsonc index 7bb9f6366e..e3848e4278 100644 --- a/test/offline/config/jak2/config.jsonc +++ b/test/offline/config/jak2/config.jsonc @@ -49,7 +49,7 @@ // - never fixed this one in jak 1, assumed there was an original bug? "print-game-text", // joint asm - "cspace<-parented-transformq-joint!", "(method 11 art-joint-anim-manager)", "make-joint-jump-tables", + "cspace<-parented-transformq-joint!", "(method 11 art-joint-anim-manager)", "make-joint-jump-tables", "joint-channel-copy!", // default menu // - causes a decompiler hang "dm-cam-setting-float", @@ -87,6 +87,10 @@ // cam-update "update-visible", // assertion crash when filling out bsp-header // placeholder + + // gun-util + "draw-beam", "(method 9 gun-info)", + "i-hopefully-will-never-exist-dont-add-anything-after-me-please" ],