From b1b5cbb1439f3867569d7838738d863acfee9e11 Mon Sep 17 00:00:00 2001 From: water111 <48171810+water111@users.noreply.github.com> Date: Thu, 1 Feb 2024 18:46:54 -0500 Subject: [PATCH] [jak3] More headers again (#3352) joint-mod-h collide-frag-h projectile-h stats-h bsp-h chain-physics-h ragdoll-h collide-hash-h --- decompiler/analysis/insert_lets.cpp | 10 +- decompiler/config/jak3/all-types.gc | 470 +++++---- .../jak3/ntsc_v1/stack_structures.jsonc | 3 +- .../config/jak3/ntsc_v1/type_casts.jsonc | 9 +- .../config/jak3/ntsc_v1/var_names.jsonc | 91 ++ goal_src/jak3/engine/anim/joint-h.gc | 3 + goal_src/jak3/engine/anim/joint-mod-h.gc | 512 +++++++++- .../jak3/engine/collide/collide-frag-h.gc | 40 + .../jak3/engine/common-obs/projectile-h.gc | 114 +++ goal_src/jak3/engine/debug/debug-h.gc | 3 + goal_src/jak3/engine/debug/stats-h.gc | 358 +++++++ goal_src/jak3/engine/gfx/vu1-user-h.gc | 2 +- goal_src/jak3/engine/level/bsp-h.gc | 117 +++ goal_src/jak3/engine/math/transformq-h.gc | 4 + .../jak3/engine/physics/chain-physics-h.gc | 44 + goal_src/jak3/engine/physics/ragdoll-h.gc | 161 +++ .../engine/spatial-hash/collide-hash-h.gc | 108 ++ .../reference/jak3/decompiler-macros.gc | 20 + .../jak3/engine/anim/joint-mod-h_REF.gc | 965 ++++++++++++++++++ .../jak3/engine/collide/collide-frag-h_REF.gc | 119 +++ .../jak3/engine/collide/collide-hash-h_REF.gc | 267 +++++ .../engine/common_objs/projectile-h_REF.gc | 203 ++++ .../jak3/engine/debug/stats-h_REF.gc | 372 +++++++ .../reference/jak3/engine/level/bsp-h_REF.gc | 205 ++++ .../engine/physics/chain-physics-h_REF.gc | 108 ++ .../jak3/engine/physics/ragdoll-h_REF.gc | 335 ++++++ 26 files changed, 4446 insertions(+), 197 deletions(-) create mode 100644 test/decompiler/reference/jak3/engine/anim/joint-mod-h_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/collide/collide-frag-h_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/collide/collide-hash-h_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/common_objs/projectile-h_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/debug/stats-h_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/level/bsp-h_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/physics/chain-physics-h_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/physics/ragdoll-h_REF.gc diff --git a/decompiler/analysis/insert_lets.cpp b/decompiler/analysis/insert_lets.cpp index c70c670566..2e7c2ec1d6 100644 --- a/decompiler/analysis/insert_lets.cpp +++ b/decompiler/analysis/insert_lets.cpp @@ -1515,9 +1515,13 @@ FormElement* rewrite_proc_new(LetElement* in, const Env& env, FormPool& pool) { // look for setting a var to (get-process *default-dead-pool* logo-slave #x4000) auto ra = in->entries().at(0).dest; - auto mr_get_proc = match( - Matcher::func("get-process", {Matcher::any(0), Matcher::any_symbol(1), Matcher::any(2)}), - in->entries().at(0).src); + std::vector get_process_args = {Matcher::any(0), Matcher::any_symbol(1), + Matcher::any(2)}; + if (env.version >= GameVersion::Jak3) { + // this flag appears unused... + get_process_args.push_back(Matcher::integer(1)); + } + auto mr_get_proc = match(Matcher::func("get-process", get_process_args), in->entries().at(0).src); if (!mr_get_proc.matched) { return nullptr; } diff --git a/decompiler/config/jak3/all-types.gc b/decompiler/config/jak3/all-types.gc index ab82300f14..14c0fb68c2 100644 --- a/decompiler/config/jak3/all-types.gc +++ b/decompiler/config/jak3/all-types.gc @@ -3978,7 +3978,7 @@ (bucket574 574) (bucket575 575) (bucket576 576) - (bucket577 577) + (bucket577 577) ;; debug? (bucket578 578) (bucket579 579) (bucket580 580) @@ -18952,7 +18952,7 @@ :size-assert #x2c :flag-assert #x90000002c (:methods - (new (symbol type process-drawable int vector float) _type_) + (new "Create and attach a joint-mod-spinner to a joint." (symbol type process-drawable int vector float) _type_) ;; 0 ) ) @@ -18960,6 +18960,9 @@ :bitfield #t :type uint16 (attached 0) + (trans 1) + (quat 2) + (scale 3) ) (deftype joint-mod-base (structure) @@ -18991,6 +18994,7 @@ ) (deftype joint-mod-rotate-world (joint-mod-base) + "Add an additional rotation to a joint (right multiply)" ((rotation quaternion :inline :offset-assert 16) ) :method-count-assert 12 @@ -18999,6 +19003,7 @@ ) (deftype joint-mod-set-local (joint-mod-base) + "Override the trans, quat, and scale of the joint transform. The component to override is selected by the flag." ((transform transformq :inline :offset-assert 16) ) :method-count-assert 12 @@ -19010,6 +19015,8 @@ ) (deftype joint-mod-add-local (joint-mod-base) + "Add to the trans, rotate the quat, and multiply the scale of the joint transform. The components can be selected by the flag. + Unlike jak 2, this actually multiplies the scale, instead of adding." ((transform transformq :inline :offset-assert 16) ) :method-count-assert 12 @@ -19021,6 +19028,8 @@ ) (deftype joint-mod-set-world (joint-mod-base) + "Directly overwrite the _bone_ transform (ignoring the parent entirely). + This does not pay attention to the flags." ((transform transformq :inline :offset-assert 16) ) :method-count-assert 12 @@ -19032,6 +19041,8 @@ ) (deftype joint-mod-set-world-no-trans (joint-mod-base) + "Set the rotation and scale of the _bone_ directly to the values from this transform. + The translation is kept from the result of the normal parented value." ((transform transformq :inline :offset-assert 16) ) :method-count-assert 12 @@ -19040,6 +19051,8 @@ ) (deftype joint-mod-blend-local (joint-mod-base) + "Blend the _joint_ transform between this transform and the animated one. + Then, apply the normal parented transform." ((transform transformq :inline :offset-assert 16) (blend-transform transformq :inline :offset-assert 64) (blend float :offset-assert 112) @@ -19052,7 +19065,17 @@ ) ) +;; added - I really have no idea what is going on here + +(deftype joint-mod-blend-world-work (structure) + ((mat1 matrix :inline) + (mat2 matrix :inline) + (quat quaternion :inline) + (vec vector :inline)) + ) + (deftype joint-mod-blend-world (joint-mod-base) + "Blend the _bone_ transform between this one and the animated one." ((transform transformq :inline :offset-assert 16) (blend-transform transformq :inline :offset-assert 64) (blend float :offset-assert 112) @@ -19133,7 +19156,7 @@ ) ) -;; (define-extern joint-mod-debug-draw function) ;; (function joint-mod none) +(define-extern joint-mod-debug-draw "Debug draw the bone transform for the associated bone of a joint-mod" (function joint-mod none)) (define-extern joint-mod-spinner-callback "cspace callback for joint-mod-spinner. Update the cspace's bone from the parent transformq, plus the rotation from this spinner." (function cspace transformq none)) @@ -19142,12 +19165,12 @@ (function cspace transformq none)) (define-extern vector<-cspace2! "Same as vector<-cspace! Convert a bone matrix from a cspace to the origin of the bone frame." (function vector cspace vector)) (define-extern joint-mod-rotate-world-callback "Callback for joint-mod-rotate-world. See comment on that type." (function cspace transformq none)) -;; (define-extern joint-mod-set-local-callback function) -;; (define-extern joint-mod-add-local-callback function) ;; (function cspace transformq none) -;; (define-extern joint-mod-set-world-callback function) ;; (function cspace transformq none) -;; (define-extern joint-mod-set-world-no-trans-callback function) -;; (define-extern joint-mod-blend-local-callback function) ;; (function cspace transformq none) -;; (define-extern joint-mod-blend-world-callback function) ;; (function cspace transformq none) +(define-extern joint-mod-set-local-callback "Callback for joint-mod-rotate-local. See comment on that type." (function cspace transformq none)) +(define-extern joint-mod-add-local-callback "Callback for joint-mod-add-local. See comment on that type." (function cspace transformq none)) +(define-extern joint-mod-set-world-callback "Callback for joint-mod-set-world. See comment on that type." (function cspace transformq none)) +(define-extern joint-mod-set-world-no-trans-callback "Callback for joint-mod-set-world-no-trans. See comment on that type." (function cspace transformq none)) +(define-extern joint-mod-blend-local-callback "Callback for joint-mod-blend-local. See comment on that type." (function cspace transformq none)) +(define-extern joint-mod-blend-world-callback "Callback for joint-mod-blend-world. See comment on that type." (function cspace transformq none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; collide-func-h ;; @@ -20533,79 +20556,77 @@ ;; collide-frag-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype collide-frag-vertex (vector) () :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype collide-frag-mesh (basic) + "Unused Jak 1 background collision mesh fragment." ((packed-data uint32 :offset-assert 4) (pat-array uint32 :offset-assert 8) (strip-data-len uint16 :offset-assert 12) (poly-count uint16 :offset-assert 14) (base-trans vector4w :inline :offset-assert 16) - (vertex-count uint8 :offset-assert 28) - (vertex-data-qwc uint8 :offset-assert 29) - (total-qwc uint8 :offset-assert 30) - (unused uint8 :offset-assert 31) + (vertex-count uint8 :offset 28) + (vertex-data-qwc uint8 :offset 29) + (total-qwc uint8 :offset 30) + (unused uint8 :offset 31) ) :method-count-assert 9 :size-assert #x20 :flag-assert #x900000020 ) -|# -#| (deftype collide-fragment (drawable) - ((mesh collide-frag-mesh :offset-assert 8) ;; guessed by decompiler - (collide-new basic :offset-assert 12) + "Unused Jak 1 background collision drawable tree node." + ((mesh collide-frag-mesh :offset 8) ;; guessed by decompiler + (collide-new basic :offset 12) ) :method-count-assert 17 :size-assert #x20 :flag-assert #x1100000020 ) -|# -#| (deftype drawable-inline-array-collide-fragment (drawable-inline-array) - ((data collide-fragment 1 :offset-assert 36) ;; guessed by decompiler + "Unused Jak 1 background collision drawable tree inline-array class." + ((data collide-fragment 1 :inline :offset-assert 32) ;; guessed by decompiler + (pad uint32) ) :method-count-assert 17 :size-assert #x44 :flag-assert #x1100000044 ) -|# -;; (deftype drawable-tree-collide-fragment (drawable-tree) -;; () -;; :flag-assert #x1100000020 -;; ) +(deftype drawable-tree-collide-fragment (drawable-tree) + "Unused jak 1 background collision data." + () + :flag-assert #x1100000020 + ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; collide-hash-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype collide-hash-scratch (structure) + "Scratchpad memory layout for collide-hash. Bitmask of things that have already been checked" ((collidable-bits uint128 128 :offset-assert 0) ;; guessed by decompiler - (poly-bits uint64 2 :offset-assert 0) ;; guessed by decompiler - (id-bits uint32 512 :offset-assert 0) ;; guessed by decompiler + (poly-bits uint64 2 :offset 0) ;; guessed by decompiler + (id-bits uint32 512 :offset 0) ;; guessed by decompiler (tris uint32 :offset-assert 2048) ) :method-count-assert 9 :size-assert #x804 :flag-assert #x900000804 ) -|# -#| (deftype collide-hash-bucket (structure) + "A bucket is a reference to a list of items that intersect a grid cell. + For the broadphase, the items are collide-hash-item (wrapper of collide-hash-fragment). + For the narrowphase, the items are entries in the index list, which contains poly indices." ((index int16 :offset-assert 0) (count int16 :offset-assert 2) ) @@ -20613,10 +20634,10 @@ :size-assert #x4 :flag-assert #x900000004 ) -|# -#| (deftype collide-hash-item (structure) + "Items that are 'hashed' in the broadphase. Contains unique ID for checking against already-visited-bitmask + and a pointer to the actual collide-hash-fragment, or possibly a TIE." ((id uint32 :offset-assert 0) (collidable basic :offset-assert 4) ) @@ -20624,101 +20645,92 @@ :size-assert #x8 :flag-assert #x900000008 ) -|# -#| (deftype collide-hash-poly (structure) + "A polygon in the narrow-phase data. This is just indices into the vertex and PAT tables." ((data uint8 4 :offset-assert 0) ;; guessed by decompiler - (vert-index0 uint8 :offset-assert 0) - (vert-index1 uint8 :offset-assert 1) - (vert-index2 uint8 :offset-assert 2) - (pat-index uint8 :offset-assert 3) - (word uint32 :offset-assert 0) + (vert-index0 uint8 :offset 0) + (vert-index1 uint8 :offset 1) + (vert-index2 uint8 :offset 2) + (pat-index uint8 :offset 3) + (word uint32 :offset 0) ) :method-count-assert 9 :size-assert #x4 :flag-assert #x900000004 ) -|# -#| (deftype collide-hash-fragment-stats (structure) ((num-verts uint16 :offset-assert 0) (num-polys uint8 :offset-assert 2) (poly-count uint8 :offset-assert 3) ) + :pack-me :method-count-assert 9 :size-assert #x4 :flag-assert #x900000004 ) -|# -#| (deftype collide-hash-fragment (drawable) - ((num-buckets uint16 :offset-assert 4) - (num-indices uint16 :offset-assert 6) - (pat-array uint32 :offset-assert 8) - (bucket-array uint32 :offset-assert 12) + "A mesh fragment for the Jak2/Jak3 collision system. This is a 'hash' of triangles into a grid + where the 'hash' function is just identity." + ((num-buckets uint16 :offset 4) + (num-indices uint16 :offset 6) + (pat-array uint32 :offset 8) + (bucket-array uint32 :offset 12) (grid-step vector :inline :offset-assert 32) (bbox bounding-box :inline :offset-assert 48) (bbox4w bounding-box4w :inline :offset-assert 80) - (axis-scale vector :inline :offset-assert 64) - (avg-extents vector :inline :offset-assert 80) - (dimension-array uint32 4 :offset-assert 44) ;; guessed by decompiler - (stats collide-hash-fragment-stats :inline :offset-assert 60) - (num-verts uint16 :offset-assert 60) - (num-polys uint8 :offset-assert 62) - (poly-count uint8 :offset-assert 63) - (poly-array uint32 :offset-assert 76) - (vert-array uint32 :offset-assert 92) - (index-array uint32 :offset-assert 108) + (axis-scale vector :inline :offset 64) + (avg-extents vector :inline :offset 80) + (dimension-array uint32 4 :offset 44) ;; guessed by decompiler + (stats collide-hash-fragment-stats :inline :offset 60) + (num-verts uint16 :offset 60) + (num-polys uint8 :offset 62) + (poly-count uint8 :offset 63) + (poly-array uint32 :offset 76) + (vert-array uint32 :offset 92) + (index-array uint32 :offset 108) ) :method-count-assert 17 :size-assert #x70 :flag-assert #x1100000070 ) -|# -#| (deftype collide-hash-fragment-array (array) - ((type type :offset-assert 0) ;; guessed by decompiler - (length int32 :offset-assert 4) - (allocated-length int32 :offset-assert 8) - (content-type type :offset-assert 12) ;; guessed by decompiler - ) + "A collection of collide-hash-fragments. These are used by the instanced collision if a single instance + needs more than 1 collide-hash-fragment worth of triangles." + ((fragments collide-hash-fragment :dynamic :offset 16)) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype collide-hash (drawable) - ((num-ids uint16 :offset-assert 4) - (id-count uint16 :offset-assert 6) - (num-buckets uint32 :offset-assert 8) - (qwc-id-bits uint32 :offset-assert 12) - (grid-step vector :inline :offset-assert 16) - (bbox bounding-box :inline :offset-assert 32) - (bbox4w bounding-box4w :inline :offset-assert 64) - (axis-scale vector :inline :offset-assert 48) - (avg-extents vector :inline :offset-assert 64) - (bucket-array uint32 :offset-assert 44) - (item-array (inline-array collide-hash-item) :offset-assert 60) ;; guessed by decompiler - (dimension-array uint32 3 :offset-assert 76) ;; guessed by decompiler - (num-items uint32 :offset-assert 92) + ((num-ids uint16 :offset 4) + (id-count uint16 :offset 6) + (num-buckets uint32 :offset 8) + (qwc-id-bits uint32 :offset 12) + (grid-step vector :inline :offset 16) + (bbox bounding-box :inline :offset 32) + (bbox4w bounding-box4w :inline :offset 64) + (axis-scale vector :inline :offset 48) + (avg-extents vector :inline :offset 64) + (bucket-array uint32 :offset 44) + (item-array (inline-array collide-hash-item) :offset 60) ;; guessed by decompiler + (dimension-array uint32 3 :offset 76) ;; guessed by decompiler + (num-items uint32 :offset 92) ) :method-count-assert 17 :size-assert #x60 :flag-assert #x1100000060 ) -|# -;; (define-extern *collide-list-boxes* object) ;; object -;; (define-extern *collide-hash-fragments* object) ;; object -;; (define-extern *collide-hash-fragments-tfrag* object) ;; object -;; (define-extern *collide-hash-fragments-instance* object) ;; object -;; (define-extern *already-printed-exeeded-max-cache-tris* object) ;; symbol +(define-extern *collide-list-boxes* symbol) ;; object +(define-extern *collide-hash-fragments* int) ;; object +(define-extern *collide-hash-fragments-tfrag* int) ;; object +(define-extern *collide-hash-fragments-instance* int) ;; object +(define-extern *already-printed-exeeded-max-cache-tris* symbol) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; water-info-h ;; @@ -20792,7 +20804,6 @@ ;; chain-physics-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype chain-physics-setup (structure) ((joint-index int32 :offset-assert 0) ) @@ -20800,9 +20811,7 @@ :size-assert #x4 :flag-assert #x900000004 ) -|# -#| (deftype chain-physics-joint (structure) ((position vector :inline :offset-assert 0) (velocity vector :inline :offset-assert 16) @@ -20813,11 +20822,9 @@ :size-assert #x34 :flag-assert #x900000034 ) -|# -#| (deftype chain-physics (basic) - ((chain-joints chain-physics-joint 20 :offset-assert 16) ;; guessed by decompiler + ((chain-joints chain-physics-joint 20 :inline :offset-assert 16) ;; guessed by decompiler (num-joints uint8 :offset-assert 1296) (root-joint-index uint8 :offset-assert 1297) (joint-length float :offset-assert 1300) @@ -20848,26 +20855,24 @@ (chain-physics-method-17 () none) ;; 17 ;; (chain-physics-method-17 (_type_ vector int) none) ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ragdoll-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype ragdoll-edit-info (structure) - ((editing basic :offset-assert 0) + ((editing symbol :offset-assert 0) (current-func uint64 :offset-assert 8) (analog-func uint64 :offset-assert 16) (affect uint64 :offset-assert 24) (single-step uint64 :offset-assert 32) - (collision basic :offset-assert 40) - (gravity basic :offset-assert 44) + (collision symbol :offset-assert 40) + (gravity symbol :offset-assert 44) (skel-visible uint64 :offset-assert 48) (current-joint int8 :offset-assert 56) (auto-setup-now basic :offset-assert 60) - (child-stack UNKNOWN 60 :offset-assert 64) + (child-stack object 60 :offset-assert 64) (child-stack-num int8 :offset-assert 304) (last-frame uint64 :offset-assert 312) (last-frame-dur uint64 :offset-assert 320) @@ -20887,9 +20892,7 @@ (ragdoll-edit-info-method-17 () none) ;; 17 ) ) -|# -#| (deftype ragdoll-joint-setup (structure) ((joint-index int32 :offset-assert 0) (parent-joint int32 :offset-assert 4) @@ -20905,22 +20908,18 @@ :size-assert #x50 :flag-assert #x900000050 ) -|# -#| (deftype ragdoll-setup (structure) ((orient-tform vector :inline :offset-assert 0) (scale vector :inline :offset-assert 16) - (bg-collide-with uint32 :offset-assert 32) + (bg-collide-with collide-spec :offset-assert 32) (joint-setup basic :offset-assert 36) ) :method-count-assert 9 :size-assert #x28 :flag-assert #x900000028 ) -|# -#| (deftype ragdoll-joint (structure) ((quat quaternion :inline :offset-assert 0) (position vector :inline :offset-assert 16) @@ -20949,11 +20948,9 @@ :size-assert #xbc :flag-assert #x9000000bc ) -|# -#| (deftype ragdoll (basic) - ((ragdoll-joints UNKNOWN 60 :offset-assert 16) + ((ragdoll-joints ragdoll-joint 60 :inline :offset-assert 16) (num-joints uint8 :offset-assert 11536) (mirror matrix :inline :offset-assert 11552) (gravity vector :inline :offset-assert 11616) @@ -20976,7 +20973,7 @@ (ragdoll-flags uint32 :offset-assert 11780) (flex-blend float :offset-assert 11784) (stable-joints int8 :offset-assert 11788) - (ragdoll-joint-remap UNKNOWN 100 :offset-assert 11789) + (ragdoll-joint-remap uint8 100 :offset-assert 11789) (allow-destabilize uint64 :offset-assert 11896) (bg-collide-with uint32 :offset-assert 11904) (water-info water-info :inline :offset-assert 11920) @@ -21004,11 +21001,9 @@ (ragdoll-method-25 () none) ;; 25 ) ) -|# -#| (deftype ragdoll-proc (process) - ((ragdoll basic :offset-assert 128) + ((ragdoll ragdoll :offset-assert 128) (last-attack-id uint32 :offset-assert 132) ) :method-count-assert 20 @@ -21023,37 +21018,38 @@ (ragdoll-proc-method-19 () none) ;; 19 ) ) -|# -#| (deftype wings-ragdoll-proc (ragdoll-proc) () :method-count-assert 20 :size-assert #x88 :flag-assert #x1400100088 ) -|# -;; (define-extern *ragdoll-edit-info* object) +(define-extern *ragdoll-edit-info* ragdoll-edit-info) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; projectile-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +(defenum projectile-options + :bitfield #t + :type uint64 + ) + (deftype projectile (process-drawable) ((starting-pos vector :inline :offset-assert 208) (starting-dir vector :inline :offset-assert 224) (target-pos vector :inline :offset-assert 240) (base-target-pos vector :inline :offset-assert 256) (pre-move-transv vector :inline :offset-assert 272) - (timeout uint64 :offset-assert 288) ;; time-frame - (spawn-time uint64 :offset-assert 296) ;; time-frame - (options uint64 :offset-assert 304) ;; projectile-options - (last-target uint64 :offset-assert 312) ;; handle - (notify-handle uint64 :offset-assert 320) ;; handle - (owner-handle uint64 :offset-assert 328) ;; handle - (ignore-handle uint64 :offset-assert 336) ;; handle + (timeout time-frame :offset-assert 288) ;; time-frame + (spawn-time time-frame :offset-assert 296) ;; time-frame + (options projectile-options :offset-assert 304) ;; projectile-options + (last-target handle :offset-assert 312) ;; handle + (notify-handle handle :offset-assert 320) ;; handle + (owner-handle handle :offset-assert 328) ;; handle + (ignore-handle handle :offset-assert 336) ;; handle (update-velocity (function projectile none) :offset-assert 344) ;; guessed by decompiler (move (function projectile none) :offset-assert 348) ;; guessed by decompiler (pick-target (function projectile none) :offset-assert 352) ;; guessed by decompiler @@ -21071,7 +21067,7 @@ (charge-level float :offset-assert 460) (sound-id sound-id :offset-assert 464) ;; guessed by decompiler (stop-speed meters :offset-assert 468) - (invinc-time uint64 :offset-assert 472) ;; time-frame + (invinc-time time-frame :offset-assert 472) ;; time-frame (desired-target uint64 :offset-assert 480) (desired-target-pos vector :inline :offset-assert 496) ) @@ -21102,9 +21098,7 @@ (projectile-method-40 () none) ;; 40 ) ) -|# -#| (deftype projectile-init-by-other-params (structure) ((pos vector :inline :offset-assert 0) (vel vector :inline :offset-assert 16) @@ -21113,11 +21107,11 @@ (ent entity :offset-assert 56) ;; guessed by decompiler (charge float :offset-assert 60) (attack-id uint32 :offset-assert 64) - (options uint64 :offset-assert 72) ;; projectile-options - (notify-handle uint64 :offset-assert 80) ;; handle - (owner-handle uint64 :offset-assert 88) ;; handle - (ignore-handle uint64 :offset-assert 96) ;; handle - (timeout uint64 :offset-assert 104) ;; time-frame + (options projectile-options :offset-assert 72) ;; projectile-options + (notify-handle handle :offset-assert 80) ;; handle + (owner-handle handle :offset-assert 88) ;; handle + (ignore-handle handle :offset-assert 96) ;; handle + (timeout time-frame :offset-assert 104) ;; time-frame (damage float :offset-assert 112) (vehicle-damage-factor float :offset-assert 116) (vehicle-impulse-factor float :offset-assert 120) @@ -21126,11 +21120,9 @@ :size-assert #x7c :flag-assert #x90000007c ) -|# -#| (deftype projectile-bounce (projectile) - ((played-bounce-time uint64 :offset-assert 512) ;; time-frame + ((played-bounce-time time-frame :offset-assert 512) ;; time-frame (tumble-quat quaternion :inline :offset-assert 528) (gravity float :offset-assert 544) ) @@ -21143,9 +21135,8 @@ (projectile-bounce-method-43 () none) ;; 43 ) ) -|# -;; (define-extern spawn-projectile function) ;; (function type projectile-init-by-other-params process-tree dead-pool (pointer process)) +(define-extern spawn-projectile "Create a new process for a projectile of the given type." (function type projectile-init-by-other-params process-tree dead-pool (pointer process))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; find-nearest-h ;; @@ -21481,8 +21472,8 @@ ;; stats-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype tr-stat (structure) + "triangle stats for a renderer. This can apply to a lot of different renderer types." ((groups uint16 :offset-assert 0) (fragments uint16 :offset-assert 2) (tris uint32 :offset-assert 4) @@ -21494,10 +21485,9 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype merc-global-stats (structure) + "Triangle stats for all merc renderers." ((merc tr-stat :inline :offset-assert 0) (emerc tr-stat :inline :offset-assert 16) (mercneric tr-stat :inline :offset-assert 32) @@ -21506,10 +21496,10 @@ :size-assert #x30 :flag-assert #x900000030 ) -|# -#| (deftype perf-stat (structure) + "Performance statistics for a single 'bucket' or category. Unlike the more general profile-bars, + this records statistics like cache hits/instruction counts." ((frame-number uint32 :offset-assert 0) (count uint32 :offset-assert 4) (cycles uint32 :offset-assert 8) @@ -21524,37 +21514,98 @@ (to-spr-waits uint32 :offset-assert 44) (from-spr-waits uint32 :offset-assert 48) ) + :pack-me :method-count-assert 14 :size-assert #x34 :flag-assert #xe00000034 (:methods (perf-stat-method-9 () none) ;; 9 ;; (perf-stat-method-9 () none) - (perf-stat-method-10 () none) ;; 10 ;; (print-to-stream (_type_ string basic) none) - (perf-stat-method-11 () none) ;; 11 ;; (reset! (_type_) none) - (perf-stat-method-12 () none) ;; 12 ;; (read! (_type_) none) - (perf-stat-method-13 () none) ;; 13 ;; (update-wait-stats (_type_ uint uint uint) none) + (print-to-stream (_type_ string basic) none) ;; 10 + (start-profiling! (_type_) none) ;; 11 + (stop-profiling! (_type_) none) ;; 12 + (update-wait-stats (_type_ uint uint uint) none) ;; 13 ) ) -|# -#| (deftype perf-stat-array (inline-array-class) - ((data perf-stat :dynamic :offset-assert 16) ;; guessed by decompiler + "Array of all stats for all buckets." + ((data perf-stat :dynamic :inline :offset-assert 16) ;; guessed by decompiler ) :method-count-assert 14 :size-assert #x10 :flag-assert #xe00000010 ) -|# -;; (define-extern perf-stat-bucket->string function) ;; (function perf-stat-bucket string) +(defenum perf-stat-bucket + :type uint32 ;; guess + (all-code) + (spatial-hash-build) + (spatial-hash-search) + (collide) + (collide-list) + (collide-fill) + (actor-hash) + (nav) + (nav-dma-all) + (nav-dma-read) + (nav-dma-write) + (nav-dma-work) + (nav-part1) + (nav-part2) + (nav-part3) + (nav-part4) + (nav-part5) + (nav-part6) + (nav-part7) + (nav-part8) + (nav-part9) + (nav-part10) + (add-to-translation) + (update-current-poly) + (clamp-vector-to-mesh) + (ray-step) + (update-spheres) + (travel-around-spheres) + (avoid-spheres) + (check-vector-collision-with-nav-spheres) + (find-nearest-poly) + (find-containing-poly) + (generate-velocity) + (apply-rotation) + (apply-velocity) + (travel-post) + (common-post) + (misc) + (mercneric) + (tie-generic) + (background) + (drawable) + (tfrag) + (tfrag-scissor) + (inst-shrub) + (proto-shrub) + (inst-tie) + (proto-tie) + (bones) + (camera) + (foreground) + (hover-path) + (hover-spheres) + (hover-update) + (hover-move) + (hover-find-closest) + (update-los) +) + +(define-extern perf-stat-bucket->string (function perf-stat-bucket string)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; bsp-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype bsp-node (structure) + "A node in the 'BSP' tree. This is really a bounding volume tree, where each volume is an axis-aligned box, containing 2 child boxes. + This is used for precomputed visibility, based on the camera position. This is not used for collision." ((front int16 :offset-assert 0) (back int16 :offset-assert 2) (front-box-min vector4b :inline :offset-assert 4) @@ -21566,38 +21617,99 @@ :size-assert #x14 :flag-assert #x900000014 ) -|# -#| (deftype bsp-header (drawable) - ((all-visible-list (pointer uint16) :offset-assert 28) ;; guessed by decompiler - (visible-list-length int16 :offset-assert 32) - (drawable-trees drawable-tree-array :offset-assert 36) ;; guessed by decompiler - (pat pointer :offset-assert 40) ;; guessed by decompiler - (pat-length int32 :offset-assert 44) + "The bsp-header is really an entire level. + This probably started as a very simple structure, but now it is extremely complicated." + ((all-visible-list (pointer uint16) :offset 32) ;; guessed by decompiler + (visible-list-length int16 :offset 36) + (drawable-trees drawable-tree-array :offset 40) ;; guessed by decompiler + (pat pointer :offset 44) ;; guessed by decompiler + (pat-length int32 :offset 48) + ;; jak2: unlikely to match jak 3 exactly!! + ; (texture-remap-table (pointer uint64) :offset-assert 52) + ; (texture-remap-table-len int32 :offset-assert 56) + ; (texture-ids (pointer texture-id) :offset-assert 60) + ; (texture-page-count int32 :offset-assert 64) + ; (unknown-basic basic :offset-assert 68) ;; seems to be 0 everywhere. + ; (name symbol :offset-assert 72) + ; (nickname symbol :offset-assert 76) + ; (vis-info level-vis-info 8 :offset-assert 80) + ; (actors drawable-inline-array-actor :offset-assert 112) + ; (cameras (array entity-camera) :offset-assert 116) + (nodes (inline-array bsp-node) :offset 120) + + ;; jak2: unlikely to match jak 3 exactly!! + ; (level level :offset-assert 124) + ; (current-leaf-idx uint16 :offset-assert 128) + ; (texture-flags texture-page-flag 10 :offset-assert 130) + ; (cam-outside-bsp uint8 :offset 152) + ; (cam-using-back uint8 :offset-assert 153) + ; (cam-box-idx uint16 :offset-assert 154) + ; (ambients symbol :offset-assert 156) ;; now just #t? + ; (subdivide-close float :offset-assert 160) + ; (subdivide-far float :offset-assert 164) + ; (race-meshes (array entity-race-mesh) :offset-assert 168) + ; (actor-birth-order (pointer uint32) :offset-assert 172) + ; (light-hash light-hash :offset-assert 176) + ; (nav-meshes (array entity-nav-mesh) :offset-assert 180) + ; (actor-groups (array actor-group) :offset-assert 184) + ; (region-trees (array drawable-tree-region-prim) :offset-assert 188) + ; (region-array region-array :offset-assert 192) + ; (collide-hash collide-hash :offset-assert 196) + ; ;; 200 is some array + ; (wind-array uint32 :offset 200) + ; ;; 204 is maybe that array's length + ; (wind-array-length int32 :offset 204) + ; (city-level-info city-level-info :offset 208) + ; (vis-spheres vector-array :offset 216) + ; (vis-spheres-length uint32 :offset 248) + ; (region-tree drawable-tree-region-prim :offset 252) + + ; (tfrag-masks texture-masks-array :offset-assert 256) + ; (tfrag-closest (pointer float) :offset-assert 260) + ; (tfrag-mask-count uint32 :offset 260) + + ; (shrub-masks texture-masks-array :offset-assert 264) + ; (shrub-closest (pointer float) :offset-assert 268) + ; (shrub-mask-count uint32 :offset 268) + + ; (alpha-masks texture-masks-array :offset-assert 272) + ; (alpha-closest (pointer float) :offset-assert 276) + ; (alpha-mask-count uint32 :offset 276) + + ; (water-masks texture-masks-array :offset-assert 280) + ; (water-closest (pointer float) :offset-assert 284) + ; (water-mask-count uint32 :offset 284) + + ; (bsp-scale vector :inline :offset-assert 288) + ; (bsp-offset vector :inline :offset-assert 304) + + + (end uint8 :offset #x18f) ) :method-count-assert 19 :size-assert #x190 :flag-assert #x1300000190 (:methods - (bsp-header-method-17 () none) ;; 17 ;; (birth (_type_) none) - (bsp-header-method-18 () none) ;; 18 ;; (deactivate-entities (_type_) none) + (birth (_type_) none) ;; 17 + (deactivate-entities (_type_) none) ;; 18 ) ) -|# -#| (deftype game-level (basic) + "Unused in Jak 1, 2, and 3!" ((master-bsp basic :offset-assert 4) ) :method-count-assert 9 :size-assert #x8 :flag-assert #x900000008 ) -|# -#| (deftype view-frustum (structure) + "A view frustum, expressed as corners. + This representation is not very useful, and is used in only one spot to generate camera planes + in a very inefficient way." ((hither-top-left vector :inline :offset-assert 0) (hither-top-right vector :inline :offset-assert 16) (hither-bottom-left vector :inline :offset-assert 32) @@ -21611,28 +21723,28 @@ :size-assert #x80 :flag-assert #x900000080 ) -|# -#| (deftype collide-stats (structure) + "Very strange collide stats type. It has been somewhat broken in all versions of the game. + The final stopwatch is cut off. For jak 3, I just fixed it." ((calls uint32 :offset-assert 0) (spheres uint32 :offset-assert 4) (nodes uint32 :offset-assert 8) (frags uint32 :offset-assert 12) (tris uint32 :offset-assert 16) (output uint32 :offset-assert 20) - (total-target stopwatch :inline :offset-assert 28) ;; uint32 8 - (target-cache-fill stopwatch :inline :offset-assert 60) ;; uint32 8 - (target-ray-poly stopwatch :inline :offset-assert 92) ;; uint32 6 + (junk (pointer uint32) 24) + ; (total-target stopwatch :inline :offset-assert 28) ;; uint32 8 + ; (target-cache-fill stopwatch :inline :offset-assert 60) ;; uint32 8 + ; (target-ray-poly stopwatch :inline :offset-assert 92) ;; uint32 6 ) :method-count-assert 9 :size-assert #x78 :flag-assert #x900000078 ) -|# -;; (define-extern inspect-bsp-tree function) ;; (function bsp-header bsp-node none) -;; (define-extern map-bsp-tree function) ;; (function (function bsp-node none) bsp-header bsp-node none) +(define-extern inspect-bsp-tree "Attempt to print a bsp-tree, but it is actually broken since the jak 2 bsp format change" (function bsp-header bsp-node none)) +(define-extern map-bsp-tree "Attempt to call a function on all bsp-tree nodes, but it is actually broken since the jak 2 bsp format" (function (function bsp-node none) bsp-header bsp-node none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; collide-cache-h ;; @@ -27001,11 +27113,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; (define-extern transformq-copy! function) ;; (function transformq transformq transformq) -;; (define-extern matrix<-transformq! function) ;; (function matrix transformq matrix) +(define-extern matrix<-transformq! (function matrix transformq matrix)) ;; (define-extern matrix<-no-trans-transformq! function) ;; (function matrix transformq matrix) ;; (define-extern matrix<-transformq+trans! function) ;; (function matrix transformq vector matrix) ;; (define-extern matrix<-transformq+world-trans! function) ;; (function matrix transformq vector matrix) -;; (define-extern matrix<-parented-transformq! function) ;; (function matrix transformq vector matrix) +(define-extern matrix<-parented-transformq! (function matrix transformq vector matrix)) ;; (define-extern matrix<-transformq+rot-offset! function) ;; (function matrix transformq vector matrix) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -27533,7 +27645,7 @@ ;; (define-extern add-debug-line-sphere function) ;; (function symbol bucket-id vector vector float rgba none) ;; (define-extern add-debug-circle function) ;; (function symbol bucket-id vector float rgba matrix symbol) ;; (define-extern add-debug-vector function) ;; (function symbol bucket-id vector vector meters rgba symbol) -;; (define-extern add-debug-matrix function) ;; (function symbol bucket-id matrix meters matrix) +(define-extern add-debug-matrix (function symbol bucket-id matrix meters matrix)) ;; (define-extern add-debug-rot-matrix function) ;; (function symbol bucket-id matrix vector matrix) ;; (define-extern add-debug-quaternion function) ;; (function symbol bucket-id vector quaternion none) ;; (define-extern add-debug-cspace function) ;; (function symbol bucket-id cspace cspace) @@ -33444,7 +33556,7 @@ ;; (define-extern projectile-move-fill-line-sphere function) ;; (function projectile none) ;; (define-extern projectile-update-velocity-add-gravity function) ;; (function projectile none) ;; (define-extern projectile-update-velocity-space-wars function) ;; (function projectile none) -;; (define-extern projectile-init-by-other function) ;; (function projectile-init-by-other-params projectile :behavior projectile) +(define-extern projectile-init-by-other (function projectile-init-by-other-params projectile :behavior projectile)) ;; (define-extern projectile-bounce-update-velocity function) ;; (function projectile-bounce none :behavior projectile) ;; (define-extern projectile-bounce-falling-post function) ;; (function none :behavior projectile-bounce) ;; (define-extern projectile-bounce-move function) ;; (function projectile-bounce none) diff --git a/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc b/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc index 505ea2396d..c8947d27f9 100644 --- a/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc +++ b/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc @@ -11,5 +11,6 @@ ], "rotate-vector-to-vector": [[16, "quaternion"]], "init-for-transform": [[192, "vector"]], - "show-mc-info": [[16, "mc-slot-info"]] + "show-mc-info": [[16, "mc-slot-info"]], + "joint-mod-blend-world-callback": [[16, "joint-mod-blend-world-work"]] } diff --git a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc index 9a011485d0..e53158eaa5 100644 --- a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc +++ b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc @@ -321,5 +321,12 @@ "(method 21 process-focusable)": [ [15, "gp", "collide-shape-moving"], [35, "gp", "collide-shape-moving"] - ] + ], + "joint-mod-rotate-world-callback": [[[0, 24], "s3", "joint-mod-rotate-world"]], + "joint-mod-set-local-callback": [[[1, 24], "v1", "joint-mod-set-local"]], + "joint-mod-add-local-callback": [[[1, 37], "s4", "joint-mod-add-local"]], + "joint-mod-set-world-callback": [[[1, 4], "v1", "joint-mod-set-local"]], + "joint-mod-set-world-no-trans-callback": [[[1, 25], "s4", "joint-mod-set-world-no-trans"]], + "joint-mod-blend-local-callback": [[[1, 28], "gp", "joint-mod-blend-local"]], + "joint-mod-blend-world-callback": [[[1, 150], "gp", "joint-mod-blend-world"]] } diff --git a/decompiler/config/jak3/ntsc_v1/var_names.jsonc b/decompiler/config/jak3/ntsc_v1/var_names.jsonc index 66030d54e2..bad8473934 100644 --- a/decompiler/config/jak3/ntsc_v1/var_names.jsonc +++ b/decompiler/config/jak3/ntsc_v1/var_names.jsonc @@ -794,5 +794,96 @@ }, "(method 0 effect-control)": { "args": ["allocation", "type-to-make", "proc"] + }, + "(method 0 joint-mod-spinner)": { + "args": [ + "allocation", + "type-to-make", + "proc", + "bone-idx", + "axis", + "rate" + ] + }, + "(method 9 joint-mod-base)": { + "args": [ + "this", + "proc", + "bone-idx", + "flags" + ] + }, + "joint-mod-debug-draw": { + "args": [ + "jmod" + ] + }, + "joint-mod-spinner-callback": { + "args": [ + "bone-cspace", + "joint-transform" + ] + }, + "joint-mod-rotate-local-callback": { + "args": [ + "bone-cspace", + "joint-transform" + ] + }, + "vector<-cspace2!": { + "args": [ + "output-vec", + "input-cspace" + ] + }, + "joint-mod-rotate-world-callback": { + "args": [ + "bone-cspace", + "joint-transform" + ] + }, + "joint-mod-set-local-callback": { + "args": [ + "bone-cspace", + "joint-transform" + ] + }, + "joint-mod-add-local-callback": { + "args": [ + "bone-cspace", + "joint-transform" + ] + }, + "joint-mod-set-world-callback": { + "args": [ + "bone-cspace", + "joint-trasnform" + ] + }, + "joint-mod-set-world-no-trans-callback": { + "args": [ + "bone-cspace", + "joint-transform" + ] + }, + "joint-mod-blend-local-callback": { + "args": [ + "bone-cspace", + "joint-transform" + ] + }, + "joint-mod-blend-world-callback": { + "args": [ + "bone-cspace", + "joint-transform" + ] + }, + "spawn-projectile": { + "args": [ + "proj-type", + "params", + "parent-proc-tree", + "pool" + ] } } diff --git a/goal_src/jak3/engine/anim/joint-h.gc b/goal_src/jak3/engine/anim/joint-h.gc index 26aec786b5..46cc6d7612 100644 --- a/goal_src/jak3/engine/anim/joint-h.gc +++ b/goal_src/jak3/engine/anim/joint-h.gc @@ -7,6 +7,9 @@ (declare-type joint-control basic) +(define-extern cspace<-transformq! (function cspace transformq matrix)) +(define-extern cspace<-parented-transformq-joint! (function cspace transformq none)) + (defenum joint-control-command :type uint64 (push 1) diff --git a/goal_src/jak3/engine/anim/joint-mod-h.gc b/goal_src/jak3/engine/anim/joint-mod-h.gc index 6c78131d09..737350f0ca 100644 --- a/goal_src/jak3/engine/anim/joint-mod-h.gc +++ b/goal_src/jak3/engine/anim/joint-mod-h.gc @@ -37,13 +37,6 @@ ) ;; ---joint-mod-h:track-mode - -(defenum joint-mod-base-flags - :bitfield #t - :type uint16 - (attached 0) - ) - (defenum joint-mod-ik-flags :bitfield #t :type uint32 @@ -52,6 +45,22 @@ (elbow-rot-neg) ) +(defenum joint-mod-base-flags + :bitfield #t + :type uint16 + (attached 0) + (trans 1) + (quat 2) + (scale 3) + ) + +(deftype joint-mod-blend-world-work (structure) + ((mat1 matrix :inline) + (mat2 matrix :inline) + (quat quaternion :inline) + (vec vector :inline)) + ) + ;; DECOMP BEGINS (deftype joint-mod (basic) @@ -110,6 +119,65 @@ This is used to make jak look toward an enemy, for example." ) ) + +(defun-debug joint-mod-debug-draw ((jmod joint-mod)) + "Debug draw the bone transform for the associated bone of a joint-mod" + (add-debug-matrix #t (bucket-id bucket577) (-> jmod joint bone transform) (meters 2)) + 0 + (none) + ) + +(defmethod reset-blend! ((this joint-mod)) + "Set the blend to 0." + (set! (-> this blend) 0.0) + this + ) + +(deftype joint-mod-spinner (basic) + "Control a joint by just spinning it around an axis." + ((spin-axis vector :inline) + (angle float) + (spin-rate float) + (enable symbol) + ) + (:methods + (new (symbol type process-drawable int vector float) _type_) + ) + ) + + +(defun joint-mod-spinner-callback ((bone-cspace cspace) (joint-transform transformq)) + "cspace callback for joint-mod-spinner. Update the cspace's bone from the parent transformq, plus the rotation from this spinner." + (let ((gp-0 (the-as joint-mod-spinner (-> bone-cspace param1)))) + (when (-> gp-0 enable) + (let ((f30-0 + (the float (sar (shl (the int (+ (-> gp-0 angle) (* (-> gp-0 spin-rate) (seconds-per-frame)))) 48) 48)) + ) + ) + (quaternion-vector-angle! (-> joint-transform quat) (-> gp-0 spin-axis) f30-0) + (set! (-> gp-0 angle) f30-0) + ) + ) + ) + (cspace<-parented-transformq-joint! bone-cspace joint-transform) + (none) + ) + +(defmethod new joint-mod-spinner ((allocation symbol) (type-to-make type) (proc process-drawable) (bone-idx int) (axis vector) (rate float)) + "Create and attach a joint-mod-spinner to a joint." + (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> v0-0 spin-axis quad) (-> axis quad)) + (set! (-> v0-0 spin-rate) rate) + (set! (-> v0-0 enable) #t) + (set! (-> v0-0 angle) 0.0) + (let ((a0-3 (-> proc node-list data bone-idx))) + (set! (-> a0-3 param0) joint-mod-spinner-callback) + (set! (-> a0-3 param1) v0-0) + ) + v0-0 + ) + ) + (deftype joint-mod-base (structure) "Base type for most joint-mods" ((flags joint-mod-base-flags) @@ -144,18 +212,403 @@ This is used to make jak look toward an enemy, for example." (none) ) -(defmethod init ((this joint-mod-base) (arg0 process-drawable) (arg1 uint) (arg2 joint-mod-base-flags)) +(defmethod init ((this joint-mod-base) (proc process-drawable) (bone-idx uint) (flags joint-mod-base-flags)) "Set up this joint-mod to modify the given joint of the given process. Will attach automatically if attached flag is set." - (set! (-> this flags) arg2) - (set! (-> this node-index) (the-as int arg1)) - (set! (-> this proc) (the-as (pointer process-drawable) (process->ppointer arg0))) - (if (logtest? arg2 (joint-mod-base-flags attached)) + (set! (-> this flags) flags) + (set! (-> this node-index) (the-as int bone-idx)) + (set! (-> this proc) (the-as (pointer process-drawable) (process->ppointer proc))) + (if (logtest? flags (joint-mod-base-flags attached)) (attach-callback this) ) 0 (none) ) +(deftype joint-mod-rotate-local (joint-mod-base) + ((rotation quaternion :inline) + ) + (:methods + (new (symbol type) _type_) + ) + ) + + +(defun joint-mod-rotate-local-callback ((bone-cspace cspace) (joint-transform transformq)) + "Apply an additional rotation to the transform (left side quaternion multiplication" + (let ((v1-0 (the-as joint-mod-rotate-local (-> bone-cspace param1)))) + (quaternion*! (-> joint-transform quat) (-> joint-transform quat) (-> v1-0 rotation)) + ) + (cspace<-parented-transformq-joint! bone-cspace joint-transform) + (none) + ) + +(defmethod init ((this joint-mod-rotate-local) (arg0 process-drawable) (arg1 uint) (arg2 joint-mod-base-flags)) + "Set up this joint-mod to modify the given joint of the given process. Will attach automatically if attached flag is set." + (set! (-> this callback) joint-mod-rotate-local-callback) + (quaternion-identity! (-> this rotation)) + ((method-of-type joint-mod-base init) this arg0 arg1 arg2) + (none) + ) + +(deftype joint-mod-rotate-world (joint-mod-base) + "Add an additional rotation to a joint (right multiply)" + ((rotation quaternion :inline) + ) + ) + +(defun vector<-cspace2! ((output-vec vector) (input-cspace cspace)) + "Same as vector<-cspace! Convert a bone matrix from a cspace to the origin of the bone frame." + (rlet ((Q :class vf) + (vf0 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (.lvf vf2 (&-> (-> input-cspace bone) transform trans quad)) + (.div.vf Q vf0 vf2 :fsf #b11 :ftf #b11) + (.wait.vf) + (.mul.vf vf2 vf2 Q :mask #b111) + (.nop.vf) + (.nop.vf) + (.mov.vf vf2 vf0 :mask #b1000) + (.svf (&-> output-vec quad) vf2) + output-vec + ) + ) + +;; WARN: Return type mismatch matrix vs none. +(defun joint-mod-rotate-world-callback ((bone-cspace cspace) (joint-transform transformq)) + "Callback for joint-mod-rotate-world. See comment on that type." + (let ((s3-0 (the-as joint-mod-rotate-world (-> bone-cspace param1)))) + (cspace<-parented-transformq-joint! bone-cspace joint-transform) + (let ((s4-0 (vector<-cspace2! (new 'stack-no-clear 'vector) bone-cspace))) + (quaternion*! (-> joint-transform quat) (-> joint-transform quat) (-> s3-0 rotation)) + (set! (-> joint-transform trans quad) (-> s4-0 quad)) + ) + ) + (cspace<-transformq! bone-cspace joint-transform) + (none) + ) + +(defmethod init ((this joint-mod-rotate-world) (arg0 process-drawable) (arg1 uint) (arg2 joint-mod-base-flags)) + "Set up this joint-mod to modify the given joint of the given process. Will attach automatically if attached flag is set." + (set! (-> this callback) joint-mod-rotate-world-callback) + (quaternion-identity! (-> this rotation)) + ((method-of-type joint-mod-base init) this arg0 arg1 arg2) + (none) + ) + +(deftype joint-mod-set-local (joint-mod-base) + "Override the trans, quat, and scale of the joint transform. The component to override is selected by the flag." + ((transform transformq :inline) + ) + (:methods + (new (symbol type) _type_) + ) + ) + +(defun joint-mod-set-local-callback ((bone-cspace cspace) (joint-transform transformq)) + "Callback for joint-mod-rotate-local. See comment on that type." + (let ((v1-0 (the-as joint-mod-set-local (-> bone-cspace param1)))) + (if (not (logtest? (-> v1-0 flags) (joint-mod-base-flags trans))) + (set! (-> v1-0 transform trans quad) (-> joint-transform trans quad)) + ) + (if (not (logtest? (-> v1-0 flags) (joint-mod-base-flags quat))) + (set! (-> v1-0 transform quat quad) (-> joint-transform quat quad)) + ) + (if (not (logtest? (-> v1-0 flags) (joint-mod-base-flags scale))) + (set! (-> v1-0 transform scale quad) (-> joint-transform scale quad)) + ) + (cspace<-parented-transformq-joint! bone-cspace (-> v1-0 transform)) + ) + (none) + ) + +(defmethod init ((this joint-mod-set-local) (arg0 process-drawable) (arg1 uint) (arg2 joint-mod-base-flags)) + "Set up this joint-mod to modify the given joint of the given process. Will attach automatically if attached flag is set." + (rlet ((vf0 :class vf)) + (init-vf0-vector) + (set! (-> this callback) joint-mod-set-local-callback) + (.svf (&-> (-> this transform) trans quad) vf0) + (quaternion-identity! (-> this transform quat)) + (vector-identity! (-> this transform scale)) + ((method-of-type joint-mod-base init) this arg0 arg1 arg2) + (none) + ) + ) + +(deftype joint-mod-add-local (joint-mod-base) + "Add to the trans, rotate the quat, and multiply the scale of the joint transform. The components can be selected by the flag. +Unlike jak 2, this actually multiplies the scale, instead of adding." + ((transform transformq :inline) + ) + (:methods + (new (symbol type) _type_) + ) + ) + + +(defun joint-mod-add-local-callback ((bone-cspace cspace) (joint-transform transformq)) + "Callback for joint-mod-add-local. See comment on that type." + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (let ((s4-0 (the-as joint-mod-add-local (-> bone-cspace param1)))) + (if (logtest? (-> s4-0 flags) (joint-mod-base-flags trans)) + (vector+! (-> joint-transform trans) (-> joint-transform trans) (the-as vector (-> s4-0 transform))) + ) + (when (logtest? (-> s4-0 flags) (joint-mod-base-flags quat)) + (quaternion*! (-> joint-transform quat) (-> joint-transform quat) (-> s4-0 transform quat)) + (quaternion-normalize! (-> joint-transform quat)) + ) + (when (logtest? (-> s4-0 flags) (joint-mod-base-flags scale)) + (let ((a0-4 (-> joint-transform scale))) + (let ((v1-11 (-> joint-transform scale)) + (a1-4 (-> s4-0 transform scale)) + ) + (.lvf vf4 (&-> v1-11 quad)) + (.lvf vf5 (&-> a1-4 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.vf vf6 vf4 vf5 :mask #b111) + (.svf (&-> a0-4 quad) vf6) + ) + ) + ) + (cspace<-parented-transformq-joint! bone-cspace joint-transform) + (none) + ) + ) + +(defmethod init ((this joint-mod-add-local) (arg0 process-drawable) (arg1 uint) (arg2 joint-mod-base-flags)) + "Set up this joint-mod to modify the given joint of the given process. Will attach automatically if attached flag is set." + (rlet ((vf0 :class vf)) + (init-vf0-vector) + (set! (-> this callback) joint-mod-add-local-callback) + (.svf (&-> (-> this transform) trans quad) vf0) + (quaternion-identity! (-> this transform quat)) + (set-vector! (-> this transform scale) 1.0 1.0 1.0 1.0) + ((method-of-type joint-mod-base init) this arg0 arg1 arg2) + (none) + ) + ) + +(deftype joint-mod-set-world (joint-mod-base) + "Directly overwrite the _bone_ transform (ignoring the parent entirely). +This does not pay attention to the flags." + ((transform transformq :inline) + ) + (:methods + (new (symbol type) _type_) + ) + ) + +;; WARN: Return type mismatch matrix vs none. +(defun joint-mod-set-world-callback ((bone-cspace cspace) (joint-trasnform transformq)) + "Callback for joint-mod-set-world. See comment on that type." + (let ((v1-0 (the-as joint-mod-set-local (-> bone-cspace param1)))) + (cspace<-transformq! bone-cspace (-> v1-0 transform)) + ) + (none) + ) + +(defmethod init ((this joint-mod-set-world) (arg0 process-drawable) (arg1 uint) (arg2 joint-mod-base-flags)) + "Set up this joint-mod to modify the given joint of the given process. Will attach automatically if attached flag is set." + (rlet ((vf0 :class vf)) + (init-vf0-vector) + (set! (-> this callback) joint-mod-set-world-callback) + (.svf (&-> (-> this transform) trans quad) vf0) + (quaternion-identity! (-> this transform quat)) + (vector-identity! (-> this transform scale)) + ((method-of-type joint-mod-base init) this arg0 arg1 arg2) + (none) + ) + ) + +(deftype joint-mod-set-world-no-trans (joint-mod-base) + "Set the rotation and scale of the _bone_ directly to the values from this transform. +The translation is kept from the result of the normal parented value." + ((transform transformq :inline) + ) + ) + +;; WARN: Return type mismatch vector vs none. +(defun joint-mod-set-world-no-trans-callback ((bone-cspace cspace) (joint-transform transformq)) + "Callback for joint-mod-set-world-no-trans. See comment on that type." + (let ((s4-0 (the-as joint-mod-set-world-no-trans (-> bone-cspace param1))) + (gp-0 (new 'stack-no-clear 'matrix)) + ) + (cspace<-parented-transformq-joint! bone-cspace joint-transform) + (matrix<-transformq! gp-0 (-> s4-0 transform)) + (set! (-> bone-cspace bone transform rvec quad) (-> gp-0 rvec quad)) + (set! (-> bone-cspace bone transform uvec quad) (-> gp-0 uvec quad)) + (set! (-> bone-cspace bone transform fvec quad) (-> gp-0 fvec quad)) + ) + (none) + ) + +(defmethod init ((this joint-mod-set-world-no-trans) (arg0 process-drawable) (arg1 uint) (arg2 joint-mod-base-flags)) + "Set up this joint-mod to modify the given joint of the given process. Will attach automatically if attached flag is set." + (rlet ((vf0 :class vf)) + (init-vf0-vector) + (set! (-> this callback) joint-mod-set-world-no-trans-callback) + (.svf (&-> (-> this transform) trans quad) vf0) + (quaternion-identity! (-> this transform quat)) + (vector-identity! (-> this transform scale)) + ((method-of-type joint-mod-base init) this arg0 arg1 arg2) + (none) + ) + ) + +(deftype joint-mod-blend-local (joint-mod-base) + "Blend the _joint_ transform between this transform and the animated one. +Then, apply the normal parented transform." + ((transform transformq :inline) + (blend-transform transformq :inline) + (blend float) + ) + (:methods + (new (symbol type) _type_) + ) + ) + +(defun joint-mod-blend-local-callback ((bone-cspace cspace) (joint-transform transformq)) + "Callback for joint-mod-blend-local. See comment on that type." + (let ((gp-0 (the-as joint-mod-blend-local (-> bone-cspace param1)))) + (vector-lerp! + (the-as vector (-> gp-0 blend-transform)) + (-> joint-transform trans) + (the-as vector (-> gp-0 transform)) + (-> gp-0 blend) + ) + (vector-lerp! + (-> gp-0 blend-transform scale) + (-> joint-transform scale) + (-> gp-0 transform scale) + (-> gp-0 blend) + ) + (quaternion-slerp! + (-> gp-0 blend-transform quat) + (-> joint-transform quat) + (-> gp-0 transform quat) + (-> gp-0 blend) + ) + (cspace<-parented-transformq-joint! bone-cspace (-> gp-0 blend-transform)) + ) + (none) + ) + +(defmethod init ((this joint-mod-blend-local) (arg0 process-drawable) (arg1 uint) (arg2 joint-mod-base-flags)) + "Set up this joint-mod to modify the given joint of the given process. Will attach automatically if attached flag is set." + (rlet ((vf0 :class vf)) + (init-vf0-vector) + (set! (-> this callback) joint-mod-blend-local-callback) + (.svf (&-> (-> this transform) trans quad) vf0) + (quaternion-identity! (-> this transform quat)) + (vector-identity! (-> this transform scale)) + (set! (-> this blend) 0.0) + ((method-of-type joint-mod-base init) this arg0 arg1 arg2) + (none) + ) + ) + +(deftype joint-mod-blend-world (joint-mod-base) + "Blend the _bone_ transform between this one and the animated one." + ((transform transformq :inline) + (blend-transform transformq :inline) + (blend float) + ) + (:methods + (new (symbol type) _type_) + ) + ) + +;; WARN: Return type mismatch matrix vs none. +(defun joint-mod-blend-world-callback ((bone-cspace cspace) (joint-transform transformq)) + "Callback for joint-mod-blend-world. See comment on that type." + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (let ((gp-0 (the-as joint-mod-blend-world (-> bone-cspace param1)))) + (let ((f30-0 (if (logtest? (-> gp-0 flags) (joint-mod-base-flags trans)) + (-> gp-0 blend) + 0.0 + ) + ) + (f28-0 (if (logtest? (-> gp-0 flags) (joint-mod-base-flags quat)) + (-> gp-0 blend) + 0.0 + ) + ) + (f26-0 (if (logtest? (-> gp-0 flags) (joint-mod-base-flags scale)) + (-> gp-0 blend) + 0.0 + ) + ) + (s3-0 (new 'stack-no-clear 'joint-mod-blend-world-work)) + ) + (if (= (-> bone-cspace parent bone scale w) 0.0) + (matrix<-transformq! (-> s3-0 mat1) joint-transform) + (matrix<-parented-transformq! (-> s3-0 mat1) joint-transform (-> bone-cspace parent bone scale)) + ) + (matrix*! (-> s3-0 mat2) (-> s3-0 mat1) (-> bone-cspace parent bone transform)) + (set-vector! + (-> s3-0 vec) + (vector-length (the-as vector (-> s3-0 mat2))) + (vector-length (-> s3-0 mat2 uvec)) + (vector-length (-> s3-0 mat2 fvec)) + 1.0 + ) + (let ((a0-11 (-> gp-0 blend-transform scale))) + (let ((v1-18 (-> s3-0 vec)) + (a1-4 (-> joint-transform scale)) + ) + (.lvf vf4 (&-> v1-18 quad)) + (.lvf vf5 (&-> a1-4 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.vf vf6 vf4 vf5 :mask #b111) + (.svf (&-> a0-11 quad) vf6) + ) + (vector-lerp! + (the-as vector (-> gp-0 blend-transform)) + (-> s3-0 mat2 trans) + (the-as vector (-> gp-0 transform)) + f30-0 + ) + (vector-lerp! (-> gp-0 blend-transform scale) (-> gp-0 blend-transform scale) (-> gp-0 transform scale) f26-0) + (quaternion-slerp! + (-> gp-0 blend-transform quat) + (matrix->quat (-> s3-0 mat2) (-> s3-0 quat)) + (-> gp-0 transform quat) + f28-0 + ) + ) + (cspace<-transformq! bone-cspace (-> gp-0 blend-transform)) + ) + (none) + ) + ) + +(defmethod init ((this joint-mod-blend-world) (arg0 process-drawable) (arg1 uint) (arg2 joint-mod-base-flags)) + "Set up this joint-mod to modify the given joint of the given process. Will attach automatically if attached flag is set." + (rlet ((vf0 :class vf)) + (init-vf0-vector) + (set! (-> this callback) joint-mod-blend-world-callback) + (.svf (&-> (-> this transform) trans quad) vf0) + (quaternion-identity! (-> this transform quat)) + (vector-identity! (-> this transform scale)) + (set! (-> this blend) 0.0) + ((method-of-type joint-mod-base init) this arg0 arg1 arg2) + (none) + ) + ) + (deftype joint-mod-ik (basic) ((flags joint-mod-ik-flags) (process process-drawable) @@ -179,3 +632,38 @@ This is used to make jak look toward an enemy, for example." (joint-mod-ik-method-10 () none) ) ) + +(deftype ik-limb-setup (structure) + ((elbow-index int32) + (hand-dist float) + ) + ) + +(deftype joint-mod-polar-look-at (basic) + ((flags uint32) + (ear int8) + (up int8) + (nose int8) + (polar-internal-tilt-max float) + (polar-internal-radius float) + (polar-external-tilt-max float) + (polar-external-radius float) + (upward-tilt float) + (downward-tilt float) + (forward-twist float) + (backward-twist float) + (target vector :inline) + (blend-duration uint64) + (blend-start-time uint64) + (blend-start-value float) + (blend-max float) + ) + (:methods + (joint-mod-polar-look-at-method-9 () none) + (joint-mod-polar-look-at-method-10 () none) + (joint-mod-polar-look-at-method-11 () none) + (joint-mod-polar-look-at-method-12 () none) + (joint-mod-polar-look-at-method-13 () none) + (joint-mod-polar-look-at-method-14 () none) + ) + ) diff --git a/goal_src/jak3/engine/collide/collide-frag-h.gc b/goal_src/jak3/engine/collide/collide-frag-h.gc index a1dbf93849..9562726104 100644 --- a/goal_src/jak3/engine/collide/collide-frag-h.gc +++ b/goal_src/jak3/engine/collide/collide-frag-h.gc @@ -7,3 +7,43 @@ ;; DECOMP BEGINS +(deftype collide-frag-vertex (vector) + () + ) + + +(deftype collide-frag-mesh (basic) + "Unused Jak 1 background collision mesh fragment." + ((packed-data uint32) + (pat-array uint32) + (strip-data-len uint16) + (poly-count uint16) + (base-trans vector4w :inline) + (vertex-count uint8 :overlay-at (-> base-trans data 3)) + (vertex-data-qwc uint8 :offset 29) + (total-qwc uint8 :offset 30) + (unused uint8 :offset 31) + ) + ) + + +(deftype collide-fragment (drawable) + "Unused Jak 1 background collision drawable tree node." + ((mesh collide-frag-mesh :offset 8) + (collide-new basic :offset 12) + ) + ) + + +(deftype drawable-inline-array-collide-fragment (drawable-inline-array) + "Unused Jak 1 background collision drawable tree inline-array class." + ((data collide-fragment 1 :inline) + (pad uint32) + ) + ) + + +(deftype drawable-tree-collide-fragment (drawable-tree) + "Unused jak 1 background collision data." + () + ) diff --git a/goal_src/jak3/engine/common-obs/projectile-h.gc b/goal_src/jak3/engine/common-obs/projectile-h.gc index c753d354e6..ee242fc45e 100644 --- a/goal_src/jak3/engine/common-obs/projectile-h.gc +++ b/goal_src/jak3/engine/common-obs/projectile-h.gc @@ -5,5 +5,119 @@ ;; name in dgo: projectile-h ;; dgos: GAME +(defenum projectile-options + :bitfield #t + :type uint64 + ) + +(declare-type projectile process) +(declare-type projectile-init-by-other-params structure) +(define-extern projectile-init-by-other (function projectile-init-by-other-params projectile :behavior projectile)) + + ;; DECOMP BEGINS +(deftype projectile (process-drawable) + ((starting-pos vector :inline) + (starting-dir vector :inline) + (target-pos vector :inline) + (base-target-pos vector :inline) + (pre-move-transv vector :inline) + (timeout time-frame) + (spawn-time time-frame) + (options projectile-options) + (last-target handle) + (notify-handle handle) + (owner-handle handle) + (ignore-handle handle) + (update-velocity (function projectile none)) + (move (function projectile none)) + (pick-target (function projectile none)) + (max-speed float) + (old-dist float 16) + (old-dist-count int32) + (hits int32) + (max-hits int32) + (tween float) + (attack-mode symbol) + (attack-id uint32) + (damage float) + (vehicle-damage-factor float) + (vehicle-impulse-factor float) + (charge-level float) + (sound-id sound-id) + (stop-speed meters) + (invinc-time time-frame) + (desired-target uint64) + (desired-target-pos vector :inline) + ) + (:methods + (projectile-method-20 () none) + (projectile-method-21 () none) + (projectile-method-22 () none) + (projectile-method-23 () none) + (projectile-method-24 () none) + (projectile-method-25 () none) + (projectile-method-26 () none) + (projectile-method-27 () none) + (projectile-method-28 () none) + (projectile-method-29 () none) + (projectile-method-30 () none) + (projectile-method-31 () none) + (projectile-method-32 () none) + (projectile-method-33 () none) + (projectile-method-34 () none) + (projectile-method-35 () none) + (projectile-method-36 () none) + (projectile-method-37 () none) + (projectile-method-38 () none) + (projectile-method-39 () none) + (projectile-method-40 () none) + ) + ) + + +(deftype projectile-init-by-other-params (structure) + ((pos vector :inline) + (vel vector :inline) + (target-pos vector :inline) + (target-handle uint64) + (ent entity) + (charge float) + (attack-id uint32) + (options projectile-options) + (notify-handle handle) + (owner-handle handle) + (ignore-handle handle) + (timeout time-frame) + (damage float) + (vehicle-damage-factor float) + (vehicle-impulse-factor float) + ) + ) + + +(defun spawn-projectile ((proj-type type) (params projectile-init-by-other-params) (parent-proc-tree process-tree) (pool dead-pool)) + "Create a new process for a projectile of the given type." + (let ((s4-0 (get-process pool proj-type #x4000 1))) + (when s4-0 + (let ((t9-1 (method-of-type process activate))) + (t9-1 s4-0 parent-proc-tree "projectile" (the-as pointer #x70004000)) + ) + (run-now-in-process s4-0 projectile-init-by-other params) + (-> s4-0 ppointer) + ) + ) + ) + +(deftype projectile-bounce (projectile) + ((played-bounce-time time-frame) + (tumble-quat quaternion :inline) + (gravity float) + ) + (:methods + (projectile-bounce-method-41 () none) + (projectile-bounce-method-42 () none) + (projectile-bounce-method-43 () none) + ) + ) diff --git a/goal_src/jak3/engine/debug/debug-h.gc b/goal_src/jak3/engine/debug/debug-h.gc index 0dd2c547c5..d3947d6bc4 100644 --- a/goal_src/jak3/engine/debug/debug-h.gc +++ b/goal_src/jak3/engine/debug/debug-h.gc @@ -5,6 +5,9 @@ ;; name in dgo: debug-h ;; dgos: GAME +(define-extern add-debug-matrix (function symbol bucket-id matrix meters matrix)) + + ;; DECOMP BEGINS (deftype pos-history (structure) diff --git a/goal_src/jak3/engine/debug/stats-h.gc b/goal_src/jak3/engine/debug/stats-h.gc index 09c574bbd2..6bf605396c 100644 --- a/goal_src/jak3/engine/debug/stats-h.gc +++ b/goal_src/jak3/engine/debug/stats-h.gc @@ -5,5 +5,363 @@ ;; name in dgo: stats-h ;; dgos: GAME +(defenum perf-stat-bucket + :type uint32 ;; guess + (all-code) + (spatial-hash-build) + (spatial-hash-search) + (collide) + (collide-list) + (collide-fill) + (actor-hash) + (nav) + (nav-dma-all) + (nav-dma-read) + (nav-dma-write) + (nav-dma-work) + (nav-part1) + (nav-part2) + (nav-part3) + (nav-part4) + (nav-part5) + (nav-part6) + (nav-part7) + (nav-part8) + (nav-part9) + (nav-part10) + (add-to-translation) + (update-current-poly) + (clamp-vector-to-mesh) + (ray-step) + (update-spheres) + (travel-around-spheres) + (avoid-spheres) + (check-vector-collision-with-nav-spheres) + (find-nearest-poly) + (find-containing-poly) + (generate-velocity) + (apply-rotation) + (apply-velocity) + (travel-post) + (common-post) + (misc) + (mercneric) + (tie-generic) + (background) + (drawable) + (tfrag) + (tfrag-scissor) + (inst-shrub) + (proto-shrub) + (inst-tie) + (proto-tie) + (bones) + (camera) + (foreground) + (hover-path) + (hover-spheres) + (hover-update) + (hover-move) + (hover-find-closest) + (update-los) +) + +(define *pc-perf-stat-counter* (the-as uint 0)) + ;; DECOMP BEGINS +(deftype tr-stat (structure) + "triangle stats for a renderer. This can apply to a lot of different renderer types." + ((groups uint16) + (fragments uint16) + (tris uint32) + (dverts uint32) + (instances uint16) + (pad uint16) + ) + ) + + +(deftype merc-global-stats (structure) + "Triangle stats for all merc renderers." + ((merc tr-stat :inline) + (emerc tr-stat :inline) + (mercneric tr-stat :inline) + ) + ) + + +(deftype perf-stat (structure) + "Performance statistics for a single 'bucket' or category. Unlike the more general profile-bars, +this records statistics like cache hits/instruction counts." + ((frame-number uint32) + (count uint32) + (cycles uint32) + (instructions uint32) + (icache uint32) + (dcache uint32) + (select uint32) + (ctrl uint32) + (accum0 uint32) + (accum1 uint32) + (to-vu0-waits uint32) + (to-spr-waits uint32) + (from-spr-waits uint32) + ) + :pack-me + (:methods + (perf-stat-method-9 () none) + (print-to-stream (_type_ string basic) none) + (start-profiling! (_type_) none) + (stop-profiling! (_type_) none) + (update-wait-stats (_type_ uint uint uint) none) + ) + ) + + +(defun-debug perf-stat-bucket->string ((arg0 perf-stat-bucket)) + (case arg0 + (((perf-stat-bucket collide-fill)) + "collide-fill" + ) + (((perf-stat-bucket nav)) + "nav" + ) + (((perf-stat-bucket bones)) + "bones" + ) + (((perf-stat-bucket foreground)) + "foreground" + ) + (((perf-stat-bucket inst-tie)) + "inst-tie" + ) + (((perf-stat-bucket common-post)) + "common-post" + ) + (((perf-stat-bucket nav-dma-write)) + "nav-dma-write" + ) + (((perf-stat-bucket collide-list)) + "collide-list" + ) + (((perf-stat-bucket clamp-vector-to-mesh)) + "clamp-vector-to-mesh" + ) + (((perf-stat-bucket nav-part3)) + "nav-part3" + ) + (((perf-stat-bucket mercneric)) + "mercneric" + ) + (((perf-stat-bucket apply-velocity)) + "apply-velocity" + ) + (((perf-stat-bucket tfrag-scissor)) + "tfrag-scissor" + ) + (((perf-stat-bucket hover-update)) + "hover-update" + ) + (((perf-stat-bucket misc)) + "misc" + ) + (((perf-stat-bucket find-nearest-poly)) + "find-nearest-poly" + ) + (((perf-stat-bucket nav-part6)) + "nav-part6" + ) + (((perf-stat-bucket nav-part2)) + "nav-part2" + ) + (((perf-stat-bucket generate-velocity)) + "generate-velocity" + ) + (((perf-stat-bucket inst-shrub)) + "inst-shrub" + ) + (((perf-stat-bucket hover-path)) + "hover-path" + ) + (((perf-stat-bucket avoid-spheres)) + "avoid-spheres" + ) + (((perf-stat-bucket proto-shrub)) + "proto-shrub" + ) + (((perf-stat-bucket drawable)) + "drawable" + ) + (((perf-stat-bucket nav-part9)) + "nav-part9" + ) + (((perf-stat-bucket all-code)) + "all-code" + ) + (((perf-stat-bucket actor-hash)) + "actor-hash" + ) + (((perf-stat-bucket nav-dma-all)) + "nav-dma-all" + ) + (((perf-stat-bucket travel-post)) + "travel-post" + ) + (((perf-stat-bucket travel-around-spheres)) + "travel-around-spheres" + ) + (((perf-stat-bucket nav-part10)) + "nav-part10" + ) + (((perf-stat-bucket nav-dma-work)) + "nav-dma-work" + ) + (((perf-stat-bucket update-los)) + "update-los" + ) + (((perf-stat-bucket proto-tie)) + "proto-tie" + ) + (((perf-stat-bucket hover-move)) + "hover-move" + ) + (((perf-stat-bucket nav-part4)) + "nav-part4" + ) + (((perf-stat-bucket ray-step)) + "ray-step" + ) + (((perf-stat-bucket hover-find-closest)) + "hover-find-closest" + ) + (((perf-stat-bucket spatial-hash-search)) + "spatial-hash-search" + ) + (((perf-stat-bucket apply-rotation)) + "apply-rotation" + ) + (((perf-stat-bucket find-containing-poly)) + "find-containing-poly" + ) + (((perf-stat-bucket update-spheres)) + "update-spheres" + ) + (((perf-stat-bucket nav-part7)) + "nav-part7" + ) + (((perf-stat-bucket tfrag)) + "tfrag" + ) + (((perf-stat-bucket collide)) + "collide" + ) + (((perf-stat-bucket update-current-poly)) + "update-current-poly" + ) + (((perf-stat-bucket nav-dma-read)) + "nav-dma-read" + ) + (((perf-stat-bucket spatial-hash-build)) + "spatial-hash-build" + ) + (((perf-stat-bucket tie-generic)) + "tie-generic" + ) + (((perf-stat-bucket camera)) + "camera" + ) + (((perf-stat-bucket background)) + "background" + ) + (((perf-stat-bucket nav-part5)) + "nav-part5" + ) + (((perf-stat-bucket nav-part1)) + "nav-part1" + ) + (((perf-stat-bucket hover-spheres)) + "hover-spheres" + ) + (((perf-stat-bucket check-vector-collision-with-nav-spheres)) + "check-vector-collision-with-nav-spheres" + ) + (((perf-stat-bucket add-to-translation)) + "add-to-translation" + ) + (((perf-stat-bucket nav-part8)) + "nav-part8" + ) + (else + "*unknown*" + ) + ) + ) + +(deftype perf-stat-array (inline-array-class) + "Array of all stats for all buckets." + ((data perf-stat :inline :dynamic) + ) + ) + + +(set! (-> perf-stat-array heap-base) (the-as uint 52)) + +(defmethod start-profiling! ((this perf-stat)) + (+! (-> this count) 1) + (when (nonzero? (-> this ctrl)) + (set! *pc-perf-stat-counter* (get-cpu-clock)) + ) + ; (let ((v1-0 (-> this ctrl))) + ; (+! (-> this count) 1) + ; (b! (zero? v1-0) cfg-2 :delay (nop!)) + ; (.mtc0 Perf 0) + ; (.sync.l) + ; (.sync.p) + ; (.mtpc pcr0 0) + ; (.mtpc pcr1 0) + ; (.sync.l) + ; (.sync.p) + ; (.mtc0 Perf v1-0) + ; ) + ; (.sync.l) + ; (.sync.p) + ; (label cfg-2) + ; 0 + (none) + ) + +(defmethod stop-profiling! ((this perf-stat)) + ; (local-vars (v1-1 int) (v1-3 int)) + ; (b! (zero? (-> this ctrl)) cfg-2 :delay (nop!)) + ; (.mtc0 Perf 0) + ; (.sync.l) + ; (.sync.p) + ; (.mfpc v1-1 pcr0) + ; (+! (-> this accum0) v1-1) + ; (.mfpc v1-3 pcr1) + ; (+! (-> this accum1) v1-3) + ; (label cfg-2) + ; 0 + (when (nonzero? (-> this ctrl)) + (+! (-> this accum0) (- (get-cpu-clock) *pc-perf-stat-counter*)) + (set! (-> this accum1) 0) + ) + (none) + ) + +(defmethod update-wait-stats ((this perf-stat) (arg0 uint) (arg1 uint) (arg2 uint)) + (when (nonzero? (-> this ctrl)) + (+! (-> this to-vu0-waits) arg0) + (+! (-> this to-spr-waits) arg1) + (+! (-> this from-spr-waits) arg2) + ) + 0 + (none) + ) + +(when (not *debug-segment*) + (set! (-> perf-stat method-table 11) nothing) + (set! (-> perf-stat method-table 12) nothing) + (set! (-> perf-stat method-table 13) nothing) + ) diff --git a/goal_src/jak3/engine/gfx/vu1-user-h.gc b/goal_src/jak3/engine/gfx/vu1-user-h.gc index 30c5ee38a9..05db187c3f 100644 --- a/goal_src/jak3/engine/gfx/vu1-user-h.gc +++ b/goal_src/jak3/engine/gfx/vu1-user-h.gc @@ -602,7 +602,7 @@ (bucket574 574) (bucket575 575) (bucket576 576) - (bucket577 577) + (bucket577 577) ;; debug? (bucket578 578) (bucket579 579) (bucket580 580) diff --git a/goal_src/jak3/engine/level/bsp-h.gc b/goal_src/jak3/engine/level/bsp-h.gc index 3f23a4a2f6..2921983d18 100644 --- a/goal_src/jak3/engine/level/bsp-h.gc +++ b/goal_src/jak3/engine/level/bsp-h.gc @@ -5,5 +5,122 @@ ;; name in dgo: bsp-h ;; dgos: GAME +(declare-type bsp-header drawable) +(declare-type bsp-node structure) +(define-extern inspect-bsp-tree (function bsp-header bsp-node none)) +(define-extern map-bsp-tree (function (function bsp-node none) bsp-header bsp-node none)) + ;; DECOMP BEGINS +(deftype bsp-node (structure) + "A node in the 'BSP' tree. This is really a bounding volume tree, where each volume is an axis-aligned box, containing 2 child boxes. +This is used for precomputed visibility, based on the camera position. This is not used for collision." + ((front int16) + (back int16) + (front-box-min vector4b :inline) + (front-box-max vector4b :inline) + (back-box-min vector4b :inline) + (back-box-max vector4b :inline) + ) + ) + + +(deftype bsp-header (drawable) + "The bsp-header is really an entire level. +This probably started as a very simple structure, but now it is extremely complicated." + ((all-visible-list (pointer uint16) :offset 32) + (visible-list-length int16 :offset 36) + (drawable-trees drawable-tree-array :offset 40) + (pat pointer :offset 44) + (pat-length int32 :offset 48) + (nodes (inline-array bsp-node) :offset 120) + (end uint8 :offset 399) + ) + (:methods + (birth (_type_) none) + (deactivate-entities (_type_) none) + ) + ) + +(deftype game-level (basic) + "Unused in Jak 1, 2, and 3!" + ((master-bsp basic) + ) + ) + + +(deftype view-frustum (structure) + "A view frustum, expressed as corners. +This representation is not very useful, and is used in only one spot to generate camera planes +in a very inefficient way." + ((hither-top-left vector :inline) + (hither-top-right vector :inline) + (hither-bottom-left vector :inline) + (hither-bottom-right vector :inline) + (yon-top-left vector :inline) + (yon-top-right vector :inline) + (yon-bottom-left vector :inline) + (yon-bottom-right vector :inline) + ) + ) + + + +;; WARN: Return type mismatch bsp-header vs none. +(defun-debug inspect-bsp-tree ((arg0 bsp-header) (arg1 bsp-node)) + "Attempt to print a bsp-tree, but it is actually broken since the jak 2 bsp format change" + (cond + ((zero? arg1) + ) + (else + (format #t "_#x~X________________~%" arg1) + (inspect arg1) + (let ((s4-0 *print-column*)) + (set! *print-column* (+ *print-column* 64)) + (if (> (-> arg1 front) 0) + (inspect-bsp-tree arg0 (the-as bsp-node (-> arg1 front))) + (format #t "_#x~X________________~%" arg1) + ) + (if (> (-> arg1 back) 0) + (inspect-bsp-tree arg0 (the-as bsp-node (-> arg1 back))) + (format #t "_#x~X________________~%" arg1) + ) + (set! *print-column* s4-0) + ) + ) + ) + (none) + ) + +;; WARN: Return type mismatch bsp-header vs none. +(defun map-bsp-tree ((arg0 (function bsp-node none)) (arg1 bsp-header) (arg2 bsp-node)) + "Attempt to call a function on all bsp-tree nodes, but it is actually broken since the jak 2 bsp format" + (cond + ((zero? arg2) + ) + (else + (if (> (-> arg2 front) 0) + (map-bsp-tree arg0 arg1 (the-as bsp-node (-> arg2 front))) + (arg0 arg2) + ) + (if (> (-> arg2 back) 0) + (map-bsp-tree arg0 arg1 (the-as bsp-node (-> arg2 back))) + (arg0 arg2) + ) + ) + ) + (none) + ) + +(deftype collide-stats (structure) + "Very strange collide stats type. It has been somewhat broken in all versions of the game. +The final stopwatch is cut off. For jak 3, I just fixed it." + ((calls uint32) + (spheres uint32) + (nodes uint32) + (frags uint32) + (tris uint32) + (output uint32) + (junk (pointer uint32) 24) + ) + ) diff --git a/goal_src/jak3/engine/math/transformq-h.gc b/goal_src/jak3/engine/math/transformq-h.gc index bcfbcaabbc..b182aeeeb4 100644 --- a/goal_src/jak3/engine/math/transformq-h.gc +++ b/goal_src/jak3/engine/math/transformq-h.gc @@ -5,6 +5,10 @@ ;; name in dgo: transformq-h ;; dgos: GAME +(declare-type transformq structure) +(define-extern matrix<-transformq! (function matrix transformq matrix)) +(define-extern matrix<-parented-transformq! (function matrix transformq vector matrix)) + ;; DECOMP BEGINS (deftype transformq (transform) diff --git a/goal_src/jak3/engine/physics/chain-physics-h.gc b/goal_src/jak3/engine/physics/chain-physics-h.gc index 9efb3efcde..1d18e5319c 100644 --- a/goal_src/jak3/engine/physics/chain-physics-h.gc +++ b/goal_src/jak3/engine/physics/chain-physics-h.gc @@ -7,3 +7,47 @@ ;; DECOMP BEGINS +(deftype chain-physics-setup (structure) + ((joint-index int32) + ) + ) + + +(deftype chain-physics-joint (structure) + ((position vector :inline) + (velocity vector :inline) + (old-x vector :inline) + (joint-mod joint-mod) + ) + ) + + +(deftype chain-physics (basic) + ((chain-joints chain-physics-joint 20 :inline) + (num-joints uint8) + (root-joint-index uint8) + (joint-length float) + (gravity vector :inline) + (gravity-target vector :inline) + (stretch-vel float) + (stretch-vel-parallel float) + (compress-vel float) + (compress-vel-parallel float) + (negate-y symbol) + (axial-slop float) + (maximum-stretch float) + (turn-off-start uint64) + (turn-off-duration uint64) + ) + (:methods + (chain-physics-method-9 () none) + (chain-physics-method-10 () none) + (chain-physics-method-11 () none) + (chain-physics-method-12 () none) + (chain-physics-method-13 () none) + (chain-physics-method-14 () none) + (chain-physics-method-15 () none) + (chain-physics-method-16 () none) + (chain-physics-method-17 () none) + ) + ) diff --git a/goal_src/jak3/engine/physics/ragdoll-h.gc b/goal_src/jak3/engine/physics/ragdoll-h.gc index 74f1ce62a7..9c5d6fbc30 100644 --- a/goal_src/jak3/engine/physics/ragdoll-h.gc +++ b/goal_src/jak3/engine/physics/ragdoll-h.gc @@ -7,3 +7,164 @@ ;; DECOMP BEGINS +(deftype ragdoll-edit-info (structure) + ((editing symbol) + (current-func uint64) + (analog-func uint64) + (affect uint64) + (single-step uint64) + (collision symbol) + (gravity symbol) + (skel-visible uint64) + (current-joint int8) + (auto-setup-now basic) + (child-stack object 60) + (child-stack-num int8) + (last-frame uint64) + (last-frame-dur uint64) + ) + (:methods + (ragdoll-edit-info-method-9 () none) + (ragdoll-edit-info-method-10 () none) + (ragdoll-edit-info-method-11 () none) + (ragdoll-edit-info-method-12 () none) + (ragdoll-edit-info-method-13 () none) + (ragdoll-edit-info-method-14 () none) + (ragdoll-edit-info-method-15 () none) + (ragdoll-edit-info-method-16 () none) + (ragdoll-edit-info-method-17 () none) + ) + ) + + +(define *ragdoll-edit-info* (the-as ragdoll-edit-info 0)) + +(define *ragdoll-edit-info* (new 'static 'ragdoll-edit-info + :editing #t + :current-func #x9 + :single-step #x2 + :collision #t + :gravity #t + :skel-visible #x1 + ) + ) + +(deftype ragdoll-joint-setup (structure) + ((joint-index int32) + (parent-joint int32) + (joint-type uint64) + (pre-tform vector :inline) + (geo-tform vector :inline) + (axial-slop float) + (max-angle float) + (coll-rad float) + (hit-sound uint128) + ) + ) + + +(deftype ragdoll-setup (structure) + ((orient-tform vector :inline) + (scale vector :inline) + (bg-collide-with collide-spec) + (joint-setup basic) + ) + ) + + +(deftype ragdoll-joint (structure) + ((quat quaternion :inline) + (position vector :inline) + (velocity vector :inline) + (bounce vector :inline) + (old-x vector :inline) + (pre-tform vector :inline) + (geo-tform vector :inline) + (axial-slop float) + (max-angle float) + (joint-length float) + (coll-rad float) + (ragdoll-joint-flags uint32) + (joint-type uint64) + (joint-index int8) + (parent-joint int8) + (parent-index int8) + (num-children int8) + (old-param0 basic) + (hit-sound uint128) + (ground-pat uint32) + (user0 int32) + (original-speed float) + ) + ) + + +(deftype ragdoll (basic) + ((ragdoll-joints ragdoll-joint 60 :inline) + (num-joints uint8) + (mirror matrix :inline) + (gravity vector :inline) + (gravity-target vector :inline) + (orient-tform vector :inline) + (scale vector :inline) + (stretch-vel float) + (stretch-vel-parallel float) + (compress-vel float) + (compress-vel-parallel float) + (momentum float) + (maximum-stretch float) + (turn-off-start uint64) + (turn-off-duration uint64) + (copy-velocity-start uint64) + (root-offset vector :inline) + (rotate-vel quaternion :inline) + (rotate-adj quaternion :inline) + (rotate-adj-count int8) + (ragdoll-flags uint32) + (flex-blend float) + (stable-joints int8) + (ragdoll-joint-remap uint8 100) + (allow-destabilize uint64) + (bg-collide-with uint32) + (water-info water-info :inline) + ) + (:methods + (ragdoll-method-9 () none) + (ragdoll-method-10 () none) + (ragdoll-method-11 () none) + (ragdoll-method-12 () none) + (ragdoll-method-13 () none) + (ragdoll-method-14 () none) + (ragdoll-method-15 () none) + (ragdoll-method-16 () none) + (ragdoll-method-17 () none) + (ragdoll-method-18 () none) + (ragdoll-method-19 () none) + (ragdoll-method-20 () none) + (ragdoll-method-21 () none) + (ragdoll-method-22 () none) + (ragdoll-method-23 () none) + (ragdoll-method-24 () none) + (ragdoll-method-25 () none) + ) + ) + + +(deftype ragdoll-proc (process) + ((ragdoll ragdoll) + (last-attack-id uint32) + ) + (:methods + (ragdoll-proc-method-14 () none) + (ragdoll-proc-method-15 () none) + (ragdoll-proc-method-16 () none) + (ragdoll-proc-method-17 () none) + (ragdoll-proc-method-18 () none) + (ragdoll-proc-method-19 () none) + ) + ) + + +(deftype wings-ragdoll-proc (ragdoll-proc) + () + ) diff --git a/goal_src/jak3/engine/spatial-hash/collide-hash-h.gc b/goal_src/jak3/engine/spatial-hash/collide-hash-h.gc index e89cf1b6ac..e30484cb27 100644 --- a/goal_src/jak3/engine/spatial-hash/collide-hash-h.gc +++ b/goal_src/jak3/engine/spatial-hash/collide-hash-h.gc @@ -7,3 +7,111 @@ ;; DECOMP BEGINS +(define *collide-list-boxes* #f) + +(define *collide-hash-fragments* 0) + +(define *collide-hash-fragments-tfrag* 0) + +(define *collide-hash-fragments-instance* 0) + +(define *already-printed-exeeded-max-cache-tris* #f) + +(deftype collide-hash-scratch (structure) + "Scratchpad memory layout for collide-hash. Bitmask of things that have already been checked" + ((collidable-bits uint128 128) + (poly-bits uint64 2 :overlay-at (-> collidable-bits 0)) + (id-bits uint32 512 :overlay-at (-> collidable-bits 0)) + (tris uint32) + ) + ) + + +(deftype collide-hash-bucket (structure) + "A bucket is a reference to a list of items that intersect a grid cell. +For the broadphase, the items are collide-hash-item (wrapper of collide-hash-fragment). +For the narrowphase, the items are entries in the index list, which contains poly indices." + ((index int16) + (count int16) + ) + ) + + +(deftype collide-hash-item (structure) + "Items that are 'hashed' in the broadphase. Contains unique ID for checking against already-visited-bitmask +and a pointer to the actual collide-hash-fragment, or possibly a TIE." + ((id uint32) + (collidable basic) + ) + ) + + +(deftype collide-hash-poly (structure) + "A polygon in the narrow-phase data. This is just indices into the vertex and PAT tables." + ((data uint8 4) + (vert-index0 uint8 :overlay-at (-> data 0)) + (vert-index1 uint8 :overlay-at (-> data 1)) + (vert-index2 uint8 :overlay-at (-> data 2)) + (pat-index uint8 :overlay-at (-> data 3)) + (word uint32 :overlay-at (-> data 0)) + ) + ) + + +(deftype collide-hash-fragment-stats (structure) + ((num-verts uint16) + (num-polys uint8) + (poly-count uint8) + ) + :pack-me + ) + + +(deftype collide-hash-fragment (drawable) + "A mesh fragment for the Jak2/Jak3 collision system. This is a 'hash' of triangles into a grid +where the 'hash' function is just identity." + ((num-buckets uint16 :overlay-at id) + (num-indices uint16 :offset 6) + (pat-array uint32 :offset 8) + (bucket-array uint32 :offset 12) + (grid-step vector :inline) + (bbox bounding-box :inline) + (bbox4w bounding-box4w :inline) + (axis-scale vector :inline :overlay-at (-> bbox max)) + (avg-extents vector :inline :overlay-at (-> bbox4w min data 0)) + (dimension-array uint32 4 :overlay-at (-> grid-step data 3)) + (stats collide-hash-fragment-stats :inline :overlay-at (-> bbox min data 3)) + (num-verts uint16 :overlay-at (-> bbox min data 3)) + (num-polys uint8 :offset 62) + (poly-count uint8 :offset 63) + (poly-array uint32 :overlay-at (-> bbox max data 3)) + (vert-array uint32 :overlay-at (-> bbox4w min data 3)) + (index-array uint32 :overlay-at (-> bbox4w max data 3)) + ) + ) + + +(deftype collide-hash-fragment-array (array) + "A collection of collide-hash-fragments. These are used by the instanced collision if a single instance +needs more than 1 collide-hash-fragment worth of triangles." + ((fragments collide-hash-fragment :dynamic :offset 16) + ) + ) + + +(deftype collide-hash (drawable) + ((num-ids uint16 :overlay-at id) + (id-count uint16 :offset 6) + (num-buckets uint32 :offset 8) + (qwc-id-bits uint32 :offset 12) + (grid-step vector :inline :overlay-at bsphere) + (bbox bounding-box :inline :offset 32) + (bbox4w bounding-box4w :inline :offset 64) + (axis-scale vector :inline :offset 48) + (avg-extents vector :inline :offset 64) + (bucket-array uint32 :offset 44) + (item-array (inline-array collide-hash-item) :overlay-at (-> axis-scale w)) + (dimension-array uint32 3 :overlay-at (-> avg-extents w)) + (num-items uint32 :offset 92) + ) + ) diff --git a/test/decompiler/reference/jak3/decompiler-macros.gc b/test/decompiler/reference/jak3/decompiler-macros.gc index 292dee7464..fa79eea3ae 100644 --- a/test/decompiler/reference/jak3/decompiler-macros.gc +++ b/test/decompiler/reference/jak3/decompiler-macros.gc @@ -788,3 +788,23 @@ "Change the current process to the virtual state of the given process." `(go (method-of-object ,proc ,state-name) ,@args) ) + +;; run the given function in a process right now. +;; will return to here when: +;; - you return +;; - you deactivate +;; - you go +;; - you throw to 'initialize +(defmacro run-now-in-process (proc func &rest args) + `((the (function _varargs_ object) run-function-in-process) + ,proc ,func ,@args + ) + ) + +;; sets the main thread of the given process to run the given thing. +;; this resets the main thread stack back to the top +(defmacro run-next-time-in-process (proc func &rest args) + `((the (function _varargs_ object) set-to-run) + (-> ,proc main-thread) ,func ,@args + ) + ) \ No newline at end of file diff --git a/test/decompiler/reference/jak3/engine/anim/joint-mod-h_REF.gc b/test/decompiler/reference/jak3/engine/anim/joint-mod-h_REF.gc new file mode 100644 index 0000000000..41ce9501f1 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/anim/joint-mod-h_REF.gc @@ -0,0 +1,965 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type joint-mod +(deftype joint-mod (basic) + "Utility to modify a joint transform from code, rather than just getting it from animation. +This is used to make jak look toward an enemy, for example." + ((mode joint-mod-mode) + (process process-drawable) + (joint cspace) + (target vector :inline) + (twist vector :inline) + (twist-max vector :inline) + (extra-twist degrees :overlay-at (-> twist data 2)) + (track-mode track-mode :overlay-at (-> twist data 3)) + (look-at-count uint16 :offset 46) + (twist-range-x meters :overlay-at (-> twist-max data 2)) + (twist-range-y meters :overlay-at (-> twist-max data 3)) + (twist-speed-x float) + (twist-speed-y float) + (trans vector :inline) + (smushy-old float :overlay-at (-> trans data 0)) + (smushy-off float :overlay-at (-> trans data 1)) + (smushyv float :overlay-at (-> trans data 2)) + (quat quaternion :inline) + (scale vector :inline) + (notice-time time-frame) + (flex-blend float) + (blend float) + (old-blend float) + (max-dist meters) + (ignore-angle degrees) + (up uint8) + (nose uint8) + (ear uint8) + (base-joint uint8) + (base-nose uint8) + (shutting-down? symbol) + (parented-scale? symbol) + ) + (:methods + (new (symbol type) _type_) + (joint-mod-method-9 () none) + (joint-mod-method-10 () none) + (joint-mod-method-11 () none) + (reset-blend! (_type_) _type_) + (joint-mod-method-13 () none) + (joint-mod-method-14 () none) + (joint-mod-method-15 () none) + ) + ) + +;; definition for method 3 of type joint-mod +(defmethod inspect ((this joint-mod)) + (when (not this) + (set! this this) + (goto cfg-18) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tmode: ~D~%" (-> this mode)) + (format #t "~1Tprocess: ~A~%" (-> this process)) + (format #t "~1Tjoint: #~%" (-> this joint)) + (format #t "~1Ttarget: ~`vector`P~%" (-> this target)) + (format #t "~1Ttwist: ~`vector`P~%" (-> this twist)) + (format #t "~1Ttwist-max: ~`vector`P~%" (-> this twist-max)) + (format #t "~1Textra-twist: (deg ~r)~%" (-> this twist z)) + (format #t "~1Ttrack-mode: #x~X : (track-mode " (-> this track-mode)) + (let ((s5-0 (-> this track-mode))) + (if (= (logand s5-0 (track-mode track-on)) (track-mode track-on)) + (format #t "track-on ") + ) + (if (= (logand s5-0 (track-mode no-rotate)) (track-mode no-rotate)) + (format #t "no-rotate ") + ) + (if (= (logand s5-0 (track-mode lock-on)) (track-mode lock-on)) + (format #t "lock-on ") + ) + (if (= (logand s5-0 (track-mode no-scale)) (track-mode no-scale)) + (format #t "no-scale ") + ) + (if (= (logand s5-0 (track-mode track-x)) (track-mode track-x)) + (format #t "track-x ") + ) + (if (= (logand s5-0 (track-mode track-y)) (track-mode track-y)) + (format #t "track-y ") + ) + (if (= (logand s5-0 (track-mode no-trans)) (track-mode no-trans)) + (format #t "no-trans ") + ) + ) + (format #t ")~%") + (format #t "~1Tlook-at-count: ~D~%" (-> this look-at-count)) + (format #t "~1Ttwist-range-x: (meters ~m)~%" (-> this twist-max z)) + (format #t "~1Ttwist-range-y: (meters ~m)~%" (-> this twist-max w)) + (format #t "~1Ttwist-speed-x: ~f~%" (-> this twist-speed-x)) + (format #t "~1Ttwist-speed-y: ~f~%" (-> this twist-speed-y)) + (format #t "~1Ttrans: ~`vector`P~%" (-> this trans)) + (format #t "~1Tsmushy-old: ~f~%" (-> this trans x)) + (format #t "~1Tsmushy-off: ~f~%" (-> this trans y)) + (format #t "~1Tsmushyv: ~f~%" (-> this trans z)) + (format #t "~1Tquat: ~`quaternion`P~%" (-> this quat)) + (format #t "~1Tscale: ~`vector`P~%" (-> this scale)) + (format #t "~1Tnotice-time: ~D~%" (-> this notice-time)) + (format #t "~1Tflex-blend: ~f~%" (-> this flex-blend)) + (format #t "~1Tblend: ~f~%" (-> this blend)) + (format #t "~1Told-blend: ~f~%" (-> this old-blend)) + (format #t "~1Tmax-dist: (meters ~m)~%" (-> this max-dist)) + (format #t "~1Tignore-angle: (deg ~r)~%" (-> this ignore-angle)) + (format #t "~1Tup: ~D~%" (-> this up)) + (format #t "~1Tnose: ~D~%" (-> this nose)) + (format #t "~1Tear: ~D~%" (-> this ear)) + (format #t "~1Tbase-joint: ~D~%" (-> this base-joint)) + (format #t "~1Tbase-nose: ~D~%" (-> this base-nose)) + (format #t "~1Tshutting-down?: ~A~%" (-> this shutting-down?)) + (format #t "~1Tparented-scale?: ~A~%" (-> this parented-scale?)) + (label cfg-18) + this + ) + +;; definition of type try-to-look-at-info +(deftype try-to-look-at-info (basic) + ((who handle) + (horz float) + (vert float) + ) + ) + +;; definition for method 3 of type try-to-look-at-info +(defmethod inspect ((this try-to-look-at-info)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Twho: ~D~%" (-> this who)) + (format #t "~1Thorz: ~f~%" (-> this horz)) + (format #t "~1Tvert: ~f~%" (-> this vert)) + (label cfg-4) + this + ) + +;; definition (debug) for function joint-mod-debug-draw +;; WARN: Return type mismatch int vs none. +(defun-debug joint-mod-debug-draw ((jmod joint-mod)) + "Debug draw the bone transform for the associated bone of a joint-mod" + (add-debug-matrix #t (bucket-id bucket577) (-> jmod joint bone transform) (meters 2)) + 0 + (none) + ) + +;; definition for method 12 of type joint-mod +(defmethod reset-blend! ((this joint-mod)) + "Set the blend to 0." + (set! (-> this blend) 0.0) + this + ) + +;; definition of type joint-mod-spinner +(deftype joint-mod-spinner (basic) + "Control a joint by just spinning it around an axis." + ((spin-axis vector :inline) + (angle float) + (spin-rate float) + (enable symbol) + ) + (:methods + (new (symbol type process-drawable int vector float) _type_) + ) + ) + +;; definition for method 3 of type joint-mod-spinner +(defmethod inspect ((this joint-mod-spinner)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tspin-axis: #~%" (-> this spin-axis)) + (format #t "~1Tangle: ~f~%" (-> this angle)) + (format #t "~1Tspin-rate: ~f~%" (-> this spin-rate)) + (format #t "~1Tenable: ~A~%" (-> this enable)) + (label cfg-4) + this + ) + +;; definition for function joint-mod-spinner-callback +(defun joint-mod-spinner-callback ((bone-cspace cspace) (joint-transform transformq)) + "cspace callback for joint-mod-spinner. Update the cspace's bone from the parent transformq, plus the rotation from this spinner." + (let ((gp-0 (the-as joint-mod-spinner (-> bone-cspace param1)))) + (when (-> gp-0 enable) + (let ((f30-0 + (the float (sar (shl (the int (+ (-> gp-0 angle) (* (-> gp-0 spin-rate) (seconds-per-frame)))) 48) 48)) + ) + ) + (quaternion-vector-angle! (-> joint-transform quat) (-> gp-0 spin-axis) f30-0) + (set! (-> gp-0 angle) f30-0) + ) + ) + ) + (cspace<-parented-transformq-joint! bone-cspace joint-transform) + (none) + ) + +;; definition for method 0 of type joint-mod-spinner +;; INFO: Used lq/sq +(defmethod new joint-mod-spinner ((allocation symbol) (type-to-make type) (proc process-drawable) (bone-idx int) (axis vector) (rate float)) + "Create and attach a joint-mod-spinner to a joint." + (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> v0-0 spin-axis quad) (-> axis quad)) + (set! (-> v0-0 spin-rate) rate) + (set! (-> v0-0 enable) #t) + (set! (-> v0-0 angle) 0.0) + (let ((a0-3 (-> proc node-list data bone-idx))) + (set! (-> a0-3 param0) joint-mod-spinner-callback) + (set! (-> a0-3 param1) v0-0) + ) + v0-0 + ) + ) + +;; definition of type joint-mod-base +(deftype joint-mod-base (structure) + "Base type for most joint-mods" + ((flags joint-mod-base-flags) + (node-index int16) + (proc (pointer process-drawable)) + (callback (function cspace transformq none)) + ) + (:methods + (init (_type_ process-drawable uint joint-mod-base-flags) none) + (attach-callback (_type_) none) + (remove-callback (_type_) none) + ) + ) + +;; definition for method 3 of type joint-mod-base +(defmethod inspect ((this joint-mod-base)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'joint-mod-base) + (format #t "~1Tflags: ~D~%" (-> this flags)) + (format #t "~1Tnode-index: ~D~%" (-> this node-index)) + (format #t "~1Tproc: #x~X~%" (-> this proc)) + (format #t "~1Tcallback: ~A~%" (-> this callback)) + (label cfg-4) + this + ) + +;; definition for method 10 of type joint-mod-base +;; WARN: Return type mismatch int vs none. +(defmethod attach-callback ((this joint-mod-base)) + "Take control of the specified joint by modifying the cspace callback." + (let ((a1-3 (-> this proc 0 node-list data (-> this node-index)))) + (set! (-> a1-3 param0) (-> this callback)) + (set! (-> a1-3 param1) (the-as basic this)) + ) + (logior! (-> this flags) (joint-mod-base-flags attached)) + 0 + (none) + ) + +;; definition for method 11 of type joint-mod-base +;; WARN: Return type mismatch int vs none. +(defmethod remove-callback ((this joint-mod-base)) + "Remove this callback and set param0 to #f to use the default (animated joint)" + (set! (-> this proc 0 node-list data (-> this node-index) param0) #f) + (logclear! (-> this flags) (joint-mod-base-flags attached)) + 0 + (none) + ) + +;; definition for method 9 of type joint-mod-base +;; WARN: Return type mismatch int vs none. +(defmethod init ((this joint-mod-base) (proc process-drawable) (bone-idx uint) (flags joint-mod-base-flags)) + "Set up this joint-mod to modify the given joint of the given process. Will attach automatically if attached flag is set." + (set! (-> this flags) flags) + (set! (-> this node-index) (the-as int bone-idx)) + (set! (-> this proc) (the-as (pointer process-drawable) (process->ppointer proc))) + (if (logtest? flags (joint-mod-base-flags attached)) + (attach-callback this) + ) + 0 + (none) + ) + +;; definition of type joint-mod-rotate-local +(deftype joint-mod-rotate-local (joint-mod-base) + ((rotation quaternion :inline) + ) + (:methods + (new (symbol type) _type_) + ) + ) + +;; definition for method 3 of type joint-mod-rotate-local +(defmethod inspect ((this joint-mod-rotate-local)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'joint-mod-rotate-local) + (format #t "~1Tflags: ~D~%" (-> this flags)) + (format #t "~1Tnode-index: ~D~%" (-> this node-index)) + (format #t "~1Tproc: #x~X~%" (-> this proc)) + (format #t "~1Tcallback: ~A~%" (-> this callback)) + (format #t "~1Trotation: #~%" (-> this rotation)) + (label cfg-4) + this + ) + +;; definition for function joint-mod-rotate-local-callback +(defun joint-mod-rotate-local-callback ((bone-cspace cspace) (joint-transform transformq)) + "Apply an additional rotation to the transform (left side quaternion multiplication" + (let ((v1-0 (the-as joint-mod-rotate-local (-> bone-cspace param1)))) + (quaternion*! (-> joint-transform quat) (-> joint-transform quat) (-> v1-0 rotation)) + ) + (cspace<-parented-transformq-joint! bone-cspace joint-transform) + (none) + ) + +;; definition for method 9 of type joint-mod-rotate-local +(defmethod init ((this joint-mod-rotate-local) (arg0 process-drawable) (arg1 uint) (arg2 joint-mod-base-flags)) + "Set up this joint-mod to modify the given joint of the given process. Will attach automatically if attached flag is set." + (set! (-> this callback) joint-mod-rotate-local-callback) + (quaternion-identity! (-> this rotation)) + ((method-of-type joint-mod-base init) this arg0 arg1 arg2) + (none) + ) + +;; definition of type joint-mod-rotate-world +(deftype joint-mod-rotate-world (joint-mod-base) + "Add an additional rotation to a joint (right multiply)" + ((rotation quaternion :inline) + ) + ) + +;; definition for method 3 of type joint-mod-rotate-world +(defmethod inspect ((this joint-mod-rotate-world)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'joint-mod-rotate-world) + (format #t "~1Tflags: ~D~%" (-> this flags)) + (format #t "~1Tnode-index: ~D~%" (-> this node-index)) + (format #t "~1Tproc: #x~X~%" (-> this proc)) + (format #t "~1Tcallback: ~A~%" (-> this callback)) + (format #t "~1Trotation: #~%" (-> this rotation)) + (label cfg-4) + this + ) + +;; definition for function vector<-cspace2! +(defun vector<-cspace2! ((output-vec vector) (input-cspace cspace)) + "Same as vector<-cspace! Convert a bone matrix from a cspace to the origin of the bone frame." + (rlet ((Q :class vf) + (vf0 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (.lvf vf2 (&-> (-> input-cspace bone) transform trans quad)) + (.div.vf Q vf0 vf2 :fsf #b11 :ftf #b11) + (.wait.vf) + (.mul.vf vf2 vf2 Q :mask #b111) + (.nop.vf) + (.nop.vf) + (.mov.vf vf2 vf0 :mask #b1000) + (.svf (&-> output-vec quad) vf2) + output-vec + ) + ) + +;; definition for function joint-mod-rotate-world-callback +;; INFO: Used lq/sq +;; WARN: Return type mismatch matrix vs none. +(defun joint-mod-rotate-world-callback ((bone-cspace cspace) (joint-transform transformq)) + "Callback for joint-mod-rotate-world. See comment on that type." + (let ((s3-0 (the-as joint-mod-rotate-world (-> bone-cspace param1)))) + (cspace<-parented-transformq-joint! bone-cspace joint-transform) + (let ((s4-0 (vector<-cspace2! (new 'stack-no-clear 'vector) bone-cspace))) + (quaternion*! (-> joint-transform quat) (-> joint-transform quat) (-> s3-0 rotation)) + (set! (-> joint-transform trans quad) (-> s4-0 quad)) + ) + ) + (cspace<-transformq! bone-cspace joint-transform) + (none) + ) + +;; definition for method 9 of type joint-mod-rotate-world +(defmethod init ((this joint-mod-rotate-world) (arg0 process-drawable) (arg1 uint) (arg2 joint-mod-base-flags)) + "Set up this joint-mod to modify the given joint of the given process. Will attach automatically if attached flag is set." + (set! (-> this callback) joint-mod-rotate-world-callback) + (quaternion-identity! (-> this rotation)) + ((method-of-type joint-mod-base init) this arg0 arg1 arg2) + (none) + ) + +;; definition of type joint-mod-set-local +(deftype joint-mod-set-local (joint-mod-base) + "Override the trans, quat, and scale of the joint transform. The component to override is selected by the flag." + ((transform transformq :inline) + ) + (:methods + (new (symbol type) _type_) + ) + ) + +;; definition for method 3 of type joint-mod-set-local +(defmethod inspect ((this joint-mod-set-local)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'joint-mod-set-local) + (format #t "~1Tflags: ~D~%" (-> this flags)) + (format #t "~1Tnode-index: ~D~%" (-> this node-index)) + (format #t "~1Tproc: #x~X~%" (-> this proc)) + (format #t "~1Tcallback: ~A~%" (-> this callback)) + (format #t "~1Ttransform: #~%" (-> this transform)) + (label cfg-4) + this + ) + +;; definition for function joint-mod-set-local-callback +;; INFO: Used lq/sq +(defun joint-mod-set-local-callback ((bone-cspace cspace) (joint-transform transformq)) + "Callback for joint-mod-rotate-local. See comment on that type." + (let ((v1-0 (the-as joint-mod-set-local (-> bone-cspace param1)))) + (if (not (logtest? (-> v1-0 flags) (joint-mod-base-flags trans))) + (set! (-> v1-0 transform trans quad) (-> joint-transform trans quad)) + ) + (if (not (logtest? (-> v1-0 flags) (joint-mod-base-flags quat))) + (set! (-> v1-0 transform quat quad) (-> joint-transform quat quad)) + ) + (if (not (logtest? (-> v1-0 flags) (joint-mod-base-flags scale))) + (set! (-> v1-0 transform scale quad) (-> joint-transform scale quad)) + ) + (cspace<-parented-transformq-joint! bone-cspace (-> v1-0 transform)) + ) + (none) + ) + +;; definition for method 9 of type joint-mod-set-local +(defmethod init ((this joint-mod-set-local) (arg0 process-drawable) (arg1 uint) (arg2 joint-mod-base-flags)) + "Set up this joint-mod to modify the given joint of the given process. Will attach automatically if attached flag is set." + (rlet ((vf0 :class vf)) + (init-vf0-vector) + (set! (-> this callback) joint-mod-set-local-callback) + (.svf (&-> (-> this transform) trans quad) vf0) + (quaternion-identity! (-> this transform quat)) + (vector-identity! (-> this transform scale)) + ((method-of-type joint-mod-base init) this arg0 arg1 arg2) + (none) + ) + ) + +;; definition of type joint-mod-add-local +(deftype joint-mod-add-local (joint-mod-base) + "Add to the trans, rotate the quat, and multiply the scale of the joint transform. The components can be selected by the flag. +Unlike jak 2, this actually multiplies the scale, instead of adding." + ((transform transformq :inline) + ) + (:methods + (new (symbol type) _type_) + ) + ) + +;; definition for method 3 of type joint-mod-add-local +(defmethod inspect ((this joint-mod-add-local)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'joint-mod-add-local) + (format #t "~1Tflags: ~D~%" (-> this flags)) + (format #t "~1Tnode-index: ~D~%" (-> this node-index)) + (format #t "~1Tproc: #x~X~%" (-> this proc)) + (format #t "~1Tcallback: ~A~%" (-> this callback)) + (format #t "~1Ttransform: #~%" (-> this transform)) + (label cfg-4) + this + ) + +;; definition for function joint-mod-add-local-callback +(defun joint-mod-add-local-callback ((bone-cspace cspace) (joint-transform transformq)) + "Callback for joint-mod-add-local. See comment on that type." + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (let ((s4-0 (the-as joint-mod-add-local (-> bone-cspace param1)))) + (if (logtest? (-> s4-0 flags) (joint-mod-base-flags trans)) + (vector+! (-> joint-transform trans) (-> joint-transform trans) (the-as vector (-> s4-0 transform))) + ) + (when (logtest? (-> s4-0 flags) (joint-mod-base-flags quat)) + (quaternion*! (-> joint-transform quat) (-> joint-transform quat) (-> s4-0 transform quat)) + (quaternion-normalize! (-> joint-transform quat)) + ) + (when (logtest? (-> s4-0 flags) (joint-mod-base-flags scale)) + (let ((a0-4 (-> joint-transform scale))) + (let ((v1-11 (-> joint-transform scale)) + (a1-4 (-> s4-0 transform scale)) + ) + (.lvf vf4 (&-> v1-11 quad)) + (.lvf vf5 (&-> a1-4 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.vf vf6 vf4 vf5 :mask #b111) + (.svf (&-> a0-4 quad) vf6) + ) + ) + ) + (cspace<-parented-transformq-joint! bone-cspace joint-transform) + (none) + ) + ) + +;; definition for method 9 of type joint-mod-add-local +(defmethod init ((this joint-mod-add-local) (arg0 process-drawable) (arg1 uint) (arg2 joint-mod-base-flags)) + "Set up this joint-mod to modify the given joint of the given process. Will attach automatically if attached flag is set." + (rlet ((vf0 :class vf)) + (init-vf0-vector) + (set! (-> this callback) joint-mod-add-local-callback) + (.svf (&-> (-> this transform) trans quad) vf0) + (quaternion-identity! (-> this transform quat)) + (set-vector! (-> this transform scale) 1.0 1.0 1.0 1.0) + ((method-of-type joint-mod-base init) this arg0 arg1 arg2) + (none) + ) + ) + +;; definition of type joint-mod-set-world +(deftype joint-mod-set-world (joint-mod-base) + "Directly overwrite the _bone_ transform (ignoring the parent entirely). +This does not pay attention to the flags." + ((transform transformq :inline) + ) + (:methods + (new (symbol type) _type_) + ) + ) + +;; definition for method 3 of type joint-mod-set-world +(defmethod inspect ((this joint-mod-set-world)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'joint-mod-set-world) + (format #t "~1Tflags: ~D~%" (-> this flags)) + (format #t "~1Tnode-index: ~D~%" (-> this node-index)) + (format #t "~1Tproc: #x~X~%" (-> this proc)) + (format #t "~1Tcallback: ~A~%" (-> this callback)) + (format #t "~1Ttransform: #~%" (-> this transform)) + (label cfg-4) + this + ) + +;; definition for function joint-mod-set-world-callback +;; WARN: Return type mismatch matrix vs none. +(defun joint-mod-set-world-callback ((bone-cspace cspace) (joint-trasnform transformq)) + "Callback for joint-mod-set-world. See comment on that type." + (let ((v1-0 (the-as joint-mod-set-local (-> bone-cspace param1)))) + (cspace<-transformq! bone-cspace (-> v1-0 transform)) + ) + (none) + ) + +;; definition for method 9 of type joint-mod-set-world +(defmethod init ((this joint-mod-set-world) (arg0 process-drawable) (arg1 uint) (arg2 joint-mod-base-flags)) + "Set up this joint-mod to modify the given joint of the given process. Will attach automatically if attached flag is set." + (rlet ((vf0 :class vf)) + (init-vf0-vector) + (set! (-> this callback) joint-mod-set-world-callback) + (.svf (&-> (-> this transform) trans quad) vf0) + (quaternion-identity! (-> this transform quat)) + (vector-identity! (-> this transform scale)) + ((method-of-type joint-mod-base init) this arg0 arg1 arg2) + (none) + ) + ) + +;; definition of type joint-mod-set-world-no-trans +(deftype joint-mod-set-world-no-trans (joint-mod-base) + "Set the rotation and scale of the _bone_ directly to the values from this transform. +The translation is kept from the result of the normal parented value." + ((transform transformq :inline) + ) + ) + +;; definition for method 3 of type joint-mod-set-world-no-trans +(defmethod inspect ((this joint-mod-set-world-no-trans)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'joint-mod-set-world-no-trans) + (format #t "~1Tflags: ~D~%" (-> this flags)) + (format #t "~1Tnode-index: ~D~%" (-> this node-index)) + (format #t "~1Tproc: #x~X~%" (-> this proc)) + (format #t "~1Tcallback: ~A~%" (-> this callback)) + (format #t "~1Ttransform: #~%" (-> this transform)) + (label cfg-4) + this + ) + +;; definition for function joint-mod-set-world-no-trans-callback +;; INFO: Used lq/sq +;; WARN: Return type mismatch vector vs none. +(defun joint-mod-set-world-no-trans-callback ((bone-cspace cspace) (joint-transform transformq)) + "Callback for joint-mod-set-world-no-trans. See comment on that type." + (let ((s4-0 (the-as joint-mod-set-world-no-trans (-> bone-cspace param1))) + (gp-0 (new 'stack-no-clear 'matrix)) + ) + (cspace<-parented-transformq-joint! bone-cspace joint-transform) + (matrix<-transformq! gp-0 (-> s4-0 transform)) + (set! (-> bone-cspace bone transform rvec quad) (-> gp-0 rvec quad)) + (set! (-> bone-cspace bone transform uvec quad) (-> gp-0 uvec quad)) + (set! (-> bone-cspace bone transform fvec quad) (-> gp-0 fvec quad)) + ) + (none) + ) + +;; definition for method 9 of type joint-mod-set-world-no-trans +(defmethod init ((this joint-mod-set-world-no-trans) (arg0 process-drawable) (arg1 uint) (arg2 joint-mod-base-flags)) + "Set up this joint-mod to modify the given joint of the given process. Will attach automatically if attached flag is set." + (rlet ((vf0 :class vf)) + (init-vf0-vector) + (set! (-> this callback) joint-mod-set-world-no-trans-callback) + (.svf (&-> (-> this transform) trans quad) vf0) + (quaternion-identity! (-> this transform quat)) + (vector-identity! (-> this transform scale)) + ((method-of-type joint-mod-base init) this arg0 arg1 arg2) + (none) + ) + ) + +;; definition of type joint-mod-blend-local +(deftype joint-mod-blend-local (joint-mod-base) + "Blend the _joint_ transform between this transform and the animated one. +Then, apply the normal parented transform." + ((transform transformq :inline) + (blend-transform transformq :inline) + (blend float) + ) + (:methods + (new (symbol type) _type_) + ) + ) + +;; definition for method 3 of type joint-mod-blend-local +(defmethod inspect ((this joint-mod-blend-local)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'joint-mod-blend-local) + (format #t "~1Tflags: ~D~%" (-> this flags)) + (format #t "~1Tnode-index: ~D~%" (-> this node-index)) + (format #t "~1Tproc: #x~X~%" (-> this proc)) + (format #t "~1Tcallback: ~A~%" (-> this callback)) + (format #t "~1Ttransform: #~%" (-> this transform)) + (format #t "~1Tblend-transform: #~%" (-> this blend-transform)) + (format #t "~1Tblend: ~f~%" (-> this blend)) + (label cfg-4) + this + ) + +;; definition for function joint-mod-blend-local-callback +(defun joint-mod-blend-local-callback ((bone-cspace cspace) (joint-transform transformq)) + "Callback for joint-mod-blend-local. See comment on that type." + (let ((gp-0 (the-as joint-mod-blend-local (-> bone-cspace param1)))) + (vector-lerp! + (the-as vector (-> gp-0 blend-transform)) + (-> joint-transform trans) + (the-as vector (-> gp-0 transform)) + (-> gp-0 blend) + ) + (vector-lerp! + (-> gp-0 blend-transform scale) + (-> joint-transform scale) + (-> gp-0 transform scale) + (-> gp-0 blend) + ) + (quaternion-slerp! + (-> gp-0 blend-transform quat) + (-> joint-transform quat) + (-> gp-0 transform quat) + (-> gp-0 blend) + ) + (cspace<-parented-transformq-joint! bone-cspace (-> gp-0 blend-transform)) + ) + (none) + ) + +;; definition for method 9 of type joint-mod-blend-local +(defmethod init ((this joint-mod-blend-local) (arg0 process-drawable) (arg1 uint) (arg2 joint-mod-base-flags)) + "Set up this joint-mod to modify the given joint of the given process. Will attach automatically if attached flag is set." + (rlet ((vf0 :class vf)) + (init-vf0-vector) + (set! (-> this callback) joint-mod-blend-local-callback) + (.svf (&-> (-> this transform) trans quad) vf0) + (quaternion-identity! (-> this transform quat)) + (vector-identity! (-> this transform scale)) + (set! (-> this blend) 0.0) + ((method-of-type joint-mod-base init) this arg0 arg1 arg2) + (none) + ) + ) + +;; definition of type joint-mod-blend-world +(deftype joint-mod-blend-world (joint-mod-base) + "Blend the _bone_ transform between this one and the animated one." + ((transform transformq :inline) + (blend-transform transformq :inline) + (blend float) + ) + (:methods + (new (symbol type) _type_) + ) + ) + +;; definition for method 3 of type joint-mod-blend-world +(defmethod inspect ((this joint-mod-blend-world)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'joint-mod-blend-world) + (format #t "~1Tflags: ~D~%" (-> this flags)) + (format #t "~1Tnode-index: ~D~%" (-> this node-index)) + (format #t "~1Tproc: #x~X~%" (-> this proc)) + (format #t "~1Tcallback: ~A~%" (-> this callback)) + (format #t "~1Ttransform: #~%" (-> this transform)) + (format #t "~1Tblend-transform: #~%" (-> this blend-transform)) + (format #t "~1Tblend: ~f~%" (-> this blend)) + (label cfg-4) + this + ) + +;; definition for function joint-mod-blend-world-callback +;; WARN: Return type mismatch matrix vs none. +(defun joint-mod-blend-world-callback ((bone-cspace cspace) (joint-transform transformq)) + "Callback for joint-mod-blend-world. See comment on that type." + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (let ((gp-0 (the-as joint-mod-blend-world (-> bone-cspace param1)))) + (let ((f30-0 (if (logtest? (-> gp-0 flags) (joint-mod-base-flags trans)) + (-> gp-0 blend) + 0.0 + ) + ) + (f28-0 (if (logtest? (-> gp-0 flags) (joint-mod-base-flags quat)) + (-> gp-0 blend) + 0.0 + ) + ) + (f26-0 (if (logtest? (-> gp-0 flags) (joint-mod-base-flags scale)) + (-> gp-0 blend) + 0.0 + ) + ) + (s3-0 (new 'stack-no-clear 'joint-mod-blend-world-work)) + ) + (if (= (-> bone-cspace parent bone scale w) 0.0) + (matrix<-transformq! (-> s3-0 mat1) joint-transform) + (matrix<-parented-transformq! (-> s3-0 mat1) joint-transform (-> bone-cspace parent bone scale)) + ) + (matrix*! (-> s3-0 mat2) (-> s3-0 mat1) (-> bone-cspace parent bone transform)) + (set-vector! + (-> s3-0 vec) + (vector-length (the-as vector (-> s3-0 mat2))) + (vector-length (-> s3-0 mat2 uvec)) + (vector-length (-> s3-0 mat2 fvec)) + 1.0 + ) + (let ((a0-11 (-> gp-0 blend-transform scale))) + (let ((v1-18 (-> s3-0 vec)) + (a1-4 (-> joint-transform scale)) + ) + (.lvf vf4 (&-> v1-18 quad)) + (.lvf vf5 (&-> a1-4 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.vf vf6 vf4 vf5 :mask #b111) + (.svf (&-> a0-11 quad) vf6) + ) + (vector-lerp! + (the-as vector (-> gp-0 blend-transform)) + (-> s3-0 mat2 trans) + (the-as vector (-> gp-0 transform)) + f30-0 + ) + (vector-lerp! (-> gp-0 blend-transform scale) (-> gp-0 blend-transform scale) (-> gp-0 transform scale) f26-0) + (quaternion-slerp! + (-> gp-0 blend-transform quat) + (matrix->quat (-> s3-0 mat2) (-> s3-0 quat)) + (-> gp-0 transform quat) + f28-0 + ) + ) + (cspace<-transformq! bone-cspace (-> gp-0 blend-transform)) + ) + (none) + ) + ) + +;; definition for method 9 of type joint-mod-blend-world +(defmethod init ((this joint-mod-blend-world) (arg0 process-drawable) (arg1 uint) (arg2 joint-mod-base-flags)) + "Set up this joint-mod to modify the given joint of the given process. Will attach automatically if attached flag is set." + (rlet ((vf0 :class vf)) + (init-vf0-vector) + (set! (-> this callback) joint-mod-blend-world-callback) + (.svf (&-> (-> this transform) trans quad) vf0) + (quaternion-identity! (-> this transform quat)) + (vector-identity! (-> this transform scale)) + (set! (-> this blend) 0.0) + ((method-of-type joint-mod-base init) this arg0 arg1 arg2) + (none) + ) + ) + +;; definition of type joint-mod-ik +(deftype joint-mod-ik (basic) + ((flags joint-mod-ik-flags) + (process process-drawable) + (hand-dist float) + (handle-pos vector :inline) + (elbow-pole-vector-axis uint32) + (elbow-rotation-axis uint32) + (user-position vector :inline) + (user-normal vector :inline) + (user-blend float) + (user-float float) + (callback (function joint-mod-ik matrix matrix vector object)) + (shoulder-matrix-no-ik matrix :inline) + (elbow-matrix-no-ik matrix :inline) + (blend float) + (blend-interp float) + ) + (:methods + (new (symbol type) _type_) + (joint-mod-ik-method-9 () none) + (joint-mod-ik-method-10 () none) + ) + ) + +;; definition for method 3 of type joint-mod-ik +(defmethod inspect ((this joint-mod-ik)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tflags: ~D~%" (-> this flags)) + (format #t "~1Tprocess: ~A~%" (-> this process)) + (format #t "~1Thand-dist: ~f~%" (-> this hand-dist)) + (format #t "~1Thandle-pos: #~%" (-> this handle-pos)) + (format #t "~1Telbow-pole-vector-axis: ~D~%" (-> this elbow-pole-vector-axis)) + (format #t "~1Telbow-rotation-axis: ~D~%" (-> this elbow-rotation-axis)) + (format #t "~1Tuser-position: #~%" (-> this user-position)) + (format #t "~1Tuser-normal: #~%" (-> this user-normal)) + (format #t "~1Tuser-blend: ~f~%" (-> this user-blend)) + (format #t "~1Tuser-float: ~f~%" (-> this user-float)) + (format #t "~1Tcallback: ~A~%" (-> this callback)) + (format #t "~1Tshoulder-matrix-no-ik: #~%" (-> this shoulder-matrix-no-ik)) + (format #t "~1Telbow-matrix-no-ik: #~%" (-> this elbow-matrix-no-ik)) + (format #t "~1Tblend: ~f~%" (-> this blend)) + (format #t "~1Tblend-interp: ~f~%" (-> this blend-interp)) + (label cfg-4) + this + ) + +;; definition of type ik-limb-setup +(deftype ik-limb-setup (structure) + ((elbow-index int32) + (hand-dist float) + ) + ) + +;; definition for method 3 of type ik-limb-setup +(defmethod inspect ((this ik-limb-setup)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'ik-limb-setup) + (format #t "~1Telbow-index: ~D~%" (-> this elbow-index)) + (format #t "~1Thand-dist: ~f~%" (-> this hand-dist)) + (label cfg-4) + this + ) + +;; definition of type joint-mod-polar-look-at +(deftype joint-mod-polar-look-at (basic) + ((flags uint32) + (ear int8) + (up int8) + (nose int8) + (polar-internal-tilt-max float) + (polar-internal-radius float) + (polar-external-tilt-max float) + (polar-external-radius float) + (upward-tilt float) + (downward-tilt float) + (forward-twist float) + (backward-twist float) + (target vector :inline) + (blend-duration uint64) + (blend-start-time uint64) + (blend-start-value float) + (blend-max float) + ) + (:methods + (joint-mod-polar-look-at-method-9 () none) + (joint-mod-polar-look-at-method-10 () none) + (joint-mod-polar-look-at-method-11 () none) + (joint-mod-polar-look-at-method-12 () none) + (joint-mod-polar-look-at-method-13 () none) + (joint-mod-polar-look-at-method-14 () none) + ) + ) + +;; definition for method 3 of type joint-mod-polar-look-at +(defmethod inspect ((this joint-mod-polar-look-at)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tflags: ~D~%" (-> this flags)) + (format #t "~1Tear: ~D~%" (-> this ear)) + (format #t "~1Tup: ~D~%" (-> this up)) + (format #t "~1Tnose: ~D~%" (-> this nose)) + (format #t "~1Tpolar-internal-tilt-max: ~f~%" (-> this polar-internal-tilt-max)) + (format #t "~1Tpolar-internal-radius: ~f~%" (-> this polar-internal-radius)) + (format #t "~1Tpolar-external-tilt-max: ~f~%" (-> this polar-external-tilt-max)) + (format #t "~1Tpolar-external-radius: ~f~%" (-> this polar-external-radius)) + (format #t "~1Tupward-tilt: ~f~%" (-> this upward-tilt)) + (format #t "~1Tdownward-tilt: ~f~%" (-> this downward-tilt)) + (format #t "~1Tforward-twist: ~f~%" (-> this forward-twist)) + (format #t "~1Tbackward-twist: ~f~%" (-> this backward-twist)) + (format #t "~1Ttarget: #~%" (-> this target)) + (format #t "~1Tblend-duration: ~D~%" (-> this blend-duration)) + (format #t "~1Tblend-start-time: ~D~%" (-> this blend-start-time)) + (format #t "~1Tblend-start-value: ~f~%" (-> this blend-start-value)) + (format #t "~1Tblend-max: ~f~%" (-> this blend-max)) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +0 + + + + diff --git a/test/decompiler/reference/jak3/engine/collide/collide-frag-h_REF.gc b/test/decompiler/reference/jak3/engine/collide/collide-frag-h_REF.gc new file mode 100644 index 0000000000..e26e6e762e --- /dev/null +++ b/test/decompiler/reference/jak3/engine/collide/collide-frag-h_REF.gc @@ -0,0 +1,119 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type collide-frag-vertex +(deftype collide-frag-vertex (vector) + () + ) + +;; definition for method 3 of type collide-frag-vertex +;; INFO: Used lq/sq +(defmethod inspect ((this collide-frag-vertex)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'collide-frag-vertex) + (format #t "~1Tdata[4] @ #x~X~%" (&-> this x)) + (format #t "~1Tx: ~f~%" (-> this x)) + (format #t "~1Ty: ~f~%" (-> this y)) + (format #t "~1Tz: ~f~%" (-> this z)) + (format #t "~1Tw: ~f~%" (-> this w)) + (format #t "~1Tquad: ~D~%" (-> this quad)) + (label cfg-4) + this + ) + +;; definition of type collide-frag-mesh +(deftype collide-frag-mesh (basic) + "Unused Jak 1 background collision mesh fragment." + ((packed-data uint32) + (pat-array uint32) + (strip-data-len uint16) + (poly-count uint16) + (base-trans vector4w :inline) + (vertex-count uint8 :overlay-at (-> base-trans data 3)) + (vertex-data-qwc uint8 :offset 29) + (total-qwc uint8 :offset 30) + (unused uint8 :offset 31) + ) + ) + +;; definition for method 3 of type collide-frag-mesh +(defmethod inspect ((this collide-frag-mesh)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tpacked-data: #x~X~%" (-> this packed-data)) + (format #t "~1Tpat-array: #x~X~%" (-> this pat-array)) + (format #t "~1Tstrip-data-len: ~D~%" (-> this strip-data-len)) + (format #t "~1Tpoly-count: ~D~%" (-> this poly-count)) + (format #t "~1Tbase-trans: #~%" (-> this base-trans)) + (format #t "~1Tvertex-count: ~D~%" (-> this vertex-count)) + (format #t "~1Tvertex-data-qwc: ~D~%" (-> this vertex-data-qwc)) + (format #t "~1Ttotal-qwc: ~D~%" (-> this total-qwc)) + (format #t "~1Tunused: ~D~%" (-> this unused)) + (label cfg-4) + this + ) + +;; definition of type collide-fragment +(deftype collide-fragment (drawable) + "Unused Jak 1 background collision drawable tree node." + ((mesh collide-frag-mesh :offset 8) + (collide-new basic :offset 12) + ) + ) + +;; definition for method 3 of type collide-fragment +(defmethod inspect ((this collide-fragment)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tid: ~D~%" (-> this id)) + (format #t "~1Tbsphere: ~`vector`P~%" (-> this bsphere)) + (format #t "~1Tmesh: ~A~%" (-> this mesh)) + (format #t "~1Tcollide-new: ~A~%" (-> this collide-new)) + (label cfg-4) + this + ) + +;; definition of type drawable-inline-array-collide-fragment +(deftype drawable-inline-array-collide-fragment (drawable-inline-array) + "Unused Jak 1 background collision drawable tree inline-array class." + ((data collide-fragment 1 :inline) + (pad uint32) + ) + ) + +;; definition for method 3 of type drawable-inline-array-collide-fragment +(defmethod inspect ((this drawable-inline-array-collide-fragment)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tid: ~D~%" (-> this id)) + (format #t "~1Tbsphere: ~`vector`P~%" (-> this bsphere)) + (format #t "~1Tlength: ~D~%" (-> this length)) + (format #t "~1Tdata[1] @ #x~X~%" (-> this data)) + (label cfg-4) + this + ) + +;; definition of type drawable-tree-collide-fragment +(deftype drawable-tree-collide-fragment (drawable-tree) + "Unused jak 1 background collision data." + () + ) + +;; failed to figure out what this is: +0 + + + + diff --git a/test/decompiler/reference/jak3/engine/collide/collide-hash-h_REF.gc b/test/decompiler/reference/jak3/engine/collide/collide-hash-h_REF.gc new file mode 100644 index 0000000000..b8dbb3224d --- /dev/null +++ b/test/decompiler/reference/jak3/engine/collide/collide-hash-h_REF.gc @@ -0,0 +1,267 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *collide-list-boxes*, type symbol +(define *collide-list-boxes* #f) + +;; definition for symbol *collide-hash-fragments*, type int +(define *collide-hash-fragments* 0) + +;; definition for symbol *collide-hash-fragments-tfrag*, type int +(define *collide-hash-fragments-tfrag* 0) + +;; definition for symbol *collide-hash-fragments-instance*, type int +(define *collide-hash-fragments-instance* 0) + +;; definition for symbol *already-printed-exeeded-max-cache-tris*, type symbol +(define *already-printed-exeeded-max-cache-tris* #f) + +;; definition of type collide-hash-scratch +(deftype collide-hash-scratch (structure) + "Scratchpad memory layout for collide-hash. Bitmask of things that have already been checked" + ((collidable-bits uint128 128) + (poly-bits uint64 2 :overlay-at (-> collidable-bits 0)) + (id-bits uint32 512 :overlay-at (-> collidable-bits 0)) + (tris uint32) + ) + ) + +;; definition for method 3 of type collide-hash-scratch +(defmethod inspect ((this collide-hash-scratch)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'collide-hash-scratch) + (format #t "~1Tcollidable-bits[128] @ #x~X~%" (-> this collidable-bits)) + (format #t "~1Tpoly-bits[2] @ #x~X~%" (-> this collidable-bits)) + (format #t "~1Tid-bits[512] @ #x~X~%" (-> this collidable-bits)) + (format #t "~1Ttris: ~D~%" (-> this tris)) + (label cfg-4) + this + ) + +;; definition of type collide-hash-bucket +(deftype collide-hash-bucket (structure) + "A bucket is a reference to a list of items that intersect a grid cell. +For the broadphase, the items are collide-hash-item (wrapper of collide-hash-fragment). +For the narrowphase, the items are entries in the index list, which contains poly indices." + ((index int16) + (count int16) + ) + ) + +;; definition for method 3 of type collide-hash-bucket +(defmethod inspect ((this collide-hash-bucket)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'collide-hash-bucket) + (format #t "~1Tindex: ~D~%" (-> this index)) + (format #t "~1Tcount: ~D~%" (-> this count)) + (label cfg-4) + this + ) + +;; definition of type collide-hash-item +(deftype collide-hash-item (structure) + "Items that are 'hashed' in the broadphase. Contains unique ID for checking against already-visited-bitmask +and a pointer to the actual collide-hash-fragment, or possibly a TIE." + ((id uint32) + (collidable basic) + ) + ) + +;; definition for method 3 of type collide-hash-item +(defmethod inspect ((this collide-hash-item)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'collide-hash-item) + (format #t "~1Tid: ~D~%" (-> this id)) + (format #t "~1Tcollidable: ~A~%" (-> this collidable)) + (label cfg-4) + this + ) + +;; definition of type collide-hash-poly +(deftype collide-hash-poly (structure) + "A polygon in the narrow-phase data. This is just indices into the vertex and PAT tables." + ((data uint8 4) + (vert-index0 uint8 :overlay-at (-> data 0)) + (vert-index1 uint8 :overlay-at (-> data 1)) + (vert-index2 uint8 :overlay-at (-> data 2)) + (pat-index uint8 :overlay-at (-> data 3)) + (word uint32 :overlay-at (-> data 0)) + ) + ) + +;; definition for method 3 of type collide-hash-poly +(defmethod inspect ((this collide-hash-poly)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'collide-hash-poly) + (format #t "~1Tdata[4] @ #x~X~%" (-> this data)) + (format #t "~1Tvert-index0: ~D~%" (-> this vert-index0)) + (format #t "~1Tvert-index1: ~D~%" (-> this vert-index1)) + (format #t "~1Tvert-index2: ~D~%" (-> this vert-index2)) + (format #t "~1Tpat-index: ~D~%" (-> this pat-index)) + (format #t "~1Tword: ~D~%" (-> this word)) + (label cfg-4) + this + ) + +;; definition of type collide-hash-fragment-stats +(deftype collide-hash-fragment-stats (structure) + ((num-verts uint16) + (num-polys uint8) + (poly-count uint8) + ) + :pack-me + ) + +;; definition for method 3 of type collide-hash-fragment-stats +(defmethod inspect ((this collide-hash-fragment-stats)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'collide-hash-fragment-stats) + (format #t "~1Tnum-verts: ~D~%" (-> this num-verts)) + (format #t "~1Tnum-polys: ~D~%" (-> this num-polys)) + (format #t "~1Tpoly-count: ~D~%" (-> this poly-count)) + (label cfg-4) + this + ) + +;; definition of type collide-hash-fragment +(deftype collide-hash-fragment (drawable) + "A mesh fragment for the Jak2/Jak3 collision system. This is a 'hash' of triangles into a grid +where the 'hash' function is just identity." + ((num-buckets uint16 :overlay-at id) + (num-indices uint16 :offset 6) + (pat-array uint32 :offset 8) + (bucket-array uint32 :offset 12) + (grid-step vector :inline) + (bbox bounding-box :inline) + (bbox4w bounding-box4w :inline) + (axis-scale vector :inline :overlay-at (-> bbox max)) + (avg-extents vector :inline :overlay-at (-> bbox4w min data 0)) + (dimension-array uint32 4 :overlay-at (-> grid-step data 3)) + (stats collide-hash-fragment-stats :inline :overlay-at (-> bbox min data 3)) + (num-verts uint16 :overlay-at (-> bbox min data 3)) + (num-polys uint8 :offset 62) + (poly-count uint8 :offset 63) + (poly-array uint32 :overlay-at (-> bbox max data 3)) + (vert-array uint32 :overlay-at (-> bbox4w min data 3)) + (index-array uint32 :overlay-at (-> bbox4w max data 3)) + ) + ) + +;; definition for method 3 of type collide-hash-fragment +(defmethod inspect ((this collide-hash-fragment)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tid: ~D~%" (-> this id)) + (format #t "~1Tbsphere: ~`vector`P~%" (-> this bsphere)) + (format #t "~1Tnum-buckets: ~D~%" (-> this num-buckets)) + (format #t "~1Tnum-indices: ~D~%" (-> this num-indices)) + (format #t "~1Tpat-array: #x~X~%" (-> this pat-array)) + (format #t "~1Tbucket-array: #x~X~%" (-> this bucket-array)) + (format #t "~1Tgrid-step: #~%" (-> this grid-step)) + (format #t "~1Tbbox: #~%" (-> this bbox)) + (format #t "~1Tbbox4w: #~%" (-> this bbox4w)) + (format #t "~1Taxis-scale: #~%" (-> this bbox max)) + (format #t "~1Tavg-extents: #~%" (-> this bbox4w)) + (format #t "~1Tdimension-array[4] @ #x~X~%" (&-> this grid-step w)) + (format #t "~1Tstats: #~%" (&-> this bbox min w)) + (format #t "~1Tnum-verts: ~D~%" (-> this stats num-verts)) + (format #t "~1Tnum-polys: ~D~%" (-> this stats num-polys)) + (format #t "~1Tpoly-count: ~D~%" (-> this stats poly-count)) + (format #t "~1Tpoly-array: #x~X~%" (-> this bbox max w)) + (format #t "~1Tvert-array: #x~X~%" (-> this avg-extents w)) + (format #t "~1Tindex-array: #x~X~%" (-> this index-array)) + (label cfg-4) + this + ) + +;; definition of type collide-hash-fragment-array +(deftype collide-hash-fragment-array (array) + "A collection of collide-hash-fragments. These are used by the instanced collision if a single instance +needs more than 1 collide-hash-fragment worth of triangles." + ((fragments collide-hash-fragment :dynamic :offset 16) + ) + ) + +;; definition for method 3 of type collide-hash-fragment-array +(defmethod inspect ((this collide-hash-fragment-array)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Ttype: ~A~%" (-> this type)) + (format #t "~1Tlength: ~D~%" (-> this length)) + (format #t "~1Tallocated-length: ~D~%" (-> this allocated-length)) + (format #t "~1Tcontent-type: ~A~%" (-> this content-type)) + (label cfg-4) + this + ) + +;; definition of type collide-hash +(deftype collide-hash (drawable) + ((num-ids uint16 :overlay-at id) + (id-count uint16 :offset 6) + (num-buckets uint32 :offset 8) + (qwc-id-bits uint32 :offset 12) + (grid-step vector :inline :overlay-at bsphere) + (bbox bounding-box :inline :offset 32) + (bbox4w bounding-box4w :inline :offset 64) + (axis-scale vector :inline :offset 48) + (avg-extents vector :inline :offset 64) + (bucket-array uint32 :offset 44) + (item-array (inline-array collide-hash-item) :overlay-at (-> axis-scale w)) + (dimension-array uint32 3 :overlay-at (-> avg-extents w)) + (num-items uint32 :offset 92) + ) + ) + +;; definition for method 3 of type collide-hash +(defmethod inspect ((this collide-hash)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tid: ~D~%" (-> this id)) + (format #t "~1Tbsphere: ~`vector`P~%" (-> this bsphere)) + (format #t "~1Tnum-ids: ~D~%" (-> this num-ids)) + (format #t "~1Tid-count: ~D~%" (-> this id-count)) + (format #t "~1Tnum-buckets: ~D~%" (-> this num-buckets)) + (format #t "~1Tqwc-id-bits: ~D~%" (-> this qwc-id-bits)) + (format #t "~1Tgrid-step: #~%" (-> this bsphere)) + (format #t "~1Tbbox: #~%" (-> this bbox)) + (format #t "~1Tbbox4w: #~%" (-> this bbox4w)) + (format #t "~1Taxis-scale: #~%" (-> this bbox max)) + (format #t "~1Tavg-extents: #~%" (-> this bbox4w)) + (format #t "~1Tbucket-array: #x~X~%" (-> this bbox min w)) + (format #t "~1Titem-array: #x~X~%" (-> this bbox max w)) + (format #t "~1Tdimension-array[3] @ #x~X~%" (&-> this bbox4w min w)) + (format #t "~1Tnum-items: ~D~%" (-> this num-items)) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +0 + + + + diff --git a/test/decompiler/reference/jak3/engine/common_objs/projectile-h_REF.gc b/test/decompiler/reference/jak3/engine/common_objs/projectile-h_REF.gc new file mode 100644 index 0000000000..845104e9fb --- /dev/null +++ b/test/decompiler/reference/jak3/engine/common_objs/projectile-h_REF.gc @@ -0,0 +1,203 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type projectile +(deftype projectile (process-drawable) + ((starting-pos vector :inline) + (starting-dir vector :inline) + (target-pos vector :inline) + (base-target-pos vector :inline) + (pre-move-transv vector :inline) + (timeout time-frame) + (spawn-time time-frame) + (options projectile-options) + (last-target handle) + (notify-handle handle) + (owner-handle handle) + (ignore-handle handle) + (update-velocity (function projectile none)) + (move (function projectile none)) + (pick-target (function projectile none)) + (max-speed float) + (old-dist float 16) + (old-dist-count int32) + (hits int32) + (max-hits int32) + (tween float) + (attack-mode symbol) + (attack-id uint32) + (damage float) + (vehicle-damage-factor float) + (vehicle-impulse-factor float) + (charge-level float) + (sound-id sound-id) + (stop-speed meters) + (invinc-time time-frame) + (desired-target uint64) + (desired-target-pos vector :inline) + ) + (:methods + (projectile-method-20 () none) + (projectile-method-21 () none) + (projectile-method-22 () none) + (projectile-method-23 () none) + (projectile-method-24 () none) + (projectile-method-25 () none) + (projectile-method-26 () none) + (projectile-method-27 () none) + (projectile-method-28 () none) + (projectile-method-29 () none) + (projectile-method-30 () none) + (projectile-method-31 () none) + (projectile-method-32 () none) + (projectile-method-33 () none) + (projectile-method-34 () none) + (projectile-method-35 () none) + (projectile-method-36 () none) + (projectile-method-37 () none) + (projectile-method-38 () none) + (projectile-method-39 () none) + (projectile-method-40 () none) + ) + ) + +;; definition for method 3 of type projectile +(defmethod inspect ((this projectile)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 this) + ) + (format #t "~2Tstarting-pos: ~`vector`P~%" (-> this starting-pos)) + (format #t "~2Tstarting-dir: ~`vector`P~%" (-> this starting-dir)) + (format #t "~2Ttarget-pos: ~`vector`P~%" (-> this target-pos)) + (format #t "~2Tbase-target-pos: ~`vector`P~%" (-> this base-target-pos)) + (format #t "~2Tpre-move-transv: ~`vector`P~%" (-> this pre-move-transv)) + (format #t "~2Ttimeout: ~D~%" (-> this timeout)) + (format #t "~2Tspawn-time: ~D~%" (-> this spawn-time)) + (format #t "~2Toptions: ~D~%" (-> this options)) + (format #t "~2Tlast-target: ~D~%" (-> this last-target)) + (format #t "~2Tnotify-handle: ~D~%" (-> this notify-handle)) + (format #t "~2Towner-handle: ~D~%" (-> this owner-handle)) + (format #t "~2Tignore-handle: ~D~%" (-> this ignore-handle)) + (format #t "~2Tupdate-velocity: ~A~%" (-> this update-velocity)) + (format #t "~2Tmove: ~A~%" (-> this move)) + (format #t "~2Tpick-target: ~A~%" (-> this pick-target)) + (format #t "~2Tmax-speed: ~f~%" (-> this max-speed)) + (format #t "~2Told-dist[16] @ #x~X~%" (-> this old-dist)) + (format #t "~2Told-dist-count: ~D~%" (-> this old-dist-count)) + (format #t "~2Thits: ~D~%" (-> this hits)) + (format #t "~2Tmax-hits: ~D~%" (-> this max-hits)) + (format #t "~2Ttween: ~f~%" (-> this tween)) + (format #t "~2Tattack-mode: ~A~%" (-> this attack-mode)) + (format #t "~2Tattack-id: ~D~%" (-> this attack-id)) + (format #t "~2Tdamage: ~f~%" (-> this damage)) + (format #t "~2Tvehicle-damage-factor: ~f~%" (-> this vehicle-damage-factor)) + (format #t "~2Tvehicle-impulse-factor: ~f~%" (-> this vehicle-impulse-factor)) + (format #t "~2Tcharge-level: ~f~%" (-> this charge-level)) + (format #t "~2Tsound-id: ~D~%" (-> this sound-id)) + (format #t "~2Tstop-speed: (meters ~m)~%" (-> this stop-speed)) + (format #t "~2Tinvinc-time: ~D~%" (-> this invinc-time)) + (format #t "~2Tdesired-target: ~D~%" (-> this desired-target)) + (format #t "~2Tdesired-target-pos: #~%" (-> this desired-target-pos)) + (label cfg-4) + this + ) + +;; definition of type projectile-init-by-other-params +(deftype projectile-init-by-other-params (structure) + ((pos vector :inline) + (vel vector :inline) + (target-pos vector :inline) + (target-handle uint64) + (ent entity) + (charge float) + (attack-id uint32) + (options projectile-options) + (notify-handle handle) + (owner-handle handle) + (ignore-handle handle) + (timeout time-frame) + (damage float) + (vehicle-damage-factor float) + (vehicle-impulse-factor float) + ) + ) + +;; definition for method 3 of type projectile-init-by-other-params +(defmethod inspect ((this projectile-init-by-other-params)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'projectile-init-by-other-params) + (format #t "~1Tpos: #~%" (-> this pos)) + (format #t "~1Tvel: #~%" (-> this vel)) + (format #t "~1Ttarget-pos: #~%" (-> this target-pos)) + (format #t "~1Ttarget-handle: ~D~%" (-> this target-handle)) + (format #t "~1Tent: ~A~%" (-> this ent)) + (format #t "~1Tcharge: ~f~%" (-> this charge)) + (format #t "~1Tattack-id: ~D~%" (-> this attack-id)) + (format #t "~1Toptions: ~D~%" (-> this options)) + (format #t "~1Tnotify-handle: ~D~%" (-> this notify-handle)) + (format #t "~1Towner-handle: ~D~%" (-> this owner-handle)) + (format #t "~1Tignore-handle: ~D~%" (-> this ignore-handle)) + (format #t "~1Ttimeout: ~D~%" (-> this timeout)) + (format #t "~1Tdamage: ~f~%" (-> this damage)) + (format #t "~1Tvehicle-damage-factor: ~f~%" (-> this vehicle-damage-factor)) + (format #t "~1Tvehicle-impulse-factor: ~f~%" (-> this vehicle-impulse-factor)) + (label cfg-4) + this + ) + +;; definition for function spawn-projectile +(defun spawn-projectile ((proj-type type) (params projectile-init-by-other-params) (parent-proc-tree process-tree) (pool dead-pool)) + "Create a new process for a projectile of the given type." + (let ((s4-0 (get-process pool proj-type #x4000 1))) + (when s4-0 + (let ((t9-1 (method-of-type process activate))) + (t9-1 s4-0 parent-proc-tree "projectile" (the-as pointer #x70004000)) + ) + (run-now-in-process s4-0 projectile-init-by-other params) + (-> s4-0 ppointer) + ) + ) + ) + +;; definition of type projectile-bounce +(deftype projectile-bounce (projectile) + ((played-bounce-time time-frame) + (tumble-quat quaternion :inline) + (gravity float) + ) + (:methods + (projectile-bounce-method-41 () none) + (projectile-bounce-method-42 () none) + (projectile-bounce-method-43 () none) + ) + ) + +;; definition for method 3 of type projectile-bounce +(defmethod inspect ((this projectile-bounce)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type projectile inspect))) + (t9-0 this) + ) + (format #t "~2Tplayed-bounce-time: ~D~%" (-> this played-bounce-time)) + (format #t "~2Ttumble-quat: #~%" (-> this tumble-quat)) + (format #t "~2Tgravity: ~f~%" (-> this gravity)) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +0 + + + + diff --git a/test/decompiler/reference/jak3/engine/debug/stats-h_REF.gc b/test/decompiler/reference/jak3/engine/debug/stats-h_REF.gc new file mode 100644 index 0000000000..76c9f08400 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/debug/stats-h_REF.gc @@ -0,0 +1,372 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type tr-stat +(deftype tr-stat (structure) + "triangle stats for a renderer. This can apply to a lot of different renderer types." + ((groups uint16) + (fragments uint16) + (tris uint32) + (dverts uint32) + (instances uint16) + (pad uint16) + ) + ) + +;; definition for method 3 of type tr-stat +(defmethod inspect ((this tr-stat)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'tr-stat) + (format #t "~1Tgroups: ~D~%" (-> this groups)) + (format #t "~1Tfragments: ~D~%" (-> this fragments)) + (format #t "~1Ttris: ~D~%" (-> this tris)) + (format #t "~1Tdverts: ~D~%" (-> this dverts)) + (format #t "~1Tinstances: ~D~%" (-> this instances)) + (format #t "~1Tpad: ~D~%" (-> this pad)) + (label cfg-4) + this + ) + +;; definition of type merc-global-stats +(deftype merc-global-stats (structure) + "Triangle stats for all merc renderers." + ((merc tr-stat :inline) + (emerc tr-stat :inline) + (mercneric tr-stat :inline) + ) + ) + +;; definition for method 3 of type merc-global-stats +(defmethod inspect ((this merc-global-stats)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'merc-global-stats) + (format #t "~1Tmerc: #~%" (-> this merc)) + (format #t "~1Temerc: #~%" (-> this emerc)) + (format #t "~1Tmercneric: #~%" (-> this mercneric)) + (label cfg-4) + this + ) + +;; definition of type perf-stat +(deftype perf-stat (structure) + "Performance statistics for a single 'bucket' or category. Unlike the more general profile-bars, +this records statistics like cache hits/instruction counts." + ((frame-number uint32) + (count uint32) + (cycles uint32) + (instructions uint32) + (icache uint32) + (dcache uint32) + (select uint32) + (ctrl uint32) + (accum0 uint32) + (accum1 uint32) + (to-vu0-waits uint32) + (to-spr-waits uint32) + (from-spr-waits uint32) + ) + :pack-me + (:methods + (perf-stat-method-9 () none) + (print-to-stream (_type_ string basic) none) + (start-profiling! (_type_) none) + (stop-profiling! (_type_) none) + (update-wait-stats (_type_ uint uint uint) none) + ) + ) + +;; definition for method 3 of type perf-stat +(defmethod inspect ((this perf-stat)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'perf-stat) + (format #t "~1Tframe-number: ~D~%" (-> this frame-number)) + (format #t "~1Tcount: ~D~%" (-> this count)) + (format #t "~1Tcycles: ~D~%" (-> this cycles)) + (format #t "~1Tinstructions: ~D~%" (-> this instructions)) + (format #t "~1Ticache: ~D~%" (-> this icache)) + (format #t "~1Tdcache: ~D~%" (-> this dcache)) + (format #t "~1Tselect: ~D~%" (-> this select)) + (format #t "~1Tctrl: ~D~%" (-> this ctrl)) + (format #t "~1Taccum0: ~D~%" (-> this accum0)) + (format #t "~1Taccum1: ~D~%" (-> this accum1)) + (format #t "~1Tto-vu0-waits: ~D~%" (-> this to-vu0-waits)) + (format #t "~1Tto-spr-waits: ~D~%" (-> this to-spr-waits)) + (format #t "~1Tfrom-spr-waits: ~D~%" (-> this from-spr-waits)) + (label cfg-4) + this + ) + +;; definition (debug) for function perf-stat-bucket->string +(defun-debug perf-stat-bucket->string ((arg0 perf-stat-bucket)) + (case arg0 + (((perf-stat-bucket collide-fill)) + "collide-fill" + ) + (((perf-stat-bucket nav)) + "nav" + ) + (((perf-stat-bucket bones)) + "bones" + ) + (((perf-stat-bucket foreground)) + "foreground" + ) + (((perf-stat-bucket inst-tie)) + "inst-tie" + ) + (((perf-stat-bucket common-post)) + "common-post" + ) + (((perf-stat-bucket nav-dma-write)) + "nav-dma-write" + ) + (((perf-stat-bucket collide-list)) + "collide-list" + ) + (((perf-stat-bucket clamp-vector-to-mesh)) + "clamp-vector-to-mesh" + ) + (((perf-stat-bucket nav-part3)) + "nav-part3" + ) + (((perf-stat-bucket mercneric)) + "mercneric" + ) + (((perf-stat-bucket apply-velocity)) + "apply-velocity" + ) + (((perf-stat-bucket tfrag-scissor)) + "tfrag-scissor" + ) + (((perf-stat-bucket hover-update)) + "hover-update" + ) + (((perf-stat-bucket misc)) + "misc" + ) + (((perf-stat-bucket find-nearest-poly)) + "find-nearest-poly" + ) + (((perf-stat-bucket nav-part6)) + "nav-part6" + ) + (((perf-stat-bucket nav-part2)) + "nav-part2" + ) + (((perf-stat-bucket generate-velocity)) + "generate-velocity" + ) + (((perf-stat-bucket inst-shrub)) + "inst-shrub" + ) + (((perf-stat-bucket hover-path)) + "hover-path" + ) + (((perf-stat-bucket avoid-spheres)) + "avoid-spheres" + ) + (((perf-stat-bucket proto-shrub)) + "proto-shrub" + ) + (((perf-stat-bucket drawable)) + "drawable" + ) + (((perf-stat-bucket nav-part9)) + "nav-part9" + ) + (((perf-stat-bucket all-code)) + "all-code" + ) + (((perf-stat-bucket actor-hash)) + "actor-hash" + ) + (((perf-stat-bucket nav-dma-all)) + "nav-dma-all" + ) + (((perf-stat-bucket travel-post)) + "travel-post" + ) + (((perf-stat-bucket travel-around-spheres)) + "travel-around-spheres" + ) + (((perf-stat-bucket nav-part10)) + "nav-part10" + ) + (((perf-stat-bucket nav-dma-work)) + "nav-dma-work" + ) + (((perf-stat-bucket update-los)) + "update-los" + ) + (((perf-stat-bucket proto-tie)) + "proto-tie" + ) + (((perf-stat-bucket hover-move)) + "hover-move" + ) + (((perf-stat-bucket nav-part4)) + "nav-part4" + ) + (((perf-stat-bucket ray-step)) + "ray-step" + ) + (((perf-stat-bucket hover-find-closest)) + "hover-find-closest" + ) + (((perf-stat-bucket spatial-hash-search)) + "spatial-hash-search" + ) + (((perf-stat-bucket apply-rotation)) + "apply-rotation" + ) + (((perf-stat-bucket find-containing-poly)) + "find-containing-poly" + ) + (((perf-stat-bucket update-spheres)) + "update-spheres" + ) + (((perf-stat-bucket nav-part7)) + "nav-part7" + ) + (((perf-stat-bucket tfrag)) + "tfrag" + ) + (((perf-stat-bucket collide)) + "collide" + ) + (((perf-stat-bucket update-current-poly)) + "update-current-poly" + ) + (((perf-stat-bucket nav-dma-read)) + "nav-dma-read" + ) + (((perf-stat-bucket spatial-hash-build)) + "spatial-hash-build" + ) + (((perf-stat-bucket tie-generic)) + "tie-generic" + ) + (((perf-stat-bucket camera)) + "camera" + ) + (((perf-stat-bucket background)) + "background" + ) + (((perf-stat-bucket nav-part5)) + "nav-part5" + ) + (((perf-stat-bucket nav-part1)) + "nav-part1" + ) + (((perf-stat-bucket hover-spheres)) + "hover-spheres" + ) + (((perf-stat-bucket check-vector-collision-with-nav-spheres)) + "check-vector-collision-with-nav-spheres" + ) + (((perf-stat-bucket add-to-translation)) + "add-to-translation" + ) + (((perf-stat-bucket nav-part8)) + "nav-part8" + ) + (else + "*unknown*" + ) + ) + ) + +;; definition of type perf-stat-array +(deftype perf-stat-array (inline-array-class) + "Array of all stats for all buckets." + ((data perf-stat :inline :dynamic) + ) + ) + +;; definition for method 3 of type perf-stat-array +(defmethod inspect ((this perf-stat-array)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tlength: ~D~%" (-> this length)) + (format #t "~1Tallocated-length: ~D~%" (-> this allocated-length)) + (format #t "~1Tdata[0] @ #x~X~%" (-> this data)) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +(set! (-> perf-stat-array heap-base) (the-as uint 52)) + +;; definition for method 11 of type perf-stat +;; WARN: Return type mismatch int vs none. +(defmethod start-profiling! ((this perf-stat)) + (let ((v1-0 (-> this ctrl))) + (+! (-> this count) 1) + (b! (zero? v1-0) cfg-2 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mtpc pcr0 0) + (.mtpc pcr1 0) + (.sync.l) + (.sync.p) + (.mtc0 Perf v1-0) + ) + (.sync.l) + (.sync.p) + (label cfg-2) + 0 + (none) + ) + +;; definition for method 12 of type perf-stat +;; WARN: Return type mismatch int vs none. +(defmethod stop-profiling! ((this perf-stat)) + (local-vars (v1-1 int) (v1-3 int)) + (b! (zero? (-> this ctrl)) cfg-2 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mfpc v1-1 pcr0) + (+! (-> this accum0) v1-1) + (.mfpc v1-3 pcr1) + (+! (-> this accum1) v1-3) + (label cfg-2) + 0 + (none) + ) + +;; definition for method 13 of type perf-stat +;; WARN: Return type mismatch int vs none. +(defmethod update-wait-stats ((this perf-stat) (arg0 uint) (arg1 uint) (arg2 uint)) + (when (nonzero? (-> this ctrl)) + (+! (-> this to-vu0-waits) arg0) + (+! (-> this to-spr-waits) arg1) + (+! (-> this from-spr-waits) arg2) + ) + 0 + (none) + ) + +;; failed to figure out what this is: +(when (not *debug-segment*) + (set! (-> perf-stat method-table 11) nothing) + (set! (-> perf-stat method-table 12) nothing) + (set! (-> perf-stat method-table 13) nothing) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/level/bsp-h_REF.gc b/test/decompiler/reference/jak3/engine/level/bsp-h_REF.gc new file mode 100644 index 0000000000..f490ede060 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/level/bsp-h_REF.gc @@ -0,0 +1,205 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type bsp-node +(deftype bsp-node (structure) + "A node in the 'BSP' tree. This is really a bounding volume tree, where each volume is an axis-aligned box, containing 2 child boxes. +This is used for precomputed visibility, based on the camera position. This is not used for collision." + ((front int16) + (back int16) + (front-box-min vector4b :inline) + (front-box-max vector4b :inline) + (back-box-min vector4b :inline) + (back-box-max vector4b :inline) + ) + ) + +;; definition for method 3 of type bsp-node +(defmethod inspect ((this bsp-node)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'bsp-node) + (format #t "~1Tfront: ~D~%" (-> this front)) + (format #t "~1Tback: ~D~%" (-> this back)) + (format #t "~1Tfront-box-min: #~%" (-> this front-box-min)) + (format #t "~1Tfront-box-max: #~%" (-> this front-box-max)) + (format #t "~1Tback-box-min: #~%" (-> this back-box-min)) + (format #t "~1Tback-box-max: #~%" (-> this back-box-max)) + (label cfg-4) + this + ) + +;; definition of type bsp-header +(deftype bsp-header (drawable) + "The bsp-header is really an entire level. +This probably started as a very simple structure, but now it is extremely complicated." + ((all-visible-list (pointer uint16) :offset 32) + (visible-list-length int16 :offset 36) + (drawable-trees drawable-tree-array :offset 40) + (pat pointer :offset 44) + (pat-length int32 :offset 48) + (nodes (inline-array bsp-node) :offset 120) + (end uint8 :offset 399) + ) + (:methods + (birth (_type_) none) + (deactivate-entities (_type_) none) + ) + ) + +;; definition of type game-level +(deftype game-level (basic) + "Unused in Jak 1, 2, and 3!" + ((master-bsp basic) + ) + ) + +;; definition for method 3 of type game-level +(defmethod inspect ((this game-level)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tmaster-bsp: ~A~%" (-> this master-bsp)) + (label cfg-4) + this + ) + +;; definition of type view-frustum +(deftype view-frustum (structure) + "A view frustum, expressed as corners. +This representation is not very useful, and is used in only one spot to generate camera planes +in a very inefficient way." + ((hither-top-left vector :inline) + (hither-top-right vector :inline) + (hither-bottom-left vector :inline) + (hither-bottom-right vector :inline) + (yon-top-left vector :inline) + (yon-top-right vector :inline) + (yon-bottom-left vector :inline) + (yon-bottom-right vector :inline) + ) + ) + +;; definition for method 3 of type view-frustum +(defmethod inspect ((this view-frustum)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'view-frustum) + (format #t "~1Thither-top-left: #~%" (-> this hither-top-left)) + (format #t "~1Thither-top-right: #~%" (-> this hither-top-right)) + (format #t "~1Thither-bottom-left: #~%" (-> this hither-bottom-left)) + (format #t "~1Thither-bottom-right: #~%" (-> this hither-bottom-right)) + (format #t "~1Tyon-top-left: #~%" (-> this yon-top-left)) + (format #t "~1Tyon-top-right: #~%" (-> this yon-top-right)) + (format #t "~1Tyon-bottom-left: #~%" (-> this yon-bottom-left)) + (format #t "~1Tyon-bottom-right: #~%" (-> this yon-bottom-right)) + (label cfg-4) + this + ) + +;; definition for method 3 of type bsp-header +(defmethod inspect ((this bsp-header)) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~Tall-visible-list: #x~X~%" (-> this all-visible-list)) + (format #t "~Tvisible-list-length: ~D~%" (-> this visible-list-length)) + (format #t "~Tdrawable-trees: ~A~%" (-> this drawable-trees)) + (format #t "~Tpat: #x~X~%" (-> this pat)) + (format #t "~Tpat-length: ~D~%" (-> this pat-length)) + (inspect-bsp-tree this (-> this nodes 0)) + this + ) + +;; definition (debug) for function inspect-bsp-tree +;; WARN: Return type mismatch bsp-header vs none. +(defun-debug inspect-bsp-tree ((arg0 bsp-header) (arg1 bsp-node)) + "Attempt to print a bsp-tree, but it is actually broken since the jak 2 bsp format change" + (cond + ((zero? arg1) + ) + (else + (format #t "_#x~X________________~%" arg1) + (inspect arg1) + (let ((s4-0 *print-column*)) + (set! *print-column* (+ *print-column* 64)) + (if (> (-> arg1 front) 0) + (inspect-bsp-tree arg0 (the-as bsp-node (-> arg1 front))) + (format #t "_#x~X________________~%" arg1) + ) + (if (> (-> arg1 back) 0) + (inspect-bsp-tree arg0 (the-as bsp-node (-> arg1 back))) + (format #t "_#x~X________________~%" arg1) + ) + (set! *print-column* s4-0) + ) + ) + ) + (none) + ) + +;; definition for function map-bsp-tree +;; WARN: Return type mismatch bsp-header vs none. +(defun map-bsp-tree ((arg0 (function bsp-node none)) (arg1 bsp-header) (arg2 bsp-node)) + "Attempt to call a function on all bsp-tree nodes, but it is actually broken since the jak 2 bsp format" + (cond + ((zero? arg2) + ) + (else + (if (> (-> arg2 front) 0) + (map-bsp-tree arg0 arg1 (the-as bsp-node (-> arg2 front))) + (arg0 arg2) + ) + (if (> (-> arg2 back) 0) + (map-bsp-tree arg0 arg1 (the-as bsp-node (-> arg2 back))) + (arg0 arg2) + ) + ) + ) + (none) + ) + +;; definition of type collide-stats +(deftype collide-stats (structure) + "Very strange collide stats type. It has been somewhat broken in all versions of the game. +The final stopwatch is cut off. For jak 3, I just fixed it." + ((calls uint32) + (spheres uint32) + (nodes uint32) + (frags uint32) + (tris uint32) + (output uint32) + (junk (pointer uint32) 24) + ) + ) + +;; definition for method 3 of type collide-stats +(defmethod inspect ((this collide-stats)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'collide-stats) + (format #t "~1Tcalls: ~D~%" (-> this calls)) + (format #t "~1Tspheres: ~D~%" (-> this spheres)) + (format #t "~1Tnodes: ~D~%" (-> this nodes)) + (format #t "~1Tfrags: ~D~%" (-> this frags)) + (format #t "~1Ttris: ~D~%" (-> this tris)) + (format #t "~1Toutput: ~D~%" (-> this output)) + (format #t "~1Ttotal-target: #~%" (&-> this junk 1)) + (format #t "~1Ttarget-cache-fill: #~%" (&-> this junk 9)) + (format #t "~1Ttarget-ray-poly: #~%" (&-> this junk 17)) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +0 + + + + diff --git a/test/decompiler/reference/jak3/engine/physics/chain-physics-h_REF.gc b/test/decompiler/reference/jak3/engine/physics/chain-physics-h_REF.gc new file mode 100644 index 0000000000..f297394793 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/physics/chain-physics-h_REF.gc @@ -0,0 +1,108 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type chain-physics-setup +(deftype chain-physics-setup (structure) + ((joint-index int32) + ) + ) + +;; definition for method 3 of type chain-physics-setup +(defmethod inspect ((this chain-physics-setup)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'chain-physics-setup) + (format #t "~1Tjoint-index: ~D~%" (-> this joint-index)) + (label cfg-4) + this + ) + +;; definition of type chain-physics-joint +(deftype chain-physics-joint (structure) + ((position vector :inline) + (velocity vector :inline) + (old-x vector :inline) + (joint-mod joint-mod) + ) + ) + +;; definition for method 3 of type chain-physics-joint +(defmethod inspect ((this chain-physics-joint)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'chain-physics-joint) + (format #t "~1Tposition: #~%" (-> this position)) + (format #t "~1Tvelocity: #~%" (-> this velocity)) + (format #t "~1Told-x: #~%" (-> this old-x)) + (format #t "~1Tjoint-mod: ~A~%" (-> this joint-mod)) + (label cfg-4) + this + ) + +;; definition of type chain-physics +(deftype chain-physics (basic) + ((chain-joints chain-physics-joint 20 :inline) + (num-joints uint8) + (root-joint-index uint8) + (joint-length float) + (gravity vector :inline) + (gravity-target vector :inline) + (stretch-vel float) + (stretch-vel-parallel float) + (compress-vel float) + (compress-vel-parallel float) + (negate-y symbol) + (axial-slop float) + (maximum-stretch float) + (turn-off-start uint64) + (turn-off-duration uint64) + ) + (:methods + (chain-physics-method-9 () none) + (chain-physics-method-10 () none) + (chain-physics-method-11 () none) + (chain-physics-method-12 () none) + (chain-physics-method-13 () none) + (chain-physics-method-14 () none) + (chain-physics-method-15 () none) + (chain-physics-method-16 () none) + (chain-physics-method-17 () none) + ) + ) + +;; definition for method 3 of type chain-physics +(defmethod inspect ((this chain-physics)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tchain-joints[20] @ #x~X~%" (-> this chain-joints)) + (format #t "~1Tnum-joints: ~D~%" (-> this num-joints)) + (format #t "~1Troot-joint-index: ~D~%" (-> this root-joint-index)) + (format #t "~1Tjoint-length: ~f~%" (-> this joint-length)) + (format #t "~1Tgravity: #~%" (-> this gravity)) + (format #t "~1Tgravity-target: #~%" (-> this gravity-target)) + (format #t "~1Tstretch-vel: ~f~%" (-> this stretch-vel)) + (format #t "~1Tstretch-vel-parallel: ~f~%" (-> this stretch-vel-parallel)) + (format #t "~1Tcompress-vel: ~f~%" (-> this compress-vel)) + (format #t "~1Tcompress-vel-parallel: ~f~%" (-> this compress-vel-parallel)) + (format #t "~1Tnegate-y: ~A~%" (-> this negate-y)) + (format #t "~1Taxial-slop: ~f~%" (-> this axial-slop)) + (format #t "~1Tmaximum-stretch: ~f~%" (-> this maximum-stretch)) + (format #t "~1Tturn-off-start: ~D~%" (-> this turn-off-start)) + (format #t "~1Tturn-off-duration: ~D~%" (-> this turn-off-duration)) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +0 + + + + diff --git a/test/decompiler/reference/jak3/engine/physics/ragdoll-h_REF.gc b/test/decompiler/reference/jak3/engine/physics/ragdoll-h_REF.gc new file mode 100644 index 0000000000..5001383ed0 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/physics/ragdoll-h_REF.gc @@ -0,0 +1,335 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type ragdoll-edit-info +(deftype ragdoll-edit-info (structure) + ((editing symbol) + (current-func uint64) + (analog-func uint64) + (affect uint64) + (single-step uint64) + (collision symbol) + (gravity symbol) + (skel-visible uint64) + (current-joint int8) + (auto-setup-now basic) + (child-stack object 60) + (child-stack-num int8) + (last-frame uint64) + (last-frame-dur uint64) + ) + (:methods + (ragdoll-edit-info-method-9 () none) + (ragdoll-edit-info-method-10 () none) + (ragdoll-edit-info-method-11 () none) + (ragdoll-edit-info-method-12 () none) + (ragdoll-edit-info-method-13 () none) + (ragdoll-edit-info-method-14 () none) + (ragdoll-edit-info-method-15 () none) + (ragdoll-edit-info-method-16 () none) + (ragdoll-edit-info-method-17 () none) + ) + ) + +;; definition for method 3 of type ragdoll-edit-info +(defmethod inspect ((this ragdoll-edit-info)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'ragdoll-edit-info) + (format #t "~1Tediting: ~A~%" (-> this editing)) + (format #t "~1Tcurrent-func: ~D~%" (-> this current-func)) + (format #t "~1Tanalog-func: ~D~%" (-> this analog-func)) + (format #t "~1Taffect: ~D~%" (-> this affect)) + (format #t "~1Tsingle-step: ~D~%" (-> this single-step)) + (format #t "~1Tcollision: ~A~%" (-> this collision)) + (format #t "~1Tgravity: ~A~%" (-> this gravity)) + (format #t "~1Tskel-visible: ~D~%" (-> this skel-visible)) + (format #t "~1Tcurrent-joint: ~D~%" (-> this current-joint)) + (format #t "~1Tauto-setup-now: ~A~%" (-> this auto-setup-now)) + (format #t "~1Tchild-stack[60] @ #x~X~%" (-> this child-stack)) + (format #t "~1Tchild-stack-num: ~D~%" (-> this child-stack-num)) + (format #t "~1Tlast-frame: ~D~%" (-> this last-frame)) + (format #t "~1Tlast-frame-dur: ~D~%" (-> this last-frame-dur)) + (label cfg-4) + this + ) + +;; definition for symbol *ragdoll-edit-info*, type ragdoll-edit-info +(define *ragdoll-edit-info* (the-as ragdoll-edit-info 0)) + +;; definition for symbol *ragdoll-edit-info*, type ragdoll-edit-info +(define *ragdoll-edit-info* (new 'static 'ragdoll-edit-info + :editing #t + :current-func #x9 + :single-step #x2 + :collision #t + :gravity #t + :skel-visible #x1 + ) + ) + +;; definition of type ragdoll-joint-setup +(deftype ragdoll-joint-setup (structure) + ((joint-index int32) + (parent-joint int32) + (joint-type uint64) + (pre-tform vector :inline) + (geo-tform vector :inline) + (axial-slop float) + (max-angle float) + (coll-rad float) + (hit-sound uint128) + ) + ) + +;; definition for method 3 of type ragdoll-joint-setup +;; INFO: Used lq/sq +(defmethod inspect ((this ragdoll-joint-setup)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'ragdoll-joint-setup) + (format #t "~1Tjoint-index: ~D~%" (-> this joint-index)) + (format #t "~1Tparent-joint: ~D~%" (-> this parent-joint)) + (format #t "~1Tjoint-type: ~D~%" (-> this joint-type)) + (format #t "~1Tpre-tform: #~%" (-> this pre-tform)) + (format #t "~1Tgeo-tform: #~%" (-> this geo-tform)) + (format #t "~1Taxial-slop: ~f~%" (-> this axial-slop)) + (format #t "~1Tmax-angle: ~f~%" (-> this max-angle)) + (format #t "~1Tcoll-rad: ~f~%" (-> this coll-rad)) + (format #t "~1Thit-sound: ~D~%" (-> this hit-sound)) + (label cfg-4) + this + ) + +;; definition of type ragdoll-setup +(deftype ragdoll-setup (structure) + ((orient-tform vector :inline) + (scale vector :inline) + (bg-collide-with collide-spec) + (joint-setup basic) + ) + ) + +;; definition for method 3 of type ragdoll-setup +(defmethod inspect ((this ragdoll-setup)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'ragdoll-setup) + (format #t "~1Torient-tform: #~%" (-> this orient-tform)) + (format #t "~1Tscale: #~%" (-> this scale)) + (format #t "~1Tbg-collide-with: ~D~%" (-> this bg-collide-with)) + (format #t "~1Tjoint-setup: ~A~%" (-> this joint-setup)) + (label cfg-4) + this + ) + +;; definition of type ragdoll-joint +(deftype ragdoll-joint (structure) + ((quat quaternion :inline) + (position vector :inline) + (velocity vector :inline) + (bounce vector :inline) + (old-x vector :inline) + (pre-tform vector :inline) + (geo-tform vector :inline) + (axial-slop float) + (max-angle float) + (joint-length float) + (coll-rad float) + (ragdoll-joint-flags uint32) + (joint-type uint64) + (joint-index int8) + (parent-joint int8) + (parent-index int8) + (num-children int8) + (old-param0 basic) + (hit-sound uint128) + (ground-pat uint32) + (user0 int32) + (original-speed float) + ) + ) + +;; definition for method 3 of type ragdoll-joint +;; INFO: Used lq/sq +(defmethod inspect ((this ragdoll-joint)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'ragdoll-joint) + (format #t "~1Tquat: #~%" (-> this quat)) + (format #t "~1Tposition: #~%" (-> this position)) + (format #t "~1Tvelocity: #~%" (-> this velocity)) + (format #t "~1Tbounce: #~%" (-> this bounce)) + (format #t "~1Told-x: #~%" (-> this old-x)) + (format #t "~1Tpre-tform: #~%" (-> this pre-tform)) + (format #t "~1Tgeo-tform: #~%" (-> this geo-tform)) + (format #t "~1Taxial-slop: ~f~%" (-> this axial-slop)) + (format #t "~1Tmax-angle: ~f~%" (-> this max-angle)) + (format #t "~1Tjoint-length: ~f~%" (-> this joint-length)) + (format #t "~1Tcoll-rad: ~f~%" (-> this coll-rad)) + (format #t "~1Tragdoll-joint-flags: ~D~%" (-> this ragdoll-joint-flags)) + (format #t "~1Tjoint-type: ~D~%" (-> this joint-type)) + (format #t "~1Tjoint-index: ~D~%" (-> this joint-index)) + (format #t "~1Tparent-joint: ~D~%" (-> this parent-joint)) + (format #t "~1Tparent-index: ~D~%" (-> this parent-index)) + (format #t "~1Tnum-children: ~D~%" (-> this num-children)) + (format #t "~1Told-param0: ~A~%" (-> this old-param0)) + (format #t "~1Thit-sound: ~D~%" (-> this hit-sound)) + (format #t "~1Tground-pat: #x~X~%" (-> this ground-pat)) + (format #t "~1Tuser0: ~D~%" (-> this user0)) + (format #t "~1Toriginal-speed: ~f~%" (-> this original-speed)) + (label cfg-4) + this + ) + +;; definition of type ragdoll +(deftype ragdoll (basic) + ((ragdoll-joints ragdoll-joint 60 :inline) + (num-joints uint8) + (mirror matrix :inline) + (gravity vector :inline) + (gravity-target vector :inline) + (orient-tform vector :inline) + (scale vector :inline) + (stretch-vel float) + (stretch-vel-parallel float) + (compress-vel float) + (compress-vel-parallel float) + (momentum float) + (maximum-stretch float) + (turn-off-start uint64) + (turn-off-duration uint64) + (copy-velocity-start uint64) + (root-offset vector :inline) + (rotate-vel quaternion :inline) + (rotate-adj quaternion :inline) + (rotate-adj-count int8) + (ragdoll-flags uint32) + (flex-blend float) + (stable-joints int8) + (ragdoll-joint-remap uint8 100) + (allow-destabilize uint64) + (bg-collide-with uint32) + (water-info water-info :inline) + ) + (:methods + (ragdoll-method-9 () none) + (ragdoll-method-10 () none) + (ragdoll-method-11 () none) + (ragdoll-method-12 () none) + (ragdoll-method-13 () none) + (ragdoll-method-14 () none) + (ragdoll-method-15 () none) + (ragdoll-method-16 () none) + (ragdoll-method-17 () none) + (ragdoll-method-18 () none) + (ragdoll-method-19 () none) + (ragdoll-method-20 () none) + (ragdoll-method-21 () none) + (ragdoll-method-22 () none) + (ragdoll-method-23 () none) + (ragdoll-method-24 () none) + (ragdoll-method-25 () none) + ) + ) + +;; definition for method 3 of type ragdoll +(defmethod inspect ((this ragdoll)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tragdoll-joints[60] @ #x~X~%" (-> this ragdoll-joints)) + (format #t "~1Tnum-joints: ~D~%" (-> this num-joints)) + (format #t "~1Tmirror: #~%" (-> this mirror)) + (format #t "~1Tgravity: #~%" (-> this gravity)) + (format #t "~1Tgravity-target: #~%" (-> this gravity-target)) + (format #t "~1Torient-tform: #~%" (-> this orient-tform)) + (format #t "~1Tscale: #~%" (-> this scale)) + (format #t "~1Tstretch-vel: ~f~%" (-> this stretch-vel)) + (format #t "~1Tstretch-vel-parallel: ~f~%" (-> this stretch-vel-parallel)) + (format #t "~1Tcompress-vel: ~f~%" (-> this compress-vel)) + (format #t "~1Tcompress-vel-parallel: ~f~%" (-> this compress-vel-parallel)) + (format #t "~1Tmomentum: ~f~%" (-> this momentum)) + (format #t "~1Tmaximum-stretch: ~f~%" (-> this maximum-stretch)) + (format #t "~1Tturn-off-start: ~D~%" (-> this turn-off-start)) + (format #t "~1Tturn-off-duration: ~D~%" (-> this turn-off-duration)) + (format #t "~1Tcopy-velocity-start: ~D~%" (-> this copy-velocity-start)) + (format #t "~1Troot-offset: #~%" (-> this root-offset)) + (format #t "~1Trotate-vel: #~%" (-> this rotate-vel)) + (format #t "~1Trotate-adj: #~%" (-> this rotate-adj)) + (format #t "~1Trotate-adj-count: ~D~%" (-> this rotate-adj-count)) + (format #t "~1Tragdoll-flags: ~D~%" (-> this ragdoll-flags)) + (format #t "~1Tflex-blend: ~f~%" (-> this flex-blend)) + (format #t "~1Tstable-joints: ~D~%" (-> this stable-joints)) + (format #t "~1Tragdoll-joint-remap[100] @ #x~X~%" (-> this ragdoll-joint-remap)) + (format #t "~1Tallow-destabilize: ~D~%" (-> this allow-destabilize)) + (format #t "~1Tbg-collide-with: ~D~%" (-> this bg-collide-with)) + (format #t "~1Twater-info: #~%" (-> this water-info)) + (label cfg-4) + this + ) + +;; definition of type ragdoll-proc +(deftype ragdoll-proc (process) + ((ragdoll ragdoll) + (last-attack-id uint32) + ) + (:methods + (ragdoll-proc-method-14 () none) + (ragdoll-proc-method-15 () none) + (ragdoll-proc-method-16 () none) + (ragdoll-proc-method-17 () none) + (ragdoll-proc-method-18 () none) + (ragdoll-proc-method-19 () none) + ) + ) + +;; definition for method 3 of type ragdoll-proc +(defmethod inspect ((this ragdoll-proc)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process inspect))) + (t9-0 this) + ) + (format #t "~2Tragdoll: ~A~%" (-> this ragdoll)) + (format #t "~2Tlast-attack-id: ~D~%" (-> this last-attack-id)) + (label cfg-4) + this + ) + +;; definition of type wings-ragdoll-proc +(deftype wings-ragdoll-proc (ragdoll-proc) + () + ) + +;; definition for method 3 of type wings-ragdoll-proc +(defmethod inspect ((this wings-ragdoll-proc)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type ragdoll-proc inspect))) + (t9-0 this) + ) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +0 + + + +