From 136136e498b495763c171eb4b97853951fa554ed Mon Sep 17 00:00:00 2001 From: water111 <48171810+water111@users.noreply.github.com> Date: Fri, 11 Nov 2022 12:01:45 -0500 Subject: [PATCH] [decomp] start work on collide (#2008) Adds `collide-shape` and a few other related ones. --- decompiler/config/jak2/all-types.gc | 349 +- decompiler/config/jak2/hacks.jsonc | 19 +- decompiler/config/jak2/label_types.jsonc | 13 + decompiler/config/jak2/stack_structures.jsonc | 20 + decompiler/config/jak2/type_casts.jsonc | 72 + decompiler/config/jak2/var_names.jsonc | 44 + decompiler/config/jak2_ntsc_v1.jsonc | 2 +- goal_src/jak2/engine/anim/fma-sphere.gc | 2 +- .../jak2/engine/collide/collide-cache-h.gc | 14 +- goal_src/jak2/engine/collide/collide-h.gc | 79 +- .../jak2/engine/collide/collide-mesh-h.gc | 15 +- goal_src/jak2/engine/collide/collide-mesh.gc | 2 +- .../jak2/engine/collide/collide-shape-h.gc | 185 +- .../engine/collide/collide-shape-rider.gc | 435 +++ goal_src/jak2/engine/collide/collide-shape.gc | 3238 +++++++++++++++++ .../jak2/engine/collide/collide-target-h.gc | 417 ++- goal_src/jak2/engine/collide/collide.gc | 23 + goal_src/jak2/engine/common_objs/base-plat.gc | 10 +- .../jak2/engine/common_objs/basebutton.gc | 30 +- goal_src/jak2/engine/common_objs/conveyor.gc | 2 +- goal_src/jak2/engine/common_objs/crates.gc | 19 +- goal_src/jak2/engine/common_objs/elevator.gc | 23 +- .../jak2/engine/common_objs/generic-obs.gc | 2 +- goal_src/jak2/engine/common_objs/plat.gc | 6 +- .../jak2/engine/common_objs/projectile.gc | 41 +- .../engine/common_objs/rigid-body-plat.gc | 10 +- goal_src/jak2/engine/common_objs/voicebox.gc | 8 +- goal_src/jak2/engine/common_objs/water.gc | 31 +- goal_src/jak2/engine/game/game-h.gc | 2 +- goal_src/jak2/engine/physics/rigid-body.gc | 8 +- goal_src/jak2/engine/physics/trajectory.gc | 2 +- .../process-drawable/process-taskable.gc | 69 +- .../process-drawable/simple-nav-sphere.gc | 8 +- .../engine/spatial-hash/spatial-hash-h.gc | 2 +- goal_src/jak2/engine/target/board/board-h.gc | 5 +- .../jak2/engine/target/board/board-states.gc | 84 +- .../jak2/engine/target/board/target-board.gc | 132 +- goal_src/jak2/engine/target/logic-target.gc | 175 +- goal_src/jak2/engine/target/sidekick.gc | 27 +- goal_src/jak2/engine/target/target-carry.gc | 29 +- goal_src/jak2/engine/target/target-darkjak.gc | 30 +- goal_src/jak2/engine/target/target-gun.gc | 64 +- goal_src/jak2/engine/target/target-swim.gc | 20 +- goal_src/jak2/engine/target/target-util.gc | 80 +- goal_src/jak2/engine/target/target.gc | 89 +- goal_src/jak2/levels/common/battle.gc | 2 +- .../levels/common/cty-guard-turret-button.gc | 153 + .../jak2/levels/common/guard-projectile.gc | 44 +- .../levels/common/metalhead-projectile.gc | 18 +- .../engine/collide/collide-cache-h_REF.gc | 25 +- .../engine/collide/collide-edge-grab_REF.gc | 8 +- .../jak2/engine/collide/collide-h_REF.gc | 13 +- .../jak2/engine/collide/collide-mesh-h_REF.gc | 2 +- .../jak2/engine/collide/collide-mesh_REF.gc | 7 +- .../engine/collide/collide-shape-h_REF.gc | 231 +- .../engine/collide/collide-shape-rider_REF.gc | 438 +++ .../jak2/engine/collide/collide-shape_REF.gc | 3130 ++++++++++++++++ .../engine/collide/collide-target-h_REF.gc | 408 +-- .../jak2/engine/collide/collide_REF.gc | 23 + .../jak2/engine/common_objs/base-plat_REF.gc | 10 +- .../jak2/engine/common_objs/basebutton_REF.gc | 2 +- .../jak2/engine/common_objs/conveyor_REF.gc | 2 +- .../jak2/engine/common_objs/crates_REF.gc | 77 +- .../jak2/engine/common_objs/elevator_REF.gc | 2 +- .../jak2/engine/common_objs/plat_REF.gc | 4 +- .../jak2/engine/common_objs/projectile_REF.gc | 41 +- .../engine/common_objs/rigid-body-plat_REF.gc | 10 +- .../jak2/engine/common_objs/voicebox_REF.gc | 52 +- .../jak2/engine/common_objs/water_REF.gc | 105 +- .../reference/jak2/engine/game/game-h_REF.gc | 14 +- .../jak2/engine/physics/rigid-body_REF.gc | 8 +- .../jak2/engine/physics/trajectory_REF.gc | 49 +- .../process-drawable/simple-nav-sphere_REF.gc | 8 +- .../engine/spatial-hash/spatial-hash-h_REF.gc | 17 +- .../jak2/engine/target/board/board-h_REF.gc | 2 +- .../engine/target/board/board-states_REF.gc | 46 +- .../engine/target/board/target-board_REF.gc | 58 +- .../engine/target/gun/gun-blue-shot_REF.gc | 20 +- .../engine/target/gun/gun-red-shot_REF.gc | 22 +- .../engine/target/gun/gun-yellow-shot_REF.gc | 22 +- .../jak2/engine/target/logic-target_REF.gc | 164 +- .../jak2/engine/target/sidekick_REF.gc | 513 +++ .../jak2/engine/target/target-carry_REF.gc | 12 +- .../jak2/engine/target/target-darkjak_REF.gc | 32 +- .../jak2/engine/target/target-gun_REF.gc | 18 +- .../jak2/engine/target/target-swim_REF.gc | 16 +- .../jak2/engine/target/target-util_REF.gc | 52 +- .../jak2/engine/target/target_REF.gc | 84 +- .../jak2/levels/common/battle_REF.gc | 93 +- .../common/cty-guard-turret-button_REF.gc | 2 +- .../levels/common/guard-projectile_REF.gc | 48 +- .../levels/common/metalhead-projectile_REF.gc | 22 +- test/offline/config/jak2/config.jsonc | 10 + 93 files changed, 10269 insertions(+), 1807 deletions(-) create mode 100644 test/decompiler/reference/jak2/engine/collide/collide-shape-rider_REF.gc create mode 100644 test/decompiler/reference/jak2/engine/collide/collide-shape_REF.gc create mode 100644 test/decompiler/reference/jak2/engine/collide/collide_REF.gc create mode 100644 test/decompiler/reference/jak2/engine/target/sidekick_REF.gc diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index 71ffe3f510..0bbcd5c8b5 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -14970,7 +14970,7 @@ (damage float) (shield-damage float) (knock uint8) - (test uint32) + (test symbol) ) :method-count-assert 12 :size-assert #xa0 @@ -15806,7 +15806,7 @@ :size-assert #xbb90 :flag-assert #xd0000bb90 (:methods - (populate-for-prim-mesh (_type_ collide-shape-prim-mesh) none 9) + (populate-for-prim-mesh (_type_ collide-shape-prim-mesh) collide-mesh-cache-entry 9) (is-id? (_type_ int) symbol 10) (next-id! (_type_) uint 11) (allocate! (_type_ int) collide-mesh-cache-entry 12) @@ -15916,9 +15916,10 @@ (nav-sphere 16) ;; hi 1 ) +(declare-type collide-shape-prim basic) (deftype collide-rider (structure) ((rider-handle handle :offset-assert 0) - (sticky-prim basic :offset-assert 8) + (sticky-prim collide-shape-prim :offset-assert 8) (prim-ry float :offset-assert 12) (rider-local-pos vector :inline :offset-assert 16) ) @@ -15935,7 +15936,7 @@ :size-assert #x290 :flag-assert #xb00000290 (:methods - (collide-rider-pool-method-9 () none 9) + (add-rider (_type_ handle) collide-rider 9) (prepare (_type_) none 10) ) ) @@ -16015,6 +16016,9 @@ :flag-assert #x900000020 ) +(declare-type collide-cache-prim structure) +(declare-type collide-shape-prim-group structure) + (deftype collide-shape-prim (basic) ((cshape collide-shape :offset-assert 4) (prim-id uint32 :offset-assert 8) @@ -16037,17 +16041,17 @@ ;; Failed to read fields. (:methods (new (symbol type collide-shape uint int) _type_ 0) - (collide-shape-prim-method-9 () none 9) ;; (move-by-vector! (_type_ vector) none 9) - (add-fg-prim-using-box () none 10) ;; (find-prim-by-id (_type_ uint) collide-shape-prim 10) - (add-fg-prim-using-line-sphere () none 11) ;; (debug-draw-world-sphere (_type_) symbol 11) - (collide-shape-prim-method-12 () none 12) ;; (add-fg-prim-using-box (_type_ collide-cache) none 12) - (collide-shape-prim-method-13 () none 13) ;; (add-fg-prim-using-line-sphere (_type_ collide-cache) none 13) - (collide-shape-prim-method-14 () none 14) ;; (add-fg-prim-using-y-probe (_type_ collide-cache) none 14) - (collide-shape-prim-method-15 () none 15) ;; (overlaps-others-test (_type_ overlaps-others-params collide-shape-prim) symbol 15) - (collide-shape-prim-method-16 () none 16) ;; (overlaps-others-group (_type_ overlaps-others-params collide-shape-prim-group) symbol 16) - (collide-shape-prim-method-17 () none 17) ;; (unused-17 () none 17) - (collide-shape-prim-method-18 () none 18) ;; (collide-with-collide-cache-prim-mesh (_type_ collide-shape-intersect collide-cache-prim) none 18) - (collide-shape-prim-method-19 () none 19) ;; (collide-with-collide-cache-prim-sphere (_type_ collide-shape-intersect collide-cache-prim) none 19) + (debug-draw (_type_) none 9) + (add-fg-prim-using-box () none 10) + (add-fg-prim-using-line-sphere () none 11) + (overlaps-others-test (_type_ overlaps-others-params collide-shape-prim) symbol 12) + (overlaps-others-group (_type_ overlaps-others-params collide-shape-prim-group) symbol 13) + (collide-shape-prim-method-14 () none 14) + (collide-with-collide-cache-prim-mesh (_type_ collide-query collide-cache-prim) none 15) + (collide-with-collide-cache-prim-sphere (_type_ collide-query collide-cache-prim) none 16) + (on-platform-test (_type_ collide-shape-prim collide-query float) none 17) + (should-push-away-test (_type_ collide-shape-prim collide-query) none 18) + (should-push-away-a-group-test (_type_ collide-shape-prim-group collide-query) none 19) ) ) @@ -16124,7 +16128,7 @@ (event-self symbol :offset-assert 152) (event-other symbol :offset-assert 156) (root-prim collide-shape-prim :offset-assert 160) - (riders pointer :offset-assert 164) ;; no + (riders (inline-array collide-rider) :offset-assert 164) ;; no (penetrate-using penetrate :offset-assert 168) (penetrated-by penetrate :offset-assert 176) (backup-collide-as collide-spec :offset-assert 184) @@ -16138,72 +16142,97 @@ ;; Failed to read fields. (:methods (new (symbol type process-drawable collide-list-enum) _type_ 0) - (move-by-vector! (_type_ vector) none 28) ;; (move-by-vector! (_type_ vector) none 28) - (collide-shape-method-29 (_type_ vector) none 29) ;; (alloc-riders (_type_ int) none 29) - (collide-shape-method-30 () none 30) ;; (move-to-point! (_type_ vector) none 30) - (collide-shape-method-31 () none 31) ;; (debug-draw (_type_) none 31) - (collide-shape-method-32 (_type_ vector collide-query meters) none 32) ;; (fill-cache-for-shape! (_type_ float collide-kind) none 32) - (collide-shape-method-33 () none 33) ;; (fill-cache-integrate-and-collide! (_type_ vector collide-kind) none 33) - (collide-shape-method-34 () none 34) ;; (find-prim-by-id (_type_ uint) collide-shape-prim 34) - (collide-shape-method-35 () none 35) ;; (detect-riders! (_type_) symbol 35) - (collide-shape-method-36 () none 36) ;; (build-bounding-box-for-shape (_type_ bounding-box float collide-kind) symbol 36) - (collide-shape-method-37 (_type_ vector) none 37) ;; (integrate-and-collide! (_type_ vector) none 37) - (collide-shape-method-38 () none 38) ;; (find-collision-meshes (_type_) symbol 38) - (collide-shape-method-39 () none 39) ;; (on-platform (_type_ collide-shape collide-overlap-result) symbol 39) - (find-overlapping-shapes (_type_ overlaps-others-params) symbol 40) ;; (find-overlapping-shapes (_type_ overlaps-others-params) symbol 40) - (collide-shape-method-41 () none 41) ;; (dummy-41 (_type_ attack-info float) vector 41) - (collide-shape-method-42 () none 42) ;; (should-push-away (_type_ collide-shape collide-overlap-result) symbol 42) - (collide-shape-method-43 () none 43) ;; (pull-rider! (_type_ pull-rider-info) none 43) - (collide-shape-method-44 () none 44) ;; (pull-riders! (_type_) symbol 44) - (collide-shape-method-45 () none 45) ;; (do-push-aways! (_type_) symbol 45) - (collide-shape-method-46 (_type_) none 46) ;; (set-root-prim! (_type_ collide-shape-prim) collide-shape-prim 46) - (set-collide-with! (_type_ collide-spec) none 47) ;; (update-transforms! (_type_) symbol 47) - (set-collide-as! (_type_ collide-spec) none 48) ;; (clear-collide-with-as (_type_) none 48) - (collide-shape-method-49 (_type_ int int int) none 49) ;; (restore-collide-with-as (_type_) none 49) - (collide-shape-method-50 (_type_ process object float float float) none 50) ;; (backup-collide-with-as (_type_) none 50) - (collide-shape-method-51 (_type_) none 51) ;; (set-root-prim-collide-with! (_type_ collide-kind) none 51) + (move-by-vector! (_type_ vector) none 28) + (move-to-point! (_type_ vector) none 29) + (debug-draw (_type_) none 30) + (fill-cache-for-shape (_type_ float collide-query) none 31) + (fill-cache-integrate-and-collide (_type_ vector collide-query meters) none 32) + (find-prim-by-id (_type_ uint) collide-shape-prim 33) + (find-prim-by-id-logtest (_type_ uint) collide-shape-prim 34) + (detect-riders! (_type_) symbol 35) + (build-bounding-box-for-shape (_type_ bounding-box float collide-spec) symbol 36) + (integrate-and-collide! (_type_ vector) none 37) + (find-collision-meshes (_type_) none 38) + (on-platform (_type_ collide-shape collide-query) symbol 39) + (find-overlapping-shapes (_type_ overlaps-others-params) symbol 40) + (shove-to-closest-point-on-path (_type_ attack-info float) vector 41) + (should-push-away (_type_ collide-shape collide-query) symbol 42) + (pull-rider! (_type_ pull-rider-info) none 43) + (pull-riders! (_type_) symbol 44) + (do-push-aways (_type_) collide-spec 45) + (update-transforms (_type_) none 46) + (set-collide-with! (_type_ collide-spec) none 47) + (set-collide-as! (_type_ collide-spec) none 48) + (modify-collide-as! (_type_ int collide-spec collide-spec) none 49) + (send-shoves (_type_ process touching-shapes-entry float float float) symbol 50) + (above-ground? (_type_ collide-query vector object float float float) symbol 51) (water-info-init! "Initialize a [[water-info]] with the currently loaded regions." - (_type_ water-info collide-action) water-info 52) ;; (set-root-prim-collide-as! (_type_ collide-kind) none 52) - (collide-shape-method-53 (_type_) none 53) ;; (set-collide-kinds (_type_ int collide-kind collide-kind) none 53) - (collide-shape-method-54 (_type_) none 54) ;; (set-collide-offense (_type_ int collide-offense) none 54) + (_type_ water-info collide-action) water-info 52) + (iterate-prims (_type_ (function collide-shape-prim none)) none 53) + (pusher-init (_type_) none 54) ) ) -(defenum cshape-moving-flags + +#| +(defenum collide-status :bitfield #t :type uint64 (on-surface 0) (on-ground 1) - (t-surface 2) - (t-wall 3) - (t-ceil 4) - (t-act 5) - (csmf06) - (csmf07) - (csmf08) - (csmf09) + (touch-surface 2) + (touch-wall 3) + (touch-ceiling 4) + (touch-actor 5) + (on-special-surface 6) + (touch-edge 7) + (no-touch 8) + (blocked 9) (on-water 10) - (csmf11) - (csmf12) - (csmf13) - (csmf14) - (csmf15) - (csmf16) - (csmf17) - (csmf18) - (csmf19) - (csmf20) - (csmf21) - (csmf22) - (csmf23) - (csmf24) - (csmf25) - (csmf26) - (csmf27) - (csmf28) - (csmf29) + (impact-surface 11) + (touch-background 12) + (stuck 13) + (touch-ceiling-sticky 14) + (glance 15) + (probe-hit 16) ) + |# + +; (defenum cshape-moving-flags +; :bitfield #t +; :type uint64 +; (on-surface 0) +; (on-ground 1) +; (t-surface 2) +; (t-wall 3) +; (t-ceil 4) +; (t-act 5) +; (csmf06) +; (csmf07) +; (csmf08) +; (csmf09) +; (on-water 10) +; (csmf11) +; (csmf12) +; (csmf13) +; (csmf14) +; (csmf15) +; (csmf16) +; (csmf17) +; (csmf18) +; (csmf19) +; (csmf20) +; (csmf21) +; (csmf22) +; (csmf23) +; (csmf24) +; (csmf25) +; (csmf26) +; (csmf27) +; (csmf28) +; (csmf29) +; ) (defenum cshape-reaction-flags :bitfield #t @@ -16242,23 +16271,45 @@ (csrf31) ) +(defenum collide-status + :bitfield #t + :type uint64 + (on-surface 0) + (on-ground 1) + (touch-surface 2) + (touch-wall 3) + (touch-ceiling 4) + (touch-actor 5) + (on-special-surface 6) + (touch-edge 7) + (no-touch 8) + (blocked 9) + (on-water 10) + (impact-surface 11) + (touch-background 12) + (stuck 13) + (touch-ceiling-sticky 14) + (glance 15) + (probe-hit 16) + ) + (declare-type collide-query structure) (declare-type control-info basic) (deftype collide-shape-moving (collide-shape) ((rider-time time-frame :offset-assert 200) (rider-last-move vector :inline :offset-assert 208) (trans-old vector :inline :offset-assert 224) - (csm-unk-vec-981i2u312 vector :inline :offset 240) - (csm-unk-vec-klj1n23 vector :inline :offset 256) + (trans-old-old vector :inline :offset 240) + (trans-old-old-old vector :inline :offset 256) (poly-pat pat-surface :offset 272) (cur-pat pat-surface :offset-assert 276) (ground-pat pat-surface :offset-assert 280) - (status cshape-moving-flags :offset-assert 288) - (old-status cshape-moving-flags :offset-assert 296) - (prev-status cshape-moving-flags :offset-assert 304) + (status collide-status :offset-assert 288) + (old-status collide-status :offset-assert 296) + (prev-status collide-status :offset-assert 304) (reaction-flag cshape-reaction-flags :offset-assert 312) - (reaction (function control-info collide-query vector vector cshape-moving-flags) :offset-assert 316) - (no-reaction function :offset-assert 320) + (reaction (function control-info collide-query vector vector collide-status) :offset-assert 316) + (no-reaction (function collide-shape-moving collide-query vector vector object) :offset-assert 320) (local-normal vector :inline :offset-assert 336) (surface-normal vector :inline :offset-assert 352) (poly-normal vector :inline :offset-assert 368) @@ -16279,18 +16330,18 @@ :flag-assert #x44000001dc (:methods (new (symbol type process-drawable collide-list-enum) _type_ 0) - (collide-shape-moving-method-55 (_type_ collide-query collide-spec float float float) symbol 55) - (collide-shape-moving-method-56 (_type_ pat-surface) none 56) ;; (set-and-handle-pat! (_type_ pat-surface) none 56) - (collide-shape-moving-method-57 () none 57) ;; (integrate-no-collide! (_type_ vector) none 57) - (collide-shape-moving-method-58 (_type_ vector overlaps-others-params) symbol 58) ;; (dummy-58 (_type_ vector) symbol 58) - (collide-shape-moving-method-59 () none 59) ;; (integrate-for-enemy-with-move-to-ground! (_type_ vector collide-kind float symbol symbol symbol) none 59) - (collide-shape-moving-method-60 () none 60) ;; (move-to-ground (_type_ float float symbol collide-kind) symbol 60) - (collide-shape-moving-method-61 () none 61) ;; (move-to-ground-point! (_type_ vector vector vector) none 61) - (compute-acc-due-to-gravity (_type_ vector float) vector 62) ;; (compute-acc-due-to-gravity (_type_ vector float) vector 62) - (collide-shape-moving-method-63 () none 63) ;; (step-collison! (_type_ vector vector float) float 63) - (collide-shape-moving-method-64 () none 64) ;; (move-to-tri! (_type_ collide-tri-result vector) none 64) - (collide-shape-moving-method-65 (_type_ vector float float float) symbol 65) - (collide-shape-moving-method-66 () none 66) + (find-ground (_type_ collide-query collide-spec float float float) symbol 55) + (react-to-pat! (_type_ pat-surface) none 56) + (integrate-no-collide! (_type_ vector) none 57) + (integrate-for-enemy-no-mtg (_type_ vector overlaps-others-params) symbol 58) + (move-above-ground (_type_ vector move-above-ground-params) none 59) + (move-to-ground (_type_ float float symbol collide-spec) none 60) + (move-to-ground-point (_type_ vector vector vector) none 61) + (compute-acc-due-to-gravity (_type_ vector float) vector 62) + (collide-shape-moving-method-63 () none 63) ;; ( 63) + (try-snap-to-surface (_type_ vector float float float) symbol 64) + (fill-and-try-snap-to-surface (_type_ vector float float float collide-query) symbol 65) + (step-collison! (_type_ vector vector float int) float 66) (collide-shape-moving-method-67 () none 67) ) ) @@ -16653,7 +16704,9 @@ (unknown-float02 float :offset 456) ;; logic-target::target-print-stats (unknown-float03 float :offset 460) ;; logic-target::target-print-stats (unknown-vector00 vector :inline :offset 480) ;; logic-target::reverse-conversions - (unknown-vector01 vector :inline :offset 496) ;; logic-target::add-thrust + + ;; the desired velocity + (target-transv vector :inline :offset 496) ;; logic-target::add-thrust (unknown-vector02 vector :inline :offset 512) ;; logic-target::reset-target-state ;; the quaternion used for all the control code. @@ -16678,11 +16731,25 @@ (unknown-vector-array00 vector 128 :inline :offset 640) ;; logic-target::target-log-trans (unknown-time-frame-array00 time-frame 128 :offset 2688) ;; logic-target::target-log-trans (unknown-word00 int32 :offset 3712) ;; logic-target::target-log-trans - (unknown-vector04 vector :inline :offset 3728) ;; logic-target::target-no-ja-move-post - (unknown-vector05 vector :inline :offset 3744) ;; logic-target::target-no-ja-move-post - (unknown-vector06 vector :inline :offset 3760) ;; target::mod-var-jump - (unknown-vector07 vector :inline :offset 3776) ;; logic-target::target-no-ja-move-post - (unknown-vector000 vector :inline :offset 3792) ;; target-handler::target-exit + + ;; offset applied to drawing, separate from collision or anything else + ;; this should be filled out by the control code. + (draw-offset vector :inline :offset 3728) ;; logic-target::target-no-ja-move-post + + ;; drawing cspace offset, contains both draw-offset, and the collide-offset anim trick + (cspace-offset vector :inline :offset 3744) ;; logic-target::target-no-ja-move-post + + ;; offset to apply to collision geom from animation. specified in the animation frame + (anim-collide-offset-local vector :inline :offset 3760) ;; target::mod-var-jump + + ;; same offset as above, in the world + (anim-collide-offset-world vector :inline :offset 3776) ;; logic-target::target-no-ja-move-post + + ;; the offset from the previous frame. + (old-anim-collide-offset-world vector :inline :offset 3792) ;; target-handler::target-exit + + ;; how much this changed from frame to frame. + (anim-collide-offset-delta-world vector :inline :offset 3808) (unknown-dynamics00 dynamics :offset 3824) ;; logic-target::reset-target-state (unknown-surface00 surface :offset 3828) ;; logic-target::target-print-stats (unknown-surface01 surface :offset 3832) ;; board-h::want-to-board? @@ -16708,7 +16775,9 @@ (unknown-dword01 int64 :offset 4104) ;; logic-target::read-pad (unknown-matrix00 matrix :inline :offset 4112) ;; logic-target::build-conversions (unknown-matrix01 matrix :inline :offset 4176) ;; logic-target::reverse-conversions - (unknown-matrix02 matrix :inline :offset 4240) ;; logic-target::joint-points + + ;; rotate from "control frame" to world frame. + (ctrl-orientation matrix :inline :offset 4240) ;; logic-target::joint-points (unknown-vector14 vector :inline :offset 4320) ;; logic-target::pre-collide-setup (unknown-vector15 vector :inline :offset 4336) ;; logic-target::reset-target-state (unknown-matrix03 matrix :inline :offset 4352) ;; logic-target::read-pad @@ -16718,7 +16787,7 @@ (unknown-floatiujh1bnb2n3i1 float :offset 4452) ;; target-death::velocity-set-to-target! (unknown-float15 float :offset 4456) ;; logic-target::target-real-post (unknown-word01 int32 :offset 4460) ;; logic-target::joint-points - (unknown-vector17 vector :inline :offset 4464) ;; logic-target::pre-collide-setup + (collide-extra-velocity vector :inline :offset 4464) ;; logic-target::pre-collide-setup (unknown-vector18 vector :inline :offset 4480) ;; logic-target::pre-collide-setup (unknown-time-frame03 time-frame :offset 4496) ;; logic-target::pre-collide-setup (unknown-time-frame04 time-frame :offset 4504) ;; logic-target::pre-collide-setup @@ -16727,7 +16796,9 @@ (unknown-vector21 vector :inline :offset 4544) ;; logic-target::target-print-stats (unknown-float16 float :offset 4548) ;; logic-target::target-print-stats (unknown-vector22 vector :inline :offset 4560) ;; logic-target::target-update-ik - (unknown-vector23 vector :inline :offset 4576) ;; logic-target::flag-setup + + ;; the last safe ground (got on-surf flag) + (last-trans-on-surf vector :inline :offset 4576) ;; logic-target::flag-setup (unknown-time-frame05 time-frame :offset 4624) ;; board-h::want-to-board? (unknown-float0000 float :offset 4632) ;; target-util::can-duck? (unknown-float17 float :offset 4636) ;; logic-target::target-print-stats @@ -16752,8 +16823,20 @@ (unknown-float002 float :offset 4804) ;; target-gun::target-gun-joint-pre (unknown-time-frame08 time-frame :offset 4816) ;; logic-target::turn-around? (unknown-vector26 vector :inline :offset 4928) ;; logic-target::target-add-slide-factor - (unknwon-vector27 vector :inline :offset 4976) ;; logic-target::add-thrust - (unknown-float27 float :offset 4992) ;; logic-target::wall-hide? + + ;; this is a bit weird + ;; I believe it's supposed to set the velocity of jak when he first becomes blocked. + ;; this gets set in two ways: + ;; - first, it's set to the pre-collide velocity if jak isn't blocked and is on a surface, but only if this makes it larger. + ;; - second, it gets limited to be in the same direction, and no faster than the command. + (btransv vector :inline :offset 4976) ;; logic-target::add-thrust + + ;; number which goes toward 1 as jak is blocked by a wall (blocked means that the wall is preventing velocity) + (blocked-factor float :offset 4992) ;; logic-target::wall-hide? + + ;; number which goes toward 1 as jak is blocked by a wall, and has surface mode air. + (blocked-in-air-factor float :offset 4996) + (unknown-time-frame09 time-frame :offset 5000) ;; logic-target::add-thrust (unknown-sphere-array00 collide-shape-prim-sphere 10 :offset 5016) ;; (method 28 target) (unknown-word02 int32 :offset 5064) ;; (enter target-roll) @@ -16849,8 +16932,10 @@ (unknown-time-frame26 time-frame :offset 6248) ;; logic-target::target-calc-camera-pos (unknown-time-frame27 time-frame :offset 6256) ;; logic-target::target-calc-camera-pos (unknown-dword11 int64 :offset 6264) ;; logic-target::reset-target-state - (unknown-vector44 vector :inline :offset 6272) ;; (code target-roll-flip) - (unknown-float44 float :offset 6288) ;; (code target-roll-flip) + + ;; the xz velocity from align. + (align-xz-vel vector :inline :offset 6272) ;; (code target-roll-flip) + (zx-vel-frac float :offset 6288) ;; (code target-roll-flip) (unknown-sound-id04 sound-id :offset 6292) ;; (method 28 target) (unknown-float45 float :offset 6296) ;; powerups::target-powerup-process (unknown-word08 int32 :offset 6300) ;; (method 28 target) @@ -18201,8 +18286,8 @@ :size-assert #x30 :flag-assert #xb00000030 (:methods - (collide-cache-prim-method-9 () none 9) ;; (resolve-moving-sphere-tri (_type_ collide-tri-result collide-prim-core vector float collide-action) float 9) - (collide-cache-prim-method-10 () none 10) ;; (resolve-moving-sphere-sphere (_type_ collide-tri-result collide-prim-core vector float collide-action) float 10) + (resolve-moving-sphere-tri (_type_ collide-tri-result collide-prim-core vector float collide-action) float 9) + (resolve-moving-sphere-sphere (_type_ collide-tri-result collide-prim-core vector float collide-action) float 10) ) ) @@ -18228,7 +18313,7 @@ :size-assert #x8670 :flag-assert #x1a00008670 (:methods - (collide-cache-method-9 () none 9) ;; (debug-draw (_type_) none 9) + (debug-draw (_type_) none 9) (fill-and-probe-using-line-sphere (_type_ collide-query) float 10) (fill-and-probe-using-spheres (_type_ collide-query) symbol 11) (fill-using-bounding-box (_type_ collide-query) none 12) ;; (fill-and-probe-using-y-probe (_type_ vector float collide-kind process-drawable collide-tri-result pat-surface) float 12) @@ -18300,7 +18385,7 @@ (spheres (inline-array sphere) :offset 112 :score 1) (num-spheres uint32 :offset 116) (solid-only symbol :offset 120) - (best-dist float :offset 112 :score -1) + (best-dist float :offset 112 :score 2) (best-other-prim basic :offset 116) (best-my-prim collide-shape-prim :offset 120 :score 1) (move-vec vector :inline :offset 224) @@ -18329,6 +18414,15 @@ (vec vector :inline)) ) +(deftype do-push-aways-work (structure) + "Added" + ((cquery collide-query :inline) + (push-vel vector :inline) + (vec33 vector :inline :offset 560) + (cspec collide-spec :offset 576) + ) + ) + (define-extern *collide-test-flag* symbol) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -22543,7 +22637,7 @@ (:methods (spatial-hash-method-34 (_type_ vector hash-object-info) int 34) (spatial-hash-method-35 (_type_) none 35) - (spatial-hash-method-36 (_type_ sphere (pointer collide-shape) int) int 36) + (fill-actor-list-for-sphere (_type_ sphere (pointer collide-shape) int) int 36) (spatial-hash-method-37 (_type_) none 37) (spatial-hash-method-38 (_type_) none 38) (spatial-hash-method-39 (_type_ object hash-object-info) none 39) @@ -23380,27 +23474,6 @@ ;; history ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defenum collide-status - :bitfield #t - :type uint64 - (on-surface 0) - (on-ground 1) - (touch-surface 2) - (touch-wall 3) - (touch-ceiling 4) - (touch-actor 5) - (on-special-surface 6) - (touch-edge 7) - (no-touch 8) - (blocked 9) - (on-water 10) - (impact-surface 11) - (touch-background 12) - (stuck 13) - (touch-ceiling-sticky 14) - (glance 15) - (probe-hit 16) - ) (defenum history-channel :type uint8 @@ -26332,17 +26405,17 @@ ;; collide-shape ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern find-ground-point function) ;; (function control-info vector float float vector) -;; (define-extern target-attack-up function) ;; (function target symbol symbol none) +(define-extern find-ground-point (function control-info vector float float vector)) +(define-extern target-attack-up (function target symbol symbol none)) (define-extern collide-shape-moving-angle-set! (function collide-shape-moving vector vector none)) (define-extern cshape-reaction-update-state (function control-info collide-query vector none)) -(define-extern cshape-reaction-default (function control-info collide-query vector vector cshape-moving-flags)) -(define-extern cshape-reaction-just-move (function control-info collide-query vector cshape-moving-flags)) +(define-extern cshape-reaction-default (function control-info collide-query vector vector collide-status)) +(define-extern cshape-reaction-just-move (function control-info collide-query vector collide-status)) (define-extern collide-shape-draw-debug-marks (function none)) (define-extern *col-timer* stopwatch) (define-extern *frame-timer* stopwatch) (define-extern *col-timer-enable* symbol) -;; (define-extern debug-report-col-stats function) ;; (function int) +(define-extern debug-report-col-stats (function int)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; collide-shape-rider ;; @@ -28224,7 +28297,7 @@ (define-extern poly-find-nearest-edge (function vector (inline-array vector) vector vector vector)) ;; (define-extern target-collision-low-coverage function) ;; (function control-info collide-shape-intersect vector (pointer uint32) (pointer uint64) (pointer symbol) uint) -(define-extern target-collision-reaction (function control-info collide-query vector vector cshape-moving-flags)) ;; (function control-info collide-shape-intersect vector vector cshape-moving-flags) +(define-extern target-collision-reaction (function control-info collide-query vector vector collide-status)) ;; (function control-info collide-shape-intersect vector vector collide-status) (define-extern target-collision-no-reaction (function control-info collide-query vector vector none)) ;; (function control-info collide-shape-intersect vector vector none) (define-extern *collide-edge-board-spec* collide-edge-spec) (define-extern rail-surface-touch (function none)) @@ -28488,7 +28561,7 @@ (define-extern cshape-reaction-projectile "A projectile's collision reaction -- if the projectile hits a material with [[pat-material::stopproj]] set, kill the projectile" - (function control-info collide-query vector vector cshape-moving-flags)) + (function control-info collide-query vector vector collide-status)) (define-extern projectile-event-handler (function process int symbol event-message-block projectile :behavior projectile)) (define-extern projectile-move-fill-all-dirs (function projectile none)) (define-extern projectile-move-fill-line-sphere (function projectile none)) @@ -28498,7 +28571,7 @@ (define-extern projectile-bounce-update-velocity (function projectile-bounce none :behavior projectile)) (define-extern projectile-bounce-falling-post (function projectile-bounce none :behavior projectile-bounce)) (define-extern projectile-bounce-move (function projectile-bounce none)) -(define-extern projectile-bounce-reaction (function control-info collide-query vector vector cshape-moving-flags)) +(define-extern projectile-bounce-reaction (function control-info collide-query vector vector collide-status)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; target-handler ;; @@ -28797,7 +28870,7 @@ (define-extern target-gun-fire-blue (function (pointer process) :behavior target)) (define-extern gun-blue-shot-move (function gun-blue-shot none)) -(define-extern cshape-reaction-blue-shot (function control-info collide-query vector vector cshape-moving-flags)) +(define-extern cshape-reaction-blue-shot (function control-info collide-query vector vector collide-status)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; gun-yellow-shot ;; diff --git a/decompiler/config/jak2/hacks.jsonc b/decompiler/config/jak2/hacks.jsonc index 987a27b2d9..1ba7938340 100644 --- a/decompiler/config/jak2/hacks.jsonc +++ b/decompiler/config/jak2/hacks.jsonc @@ -100,10 +100,6 @@ "shadow-add-double-tris", "shadow-add-double-edges", "(method 17 collide-edge-work)", - "(method 42 collide-shape)", - "(method 12 collide-shape-prim-sphere)", - "(method 12 collide-shape-prim-mesh)", - "(method 18 collide-shape-prim-mesh)", "(method 10 collide-cache-prim)", "(method 17 collide-cache)", "(method 16 ocean)", @@ -376,7 +372,20 @@ "(method 13 collide-cache)": [7, 9], "(method 11 collide-mesh)": [2, 4], "(method 12 collide-mesh-cache)": [0, 1, 2, 3, 4, 5], - "(method 10 collide-mesh)": [2] + "(method 10 collide-mesh)": [2], + "(method 42 collide-shape)": [0, 1, 2, 3, 4, 7], + "(method 18 collide-shape-prim-mesh)": [2, 3, 4, 5, 6, 7], + "(method 18 collide-shape-prim-sphere)": [2, 3, 4], + "(method 15 collide-shape-prim-sphere)": [1, 2, 3, 4, 5, 6], + "(method 16 collide-shape-prim-sphere)": [0, 1, 2, 3, 4], + "(method 36 collide-shape)": [8, 9], + "(method 45 collide-shape)": [33], + "(method 40 collide-shape)": [ + 0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32], + "(method 12 collide-shape-prim-group)": [1, 2, 3, 4, 5, 6], + "(method 13 collide-shape-prim)": [1, 2, 3, 4, 5, 6], + "(method 12 collide-shape-prim-sphere)": [1, 2, 3, 4, 5, 8, 10, 11, 13, 14, 15], + "(method 12 collide-shape-prim-mesh)": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16] }, // Sometimes the game might use format strings that are fetched dynamically, diff --git a/decompiler/config/jak2/label_types.jsonc b/decompiler/config/jak2/label_types.jsonc index 65a880dda4..54ee4c5135 100644 --- a/decompiler/config/jak2/label_types.jsonc +++ b/decompiler/config/jak2/label_types.jsonc @@ -499,5 +499,18 @@ ["L648", "uint64", true], ["L565", "uint64", true], ["L567", "uint64", true] + ], + "collide-shape": [ + ["L383", "attack-info"], + ["L382", "attack-info"], + ["L381", "attack-info"], + ["L380", "vector"], + ["L379", "attack-info"], + ["L378", "attack-info"], + ["L377", "attack-info"], + ["L376", "attack-info"], + ["L375", "attack-info"], + ["L372", "vector"], + ["L365", "attack-info"] ] } diff --git a/decompiler/config/jak2/stack_structures.jsonc b/decompiler/config/jak2/stack_structures.jsonc index 15933bd770..479e8457cb 100644 --- a/decompiler/config/jak2/stack_structures.jsonc +++ b/decompiler/config/jak2/stack_structures.jsonc @@ -1151,6 +1151,26 @@ [32, "vector"] ], "(method 67 ocean)": [[16, "vector"]], + "(method 18 collide-shape-prim-mesh)": [ + [16, "collide-tri-result"] + ], + "(method 15 collide-shape-prim-sphere)": [ + [16, "collide-tri-result"]], + "target-attack-up": [ + [16, "event-message-block"] + ], + "(method 37 control-info)": [ + [48, "vector"] + ], + "(method 45 collide-shape)": [ + [16, "do-push-aways-work"] + ], + "(method 50 collide-shape)": [ + [32, "vector"] + ], + "(method 44 collide-shape)": [ + [16, "pull-rider-info"] + ], // placeholder "placeholder-do-not-add-below": [], "(method 25 guard-shot)": [[32, "vector"]], diff --git a/decompiler/config/jak2/type_casts.jsonc b/decompiler/config/jak2/type_casts.jsonc index fce5ec492a..fe8302d59a 100644 --- a/decompiler/config/jak2/type_casts.jsonc +++ b/decompiler/config/jak2/type_casts.jsonc @@ -4525,6 +4525,78 @@ [[382, 421], "v1", "(inline-array vector4w)"] ], "(method 90 ocean)": [[0, "a2", "(pointer int32)"]], + "(method 18 collide-shape-prim-group)": [ + [[3, 32], "s4", "collide-shape-prim"] + ], + "(method 19 collide-shape-prim)": [ + [[3, 32], "s4", "collide-shape-prim"] + ], + "collide-shape-draw-debug-marks": [ + [24, "v1", "connection"], + [[24, 41], "a0", "collide-shape"], + [56, "v1", "connection"], + [[56, 70], "a0", "collide-shape"], + [88, "v1", "connection"], + [[88, 104], "a0", "collide-shape"] + ], + "(method 18 collide-shape-prim-sphere)": [ + [79, "s4", "collide-shape-prim-mesh"] + ], + "(method 56 collide-shape-moving)": [ + [68, "a0", "process-focusable"], + [153, "a0", "process-focusable"] + ], + "(method 66 collide-shape-moving)": [ + [[29, 58], "s0", "collide-cache-prim"] + ], + "(method 36 collide-shape)": [ + [[1, 40], "v1", "collide-shape-prim"] + ], + "(method 38 collide-shape)": [ + [[42, 80], "s5", "collide-shape-prim-mesh"], + [34, "v0", "(array collide-mesh)"] + ], + "(method 45 collide-shape)": [ + [28, "a0", "connection"], + [29, "a0", "collide-shape"], + [79, "a0", "connection"], + [80, "a0", "collide-shape-moving"], + [[224, 235], "s1", "collide-shape-moving"] + ], + "(method 40 collide-shape)": [ + [30, "a0", "connection"], + [31, "a0", "collide-shape"], + [79, "a0", "connection"], + [80, "a0", "collide-shape-moving"], + [156, "s4", "(pointer uint64)"] + ], + "(method 12 collide-shape-prim-group)":[ + [[12, 43], "s4", "collide-shape-prim"] + ], + "(method 13 collide-shape-prim)":[ + [[12, 43], "s4", "collide-shape-prim"] + ], + "(method 12 collide-shape-prim-sphere)": [ + [17, "gp", "collide-shape-prim-mesh"] + ], + "(method 50 collide-shape)": [ + [[30, 100], "gp", "process-focusable"] + ], + "cshape-reaction-update-state": [ + ["_stack_", 56, "collide-status"] + ], + "(method 17 collide-shape-prim-mesh)": [ + [[6, 11], "s2", "collide-shape-prim-group"] + ], + "(method 35 collide-shape)": [ + [27, "a0", "connection"], + [28, "a0", "collide-shape"], + [76, "a0", "connection"], + [77, "a0", "collide-shape"] + ], + "(method 44 collide-shape)": [ + [25, "a0", "process-drawable"] + ], // placeholder "placeholder-do-not-add-below": [], "(method 38 guard-lazer-shot)": [[[33, 37], "a0", "process-focusable"]], diff --git a/decompiler/config/jak2/var_names.jsonc b/decompiler/config/jak2/var_names.jsonc index 3ee8d3ec58..71625a0086 100644 --- a/decompiler/config/jak2/var_names.jsonc +++ b/decompiler/config/jak2/var_names.jsonc @@ -2142,5 +2142,49 @@ }, "(method 21 ocean)": { "args": ["obj", "corner-x", "corner-z"] + }, + "(method 37 control-info)": { + "vars": { + "a1-6": "total-offset", + "a1-8": "bonus-vel", + "s2-0": "old-iter-cnt", + "s3-0": "old-in-vel", + "s4-0": "old-stat-flg", + "s3-1": "regular-vel", + "s4-1": "before-regular-vel", + "s1-0": "b1", + "s2-1": "a1", + "v1-32": "b1-nrm-to-grav", + "f0-7": "b1-nrm-to-grav-vel", + "f0-14": "ba-dot", + "v1-67": "align-xz-dir", + "f0-32": "align-xz-speed" + } + }, + "(method 54 collide-shape)": { + "vars": {"v1-3":"proc"} + }, + "(method 42 collide-shape)": { + "args": ["obj", "other", "cquery"] + }, + "(method 18 collide-shape-prim-group)": { + "args": ["obj", "other", "cquery"] + }, + "(method 19 collide-shape-prim)": { + "args": ["obj", "other", "cquery"] + }, + "(method 18 collide-shape-prim-mesh)": { + "args": ["obj", "other", "cquery"] + }, + "(method 18 collide-shape-prim-sphere)": { + "args": ["obj", "other", "cquery"] + }, + "(method 64 collide-shape-moving)": { + "args":["obj", "vel", "check-dist", "amt", "bounce-dist"], + "vars": { + "gp-0":"initial-trans", + "s2-0":"collide-vel", + "s1-1":"vel-dir" + } } } diff --git a/decompiler/config/jak2_ntsc_v1.jsonc b/decompiler/config/jak2_ntsc_v1.jsonc index 67bb375880..ab2695a415 100644 --- a/decompiler/config/jak2_ntsc_v1.jsonc +++ b/decompiler/config/jak2_ntsc_v1.jsonc @@ -7,7 +7,7 @@ // if you want to filter to only some object names. // it will make the decompiler much faster. - "allowed_objects": ["crimson-guard-level"], + "allowed_objects": [], "banned_objects": ["effect-control", "ctywide-scenes", "texture-anim-tables", "traffic-engine"], //////////////////////////// diff --git a/goal_src/jak2/engine/anim/fma-sphere.gc b/goal_src/jak2/engine/anim/fma-sphere.gc index e23499af7c..c1d398026d 100644 --- a/goal_src/jak2/engine/anim/fma-sphere.gc +++ b/goal_src/jak2/engine/anim/fma-sphere.gc @@ -121,7 +121,7 @@ (.svf (&-> a0-12 quad) vf1) ) ) - (collide-shape-method-29 (-> self root-override) gp-0) + (move-to-point! (-> self root-override) gp-0) (set! (-> self danger sphere x) (-> gp-0 x)) (set! (-> self danger sphere y) (-> gp-0 y)) (set! (-> self danger sphere z) (-> gp-0 z)) diff --git a/goal_src/jak2/engine/collide/collide-cache-h.gc b/goal_src/jak2/engine/collide/collide-cache-h.gc index 5fd93f501c..0775291c60 100644 --- a/goal_src/jak2/engine/collide/collide-cache-h.gc +++ b/goal_src/jak2/engine/collide/collide-cache-h.gc @@ -70,8 +70,8 @@ :size-assert #x30 :flag-assert #xb00000030 (:methods - (collide-cache-prim-method-9 () none 9) - (collide-cache-prim-method-10 () none 10) + (resolve-moving-sphere-tri (_type_ collide-tri-result collide-prim-core vector float collide-action) float 9) + (resolve-moving-sphere-sphere (_type_ collide-tri-result collide-prim-core vector float collide-action) float 10) ) ) @@ -94,7 +94,7 @@ :size-assert #x8670 :flag-assert #x1a00008670 (:methods - (collide-cache-method-9 () none 9) + (debug-draw (_type_) none 9) (fill-and-probe-using-line-sphere (_type_ collide-query) float 10) (fill-and-probe-using-spheres (_type_ collide-query) symbol 11) (fill-using-bounding-box (_type_ collide-query) none 12) @@ -116,8 +116,8 @@ (deftype collide-list-item (structure) - ((mesh instance-tie :offset-assert 0) - (inst basic :offset-assert 4) + ((mesh instance-tie :offset-assert 0) + (inst basic :offset-assert 4) ) :pack-me :method-count-assert 9 @@ -143,7 +143,3 @@ (define-perm *collide-list* collide-list (new 'global 'collide-list)) (kmemclose) - - - - diff --git a/goal_src/jak2/engine/collide/collide-h.gc b/goal_src/jak2/engine/collide/collide-h.gc index cfff4763db..eed9767502 100644 --- a/goal_src/jak2/engine/collide/collide-h.gc +++ b/goal_src/jak2/engine/collide/collide-h.gc @@ -10,46 +10,45 @@ ;; DECOMP BEGINS (deftype collide-query (structure) - ((best-other-tri collide-tri-result :inline :offset-assert 0) - (best-my-tri collide-tri-result :inline :offset 0) - (ignore-processes process-tree 2 :offset-assert 88) - (ignore-process0 process-tree :offset 88) - (ignore-process1 process-tree :offset 92) - (ignore-pat pat-surface :offset-assert 96) - (ignore-pat-s32 int32 :offset 96) - - (collide-with collide-spec :offset-assert 100) - (collide-with-s32 int32 :offset 100) - (overlay-params uint32 3 :offset 112) ;; ? - (bbox bounding-box :inline :offset-assert 128) - (bbox4w bounding-box4w :inline :offset-assert 160) - (bsphere sphere :inline :offset-assert 192) - (start-pos vector :inline :offset-assert 208) - (move-dist vector :inline :offset-assert 224) - (rlength vector :inline :offset-assert 240) - (exit-planes plane 2 :inline :offset-assert 256) ;; ? - (radius float :offset 268) - (inv-mat matrix :inline :offset 288) - (spheres (inline-array sphere) :offset 112 :score 1) - (num-spheres uint32 :offset 116) - (solid-only symbol :offset 120) - (best-dist float :offset 112 :score -1) - (best-other-prim basic :offset 116) - (best-my-prim collide-shape-prim :offset 120 :score 1) - (move-vec vector :inline :offset 224) - (best-u float :offset 112 :score -1) - (action-mask collide-action :offset-assert 352) - (local-box4w bounding-box4w :inline :offset-assert 368) - (search-box bounding-box4w :inline :offset-assert 400) - (search-vector vector4w :inline :offset-assert 432) - (instance-mat matrix :inline :offset-assert 448) - (instance-ptr basic :offset-assert 512) - (x-addr uint32 :offset-assert 516) - (x-step uint32 :offset-assert 520) - (y-addr uint32 :offset-assert 524) - (y-step uint32 :offset-assert 528) - (z-addr uint32 :offset-assert 532) - (z-step uint32 :offset-assert 536) + ((best-other-tri collide-tri-result :inline :offset-assert 0) + (best-my-tri collide-tri-result :inline :offset 0) + (ignore-processes process-tree 2 :offset-assert 88) + (ignore-process0 process-tree :offset 88) + (ignore-process1 process-tree :offset 92) + (ignore-pat pat-surface :offset-assert 96) + (ignore-pat-s32 int32 :offset 96) + (collide-with collide-spec :offset-assert 100) + (collide-with-s32 int32 :offset 100) + (overlay-params uint32 3 :offset 112) + (bbox bounding-box :inline :offset-assert 128) + (bbox4w bounding-box4w :inline :offset-assert 160) + (bsphere sphere :inline :offset-assert 192) + (start-pos vector :inline :offset-assert 208) + (move-dist vector :inline :offset-assert 224) + (rlength vector :inline :offset-assert 240) + (exit-planes plane 2 :inline :offset-assert 256) + (radius float :offset 268) + (inv-mat matrix :inline :offset 288) + (spheres (inline-array sphere) :offset 112) + (num-spheres uint32 :offset 116) + (solid-only symbol :offset 120) + (best-dist float :offset 112) + (best-other-prim basic :offset 116) + (best-my-prim collide-shape-prim :offset 120) + (move-vec vector :inline :offset 224) + (best-u float :offset 112) + (action-mask collide-action :offset-assert 352) + (local-box4w bounding-box4w :inline :offset-assert 368) + (search-box bounding-box4w :inline :offset-assert 400) + (search-vector vector4w :inline :offset-assert 432) + (instance-mat matrix :inline :offset-assert 448) + (instance-ptr basic :offset-assert 512) + (x-addr uint32 :offset-assert 516) + (x-step uint32 :offset-assert 520) + (y-addr uint32 :offset-assert 524) + (y-step uint32 :offset-assert 528) + (z-addr uint32 :offset-assert 532) + (z-step uint32 :offset-assert 536) ) :method-count-assert 9 :size-assert #x21c diff --git a/goal_src/jak2/engine/collide/collide-mesh-h.gc b/goal_src/jak2/engine/collide/collide-mesh-h.gc index f6593ef26d..12b286ad68 100644 --- a/goal_src/jak2/engine/collide/collide-mesh-h.gc +++ b/goal_src/jak2/engine/collide/collide-mesh-h.gc @@ -22,6 +22,7 @@ :flag-assert #x900000058 ) + (deftype collide-mesh-tri (structure) ((vertex-index uint8 3 :offset-assert 0) (unused uint8 :offset-assert 3) @@ -33,6 +34,7 @@ :flag-assert #x900000008 ) + (deftype collide-mesh (basic) ((joint-id int32 :offset-assert 4) (num-tris uint32 :offset-assert 8) @@ -54,6 +56,7 @@ ) ) + (deftype collide-mesh-cache-tri (structure) ((vertex vector 3 :inline :offset-assert 0) (normal vector :inline :offset-assert 48) @@ -65,6 +68,7 @@ :flag-assert #x900000060 ) + (deftype collide-mesh-cache-entry (structure) ((mat matrix :inline :offset-assert 0) (tris collide-mesh-cache-tri :inline :dynamic :offset-assert 64) @@ -74,6 +78,7 @@ :flag-assert #x900000040 ) + (deftype collide-mesh-cache (basic) ((used-size uint32 :offset-assert 4) (max-size uint32 :offset-assert 8) @@ -84,7 +89,7 @@ :size-assert #xbb90 :flag-assert #xd0000bb90 (:methods - (populate-for-prim-mesh (_type_ collide-shape-prim-mesh) none 9) + (populate-for-prim-mesh (_type_ collide-shape-prim-mesh) collide-mesh-cache-entry 9) (is-id? (_type_ int) symbol 10) (next-id! (_type_) uint 11) (allocate! (_type_ int) collide-mesh-cache-entry 12) @@ -120,11 +125,11 @@ (kmemopen global "collide-mesh-cache") (define-perm *collide-mesh-cache* collide-mesh-cache (new 'global 'collide-mesh-cache)) + (set! (-> *collide-mesh-cache* id) (the-as uint 1)) + (set! (-> *collide-mesh-cache* used-size) (the-as uint 0)) + (set! (-> *collide-mesh-cache* max-size) (the-as uint #xbb80)) + (kmemclose) - - - - diff --git a/goal_src/jak2/engine/collide/collide-mesh.gc b/goal_src/jak2/engine/collide/collide-mesh.gc index 05679097ea..699e1b2acc 100644 --- a/goal_src/jak2/engine/collide/collide-mesh.gc +++ b/goal_src/jak2/engine/collide/collide-mesh.gc @@ -357,8 +357,8 @@ ) ) ) + s4-0 ) - (none) ) (defmethod allocate! collide-mesh-cache ((obj collide-mesh-cache) (arg0 int)) diff --git a/goal_src/jak2/engine/collide/collide-shape-h.gc b/goal_src/jak2/engine/collide/collide-shape-h.gc index 05a4533433..76d29ae193 100644 --- a/goal_src/jak2/engine/collide/collide-shape-h.gc +++ b/goal_src/jak2/engine/collide/collide-shape-h.gc @@ -11,6 +11,9 @@ (declare-type touching-list structure) (declare-type collide-query structure) (declare-type water-info structure) +(declare-type collide-shape-prim-group basic) +(declare-type collide-cache-prim structure) +(declare-type collide-shape-prim basic) (defenum penetrate :bitfield #t @@ -241,6 +244,28 @@ (player) ) +(defenum collide-status + :bitfield #t + :type uint64 + (on-surface 0) + (on-ground 1) + (touch-surface 2) + (touch-wall 3) + (touch-ceiling 4) + (touch-actor 5) + (on-special-surface 6) + (touch-edge 7) + (no-touch 8) + (blocked 9) + (on-water 10) + (impact-surface 11) + (touch-background 12) + (stuck 13) + (touch-ceiling-sticky 14) + (glance 15) + (probe-hit 16) + ) + ;; +++nav-flags (defenum nav-flags :type uint8 @@ -250,34 +275,32 @@ ) ;; ---nav-flags -;; NOTE - for projectile -(define-extern cshape-reaction-default (function control-info collide-query vector vector cshape-moving-flags)) (define-extern cshape-reaction-update-state (function control-info collide-query vector none)) -(define-extern cshape-reaction-just-move (function control-info collide-query vector cshape-moving-flags)) +(define-extern cshape-reaction-default (function control-info collide-query vector vector collide-status)) +(define-extern cshape-reaction-just-move (function control-info collide-query vector collide-status)) ;; DECOMP BEGINS (deftype collide-rider (structure) - ((rider-handle handle :offset-assert 0) - (sticky-prim basic :offset-assert 8) - (prim-ry float :offset-assert 12) - (rider-local-pos vector :inline :offset-assert 16) + ((rider-handle handle :offset-assert 0) + (sticky-prim collide-shape-prim :offset-assert 8) + (prim-ry float :offset-assert 12) + (rider-local-pos vector :inline :offset-assert 16) ) :method-count-assert 9 :size-assert #x20 :flag-assert #x900000020 ) - (deftype collide-rider-pool (basic) - ((alloc-count int32 :offset-assert 4) - (riders collide-rider 20 :inline :offset-assert 16) + ((alloc-count int32 :offset-assert 4) + (riders collide-rider 20 :inline :offset-assert 16) ) :method-count-assert 11 :size-assert #x290 :flag-assert #xb00000290 (:methods - (collide-rider-pool-method-9 () none 9) + (add-rider (_type_ handle) collide-rider 9) (prepare (_type_) none 10) ) ) @@ -380,17 +403,17 @@ :flag-assert #x1400000050 (:methods (new (symbol type collide-shape uint int) _type_ 0) - (collide-shape-prim-method-9 () none 9) + (debug-draw (_type_) none 9) (add-fg-prim-using-box () none 10) (add-fg-prim-using-line-sphere () none 11) - (collide-shape-prim-method-12 () none 12) - (collide-shape-prim-method-13 () none 13) + (overlaps-others-test (_type_ overlaps-others-params collide-shape-prim) symbol 12) + (overlaps-others-group (_type_ overlaps-others-params collide-shape-prim-group) symbol 13) (collide-shape-prim-method-14 () none 14) - (collide-shape-prim-method-15 () none 15) - (collide-shape-prim-method-16 () none 16) - (collide-shape-prim-method-17 () none 17) - (collide-shape-prim-method-18 () none 18) - (collide-shape-prim-method-19 () none 19) + (collide-with-collide-cache-prim-mesh (_type_ collide-query collide-cache-prim) none 15) + (collide-with-collide-cache-prim-sphere (_type_ collide-query collide-cache-prim) none 16) + (on-platform-test (_type_ collide-shape-prim collide-query float) none 17) + (should-push-away-test (_type_ collide-shape-prim collide-query) none 18) + (should-push-away-a-group-test (_type_ collide-shape-prim-group collide-query) none 19) ) ) @@ -448,7 +471,7 @@ (event-self symbol :offset-assert 152) (event-other symbol :offset-assert 156) (root-prim collide-shape-prim :offset-assert 160) - (riders pointer :offset-assert 164) + (riders (inline-array collide-rider) :offset-assert 164) (penetrate-using penetrate :offset-assert 168) (penetrated-by penetrate :offset-assert 176) (backup-collide-as collide-spec :offset-assert 184) @@ -462,83 +485,83 @@ (:methods (new (symbol type process-drawable collide-list-enum) _type_ 0) (move-by-vector! (_type_ vector) none 28) - (collide-shape-method-29 (_type_ vector) none 29) - (collide-shape-method-30 () none 30) - (collide-shape-method-31 () none 31) - (collide-shape-method-32 (_type_ vector collide-query meters) none 32) - (collide-shape-method-33 () none 33) - (collide-shape-method-34 () none 34) - (collide-shape-method-35 () none 35) - (collide-shape-method-36 () none 36) - (collide-shape-method-37 (_type_ vector) none 37) - (collide-shape-method-38 () none 38) - (collide-shape-method-39 () none 39) + (move-to-point! (_type_ vector) none 29) + (debug-draw (_type_) none 30) + (fill-cache-for-shape (_type_ float collide-query) none 31) + (fill-cache-integrate-and-collide (_type_ vector collide-query meters) none 32) + (find-prim-by-id (_type_ uint) collide-shape-prim 33) + (find-prim-by-id-logtest (_type_ uint) collide-shape-prim 34) + (detect-riders! (_type_) symbol 35) + (build-bounding-box-for-shape (_type_ bounding-box float collide-spec) symbol 36) + (integrate-and-collide! (_type_ vector) none 37) + (find-collision-meshes (_type_) none 38) + (on-platform (_type_ collide-shape collide-query) symbol 39) (find-overlapping-shapes (_type_ overlaps-others-params) symbol 40) - (collide-shape-method-41 () none 41) - (collide-shape-method-42 () none 42) - (collide-shape-method-43 () none 43) - (collide-shape-method-44 () none 44) - (collide-shape-method-45 () none 45) - (collide-shape-method-46 (_type_) none 46) + (shove-to-closest-point-on-path (_type_ attack-info float) vector 41) + (should-push-away (_type_ collide-shape collide-query) symbol 42) + (pull-rider! (_type_ pull-rider-info) none 43) + (pull-riders! (_type_) symbol 44) + (do-push-aways (_type_) collide-spec 45) + (update-transforms (_type_) none 46) (set-collide-with! (_type_ collide-spec) none 47) (set-collide-as! (_type_ collide-spec) none 48) - (collide-shape-method-49 (_type_ int int int) none 49) - (collide-shape-method-50 (_type_ process object float float float) none 50) - (collide-shape-method-51 (_type_) none 51) + (modify-collide-as! (_type_ int collide-spec collide-spec) none 49) + (send-shoves (_type_ process touching-shapes-entry float float float) symbol 50) + (above-ground? (_type_ collide-query vector object float float float) symbol 51) (water-info-init! (_type_ water-info collide-action) water-info 52) - (collide-shape-method-53 (_type_) none 53) - (collide-shape-method-54 (_type_) none 54) + (iterate-prims (_type_ (function collide-shape-prim none)) none 53) + (pusher-init (_type_) none 54) ) ) (deftype collide-shape-moving (collide-shape) - ((rider-time time-frame :offset-assert 200) - (rider-last-move vector :inline :offset-assert 208) - (trans-old vector :inline :offset-assert 224) - (csm-unk-vec-981i2u312 vector :inline :offset 240) - (csm-unk-vec-klj1n23 vector :inline :offset 256) - (poly-pat pat-surface :offset 272) - (cur-pat pat-surface :offset-assert 276) - (ground-pat pat-surface :offset-assert 280) - (status cshape-moving-flags :offset-assert 288) - (old-status cshape-moving-flags :offset-assert 296) - (prev-status cshape-moving-flags :offset-assert 304) - (reaction-flag cshape-reaction-flags :offset-assert 312) - (reaction (function control-info collide-query vector vector cshape-moving-flags) :offset-assert 316) - (no-reaction function :offset-assert 320) - (local-normal vector :inline :offset-assert 336) - (surface-normal vector :inline :offset-assert 352) - (poly-normal vector :inline :offset-assert 368) - (ground-poly-normal vector :inline :offset-assert 384) - (gspot-pos vector :inline :offset-assert 400) - (gspot-normal vector :inline :offset-assert 416) - (grount-touch-point vector :inline :offset-assert 432) - (ground-impact-vel meters :offset-assert 448) - (surface-angle float :offset-assert 452) - (poly-angle float :offset-assert 456) - (touch-angle float :offset-assert 460) - (coverage float :offset-assert 464) - (dynam dynamics :offset-assert 468) - (surf surface :offset-assert 472) + ((rider-time time-frame :offset-assert 200) + (rider-last-move vector :inline :offset-assert 208) + (trans-old vector :inline :offset-assert 224) + (trans-old-old vector :inline :offset 240) + (trans-old-old-old vector :inline :offset 256) + (poly-pat pat-surface :offset 272) + (cur-pat pat-surface :offset-assert 276) + (ground-pat pat-surface :offset-assert 280) + (status collide-status :offset-assert 288) + (old-status collide-status :offset-assert 296) + (prev-status collide-status :offset-assert 304) + (reaction-flag cshape-reaction-flags :offset-assert 312) + (reaction (function control-info collide-query vector vector collide-status) :offset-assert 316) + (no-reaction (function collide-shape-moving collide-query vector vector object) :offset-assert 320) + (local-normal vector :inline :offset-assert 336) + (surface-normal vector :inline :offset-assert 352) + (poly-normal vector :inline :offset-assert 368) + (ground-poly-normal vector :inline :offset-assert 384) + (gspot-pos vector :inline :offset-assert 400) + (gspot-normal vector :inline :offset-assert 416) + (grount-touch-point vector :inline :offset-assert 432) + (ground-impact-vel meters :offset-assert 448) + (surface-angle float :offset-assert 452) + (poly-angle float :offset-assert 456) + (touch-angle float :offset-assert 460) + (coverage float :offset-assert 464) + (dynam dynamics :offset-assert 468) + (surf surface :offset-assert 472) ) :method-count-assert 68 :size-assert #x1dc :flag-assert #x44000001dc (:methods (new (symbol type process-drawable collide-list-enum) _type_ 0) - (collide-shape-moving-method-55 (_type_ collide-query collide-spec float float float) symbol 55) - (collide-shape-moving-method-56 (_type_ pat-surface) none 56) - (collide-shape-moving-method-57 () none 57) - (collide-shape-moving-method-58 (_type_ vector overlaps-others-params) symbol 58) - (collide-shape-moving-method-59 () none 59) - (collide-shape-moving-method-60 () none 60) - (collide-shape-moving-method-61 () none 61) + (find-ground (_type_ collide-query collide-spec float float float) symbol 55) + (react-to-pat! (_type_ pat-surface) none 56) + (integrate-no-collide! (_type_ vector) none 57) + (integrate-for-enemy-no-mtg (_type_ vector overlaps-others-params) symbol 58) + (move-above-ground (_type_ vector move-above-ground-params) none 59) + (move-to-ground (_type_ float float symbol collide-spec) none 60) + (move-to-ground-point (_type_ vector vector vector) none 61) (compute-acc-due-to-gravity (_type_ vector float) vector 62) (collide-shape-moving-method-63 () none 63) - (collide-shape-moving-method-64 () none 64) - (collide-shape-moving-method-65 (_type_ vector float float float) symbol 65) - (collide-shape-moving-method-66 () none 66) + (try-snap-to-surface (_type_ vector float float float) symbol 64) + (fill-and-try-snap-to-surface (_type_ vector float float float collide-query) symbol 65) + (step-collison! (_type_ vector vector float int) float 66) (collide-shape-moving-method-67 () none 67) ) ) @@ -605,7 +628,7 @@ (set! (-> s5-0 nav-flags) (nav-flags nav-flags0)) (set! (-> s5-0 event-self) #f) (set! (-> s5-0 event-other) #f) - (set! (-> s5-0 riders) (the-as pointer #f)) + (set! (-> s5-0 riders) #f) (set! (-> s5-0 root-prim) #f) (set! (-> s5-0 penetrate-using) (penetrate)) (set! (-> s5-0 penetrated-by) (penetrate)) diff --git a/goal_src/jak2/engine/collide/collide-shape-rider.gc b/goal_src/jak2/engine/collide/collide-shape-rider.gc index f96f782001..eaaa9858a4 100644 --- a/goal_src/jak2/engine/collide/collide-shape-rider.gc +++ b/goal_src/jak2/engine/collide/collide-shape-rider.gc @@ -7,3 +7,438 @@ ;; DECOMP BEGINS +;; definition for method 39 of type collide-shape +(defmethod on-platform collide-shape ((obj collide-shape) (arg0 collide-shape) (arg1 collide-query)) + (let ((v1-0 arg1)) + (set! (-> v1-0 best-dist) 0.0) + (set! (-> v1-0 best-my-prim) #f) + (set! (-> v1-0 num-spheres) (the-as uint #f)) + ) + (set! (-> arg1 best-dist) 122.88) + (let ((s5-0 (-> obj root-prim)) + (s4-0 (-> arg0 root-prim)) + ) + (when (and (logtest? (-> s5-0 prim-core collide-with) (-> s4-0 prim-core collide-as)) + (logtest? (-> s5-0 prim-core action) (collide-action rideable)) + (logtest? (-> s4-0 prim-core action) (collide-action can-ride)) + ) + (let ((f0-4 (- (- (vector-vector-distance (the-as vector (-> s5-0 prim-core)) (the-as vector (-> s4-0 prim-core))) + (-> s5-0 prim-core world-sphere w) + ) + (-> s4-0 prim-core world-sphere w) + ) + ) + ) + (if (< f0-4 122.88) + (on-platform-test s5-0 s4-0 arg1 f0-4) + ) + ) + ) + ) + (< (-> arg1 best-dist) 122.88) + ) + +;; definition for method 17 of type collide-shape-prim +;; WARN: Return type mismatch object vs none. +(defmethod on-platform-test collide-shape-prim ((obj collide-shape-prim) (arg0 collide-shape-prim) (arg1 collide-query) (arg2 float)) + (format 0 "ERROR: collide-shape-prim::on-platform-test was called illegally!~%") + (none) + ) + +;; definition for method 17 of type collide-shape-prim-group +;; WARN: Return type mismatch int vs none. +(defmethod on-platform-test collide-shape-prim-group ((obj collide-shape-prim-group) (arg0 collide-shape-prim) (arg1 collide-query) (arg2 float)) + (let ((s4-0 (-> arg0 prim-core collide-as)) + (s3-0 (-> obj child 0)) + ) + (countdown (s2-0 (the-as uint (-> obj num-children))) + (when (and (logtest? (-> s3-0 prim-core collide-with) s4-0) + (logtest? (-> s3-0 prim-core action) (collide-action rideable)) + ) + (let ((f0-2 (- (- (vector-vector-distance (the-as vector (-> s3-0 prim-core)) (the-as vector (-> arg0 prim-core))) + (-> s3-0 prim-core world-sphere w) + ) + (-> arg0 prim-core world-sphere w) + ) + ) + ) + (if (< f0-2 122.88) + (on-platform-test s3-0 arg0 arg1 f0-2) + ) + ) + ) + (&+! s3-0 80) + ) + ) + 0 + (none) + ) + +;; definition for method 17 of type collide-shape-prim-mesh +;; INFO: Used lq/sq +;; WARN: Return type mismatch pat-surface vs none. +(defmethod on-platform-test collide-shape-prim-mesh ((obj collide-shape-prim-mesh) (arg0 collide-shape-prim) (arg1 collide-query) (arg2 float)) + (case (-> arg0 type) + ((collide-shape-prim-group) + (let ((s4-0 (-> obj prim-core collide-with)) + (s3-0 (-> (the-as collide-shape-prim-group arg0) child 0)) + (s2-1 (the-as object (-> (the-as collide-shape-prim-group arg0) num-children))) + ) + (while (nonzero? (the-as uint s2-1)) + (set! s2-1 (+ (the-as uint s2-1) -1)) + (when (and (logtest? s4-0 (-> s3-0 prim-core collide-as)) + (logtest? (-> s3-0 prim-core action) (collide-action can-ride)) + ) + (let ((f0-2 (- (- (vector-vector-distance (the-as vector (-> obj prim-core)) (the-as vector (-> s3-0 prim-core))) + (-> obj prim-core world-sphere w) + ) + (-> s3-0 prim-core world-sphere w) + ) + ) + ) + (if (< f0-2 122.88) + (on-platform-test obj s3-0 arg1 f0-2) + ) + ) + ) + (&+! s3-0 80) + ) + ) + ) + ((collide-shape-prim-sphere) + (let ((s3-1 (-> obj mesh))) + (when s3-1 + (let ((v1-13 (populate-for-prim-mesh *collide-mesh-cache* obj))) + (when v1-13 + (let* ((s4-1 (new 'stack-no-clear 'collide-tri-result)) + (f0-4 (sphere-on-platform-test + s3-1 + (the-as collide-mesh-cache-tri (-> v1-13 tris)) + s4-1 + (the-as vector (-> arg0 prim-core)) + (-> arg1 best-dist) + ) + ) + ) + (when (< f0-4 (-> arg1 best-dist)) + (set! (-> arg1 best-dist) f0-4) + (set! (-> arg1 best-my-prim) obj) + (set! (-> arg1 num-spheres) (the-as uint arg0)) + (set! (-> arg1 best-other-tri vertex 0 quad) (-> s4-1 vertex 0 quad)) + (set! (-> arg1 best-other-tri vertex 1 quad) (-> s4-1 vertex 1 quad)) + (set! (-> arg1 best-other-tri vertex 2 quad) (-> s4-1 vertex 2 quad)) + (set! (-> arg1 best-other-tri intersect quad) (-> s4-1 intersect quad)) + (set! (-> arg1 best-other-tri normal quad) (-> s4-1 normal quad)) + (set! (-> arg1 best-other-tri pat) (-> s4-1 pat)) + ) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for method 9 of type collide-rider-pool +(defmethod add-rider collide-rider-pool ((obj collide-rider-pool) (arg0 handle)) + (let ((v1-0 (-> obj alloc-count))) + (cond + ((< v1-0 20) + (let ((v0-0 (-> obj riders v1-0))) + (set! (-> obj alloc-count) (+ v1-0 1)) + (set! (-> v0-0 rider-handle) arg0) + (set! (-> v0-0 sticky-prim) #f) + v0-0 + ) + ) + (else + (format 0 "ERROR: *collide-rider-pool*: exceeded max # of riders!~%") + (the-as collide-rider #f) + ) + ) + ) + ) + +;; definition for method 35 of type collide-shape +;; WARN: Return type mismatch joint-control-status vs symbol. +(defmethod detect-riders! collide-shape ((obj collide-shape)) + (local-vars (v0-7 joint-control-status) (a2-5 float) (a2-12 float)) + (rlet ((vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + ) + (set! (-> obj num-riders) (the-as uint 0)) + (set! (-> obj riders) (the-as (inline-array collide-rider) #f)) + (let* ((s4-0 (-> obj root-prim)) + (s5-0 (-> s4-0 prim-core collide-with)) + ) + (set! *actor-list-length* 0) + (if (logtest? s5-0 (collide-spec hit-by-others-list)) + (set! *actor-list-length* + (fill-actor-list-for-sphere *actor-hash* (the-as sphere (-> s4-0 prim-core)) *actor-list* 256) + ) + ) + (when (logtest? s5-0 (collide-spec player-list)) + (let ((a0-2 (-> *collide-player-list* alive-list next0))) + *collide-player-list* + (let ((v1-11 (-> a0-2 next0))) + (while (!= a0-2 (-> *collide-player-list* alive-list-end)) + (let* ((a0-3 (-> (the-as connection a0-2) param1)) + (a1-1 (-> (the-as collide-shape a0-3) root-prim)) + ) + (when (logtest? s5-0 (-> a1-1 prim-core collide-as)) + (let ((a1-2 (-> a1-1 prim-core))) + (let ((a2-4 a1-2) + (a3-1 (-> s4-0 prim-core)) + ) + (.lvf vf2 (&-> a2-4 world-sphere quad)) + (.lvf vf3 (&-> a3-1 world-sphere quad)) + ) + (.sub.vf vf1 vf3 vf2) + (.mul.vf vf1 vf1 vf1) + (.add.y.vf vf1 vf1 vf1 :mask #b1) + (.add.z.vf vf1 vf1 vf1 :mask #b1) + (.mov a2-5 vf1) + (let ((f0-0 a2-5) + (f1-1 (+ (-> a1-2 world-sphere w) (-> s4-0 prim-core world-sphere w))) + ) + (when (< f0-0 (* f1-1 f1-1)) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-3)) + (set! *actor-list-length* (+ *actor-list-length* 1)) + ) + ) + ) + ) + ) + ) + (set! a0-2 v1-11) + *collide-player-list* + (set! v1-11 (-> v1-11 next0)) + ) + ) + ) + ) + (when (logtest? s5-0 (collide-spec hit-by-player-list)) + (let ((a0-5 (-> *collide-hit-by-player-list* alive-list next0))) + *collide-hit-by-player-list* + (let ((v1-19 (-> a0-5 next0))) + (while (!= a0-5 (-> *collide-hit-by-player-list* alive-list-end)) + (let* ((a0-6 (-> (the-as connection a0-5) param1)) + (a1-13 (-> (the-as collide-shape a0-6) root-prim)) + ) + (when (logtest? s5-0 (-> a1-13 prim-core collide-as)) + (let ((a1-14 (-> a1-13 prim-core))) + (let ((a2-11 a1-14) + (a3-2 (-> s4-0 prim-core)) + ) + (.lvf vf2 (&-> a2-11 world-sphere quad)) + (.lvf vf3 (&-> a3-2 world-sphere quad)) + ) + (.sub.vf vf1 vf3 vf2) + (.mul.vf vf1 vf1 vf1) + (.add.y.vf vf1 vf1 vf1 :mask #b1) + (.add.z.vf vf1 vf1 vf1 :mask #b1) + (.mov a2-12 vf1) + (let ((f0-1 a2-12) + (f1-5 (+ (-> a1-14 world-sphere w) (-> s4-0 prim-core world-sphere w))) + ) + (when (< f0-1 (* f1-5 f1-5)) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) + (set! *actor-list-length* (+ *actor-list-length* 1)) + ) + ) + ) + ) + ) + ) + (set! a0-5 v1-19) + *collide-hit-by-player-list* + (set! v1-19 (-> v1-19 next0)) + ) + ) + ) + ) + (dotimes (s4-1 *actor-list-length*) + (let* ((s3-0 (-> *actor-list* s4-1)) + (v1-24 (-> s3-0 root-prim)) + ) + (when (logtest? s5-0 (-> v1-24 prim-core collide-as)) + (when (and (logtest? (-> v1-24 prim-core action) (collide-action can-ride)) (!= (-> obj process) (-> s3-0 process))) + (let ((s2-0 (new 'stack-no-clear 'collide-query))) + (when (on-platform obj s3-0 s2-0) + (let ((s5-1 (add-rider *collide-rider-pool* (process->handle (-> s3-0 process))))) + (when s5-1 + (+! (-> obj num-riders) 1) + (if (not (-> obj riders)) + (set! (-> obj riders) (the-as (inline-array collide-rider) s5-1)) + ) + (let ((a0-15 (-> s2-0 best-my-prim))) + (set! (-> s5-1 sticky-prim) a0-15) + (let ((s1-0 (-> obj process node-list data (-> a0-15 transform-index) bone transform))) + (set! (-> s5-1 prim-ry) (matrix-y-angle s1-0)) + (let ((s2-1 (new 'stack-no-clear 'matrix))) + (matrix-4x4-inverse! s2-1 s1-0) + (set! (-> s3-0 trans w) 1.0) + (vector-matrix*! (-> s5-1 rider-local-pos) (-> s3-0 trans) s2-1) + ) + ) + ) + (send-event (-> obj process) 'ridden s5-1) + ) + ) + (set! s5-0 (-> obj root-prim prim-core collide-with)) + ) + ) + ) + ) + ) + ) + ) + (let ((v1-58 (-> obj process skel))) + (the-as + symbol + (when (nonzero? v1-58) + (cond + ((or (> (-> obj num-riders) 0) (logtest? (-> obj root-prim prim-core action) (collide-action edge-grabbed))) + (set! v0-7 (logior (-> v1-58 status) (joint-control-status sync-math))) + (set! (-> v1-58 status) v0-7) + ) + (else + (set! v0-7 (logclear (-> v1-58 status) (joint-control-status sync-math))) + (set! (-> v1-58 status) v0-7) + ) + ) + v0-7 + ) + ) + ) + ) + ) + +;; definition for method 44 of type collide-shape +;; WARN: Return type mismatch int vs symbol. +(defmethod pull-riders! collide-shape ((obj collide-shape)) + (let ((s5-0 (-> obj riders))) + (when s5-0 + (let ((s4-0 (new 'stack-no-clear 'pull-rider-info))) + (countdown (s3-0 (-> obj num-riders)) + (let* ((v1-2 (-> s5-0 s3-0)) + (a0-1 (-> v1-2 rider-handle)) + ) + (when (handle->process a0-1) + (set! (-> s4-0 rider) v1-2) + (set! (-> s4-0 rider-cshape) + (the-as collide-shape-moving (-> (the-as process-drawable (-> a0-1 process 0)) root)) + ) + (let ((a0-5 (-> v1-2 sticky-prim))) + (when a0-5 + (let ((s2-0 (-> obj process node-list data (-> a0-5 transform-index) bone transform))) + (let ((s1-0 (-> s4-0 rider-dest))) + (vector-matrix*! s1-0 (-> v1-2 rider-local-pos) s2-0) + (vector-float*! s1-0 s1-0 (/ 1.0 (-> s1-0 w))) + ) + (set! (-> s4-0 rider-delta-ry) (deg- (matrix-y-angle s2-0) (-> s4-0 rider prim-ry))) + ) + (pull-rider! obj s4-0) + ) + ) + ) + ) + ) + ) + ) + ) + (the-as symbol 0) + ) + +;; definition for method 43 of type collide-shape +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defmethod pull-rider! collide-shape ((obj collide-shape) (arg0 pull-rider-info)) + (local-vars (at-0 int)) + (with-pp + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((gp-0 (-> arg0 rider-cshape))) + (let ((s2-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> s3-0 quad) (-> gp-0 trans quad)) + (vector-! s2-0 (-> arg0 rider-dest) s3-0) + (cond + ((logtest? (-> obj root-prim prim-core action) (collide-action pull-rider-can-collide)) + (let ((s1-0 (-> obj root-prim prim-core collide-as))) + (set! (-> obj root-prim prim-core collide-as) (collide-spec)) + (let ((a2-0 (new 'stack-no-clear 'collide-query))) + (set! (-> a2-0 collide-with) (-> gp-0 root-prim prim-core collide-with)) + (set! (-> a2-0 ignore-process0) (-> gp-0 process)) + (set! (-> a2-0 ignore-process1) #f) + (set! (-> a2-0 ignore-pat) (-> gp-0 pat-ignore-mask)) + (set! (-> a2-0 action-mask) (collide-action solid)) + (fill-cache-for-shape gp-0 (+ 8192.0 (vector-length s2-0)) a2-0) + ) + (set! (-> obj root-prim prim-core collide-as) s1-0) + ) + (let ((s1-1 (new 'stack-no-clear 'vector))) + (set! (-> s1-1 quad) (-> s2-0 quad)) + (let ((v1-19 s1-1)) + (.lvf vf1 (&-> s1-1 quad)) + (let ((f0-2 (-> pp clock frames-per-second))) + (.mov at-0 f0-2) + ) + (.mov vf2 at-0) + (.mov.vf vf1 vf0 :mask #b1000) + (.mul.x.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> v1-19 quad) vf1) + ) + (cond + ((type? gp-0 collide-shape-moving) + (let ((s2-1 (-> gp-0 status))) + (integrate-and-collide! gp-0 s1-1) + (set! (-> gp-0 status) s2-1) + ) + ) + (else + (integrate-and-collide! gp-0 s1-1) + ) + ) + ) + ) + (else + (move-by-vector! gp-0 s2-0) + ) + ) + (when (type? gp-0 collide-shape-moving) + (let ((v1-26 (new 'stack-no-clear 'vector))) + (vector-! v1-26 (-> gp-0 trans) s3-0) + (vector-float*! (-> gp-0 rider-last-move) v1-26 (-> pp clock frames-per-second)) + ) + (let ((f0-4 (vector-length (-> gp-0 rider-last-move)))) + (if (< (-> obj rider-max-momentum) f0-4) + (vector-normalize! (-> gp-0 rider-last-move) (-> obj rider-max-momentum)) + ) + ) + (set! (-> gp-0 rider-time) (-> gp-0 process clock frame-counter)) + ) + ) + (let ((f0-6 (-> arg0 rider-delta-ry))) + (if (!= f0-6 0.0) + (send-event (-> gp-0 process) 'rotate-y-angle f0-6) + ) + ) + ) + (none) + ) + ) + ) + + + + diff --git a/goal_src/jak2/engine/collide/collide-shape.gc b/goal_src/jak2/engine/collide/collide-shape.gc index c4651ac566..dd2783d81f 100644 --- a/goal_src/jak2/engine/collide/collide-shape.gc +++ b/goal_src/jak2/engine/collide/collide-shape.gc @@ -7,3 +7,3241 @@ ;; DECOMP BEGINS +;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; PUSHER +;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; "pushers" are things that push things out of the way. For example, if a platform hits jak, it pushes him out of the way. +;; Nothing can ever push back against a pusher - they move on some fixed path and cannot be disturbed. +;; these are done by pairs of collide-shape's, and don't involve the main collide-cache. +;; Using the main collide cache wouldn't really make sense because a pusher never interacts with the background +;; and there's just one check per pair per frame. + +;; the do-push-aways function is what actually does all the tests for all the objects. + +;; there's a "pusher-pool" to make all pushers run at the end of a frame. + +;; the "should push away test" (SPAT) checks to see if the movement of a pusher should push away another collide shape. +;; it returns a triangle and normal direction to push in. + + +(defmethod pusher-init collide-shape ((obj collide-shape)) + "Initialize a collide-shape as a pusher and move it to the pusher pool." + (when (logtest? (collide-spec pusher) (-> obj root-prim prim-core collide-as)) + (let ((proc (the-as process-tree (-> obj process)))) + (while (not (logtest? (-> proc mask) (process-mask process-tree))) + (set! proc (ppointer->process (-> proc parent))) + ) + ;; "pushers" go in a separate pool so they run after non-pushers. + (if (!= proc *pusher-pool*) + (change-parent (-> obj process) *pusher-pool*) + ) + ) + ) + (none) + ) + +(defmethod should-push-away collide-shape ((obj collide-shape) (other collide-shape) (cquery collide-query)) + "Should this shape push away the other? Most generic implementation." + (local-vars (v1-2 uint) (v1-3 float) (a2-2 uint) (a3-2 uint)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + ) + (init-vf0-vector) + (let ((v1-0 cquery)) + (set! (-> v1-0 best-dist) 0.0) + (set! (-> v1-0 best-my-prim) #f) + (set! (-> v1-0 num-spheres) (the-as uint #f)) + ) + (let ((a0-1 (-> obj root-prim)) + (a1-1 (-> other root-prim)) + ) + ;; check action + (let ((a3-0 (-> a0-1 prim-core collide-with)) + (t0-0 (-> a1-1 prim-core collide-as)) + (v1-1 (-> a0-1 prim-core action)) + ) + (let ((a2-1 (-> a1-1 prim-core action))) + (b! (not (logtest? a3-0 t0-0)) cfg-8 :delay (set! a3-2 (the-as uint (logand a2-1 1)))) + (b! (zero? a3-2) cfg-8 :delay (set! a2-2 (the-as uint (logand a2-1 16)))) + ) + (b! (nonzero? a2-2) cfg-8 :delay (set! v1-2 (the-as uint (logand v1-1 1)))) + ) + (b! (zero? v1-2) cfg-8 :delay (nop!)) + ;; check bsphere + (.lvf vf1 (&-> a0-1 prim-core world-sphere quad)) + (.lvf vf2 (&-> a1-1 prim-core world-sphere quad)) + (.sub.vf vf3 vf1 vf2) + (.add.w.vf vf4 vf1 vf2 :mask #b1000) + (.mul.vf vf3 vf3 vf3 :mask #b111) + (.mul.w.vf vf4 vf4 vf4 :mask #b1000) + (.mul.x.vf acc vf0 vf3 :mask #b1000) + (.add.mul.y.vf acc vf0 vf3 acc :mask #b1000) + (.add.mul.z.vf vf3 vf0 vf3 acc :mask #b1000) + (.sub.w.vf vf5 vf3 vf4 :mask #b1000) + (let ((f0-1 0.0)) + (.add.w.vf vf5 vf0 vf5 :mask #b1) + (.mov v1-3 vf5) + (b! (<= f0-1 v1-3) cfg-8) + ) + ;; more specific test + (should-push-away-test a0-1 a1-1 cquery) + ) + (let ((v0-1 (< (-> cquery best-dist) 0.0))) + (b! #t cfg-9 :delay (nop!)) + (label cfg-8) + (set! v0-1 #f) + (label cfg-9) + v0-1 + ) + ) + ) + +(defmethod should-push-away-test collide-shape-prim ((obj collide-shape-prim) (arg0 collide-shape-prim) (arg1 collide-query)) + "Most generic should-push-away-test - child prims are expected to override." + (format 0 "ERROR: collide-shape-prim::should-push-away-test was called illegally!~%") + (none) + ) + +(defmethod should-push-away-test collide-shape-prim-group ((obj collide-shape-prim-group) (other collide-shape-prim) (cquery collide-query)) + "Should push away test where the pusher is a group." + (local-vars (a0-2 collide-action) (a0-3 float) (f0-0 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (nop!) + (let ((s4-0 (the-as collide-shape-prim obj)) + (s3-0 (the-as uint (-> obj num-children))) + ) + (nop!) + (let ((v1-0 (-> other prim-core collide-as))) + (nop!) + (.lvf vf1 (&-> other prim-core world-sphere quad)) + (until (> f0-0 a0-3) + (until (nonzero? a0-2) + (label cfg-1) + (b! (zero? s3-0) cfg-6 :delay (set! s4-0 (&+ s4-0 80))) + (+! s3-0 -1) + (let ((a1-1 (-> s4-0 prim-core collide-with))) + (nop!) + (let ((a0-1 (-> s4-0 prim-core action)) + (a1-2 (logand a1-1 v1-0)) + ) + (set! a0-2 (logand a0-1 (collide-action solid))) + (b! (zero? a1-2) cfg-1 :delay (.lvf vf2 (&-> s4-0 prim-core world-sphere quad))) + ) + ) + ) + (.sub.vf vf3 vf2 vf1) + (.add.w.vf vf4 vf2 vf1 :mask #b1000) + (.mul.vf vf3 vf3 vf3 :mask #b111) + (.mul.w.vf vf4 vf4 vf4 :mask #b1000) + (.mul.x.vf acc vf0 vf3 :mask #b1000) + (.add.mul.y.vf acc vf0 vf3 acc :mask #b1000) + (.add.mul.z.vf vf3 vf0 vf3 acc :mask #b1000) + (.sub.w.vf vf3 vf3 vf4 :mask #b1000) + (set! f0-0 0.0) + (.add.w.vf vf3 vf0 vf3 :mask #b1) + (.mov a0-3 vf3) + ) + (should-push-away-test s4-0 other cquery) + (set! v1-0 (-> other prim-core collide-as)) + ) + ) + (b! #t cfg-1 :delay (.lvf vf1 (&-> other prim-core world-sphere quad))) + (label cfg-6) + 0 + (none) + ) + ) + +(defmethod should-push-away-a-group-test collide-shape-prim ((obj collide-shape-prim) (other collide-shape-prim-group) (cquery collide-query)) + "should-push-away-test anything vs. a group." + (local-vars (a0-2 collide-action) (a0-3 float) (f0-0 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (nop!) + (let ((s4-0 (the-as object other)) + (s3-0 (the-as uint (-> other num-children))) + ) + (nop!) + (let ((v1-0 (-> obj prim-core collide-with))) + (nop!) + (.lvf vf2 (&-> obj prim-core world-sphere quad)) + (until (> f0-0 a0-3) + (until (nonzero? a0-2) + (label cfg-1) + (b! (zero? s3-0) cfg-6 :delay (set! s4-0 (&+ (the-as collide-shape-prim s4-0) 80))) + (+! s3-0 -1) + (let ((a1-1 (-> (the-as collide-shape-prim s4-0) prim-core collide-as))) + (nop!) + (let ((a0-1 (-> (the-as collide-shape-prim s4-0) prim-core action)) + (a1-2 (logand v1-0 a1-1)) + ) + (set! a0-2 (logand a0-1 (collide-action solid))) + (b! (zero? a1-2) cfg-1 :delay (.lvf vf1 (&-> (the-as collide-shape-prim s4-0) prim-core world-sphere quad))) + ) + ) + ) + (.sub.vf vf3 vf2 vf1) + (.add.w.vf vf4 vf2 vf1 :mask #b1000) + (.mul.vf vf3 vf3 vf3 :mask #b111) + (.mul.w.vf vf4 vf4 vf4 :mask #b1000) + (.mul.x.vf acc vf0 vf3 :mask #b1000) + (.add.mul.y.vf acc vf0 vf3 acc :mask #b1000) + (.add.mul.z.vf vf3 vf0 vf3 acc :mask #b1000) + (.sub.w.vf vf3 vf3 vf4 :mask #b1000) + (set! f0-0 0.0) + (.add.w.vf vf3 vf0 vf3 :mask #b1) + (.mov a0-3 vf3) + ) + (should-push-away-test obj (the-as collide-shape-prim s4-0) cquery) + (set! v1-0 (-> obj prim-core collide-with)) + ) + ) + (b! #t cfg-1 :delay (.lvf vf2 (&-> obj prim-core world-sphere quad))) + (label cfg-6) + 0 + (none) + ) + ) + +(defmethod should-push-away-test collide-shape-prim-mesh ((obj collide-shape-prim-mesh) (other collide-shape-prim) (cquery collide-query)) + "Check if we should push away another shape (must be sphere or group)" + (let ((v1-0 (-> other prim-core prim-type))) + (cond + ((= v1-0 (prim-type group)) + ;; iterate over group + (should-push-away-a-group-test obj (the-as collide-shape-prim-group other) cquery) + ) + (else + (b! (> (the-as int v1-0) 0) cfg-8 :delay (nop!)) + (let ((s2-0 (-> obj mesh))) + (b! (not s2-0) cfg-7 :delay (empty-form)) + ;; mesh vs. sphere. Set up the collide-mesh-cache + (let ((v1-4 (populate-for-prim-mesh *collide-mesh-cache* obj))) + (b! (not v1-4) cfg-7 :delay (empty-form)) + (let ((s5-0 (new 'stack-no-clear 'collide-tri-result))) + ;; run the actual mesh/sphere collision + (let ((f0-1 (should-push-away-test + s2-0 + (the-as collide-mesh-cache-tri (-> v1-4 tris)) + s5-0 + (the-as vector (-> other prim-core)) + (-> cquery best-dist) + ) + ) + ) + (b! (>= f0-1 (-> cquery best-dist)) cfg-7 :delay #f) + (set! (-> cquery best-dist) f0-1) + ) + (set! (-> cquery best-my-prim) obj) + (set! (-> cquery num-spheres) (the-as uint other)) + (set! (-> cquery best-other-tri vertex 0 quad) (-> s5-0 vertex 0 quad)) + (set! (-> cquery best-other-tri vertex 1 quad) (-> s5-0 vertex 1 quad)) + (set! (-> cquery best-other-tri vertex 2 quad) (-> s5-0 vertex 2 quad)) + (set! (-> cquery best-other-tri intersect quad) (-> s5-0 intersect quad)) + (set! (-> cquery best-other-tri normal quad) (-> s5-0 normal quad)) + (set! (-> cquery best-other-tri pat) (-> s5-0 pat)) + ) + ) + ) + (label cfg-7) + (b! #t cfg-9 :delay (nop!)) + (label cfg-8) + (format 0 "ERROR: Attempted unsupported mesh -> mesh test in collide-shape-prim::should-push-away-test!~%") + ) + ) + ) + (label cfg-9) + 0 + (none) + ) + +(defmethod should-push-away-test collide-shape-prim-sphere ((obj collide-shape-prim-sphere) (other collide-shape-prim) (cquery collide-query)) + "Sphere against anything test." + (local-vars (v1-3 float)) + (rlet ((acc :class vf) + (Q :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let ((v1-0 (-> other prim-core prim-type))) + (cond + ((= v1-0 (prim-type group)) + ;; test against a group + (should-push-away-a-group-test obj (the collide-shape-prim-group other) cquery) + ) + (else + (b! (> (the-as int v1-0) 0) cfg-5 :delay (nop!)) + ;; sphere sphere + (.lvf vf1 (&-> obj prim-core world-sphere quad)) + (.lvf vf2 (&-> other prim-core world-sphere quad)) + (.sub.vf vf3 vf2 vf1 :mask #b111) + (.add.w.vf vf5 vf1 vf2 :mask #b1000) + (.mul.vf vf4 vf3 vf3 :mask #b111) + (.mul.x.vf acc vf0 vf4 :mask #b1000) + (.add.mul.y.vf acc vf0 vf4 acc :mask #b1000) + (.add.mul.z.vf vf4 vf0 vf4 acc :mask #b1000) + (.sqrt.vf Q vf4 :ftf #b11) + (.mov.vf vf3 vf0 :mask #b1000) + (.add.w.vf vf5 vf0 vf5 :mask #b1) + (let ((f2-0 (-> cquery best-dist))) + (.wait.vf) + (nop!) + (.add.vf vf4 vf0 Q :mask #b1) + (.sub.x.vf vf6 vf4 vf5 :mask #b1) + (.mul.x.vf vf3 vf3 vf4 :mask #b111) + (.mov v1-3 vf6) + (let ((f1-0 v1-3)) + (b! (<= f2-0 f1-0) cfg-9) + (let ((v1-4 (-> obj pat))) + (set! (-> cquery best-dist) f1-0) + (set! (-> cquery best-my-prim) obj) + (set! (-> cquery num-spheres) (the-as uint other)) + (.svf (&-> cquery best-other-tri normal quad) vf3) + (set! (-> cquery best-other-tri pat) v1-4) + ) + ) + ) + (let ((s3-0 (-> cquery best-other-tri normal)) + (s4-1 (-> cquery best-other-tri intersect)) + ) + ;; some annoying logic to fake a "triangle" on the sphere + (vector-float*! s4-1 s3-0 (-> obj prim-core world-sphere w)) + (vector+! s4-1 s4-1 (the-as vector (-> obj prim-core))) + (set! (-> cquery best-other-tri vertex 0 quad) (-> s4-1 quad)) + (point-in-plane-<-point+normal! (-> cquery best-other-tri vertex 1) s4-1 s3-0) + (let* ((a0-8 (vector-normalize! + (vector-! + (new 'stack-no-clear 'vector) + (-> cquery best-other-tri vertex 1) + (the-as vector (-> cquery best-other-tri)) + ) + 1.0 + ) + ) + (v1-11 (vector-cross! (new 'stack-no-clear 'vector) s3-0 a0-8)) + (a0-9 (-> cquery best-other-tri vertex 2)) + ) + (let ((a1-7 4096.0)) + (.mov vf7 a1-7) + ) + (.lvf vf5 (&-> v1-11 quad)) + (.lvf vf4 (&-> s4-1 quad)) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> a0-9 quad) vf6) + ) + ) + (b! #t cfg-9 :delay (nop!)) + (label cfg-5) + ;; sphere to mesh + (let ((s2-0 (-> (the-as collide-shape-prim-mesh other) mesh))) + (when s2-0 + (let ((v1-13 (populate-for-prim-mesh *collide-mesh-cache* (the-as collide-shape-prim-mesh other)))) + (when v1-13 + (let* ((s3-1 (new 'stack-no-clear 'collide-tri-result)) + (f0-3 (should-push-away-test + s2-0 + (the-as collide-mesh-cache-tri (-> v1-13 tris)) + s3-1 + (the-as vector (-> obj prim-core)) + (-> cquery best-dist) + ) + ) + ) + (when (< f0-3 (-> cquery best-dist)) + (set! (-> cquery best-dist) f0-3) + (set! (-> cquery best-my-prim) obj) + (set! (-> cquery num-spheres) (the-as uint other)) + (let ((s4-2 (-> cquery best-other-tri normal))) + ;; some annoying logic to fake a "triangle" on the sphere + (vector-! s4-2 (-> s3-1 intersect) (the-as vector (-> obj prim-core))) + (vector-normalize! s4-2 1.0) + (let ((s3-2 (-> cquery best-other-tri intersect))) + (vector-float*! s3-2 s4-2 (-> obj prim-core world-sphere w)) + (vector+! s3-2 s3-2 (the-as vector (-> obj prim-core))) + (set! (-> cquery best-other-tri vertex 0 quad) (-> s3-2 quad)) + (point-in-plane-<-point+normal! (-> cquery best-other-tri vertex 1) s3-2 s4-2) + (let* ((a0-23 (vector-normalize! + (vector-! + (new 'stack-no-clear 'vector) + (-> cquery best-other-tri vertex 1) + (the-as vector (-> cquery best-other-tri)) + ) + 1.0 + ) + ) + (v1-23 (vector-cross! (new 'stack-no-clear 'vector) s4-2 a0-23)) + (a0-24 (-> cquery best-other-tri vertex 2)) + ) + (let ((a1-18 4096.0)) + (.mov vf7 a1-18) + ) + (.lvf vf5 (&-> v1-23 quad)) + (.lvf vf4 (&-> s3-2 quad)) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> a0-24 quad) vf6) + ) + ) + ) + (set! (-> cquery best-other-tri pat) (-> obj pat)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (label cfg-9) + 0 + (none) + ) + ) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; COLLIDE +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; the "collide" system is a bit more complicated. Instead of one object being pushed by another, one object will move +;; until it hits another, and then the "collision reaction" function is called, which makes it bounce off, or something like that. + +;; there are two important details: +;; - this system uses the collide cache. Objects may bounce off of multiple collide shapes, and the background, +;; so the collide cache will provide a large speedup. The functions below are for checking collide shapes against +;; data in the collide cache. +;; - the collide-with functions figure out how far a moving sphere can move before it hits the first thing. +;; and return this value in best-u. They also populate the touching-list with all primts that were hit. +;; NOTE: it will over-populate the list, and the user must call (update-from-step-size *touching-list* u) +;; in order to get an accurate list. + +(defmethod collide-with-collide-cache-prim-mesh collide-shape-prim ((obj collide-shape-prim) (arg0 collide-query) (arg1 collide-cache-prim)) + (format 0 "ERROR: Unsupported prim type in collide-shape-prim::collide-with-collide-cache-prim-mesh!~%") + (none) + ) + +(defmethod collide-with-collide-cache-prim-mesh collide-shape-prim-sphere ((obj collide-shape-prim-sphere) (arg0 collide-query) (arg1 collide-cache-prim)) + "Collide a moving sphere with a mesh in the collide cache." + (rlet ((vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + ) + (let* ((gp-0 (new 'stack-no-clear 'collide-tri-result)) + ;; run moving sphere to mesh collision + (f0-1 (resolve-moving-sphere-tri + arg1 + gp-0 + (-> obj prim-core) + (-> arg0 move-dist) + (-> arg0 best-dist) + (-> obj prim-core action) + ) + ) + ) + (when (>= f0-1 0.0) ;; did we hit anything? + (let ((v1-3 (-> arg1 prim-core action)) + (a0-2 (-> obj prim-core action)) + (a2-2 (-> arg1 prim)) + ) + ;; it really seems like these checks should have gone first... + (let* ((v1-4 (logand a0-2 v1-3)) + (a0-3 (-> obj cshape)) + (a1-2 (logand v1-4 (collide-action solid))) + (v1-5 (-> a2-2 cshape)) + ) + (b! (zero? a1-2) cfg-6 :delay (nop!)) + (b! (= v1-5 #f) cfg-5 :likely-delay (set! a2-2 (the-as collide-shape-prim #f))) + (b! (logtest? (-> a0-3 penetrate-using) (-> v1-5 penetrated-by)) cfg-6 :delay (nop!)) + (label cfg-5) + ;; fill out info + (.lvf vf3 (&-> gp-0 vertex 0 quad)) + (.lvf vf4 (&-> gp-0 vertex 1 quad)) + (.lvf vf5 (&-> gp-0 vertex 2 quad)) + (.lvf vf1 (&-> gp-0 intersect quad)) + (.lvf vf2 (&-> gp-0 normal quad)) + (let ((a0-6 (-> gp-0 pat)) + (a1-4 (-> gp-0 collide-ptr)) + ) + (set! (-> arg0 best-dist) f0-1) + (.svf (&-> arg0 best-other-tri vertex 0 quad) vf3) + (.svf (&-> arg0 best-other-tri vertex 1 quad) vf4) + (.svf (&-> arg0 best-other-tri vertex 2 quad) vf5) + (.svf (&-> arg0 best-other-tri intersect quad) vf1) + (.svf (&-> arg0 best-other-tri normal quad) vf2) + (set! (-> arg0 best-other-tri pat) a0-6) + (set! (-> arg0 best-other-tri collide-ptr) a1-4) + ) + (set! (-> arg0 num-spheres) (the-as uint a2-2)) + (set! (-> arg0 best-my-prim) obj) + (label cfg-6) + (b! (not v1-5) cfg-8 :delay (empty-form)) + ) + ;; add to touching list + (add-touching-prims + *touching-list* + obj + a2-2 + f0-1 + (the-as collide-tri-result #f) + (the-as collide-tri-result (-> gp-0 vertex)) + ) + ) + ) + ) + (label cfg-8) + 0 + (none) + ) + ) + +(defmethod collide-with-collide-cache-prim-mesh collide-shape-prim-mesh ((obj collide-shape-prim-mesh) (arg0 collide-query) (arg1 collide-cache-prim)) + "moving mesh to mesh not supported." + (format 0 "ERROR: collide-shape-prim-mesh vs. collide-cache-prim mesh is not currently supported!~%") + (none) + ) + +(defmethod collide-with-collide-cache-prim-mesh collide-shape-prim-group ((obj collide-shape-prim-group) (arg0 collide-query) (arg1 collide-cache-prim)) + "Collide a group with a mesh in the collide cache." + (let ((s4-0 (-> arg1 prim-core collide-as)) + (s3-0 (-> obj child 0)) + ) + (countdown (s2-0 (the-as uint (-> obj num-children))) + (if (logtest? (-> s3-0 prim-core collide-with) s4-0) + (collide-with-collide-cache-prim-mesh s3-0 arg0 arg1) + ) + (&+! s3-0 80) + ) + ) + 0 + (none) + ) + +(defmethod collide-with-collide-cache-prim-sphere collide-shape-prim ((obj collide-shape-prim) (arg0 collide-query) (arg1 collide-cache-prim)) + (format 0 "ERROR: Unsupported prim type in collide-shape-prim::collide-with-collide-cache-prim-sphere!~%") + (none) + ) + +(defmethod collide-with-collide-cache-prim-sphere collide-shape-prim-sphere ((obj collide-shape-prim-sphere) (arg0 collide-query) (arg1 collide-cache-prim)) + (rlet ((vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + ) + (let* ((gp-0 (new 'stack-no-clear 'collide-tri-result)) + (f0-1 (resolve-moving-sphere-sphere + arg1 + gp-0 + (-> obj prim-core) + (-> arg0 move-dist) + (-> arg0 best-dist) + (-> arg1 prim-core action) + ) + ) + ) + (b! (< f0-1 0.0) cfg-5 :delay #f) + (let ((v1-3 (-> arg1 prim-core action)) + (a0-2 (-> obj prim-core action)) + (a2-2 (-> arg1 prim)) + ) + (let* ((a0-3 (logand a0-2 v1-3)) + (v1-4 (-> obj cshape)) + (a1-2 (logand a0-3 (collide-action solid))) + (a0-4 (-> a2-2 cshape)) + ) + (b! (zero? a1-2) cfg-4 :delay (nop!)) + (b! (logtest? (-> v1-4 penetrate-using) (-> a0-4 penetrated-by)) cfg-4 :delay (nop!)) + ) + (.lvf vf3 (&-> gp-0 vertex 0 quad)) + (.lvf vf4 (&-> gp-0 vertex 1 quad)) + (.lvf vf5 (&-> gp-0 vertex 2 quad)) + (.lvf vf1 (&-> gp-0 intersect quad)) + (.lvf vf2 (&-> gp-0 normal quad)) + (let ((v1-7 (-> gp-0 pat)) + (a0-6 (-> gp-0 collide-ptr)) + ) + (set! (-> arg0 best-dist) f0-1) + (.svf (&-> arg0 best-other-tri vertex 0 quad) vf3) + (.svf (&-> arg0 best-other-tri vertex 1 quad) vf4) + (.svf (&-> arg0 best-other-tri vertex 2 quad) vf5) + (.svf (&-> arg0 best-other-tri intersect quad) vf1) + (.svf (&-> arg0 best-other-tri normal quad) vf2) + (set! (-> arg0 best-other-tri pat) v1-7) + (set! (-> arg0 best-other-tri collide-ptr) a0-6) + ) + (set! (-> arg0 num-spheres) (the-as uint a2-2)) + (set! (-> arg0 best-my-prim) obj) + (label cfg-4) + (add-touching-prims + *touching-list* + obj + a2-2 + f0-1 + (the-as collide-tri-result #f) + (the-as collide-tri-result (-> gp-0 vertex)) + ) + ) + ) + (label cfg-5) + 0 + (none) + ) + ) + +(defmethod collide-with-collide-cache-prim-sphere collide-shape-prim-mesh ((obj collide-shape-prim-mesh) (arg0 collide-query) (arg1 collide-cache-prim)) + "Can't collide meshes with collide cache." + (format 0 "ERROR: collide-shape-prim-mesh vs. collide-cache-prim sphere is not currently supported!~%") + (none) + ) + +(defmethod collide-with-collide-cache-prim-sphere collide-shape-prim-group ((obj collide-shape-prim-group) (arg0 collide-query) (arg1 collide-cache-prim)) + (let ((s4-0 (-> arg1 prim-core collide-as)) + (s3-0 (-> obj child 0)) + ) + (countdown (s2-0 (the-as uint (-> obj num-children))) + (if (logtest? (-> s3-0 prim-core collide-with) s4-0) + (collide-with-collide-cache-prim-sphere s3-0 arg0 arg1) + ) + (&+! s3-0 80) + ) + ) + 0 + (none) + ) + +;;;;;;;;;;;;;;;;;;;;; +;; cshape reaction +;;;;;;;;;;;;;;;;;;;;; + +;; this mess has callbacks for when a collide shape hits something. This is called as part of the collision system. + +(defun find-ground-point ((arg0 control-info) (arg1 vector) (arg2 float) (arg3 float)) + "Find a safe ground point to bounce the player back to if they jump onto lava or similar." + (local-vars (sv-560 int)) + (let* ((f0-0 819.2) + (v1-1 (-> arg0 transv)) + (f30-0 (if (< f0-0 (sqrtf (+ (* (-> v1-1 x) (-> v1-1 x)) (* (-> v1-1 z) (-> v1-1 z))))) + (vector-y-angle (-> arg0 transv)) + (y-angle arg0) + ) + ) + (s2-0 (-> arg0 trans)) + (s1-0 (new 'stack-no-clear 'collide-query)) + ) + (set! (-> s1-0 collide-with) (-> arg0 root-prim prim-core collide-with)) + (set! (-> s1-0 ignore-process0) (-> arg0 process)) + (set! (-> s1-0 ignore-process1) #f) + (set! (-> s1-0 ignore-pat) (-> arg0 pat-ignore-mask)) + (set! (-> s1-0 action-mask) (collide-action solid)) + (set! (-> arg1 w) 0.0) + (dotimes (v1-9 3) + (set! (-> s1-0 bbox min data v1-9) (- (-> s2-0 data v1-9) arg3)) + (set! (-> s1-0 bbox max data v1-9) (+ (-> s2-0 data v1-9) arg3)) + ) + (set! (-> s1-0 bbox min y) (+ -40960.0 (-> s2-0 y))) + (set! (-> s1-0 bbox max y) (+ 20480.0 (-> s2-0 y))) + (fill-using-bounding-box *collide-cache* s1-0) + (vector+! (-> s1-0 start-pos) s2-0 (new 'static 'vector :y 20480.0 :w 1.0)) + (let ((v1-16 s1-0)) + (set! (-> v1-16 radius) 2048.0) + (set! (-> v1-16 collide-with) (-> arg0 root-prim prim-core collide-with)) + (set! (-> v1-16 ignore-process0) (-> arg0 process)) + (set! (-> v1-16 ignore-process1) #f) + (set! (-> v1-16 ignore-pat) (-> arg0 pat-ignore-mask)) + (set! (-> v1-16 action-mask) (collide-action solid)) + ) + (dotimes (s0-0 8) + (let ((f28-0 (+ f30-0 (if (not (logtest? s0-0 1)) + (* 8192.0 (the float (/ s0-0 2))) + (* -8192.0 (the float (/ s0-0 2))) + ) + ) + ) + ) + (set! sv-560 0) + (let ((f26-0 arg3)) + (set-vector! (-> s1-0 move-dist) 0.0 0.0 arg3 1.0) + (vector-rotate-y! (-> s1-0 move-dist) (-> s1-0 move-dist) f28-0) + (if (>= (probe-using-line-sphere *collide-cache* s1-0) 0.0) + (set! f26-0 (+ -6144.0 (vector-vector-xz-distance s2-0 (-> s1-0 best-other-tri intersect)))) + ) + (let ((f24-0 arg2)) + (while (>= f26-0 f24-0) + (set-vector! (-> s1-0 start-pos) 0.0 0.0 f24-0 1.0) + (vector-rotate-y! (-> s1-0 start-pos) (-> s1-0 start-pos) f28-0) + (vector+! (-> s1-0 start-pos) s2-0 (-> s1-0 start-pos)) + (set! (-> s1-0 start-pos y) (+ 20480.0 (-> s2-0 y))) + (set-vector! (-> s1-0 move-dist) 0.0 -61440.0 0.0 1.0) + (let ((v1-33 s1-0)) + (set! (-> v1-33 radius) 10240.0) + (set! (-> v1-33 collide-with) (-> arg0 root-prim prim-core collide-with)) + (set! (-> v1-33 ignore-process0) (-> arg0 process)) + (set! (-> v1-33 ignore-process1) #f) + (set! (-> v1-33 ignore-pat) (-> arg0 pat-ignore-mask)) + (set! (-> v1-33 action-mask) (collide-action solid)) + ) + (when (>= (probe-using-line-sphere *collide-cache* s1-0) 0.0) + (cond + ((and (or (= (-> s1-0 best-other-tri pat mode) (pat-mode ground)) + (= (-> s1-0 best-other-tri pat mode) (pat-mode halfpipe)) + ) + (and (= (-> s1-0 best-other-tri pat event) (pat-event none)) (< 0.7 (-> s1-0 best-other-tri normal y))) + ) + (set! (-> arg1 quad) (-> s1-0 best-other-tri intersect quad)) + (set! sv-560 (+ sv-560 1)) + (if (>= sv-560 2) + (return arg1) + ) + ) + ((and (= (-> s1-0 best-other-tri pat mode) (pat-mode wall)) + (< (+ 4096.0 (-> s2-0 y)) (-> s1-0 best-other-tri intersect y)) + ) + (goto cfg-38) + ) + ) + ) + (set! f24-0 (+ 4096.0 f24-0)) + ) + ) + ) + ) + (label cfg-38) + ) + ) + (the-as vector #f) + ) + +(defun target-attack-up ((arg0 target) (arg1 symbol) (arg2 symbol)) + "Send events to target in response to hitting a surface that launches you up." + (with-pp + ;; first, just send an event to test and see if we should even respond + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer pp)) + (set! (-> a1-1 num-params) 2) + (set! (-> a1-1 message) arg1) + (set! (-> a1-1 param 0) (the-as uint #f)) + (let ((v1-2 (new 'static 'attack-info :mask (attack-info-mask mode id test)))) + (set! (-> v1-2 id) (the-as uint 2)) + (set! (-> v1-2 mode) arg2) + (set! (-> v1-2 test) #t) + (set! (-> a1-1 param 1) (the-as uint v1-2)) + ) + (when (send-event-function arg0 a1-1) + ;; we should respond. now do the more complicated ground point finding. + (let ((s3-0 (find-ground-point (-> arg0 control) (new 'stack-no-clear 'vector) 8192.0 40960.0))) + (set! s3-0 (cond + (s3-0 + (empty) + s3-0 + ) + (else + (-> arg0 control last-trans-on-surf) + ) + ) + ) + (let* ((s2-1 (vector-! (new 'stack-no-clear 'vector) s3-0 (-> arg0 control trans))) + (f0-0 8192.0) + (f1-0 40960.0) + (v1-8 s2-1) + (f30-0 (fmax f0-0 (fmin f1-0 (sqrtf (+ (* (-> v1-8 x) (-> v1-8 x)) (* (-> v1-8 z) (-> v1-8 z))))))) + ) + (cond + ((< (fabs (vector-dot + (-> arg0 control dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) s3-0 (-> arg0 control trans)) + ) + ) + 40960.0 + ) + (vector-xz-normalize! s2-1 f30-0) + (let ((s1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> s1-0 from) (process->ppointer pp)) + (set! (-> s1-0 num-params) 2) + (set! (-> s1-0 message) arg1) + (set! (-> s1-0 param 0) (the-as uint #f)) + (let ((s4-1 (new 'static 'attack-info :mask (attack-info-mask vector mode shove-up angle id)))) + (set! (-> s4-1 id) (the-as uint 2)) + (set! (-> s4-1 mode) arg2) + (set! (-> s4-1 vector quad) (-> s2-1 quad)) + (set! (-> s4-1 shove-up) + (+ (lerp-scale 4096.0 16384.0 f30-0 4096.0 40960.0) (fmax 0.0 (- (-> s3-0 y) (-> arg0 control trans y)))) + ) + (set! (-> s4-1 angle) 'up) + (set! (-> s1-0 param 1) (the-as uint s4-1)) + ) + (send-event-function arg0 s1-0) + ) + ) + (else + (let ((a1-7 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-7 from) (process->ppointer pp)) + (set! (-> a1-7 num-params) 2) + (set! (-> a1-7 message) arg1) + (set! (-> a1-7 param 0) (the-as uint #f)) + (let ((v1-24 (new 'static 'attack-info :mask (attack-info-mask vector mode shove-up control angle id)))) + (set! (-> v1-24 id) (the-as uint 2)) + (set! (-> v1-24 mode) arg2) + (set! (-> v1-24 vector quad) (-> (new 'static 'vector :y 40960.0 :w 1.0) quad)) + (set! (-> v1-24 shove-up) 40960.0) + (set! (-> v1-24 angle) 'up) + (set! (-> v1-24 control) 1.0) + (set! (-> a1-7 param 1) (the-as uint v1-24)) + ) + (send-event-function arg0 a1-7) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + ) + +(defmethod react-to-pat! collide-shape-moving ((obj collide-shape-moving) (arg0 pat-surface)) + "React to colliding with the given 'pat'." + (with-pp + (let ((s5-0 0)) + (set! (-> obj cur-pat) arg0) + (set! (-> obj poly-pat) arg0) + ;; update the surface based on the material. + (case (-> arg0 material) + (((pat-material ice)) + (set! (-> obj surf) *ice-surface*) + ) + (((pat-material gravel)) + (set! (-> obj surf) *gravel-surface*) + ) + (((pat-material quicksand)) + (set! (-> obj surf) *quicksand-surface*) + ) + (((pat-material tube)) + (set! (-> obj surf) *no-walk-surface*) + ) + (else + (set! (-> obj surf) *standard-ground-surface*) + ) + ) + ;; respond to events. + (when (nonzero? (-> arg0 event)) + (case (-> arg0 event) + (((pat-event slide)) + (set! (-> obj surf) *gravel-surface*) + (send-event (-> obj process) 'slide) + ) + (((pat-event slippery)) + (set! (-> obj surf) *gravel-surface*) + ) + (((pat-event rail)) + (let* ((s4-0 (-> obj process)) + (a0-14 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + (if (and a0-14 (zero? (logand (focus-status rail) (-> (the-as process-focusable a0-14) focus-status)))) + (set! (-> obj surf) *rail-surface*) + ) + ) + ) + (((pat-event deadly)) + (set! s5-0 (logior s5-0 #x4000)) + (let ((a1-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-4 from) (process->ppointer pp)) + (set! (-> a1-4 num-params) 2) + (set! (-> a1-4 message) 'attack) + (set! (-> a1-4 param 0) (the-as uint #f)) + (let ((v1-24 (new 'static 'attack-info :mask (attack-info-mask mode shove-up id)))) + (set! (-> v1-24 id) (the-as uint 2)) + (set! (-> v1-24 mode) 'deadly) + (set! (-> v1-24 shove-up) 12288.0) + (set! (-> a1-4 param 1) (the-as uint v1-24)) + ) + (send-event-function (-> obj process) a1-4) + ) + ) + (((pat-event burn)) + (set! s5-0 (logior s5-0 #x4000)) + (let ((a1-5 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-5 from) (process->ppointer pp)) + (set! (-> a1-5 num-params) 2) + (set! (-> a1-5 message) 'attack) + (set! (-> a1-5 param 0) (the-as uint #f)) + (let ((v1-29 (new 'static 'attack-info :mask (attack-info-mask mode shove-up id)))) + (set! (-> v1-29 id) (the-as uint 2)) + (set! (-> v1-29 mode) 'burn) + (set! (-> v1-29 shove-up) 12288.0) + (set! (-> a1-5 param 1) (the-as uint v1-29)) + ) + (send-event-function (-> obj process) a1-5) + ) + ) + (((pat-event deadlup)) + (set! s5-0 (logior s5-0 #x4000)) + (target-attack-up (the-as target (-> obj process)) 'attack-or-shove 'deadlyup) + ) + (((pat-event shockup)) + (set! s5-0 (logior s5-0 #x4000)) + (target-attack-up (the-as target (-> obj process)) 'attack-or-shove 'shockup) + ) + (((pat-event burnup)) + (when (not (logtest? (focus-status pilot) (-> (the-as process-focusable (-> obj process)) focus-status))) + (set! s5-0 (logior s5-0 #x4000)) + (target-attack-up (the-as target (-> obj process)) 'attack-or-shove 'burnup) + ) + ) + (((pat-event melt)) + (set! s5-0 (logior s5-0 #x4000)) + (let ((a1-9 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-9 from) (process->ppointer pp)) + (set! (-> a1-9 num-params) 2) + (set! (-> a1-9 message) 'attack-invinc) + (set! (-> a1-9 param 0) (the-as uint #f)) + (let ((v1-40 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (set! (-> v1-40 id) (the-as uint 2)) + (set! (-> v1-40 mode) 'melt) + (set! (-> a1-9 param 1) (the-as uint v1-40)) + ) + (send-event-function (-> obj process) a1-9) + ) + ) + (((pat-event endlessfall)) + (set! s5-0 (logior s5-0 #x4000)) + (let ((a1-10 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-10 from) (process->ppointer pp)) + (set! (-> a1-10 num-params) 2) + (set! (-> a1-10 message) 'attack-invinc) + (set! (-> a1-10 param 0) (the-as uint #f)) + (let ((v1-45 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (set! (-> v1-45 id) (the-as uint 2)) + (set! (-> v1-45 mode) 'endlessfall) + (set! (-> a1-10 param 1) (the-as uint v1-45)) + ) + (send-event-function (-> obj process) a1-10) + ) + ) + (((pat-event shock)) + (set! s5-0 (logior s5-0 #x4000)) + (let ((a1-11 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-11 from) (process->ppointer pp)) + (set! (-> a1-11 num-params) 2) + (set! (-> a1-11 message) 'attack-invinc) + (set! (-> a1-11 param 0) (the-as uint #f)) + (let ((v1-50 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (set! (-> v1-50 id) (the-as uint 2)) + (set! (-> v1-50 mode) 'shock) + (set! (-> a1-11 param 1) (the-as uint v1-50)) + ) + (send-event-function (-> obj process) a1-11) + ) + ) + (((pat-event lip)) + (send-event (-> obj process) 'lip 'lip) + ) + (((pat-event lipramp)) + (send-event (-> obj process) 'lip 'lipramp) + ) + ) + ) + ) + (none) + ) + ) + +(defun collide-shape-moving-angle-set! ((arg0 collide-shape-moving) (arg1 vector) (arg2 vector)) + "Update the angle parameters" + (set! (-> arg0 surface-normal quad) (-> arg1 quad)) + (set! (-> arg0 surface-angle) (vector-dot arg1 (-> arg0 dynam gravity-normal))) + (set! (-> arg0 poly-angle) (vector-dot (-> arg0 poly-normal) (-> arg0 dynam gravity-normal))) + (set! (-> arg0 touch-angle) + (fmax + (-> arg0 touch-angle) + (vector-dot arg1 (vector-normalize! (vector-negate! (new-stack-vector0) arg2) 1.0)) + ) + ) + 0 + (none) + ) + +(defun cshape-reaction-update-state ((arg0 control-info) (arg1 collide-query) (arg2 vector)) + "Common update for cshape reaction." + (local-vars (sv-48 vector) (sv-52 vector) (sv-56 collide-status) (sv-96 symbol)) + (set! sv-48 (new-stack-vector0)) + (set! sv-52 (new-stack-vector0)) + (set! sv-56 (collide-status)) + + ;; do the move! + (let ((a1-1 (new 'stack-no-clear 'vector))) + (vector-float*! a1-1 (-> arg1 move-dist) (-> arg1 best-dist)) + (move-by-vector! arg0 a1-1) + ) + + ;; do reactions + (react-to-pat! arg0 (-> arg1 best-other-tri pat)) + + ;; direction to the collision point + (vector-! sv-48 (the-as vector (-> arg1 best-my-prim prim-core)) (-> arg1 best-other-tri intersect)) + + ;; compute "coverage". this is a measure of how much the triangle below us "supports" us. + (cond + ((and (= (-> arg1 best-dist) 0.0) ;; can't move + (< (vector-length sv-48) (+ -40.96 (-> arg1 best-my-prim prim-core world-sphere w))) ;; 1m in collision! + ) + + ;; hack: things have gone very wrong. + ;; added print + (format 0 "very far in collision hack running~%") + (set! (-> sv-48 quad) (-> arg1 best-other-tri normal quad)) ;; just use the triangle's normal, things are bad. + (set! (-> arg0 coverage) 0.0) + ) + (else + (set! (-> sv-48 w) 1.0) + (vector-normalize! sv-48 1.0) + ;; dot with normal is the coverage + (set! (-> arg0 coverage) (vector-dot sv-48 (-> arg1 best-other-tri normal))) + ;; hack + (when (< (-> arg0 coverage) 0.0) + ;; no idea how this can happen, but cheat things to project to the plane of the triangle. + (set! (-> arg0 coverage) 0.0) ;; would be 0 + ;; projects to plane + (vector-flatten! sv-48 sv-48 (-> arg1 best-other-tri normal)) + (vector-normalize! sv-48 1.0) + ) + ) + ) + ;; ?? + (let ((v1-25 (-> sv-48 quad))) + (set! (-> sv-52 quad) v1-25) + ) + ;; hack: if we can't move, move out, but only a very small amount. + (if (= (-> arg1 best-dist) 0.0) + (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-52 6.0)) + ) + + ;; fill out normals/angles + (set! (-> arg0 poly-normal quad) (-> arg1 best-other-tri normal quad)) + (collide-shape-moving-angle-set! arg0 sv-52 arg2) + + ;; flags! + (if (< (-> arg0 poly-angle) -0.2) + (set! sv-56 (logior sv-56 (collide-status touch-ceiling))) + ) + (set! sv-96 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle))) + + ;; if we hit this function, we hit some surface + (set! sv-56 (logior sv-56 (collide-status touch-surface))) + + ;; if the thing we hit is spheres, it's not water or background. + (if (-> arg1 num-spheres) + (set! sv-56 (logior sv-56 (collide-status touch-actor))) + ) + (cond + (sv-96 + ;; on a wall + (set! sv-56 (logior sv-56 (collide-status touch-wall))) + (set! (-> arg0 cur-pat mode) 1) + ) + (else + ;; on the ground + (set! sv-56 (logior sv-56 (collide-status on-surface))) + (set! (-> arg0 local-normal quad) (-> sv-52 quad)) + ) + ) + (when (and (not sv-96) (>= (-> arg0 coverage) 0.9)) + ;; on the ground, and not slipping off an edge. + (set! sv-56 (logior sv-56 (collide-status on-ground))) + (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) + (when (!= (-> arg0 poly-pat mode) (pat-mode wall)) + (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) + (set! (-> arg0 grount-touch-point quad) (-> arg1 best-other-tri intersect quad)) + ) + ) + ;; catch transition to ground. + (when (not (logtest? (-> arg0 prev-status) (collide-status on-surface))) + (set! sv-56 (logior sv-56 (collide-status impact-surface))) + (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) + ) + (logior! (-> arg0 status) sv-56) + 0 + (none) + ) + +(defun cshape-reaction-default ((arg0 control-info) (arg1 collide-query) (arg2 vector) (arg3 vector)) + "Default collision reaction. Bounce off of wall, react to things, etc." + + ;; do most of the math and move: + (cshape-reaction-update-state arg0 arg1 arg3) + + (let ((a1-1 (new 'stack-no-clear 'vector))) + (set! (-> a1-1 quad) (-> arg3 quad)) + ;; check for impact: + (when (and (not (logtest? (-> arg0 prev-status) (collide-status on-surface))) + (zero? (logand (-> arg0 status) (collide-status touch-wall))) + ) + ;; do "impact friction" + (let ((f0-1 (- 1.0 (-> arg0 surf impact-fric)))) + (when (< f0-1 1.0) + (let ((v1-9 (new-stack-vector0)) + (f1-3 (vector-dot (-> arg0 dynam gravity-normal) a1-1)) + ) + 0.0 + (vector-! v1-9 a1-1 (vector-float*! v1-9 (-> arg0 dynam gravity-normal) f1-3)) + (let* ((f2-2 (vector-length v1-9)) + (f3-0 f2-2) + ) + (if (< f1-3 0.0) + (set! f1-3 (* f1-3 f0-1)) + ) + (vector+! + a1-1 + (vector-float*! a1-1 (-> arg0 dynam gravity-normal) f1-3) + (vector-float*! v1-9 v1-9 (/ f2-2 f3-0)) + ) + ) + ) + ) + ) + ) + ;; and compute our new velocity! + (vector-reflect-flat-above! arg2 a1-1 (-> arg0 surface-normal)) + ) + (-> arg0 status) + ) + +(defun cshape-reaction-just-move ((arg0 control-info) (arg1 collide-query) (arg2 vector)) + "Simple collision reaction. Just stop at the obstacle." + ;; set velocity to 0 to stop + (vector-reset! arg2) + ;; move until we hit the thing + (let ((a1-1 (new 'stack-no-clear 'vector))) + (vector-float*! a1-1 (-> arg1 move-dist) (-> arg1 best-dist)) + (move-by-vector! arg0 a1-1) + ) + + ;; set falgs. + (let ((v1-5 4)) + (if (-> arg1 num-spheres) + (set! v1-5 (logior v1-5 32)) + ) + (let ((v0-1 (logior (-> arg0 status) v1-5))) + (set! (-> arg0 status) v0-1) + v0-1 + ) + ) + ) + +(defmethod step-collison! collide-shape-moving ((obj collide-shape-moving) (arg0 vector) (arg1 vector) (arg2 float) (arg3 int)) + "Main function to move forward until we hit a single thing, then react." + (local-vars (sv-592 int)) + (with-pp + (let ((s5-0 (new 'stack 'collide-query)) + (s2-0 (new 'stack-no-clear 'vector)) + ) + ;; figure out how far we want to move + (vector-float*! s2-0 arg1 (* arg2 (-> pp clock seconds-per-frame))) + ;; setup collision query + (set! (-> s5-0 move-dist quad) (-> s2-0 quad)) + (set! (-> s5-0 best-dist) -100000000.0) + (set! (-> s5-0 best-my-prim) #f) + (set! (-> s5-0 num-spheres) (the-as uint #f)) + (let* ((s1-1 (-> obj root-prim)) + (v1-5 *collide-cache*) + (s0-0 (the-as collide-cache-prim (-> v1-5 prims))) + ) + (set! sv-592 (-> v1-5 num-prims)) + + ;; collide against everything in the collide cache + (while (nonzero? sv-592) + (set! sv-592 (+ sv-592 -1)) + (when (logtest? (-> s1-1 prim-core collide-with) (-> s0-0 prim-core collide-as)) + (if (>= (the-as int (-> s0-0 prim-core prim-type)) 0) + (collide-with-collide-cache-prim-mesh s1-1 s5-0 s0-0) + (collide-with-collide-cache-prim-sphere s1-1 s5-0 s0-0) + ) + ) + (&+! s0-0 48) + ) + ) + + ;; see how far we can move + (let ((f30-0 (-> s5-0 best-dist))) + (set! f30-0 (cond + ((>= f30-0 0.0) ;; set a positive value, means we can't move all the way! + + ;; remember velocity before reaction + (let ((s2-1 (new 'stack-no-clear 'vector))) + (if *display-collision-marks* + (set! (-> s2-1 quad) (-> arg1 quad)) + ) + + ;; handle collision. will move us. + (set! (-> obj prev-status) ((-> obj reaction) (the-as control-info obj) s5-0 arg0 arg1)) + + ;; debug draw + (when *display-collision-marks* + (let ((t1-0 (-> *pat-mode-info* (-> s5-0 best-other-tri pat mode) hilite-color))) + (add-debug-outline-triangle + #t + (bucket-id debug-no-zbuf1) + (the-as vector (-> s5-0 best-other-tri)) + (-> s5-0 best-other-tri vertex 1) + (-> s5-0 best-other-tri vertex 2) + t1-0 + ) + ) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (-> s5-0 best-other-tri intersect) + s2-1 + (meters 0.00007324219) + (new 'static 'rgba :r #xff :g #xa0 :a #x80) + ) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (-> s5-0 best-other-tri intersect) + arg0 + (meters 0.00007324219) + (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) + ) + (if (= (-> obj process type) target) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (-> s5-0 best-other-tri intersect) + (-> obj surface-normal) + (meters 0.5) + (-> *pat-mode-info* (-> obj cur-pat mode) hilite-color) + ) + ) + ) + ) + ;; return how far we went. + f30-0 + ) + (else + ;; didn't collide. call no reaction and clear stuff + (set! (-> obj reaction-flag) (cshape-reaction-flags)) + ((-> obj no-reaction) obj s5-0 arg0 arg1) + (set! (-> obj prev-status) (collide-status)) + ;; move all the way + (move-by-vector! obj s2-0) + (set! (-> arg0 quad) (-> arg1 quad)) + 1.0 ;; return 1 to indicate that we did the whole thing. + ) + ) + ) + f30-0 + ) + ) + ) + ) + +;;;;;;;;;;;;;;;;;;;;;;;;;; +;; integrate and collide +;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; this function moves collide shapes by one frame. + +(defmethod integrate-and-collide! collide-shape ((obj collide-shape) (arg0 vector)) + ;; for the simple collide shape, just move, and ignore collision. + (local-vars (at-0 int)) + (with-pp + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((t9-0 (method-of-object obj move-by-vector!)) + (v1-1 (new 'stack-no-clear 'vector)) + ) + (.lvf vf1 (&-> arg0 quad)) + (let ((f0-0 (-> pp clock seconds-per-frame))) + (.mov at-0 f0-0) + ) + (.mov vf2 at-0) + (.mov.vf vf1 vf0 :mask #b1000) + (.mul.x.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> v1-1 quad) vf1) + (t9-0 obj v1-1) + ) + (none) + ) + ) + ) + +(defmethod integrate-and-collide! collide-shape-moving ((obj collide-shape-moving) (arg0 vector)) + "Main function to move a collide shape at a given velocity for 1 frame." + + ;; compute the location of our collision geometry based on transforms from animations/other places. + (update-transforms obj) + + ;; set up status + (set! (-> obj trans-old-old-old quad) (-> obj trans-old-old quad)) + (set! (-> obj trans-old-old quad) (-> obj trans-old quad)) + (set! (-> obj trans-old quad) (-> obj trans quad)) + (set! (-> obj prev-status) (-> obj status)) + (logclear! (-> obj status) (collide-status + on-surface + on-ground + touch-surface + touch-wall + touch-ceiling + touch-actor + on-special-surface + touch-edge + blocked + on-water + impact-surface + touch-background + stuck + glance + ) + ) + (when (not (logtest? (-> obj root-prim prim-core action) (collide-action no-normal-reset))) + (let ((v1-13 (-> obj dynam gravity-normal))) + (set! (-> obj local-normal quad) (-> v1-13 quad)) + (set! (-> obj surface-normal quad) (-> v1-13 quad)) + (set! (-> obj poly-normal quad) (-> v1-13 quad)) + ) + (set! (-> obj coverage) 0.0) + (set! (-> obj touch-angle) 0.0) + ) + + ;; collision loop: run until we: + ;; - almost make it all the way + ;; - hit the iteration count + ;; - hit velocity of 0. + (let ((f30-0 1.0) + (s4-0 0) + ) + (while (and (< 0.05 f30-0) (and (< s4-0 (the-as int (-> obj max-iteration-count))) + (not (and (= (-> arg0 x) 0.0) (= (-> arg0 y) 0.0) (= (-> arg0 z) 0.0))) + ) + ) + (let ((f28-0 (step-collison! obj arg0 arg0 f30-0 s4-0))) ;; move until we hit something, or travel the full distance + (update-from-step-size *touching-list* f28-0) ;; update touch list with the actual step size + (set! f30-0 (- f30-0 (* f28-0 f30-0))) ;; update how much is left (fraction of what we tried) + ) + (+! s4-0 1) + ) + ) + 0 + (none) + ) + +(defmethod integrate-and-collide! control-info ((obj control-info) (arg0 vector)) + "specialization of integrate-and-collide! for the control-info used in target." + (with-pp + (stopwatch-start (the-as stopwatch (&-> *collide-stats* pad0 1))) ;; i think this code is just broken. + + ;; hack: prevent crazy velocities. + (when (< 1638400.0 (vector-length arg0)) + (format 0 "WARNING: target vel is ~M m/s, reseting to zero.~%" (vector-length arg0)) + (vector-reset! arg0) + ) + + ;; the jump and double jump animations have a collide-offset trick applied to them. + ;; (todo: move part of this comment to target.gc) + + ;; this trick is kind of complicated: + ;; some art-joint-anim's (jump only?) involve jak tucking in his feet near the apex, and we want the collision geometry to + ;; follow his feet. + ;; However, we don't wan't jak's feet to be the point that follows a ballistic trajectory - it should be + ;; his center of mass somewhere in his torso. + + ;; the animation is in a frame that should follow the ballistic trajectory - his torso is roughly + ;; stationary. The control code is responsible for generating the actual trajectory; + ;; the animation stores a res-lump with a time-varying collide-offset, which is the trajectory of jak's feet moving. + + ;; the way they handle this is by cheating jak's position to align with the feet/collision geometry, + ;; then applying an offset to drawing. To make it more confusing, this offset is applied on the velocity level + ;; - this makes the collision stuff more correct. + + ;; remember old before recomputing - this is how much we've cheated jak's collision geometry + ;; position to account for movement in the animation frame. + (set! (-> obj old-anim-collide-offset-world quad) (-> obj anim-collide-offset-world quad)) + + ;; transform this frame's anim offset to world + (vector-matrix*! + (-> obj anim-collide-offset-world) + (-> obj anim-collide-offset-local) + (-> obj ctrl-orientation) + ) + + ;; compute how much the anim offset changed, in world frame, since last frame. + (vector-! + (-> obj anim-collide-offset-delta-world) + (-> obj anim-collide-offset-world) + (-> obj old-anim-collide-offset-world) + ) + + ;; compute the total offset of drawing. The draw-offset is used for non-collision animation like the zoomer bobbing. + ;; Note: we subtract off the anim offset here. This way, we can add the anim offset to jak's position later on, and + ;; it will move the collision geometry without changing the drawing. + (let ((total-offset + (vector-! (new 'stack-no-clear 'vector) (-> obj draw-offset) (-> obj anim-collide-offset-world)) + ) + ) + ;; and also rate limit it to prevent huge jumps in jak's animation when exiting an anim early. + ;; in theory, this should follow the blending of animations, but this likely good enough. + (vector-seek! (-> obj cspace-offset) total-offset (* 16384.0 (-> pp clock seconds-per-frame))) + ) + + ;; compute the total extra velocity to add to collide. + (let ((bonus-vel (vector+float*! + (new-stack-vector0) + (-> obj collide-extra-velocity) ;; some other weird offset. + (-> obj anim-collide-offset-delta-world) + 60.0 + ) + ) + ) + + ;; new for jak 2: the movement of the collision geometry due to collide-offset now has its reaction + ;; canceled out. This is done by first stepping collision from only the bonus velcoity, keeping that + ;; position, then overwriting the old velocity. + ;; this is like trying to move the collision geometry, but if we hit something, don't go boucing off the ceiling. + (when (< 0.0 (vector-length bonus-vel)) + (let ((old-iter-cnt (-> obj max-iteration-count)) + (old-in-vel (new 'stack-no-clear 'vector)) + ) + (set! (-> old-in-vel quad) (-> arg0 quad)) + (let ((old-stat-flg (-> obj status))) + (let ((t9-4 (method-of-type collide-shape-moving integrate-and-collide!))) + (t9-4 obj bonus-vel) + ) + (set! (-> obj max-iteration-count) old-iter-cnt) + (set! (-> arg0 quad) (-> old-in-vel quad)) ;; set it back. + (logior! (-> obj status) old-stat-flg) + ) + ) + ) + ) + + ;; now do normal collision. + (let ((regular-vel (new-stack-vector0))) + (set! (-> regular-vel quad) (-> arg0 quad)) + (let ((before-regular-vel (new 'stack-no-clear 'vector))) + (set! (-> before-regular-vel quad) (-> arg0 quad)) + ;; run collision! + (let ((t9-5 (method-of-type collide-shape-moving integrate-and-collide!))) + (t9-5 obj regular-vel) + ) + + ;; b1 and a1 are before and after velocities + (let ((b1 (new-stack-vector0))) + (set! (-> b1 quad) (-> before-regular-vel quad)) + (let ((a1 (new-stack-vector0))) + (set! (-> a1 quad) (-> regular-vel quad)) + + ;; this code allows the weighting of normal and parallel to gravity components, but + ;; both are set up to just get normal to gravity. + (let ((b1-nrm-to-grav (new-stack-vector0))) + (let ((f0-6 (vector-dot (-> obj dynam gravity-normal) b1))) + 0.0 + ;; subtract off the stuff in the direction of gravity. + (vector-! b1-nrm-to-grav b1 (vector-float*! b1-nrm-to-grav (-> obj dynam gravity-normal) f0-6)) + ) + (let* ((b1-nrm-to-grav-vel (vector-length b1-nrm-to-grav)) + (f1-4 b1-nrm-to-grav-vel) ;; * 1.0 probably + (f2-0 0.0) ;; no weight for grav term. + ) + (vector+! + b1 + (vector-float*! b1 (-> obj dynam gravity-normal) f2-0) ;; 0 + (vector-float*! b1-nrm-to-grav b1-nrm-to-grav (/ b1-nrm-to-grav-vel f1-4)) ;; just normal grav + ) + ) + ) + (let ((v1-33 (new-stack-vector0))) + (let ((f0-10 (vector-dot (-> obj dynam gravity-normal) a1))) + 0.0 + (vector-! v1-33 a1 (vector-float*! v1-33 (-> obj dynam gravity-normal) f0-10)) + ) + (let* ((f0-11 (vector-length v1-33)) + (f1-6 f0-11) + (f2-1 0.0) + ) + (vector+! + a1 + (vector-float*! a1 (-> obj dynam gravity-normal) f2-1) + (vector-float*! v1-33 v1-33 (/ f0-11 f1-6)) + ) + ) + ) + + ;; normalize to get directions. + (vector-normalize! b1 1.0) + (vector-normalize! a1 1.0) + + ;; detect if we are blocked. "blocked" means that collision changed our velocity direction, + ;; but we are still moving (which ends up being true if you're pushing on the stick at all) + ;; this is a noisy signal, so there's a filtered "blocked factor" between 0 and 1 that increases + ;; the more blocked you are. + (let ((ba-dot (vector-dot b1 a1))) + (cond + ((and (!= (vector-length (-> obj target-transv)) 0.0) ;; standing still at wall doesn't count + (if (logtest? (-> obj status) (collide-status touch-wall)) ;; make it easier to hit blocked if touching wall. + (< ba-dot 0.9999) + (< ba-dot 0.95) + ) + ) + ;; increase a blocked counter. + (seek! (-> obj blocked-factor) 1.0 (* 4.0 (-> pp clock seconds-per-frame))) + + ;; and a "air block" counter. + (seek! + (-> obj blocked-in-air-factor) + (if (= (-> obj unknown-surface00 mode) 'air) + 1.0 + 0.0 + ) + (* 4.0 (-> pp clock seconds-per-frame)) + ) + ;; set block flag. + (logior! (-> obj status) (collide-status blocked)) + ) + (else + ;; not blocked, wind down counters. + (seek! (-> obj blocked-factor) 0.0 (* 2.0 (-> pp clock seconds-per-frame))) + (seek! (-> obj blocked-in-air-factor) 0.0 (* 2.0 (-> pp clock seconds-per-frame))) + ) + ) + ) + ) + ) + ;; set velocity. + (set! (-> arg0 quad) (-> regular-vel quad)) + + ;; update btransv. this is suppposed to be the last good velocity before becoming blocked, or something like that. + ;; this is only increased in this function, and some other code clamps it to be no larger than your joystick command. + ;; so you can increase it by actually travelling at speed, and can decrease it by letting off the joystick. + (if (and (logtest? (-> obj status) (collide-status on-surface)) ;; only update if we're on a surface + (and (not (logtest? (-> obj status) (collide-status touch-wall blocked))) ;; and not blocked + (< (vector-length (-> obj btransv)) (vector-length before-regular-vel)) ;; and faster than current btransv. + ) + ) + (set! (-> obj btransv quad) (-> before-regular-vel quad)) + ) + ) + ) + + ;; see how our velocity after collision compares to the velocity we got after aligning. + (let ((align-xz-dir (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> obj align-xz-vel) 1.0)) + (align-xz-speed (vector-length (-> obj align-xz-vel))) + ) + (set! (-> obj zx-vel-frac) (if (= align-xz-speed 0.0) + 0.0 + (fmax 0.0 (/ (vector-dot (-> obj transv) align-xz-dir) align-xz-speed)) + ) + ) + ) + (stopwatch-stop (the-as stopwatch (&-> *collide-stats* pad0 1))) + 0 + (none) + ) + ) + +(defmethod try-snap-to-surface collide-shape-moving ((obj collide-shape-moving) (vel vector) (check-dist float) (amt float) (bounce-dist float)) + "Strange function to try to find a surface and move to it. + Teleports a distance of check-dist, then moves back to the start point plus amt. + If this move hits something, moves to that surface, then an additional bounce-dist. + I have no idea what this is used for - it kinda seems like this is a hack to make sure that + projectiles that start inside something will hit that thing." + (local-vars (at-0 int)) + (with-pp + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((initial-trans (new 'stack-no-clear 'vector)) + (collide-vel (new 'stack-no-clear 'vector)) + ) + ;; remember where we started + (set! (-> initial-trans quad) (-> obj trans quad)) + ;; move the check-dist (teleporting) + (vector-normalize-copy! (-> obj trans) vel check-dist) + (vector+! (-> obj trans) (-> obj trans) initial-trans) + ;; update for the start position + (update-transforms obj) + ;; compute vel to make it back (plus amt) + (vector-normalize-copy! collide-vel vel (- amt check-dist)) + (let ((v1-4 collide-vel)) + (.lvf vf1 (&-> collide-vel quad)) + (let ((f0-2 (-> pp clock frames-per-second))) + (.mov at-0 f0-2) + ) + (.mov vf2 at-0) + (.mov.vf vf1 vf0 :mask #b1000) + (.mul.x.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> v1-4 quad) vf1) + ) + ;; run collision. + (set! (-> obj prev-status) (-> obj status)) + (logclear! (-> obj status) (collide-status + on-surface + on-ground + touch-surface + touch-wall + touch-ceiling + touch-actor + on-special-surface + touch-edge + blocked + on-water + impact-surface + touch-background + stuck + glance + ) + ) + (when (not (logtest? (-> obj root-prim prim-core action) (collide-action no-normal-reset))) + (let ((v1-13 (-> obj dynam gravity-normal))) + (set! (-> obj local-normal quad) (-> v1-13 quad)) + (set! (-> obj surface-normal quad) (-> v1-13 quad)) + (set! (-> obj poly-normal quad) (-> v1-13 quad)) + ) + (set! (-> obj coverage) 0.0) + (set! (-> obj touch-angle) 0.0) + ) + (let ((f30-0 (step-collison! obj collide-vel collide-vel 1.0 0))) ;; just one step. + (update-from-step-size *touching-list* f30-0) ;; update touching list, so we hit things. + (cond + ((< f30-0 1.0) + ;; hit a thing! do the bounce thing + (let ((vel-dir (new 'stack-no-clear 'vector)) + (s2-1 (new 'stack-no-clear 'vector)) + ) + (vector-normalize-copy! vel-dir vel 1.0) + (vector-! s2-1 (-> obj trans) initial-trans) + (when (< (vector-dot vel-dir s2-1) bounce-dist) + (vector-normalize-copy! s2-1 vel bounce-dist) + (vector+! s2-1 s2-1 initial-trans) + (move-to-point! obj s2-1) + ) + ) + #t + ) + (else + ;; nope, revert to old position. + (move-to-point! obj initial-trans) + #f + ) + ) + ) + ) + ) + ) + ) + +(defmethod fill-and-try-snap-to-surface collide-shape-moving ((obj collide-shape-moving) (arg0 vector) (arg1 float) (arg2 float) (arg3 float) (arg4 collide-query)) + "Fill the collision cache and try to snap to a nearby surface." + (vector-normalize-copy! (-> arg4 start-pos) arg0 arg1) + (vector+! (-> arg4 start-pos) (-> arg4 start-pos) (-> obj trans)) + (vector-normalize-copy! (-> arg4 move-dist) arg0 (- arg2 arg1)) + (fill-using-line-sphere *collide-cache* arg4) + (try-snap-to-surface obj arg0 arg1 arg2 arg3) + ) + +(defmethod move-to-ground-point collide-shape-moving ((obj collide-shape-moving) (arg0 vector) (arg1 vector) (arg2 vector)) + "Move to point, and treat as ground." + (move-to-point! obj arg0) + (set! (-> arg1 y) 0.0) + (set! (-> obj grount-touch-point quad) (-> arg0 quad)) + (set! (-> obj poly-normal quad) (-> arg2 quad)) + (set! (-> obj surface-normal quad) (-> arg2 quad)) + (set! (-> obj local-normal quad) (-> arg2 quad)) + (set! (-> obj ground-poly-normal quad) (-> arg2 quad)) + (logior! (-> obj status) (collide-status on-surface on-ground touch-surface)) + (set! (-> obj ground-impact-vel) (- (vector-dot arg1 (-> obj dynam gravity-normal)))) + 0 + (none) + ) + +(defmethod integrate-no-collide! collide-shape-moving ((obj collide-shape-moving) (arg0 vector)) + "Move, ignoring all collision." + (local-vars (at-0 int)) + (with-pp + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (update-transforms obj) + (set! (-> obj trans-old-old-old quad) (-> obj trans-old-old quad)) + (set! (-> obj trans-old-old quad) (-> obj trans-old quad)) + (set! (-> obj trans-old quad) (-> obj trans quad)) + (set! (-> obj prev-status) (-> obj status)) + (logclear! (-> obj status) (collide-status + on-surface + on-ground + touch-surface + touch-wall + touch-ceiling + touch-actor + on-special-surface + touch-edge + blocked + on-water + impact-surface + touch-background + stuck + glance + ) + ) + (when (not (logtest? (-> obj root-prim prim-core action) (collide-action no-normal-reset))) + (let ((v1-13 (-> obj dynam gravity-normal))) + (set! (-> obj local-normal quad) (-> v1-13 quad)) + (set! (-> obj surface-normal quad) (-> v1-13 quad)) + (set! (-> obj poly-normal quad) (-> v1-13 quad)) + ) + (set! (-> obj coverage) 0.0) + (set! (-> obj touch-angle) 0.0) + ) + (let ((t9-1 (method-of-object obj move-by-vector!)) + (a1-5 (new 'stack-no-clear 'vector)) + ) + (.lvf vf1 (&-> arg0 quad)) + (let ((f0-2 (-> pp clock seconds-per-frame))) + (.mov at-0 f0-2) + ) + (.mov vf2 at-0) + (.mov.vf vf1 vf0 :mask #b1000) + (.mul.x.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> a1-5 quad) vf1) + (t9-1 obj a1-5) + ) + 0 + (none) + ) + ) + ) + +(defmethod integrate-for-enemy-no-mtg collide-shape-moving ((obj collide-shape-moving) (arg0 vector) (arg1 overlaps-others-params)) + "Simpler move for enemy, with no moving to ground. Will just stop if the move collides." + (integrate-no-collide! obj arg0) + (let ((s5-1 (find-overlapping-shapes obj arg1))) + (if s5-1 ;; if we hit something, move back. + (move-to-point! obj (-> obj trans-old)) + ) + s5-1 + ) + ) + +(defmethod find-ground collide-shape-moving ((obj collide-shape-moving) (arg0 collide-query) (arg1 collide-spec) (arg2 float) (arg3 float) (arg4 float)) + "Find the ground, return #t if we found it, and fill out gspot in the collide-query." + (with-pp + (set! (-> obj gspot-pos quad) (-> obj trans quad)) + (set! (-> arg0 start-pos quad) (-> obj trans quad)) + (vector-reset! (-> arg0 move-dist)) + (let ((f0-0 (-> obj transv y))) + (if (< f0-0 0.0) + (set! arg2 (- arg2 (fmax -40960.0 (* f0-0 (-> pp clock seconds-per-frame))))) + ) + ) + (+! (-> arg0 start-pos y) arg2) + (set! (-> arg0 move-dist y) (- (+ arg2 arg3))) + (let ((v1-7 arg0)) + (set! (-> v1-7 radius) arg4) + (set! (-> v1-7 collide-with) arg1) + (set! (-> v1-7 ignore-process0) (-> obj process)) + (set! (-> v1-7 ignore-process1) #f) + (set! (-> v1-7 ignore-pat) (logior (new 'static 'pat-surface :noendlessfall #x1) (-> obj pat-ignore-mask))) + (set! (-> v1-7 action-mask) (collide-action solid)) + ) + (cond + ((>= (fill-and-probe-using-line-sphere *collide-cache* arg0) 0.0) + (set! (-> obj gspot-pos y) (-> arg0 best-other-tri intersect y)) + (set! (-> obj gspot-normal quad) (-> arg0 best-other-tri normal quad)) + #t + ) + (else + (set! (-> obj gspot-pos y) -40959590.0) + (set! (-> obj gspot-normal quad) (-> *y-vector* quad)) + #f + ) + ) + ) + ) + +(defmethod above-ground? collide-shape ((obj collide-shape) (arg0 collide-query) (arg1 vector) (arg2 object) (arg3 float) (arg4 float) (arg5 float)) + "Check to see if we are above the ground." + (set! (-> arg0 start-pos quad) (-> arg1 quad)) + (+! (-> arg0 start-pos y) arg3) + (vector-reset! (-> arg0 move-dist)) + (set! (-> arg0 move-dist y) (- (+ arg3 arg4))) + (let ((v1-2 arg0)) + (set! (-> v1-2 radius) arg5) + (set! (-> v1-2 collide-with) (the-as collide-spec arg2)) + (set! (-> v1-2 ignore-process0) (-> obj process)) + (set! (-> v1-2 ignore-process1) #f) + (set! (-> v1-2 ignore-pat) (-> obj pat-ignore-mask)) + (set! (-> v1-2 action-mask) (collide-action solid)) + ) + (>= (fill-and-probe-using-line-sphere *collide-cache* arg0) 0.0) + ) + +(defmethod move-above-ground collide-shape-moving ((obj collide-shape-moving) (arg0 vector) (arg1 move-above-ground-params)) + "Move at the given velocity, while not going through the ground" + (with-profiler 'collide *profile-collide-color* + (set! (-> arg1 on-ground?) #f) + (set! (-> arg1 do-move?) #t) + (set! (-> arg1 old-gspot-pos quad) (-> obj gspot-pos quad)) + (set! (-> arg1 old-gspot-normal quad) (-> obj gspot-normal quad)) + (set! (-> obj trans-old-old-old quad) (-> obj trans-old-old quad)) + (set! (-> obj trans-old-old quad) (-> obj trans-old quad)) + (set! (-> obj trans-old quad) (-> obj trans quad)) + (set! (-> obj prev-status) (-> obj status)) + + ;; move! note that we don't actually call move-to-point! yet - that's more + ;; expensive, and we save it for when we actually know the final position. + (vector-v+! (-> obj trans) (-> obj trans) arg0) + (set! (-> arg1 new-pos quad) (-> obj trans quad)) + + ;; find the ground. + (let ((s3-1 (new 'stack-no-clear 'collide-query))) + (cond + ((find-ground obj s3-1 (-> arg1 gnd-collide-with) (-> arg1 popup) 81920.0 1024.0) + (when (>= (-> obj gspot-pos y) (-> arg1 new-pos y)) ;; check if we are at/below the ground + ;; we are + (set! (-> arg1 on-ground?) #t) + (set! (-> arg1 pat) (-> s3-1 best-other-tri pat)) + ;; move to ground + (set! (-> arg1 new-pos y) (-> s3-1 best-other-tri intersect y)) + (set! (-> obj ground-impact-vel) (- (vector-dot arg0 (-> obj dynam gravity-normal)))) + (set! (-> arg0 y) 0.0) + ) + ) + (else + ;; no ground. if hover is enabled, disable falling. + (if (-> arg1 hover-if-no-ground?) + (set! (-> arg1 new-pos y) (-> obj trans-old y)) + ) + ) + ) + ) + + ;; do the (slightly) more expensive move + (set! (-> obj trans quad) (-> obj trans-old quad)) + (move-to-point! obj (-> arg1 new-pos)) + + ;; see if the object should collide with foreground objects + (when (logtest? (logand (-> arg1 overlaps-params collide-with-filter) + (collide-spec hit-by-player-list hit-by-others-list player-list) + ) + (-> obj root-prim prim-core collide-with) + ) + ;; if it does, see if we moved into overlap + (when (find-overlapping-shapes obj (-> arg1 overlaps-params)) + (when (-> arg1 dont-move-if-overlaps?) + ;; and abort the move. + (set! (-> arg1 do-move?) #f) + (move-to-point! obj (-> obj trans-old)) + (set! (-> obj gspot-pos quad) (-> arg1 old-gspot-pos quad)) + (set! (-> obj gspot-normal quad) (-> arg1 old-gspot-normal quad)) + ) + ) + ) + + ;; update flags. + (when (-> arg1 do-move?) + (cond + ((-> arg1 on-ground?) + (let ((a1-8 (-> obj gspot-pos)) + (a0-29 (-> obj gspot-normal)) + (v1-59 (-> arg1 pat)) + ) + (set! (-> obj grount-touch-point quad) (-> a1-8 quad)) + (set! (-> obj poly-normal quad) (-> a0-29 quad)) + (set! (-> obj surface-normal quad) (-> a0-29 quad)) + (set! (-> obj local-normal quad) (-> a0-29 quad)) + (set! (-> obj ground-poly-normal quad) (-> a0-29 quad)) + (set! (-> obj poly-pat) v1-59) + (set! (-> obj cur-pat) v1-59) + (set! (-> obj ground-pat) v1-59) + ) + (logior! (-> obj status) (collide-status on-surface on-ground touch-surface)) + ) + (else + (logclear! (-> obj status) (collide-status + on-surface + on-ground + touch-surface + touch-wall + touch-ceiling + touch-actor + on-special-surface + touch-edge + blocked + on-water + impact-surface + touch-background + stuck + glance + ) + ) + (when (not (logtest? (-> obj root-prim prim-core action) (collide-action no-normal-reset))) + (let ((v1-69 (-> obj dynam gravity-normal))) + (set! (-> obj local-normal quad) (-> v1-69 quad)) + (set! (-> obj surface-normal quad) (-> v1-69 quad)) + (set! (-> obj poly-normal quad) (-> v1-69 quad)) + ) + (set! (-> obj coverage) 0.0) + (set! (-> obj touch-angle) 0.0) + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod move-to-ground collide-shape-moving ((obj collide-shape-moving) (arg0 float) (arg1 float) (arg2 symbol) (arg3 collide-spec)) + "Find the ground a move to it." + (local-vars (sv-576 profile-segment) (sv-592 int)) + (with-profiler 'collide *profile-collide-color* + (let ((s1-1 (new 'stack-no-clear 'collide-query))) + (cond + ((find-ground obj s1-1 arg3 arg0 arg1 1024.0) + (let ((a1-4 (new 'stack-no-clear 'vector))) + (set! (-> a1-4 quad) (-> obj trans quad)) + (set! (-> a1-4 y) (-> s1-1 best-other-tri intersect y)) + (move-to-point! obj a1-4) + ) + (let ((a1-5 (-> s1-1 best-other-tri intersect)) + (a0-19 (-> s1-1 best-other-tri normal)) + (v1-25 (-> s1-1 best-other-tri pat)) + ) + (set! (-> obj grount-touch-point quad) (-> a1-5 quad)) + (set! (-> obj poly-normal quad) (-> a0-19 quad)) + (set! (-> obj surface-normal quad) (-> a0-19 quad)) + (set! (-> obj local-normal quad) (-> a0-19 quad)) + (set! (-> obj ground-poly-normal quad) (-> a0-19 quad)) + (set! (-> obj poly-pat) v1-25) + (set! (-> obj cur-pat) v1-25) + (set! (-> obj ground-pat) v1-25) + ) + (logior! (-> obj status) (collide-status on-surface on-ground touch-surface)) + #t + ) + (else + (logclear! (-> obj status) (collide-status + on-surface + on-ground + touch-surface + touch-wall + touch-ceiling + touch-actor + on-special-surface + touch-edge + blocked + on-water + impact-surface + touch-background + stuck + glance + ) + ) + (when (not (logtest? (-> obj root-prim prim-core action) (collide-action no-normal-reset))) + (let ((v1-36 (-> obj dynam gravity-normal))) + (set! (-> obj local-normal quad) (-> v1-36 quad)) + (set! (-> obj surface-normal quad) (-> v1-36 quad)) + (set! (-> obj poly-normal quad) (-> v1-36 quad)) + ) + (set! (-> obj coverage) 0.0) + (set! (-> obj touch-angle) 0.0) + ) + (if arg2 + (format 0 "WARNING: move-to-ground: failed to locate ground for ~S!~%" (-> obj process name)) + ) + ) + ) + ) + ) + (none) + ) + +(defmethod compute-acc-due-to-gravity collide-shape-moving ((obj collide-shape-moving) (arg0 vector) (arg1 float)) + "Adjust the velocity from the acceleration of gravity." + (let* ((s4-0 (vector-negate! (new 'stack-no-clear 'vector) (-> obj dynam gravity))) + (a2-1 (-> obj local-normal)) + (a2-2 (vector-reflect-flat! (new-stack-vector0) s4-0 a2-1)) + ) + (vector--float*! arg0 s4-0 a2-2 (cond + ((logtest? (-> obj status) (collide-status on-surface)) + (empty) + arg1 + ) + (else + 0.0 + ) + ) + ) + ) + arg0 + ) + +(defmethod fill-cache-integrate-and-collide collide-shape ((obj collide-shape) (arg0 vector) (arg1 collide-query) (arg2 meters)) + "Helper to fill the collide cache and call integrate-and-collide." + (local-vars (at-0 int)) + (with-pp + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + ;; scale the cache fill volume by frame rate + (let ((v1-0 (new 'stack-no-clear 'vector))) + (let ((a0-1 v1-0)) + (.lvf vf1 (&-> arg0 quad)) + (let ((f0-0 (-> pp clock seconds-per-frame))) + (.mov at-0 f0-0) + ) + (.mov vf2 at-0) + (.mov.vf vf1 vf0 :mask #b1000) + (.mul.x.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> a0-1 quad) vf1) + ) + ;; fill the cache. + (fill-cache-for-shape obj (+ (vector-length v1-0) arg2) arg1) + ) + ;; move. + (integrate-and-collide! obj arg0) + (none) + ) + ) + ) + +(defmethod fill-cache-for-shape collide-shape ((obj collide-shape) (arg0 float) (arg1 collide-query)) + "Fill the collide cache for a collide-shape by buliding a bounding box and filling from that." + (cond + ((build-bounding-box-for-shape obj (-> arg1 bbox) arg0 (-> arg1 collide-with)) + (fill-using-bounding-box *collide-cache* arg1) + (if (and *display-collide-cache* (or (= (-> obj process type) target) (= (-> obj process) *debug-actor*))) + (debug-draw *collide-cache*) + ) + ) + (else + (reset *collide-cache*) + ) + ) + 0 + (none) + ) + +(defmethod build-bounding-box-for-shape collide-shape ((obj collide-shape) (arg0 bounding-box) (arg1 float) (arg2 collide-spec)) + (rlet ((vf0 :class vf) + (vf24 :class vf) + (vf25 :class vf) + (vf26 :class vf) + (vf27 :class vf) + (vf28 :class vf) + (vf29 :class vf) + (vf30 :class vf) + (vf31 :class vf) + ) + (init-vf0-vector) + (let ((t0-0 (new 'static 'vector :x 4.096)) + (v1-0 (-> obj root-prim)) + ) + (.mov vf31 arg1) + (let ((a0-2 (logand (-> v1-0 prim-core collide-with) arg2)) + (a2-1 (-> v1-0 prim-core prim-type)) + ) + (b! (zero? a0-2) cfg-9 :delay (.lvf vf28 (&-> t0-0 quad))) + (.add.x.vf vf31 vf31 vf28 :mask #b1) + (let ((a0-3 (-> v1-0 specific 0))) + (b! (= a2-1 (prim-type group)) cfg-3 :delay (.lvf vf24 (&-> v1-0 prim-core world-sphere quad))) + (.add.w.vf vf25 vf31 vf24 :mask #b1) + (.add.x.vf vf30 vf24 vf25 :mask #b111) + (b! #t cfg-10 :delay (.sub.x.vf vf29 vf24 vf25 :mask #b111)) + (label cfg-3) + (b! (zero? a0-3) cfg-9 :delay (set! v1-0 (&+ v1-0 80))) + (+! a0-3 -1) + (let ((a2-3 (logand (-> v1-0 prim-core collide-with) arg2))) + (.lvf vf24 (&-> v1-0 prim-core world-sphere quad)) + (b! (zero? a2-3) cfg-3 :delay (.add.w.vf vf25 vf31 vf24 :mask #b1)) + ) + (.add.x.vf vf30 vf24 vf25 :mask #b111) + (.sub.x.vf vf29 vf24 vf25 :mask #b111) + (label cfg-6) + (b! (zero? a0-3) cfg-10 :delay (set! v1-0 (&+ v1-0 80))) + (+! a0-3 -1) + ) + ) + (let ((a2-5 (logand (-> v1-0 prim-core collide-with) arg2))) + (.lvf vf24 (&-> v1-0 prim-core world-sphere quad)) + (b! (zero? a2-5) cfg-6 :delay (.add.w.vf vf25 vf31 vf24 :mask #b1)) + ) + ) + (.add.x.vf vf27 vf24 vf25 :mask #b111) + (.sub.x.vf vf26 vf24 vf25 :mask #b111) + (.min.vf vf29 vf29 vf26) + (.max.vf vf30 vf30 vf27) + (b! #t cfg-6 :delay (nop!)) + (label cfg-9) + (let ((v0-0 #f)) + (b! #t cfg-11 :delay (nop!)) + (label cfg-10) + (.mov.vf vf29 vf0 :mask #b1000) + (.mov.vf vf30 vf0 :mask #b1000) + (.svf (&-> arg0 min quad) vf29) + (.svf (&-> arg0 max quad) vf30) + (set! v0-0 #t) + (label cfg-11) + v0-0 + ) + ) + ) + +(defmethod find-prim-by-id collide-shape ((obj collide-shape) (arg0 uint)) + (let ((v1-0 (-> obj root-prim))) + (countdown (a0-1 (-> obj total-prims)) + (if (= (-> v1-0 prim-id) arg0) + (return v1-0) + ) + (&+! v1-0 80) + ) + ) + (the-as collide-shape-prim #f) + ) + +(defmethod find-prim-by-id-logtest collide-shape ((obj collide-shape) (arg0 uint)) + (let ((v1-0 (-> obj root-prim))) + (countdown (a0-1 (-> obj total-prims)) + (if (logtest? (-> v1-0 prim-id) arg0) + (return v1-0) + ) + (&+! v1-0 80) + ) + ) + (the-as collide-shape-prim #f) + ) + +(defun-debug collide-shape-draw-debug-marks () + "Draw geometry for all collide shapes." + + ;; draw target separately + (add-debug-sphere + (or *display-collision-marks* *display-target-marks*) + (bucket-id debug2) + (target-pos 0) + (meters 0.2) + (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) + ) + + ;; loop over the 3 main lists. + (when *display-collision-marks* + (let ((v1-4 (-> *collide-player-list* alive-list next0))) + *collide-player-list* + (let ((gp-1 (-> v1-4 next0))) + (while (!= v1-4 (-> *collide-player-list* alive-list-end)) + (let ((a0-4 (the-as collide-shape (-> (the-as connection v1-4) param1)))) + (if (or (not *debug-actor*) (= (-> a0-4 process) *target*) (= (-> a0-4 process) *debug-actor*)) + (debug-draw a0-4) + ) + ) + (set! v1-4 gp-1) + *collide-player-list* + (set! gp-1 (-> gp-1 next0)) + ) + ) + ) + (let ((v1-15 (-> *collide-hit-by-player-list* alive-list next0))) + *collide-hit-by-player-list* + (let ((gp-2 (-> v1-15 next0))) + (while (!= v1-15 (-> *collide-hit-by-player-list* alive-list-end)) + (let ((a0-11 (-> (the-as connection v1-15) param1))) + (if (or (not *debug-actor*) + (= (-> (the-as collide-shape a0-11) process) *target*) + (= (-> (the-as collide-shape a0-11) process) *debug-actor*) + ) + (debug-draw (the-as collide-shape a0-11)) + ) + ) + (set! v1-15 gp-2) + *collide-hit-by-player-list* + (set! gp-2 (-> gp-2 next0)) + ) + ) + ) + (let ((v1-26 (-> *collide-hit-by-others-list* alive-list next0))) + *collide-hit-by-others-list* + (let ((gp-3 (-> v1-26 next0))) + (while (!= v1-26 (-> *collide-hit-by-others-list* alive-list-end)) + (let ((a0-18 (the-as collide-shape (-> (the-as connection v1-26) param1)))) + (if (or (not *debug-actor*) (= (-> a0-18 process) *target*) (= (-> a0-18 process) *debug-actor*)) + (debug-draw a0-18) + ) + ) + (set! v1-26 gp-3) + *collide-hit-by-others-list* + (set! gp-3 (-> gp-3 next0)) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod debug-draw collide-shape ((obj collide-shape)) + (if (sphere-in-view-frustum? (the-as sphere (-> obj root-prim prim-core))) + (debug-draw (-> obj root-prim)) + ) + 0 + (none) + ) + +(define *col-timer* (new 'global 'stopwatch)) + +(define *frame-timer* (new 'global 'stopwatch)) + +(define *col-timer-enable* #t) + +(defun debug-report-col-stats () + (when *col-timer-enable* + (stopwatch-end *frame-timer*) + (format *stdcon* "col stats:~%") + (format *stdcon* " col ~F ms~%" (* 1000.0 (stopwatch-elapsed-seconds *col-timer*))) + (format *stdcon* " frame ~F ms~%" (* 1000.0 (stopwatch-elapsed-seconds *frame-timer*))) + (stopwatch-init *col-timer*) + (stopwatch-init *frame-timer*) + (stopwatch-begin *frame-timer*) + ) + ) + +(defmethod update-transforms collide-shape ((obj collide-shape)) + "Update collisision transforms." + (local-vars (v1-8 float) (a1-5 float) (a1-7 float)) + (rlet ((acc :class vf) + (Q :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + ) + (init-vf0-vector) + (let ((s5-0 (-> obj root-prim)) + (v1-1 (-> obj process node-list)) + ) + (cond + ((nonzero? v1-1) ;; using cspace stuff + (countdown (a0-1 (-> obj total-prims)) + (let ((a1-0 (-> s5-0 transform-index))) + (cond + ((>= a1-0 0) + ;; normal cspace stuff - just do a cspace transformation. + (let ((a1-4 (-> v1-1 data a1-0 bone transform))) + (.lvf vf5 (&-> a1-4 trans quad)) + (.lvf vf1 (&-> s5-0 local-sphere quad)) + (.lvf vf2 (&-> a1-4 vector 0 quad)) + (.mul.w.vf acc vf5 vf0) + (.div.vf Q vf0 vf5 :fsf #b11 :ftf #b11) + (.lvf vf3 (&-> a1-4 vector 1 quad)) + (.add.mul.x.vf acc vf2 vf1 acc) + (.lvf vf4 (&-> a1-4 vector 2 quad)) + ) + (.add.mul.y.vf acc vf3 vf1 acc) + (.add.mul.z.vf vf1 vf4 vf1 acc :mask #b111) + (.mul.vf vf1 vf1 Q :mask #b111) + (.svf (&-> s5-0 prim-core world-sphere quad) vf1) + (.mov a1-5 vf1) + ) + (else + ;; -2 is magic and tied to the root trans, skip cspace math. + (when (= a1-0 -2) + (.lvf vf1 (&-> s5-0 local-sphere quad)) + (.lvf vf2 (&-> obj trans quad)) + (.add.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> s5-0 prim-core world-sphere quad) vf1) + (.mov a1-7 vf1) + ) + ) + ) + ) + (&+! s5-0 80) + ) + ) + (else + ;; special cases for non-cspace users. + (countdown (s4-0 (-> obj total-prims)) + (case (-> s5-0 transform-index) + ((-3) + ;; rotate and translate from root pos/orientation + (let ((s3-0 (new 'stack-no-clear 'vector))) + (vector-orient-by-quat! s3-0 (-> s5-0 local-sphere) (-> obj quat)) + (vector+! (the-as vector (-> s5-0 prim-core)) s3-0 (-> obj trans)) + ) + (set! (-> s5-0 prim-core world-sphere w) (-> s5-0 local-sphere w)) + ) + ((-2) + ;; just translate. + (.lvf vf1 (&-> s5-0 local-sphere quad)) + (.lvf vf2 (&-> obj trans quad)) + (.add.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> s5-0 prim-core world-sphere quad) vf1) + (.mov v1-8 vf1) + ) + ) + (&+! s5-0 80) + ) + ) + ) + ) + 0 + (none) + ) + ) + +(defmethod move-by-vector! collide-shape ((obj collide-shape) (arg0 vector)) + "Move everything by a vector." + (vector+! (-> obj trans) (-> obj trans) arg0) + (let ((v1-1 (-> obj root-prim))) + (countdown (a0-1 (-> obj total-prims)) + (vector+! (the-as vector (-> v1-1 prim-core)) (the-as vector (-> v1-1 prim-core)) arg0) + (set! (-> v1-1 prim-core world-sphere w) (-> v1-1 local-sphere w)) + (&+! v1-1 80) + ) + ) + 0 + (none) + ) + +(defmethod move-to-point! collide-shape ((obj collide-shape) (arg0 vector)) + "Move root to a point." + (let ((v1-0 (new 'stack-no-clear 'vector))) + (vector-! v1-0 arg0 (-> obj trans)) + (set! (-> obj trans quad) (-> arg0 quad)) + (let ((a1-2 (-> obj root-prim))) + (countdown (a0-1 (-> obj total-prims)) + (vector+! (the-as vector (-> a1-2 prim-core)) (the-as vector (-> a1-2 prim-core)) v1-0) + (set! (-> a1-2 prim-core world-sphere w) (-> a1-2 local-sphere w)) + (&+! a1-2 80) + ) + ) + ) + 0 + (none) + ) + +(defmethod set-collide-with! collide-shape ((obj collide-shape) (arg0 collide-spec)) + "Set the collide with field of everything." + (let ((v1-0 (-> obj root-prim))) + (countdown (a0-1 (-> obj total-prims)) + (set! (-> v1-0 prim-core collide-with) arg0) + (nop!) + (nop!) + (&+! v1-0 80) + ) + ) + 0 + (none) + ) + +(defmethod set-collide-as! collide-shape ((obj collide-shape) (arg0 collide-spec)) + "Set the collide as field of everything" + (let ((v1-0 (-> obj root-prim))) + (countdown (a0-1 (-> obj total-prims)) + (set! (-> v1-0 prim-core collide-as) arg0) + (nop!) + (nop!) + (&+! v1-0 80) + ) + ) + 0 + (none) + ) + +(defmethod iterate-prims collide-shape ((obj collide-shape) (arg0 (function collide-shape-prim none))) + "Call the given function for each prim." + (let ((s5-0 (-> obj root-prim))) + (countdown (s4-0 (-> obj total-prims)) + (arg0 s5-0) + (&+! s5-0 80) + ) + ) + 0 + (none) + ) + +(defmethod find-collision-meshes collide-shape ((obj collide-shape)) + "Find collision meshes for our collide prims. + The collide shape system is built in code, so this function should be called + to actually find the matching meshes." + (let ((s5-0 (-> obj root-prim)) + (s4-0 0) + ) + (case (-> s5-0 prim-core prim-type) + (((prim-type mesh)) + (set! s4-0 1) + ) + (((prim-type group)) + (set! s4-0 (the-as int (-> s5-0 specific 1))) + (&+! s5-0 80) + ) + ) + (when (nonzero? s4-0) + (let ((s3-0 0)) + (let ((v1-7 (-> obj process draw)) + (s2-0 (the-as (array collide-mesh) #f)) + ) + (when (and (nonzero? v1-7) (-> v1-7 jgeo)) + (set! s2-0 (res-lump-struct (-> v1-7 jgeo extra) 'collide-mesh-group (array collide-mesh))) + (when s2-0 + (countdown (s1-0 s4-0) + (when (= (-> s5-0 prim-core prim-type) (prim-type mesh)) + (let ((s0-0 (-> (the-as collide-shape-prim-mesh s5-0) mesh-id))) + (cond + ((and (>= s0-0 0) (< s0-0 (length s2-0))) + (set! (-> (the-as collide-shape-prim-mesh s5-0) mesh) (-> s2-0 s0-0)) + ) + (else + (set! (-> (the-as collide-shape-prim-mesh s5-0) mesh) #f) + (+! s3-0 1) + ) + ) + ) + ) + (set! s5-0 (&+ (the-as collide-shape-prim-mesh s5-0) 80)) + ) + ) + ) + (when (not s2-0) + (while (nonzero? s4-0) + (+! s4-0 -1) + (when (= (-> (the-as collide-shape-prim-mesh s5-0) prim-core prim-type) (prim-type mesh)) + (set! (-> (the-as collide-shape-prim-mesh s5-0) mesh) #f) + (+! s3-0 1) + ) + (set! s5-0 (&+ (the-as collide-shape-prim-mesh s5-0) 80)) + ) + ) + ) + (if (nonzero? s3-0) + (format 0 "ERROR: Failed to find collision meshes for ~D prim(s) in ~A!~%" s3-0 (-> obj process name)) + ) + ) + ) + ) + (update-transforms obj) + 0 + (none) + ) + +(defmethod debug-draw collide-shape-prim ((obj collide-shape-prim)) + (add-debug-sphere + #t + (bucket-id debug2) + (the-as vector (-> obj prim-core)) + (-> obj local-sphere w) + (new 'static 'rgba :r #xff :g #xff :b #xff :a #x40) + ) + 0 + (none) + ) + +(defmethod debug-draw collide-shape-prim-sphere ((obj collide-shape-prim-sphere)) + (add-debug-sphere + #t + (bucket-id debug2) + (the-as vector (-> obj prim-core)) + (-> obj local-sphere w) + (cond + ((and (zero? (-> obj prim-core collide-as)) (zero? (-> obj prim-core collide-with))) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x40) + ) + ((logtest? (-> obj prim-core action) (collide-action solid)) + (new 'static 'rgba :r #xff :g #xff :a #x40) + ) + (else + (new 'static 'rgba :r #xff :g #x80 :a #x40) + ) + ) + ) + 0 + (none) + ) + +(defmethod debug-draw collide-shape-prim-mesh ((obj collide-shape-prim-mesh)) + (add-debug-sphere + #t + (bucket-id debug2) + (the-as vector (-> obj prim-core)) + (-> obj local-sphere w) + (new 'static 'rgba :b #xff :a #x40) + ) + 0 + (none) + ) + +(defmethod debug-draw collide-shape-prim-group ((obj collide-shape-prim-group)) + (add-debug-sphere + #t + (bucket-id debug2) + (the-as vector (-> obj prim-core)) + (-> obj local-sphere w) + (new 'static 'rgba :g #xff :a #x10) + ) + (countdown (s5-0 (the-as uint (-> obj num-children))) + (debug-draw (-> obj child s5-0)) + ) + 0 + (none) + ) + +(deftype do-push-aways-work (structure) + "Added" + ((cquery collide-query :inline) + (push-vel vector :inline) + (vec33 vector :inline :offset 560) + (cspec collide-spec :offset 576) + ) + ) + +(defmethod do-push-aways collide-shape ((obj collide-shape)) + "Push away things." + (local-vars (at-0 int) (v1-55 int) (a2-5 float) (a2-12 float)) + (with-pp + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + ) + (init-vf0-vector) + (let ((gp-0 (new 'stack-no-clear 'do-push-aways-work))) + (set! (-> gp-0 cspec) (collide-spec)) + (let ((s4-0 (-> obj root-prim prim-core collide-with))) + + ;; first, we build the actor list. hit-by-others now uses spatial hash. + (set! *actor-list-length* 0) + (if (logtest? s4-0 (collide-spec hit-by-others-list)) + (set! *actor-list-length* + (fill-actor-list-for-sphere *actor-hash* (the-as sphere (-> obj root-prim prim-core)) *actor-list* 256) + ) + ) + + ;; if we want to collide with the player, add it explicitly. + (when (logtest? s4-0 (collide-spec player-list)) + (let ((a0-2 (-> *collide-player-list* alive-list next0))) + *collide-player-list* + (let ((v1-13 (-> a0-2 next0))) + (while (!= a0-2 (-> *collide-player-list* alive-list-end)) + (let* ((a0-3 (-> (the-as connection a0-2) param1)) + (a1-1 (-> (the-as collide-shape a0-3) root-prim)) + ) + (when (logtest? s4-0 (-> a1-1 prim-core collide-as)) + (let ((a1-2 (-> a1-1 prim-core))) + (let ((a2-4 a1-2) + (a3-2 (-> obj root-prim prim-core)) + ) + (.lvf vf2 (&-> a2-4 world-sphere quad)) + (.lvf vf3 (&-> a3-2 world-sphere quad)) + ) + (.sub.vf vf1 vf3 vf2) + (.mul.vf vf1 vf1 vf1) + (.add.y.vf vf1 vf1 vf1 :mask #b1) + (.add.z.vf vf1 vf1 vf1 :mask #b1) + (.mov a2-5 vf1) + (let ((f0-0 a2-5) + (f1-1 (+ (-> a1-2 world-sphere w) (-> obj root-prim prim-core world-sphere w))) + ) + (when (< f0-0 (* f1-1 f1-1)) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-3)) + (set! *actor-list-length* (+ *actor-list-length* 1)) + ) + ) + ) + ) + ) + ) + (set! a0-2 v1-13) + *collide-player-list* + (set! v1-13 (-> v1-13 next0)) + ) + ) + ) + ) + + ;; same for hit-by-plyer list + (when (logtest? s4-0 (collide-spec hit-by-player-list)) + (let ((a0-5 (-> *collide-hit-by-player-list* alive-list next0))) + *collide-hit-by-player-list* + (let ((v1-21 (-> a0-5 next0))) + (while (!= a0-5 (-> *collide-hit-by-player-list* alive-list-end)) + (let* ((a0-6 (-> (the-as connection a0-5) param1)) + (a1-14 (-> (the-as collide-shape-moving a0-6) root-prim)) + ) + (when (logtest? s4-0 (-> a1-14 prim-core collide-as)) + (let ((a1-15 (-> a1-14 prim-core))) + (let ((a2-11 a1-15) + (a3-4 (-> obj root-prim prim-core)) + ) + (.lvf vf2 (&-> a2-11 world-sphere quad)) + (.lvf vf3 (&-> a3-4 world-sphere quad)) + ) + (.sub.vf vf1 vf3 vf2) + (.mul.vf vf1 vf1 vf1) + (.add.y.vf vf1 vf1 vf1 :mask #b1) + (.add.z.vf vf1 vf1 vf1 :mask #b1) + (.mov a2-12 vf1) + (let ((f0-1 a2-12) + (f1-5 (+ (-> a1-15 world-sphere w) (-> obj root-prim prim-core world-sphere w))) + ) + (when (< f0-1 (* f1-5 f1-5)) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) + (set! *actor-list-length* (+ *actor-list-length* 1)) + ) + ) + ) + ) + ) + ) + (set! a0-5 v1-21) + *collide-hit-by-player-list* + (set! v1-21 (-> v1-21 next0)) + ) + ) + ) + ) + + ;; now loop over all actors: + (dotimes (s3-0 *actor-list-length*) + (let* ((s1-0 (-> *actor-list* s3-0)) + (s2-0 (-> s1-0 root-prim)) + ) + (when (logtest? s4-0 (-> s2-0 prim-core collide-as)) + (when (!= (-> obj process) (-> s1-0 process)) + ;; do the test + (when (and (should-push-away obj s1-0 (-> gp-0 cquery)) (>= -81.92 (-> gp-0 cquery best-dist))) + (set! (-> gp-0 cquery collide-with) (-> s1-0 root-prim prim-core collide-with)) + (set! (-> gp-0 cquery ignore-process0) (-> s1-0 process)) + (set! (-> gp-0 cquery ignore-process1) #f) + (set! (-> gp-0 cquery ignore-pat) (-> s1-0 pat-ignore-mask)) + (set! (-> gp-0 cquery action-mask) (collide-action solid)) + (-> gp-0 cquery) + ;; push away + (fill-cache-for-shape s1-0 8192.0 (-> gp-0 cquery)) + (let ((s4-1 3)) + (until (or (<= s4-1 0) (not (should-push-away obj s1-0 (-> gp-0 cquery)))) + (set! (-> gp-0 vec33 quad) (-> s1-0 trans quad)) + (let* ((f0-4 (+ 2867.2 (-> gp-0 vec33 y))) + (f2-2 (+ 5734.4 f0-4)) + (f1-11 (-> gp-0 cquery best-other-tri intersect y)) + ) + (cond + ((< f1-11 f0-4) + (set! f1-11 f0-4) + ) + ((< f2-2 f1-11) + (set! f1-11 f2-2) + ) + ) + (set! (-> gp-0 vec33 y) f1-11) + ) + (.lvf vf4 (&-> (-> gp-0 vec33) quad)) + (.lvf vf3 (&-> (-> gp-0 cquery) best-other-tri intersect quad)) + (.lvf vf5 (&-> (-> gp-0 cquery) best-other-tri normal quad)) + (.sub.vf vf2 vf4 vf3) + (.mul.vf vf1 vf5 vf2) + (.add.x.vf vf1 vf1 vf1 :mask #b10) + (.add.z.vf vf1 vf1 vf1 :mask #b10) + (.mov v1-55 vf1) + (b! (< (the-as int v1-55) 0) cfg-35 :likely-delay (.sub.vf vf2 vf0 vf2)) + (label cfg-35) + (.svf (&-> (-> gp-0 push-vel) quad) vf2) + (vector-normalize! (-> gp-0 push-vel) 1.0) + (vector-float*! (-> gp-0 push-vel) (-> gp-0 push-vel) (- (-> gp-0 cquery best-dist))) + (let ((v1-59 (-> gp-0 push-vel))) + (.lvf vf1 (&-> (-> gp-0 push-vel) quad)) + (let ((f0-7 (-> pp clock frames-per-second))) + (.mov at-0 f0-7) + ) + (.mov vf2 at-0) + (.mov.vf vf1 vf0 :mask #b1000) + (.mul.x.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> v1-59 quad) vf1) + ) + (let ((s0-0 (-> (the-as collide-shape-moving s1-0) status))) + (integrate-and-collide! (the-as collide-shape-moving s1-0) (-> gp-0 push-vel)) + (set! (-> (the-as collide-shape-moving s1-0) status) s0-0) + ) + (+! s4-1 -1) + ) + (if (zero? s4-1) + (logior! (-> gp-0 cspec) (-> s2-0 prim-core collide-as)) + ) + ) + (set! s4-0 (-> obj root-prim prim-core collide-with)) + ) + ) + ) + ) + ) + ) + (-> gp-0 cspec) + ) + ) + ) + ) + +;; definition for method 40 of type collide-shape +;; WARN: Return type mismatch object vs symbol. +(defmethod find-overlapping-shapes collide-shape ((obj collide-shape) (arg0 overlaps-others-params)) + (local-vars (a0-10 float) (a0-14 uint) (a2-5 float) (a2-12 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (let ((gp-0 (the-as object #f))) + (let* ((s3-0 (-> obj root-prim)) + (s2-0 (the-as uint (logand (-> s3-0 prim-core collide-with) (-> arg0 collide-with-filter)))) + ) + (set! (-> arg0 filtered-root-collide-with) (the-as collide-spec s2-0)) + (set! *actor-list-length* 0) + (b! (not (logtest? (the-as collide-spec s2-0) 512)) cfg-2 :delay (empty-form)) + (set! *actor-list-length* + (fill-actor-list-for-sphere *actor-hash* (the-as sphere (-> s3-0 prim-core)) *actor-list* 256) + ) + (label cfg-2) + (b! (not (logtest? (the-as collide-spec s2-0) 1024)) cfg-11 :delay (empty-form)) + (let ((a0-3 (-> *collide-player-list* alive-list next0))) + *collide-player-list* + (let ((v1-12 (-> a0-3 next0))) + (b! #t cfg-9 :delay (nop!)) + (label cfg-4) + (let ((a0-4 (-> (the-as connection a0-3) param1))) + (let ((a1-2 (-> (the-as collide-shape a0-4) root-prim))) + (b! (not (logtest? (the-as collide-spec s2-0) (-> a1-2 prim-core collide-as))) cfg-8 :delay (empty-form)) + (let ((a1-3 (-> a1-2 prim-core))) + (let ((a2-4 a1-3) + (a3-1 (-> s3-0 prim-core)) + ) + (.lvf vf2 (&-> a2-4 world-sphere quad)) + (.lvf vf3 (&-> a3-1 world-sphere quad)) + ) + (.sub.vf vf1 vf3 vf2) + (.mul.vf vf1 vf1 vf1) + (.add.y.vf vf1 vf1 vf1 :mask #b1) + (.add.z.vf vf1 vf1 vf1 :mask #b1) + (.mov a2-5 vf1) + (let ((f0-0 a2-5) + (f1-1 (+ (-> a1-3 world-sphere w) (-> s3-0 prim-core world-sphere w))) + ) + (b! (>= f0-0 (* f1-1 f1-1)) cfg-8 :delay #f) + ) + ) + ) + (b! (>= *actor-list-length* 256) cfg-8 :delay #f) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-4)) + ) + (set! *actor-list-length* (+ *actor-list-length* 1)) + (label cfg-8) + (set! a0-3 v1-12) + *collide-player-list* + (set! v1-12 (-> v1-12 next0)) + ) + (label cfg-9) + (b! (!= a0-3 (-> *collide-player-list* alive-list-end)) cfg-4 :delay (nop!)) + ) + (label cfg-11) + (b! (not (logtest? (the-as collide-spec s2-0) 256)) cfg-20 :delay (empty-form)) + (let ((a0-6 (-> *collide-hit-by-player-list* alive-list next0))) + *collide-hit-by-player-list* + (let ((v1-20 (-> a0-6 next0))) + (b! #t cfg-18 :delay (nop!)) + (label cfg-13) + (let ((a0-7 (-> (the-as connection a0-6) param1))) + (let ((a1-14 (-> (the-as collide-shape-moving a0-7) root-prim))) + (b! (not (logtest? (the-as collide-spec s2-0) (-> a1-14 prim-core collide-as))) cfg-17 :delay (empty-form)) + (let ((a1-15 (-> a1-14 prim-core))) + (let ((a2-11 a1-15) + (a3-2 (-> s3-0 prim-core)) + ) + (.lvf vf2 (&-> a2-11 world-sphere quad)) + (.lvf vf3 (&-> a3-2 world-sphere quad)) + ) + (.sub.vf vf1 vf3 vf2) + (.mul.vf vf1 vf1 vf1) + (.add.y.vf vf1 vf1 vf1 :mask #b1) + (.add.z.vf vf1 vf1 vf1 :mask #b1) + (.mov a2-12 vf1) + (let ((f0-1 a2-12) + (f1-5 (+ (-> a1-15 world-sphere w) (-> s3-0 prim-core world-sphere w))) + ) + (b! (>= f0-1 (* f1-5 f1-5)) cfg-17 :delay #f) + ) + ) + ) + (b! (>= *actor-list-length* 256) cfg-17 :delay #f) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-7)) + ) + (set! *actor-list-length* (+ *actor-list-length* 1)) + (label cfg-17) + (set! a0-6 v1-20) + *collide-hit-by-player-list* + (set! v1-20 (-> v1-20 next0)) + ) + (label cfg-18) + (b! (!= a0-6 (-> *collide-hit-by-player-list* alive-list-end)) cfg-13 :delay (nop!)) + ) + (label cfg-20) + (let ((s1-0 0)) + (b! #t cfg-30 :delay (nop!)) + (label cfg-21) + (let ((s0-0 (-> *actor-list* s1-0))) + (let ((a2-15 (-> s0-0 root-prim))) + (b! (not (logtest? (the-as collide-spec s2-0) (-> a2-15 prim-core collide-as))) cfg-29 :delay (empty-form)) + (.lvf vf1 (&-> s3-0 prim-core world-sphere quad)) + (.lvf vf2 (&-> a2-15 prim-core world-sphere quad)) + (.sub.vf vf3 vf1 vf2) + (.add.w.vf vf4 vf1 vf2 :mask #b1000) + (.mul.vf vf3 vf3 vf3 :mask #b111) + (.mul.w.vf vf4 vf4 vf4 :mask #b1000) + (.mul.x.vf acc vf0 vf3 :mask #b1000) + (.add.mul.y.vf acc vf0 vf3 acc :mask #b1000) + (.add.mul.z.vf vf3 vf0 vf3 acc :mask #b1000) + (.sub.w.vf vf3 vf3 vf4 :mask #b1000) + (let ((f0-2 0.0)) + (.add.w.vf vf3 vf0 vf3 :mask #b1) + (let ((v1-28 (-> obj process))) + (.mov a0-10 vf3) + (let ((a1-26 (-> s0-0 process))) + (b! (< f0-2 a0-10) cfg-28) + (b! (= v1-28 a1-26) cfg-28 :delay (nop!)) + ) + ) + ) + (let ((v1-30 (overlaps-others-test s3-0 arg0 a2-15))) + (.lvf vf1 (&-> s3-0 prim-core world-sphere quad)) + (b! (= v1-30 #f) cfg-28 :delay (set! s2-0 (the-as uint (-> arg0 filtered-root-collide-with)))) + ) + ) + (let ((a0-12 (-> (the-as (pointer uint64) arg0) 0)) + (v1-31 (-> obj penetrate-using)) + ) + (b! (not (logtest? a0-12 4)) cfg-27 :delay (set! a0-14 (the-as uint (-> arg0 tlist)))) + (b! (logtest? (-> s0-0 penetrated-by) v1-31) cfg-28 :delay (nop!)) + ) + ) + (label cfg-27) + (b! (= a0-14 #f) cfg-32 :delay (set! gp-0 0)) + (label cfg-28) + 0 + (label cfg-29) + (+! s1-0 1) + (label cfg-30) + (b! (< s1-0 *actor-list-length*) cfg-21) + ) + ) + (label cfg-32) + (b! (= (the-as uint gp-0) #f) cfg-34 :delay (nop!)) + (set! gp-0 #t) + (label cfg-34) + (the-as symbol gp-0) + ) + ) + ) + +;; definition for method 12 of type collide-shape-prim +(defmethod overlaps-others-test collide-shape-prim ((obj collide-shape-prim) (arg0 overlaps-others-params) (arg1 collide-shape-prim)) + (format 0 "ERROR: Unsupported call to collide-shape-prim::overlaps-others-test!~%") + #f + ) + +;; definition for method 12 of type collide-shape-prim-group +;; WARN: Return type mismatch object vs symbol. +(defmethod overlaps-others-test collide-shape-prim-group ((obj collide-shape-prim-group) (arg0 overlaps-others-params) (arg1 collide-shape-prim)) + (local-vars (a0-3 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (let ((s4-0 (the-as collide-shape-prim obj)) + (v1-0 (-> arg1 prim-core collide-as)) + (s2-0 (the-as object #f)) + ) + (let ((a1-1 (-> arg0 collide-with-filter))) + (nop!) + (let ((s3-0 (the-as uint (-> obj num-children))) + (v1-1 (logand v1-0 a1-1)) + ) + (.lvf vf1 (&-> arg1 prim-core world-sphere quad)) + (nop!) + (set! (-> arg0 filtered-other-collide-as) v1-1) + (label cfg-1) + (b! (zero? s3-0) cfg-6 :delay (set! s4-0 (&+ s4-0 80))) + (+! s3-0 -1) + (let ((a0-2 (logand (-> s4-0 prim-core collide-with) v1-1))) + (.lvf vf2 (&-> s4-0 prim-core world-sphere quad)) + (b! (zero? a0-2) cfg-1 :delay (.sub.vf vf3 vf2 vf1)) + ) + (.add.w.vf vf4 vf2 vf1 :mask #b1000) + (.mul.vf vf3 vf3 vf3 :mask #b111) + (.mul.w.vf vf4 vf4 vf4 :mask #b1000) + (.mul.x.vf acc vf0 vf3 :mask #b1000) + (.add.mul.y.vf acc vf0 vf3 acc :mask #b1000) + (.add.mul.z.vf vf3 vf0 vf3 acc :mask #b1000) + (.sub.w.vf vf3 vf3 vf4 :mask #b1000) + (let ((f0-0 0.0)) + (.add.w.vf vf3 vf0 vf3 :mask #b1) + (.mov a0-3 vf3) + (b! (< f0-0 a0-3) cfg-1) + ) + (let ((a0-5 (overlaps-others-test s4-0 arg0 arg1))) + (set! v1-1 (-> arg0 filtered-other-collide-as)) + (b! (= a0-5 #f) cfg-1 :delay (.lvf vf1 (&-> arg1 prim-core world-sphere quad))) + ) + ) + ) + (b! (!= (-> arg0 tlist) #f) cfg-1 :delay (set! s2-0 0)) + (label cfg-6) + (b! (= (the-as uint s2-0) #f) cfg-8 :delay (nop!)) + (set! s2-0 #t) + (label cfg-8) + (the-as symbol s2-0) + ) + ) + ) + +;; definition for method 13 of type collide-shape-prim +;; WARN: Return type mismatch object vs symbol. +(defmethod overlaps-others-group collide-shape-prim ((obj collide-shape-prim) (arg0 overlaps-others-params) (arg1 collide-shape-prim-group)) + (local-vars (a0-4 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (let ((s4-0 (the-as collide-shape-prim arg1)) + (v1-0 (-> obj prim-core collide-with)) + ) + (nop!) + (let ((a0-1 (-> arg0 collide-with-filter))) + (nop!) + (let ((s3-0 (the-as uint (-> arg1 num-children))) + (v1-1 (logand v1-0 a0-1)) + ) + (.lvf vf2 (&-> obj prim-core world-sphere quad)) + (let ((s2-0 (the-as object #f))) + (set! (-> arg0 filtered-child-collide-with) v1-1) + (label cfg-1) + (b! (zero? s3-0) cfg-6 :delay (set! s4-0 (&+ s4-0 80))) + (+! s3-0 -1) + (let ((a0-3 (logand v1-1 (-> s4-0 prim-core collide-as)))) + (.lvf vf1 (&-> s4-0 prim-core world-sphere quad)) + (b! (zero? a0-3) cfg-1 :delay (.sub.vf vf3 vf2 vf1)) + ) + (.add.w.vf vf4 vf2 vf1 :mask #b1000) + (.mul.vf vf3 vf3 vf3 :mask #b111) + (.mul.w.vf vf4 vf4 vf4 :mask #b1000) + (.mul.x.vf acc vf0 vf3 :mask #b1000) + (.add.mul.y.vf acc vf0 vf3 acc :mask #b1000) + (.add.mul.z.vf vf3 vf0 vf3 acc :mask #b1000) + (.sub.w.vf vf3 vf3 vf4 :mask #b1000) + (let ((f0-0 0.0)) + (.add.w.vf vf3 vf0 vf3 :mask #b1) + (.mov a0-4 vf3) + (b! (< f0-0 a0-4) cfg-1) + ) + (let ((a0-6 (overlaps-others-test obj arg0 s4-0))) + (set! v1-1 (-> arg0 filtered-child-collide-with)) + (b! (= a0-6 #f) cfg-1 :delay (.lvf vf2 (&-> obj prim-core world-sphere quad))) + ) + (b! (!= (-> arg0 tlist) #f) cfg-1 :delay (set! s2-0 0)) + (label cfg-6) + (b! (= (the-as uint s2-0) #f) cfg-8 :delay (nop!)) + (set! s2-0 #t) + (label cfg-8) + (the-as symbol s2-0) + ) + ) + ) + ) + ) + ) + +;; definition for method 12 of type collide-shape-prim-sphere +(defmethod overlaps-others-test collide-shape-prim-sphere ((obj collide-shape-prim-sphere) (arg0 overlaps-others-params) (arg1 collide-shape-prim)) + (local-vars (v1-11 uint) (s4-0 uint)) + (let ((v1-0 (-> arg1 prim-core prim-type))) + (b! (nonzero? v1-0) cfg-2 :delay (set! s4-0 (the-as uint (-> arg0 options)))) + (let ((v0-1 (overlaps-others-group obj arg0 (the-as collide-shape-prim-group arg1)))) + (b! #t cfg-17 :delay (nop!)) + (label cfg-2) + (b! (> (the-as int v1-0) 0) cfg-4 :delay (nop!)) + (b! #t cfg-11 :delay (logand s4-0 2)) + (label cfg-4) + (b! (nonzero? 0) cfg-11 :delay (nop!)) + (let ((s2-0 (-> (the-as collide-shape-prim-mesh arg1) mesh))) + (b! (not s2-0) cfg-10 :delay (empty-form)) + (let ((v1-5 (populate-for-prim-mesh *collide-mesh-cache* (the-as collide-shape-prim-mesh arg1)))) + (when v1-5 + (when (overlap-test s2-0 (the-as collide-mesh-cache-tri (-> v1-5 tris)) (the-as vector (-> obj prim-core))) + (b! #t cfg-11 :delay (nop!)) + (the-as none 0) + ) + ) + ) + ) + (label cfg-10) + (set! v0-1 #f) + (b! #t cfg-17 :delay (nop!)) + (label cfg-11) + (let ((a0-8 (-> arg0 tlist))) + (b! (= a0-8 #f) cfg-13 :delay (nop!)) + (add-touching-prims a0-8 obj arg1 -1.0 (the-as collide-tri-result #f) (the-as collide-tri-result #f)) + ) + (label cfg-13) + (b! (not (logtest? s4-0 1)) cfg-16 :delay (set! v1-11 (the-as uint (-> obj prim-core action)))) + (let ((a0-9 (-> arg1 prim-core action))) + (b! (logtest? (the-as collide-action (logand v1-11 1)) a0-9) cfg-16 :delay (nop!)) + ) + (set! v0-1 #f) + (b! #t cfg-17 :delay (nop!)) + (label cfg-16) + (set! v0-1 #t) + (label cfg-17) + v0-1 + ) + ) + ) + +;; definition for method 12 of type collide-shape-prim-mesh +(defmethod overlaps-others-test collide-shape-prim-mesh ((obj collide-shape-prim-mesh) (arg0 overlaps-others-params) (arg1 collide-shape-prim)) + (local-vars (v1-3 uint) (v1-11 uint) (s4-0 uint)) + (let ((v1-0 (-> arg1 prim-core prim-type))) + (b! (nonzero? v1-0) cfg-2 :delay (set! s4-0 (the-as uint (-> arg0 options)))) + (let ((v0-1 (overlaps-others-group obj arg0 (the-as collide-shape-prim-group arg1)))) + (b! #t cfg-18 :delay (nop!)) + (label cfg-2) + (b! (> (the-as int v1-0) 0) cfg-10 :delay (set! v1-3 (logand s4-0 2))) + (b! (nonzero? v1-3) cfg-12 :delay (nop!)) + (let ((s2-0 (-> obj mesh))) + (b! (not s2-0) cfg-9 :delay (empty-form)) + (let ((v1-5 (populate-for-prim-mesh *collide-mesh-cache* obj))) + (b! (not v1-5) cfg-9 :delay (empty-form)) + (b! + (not (overlap-test s2-0 (the-as collide-mesh-cache-tri (-> v1-5 tris)) (the-as vector (-> arg1 prim-core)))) + cfg-9 + :delay (empty-form) + ) + ) + ) + (b! #t cfg-12 :delay (nop!)) + (the-as none 0) + (label cfg-9) + (set! v0-1 #f) + (b! #t cfg-18 :delay (nop!)) + (label cfg-10) + (b! (nonzero? v1-3) cfg-12 :delay (nop!)) + (format + 0 + "ERROR: Unsupported mesh -> mesh test attempted in collide-shape-prim-mesh::overlaps-others-test!~%" + ) + (set! v0-1 #f) + (b! #t cfg-18 :delay (nop!)) + (label cfg-12) + (let ((a0-9 (-> arg0 tlist))) + (b! (= a0-9 #f) cfg-14 :delay (nop!)) + (add-touching-prims a0-9 obj arg1 -1.0 (the-as collide-tri-result #f) (the-as collide-tri-result #f)) + ) + (label cfg-14) + (b! (not (logtest? s4-0 1)) cfg-17 :delay (set! v1-11 (the-as uint (-> obj prim-core action)))) + (let ((a0-10 (-> arg1 prim-core action))) + (b! (logtest? (the-as collide-action (logand v1-11 1)) a0-10) cfg-17 :delay (nop!)) + ) + (set! v0-1 #f) + (b! #t cfg-18 :delay (nop!)) + (label cfg-17) + (set! v0-1 #t) + (label cfg-18) + v0-1 + ) + ) + ) + +;; definition for method 49 of type collide-shape +;; WARN: Return type mismatch int vs none. +(defmethod modify-collide-as! collide-shape ((obj collide-shape) (arg0 int) (arg1 collide-spec) (arg2 collide-spec)) + (let ((v1-0 (-> obj root-prim))) + (countdown (a0-1 (-> obj total-prims)) + (if (logtest? (-> v1-0 prim-id) arg0) + (set! (-> v1-0 prim-core collide-as) (logior (logclear (-> v1-0 prim-core collide-as) arg1) arg2)) + ) + (&+! v1-0 80) + ) + ) + 0 + (none) + ) + +;; definition for method 50 of type collide-shape +;; INFO: Used lq/sq +(defmethod send-shoves collide-shape ((obj collide-shape) (arg0 process) (arg1 touching-shapes-entry) (arg2 float) (arg3 float) (arg4 float)) + (local-vars (sv-144 process) (sv-160 collide-shape-prim) (sv-176 vector)) + (with-pp + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (when arg1 + (let ((s0-0 (-> arg1 head))) + (set! sv-144 arg0) + (let ((gp-0 (if (type? sv-144 process-focusable) + sv-144 + ) + ) + ) + (when (and s0-0 gp-0) + (while s0-0 + (set! sv-160 (get-touched-prim s0-0 obj arg1)) + (get-touched-prim s0-0 (-> (the-as process-focusable gp-0) root-override) arg1) + (when (logtest? (-> sv-160 prim-core action) (collide-action no-standon)) + (let ((v1-12 (get-middle-of-bsphere-overlap s0-0 (new 'stack-no-clear 'vector)))) + (set! sv-176 (new 'stack-no-clear 'vector)) + (let ((a0-7 (-> sv-160 prim-core))) + (.lvf vf4 (&-> v1-12 quad)) + (.lvf vf5 (&-> a0-7 world-sphere quad)) + ) + ) + (.mov.vf vf6 vf0 :mask #b1000) + (.sub.vf vf6 vf4 vf5 :mask #b111) + (.svf (&-> sv-176 quad) vf6) + (vector-normalize! sv-176 1.0) + (when (and (< arg2 (-> sv-176 y)) + (and (not (logtest? (focus-status dead hit board mech) (-> (the-as process-focusable gp-0) focus-status))) + (< (-> (the-as process-focusable gp-0) root-override transv y) 4.096) + ) + ) + (let ((s2-1 (new 'stack-no-clear 'vector))) + (set! (-> s2-1 quad) (-> (the-as process-focusable gp-0) root-override transv quad)) + (let* ((v1-26 (-> (the-as process-focusable gp-0) root-override transv)) + (f30-0 (sqrtf (+ (* (-> v1-26 x) (-> v1-26 x)) (* (-> v1-26 z) (-> v1-26 z))))) + ) + (if (= f30-0 0.0) + (set! (-> s2-1 quad) + (-> (vector-z-quaternion! s2-1 (-> (the-as process-focusable gp-0) root-override quat)) quad) + ) + ) + (vector-xz-normalize! s2-1 (fmax f30-0 arg4)) + ) + (set! (-> s2-1 y) arg3) + (let ((a1-8 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-8 from) (process->ppointer pp)) + (set! (-> a1-8 num-params) 2) + (set! (-> a1-8 message) 'shove) + (set! (-> a1-8 param 0) (the-as uint arg1)) + (let ((v1-34 (new 'static 'attack-info :mask (attack-info-mask vector angle id)))) + (let* ((a0-13 *game-info*) + (a2-4 (+ (-> a0-13 attack-id) 1)) + ) + (set! (-> a0-13 attack-id) a2-4) + (set! (-> v1-34 id) a2-4) + ) + (set! (-> v1-34 vector quad) (-> s2-1 quad)) + (set! (-> v1-34 angle) 'jump) + (set! (-> a1-8 param 1) (the-as uint v1-34)) + ) + (send-event-function gp-0 a1-8) + ) + ) + (return #t) + ) + ) + (set! s0-0 (-> s0-0 next)) + ) + ) + ) + ) + ) + #f + ) + ) + ) + +;; definition for method 41 of type collide-shape +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs vector. +(defmethod shove-to-closest-point-on-path collide-shape ((obj collide-shape) (arg0 attack-info) (arg1 float)) + (set! (-> arg0 shove-up) arg1) + (let* ((s3-0 (-> obj process path)) + (s2-0 (-> s3-0 curve num-cverts)) + (s4-0 (target-pos 0)) + (s1-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (let ((f30-0 -1.0)) + (dotimes (s0-0 s2-0) + (get-point-in-path! s3-0 s1-0 (the float s0-0) 'interp) + (let ((f0-3 (vector-vector-distance-squared s4-0 s1-0))) + (when (or (< f30-0 0.0) (< f0-3 f30-0)) + (set! f30-0 f0-3) + (set! (-> s5-0 quad) (-> s1-0 quad)) + ) + ) + ) + ) + (vector-! (-> arg0 vector) s5-0 s4-0) + ) + (the-as vector 0) + ) + + + + diff --git a/goal_src/jak2/engine/collide/collide-target-h.gc b/goal_src/jak2/engine/collide/collide-target-h.gc index f30e629c07..0fc19bfe61 100644 --- a/goal_src/jak2/engine/collide/collide-target-h.gc +++ b/goal_src/jak2/engine/collide/collide-target-h.gc @@ -8,218 +8,211 @@ ;; DECOMP BEGINS (deftype control-info (collide-shape-moving) - ((unknown-float00 float :offset 448) - (unknown-float01 float :offset 452) - (unknown-float02 float :offset 456) - (unknown-float03 float :offset 460) - (unknown-vector00 vector :inline :offset 480) - (unknown-vector01 vector :inline :offset 496) - (unknown-vector02 vector :inline :offset 512) - ;; the quaternion used for all the control code. - ;; there is an additional rotation offset applied for certain effects, like the pitch of - ;; jak's body when swimming underwater. - (quat-for-control quaternion :inline :offset 528) - ;; The final quat (used for drawing, and _maybe_ collision?) is separate from the quaternion used for the - ;; control math. The quat-for-control and override-quat are interpolated to get this final quaternion. - ;; At least in jak 1, this was only used for pitching jak's body when swimming. - (override-quat quaternion :inline :offset 544) - (override-quat-alpha float :offset 560) ;; 0 = use quat-for-control only - - (unknown-float05 float :offset 564) - (unknown-float003 float :offset 568) - (unknown-float06 float :offset 572) - (unknown-float07 float :offset 576) - (unknown-time-frame00 time-frame :offset 584) - (unknown-vector03 vector :inline :offset 592) - (unknown-quaternion02 quaternion :inline :offset 608) - (unknown-quaternion03 quaternion :inline :offset 624) - (unknown-vector-array00 vector 128 :inline :offset 640) - (unknown-time-frame-array00 time-frame 128 :offset 2688) - (unknown-word00 int32 :offset 3712) - (unknown-vector04 vector :inline :offset 3728) - (unknown-vector05 vector :inline :offset 3744) - (unknown-vector06 vector :inline :offset 3760) - (unknown-vector07 vector :inline :offset 3776) - (unknown-vector000 vector :inline :offset 3792) - (unknown-dynamics00 dynamics :offset 3824) - (unknown-surface00 surface :offset 3828) - (unknown-surface01 surface :offset 3832) - (unknown-surface02 surface :offset 3836) - (unknown-time-frame02 time-frame :offset 3840) - (cpad cpad-info :offset 3848) - (unknown-float08 float :offset 3852) - (unknown-float09 float :offset 3856) - (unknown-float10 float :offset 3860) - (unknown-float11 float :offset 3864) - ;; unit vector in xz plane. Points from jak to the 'target' point. - ;; if the user's input is 0, will keep the last value. - (to-target-pt-xz vector :inline :offset 3872) - (unknown-vector09 vector :inline :offset 3888) - (unknown-vector10 vector :inline :offset 3904) - (unknown-vector11 vector :inline :offset 3920) - (unknown-vector-array01 vector 7 :inline :offset 3936) - (unknown-vector12 vector :inline :offset 4064) - (unknown-vector13 vector :inline :offset 4080) - (unknown-float12 float :offset 4096) - (unknown-float13 float :offset 4100) - (unknown-dword01 int64 :offset 4104) - (unknown-matrix00 matrix :inline :offset 4112) - (unknown-matrix01 matrix :inline :offset 4176) - (unknown-matrix02 matrix :inline :offset 4240) - (unknown-vector14 vector :inline :offset 4320) - (unknown-vector15 vector :inline :offset 4336) - (unknown-matrix03 matrix :inline :offset 4352) - (unknown-dword02 int64 :offset 4416) - (unknown-vector16 vector :inline :offset 4432) - (unknown-float14 float :offset 4448) - (unknown-floatiujh1bnb2n3i1 float :offset 4452) - (unknown-float15 float :offset 4456) - (unknown-word01 int32 :offset 4460) - (unknown-vector17 vector :inline :offset 4464) - (unknown-vector18 vector :inline :offset 4480) - (unknown-time-frame03 time-frame :offset 4496) - (unknown-time-frame04 time-frame :offset 4504) - (unknown-vector19 vector :inline :offset 4512) - (unknown-vector20 vector :inline :offset 4528) - (unknown-vector21 vector :inline :offset 4544) - (unknown-float16 float :offset 4548) - (unknown-vector22 vector :inline :offset 4560) - (unknown-vector23 vector :inline :offset 4576) - (unknown-time-frame05 time-frame :offset 4624) - (unknown-float0000 float :offset 4632) - (unknown-float17 float :offset 4636) - (unknown-float18 float :offset 4640) - (unknown-float19 float :offset 4644) - (unknown-float20 float :offset 4648) - (unknown-time-frame06 time-frame :offset 4656) - (unknown-float21 float :offset 4664) - (unknown-time-frame07 time-frame :offset 4672) - (unknown-pat-surface00 pat-surface :offset 4680) - (unknown-vector24 vector :inline :offset 4688) - (unknown-vector25 vector :inline :offset 4720) - (unknown-vector001 vector :inline :offset 4736) - (unknown-handle00 handle :offset 4768) - (unknown-pat-surface01 pat-surface :offset 4776) - (unknown-float22 float :offset 4780) - (unknown-float23 float :offset 4784) - (unknown-float24 float :offset 4788) - (unknown-float25 float :offset 4792) - (unknown-float26 float :offset 4796) - (unknown-word000 int32 :offset 4800) - (unknown-float002 float :offset 4804) - (unknown-time-frame08 time-frame :offset 4816) - (unknown-vector26 vector :inline :offset 4928) - (unknwon-vector27 vector :inline :offset 4976) - (unknown-float27 float :offset 4992) - (unknown-time-frame09 time-frame :offset 5000) - (unknown-sphere-array00 collide-shape-prim-sphere 10 :offset 5016) - (unknown-word02 int32 :offset 5064) - (unknown-time-frame10 time-frame :offset 5072) - (unknown-time-frame11 time-frame :offset 5080) - (unknown-time-frame001 time-frame :offset 5088) - (unknown-time-frame12 time-frame :offset 5096) - (unknown-time-frame002 time-frame :offset 5104) - (unknown-time-frame13 time-frame :offset 5112) - (unknown-time-frame14 time-frame :offset 5120) - (unknown-float28 float :offset 5132) - (unknown-float29 float :offset 5136) - (unknown-float30 float :offset 5140) - (unknown-vector28 vector :inline :offset 5152) - (lhand-cspace cspace :offset 5168) - (rhand-cspace cspace :offset 5172) - (midpoint-of-hands vector :inline :offset 5184) - (unknown-vector31 vector :inline :offset 5200) - (unknown-cspacei1un23i1 cspace :inline :offset 5216) - (unknown-symbol00 symbol :offset 5248) - (unknown-float000 float :offset 5252) - (unknown-float31 float :offset 5256) - (unknown-vector-array02 vector 15 :inline :offset 5264) - (unknown-float32 float :offset 5520) - (unknown-word03 int32 :offset 5524) - (unknown-float33 float :offset 5528) - (unknown-symbol000 symbol :offset 5532) - (unknown-vector34 vector :inline :offset 5536) - (unknown-vector35 vector :inline :offset 5552) - (unknown-vector36 vector :inline :offset 5568) - (unknown-time-frame15 time-frame :offset 5584) - (unknown-time-frame16 time-frame :offset 5592) - (unknown-handle000 handle :offset 5600) - (unknown-handle01 handle :offset 5608) - (unknown-word04 uint32 :offset 5616) - (unknown-spool-anim00 spool-anim :offset 5616) - (unknown-word05 int32 :offset 5616) - (unknown-symbol01 symbol :offset 5616) - (unknown-float34 float :offset 5616) - (unknown-symbol02 float :offset 5620) - (unknown-symbol03 float :offset 5624) - (unknown-float35 float :offset 5628) - (unknown-float36 float :offset 5632) - (unknown-float37 float :offset 5636) - (unknown-vector37 vector :inline :offset 5648) - (unknown-vector38 vector :inline :offset 5664) - (unknown-vector39 vector :inline :offset 5680) - (unknown-vector40 vector :inline :offset 5696) - (unknown-time-frame17 time-frame :offset 5712) - (unknown-time-frame18 time-frame :offset 5720) - (unknown-sound-id00 sound-id :offset 5776) - (unknown-handle02 handle :offset 5792) - (unknown-impact-control00 impact-control :inline :offset 5824) - (unknown-word06 int32 :offset 5832) - (unknown-vector41 vector :inline :offset 5888) - (unknown-vector42 vector :inline :offset 5904) - (unknown-float38 float :offset 5908) - (unknown-vector43 vector :inline :offset 5920) - (unknown-float39 float :offset 5924) - (unknown-time-frame19 time-frame :offset 5936) - (unknown-time-frame20 time-frame :offset 5944) - (unknown-symbol04 symbol :offset 5984) - (unknown-symbol05 symbol :offset 5988) - (unknown-attack-id00 int32 :offset 5992) - (unknown-float40 float :offset 5996) - (unknown-dword05 uint64 :offset 6000) - (unknown-dword06 handle :offset 6008) - (unknown-time-frame000 time-frame :offset 6016) - (unknown-combo-tracker00 combo-tracker :inline :offset 6032) - (unknown-time-frame21 time-frame :offset 6072) - (unknown-dword07 int64 :offset 6096) - (unknown-dword08 int64 :offset 6104) - (unknown-dword09 int64 :offset 6112) - (unknown-dword10 int64 :offset 6120) - (unknown-symbol06 symbol :offset 6144) - (unknown-quaternion04 quaternion :inline :offset 6160) - (unknown-sound-id01 sound-id :offset 6176) - (unknown-float41 float :offset 6180) - (unknown-float42 float :offset 6184) - (unknown-halfword00 uint16 :offset 6188) - (history-length uint16 :offset 6190) - (unknown-word07 int32 :offset 6192) - (unknown-time-frame22 time-frame :offset 6200) - (unknown-time-frame23 time-frame :offset 6208) - (unknown-time-frame24 time-frame :offset 6216) - (unknown-time-frame25 time-frame :offset 6224) - (unknown-float43 float :offset 6232) - (unknown-float001 float :offset 6236) - (unknown-sound-id02 sound-id :offset 6240) - (unknown-sound-id03 sound-id :offset 6244) - (unknown-time-frame26 time-frame :offset 6248) - (unknown-time-frame27 time-frame :offset 6256) - (unknown-dword11 int64 :offset 6264) - (unknown-vector44 vector :inline :offset 6272) - (unknown-float44 float :offset 6288) - (unknown-sound-id04 sound-id :offset 6292) - (unknown-float45 float :offset 6296) - (unknown-word08 int32 :offset 6300) - (unknown-sphere000 sphere :offset 6304) - (unknown-word09 int32 :offset 6308) - (unknown-word10 uint32 :offset 6312) - (unknown-time-frame28 time-frame :offset 6320) - (unknown-time-frame29 time-frame :offset 6328) - (unknown-dword12 int64 :offset 6336) - (unknown-time-frame30 time-frame :offset 6368) - (unknown-quaternion05 quaternion :inline :offset 6384) - (unknown-time-frame31 time-frame :offset 6400) - (unknown-time-frame32 time-frame :offset 6408) - (pad uint8 :offset 6415) + ((unknown-float00 float :offset 448) + (unknown-float01 float :offset 452) + (unknown-float02 float :offset 456) + (unknown-float03 float :offset 460) + (unknown-vector00 vector :inline :offset 480) + (target-transv vector :inline :offset 496) + (unknown-vector02 vector :inline :offset 512) + (quat-for-control quaternion :inline :offset 528) + (override-quat quaternion :inline :offset 544) + (override-quat-alpha float :offset 560) + (unknown-float05 float :offset 564) + (unknown-float003 float :offset 568) + (unknown-float06 float :offset 572) + (unknown-float07 float :offset 576) + (unknown-time-frame00 time-frame :offset 584) + (unknown-vector03 vector :inline :offset 592) + (unknown-quaternion02 quaternion :inline :offset 608) + (unknown-quaternion03 quaternion :inline :offset 624) + (unknown-vector-array00 vector 128 :inline :offset 640) + (unknown-time-frame-array00 time-frame 128 :offset 2688) + (unknown-word00 int32 :offset 3712) + (draw-offset vector :inline :offset 3728) + (cspace-offset vector :inline :offset 3744) + (anim-collide-offset-local vector :inline :offset 3760) + (anim-collide-offset-world vector :inline :offset 3776) + (old-anim-collide-offset-world vector :inline :offset 3792) + (anim-collide-offset-delta-world vector :inline :offset 3808) + (unknown-dynamics00 dynamics :offset 3824) + (unknown-surface00 surface :offset 3828) + (unknown-surface01 surface :offset 3832) + (unknown-surface02 surface :offset 3836) + (unknown-time-frame02 time-frame :offset 3840) + (cpad cpad-info :offset 3848) + (unknown-float08 float :offset 3852) + (unknown-float09 float :offset 3856) + (unknown-float10 float :offset 3860) + (unknown-float11 float :offset 3864) + (to-target-pt-xz vector :inline :offset 3872) + (unknown-vector09 vector :inline :offset 3888) + (unknown-vector10 vector :inline :offset 3904) + (unknown-vector11 vector :inline :offset 3920) + (unknown-vector-array01 vector 7 :inline :offset 3936) + (unknown-vector12 vector :inline :offset 4064) + (unknown-vector13 vector :inline :offset 4080) + (unknown-float12 float :offset 4096) + (unknown-float13 float :offset 4100) + (unknown-dword01 int64 :offset 4104) + (unknown-matrix00 matrix :inline :offset 4112) + (unknown-matrix01 matrix :inline :offset 4176) + (ctrl-orientation matrix :inline :offset 4240) + (unknown-vector14 vector :inline :offset 4320) + (unknown-vector15 vector :inline :offset 4336) + (unknown-matrix03 matrix :inline :offset 4352) + (unknown-dword02 int64 :offset 4416) + (unknown-vector16 vector :inline :offset 4432) + (unknown-float14 float :offset 4448) + (unknown-floatiujh1bnb2n3i1 float :offset 4452) + (unknown-float15 float :offset 4456) + (unknown-word01 int32 :offset 4460) + (collide-extra-velocity vector :inline :offset 4464) + (unknown-vector18 vector :inline :offset 4480) + (unknown-time-frame03 time-frame :offset 4496) + (unknown-time-frame04 time-frame :offset 4504) + (unknown-vector19 vector :inline :offset 4512) + (unknown-vector20 vector :inline :offset 4528) + (unknown-vector21 vector :inline :offset 4544) + (unknown-float16 float :offset 4548) + (unknown-vector22 vector :inline :offset 4560) + (last-trans-on-surf vector :inline :offset 4576) + (unknown-time-frame05 time-frame :offset 4624) + (unknown-float0000 float :offset 4632) + (unknown-float17 float :offset 4636) + (unknown-float18 float :offset 4640) + (unknown-float19 float :offset 4644) + (unknown-float20 float :offset 4648) + (unknown-time-frame06 time-frame :offset 4656) + (unknown-float21 float :offset 4664) + (unknown-time-frame07 time-frame :offset 4672) + (unknown-pat-surface00 pat-surface :offset 4680) + (unknown-vector24 vector :inline :offset 4688) + (unknown-vector25 vector :inline :offset 4720) + (unknown-vector001 vector :inline :offset 4736) + (unknown-handle00 handle :offset 4768) + (unknown-pat-surface01 pat-surface :offset 4776) + (unknown-float22 float :offset 4780) + (unknown-float23 float :offset 4784) + (unknown-float24 float :offset 4788) + (unknown-float25 float :offset 4792) + (unknown-float26 float :offset 4796) + (unknown-word000 int32 :offset 4800) + (unknown-float002 float :offset 4804) + (unknown-time-frame08 time-frame :offset 4816) + (unknown-vector26 vector :inline :offset 4928) + (btransv vector :inline :offset 4976) + (blocked-factor float :offset 4992) + (blocked-in-air-factor float :offset 4996) + (unknown-time-frame09 time-frame :offset 5000) + (unknown-sphere-array00 collide-shape-prim-sphere 10 :offset 5016) + (unknown-word02 int32 :offset 5064) + (unknown-time-frame10 time-frame :offset 5072) + (unknown-time-frame11 time-frame :offset 5080) + (unknown-time-frame001 time-frame :offset 5088) + (unknown-time-frame12 time-frame :offset 5096) + (unknown-time-frame002 time-frame :offset 5104) + (unknown-time-frame13 time-frame :offset 5112) + (unknown-time-frame14 time-frame :offset 5120) + (unknown-float28 float :offset 5132) + (unknown-float29 float :offset 5136) + (unknown-float30 float :offset 5140) + (unknown-vector28 vector :inline :offset 5152) + (lhand-cspace cspace :offset 5168) + (rhand-cspace cspace :offset 5172) + (midpoint-of-hands vector :inline :offset 5184) + (unknown-vector31 vector :inline :offset 5200) + (unknown-cspacei1un23i1 cspace :inline :offset 5216) + (unknown-symbol00 symbol :offset 5248) + (unknown-float000 float :offset 5252) + (unknown-float31 float :offset 5256) + (unknown-vector-array02 vector 15 :inline :offset 5264) + (unknown-float32 float :offset 5520) + (unknown-word03 int32 :offset 5524) + (unknown-float33 float :offset 5528) + (unknown-symbol000 symbol :offset 5532) + (unknown-vector34 vector :inline :offset 5536) + (unknown-vector35 vector :inline :offset 5552) + (unknown-vector36 vector :inline :offset 5568) + (unknown-time-frame15 time-frame :offset 5584) + (unknown-time-frame16 time-frame :offset 5592) + (unknown-handle000 handle :offset 5600) + (unknown-handle01 handle :offset 5608) + (unknown-word04 uint32 :offset 5616) + (unknown-spool-anim00 spool-anim :offset 5616) + (unknown-word05 int32 :offset 5616) + (unknown-symbol01 symbol :offset 5616) + (unknown-float34 float :offset 5616) + (unknown-symbol02 float :offset 5620) + (unknown-symbol03 float :offset 5624) + (unknown-float35 float :offset 5628) + (unknown-float36 float :offset 5632) + (unknown-float37 float :offset 5636) + (unknown-vector37 vector :inline :offset 5648) + (unknown-vector38 vector :inline :offset 5664) + (unknown-vector39 vector :inline :offset 5680) + (unknown-vector40 vector :inline :offset 5696) + (unknown-time-frame17 time-frame :offset 5712) + (unknown-time-frame18 time-frame :offset 5720) + (unknown-sound-id00 sound-id :offset 5776) + (unknown-handle02 handle :offset 5792) + (unknown-impact-control00 impact-control :inline :offset 5824) + (unknown-word06 int32 :offset 5832) + (unknown-vector41 vector :inline :offset 5888) + (unknown-vector42 vector :inline :offset 5904) + (unknown-float38 float :offset 5908) + (unknown-vector43 vector :inline :offset 5920) + (unknown-float39 float :offset 5924) + (unknown-time-frame19 time-frame :offset 5936) + (unknown-time-frame20 time-frame :offset 5944) + (unknown-symbol04 symbol :offset 5984) + (unknown-symbol05 symbol :offset 5988) + (unknown-attack-id00 int32 :offset 5992) + (unknown-float40 float :offset 5996) + (unknown-dword05 uint64 :offset 6000) + (unknown-dword06 handle :offset 6008) + (unknown-time-frame000 time-frame :offset 6016) + (unknown-combo-tracker00 combo-tracker :inline :offset 6032) + (unknown-time-frame21 time-frame :offset 6072) + (unknown-dword07 int64 :offset 6096) + (unknown-dword08 int64 :offset 6104) + (unknown-dword09 int64 :offset 6112) + (unknown-dword10 int64 :offset 6120) + (unknown-symbol06 symbol :offset 6144) + (unknown-quaternion04 quaternion :inline :offset 6160) + (unknown-sound-id01 sound-id :offset 6176) + (unknown-float41 float :offset 6180) + (unknown-float42 float :offset 6184) + (unknown-halfword00 uint16 :offset 6188) + (history-length uint16 :offset 6190) + (unknown-word07 int32 :offset 6192) + (unknown-time-frame22 time-frame :offset 6200) + (unknown-time-frame23 time-frame :offset 6208) + (unknown-time-frame24 time-frame :offset 6216) + (unknown-time-frame25 time-frame :offset 6224) + (unknown-float43 float :offset 6232) + (unknown-float001 float :offset 6236) + (unknown-sound-id02 sound-id :offset 6240) + (unknown-sound-id03 sound-id :offset 6244) + (unknown-time-frame26 time-frame :offset 6248) + (unknown-time-frame27 time-frame :offset 6256) + (unknown-dword11 int64 :offset 6264) + (align-xz-vel vector :inline :offset 6272) + (zx-vel-frac float :offset 6288) + (unknown-sound-id04 sound-id :offset 6292) + (unknown-float45 float :offset 6296) + (unknown-word08 int32 :offset 6300) + (unknown-sphere000 sphere :offset 6304) + (unknown-word09 int32 :offset 6308) + (unknown-word10 uint32 :offset 6312) + (unknown-time-frame28 time-frame :offset 6320) + (unknown-time-frame29 time-frame :offset 6328) + (unknown-dword12 int64 :offset 6336) + (unknown-time-frame30 time-frame :offset 6368) + (unknown-quaternion05 quaternion :inline :offset 6384) + (unknown-time-frame31 time-frame :offset 6400) + (unknown-time-frame32 time-frame :offset 6408) + (pad uint8 :offset 6415) ) :method-count-assert 68 :size-assert #x1910 diff --git a/goal_src/jak2/engine/collide/collide.gc b/goal_src/jak2/engine/collide/collide.gc index e9aa816436..ff66f2c230 100644 --- a/goal_src/jak2/engine/collide/collide.gc +++ b/goal_src/jak2/engine/collide/collide.gc @@ -11,5 +11,28 @@ (vec vector :inline)) ) +;; this is some vif setup stuff that was in jak 1 as well - some code in collide-cache +;; uses VIF's unpack/upload to modify collision data. This gets ported to c++, just +;; keeping it here for reference. + ;; DECOMP BEGINS +(define *collide-vif0-init* (new 'static 'boxed-array :type uint32 + #x30000000 ;; strow + #x4d000000 ;; row x + #x4d000000 ;; row y + #x4d000000 ;; row z + #x3f800000 ;; row w + #x5000001 ;; stmod 1 + #x20000000 ;; stmask + #x40404040 ;; 1's on all w's + #x1000404 ;; stcycl cl 4 wl 4 + #x0 + #x0 + #x0 + ) + ) + + + + diff --git a/goal_src/jak2/engine/common_objs/base-plat.gc b/goal_src/jak2/engine/common_objs/base-plat.gc index abbfb6f8f5..29f7d244b9 100644 --- a/goal_src/jak2/engine/common_objs/base-plat.gc +++ b/goal_src/jak2/engine/common_objs/base-plat.gc @@ -106,14 +106,14 @@ (let ((trans (new 'stack-no-clear 'vector))) (set! (-> trans quad) (-> self basetrans quad)) (+! (-> trans y) (* (-> self bounce-scale) (update! (-> self smush)))) - (collide-shape-method-29 (-> self root-override) trans) + (move-to-point! (-> self root-override) trans) ) (if (not (!= (-> self smush amp) 0.0)) (set! (-> self bouncing) #f) ) ) (else - (collide-shape-method-29 (-> self root-override) (-> self basetrans)) + (move-to-point! (-> self root-override) (-> self basetrans)) ) ) (none) @@ -218,7 +218,7 @@ eco-door-event-handler :code (behavior () (ja :num-func num-func-identity :frame-num 0.0) (suspend) - (collide-shape-method-46 (-> self root-override)) + (update-transforms (-> self root-override)) (ja-post) (until #f (when (and *target* (and (>= (-> self open-distance) @@ -284,7 +284,7 @@ eco-door-event-handler (ja :num-func num-func-identity :frame-num max) (logior! (-> self draw status) (draw-control-status no-draw)) (suspend) - (collide-shape-method-46 (-> self root-override)) + (update-transforms (-> self root-override)) (ja-post) (until #f (let ((dist-from-target (vector4-dot (-> self out-dir) (target-pos 0))) @@ -404,7 +404,7 @@ eco-door-event-handler (set! (-> obj one-way) (logtest? (-> obj flags) (eco-door-flags one-way))) (vector-z-quaternion! (-> obj out-dir) (-> obj root-override quat)) (set! (-> obj out-dir w) (- (vector-dot (-> obj out-dir) (-> obj root-override trans)))) - (collide-shape-method-46 (-> obj root-override)) + (update-transforms (-> obj root-override)) (stub obj) (if (and (not (-> obj auto-close)) (-> obj entity) diff --git a/goal_src/jak2/engine/common_objs/basebutton.gc b/goal_src/jak2/engine/common_objs/basebutton.gc index 9592d8bf4e..71eae9b7d1 100644 --- a/goal_src/jak2/engine/common_objs/basebutton.gc +++ b/goal_src/jak2/engine/common_objs/basebutton.gc @@ -61,11 +61,11 @@ (logclear! (-> obj button-status) (button-status button-status-2)) (if vec (set! (-> obj move-to-pos quad) (-> vec quad)) - (set! (-> obj move-to-pos quad) (-> obj root trans quad)) + (set! (-> obj move-to-pos quad) (-> obj root-override trans quad)) ) (if quat (quaternion-copy! (-> obj move-to-quat) quat) - (quaternion-copy! (-> obj move-to-quat) (-> obj root quat)) + (quaternion-copy! (-> obj move-to-quat) (-> obj root-override quat)) ) 0 (none) @@ -129,8 +129,8 @@ :post (behavior () (when (logtest? (-> self button-status) (button-status button-status-2)) (logclear! (-> self button-status) (button-status button-status-2)) - (set! (-> self root trans quad) (-> self move-to-pos quad)) - (quaternion-copy! (-> self root quat) (-> self move-to-quat)) + (set! (-> self root-override trans quad) (-> self move-to-pos quad)) + (quaternion-copy! (-> self root-override quat) (-> self move-to-quat)) (rider-post) ) (none) @@ -178,8 +178,8 @@ :post (behavior () (when (logtest? (-> self button-status) (button-status button-status-2)) (logclear! (-> self button-status) (button-status button-status-2)) - (set! (-> self root trans quad) (-> self move-to-pos quad)) - (quaternion-copy! (-> self root quat) (-> self move-to-quat)) + (set! (-> self root-override trans quad) (-> self move-to-pos quad)) + (quaternion-copy! (-> self root-override quat) (-> self move-to-quat)) ) (rider-post) (none) @@ -231,8 +231,8 @@ :post (behavior () (when (logtest? (-> self button-status) (button-status button-status-2)) (logclear! (-> self button-status) (button-status button-status-2)) - (set! (-> self root trans quad) (-> self move-to-pos quad)) - (quaternion-copy! (-> self root quat) (-> self move-to-quat)) + (set! (-> self root-override trans quad) (-> self move-to-pos quad)) + (quaternion-copy! (-> self root-override quat) (-> self move-to-quat)) (rider-post) ) (none) @@ -272,8 +272,8 @@ :post (behavior () (when (logtest? (-> self button-status) (button-status button-status-2)) (logclear! (-> self button-status) (button-status button-status-2)) - (set! (-> self root trans quad) (-> self move-to-pos quad)) - (quaternion-copy! (-> self root quat) (-> self move-to-quat)) + (set! (-> self root-override trans quad) (-> self move-to-pos quad)) + (quaternion-copy! (-> self root-override quat) (-> self move-to-quat)) ) (rider-post) (none) @@ -406,13 +406,13 @@ (set! (-> collision-shape total-prims) (the-as uint 1)) (set! (-> collision-shape root-prim) collision-mesh) ) - (collide-shape-method-54 collision-shape) + (pusher-init collision-shape) (set! (-> collision-shape nav-radius) (* 0.75 (-> collision-shape root-prim local-sphere w))) (let ((prim (-> collision-shape root-prim))) (set! (-> collision-shape backup-collide-as) (-> prim prim-core collide-as)) (set! (-> collision-shape backup-collide-with) (-> prim prim-core collide-with)) ) - (set! (-> obj root) collision-shape) + (set! (-> obj root-override) collision-shape) ) 0 (none) @@ -481,9 +481,9 @@ (set! (-> self actor-group) (the-as (pointer actor-group) #f)) (set! (-> self actor-group-count) 0) (basebutton-method-34 self) - (set! (-> self root trans quad) (-> vec quad)) - (quaternion-copy! (-> self root quat) quat) - (set-vector! (-> self root scale) 1.0 1.0 1.0 1.0) + (set! (-> self root-override trans quad) (-> vec quad)) + (quaternion-copy! (-> self root-override quat) quat) + (set-vector! (-> self root-override scale) 1.0 1.0 1.0 1.0) (prepare-trigger-event! self) (basebutton-method-33 self) (idle-state-transition self) diff --git a/goal_src/jak2/engine/common_objs/conveyor.gc b/goal_src/jak2/engine/common_objs/conveyor.gc index 3674ed8998..c2cf97fe6c 100644 --- a/goal_src/jak2/engine/common_objs/conveyor.gc +++ b/goal_src/jak2/engine/common_objs/conveyor.gc @@ -184,7 +184,7 @@ (init-vf0-vector) (set! *actor-list-length* 0) (if #t - (set! *actor-list-length* (spatial-hash-method-36 *actor-hash* (-> obj collide-bounds) *actor-list* 256)) + (set! *actor-list-length* (fill-actor-list-for-sphere *actor-hash* (-> obj collide-bounds) *actor-list* 256)) ) (when #t (let ((a0-2 (-> *collide-player-list* alive-list next0))) diff --git a/goal_src/jak2/engine/common_objs/crates.gc b/goal_src/jak2/engine/common_objs/crates.gc index a61c245381..ecb1b680a2 100644 --- a/goal_src/jak2/engine/common_objs/crates.gc +++ b/goal_src/jak2/engine/common_objs/crates.gc @@ -7,12 +7,11 @@ (define-extern process-contact-action (function process none :behavior target)) (define-extern eco-blue-glow (function vector none)) -(define-extern cshape-reaction-default (function control-info collide-query vector vector cshape-moving-flags)) ;; DECOMP BEGINS -(defskelgroup skel-crate-krimson crate 0 3 - ((1 (meters 20)) (2 (meters 999999))) +(defskelgroup skel-crate-krimson crate crate-krimson-lod0-jg crate-idle-ja + ((crate-krimson-lod0-mg (meters 20)) (crate-krimson-lod1-mg (meters 999999))) :bounds (static-spherem 0 1 0 1.6) :texture-level 6 ) @@ -668,7 +667,7 @@ :event crate-standard-event-handler :code (behavior () (suspend) - (collide-shape-method-46 (the-as collide-shape-moving (-> self root-override2))) + (update-transforms (the-as collide-shape-moving (-> self root-override2))) (carry-info-method-9 (-> self carry)) (logior! (-> self mask) (process-mask sleep)) (until #f @@ -698,7 +697,7 @@ (ja-post) (carry-info-method-9 (-> self carry)) (carry-info-method-13 (-> self carry)) - (collide-shape-method-46 (the-as collide-shape-moving (-> self root-override2))) + (update-transforms (the-as collide-shape-moving (-> self root-override2))) (none) ) ) @@ -725,7 +724,7 @@ (-> self carry) ) ) - (set! (-> self root-override2 status) (cshape-moving-flags)) + (set! (-> self root-override2 status) (collide-status)) (set! (-> self root-override2 root-prim local-sphere w) (-> self carry carry-radius)) (set! (-> self root-override2 root-prim prim-core collide-with) (logior (collide-spec backgnd crate obstacle hit-by-others-list pusher) @@ -735,7 +734,7 @@ (none) ) :trans (behavior () - (when (and (logtest? (-> (the-as collide-shape-moving (-> self root-override2)) status) (cshape-moving-flags on-surface)) + (when (and (logtest? (-> (the-as collide-shape-moving (-> self root-override2)) status) (collide-status on-surface)) (< 0.8 (-> (the-as collide-shape-moving (-> self root-override2)) surface-angle)) ) (vector-reset! (-> self root-override2 transv)) @@ -779,7 +778,7 @@ (set! (-> a2-1 ignore-process1) #f) (set! (-> a2-1 ignore-pat) (-> gp-1 pat-ignore-mask)) (set! (-> a2-1 action-mask) (collide-action solid)) - (collide-shape-method-32 gp-1 (-> gp-1 transv) a2-1 (meters 0)) + (fill-cache-integrate-and-collide gp-1 (-> gp-1 transv) a2-1 (meters 0)) ) (set! (-> gp-1 root-prim type) collide-shape-prim-mesh) ) @@ -1213,7 +1212,9 @@ (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s4-0 reaction) cshape-reaction-default) - (set! (-> s4-0 no-reaction) nothing) + (set! (-> s4-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) (let ((v1-10 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) (set! (-> v1-10 prim-core collide-as) (collide-spec crate notice-blue-eco-powerup)) (set! (-> v1-10 prim-core collide-with) (collide-spec jak player-list tobot)) diff --git a/goal_src/jak2/engine/common_objs/elevator.gc b/goal_src/jak2/engine/common_objs/elevator.gc index b7da9c4d47..ac62d8b6a9 100644 --- a/goal_src/jak2/engine/common_objs/elevator.gc +++ b/goal_src/jak2/engine/common_objs/elevator.gc @@ -463,12 +463,6 @@ #t ) -;; WARN: Stack slot offset 16 signed mismatch -;; WARN: Stack slot offset 16 signed mismatch -;; WARN: Stack slot offset 16 signed mismatch -;; WARN: Stack slot offset 16 signed mismatch -;; WARN: Stack slot offset 16 signed mismatch -;; WARN: Stack slot offset 16 signed mismatch (defmethod move-to-next-point! elevator ((obj elevator)) "If the [[*target*]] is in a valid state and there is a point to transition to in the elevator's path do so. @@ -806,21 +800,6 @@ ) ) -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch -;; WARN: Stack slot offset 32 signed mismatch ;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! elevator ((obj elevator) (entity entity-actor)) (local-vars (sv-32 float) (sv-36 path-control) (sv-40 target)) @@ -829,7 +808,7 @@ (initialize-skeleton obj (the-as skeleton-group (get-art-group obj)) (the-as pair 0)) (stop-bouncing! obj) (set! (-> obj elevator-status) (elevator-status)) - (collide-shape-method-46 (-> obj root-override)) + (update-transforms (-> obj root-override)) (base-plat-method-32 obj) (init-defaults! obj) (set! (-> obj on-activate) (res-lump-struct (-> obj entity) 'on-activate basic)) diff --git a/goal_src/jak2/engine/common_objs/generic-obs.gc b/goal_src/jak2/engine/common_objs/generic-obs.gc index 5a06a6f51c..67e4067404 100644 --- a/goal_src/jak2/engine/common_objs/generic-obs.gc +++ b/goal_src/jak2/engine/common_objs/generic-obs.gc @@ -40,7 +40,7 @@ ) ) (if a0-7 - (collide-shape-method-29 a0-7 (-> (the-as process-drawable gp-0) root trans)) + (move-to-point! a0-7 (-> (the-as process-drawable gp-0) root trans)) (set! (-> self root trans quad) (-> (the-as process-drawable gp-0) root trans quad)) ) ) diff --git a/goal_src/jak2/engine/common_objs/plat.gc b/goal_src/jak2/engine/common_objs/plat.gc index 71e4ad7617..bbf6a9261f 100644 --- a/goal_src/jak2/engine/common_objs/plat.gc +++ b/goal_src/jak2/engine/common_objs/plat.gc @@ -46,13 +46,13 @@ (set! (-> collision-shape total-prims) (the-as uint 1)) (set! (-> collision-shape root-prim) collision-mesh) ) - (collide-shape-method-54 collision-shape) + (pusher-init collision-shape) (set! (-> collision-shape nav-radius) (* 0.75 (-> collision-shape root-prim local-sphere w))) (let ((prim (-> collision-shape root-prim))) (set! (-> collision-shape backup-collide-as) (-> prim prim-core collide-as)) (set! (-> collision-shape backup-collide-with) (-> prim prim-core collide-with)) ) - (set! (-> obj root-override) (the-as collide-shape-moving collision-shape)) + (set! (-> obj root-override) collision-shape) ) 0 (none) @@ -155,7 +155,7 @@ (base-plat-method-31 obj) (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as skeleton-group (get-art-group obj)) (the-as pair 0)) - (collide-shape-method-46 (-> obj root-override)) + (update-transforms (-> obj root-override)) (stop-bouncing! obj) (base-plat-method-32 obj) (set! (-> obj fact) diff --git a/goal_src/jak2/engine/common_objs/projectile.gc b/goal_src/jak2/engine/common_objs/projectile.gc index e8532f40a9..cf589ff9de 100644 --- a/goal_src/jak2/engine/common_objs/projectile.gc +++ b/goal_src/jak2/engine/common_objs/projectile.gc @@ -163,8 +163,10 @@ (defmethod made-impact? projectile ((obj projectile)) "TODO - queries the collision cache, return true/false" - (let ((v1-0 (-> obj root-override))) - (let ((a1-0 (new 'stack-no-clear 'collide-query))) + (let ((v1-0 (-> obj root-override)) + (t1-0 (new 'stack-no-clear 'collide-query)) + ) + (let ((a1-0 t1-0)) (set! (-> a1-0 radius) (-> v1-0 root-prim prim-core world-sphere w)) (set! (-> a1-0 collide-with) (-> v1-0 root-prim prim-core collide-with)) (set! (-> a1-0 ignore-process0) obj) @@ -172,7 +174,7 @@ (set! (-> a1-0 ignore-pat) (-> v1-0 pat-ignore-mask)) (set! (-> a1-0 action-mask) (collide-action solid)) ) - (collide-shape-moving-method-65 v1-0 (-> v1-0 transv) -6144.0 0.0 -2048.0) + (fill-and-try-snap-to-surface v1-0 (-> v1-0 transv) -6144.0 0.0 -2048.0 t1-0) ) ) @@ -185,7 +187,7 @@ (set! (-> a2-0 ignore-process1) (handle->process (-> arg0 ignore-handle))) (set! (-> a2-0 ignore-pat) (-> v1-0 pat-ignore-mask)) (set! (-> a2-0 action-mask) (collide-action solid)) - (collide-shape-method-32 v1-0 (-> v1-0 transv) a2-0 (meters 0)) + (fill-cache-integrate-and-collide v1-0 (-> v1-0 transv) a2-0 (meters 0)) ) 0 (none) @@ -224,7 +226,7 @@ ) (fill-using-line-sphere *collide-cache* a1-0) ) - (collide-shape-method-37 gp-0 (-> gp-0 transv)) + (integrate-and-collide! gp-0 (-> gp-0 transv)) ) 0 (none) @@ -247,7 +249,7 @@ (s3-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 root-override transv) 1.0)) (f30-0 (vector-length (-> arg0 root-override transv))) ) - (if (logtest? (-> arg0 root-override status) (cshape-moving-flags t-surface)) + (if (logtest? (-> arg0 root-override status) (collide-status touch-surface)) (vector-flatten! s5-1 s5-1 (-> arg0 root-override local-normal)) ) (vector-normalize-copy! s4-0 s5-1 1.0) @@ -331,7 +333,7 @@ (+! f0-14 (-> self old-dist v1-38)) ) (if (or (and (logtest? (-> self options) (projectile-options proj-options-4)) - (and (logtest? (-> self root-override status) (cshape-moving-flags t-wall)) (< f0-14 2048.0)) + (and (logtest? (-> self root-override status) (collide-status touch-wall)) (< f0-14 2048.0)) ) (< f0-14 (-> self stop-speed)) ) @@ -404,7 +406,9 @@ (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-projectile) - (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) (let ((v1-6 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) (set! (-> v1-6 prim-core collide-as) (collide-spec projectile)) (set! (-> v1-6 prim-core collide-with) @@ -499,7 +503,7 @@ (set! (-> self target-pos quad) (-> self base-target-pos quad)) (set! (-> self event-hook) projectile-event-handler) (init-proj-settings! self) - (collide-shape-method-46 (-> self root-override)) + (update-transforms (-> self root-override)) (draw-laser-sight self) (play-impact-sound self (projectile-options)) (when (logtest? (-> self options) (projectile-options proj-options-8000)) @@ -527,14 +531,7 @@ (projectile-bounce-update-velocity self) (set! (-> s5-0 quad) (-> gp-0 trans quad)) (vector-v++! s5-0 (-> gp-0 transv)) - (when (collide-shape-moving-method-55 - gp-0 - s4-0 - (collide-spec backgnd crate obstacle hit-by-others-list pusher) - 4096.0 - 81920.0 - 1024.0 - ) + (when (find-ground gp-0 s4-0 (collide-spec backgnd crate obstacle hit-by-others-list pusher) 4096.0 81920.0 1024.0) (let ((f0-1 (+ (-> gp-0 gspot-pos y) (-> self root-override root-prim local-sphere w)))) (when (>= f0-1 (-> s5-0 y)) (set! (-> s5-0 y) f0-1) @@ -542,7 +539,7 @@ ) ) ) - (collide-shape-method-29 gp-0 s5-0) + (move-to-point! gp-0 s5-0) ) (transform-post) 0 @@ -617,10 +614,10 @@ (let* ((a2-0 (-> obj root-override)) (v1-0 (-> a2-0 status)) ) - (if (logtest? v1-0 (cshape-moving-flags t-surface)) + (if (logtest? v1-0 (collide-status touch-surface)) (vector-float*! (-> a2-0 transv) (-> a2-0 transv) 0.6) ) - (when (and (logtest? v1-0 (cshape-moving-flags csmf11)) + (when (and (logtest? v1-0 (collide-status impact-surface)) (>= (- (-> self clock frame-counter) (-> obj played-bounce-time)) (seconds 0.3)) ) (set! (-> obj played-bounce-time) (-> self clock frame-counter)) @@ -634,7 +631,9 @@ (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) projectile-bounce-reaction) - (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) (set! (-> s5-0 penetrate-using) (penetrate jak-dark-shot)) (let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) (set! (-> v1-7 prim-core action) (collide-action solid)) diff --git a/goal_src/jak2/engine/common_objs/rigid-body-plat.gc b/goal_src/jak2/engine/common_objs/rigid-body-plat.gc index 3ce780f7f5..04f1476641 100644 --- a/goal_src/jak2/engine/common_objs/rigid-body-plat.gc +++ b/goal_src/jak2/engine/common_objs/rigid-body-plat.gc @@ -215,7 +215,7 @@ (defmethod rigid-body-object-method-30 rigid-body-platform ((obj rigid-body-platform)) (if (-> obj info-override platform) - ((method-of-object (-> obj root-override-2) collide-shape-method-35)) + (detect-riders! (-> obj root-override-2)) ) (set! (-> obj player-velocity-prev quad) (-> obj player-velocity quad)) (if *target* @@ -348,7 +348,7 @@ (set! (-> obj control-point-array) (new 'process 'rigid-body-control-point-inline-array (-> obj info-override control-point-count)) ) - (collide-shape-method-46 (-> obj root-override-2)) + (update-transforms (-> obj root-override-2)) (let ((v1-5 (-> obj rbody)) (a1-3 (&-> (-> obj info-override) mass)) (a2-2 (-> obj root-override-2 trans)) @@ -373,7 +373,9 @@ (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) - (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) (let ((s4-0 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) (set! (-> s4-0 prim-core collide-as) (collide-spec pusher)) (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list)) @@ -383,7 +385,7 @@ (set! (-> s5-0 total-prims) (the-as uint 1)) (set! (-> s5-0 root-prim) s4-0) ) - (collide-shape-method-54 s5-0) + (pusher-init s5-0) (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) (let ((v1-15 (-> s5-0 root-prim))) (set! (-> s5-0 backup-collide-as) (-> v1-15 prim-core collide-as)) diff --git a/goal_src/jak2/engine/common_objs/voicebox.gc b/goal_src/jak2/engine/common_objs/voicebox.gc index eceada6d3c..09d8bccf04 100644 --- a/goal_src/jak2/engine/common_objs/voicebox.gc +++ b/goal_src/jak2/engine/common_objs/voicebox.gc @@ -82,8 +82,8 @@ ) -(defskelgroup skel-voicebox talk-box 0 2 - ((1 (meters 999999))) +(defskelgroup skel-voicebox talk-box talk-box-lod0-jg talk-box-idle-ja + ((talk-box-lod0-mg (meters 999999))) :bounds (static-spherem 0 0 0 4) :texture-level 6 :sort 1 @@ -113,7 +113,7 @@ (init-vf0-vector) (ja-post) (if (type? (-> obj root) collide-shape) - (collide-shape-method-46 (the-as collide-shape (-> obj root))) + (update-transforms (the-as collide-shape (-> obj root))) ) (when (and (nonzero? (-> obj part)) (and (or (and (-> obj next-state) (= (-> obj next-state name) 'idle)) (and (-> obj next-state) (= (-> obj next-state name) 'enter)) @@ -439,7 +439,7 @@ (defmethod remote-method-25 judge ((obj judge)) (ja-post) (if (type? (-> obj root) collide-shape) - (collide-shape-method-46 (the-as collide-shape (-> obj root))) + (update-transforms (the-as collide-shape (-> obj root))) ) (when (and (-> obj next-state) (let ((v1-6 (-> obj next-state name))) (or (= v1-6 'idle) (= v1-6 'enter)) diff --git a/goal_src/jak2/engine/common_objs/water.gc b/goal_src/jak2/engine/common_objs/water.gc index e84c849028..432072ada8 100644 --- a/goal_src/jak2/engine/common_objs/water.gc +++ b/goal_src/jak2/engine/common_objs/water.gc @@ -778,7 +778,7 @@ (set! (-> obj swim-depth) (fmax 0.0 (- (- (-> obj surface-height) (-> obj swim-height)) (-> obj bottom 0 y)))) (and (>= (-> obj height) (-> obj bottom 0 y)) (logtest? (water-flags touch-water) (-> s5-0 flags))) ) - (if (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (cshape-moving-flags on-water)) + (if (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (collide-status on-water)) (set! (-> obj on-water-time) (-> pp clock frame-counter)) ) (when (not (logtest? (-> obj flags) (water-flags dark-eco lava))) @@ -968,19 +968,18 @@ ) (if (and (logtest? (-> obj flags) (water-flags swim-ground)) (and v1-237 - (zero? (logand (-> (the-as collide-shape-moving (-> obj process control)) status) (cshape-moving-flags on-water)) - ) + (zero? (logand (-> (the-as collide-shape-moving (-> obj process control)) status) (collide-status on-water))) ) ) (set! (-> obj bob amp) (* 0.8 (-> obj bob amp))) ) (cond ((and (logtest? (-> obj flags) (water-flags can-swim)) - (or (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (cshape-moving-flags on-water)) + (or (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (collide-status on-water)) (>= f30-1 (-> obj bottom 0 y)) (and (logtest? (water-flags swimming) s4-0) - (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (cshape-moving-flags t-surface)) - (not (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (cshape-moving-flags on-surface)) + (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (collide-status touch-surface)) + (not (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (collide-status on-surface)) ) (>= (+ 204.8 f30-1) (-> obj bottom 0 y)) ) @@ -1007,23 +1006,23 @@ ) (cond ((and (logtest? (-> obj flags) (water-flags swim-ground)) - (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (cshape-moving-flags t-surface)) + (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (collide-status touch-surface)) (zero? (logand (water-flags jump-out) (-> obj flags))) ) (let ((v1-260 (new 'stack-no-clear 'vector))) (set! (-> v1-260 quad) (-> obj bottom 0 quad)) (set! (-> v1-260 y) (- (-> obj height) (-> obj swim-height))) (let ((s3-3 (the-as collide-shape-moving (-> obj process control)))) - (when (and (not (logtest? (-> s3-3 status) (cshape-moving-flags csmf12))) + (when (and (not (logtest? (-> s3-3 status) (collide-status touch-background))) (logtest? (water-flags swimming) (-> obj flags)) (zero? (logand (focus-status board pilot) (-> obj process focus-status))) ) (let ((a1-42 (vector-! (new 'stack-no-clear 'vector) v1-260 (-> (the-as control-info s3-3) trans)))) (vector-float*! a1-42 a1-42 (-> pp clock frames-per-second)) - (collide-shape-method-37 s3-3 a1-42) + (integrate-and-collide! s3-3 a1-42) ) (set! (-> (the-as control-info s3-3) status) - (logior (-> s3-3 status) (cshape-moving-flags on-surface on-ground t-surface on-water)) + (logior (-> s3-3 status) (collide-status on-surface on-ground touch-surface on-water)) ) ) ) @@ -1063,12 +1062,8 @@ (set! (-> a1-47 y) f30-1) (when (not (logtest? (focus-status board pilot) (-> obj process focus-status))) (let ((f30-2 (-> s4-1 ground-impact-vel))) - (let ((t9-26 (method-of-object s4-1 collide-shape-moving-method-61))) - (-> (the-as control-info s4-1) transv) - *up-vector* - (t9-26) - ) - (set! (-> (the-as control-info s4-1) status) (logior (-> s4-1 status) (cshape-moving-flags on-water))) + (move-to-ground-point s4-1 a1-47 (-> (the-as control-info s4-1) transv) *up-vector*) + (set! (-> (the-as control-info s4-1) status) (logior (-> s4-1 status) (collide-status on-water))) (set! (-> (the-as control-info s4-1) ground-impact-vel) f30-2) ) ) @@ -1080,7 +1075,7 @@ (cond ((logtest? (-> obj flags) (water-flags tar)) (when (and (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) - (cshape-moving-flags on-surface on-water) + (collide-status on-surface on-water) ) (zero? (logand (focus-status board pilot) (-> obj process focus-status))) ) @@ -1114,7 +1109,7 @@ ) ((logtest? (-> obj flags) (water-flags lava)) (when (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) - (cshape-moving-flags on-surface on-water) + (collide-status on-surface on-water) ) (when (< (-> obj process control trans y) (+ -204.8 (-> obj base-height))) (send-event (-> obj process) 'no-look-around (seconds 1.5)) diff --git a/goal_src/jak2/engine/game/game-h.gc b/goal_src/jak2/engine/game/game-h.gc index 71ece9ccbf..6bedf1ea64 100644 --- a/goal_src/jak2/engine/game/game-h.gc +++ b/goal_src/jak2/engine/game/game-h.gc @@ -323,7 +323,7 @@ (damage float :offset-assert 144) (shield-damage float :offset-assert 148) (knock uint8 :offset-assert 152) - (test uint32 :offset-assert 156) + (test symbol :offset-assert 156) ) :method-count-assert 12 :size-assert #xa0 diff --git a/goal_src/jak2/engine/physics/rigid-body.gc b/goal_src/jak2/engine/physics/rigid-body.gc index fc927a965f..b232c7973e 100644 --- a/goal_src/jak2/engine/physics/rigid-body.gc +++ b/goal_src/jak2/engine/physics/rigid-body.gc @@ -567,7 +567,7 @@ (defmethod rigid-body-object-method-31 rigid-body-object ((obj rigid-body-object) (arg0 rigid-body-object-constants)) (set! (-> obj info) arg0) (set! (-> obj rbody) (new 'process 'rigid-body-control obj)) - (collide-shape-method-46 (-> obj root-override-2)) + (update-transforms (-> obj root-override-2)) (rigid-body-method-25 (-> obj rbody state) (the-as rigid-body-info (&-> (-> obj info) mass)) @@ -590,7 +590,9 @@ (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) - (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) (let ((s4-0 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) (set! (-> s4-0 prim-core collide-as) (collide-spec pusher)) (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list)) @@ -600,7 +602,7 @@ (set! (-> s5-0 total-prims) (the-as uint 1)) (set! (-> s5-0 root-prim) s4-0) ) - (collide-shape-method-54 s5-0) + (pusher-init s5-0) (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) (let ((v1-16 (-> s5-0 root-prim))) (set! (-> s5-0 backup-collide-as) (-> v1-16 prim-core collide-as)) diff --git a/goal_src/jak2/engine/physics/trajectory.gc b/goal_src/jak2/engine/physics/trajectory.gc index 7680c486de..335dd91efd 100644 --- a/goal_src/jak2/engine/physics/trajectory.gc +++ b/goal_src/jak2/engine/physics/trajectory.gc @@ -254,7 +254,7 @@ ) ) (sphere<-vector+r! s1-0 arg1 arg2) - (set! (-> s2-1 length) (spatial-hash-method-36 + (set! (-> s2-1 length) (fill-actor-list-for-sphere *actor-hash* s1-0 (the-as (pointer collide-shape) (-> s2-1 data)) diff --git a/goal_src/jak2/engine/process-drawable/process-taskable.gc b/goal_src/jak2/engine/process-drawable/process-taskable.gc index 9af2bc81b9..a00bd31d6e 100644 --- a/goal_src/jak2/engine/process-drawable/process-taskable.gc +++ b/goal_src/jak2/engine/process-drawable/process-taskable.gc @@ -122,40 +122,45 @@ (defstate idle (process-taskable) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as - object - (cond - ((= v1-0 'attack) - (when (-> self bounce-away) - (let ((a1-3 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-3 from) (process->ppointer self)) - (set! (-> a1-3 num-params) 2) - (set! (-> a1-3 message) 'shove) - (set! (-> a1-3 param 0) (the-as uint #f)) - (let ((v1-5 (new 'static 'attack-info :mask (attack-info-mask shove-back shove-up id)))) - (let* ((a2-2 *game-info*) - (a3-2 (+ (-> a2-2 attack-id) 1)) - ) - (set! (-> a2-2 attack-id) a3-2) - (set! (-> v1-5 id) a3-2) - ) - (set! (-> v1-5 shove-back) 12288.0) - (set! (-> v1-5 shove-up) 4096.0) - (set! (-> a1-3 param 1) (the-as uint v1-5)) - ) - (send-event-function proc a1-3) + (case event-type + (('attack) + (when (-> self bounce-away) + (let ((a1-3 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-3 from) (process->ppointer self)) + (set! (-> a1-3 num-params) 2) + (set! (-> a1-3 message) 'shove) + (set! (-> a1-3 param 0) (the-as uint #f)) + (let ((v1-5 (new 'static 'attack-info :mask (attack-info-mask shove-back shove-up id)))) + (let* ((a2-2 *game-info*) + (a3-2 (+ (-> a2-2 attack-id) 1)) + ) + (set! (-> a2-2 attack-id) a3-2) + (set! (-> v1-5 id) a3-2) ) + (set! (-> v1-5 shove-back) 12288.0) + (set! (-> v1-5 shove-up) 4096.0) + (set! (-> a1-3 param 1) (the-as uint v1-5)) ) + (send-event-function proc a1-3) ) - ((= v1-0 'touch) - (collide-shape-method-50 (-> self root-override) proc (-> event param 0) 0.7 6144.0 16384.0) - ) - ((= v1-0 'say) - (set! (-> self want-to-say) (-> self clock frame-counter)) - ) - ) - ) + ) + ) + (('touch) + (send-shoves + (-> self root-override) + proc + (the-as touching-shapes-entry (-> event param 0)) + 0.7 + 6144.0 + 16384.0 + ) + ) + (('say) + (let ((v0-0 (the-as object (-> self clock frame-counter)))) + (set! (-> self want-to-say) (the-as time-frame v0-0)) + v0-0 + ) + ) ) ) :enter (behavior () @@ -498,3 +503,5 @@ (go (method-of-object obj hide)) (none) ) + + diff --git a/goal_src/jak2/engine/process-drawable/simple-nav-sphere.gc b/goal_src/jak2/engine/process-drawable/simple-nav-sphere.gc index 9bb4311b78..cf5661c165 100644 --- a/goal_src/jak2/engine/process-drawable/simple-nav-sphere.gc +++ b/goal_src/jak2/engine/process-drawable/simple-nav-sphere.gc @@ -30,7 +30,7 @@ (go empty-state) ) (('move-trans) - (collide-shape-method-29 (-> self root-override) (the-as vector (-> event param 0))) + (move-to-point! (-> self root-override) (the-as vector (-> event param 0))) #t ) (('set-radius) @@ -39,7 +39,7 @@ ) (set! (-> collide-shape nav-radius) radius) (set! (-> collide-shape root-prim local-sphere w) radius) - (collide-shape-method-46 collide-shape) + (update-transforms collide-shape) ) #t ) @@ -94,7 +94,7 @@ (gp-0 (new 'stack-no-clear 'vector)) ) (vector<-cspace! gp-0 (-> (the-as process-drawable v1-0) node-list data (-> self track-joint))) - (collide-shape-method-29 (-> self root-override) gp-0) + (move-to-point! (-> self root-override) gp-0) ) (none) ) @@ -129,7 +129,7 @@ (set! (-> v1-11 prim-core collide-with) (collide-spec)) ) 0 - (collide-shape-method-46 s5-0) + (update-transforms s5-0) (set! (-> self root-override) s5-0) ) (logclear! (-> self mask) (process-mask actor-pause enemy)) diff --git a/goal_src/jak2/engine/spatial-hash/spatial-hash-h.gc b/goal_src/jak2/engine/spatial-hash/spatial-hash-h.gc index 02af85692f..300f605226 100644 --- a/goal_src/jak2/engine/spatial-hash/spatial-hash-h.gc +++ b/goal_src/jak2/engine/spatial-hash/spatial-hash-h.gc @@ -129,7 +129,7 @@ (:methods (spatial-hash-method-34 (_type_ vector hash-object-info) int 34) (spatial-hash-method-35 (_type_) none 35) - (spatial-hash-method-36 (_type_ sphere (pointer collide-shape) int) int 36) + (fill-actor-list-for-sphere (_type_ sphere (pointer collide-shape) int) int 36) (spatial-hash-method-37 (_type_) none 37) (spatial-hash-method-38 (_type_) none 38) (spatial-hash-method-39 (_type_ object hash-object-info) none 39) diff --git a/goal_src/jak2/engine/target/board/board-h.gc b/goal_src/jak2/engine/target/board/board-h.gc index 1731018515..9bbed63e64 100644 --- a/goal_src/jak2/engine/target/board/board-h.gc +++ b/goal_src/jak2/engine/target/board/board-h.gc @@ -245,8 +245,7 @@ (and (logtest? (-> self game features) (game-feature board)) (or (and (cpad-pressed? (-> self control cpad number) r2) (or (!= *cheat-mode* 'debug) - (zero? (logand (-> *cpad-list* cpads (-> self control cpad number) button0-abs 0) (pad-buttons l2)) - ) + (zero? (logand (-> *cpad-list* cpads (-> self control cpad number) button0-abs 0) (pad-buttons l2))) ) (not *pause-lock*) (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame30)) (seconds 0.1)) @@ -287,7 +286,7 @@ (set! (-> s5-0 2 y) (+ 16384.0 (-> s5-0 2 y))) (set! (-> s5-0 2 r) 2867.2) (let ((v1-55 gp-0)) - (set! (-> v1-55 spheres) s5-0) + (set! (-> v1-55 best-dist) (the-as float s5-0)) (set! (-> v1-55 num-spheres) (the-as uint 3)) (set! (-> v1-55 collide-with) (logclear (-> self control root-prim prim-core collide-with) diff --git a/goal_src/jak2/engine/target/board/board-states.gc b/goal_src/jak2/engine/target/board/board-states.gc index c1bb0323f2..8caa71b2e9 100644 --- a/goal_src/jak2/engine/target/board/board-states.gc +++ b/goal_src/jak2/engine/target/board/board-states.gc @@ -29,7 +29,6 @@ ;; DECOMP BEGINS -;; definition for function vector-vector-angle (defun vector-vector-angle ((arg0 vector) (arg1 vector)) (let ((s4-0 (new 'stack-no-clear 'matrix)) (gp-0 (new 'stack-no-clear 'matrix)) @@ -42,7 +41,6 @@ ) ) -;; definition for function target-board-anim-trans ;; WARN: Return type mismatch float vs none. (defbehavior target-board-anim-trans target () (let ((f26-0 (deg- @@ -110,7 +108,7 @@ (when (and (board-on-ground?) (>= (- (-> self clock frame-counter) (-> self board unknown-time-frame02)) (seconds 0.2)) ) - (if (logtest? (-> self control status) (cshape-moving-flags csmf11)) + (if (logtest? (-> self control status) (collide-status impact-surface)) (+! (-> self board turn-anim-duck-vel) (lerp-scale 0.0 15.0 (-> self control unknown-float21) 0.0 81920.0)) ) (let ((f0-38 (vector-dot (the-as vector (-> self board up-vector)) (-> self board up-vector 1)))) @@ -124,8 +122,6 @@ (none) ) -;; definition for function target-board-spin-check -;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defbehavior target-board-spin-check target () (when (and (or (cpad-pressed? (-> self control cpad number) r1) @@ -289,8 +285,6 @@ (none) ) -;; definition for function target-board-halfpipe-trans -;; WARN: Return type mismatch int vs none. (defbehavior target-board-halfpipe-trans target () (when (and (logtest? (focus-status halfpipe) (-> self focus-status)) *camera*) (let ((gp-0 (new 'stack-no-clear 'vector))) @@ -321,8 +315,6 @@ (none) ) -;; definition for function target-board-resolve-points -;; WARN: Return type mismatch int vs none. (defbehavior target-board-resolve-points target () (when (= (-> self board main mode) (joint-mod-mode rotate)) (let ((f0-1 (fabs (-> self board troty-cum)))) @@ -348,8 +340,6 @@ (none) ) -;; definition for function target-board-ground-check -;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs none. (defbehavior target-board-ground-check target () (when (board-on-ground?) @@ -385,7 +375,7 @@ (if (< (vector-length (-> self control transv)) 114688.0) (vector-normalize! (-> self control transv) 114688.0) ) - (when (not (logtest? (-> self control old-status) (cshape-moving-flags on-surface))) + (when (not (logtest? (-> self control old-status) (collide-status on-surface))) (let ((gp-0 (new 'stack-no-clear 'vector))) (set! (-> gp-0 quad) (-> self control trans quad)) (set! (-> gp-0 y) (+ 2048.0 (-> gp-0 y))) @@ -461,8 +451,6 @@ (none) ) -;; definition for function target-board-halfpipe-check -;; INFO: Used lq/sq (defbehavior target-board-halfpipe-check target () (local-vars (v0-3 collide-action)) (let ((gp-0 (vector-flatten! @@ -502,7 +490,6 @@ ) ) -;; definition for function target-board-jump-trans (defbehavior target-board-jump-trans target () (when (and (!= (-> self state-time) (-> self clock frame-counter)) (jump-hit-ground-stuck?)) (set! (-> self board jump-land-time) (-> self clock frame-counter)) @@ -525,7 +512,6 @@ (none) ) -;; failed to figure out what this is: (defstate target-board-start (target) :event target-board-handler :exit target-board-exit @@ -538,7 +524,6 @@ :post target-post ) -;; failed to figure out what this is: (defstate target-board-stance (target) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type @@ -791,7 +776,6 @@ :post target-board-post ) -;; failed to figure out what this is: (defstate target-board-duck-stance (target) :event (-> target-board-stance event) :enter (behavior () @@ -900,7 +884,6 @@ :post target-board-post ) -;; failed to figure out what this is: (defstate target-board-jump (target) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (if (and (= event-type 'edge-grab) (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1))) @@ -1027,7 +1010,7 @@ ) ) ) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! arg2 (cond ((the-as object arg2) (empty) @@ -1118,7 +1101,6 @@ :post target-board-post ) -;; failed to figure out what this is: (defstate target-board-halfpipe (target) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type @@ -1383,7 +1365,6 @@ :post target-board-post ) -;; failed to figure out what this is: (defstate target-board-falling (target) :event target-board-handler :enter (behavior () @@ -1465,7 +1446,6 @@ :post target-board-post ) -;; failed to figure out what this is: (defstate target-board-jump-kick (target) :event target-board-handler :enter (behavior () @@ -1517,7 +1497,6 @@ :post target-board-post ) -;; failed to figure out what this is: (defstate target-board-wall-kick (target) :event target-board-handler :enter (behavior ((arg0 vector) (arg1 float)) @@ -1567,7 +1546,6 @@ :post target-board-post ) -;; failed to figure out what this is: (defstate target-board-flip (target) :event (-> target-board-jump event) :enter (behavior ((arg0 float) (arg1 float) (arg2 symbol)) @@ -1586,7 +1564,7 @@ ) (else (init-var-jump arg0 arg1 #t #f (-> self control transv) 1.0) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control unknown-float36) (fmax 0.0 (fmin 1.0 (* 0.00004359654 (+ -11468.8 (-> self control unknown-float05))))) ) @@ -1749,7 +1727,6 @@ :post target-board-post ) -;; failed to figure out what this is: (defstate target-board-hold (target) :event (-> target-board-jump event) :enter (behavior ((arg0 float) (arg1 float) (arg2 symbol)) @@ -1769,7 +1746,7 @@ ) (else (init-var-jump arg0 arg1 #t #f (-> self control transv) 1.0) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control unknown-float36) (fmax 0.0 (fmin 1.0 (* 0.00004359654 (+ -11468.8 (-> self control unknown-float05))))) ) @@ -1953,7 +1930,6 @@ :post target-board-post ) -;; failed to figure out what this is: (defstate target-board-trickx (target) :event (-> target-board-jump event) :enter (-> target-board-hold enter) @@ -2062,7 +2038,6 @@ :post target-board-post ) -;; failed to figure out what this is: (defstate target-board-hit-ground (target) :event target-board-handler :enter (behavior () @@ -2145,7 +2120,6 @@ :post target-board-post ) -;; failed to figure out what this is: (defstate target-board-turn-to (target) :event target-board-handler :enter (behavior ((arg0 vector) (arg1 time-frame)) @@ -2214,7 +2188,6 @@ :post target-board-post ) -;; failed to figure out what this is: (defstate target-board-ride-edge (target) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type @@ -2297,7 +2270,7 @@ (none) ) :exit (behavior () - (logclear! (-> self control status) (cshape-moving-flags csmf16)) + (logclear! (-> self control status) (collide-status probe-hit)) (let ((v1-2 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) (set! (-> v1-2 command) (sound-command set-param)) (set! (-> v1-2 id) (the-as sound-id (-> self board ride-sound-id))) @@ -2315,7 +2288,7 @@ (let ((gp-0 (new 'stack-no-clear 'vector))) (set! (-> gp-0 quad) (-> self control trans quad)) (let ((s5-0 (new 'stack-no-clear 'collide-query))) - (if (collide-shape-moving-method-55 + (if (find-ground (-> self control) s5-0 (logclear (-> self control root-prim prim-core collide-with) (collide-spec water)) @@ -2329,7 +2302,7 @@ (if (< (-> self control trans y) (-> self control gspot-pos y)) (set! (-> gp-0 quad) (-> self control gspot-pos quad)) ) - (collide-shape-method-29 + (move-to-point! (-> self control) (vector+! (new 'stack-no-clear 'vector) gp-0 (new 'static 'vector :y 204.8 :w 1.0)) ) @@ -2488,7 +2461,6 @@ ) ) -;; failed to figure out what this is: (defstate target-board-grenade (target) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type @@ -2599,7 +2571,6 @@ :post target-board-post ) -;; failed to figure out what this is: (defstate target-board-get-on (target) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type @@ -2620,7 +2591,7 @@ :enter (behavior () (set! (-> self board shock-offsetv) 0.0) (set! (-> self state-time) (-> self clock frame-counter)) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control unknown-surface00) *board-jump-mods*) (set! (-> self board mods-backup) (-> self control unknown-surface00)) (let ((a0-5 (target-time-to-ground))) @@ -2736,7 +2707,7 @@ :frame-num 0.0 ) (until (ja-done? 0) - (when (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (when (logtest? (-> self control status) (collide-status on-surface)) (set! (-> self board turn-anim-duck-vel) 0.0) (goto cfg-19) ) @@ -2750,14 +2721,13 @@ ) (label cfg-19) (send-event (ppointer->process (-> self sidekick)) 'matrix 'board) - (logior! (-> self control status) (cshape-moving-flags on-surface)) + (logior! (-> self control status) (collide-status on-surface)) (go target-board-hit-ground) (none) ) :post target-board-post ) -;; failed to figure out what this is: (defstate target-board-pegasus (target) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type @@ -2773,7 +2743,7 @@ (logclear! (-> self focus-status) (focus-status halfpipe)) (set! (-> self board shock-offsetv) 0.0) (set! (-> self state-time) (-> self clock frame-counter)) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (none) ) :exit target-board-exit @@ -2848,14 +2818,13 @@ :post (behavior () (set! (-> self control unknown-float30) 0.0) (set! (-> self control unknown-float29) 0.0) - (vector-seek! (-> self control unknown-vector04) *null-vector* (* 16384.0 (-> self clock seconds-per-frame))) + (vector-seek! (-> self control draw-offset) *null-vector* (* 16384.0 (-> self clock seconds-per-frame))) (target-no-move-post) (target-board-effect) (none) ) ) -;; failed to figure out what this is: (defstate target-board-get-off (target) :event (-> target-board-get-on event) :enter (behavior ((arg0 object) (arg1 symbol)) @@ -2867,7 +2836,7 @@ (logclear! (-> self focus-status) (focus-status halfpipe)) (set! (-> self board shock-offsetv) 0.0) (set! (-> self state-time) (-> self clock frame-counter)) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control unknown-surface00) (new 'static 'surface :name 'jump :turnv 131072.0 @@ -3026,9 +2995,9 @@ (not (or (logtest? v1-114 (the-as water-flags a0-35)) (begin (let ((v1-117 #t)) - (set! a0-35 (the-as int (logand (-> self control status) (cshape-moving-flags on-water)))) + (set! a0-35 (the-as int (logand (-> self control status) (collide-status on-water)))) (set! a0-35 a0-35) - (cmove-#f-zero v1-116 (the-as cshape-moving-flags a0-35) v1-117) + (cmove-#f-zero v1-116 (the-as collide-status a0-35) v1-117) ) v1-116 ) @@ -3047,14 +3016,13 @@ :post (behavior () (set! (-> self control unknown-float30) 0.0) (set! (-> self control unknown-float29) 0.0) - (vector-seek! (-> self control unknown-vector04) *null-vector* (* 16384.0 (-> self clock seconds-per-frame))) + (vector-seek! (-> self control draw-offset) *null-vector* (* 16384.0 (-> self clock seconds-per-frame))) (target-post) (target-board-effect) (none) ) ) -;; failed to figure out what this is: (defstate target-board-grab (target) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (cond @@ -3117,7 +3085,6 @@ :post target-board-post ) -;; failed to figure out what this is: (defstate target-board-clone-anim (target) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (if (and (= event-type 'trans) (= (-> event param 0) 'restore)) @@ -3127,8 +3094,8 @@ ) :enter (-> target-clone-anim enter) :exit (behavior () - (set! (-> self control unknown-vector04 y) (the-as float (-> self control unknown-word04))) - (set! (-> self control unknown-vector05 y) (-> self control unknown-vector04 y)) + (set! (-> self control draw-offset y) (the-as float (-> self control unknown-word04))) + (set! (-> self control cspace-offset y) (-> self control draw-offset y)) (send-event (ppointer->process (-> self sidekick)) 'matrix 'board) ((-> target-clone-anim exit)) ((-> target-board-start exit)) @@ -3136,8 +3103,8 @@ (none) ) :code (behavior ((arg0 handle)) - (set! (-> self control unknown-word04) (the-as uint (-> self control unknown-vector04 y))) - (set! (-> self control unknown-vector04 y) 0.0) + (set! (-> self control unknown-word04) (the-as uint (-> self control draw-offset y))) + (set! (-> self control draw-offset y) 0.0) (send-event (ppointer->process (-> self sidekick)) 'matrix 'play-anim) (clone-anim arg0 #t "") (go target-board-stance) @@ -3146,7 +3113,6 @@ :post target-no-ja-move-post ) -;; failed to figure out what this is: (defstate target-board-hit (target) :event target-board-handler :exit (behavior () @@ -3236,14 +3202,14 @@ (cond ((= (-> self game mode) 'debug) (let ((s4-1 (new-stack-vector0))) - (set! (-> s4-1 quad) (-> self control unknown-vector23 quad)) + (set! (-> s4-1 quad) (-> self control last-trans-on-surf quad)) (ja-channel-set! 0) (let ((s3-1 (-> self clock frame-counter))) (until (>= (- (-> self clock frame-counter) s3-1) (seconds 1)) (suspend) ) ) - (collide-shape-method-29 (-> self control) s4-1) + (move-to-point! (-> self control) s4-1) ) (set! (-> self control unknown-vector15 quad) (-> self control trans quad)) (send-event *camera* 'teleport) @@ -3345,7 +3311,3 @@ (none) ) ) - - - - diff --git a/goal_src/jak2/engine/target/board/target-board.gc b/goal_src/jak2/engine/target/board/target-board.gc index b530924f81..43b555a63d 100644 --- a/goal_src/jak2/engine/target/board/target-board.gc +++ b/goal_src/jak2/engine/target/board/target-board.gc @@ -54,7 +54,6 @@ ;; decomp begins -;; definition for symbol *board-walk-mods*, type surface (define *board-walk-mods* (new 'static 'surface :name 'run @@ -146,7 +145,6 @@ ) ) -;; definition for symbol *board-duck-mods*, type surface (define *board-duck-mods* (new 'static 'surface :name 'duck :turnv 21845.334 @@ -180,10 +178,8 @@ ) ) -;; failed to figure out what this is: (set! (-> *board-duck-mods* mult-hook) (-> *board-walk-mods* mult-hook)) -;; definition for symbol *board-air-mods*, type surface (define *board-air-mods* (new 'static 'surface :name 'air :turnv 49152.0 @@ -218,7 +214,6 @@ ) ) -;; definition for symbol *board-jump-mods*, type surface (define *board-jump-mods* (new 'static 'surface :name 'jump :turnv 49152.0 @@ -247,7 +242,6 @@ ) ) -;; definition for symbol *board-ride-jump-mods*, type surface (define *board-ride-jump-mods* (new 'static 'surface :name 'jump @@ -291,13 +285,10 @@ ) ) -;; definition for symbol *board-duck-jump-mods*, type surface (define *board-duck-jump-mods* *board-jump-mods*) -;; definition for symbol *board-spin-mods*, type surface (define *board-spin-mods* (copy *board-jump-mods* 'global)) -;; failed to figure out what this is: (let ((v1-10 *board-spin-mods*)) (set! (-> v1-10 name) 'spin) (set! (-> v1-10 flags) (surface-flag no-turn-around check-edge air)) @@ -311,7 +302,6 @@ (set! (-> v1-10 tiltvf) 0.0) ) -;; failed to figure out what this is: (let ((v1-12 (copy *board-jump-mods* 'global))) (set! (-> v1-12 seek0) 0.0) (set! (-> v1-12 seek90) 0.0) @@ -320,7 +310,6 @@ (set! *board-spin-post-mods* v1-12) ) -;; failed to figure out what this is: (let ((v1-14 (copy *board-duck-jump-mods* 'global))) (set! (-> v1-14 flags) (surface-flag no-turn-around turn-to-vel air)) (set! (-> v1-14 seek0) 0.0) @@ -334,7 +323,6 @@ (set! *board-flip-mods* v1-14) ) -;; definition for symbol *board-wall-kick-mods*, type surface (define *board-wall-kick-mods* (new 'static 'surface :name 'jump @@ -373,7 +361,6 @@ ) ) -;; definition for symbol *board-halfpipe-mods*, type surface (define *board-halfpipe-mods* (new 'static 'surface :name 'jump :turnv 131072.0 @@ -401,7 +388,6 @@ ) ) -;; definition for symbol *board-turn-to-mods*, type surface (define *board-turn-to-mods* (new 'static 'surface :name 'run :turnv 524288.0 @@ -433,10 +419,8 @@ ) ) -;; failed to figure out what this is: (set! (-> *board-turn-to-mods* mult-hook) (-> *board-walk-mods* mult-hook)) -;; definition for symbol *board-ride-mods*, type surface (define *board-ride-mods* (new 'static 'surface :name 'run :turnv 218453.33 @@ -478,7 +462,6 @@ ) ) -;; definition for symbol *collide-edge-board-halfpipe-spec*, type collide-edge-spec (define *collide-edge-board-halfpipe-spec* (new 'static 'collide-edge-spec :split-dists (new 'static 'array float 2 1024.0 1433.6) :outward-offset (new 'static 'vector :x 708.608 :y 13312.0 :w 1.0) @@ -512,11 +495,8 @@ ) ) -;; definition for function target-board-handler ;; ERROR: function was not converted to expressions. Cannot decompile. -;; definition for function target-board-setup -;; WARN: Return type mismatch int vs none. (defbehavior target-board-setup target ((arg0 symbol)) (when (zero? (-> self board)) (set! (-> self board) (new 'process 'board-info)) @@ -552,7 +532,6 @@ (none) ) -;; definition for function target-board-init (defbehavior target-board-init target () (target-gun-end-mode #f) (target-exit) @@ -616,7 +595,7 @@ (let ((v1-82 (-> self node-list data))) (set! (-> v1-82 0 param0) cspace<-transformq+world-trans!) (set! (-> v1-82 0 param1) (the-as basic (-> self control trans))) - (set! (-> v1-82 0 param2) (the-as basic (-> self control unknown-vector05))) + (set! (-> v1-82 0 param2) (the-as basic (-> self control cspace-offset))) ) (target-collide-set! 'board 0.0) (set! (-> self state-flags) (logior (state-flags lleg-no-ik rleg-no-ik) (-> self state-flags))) @@ -645,8 +624,6 @@ (none) ) -;; definition for function target-board-exit -;; INFO: Used lq/sq (defbehavior target-board-exit target () (when (not (and (-> self next-state) (let ((v1-3 (-> self next-state name))) @@ -695,7 +672,7 @@ (let ((v1-43 (-> self node-list data))) (set! (-> v1-43 0 param0) cspace<-transformq+trans!) (set! (-> v1-43 0 param1) (the-as basic (-> self control trans))) - (set! (-> v1-43 0 param2) (the-as basic (-> self control unknown-vector05))) + (set! (-> v1-43 0 param2) (the-as basic (-> self control cspace-offset))) ) (target-collide-set! 'normal 0.0) (set! (-> self control reaction) target-collision-reaction) @@ -707,7 +684,7 @@ (sound-stop (the-as sound-id (-> self board spin-sound-id))) (set! (-> self board spin-sound-id) (the-as uint 0)) (send-event (ppointer->process (-> self sidekick)) 'matrix 'normal) - (set! (-> self control unknown-vector05 quad) (the-as uint128 0)) + (set! (-> self control cspace-offset quad) (the-as uint128 0)) (remove-setting! 'sound-flava) (remove-setting! 'mode-sound-bank) (target-exit) @@ -715,8 +692,6 @@ (none) ) -;; definition for function target-board-falling-anim-trans -;; WARN: Return type mismatch int vs none. (defbehavior target-board-falling-anim-trans target () (let ((v1-2 (ja-group))) (cond @@ -735,20 +710,17 @@ (none) ) -;; definition for function board-on-ground? (defbehavior board-on-ground? target () - (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (logtest? (-> self control status) (collide-status on-surface)) ) -;; definition for function target-board-smack-surface? -;; INFO: Used lq/sq (defbehavior target-board-smack-surface? target () - (when (and (logtest? (-> self control status) (cshape-moving-flags t-wall)) + (when (and (logtest? (-> self control status) (collide-status touch-wall)) (< (+ (-> self clock frame-counter) (seconds -0.05)) (-> self control unknown-time-frame07)) (< 0.7 (-> self control touch-angle)) (< 73728.0 (-> self control unknown-float05)) (and (< (vector-dot (-> self control unknown-vector25) (-> self control dynam gravity-normal)) 0.3) - (zero? (logand (-> self control status) (cshape-moving-flags t-act))) + (zero? (logand (-> self control status) (collide-status touch-actor))) ) ) (set! (-> self board smack-surface-time) (-> self clock frame-counter)) @@ -758,9 +730,6 @@ ) ) -;; definition for function board-add-thrust -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. (defbehavior board-add-thrust target () (let ((gp-0 (-> self control unknown-vector00))) (let* ((v1-1 gp-0) @@ -838,7 +807,7 @@ ) (cond ((and (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame07)) (seconds 0.1)) - (< 0.3 (-> self control unknown-float27)) + (< 0.3 (-> self control blocked-factor)) ) (set! f0-28 f1-23) ) @@ -876,7 +845,7 @@ "ltransv" (the-as rgba (-> (new 'static 'array uint64 1 #x8000ff00) 0)) ) - (set! (-> s5-0 quad) (-> self control unknwon-vector27 quad)) + (set! (-> s5-0 quad) (-> self control btransv quad)) (vector-float*! s5-0 s5-0 0.5) (vector+! s5-0 s5-0 (-> self control trans)) (add-debug-text-sphere @@ -893,7 +862,6 @@ (none) ) -;; definition for function segment-array-vector->index (defun segment-array-vector->index ((arg0 (inline-array vector)) (arg1 int) (arg2 float) (arg3 float)) (let ((gp-0 -1) (f30-0 0.0) @@ -911,7 +879,6 @@ ) ) -;; definition for function segment-array-index->vector (defun segment-array-index->vector ((arg0 (inline-array vector)) (arg1 int) (arg2 float) (arg3 vector)) (let ((v0-0 (the int arg2))) (let* ((f0-2 arg2) @@ -931,8 +898,6 @@ ) ) -;; definition for function target-board-exit-check -;; WARN: Return type mismatch int vs none. (defbehavior target-board-exit-check target () (if (and (or (and (cpad-pressed? (-> self control cpad number) r2) (or (!= *cheat-mode* 'debug) @@ -956,8 +921,6 @@ (none) ) -;; definition for function target-board-effect -;; WARN: Return type mismatch int vs none. (defbehavior target-board-effect target () (let ((gp-0 0)) (cond @@ -971,11 +934,11 @@ (set! gp-0 4) ) ((and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) - (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (zero? (logand (-> self control status) (collide-status on-surface))) ) (set! gp-0 1) ) - ((not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + ((not (logtest? (-> self control status) (collide-status on-surface))) (set! gp-0 2) ) ) @@ -1120,9 +1083,6 @@ (none) ) -;; definition for function target-board-physics -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. (defbehavior target-board-physics target ((arg0 vector)) (let ((f30-0 0.5)) (if (>= (- (-> self clock frame-counter) (-> self board unknown-time-frame02)) (seconds 0.3)) @@ -1223,19 +1183,16 @@ ) ) ) - (set! (-> self control unknown-vector04 y) + (set! (-> self control draw-offset y) (+ (-> self board cushion-base) (-> self board cushion-offset) (-> self board shock-offset)) ) - (if (< (-> self control unknown-vector04 y) 0.0) - (set! (-> self control unknown-vector04 y) 0.0) + (if (< (-> self control draw-offset y) 0.0) + (set! (-> self control draw-offset y) 0.0) ) 0 (none) ) -;; definition for function target-board-collision -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. (defbehavior target-board-collision target () (let ((gp-0 (new 'stack-no-clear 'vector))) (set! (-> gp-0 quad) (-> self control transv quad)) @@ -1292,7 +1249,7 @@ (set! (-> a2-6 ignore-process1) #f) (set! (-> a2-6 ignore-pat) (-> v1-30 pat-ignore-mask)) (set! (-> a2-6 action-mask) (collide-action solid)) - (collide-shape-method-32 v1-30 (-> v1-30 transv) a2-6 (meters 1)) + (fill-cache-integrate-and-collide v1-30 (-> v1-30 transv) a2-6 (meters 1)) ) (when (logtest? (-> self control root-prim prim-core action) (collide-action check-edge)) (logclear! (-> *collide-edge-board-spec* flags) (collide-edge-spec-flags one)) @@ -1320,7 +1277,7 @@ (let* ((v1-60 gp-0) (f30-0 (sqrtf (+ (* (-> v1-60 x) (-> v1-60 x)) (* (-> v1-60 z) (-> v1-60 z))))) ) - (when (and (logtest? (-> self control status) (cshape-moving-flags t-wall)) + (when (and (logtest? (-> self control status) (collide-status touch-wall)) (and (< 16384.0 f30-0) (not (and (-> self next-state) (= (-> self next-state name) 'target-board-smack))) (not (logtest? (focus-status halfpipe) (-> self focus-status))) @@ -1347,7 +1304,7 @@ ) (s3-3 (vector-matrix*! (new 'stack-no-clear 'vector) s3-2 (-> self control unknown-matrix00))) ) - (logior! (-> self control status) (cshape-moving-flags csmf15)) + (logior! (-> self control status) (collide-status glance)) (set! (-> self board glance-time) (-> self clock frame-counter)) (let ((v1-99 s2-2)) (set! (-> self board glance-speed) (sqrtf (+ (* (-> v1-99 x) (-> v1-99 x)) (* (-> v1-99 z) (-> v1-99 z))))) @@ -1367,7 +1324,7 @@ (when (and (< (vector-dot s4-3 s5-3) -0.77) (zero? (logand (-> self focus-status) (focus-status dead hit)))) (cond ((not (and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) - (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (zero? (logand (-> self control status) (collide-status on-surface))) ) ) (if (< 32768.0 f30-0) @@ -1430,9 +1387,6 @@ (none) ) -;; definition for function target-board-joint-points -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. (defbehavior target-board-joint-points target () (when (-> self board board) (let ((a1-0 (-> self node-list data 25 bone transform))) @@ -1447,13 +1401,10 @@ (none) ) -;; definition for function target-board-pre-move -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. (defbehavior target-board-pre-move target () (cond ((and (and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) - (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (zero? (logand (-> self control status) (collide-status on-surface))) ) (begin (set! (-> self board in-air-time) (-> self clock frame-counter)) @@ -1633,7 +1584,7 @@ (set! (-> self board unknown-time-frame00) (-> self clock frame-counter)) ) ) - (when (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (when (and (not (logtest? (-> self control status) (collide-status on-surface))) (< 0.0 f28-0) (or (and (or (< (target-height-above-ground) 4096.0) (< (- (-> self clock frame-counter) (-> self board unknown-time-frame00)) (seconds 0.1)) @@ -1676,9 +1627,6 @@ (none) ) -;; definition for function target-board-real-post -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. (defbehavior target-board-real-post target () (let ((f30-0 (-> self clock clock-ratio))) (let ((gp-1 (max 1 (the int (-> self clock time-adjust-ratio))))) @@ -1847,7 +1795,7 @@ (seek! (-> self board cushion-offset) 0.0 (* 20480.0 (-> self clock seconds-per-frame))) ) ((and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) - (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (zero? (logand (-> self control status) (collide-status on-surface))) ) (seek! (-> self board cushion-offset) @@ -1935,8 +1883,6 @@ (none) ) -;; definition for function probe-test -;; INFO: Used lq/sq (defun probe-test ((arg0 control-info) (arg1 vector) (arg2 pat-surface)) (dotimes (s3-0 3) (let ((s2-0 (new 'stack-no-clear 'collide-query))) @@ -1964,9 +1910,7 @@ #f ) -;; definition for function target-board-compute-edge ;; WARN: Found some very strange gotos. Check result carefully, this is not well tested. -;; INFO: Used lq/sq (defbehavior target-board-compute-edge target () (local-vars (sv-768 int)) (let ((s4-0 *edge-grab-info*) @@ -2109,7 +2053,7 @@ ) ) (if (probe-test (-> self control) s3-5 (new 'static 'pat-surface :noentity #x1 :noboard #x1 :probe #x1)) - (set! (-> self control status) (logior (cshape-moving-flags csmf16) (-> self control status))) + (set! (-> self control status) (logior (collide-status probe-hit) (-> self control status))) (move-by-vector! (-> self control) s3-5) ) ) @@ -2250,10 +2194,10 @@ ) (set! s4-3 (logior s4-3 32)) ) - (if (logtest? (cshape-moving-flags csmf16) (-> self control status)) + (if (logtest? (collide-status probe-hit) (-> self control status)) (set! s4-3 (logior s4-3 64)) ) - (logclear! (-> self control status) (cshape-moving-flags csmf16)) + (logclear! (-> self control status) (collide-status probe-hit)) (when (and (< (- (-> self clock frame-counter) (-> self board ride-time)) (seconds 0.2)) (nonzero? s4-3)) (if (logtest? s4-3 1) (format #t "exit speed ~M~%" f30-2) @@ -2313,7 +2257,7 @@ ) ) ((logtest? s4-3 42) - (collide-shape-method-29 (-> self control) gp-0) + (move-to-point! (-> self control) gp-0) (set! (-> self control transv quad) (-> s5-0 quad)) ) ) @@ -2341,8 +2285,6 @@ ) ) -;; definition for function board-ride-add-thrust -;; WARN: Return type mismatch int vs none. (defbehavior board-ride-add-thrust target ((arg0 vector) (arg1 float)) (let* ((f30-0 (-> self board ride-speed)) (f0-4 @@ -2390,9 +2332,6 @@ (none) ) -;; definition for function target-board-ride-post -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. (defbehavior target-board-ride-post target () (let ((f30-0 (-> self clock clock-ratio))) (let ((gp-1 (max 1 (the int (-> self clock time-adjust-ratio))))) @@ -2488,7 +2427,7 @@ (set! (-> a2-4 ignore-process1) #f) (set! (-> a2-4 ignore-pat) (-> v1-103 pat-ignore-mask)) (set! (-> a2-4 action-mask) (collide-action solid)) - (collide-shape-method-32 v1-103 (-> v1-103 transv) a2-4 (meters 1)) + (fill-cache-integrate-and-collide v1-103 (-> v1-103 transv) a2-4 (meters 1)) ) (when (logtest? (-> self control root-prim prim-core action) (collide-action check-edge)) (logclear! (-> *collide-edge-board-spec* flags) (collide-edge-spec-flags two)) @@ -2549,10 +2488,10 @@ (vector-! (new 'stack-no-clear 'vector) s3-2 (-> self control trans)) (new 'static 'pat-surface :noentity #x1 :noboard #x1 :probe #x1) ) - (set! (-> self control status) (logior (cshape-moving-flags csmf16) (-> self control status))) + (set! (-> self control status) (logior (collide-status probe-hit) (-> self control status))) ) - (if (and (-> self board ride-lock-on) (zero? (logand (cshape-moving-flags csmf16) (-> self control status)))) - (collide-shape-method-29 (-> self control) s3-2) + (if (and (-> self board ride-lock-on) (zero? (logand (collide-status probe-hit) (-> self control status)))) + (move-to-point! (-> self control) s3-2) ) ) (set! (-> self control transv quad) (-> s5-3 quad)) @@ -2624,22 +2563,17 @@ (none) ) -;; definition for function target-board-post (defbehavior target-board-post target () (target-board-real-post) (none) ) -;; definition for function target-board-center-anim -;; WARN: Return type mismatch int vs none. (defbehavior target-board-center-anim target () (set! (-> self board turn-anim-frame) 0.0) 0 (none) ) -;; definition for function target-board-turn-anim -;; WARN: Return type mismatch int vs none. (defbehavior target-board-turn-anim target ((arg0 int)) (let ((f30-0 (-> self clock clock-ratio))) (let ((s5-1 (max 1 (the int (-> self clock time-adjust-ratio))))) @@ -2717,7 +2651,7 @@ ) ) (let ((f0-59 (fmin - (if (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (if (logtest? (-> self control status) (collide-status on-surface)) (seek (-> self board turn-anim-duck) 0.0 (-> self clock seconds-per-frame)) (-> self board turn-anim-duck) ) @@ -2751,8 +2685,6 @@ (none) ) -;; definition for method 9 of type board-info -;; WARN: Return type mismatch int vs none. (defmethod add-to-trick-list board-info ((obj board-info) (arg0 board-tricks) (arg1 float)) "Add specified trick and point amount to trick list." (send-event (handle->process (-> obj process 0 notify)) 'notify 'trick-point arg0) @@ -2873,8 +2805,6 @@ (none) ) -;; definition for method 10 of type board-info -;; WARN: Return type mismatch int vs none. (defmethod flush-trick-list board-info ((obj board-info)) "Flush trick list and give out points." (with-pp @@ -2917,7 +2847,3 @@ (none) ) ) - - - - diff --git a/goal_src/jak2/engine/target/logic-target.gc b/goal_src/jak2/engine/target/logic-target.gc index 5fd8ed326b..42abba948a 100644 --- a/goal_src/jak2/engine/target/logic-target.gc +++ b/goal_src/jak2/engine/target/logic-target.gc @@ -15,7 +15,7 @@ (define-extern target-gun-joint-points (function none :behavior target)) (define-extern target-board-joint-points (function none :behavior target)) (define-extern debounce-speed (function float float vector vector float :behavior target)) -(define-extern target-collision-reaction (function control-info collide-query vector vector cshape-moving-flags)) +(define-extern target-collision-reaction (function control-info collide-query vector vector collide-status)) (define-extern ja-post (function none :behavior process-drawable)) (define-extern target-powerup-process (function none :behavior target)) (define-extern target-exit (function none :behavior target)) @@ -30,7 +30,6 @@ ;; DECOMP BEGINS - (defbehavior build-conversions target ((arg0 vector)) (when (!= (-> self control unknown-surface02) (-> self control surf)) (set! (-> self control unknown-surface02) (-> self control surf)) @@ -95,6 +94,7 @@ (build-conversions (-> self control transv)) ) +;; WARN: Return type mismatch collide-status vs none. (defbehavior reverse-conversions target ((arg0 vector)) (let ((v1-1 (-> self control unknown-vector00))) (set! (-> self control unknown-float05) (sqrtf (+ (* (-> v1-1 x) (-> v1-1 x)) (* (-> v1-1 z) (-> v1-1 z))))) @@ -142,10 +142,8 @@ (none) ) -;; definition (debug) for function target-history-print ;; ERROR: function was not converted to expressions. Cannot decompile. -;; definition (debug) for function target-print-stats (defun-debug target-print-stats ((arg0 target) (arg1 symbol)) (local-vars (sv-64 int) @@ -351,31 +349,31 @@ (format arg1 "~0k~9S ~9S ~9S ~9S ~9S ~9S~%" - (if (logtest? (-> arg0 control status) (cshape-moving-flags on-surface)) + (if (logtest? (-> arg0 control status) (collide-status on-surface)) "on-surface" "" ) - (if (logtest? (-> arg0 control status) (cshape-moving-flags on-ground)) + (if (logtest? (-> arg0 control status) (collide-status on-ground)) "on-ground" "" ) - (if (logtest? (-> arg0 control status) (cshape-moving-flags t-surface)) + (if (logtest? (-> arg0 control status) (collide-status touch-surface)) "t-surface" "" ) - (if (logtest? (-> arg0 control status) (cshape-moving-flags t-wall)) + (if (logtest? (-> arg0 control status) (collide-status touch-wall)) "t-wall" "" ) - (if (logtest? (-> arg0 control status) (cshape-moving-flags t-act)) + (if (logtest? (-> arg0 control status) (collide-status touch-actor)) "t-act" "" ) (cond - ((logtest? (-> arg0 control status) (cshape-moving-flags t-ceil)) + ((logtest? (-> arg0 control status) (collide-status touch-ceiling)) "t-ceil" ) - ((logtest? (-> arg0 control status) (cshape-moving-flags on-water)) + ((logtest? (-> arg0 control status) (collide-status on-water)) "on-water" ) (else @@ -584,6 +582,7 @@ arg0 ) +;; WARN: Return type mismatch vector vs none. (defun vector<-pad-in-matrix! ((arg0 vector) (arg1 cpad-info) (arg2 matrix)) (let ((gp-0 (new 'stack-no-clear 'vector)) (t9-0 matrix-local->world) @@ -654,7 +653,7 @@ (< 0.7 (-> self control unknown-float12)) (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame07)) (seconds 0.3)) (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame08)) (seconds 0.3)) - (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (logtest? (-> self control status) (collide-status on-surface)) (and (< 0.7 (-> self control surface-angle)) #t) ) ) @@ -664,10 +663,10 @@ (defbehavior wall-hide? target () (when (and (< 0.7 (-> self control unknown-float12)) - (< 0.7 (-> self control unknown-float27)) + (< 0.7 (-> self control blocked-factor)) (and (< (-> self control unknown-float05) 8192.0) - (logtest? (-> self control status) (cshape-moving-flags t-wall)) - (not (logtest? (-> self control status) (cshape-moving-flags t-act))) + (logtest? (-> self control status) (collide-status touch-wall)) + (not (logtest? (-> self control status) (collide-status touch-actor))) (or (= (-> self control unknown-pat-surface00 event) (pat-event hide)) (let ((a0-2 (level-get-target-inside *level*))) (and a0-2 (logtest? (-> a0-2 info level-flags) 1)) @@ -802,11 +801,11 @@ (set! (-> self control unknown-float08) f0-6) ) (let ((f0-8 (* arg1 (-> self control unknown-surface01 target-speed)))) - (set! (-> self control unknown-vector01 quad) (-> (vector-normalize! gp-0 f0-8) quad)) + (set! (-> self control target-transv quad) (-> (vector-normalize! gp-0 f0-8) quad)) ) ) (let ((gp-1 (new-stack-vector0))) - (vector-matrix*! gp-1 (-> self control unknown-vector01) (-> self control unknown-matrix01)) + (vector-matrix*! gp-1 (-> self control target-transv) (-> self control unknown-matrix01)) (vector-float*! gp-1 gp-1 0.5) (vector+! gp-1 gp-1 (-> self control trans)) (add-debug-text-sphere @@ -907,11 +906,11 @@ ) (defbehavior add-thrust target () - (let ((s5-0 (-> self control unknown-vector01)) + (let ((s5-0 (-> self control target-transv)) (gp-0 (-> self control unknown-vector00)) ) (let ((s4-0 (new 'stack-no-clear 'vector))) - (set! (-> s4-0 quad) (-> self control unknown-vector01 quad)) + (set! (-> s4-0 quad) (-> self control target-transv quad)) (target-bend-vel-turn gp-0) (target-add-slide-factor s5-0) (let ((t9-2 vector-xz-normalize!) @@ -958,7 +957,7 @@ ) ) ) - (let* ((s2-0 (-> self control unknwon-vector27)) + (let* ((s2-0 (-> self control btransv)) (s3-1 (vector-matrix*! (new 'stack-no-clear 'vector) s2-0 (-> self control unknown-matrix00))) ) (if (< (-> s4-0 x) 0.0) @@ -973,12 +972,12 @@ (set! (-> s3-1 z) (fmax (fmin 0.0 (-> s3-1 z)) (-> s4-0 z))) (set! (-> s3-1 z) (fmax 0.0 (fmin (-> s3-1 z) (-> s4-0 z)))) ) - (if (< 0.2 (-> self control unknown-float27)) + (if (< 0.2 (-> self control blocked-factor)) (vector-seek! s3-1 s4-0 (* 122880.0 (-> self clock seconds-per-frame))) ) (vector-matrix*! s2-0 s3-1 (-> self control unknown-matrix01)) (let ((f28-0 (vector-vector-xz-distance s3-1 s4-0))) - (when (and (not (logtest? (-> self control status) (cshape-moving-flags t-surface))) + (when (and (not (logtest? (-> self control status) (collide-status touch-surface))) (let ((v1-51 gp-0)) (< (sqrtf (+ (* (-> v1-51 x) (-> v1-51 x)) (* (-> v1-51 z) (-> v1-51 z)))) (sqrtf (+ (* (-> s3-1 x) (-> s3-1 x)) (* (-> s3-1 z) (-> s3-1 z)))) @@ -994,8 +993,8 @@ ) ) ) - (if (and (not (logtest? (-> self control status) (cshape-moving-flags t-wall))) - (logtest? (-> self control old-status) (cshape-moving-flags t-wall)) + (if (and (not (logtest? (-> self control status) (collide-status touch-wall))) + (logtest? (-> self control old-status) (collide-status touch-wall)) (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) (< 0.0 (-> gp-0 y)) (< 0.0 (vector-dot @@ -1013,8 +1012,8 @@ (if (< (- (-> self clock frame-counter) (-> self control unknown-time-frame09)) (seconds 0.2)) (set! f30-0 (+ 204800.0 f30-0)) ) - (if (and (not (logtest? (-> self control status) (cshape-moving-flags t-wall))) - (and (logtest? (-> self control old-status) (cshape-moving-flags t-wall)) + (if (and (not (logtest? (-> self control status) (collide-status touch-wall))) + (and (logtest? (-> self control old-status) (collide-status touch-wall)) (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) (< 0.0 (-> gp-0 y)) (< (-> gp-0 z) 0.0) @@ -1051,7 +1050,7 @@ "ltransv" (new 'static 'rgba :g #xff :a #x80) ) - (set! (-> gp-1 quad) (-> self control unknwon-vector27 quad)) + (set! (-> gp-1 quad) (-> self control btransv quad)) (vector-float*! gp-1 gp-1 0.5) (vector+! gp-1 gp-1 (-> self control trans)) (add-debug-text-sphere @@ -1153,7 +1152,7 @@ (-> self control unknown-vector03) ) ((and (or (not (logtest? (logior (-> self control status) (-> self control old-status)) - (cshape-moving-flags on-surface t-surface) + (collide-status on-surface touch-surface) ) ) (< (- (-> self clock frame-counter) (-> self control unknown-time-frame07)) (seconds 0.5)) @@ -1395,7 +1394,7 @@ (dotimes (s5-0 2) (let ((a1-4 (not (or (logtest? (state-flags lleg-no-ik rleg-no-ik) (-> self state-flags)) (and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) - (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (zero? (logand (-> self control status) (collide-status on-surface))) ) (logtest? (focus-status edge-grab pole flut pilot mech) (-> self focus-status)) ) @@ -1537,7 +1536,7 @@ ) ) (cond - ((logtest? (-> self control old-status) (cshape-moving-flags on-surface)) + ((logtest? (-> self control old-status) (collide-status on-surface)) (if (>= (+ (-> self clock frame-counter) (seconds -0.035)) (-> self control unknown-time-frame03)) (vector-reset! (-> self control unknown-vector18)) ) @@ -1557,7 +1556,7 @@ ) ) ) - (set! (-> self control unknown-vector17 quad) (-> self control unknown-vector18 quad)) + (set! (-> self control collide-extra-velocity quad) (-> self control unknown-vector18 quad)) (set! (-> self control unknown-vector14 quad) (-> self control local-normal quad)) 0 (none) @@ -1601,20 +1600,20 @@ (quaternion-copy! (-> self control unknown-quaternion03) (-> self control quat-for-control)) ((-> self control unknown-surface01 active-hook)) (cond - ((logtest? (-> self control status) (cshape-moving-flags on-surface)) + ((logtest? (-> self control status) (collide-status on-surface)) (set! (-> self control unknown-time-frame06) (-> self clock frame-counter)) (set! (-> self control unknown-vector21 quad) (-> self control trans quad)) (if (and (>= (-> self control coverage) 1.0) - (not (logtest? (-> self control status) (cshape-moving-flags t-act on-water))) - (logtest? (-> self control status) (cshape-moving-flags on-ground)) + (not (logtest? (-> self control status) (collide-status touch-actor on-water))) + (logtest? (-> self control status) (collide-status on-ground)) ) - (set! (-> self control unknown-vector23 quad) (-> self control trans quad)) + (set! (-> self control last-trans-on-surf quad) (-> self control trans quad)) ) ((-> self control unknown-surface01 touch-hook)) ) (else (let ((v1-49 (-> self control trans))) - (when (logtest? (-> self control old-status) (cshape-moving-flags on-surface)) + (when (logtest? (-> self control old-status) (collide-status on-surface)) (set! (-> self control unknown-vector42 quad) (-> self control unknown-vector21 quad)) (set! (-> self control unknown-vector43 quad) (-> self control unknown-vector21 quad)) ) @@ -1710,17 +1709,16 @@ (set! (-> self control unknown-time-frame20) (-> self clock frame-counter)) (cond ((logtest? (focus-status mech indax) (-> self focus-status)) - (if (not (and (-> self next-state) - (let ((v1-179 (-> self next-state name))) - (or (= v1-179 'target-falling) - (= v1-179 'target-board-falling) - (= v1-179 'target-gun-falling) - (= v1-179 'target-mech-falling) - (= v1-179 'target-mech-carry-falling) - (= v1-179 'target-carry-falling) - (= v1-179 'target-indax-falling) - ) - ) + (if (not (and (-> self next-state) (let ((v1-179 (-> self next-state name))) + (or (= v1-179 'target-falling) + (= v1-179 'target-board-falling) + (= v1-179 'target-gun-falling) + (= v1-179 'target-mech-falling) + (= v1-179 'target-mech-carry-falling) + (= v1-179 'target-carry-falling) + (= v1-179 'target-indax-falling) + ) + ) ) ) (send-event self 'change-mode 'falling) @@ -1761,7 +1759,7 @@ ) ) ) - (collide-shape-method-29 (-> self control) a1-36) + (move-to-point! (-> self control) a1-36) ) (set! (-> self control surf) *standard-ground-surface*) ) @@ -1776,7 +1774,7 @@ (or (= v1-211 'target-walk) (= v1-211 'target-gun-walk)) ) ) - (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (zero? (logand (-> self control status) (collide-status on-surface))) ) ) (and (< f0-17 0.0) @@ -1819,11 +1817,10 @@ ) ) ) - (set! (-> self control unknown-float30) - (if (logtest? (-> self control status) (cshape-moving-flags on-surface)) - 32.0 - 2.0 - ) + (set! (-> self control unknown-float30) (if (logtest? (-> self control status) (collide-status on-surface)) + 32.0 + 2.0 + ) ) (let ((v1-248 (-> *setting-control* user-current beard))) (when (!= (-> self beard?) v1-248) @@ -1843,9 +1840,8 @@ (none) ) -;; WARN: Return type mismatch int vs none. (defbehavior post-flag-setup target () - (if (logtest? (-> self control status) (cshape-moving-flags t-wall t-act)) + (if (logtest? (-> self control status) (collide-status touch-wall touch-actor)) (set! (-> self control unknown-time-frame07) (-> self clock frame-counter)) ) (when (logtest? (-> self state-flags) (state-flags tinvul1)) @@ -1934,13 +1930,13 @@ (defbehavior bend-gravity target () (if (and (logtest? (-> self control root-prim prim-core action) (collide-action no-normal-reset)) - (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (zero? (logand (-> self control status) (collide-status on-surface))) ) (return #f) ) (let ((f0-1 - (if (and (logtest? (-> self control status) (cshape-moving-flags t-wall)) - (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (if (and (logtest? (-> self control status) (collide-status touch-wall)) + (zero? (logand (-> self control status) (collide-status on-surface))) ) 0.0 (-> self control unknown-float29) @@ -2141,15 +2137,15 @@ ) (vector-float*! (-> self control rider-last-move) s4-1 (-> self clock frames-per-second)) (set! (-> self control rider-time) (-> self clock frame-counter)) - (vector+! s3-1 s3-1 (-> self control unknown-vector05)) - (collide-shape-method-29 (-> self control) s3-1) + (vector+! s3-1 s3-1 (-> self control cspace-offset)) + (move-to-point! (-> self control) s3-1) ) (set! (-> self control unknown-float33) 0.0) (set! (-> self control unknown-vector21 quad) (-> self control trans quad)) ) (else (vector-normalize! s4-1 1228.8) - (let ((a1-20 (vector+! (new 'stack-no-clear 'vector) s4-1 (-> self control unknown-vector05)))) + (let ((a1-20 (vector+! (new 'stack-no-clear 'vector) s4-1 (-> self control cspace-offset)))) (move-by-vector! (-> self control) a1-20) ) (vector-float*! (-> self control rider-last-move) s4-1 (-> self clock frames-per-second)) @@ -2167,8 +2163,8 @@ (vector-! a1-23 (-> s5-0 center-hold) (-> self control unknown-vector31)) (vector-float*! (-> self control rider-last-move) s4-1 (-> self clock frames-per-second)) (set! (-> self control rider-time) (-> self clock frame-counter)) - (vector+! a1-23 a1-23 (-> self control unknown-vector05)) - (collide-shape-method-29 (-> self control) a1-23) + (vector+! a1-23 a1-23 (-> self control cspace-offset)) + (move-to-point! (-> self control) a1-23) ) (set! (-> self control unknown-float33) 0.0) (set! (-> self control unknown-vector21 quad) (-> self control trans quad)) @@ -2311,7 +2307,7 @@ ) (else (set! (-> self control unknown-symbol02) (the-as float #t)) - (collide-shape-method-29 + (move-to-point! (-> self control) (vector-! (new 'stack-no-clear 'vector) s5-0 (-> self control unknown-vector31)) ) @@ -2332,7 +2328,7 @@ (set-quaternion! (-> self control) (-> self control dir-targ)) (joint-control-method-10 (-> self skel)) (draw-control-method-14 (-> self draw) (-> self node-list) (-> self skel)) - (collide-shape-method-46 (-> self control)) + (update-transforms (-> self control)) (none) ) @@ -2355,7 +2351,7 @@ ((logtest? (focus-status board pilot mech indax) (-> self focus-status)) (set! (-> self control unknown-vector15 quad) (-> self control trans quad)) ) - ((or (logtest? (-> self control status) (cshape-moving-flags on-water)) + ((or (logtest? (-> self control status) (collide-status on-water)) (let ((v1-23 (-> self water flags))) (and (logtest? (water-flags touch-water) v1-23) (logtest? (water-flags under-water swimming) v1-23) @@ -2404,7 +2400,7 @@ (-> self control unknown-vector15) ) ((and (or (logtest? (water-flags touch-water) (-> self water flags)) - (logtest? (-> self control status) (cshape-moving-flags on-water)) + (logtest? (-> self control status) (collide-status on-water)) ) (logtest? (-> self water flags) (water-flags mud)) ) @@ -2483,7 +2479,7 @@ ) ) (let ((a2-5 - (matrix<-no-trans-transformq! (-> self control unknown-matrix02) (the-as transformq (-> self control trans))) + (matrix<-no-trans-transformq! (-> self control ctrl-orientation) (the-as transformq (-> self control trans))) ) ) (vector-matrix*! (-> self control unknown-vector28) (-> *TARGET-bank* head-offset) a2-5) @@ -2525,7 +2521,7 @@ (defbehavior do-target-gspot target () (cond - ((and (logtest? (-> self control status) (cshape-moving-flags on-surface)) + ((and (logtest? (-> self control status) (collide-status on-surface)) (!= (-> self control unknown-surface00 mode) 'swim) (!= (-> self control unknown-surface00 mode) 'dive) (not (and (-> self next-state) (= (-> self next-state name) 'target-flop))) @@ -2537,7 +2533,7 @@ ) (else (let ((gp-0 (new 'stack-no-clear 'collide-query))) - (if (collide-shape-moving-method-55 + (if (find-ground (-> self control) gp-0 (logclear (-> self control root-prim prim-core collide-with) (collide-spec water)) @@ -2641,7 +2637,7 @@ (set! (-> a2-3 ignore-pat) (-> v1-52 pat-ignore-mask)) ) (set! (-> a2-3 action-mask) (collide-action solid)) - (collide-shape-method-32 (-> self control) (-> self control transv) a2-3 (meters 1)) + (fill-cache-integrate-and-collide (-> self control) (-> self control transv) a2-3 (meters 1)) ) (if (and (logtest? (-> self control root-prim prim-core action) (collide-action check-edge)) (>= (vector-dot @@ -2774,7 +2770,7 @@ (set! (-> a2-0 ignore-pat) (-> v1-30 pat-ignore-mask)) ) (set! (-> a2-0 action-mask) (collide-action solid)) - (collide-shape-method-32 (-> self control) (-> self control transv) a2-0 (meters 1)) + (fill-cache-integrate-and-collide (-> self control) (-> self control transv) a2-0 (meters 1)) ) (if (and (logtest? (-> self control root-prim prim-core action) (collide-action check-edge)) (>= (vector-dot @@ -2901,7 +2897,7 @@ (set! (-> a2-0 ignore-pat) (-> v1-29 pat-ignore-mask)) ) (set! (-> a2-0 action-mask) (collide-action solid)) - (collide-shape-method-32 (-> self control) (-> self control transv) a2-0 (meters 1)) + (fill-cache-integrate-and-collide (-> self control) (-> self control transv) a2-0 (meters 1)) ) (if (and (logtest? (-> self control root-prim prim-core action) (collide-action check-edge)) (>= (vector-dot @@ -2993,9 +2989,9 @@ (do-rotations2) (reverse-conversions (-> self control transv)) (vector-! - (-> self control unknown-vector05) - (-> self control unknown-vector04) - (-> self control unknown-vector07) + (-> self control cspace-offset) + (-> self control draw-offset) + (-> self control anim-collide-offset-world) ) (let ((a1-3 (new 'stack-no-clear 'overlaps-others-params))) (set! (-> a1-3 options) (overlaps-others-options oo0)) @@ -3065,9 +3061,7 @@ (clear-record-tags! *history* (history-channel collide-status) (-> gp-4 unknown-halfword00) (the-as uint 2)) ) ) - (set! (-> v1-68 collide-status) - (the-as collide-status (logior (-> gp-4 status) (cshape-moving-flags csmf08))) - ) + (set! (-> v1-68 collide-status) (logior (-> gp-4 status) (collide-status no-touch))) (set! (-> v1-68 vector z) (the-as float (-> gp-4 reaction-flag))) ) ) @@ -3079,9 +3073,9 @@ (defbehavior target-no-ja-move-post target () (vector-! - (-> self control unknown-vector05) - (-> self control unknown-vector04) - (-> self control unknown-vector07) + (-> self control cspace-offset) + (-> self control draw-offset) + (-> self control anim-collide-offset-world) ) (let ((a1-2 (new 'stack-no-clear 'overlaps-others-params))) (set! (-> a1-2 options) (overlaps-others-options oo0)) @@ -3108,7 +3102,7 @@ (target-exit) (target-timed-invulnerable-off self 0) (target-timed-invulnerable-off self 2) - (set! (-> self control status) (cshape-moving-flags)) + (set! (-> self control status) (collide-status)) (set! (-> self control unknown-dynamics00) *standard-dynamics*) (set! (-> self control surf) *standard-ground-surface*) (set! (-> self control unknown-vector02 quad) (-> self control unknown-dynamics00 gravity-normal quad)) @@ -3159,7 +3153,9 @@ (let ((s0-0 (new 'process 'control-info obj (collide-list-enum hit-by-others)))) (set! (-> s0-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s0-0 reaction) target-collision-reaction) - (set! (-> s0-0 no-reaction) target-collision-no-reaction) + (set! (-> s0-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) target-collision-no-reaction) + ) (set! sv-16 (new 'process 'collide-shape-prim-group s0-0 (the-as uint 9) 1)) (set! (-> s0-0 total-prims) (the-as uint 10)) (set! (-> sv-16 prim-core action) (collide-action solid can-ride)) @@ -3240,7 +3236,7 @@ (set! (-> v1-69 event-self) 'touched) ) (set! (-> obj game) *game-info*) - (collide-shape-method-29 (-> obj control) (-> arg0 trans)) + (move-to-point! (-> obj control) (-> arg0 trans)) (set! (-> obj control unknown-vector15 quad) (-> arg0 trans quad)) (set! (-> obj focus-search) (new 'process 'boxed-array collide-shape 128)) (set! (-> obj focus-search length) 0) @@ -3264,7 +3260,7 @@ (let ((v1-94 (-> obj node-list data))) (set! (-> v1-94 0 param0) cspace<-transformq+trans!) (set! (-> v1-94 0 param1) (the-as basic (-> obj control trans))) - (set! (-> v1-94 0 param2) (the-as basic (-> obj control unknown-vector05))) + (set! (-> v1-94 0 param2) (the-as basic (-> obj control cspace-offset))) ) (set! (-> obj skel override) (new 'process 'boxed-array float 54)) (set! (-> obj draw light-index) (the-as uint 30)) @@ -3352,6 +3348,7 @@ (none) ) +;; WARN: Return type mismatch object vs none. (defbehavior target-init target ((arg0 continue-point)) (init-target self arg0 #f) (set! (-> self event-hook) (-> target-continue event)) @@ -3360,6 +3357,7 @@ (none) ) +;; WARN: Return type mismatch object vs none. (defbehavior tobot-init target ((arg0 symbol)) (init-target self (the-as continue-point #f) 'tobot) (set! (-> self name) "tobot") @@ -3419,6 +3417,7 @@ *target* ) +;; WARN: Return type mismatch (pointer process) vs target. (defun tobot-start ((arg0 symbol)) (the-as target (process-spawn target @@ -3434,4 +3433,4 @@ (defun tobot-stop () (kill-by-name "tobot" *active-pool*) 0 - ) \ No newline at end of file + ) diff --git a/goal_src/jak2/engine/target/sidekick.gc b/goal_src/jak2/engine/target/sidekick.gc index cf111e7c1a..c20fef62f8 100644 --- a/goal_src/jak2/engine/target/sidekick.gc +++ b/goal_src/jak2/engine/target/sidekick.gc @@ -9,28 +9,30 @@ (define-extern init-sidekick (function none :behavior sidekick)) ;; DECOMP BEGINS - -(defskelgroup skel-sidekick daxter 0 -1 - ((1 (meters 999999))) +;; failed to figure out what this is: +(defskelgroup skel-sidekick daxter daxter-lod0-jg -1 + ((daxter-lod0-mg (meters 999999))) :bounds (static-spherem 0 0 0 3) :longest-edge (meters 1) - :shadow 3 + :shadow daxter-shadow-mg :texture-level 6 :sort 1 :origin-joint-index 6 :shadow-joint-index 6 ) -(defskelgroup skel-sidekick-highres daxter-highres 0 -1 - ((1 (meters 999999))) +;; failed to figure out what this is: +(defskelgroup skel-sidekick-highres daxter-highres daxter-highres-lod0-jg -1 + ((daxter-highres-lod0-mg (meters 999999))) :bounds (static-spherem 0 0 0 3) :longest-edge (meters 1) - :shadow 2 + :shadow daxter-highres-shadow-mg :sort 1 :origin-joint-index 6 :shadow-joint-index 6 ) +;; definition for symbol *sidekick-remap*, type pair (define *sidekick-remap* '(("run-to-stance-left" "run-to-stance") ("run-to-stance-loop-left" "run-to-stance-loop") @@ -114,6 +116,7 @@ ) ) +;; definition for function cspace<-cspace+transformq! (defun cspace<-cspace+transformq! ((arg0 cspace) (arg1 cspace) (arg2 transformq)) (rlet ((acc :class vf) (Q :class vf) @@ -154,6 +157,8 @@ ) ) +;; definition for function target-sidekick-setup +;; WARN: Return type mismatch int vs none. (defbehavior target-sidekick-setup target ((arg0 symbol)) (if (zero? (-> self sidekick)) (set! (-> self sidekick) (the-as (pointer sidekick) #f)) @@ -173,6 +178,7 @@ (none) ) +;; failed to figure out what this is: (defstate sidekick-clone (sidekick) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (local-vars (v0-0 object)) @@ -210,7 +216,7 @@ (the-as basic (-> self parent-override 0 control trans)) ) (set! (-> (the-as (inline-array cspace) v0-0) 0 param2) - (the-as basic (-> self parent-override 0 control unknown-vector05)) + (the-as basic (-> self parent-override 0 control cspace-offset)) ) ) (('board) @@ -488,6 +494,7 @@ ) ) +;; definition for function init-sidekick ;; WARN: Return type mismatch object vs none. (defbehavior init-sidekick sidekick () (set! (-> self mask) (logior (process-mask sidekick) (-> self mask))) @@ -512,3 +519,7 @@ (go sidekick-clone) (none) ) + + + + diff --git a/goal_src/jak2/engine/target/target-carry.gc b/goal_src/jak2/engine/target/target-carry.gc index 352f67b0d4..5c54778867 100644 --- a/goal_src/jak2/engine/target/target-carry.gc +++ b/goal_src/jak2/engine/target/target-carry.gc @@ -7,7 +7,6 @@ ;; DECOMP BEGINS -;; definition for symbol *carry-walk-mods*, type surface (define *carry-walk-mods* (new 'static 'surface :name 'run :turnv 524288.0 @@ -40,7 +39,6 @@ ) ) -;; definition for symbol *carry-jump-mods*, type surface (define *carry-jump-mods* (new 'static 'surface :name 'jump :turnv 524288.0 @@ -74,8 +72,6 @@ ) ) -;; definition for function target-carry-update -;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defbehavior target-carry-update target () (carry-info-method-9 (-> self carry)) @@ -90,7 +86,7 @@ (set! (-> s5-0 0 quad) (-> self control unknown-sphere-array00 2 prim-core world-sphere quad)) (set! (-> s5-0 0 r) (lerp-scale (-> *TARGET-bank* body-radius) 7372.8 f30-0 0.0 1.0)) (let ((v1-17 gp-0)) - (set! (-> v1-17 spheres) s5-0) + (set! (-> v1-17 best-dist) (the-as float s5-0)) (set! (-> v1-17 num-spheres) (the-as uint 1)) (set! (-> v1-17 collide-with) (-> self control root-prim prim-core collide-with)) (set! (-> v1-17 ignore-process0) #f) @@ -109,7 +105,6 @@ (none) ) -;; definition for function target-carry-post ;; WARN: Return type mismatch focus-status vs none. (defbehavior target-carry-post target () (target-post) @@ -118,7 +113,6 @@ (none) ) -;; failed to figure out what this is: (defstate target-carry-pickup (target) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type @@ -297,7 +291,6 @@ ) ) -;; failed to figure out what this is: (defstate target-carry-drop (target) :event target-standard-event-handler :enter (behavior () @@ -374,7 +367,7 @@ ) (set! (-> s5-1 0 quad) (-> s4-0 root-prim prim-core world-sphere quad)) (let ((v1-64 gp-5)) - (set! (-> v1-64 spheres) s5-1) + (set! (-> v1-64 best-dist) (the-as float s5-1)) (set! (-> v1-64 num-spheres) (the-as uint 1)) (set! (-> v1-64 collide-with) (-> self control root-prim prim-core collide-with)) (set! (-> v1-64 ignore-process0) #f) @@ -424,7 +417,6 @@ :post (-> target-carry-pickup post) ) -;; failed to figure out what this is: (defstate target-carry-stance (target) :event target-standard-event-handler :enter (behavior () @@ -487,7 +479,6 @@ :post target-carry-post ) -;; failed to figure out what this is: (defstate target-carry-walk (target) :event target-standard-event-handler :enter (behavior () @@ -554,7 +545,6 @@ :post target-carry-post ) -;; failed to figure out what this is: (defstate target-carry-falling (target) :event target-jump-event-handler :enter (behavior () @@ -563,7 +553,7 @@ (none) ) :trans (behavior () - (if (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (if (logtest? (-> self control status) (collide-status on-surface)) (go target-carry-hit-ground #f) ) (let* ((f0-0 (target-move-dist (-> *TARGET-bank* stuck-time))) @@ -582,7 +572,7 @@ ) #t ) - (logior! (-> self control status) (cshape-moving-flags on-surface)) + (logior! (-> self control status) (collide-status on-surface)) (go target-carry-hit-ground 'stuck) ) ) @@ -613,7 +603,6 @@ :post target-carry-post ) -;; failed to figure out what this is: (defstate target-carry-hit-ground (target) :event target-walk-event-handler :enter (behavior ((arg0 symbol)) @@ -681,14 +670,13 @@ :post target-carry-post ) -;; failed to figure out what this is: (defstate target-carry-jump (target) :event target-jump-event-handler :enter (behavior ((arg0 float) (arg1 float)) (set! (-> self state-time) (-> self clock frame-counter)) (sound-play "jump" :vol 70) (init-var-jump arg0 arg1 #t #f (-> self control transv) 2.0) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control unknown-surface00) *carry-jump-mods*) (set! (-> self control unknown-float36) (fmax 0.0 (fmin 1.0 (* 0.00004359654 (+ -11468.8 (-> self control unknown-float05))))) @@ -749,7 +737,6 @@ :post target-carry-post ) -;; failed to figure out what this is: (defstate target-carry-throw (target) :event target-standard-event-handler :enter (behavior () @@ -790,7 +777,7 @@ ) (set! (-> s5-0 0 quad) (-> s4-0 root-prim prim-core world-sphere quad)) (let ((v1-38 gp-3)) - (set! (-> v1-38 spheres) s5-0) + (set! (-> v1-38 best-dist) (the-as float s5-0)) (set! (-> v1-38 num-spheres) (the-as uint 1)) (set! (-> v1-38 collide-with) (-> self control root-prim prim-core collide-with)) (set! (-> v1-38 ignore-process0) #f) @@ -837,7 +824,3 @@ ) :post (-> target-carry-pickup post) ) - - - - diff --git a/goal_src/jak2/engine/target/target-darkjak.gc b/goal_src/jak2/engine/target/target-darkjak.gc index 5f1793e7bd..1a5a01ed5a 100644 --- a/goal_src/jak2/engine/target/target-darkjak.gc +++ b/goal_src/jak2/engine/target/target-darkjak.gc @@ -110,7 +110,7 @@ (let ((a1-1 'eco-red)) (target-danger-set! (-> self control unknown-symbol04) a1-1) ) - (collide-shape-method-46 (-> self control)) + (update-transforms (-> self control)) (let ((a1-2 (new 'stack-no-clear 'overlaps-others-params))) (set! (-> a1-2 options) (overlaps-others-options)) (set! (-> a1-2 collide-with-filter) (the-as collide-spec -1)) @@ -118,9 +118,9 @@ (find-overlapping-shapes (-> self control) a1-2) ) (target-danger-set! (-> self control unknown-symbol04) #f) - (collide-shape-method-46 (-> self control)) - (if (and (or (>= (- (-> self clock frame-counter) (-> (the-as fact-info-target (-> self fact)) darkjak-start-time)) - (-> (the-as fact-info-target (-> self fact)) darkjak-effect-time) + (update-transforms (-> self control)) + (if (and (or (>= (- (-> self clock frame-counter) (-> (the-as fact-info-target (-> self fact-override)) darkjak-start-time)) + (-> (the-as fact-info-target (-> self fact-override)) darkjak-effect-time) ) (not (-> *setting-control* user-current darkjak)) ) @@ -771,7 +771,7 @@ (when (not (ja-min? 0)) (cond ((and (>= (ja-frame-num 0) 20.0) - (and (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (and (and (not (logtest? (-> self control status) (collide-status on-surface))) (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) @@ -864,7 +864,7 @@ (let ((gp-1 (new-stack-vector0))) (vector-matrix*! gp-1 (-> self control transv) (-> self control unknown-matrix00)) (set! (-> gp-1 y) 0.0) - (vector-matrix*! (-> self control unknown-vector44) gp-1 (-> self control unknown-matrix01)) + (vector-matrix*! (-> self control align-xz-vel) gp-1 (-> self control unknown-matrix01)) ) (when (!= (the-as float (-> self control unknown-word04)) 0.0) (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) @@ -989,11 +989,11 @@ (set! (-> *run-attack-mods* turnvv) 0.0) ) (if (< 2 sv-24) - (set! sv-20 (* sv-20 (fmin 1.0 (-> self control unknown-float44)))) + (set! sv-20 (* sv-20 (fmin 1.0 (-> self control zx-vel-frac)))) ) (set! sv-24 (+ sv-24 1)) ) - (if (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (if (and (not (logtest? (-> self control status) (collide-status on-surface))) (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) @@ -1045,7 +1045,7 @@ (seek! (-> (the-as (pointer float) arg0) 0) arg1 (* 4.0 (-> self clock seconds-per-frame))) (set! (-> self control unknown-float40) (-> (the-as (pointer float) arg0) 0)) (target-danger-set! 'bomb #f) - (collide-shape-method-46 (-> self control)) + (update-transforms (-> self control)) (let ((a1-2 (new 'stack-no-clear 'overlaps-others-params))) (set! (-> a1-2 options) (overlaps-others-options)) (set! (-> a1-2 collide-with-filter) (the-as collide-spec -1)) @@ -1054,12 +1054,11 @@ ) (set! (-> self control unknown-float40) 0.0) (target-danger-set! 'bomb #f) - (collide-shape-method-46 (-> self control)) + (update-transforms (-> self control)) 0 (none) ) -;; failed to figure out what this is: (defstate target-darkjak-bomb0 (target) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (case event-type @@ -1204,7 +1203,7 @@ ) (suspend) (ja :num! (seek! max (lerp-scale 1.5 0.3 f30-0 30.0 210.0))) - (set! v1-100 (or (ja-done? 0) (logtest? (-> self control status) (cshape-moving-flags on-surface)))) + (set! v1-100 (or (ja-done? 0) (logtest? (-> self control status) (collide-status on-surface)))) ) ) (logclear! (-> self state-flags) (state-flags sf6)) @@ -1498,7 +1497,7 @@ (suspend) (ja :num! (seek! (ja-aframe 90.0 0))) ) - (logior! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logior! (-> self control status) (collide-status on-surface on-ground touch-surface)) (send-event (handle->process (-> self notify)) 'notify 'attack 16) (go target-darkjak-get-off) (none) @@ -1527,6 +1526,7 @@ ;; ) ;; ) +;; WARN: Return type mismatch object vs none. (defbehavior target-bomb1-fire-shot target ((arg0 (pointer handle)) (arg1 int) (arg2 int) (arg3 int)) (local-vars (sv-128 target) (sv-144 int) (sv-160 vector) (sv-176 vector) (sv-192 vector)) (rlet ((vf0 :class vf) @@ -1633,7 +1633,7 @@ :enter (-> target-attack-uppercut-jump enter) :exit (-> target-darkjak-bomb0 exit) :trans (behavior () - (if (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (if (logtest? (-> self control status) (collide-status on-surface)) (go target-hit-ground #f) ) (mod-var-jump #t #t (cpad-hold? (-> self control cpad number) x) (-> self control transv)) @@ -1836,7 +1836,7 @@ 327680.0 ) ) - (set! sv-40 (spatial-hash-method-36 *actor-hash* sv-56 (-> sv-32 data) (-> sv-32 allocated-length))) + (set! sv-40 (fill-actor-list-for-sphere *actor-hash* sv-56 (-> sv-32 data) (-> sv-32 allocated-length))) (set! (-> sv-32 length) sv-40) (countdown (s5-0 sv-40) (let* ((s4-0 (-> sv-32 s5-0 process)) diff --git a/goal_src/jak2/engine/target/target-gun.gc b/goal_src/jak2/engine/target/target-gun.gc index b2edbb9559..c0b9f14cd7 100644 --- a/goal_src/jak2/engine/target/target-gun.gc +++ b/goal_src/jak2/engine/target/target-gun.gc @@ -7,12 +7,10 @@ ;; DECOMP BEGINS -;; failed to figure out what this is: (if (not (nmember "gunp" *kernel-packages*)) (set! *kernel-packages* (cons "gunp" *kernel-packages*)) ) -;; definition for symbol *gun-walk-mods*, type surface (define *gun-walk-mods* (new 'static 'surface :name 'run @@ -110,7 +108,6 @@ ) ) -;; definition for function target-gun-event-handler (defbehavior target-gun-event-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) (cond ((and (= arg2 'query) (= (-> arg3 param 0) 'mode)) @@ -157,8 +154,6 @@ ) ) -;; definition for function target-gun-setup -;; WARN: Return type mismatch int vs none. (defbehavior target-gun-setup target ((arg0 symbol)) (when (zero? (-> self gun)) (if (zero? (-> self game gun-type)) @@ -198,8 +193,6 @@ (none) ) -;; definition for function target-gun-init -;; WARN: Return type mismatch int vs none. (defbehavior target-gun-init target ((arg0 int)) (let ((gp-0 (-> self gun))) (if (zero? (-> gp-0 hips)) @@ -366,12 +359,10 @@ (none) ) -;; definition for function target-gun-exit (defun target-gun-exit () #f ) -;; definition for function target-gun-end-mode (defbehavior target-gun-end-mode target ((arg0 symbol)) (when (using-gun? self) (set! (-> self gun fire-pending) 0) @@ -535,12 +526,10 @@ ) ) -;; definition for function quat<-gun! (defun quat<-gun! ((arg0 quaternion) (arg1 quaternion)) (quaternion-copy! arg0 (the-as quaternion *null-vector*)) ) -;; definition for function target-gun-ammo-out-pick (defbehavior target-gun-ammo-out-pick target () (cond ((and (and (logtest? (-> self game features) (game-feature unk-game-feature-06)) @@ -589,8 +578,6 @@ ) ) -;; definition for function target-gun-type-set! -;; WARN: Return type mismatch int vs none. (defbehavior target-gun-type-set! target ((arg0 int)) (if (zero? arg0) (set! arg0 (-> self game gun-type)) @@ -1090,8 +1077,6 @@ (none) ) -;; definition for function target-gun-marking-menu -;; WARN: Return type mismatch int vs none. (defun target-gun-marking-menu ((arg0 target)) (when (and (not (paused?)) (not (and (logtest? (focus-status dark) (-> arg0 focus-status)) (nonzero? (-> arg0 darkjak)))) @@ -1152,9 +1137,6 @@ (none) ) -;; definition for function target-gun-build-track-list -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. (defbehavior target-gun-build-track-list target () (let ((gp-0 (new 'stack-no-clear 'vector))) (set! (-> gp-0 quad) (-> self control trans quad)) @@ -1186,7 +1168,7 @@ ) (set! (-> s3-0 w) (* 0.5 (vector-vector-distance gp-0 s5-0))) (set! (-> s4-1 length) - (spatial-hash-method-36 *actor-hash* (the-as sphere s3-0) (-> s4-1 data) (-> s4-1 allocated-length)) + (fill-actor-list-for-sphere *actor-hash* (the-as sphere s3-0) (-> s4-1 data) (-> s4-1 allocated-length)) ) ) ) @@ -1195,9 +1177,6 @@ (none) ) -;; definition for function target-gun-find-track -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. (defbehavior target-gun-find-track target () (if (logtest? (-> self gun upper-body track-mode) (track-mode lock-on)) (logior! (-> self gun track?) 8) @@ -1206,7 +1185,7 @@ (let ((gp-0 (the-as basic #f))) (when (and (or (< (- (-> self clock frame-counter) (-> self control unknown-time-frame29)) (seconds 0.2)) (and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) - (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (zero? (logand (-> self control status) (collide-status on-surface))) ) (or (logtest? (surface-flag gun-direct) (-> self control unknown-surface01 flags)) (= (-> self gun gun-type) (pickup-type eco-dark)) @@ -1232,7 +1211,7 @@ ) ) ((or (and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) - (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (zero? (logand (-> self control status) (collide-status on-surface))) ) (logtest? (surface-flag gun-direct) (-> self control unknown-surface01 flags)) ) @@ -1320,7 +1299,7 @@ ) ) (and (or (and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) - (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (zero? (logand (-> self control status) (collide-status on-surface))) ) (logtest? (surface-flag gun-direct) (-> self control unknown-surface01 flags)) ) @@ -1424,8 +1403,6 @@ (none) ) -;; definition for function target-top-anim-base-mode -;; WARN: Return type mismatch int vs none. (defbehavior target-top-anim-base-mode target ((arg0 int)) (cond ((logtest? (-> self focus-status) (focus-status pilot-riding)) @@ -1541,8 +1518,6 @@ (none) ) -;; definition for function target-gun-combo-start -;; WARN: Return type mismatch int vs none. (defbehavior target-gun-combo-start target ((arg0 int) (arg1 time-frame)) (target-top-anim-base-mode arg0) (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) arg0)) @@ -1551,9 +1526,6 @@ (none) ) -;; definition for function target-gun-joint-pre0 -;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. (defbehavior target-gun-joint-pre0 target () (if (!= (zero? (logand (-> self game features) (game-feature unk-game-feature-06))) (not (-> self gun gun))) (target-gun-setup (logtest? (-> self game features) (game-feature unk-game-feature-06))) @@ -1666,9 +1638,9 @@ ) ((= (-> self control unknown-symbol00) 'gun) (cond - ((or (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + ((or (and (not (logtest? (-> self control status) (collide-status on-surface))) (or (and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) - (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (zero? (logand (-> self control status) (collide-status on-surface))) ) (< 2048.0 (target-height-above-ground)) ) @@ -1693,7 +1665,7 @@ (set! (-> s5-2 0 quad) (-> self control unknown-sphere-array00 2 prim-core world-sphere quad)) (set! (-> s5-2 0 r) (lerp-scale (-> *TARGET-bank* body-radius) 7372.8 f30-1 0.0 1.0)) (let ((v1-212 gp-3)) - (set! (-> v1-212 spheres) s5-2) + (set! (-> v1-212 best-dist) (the-as float s5-2)) (set! (-> v1-212 num-spheres) (the-as uint 1)) (set! (-> v1-212 collide-with) (-> self control root-prim prim-core collide-with)) (set! (-> v1-212 ignore-process0) #f) @@ -1851,7 +1823,7 @@ (set! (-> self gun upper-body twist-speed-x) 0.6) ) ((and (or (and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) - (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (zero? (logand (-> self control status) (collide-status on-surface))) ) (logtest? (surface-flag gun-direct) (-> self control unknown-surface01 flags)) ) @@ -1924,8 +1896,6 @@ (none) ) -;; definition for function target-gun-joint-pre -;; WARN: Return type mismatch int vs none. (defbehavior target-gun-joint-pre target () (local-vars (gp-0 art-element)) (target-gun-joint-pre0) @@ -2111,8 +2081,6 @@ (none) ) -;; definition for function target-gun-compute-pos -;; INFO: Used lq/sq (defbehavior target-gun-compute-pos target () (let ((a1-0 (-> self node-list data 24 bone transform)) (a2-0 (if (-> self sidekick) @@ -2156,8 +2124,6 @@ ) ) -;; definition for function target-gun-joint-points -;; WARN: Return type mismatch int vs none. (defbehavior target-gun-joint-points target () (when (-> self gun gun) (set! (-> self gun gun-daxter) @@ -2374,7 +2340,6 @@ (none) ) -;; definition for function target-gun-fire ;; WARN: Return type mismatch symbol vs none. (defbehavior target-gun-fire target ((arg0 pickup-type)) (when (using-gun? self) @@ -2643,8 +2608,6 @@ (none) ) -;; definition for function target-gun-check -;; WARN: Return type mismatch int vs none. (defbehavior target-gun-check target () (when (using-gun? self) (let ((gp-0 (-> self gun))) @@ -2849,8 +2812,6 @@ (none) ) -;; definition for function camera-rotate-to-vector -;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defun camera-rotate-to-vector ((arg0 vector) (arg1 vector)) (let ((s5-0 (new 'stack-no-clear 'vector))) @@ -2871,8 +2832,6 @@ (none) ) -;; definition for function target-gun-real-post -;; INFO: Used lq/sq (defbehavior target-gun-real-post target () (let ((f30-0 (-> self clock clock-ratio))) (let ((gp-1 (max 1 (the int (-> self clock time-adjust-ratio))))) @@ -2928,7 +2887,7 @@ (set! (-> a2-1 ignore-process1) #f) (set! (-> a2-1 ignore-pat) (-> v1-33 pat-ignore-mask)) (set! (-> a2-1 action-mask) (collide-action solid)) - (collide-shape-method-32 v1-33 (-> v1-33 transv) a2-1 (meters 1)) + (fill-cache-integrate-and-collide v1-33 (-> v1-33 transv) a2-1 (meters 1)) ) (if (and (logtest? (-> self control root-prim prim-core action) (collide-action check-edge)) (>= (vector-dot @@ -3007,12 +2966,7 @@ (none) ) -;; definition for function target-gun-post (defbehavior target-gun-post target () (target-gun-real-post) (none) ) - - - - diff --git a/goal_src/jak2/engine/target/target-swim.gc b/goal_src/jak2/engine/target/target-swim.gc index c9fc5a177f..19f172b485 100644 --- a/goal_src/jak2/engine/target/target-swim.gc +++ b/goal_src/jak2/engine/target/target-swim.gc @@ -375,7 +375,7 @@ (seek! (-> self control unknown-float001) -6144.0 (* 4096.0 (-> self clock seconds-per-frame))) (seek! (-> self control unknown-float001) 0.0 (* 2048.0 (-> self clock seconds-per-frame))) ) - (set! (-> self control unknown-vector04 y) (-> self control unknown-float001)) + (set! (-> self control draw-offset y) (-> self control unknown-float001)) ) (defstate target-swim-stance (target) @@ -422,8 +422,8 @@ ) :trans (behavior () ((-> self state-hook)) - (if (and (logtest? (-> self control status) (cshape-moving-flags on-surface)) - (zero? (logand (-> self control status) (cshape-moving-flags on-water))) + (if (and (logtest? (-> self control status) (collide-status on-surface)) + (zero? (logand (-> self control status) (collide-status on-water))) ) (set-zero! (-> self water bob)) ) @@ -544,8 +544,8 @@ :exit (-> target-swim-stance exit) :trans (behavior () ((-> self state-hook)) - (if (and (logtest? (-> self control status) (cshape-moving-flags on-surface)) - (zero? (logand (-> self control status) (cshape-moving-flags on-water))) + (if (and (logtest? (-> self control status) (collide-status on-surface)) + (zero? (logand (-> self control status) (collide-status on-water))) ) (set-zero! (-> self water bob)) ) @@ -843,7 +843,7 @@ (go target-swim-up) ) (if (or (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame27)) s5-0) - (and (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (and (logtest? (-> self control status) (collide-status on-surface)) (and (< (-> self water swim-depth) 8192.0) (>= (- (-> self clock frame-counter) (-> self state-time)) gp-0)) ) ) @@ -922,7 +922,7 @@ ) (if (and (cpad-pressed? (-> self control cpad number) circle square) (or (< (- (-> self clock frame-counter) (-> self control unknown-time-frame27)) (seconds 10)) - (logtest? (-> self control status) (cshape-moving-flags t-ceil)) + (logtest? (-> self control status) (collide-status touch-ceiling)) ) (and (< (-> *TARGET-bank* min-dive-depth) (target-height-above-ground)) (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) @@ -1029,7 +1029,7 @@ (cond ((< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (set! (-> self water flags) (logior (water-flags jump-out) (-> self water flags))) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) ) (else (set! (-> self trans-hook) (-> target-jump trans)) @@ -1089,7 +1089,3 @@ ) :post target-swim-post ) - - - - diff --git a/goal_src/jak2/engine/target/target-util.gc b/goal_src/jak2/engine/target/target-util.gc index 3cc9457d87..4848a2863b 100644 --- a/goal_src/jak2/engine/target/target-util.gc +++ b/goal_src/jak2/engine/target/target-util.gc @@ -7,11 +7,11 @@ ;; DECOMP BEGINS -(defskelgroup skel-jchar jakb 0 -1 - ((1 (meters 999999))) +(defskelgroup skel-jchar jakb jakb-lod0-jg -1 + ((jakb-lod0-mg (meters 999999))) :bounds (static-spherem 0 0 0 3.2) :longest-edge (meters 1) - :shadow 2 + :shadow jakb-shadow-mg :texture-level 6 :sort 1 :origin-joint-index 3 @@ -38,22 +38,22 @@ :shadow-joint-index 3 ) -(defskelgroup skel-generic-blast collectables 10 12 - ((11 (meters 999999))) +(defskelgroup skel-generic-blast collectables collectables-generic-blast-lod0-jg collectables-generic-blast-idle-ja + ((collectables-generic-blast-lod0-mg (meters 999999))) :bounds (static-spherem 0 0 0 50) :texture-level 6 :sort 4 ) -(defskelgroup skel-generic-ripples collectables 13 15 - ((14 (meters 999999))) +(defskelgroup skel-generic-ripples collectables collectables-generic-ripples-lod0-jg collectables-generic-ripples-idle-ja + ((collectables-generic-ripples-lod0-mg (meters 999999))) :bounds (static-spherem 0 0 0 6) :texture-level 6 :sort 4 ) -(defskelgroup skel-bomb-blast collectables 0 2 - ((1 (meters 999999))) +(defskelgroup skel-bomb-blast collectables collectables-bomb-blast-lod0-jg collectables-bomb-blast-idle-ja + ((collectables-bomb-blast-lod0-mg (meters 999999))) :bounds (static-spherem 0 0 0 50) :texture-level 6 :sort 4 @@ -169,6 +169,7 @@ :flag-assert #x9000002a8 ) + (define *TARGET-bank* (new 'static 'target-bank :jump-collide-offset (meters 0.7) :jump-height-min (meters 1.01) @@ -694,7 +695,7 @@ (logior! (-> self control penetrate-using) (penetrate touch board)) ) ((= arg0 'racer) - (set! (-> gp-0 unknown-vector04 y) 4096.0) + (set! (-> gp-0 draw-offset y) 4096.0) (sphere<-vector+r! (the-as sphere (-> gp-0 root-prim local-sphere)) (new 'static 'vector :y 8192.0 :w 1.0) @@ -727,7 +728,7 @@ (logior! (-> self control penetrate-using) (penetrate touch mech)) ) ((= arg0 'mech-carry) - (set! (-> gp-0 unknown-vector04 y) 0.0) + (set! (-> gp-0 draw-offset y) 0.0) (sphere<-vector+r! (the-as sphere (-> gp-0 root-prim local-sphere)) (new 'static 'vector :y 12288.0 :w 1.0) @@ -746,7 +747,7 @@ ((= arg0 'duck) (set! (-> self control unknown-float31) arg1) (let ((f30-1 (- 1.0 arg1))) - (set! (-> gp-0 unknown-vector04 y) 0.0) + (set! (-> gp-0 draw-offset y) 0.0) (sphere<-vector+r! (the-as sphere (-> gp-0 root-prim local-sphere)) (-> *TARGET-bank* root-offset) @@ -786,7 +787,7 @@ ) ((= arg0 'indax) (let ((f30-2 0.2)) - (set! (-> gp-0 unknown-vector04 y) 0.0) + (set! (-> gp-0 draw-offset y) 0.0) (sphere<-vector+r! (the-as sphere (-> gp-0 root-prim local-sphere)) (-> *TARGET-bank* root-offset) @@ -821,7 +822,7 @@ ((= arg0 'tube) (set! (-> self control unknown-float31) arg1) (let ((f30-3 (- 1.0 arg1))) - (set! (-> gp-0 unknown-vector04 y) 0.0) + (set! (-> gp-0 draw-offset y) 0.0) (sphere<-vector+r! (the-as sphere (-> gp-0 root-prim local-sphere)) (-> *TARGET-bank* root-offset) @@ -852,7 +853,7 @@ (logior! (-> self control penetrate-using) (penetrate touch tube)) ) ((= arg0 'carry) - (set! (-> gp-0 unknown-vector04 y) 0.0) + (set! (-> gp-0 draw-offset y) 0.0) (sphere<-vector+r! (the-as sphere (-> gp-0 root-prim local-sphere)) (-> *TARGET-bank* root-offset) @@ -882,7 +883,7 @@ ) ((= arg0 'gun) (set! (-> self control unknown-float31) arg1) - (set! (-> gp-0 unknown-vector04 y) 0.0) + (set! (-> gp-0 draw-offset y) 0.0) (sphere<-vector+r! (the-as sphere (-> gp-0 root-prim local-sphere)) (-> *TARGET-bank* root-offset) @@ -936,7 +937,7 @@ ) (else (set! (-> self control unknown-float31) 0.0) - (set! (-> gp-0 unknown-vector04 y) 0.0) + (set! (-> gp-0 draw-offset y) 0.0) (sphere<-vector+r! (the-as sphere (-> gp-0 root-prim local-sphere)) (-> *TARGET-bank* root-offset) @@ -1026,6 +1027,7 @@ ) ) +;; WARN: Return type mismatch control-info vs object. (defmethod apply-alignment target ((obj target) (arg0 align-opts) (arg1 transformq) (arg2 vector)) (with-pp (let ((s2-0 (new 'stack-no-clear 'vector))) @@ -1102,10 +1104,10 @@ (>= (- (-> *display* game-clock frame-counter) (the-as int (-> self game kiosk-timeout))) (seconds 60)) ) (and (>= (- (-> self clock frame-counter) (-> self ambient-time)) (seconds 30)) - (not (logtest? (-> self control status) (cshape-moving-flags t-act))) - (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (not (logtest? (-> self control status) (collide-status touch-actor))) + (logtest? (-> self control status) (collide-status on-surface)) (not (or (logtest? (water-flags touch-water) (-> self water flags)) - (logtest? (-> self control status) (cshape-moving-flags on-water)) + (logtest? (-> self control status) (collide-status on-water)) ) ) (zero? (logand (focus-status dead hit grabbed in-head edge-grab pole flut tube board mech dark indax teleporting) @@ -1142,11 +1144,11 @@ ) (defbehavior can-jump? target ((arg0 symbol)) - (and (or (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (and (or (logtest? (-> self control status) (collide-status on-surface)) (< (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) - (and (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (and (logtest? (-> self control status) (collide-status on-surface)) (< 0.866 (-> self control surface-angle)) ) (and (= arg0 'board) @@ -1168,6 +1170,7 @@ ) ) +;; WARN: Return type mismatch object vs none. (defbehavior target-jump-go target () (go target-jump (-> *TARGET-bank* jump-height-min) (-> *TARGET-bank* jump-height-max) (the-as surface #f)) (none) @@ -1178,7 +1181,7 @@ ) (defbehavior jump-hit-ground-stuck? target () - (or (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (or (logtest? (-> self control status) (collide-status on-surface)) (when (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) ) @@ -1188,6 +1191,7 @@ ) ) +;; WARN: Return type mismatch int vs time-frame. (defbehavior target-time-to-ground target () (let ((f0-0 (target-height-above-ground)) (f2-0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) @@ -1202,8 +1206,9 @@ ) ) +;; WARN: Return type mismatch object vs none. (defbehavior fall-test target ((arg0 (state symbol target)) (arg1 float)) - (when (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (when (and (not (logtest? (-> self control status) (collide-status on-surface))) (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) @@ -1220,12 +1225,13 @@ (none) ) +;; WARN: Return type mismatch object vs none. (defbehavior slide-down-test target () - (if (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface csmf07))) + (if (and (not (logtest? (-> self control status) (collide-status on-surface touch-edge))) (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) - (logtest? (-> self control status) (cshape-moving-flags t-surface)) + (logtest? (-> self control status) (collide-status touch-surface)) (< 0.5 (-> self control surface-angle)) ) (go target-slide-down) @@ -1236,15 +1242,15 @@ (defbehavior smack-surface? target ((arg0 symbol)) (and (< 0.7 (-> self control touch-angle)) (and (< (-> self control surface-angle) 0.3) - (logtest? (-> self control status) (cshape-moving-flags t-wall)) - (or arg0 (zero? (logand (-> self control status) (cshape-moving-flags t-act)))) + (logtest? (-> self control status) (collide-status touch-wall)) + (or arg0 (zero? (logand (-> self control status) (collide-status touch-actor)))) ) ) ) (defbehavior can-roll? target () - (and (logtest? (-> self control status) (cshape-moving-flags on-surface)) - (or (not (logtest? (-> self control status) (cshape-moving-flags t-wall))) + (and (logtest? (-> self control status) (collide-status on-surface)) + (or (not (logtest? (-> self control status) (collide-status touch-wall))) (>= 0.7 (-> self control touch-angle)) ) (< (-> self control unknown-float17) 0.7) @@ -1264,7 +1270,7 @@ ) (defbehavior can-duck? target () - (and (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (and (logtest? (-> self control status) (collide-status on-surface)) (>= (-> self control unknown-float0000) 0.7) (not (logtest? (water-flags under-water swimming) (-> self water flags))) (not (logtest? (-> self state-flags) (state-flags sf9))) @@ -1287,7 +1293,7 @@ (set! (-> s4-0 1 y) (+ 2867.2 (-> *TARGET-bank* body-radius) (-> s4-0 1 y))) (set! (-> s4-0 1 r) (-> *TARGET-bank* body-radius)) (let ((v1-12 gp-0)) - (set! (-> v1-12 spheres) s4-0) + (set! (-> v1-12 best-dist) (the-as float s4-0)) (set! (-> v1-12 num-spheres) (the-as uint 2)) (set! (-> v1-12 collide-with) (logclear (-> arg0 control root-prim prim-core collide-with) @@ -1441,7 +1447,7 @@ (set! (-> arg1 control unknown-time-frame25) arg0) ) ) - (collide-shape-method-49 (-> arg1 control) 2 #x8000 0) + (modify-collide-as! (-> arg1 control) 2 (collide-spec jak-vulnerable) (collide-spec)) (logior! (-> arg1 focus-status) (focus-status ignore)) 0 (none) @@ -1464,7 +1470,7 @@ ) (when (not (logtest? (state-flags tinvul1 tinvul2) (-> arg0 state-flags))) (logclear! (-> arg0 draw status) (draw-control-status no-draw-bounds)) - (collide-shape-method-49 (-> arg0 control) 2 0 #x8000) + (modify-collide-as! (-> arg0 control) 2 (collide-spec) (collide-spec jak-vulnerable)) ) 0 (none) @@ -1933,7 +1939,7 @@ ) ) ((= arg0 7) - (-> v1-0 unknown-vector23) + (-> v1-0 last-trans-on-surf) ) ((= arg0 8) (-> v1-0 unknown-vector42) @@ -2005,7 +2011,3 @@ (defmethod process-focusable-method-25 target ((obj target)) (-> obj neck notice-time) ) - - - - diff --git a/goal_src/jak2/engine/target/target.gc b/goal_src/jak2/engine/target/target.gc index 51757a2fc0..9874806d07 100644 --- a/goal_src/jak2/engine/target/target.gc +++ b/goal_src/jak2/engine/target/target.gc @@ -6,6 +6,7 @@ ;; dgos: ENGINE, GAME ;; DECOMP BEGINS + (defbehavior target-falling-trans target ((arg0 symbol) (arg1 time-frame)) (if (want-to-darkjak?) (go target-darkjak-get-on 2) @@ -13,7 +14,7 @@ (if (and (cpad-pressed? (-> self control cpad number) circle) (can-feet? #f)) (go target-attack-air #f) ) - (if (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (if (logtest? (-> self control status) (collide-status on-surface)) (go target-hit-ground #f) ) (when (if (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) @@ -23,7 +24,7 @@ ) #t ) - (logior! (-> self control status) (cshape-moving-flags on-surface)) + (logior! (-> self control status) (collide-status on-surface)) (go target-hit-ground 'stuck) ) (if (!= (-> self state-time) (-> self clock frame-counter)) @@ -289,7 +290,7 @@ (if (and (cpad-pressed? (-> self control cpad number) square) (can-hands? #t)) (go target-running-attack) ) - (if (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (if (and (not (logtest? (-> self control status) (collide-status on-surface))) (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) (seconds 0.08)) ) (go target-falling #f) @@ -330,12 +331,12 @@ (none) ) :trans (behavior () - (when (or (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (when (or (logtest? (-> self control status) (collide-status on-surface)) (if (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) #t ) ) - (logior! (-> self control status) (cshape-moving-flags on-surface)) + (logior! (-> self control status) (collide-status on-surface)) (if (using-gun? self) (go target-stance) (go target-duck-stance #f) @@ -456,7 +457,7 @@ (none) ) :trans (behavior () - (if (and (or (and (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (if (and (or (and (logtest? (-> self control status) (collide-status on-surface)) (and (< 0.9 (-> self control surface-angle)) (!= (-> self control cur-pat material) 14) (!= (-> self control cur-pat event) 7) @@ -518,7 +519,7 @@ (go target-running-attack) ) (when (= (-> self control unknown-float15) 0.0) - (logior! (-> self control status) (cshape-moving-flags on-surface)) + (logior! (-> self control status) (collide-status on-surface)) (if (using-gun? self) (go target-stance) (go target-duck-stance #f) @@ -575,7 +576,7 @@ (set! arg0 (* arg0 (-> self darkjak-giant-interp))) (set! arg1 (* arg1 (-> self darkjak-giant-interp))) ) - (logclear! (-> self control status) (cshape-moving-flags csmf14)) + (logclear! (-> self control status) (collide-status touch-ceiling-sticky)) (set! (-> self control unknown-time-frame19) (-> self clock frame-counter)) (delete-back-vel) (let* ((f0-4 arg5) @@ -708,11 +709,11 @@ ) (set! (-> v1-62 y) (* 0.5 (-> v1-62 y))) ) - (set! v0-1 (-> self control unknown-vector06)) + (set! v0-1 (-> self control anim-collide-offset-local)) (set! (-> v0-1 quad) (-> v1-62 quad)) ) (else - (set! v0-1 (-> self control unknown-vector06)) + (set! v0-1 (-> self control anim-collide-offset-local)) (set! (-> v0-1 quad) (the-as uint128 0)) ) ) @@ -1100,7 +1101,7 @@ (set! (-> self state-time) (-> self clock frame-counter)) (sound-play "jump" :vol 70) (init-var-jump arg0 arg1 #t #t (-> self control transv) 2.0) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! arg2 (cond (arg2 (empty) @@ -1387,7 +1388,7 @@ ) (set! (-> self state-time) (-> self clock frame-counter)) (init-var-jump arg0 arg1 #t #t (-> self control transv) 2.0) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (if (!= (-> self control unknown-surface00) *slide-jump-mods*) (set! (-> self control unknown-surface00) *double-jump-mods*) ) @@ -1526,7 +1527,7 @@ (go target-duck-high-jump arg0 arg1 (the-as symbol arg2)) ) (set! (-> self state-time) (-> self clock frame-counter)) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (sound-play "jump" :pitch 0.3) (init-var-jump arg0 arg1 #t #t (-> self control transv) 2.0) (set! (-> self control unknown-surface00) (cond @@ -1603,7 +1604,7 @@ :event target-standard-event-handler :enter (behavior ((arg0 float) (arg1 float) (arg2 symbol)) (set! (-> self state-time) (-> self clock frame-counter)) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control unknown-surface00) *turn-around-mods*) (case arg2 (('launch) @@ -1657,7 +1658,7 @@ (set! (-> self state-time) (-> self clock frame-counter)) (sound-play "jump" :vol 80 :pitch -0.4) (init-var-jump arg0 arg1 #t #f (-> self control transv) 2.0) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (cond ((= arg2 'launch) (set! (-> self neck flex-blend) 0.0) @@ -1869,9 +1870,7 @@ ) ) ) - (if (and (< (-> *TARGET-bank* fall-far) f0-2) - (zero? (logand (-> self control status) (cshape-moving-flags on-water))) - ) + (if (and (< (-> *TARGET-bank* fall-far) f0-2) (zero? (logand (-> self control status) (collide-status on-water)))) (go target-hit-ground-hard f0-2) ) ) @@ -2474,7 +2473,7 @@ (when (!= (-> self state-time) (-> self clock frame-counter)) (when (and (or (smack-surface? #t) (and (>= (-> self control unknown-float19) 0.7) - (zero? (logand (-> self control status) (cshape-moving-flags t-act))) + (zero? (logand (-> self control status) (collide-status touch-actor))) ) ) (begin @@ -2625,7 +2624,7 @@ (when (not (ja-min? 0)) (cond ((and (>= (ja-aframe-num 0) 20.0) - (and (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (and (and (not (logtest? (-> self control status) (collide-status on-surface))) (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) @@ -2670,7 +2669,7 @@ (let ((s5-1 (new-stack-vector0))) (vector-matrix*! s5-1 (-> self control transv) (-> self control unknown-matrix00)) (set! (-> s5-1 y) 0.0) - (vector-matrix*! (-> self control unknown-vector44) s5-1 (-> self control unknown-matrix01)) + (vector-matrix*! (-> self control align-xz-vel) s5-1 (-> self control unknown-matrix01)) ) (when (!= (the-as float (-> self control unknown-word04)) 0.0) (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) @@ -2773,12 +2772,12 @@ (set! (-> *run-attack-mods* turnvv) 0.0) ) (if (< 2 gp-2) - (set! f30-0 (* f30-0 (fmin 1.0 (-> self control unknown-float44)))) + (set! f30-0 (* f30-0 (fmin 1.0 (-> self control zx-vel-frac)))) ) (+! gp-2 1) ) ) - (if (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (if (and (not (logtest? (-> self control status) (collide-status on-surface))) (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) @@ -2892,7 +2891,7 @@ ) :enter (behavior ((arg0 symbol)) (set! (-> self state-time) (-> self clock frame-counter)) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (target-start-attack) (target-danger-set! 'spin-air #f) (set! (-> self control unknown-surface00) *jump-attack-mods*) @@ -2973,7 +2972,7 @@ (none) ) :trans (behavior () - (when (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (when (logtest? (-> self control status) (collide-status on-surface)) (set-quaternion! (-> self control) (-> self control dir-targ)) (go target-hit-ground #f) ) @@ -3243,7 +3242,7 @@ ) (set! (-> self state-time) (-> self clock frame-counter)) (init-var-jump arg0 arg1 #t #f (-> self control transv) 2.0) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self neck flex-blend) 0.0) (set! (-> self control unknown-surface00) *uppercut-jump-mods*) (target-start-attack) @@ -3256,7 +3255,7 @@ ) :exit target-exit :trans (behavior () - (if (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (if (logtest? (-> self control status) (collide-status on-surface)) (go target-hit-ground #f) ) (when (and (cpad-pressed? (-> self control cpad number) square) @@ -3436,7 +3435,7 @@ (set-forward-vel (-> self control unknown-float05)) ) (set! (-> self state-time) (-> self clock frame-counter)) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control unknown-surface00) *flop-mods*) (set! (-> self neck flex-blend) 0.0) (set! (-> self control unknown-word04) (the-as uint 0)) @@ -3479,16 +3478,16 @@ ) :trans (behavior () (delete-back-vel) - (let ((gp-1 (logtest? (-> self control status) (cshape-moving-flags on-surface)))) + (let ((gp-1 (logtest? (-> self control status) (collide-status on-surface)))) (when (and (not gp-1) (let ((v1-6 (ja-group))) (and v1-6 (or (= v1-6 (-> self draw art-group data 53)) (= v1-6 (-> self draw art-group data 55)))) ) ) (when (and (or (< (target-move-dist (seconds 0.1)) 1638.4) - (and (logtest? (-> self control status) (cshape-moving-flags t-wall)) (< 0.7 (-> self control poly-angle))) + (and (logtest? (-> self control status) (collide-status touch-wall)) (< 0.7 (-> self control poly-angle))) ) - (not (logtest? (-> self control status) (cshape-moving-flags t-act))) + (not (logtest? (-> self control status) (collide-status touch-actor))) (>= (the-as uint (-> self control unknown-word04)) (the-as uint 2)) ) (set! (-> self control unknown-time-frame14) (-> self clock frame-counter)) @@ -3496,7 +3495,7 @@ ) ) (when gp-1 - (logior! (-> self control status) (cshape-moving-flags on-surface)) + (logior! (-> self control status) (collide-status on-surface)) (when (or (and (= (-> (the-as fact-info-target (-> self fact-override)) eco-type) 2) (>= (-> (the-as fact-info-target (-> self fact-override)) eco-level) 1.0) ) @@ -3602,11 +3601,11 @@ ) (let ((f30-0 1.0)) (let ((v1-58 (new-stack-vector0))) - (let ((f0-17 (vector-dot (-> self control dynam gravity-normal) (-> self control unknown-vector44)))) + (let ((f0-17 (vector-dot (-> self control dynam gravity-normal) (-> self control align-xz-vel)))) 0.0 (vector-! v1-58 - (-> self control unknown-vector44) + (-> self control align-xz-vel) (vector-float*! v1-58 (-> self control dynam gravity-normal) f0-17) ) ) @@ -3615,8 +3614,8 @@ (f2-0 -368640.0) ) (vector+! - (-> self control unknown-vector44) - (vector-float*! (-> self control unknown-vector44) (-> self control dynam gravity-normal) f2-0) + (-> self control align-xz-vel) + (vector-float*! (-> self control align-xz-vel) (-> self control dynam gravity-normal) f2-0) (vector-float*! v1-58 v1-58 (/ f0-18 f1-1)) ) ) @@ -3649,7 +3648,7 @@ (set! (-> gp-1 param 0) 0.0) (joint-control-channel-group-eval! gp-1 (the-as art-joint-anim #f) num-func-chan) ) - (set! f30-0 (* f30-0 (fmin 1.0 (-> self control unknown-float44)))) + (set! f30-0 (* f30-0 (fmin 1.0 (-> self control zx-vel-frac)))) (let ((v1-77 (new-stack-vector0)) (f0-33 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) ) @@ -3916,13 +3915,13 @@ (let ((s3-2 (new-stack-vector0))) (vector-matrix*! s3-2 (-> self control transv) (-> self control unknown-matrix00)) (set! (-> s3-2 y) 0.0) - (vector-matrix*! (-> self control unknown-vector44) s3-2 (-> self control unknown-matrix01)) + (vector-matrix*! (-> self control align-xz-vel) s3-2 (-> self control unknown-matrix01)) ) ) ) (suspend) (ja :num! (seek!)) - (set! f30-0 (* f30-0 (fmin 1.0 (-> self control unknown-float44)))) + (set! f30-0 (* f30-0 (fmin 1.0 (-> self control zx-vel-frac)))) ) ) (if (and (or (< (- (-> self clock frame-counter) (the-as time-frame gp-0)) @@ -4068,20 +4067,20 @@ (let ((s4-1 (new-stack-vector0))) (vector-matrix*! s4-1 (-> self control transv) (-> self control unknown-matrix00)) (set! (-> s4-1 y) 0.0) - (vector-matrix*! (-> self control unknown-vector44) s4-1 (-> self control unknown-matrix01)) + (vector-matrix*! (-> self control align-xz-vel) s4-1 (-> self control unknown-matrix01)) ) (suspend) (ja :num! (seek!)) - (set! f30-0 (* f30-0 (fmin 1.0 (-> self control unknown-float44)))) + (set! f30-0 (* f30-0 (fmin 1.0 (-> self control zx-vel-frac)))) (set! v1-37 (or (ja-max? 0) - (and (>= (ja-aframe-num 0) 4.0) (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (and (>= (ja-aframe-num 0) 4.0) (logtest? (-> self control status) (collide-status on-surface))) ) ) ) ) (set! (-> self state-time) (-> self clock frame-counter)) - (while (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (while (not (logtest? (-> self control status) (collide-status on-surface))) (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.01)) (let ((v1-50 (ja-group))) (when (not (and v1-50 (= v1-50 (-> self draw art-group data 27)))) @@ -4159,7 +4158,3 @@ ) :post target-post ) - - - - diff --git a/goal_src/jak2/levels/common/battle.gc b/goal_src/jak2/levels/common/battle.gc index 904f0d6666..229233873c 100644 --- a/goal_src/jak2/levels/common/battle.gc +++ b/goal_src/jak2/levels/common/battle.gc @@ -891,7 +891,7 @@ ) (set! *actor-list-length* 0) (if (logtest? s5-0 512) - (set! *actor-list-length* (spatial-hash-method-36 *actor-hash* (the-as sphere gp-0) *actor-list* 256)) + (set! *actor-list-length* (fill-actor-list-for-sphere *actor-hash* (the-as sphere gp-0) *actor-list* 256)) ) (when (logtest? s5-0 1024) (let ((a0-2 (-> *collide-player-list* alive-list next0))) diff --git a/goal_src/jak2/levels/common/cty-guard-turret-button.gc b/goal_src/jak2/levels/common/cty-guard-turret-button.gc index adcc1356fc..c0f56e2def 100644 --- a/goal_src/jak2/levels/common/cty-guard-turret-button.gc +++ b/goal_src/jak2/levels/common/cty-guard-turret-button.gc @@ -7,3 +7,156 @@ ;; DECOMP BEGINS +(defskelgroup skel-cty-guard-turret-button cty-guard-turret-button 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 3) + ) + +(deftype cty-guard-turret-button (basebutton) + () + :heap-base #xa0 + :method-count-assert 40 + :size-assert #x120 + :flag-assert #x2800a00120 + (:methods + (pop-up () _type_ :state 39) + ) + ) + + +(defmethod basebutton-method-33 cty-guard-turret-button ((obj cty-guard-turret-button)) + "TODO - joint stuff" + (initialize-skeleton + obj + (the-as + skeleton-group + (art-group-get-by-name *level* "skel-cty-guard-turret-button" (the-as (pointer uint32) #f)) + ) + (the-as pair 0) + ) + (ja-channel-set! 1) + (cond + ((logtest? (-> obj button-status) (button-status pressed)) + (let ((s5-1 (-> obj skel root-channel 0))) + (joint-control-channel-group-eval! + s5-1 + (the-as art-joint-anim (-> obj draw art-group data 2)) + num-func-identity + ) + (set! (-> s5-1 frame-num) + (the float (+ (-> (the-as art-joint-anim (-> obj draw art-group data 2)) frames num-frames) -1)) + ) + ) + ) + (else + (let ((s5-2 (-> obj skel root-channel 0))) + (joint-control-channel-group-eval! + s5-2 + (the-as art-joint-anim (-> obj draw art-group data 2)) + num-func-identity + ) + (set! (-> s5-2 frame-num) 0.0) + ) + ) + ) + (transform-post) + (none) + ) + +;; WARN: Return type mismatch collide-shape vs none. +(defmethod basebutton-method-34 cty-guard-turret-button ((obj cty-guard-turret-button)) + "TODO - collision stuff" + (let ((s5-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec pusher)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak enemy hit-by-others-list player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid rideable)) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 12288.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (pusher-init s5-0) + (let ((v1-10 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-10 prim-core collide-as) (collide-spec pusher)) + (set! (-> v1-10 prim-core collide-with) (collide-spec jak bot enemy hit-by-others-list player-list)) + (set! (-> v1-10 prim-core action) (collide-action solid rideable)) + (set! (-> v1-10 transform-index) 3) + (set-vector! (-> v1-10 local-sphere) 0.0 0.0 0.0 12288.0) + ) + (let ((v1-12 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-12 prim-core collide-as) (collide-spec pusher)) + (set! (-> v1-12 prim-core collide-with) (collide-spec jak bot enemy hit-by-others-list player-list)) + (set! (-> v1-12 prim-core action) (collide-action solid rideable)) + (set! (-> v1-12 transform-index) 4) + (set-vector! (-> v1-12 local-sphere) 0.0 -2048.0 0.0 4096.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-15 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-15 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-15 prim-core collide-with)) + ) + (set! (-> obj root-override) s5-0) + ) + (none) + ) + +;; WARN: Return type mismatch symbol vs none. +(defmethod prepare-trigger-event! cty-guard-turret-button ((obj cty-guard-turret-button)) + "Sets `event-going-down` to `'trigger`" + (logior! (-> obj button-status) (button-status button-status-4)) + (set! (-> obj event-going-down) 'trigger) + (none) + ) + +(defstate pop-up (cty-guard-turret-button) + :virtual #t + :code (behavior () + (ja-no-eval :group! (-> self draw art-group data 3) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) frames num-frames) -1)) 0.4) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 0.4)) + ) + (ja :group! (-> self draw art-group data 2) :num! min) + (go-virtual up-idle) + (none) + ) + :post (behavior () + (rider-post) + (none) + ) + ) + +(defmethod idle-state-transition cty-guard-turret-button ((obj cty-guard-turret-button)) + "If `button-status` has [[button-status:0]] set, transition to [[basebutton::27]] otherwise, [[basebutton::30]]" + (draw-control-method-12 (-> obj draw) (the-as uint 0) -1) + (cond + ((logtest? (-> obj button-status) (button-status pressed)) + (format #t "off~%") + (draw-control-method-12 (-> obj draw) (the-as uint 4) 0) + (draw-control-method-12 (-> obj draw) (the-as uint 1) 0) + (go (method-of-object obj down-idle)) + ) + (else + (format #t "on~%") + (draw-control-method-12 (-> obj draw) (the-as uint 4) 0) + (draw-control-method-12 (-> obj draw) (the-as uint 2) 0) + (go (method-of-object obj pop-up)) + ) + ) + ) + +(defstate going-down (cty-guard-turret-button) + :virtual #t + :enter (behavior () + (sound-play "gturret-button") + (format #t "going-down off~%") + (draw-control-method-12 (-> self draw) (the-as uint 0) -1) + (draw-control-method-12 (-> self draw) (the-as uint 4) 0) + (draw-control-method-12 (-> self draw) (the-as uint 1) 0) + (press! self #t) + (none) + ) + ) diff --git a/goal_src/jak2/levels/common/guard-projectile.gc b/goal_src/jak2/levels/common/guard-projectile.gc index 40fa9660b4..3983915075 100644 --- a/goal_src/jak2/levels/common/guard-projectile.gc +++ b/goal_src/jak2/levels/common/guard-projectile.gc @@ -569,8 +569,8 @@ ) ) ) - (when (logtest? (-> s5-0 status) (cshape-moving-flags t-surface)) - (if (logtest? (-> arg0 root-override status) (cshape-moving-flags t-act)) + (when (logtest? (-> s5-0 status) (collide-status touch-surface)) + (if (logtest? (-> arg0 root-override status) (collide-status touch-actor)) (set! (-> arg0 hit-actor?) #t) ) (go (method-of-object arg0 impact)) @@ -582,8 +582,10 @@ (defmethod made-impact? guard-shot ((obj guard-shot)) "TODO - queries the collision cache, return true/false" - (let ((v1-0 (-> obj root-override))) - (let ((a0-1 (new 'stack-no-clear 'collide-query))) + (let ((v1-0 (-> obj root-override)) + (t1-0 (new 'stack-no-clear 'collide-query)) + ) + (let ((a0-1 t1-0)) (set! (-> a0-1 radius) (-> v1-0 root-prim prim-core world-sphere w)) (set! (-> a0-1 collide-with) (-> v1-0 root-prim prim-core collide-with)) (set! (-> a0-1 ignore-process0) obj) @@ -591,8 +593,8 @@ (set! (-> a0-1 ignore-pat) (-> v1-0 pat-ignore-mask)) (set! (-> a0-1 action-mask) (collide-action solid)) ) - (when (collide-shape-moving-method-65 v1-0 (-> v1-0 transv) -6144.0 0.0 -2048.0) - (if (logtest? (-> obj root-override status) (cshape-moving-flags t-act)) + (when (fill-and-try-snap-to-surface v1-0 (-> v1-0 transv) -6144.0 0.0 -2048.0 t1-0) + (if (logtest? (-> obj root-override status) (collide-status touch-actor)) (set! (-> obj hit-actor?) #t) ) #t @@ -605,9 +607,11 @@ (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) - (the-as (function control-info collide-query vector vector cshape-moving-flags) cshape-reaction-just-move) + (the-as (function control-info collide-query vector vector collide-status) cshape-reaction-just-move) + ) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (set! (-> s5-0 no-reaction) nothing) (set! (-> s5-0 penetrate-using) (penetrate enemy-yellow-shot)) (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) (set! (-> s5-0 total-prims) (the-as uint 3)) @@ -702,7 +706,9 @@ (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) projectile-bounce-reaction) - (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) (set! (-> s5-0 penetrate-using) (penetrate explode)) (let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) (set! (-> v1-7 prim-core action) (collide-action solid)) @@ -771,10 +777,10 @@ (let* ((a2-0 (-> obj root-override)) (v1-0 (-> a2-0 status)) ) - (if (logtest? v1-0 (cshape-moving-flags t-surface)) + (if (logtest? v1-0 (collide-status touch-surface)) (vector-float*! (-> a2-0 transv) (-> a2-0 transv) 0.2) ) - (when (and (logtest? v1-0 (cshape-moving-flags csmf11)) + (when (and (logtest? v1-0 (collide-status impact-surface)) (>= (- (-> self clock frame-counter) (-> obj played-bounce-time)) (seconds 0.3)) ) (set! (-> obj played-bounce-time) (-> self clock frame-counter)) @@ -934,10 +940,10 @@ (defmethod made-impact? guard-lazer-shot ((obj guard-lazer-shot)) "TODO - queries the collision cache, return true/false" - (let ((gp-0 (-> obj root-override))) - (let* ((s5-0 (new 'stack-no-clear 'collide-query)) - (v1-0 s5-0) - ) + (let ((gp-0 (-> obj root-override)) + (s5-0 (new 'stack-no-clear 'collide-query)) + ) + (let ((v1-0 s5-0)) (set! (-> v1-0 radius) (-> gp-0 root-prim prim-core world-sphere w)) (set! (-> v1-0 collide-with) (-> gp-0 root-prim prim-core collide-with)) (set! (-> v1-0 ignore-process0) obj) @@ -950,7 +956,7 @@ (let* ((s4-1 (vector-! (new 'stack-no-clear 'vector) (-> gp-0 trans) (get-trans (the-as process-focusable a0-2) 3))) (f0-2 (- (vector-length s4-1))) ) - (collide-shape-moving-method-65 gp-0 s4-1 f0-2 0.0 -3072.0) + (fill-and-try-snap-to-surface gp-0 s4-1 f0-2 0.0 -3072.0 s5-0) ) ) ) @@ -959,7 +965,7 @@ (defun guard-lazer-shot-move ((arg0 guard-lazer-shot)) (projectile-move-fill-line-sphere arg0) - (if (logtest? (-> arg0 root-override status) (cshape-moving-flags t-surface)) + (if (logtest? (-> arg0 root-override status) (collide-status touch-surface)) (go (method-of-object arg0 impact)) ) 0 @@ -971,7 +977,9 @@ (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) - (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) (set! (-> s5-0 penetrate-using) (penetrate enemy-yellow-shot)) (let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) (set! (-> v1-7 prim-core collide-as) (collide-spec projectile)) diff --git a/goal_src/jak2/levels/common/metalhead-projectile.gc b/goal_src/jak2/levels/common/metalhead-projectile.gc index eb04890014..80047ae828 100644 --- a/goal_src/jak2/levels/common/metalhead-projectile.gc +++ b/goal_src/jak2/levels/common/metalhead-projectile.gc @@ -496,7 +496,7 @@ ) ) ) - (if (logtest? (-> s5-0 status) (cshape-moving-flags t-surface)) + (if (logtest? (-> s5-0 status) (collide-status touch-surface)) (go (method-of-object arg0 impact)) ) ) @@ -509,9 +509,11 @@ (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) - (the-as (function control-info collide-query vector vector cshape-moving-flags) cshape-reaction-just-move) + (the-as (function control-info collide-query vector vector collide-status) cshape-reaction-just-move) + ) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (set! (-> s5-0 no-reaction) nothing) (set! (-> s5-0 penetrate-using) (penetrate enemy-yellow-shot)) (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) (set! (-> s5-0 total-prims) (the-as uint 3)) @@ -800,7 +802,7 @@ ) (set! (-> v1-1 prim-core collide-as) (collide-spec enemy)) ) - (collide-shape-method-46 (-> self root-override)) + (update-transforms (-> self root-override)) (let ((a1-0 (new 'stack-no-clear 'overlaps-others-params))) (set! (-> a1-0 options) (overlaps-others-options)) (set! (-> a1-0 collide-with-filter) (the-as collide-spec -1)) @@ -845,7 +847,7 @@ (go (method-of-object arg0 impact)) ) ) - (if (logtest? (-> arg0 root-override status) (cshape-moving-flags t-surface)) + (if (logtest? (-> arg0 root-override status) (collide-status touch-surface)) (go (method-of-object arg0 impact)) ) 0 @@ -877,9 +879,11 @@ (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) - (the-as (function control-info collide-query vector vector cshape-moving-flags) gren-cshape-reaction-canister) + (the-as (function control-info collide-query vector vector collide-status) gren-cshape-reaction-canister) + ) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (set! (-> s5-0 no-reaction) nothing) (set! (-> s5-0 penetrate-using) (penetrate enemy-dark-shot)) (let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) (set! (-> v1-7 prim-core collide-as) (collide-spec projectile)) diff --git a/test/decompiler/reference/jak2/engine/collide/collide-cache-h_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-cache-h_REF.gc index 5b802e2616..ef8de23ff7 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-cache-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-cache-h_REF.gc @@ -1,5 +1,7 @@ +;;-*-Lisp-*- (in-package goal) +;; definition of type collide-puss-sphere (deftype collide-puss-sphere (structure) ((bsphere sphere :inline :offset-assert 0) (bbox4w bounding-box4w :inline :offset-assert 16) @@ -9,6 +11,7 @@ :flag-assert #x900000030 ) +;; definition for method 3 of type collide-puss-sphere (defmethod inspect collide-puss-sphere ((obj collide-puss-sphere)) (when (not obj) (set! obj obj) @@ -21,6 +24,7 @@ obj ) +;; definition of type collide-puss-work (deftype collide-puss-work (structure) ((closest-pt vector :inline :offset-assert 0) (tri-normal vector :inline :offset-assert 16) @@ -37,6 +41,7 @@ ) ) +;; definition for method 3 of type collide-puss-work (defmethod inspect collide-puss-work ((obj collide-puss-work)) (when (not obj) (set! obj obj) @@ -52,6 +57,7 @@ obj ) +;; definition of type collide-cache-tri (deftype collide-cache-tri (structure) ((vertex vector 3 :inline :offset-assert 0) (extra-quad uint8 16 :offset-assert 48) @@ -66,6 +72,7 @@ :flag-assert #x900000040 ) +;; definition for method 3 of type collide-cache-tri (defmethod inspect collide-cache-tri ((obj collide-cache-tri)) (when (not obj) (set! obj obj) @@ -83,6 +90,7 @@ obj ) +;; definition of type collide-cache-prim (deftype collide-cache-prim (structure) ((prim-core collide-prim-core :inline :offset-assert 0) (extra-quad uint8 16 :offset-assert 32) @@ -100,11 +108,12 @@ :size-assert #x30 :flag-assert #xb00000030 (:methods - (collide-cache-prim-method-9 () none 9) - (collide-cache-prim-method-10 () none 10) + (resolve-moving-sphere-tri (_type_ collide-tri-result collide-prim-core vector float collide-action) float 9) + (resolve-moving-sphere-sphere (_type_ collide-tri-result collide-prim-core vector float collide-action) float 10) ) ) +;; definition for method 3 of type collide-cache-prim (defmethod inspect collide-cache-prim ((obj collide-cache-prim)) (when (not obj) (set! obj obj) @@ -126,6 +135,7 @@ obj ) +;; definition of type collide-cache (deftype collide-cache (basic) ((num-tris int32 :offset-assert 4) (num-tris-u32 uint32 :offset 4) @@ -144,7 +154,7 @@ :size-assert #x8670 :flag-assert #x1a00008670 (:methods - (collide-cache-method-9 () none 9) + (debug-draw (_type_) none 9) (fill-and-probe-using-line-sphere (_type_ collide-query) float 10) (fill-and-probe-using-spheres (_type_ collide-query) symbol 11) (fill-using-bounding-box (_type_ collide-query) none 12) @@ -164,6 +174,7 @@ ) ) +;; definition for method 3 of type collide-cache (defmethod inspect collide-cache ((obj collide-cache)) (when (not obj) (set! obj obj) @@ -184,6 +195,7 @@ obj ) +;; definition of type collide-list-item (deftype collide-list-item (structure) ((mesh instance-tie :offset-assert 0) (inst basic :offset-assert 4) @@ -194,6 +206,7 @@ :flag-assert #x900000008 ) +;; definition for method 3 of type collide-list-item (defmethod inspect collide-list-item ((obj collide-list-item)) (when (not obj) (set! obj obj) @@ -206,6 +219,7 @@ obj ) +;; definition of type collide-list (deftype collide-list (structure) ((num-items int32 :offset-assert 0) (items collide-list-item 256 :inline :offset 16) @@ -215,6 +229,7 @@ :flag-assert #x900000810 ) +;; definition for method 3 of type collide-list (defmethod inspect collide-list ((obj collide-list)) (when (not obj) (set! obj obj) @@ -227,10 +242,14 @@ obj ) +;; failed to figure out what this is: (kmemopen global "collide-cache") +;; definition (perm) for symbol *collide-cache*, type collide-cache (define-perm *collide-cache* collide-cache (new 'global 'collide-cache)) +;; definition (perm) for symbol *collide-list*, type collide-list (define-perm *collide-list* collide-list (new 'global 'collide-list)) +;; failed to figure out what this is: (kmemclose) diff --git a/test/decompiler/reference/jak2/engine/collide/collide-edge-grab_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-edge-grab_REF.gc index 249236dce0..803b6a9c5e 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-edge-grab_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-edge-grab_REF.gc @@ -241,7 +241,7 @@ ) (let ((a1-12 (new 'stack-no-clear 'collide-query))) (let ((v1-28 a1-12)) - (set! (-> v1-28 spheres) (-> obj world-player-spheres)) + (set! (-> v1-28 best-dist) (the-as float (-> obj world-player-spheres))) (set! (-> v1-28 num-spheres) (the-as uint 12)) (set! (-> v1-28 collide-with) (-> obj cshape root-prim prim-core collide-with)) (set! (-> v1-28 ignore-process0) #f) @@ -338,7 +338,7 @@ (transform-vectors! s4-0 s5-0 (-> arg0 spec local-player-spheres) 6) (let ((a1-11 (new 'stack-no-clear 'collide-query))) (let ((v1-13 a1-11)) - (set! (-> v1-13 spheres) s5-0) + (set! (-> v1-13 best-dist) (the-as float s5-0)) (set! (-> v1-13 num-spheres) (the-as uint 6)) (set! (-> v1-13 collide-with) (-> arg0 cshape root-prim prim-core collide-with)) (set! (-> v1-13 ignore-process0) #f) @@ -787,7 +787,3 @@ (set! (-> v1-2 touch-hook) nothing) (set! (-> v1-2 active-hook) nothing) ) - - - - diff --git a/test/decompiler/reference/jak2/engine/collide/collide-h_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-h_REF.gc index 324455c2d6..40021a4150 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-h_REF.gc @@ -1,5 +1,7 @@ +;;-*-Lisp-*- (in-package goal) +;; definition of type collide-query (deftype collide-query (structure) ((best-other-tri collide-tri-result :inline :offset-assert 0) (best-my-tri collide-tri-result :inline :offset 0) @@ -46,6 +48,7 @@ :flag-assert #x90000021c ) +;; definition for method 3 of type collide-query (defmethod inspect collide-query ((obj collide-query)) (when (not obj) (set! obj obj) @@ -59,7 +62,7 @@ (format #t "~1Tignore-process1: ~A~%" (-> obj ignore-process1)) (format #t "~1Tignore-pat: ~D~%" (-> obj ignore-pat)) (format #t "~1Tcollide-with: ~D~%" (-> obj collide-with)) - (format #t "~1Toverlay-params[3] @ #x~X~%" (&-> obj spheres)) + (format #t "~1Toverlay-params[3] @ #x~X~%" (&-> obj best-dist)) (format #t "~1Tbbox: #~%" (-> obj bbox)) (format #t "~1Tbbox4w: #~%" (-> obj bbox4w)) (format #t "~1Tbsphere: #~%" (-> obj bsphere)) @@ -69,14 +72,14 @@ (format #t "~1Texit-planes[2] @ #x~X~%" (-> obj exit-planes)) (format #t "~1Tradius: ~f~%" (-> obj radius)) (format #t "~1Tinv-mat: #~%" (-> obj inv-mat)) - (format #t "~1Tspheres: #x~X~%" (-> obj spheres)) + (format #t "~1Tspheres: #x~X~%" (-> obj best-dist)) (format #t "~1Tnum-spheres: ~D~%" (-> obj num-spheres)) (format #t "~1Tsolid-only: ~A~%" (-> obj best-my-prim)) - (format #t "~1Tbest-dist: ~f~%" (the-as float (-> obj spheres))) + (format #t "~1Tbest-dist: ~f~%" (the-as float (-> obj best-dist))) (format #t "~1Tbest-other-prim: ~A~%" (-> obj num-spheres)) (format #t "~1Tbest-my-prim: ~A~%" (-> obj best-my-prim)) (format #t "~1Tmove-vec: #~%" (-> obj move-dist)) - (format #t "~1Tbest-u: ~f~%" (the-as float (-> obj spheres))) + (format #t "~1Tbest-u: ~f~%" (the-as float (-> obj best-dist))) (format #t "~1Taction-mask: ~D~%" (-> obj action-mask)) (format #t "~1Tlocal-box4w: #~%" (-> obj local-box4w)) (format #t "~1Tsearch-box: #~%" (-> obj search-box)) @@ -93,6 +96,8 @@ obj ) +;; definition for symbol *collide-test-flag*, type symbol (define *collide-test-flag* #f) +;; failed to figure out what this is: 0 diff --git a/test/decompiler/reference/jak2/engine/collide/collide-mesh-h_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-mesh-h_REF.gc index ea047b7de1..dd7039f838 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-mesh-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-mesh-h_REF.gc @@ -155,7 +155,7 @@ :size-assert #xbb90 :flag-assert #xd0000bb90 (:methods - (populate-for-prim-mesh (_type_ collide-shape-prim-mesh) none 9) + (populate-for-prim-mesh (_type_ collide-shape-prim-mesh) collide-mesh-cache-entry 9) (is-id? (_type_ int) symbol 10) (next-id! (_type_) uint 11) (allocate! (_type_ int) collide-mesh-cache-entry 12) diff --git a/test/decompiler/reference/jak2/engine/collide/collide-mesh_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-mesh_REF.gc index 2faf91c0aa..d49dbe7fae 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-mesh_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-mesh_REF.gc @@ -274,7 +274,6 @@ ;; definition for method 9 of type collide-mesh-cache ;; INFO: Used lq/sq -;; WARN: Return type mismatch collide-mesh-cache-entry vs none. ;; ERROR: Unsupported inline assembly instruction kind - [pxor v1, v1, a0] ;; ERROR: Unsupported inline assembly instruction kind - [pxor a0, a0, a1] ;; ERROR: Unsupported inline assembly instruction kind - [pxor a0, a0, a1] @@ -355,8 +354,8 @@ ) ) ) + s4-0 ) - (none) ) ;; definition for method 12 of type collide-mesh-cache @@ -669,7 +668,3 @@ #f ) ) - - - - diff --git a/test/decompiler/reference/jak2/engine/collide/collide-shape-h_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-shape-h_REF.gc index 4edd5722d5..7fc057460f 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-shape-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-shape-h_REF.gc @@ -1,16 +1,19 @@ +;;-*-Lisp-*- (in-package goal) +;; definition of type collide-rider (deftype collide-rider (structure) - ((rider-handle handle :offset-assert 0) - (sticky-prim basic :offset-assert 8) - (prim-ry float :offset-assert 12) - (rider-local-pos vector :inline :offset-assert 16) + ((rider-handle handle :offset-assert 0) + (sticky-prim collide-shape-prim :offset-assert 8) + (prim-ry float :offset-assert 12) + (rider-local-pos vector :inline :offset-assert 16) ) :method-count-assert 9 :size-assert #x20 :flag-assert #x900000020 ) +;; definition for method 3 of type collide-rider (defmethod inspect collide-rider ((obj collide-rider)) (when (not obj) (set! obj obj) @@ -25,6 +28,7 @@ obj ) +;; definition of type collide-rider-pool (deftype collide-rider-pool (basic) ((alloc-count int32 :offset-assert 4) (riders collide-rider 20 :inline :offset-assert 16) @@ -33,11 +37,12 @@ :size-assert #x290 :flag-assert #xb00000290 (:methods - (collide-rider-pool-method-9 () none 9) + (add-rider (_type_ handle) collide-rider 9) (prepare (_type_) none 10) ) ) +;; definition for method 3 of type collide-rider-pool (defmethod inspect collide-rider-pool ((obj collide-rider-pool)) (when (not obj) (set! obj obj) @@ -50,6 +55,8 @@ obj ) +;; definition for method 10 of type collide-rider-pool +;; WARN: Return type mismatch int vs none. (defmethod prepare collide-rider-pool ((obj collide-rider-pool)) "Gets this pool ready to be used to allow allocations. This should be called once at the start of every frame." (set! (-> obj alloc-count) 0) @@ -57,6 +64,7 @@ (none) ) +;; definition of type pull-rider-info (deftype pull-rider-info (structure) ((rider collide-rider :offset-assert 0) (rider-cshape collide-shape-moving :offset-assert 4) @@ -68,6 +76,7 @@ :flag-assert #x900000020 ) +;; definition for method 3 of type pull-rider-info (defmethod inspect pull-rider-info ((obj pull-rider-info)) (when (not obj) (set! obj obj) @@ -82,16 +91,22 @@ obj ) +;; failed to figure out what this is: (kmemopen global "collide-lists") +;; definition for symbol *collide-hit-by-player-list*, type engine (define *collide-hit-by-player-list* (new 'global 'engine 'collide-hit-by-player-list 640 connection)) +;; definition for symbol *collide-hit-by-others-list*, type engine (define *collide-hit-by-others-list* (new 'global 'engine 'collide-hit-by-others-list 768 connection)) +;; definition for symbol *collide-player-list*, type engine (define *collide-player-list* (new 'global 'engine 'collide-player-list 32 connection)) +;; failed to figure out what this is: (kmemclose) +;; definition of type overlaps-others-params (deftype overlaps-others-params (structure) ((options overlaps-others-options :offset-assert 0) (collide-with-filter collide-spec :offset-assert 4) @@ -105,6 +120,7 @@ :flag-assert #x900000018 ) +;; definition for method 3 of type overlaps-others-params (defmethod inspect overlaps-others-params ((obj overlaps-others-params)) (when (not obj) (set! obj obj) @@ -121,6 +137,7 @@ obj ) +;; definition of type move-above-ground-params (deftype move-above-ground-params (structure) ((gnd-collide-with collide-spec :offset-assert 0) (popup float :offset-assert 4) @@ -139,6 +156,7 @@ :flag-assert #x90000006c ) +;; definition for method 3 of type move-above-ground-params (defmethod inspect move-above-ground-params ((obj move-above-ground-params)) (when (not obj) (set! obj obj) @@ -160,6 +178,7 @@ obj ) +;; definition of type collide-prim-core (deftype collide-prim-core (structure) ((world-sphere vector :inline :offset-assert 0) (collide-as collide-spec :offset-assert 16) @@ -174,6 +193,7 @@ :flag-assert #x900000020 ) +;; definition for method 3 of type collide-prim-core (defmethod inspect collide-prim-core ((obj collide-prim-core)) (when (not obj) (set! obj obj) @@ -191,6 +211,7 @@ obj ) +;; definition of type collide-shape-prim (deftype collide-shape-prim (basic) ((cshape collide-shape :offset-assert 4) (prim-id uint32 :offset-assert 8) @@ -211,20 +232,21 @@ :flag-assert #x1400000050 (:methods (new (symbol type collide-shape uint int) _type_ 0) - (collide-shape-prim-method-9 () none 9) + (debug-draw (_type_) none 9) (add-fg-prim-using-box () none 10) (add-fg-prim-using-line-sphere () none 11) - (collide-shape-prim-method-12 () none 12) - (collide-shape-prim-method-13 () none 13) + (overlaps-others-test (_type_ overlaps-others-params collide-shape-prim) symbol 12) + (overlaps-others-group (_type_ overlaps-others-params collide-shape-prim-group) symbol 13) (collide-shape-prim-method-14 () none 14) - (collide-shape-prim-method-15 () none 15) - (collide-shape-prim-method-16 () none 16) - (collide-shape-prim-method-17 () none 17) - (collide-shape-prim-method-18 () none 18) - (collide-shape-prim-method-19 () none 19) + (collide-with-collide-cache-prim-mesh (_type_ collide-query collide-cache-prim) none 15) + (collide-with-collide-cache-prim-sphere (_type_ collide-query collide-cache-prim) none 16) + (on-platform-test (_type_ collide-shape-prim collide-query float) none 17) + (should-push-away-test (_type_ collide-shape-prim collide-query) none 18) + (should-push-away-a-group-test (_type_ collide-shape-prim-group collide-query) none 19) ) ) +;; definition for method 3 of type collide-shape-prim (defmethod inspect collide-shape-prim ((obj collide-shape-prim)) (when (not obj) (set! obj obj) @@ -470,6 +492,7 @@ obj ) +;; definition of type collide-shape-prim-sphere (deftype collide-shape-prim-sphere (collide-shape-prim) ((pat pat-surface :offset 64) (nav-radius float :offset 68) @@ -482,6 +505,7 @@ ) ) +;; definition for method 3 of type collide-shape-prim-sphere (defmethod inspect collide-shape-prim-sphere ((obj collide-shape-prim-sphere)) (when (not obj) (set! obj obj) @@ -729,6 +753,7 @@ obj ) +;; definition of type collide-shape-prim-mesh (deftype collide-shape-prim-mesh (collide-shape-prim) ((mesh collide-mesh :offset 64) (mesh-id int32 :offset 68) @@ -743,6 +768,7 @@ ) ) +;; definition for method 3 of type collide-shape-prim-mesh (defmethod inspect collide-shape-prim-mesh ((obj collide-shape-prim-mesh)) (when (not obj) (set! obj obj) @@ -992,6 +1018,7 @@ obj ) +;; definition of type collide-shape-prim-group (deftype collide-shape-prim-group (collide-shape-prim) ((num-children uint8 :offset 64) (num-alloc-children uint8 :offset 65) @@ -1005,6 +1032,7 @@ ) ) +;; definition for method 3 of type collide-shape-prim-group (defmethod inspect collide-shape-prim-group ((obj collide-shape-prim-group)) (when (not obj) (set! obj obj) @@ -1253,24 +1281,25 @@ obj ) +;; definition of type collide-shape (deftype collide-shape (trsqv) - ((actor-hash-index int16 :offset 12) - (process process-drawable :offset-assert 140) - (max-iteration-count uint8 :offset-assert 144) - (nav-flags nav-flags :offset-assert 145) - (total-prims uint8 :offset-assert 146) - (num-riders uint8 :offset-assert 147) - (pat-ignore-mask pat-surface :offset-assert 148) - (event-self symbol :offset-assert 152) - (event-other symbol :offset-assert 156) - (root-prim collide-shape-prim :offset-assert 160) - (riders pointer :offset-assert 164) - (penetrate-using penetrate :offset-assert 168) - (penetrated-by penetrate :offset-assert 176) - (backup-collide-as collide-spec :offset-assert 184) - (backup-collide-with collide-spec :offset-assert 188) - (event-priority uint8 :offset-assert 192) - (rider-max-momentum float :offset-assert 196) + ((actor-hash-index int16 :offset 12) + (process process-drawable :offset-assert 140) + (max-iteration-count uint8 :offset-assert 144) + (nav-flags nav-flags :offset-assert 145) + (total-prims uint8 :offset-assert 146) + (num-riders uint8 :offset-assert 147) + (pat-ignore-mask pat-surface :offset-assert 148) + (event-self symbol :offset-assert 152) + (event-other symbol :offset-assert 156) + (root-prim collide-shape-prim :offset-assert 160) + (riders (inline-array collide-rider) :offset-assert 164) + (penetrate-using penetrate :offset-assert 168) + (penetrated-by penetrate :offset-assert 176) + (backup-collide-as collide-spec :offset-assert 184) + (backup-collide-with collide-spec :offset-assert 188) + (event-priority uint8 :offset-assert 192) + (rider-max-momentum float :offset-assert 196) ) :method-count-assert 55 :size-assert #xc8 @@ -1278,35 +1307,36 @@ (:methods (new (symbol type process-drawable collide-list-enum) _type_ 0) (move-by-vector! (_type_ vector) none 28) - (collide-shape-method-29 (_type_ vector) none 29) - (collide-shape-method-30 () none 30) - (collide-shape-method-31 () none 31) - (collide-shape-method-32 (_type_ vector collide-query meters) none 32) - (collide-shape-method-33 () none 33) - (collide-shape-method-34 () none 34) - (collide-shape-method-35 () none 35) - (collide-shape-method-36 () none 36) - (collide-shape-method-37 (_type_ vector) none 37) - (collide-shape-method-38 () none 38) - (collide-shape-method-39 () none 39) + (move-to-point! (_type_ vector) none 29) + (debug-draw (_type_) none 30) + (fill-cache-for-shape (_type_ float collide-query) none 31) + (fill-cache-integrate-and-collide (_type_ vector collide-query meters) none 32) + (find-prim-by-id (_type_ uint) collide-shape-prim 33) + (find-prim-by-id-logtest (_type_ uint) collide-shape-prim 34) + (detect-riders! (_type_) symbol 35) + (build-bounding-box-for-shape (_type_ bounding-box float collide-spec) symbol 36) + (integrate-and-collide! (_type_ vector) none 37) + (find-collision-meshes (_type_) none 38) + (on-platform (_type_ collide-shape collide-query) symbol 39) (find-overlapping-shapes (_type_ overlaps-others-params) symbol 40) - (collide-shape-method-41 () none 41) - (collide-shape-method-42 () none 42) - (collide-shape-method-43 () none 43) - (collide-shape-method-44 () none 44) - (collide-shape-method-45 () none 45) - (collide-shape-method-46 (_type_) none 46) + (shove-to-closest-point-on-path (_type_ attack-info float) vector 41) + (should-push-away (_type_ collide-shape collide-query) symbol 42) + (pull-rider! (_type_ pull-rider-info) none 43) + (pull-riders! (_type_) symbol 44) + (do-push-aways (_type_) collide-spec 45) + (update-transforms (_type_) none 46) (set-collide-with! (_type_ collide-spec) none 47) (set-collide-as! (_type_ collide-spec) none 48) - (collide-shape-method-49 (_type_ int int int) none 49) - (collide-shape-method-50 (_type_ process object float float float) none 50) - (collide-shape-method-51 (_type_) none 51) + (modify-collide-as! (_type_ int collide-spec collide-spec) none 49) + (send-shoves (_type_ process touching-shapes-entry float float float) symbol 50) + (above-ground? (_type_ collide-query vector object float float float) symbol 51) (water-info-init! (_type_ water-info collide-action) water-info 52) - (collide-shape-method-53 (_type_) none 53) - (collide-shape-method-54 (_type_) none 54) + (iterate-prims (_type_ (function collide-shape-prim none)) none 53) + (pusher-init (_type_) none 54) ) ) +;; definition for method 3 of type collide-shape (defmethod inspect collide-shape ((obj collide-shape)) (when (not obj) (set! obj obj) @@ -1550,57 +1580,59 @@ obj ) +;; definition of type collide-shape-moving (deftype collide-shape-moving (collide-shape) - ((rider-time time-frame :offset-assert 200) - (rider-last-move vector :inline :offset-assert 208) - (trans-old vector :inline :offset-assert 224) - (csm-unk-vec-981i2u312 vector :inline :offset 240) - (csm-unk-vec-klj1n23 vector :inline :offset 256) - (poly-pat pat-surface :offset 272) - (cur-pat pat-surface :offset-assert 276) - (ground-pat pat-surface :offset-assert 280) - (status cshape-moving-flags :offset-assert 288) - (old-status cshape-moving-flags :offset-assert 296) - (prev-status cshape-moving-flags :offset-assert 304) - (reaction-flag cshape-reaction-flags :offset-assert 312) - (reaction (function control-info collide-query vector vector cshape-moving-flags) :offset-assert 316) - (no-reaction function :offset-assert 320) - (local-normal vector :inline :offset-assert 336) - (surface-normal vector :inline :offset-assert 352) - (poly-normal vector :inline :offset-assert 368) - (ground-poly-normal vector :inline :offset-assert 384) - (gspot-pos vector :inline :offset-assert 400) - (gspot-normal vector :inline :offset-assert 416) - (grount-touch-point vector :inline :offset-assert 432) - (ground-impact-vel meters :offset-assert 448) - (surface-angle float :offset-assert 452) - (poly-angle float :offset-assert 456) - (touch-angle float :offset-assert 460) - (coverage float :offset-assert 464) - (dynam dynamics :offset-assert 468) - (surf surface :offset-assert 472) + ((rider-time time-frame :offset-assert 200) + (rider-last-move vector :inline :offset-assert 208) + (trans-old vector :inline :offset-assert 224) + (trans-old-old vector :inline :offset 240) + (trans-old-old-old vector :inline :offset 256) + (poly-pat pat-surface :offset 272) + (cur-pat pat-surface :offset-assert 276) + (ground-pat pat-surface :offset-assert 280) + (status collide-status :offset-assert 288) + (old-status collide-status :offset-assert 296) + (prev-status collide-status :offset-assert 304) + (reaction-flag cshape-reaction-flags :offset-assert 312) + (reaction (function control-info collide-query vector vector collide-status) :offset-assert 316) + (no-reaction (function collide-shape-moving collide-query vector vector object) :offset-assert 320) + (local-normal vector :inline :offset-assert 336) + (surface-normal vector :inline :offset-assert 352) + (poly-normal vector :inline :offset-assert 368) + (ground-poly-normal vector :inline :offset-assert 384) + (gspot-pos vector :inline :offset-assert 400) + (gspot-normal vector :inline :offset-assert 416) + (grount-touch-point vector :inline :offset-assert 432) + (ground-impact-vel meters :offset-assert 448) + (surface-angle float :offset-assert 452) + (poly-angle float :offset-assert 456) + (touch-angle float :offset-assert 460) + (coverage float :offset-assert 464) + (dynam dynamics :offset-assert 468) + (surf surface :offset-assert 472) ) :method-count-assert 68 :size-assert #x1dc :flag-assert #x44000001dc (:methods (new (symbol type process-drawable collide-list-enum) _type_ 0) - (collide-shape-moving-method-55 (_type_ collide-query collide-spec float float float) symbol 55) - (collide-shape-moving-method-56 (_type_ pat-surface) none 56) - (collide-shape-moving-method-57 () none 57) - (collide-shape-moving-method-58 (_type_ vector overlaps-others-params) symbol 58) - (collide-shape-moving-method-59 () none 59) - (collide-shape-moving-method-60 () none 60) - (collide-shape-moving-method-61 () none 61) + (find-ground (_type_ collide-query collide-spec float float float) symbol 55) + (react-to-pat! (_type_ pat-surface) none 56) + (integrate-no-collide! (_type_ vector) none 57) + (integrate-for-enemy-no-mtg (_type_ vector overlaps-others-params) symbol 58) + (move-above-ground (_type_ vector move-above-ground-params) none 59) + (move-to-ground (_type_ float float symbol collide-spec) none 60) + (move-to-ground-point (_type_ vector vector vector) none 61) (compute-acc-due-to-gravity (_type_ vector float) vector 62) (collide-shape-moving-method-63 () none 63) - (collide-shape-moving-method-64 () none 64) - (collide-shape-moving-method-65 (_type_ vector float float float) symbol 65) - (collide-shape-moving-method-66 () none 66) + (try-snap-to-surface (_type_ vector float float float) symbol 64) + (fill-and-try-snap-to-surface (_type_ vector float float float collide-query) symbol 65) + (step-collison! (_type_ vector vector float int) float 66) (collide-shape-moving-method-67 () none 67) ) ) +;; definition for method 3 of type collide-shape-moving (defmethod inspect collide-shape-moving ((obj collide-shape-moving)) (when (not obj) (set! obj obj) @@ -1870,6 +1902,7 @@ obj ) +;; definition for method 0 of type collide-shape-prim (defmethod new collide-shape-prim ((allocation symbol) (type-to-make type) (arg0 collide-shape) (arg1 uint) (arg2 int)) (let ((v0-0 (object-new allocation type-to-make arg2))) (set! (-> v0-0 cshape) arg0) @@ -1883,6 +1916,8 @@ ) ) +;; definition for method 0 of type collide-shape-prim-sphere +;; WARN: Return type mismatch collide-shape-prim vs collide-shape-prim-sphere. (defmethod new collide-shape-prim-sphere ((allocation symbol) (type-to-make type) (arg0 collide-shape) (arg1 uint)) (let ((v0-0 ((method-of-type collide-shape-prim new) allocation type-to-make arg0 arg1 80))) (set! (-> (the-as collide-shape-prim-sphere v0-0) pat) @@ -1893,6 +1928,8 @@ ) ) +;; definition for method 0 of type collide-shape-prim-mesh +;; WARN: Return type mismatch collide-shape-prim vs collide-shape-prim-mesh. (defmethod new collide-shape-prim-mesh ((allocation symbol) (type-to-make type) (arg0 collide-shape) (arg1 uint) (arg2 uint)) (let ((v0-0 ((method-of-type collide-shape-prim new) allocation type-to-make arg0 arg2 80))) (set! (-> (the-as collide-shape-prim-mesh v0-0) mesh) #f) @@ -1903,6 +1940,8 @@ ) ) +;; definition for method 0 of type collide-shape-prim-group +;; WARN: Return type mismatch collide-shape-prim vs collide-shape-prim-group. (defmethod new collide-shape-prim-group ((allocation symbol) (type-to-make type) (arg0 collide-shape) (arg1 uint) (arg2 int)) (let ((v0-0 ((method-of-type collide-shape-prim new) allocation type-to-make arg0 (the-as uint arg2) 80))) (set! (-> (the-as collide-shape-prim-group v0-0) num-children) arg1) @@ -1915,10 +1954,13 @@ ) ) +;; definition for method 4 of type collide-shape-prim-group +;; WARN: Return type mismatch uint8 vs int. (defmethod length collide-shape-prim-group ((obj collide-shape-prim-group)) (the-as int (-> obj num-children)) ) +;; definition for method 0 of type collide-shape (defmethod new collide-shape ((allocation symbol) (type-to-make type) (arg0 process-drawable) (arg1 collide-list-enum)) (let ((s5-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (set! (-> s5-0 actor-hash-index) -1) @@ -1927,7 +1969,7 @@ (set! (-> s5-0 nav-flags) (nav-flags nav-flags0)) (set! (-> s5-0 event-self) #f) (set! (-> s5-0 event-other) #f) - (set! (-> s5-0 riders) (the-as pointer #f)) + (set! (-> s5-0 riders) (the-as (inline-array collide-rider) #f)) (set! (-> s5-0 root-prim) #f) (set! (-> s5-0 penetrate-using) (penetrate)) (set! (-> s5-0 penetrated-by) (penetrate)) @@ -1967,6 +2009,9 @@ ) ) +;; definition for method 0 of type collide-shape-moving +;; INFO: Used lq/sq +;; WARN: Return type mismatch collide-shape vs collide-shape-moving. (defmethod new collide-shape-moving ((allocation symbol) (type-to-make type) (arg0 process-drawable) (arg1 collide-list-enum)) (let ((v0-0 ((method-of-type collide-shape new) allocation type-to-make arg0 arg1))) (set! (-> (the-as collide-shape-moving v0-0) gspot-pos y) -40959590.0) @@ -1976,6 +2021,7 @@ ) ) +;; definition for symbol *collide-shape-prim-backgnd*, type collide-shape-prim-mesh (define *collide-shape-prim-backgnd* (new 'static 'collide-shape-prim-mesh :cshape #f :prim-core (new 'static 'collide-prim-core @@ -1989,6 +2035,7 @@ ) ) +;; definition for symbol *collide-shape-prim-water*, type collide-shape-prim-mesh (define *collide-shape-prim-water* (new 'static 'collide-shape-prim-mesh :cshape #f :prim-core (new 'static 'collide-prim-core @@ -2002,6 +2049,8 @@ ) ) +;; definition (perm) for symbol *collide-rider-pool*, type collide-rider-pool (define-perm *collide-rider-pool* collide-rider-pool (new 'global 'collide-rider-pool)) +;; failed to figure out what this is: 0 diff --git a/test/decompiler/reference/jak2/engine/collide/collide-shape-rider_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-shape-rider_REF.gc new file mode 100644 index 0000000000..069d9a8a1f --- /dev/null +++ b/test/decompiler/reference/jak2/engine/collide/collide-shape-rider_REF.gc @@ -0,0 +1,438 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 39 of type collide-shape +(defmethod on-platform collide-shape ((obj collide-shape) (arg0 collide-shape) (arg1 collide-query)) + (let ((v1-0 arg1)) + (set! (-> v1-0 best-dist) 0.0) + (set! (-> v1-0 best-my-prim) #f) + (set! (-> v1-0 num-spheres) (the-as uint #f)) + ) + (set! (-> arg1 best-dist) 122.88) + (let ((s5-0 (-> obj root-prim)) + (s4-0 (-> arg0 root-prim)) + ) + (when (and (logtest? (-> s5-0 prim-core collide-with) (-> s4-0 prim-core collide-as)) + (logtest? (-> s5-0 prim-core action) (collide-action rideable)) + (logtest? (-> s4-0 prim-core action) (collide-action can-ride)) + ) + (let ((f0-4 (- (- (vector-vector-distance (the-as vector (-> s5-0 prim-core)) (the-as vector (-> s4-0 prim-core))) + (-> s5-0 prim-core world-sphere w) + ) + (-> s4-0 prim-core world-sphere w) + ) + ) + ) + (if (< f0-4 122.88) + (on-platform-test s5-0 s4-0 arg1 f0-4) + ) + ) + ) + ) + (< (-> arg1 best-dist) 122.88) + ) + +;; definition for method 17 of type collide-shape-prim +;; WARN: Return type mismatch object vs none. +(defmethod on-platform-test collide-shape-prim ((obj collide-shape-prim) (arg0 collide-shape-prim) (arg1 collide-query) (arg2 float)) + (format 0 "ERROR: collide-shape-prim::on-platform-test was called illegally!~%") + (none) + ) + +;; definition for method 17 of type collide-shape-prim-group +;; WARN: Return type mismatch int vs none. +(defmethod on-platform-test collide-shape-prim-group ((obj collide-shape-prim-group) (arg0 collide-shape-prim) (arg1 collide-query) (arg2 float)) + (let ((s4-0 (-> arg0 prim-core collide-as)) + (s3-0 (-> obj child 0)) + ) + (countdown (s2-0 (the-as uint (-> obj num-children))) + (when (and (logtest? (-> s3-0 prim-core collide-with) s4-0) + (logtest? (-> s3-0 prim-core action) (collide-action rideable)) + ) + (let ((f0-2 (- (- (vector-vector-distance (the-as vector (-> s3-0 prim-core)) (the-as vector (-> arg0 prim-core))) + (-> s3-0 prim-core world-sphere w) + ) + (-> arg0 prim-core world-sphere w) + ) + ) + ) + (if (< f0-2 122.88) + (on-platform-test s3-0 arg0 arg1 f0-2) + ) + ) + ) + (&+! s3-0 80) + ) + ) + 0 + (none) + ) + +;; definition for method 17 of type collide-shape-prim-mesh +;; INFO: Used lq/sq +;; WARN: Return type mismatch pat-surface vs none. +(defmethod on-platform-test collide-shape-prim-mesh ((obj collide-shape-prim-mesh) (arg0 collide-shape-prim) (arg1 collide-query) (arg2 float)) + (case (-> arg0 type) + ((collide-shape-prim-group) + (let ((s4-0 (-> obj prim-core collide-with)) + (s3-0 (-> (the-as collide-shape-prim-group arg0) child 0)) + (s2-1 (the-as object (-> (the-as collide-shape-prim-group arg0) num-children))) + ) + (while (nonzero? (the-as uint s2-1)) + (set! s2-1 (+ (the-as uint s2-1) -1)) + (when (and (logtest? s4-0 (-> s3-0 prim-core collide-as)) + (logtest? (-> s3-0 prim-core action) (collide-action can-ride)) + ) + (let ((f0-2 (- (- (vector-vector-distance (the-as vector (-> obj prim-core)) (the-as vector (-> s3-0 prim-core))) + (-> obj prim-core world-sphere w) + ) + (-> s3-0 prim-core world-sphere w) + ) + ) + ) + (if (< f0-2 122.88) + (on-platform-test obj s3-0 arg1 f0-2) + ) + ) + ) + (&+! s3-0 80) + ) + ) + ) + ((collide-shape-prim-sphere) + (let ((s3-1 (-> obj mesh))) + (when s3-1 + (let ((v1-13 (populate-for-prim-mesh *collide-mesh-cache* obj))) + (when v1-13 + (let* ((s4-1 (new 'stack-no-clear 'collide-tri-result)) + (f0-4 (sphere-on-platform-test + s3-1 + (the-as collide-mesh-cache-tri (-> v1-13 tris)) + s4-1 + (the-as vector (-> arg0 prim-core)) + (-> arg1 best-dist) + ) + ) + ) + (when (< f0-4 (-> arg1 best-dist)) + (set! (-> arg1 best-dist) f0-4) + (set! (-> arg1 best-my-prim) obj) + (set! (-> arg1 num-spheres) (the-as uint arg0)) + (set! (-> arg1 best-other-tri vertex 0 quad) (-> s4-1 vertex 0 quad)) + (set! (-> arg1 best-other-tri vertex 1 quad) (-> s4-1 vertex 1 quad)) + (set! (-> arg1 best-other-tri vertex 2 quad) (-> s4-1 vertex 2 quad)) + (set! (-> arg1 best-other-tri intersect quad) (-> s4-1 intersect quad)) + (set! (-> arg1 best-other-tri normal quad) (-> s4-1 normal quad)) + (set! (-> arg1 best-other-tri pat) (-> s4-1 pat)) + ) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for method 9 of type collide-rider-pool +(defmethod add-rider collide-rider-pool ((obj collide-rider-pool) (arg0 handle)) + (let ((v1-0 (-> obj alloc-count))) + (cond + ((< v1-0 20) + (let ((v0-0 (-> obj riders v1-0))) + (set! (-> obj alloc-count) (+ v1-0 1)) + (set! (-> v0-0 rider-handle) arg0) + (set! (-> v0-0 sticky-prim) #f) + v0-0 + ) + ) + (else + (format 0 "ERROR: *collide-rider-pool*: exceeded max # of riders!~%") + (the-as collide-rider #f) + ) + ) + ) + ) + +;; definition for method 35 of type collide-shape +;; WARN: Return type mismatch joint-control-status vs symbol. +(defmethod detect-riders! collide-shape ((obj collide-shape)) + (local-vars (v0-7 joint-control-status) (a2-5 float) (a2-12 float)) + (rlet ((vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + ) + (set! (-> obj num-riders) (the-as uint 0)) + (set! (-> obj riders) (the-as (inline-array collide-rider) #f)) + (let* ((s4-0 (-> obj root-prim)) + (s5-0 (-> s4-0 prim-core collide-with)) + ) + (set! *actor-list-length* 0) + (if (logtest? s5-0 (collide-spec hit-by-others-list)) + (set! *actor-list-length* + (fill-actor-list-for-sphere *actor-hash* (the-as sphere (-> s4-0 prim-core)) *actor-list* 256) + ) + ) + (when (logtest? s5-0 (collide-spec player-list)) + (let ((a0-2 (-> *collide-player-list* alive-list next0))) + *collide-player-list* + (let ((v1-11 (-> a0-2 next0))) + (while (!= a0-2 (-> *collide-player-list* alive-list-end)) + (let* ((a0-3 (-> (the-as connection a0-2) param1)) + (a1-1 (-> (the-as collide-shape a0-3) root-prim)) + ) + (when (logtest? s5-0 (-> a1-1 prim-core collide-as)) + (let ((a1-2 (-> a1-1 prim-core))) + (let ((a2-4 a1-2) + (a3-1 (-> s4-0 prim-core)) + ) + (.lvf vf2 (&-> a2-4 world-sphere quad)) + (.lvf vf3 (&-> a3-1 world-sphere quad)) + ) + (.sub.vf vf1 vf3 vf2) + (.mul.vf vf1 vf1 vf1) + (.add.y.vf vf1 vf1 vf1 :mask #b1) + (.add.z.vf vf1 vf1 vf1 :mask #b1) + (.mov a2-5 vf1) + (let ((f0-0 a2-5) + (f1-1 (+ (-> a1-2 world-sphere w) (-> s4-0 prim-core world-sphere w))) + ) + (when (< f0-0 (* f1-1 f1-1)) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-3)) + (set! *actor-list-length* (+ *actor-list-length* 1)) + ) + ) + ) + ) + ) + ) + (set! a0-2 v1-11) + *collide-player-list* + (set! v1-11 (-> v1-11 next0)) + ) + ) + ) + ) + (when (logtest? s5-0 (collide-spec hit-by-player-list)) + (let ((a0-5 (-> *collide-hit-by-player-list* alive-list next0))) + *collide-hit-by-player-list* + (let ((v1-19 (-> a0-5 next0))) + (while (!= a0-5 (-> *collide-hit-by-player-list* alive-list-end)) + (let* ((a0-6 (-> (the-as connection a0-5) param1)) + (a1-13 (-> (the-as collide-shape a0-6) root-prim)) + ) + (when (logtest? s5-0 (-> a1-13 prim-core collide-as)) + (let ((a1-14 (-> a1-13 prim-core))) + (let ((a2-11 a1-14) + (a3-2 (-> s4-0 prim-core)) + ) + (.lvf vf2 (&-> a2-11 world-sphere quad)) + (.lvf vf3 (&-> a3-2 world-sphere quad)) + ) + (.sub.vf vf1 vf3 vf2) + (.mul.vf vf1 vf1 vf1) + (.add.y.vf vf1 vf1 vf1 :mask #b1) + (.add.z.vf vf1 vf1 vf1 :mask #b1) + (.mov a2-12 vf1) + (let ((f0-1 a2-12) + (f1-5 (+ (-> a1-14 world-sphere w) (-> s4-0 prim-core world-sphere w))) + ) + (when (< f0-1 (* f1-5 f1-5)) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) + (set! *actor-list-length* (+ *actor-list-length* 1)) + ) + ) + ) + ) + ) + ) + (set! a0-5 v1-19) + *collide-hit-by-player-list* + (set! v1-19 (-> v1-19 next0)) + ) + ) + ) + ) + (dotimes (s4-1 *actor-list-length*) + (let* ((s3-0 (-> *actor-list* s4-1)) + (v1-24 (-> s3-0 root-prim)) + ) + (when (logtest? s5-0 (-> v1-24 prim-core collide-as)) + (when (and (logtest? (-> v1-24 prim-core action) (collide-action can-ride)) (!= (-> obj process) (-> s3-0 process))) + (let ((s2-0 (new 'stack-no-clear 'collide-query))) + (when (on-platform obj s3-0 s2-0) + (let ((s5-1 (add-rider *collide-rider-pool* (process->handle (-> s3-0 process))))) + (when s5-1 + (+! (-> obj num-riders) 1) + (if (not (-> obj riders)) + (set! (-> obj riders) (the-as (inline-array collide-rider) s5-1)) + ) + (let ((a0-15 (-> s2-0 best-my-prim))) + (set! (-> s5-1 sticky-prim) a0-15) + (let ((s1-0 (-> obj process node-list data (-> a0-15 transform-index) bone transform))) + (set! (-> s5-1 prim-ry) (matrix-y-angle s1-0)) + (let ((s2-1 (new 'stack-no-clear 'matrix))) + (matrix-4x4-inverse! s2-1 s1-0) + (set! (-> s3-0 trans w) 1.0) + (vector-matrix*! (-> s5-1 rider-local-pos) (-> s3-0 trans) s2-1) + ) + ) + ) + (send-event (-> obj process) 'ridden s5-1) + ) + ) + (set! s5-0 (-> obj root-prim prim-core collide-with)) + ) + ) + ) + ) + ) + ) + ) + (let ((v1-58 (-> obj process skel))) + (the-as + symbol + (when (nonzero? v1-58) + (cond + ((or (> (-> obj num-riders) 0) (logtest? (-> obj root-prim prim-core action) (collide-action edge-grabbed))) + (set! v0-7 (logior (-> v1-58 status) (joint-control-status sync-math))) + (set! (-> v1-58 status) v0-7) + ) + (else + (set! v0-7 (logclear (-> v1-58 status) (joint-control-status sync-math))) + (set! (-> v1-58 status) v0-7) + ) + ) + v0-7 + ) + ) + ) + ) + ) + +;; definition for method 44 of type collide-shape +;; WARN: Return type mismatch int vs symbol. +(defmethod pull-riders! collide-shape ((obj collide-shape)) + (let ((s5-0 (-> obj riders))) + (when s5-0 + (let ((s4-0 (new 'stack-no-clear 'pull-rider-info))) + (countdown (s3-0 (-> obj num-riders)) + (let* ((v1-2 (-> s5-0 s3-0)) + (a0-1 (-> v1-2 rider-handle)) + ) + (when (handle->process a0-1) + (set! (-> s4-0 rider) v1-2) + (set! (-> s4-0 rider-cshape) + (the-as collide-shape-moving (-> (the-as process-drawable (-> a0-1 process 0)) root)) + ) + (let ((a0-5 (-> v1-2 sticky-prim))) + (when a0-5 + (let ((s2-0 (-> obj process node-list data (-> a0-5 transform-index) bone transform))) + (let ((s1-0 (-> s4-0 rider-dest))) + (vector-matrix*! s1-0 (-> v1-2 rider-local-pos) s2-0) + (vector-float*! s1-0 s1-0 (/ 1.0 (-> s1-0 w))) + ) + (set! (-> s4-0 rider-delta-ry) (deg- (matrix-y-angle s2-0) (-> s4-0 rider prim-ry))) + ) + (pull-rider! obj s4-0) + ) + ) + ) + ) + ) + ) + ) + ) + (the-as symbol 0) + ) + +;; definition for method 43 of type collide-shape +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defmethod pull-rider! collide-shape ((obj collide-shape) (arg0 pull-rider-info)) + (local-vars (at-0 int)) + (with-pp + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((gp-0 (-> arg0 rider-cshape))) + (let ((s2-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> s3-0 quad) (-> gp-0 trans quad)) + (vector-! s2-0 (-> arg0 rider-dest) s3-0) + (cond + ((logtest? (-> obj root-prim prim-core action) (collide-action pull-rider-can-collide)) + (let ((s1-0 (-> obj root-prim prim-core collide-as))) + (set! (-> obj root-prim prim-core collide-as) (collide-spec)) + (let ((a2-0 (new 'stack-no-clear 'collide-query))) + (set! (-> a2-0 collide-with) (-> gp-0 root-prim prim-core collide-with)) + (set! (-> a2-0 ignore-process0) (-> gp-0 process)) + (set! (-> a2-0 ignore-process1) #f) + (set! (-> a2-0 ignore-pat) (-> gp-0 pat-ignore-mask)) + (set! (-> a2-0 action-mask) (collide-action solid)) + (fill-cache-for-shape gp-0 (+ 8192.0 (vector-length s2-0)) a2-0) + ) + (set! (-> obj root-prim prim-core collide-as) s1-0) + ) + (let ((s1-1 (new 'stack-no-clear 'vector))) + (set! (-> s1-1 quad) (-> s2-0 quad)) + (let ((v1-19 s1-1)) + (.lvf vf1 (&-> s1-1 quad)) + (let ((f0-2 (-> pp clock frames-per-second))) + (.mov at-0 f0-2) + ) + (.mov vf2 at-0) + (.mov.vf vf1 vf0 :mask #b1000) + (.mul.x.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> v1-19 quad) vf1) + ) + (cond + ((type? gp-0 collide-shape-moving) + (let ((s2-1 (-> gp-0 status))) + (integrate-and-collide! gp-0 s1-1) + (set! (-> gp-0 status) s2-1) + ) + ) + (else + (integrate-and-collide! gp-0 s1-1) + ) + ) + ) + ) + (else + (move-by-vector! gp-0 s2-0) + ) + ) + (when (type? gp-0 collide-shape-moving) + (let ((v1-26 (new 'stack-no-clear 'vector))) + (vector-! v1-26 (-> gp-0 trans) s3-0) + (vector-float*! (-> gp-0 rider-last-move) v1-26 (-> pp clock frames-per-second)) + ) + (let ((f0-4 (vector-length (-> gp-0 rider-last-move)))) + (if (< (-> obj rider-max-momentum) f0-4) + (vector-normalize! (-> gp-0 rider-last-move) (-> obj rider-max-momentum)) + ) + ) + (set! (-> gp-0 rider-time) (-> gp-0 process clock frame-counter)) + ) + ) + (let ((f0-6 (-> arg0 rider-delta-ry))) + (if (!= f0-6 0.0) + (send-event (-> gp-0 process) 'rotate-y-angle f0-6) + ) + ) + ) + (none) + ) + ) + ) + + + + diff --git a/test/decompiler/reference/jak2/engine/collide/collide-shape_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-shape_REF.gc new file mode 100644 index 0000000000..c8ab2703a5 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/collide/collide-shape_REF.gc @@ -0,0 +1,3130 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 54 of type collide-shape +;; WARN: Return type mismatch collide-shape vs none. +(defmethod pusher-init collide-shape ((obj collide-shape)) + (when (logtest? (collide-spec pusher) (-> obj root-prim prim-core collide-as)) + (let ((proc (the-as process-tree (-> obj process)))) + (while (not (logtest? (-> proc mask) (process-mask process-tree))) + (set! proc (ppointer->process (-> proc parent))) + ) + (if (!= proc *pusher-pool*) + (change-parent (-> obj process) *pusher-pool*) + ) + ) + ) + (none) + ) + +;; definition for method 42 of type collide-shape +(defmethod should-push-away collide-shape ((obj collide-shape) (other collide-shape) (cquery collide-query)) + (local-vars (v1-2 uint) (v1-3 float) (a2-2 uint) (a3-2 uint)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + ) + (init-vf0-vector) + (let ((v1-0 cquery)) + (set! (-> v1-0 best-dist) 0.0) + (set! (-> v1-0 best-my-prim) #f) + (set! (-> v1-0 num-spheres) (the-as uint #f)) + ) + (let ((a0-1 (-> obj root-prim)) + (a1-1 (-> other root-prim)) + ) + (let ((a3-0 (-> a0-1 prim-core collide-with)) + (t0-0 (-> a1-1 prim-core collide-as)) + (v1-1 (-> a0-1 prim-core action)) + ) + (let ((a2-1 (-> a1-1 prim-core action))) + (b! (not (logtest? a3-0 t0-0)) cfg-8 :delay (set! a3-2 (the-as uint (logand a2-1 1)))) + (b! (zero? a3-2) cfg-8 :delay (set! a2-2 (the-as uint (logand a2-1 16)))) + ) + (b! (nonzero? a2-2) cfg-8 :delay (set! v1-2 (the-as uint (logand v1-1 1)))) + ) + (b! (zero? v1-2) cfg-8 :delay (nop!)) + (.lvf vf1 (&-> a0-1 prim-core world-sphere quad)) + (.lvf vf2 (&-> a1-1 prim-core world-sphere quad)) + (.sub.vf vf3 vf1 vf2) + (.add.w.vf vf4 vf1 vf2 :mask #b1000) + (.mul.vf vf3 vf3 vf3 :mask #b111) + (.mul.w.vf vf4 vf4 vf4 :mask #b1000) + (.mul.x.vf acc vf0 vf3 :mask #b1000) + (.add.mul.y.vf acc vf0 vf3 acc :mask #b1000) + (.add.mul.z.vf vf3 vf0 vf3 acc :mask #b1000) + (.sub.w.vf vf5 vf3 vf4 :mask #b1000) + (let ((f0-1 0.0)) + (.add.w.vf vf5 vf0 vf5 :mask #b1) + (.mov v1-3 vf5) + (b! (<= f0-1 v1-3) cfg-8) + ) + (should-push-away-test a0-1 a1-1 cquery) + ) + (let ((v0-1 (< (-> cquery best-dist) 0.0))) + (b! #t cfg-9 :delay (nop!)) + (label cfg-8) + (set! v0-1 #f) + (label cfg-9) + v0-1 + ) + ) + ) + +;; definition for method 18 of type collide-shape-prim +;; WARN: Return type mismatch object vs none. +(defmethod should-push-away-test collide-shape-prim ((obj collide-shape-prim) (arg0 collide-shape-prim) (arg1 collide-query)) + (format 0 "ERROR: collide-shape-prim::should-push-away-test was called illegally!~%") + (none) + ) + +;; definition for method 18 of type collide-shape-prim-group +;; WARN: Return type mismatch int vs none. +(defmethod should-push-away-test collide-shape-prim-group ((obj collide-shape-prim-group) (other collide-shape-prim) (cquery collide-query)) + (local-vars (a0-2 collide-action) (a0-3 float) (f0-0 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (nop!) + (let ((s4-0 (the-as collide-shape-prim obj)) + (s3-0 (the-as uint (-> obj num-children))) + ) + (nop!) + (let ((v1-0 (-> other prim-core collide-as))) + (nop!) + (.lvf vf1 (&-> other prim-core world-sphere quad)) + (until (> f0-0 a0-3) + (until (nonzero? a0-2) + (label cfg-1) + (b! (zero? s3-0) cfg-6 :delay (set! s4-0 (+ s4-0 80))) + (+! s3-0 -1) + (let ((a1-1 (-> s4-0 prim-core collide-with))) + (nop!) + (let ((a0-1 (-> s4-0 prim-core action)) + (a1-2 (logand a1-1 v1-0)) + ) + (set! a0-2 (logand a0-1 (collide-action solid))) + (b! (zero? a1-2) cfg-1 :delay (.lvf vf2 (&-> s4-0 prim-core world-sphere quad))) + ) + ) + ) + (.sub.vf vf3 vf2 vf1) + (.add.w.vf vf4 vf2 vf1 :mask #b1000) + (.mul.vf vf3 vf3 vf3 :mask #b111) + (.mul.w.vf vf4 vf4 vf4 :mask #b1000) + (.mul.x.vf acc vf0 vf3 :mask #b1000) + (.add.mul.y.vf acc vf0 vf3 acc :mask #b1000) + (.add.mul.z.vf vf3 vf0 vf3 acc :mask #b1000) + (.sub.w.vf vf3 vf3 vf4 :mask #b1000) + (set! f0-0 0.0) + (.add.w.vf vf3 vf0 vf3 :mask #b1) + (.mov a0-3 vf3) + ) + (should-push-away-test s4-0 other cquery) + (set! v1-0 (-> other prim-core collide-as)) + ) + ) + (b! #t cfg-1 :delay (.lvf vf1 (&-> other prim-core world-sphere quad))) + (label cfg-6) + 0 + (none) + ) + ) + +;; definition for method 19 of type collide-shape-prim +;; WARN: Return type mismatch int vs none. +(defmethod should-push-away-a-group-test collide-shape-prim ((obj collide-shape-prim) (other collide-shape-prim-group) (cquery collide-query)) + (local-vars (a0-2 collide-action) (a0-3 float) (f0-0 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (nop!) + (let ((s4-0 (the-as object other)) + (s3-0 (the-as uint (-> other num-children))) + ) + (nop!) + (let ((v1-0 (-> obj prim-core collide-with))) + (nop!) + (.lvf vf2 (&-> obj prim-core world-sphere quad)) + (until (> f0-0 a0-3) + (until (nonzero? a0-2) + (label cfg-1) + (b! (zero? s3-0) cfg-6 :delay (set! s4-0 (+ (the-as collide-shape-prim s4-0) 80))) + (+! s3-0 -1) + (let ((a1-1 (-> (the-as collide-shape-prim s4-0) prim-core collide-as))) + (nop!) + (let ((a0-1 (-> (the-as collide-shape-prim s4-0) prim-core action)) + (a1-2 (logand v1-0 a1-1)) + ) + (set! a0-2 (logand a0-1 (collide-action solid))) + (b! (zero? a1-2) cfg-1 :delay (.lvf vf1 (&-> (the-as collide-shape-prim s4-0) prim-core world-sphere quad))) + ) + ) + ) + (.sub.vf vf3 vf2 vf1) + (.add.w.vf vf4 vf2 vf1 :mask #b1000) + (.mul.vf vf3 vf3 vf3 :mask #b111) + (.mul.w.vf vf4 vf4 vf4 :mask #b1000) + (.mul.x.vf acc vf0 vf3 :mask #b1000) + (.add.mul.y.vf acc vf0 vf3 acc :mask #b1000) + (.add.mul.z.vf vf3 vf0 vf3 acc :mask #b1000) + (.sub.w.vf vf3 vf3 vf4 :mask #b1000) + (set! f0-0 0.0) + (.add.w.vf vf3 vf0 vf3 :mask #b1) + (.mov a0-3 vf3) + ) + (should-push-away-test obj (the-as collide-shape-prim s4-0) cquery) + (set! v1-0 (-> obj prim-core collide-with)) + ) + ) + (b! #t cfg-1 :delay (.lvf vf2 (&-> obj prim-core world-sphere quad))) + (label cfg-6) + 0 + (none) + ) + ) + +;; definition for method 18 of type collide-shape-prim-mesh +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod should-push-away-test collide-shape-prim-mesh ((obj collide-shape-prim-mesh) (other collide-shape-prim) (cquery collide-query)) + (let ((v1-0 (-> other prim-core prim-type))) + (cond + ((= v1-0 (prim-type group)) + (should-push-away-a-group-test obj (the-as collide-shape-prim-group other) cquery) + ) + (else + (b! (> (the-as int v1-0) 0) cfg-8 :delay (nop!)) + (let ((s2-0 (-> obj mesh))) + (b! (not s2-0) cfg-7 :delay (empty-form)) + (let ((v1-4 (populate-for-prim-mesh *collide-mesh-cache* obj))) + (b! (not v1-4) cfg-7 :delay (empty-form)) + (let ((s5-0 (new 'stack-no-clear 'collide-tri-result))) + (let ((f0-1 (should-push-away-test + s2-0 + (the-as collide-mesh-cache-tri (-> v1-4 tris)) + s5-0 + (the-as vector (-> other prim-core)) + (-> cquery best-dist) + ) + ) + ) + (b! (>= f0-1 (-> cquery best-dist)) cfg-7 :delay #f) + (set! (-> cquery best-dist) f0-1) + ) + (set! (-> cquery best-my-prim) obj) + (set! (-> cquery num-spheres) (the-as uint other)) + (set! (-> cquery best-other-tri vertex 0 quad) (-> s5-0 vertex 0 quad)) + (set! (-> cquery best-other-tri vertex 1 quad) (-> s5-0 vertex 1 quad)) + (set! (-> cquery best-other-tri vertex 2 quad) (-> s5-0 vertex 2 quad)) + (set! (-> cquery best-other-tri intersect quad) (-> s5-0 intersect quad)) + (set! (-> cquery best-other-tri normal quad) (-> s5-0 normal quad)) + (set! (-> cquery best-other-tri pat) (-> s5-0 pat)) + ) + ) + ) + (label cfg-7) + (b! #t cfg-9 :delay (nop!)) + (label cfg-8) + (format 0 "ERROR: Attempted unsupported mesh -> mesh test in collide-shape-prim::should-push-away-test!~%") + ) + ) + ) + (label cfg-9) + 0 + (none) + ) + +;; definition for method 18 of type collide-shape-prim-sphere +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod should-push-away-test collide-shape-prim-sphere ((obj collide-shape-prim-sphere) (other collide-shape-prim) (cquery collide-query)) + (local-vars (v1-3 float)) + (rlet ((acc :class vf) + (Q :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let ((v1-0 (-> other prim-core prim-type))) + (cond + ((= v1-0 (prim-type group)) + (should-push-away-a-group-test obj (the-as collide-shape-prim-group other) cquery) + ) + (else + (b! (> (the-as int v1-0) 0) cfg-5 :delay (nop!)) + (.lvf vf1 (&-> obj prim-core world-sphere quad)) + (.lvf vf2 (&-> other prim-core world-sphere quad)) + (.sub.vf vf3 vf2 vf1 :mask #b111) + (.add.w.vf vf5 vf1 vf2 :mask #b1000) + (.mul.vf vf4 vf3 vf3 :mask #b111) + (.mul.x.vf acc vf0 vf4 :mask #b1000) + (.add.mul.y.vf acc vf0 vf4 acc :mask #b1000) + (.add.mul.z.vf vf4 vf0 vf4 acc :mask #b1000) + (.sqrt.vf Q vf4 :ftf #b11) + (.mov.vf vf3 vf0 :mask #b1000) + (.add.w.vf vf5 vf0 vf5 :mask #b1) + (let ((f2-0 (-> cquery best-dist))) + (.wait.vf) + (nop!) + (.add.vf vf4 vf0 Q :mask #b1) + (.sub.x.vf vf6 vf4 vf5 :mask #b1) + (.mul.x.vf vf3 vf3 vf4 :mask #b111) + (.mov v1-3 vf6) + (let ((f1-0 v1-3)) + (b! (<= f2-0 f1-0) cfg-9) + (let ((v1-4 (-> obj pat))) + (set! (-> cquery best-dist) f1-0) + (set! (-> cquery best-my-prim) obj) + (set! (-> cquery num-spheres) (the-as uint other)) + (.svf (&-> cquery best-other-tri normal quad) vf3) + (set! (-> cquery best-other-tri pat) v1-4) + ) + ) + ) + (let ((s3-0 (-> cquery best-other-tri normal)) + (s4-1 (-> cquery best-other-tri intersect)) + ) + (vector-float*! s4-1 s3-0 (-> obj prim-core world-sphere w)) + (vector+! s4-1 s4-1 (the-as vector (-> obj prim-core))) + (set! (-> cquery best-other-tri vertex 0 quad) (-> s4-1 quad)) + (point-in-plane-<-point+normal! (-> cquery best-other-tri vertex 1) s4-1 s3-0) + (let* ((a0-8 (vector-normalize! + (vector-! + (new 'stack-no-clear 'vector) + (-> cquery best-other-tri vertex 1) + (the-as vector (-> cquery best-other-tri)) + ) + 1.0 + ) + ) + (v1-11 (vector-cross! (new 'stack-no-clear 'vector) s3-0 a0-8)) + (a0-9 (-> cquery best-other-tri vertex 2)) + ) + (let ((a1-7 4096.0)) + (.mov vf7 a1-7) + ) + (.lvf vf5 (&-> v1-11 quad)) + (.lvf vf4 (&-> s4-1 quad)) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> a0-9 quad) vf6) + ) + ) + (b! #t cfg-9 :delay (nop!)) + (label cfg-5) + (let ((s2-0 (-> (the-as collide-shape-prim-mesh other) mesh))) + (when s2-0 + (let ((v1-13 (populate-for-prim-mesh *collide-mesh-cache* (the-as collide-shape-prim-mesh other)))) + (when v1-13 + (let* ((s3-1 (new 'stack-no-clear 'collide-tri-result)) + (f0-3 (should-push-away-test + s2-0 + (the-as collide-mesh-cache-tri (-> v1-13 tris)) + s3-1 + (the-as vector (-> obj prim-core)) + (-> cquery best-dist) + ) + ) + ) + (when (< f0-3 (-> cquery best-dist)) + (set! (-> cquery best-dist) f0-3) + (set! (-> cquery best-my-prim) obj) + (set! (-> cquery num-spheres) (the-as uint other)) + (let ((s4-2 (-> cquery best-other-tri normal))) + (vector-! s4-2 (-> s3-1 intersect) (the-as vector (-> obj prim-core))) + (vector-normalize! s4-2 1.0) + (let ((s3-2 (-> cquery best-other-tri intersect))) + (vector-float*! s3-2 s4-2 (-> obj prim-core world-sphere w)) + (vector+! s3-2 s3-2 (the-as vector (-> obj prim-core))) + (set! (-> cquery best-other-tri vertex 0 quad) (-> s3-2 quad)) + (point-in-plane-<-point+normal! (-> cquery best-other-tri vertex 1) s3-2 s4-2) + (let* ((a0-23 (vector-normalize! + (vector-! + (new 'stack-no-clear 'vector) + (-> cquery best-other-tri vertex 1) + (the-as vector (-> cquery best-other-tri)) + ) + 1.0 + ) + ) + (v1-23 (vector-cross! (new 'stack-no-clear 'vector) s4-2 a0-23)) + (a0-24 (-> cquery best-other-tri vertex 2)) + ) + (let ((a1-18 4096.0)) + (.mov vf7 a1-18) + ) + (.lvf vf5 (&-> v1-23 quad)) + (.lvf vf4 (&-> s3-2 quad)) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> a0-24 quad) vf6) + ) + ) + ) + (set! (-> cquery best-other-tri pat) (-> obj pat)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (label cfg-9) + 0 + (none) + ) + ) + +;; definition for method 15 of type collide-shape-prim +;; WARN: Return type mismatch object vs none. +(defmethod collide-with-collide-cache-prim-mesh collide-shape-prim ((obj collide-shape-prim) (arg0 collide-query) (arg1 collide-cache-prim)) + (format 0 "ERROR: Unsupported prim type in collide-shape-prim::collide-with-collide-cache-prim-mesh!~%") + (none) + ) + +;; definition for method 15 of type collide-shape-prim-sphere +;; WARN: Return type mismatch int vs none. +(defmethod collide-with-collide-cache-prim-mesh collide-shape-prim-sphere ((obj collide-shape-prim-sphere) (arg0 collide-query) (arg1 collide-cache-prim)) + (rlet ((vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + ) + (let* ((gp-0 (new 'stack-no-clear 'collide-tri-result)) + (f0-1 (resolve-moving-sphere-tri + arg1 + gp-0 + (-> obj prim-core) + (-> arg0 move-dist) + (-> arg0 best-dist) + (-> obj prim-core action) + ) + ) + ) + (when (>= f0-1 0.0) + (let ((v1-3 (-> arg1 prim-core action)) + (a0-2 (-> obj prim-core action)) + (a2-2 (-> arg1 prim)) + ) + (let* ((v1-4 (logand a0-2 v1-3)) + (a0-3 (-> obj cshape)) + (a1-2 (logand v1-4 (collide-action solid))) + (v1-5 (-> a2-2 cshape)) + ) + (b! (zero? a1-2) cfg-6 :delay (nop!)) + (b! (= v1-5 #f) cfg-5 :likely-delay (set! a2-2 (the-as collide-shape-prim #f))) + (b! (logtest? (-> a0-3 penetrate-using) (-> v1-5 penetrated-by)) cfg-6 :delay (nop!)) + (label cfg-5) + (.lvf vf3 (&-> gp-0 vertex 0 quad)) + (.lvf vf4 (&-> gp-0 vertex 1 quad)) + (.lvf vf5 (&-> gp-0 vertex 2 quad)) + (.lvf vf1 (&-> gp-0 intersect quad)) + (.lvf vf2 (&-> gp-0 normal quad)) + (let ((a0-6 (-> gp-0 pat)) + (a1-4 (-> gp-0 collide-ptr)) + ) + (set! (-> arg0 best-dist) f0-1) + (.svf (&-> arg0 best-other-tri vertex 0 quad) vf3) + (.svf (&-> arg0 best-other-tri vertex 1 quad) vf4) + (.svf (&-> arg0 best-other-tri vertex 2 quad) vf5) + (.svf (&-> arg0 best-other-tri intersect quad) vf1) + (.svf (&-> arg0 best-other-tri normal quad) vf2) + (set! (-> arg0 best-other-tri pat) a0-6) + (set! (-> arg0 best-other-tri collide-ptr) a1-4) + ) + (set! (-> arg0 num-spheres) (the-as uint a2-2)) + (set! (-> arg0 best-my-prim) obj) + (label cfg-6) + (b! (not v1-5) cfg-8 :delay (empty-form)) + ) + (add-touching-prims + *touching-list* + obj + a2-2 + f0-1 + (the-as collide-tri-result #f) + (the-as collide-tri-result (-> gp-0 vertex)) + ) + ) + ) + ) + (label cfg-8) + 0 + (none) + ) + ) + +;; definition for method 15 of type collide-shape-prim-mesh +;; WARN: Return type mismatch object vs none. +(defmethod collide-with-collide-cache-prim-mesh collide-shape-prim-mesh ((obj collide-shape-prim-mesh) (arg0 collide-query) (arg1 collide-cache-prim)) + (format 0 "ERROR: collide-shape-prim-mesh vs. collide-cache-prim mesh is not currently supported!~%") + (none) + ) + +;; definition for method 15 of type collide-shape-prim-group +;; WARN: Return type mismatch int vs none. +(defmethod collide-with-collide-cache-prim-mesh collide-shape-prim-group ((obj collide-shape-prim-group) (arg0 collide-query) (arg1 collide-cache-prim)) + (let ((s4-0 (-> arg1 prim-core collide-as)) + (s3-0 (-> obj child 0)) + ) + (countdown (s2-0 (the-as uint (-> obj num-children))) + (if (logtest? (-> s3-0 prim-core collide-with) s4-0) + (collide-with-collide-cache-prim-mesh s3-0 arg0 arg1) + ) + (&+! s3-0 80) + ) + ) + 0 + (none) + ) + +;; definition for method 16 of type collide-shape-prim +;; WARN: Return type mismatch object vs none. +(defmethod collide-with-collide-cache-prim-sphere collide-shape-prim ((obj collide-shape-prim) (arg0 collide-query) (arg1 collide-cache-prim)) + (format 0 "ERROR: Unsupported prim type in collide-shape-prim::collide-with-collide-cache-prim-sphere!~%") + (none) + ) + +;; definition for method 16 of type collide-shape-prim-sphere +;; WARN: Return type mismatch int vs none. +(defmethod collide-with-collide-cache-prim-sphere collide-shape-prim-sphere ((obj collide-shape-prim-sphere) (arg0 collide-query) (arg1 collide-cache-prim)) + (rlet ((vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + ) + (let* ((gp-0 (new 'stack-no-clear 'collide-tri-result)) + (f0-1 (resolve-moving-sphere-sphere + arg1 + gp-0 + (-> obj prim-core) + (-> arg0 move-dist) + (-> arg0 best-dist) + (-> arg1 prim-core action) + ) + ) + ) + (b! (< f0-1 0.0) cfg-5 :delay #f) + (let ((v1-3 (-> arg1 prim-core action)) + (a0-2 (-> obj prim-core action)) + (a2-2 (-> arg1 prim)) + ) + (let* ((a0-3 (logand a0-2 v1-3)) + (v1-4 (-> obj cshape)) + (a1-2 (logand a0-3 (collide-action solid))) + (a0-4 (-> a2-2 cshape)) + ) + (b! (zero? a1-2) cfg-4 :delay (nop!)) + (b! (logtest? (-> v1-4 penetrate-using) (-> a0-4 penetrated-by)) cfg-4 :delay (nop!)) + ) + (.lvf vf3 (&-> gp-0 vertex 0 quad)) + (.lvf vf4 (&-> gp-0 vertex 1 quad)) + (.lvf vf5 (&-> gp-0 vertex 2 quad)) + (.lvf vf1 (&-> gp-0 intersect quad)) + (.lvf vf2 (&-> gp-0 normal quad)) + (let ((v1-7 (-> gp-0 pat)) + (a0-6 (-> gp-0 collide-ptr)) + ) + (set! (-> arg0 best-dist) f0-1) + (.svf (&-> arg0 best-other-tri vertex 0 quad) vf3) + (.svf (&-> arg0 best-other-tri vertex 1 quad) vf4) + (.svf (&-> arg0 best-other-tri vertex 2 quad) vf5) + (.svf (&-> arg0 best-other-tri intersect quad) vf1) + (.svf (&-> arg0 best-other-tri normal quad) vf2) + (set! (-> arg0 best-other-tri pat) v1-7) + (set! (-> arg0 best-other-tri collide-ptr) a0-6) + ) + (set! (-> arg0 num-spheres) (the-as uint a2-2)) + (set! (-> arg0 best-my-prim) obj) + (label cfg-4) + (add-touching-prims + *touching-list* + obj + a2-2 + f0-1 + (the-as collide-tri-result #f) + (the-as collide-tri-result (-> gp-0 vertex)) + ) + ) + ) + (label cfg-5) + 0 + (none) + ) + ) + +;; definition for method 16 of type collide-shape-prim-mesh +;; WARN: Return type mismatch object vs none. +(defmethod collide-with-collide-cache-prim-sphere collide-shape-prim-mesh ((obj collide-shape-prim-mesh) (arg0 collide-query) (arg1 collide-cache-prim)) + (format 0 "ERROR: collide-shape-prim-mesh vs. collide-cache-prim sphere is not currently supported!~%") + (none) + ) + +;; definition for method 16 of type collide-shape-prim-group +;; WARN: Return type mismatch int vs none. +(defmethod collide-with-collide-cache-prim-sphere collide-shape-prim-group ((obj collide-shape-prim-group) (arg0 collide-query) (arg1 collide-cache-prim)) + (let ((s4-0 (-> arg1 prim-core collide-as)) + (s3-0 (-> obj child 0)) + ) + (countdown (s2-0 (the-as uint (-> obj num-children))) + (if (logtest? (-> s3-0 prim-core collide-with) s4-0) + (collide-with-collide-cache-prim-sphere s3-0 arg0 arg1) + ) + (&+! s3-0 80) + ) + ) + 0 + (none) + ) + +;; definition for function find-ground-point +;; INFO: Used lq/sq +(defun find-ground-point ((arg0 control-info) (arg1 vector) (arg2 float) (arg3 float)) + (local-vars (sv-560 int)) + (let* ((f0-0 819.2) + (v1-1 (-> arg0 transv)) + (f30-0 (if (< f0-0 (sqrtf (+ (* (-> v1-1 x) (-> v1-1 x)) (* (-> v1-1 z) (-> v1-1 z))))) + (vector-y-angle (-> arg0 transv)) + (y-angle arg0) + ) + ) + (s2-0 (-> arg0 trans)) + (s1-0 (new 'stack-no-clear 'collide-query)) + ) + (set! (-> s1-0 collide-with) (-> arg0 root-prim prim-core collide-with)) + (set! (-> s1-0 ignore-process0) (-> arg0 process)) + (set! (-> s1-0 ignore-process1) #f) + (set! (-> s1-0 ignore-pat) (-> arg0 pat-ignore-mask)) + (set! (-> s1-0 action-mask) (collide-action solid)) + (set! (-> arg1 w) 0.0) + (dotimes (v1-9 3) + (set! (-> s1-0 bbox min data v1-9) (- (-> s2-0 data v1-9) arg3)) + (set! (-> s1-0 bbox max data v1-9) (+ (-> s2-0 data v1-9) arg3)) + ) + (set! (-> s1-0 bbox min y) (+ -40960.0 (-> s2-0 y))) + (set! (-> s1-0 bbox max y) (+ 20480.0 (-> s2-0 y))) + (fill-using-bounding-box *collide-cache* s1-0) + (vector+! (-> s1-0 start-pos) s2-0 (new 'static 'vector :y 20480.0 :w 1.0)) + (let ((v1-16 s1-0)) + (set! (-> v1-16 radius) 2048.0) + (set! (-> v1-16 collide-with) (-> arg0 root-prim prim-core collide-with)) + (set! (-> v1-16 ignore-process0) (-> arg0 process)) + (set! (-> v1-16 ignore-process1) #f) + (set! (-> v1-16 ignore-pat) (-> arg0 pat-ignore-mask)) + (set! (-> v1-16 action-mask) (collide-action solid)) + ) + (dotimes (s0-0 8) + (let ((f28-0 (+ f30-0 (if (not (logtest? s0-0 1)) + (* 8192.0 (the float (/ s0-0 2))) + (* -8192.0 (the float (/ s0-0 2))) + ) + ) + ) + ) + (set! sv-560 0) + (let ((f26-0 arg3)) + (set-vector! (-> s1-0 move-dist) 0.0 0.0 arg3 1.0) + (vector-rotate-y! (-> s1-0 move-dist) (-> s1-0 move-dist) f28-0) + (if (>= (probe-using-line-sphere *collide-cache* s1-0) 0.0) + (set! f26-0 (+ -6144.0 (vector-vector-xz-distance s2-0 (-> s1-0 best-other-tri intersect)))) + ) + (let ((f24-0 arg2)) + (while (>= f26-0 f24-0) + (set-vector! (-> s1-0 start-pos) 0.0 0.0 f24-0 1.0) + (vector-rotate-y! (-> s1-0 start-pos) (-> s1-0 start-pos) f28-0) + (vector+! (-> s1-0 start-pos) s2-0 (-> s1-0 start-pos)) + (set! (-> s1-0 start-pos y) (+ 20480.0 (-> s2-0 y))) + (set-vector! (-> s1-0 move-dist) 0.0 -61440.0 0.0 1.0) + (let ((v1-33 s1-0)) + (set! (-> v1-33 radius) 10240.0) + (set! (-> v1-33 collide-with) (-> arg0 root-prim prim-core collide-with)) + (set! (-> v1-33 ignore-process0) (-> arg0 process)) + (set! (-> v1-33 ignore-process1) #f) + (set! (-> v1-33 ignore-pat) (-> arg0 pat-ignore-mask)) + (set! (-> v1-33 action-mask) (collide-action solid)) + ) + (when (>= (probe-using-line-sphere *collide-cache* s1-0) 0.0) + (cond + ((and (or (= (-> s1-0 best-other-tri pat mode) (pat-mode ground)) + (= (-> s1-0 best-other-tri pat mode) (pat-mode halfpipe)) + ) + (and (= (-> s1-0 best-other-tri pat event) (pat-event none)) (< 0.7 (-> s1-0 best-other-tri normal y))) + ) + (set! (-> arg1 quad) (-> s1-0 best-other-tri intersect quad)) + (set! sv-560 (+ sv-560 1)) + (if (>= sv-560 2) + (return arg1) + ) + ) + ((and (= (-> s1-0 best-other-tri pat mode) (pat-mode wall)) + (< (+ 4096.0 (-> s2-0 y)) (-> s1-0 best-other-tri intersect y)) + ) + (goto cfg-38) + ) + ) + ) + (set! f24-0 (+ 4096.0 f24-0)) + ) + ) + ) + ) + (label cfg-38) + ) + ) + (the-as vector #f) + ) + +;; definition for function target-attack-up +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defun target-attack-up ((arg0 target) (arg1 symbol) (arg2 symbol)) + (with-pp + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer pp)) + (set! (-> a1-1 num-params) 2) + (set! (-> a1-1 message) arg1) + (set! (-> a1-1 param 0) (the-as uint #f)) + (let ((v1-2 (new 'static 'attack-info :mask (attack-info-mask mode id test)))) + (set! (-> v1-2 id) (the-as uint 2)) + (set! (-> v1-2 mode) arg2) + (set! (-> v1-2 test) #t) + (set! (-> a1-1 param 1) (the-as uint v1-2)) + ) + (when (send-event-function arg0 a1-1) + (let ((s3-0 (find-ground-point (-> arg0 control) (new 'stack-no-clear 'vector) 8192.0 40960.0))) + (set! s3-0 (cond + (s3-0 + (empty) + s3-0 + ) + (else + (-> arg0 control last-trans-on-surf) + ) + ) + ) + (let* ((s2-1 (vector-! (new 'stack-no-clear 'vector) s3-0 (-> arg0 control trans))) + (f0-0 8192.0) + (f1-0 40960.0) + (v1-8 s2-1) + (f30-0 (fmax f0-0 (fmin f1-0 (sqrtf (+ (* (-> v1-8 x) (-> v1-8 x)) (* (-> v1-8 z) (-> v1-8 z))))))) + ) + (cond + ((< (fabs (vector-dot + (-> arg0 control dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) s3-0 (-> arg0 control trans)) + ) + ) + 40960.0 + ) + (vector-xz-normalize! s2-1 f30-0) + (let ((s1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> s1-0 from) (process->ppointer pp)) + (set! (-> s1-0 num-params) 2) + (set! (-> s1-0 message) arg1) + (set! (-> s1-0 param 0) (the-as uint #f)) + (let ((s4-1 (new 'static 'attack-info :mask (attack-info-mask vector mode shove-up angle id)))) + (set! (-> s4-1 id) (the-as uint 2)) + (set! (-> s4-1 mode) arg2) + (set! (-> s4-1 vector quad) (-> s2-1 quad)) + (set! (-> s4-1 shove-up) + (+ (lerp-scale 4096.0 16384.0 f30-0 4096.0 40960.0) (fmax 0.0 (- (-> s3-0 y) (-> arg0 control trans y)))) + ) + (set! (-> s4-1 angle) 'up) + (set! (-> s1-0 param 1) (the-as uint s4-1)) + ) + (send-event-function arg0 s1-0) + ) + ) + (else + (let ((a1-7 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-7 from) (process->ppointer pp)) + (set! (-> a1-7 num-params) 2) + (set! (-> a1-7 message) arg1) + (set! (-> a1-7 param 0) (the-as uint #f)) + (let ((v1-24 (new 'static 'attack-info :mask (attack-info-mask vector mode shove-up control angle id)))) + (set! (-> v1-24 id) (the-as uint 2)) + (set! (-> v1-24 mode) arg2) + (set! (-> v1-24 vector quad) (-> (new 'static 'vector :y 40960.0 :w 1.0) quad)) + (set! (-> v1-24 shove-up) 40960.0) + (set! (-> v1-24 angle) 'up) + (set! (-> v1-24 control) 1.0) + (set! (-> a1-7 param 1) (the-as uint v1-24)) + ) + (send-event-function arg0 a1-7) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + ) + +;; definition for method 56 of type collide-shape-moving +;; WARN: Return type mismatch int vs none. +(defmethod react-to-pat! collide-shape-moving ((obj collide-shape-moving) (arg0 pat-surface)) + (with-pp + (let ((s5-0 0)) + (set! (-> obj cur-pat) arg0) + (set! (-> obj poly-pat) arg0) + (case (-> arg0 material) + (((pat-material ice)) + (set! (-> obj surf) *ice-surface*) + ) + (((pat-material gravel)) + (set! (-> obj surf) *gravel-surface*) + ) + (((pat-material quicksand)) + (set! (-> obj surf) *quicksand-surface*) + ) + (((pat-material tube)) + (set! (-> obj surf) *no-walk-surface*) + ) + (else + (set! (-> obj surf) *standard-ground-surface*) + ) + ) + (when (nonzero? (-> arg0 event)) + (case (-> arg0 event) + (((pat-event slide)) + (set! (-> obj surf) *gravel-surface*) + (send-event (-> obj process) 'slide) + ) + (((pat-event slippery)) + (set! (-> obj surf) *gravel-surface*) + ) + (((pat-event rail)) + (let* ((s4-0 (-> obj process)) + (a0-14 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + (if (and a0-14 (zero? (logand (focus-status rail) (-> (the-as process-focusable a0-14) focus-status)))) + (set! (-> obj surf) *rail-surface*) + ) + ) + ) + (((pat-event deadly)) + (set! s5-0 (logior s5-0 #x4000)) + (let ((a1-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-4 from) (process->ppointer pp)) + (set! (-> a1-4 num-params) 2) + (set! (-> a1-4 message) 'attack) + (set! (-> a1-4 param 0) (the-as uint #f)) + (let ((v1-24 (new 'static 'attack-info :mask (attack-info-mask mode shove-up id)))) + (set! (-> v1-24 id) (the-as uint 2)) + (set! (-> v1-24 mode) 'deadly) + (set! (-> v1-24 shove-up) 12288.0) + (set! (-> a1-4 param 1) (the-as uint v1-24)) + ) + (send-event-function (-> obj process) a1-4) + ) + ) + (((pat-event burn)) + (set! s5-0 (logior s5-0 #x4000)) + (let ((a1-5 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-5 from) (process->ppointer pp)) + (set! (-> a1-5 num-params) 2) + (set! (-> a1-5 message) 'attack) + (set! (-> a1-5 param 0) (the-as uint #f)) + (let ((v1-29 (new 'static 'attack-info :mask (attack-info-mask mode shove-up id)))) + (set! (-> v1-29 id) (the-as uint 2)) + (set! (-> v1-29 mode) 'burn) + (set! (-> v1-29 shove-up) 12288.0) + (set! (-> a1-5 param 1) (the-as uint v1-29)) + ) + (send-event-function (-> obj process) a1-5) + ) + ) + (((pat-event deadlup)) + (set! s5-0 (logior s5-0 #x4000)) + (target-attack-up (the-as target (-> obj process)) 'attack-or-shove 'deadlyup) + ) + (((pat-event shockup)) + (set! s5-0 (logior s5-0 #x4000)) + (target-attack-up (the-as target (-> obj process)) 'attack-or-shove 'shockup) + ) + (((pat-event burnup)) + (when (not (logtest? (focus-status pilot) (-> (the-as process-focusable (-> obj process)) focus-status))) + (set! s5-0 (logior s5-0 #x4000)) + (target-attack-up (the-as target (-> obj process)) 'attack-or-shove 'burnup) + ) + ) + (((pat-event melt)) + (set! s5-0 (logior s5-0 #x4000)) + (let ((a1-9 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-9 from) (process->ppointer pp)) + (set! (-> a1-9 num-params) 2) + (set! (-> a1-9 message) 'attack-invinc) + (set! (-> a1-9 param 0) (the-as uint #f)) + (let ((v1-40 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (set! (-> v1-40 id) (the-as uint 2)) + (set! (-> v1-40 mode) 'melt) + (set! (-> a1-9 param 1) (the-as uint v1-40)) + ) + (send-event-function (-> obj process) a1-9) + ) + ) + (((pat-event endlessfall)) + (set! s5-0 (logior s5-0 #x4000)) + (let ((a1-10 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-10 from) (process->ppointer pp)) + (set! (-> a1-10 num-params) 2) + (set! (-> a1-10 message) 'attack-invinc) + (set! (-> a1-10 param 0) (the-as uint #f)) + (let ((v1-45 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (set! (-> v1-45 id) (the-as uint 2)) + (set! (-> v1-45 mode) 'endlessfall) + (set! (-> a1-10 param 1) (the-as uint v1-45)) + ) + (send-event-function (-> obj process) a1-10) + ) + ) + (((pat-event shock)) + (set! s5-0 (logior s5-0 #x4000)) + (let ((a1-11 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-11 from) (process->ppointer pp)) + (set! (-> a1-11 num-params) 2) + (set! (-> a1-11 message) 'attack-invinc) + (set! (-> a1-11 param 0) (the-as uint #f)) + (let ((v1-50 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (set! (-> v1-50 id) (the-as uint 2)) + (set! (-> v1-50 mode) 'shock) + (set! (-> a1-11 param 1) (the-as uint v1-50)) + ) + (send-event-function (-> obj process) a1-11) + ) + ) + (((pat-event lip)) + (send-event (-> obj process) 'lip 'lip) + ) + (((pat-event lipramp)) + (send-event (-> obj process) 'lip 'lipramp) + ) + ) + ) + ) + (none) + ) + ) + +;; definition for function collide-shape-moving-angle-set! +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defun collide-shape-moving-angle-set! ((arg0 collide-shape-moving) (arg1 vector) (arg2 vector)) + (set! (-> arg0 surface-normal quad) (-> arg1 quad)) + (set! (-> arg0 surface-angle) (vector-dot arg1 (-> arg0 dynam gravity-normal))) + (set! (-> arg0 poly-angle) (vector-dot (-> arg0 poly-normal) (-> arg0 dynam gravity-normal))) + (set! (-> arg0 touch-angle) + (fmax + (-> arg0 touch-angle) + (vector-dot arg1 (vector-normalize! (vector-negate! (new-stack-vector0) arg2) 1.0)) + ) + ) + 0 + (none) + ) + +;; definition for function cshape-reaction-update-state +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defun cshape-reaction-update-state ((arg0 control-info) (arg1 collide-query) (arg2 vector)) + (local-vars (sv-48 vector) (sv-52 vector) (sv-56 collide-status) (sv-96 symbol)) + (set! sv-48 (new-stack-vector0)) + (set! sv-52 (new-stack-vector0)) + (set! sv-56 (collide-status)) + (let ((a1-1 (new 'stack-no-clear 'vector))) + (vector-float*! a1-1 (-> arg1 move-dist) (-> arg1 best-dist)) + (move-by-vector! arg0 a1-1) + ) + (react-to-pat! arg0 (-> arg1 best-other-tri pat)) + (vector-! sv-48 (the-as vector (-> arg1 best-my-prim prim-core)) (-> arg1 best-other-tri intersect)) + (cond + ((and (= (-> arg1 best-dist) 0.0) + (< (vector-length sv-48) (+ -40.96 (-> arg1 best-my-prim prim-core world-sphere w))) + ) + (set! (-> sv-48 quad) (-> arg1 best-other-tri normal quad)) + (set! (-> arg0 coverage) 0.0) + ) + (else + (set! (-> sv-48 w) 1.0) + (vector-normalize! sv-48 1.0) + (set! (-> arg0 coverage) (vector-dot sv-48 (-> arg1 best-other-tri normal))) + (when (< (-> arg0 coverage) 0.0) + (set! (-> arg0 coverage) 0.0) + (vector-flatten! sv-48 sv-48 (-> arg1 best-other-tri normal)) + (vector-normalize! sv-48 1.0) + ) + ) + ) + (let ((v1-25 (-> sv-48 quad))) + (set! (-> sv-52 quad) v1-25) + ) + (if (= (-> arg1 best-dist) 0.0) + (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-52 6.0)) + ) + (set! (-> arg0 poly-normal quad) (-> arg1 best-other-tri normal quad)) + (collide-shape-moving-angle-set! arg0 sv-52 arg2) + (if (< (-> arg0 poly-angle) -0.2) + (set! sv-56 (logior sv-56 (collide-status touch-ceiling))) + ) + (set! sv-96 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle))) + (set! sv-56 (logior sv-56 (collide-status touch-surface))) + (if (-> arg1 num-spheres) + (set! sv-56 (logior sv-56 (collide-status touch-actor))) + ) + (cond + (sv-96 + (set! sv-56 (logior sv-56 (collide-status touch-wall))) + (set! (-> arg0 cur-pat mode) 1) + ) + (else + (set! sv-56 (logior sv-56 (collide-status on-surface))) + (set! (-> arg0 local-normal quad) (-> sv-52 quad)) + ) + ) + (when (and (not sv-96) (>= (-> arg0 coverage) 0.9)) + (set! sv-56 (logior sv-56 (collide-status on-ground))) + (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) + (when (!= (-> arg0 poly-pat mode) (pat-mode wall)) + (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) + (set! (-> arg0 grount-touch-point quad) (-> arg1 best-other-tri intersect quad)) + ) + ) + (when (not (logtest? (-> arg0 prev-status) (collide-status on-surface))) + (set! sv-56 (logior sv-56 (collide-status impact-surface))) + (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) + ) + (logior! (-> arg0 status) sv-56) + 0 + (none) + ) + +;; definition for function cshape-reaction-default +;; INFO: Used lq/sq +(defun cshape-reaction-default ((arg0 control-info) (arg1 collide-query) (arg2 vector) (arg3 vector)) + (cshape-reaction-update-state arg0 arg1 arg3) + (let ((a1-1 (new 'stack-no-clear 'vector))) + (set! (-> a1-1 quad) (-> arg3 quad)) + (when (and (not (logtest? (-> arg0 prev-status) (collide-status on-surface))) + (zero? (logand (-> arg0 status) (collide-status touch-wall))) + ) + (let ((f0-1 (- 1.0 (-> arg0 surf impact-fric)))) + (when (< f0-1 1.0) + (let ((v1-9 (new-stack-vector0)) + (f1-3 (vector-dot (-> arg0 dynam gravity-normal) a1-1)) + ) + 0.0 + (vector-! v1-9 a1-1 (vector-float*! v1-9 (-> arg0 dynam gravity-normal) f1-3)) + (let* ((f2-2 (vector-length v1-9)) + (f3-0 f2-2) + ) + (if (< f1-3 0.0) + (set! f1-3 (* f1-3 f0-1)) + ) + (vector+! + a1-1 + (vector-float*! a1-1 (-> arg0 dynam gravity-normal) f1-3) + (vector-float*! v1-9 v1-9 (/ f2-2 f3-0)) + ) + ) + ) + ) + ) + ) + (vector-reflect-flat-above! arg2 a1-1 (-> arg0 surface-normal)) + ) + (-> arg0 status) + ) + +;; definition for function cshape-reaction-just-move +(defun cshape-reaction-just-move ((arg0 control-info) (arg1 collide-query) (arg2 vector)) + (vector-reset! arg2) + (let ((a1-1 (new 'stack-no-clear 'vector))) + (vector-float*! a1-1 (-> arg1 move-dist) (-> arg1 best-dist)) + (move-by-vector! arg0 a1-1) + ) + (let ((v1-5 4)) + (if (-> arg1 num-spheres) + (set! v1-5 (logior v1-5 32)) + ) + (let ((v0-1 (logior (-> arg0 status) v1-5))) + (set! (-> arg0 status) v0-1) + v0-1 + ) + ) + ) + +;; definition for method 66 of type collide-shape-moving +;; INFO: Used lq/sq +(defmethod step-collison! collide-shape-moving ((obj collide-shape-moving) (arg0 vector) (arg1 vector) (arg2 float) (arg3 int)) + (local-vars (sv-592 int)) + (with-pp + (let ((s5-0 (new 'stack 'collide-query)) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (vector-float*! s2-0 arg1 (* arg2 (-> pp clock seconds-per-frame))) + (set! (-> s5-0 move-dist quad) (-> s2-0 quad)) + (set! (-> s5-0 best-dist) -100000000.0) + (set! (-> s5-0 best-my-prim) #f) + (set! (-> s5-0 num-spheres) (the-as uint #f)) + (let* ((s1-1 (-> obj root-prim)) + (v1-5 *collide-cache*) + (s0-0 (the-as collide-cache-prim (-> v1-5 prims))) + ) + (set! sv-592 (-> v1-5 num-prims)) + (while (nonzero? sv-592) + (set! sv-592 (+ sv-592 -1)) + (when (logtest? (-> s1-1 prim-core collide-with) (-> s0-0 prim-core collide-as)) + (if (>= (the-as int (-> s0-0 prim-core prim-type)) 0) + (collide-with-collide-cache-prim-mesh s1-1 s5-0 s0-0) + (collide-with-collide-cache-prim-sphere s1-1 s5-0 s0-0) + ) + ) + (&+! s0-0 48) + ) + ) + (let ((f30-0 (-> s5-0 best-dist))) + (set! f30-0 (cond + ((>= f30-0 0.0) + (let ((s2-1 (new 'stack-no-clear 'vector))) + (if *display-collision-marks* + (set! (-> s2-1 quad) (-> arg1 quad)) + ) + (set! (-> obj prev-status) ((-> obj reaction) (the-as control-info obj) s5-0 arg0 arg1)) + (when *display-collision-marks* + (let ((t1-0 (-> *pat-mode-info* (-> s5-0 best-other-tri pat mode) hilite-color))) + (add-debug-outline-triangle + #t + (bucket-id debug-no-zbuf1) + (the-as vector (-> s5-0 best-other-tri)) + (-> s5-0 best-other-tri vertex 1) + (-> s5-0 best-other-tri vertex 2) + t1-0 + ) + ) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (-> s5-0 best-other-tri intersect) + s2-1 + (meters 0.00007324219) + (new 'static 'rgba :r #xff :g #xa0 :a #x80) + ) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (-> s5-0 best-other-tri intersect) + arg0 + (meters 0.00007324219) + (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) + ) + (if (= (-> obj process type) target) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (-> s5-0 best-other-tri intersect) + (-> obj surface-normal) + (meters 0.5) + (-> *pat-mode-info* (-> obj cur-pat mode) hilite-color) + ) + ) + ) + ) + f30-0 + ) + (else + (set! (-> obj reaction-flag) (cshape-reaction-flags)) + ((-> obj no-reaction) obj s5-0 arg0 arg1) + (set! (-> obj prev-status) (collide-status)) + (move-by-vector! obj s2-0) + (set! (-> arg0 quad) (-> arg1 quad)) + 1.0 + ) + ) + ) + f30-0 + ) + ) + ) + ) + +;; definition for method 37 of type collide-shape +(defmethod integrate-and-collide! collide-shape ((obj collide-shape) (arg0 vector)) + (local-vars (at-0 int)) + (with-pp + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((t9-0 (method-of-object obj move-by-vector!)) + (v1-1 (new 'stack-no-clear 'vector)) + ) + (.lvf vf1 (&-> arg0 quad)) + (let ((f0-0 (-> pp clock seconds-per-frame))) + (.mov at-0 f0-0) + ) + (.mov vf2 at-0) + (.mov.vf vf1 vf0 :mask #b1000) + (.mul.x.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> v1-1 quad) vf1) + (t9-0 obj v1-1) + ) + (none) + ) + ) + ) + +;; definition for method 37 of type collide-shape-moving +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod integrate-and-collide! collide-shape-moving ((obj collide-shape-moving) (arg0 vector)) + (update-transforms obj) + (set! (-> obj trans-old-old-old quad) (-> obj trans-old-old quad)) + (set! (-> obj trans-old-old quad) (-> obj trans-old quad)) + (set! (-> obj trans-old quad) (-> obj trans quad)) + (set! (-> obj prev-status) (-> obj status)) + (logclear! (-> obj status) (collide-status + on-surface + on-ground + touch-surface + touch-wall + touch-ceiling + touch-actor + on-special-surface + touch-edge + blocked + on-water + impact-surface + touch-background + stuck + glance + ) + ) + (when (not (logtest? (-> obj root-prim prim-core action) (collide-action no-normal-reset))) + (let ((v1-13 (-> obj dynam gravity-normal))) + (set! (-> obj local-normal quad) (-> v1-13 quad)) + (set! (-> obj surface-normal quad) (-> v1-13 quad)) + (set! (-> obj poly-normal quad) (-> v1-13 quad)) + ) + (set! (-> obj coverage) 0.0) + (set! (-> obj touch-angle) 0.0) + ) + (let ((f30-0 1.0) + (s4-0 0) + ) + (while (and (< 0.05 f30-0) (and (< s4-0 (the-as int (-> obj max-iteration-count))) + (not (and (= (-> arg0 x) 0.0) (= (-> arg0 y) 0.0) (= (-> arg0 z) 0.0))) + ) + ) + (let ((f28-0 (step-collison! obj arg0 arg0 f30-0 s4-0))) + (update-from-step-size *touching-list* f28-0) + (set! f30-0 (- f30-0 (* f28-0 f30-0))) + ) + (+! s4-0 1) + ) + ) + 0 + (none) + ) + +;; definition for method 37 of type control-info +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod integrate-and-collide! control-info ((obj control-info) (arg0 vector)) + (with-pp + (stopwatch-start (the-as stopwatch (&-> *collide-stats* pad0 1))) + (when (< 1638400.0 (vector-length arg0)) + (format 0 "WARNING: target vel is ~M m/s, reseting to zero.~%" (vector-length arg0)) + (vector-reset! arg0) + ) + (set! (-> obj old-anim-collide-offset-world quad) (-> obj anim-collide-offset-world quad)) + (vector-matrix*! + (-> obj anim-collide-offset-world) + (-> obj anim-collide-offset-local) + (-> obj ctrl-orientation) + ) + (vector-! + (-> obj anim-collide-offset-delta-world) + (-> obj anim-collide-offset-world) + (-> obj old-anim-collide-offset-world) + ) + (let ((total-offset + (vector-! (new 'stack-no-clear 'vector) (-> obj draw-offset) (-> obj anim-collide-offset-world)) + ) + ) + (vector-seek! (-> obj cspace-offset) total-offset (* 16384.0 (-> pp clock seconds-per-frame))) + ) + (let ((bonus-vel (vector+float*! + (new-stack-vector0) + (-> obj collide-extra-velocity) + (-> obj anim-collide-offset-delta-world) + 60.0 + ) + ) + ) + (when (< 0.0 (vector-length bonus-vel)) + (let ((old-iter-cnt (-> obj max-iteration-count)) + (old-in-vel (new 'stack-no-clear 'vector)) + ) + (set! (-> old-in-vel quad) (-> arg0 quad)) + (let ((old-stat-flg (-> obj status))) + (let ((t9-4 (method-of-type collide-shape-moving integrate-and-collide!))) + (t9-4 obj bonus-vel) + ) + (set! (-> obj max-iteration-count) old-iter-cnt) + (set! (-> arg0 quad) (-> old-in-vel quad)) + (logior! (-> obj status) old-stat-flg) + ) + ) + ) + ) + (let ((regular-vel (new-stack-vector0))) + (set! (-> regular-vel quad) (-> arg0 quad)) + (let ((before-regular-vel (new 'stack-no-clear 'vector))) + (set! (-> before-regular-vel quad) (-> arg0 quad)) + (let ((t9-5 (method-of-type collide-shape-moving integrate-and-collide!))) + (t9-5 obj regular-vel) + ) + (let ((b1 (new-stack-vector0))) + (set! (-> b1 quad) (-> before-regular-vel quad)) + (let ((a1 (new-stack-vector0))) + (set! (-> a1 quad) (-> regular-vel quad)) + (let ((b1-nrm-to-grav (new-stack-vector0))) + (let ((f0-6 (vector-dot (-> obj dynam gravity-normal) b1))) + 0.0 + (vector-! b1-nrm-to-grav b1 (vector-float*! b1-nrm-to-grav (-> obj dynam gravity-normal) f0-6)) + ) + (let* ((b1-nrm-to-grav-vel (vector-length b1-nrm-to-grav)) + (f1-4 b1-nrm-to-grav-vel) + (f2-0 0.0) + ) + (vector+! + b1 + (vector-float*! b1 (-> obj dynam gravity-normal) f2-0) + (vector-float*! b1-nrm-to-grav b1-nrm-to-grav (/ b1-nrm-to-grav-vel f1-4)) + ) + ) + ) + (let ((v1-33 (new-stack-vector0))) + (let ((f0-10 (vector-dot (-> obj dynam gravity-normal) a1))) + 0.0 + (vector-! v1-33 a1 (vector-float*! v1-33 (-> obj dynam gravity-normal) f0-10)) + ) + (let* ((f0-11 (vector-length v1-33)) + (f1-6 f0-11) + (f2-1 0.0) + ) + (vector+! + a1 + (vector-float*! a1 (-> obj dynam gravity-normal) f2-1) + (vector-float*! v1-33 v1-33 (/ f0-11 f1-6)) + ) + ) + ) + (vector-normalize! b1 1.0) + (vector-normalize! a1 1.0) + (let ((ba-dot (vector-dot b1 a1))) + (cond + ((and (!= (vector-length (-> obj target-transv)) 0.0) + (if (logtest? (-> obj status) (collide-status touch-wall)) + (< ba-dot 0.9999) + (< ba-dot 0.95) + ) + ) + (seek! (-> obj blocked-factor) 1.0 (* 4.0 (-> pp clock seconds-per-frame))) + (seek! + (-> obj blocked-in-air-factor) + (if (= (-> obj unknown-surface00 mode) 'air) + 1.0 + 0.0 + ) + (* 4.0 (-> pp clock seconds-per-frame)) + ) + (logior! (-> obj status) (collide-status blocked)) + ) + (else + (seek! (-> obj blocked-factor) 0.0 (* 2.0 (-> pp clock seconds-per-frame))) + (seek! (-> obj blocked-in-air-factor) 0.0 (* 2.0 (-> pp clock seconds-per-frame))) + ) + ) + ) + ) + ) + (set! (-> arg0 quad) (-> regular-vel quad)) + (if (and (logtest? (-> obj status) (collide-status on-surface)) + (and (not (logtest? (-> obj status) (collide-status touch-wall blocked))) + (< (vector-length (-> obj btransv)) (vector-length before-regular-vel)) + ) + ) + (set! (-> obj btransv quad) (-> before-regular-vel quad)) + ) + ) + ) + (let ((align-xz-dir (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> obj align-xz-vel) 1.0)) + (align-xz-speed (vector-length (-> obj align-xz-vel))) + ) + (set! (-> obj zx-vel-frac) (if (= align-xz-speed 0.0) + 0.0 + (fmax 0.0 (/ (vector-dot (-> obj transv) align-xz-dir) align-xz-speed)) + ) + ) + ) + (stopwatch-stop (the-as stopwatch (&-> *collide-stats* pad0 1))) + 0 + (none) + ) + ) + +;; definition for method 64 of type collide-shape-moving +;; INFO: Used lq/sq +(defmethod try-snap-to-surface collide-shape-moving ((obj collide-shape-moving) (vel vector) (check-dist float) (amt float) (bounce-dist float)) + (local-vars (at-0 int)) + (with-pp + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((initial-trans (new 'stack-no-clear 'vector)) + (collide-vel (new 'stack-no-clear 'vector)) + ) + (set! (-> initial-trans quad) (-> obj trans quad)) + (vector-normalize-copy! (-> obj trans) vel check-dist) + (vector+! (-> obj trans) (-> obj trans) initial-trans) + (update-transforms obj) + (vector-normalize-copy! collide-vel vel (- amt check-dist)) + (let ((v1-4 collide-vel)) + (.lvf vf1 (&-> collide-vel quad)) + (let ((f0-2 (-> pp clock frames-per-second))) + (.mov at-0 f0-2) + ) + (.mov vf2 at-0) + (.mov.vf vf1 vf0 :mask #b1000) + (.mul.x.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> v1-4 quad) vf1) + ) + (set! (-> obj prev-status) (-> obj status)) + (logclear! (-> obj status) (collide-status + on-surface + on-ground + touch-surface + touch-wall + touch-ceiling + touch-actor + on-special-surface + touch-edge + blocked + on-water + impact-surface + touch-background + stuck + glance + ) + ) + (when (not (logtest? (-> obj root-prim prim-core action) (collide-action no-normal-reset))) + (let ((v1-13 (-> obj dynam gravity-normal))) + (set! (-> obj local-normal quad) (-> v1-13 quad)) + (set! (-> obj surface-normal quad) (-> v1-13 quad)) + (set! (-> obj poly-normal quad) (-> v1-13 quad)) + ) + (set! (-> obj coverage) 0.0) + (set! (-> obj touch-angle) 0.0) + ) + (let ((f30-0 (step-collison! obj collide-vel collide-vel 1.0 0))) + (update-from-step-size *touching-list* f30-0) + (cond + ((< f30-0 1.0) + (let ((vel-dir (new 'stack-no-clear 'vector)) + (s2-1 (new 'stack-no-clear 'vector)) + ) + (vector-normalize-copy! vel-dir vel 1.0) + (vector-! s2-1 (-> obj trans) initial-trans) + (when (< (vector-dot vel-dir s2-1) bounce-dist) + (vector-normalize-copy! s2-1 vel bounce-dist) + (vector+! s2-1 s2-1 initial-trans) + (move-to-point! obj s2-1) + ) + ) + #t + ) + (else + (move-to-point! obj initial-trans) + #f + ) + ) + ) + ) + ) + ) + ) + +;; definition for method 65 of type collide-shape-moving +(defmethod fill-and-try-snap-to-surface collide-shape-moving ((obj collide-shape-moving) (arg0 vector) (arg1 float) (arg2 float) (arg3 float) (arg4 collide-query)) + (vector-normalize-copy! (-> arg4 start-pos) arg0 arg1) + (vector+! (-> arg4 start-pos) (-> arg4 start-pos) (-> obj trans)) + (vector-normalize-copy! (-> arg4 move-dist) arg0 (- arg2 arg1)) + (fill-using-line-sphere *collide-cache* arg4) + (try-snap-to-surface obj arg0 arg1 arg2 arg3) + ) + +;; definition for method 61 of type collide-shape-moving +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod move-to-ground-point collide-shape-moving ((obj collide-shape-moving) (arg0 vector) (arg1 vector) (arg2 vector)) + (move-to-point! obj arg0) + (set! (-> arg1 y) 0.0) + (set! (-> obj grount-touch-point quad) (-> arg0 quad)) + (set! (-> obj poly-normal quad) (-> arg2 quad)) + (set! (-> obj surface-normal quad) (-> arg2 quad)) + (set! (-> obj local-normal quad) (-> arg2 quad)) + (set! (-> obj ground-poly-normal quad) (-> arg2 quad)) + (logior! (-> obj status) (collide-status on-surface on-ground touch-surface)) + (set! (-> obj ground-impact-vel) (- (vector-dot arg1 (-> obj dynam gravity-normal)))) + 0 + (none) + ) + +;; definition for method 57 of type collide-shape-moving +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod integrate-no-collide! collide-shape-moving ((obj collide-shape-moving) (arg0 vector)) + (local-vars (at-0 int)) + (with-pp + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (update-transforms obj) + (set! (-> obj trans-old-old-old quad) (-> obj trans-old-old quad)) + (set! (-> obj trans-old-old quad) (-> obj trans-old quad)) + (set! (-> obj trans-old quad) (-> obj trans quad)) + (set! (-> obj prev-status) (-> obj status)) + (logclear! (-> obj status) (collide-status + on-surface + on-ground + touch-surface + touch-wall + touch-ceiling + touch-actor + on-special-surface + touch-edge + blocked + on-water + impact-surface + touch-background + stuck + glance + ) + ) + (when (not (logtest? (-> obj root-prim prim-core action) (collide-action no-normal-reset))) + (let ((v1-13 (-> obj dynam gravity-normal))) + (set! (-> obj local-normal quad) (-> v1-13 quad)) + (set! (-> obj surface-normal quad) (-> v1-13 quad)) + (set! (-> obj poly-normal quad) (-> v1-13 quad)) + ) + (set! (-> obj coverage) 0.0) + (set! (-> obj touch-angle) 0.0) + ) + (let ((t9-1 (method-of-object obj move-by-vector!)) + (a1-5 (new 'stack-no-clear 'vector)) + ) + (.lvf vf1 (&-> arg0 quad)) + (let ((f0-2 (-> pp clock seconds-per-frame))) + (.mov at-0 f0-2) + ) + (.mov vf2 at-0) + (.mov.vf vf1 vf0 :mask #b1000) + (.mul.x.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> a1-5 quad) vf1) + (t9-1 obj a1-5) + ) + 0 + (none) + ) + ) + ) + +;; definition for method 58 of type collide-shape-moving +(defmethod integrate-for-enemy-no-mtg collide-shape-moving ((obj collide-shape-moving) (arg0 vector) (arg1 overlaps-others-params)) + (integrate-no-collide! obj arg0) + (let ((s5-1 (find-overlapping-shapes obj arg1))) + (if s5-1 + (move-to-point! obj (-> obj trans-old)) + ) + s5-1 + ) + ) + +;; definition for method 55 of type collide-shape-moving +;; INFO: Used lq/sq +(defmethod find-ground collide-shape-moving ((obj collide-shape-moving) (arg0 collide-query) (arg1 collide-spec) (arg2 float) (arg3 float) (arg4 float)) + (with-pp + (set! (-> obj gspot-pos quad) (-> obj trans quad)) + (set! (-> arg0 start-pos quad) (-> obj trans quad)) + (vector-reset! (-> arg0 move-dist)) + (let ((f0-0 (-> obj transv y))) + (if (< f0-0 0.0) + (set! arg2 (- arg2 (fmax -40960.0 (* f0-0 (-> pp clock seconds-per-frame))))) + ) + ) + (+! (-> arg0 start-pos y) arg2) + (set! (-> arg0 move-dist y) (- (+ arg2 arg3))) + (let ((v1-7 arg0)) + (set! (-> v1-7 radius) arg4) + (set! (-> v1-7 collide-with) arg1) + (set! (-> v1-7 ignore-process0) (-> obj process)) + (set! (-> v1-7 ignore-process1) #f) + (set! (-> v1-7 ignore-pat) (logior (new 'static 'pat-surface :noendlessfall #x1) (-> obj pat-ignore-mask))) + (set! (-> v1-7 action-mask) (collide-action solid)) + ) + (cond + ((>= (fill-and-probe-using-line-sphere *collide-cache* arg0) 0.0) + (set! (-> obj gspot-pos y) (-> arg0 best-other-tri intersect y)) + (set! (-> obj gspot-normal quad) (-> arg0 best-other-tri normal quad)) + #t + ) + (else + (set! (-> obj gspot-pos y) -40959590.0) + (set! (-> obj gspot-normal quad) (-> *y-vector* quad)) + #f + ) + ) + ) + ) + +;; definition for method 51 of type collide-shape +;; INFO: Used lq/sq +(defmethod above-ground? collide-shape ((obj collide-shape) (arg0 collide-query) (arg1 vector) (arg2 object) (arg3 float) (arg4 float) (arg5 float)) + (set! (-> arg0 start-pos quad) (-> arg1 quad)) + (+! (-> arg0 start-pos y) arg3) + (vector-reset! (-> arg0 move-dist)) + (set! (-> arg0 move-dist y) (- (+ arg3 arg4))) + (let ((v1-2 arg0)) + (set! (-> v1-2 radius) arg5) + (set! (-> v1-2 collide-with) (the-as collide-spec arg2)) + (set! (-> v1-2 ignore-process0) (-> obj process)) + (set! (-> v1-2 ignore-process1) #f) + (set! (-> v1-2 ignore-pat) (-> obj pat-ignore-mask)) + (set! (-> v1-2 action-mask) (collide-action solid)) + ) + (>= (fill-and-probe-using-line-sphere *collide-cache* arg0) 0.0) + ) + +;; definition for method 59 of type collide-shape-moving +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod move-above-ground collide-shape-moving ((obj collide-shape-moving) (arg0 vector) (arg1 move-above-ground-params)) + (when *debug-segment* + (let ((s3-0 (-> *display* frames (-> *display* on-screen) profile-array data 0)) + (v1-7 'collide) + (s2-0 *profile-collide-color*) + ) + (when (and *dproc* *debug-segment*) + (let ((s1-0 (-> s3-0 data (-> s3-0 count)))) + (let ((s0-0 (-> s3-0 base-time))) + (set! (-> s1-0 name) v1-7) + (set! (-> s1-0 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s0-0)))) + ) + (set! (-> s1-0 depth) (the-as uint (-> s3-0 depth))) + (set! (-> s1-0 color) s2-0) + (set! (-> s3-0 segment (-> s3-0 depth)) s1-0) + ) + (+! (-> s3-0 count) 1) + (+! (-> s3-0 depth) 1) + (set! (-> s3-0 max-depth) (max (-> s3-0 max-depth) (-> s3-0 depth))) + ) + ) + 0 + ) + (set! (-> arg1 on-ground?) #f) + (set! (-> arg1 do-move?) #t) + (set! (-> arg1 old-gspot-pos quad) (-> obj gspot-pos quad)) + (set! (-> arg1 old-gspot-normal quad) (-> obj gspot-normal quad)) + (set! (-> obj trans-old-old-old quad) (-> obj trans-old-old quad)) + (set! (-> obj trans-old-old quad) (-> obj trans-old quad)) + (set! (-> obj trans-old quad) (-> obj trans quad)) + (set! (-> obj prev-status) (-> obj status)) + (vector-v+! (-> obj trans) (-> obj trans) arg0) + (set! (-> arg1 new-pos quad) (-> obj trans quad)) + (let ((s3-1 (new 'stack-no-clear 'collide-query))) + (cond + ((find-ground obj s3-1 (-> arg1 gnd-collide-with) (-> arg1 popup) 81920.0 1024.0) + (when (>= (-> obj gspot-pos y) (-> arg1 new-pos y)) + (set! (-> arg1 on-ground?) #t) + (set! (-> arg1 pat) (-> s3-1 best-other-tri pat)) + (set! (-> arg1 new-pos y) (-> s3-1 best-other-tri intersect y)) + (set! (-> obj ground-impact-vel) (- (vector-dot arg0 (-> obj dynam gravity-normal)))) + (set! (-> arg0 y) 0.0) + ) + ) + (else + (if (-> arg1 hover-if-no-ground?) + (set! (-> arg1 new-pos y) (-> obj trans-old y)) + ) + ) + ) + ) + (set! (-> obj trans quad) (-> obj trans-old quad)) + (move-to-point! obj (-> arg1 new-pos)) + (when (logtest? (logand (-> arg1 overlaps-params collide-with-filter) + (collide-spec hit-by-player-list hit-by-others-list player-list) + ) + (-> obj root-prim prim-core collide-with) + ) + (when (find-overlapping-shapes obj (-> arg1 overlaps-params)) + (when (-> arg1 dont-move-if-overlaps?) + (set! (-> arg1 do-move?) #f) + (move-to-point! obj (-> obj trans-old)) + (set! (-> obj gspot-pos quad) (-> arg1 old-gspot-pos quad)) + (set! (-> obj gspot-normal quad) (-> arg1 old-gspot-normal quad)) + ) + ) + ) + (when (-> arg1 do-move?) + (cond + ((-> arg1 on-ground?) + (let ((a1-8 (-> obj gspot-pos)) + (a0-29 (-> obj gspot-normal)) + (v1-59 (-> arg1 pat)) + ) + (set! (-> obj grount-touch-point quad) (-> a1-8 quad)) + (set! (-> obj poly-normal quad) (-> a0-29 quad)) + (set! (-> obj surface-normal quad) (-> a0-29 quad)) + (set! (-> obj local-normal quad) (-> a0-29 quad)) + (set! (-> obj ground-poly-normal quad) (-> a0-29 quad)) + (set! (-> obj poly-pat) v1-59) + (set! (-> obj cur-pat) v1-59) + (set! (-> obj ground-pat) v1-59) + ) + (logior! (-> obj status) (collide-status on-surface on-ground touch-surface)) + ) + (else + (logclear! (-> obj status) (collide-status + on-surface + on-ground + touch-surface + touch-wall + touch-ceiling + touch-actor + on-special-surface + touch-edge + blocked + on-water + impact-surface + touch-background + stuck + glance + ) + ) + (when (not (logtest? (-> obj root-prim prim-core action) (collide-action no-normal-reset))) + (let ((v1-69 (-> obj dynam gravity-normal))) + (set! (-> obj local-normal quad) (-> v1-69 quad)) + (set! (-> obj surface-normal quad) (-> v1-69 quad)) + (set! (-> obj poly-normal quad) (-> v1-69 quad)) + ) + (set! (-> obj coverage) 0.0) + (set! (-> obj touch-angle) 0.0) + ) + ) + ) + ) + (when *debug-segment* + (let ((gp-1 (-> *display* frames (-> *display* on-screen) profile-array data 0))) + (when (and *dproc* *debug-segment*) + (let* ((v1-83 (+ (-> gp-1 depth) -1)) + (s5-1 (-> gp-1 segment v1-83)) + (s4-1 (-> gp-1 base-time)) + ) + (when (>= v1-83 0) + (set! (-> s5-1 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s4-1)))) + (+! (-> gp-1 depth) -1) + ) + ) + ) + ) + 0 + ) + 0 + (none) + ) + +;; definition for method 60 of type collide-shape-moving +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod move-to-ground collide-shape-moving ((obj collide-shape-moving) (arg0 float) (arg1 float) (arg2 symbol) (arg3 collide-spec)) + (local-vars (sv-576 profile-segment) (sv-592 int)) + (when *debug-segment* + (let ((s1-0 (-> *display* frames (-> *display* on-screen) profile-array data 0)) + (v1-7 'collide) + (s0-0 *profile-collide-color*) + ) + (when (and *dproc* *debug-segment*) + (set! sv-576 (-> s1-0 data (-> s1-0 count))) + (set! sv-592 (-> s1-0 base-time)) + (set! (-> sv-576 name) v1-7) + (set! (-> sv-576 start-time) + (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint sv-592))) + ) + (set! (-> sv-576 depth) (the-as uint (-> s1-0 depth))) + (set! (-> sv-576 color) s0-0) + (set! (-> s1-0 segment (-> s1-0 depth)) sv-576) + (+! (-> s1-0 count) 1) + (+! (-> s1-0 depth) 1) + (set! (-> s1-0 max-depth) (max (-> s1-0 max-depth) (-> s1-0 depth))) + ) + ) + 0 + ) + (let ((s1-1 (new 'stack-no-clear 'collide-query))) + (cond + ((find-ground obj s1-1 arg3 arg0 arg1 1024.0) + (let ((a1-4 (new 'stack-no-clear 'vector))) + (set! (-> a1-4 quad) (-> obj trans quad)) + (set! (-> a1-4 y) (-> s1-1 best-other-tri intersect y)) + (move-to-point! obj a1-4) + ) + (let ((a1-5 (-> s1-1 best-other-tri intersect)) + (a0-19 (-> s1-1 best-other-tri normal)) + (v1-25 (-> s1-1 best-other-tri pat)) + ) + (set! (-> obj grount-touch-point quad) (-> a1-5 quad)) + (set! (-> obj poly-normal quad) (-> a0-19 quad)) + (set! (-> obj surface-normal quad) (-> a0-19 quad)) + (set! (-> obj local-normal quad) (-> a0-19 quad)) + (set! (-> obj ground-poly-normal quad) (-> a0-19 quad)) + (set! (-> obj poly-pat) v1-25) + (set! (-> obj cur-pat) v1-25) + (set! (-> obj ground-pat) v1-25) + ) + (logior! (-> obj status) (collide-status on-surface on-ground touch-surface)) + #t + ) + (else + (logclear! (-> obj status) (collide-status + on-surface + on-ground + touch-surface + touch-wall + touch-ceiling + touch-actor + on-special-surface + touch-edge + blocked + on-water + impact-surface + touch-background + stuck + glance + ) + ) + (when (not (logtest? (-> obj root-prim prim-core action) (collide-action no-normal-reset))) + (let ((v1-36 (-> obj dynam gravity-normal))) + (set! (-> obj local-normal quad) (-> v1-36 quad)) + (set! (-> obj surface-normal quad) (-> v1-36 quad)) + (set! (-> obj poly-normal quad) (-> v1-36 quad)) + ) + (set! (-> obj coverage) 0.0) + (set! (-> obj touch-angle) 0.0) + ) + (if arg2 + (format 0 "WARNING: move-to-ground: failed to locate ground for ~S!~%" (-> obj process name)) + ) + ) + ) + ) + (when *debug-segment* + (let ((gp-1 (-> *display* frames (-> *display* on-screen) profile-array data 0))) + (when (and *dproc* *debug-segment*) + (let* ((v1-52 (+ (-> gp-1 depth) -1)) + (s5-1 (-> gp-1 segment v1-52)) + (s4-1 (-> gp-1 base-time)) + ) + (when (>= v1-52 0) + (set! (-> s5-1 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s4-1)))) + (+! (-> gp-1 depth) -1) + ) + ) + ) + ) + 0 + ) + (none) + ) + +;; definition for method 62 of type collide-shape-moving +;; INFO: Used lq/sq +(defmethod compute-acc-due-to-gravity collide-shape-moving ((obj collide-shape-moving) (arg0 vector) (arg1 float)) + (let* ((s4-0 (vector-negate! (new 'stack-no-clear 'vector) (-> obj dynam gravity))) + (a2-1 (-> obj local-normal)) + (a2-2 (vector-reflect-flat! (new-stack-vector0) s4-0 a2-1)) + ) + (vector--float*! arg0 s4-0 a2-2 (cond + ((logtest? (-> obj status) (collide-status on-surface)) + (empty) + arg1 + ) + (else + 0.0 + ) + ) + ) + ) + arg0 + ) + +;; definition for method 32 of type collide-shape +(defmethod fill-cache-integrate-and-collide collide-shape ((obj collide-shape) (arg0 vector) (arg1 collide-query) (arg2 meters)) + (local-vars (at-0 int)) + (with-pp + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((v1-0 (new 'stack-no-clear 'vector))) + (let ((a0-1 v1-0)) + (.lvf vf1 (&-> arg0 quad)) + (let ((f0-0 (-> pp clock seconds-per-frame))) + (.mov at-0 f0-0) + ) + (.mov vf2 at-0) + (.mov.vf vf1 vf0 :mask #b1000) + (.mul.x.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> a0-1 quad) vf1) + ) + (fill-cache-for-shape obj (+ (vector-length v1-0) arg2) arg1) + ) + (integrate-and-collide! obj arg0) + (none) + ) + ) + ) + +;; definition for method 31 of type collide-shape +;; WARN: Return type mismatch int vs none. +(defmethod fill-cache-for-shape collide-shape ((obj collide-shape) (arg0 float) (arg1 collide-query)) + (cond + ((build-bounding-box-for-shape obj (-> arg1 bbox) arg0 (-> arg1 collide-with)) + (fill-using-bounding-box *collide-cache* arg1) + (if (and *display-collide-cache* (or (= (-> obj process type) target) (= (-> obj process) *debug-actor*))) + (debug-draw *collide-cache*) + ) + ) + (else + (reset *collide-cache*) + ) + ) + 0 + (none) + ) + +;; definition for method 36 of type collide-shape +(defmethod build-bounding-box-for-shape collide-shape ((obj collide-shape) (arg0 bounding-box) (arg1 float) (arg2 collide-spec)) + (rlet ((vf0 :class vf) + (vf24 :class vf) + (vf25 :class vf) + (vf26 :class vf) + (vf27 :class vf) + (vf28 :class vf) + (vf29 :class vf) + (vf30 :class vf) + (vf31 :class vf) + ) + (init-vf0-vector) + (let ((t0-0 (new 'static 'vector :x 4.096)) + (v1-0 (-> obj root-prim)) + ) + (.mov vf31 arg1) + (let ((a0-2 (logand (-> v1-0 prim-core collide-with) arg2)) + (a2-1 (-> v1-0 prim-core prim-type)) + ) + (b! (zero? a0-2) cfg-9 :delay (.lvf vf28 (&-> t0-0 quad))) + (.add.x.vf vf31 vf31 vf28 :mask #b1) + (let ((a0-3 (-> v1-0 specific 0))) + (b! (= a2-1 (prim-type group)) cfg-3 :delay (.lvf vf24 (&-> v1-0 prim-core world-sphere quad))) + (.add.w.vf vf25 vf31 vf24 :mask #b1) + (.add.x.vf vf30 vf24 vf25 :mask #b111) + (b! #t cfg-10 :delay (.sub.x.vf vf29 vf24 vf25 :mask #b111)) + (label cfg-3) + (b! (zero? a0-3) cfg-9 :delay (set! v1-0 (+ v1-0 80))) + (+! a0-3 -1) + (let ((a2-3 (logand (-> v1-0 prim-core collide-with) arg2))) + (.lvf vf24 (&-> v1-0 prim-core world-sphere quad)) + (b! (zero? a2-3) cfg-3 :delay (.add.w.vf vf25 vf31 vf24 :mask #b1)) + ) + (.add.x.vf vf30 vf24 vf25 :mask #b111) + (.sub.x.vf vf29 vf24 vf25 :mask #b111) + (label cfg-6) + (b! (zero? a0-3) cfg-10 :delay (set! v1-0 (+ v1-0 80))) + (+! a0-3 -1) + ) + ) + (let ((a2-5 (logand (-> v1-0 prim-core collide-with) arg2))) + (.lvf vf24 (&-> v1-0 prim-core world-sphere quad)) + (b! (zero? a2-5) cfg-6 :delay (.add.w.vf vf25 vf31 vf24 :mask #b1)) + ) + ) + (.add.x.vf vf27 vf24 vf25 :mask #b111) + (.sub.x.vf vf26 vf24 vf25 :mask #b111) + (.min.vf vf29 vf29 vf26) + (.max.vf vf30 vf30 vf27) + (b! #t cfg-6 :delay (nop!)) + (label cfg-9) + (let ((v0-0 #f)) + (b! #t cfg-11 :delay (nop!)) + (label cfg-10) + (.mov.vf vf29 vf0 :mask #b1000) + (.mov.vf vf30 vf0 :mask #b1000) + (.svf (&-> arg0 min quad) vf29) + (.svf (&-> arg0 max quad) vf30) + (set! v0-0 #t) + (label cfg-11) + v0-0 + ) + ) + ) + +;; definition for method 33 of type collide-shape +(defmethod find-prim-by-id collide-shape ((obj collide-shape) (arg0 uint)) + (let ((v1-0 (-> obj root-prim))) + (countdown (a0-1 (-> obj total-prims)) + (if (= (-> v1-0 prim-id) arg0) + (return v1-0) + ) + (&+! v1-0 80) + ) + ) + (the-as collide-shape-prim #f) + ) + +;; definition for method 34 of type collide-shape +(defmethod find-prim-by-id-logtest collide-shape ((obj collide-shape) (arg0 uint)) + (let ((v1-0 (-> obj root-prim))) + (countdown (a0-1 (-> obj total-prims)) + (if (logtest? (-> v1-0 prim-id) arg0) + (return v1-0) + ) + (&+! v1-0 80) + ) + ) + (the-as collide-shape-prim #f) + ) + +;; definition (debug) for function collide-shape-draw-debug-marks +;; WARN: Return type mismatch int vs none. +(defun-debug collide-shape-draw-debug-marks () + (add-debug-sphere + (or *display-collision-marks* *display-target-marks*) + (bucket-id debug2) + (target-pos 0) + (meters 0.2) + (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) + ) + (when *display-collision-marks* + (let ((v1-4 (-> *collide-player-list* alive-list next0))) + *collide-player-list* + (let ((gp-1 (-> v1-4 next0))) + (while (!= v1-4 (-> *collide-player-list* alive-list-end)) + (let ((a0-4 (the-as collide-shape (-> (the-as connection v1-4) param1)))) + (if (or (not *debug-actor*) (= (-> a0-4 process) *target*) (= (-> a0-4 process) *debug-actor*)) + (debug-draw a0-4) + ) + ) + (set! v1-4 gp-1) + *collide-player-list* + (set! gp-1 (-> gp-1 next0)) + ) + ) + ) + (let ((v1-15 (-> *collide-hit-by-player-list* alive-list next0))) + *collide-hit-by-player-list* + (let ((gp-2 (-> v1-15 next0))) + (while (!= v1-15 (-> *collide-hit-by-player-list* alive-list-end)) + (let ((a0-11 (-> (the-as connection v1-15) param1))) + (if (or (not *debug-actor*) + (= (-> (the-as collide-shape a0-11) process) *target*) + (= (-> (the-as collide-shape a0-11) process) *debug-actor*) + ) + (debug-draw a0-11) + ) + ) + (set! v1-15 gp-2) + *collide-hit-by-player-list* + (set! gp-2 (-> gp-2 next0)) + ) + ) + ) + (let ((v1-26 (-> *collide-hit-by-others-list* alive-list next0))) + *collide-hit-by-others-list* + (let ((gp-3 (-> v1-26 next0))) + (while (!= v1-26 (-> *collide-hit-by-others-list* alive-list-end)) + (let ((a0-18 (the-as collide-shape (-> (the-as connection v1-26) param1)))) + (if (or (not *debug-actor*) (= (-> a0-18 process) *target*) (= (-> a0-18 process) *debug-actor*)) + (debug-draw a0-18) + ) + ) + (set! v1-26 gp-3) + *collide-hit-by-others-list* + (set! gp-3 (-> gp-3 next0)) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 30 of type collide-shape +;; WARN: Return type mismatch int vs none. +(defmethod debug-draw collide-shape ((obj collide-shape)) + (if (sphere-in-view-frustum? (the-as sphere (-> obj root-prim prim-core))) + (debug-draw (-> obj root-prim)) + ) + 0 + (none) + ) + +;; definition for symbol *col-timer*, type stopwatch +(define *col-timer* (new 'global 'stopwatch)) + +;; definition for symbol *frame-timer*, type stopwatch +(define *frame-timer* (new 'global 'stopwatch)) + +;; definition for symbol *col-timer-enable*, type symbol +(define *col-timer-enable* #t) + +;; definition for function debug-report-col-stats +(defun debug-report-col-stats () + (when *col-timer-enable* + (stopwatch-end *frame-timer*) + (format *stdcon* "col stats:~%") + (format *stdcon* " col ~F ms~%" (* 1000.0 (stopwatch-elapsed-seconds *col-timer*))) + (format *stdcon* " frame ~F ms~%" (* 1000.0 (stopwatch-elapsed-seconds *frame-timer*))) + (stopwatch-init *col-timer*) + (stopwatch-init *frame-timer*) + (stopwatch-begin *frame-timer*) + ) + ) + +;; definition for method 46 of type collide-shape +;; WARN: Return type mismatch int vs none. +(defmethod update-transforms collide-shape ((obj collide-shape)) + (local-vars (v1-8 float) (a1-5 float) (a1-7 float)) + (rlet ((acc :class vf) + (Q :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + ) + (init-vf0-vector) + (let ((s5-0 (-> obj root-prim)) + (v1-1 (-> obj process node-list)) + ) + (cond + ((nonzero? v1-1) + (countdown (a0-1 (-> obj total-prims)) + (let ((a1-0 (-> s5-0 transform-index))) + (cond + ((>= a1-0 0) + (let ((a1-4 (-> v1-1 data a1-0 bone transform))) + (.lvf vf5 (&-> a1-4 trans quad)) + (.lvf vf1 (&-> s5-0 local-sphere quad)) + (.lvf vf2 (&-> a1-4 vector 0 quad)) + (.mul.w.vf acc vf5 vf0) + (.div.vf Q vf0 vf5 :fsf #b11 :ftf #b11) + (.lvf vf3 (&-> a1-4 vector 1 quad)) + (.add.mul.x.vf acc vf2 vf1 acc) + (.lvf vf4 (&-> a1-4 vector 2 quad)) + ) + (.add.mul.y.vf acc vf3 vf1 acc) + (.add.mul.z.vf vf1 vf4 vf1 acc :mask #b111) + (.mul.vf vf1 vf1 Q :mask #b111) + (.svf (&-> s5-0 prim-core world-sphere quad) vf1) + (.mov a1-5 vf1) + ) + (else + (when (= a1-0 -2) + (.lvf vf1 (&-> s5-0 local-sphere quad)) + (.lvf vf2 (&-> obj trans quad)) + (.add.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> s5-0 prim-core world-sphere quad) vf1) + (.mov a1-7 vf1) + ) + ) + ) + ) + (&+! s5-0 80) + ) + ) + (else + (countdown (s4-0 (-> obj total-prims)) + (case (-> s5-0 transform-index) + ((-3) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (vector-orient-by-quat! s3-0 (-> s5-0 local-sphere) (-> obj quat)) + (vector+! (the-as vector (-> s5-0 prim-core)) s3-0 (-> obj trans)) + ) + (set! (-> s5-0 prim-core world-sphere w) (-> s5-0 local-sphere w)) + ) + ((-2) + (.lvf vf1 (&-> s5-0 local-sphere quad)) + (.lvf vf2 (&-> obj trans quad)) + (.add.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> s5-0 prim-core world-sphere quad) vf1) + (.mov v1-8 vf1) + ) + ) + (&+! s5-0 80) + ) + ) + ) + ) + 0 + (none) + ) + ) + +;; definition for method 28 of type collide-shape +;; WARN: Return type mismatch int vs none. +(defmethod move-by-vector! collide-shape ((obj collide-shape) (arg0 vector)) + (vector+! (-> obj trans) (-> obj trans) arg0) + (let ((v1-1 (-> obj root-prim))) + (countdown (a0-1 (-> obj total-prims)) + (vector+! (the-as vector (-> v1-1 prim-core)) (the-as vector (-> v1-1 prim-core)) arg0) + (set! (-> v1-1 prim-core world-sphere w) (-> v1-1 local-sphere w)) + (&+! v1-1 80) + ) + ) + 0 + (none) + ) + +;; definition for method 29 of type collide-shape +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod move-to-point! collide-shape ((obj collide-shape) (arg0 vector)) + (let ((v1-0 (new 'stack-no-clear 'vector))) + (vector-! v1-0 arg0 (-> obj trans)) + (set! (-> obj trans quad) (-> arg0 quad)) + (let ((a1-2 (-> obj root-prim))) + (countdown (a0-1 (-> obj total-prims)) + (vector+! (the-as vector (-> a1-2 prim-core)) (the-as vector (-> a1-2 prim-core)) v1-0) + (set! (-> a1-2 prim-core world-sphere w) (-> a1-2 local-sphere w)) + (&+! a1-2 80) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 47 of type collide-shape +;; WARN: Return type mismatch int vs none. +(defmethod set-collide-with! collide-shape ((obj collide-shape) (arg0 collide-spec)) + (let ((v1-0 (-> obj root-prim))) + (countdown (a0-1 (-> obj total-prims)) + (set! (-> v1-0 prim-core collide-with) arg0) + (nop!) + (nop!) + (&+! v1-0 80) + ) + ) + 0 + (none) + ) + +;; definition for method 48 of type collide-shape +;; WARN: Return type mismatch int vs none. +(defmethod set-collide-as! collide-shape ((obj collide-shape) (arg0 collide-spec)) + (let ((v1-0 (-> obj root-prim))) + (countdown (a0-1 (-> obj total-prims)) + (set! (-> v1-0 prim-core collide-as) arg0) + (nop!) + (nop!) + (&+! v1-0 80) + ) + ) + 0 + (none) + ) + +;; definition for method 53 of type collide-shape +;; WARN: Return type mismatch int vs none. +(defmethod iterate-prims collide-shape ((obj collide-shape) (arg0 (function collide-shape-prim none))) + (let ((s5-0 (-> obj root-prim))) + (countdown (s4-0 (-> obj total-prims)) + (arg0 s5-0) + (&+! s5-0 80) + ) + ) + 0 + (none) + ) + +;; definition for method 38 of type collide-shape +;; WARN: Return type mismatch int vs none. +(defmethod find-collision-meshes collide-shape ((obj collide-shape)) + (let ((s5-0 (-> obj root-prim)) + (s4-0 0) + ) + (case (-> s5-0 prim-core prim-type) + (((prim-type mesh)) + (set! s4-0 1) + ) + (((prim-type group)) + (set! s4-0 (the-as int (-> s5-0 specific 1))) + (&+! s5-0 80) + ) + ) + (when (nonzero? s4-0) + (let ((s3-0 0)) + (let ((v1-7 (-> obj process draw)) + (s2-0 (the-as (array collide-mesh) #f)) + ) + (when (and (nonzero? v1-7) (-> v1-7 jgeo)) + (set! s2-0 (res-lump-struct (-> v1-7 jgeo extra) 'collide-mesh-group (array collide-mesh))) + (when s2-0 + (countdown (s1-0 s4-0) + (when (= (-> s5-0 prim-core prim-type) (prim-type mesh)) + (let ((s0-0 (-> (the-as collide-shape-prim-mesh s5-0) mesh-id))) + (cond + ((and (>= s0-0 0) (< s0-0 (length s2-0))) + (set! (-> (the-as collide-shape-prim-mesh s5-0) mesh) (-> s2-0 s0-0)) + ) + (else + (set! (-> (the-as collide-shape-prim-mesh s5-0) mesh) #f) + (+! s3-0 1) + ) + ) + ) + ) + (set! s5-0 (&+ (the-as collide-shape-prim-mesh s5-0) 80)) + ) + ) + ) + (when (not s2-0) + (while (nonzero? s4-0) + (+! s4-0 -1) + (when (= (-> (the-as collide-shape-prim-mesh s5-0) prim-core prim-type) (prim-type mesh)) + (set! (-> (the-as collide-shape-prim-mesh s5-0) mesh) #f) + (+! s3-0 1) + ) + (set! s5-0 (&+ (the-as collide-shape-prim-mesh s5-0) 80)) + ) + ) + ) + (if (nonzero? s3-0) + (format 0 "ERROR: Failed to find collision meshes for ~D prim(s) in ~A!~%" s3-0 (-> obj process name)) + ) + ) + ) + ) + (update-transforms obj) + 0 + (none) + ) + +;; definition for method 9 of type collide-shape-prim +;; WARN: Return type mismatch int vs none. +(defmethod debug-draw collide-shape-prim ((obj collide-shape-prim)) + (add-debug-sphere + #t + (bucket-id debug2) + (the-as vector (-> obj prim-core)) + (-> obj local-sphere w) + (new 'static 'rgba :r #xff :g #xff :b #xff :a #x40) + ) + 0 + (none) + ) + +;; definition for method 9 of type collide-shape-prim-sphere +;; WARN: Return type mismatch int vs none. +(defmethod debug-draw collide-shape-prim-sphere ((obj collide-shape-prim-sphere)) + (add-debug-sphere + #t + (bucket-id debug2) + (the-as vector (-> obj prim-core)) + (-> obj local-sphere w) + (cond + ((and (zero? (-> obj prim-core collide-as)) (zero? (-> obj prim-core collide-with))) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x40) + ) + ((logtest? (-> obj prim-core action) (collide-action solid)) + (new 'static 'rgba :r #xff :g #xff :a #x40) + ) + (else + (new 'static 'rgba :r #xff :g #x80 :a #x40) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 9 of type collide-shape-prim-mesh +;; WARN: Return type mismatch int vs none. +(defmethod debug-draw collide-shape-prim-mesh ((obj collide-shape-prim-mesh)) + (add-debug-sphere + #t + (bucket-id debug2) + (the-as vector (-> obj prim-core)) + (-> obj local-sphere w) + (new 'static 'rgba :b #xff :a #x40) + ) + 0 + (none) + ) + +;; definition for method 9 of type collide-shape-prim-group +;; WARN: Return type mismatch int vs none. +(defmethod debug-draw collide-shape-prim-group ((obj collide-shape-prim-group)) + (add-debug-sphere + #t + (bucket-id debug2) + (the-as vector (-> obj prim-core)) + (-> obj local-sphere w) + (new 'static 'rgba :g #xff :a #x10) + ) + (countdown (s5-0 (the-as uint (-> obj num-children))) + (debug-draw (-> obj child s5-0)) + ) + 0 + (none) + ) + +;; definition for method 45 of type collide-shape +;; INFO: Used lq/sq +(defmethod do-push-aways collide-shape ((obj collide-shape)) + (local-vars (at-0 int) (v1-55 float) (a2-5 float) (a2-12 float)) + (with-pp + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + ) + (init-vf0-vector) + (let ((gp-0 (new 'stack-no-clear 'do-push-aways-work))) + (set! (-> gp-0 cspec) (collide-spec)) + (let ((s4-0 (-> obj root-prim prim-core collide-with))) + (set! *actor-list-length* 0) + (if (logtest? s4-0 (collide-spec hit-by-others-list)) + (set! *actor-list-length* + (fill-actor-list-for-sphere *actor-hash* (the-as sphere (-> obj root-prim prim-core)) *actor-list* 256) + ) + ) + (when (logtest? s4-0 (collide-spec player-list)) + (let ((a0-2 (-> *collide-player-list* alive-list next0))) + *collide-player-list* + (let ((v1-13 (-> a0-2 next0))) + (while (!= a0-2 (-> *collide-player-list* alive-list-end)) + (let* ((a0-3 (-> (the-as connection a0-2) param1)) + (a1-1 (-> (the-as collide-shape a0-3) root-prim)) + ) + (when (logtest? s4-0 (-> a1-1 prim-core collide-as)) + (let ((a1-2 (-> a1-1 prim-core))) + (let ((a2-4 a1-2) + (a3-2 (-> obj root-prim prim-core)) + ) + (.lvf vf2 (&-> a2-4 world-sphere quad)) + (.lvf vf3 (&-> a3-2 world-sphere quad)) + ) + (.sub.vf vf1 vf3 vf2) + (.mul.vf vf1 vf1 vf1) + (.add.y.vf vf1 vf1 vf1 :mask #b1) + (.add.z.vf vf1 vf1 vf1 :mask #b1) + (.mov a2-5 vf1) + (let ((f0-0 a2-5) + (f1-1 (+ (-> a1-2 world-sphere w) (-> obj root-prim prim-core world-sphere w))) + ) + (when (< f0-0 (* f1-1 f1-1)) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-3)) + (set! *actor-list-length* (+ *actor-list-length* 1)) + ) + ) + ) + ) + ) + ) + (set! a0-2 v1-13) + *collide-player-list* + (set! v1-13 (-> v1-13 next0)) + ) + ) + ) + ) + (when (logtest? s4-0 (collide-spec hit-by-player-list)) + (let ((a0-5 (-> *collide-hit-by-player-list* alive-list next0))) + *collide-hit-by-player-list* + (let ((v1-21 (-> a0-5 next0))) + (while (!= a0-5 (-> *collide-hit-by-player-list* alive-list-end)) + (let* ((a0-6 (-> (the-as connection a0-5) param1)) + (a1-14 (-> (the-as collide-shape-moving a0-6) root-prim)) + ) + (when (logtest? s4-0 (-> a1-14 prim-core collide-as)) + (let ((a1-15 (-> a1-14 prim-core))) + (let ((a2-11 a1-15) + (a3-4 (-> obj root-prim prim-core)) + ) + (.lvf vf2 (&-> a2-11 world-sphere quad)) + (.lvf vf3 (&-> a3-4 world-sphere quad)) + ) + (.sub.vf vf1 vf3 vf2) + (.mul.vf vf1 vf1 vf1) + (.add.y.vf vf1 vf1 vf1 :mask #b1) + (.add.z.vf vf1 vf1 vf1 :mask #b1) + (.mov a2-12 vf1) + (let ((f0-1 a2-12) + (f1-5 (+ (-> a1-15 world-sphere w) (-> obj root-prim prim-core world-sphere w))) + ) + (when (< f0-1 (* f1-5 f1-5)) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) + (set! *actor-list-length* (+ *actor-list-length* 1)) + ) + ) + ) + ) + ) + ) + (set! a0-5 v1-21) + *collide-hit-by-player-list* + (set! v1-21 (-> v1-21 next0)) + ) + ) + ) + ) + (dotimes (s3-0 *actor-list-length*) + (let* ((s1-0 (-> *actor-list* s3-0)) + (s2-0 (-> s1-0 root-prim)) + ) + (when (logtest? s4-0 (-> s2-0 prim-core collide-as)) + (when (!= (-> obj process) (-> s1-0 process)) + (when (and (should-push-away obj s1-0 (-> gp-0 cquery)) (>= -81.92 (-> gp-0 cquery best-dist))) + (set! (-> gp-0 cquery collide-with) (-> s1-0 root-prim prim-core collide-with)) + (set! (-> gp-0 cquery ignore-process0) (-> s1-0 process)) + (set! (-> gp-0 cquery ignore-process1) #f) + (set! (-> gp-0 cquery ignore-pat) (-> s1-0 pat-ignore-mask)) + (set! (-> gp-0 cquery action-mask) (collide-action solid)) + (-> gp-0 cquery) + (fill-cache-for-shape s1-0 8192.0 (-> gp-0 cquery)) + (let ((s4-1 3)) + (until (or (<= s4-1 0) (not (should-push-away obj s1-0 (-> gp-0 cquery)))) + (set! (-> gp-0 vec33 quad) (-> s1-0 trans quad)) + (let* ((f0-4 (+ 2867.2 (-> gp-0 vec33 y))) + (f2-2 (+ 5734.4 f0-4)) + (f1-11 (-> gp-0 cquery best-other-tri intersect y)) + ) + (cond + ((< f1-11 f0-4) + (set! f1-11 f0-4) + ) + ((< f2-2 f1-11) + (set! f1-11 f2-2) + ) + ) + (set! (-> gp-0 vec33 y) f1-11) + ) + (.lvf vf4 (&-> (-> gp-0 vec33) quad)) + (.lvf vf3 (&-> (-> gp-0 cquery) best-other-tri intersect quad)) + (.lvf vf5 (&-> (-> gp-0 cquery) best-other-tri normal quad)) + (.sub.vf vf2 vf4 vf3) + (.mul.vf vf1 vf5 vf2) + (.add.x.vf vf1 vf1 vf1 :mask #b10) + (.add.z.vf vf1 vf1 vf1 :mask #b10) + (.mov v1-55 vf1) + (b! (< (the-as int v1-55) 0) cfg-35 :likely-delay (.sub.vf vf2 vf0 vf2)) + (label cfg-35) + (.svf (&-> (-> gp-0 push-vel) quad) vf2) + (vector-normalize! (-> gp-0 push-vel) 1.0) + (vector-float*! (-> gp-0 push-vel) (-> gp-0 push-vel) (- (-> gp-0 cquery best-dist))) + (let ((v1-59 (-> gp-0 push-vel))) + (.lvf vf1 (&-> (-> gp-0 push-vel) quad)) + (let ((f0-7 (-> pp clock frames-per-second))) + (.mov at-0 f0-7) + ) + (.mov vf2 at-0) + (.mov.vf vf1 vf0 :mask #b1000) + (.mul.x.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> v1-59 quad) vf1) + ) + (let ((s0-0 (-> (the-as collide-shape-moving s1-0) status))) + (integrate-and-collide! (the-as collide-shape-moving s1-0) (-> gp-0 push-vel)) + (set! (-> (the-as collide-shape-moving s1-0) status) s0-0) + ) + (+! s4-1 -1) + ) + (if (zero? s4-1) + (logior! (-> gp-0 cspec) (-> s2-0 prim-core collide-as)) + ) + ) + (set! s4-0 (-> obj root-prim prim-core collide-with)) + ) + ) + ) + ) + ) + ) + (-> gp-0 cspec) + ) + ) + ) + ) + +;; definition for method 40 of type collide-shape +;; WARN: Return type mismatch object vs symbol. +(defmethod find-overlapping-shapes collide-shape ((obj collide-shape) (arg0 overlaps-others-params)) + (local-vars (a0-10 float) (a0-14 uint) (a2-5 float) (a2-12 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (let ((gp-0 (the-as object #f))) + (let* ((s3-0 (-> obj root-prim)) + (s2-0 (the-as uint (logand (-> s3-0 prim-core collide-with) (-> arg0 collide-with-filter)))) + ) + (set! (-> arg0 filtered-root-collide-with) (the-as collide-spec s2-0)) + (set! *actor-list-length* 0) + (b! (not (logtest? (the-as collide-spec s2-0) 512)) cfg-2 :delay (empty-form)) + (set! *actor-list-length* + (fill-actor-list-for-sphere *actor-hash* (the-as sphere (-> s3-0 prim-core)) *actor-list* 256) + ) + (label cfg-2) + (b! (not (logtest? (the-as collide-spec s2-0) 1024)) cfg-11 :delay (empty-form)) + (let ((a0-3 (-> *collide-player-list* alive-list next0))) + *collide-player-list* + (let ((v1-12 (-> a0-3 next0))) + (b! #t cfg-9 :delay (nop!)) + (label cfg-4) + (let ((a0-4 (-> (the-as connection a0-3) param1))) + (let ((a1-2 (-> (the-as collide-shape a0-4) root-prim))) + (b! (not (logtest? (the-as collide-spec s2-0) (-> a1-2 prim-core collide-as))) cfg-8 :delay (empty-form)) + (let ((a1-3 (-> a1-2 prim-core))) + (let ((a2-4 a1-3) + (a3-1 (-> s3-0 prim-core)) + ) + (.lvf vf2 (&-> a2-4 world-sphere quad)) + (.lvf vf3 (&-> a3-1 world-sphere quad)) + ) + (.sub.vf vf1 vf3 vf2) + (.mul.vf vf1 vf1 vf1) + (.add.y.vf vf1 vf1 vf1 :mask #b1) + (.add.z.vf vf1 vf1 vf1 :mask #b1) + (.mov a2-5 vf1) + (let ((f0-0 a2-5) + (f1-1 (+ (-> a1-3 world-sphere w) (-> s3-0 prim-core world-sphere w))) + ) + (b! (>= f0-0 (* f1-1 f1-1)) cfg-8 :delay #f) + ) + ) + ) + (b! (>= *actor-list-length* 256) cfg-8 :delay #f) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-4)) + ) + (set! *actor-list-length* (+ *actor-list-length* 1)) + (label cfg-8) + (set! a0-3 v1-12) + *collide-player-list* + (set! v1-12 (-> v1-12 next0)) + ) + (label cfg-9) + (b! (!= a0-3 (-> *collide-player-list* alive-list-end)) cfg-4 :delay (nop!)) + ) + (label cfg-11) + (b! (not (logtest? (the-as collide-spec s2-0) 256)) cfg-20 :delay (empty-form)) + (let ((a0-6 (-> *collide-hit-by-player-list* alive-list next0))) + *collide-hit-by-player-list* + (let ((v1-20 (-> a0-6 next0))) + (b! #t cfg-18 :delay (nop!)) + (label cfg-13) + (let ((a0-7 (-> (the-as connection a0-6) param1))) + (let ((a1-14 (-> (the-as collide-shape-moving a0-7) root-prim))) + (b! (not (logtest? (the-as collide-spec s2-0) (-> a1-14 prim-core collide-as))) cfg-17 :delay (empty-form)) + (let ((a1-15 (-> a1-14 prim-core))) + (let ((a2-11 a1-15) + (a3-2 (-> s3-0 prim-core)) + ) + (.lvf vf2 (&-> a2-11 world-sphere quad)) + (.lvf vf3 (&-> a3-2 world-sphere quad)) + ) + (.sub.vf vf1 vf3 vf2) + (.mul.vf vf1 vf1 vf1) + (.add.y.vf vf1 vf1 vf1 :mask #b1) + (.add.z.vf vf1 vf1 vf1 :mask #b1) + (.mov a2-12 vf1) + (let ((f0-1 a2-12) + (f1-5 (+ (-> a1-15 world-sphere w) (-> s3-0 prim-core world-sphere w))) + ) + (b! (>= f0-1 (* f1-5 f1-5)) cfg-17 :delay #f) + ) + ) + ) + (b! (>= *actor-list-length* 256) cfg-17 :delay #f) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-7)) + ) + (set! *actor-list-length* (+ *actor-list-length* 1)) + (label cfg-17) + (set! a0-6 v1-20) + *collide-hit-by-player-list* + (set! v1-20 (-> v1-20 next0)) + ) + (label cfg-18) + (b! (!= a0-6 (-> *collide-hit-by-player-list* alive-list-end)) cfg-13 :delay (nop!)) + ) + (label cfg-20) + (let ((s1-0 0)) + (b! #t cfg-30 :delay (nop!)) + (label cfg-21) + (let ((s0-0 (-> *actor-list* s1-0))) + (let ((a2-15 (-> s0-0 root-prim))) + (b! (not (logtest? (the-as collide-spec s2-0) (-> a2-15 prim-core collide-as))) cfg-29 :delay (empty-form)) + (.lvf vf1 (&-> s3-0 prim-core world-sphere quad)) + (.lvf vf2 (&-> a2-15 prim-core world-sphere quad)) + (.sub.vf vf3 vf1 vf2) + (.add.w.vf vf4 vf1 vf2 :mask #b1000) + (.mul.vf vf3 vf3 vf3 :mask #b111) + (.mul.w.vf vf4 vf4 vf4 :mask #b1000) + (.mul.x.vf acc vf0 vf3 :mask #b1000) + (.add.mul.y.vf acc vf0 vf3 acc :mask #b1000) + (.add.mul.z.vf vf3 vf0 vf3 acc :mask #b1000) + (.sub.w.vf vf3 vf3 vf4 :mask #b1000) + (let ((f0-2 0.0)) + (.add.w.vf vf3 vf0 vf3 :mask #b1) + (let ((v1-28 (-> obj process))) + (.mov a0-10 vf3) + (let ((a1-26 (-> s0-0 process))) + (b! (< f0-2 a0-10) cfg-28) + (b! (= v1-28 a1-26) cfg-28 :delay (nop!)) + ) + ) + ) + (let ((v1-30 (overlaps-others-test s3-0 arg0 a2-15))) + (.lvf vf1 (&-> s3-0 prim-core world-sphere quad)) + (b! (= v1-30 #f) cfg-28 :delay (set! s2-0 (the-as uint (-> arg0 filtered-root-collide-with)))) + ) + ) + (let ((a0-12 (-> (the-as (pointer uint64) arg0) 0)) + (v1-31 (-> obj penetrate-using)) + ) + (b! (not (logtest? a0-12 4)) cfg-27 :delay (set! a0-14 (the-as uint (-> arg0 tlist)))) + (b! (logtest? (-> s0-0 penetrated-by) v1-31) cfg-28 :delay (nop!)) + ) + ) + (label cfg-27) + (b! (= a0-14 #f) cfg-32 :delay (set! gp-0 0)) + (label cfg-28) + 0 + (label cfg-29) + (+! s1-0 1) + (label cfg-30) + (b! (< s1-0 *actor-list-length*) cfg-21) + ) + ) + (label cfg-32) + (b! (= (the-as uint gp-0) #f) cfg-34 :delay (nop!)) + (set! gp-0 #t) + (label cfg-34) + (the-as symbol gp-0) + ) + ) + ) + +;; definition for method 12 of type collide-shape-prim +(defmethod overlaps-others-test collide-shape-prim ((obj collide-shape-prim) (arg0 overlaps-others-params) (arg1 collide-shape-prim)) + (format 0 "ERROR: Unsupported call to collide-shape-prim::overlaps-others-test!~%") + #f + ) + +;; definition for method 12 of type collide-shape-prim-group +;; WARN: Return type mismatch object vs symbol. +(defmethod overlaps-others-test collide-shape-prim-group ((obj collide-shape-prim-group) (arg0 overlaps-others-params) (arg1 collide-shape-prim)) + (local-vars (a0-3 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (let ((s4-0 (the-as collide-shape-prim obj)) + (v1-0 (-> arg1 prim-core collide-as)) + (s2-0 (the-as object #f)) + ) + (let ((a1-1 (-> arg0 collide-with-filter))) + (nop!) + (let ((s3-0 (the-as uint (-> obj num-children))) + (v1-1 (logand v1-0 a1-1)) + ) + (.lvf vf1 (&-> arg1 prim-core world-sphere quad)) + (nop!) + (set! (-> arg0 filtered-other-collide-as) v1-1) + (label cfg-1) + (b! (zero? s3-0) cfg-6 :delay (set! s4-0 (+ s4-0 80))) + (+! s3-0 -1) + (let ((a0-2 (logand (-> s4-0 prim-core collide-with) v1-1))) + (.lvf vf2 (&-> s4-0 prim-core world-sphere quad)) + (b! (zero? a0-2) cfg-1 :delay (.sub.vf vf3 vf2 vf1)) + ) + (.add.w.vf vf4 vf2 vf1 :mask #b1000) + (.mul.vf vf3 vf3 vf3 :mask #b111) + (.mul.w.vf vf4 vf4 vf4 :mask #b1000) + (.mul.x.vf acc vf0 vf3 :mask #b1000) + (.add.mul.y.vf acc vf0 vf3 acc :mask #b1000) + (.add.mul.z.vf vf3 vf0 vf3 acc :mask #b1000) + (.sub.w.vf vf3 vf3 vf4 :mask #b1000) + (let ((f0-0 0.0)) + (.add.w.vf vf3 vf0 vf3 :mask #b1) + (.mov a0-3 vf3) + (b! (< f0-0 a0-3) cfg-1) + ) + (let ((a0-5 (overlaps-others-test s4-0 arg0 arg1))) + (set! v1-1 (-> arg0 filtered-other-collide-as)) + (b! (= a0-5 #f) cfg-1 :delay (.lvf vf1 (&-> arg1 prim-core world-sphere quad))) + ) + ) + ) + (b! (!= (-> arg0 tlist) #f) cfg-1 :delay (set! s2-0 0)) + (label cfg-6) + (b! (= (the-as uint s2-0) #f) cfg-8 :delay (nop!)) + (set! s2-0 #t) + (label cfg-8) + (the-as symbol s2-0) + ) + ) + ) + +;; definition for method 13 of type collide-shape-prim +;; WARN: Return type mismatch object vs symbol. +(defmethod overlaps-others-group collide-shape-prim ((obj collide-shape-prim) (arg0 overlaps-others-params) (arg1 collide-shape-prim-group)) + (local-vars (a0-4 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (let ((s4-0 (the-as collide-shape-prim arg1)) + (v1-0 (-> obj prim-core collide-with)) + ) + (nop!) + (let ((a0-1 (-> arg0 collide-with-filter))) + (nop!) + (let ((s3-0 (the-as uint (-> arg1 num-children))) + (v1-1 (logand v1-0 a0-1)) + ) + (.lvf vf2 (&-> obj prim-core world-sphere quad)) + (let ((s2-0 (the-as object #f))) + (set! (-> arg0 filtered-child-collide-with) v1-1) + (label cfg-1) + (b! (zero? s3-0) cfg-6 :delay (set! s4-0 (+ s4-0 80))) + (+! s3-0 -1) + (let ((a0-3 (logand v1-1 (-> s4-0 prim-core collide-as)))) + (.lvf vf1 (&-> s4-0 prim-core world-sphere quad)) + (b! (zero? a0-3) cfg-1 :delay (.sub.vf vf3 vf2 vf1)) + ) + (.add.w.vf vf4 vf2 vf1 :mask #b1000) + (.mul.vf vf3 vf3 vf3 :mask #b111) + (.mul.w.vf vf4 vf4 vf4 :mask #b1000) + (.mul.x.vf acc vf0 vf3 :mask #b1000) + (.add.mul.y.vf acc vf0 vf3 acc :mask #b1000) + (.add.mul.z.vf vf3 vf0 vf3 acc :mask #b1000) + (.sub.w.vf vf3 vf3 vf4 :mask #b1000) + (let ((f0-0 0.0)) + (.add.w.vf vf3 vf0 vf3 :mask #b1) + (.mov a0-4 vf3) + (b! (< f0-0 a0-4) cfg-1) + ) + (let ((a0-6 (overlaps-others-test obj arg0 s4-0))) + (set! v1-1 (-> arg0 filtered-child-collide-with)) + (b! (= a0-6 #f) cfg-1 :delay (.lvf vf2 (&-> obj prim-core world-sphere quad))) + ) + (b! (!= (-> arg0 tlist) #f) cfg-1 :delay (set! s2-0 0)) + (label cfg-6) + (b! (= (the-as uint s2-0) #f) cfg-8 :delay (nop!)) + (set! s2-0 #t) + (label cfg-8) + (the-as symbol s2-0) + ) + ) + ) + ) + ) + ) + +;; definition for method 12 of type collide-shape-prim-sphere +(defmethod overlaps-others-test collide-shape-prim-sphere ((obj collide-shape-prim-sphere) (arg0 overlaps-others-params) (arg1 collide-shape-prim)) + (local-vars (v1-11 uint) (s4-0 uint)) + (let ((v1-0 (-> arg1 prim-core prim-type))) + (b! (nonzero? v1-0) cfg-2 :delay (set! s4-0 (the-as uint (-> arg0 options)))) + (let ((v0-1 (overlaps-others-group obj arg0 (the-as collide-shape-prim-group arg1)))) + (b! #t cfg-17 :delay (nop!)) + (label cfg-2) + (b! (> (the-as int v1-0) 0) cfg-4 :delay (nop!)) + (b! #t cfg-11 :delay (logand s4-0 2)) + (label cfg-4) + (b! (nonzero? 0) cfg-11 :delay (nop!)) + (let ((s2-0 (-> (the-as collide-shape-prim-mesh arg1) mesh))) + (b! (not s2-0) cfg-10 :delay (empty-form)) + (let ((v1-5 (populate-for-prim-mesh *collide-mesh-cache* (the-as collide-shape-prim-mesh arg1)))) + (when v1-5 + (when (overlap-test s2-0 (the-as collide-mesh-cache-tri (-> v1-5 tris)) (the-as vector (-> obj prim-core))) + (b! #t cfg-11 :delay (nop!)) + (the-as none 0) + ) + ) + ) + ) + (label cfg-10) + (set! v0-1 #f) + (b! #t cfg-17 :delay (nop!)) + (label cfg-11) + (let ((a0-8 (-> arg0 tlist))) + (b! (= a0-8 #f) cfg-13 :delay (nop!)) + (add-touching-prims a0-8 obj arg1 -1.0 (the-as collide-tri-result #f) (the-as collide-tri-result #f)) + ) + (label cfg-13) + (b! (not (logtest? s4-0 1)) cfg-16 :delay (set! v1-11 (the-as uint (-> obj prim-core action)))) + (let ((a0-9 (-> arg1 prim-core action))) + (b! (logtest? (the-as collide-action (logand v1-11 1)) a0-9) cfg-16 :delay (nop!)) + ) + (set! v0-1 #f) + (b! #t cfg-17 :delay (nop!)) + (label cfg-16) + (set! v0-1 #t) + (label cfg-17) + v0-1 + ) + ) + ) + +;; definition for method 12 of type collide-shape-prim-mesh +(defmethod overlaps-others-test collide-shape-prim-mesh ((obj collide-shape-prim-mesh) (arg0 overlaps-others-params) (arg1 collide-shape-prim)) + (local-vars (v1-3 uint) (v1-11 uint) (s4-0 uint)) + (let ((v1-0 (-> arg1 prim-core prim-type))) + (b! (nonzero? v1-0) cfg-2 :delay (set! s4-0 (the-as uint (-> arg0 options)))) + (let ((v0-1 (overlaps-others-group obj arg0 (the-as collide-shape-prim-group arg1)))) + (b! #t cfg-18 :delay (nop!)) + (label cfg-2) + (b! (> (the-as int v1-0) 0) cfg-10 :delay (set! v1-3 (logand s4-0 2))) + (b! (nonzero? v1-3) cfg-12 :delay (nop!)) + (let ((s2-0 (-> obj mesh))) + (b! (not s2-0) cfg-9 :delay (empty-form)) + (let ((v1-5 (populate-for-prim-mesh *collide-mesh-cache* obj))) + (b! (not v1-5) cfg-9 :delay (empty-form)) + (b! + (not (overlap-test s2-0 (the-as collide-mesh-cache-tri (-> v1-5 tris)) (the-as vector (-> arg1 prim-core)))) + cfg-9 + :delay (empty-form) + ) + ) + ) + (b! #t cfg-12 :delay (nop!)) + (the-as none 0) + (label cfg-9) + (set! v0-1 #f) + (b! #t cfg-18 :delay (nop!)) + (label cfg-10) + (b! (nonzero? v1-3) cfg-12 :delay (nop!)) + (format + 0 + "ERROR: Unsupported mesh -> mesh test attempted in collide-shape-prim-mesh::overlaps-others-test!~%" + ) + (set! v0-1 #f) + (b! #t cfg-18 :delay (nop!)) + (label cfg-12) + (let ((a0-9 (-> arg0 tlist))) + (b! (= a0-9 #f) cfg-14 :delay (nop!)) + (add-touching-prims a0-9 obj arg1 -1.0 (the-as collide-tri-result #f) (the-as collide-tri-result #f)) + ) + (label cfg-14) + (b! (not (logtest? s4-0 1)) cfg-17 :delay (set! v1-11 (the-as uint (-> obj prim-core action)))) + (let ((a0-10 (-> arg1 prim-core action))) + (b! (logtest? (the-as collide-action (logand v1-11 1)) a0-10) cfg-17 :delay (nop!)) + ) + (set! v0-1 #f) + (b! #t cfg-18 :delay (nop!)) + (label cfg-17) + (set! v0-1 #t) + (label cfg-18) + v0-1 + ) + ) + ) + +;; definition for method 49 of type collide-shape +;; WARN: Return type mismatch int vs none. +(defmethod modify-collide-as! collide-shape ((obj collide-shape) (arg0 int) (arg1 collide-spec) (arg2 collide-spec)) + (let ((v1-0 (-> obj root-prim))) + (countdown (a0-1 (-> obj total-prims)) + (if (logtest? (-> v1-0 prim-id) arg0) + (set! (-> v1-0 prim-core collide-as) (logior (logclear (-> v1-0 prim-core collide-as) arg1) arg2)) + ) + (&+! v1-0 80) + ) + ) + 0 + (none) + ) + +;; definition for method 50 of type collide-shape +;; INFO: Used lq/sq +(defmethod send-shoves collide-shape ((obj collide-shape) (arg0 process) (arg1 touching-shapes-entry) (arg2 float) (arg3 float) (arg4 float)) + (local-vars (sv-144 process) (sv-160 collide-shape-prim) (sv-176 vector)) + (with-pp + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (when arg1 + (let ((s0-0 (-> arg1 head))) + (set! sv-144 arg0) + (let ((gp-0 (if (type? sv-144 process-focusable) + sv-144 + ) + ) + ) + (when (and s0-0 gp-0) + (while s0-0 + (set! sv-160 (get-touched-prim s0-0 obj arg1)) + (get-touched-prim s0-0 (-> (the-as process-focusable gp-0) root-override) arg1) + (when (logtest? (-> sv-160 prim-core action) (collide-action no-standon)) + (let ((v1-12 (get-middle-of-bsphere-overlap s0-0 (new 'stack-no-clear 'vector)))) + (set! sv-176 (new 'stack-no-clear 'vector)) + (let ((a0-7 (-> sv-160 prim-core))) + (.lvf vf4 (&-> v1-12 quad)) + (.lvf vf5 (&-> a0-7 world-sphere quad)) + ) + ) + (.mov.vf vf6 vf0 :mask #b1000) + (.sub.vf vf6 vf4 vf5 :mask #b111) + (.svf (&-> sv-176 quad) vf6) + (vector-normalize! sv-176 1.0) + (when (and (< arg2 (-> sv-176 y)) + (and (not (logtest? (focus-status dead hit board mech) (-> (the-as process-focusable gp-0) focus-status))) + (< (-> (the-as process-focusable gp-0) root-override transv y) 4.096) + ) + ) + (let ((s2-1 (new 'stack-no-clear 'vector))) + (set! (-> s2-1 quad) (-> (the-as process-focusable gp-0) root-override transv quad)) + (let* ((v1-26 (-> (the-as process-focusable gp-0) root-override transv)) + (f30-0 (sqrtf (+ (* (-> v1-26 x) (-> v1-26 x)) (* (-> v1-26 z) (-> v1-26 z))))) + ) + (if (= f30-0 0.0) + (set! (-> s2-1 quad) + (-> (vector-z-quaternion! s2-1 (-> (the-as process-focusable gp-0) root-override quat)) quad) + ) + ) + (vector-xz-normalize! s2-1 (fmax f30-0 arg4)) + ) + (set! (-> s2-1 y) arg3) + (let ((a1-8 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-8 from) (process->ppointer pp)) + (set! (-> a1-8 num-params) 2) + (set! (-> a1-8 message) 'shove) + (set! (-> a1-8 param 0) (the-as uint arg1)) + (let ((v1-34 (new 'static 'attack-info :mask (attack-info-mask vector angle id)))) + (let* ((a0-13 *game-info*) + (a2-4 (+ (-> a0-13 attack-id) 1)) + ) + (set! (-> a0-13 attack-id) a2-4) + (set! (-> v1-34 id) a2-4) + ) + (set! (-> v1-34 vector quad) (-> s2-1 quad)) + (set! (-> v1-34 angle) 'jump) + (set! (-> a1-8 param 1) (the-as uint v1-34)) + ) + (send-event-function gp-0 a1-8) + ) + ) + (return #t) + ) + ) + (set! s0-0 (-> s0-0 next)) + ) + ) + ) + ) + ) + #f + ) + ) + ) + +;; definition for method 41 of type collide-shape +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs vector. +(defmethod shove-to-closest-point-on-path collide-shape ((obj collide-shape) (arg0 attack-info) (arg1 float)) + (set! (-> arg0 shove-up) arg1) + (let* ((s3-0 (-> obj process path)) + (s2-0 (-> s3-0 curve num-cverts)) + (s4-0 (target-pos 0)) + (s1-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (let ((f30-0 -1.0)) + (dotimes (s0-0 s2-0) + (get-point-in-path! s3-0 s1-0 (the float s0-0) 'interp) + (let ((f0-3 (vector-vector-distance-squared s4-0 s1-0))) + (when (or (< f30-0 0.0) (< f0-3 f30-0)) + (set! f30-0 f0-3) + (set! (-> s5-0 quad) (-> s1-0 quad)) + ) + ) + ) + ) + (vector-! (-> arg0 vector) s5-0 s4-0) + ) + (the-as vector 0) + ) + + + + diff --git a/test/decompiler/reference/jak2/engine/collide/collide-target-h_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-target-h_REF.gc index 5e6ca426be..ba497a431f 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-target-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-target-h_REF.gc @@ -3,209 +3,211 @@ ;; definition of type control-info (deftype control-info (collide-shape-moving) - ((unknown-float00 float :offset 448) - (unknown-float01 float :offset 452) - (unknown-float02 float :offset 456) - (unknown-float03 float :offset 460) - (unknown-vector00 vector :inline :offset 480) - (unknown-vector01 vector :inline :offset 496) - (unknown-vector02 vector :inline :offset 512) - (quat-for-control quaternion :inline :offset 528) - (override-quat quaternion :inline :offset 544) - (override-quat-alpha float :offset 560) - (unknown-float05 float :offset 564) - (unknown-float003 float :offset 568) - (unknown-float06 float :offset 572) - (unknown-float07 float :offset 576) - (unknown-time-frame00 time-frame :offset 584) - (unknown-vector03 vector :inline :offset 592) - (unknown-quaternion02 quaternion :inline :offset 608) - (unknown-quaternion03 quaternion :inline :offset 624) - (unknown-vector-array00 vector 128 :inline :offset 640) - (unknown-time-frame-array00 time-frame 128 :offset 2688) - (unknown-word00 int32 :offset 3712) - (unknown-vector04 vector :inline :offset 3728) - (unknown-vector05 vector :inline :offset 3744) - (unknown-vector06 vector :inline :offset 3760) - (unknown-vector07 vector :inline :offset 3776) - (unknown-vector000 vector :inline :offset 3792) - (unknown-dynamics00 dynamics :offset 3824) - (unknown-surface00 surface :offset 3828) - (unknown-surface01 surface :offset 3832) - (unknown-surface02 surface :offset 3836) - (unknown-time-frame02 time-frame :offset 3840) - (cpad cpad-info :offset 3848) - (unknown-float08 float :offset 3852) - (unknown-float09 float :offset 3856) - (unknown-float10 float :offset 3860) - (unknown-float11 float :offset 3864) - (to-target-pt-xz vector :inline :offset 3872) - (unknown-vector09 vector :inline :offset 3888) - (unknown-vector10 vector :inline :offset 3904) - (unknown-vector11 vector :inline :offset 3920) - (unknown-vector-array01 vector 7 :inline :offset 3936) - (unknown-vector12 vector :inline :offset 4064) - (unknown-vector13 vector :inline :offset 4080) - (unknown-float12 float :offset 4096) - (unknown-float13 float :offset 4100) - (unknown-dword01 int64 :offset 4104) - (unknown-matrix00 matrix :inline :offset 4112) - (unknown-matrix01 matrix :inline :offset 4176) - (unknown-matrix02 matrix :inline :offset 4240) - (unknown-vector14 vector :inline :offset 4320) - (unknown-vector15 vector :inline :offset 4336) - (unknown-matrix03 matrix :inline :offset 4352) - (unknown-dword02 int64 :offset 4416) - (unknown-vector16 vector :inline :offset 4432) - (unknown-float14 float :offset 4448) - (unknown-floatiujh1bnb2n3i1 float :offset 4452) - (unknown-float15 float :offset 4456) - (unknown-word01 int32 :offset 4460) - (unknown-vector17 vector :inline :offset 4464) - (unknown-vector18 vector :inline :offset 4480) - (unknown-time-frame03 time-frame :offset 4496) - (unknown-time-frame04 time-frame :offset 4504) - (unknown-vector19 vector :inline :offset 4512) - (unknown-vector20 vector :inline :offset 4528) - (unknown-vector21 vector :inline :offset 4544) - (unknown-float16 float :offset 4548) - (unknown-vector22 vector :inline :offset 4560) - (unknown-vector23 vector :inline :offset 4576) - (unknown-time-frame05 time-frame :offset 4624) - (unknown-float0000 float :offset 4632) - (unknown-float17 float :offset 4636) - (unknown-float18 float :offset 4640) - (unknown-float19 float :offset 4644) - (unknown-float20 float :offset 4648) - (unknown-time-frame06 time-frame :offset 4656) - (unknown-float21 float :offset 4664) - (unknown-time-frame07 time-frame :offset 4672) - (unknown-pat-surface00 pat-surface :offset 4680) - (unknown-vector24 vector :inline :offset 4688) - (unknown-vector25 vector :inline :offset 4720) - (unknown-vector001 vector :inline :offset 4736) - (unknown-handle00 handle :offset 4768) - (unknown-pat-surface01 pat-surface :offset 4776) - (unknown-float22 float :offset 4780) - (unknown-float23 float :offset 4784) - (unknown-float24 float :offset 4788) - (unknown-float25 float :offset 4792) - (unknown-float26 float :offset 4796) - (unknown-word000 int32 :offset 4800) - (unknown-float002 float :offset 4804) - (unknown-time-frame08 time-frame :offset 4816) - (unknown-vector26 vector :inline :offset 4928) - (unknwon-vector27 vector :inline :offset 4976) - (unknown-float27 float :offset 4992) - (unknown-time-frame09 time-frame :offset 5000) - (unknown-sphere-array00 collide-shape-prim-sphere 10 :offset 5016) - (unknown-word02 int32 :offset 5064) - (unknown-time-frame10 time-frame :offset 5072) - (unknown-time-frame11 time-frame :offset 5080) - (unknown-time-frame001 time-frame :offset 5088) - (unknown-time-frame12 time-frame :offset 5096) - (unknown-time-frame002 time-frame :offset 5104) - (unknown-time-frame13 time-frame :offset 5112) - (unknown-time-frame14 time-frame :offset 5120) - (unknown-float28 float :offset 5132) - (unknown-float29 float :offset 5136) - (unknown-float30 float :offset 5140) - (unknown-vector28 vector :inline :offset 5152) - (lhand-cspace cspace :offset 5168) - (rhand-cspace cspace :offset 5172) - (midpoint-of-hands vector :inline :offset 5184) - (unknown-vector31 vector :inline :offset 5200) - (unknown-cspacei1un23i1 cspace :inline :offset 5216) - (unknown-symbol00 symbol :offset 5248) - (unknown-float000 float :offset 5252) - (unknown-float31 float :offset 5256) - (unknown-vector-array02 vector 15 :inline :offset 5264) - (unknown-float32 float :offset 5520) - (unknown-word03 int32 :offset 5524) - (unknown-float33 float :offset 5528) - (unknown-symbol000 symbol :offset 5532) - (unknown-vector34 vector :inline :offset 5536) - (unknown-vector35 vector :inline :offset 5552) - (unknown-vector36 vector :inline :offset 5568) - (unknown-time-frame15 time-frame :offset 5584) - (unknown-time-frame16 time-frame :offset 5592) - (unknown-handle000 handle :offset 5600) - (unknown-handle01 handle :offset 5608) - (unknown-word04 uint32 :offset 5616) - (unknown-spool-anim00 spool-anim :offset 5616) - (unknown-word05 int32 :offset 5616) - (unknown-symbol01 symbol :offset 5616) - (unknown-float34 float :offset 5616) - (unknown-symbol02 float :offset 5620) - (unknown-symbol03 float :offset 5624) - (unknown-float35 float :offset 5628) - (unknown-float36 float :offset 5632) - (unknown-float37 float :offset 5636) - (unknown-vector37 vector :inline :offset 5648) - (unknown-vector38 vector :inline :offset 5664) - (unknown-vector39 vector :inline :offset 5680) - (unknown-vector40 vector :inline :offset 5696) - (unknown-time-frame17 time-frame :offset 5712) - (unknown-time-frame18 time-frame :offset 5720) - (unknown-sound-id00 sound-id :offset 5776) - (unknown-handle02 handle :offset 5792) - (unknown-impact-control00 impact-control :inline :offset 5824) - (unknown-word06 int32 :offset 5832) - (unknown-vector41 vector :inline :offset 5888) - (unknown-vector42 vector :inline :offset 5904) - (unknown-float38 float :offset 5908) - (unknown-vector43 vector :inline :offset 5920) - (unknown-float39 float :offset 5924) - (unknown-time-frame19 time-frame :offset 5936) - (unknown-time-frame20 time-frame :offset 5944) - (unknown-symbol04 symbol :offset 5984) - (unknown-symbol05 symbol :offset 5988) - (unknown-attack-id00 int32 :offset 5992) - (unknown-float40 float :offset 5996) - (unknown-dword05 uint64 :offset 6000) - (unknown-dword06 handle :offset 6008) - (unknown-time-frame000 time-frame :offset 6016) - (unknown-combo-tracker00 combo-tracker :inline :offset 6032) - (unknown-time-frame21 time-frame :offset 6072) - (unknown-dword07 int64 :offset 6096) - (unknown-dword08 int64 :offset 6104) - (unknown-dword09 int64 :offset 6112) - (unknown-dword10 int64 :offset 6120) - (unknown-symbol06 symbol :offset 6144) - (unknown-quaternion04 quaternion :inline :offset 6160) - (unknown-sound-id01 sound-id :offset 6176) - (unknown-float41 float :offset 6180) - (unknown-float42 float :offset 6184) - (unknown-halfword00 uint16 :offset 6188) - (history-length uint16 :offset 6190) - (unknown-word07 int32 :offset 6192) - (unknown-time-frame22 time-frame :offset 6200) - (unknown-time-frame23 time-frame :offset 6208) - (unknown-time-frame24 time-frame :offset 6216) - (unknown-time-frame25 time-frame :offset 6224) - (unknown-float43 float :offset 6232) - (unknown-float001 float :offset 6236) - (unknown-sound-id02 sound-id :offset 6240) - (unknown-sound-id03 sound-id :offset 6244) - (unknown-time-frame26 time-frame :offset 6248) - (unknown-time-frame27 time-frame :offset 6256) - (unknown-dword11 int64 :offset 6264) - (unknown-vector44 vector :inline :offset 6272) - (unknown-float44 float :offset 6288) - (unknown-sound-id04 sound-id :offset 6292) - (unknown-float45 float :offset 6296) - (unknown-word08 int32 :offset 6300) - (unknown-sphere000 sphere :offset 6304) - (unknown-word09 int32 :offset 6308) - (unknown-word10 uint32 :offset 6312) - (unknown-time-frame28 time-frame :offset 6320) - (unknown-time-frame29 time-frame :offset 6328) - (unknown-dword12 int64 :offset 6336) - (unknown-time-frame30 time-frame :offset 6368) - (unknown-quaternion05 quaternion :inline :offset 6384) - (unknown-time-frame31 time-frame :offset 6400) - (unknown-time-frame32 time-frame :offset 6408) - (pad uint8 :offset 6415) + ((unknown-float00 float :offset 448) + (unknown-float01 float :offset 452) + (unknown-float02 float :offset 456) + (unknown-float03 float :offset 460) + (unknown-vector00 vector :inline :offset 480) + (target-transv vector :inline :offset 496) + (unknown-vector02 vector :inline :offset 512) + (quat-for-control quaternion :inline :offset 528) + (override-quat quaternion :inline :offset 544) + (override-quat-alpha float :offset 560) + (unknown-float05 float :offset 564) + (unknown-float003 float :offset 568) + (unknown-float06 float :offset 572) + (unknown-float07 float :offset 576) + (unknown-time-frame00 time-frame :offset 584) + (unknown-vector03 vector :inline :offset 592) + (unknown-quaternion02 quaternion :inline :offset 608) + (unknown-quaternion03 quaternion :inline :offset 624) + (unknown-vector-array00 vector 128 :inline :offset 640) + (unknown-time-frame-array00 time-frame 128 :offset 2688) + (unknown-word00 int32 :offset 3712) + (draw-offset vector :inline :offset 3728) + (cspace-offset vector :inline :offset 3744) + (anim-collide-offset-local vector :inline :offset 3760) + (anim-collide-offset-world vector :inline :offset 3776) + (old-anim-collide-offset-world vector :inline :offset 3792) + (anim-collide-offset-delta-world vector :inline :offset 3808) + (unknown-dynamics00 dynamics :offset 3824) + (unknown-surface00 surface :offset 3828) + (unknown-surface01 surface :offset 3832) + (unknown-surface02 surface :offset 3836) + (unknown-time-frame02 time-frame :offset 3840) + (cpad cpad-info :offset 3848) + (unknown-float08 float :offset 3852) + (unknown-float09 float :offset 3856) + (unknown-float10 float :offset 3860) + (unknown-float11 float :offset 3864) + (to-target-pt-xz vector :inline :offset 3872) + (unknown-vector09 vector :inline :offset 3888) + (unknown-vector10 vector :inline :offset 3904) + (unknown-vector11 vector :inline :offset 3920) + (unknown-vector-array01 vector 7 :inline :offset 3936) + (unknown-vector12 vector :inline :offset 4064) + (unknown-vector13 vector :inline :offset 4080) + (unknown-float12 float :offset 4096) + (unknown-float13 float :offset 4100) + (unknown-dword01 int64 :offset 4104) + (unknown-matrix00 matrix :inline :offset 4112) + (unknown-matrix01 matrix :inline :offset 4176) + (ctrl-orientation matrix :inline :offset 4240) + (unknown-vector14 vector :inline :offset 4320) + (unknown-vector15 vector :inline :offset 4336) + (unknown-matrix03 matrix :inline :offset 4352) + (unknown-dword02 int64 :offset 4416) + (unknown-vector16 vector :inline :offset 4432) + (unknown-float14 float :offset 4448) + (unknown-floatiujh1bnb2n3i1 float :offset 4452) + (unknown-float15 float :offset 4456) + (unknown-word01 int32 :offset 4460) + (collide-extra-velocity vector :inline :offset 4464) + (unknown-vector18 vector :inline :offset 4480) + (unknown-time-frame03 time-frame :offset 4496) + (unknown-time-frame04 time-frame :offset 4504) + (unknown-vector19 vector :inline :offset 4512) + (unknown-vector20 vector :inline :offset 4528) + (unknown-vector21 vector :inline :offset 4544) + (unknown-float16 float :offset 4548) + (unknown-vector22 vector :inline :offset 4560) + (last-trans-on-surf vector :inline :offset 4576) + (unknown-time-frame05 time-frame :offset 4624) + (unknown-float0000 float :offset 4632) + (unknown-float17 float :offset 4636) + (unknown-float18 float :offset 4640) + (unknown-float19 float :offset 4644) + (unknown-float20 float :offset 4648) + (unknown-time-frame06 time-frame :offset 4656) + (unknown-float21 float :offset 4664) + (unknown-time-frame07 time-frame :offset 4672) + (unknown-pat-surface00 pat-surface :offset 4680) + (unknown-vector24 vector :inline :offset 4688) + (unknown-vector25 vector :inline :offset 4720) + (unknown-vector001 vector :inline :offset 4736) + (unknown-handle00 handle :offset 4768) + (unknown-pat-surface01 pat-surface :offset 4776) + (unknown-float22 float :offset 4780) + (unknown-float23 float :offset 4784) + (unknown-float24 float :offset 4788) + (unknown-float25 float :offset 4792) + (unknown-float26 float :offset 4796) + (unknown-word000 int32 :offset 4800) + (unknown-float002 float :offset 4804) + (unknown-time-frame08 time-frame :offset 4816) + (unknown-vector26 vector :inline :offset 4928) + (btransv vector :inline :offset 4976) + (blocked-factor float :offset 4992) + (blocked-in-air-factor float :offset 4996) + (unknown-time-frame09 time-frame :offset 5000) + (unknown-sphere-array00 collide-shape-prim-sphere 10 :offset 5016) + (unknown-word02 int32 :offset 5064) + (unknown-time-frame10 time-frame :offset 5072) + (unknown-time-frame11 time-frame :offset 5080) + (unknown-time-frame001 time-frame :offset 5088) + (unknown-time-frame12 time-frame :offset 5096) + (unknown-time-frame002 time-frame :offset 5104) + (unknown-time-frame13 time-frame :offset 5112) + (unknown-time-frame14 time-frame :offset 5120) + (unknown-float28 float :offset 5132) + (unknown-float29 float :offset 5136) + (unknown-float30 float :offset 5140) + (unknown-vector28 vector :inline :offset 5152) + (lhand-cspace cspace :offset 5168) + (rhand-cspace cspace :offset 5172) + (midpoint-of-hands vector :inline :offset 5184) + (unknown-vector31 vector :inline :offset 5200) + (unknown-cspacei1un23i1 cspace :inline :offset 5216) + (unknown-symbol00 symbol :offset 5248) + (unknown-float000 float :offset 5252) + (unknown-float31 float :offset 5256) + (unknown-vector-array02 vector 15 :inline :offset 5264) + (unknown-float32 float :offset 5520) + (unknown-word03 int32 :offset 5524) + (unknown-float33 float :offset 5528) + (unknown-symbol000 symbol :offset 5532) + (unknown-vector34 vector :inline :offset 5536) + (unknown-vector35 vector :inline :offset 5552) + (unknown-vector36 vector :inline :offset 5568) + (unknown-time-frame15 time-frame :offset 5584) + (unknown-time-frame16 time-frame :offset 5592) + (unknown-handle000 handle :offset 5600) + (unknown-handle01 handle :offset 5608) + (unknown-word04 uint32 :offset 5616) + (unknown-spool-anim00 spool-anim :offset 5616) + (unknown-word05 int32 :offset 5616) + (unknown-symbol01 symbol :offset 5616) + (unknown-float34 float :offset 5616) + (unknown-symbol02 float :offset 5620) + (unknown-symbol03 float :offset 5624) + (unknown-float35 float :offset 5628) + (unknown-float36 float :offset 5632) + (unknown-float37 float :offset 5636) + (unknown-vector37 vector :inline :offset 5648) + (unknown-vector38 vector :inline :offset 5664) + (unknown-vector39 vector :inline :offset 5680) + (unknown-vector40 vector :inline :offset 5696) + (unknown-time-frame17 time-frame :offset 5712) + (unknown-time-frame18 time-frame :offset 5720) + (unknown-sound-id00 sound-id :offset 5776) + (unknown-handle02 handle :offset 5792) + (unknown-impact-control00 impact-control :inline :offset 5824) + (unknown-word06 int32 :offset 5832) + (unknown-vector41 vector :inline :offset 5888) + (unknown-vector42 vector :inline :offset 5904) + (unknown-float38 float :offset 5908) + (unknown-vector43 vector :inline :offset 5920) + (unknown-float39 float :offset 5924) + (unknown-time-frame19 time-frame :offset 5936) + (unknown-time-frame20 time-frame :offset 5944) + (unknown-symbol04 symbol :offset 5984) + (unknown-symbol05 symbol :offset 5988) + (unknown-attack-id00 int32 :offset 5992) + (unknown-float40 float :offset 5996) + (unknown-dword05 uint64 :offset 6000) + (unknown-dword06 handle :offset 6008) + (unknown-time-frame000 time-frame :offset 6016) + (unknown-combo-tracker00 combo-tracker :inline :offset 6032) + (unknown-time-frame21 time-frame :offset 6072) + (unknown-dword07 int64 :offset 6096) + (unknown-dword08 int64 :offset 6104) + (unknown-dword09 int64 :offset 6112) + (unknown-dword10 int64 :offset 6120) + (unknown-symbol06 symbol :offset 6144) + (unknown-quaternion04 quaternion :inline :offset 6160) + (unknown-sound-id01 sound-id :offset 6176) + (unknown-float41 float :offset 6180) + (unknown-float42 float :offset 6184) + (unknown-halfword00 uint16 :offset 6188) + (history-length uint16 :offset 6190) + (unknown-word07 int32 :offset 6192) + (unknown-time-frame22 time-frame :offset 6200) + (unknown-time-frame23 time-frame :offset 6208) + (unknown-time-frame24 time-frame :offset 6216) + (unknown-time-frame25 time-frame :offset 6224) + (unknown-float43 float :offset 6232) + (unknown-float001 float :offset 6236) + (unknown-sound-id02 sound-id :offset 6240) + (unknown-sound-id03 sound-id :offset 6244) + (unknown-time-frame26 time-frame :offset 6248) + (unknown-time-frame27 time-frame :offset 6256) + (unknown-dword11 int64 :offset 6264) + (align-xz-vel vector :inline :offset 6272) + (zx-vel-frac float :offset 6288) + (unknown-sound-id04 sound-id :offset 6292) + (unknown-float45 float :offset 6296) + (unknown-word08 int32 :offset 6300) + (unknown-sphere000 sphere :offset 6304) + (unknown-word09 int32 :offset 6308) + (unknown-word10 uint32 :offset 6312) + (unknown-time-frame28 time-frame :offset 6320) + (unknown-time-frame29 time-frame :offset 6328) + (unknown-dword12 int64 :offset 6336) + (unknown-time-frame30 time-frame :offset 6368) + (unknown-quaternion05 quaternion :inline :offset 6384) + (unknown-time-frame31 time-frame :offset 6400) + (unknown-time-frame32 time-frame :offset 6408) + (pad uint8 :offset 6415) ) :method-count-assert 68 :size-assert #x1910 diff --git a/test/decompiler/reference/jak2/engine/collide/collide_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide_REF.gc new file mode 100644 index 0000000000..d8da36c1e9 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/collide/collide_REF.gc @@ -0,0 +1,23 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *collide-vif0-init*, type (array uint32) +(define *collide-vif0-init* (new 'static 'boxed-array :type uint32 + #x30000000 + #x4d000000 + #x4d000000 + #x4d000000 + #x3f800000 + #x5000001 + #x20000000 + #x40404040 + #x1000404 + #x0 + #x0 + #x0 + ) + ) + + + + diff --git a/test/decompiler/reference/jak2/engine/common_objs/base-plat_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/base-plat_REF.gc index 83dc1bf9aa..76650cfb4d 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/base-plat_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/base-plat_REF.gc @@ -116,14 +116,14 @@ (let ((trans (new 'stack-no-clear 'vector))) (set! (-> trans quad) (-> self basetrans quad)) (+! (-> trans y) (* (-> self bounce-scale) (update! (-> self smush)))) - (collide-shape-method-29 (-> self root-override) trans) + (move-to-point! (-> self root-override) trans) ) (if (not (!= (-> self smush amp) 0.0)) (set! (-> self bouncing) #f) ) ) (else - (collide-shape-method-29 (-> self root-override) (-> self basetrans)) + (move-to-point! (-> self root-override) (-> self basetrans)) ) ) (none) @@ -263,7 +263,7 @@ eco-door-event-handler :code (behavior () (ja :num-func num-func-identity :frame-num 0.0) (suspend) - (collide-shape-method-46 (-> self root-override)) + (update-transforms (-> self root-override)) (ja-post) (until #f (when (and *target* (and (>= (-> self open-distance) @@ -331,7 +331,7 @@ eco-door-event-handler (ja :num-func num-func-identity :frame-num max) (logior! (-> self draw status) (draw-control-status no-draw)) (suspend) - (collide-shape-method-46 (-> self root-override)) + (update-transforms (-> self root-override)) (ja-post) (until #f (let ((dist-from-target (vector4-dot (-> self out-dir) (target-pos 0))) @@ -459,7 +459,7 @@ eco-door-event-handler (set! (-> obj one-way) (logtest? (-> obj flags) (eco-door-flags one-way))) (vector-z-quaternion! (-> obj out-dir) (-> obj root-override quat)) (set! (-> obj out-dir w) (- (vector-dot (-> obj out-dir) (-> obj root-override trans)))) - (collide-shape-method-46 (-> obj root-override)) + (update-transforms (-> obj root-override)) (stub obj) (if (and (not (-> obj auto-close)) (-> obj entity) diff --git a/test/decompiler/reference/jak2/engine/common_objs/basebutton_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/basebutton_REF.gc index d9105436e4..19560fa7d7 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/basebutton_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/basebutton_REF.gc @@ -437,7 +437,7 @@ (set! (-> collision-shape total-prims) (the-as uint 1)) (set! (-> collision-shape root-prim) collision-mesh) ) - (collide-shape-method-54 collision-shape) + (pusher-init collision-shape) (set! (-> collision-shape nav-radius) (* 0.75 (-> collision-shape root-prim local-sphere w))) (let ((prim (-> collision-shape root-prim))) (set! (-> collision-shape backup-collide-as) (-> prim prim-core collide-as)) diff --git a/test/decompiler/reference/jak2/engine/common_objs/conveyor_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/conveyor_REF.gc index 5be2a1532d..5c98fd633d 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/conveyor_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/conveyor_REF.gc @@ -240,7 +240,7 @@ (init-vf0-vector) (set! *actor-list-length* 0) (if #t - (set! *actor-list-length* (spatial-hash-method-36 *actor-hash* (-> obj collide-bounds) *actor-list* 256)) + (set! *actor-list-length* (fill-actor-list-for-sphere *actor-hash* (-> obj collide-bounds) *actor-list* 256)) ) (when #t (let ((a0-2 (-> *collide-player-list* alive-list next0))) diff --git a/test/decompiler/reference/jak2/engine/common_objs/crates_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/crates_REF.gc index 365a056ab4..050dcce7a0 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/crates_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/crates_REF.gc @@ -1,11 +1,14 @@ +;;-*-Lisp-*- (in-package goal) +;; failed to figure out what this is: (defskelgroup skel-crate-krimson crate 0 3 ((1 (meters 20)) (2 (meters 999999))) :bounds (static-spherem 0 1 0 1.6) :texture-level 6 ) +;; definition of type crate-bank (deftype crate-bank (basic) ((COLLIDE_YOFF float :offset-assert 4) (COLLIDE_RADIUS float :offset-assert 8) @@ -16,6 +19,7 @@ :flag-assert #x900000010 ) +;; definition for method 3 of type crate-bank (defmethod inspect crate-bank ((obj crate-bank)) (when (not obj) (set! obj obj) @@ -29,10 +33,12 @@ obj ) +;; definition for symbol *CRATE-bank*, type crate-bank (define *CRATE-bank* (new 'static 'crate-bank :COLLIDE_YOFF 4096.0 :COLLIDE_RADIUS 6963.2 :DARKECO_EXPLODE_RADIUS 16384.0) ) +;; definition of type crate (deftype crate (process-focusable) ((root-override2 collide-shape-moving :offset 128) (smush smush-control :inline :offset-assert 208) @@ -66,6 +72,7 @@ ) ) +;; definition for method 3 of type crate (defmethod inspect crate ((obj crate)) (when (not obj) (set! obj obj) @@ -86,8 +93,10 @@ obj ) +;; failed to figure out what this is: (method-set! crate 12 (method-of-type process run-logic?)) +;; definition for function crate-post (defbehavior crate-post crate () (rider-trans) (smush-update! self) @@ -96,6 +105,7 @@ (none) ) +;; failed to figure out what this is: (defpart 565 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) (sp-flt spt-num 16.0) @@ -119,10 +129,12 @@ ) ) +;; failed to figure out what this is: (defpart 566 :init-specs ((sp-flt spt-fade-a -1.0666667)) ) +;; failed to figure out what this is: (defpart 567 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x92 :page #xc)) (sp-flt spt-num 4.0) @@ -147,10 +159,12 @@ ) ) +;; failed to figure out what this is: (defpart 568 :init-specs ((sp-flt spt-fade-a -2.1333334)) ) +;; failed to figure out what this is: (defpart 569 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) (sp-flt spt-num 1.0) @@ -167,6 +181,7 @@ ) ) +;; failed to figure out what this is: (defpart 570 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc :page #xc)) (sp-flt spt-num 5.0) @@ -195,6 +210,7 @@ ) ) +;; failed to figure out what this is: (defpart 571 :init-specs ((sp-flt spt-scalevel-x (meters -0.0033333334)) (sp-copy-from-other spt-scalevel-y -4) @@ -202,6 +218,7 @@ ) ) +;; failed to figure out what this is: (defpart 572 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xb :page #xc)) (sp-flt spt-num 4.5) @@ -230,6 +247,7 @@ ) ) +;; failed to figure out what this is: (defpartgroup group-crate-explode :id 124 :duration (seconds 0.017) @@ -243,6 +261,7 @@ ) ) +;; failed to figure out what this is: (defpartgroup group-crate-steel-explode :id 125 :duration (seconds 0.017) @@ -251,6 +270,7 @@ :parts ((sp-item 565) (sp-item 567) (sp-item 569) (sp-item 572) (sp-item 572) (sp-item 572)) ) +;; failed to figure out what this is: (defpartgroup group-dark-eco-box-explosion :id 126 :duration (seconds 2) @@ -297,6 +317,7 @@ ) ) +;; failed to figure out what this is: (defpart 156 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) (sp-flt spt-num 6.0) @@ -321,10 +342,12 @@ ) ) +;; failed to figure out what this is: (defpart 575 :init-specs ((sp-flt spt-fade-r 0.0) (sp-flt spt-fade-g 0.0) (sp-flt spt-fade-b 0.0) (sp-flt spt-fade-a -1.4222223)) ) +;; failed to figure out what this is: (defpart 574 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) (sp-flt spt-num 3.0) @@ -342,6 +365,7 @@ ) ) +;; failed to figure out what this is: (defpart 155 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) (sp-flt spt-num 1.0) @@ -357,6 +381,7 @@ ) ) +;; failed to figure out what this is: (defpart 157 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) (sp-flt spt-num 4.0) @@ -381,6 +406,7 @@ ) ) +;; failed to figure out what this is: (defpart 154 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) (sp-flt spt-num 16.0) @@ -398,6 +424,7 @@ ) ) +;; failed to figure out what this is: (defpart 152 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) (sp-flt spt-num 1.0) @@ -422,6 +449,7 @@ ) ) +;; failed to figure out what this is: (defpart 153 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) (sp-flt spt-num 1.0) @@ -442,6 +470,7 @@ ) ) +;; failed to figure out what this is: (defpart 573 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xb :page #xc)) (sp-rnd-flt spt-num 8.0 16.0 1.0) @@ -470,6 +499,7 @@ ) ) +;; failed to figure out what this is: (defpart 576 :init-specs ((sp-flt spt-scalevel-x (meters -0.0033333334)) (sp-copy-from-other spt-scalevel-y -4) @@ -477,6 +507,8 @@ ) ) +;; definition for function crate-standard-event-handler +;; INFO: Used lq/sq (defbehavior crate-standard-event-handler crate ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) (case arg2 (('track) @@ -643,6 +675,7 @@ ) ) +;; failed to figure out what this is: (defstate hide (crate) :virtual #t :code (behavior () @@ -683,12 +716,13 @@ ) ) +;; failed to figure out what this is: (defstate idle (crate) :virtual #t :event crate-standard-event-handler :code (behavior () (suspend) - (collide-shape-method-46 (the-as collide-shape-moving (-> self root-override2))) + (update-transforms (the-as collide-shape-moving (-> self root-override2))) (carry-info-method-9 (-> self carry)) (logior! (-> self mask) (process-mask sleep)) (until #f @@ -700,6 +734,7 @@ :post (the-as (function none :behavior crate) ja-post) ) +;; failed to figure out what this is: (defstate carry (crate) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) @@ -718,11 +753,12 @@ (ja-post) (carry-info-method-9 (-> self carry)) (carry-info-method-13 (-> self carry)) - (collide-shape-method-46 (the-as collide-shape-moving (-> self root-override2))) + (update-transforms (the-as collide-shape-moving (-> self root-override2))) (none) ) ) +;; failed to figure out what this is: (defstate fall (crate) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) @@ -745,7 +781,7 @@ (-> self carry) ) ) - (set! (-> self root-override2 status) (cshape-moving-flags)) + (set! (-> self root-override2 status) (collide-status)) (set! (-> self root-override2 root-prim local-sphere w) (-> self carry carry-radius)) (set! (-> self root-override2 root-prim prim-core collide-with) (logior (collide-spec backgnd crate obstacle hit-by-others-list pusher) @@ -755,7 +791,7 @@ (none) ) :trans (behavior () - (when (and (logtest? (-> (the-as collide-shape-moving (-> self root-override2)) status) (cshape-moving-flags on-surface)) + (when (and (logtest? (-> (the-as collide-shape-moving (-> self root-override2)) status) (collide-status on-surface)) (< 0.8 (-> (the-as collide-shape-moving (-> self root-override2)) surface-angle)) ) (vector-reset! (-> self root-override2 transv)) @@ -799,7 +835,7 @@ (set! (-> a2-1 ignore-process1) #f) (set! (-> a2-1 ignore-pat) (-> gp-1 pat-ignore-mask)) (set! (-> a2-1 action-mask) (collide-action solid)) - (collide-shape-method-32 gp-1 (-> gp-1 transv) a2-1 (meters 0)) + (fill-cache-integrate-and-collide gp-1 (-> gp-1 transv) a2-1 (meters 0)) ) (set! (-> gp-1 root-prim type) collide-shape-prim-mesh) ) @@ -808,6 +844,7 @@ ) ) +;; failed to figure out what this is: (defstate bounce-on (crate) :virtual #t :event crate-standard-event-handler @@ -821,6 +858,7 @@ :post crate-post ) +;; failed to figure out what this is: (defstate notice-blue (crate) :virtual #t :event crate-standard-event-handler @@ -901,6 +939,7 @@ :post crate-post ) +;; failed to figure out what this is: (defstate die (crate) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) @@ -1126,6 +1165,7 @@ ) ) +;; failed to figure out what this is: (defstate special-contents-die (crate) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) @@ -1203,6 +1243,8 @@ ) ) +;; definition for function crate-init-by-other +;; INFO: Used lq/sq (defbehavior crate-init-by-other crate ((arg0 entity) (arg1 vector) (arg2 symbol) (arg3 fact-info-crate)) (crate-init! self (the-as entity-actor arg0)) (set! (-> self root-override2 trans quad) (-> arg1 quad)) @@ -1218,6 +1260,7 @@ (none) ) +;; definition for method 11 of type crate (defmethod init-from-entity! crate ((obj crate) (arg0 entity-actor)) (crate-init! obj arg0) (skel-init! obj) @@ -1225,6 +1268,8 @@ (none) ) +;; definition for method 35 of type crate +;; WARN: Return type mismatch crate vs none. (defmethod crate-init! crate ((obj crate) (arg0 entity-actor)) "Initialize the [[crate]] with the specified [[entity-actor]]." (stack-size-set! (-> obj main-thread) 128) @@ -1232,7 +1277,9 @@ (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s4-0 reaction) cshape-reaction-default) - (set! (-> s4-0 no-reaction) nothing) + (set! (-> s4-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) (let ((v1-10 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) (set! (-> v1-10 prim-core collide-as) (collide-spec crate notice-blue-eco-powerup)) (set! (-> v1-10 prim-core collide-with) (collide-spec jak player-list tobot)) @@ -1313,6 +1360,9 @@ (none) ) +;; definition for method 36 of type crate +;; INFO: Used lq/sq +;; WARN: Return type mismatch crate vs none. (defmethod skel-init! crate ((obj crate)) "Initialize the [[crate]]'s skeleton and other parameters based on the crate type." (case (-> obj look) @@ -1371,6 +1421,8 @@ (none) ) +;; definition for method 37 of type crate +;; WARN: Return type mismatch crate vs none. (defmethod params-set! crate ((obj crate) (arg0 symbol) (arg1 symbol)) "Set [[crate]] params based on the arguments." (if arg0 @@ -1382,6 +1434,8 @@ (none) ) +;; definition for method 38 of type crate +;; WARN: Return type mismatch int vs none. (defmethod crate-method-38 crate ((obj crate)) (when (-> obj entity) (if (>= (-> obj entity extra perm user-int8 0) 1) @@ -1403,6 +1457,8 @@ (none) ) +;; definition for method 39 of type crate +;; WARN: Return type mismatch int vs none. (defmethod smush-update! crate ((obj crate)) (let ((f0-0 (update! (-> obj smush)))) (set! (-> obj root-override2 scale x) (+ 1.0 (* -0.5 f0-0))) @@ -1413,6 +1469,8 @@ (none) ) +;; definition for method 40 of type crate +;; WARN: disable def twice: 57. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. (defmethod crate-method-40 crate ((obj crate)) (cond ((and (> (-> (the-as fact-info-crate (-> obj fact)) suck-count) 0) @@ -1444,6 +1502,7 @@ ) ) +;; definition of type pickup-spawner (deftype pickup-spawner (crate) ((blocker entity-actor :offset-assert 288) ) @@ -1453,6 +1512,7 @@ :flag-assert #x2900b00124 ) +;; definition for method 3 of type pickup-spawner (defmethod inspect pickup-spawner ((obj pickup-spawner)) (when (not obj) (set! obj obj) @@ -1466,6 +1526,8 @@ obj ) +;; definition for method 35 of type pickup-spawner +;; WARN: Return type mismatch pickup-spawner vs none. (defmethod crate-init! pickup-spawner ((obj pickup-spawner) (arg0 entity-actor)) "Initialize the [[crate]] with the specified [[entity-actor]]." (let ((t9-0 (method-of-type crate crate-init!))) @@ -1479,12 +1541,15 @@ (none) ) +;; definition for method 38 of type pickup-spawner +;; WARN: Return type mismatch int vs none. (defmethod crate-method-38 pickup-spawner ((obj pickup-spawner)) (go (method-of-object obj idle)) 0 (none) ) +;; failed to figure out what this is: (defstate idle (pickup-spawner) :virtual #t :code (behavior () diff --git a/test/decompiler/reference/jak2/engine/common_objs/elevator_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/elevator_REF.gc index c7c605c43c..370db6ff5d 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/elevator_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/elevator_REF.gc @@ -893,7 +893,7 @@ (initialize-skeleton obj (the-as skeleton-group (get-art-group obj)) (the-as pair 0)) (stop-bouncing! obj) (set! (-> obj elevator-status) (elevator-status)) - (collide-shape-method-46 (-> obj root-override)) + (update-transforms (-> obj root-override)) (base-plat-method-32 obj) (init-defaults! obj) (set! (-> obj on-activate) (res-lump-struct (-> obj entity) 'on-activate basic)) diff --git a/test/decompiler/reference/jak2/engine/common_objs/plat_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/plat_REF.gc index 038de7435c..a793b7cdc4 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/plat_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/plat_REF.gc @@ -60,7 +60,7 @@ (set! (-> collision-shape total-prims) (the-as uint 1)) (set! (-> collision-shape root-prim) collision-mesh) ) - (collide-shape-method-54 collision-shape) + (pusher-init collision-shape) (set! (-> collision-shape nav-radius) (* 0.75 (-> collision-shape root-prim local-sphere w))) (let ((prim (-> collision-shape root-prim))) (set! (-> collision-shape backup-collide-as) (-> prim prim-core collide-as)) @@ -177,7 +177,7 @@ (base-plat-method-31 obj) (process-drawable-from-entity! obj entity) (initialize-skeleton obj (the-as skeleton-group (get-art-group obj)) (the-as pair 0)) - (collide-shape-method-46 (-> obj root-override)) + (update-transforms (-> obj root-override)) (stop-bouncing! obj) (base-plat-method-32 obj) (set! (-> obj fact) diff --git a/test/decompiler/reference/jak2/engine/common_objs/projectile_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/projectile_REF.gc index 9188da989f..2dc2ff4619 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/projectile_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/projectile_REF.gc @@ -177,8 +177,10 @@ ;; definition for method 38 of type projectile (defmethod made-impact? projectile ((obj projectile)) "TODO - queries the collision cache, return true/false" - (let ((v1-0 (-> obj root-override))) - (let ((a1-0 (new 'stack-no-clear 'collide-query))) + (let ((v1-0 (-> obj root-override)) + (t1-0 (new 'stack-no-clear 'collide-query)) + ) + (let ((a1-0 t1-0)) (set! (-> a1-0 radius) (-> v1-0 root-prim prim-core world-sphere w)) (set! (-> a1-0 collide-with) (-> v1-0 root-prim prim-core collide-with)) (set! (-> a1-0 ignore-process0) obj) @@ -186,7 +188,7 @@ (set! (-> a1-0 ignore-pat) (-> v1-0 pat-ignore-mask)) (set! (-> a1-0 action-mask) (collide-action solid)) ) - (collide-shape-moving-method-65 v1-0 (-> v1-0 transv) -6144.0 0.0 -2048.0) + (fill-and-try-snap-to-surface v1-0 (-> v1-0 transv) -6144.0 0.0 -2048.0 t1-0) ) ) @@ -201,7 +203,7 @@ (set! (-> a2-0 ignore-process1) (handle->process (-> arg0 ignore-handle))) (set! (-> a2-0 ignore-pat) (-> v1-0 pat-ignore-mask)) (set! (-> a2-0 action-mask) (collide-action solid)) - (collide-shape-method-32 v1-0 (-> v1-0 transv) a2-0 (meters 0)) + (fill-cache-integrate-and-collide v1-0 (-> v1-0 transv) a2-0 (meters 0)) ) 0 (none) @@ -243,7 +245,7 @@ ) (fill-using-line-sphere *collide-cache* a1-0) ) - (collide-shape-method-37 gp-0 (-> gp-0 transv)) + (integrate-and-collide! gp-0 (-> gp-0 transv)) ) 0 (none) @@ -272,7 +274,7 @@ (s3-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 root-override transv) 1.0)) (f30-0 (vector-length (-> arg0 root-override transv))) ) - (if (logtest? (-> arg0 root-override status) (cshape-moving-flags t-surface)) + (if (logtest? (-> arg0 root-override status) (collide-status touch-surface)) (vector-flatten! s5-1 s5-1 (-> arg0 root-override local-normal)) ) (vector-normalize-copy! s4-0 s5-1 1.0) @@ -357,7 +359,7 @@ (+! f0-14 (-> self old-dist v1-38)) ) (if (or (and (logtest? (-> self options) (projectile-options proj-options-4)) - (and (logtest? (-> self root-override status) (cshape-moving-flags t-wall)) (< f0-14 2048.0)) + (and (logtest? (-> self root-override status) (collide-status touch-wall)) (< f0-14 2048.0)) ) (< f0-14 (-> self stop-speed)) ) @@ -437,7 +439,9 @@ (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-projectile) - (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) (let ((v1-6 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) (set! (-> v1-6 prim-core collide-as) (collide-spec projectile)) (set! (-> v1-6 prim-core collide-with) @@ -538,7 +542,7 @@ (set! (-> self target-pos quad) (-> self base-target-pos quad)) (set! (-> self event-hook) projectile-event-handler) (init-proj-settings! self) - (collide-shape-method-46 (-> self root-override)) + (update-transforms (-> self root-override)) (draw-laser-sight self) (play-impact-sound self (projectile-options)) (when (logtest? (-> self options) (projectile-options proj-options-8000)) @@ -571,14 +575,7 @@ (projectile-bounce-update-velocity self) (set! (-> s5-0 quad) (-> gp-0 trans quad)) (vector-v++! s5-0 (-> gp-0 transv)) - (when (collide-shape-moving-method-55 - gp-0 - s4-0 - (collide-spec backgnd crate obstacle hit-by-others-list pusher) - 4096.0 - 81920.0 - 1024.0 - ) + (when (find-ground gp-0 s4-0 (collide-spec backgnd crate obstacle hit-by-others-list pusher) 4096.0 81920.0 1024.0) (let ((f0-1 (+ (-> gp-0 gspot-pos y) (-> self root-override root-prim local-sphere w)))) (when (>= f0-1 (-> s5-0 y)) (set! (-> s5-0 y) f0-1) @@ -586,7 +583,7 @@ ) ) ) - (collide-shape-method-29 gp-0 s5-0) + (move-to-point! gp-0 s5-0) ) (transform-post) 0 @@ -671,10 +668,10 @@ (let* ((a2-0 (-> obj root-override)) (v1-0 (-> a2-0 status)) ) - (if (logtest? v1-0 (cshape-moving-flags t-surface)) + (if (logtest? v1-0 (collide-status touch-surface)) (vector-float*! (-> a2-0 transv) (-> a2-0 transv) 0.6) ) - (when (and (logtest? v1-0 (cshape-moving-flags csmf11)) + (when (and (logtest? v1-0 (collide-status impact-surface)) (>= (- (-> self clock frame-counter) (-> obj played-bounce-time)) (seconds 0.3)) ) (set! (-> obj played-bounce-time) (-> self clock frame-counter)) @@ -690,7 +687,9 @@ (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) projectile-bounce-reaction) - (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) (set! (-> s5-0 penetrate-using) (penetrate jak-dark-shot)) (let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) (set! (-> v1-7 prim-core action) (collide-action solid)) diff --git a/test/decompiler/reference/jak2/engine/common_objs/rigid-body-plat_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/rigid-body-plat_REF.gc index e0e6bb89ae..ed0cf03fed 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/rigid-body-plat_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/rigid-body-plat_REF.gc @@ -317,7 +317,7 @@ ;; WARN: Return type mismatch int vs none. (defmethod rigid-body-object-method-30 rigid-body-platform ((obj rigid-body-platform)) (if (-> obj info-override platform) - ((method-of-object (-> obj root-override-2) collide-shape-method-35)) + (detect-riders! (-> obj root-override-2)) ) (set! (-> obj player-velocity-prev quad) (-> obj player-velocity quad)) (if *target* @@ -457,7 +457,7 @@ (set! (-> obj control-point-array) (new 'process 'rigid-body-control-point-inline-array (-> obj info-override control-point-count)) ) - (collide-shape-method-46 (-> obj root-override-2)) + (update-transforms (-> obj root-override-2)) (let ((v1-5 (-> obj rbody)) (a1-3 (&-> (-> obj info-override) mass)) (a2-2 (-> obj root-override-2 trans)) @@ -484,7 +484,9 @@ (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) - (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) (let ((s4-0 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) (set! (-> s4-0 prim-core collide-as) (collide-spec pusher)) (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list)) @@ -494,7 +496,7 @@ (set! (-> s5-0 total-prims) (the-as uint 1)) (set! (-> s5-0 root-prim) s4-0) ) - (collide-shape-method-54 s5-0) + (pusher-init s5-0) (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) (let ((v1-15 (-> s5-0 root-prim))) (set! (-> s5-0 backup-collide-as) (-> v1-15 prim-core collide-as)) diff --git a/test/decompiler/reference/jak2/engine/common_objs/voicebox_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/voicebox_REF.gc index e21def6de3..e4e5fe2ebb 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/voicebox_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/voicebox_REF.gc @@ -1,5 +1,7 @@ +;;-*-Lisp-*- (in-package goal) +;; failed to figure out what this is: (defpartgroup group-talkbox-speak :id 77 :flags (unk-4 unk-6) @@ -13,6 +15,7 @@ ) ) +;; failed to figure out what this is: (defpart 265 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xcb :page #xc)) (sp-func spt-birth-func 'birth-func-set-vel) @@ -37,10 +40,12 @@ ) ) +;; failed to figure out what this is: (defpart 266 :init-specs ((sp-flt spt-fade-a -0.64)) ) +;; definition of type camera-remote (deftype camera-remote (camera-slave) () :heap-base #xa20 @@ -49,6 +54,7 @@ :flag-assert #xe0a200a94 ) +;; definition for method 3 of type camera-remote (defmethod inspect camera-remote ((obj camera-remote)) (when (not obj) (set! obj obj) @@ -61,6 +67,7 @@ obj ) +;; definition of type remote (deftype remote (process-drawable) ((parent-override (pointer camera-slave) :offset 16) (base-trans vector :inline :offset-assert 208) @@ -85,6 +92,7 @@ ) ) +;; definition for method 3 of type remote (defmethod inspect remote ((obj remote)) (when (not obj) (set! obj obj) @@ -104,6 +112,7 @@ obj ) +;; failed to figure out what this is: (defskelgroup skel-voicebox talk-box 0 2 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 4) @@ -111,6 +120,8 @@ :sort 1 ) +;; definition for method 24 of type remote +;; INFO: Used lq/sq (defmethod remote-method-24 remote ((obj remote) (arg0 vector)) (let ((s4-0 (handle->process (-> obj focus handle)))) (when s4-0 @@ -123,6 +134,8 @@ (lerp-scale 1.0 0.0 (-> obj blend) 0.8 1.0) ) +;; definition for method 25 of type remote +;; WARN: Return type mismatch int vs none. (defmethod remote-method-25 remote ((obj remote)) (with-pp (rlet ((acc :class vf) @@ -135,7 +148,7 @@ (init-vf0-vector) (ja-post) (if (type? (-> obj root) collide-shape) - (collide-shape-method-46 (the-as collide-shape (-> obj root))) + (update-transforms (the-as collide-shape (-> obj root))) ) (when (and (nonzero? (-> obj part)) (and (or (and (-> obj next-state) (= (-> obj next-state name) 'idle)) (and (-> obj next-state) (= (-> obj next-state name) 'enter)) @@ -177,6 +190,9 @@ ) ) +;; definition for function remote-track +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. (defbehavior remote-track remote () (let ((gp-0 (handle->process (-> self focus handle))) (s5-0 (new 'stack-no-clear 'vector)) @@ -245,6 +261,7 @@ (none) ) +;; failed to figure out what this is: (defstate enter (remote) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) @@ -322,6 +339,7 @@ ) ) +;; failed to figure out what this is: (defstate idle (remote) :virtual #t :event (-> (method-of-type remote enter) event) @@ -337,6 +355,7 @@ :post (-> (method-of-type remote enter) post) ) +;; failed to figure out what this is: (defstate exit (remote) :virtual #t :trans remote-track @@ -350,6 +369,8 @@ :post (-> (method-of-type remote enter) post) ) +;; definition for method 23 of type remote +;; WARN: Return type mismatch remote vs none. (defmethod remote-method-23 remote ((obj remote)) (reset-to-collide-spec (-> obj focus) (collide-spec jak player-list)) (initialize-skeleton @@ -364,6 +385,7 @@ (none) ) +;; failed to figure out what this is: (defstate cam-remote (camera-slave) :event (-> cam-string event) :enter (-> cam-string enter) @@ -376,6 +398,7 @@ :code (-> cam-string code) ) +;; definition of type voicebox (deftype voicebox (remote) ((hint handle :offset-assert 288) ) @@ -385,6 +408,7 @@ :flag-assert #x1a00b00128 ) +;; definition for method 3 of type voicebox (defmethod inspect voicebox ((obj voicebox)) (when (not obj) (set! obj obj) @@ -398,6 +422,7 @@ obj ) +;; failed to figure out what this is: (defstate exit (voicebox) :virtual #t :code (behavior () @@ -423,6 +448,9 @@ ) ) +;; definition for function voicebox-init-by-other +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. (defbehavior voicebox-init-by-other voicebox ((arg0 vector) (arg1 handle)) (set! (-> self hint) arg1) (set! (-> self root) (new 'process 'trsqv)) @@ -434,6 +462,7 @@ (none) ) +;; definition for function voicebox-spawn (defun voicebox-spawn ((arg0 process-drawable) (arg1 vector)) (with-pp (when *camera* @@ -446,6 +475,7 @@ ) ) +;; definition of type judge (deftype judge (remote) ((total-time time-frame :offset-assert 288) (beep-time time-frame :offset-assert 296) @@ -462,6 +492,7 @@ ) ) +;; definition for method 3 of type judge (defmethod inspect judge ((obj judge)) (when (not obj) (set! obj obj) @@ -478,15 +509,19 @@ obj ) +;; definition for method 24 of type judge +;; INFO: Used lq/sq (defmethod remote-method-24 judge ((obj judge) (arg0 vector)) (set! (-> arg0 quad) (-> obj base-trans quad)) 1.0 ) +;; definition for method 25 of type judge +;; WARN: Return type mismatch int vs none. (defmethod remote-method-25 judge ((obj judge)) (ja-post) (if (type? (-> obj root) collide-shape) - (collide-shape-method-46 (the-as collide-shape (-> obj root))) + (update-transforms (the-as collide-shape (-> obj root))) ) (when (and (-> obj next-state) (let ((v1-6 (-> obj next-state name))) (or (= v1-6 'idle) (= v1-6 'enter)) @@ -506,6 +541,7 @@ (none) ) +;; failed to figure out what this is: (defstate wait (judge) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) @@ -544,6 +580,7 @@ ) ) +;; failed to figure out what this is: (defstate enter (judge) :virtual #t :enter (behavior () @@ -555,6 +592,7 @@ ) ) +;; failed to figure out what this is: (defstate idle (judge) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) @@ -578,6 +616,8 @@ ) ) +;; definition for method 27 of type judge +;; WARN: Return type mismatch int vs none. (defmethod judge-method-27 judge ((obj judge)) (let ((s5-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) (let ((v1-2 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) @@ -598,6 +638,9 @@ (none) ) +;; definition for method 11 of type judge +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! judge ((obj judge) (arg0 entity-actor)) (judge-method-27 obj) (remote-method-23 obj) @@ -609,6 +652,9 @@ (none) ) +;; definition for function judge-init-by-other +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. (defbehavior judge-init-by-other judge ((arg0 vector) (arg1 uint)) (process-entity-set! self (the-as entity-actor #f)) (set! (-> self score) arg1) @@ -623,6 +669,8 @@ (none) ) +;; definition for function judge-spawn +;; WARN: Return type mismatch (pointer process) vs (pointer judge). (defun judge-spawn ((arg0 process-tree) (arg1 vector) (arg2 uint)) (process-spawn judge arg1 arg2 :to arg0) ) diff --git a/test/decompiler/reference/jak2/engine/common_objs/water_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/water_REF.gc index c6dd12977d..056fa54f41 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/water_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/water_REF.gc @@ -1,5 +1,9 @@ +;;-*-Lisp-*- (in-package goal) +;; definition for function check-water-level-drop +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. (defun check-water-level-drop ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) (when (and (< (-> arg2 y) (-> arg1 user-float)) (< (-> arg1 vel-sxvel y) 0.0)) (let ((gp-0 (new 'stack-no-clear 'vector))) @@ -20,6 +24,8 @@ (none) ) +;; definition for function check-water-level-drop-and-die +;; WARN: Return type mismatch symbol vs none. (defun check-water-level-drop-and-die ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) (if (and (< (-> arg2 y) (-> arg1 user-float)) (< (-> arg1 vel-sxvel y) 0.0)) (sp-kill-particle arg0 arg1) @@ -27,6 +33,7 @@ (none) ) +;; definition for function check-water-level-drop-and-die-motion (defun check-water-level-drop-and-die-motion ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) (if (and (< (-> arg2 y) (-> arg1 user-float)) (< (-> arg1 vel-sxvel y) 0.0)) (sp-kill-particle arg0 arg1) @@ -35,6 +42,8 @@ (none) ) +;; definition for function check-water-level-above-and-die +;; WARN: Return type mismatch symbol vs none. (defun check-water-level-above-and-die ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) (if (or (>= (-> arg2 y) (-> arg1 user-float)) (and *target* (>= (-> arg2 y) (-> *target* water height)))) (sp-kill-particle arg0 arg1) @@ -42,6 +51,7 @@ (none) ) +;; failed to figure out what this is: (defpart 502 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) (sp-flt spt-num 9.0) @@ -66,6 +76,7 @@ ) ) +;; failed to figure out what this is: (defpart 503 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) (sp-flt spt-num 0.1) @@ -90,6 +101,7 @@ ) ) +;; failed to figure out what this is: (defpart 504 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x2c :page #xc)) (sp-flt spt-num 0.05) @@ -109,6 +121,7 @@ ) ) +;; failed to figure out what this is: (defpart 506 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x2e :page #xc)) (sp-flt spt-num 0.06) @@ -133,14 +146,17 @@ ) ) +;; failed to figure out what this is: (defpart 507 :init-specs ((sp-flt spt-fade-a 0.0) (sp-int-plain-rnd spt-next-time 90 119 1) (sp-launcher-by-id spt-next-launcher 508)) ) +;; failed to figure out what this is: (defpart 508 :init-specs ((sp-flt spt-fade-a -0.21333334)) ) +;; failed to figure out what this is: (defpart 509 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x33 :page #xc)) (sp-rnd-flt spt-num 0.05 0.4 1.0) @@ -164,14 +180,17 @@ ) ) +;; failed to figure out what this is: (defpart 510 :init-specs ((sp-flt spt-fade-a 0.0) (sp-int spt-next-time 360) (sp-launcher-by-id spt-next-launcher 511)) ) +;; failed to figure out what this is: (defpart 511 :init-specs ((sp-flt spt-fade-a -0.7111111)) ) +;; failed to figure out what this is: (defpartgroup group-part-water-splash :id 121 :duration (seconds 3) @@ -213,6 +232,7 @@ ) ) +;; failed to figure out what this is: (defpartgroup group-part-water-splash-small :id 122 :duration (seconds 3) @@ -236,6 +256,7 @@ ) ) +;; failed to figure out what this is: (defpart 512 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) (sp-flt spt-num 0.2) @@ -257,6 +278,7 @@ ) ) +;; failed to figure out what this is: (defpart 513 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) (sp-flt spt-num 0.2) @@ -278,6 +300,7 @@ ) ) +;; failed to figure out what this is: (defpart 519 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x2c :page #xc)) (sp-flt spt-num 0.05) @@ -298,6 +321,7 @@ ) ) +;; failed to figure out what this is: (defpart 520 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) (sp-flt spt-num 3.2) @@ -324,6 +348,7 @@ ) ) +;; failed to figure out what this is: (defpart 518 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x2d :page #xc)) (sp-flt spt-num 1.0) @@ -344,6 +369,7 @@ ) ) +;; failed to figure out what this is: (defpart 525 :init-specs ((sp-flt spt-scalevel-y (meters 0.026666667)) (sp-int spt-next-time 20) @@ -351,6 +377,7 @@ ) ) +;; failed to figure out what this is: (defpart 526 :init-specs ((sp-flt spt-scalevel-y (meters 0)) (sp-flt spt-fade-a -0.64) @@ -359,6 +386,7 @@ ) ) +;; failed to figure out what this is: (defpart 527 :init-specs ((sp-flt spt-scalevel-x (meters 0.0016666667)) (sp-flt spt-scalevel-y (meters -0.026666667)) @@ -367,10 +395,12 @@ ) ) +;; failed to figure out what this is: (defpart 528 :init-specs ((sp-flt spt-scalevel-x (meters 0.0033333334)) (sp-flt spt-scalevel-y (meters -0.053333335))) ) +;; failed to figure out what this is: (defpart 516 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) (sp-func spt-birth-func 'birth-func-texture-group) @@ -396,10 +426,12 @@ ) ) +;; failed to figure out what this is: (defpart 505 :init-specs ((sp-flt spt-fade-a -0.21333334)) ) +;; failed to figure out what this is: (defpart 517 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) (sp-flt spt-num 3.2) @@ -425,10 +457,12 @@ ) ) +;; failed to figure out what this is: (defpart 524 :init-specs ((sp-flt spt-scalevel-x (meters 0)) (sp-copy-from-other spt-scalevel-y -4)) ) +;; failed to figure out what this is: (defpart 515 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) (sp-flt spt-num 8.0) @@ -452,6 +486,7 @@ ) ) +;; failed to figure out what this is: (defpart 514 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x2d :page #xc)) (sp-flt spt-num 1.5) @@ -477,6 +512,7 @@ ) ) +;; failed to figure out what this is: (defpart 529 :init-specs ((sp-flt spt-scalevel-x (meters 0)) (sp-flt spt-rotvel-x (degrees 0.16666667)) @@ -486,6 +522,7 @@ ) ) +;; failed to figure out what this is: (defpart 530 :init-specs ((sp-flt spt-rotvel-x (degrees 0.13333334)) (sp-flt spt-scalevel-y (meters 0)) @@ -495,6 +532,7 @@ ) ) +;; failed to figure out what this is: (defpart 531 :init-specs ((sp-flt spt-rotvel-x (degrees 0.1)) (sp-flt spt-scalevel-y (meters -0.016666668)) @@ -503,10 +541,12 @@ ) ) +;; failed to figure out what this is: (defpart 532 :init-specs ((sp-flt spt-rotvel-x (degrees 0.06666667)) (sp-flt spt-scalevel-y (meters -0.033333335))) ) +;; failed to figure out what this is: (defpart 522 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xca :page #xc)) (sp-flt spt-num 1.0) @@ -529,10 +569,12 @@ ) ) +;; failed to figure out what this is: (defpart 533 :init-specs ((sp-flt spt-fade-a -0.64)) ) +;; failed to figure out what this is: (defpart 521 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) (sp-flt spt-num 12.0) @@ -561,6 +603,7 @@ ) ) +;; failed to figure out what this is: (defpart 63 :init-specs ((sp-flt spt-r 255.0) (sp-flt spt-g 255.0) @@ -570,6 +613,7 @@ ) ) +;; failed to figure out what this is: (defpart 534 :init-specs ((sp-rnd-flt spt-r 32.0 32.0 1.0) (sp-rnd-flt spt-g 32.0 32.0 1.0) @@ -579,6 +623,7 @@ ) ) +;; failed to figure out what this is: (defpart 501 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) (sp-flt spt-num 0.3) @@ -604,6 +649,7 @@ ) ) +;; failed to figure out what this is: (defpart 536 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) (sp-rnd-flt spt-num 0.0 0.5 1.0) @@ -630,6 +676,8 @@ ) ) +;; definition for function check-water-level-drop-motion +;; INFO: Used lq/sq (defun check-water-level-drop-motion ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) (when (and (< (-> arg2 y) (-> arg1 user-float)) (< (-> arg1 vel-sxvel y) 0.0)) (let ((s3-0 (new 'stack-no-clear 'vector))) @@ -659,6 +707,7 @@ (none) ) +;; failed to figure out what this is: (defpart 537 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) (sp-flt spt-num 1.0) @@ -685,11 +734,16 @@ ) ) +;; definition for method 9 of type water-control +;; WARN: Return type mismatch int vs none. (defmethod water-control-method-9 water-control ((obj water-control)) 0 (none) ) +;; definition for method 10 of type water-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. (defmethod water-control-method-10 water-control ((obj water-control)) (local-vars (sv-272 (function vector entity-actor skeleton-group vector none :behavior manipy)) @@ -769,7 +823,7 @@ (set! (-> obj swim-depth) (fmax 0.0 (- (- (-> obj surface-height) (-> obj swim-height)) (-> obj bottom 0 y)))) (and (>= (-> obj height) (-> obj bottom 0 y)) (logtest? (water-flags touch-water) (-> s5-0 flags))) ) - (if (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (cshape-moving-flags on-water)) + (if (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (collide-status on-water)) (set! (-> obj on-water-time) (-> pp clock frame-counter)) ) (when (not (logtest? (-> obj flags) (water-flags dark-eco lava))) @@ -959,19 +1013,18 @@ ) (if (and (logtest? (-> obj flags) (water-flags swim-ground)) (and v1-237 - (zero? (logand (-> (the-as collide-shape-moving (-> obj process control)) status) (cshape-moving-flags on-water)) - ) + (zero? (logand (-> (the-as collide-shape-moving (-> obj process control)) status) (collide-status on-water))) ) ) (set! (-> obj bob amp) (* 0.8 (-> obj bob amp))) ) (cond ((and (logtest? (-> obj flags) (water-flags can-swim)) - (or (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (cshape-moving-flags on-water)) + (or (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (collide-status on-water)) (>= f30-1 (-> obj bottom 0 y)) (and (logtest? (water-flags swimming) s4-0) - (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (cshape-moving-flags t-surface)) - (not (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (cshape-moving-flags on-surface)) + (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (collide-status touch-surface)) + (not (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (collide-status on-surface)) ) (>= (+ 204.8 f30-1) (-> obj bottom 0 y)) ) @@ -998,23 +1051,23 @@ ) (cond ((and (logtest? (-> obj flags) (water-flags swim-ground)) - (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (cshape-moving-flags t-surface)) + (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (collide-status touch-surface)) (zero? (logand (water-flags jump-out) (-> obj flags))) ) (let ((v1-260 (new 'stack-no-clear 'vector))) (set! (-> v1-260 quad) (-> obj bottom 0 quad)) (set! (-> v1-260 y) (- (-> obj height) (-> obj swim-height))) (let ((s3-3 (the-as collide-shape-moving (-> obj process control)))) - (when (and (not (logtest? (-> s3-3 status) (cshape-moving-flags csmf12))) + (when (and (not (logtest? (-> s3-3 status) (collide-status touch-background))) (logtest? (water-flags swimming) (-> obj flags)) (zero? (logand (focus-status board pilot) (-> obj process focus-status))) ) (let ((a1-42 (vector-! (new 'stack-no-clear 'vector) v1-260 (-> (the-as control-info s3-3) trans)))) (vector-float*! a1-42 a1-42 (-> pp clock frames-per-second)) - (collide-shape-method-37 s3-3 a1-42) + (integrate-and-collide! s3-3 a1-42) ) (set! (-> (the-as control-info s3-3) status) - (logior (-> s3-3 status) (cshape-moving-flags on-surface on-ground t-surface on-water)) + (logior (-> s3-3 status) (collide-status on-surface on-ground touch-surface on-water)) ) ) ) @@ -1054,12 +1107,8 @@ (set! (-> a1-47 y) f30-1) (when (not (logtest? (focus-status board pilot) (-> obj process focus-status))) (let ((f30-2 (-> s4-1 ground-impact-vel))) - (let ((t9-26 (method-of-object s4-1 collide-shape-moving-method-61))) - (-> (the-as control-info s4-1) transv) - *up-vector* - (t9-26) - ) - (set! (-> (the-as control-info s4-1) status) (logior (-> s4-1 status) (cshape-moving-flags on-water))) + (move-to-ground-point s4-1 a1-47 (-> (the-as control-info s4-1) transv) *up-vector*) + (set! (-> (the-as control-info s4-1) status) (logior (-> s4-1 status) (collide-status on-water))) (set! (-> (the-as control-info s4-1) ground-impact-vel) f30-2) ) ) @@ -1071,7 +1120,7 @@ (cond ((logtest? (-> obj flags) (water-flags tar)) (when (and (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) - (cshape-moving-flags on-surface on-water) + (collide-status on-surface on-water) ) (zero? (logand (focus-status board pilot) (-> obj process focus-status))) ) @@ -1105,7 +1154,7 @@ ) ((logtest? (-> obj flags) (water-flags lava)) (when (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) - (cshape-moving-flags on-surface on-water) + (collide-status on-surface on-water) ) (when (< (-> obj process control trans y) (+ -204.8 (-> obj base-height))) (send-event (-> obj process) 'no-look-around (seconds 1.5)) @@ -1206,6 +1255,8 @@ ) ) +;; definition for method 11 of type water-control +;; WARN: Return type mismatch int vs none. (defmethod start-bobbing! water-control ((obj water-control) (arg0 float) (arg1 int) (arg2 int)) (with-pp (activate! (-> obj bob) (- arg0) arg1 arg2 0.9 1.0 (-> pp clock)) @@ -1214,6 +1265,8 @@ ) ) +;; definition for function part-water-splash-callback +;; WARN: Return type mismatch int vs none. (defun part-water-splash-callback ((arg0 part-tracker)) (let ((f1-0 (-> arg0 root trans y)) (f0-0 (the-as float (-> arg0 userdata))) @@ -1295,6 +1348,8 @@ (none) ) +;; definition for method 15 of type water-control +;; WARN: Return type mismatch int vs none. (defmethod enter-water water-control ((obj water-control)) (with-pp (set! (-> obj flags) (logior (water-flags touch-water) (-> obj flags))) @@ -1327,6 +1382,8 @@ ) ) +;; definition for method 16 of type water-control +;; WARN: Return type mismatch int vs none. (defmethod water-control-method-16 water-control ((obj water-control)) (logclear! (-> obj flags) (water-flags touch-water)) (set-zero! (-> obj bob)) @@ -1337,6 +1394,9 @@ (none) ) +;; definition for function splash-spawn +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. (defun splash-spawn ((arg0 float) (arg1 vector) (arg2 int)) (let ((s5-0 (get-process *default-dead-pool* part-tracker #x4000))) (when s5-0 @@ -1380,6 +1440,9 @@ (none) ) +;; definition for function rings-water-spawn +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. (defun rings-water-spawn ((arg0 float) (arg1 vector) (arg2 vector) (arg3 float) (arg4 float)) (let* ((v1-0 arg2) (f30-0 (sqrtf (+ (* (-> v1-0 x) (-> v1-0 x)) (* (-> v1-0 z) (-> v1-0 z))))) @@ -1425,6 +1488,8 @@ (none) ) +;; definition for method 13 of type water-control +;; WARN: Return type mismatch int vs none. (defmethod spawn-ripples water-control ((obj water-control) (arg0 float) (arg1 vector) (arg2 int) (arg3 vector) (arg4 symbol)) (with-pp (when (and (logtest? (water-flags part-splash) (-> obj flags)) (logtest? (water-flags part-water) (-> obj flags))) @@ -1471,6 +1536,8 @@ ) ) +;; definition for function water-info<-region +;; INFO: Used lq/sq (defun water-info<-region ((arg0 water-info) (arg1 drawable-region-prim) (arg2 collide-shape) (arg3 collide-action)) (with-pp (set! (-> arg0 flags) (water-flags)) @@ -1611,6 +1678,8 @@ ) ) +;; definition for method 52 of type collide-shape +;; INFO: Used lq/sq (defmethod water-info-init! collide-shape ((obj collide-shape) (arg0 water-info) (arg1 collide-action)) "Initialize a [[water-info]] with the currently loaded regions." (local-vars (sv-80 int)) diff --git a/test/decompiler/reference/jak2/engine/game/game-h_REF.gc b/test/decompiler/reference/jak2/engine/game/game-h_REF.gc index 8c8ddfb9ae..cde2725a06 100644 --- a/test/decompiler/reference/jak2/engine/game/game-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/game-h_REF.gc @@ -1,5 +1,7 @@ +;;-*-Lisp-*- (in-package goal) +;; definition of type process-drawable (deftype process-drawable (process) ((root trsqv :offset-assert 128) (node-list cspace-array :offset-assert 132) @@ -33,6 +35,7 @@ ) ) +;; definition for method 3 of type process-drawable (defmethod inspect process-drawable ((obj process-drawable)) (when (not obj) (set! obj obj) @@ -62,6 +65,7 @@ obj ) +;; definition of type process-drawable-reserved (deftype process-drawable-reserved (process-drawable) () :heap-base #x50 @@ -230,6 +234,7 @@ ) ) +;; definition for method 3 of type process-drawable-reserved (defmethod inspect process-drawable-reserved ((obj process-drawable-reserved)) (when (not obj) (set! obj obj) @@ -242,6 +247,7 @@ obj ) +;; definition of type attack-dir-info (deftype attack-dir-info (structure) ((dir vector :inline :offset-assert 0) (xz-dir vector :inline :offset-assert 16) @@ -253,6 +259,7 @@ :flag-assert #x900000040 ) +;; definition for method 3 of type attack-dir-info (defmethod inspect attack-dir-info ((obj attack-dir-info)) (when (not obj) (set! obj obj) @@ -267,6 +274,7 @@ obj ) +;; definition of type attack-info (deftype attack-info (structure) ((trans vector :inline :offset-assert 0) (vector vector :inline :offset-assert 16) @@ -291,7 +299,7 @@ (damage float :offset-assert 144) (shield-damage float :offset-assert 148) (knock uint8 :offset-assert 152) - (test uint32 :offset-assert 156) + (test symbol :offset-assert 156) ) :method-count-assert 12 :size-assert #xa0 @@ -303,6 +311,7 @@ ) ) +;; definition for method 3 of type attack-info (defmethod inspect attack-info ((obj attack-info)) (when (not obj) (set! obj obj) @@ -409,6 +418,7 @@ obj ) +;; definition of type ground-tween-info (deftype ground-tween-info (structure) ((chan uint8 3 :offset-assert 0) (blend float 3 :offset-assert 4) @@ -420,6 +430,7 @@ :flag-assert #x900000024 ) +;; definition for method 3 of type ground-tween-info (defmethod inspect ground-tween-info ((obj ground-tween-info)) (when (not obj) (set! obj obj) @@ -433,4 +444,5 @@ obj ) +;; failed to figure out what this is: 0 diff --git a/test/decompiler/reference/jak2/engine/physics/rigid-body_REF.gc b/test/decompiler/reference/jak2/engine/physics/rigid-body_REF.gc index 1ec340fc20..a1400df01f 100644 --- a/test/decompiler/reference/jak2/engine/physics/rigid-body_REF.gc +++ b/test/decompiler/reference/jak2/engine/physics/rigid-body_REF.gc @@ -645,7 +645,7 @@ (defmethod rigid-body-object-method-31 rigid-body-object ((obj rigid-body-object) (arg0 rigid-body-object-constants)) (set! (-> obj info) arg0) (set! (-> obj rbody) (new 'process 'rigid-body-control obj)) - (collide-shape-method-46 (-> obj root-override-2)) + (update-transforms (-> obj root-override-2)) (rigid-body-method-25 (-> obj rbody state) (the-as rigid-body-info (&-> (-> obj info) mass)) @@ -670,7 +670,9 @@ (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) - (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) (let ((s4-0 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) (set! (-> s4-0 prim-core collide-as) (collide-spec pusher)) (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list)) @@ -680,7 +682,7 @@ (set! (-> s5-0 total-prims) (the-as uint 1)) (set! (-> s5-0 root-prim) s4-0) ) - (collide-shape-method-54 s5-0) + (pusher-init s5-0) (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) (let ((v1-16 (-> s5-0 root-prim))) (set! (-> s5-0 backup-collide-as) (-> v1-16 prim-core collide-as)) diff --git a/test/decompiler/reference/jak2/engine/physics/trajectory_REF.gc b/test/decompiler/reference/jak2/engine/physics/trajectory_REF.gc index 445bff42f0..cbee33cb71 100644 --- a/test/decompiler/reference/jak2/engine/physics/trajectory_REF.gc +++ b/test/decompiler/reference/jak2/engine/physics/trajectory_REF.gc @@ -1,21 +1,29 @@ +;;-*-Lisp-*- (in-package goal) +;; definition for method 9 of type trajectory (defmethod compute-trans-at-time trajectory ((obj trajectory) (arg0 float) (arg1 vector)) (vector+float*! arg1 (-> obj initial-position) (-> obj initial-velocity) arg0) (+! (-> arg1 y) (* 0.5 arg0 arg0 (-> obj gravity))) arg1 ) +;; definition for method 10 of type trajectory +;; INFO: Used lq/sq (defmethod compute-transv-at-time trajectory ((obj trajectory) (arg0 float) (arg1 vector)) (set! (-> arg1 quad) (-> obj initial-velocity quad)) (+! (-> arg1 y) (* arg0 (-> obj gravity))) arg1 ) +;; definition for method 11 of type trajectory (defmethod compute-time-until-apex trajectory ((obj trajectory)) (/ (- (-> obj initial-velocity y)) (-> obj gravity)) ) +;; definition for method 12 of type trajectory +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. (defmethod setup-from-to-duration! trajectory ((obj trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float)) (set! (-> obj initial-position quad) (-> arg0 quad)) (set! (-> obj gravity) arg3) @@ -29,6 +37,8 @@ (none) ) +;; definition for method 13 of type trajectory +;; WARN: Return type mismatch int vs none. (defmethod setup-from-to-xz-vel! trajectory ((obj trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float)) (let ((f0-1 (/ (vector-vector-xz-distance arg1 arg0) arg2))) (setup-from-to-duration! obj arg0 arg1 f0-1 arg3) @@ -37,6 +47,8 @@ (none) ) +;; definition for method 14 of type trajectory +;; WARN: Return type mismatch int vs none. (defmethod setup-from-to-y-vel! trajectory ((obj trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float)) (let* ((f0-0 arg2) (f1-3 (- (* f0-0 f0-0) (* 2.0 (- (-> arg0 y) (-> arg1 y)) arg3))) @@ -53,6 +65,8 @@ (none) ) +;; definition for method 15 of type trajectory +;; WARN: Return type mismatch int vs none. (defmethod setup-from-to-height! trajectory ((obj trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float)) (let* ((f0-1 (+ arg2 (fmax (-> arg0 y) (-> arg1 y)))) (f1-4 (* 2.0 (- (-> arg0 y) f0-1) arg3)) @@ -67,6 +81,9 @@ (none) ) +;; definition for method 16 of type trajectory +;; WARN: Return type mismatch int vs none. +;; WARN: Function (method 16 trajectory) has a return type of none, but the expression builder found a return statement. (defmethod setup-from-to-duration-and-height! trajectory ((obj trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float)) (let ((f0-1 (- (-> arg1 y) (-> arg0 y)))) (cond @@ -99,6 +116,9 @@ (none) ) +;; definition for method 17 of type trajectory +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. (defmethod debug-draw trajectory ((obj trajectory)) (let ((s5-0 (new 'stack-no-clear 'vector)) (s4-0 (new 'stack-no-clear 'vector)) @@ -125,6 +145,8 @@ (none) ) +;; definition for method 9 of type impact-control +;; INFO: Used lq/sq (defmethod initialize impact-control ((obj impact-control) (arg0 process-drawable) (arg1 int) (arg2 float) (arg3 collide-spec)) (set! (-> obj start-time) (-> self clock frame-counter)) (set! (-> obj process) (the-as (pointer process-drawable) (process->ppointer arg0))) @@ -136,6 +158,9 @@ obj ) +;; definition for method 10 of type impact-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. (defmethod update-from-cspace impact-control ((obj impact-control)) (when (>= (-> obj joint) 0) (set! (-> obj trans 1 quad) (-> obj trans 0 quad)) @@ -146,6 +171,8 @@ (none) ) +;; definition for method 11 of type impact-control +;; INFO: Used lq/sq (defmethod impact-control-method-11 impact-control ((obj impact-control) (arg0 collide-query) (arg1 process) (arg2 pat-surface)) (set! (-> arg0 start-pos quad) (-> obj trans 1 quad)) (set! (-> arg0 move-dist quad) (-> obj dir quad)) @@ -193,12 +220,16 @@ ) ) +;; definition for method 9 of type point-tracker +;; INFO: Used lq/sq (defmethod initialize point-tracker ((obj point-tracker) (arg0 vector) (arg1 vector)) (set! (-> obj trans 0 quad) (-> arg0 quad)) (set! (-> obj trans 1 quad) (-> arg1 quad)) obj ) +;; definition for method 10 of type point-tracker +;; INFO: Used lq/sq (defmethod point-tracker-method-10 point-tracker ((obj point-tracker) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 float)) (cond ((>= 0.0 arg3) @@ -216,6 +247,7 @@ arg0 ) +;; definition for method 11 of type point-tracker (defmethod point-tracker-method-11 point-tracker ((obj point-tracker) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 float)) (with-pp (let ((v1-1 (point-tracker-method-10 obj (new 'stack-no-clear 'vector) arg1 arg2 arg3))) @@ -226,6 +258,7 @@ ) ) +;; definition for method 13 of type combo-tracker (defmethod combo-tracker-method-13 combo-tracker ((obj combo-tracker) (arg0 handle) (arg1 vector) (arg2 float) (arg3 vector) (arg4 float)) (cond ((send-event (handle->process arg0) 'combo) @@ -246,7 +279,7 @@ ) ) (sphere<-vector+r! s1-0 arg1 arg2) - (set! (-> s2-1 length) (spatial-hash-method-36 + (set! (-> s2-1 length) (fill-actor-list-for-sphere *actor-hash* s1-0 (the-as (pointer collide-shape) (-> s2-1 data)) @@ -277,6 +310,7 @@ ) ) +;; definition for method 12 of type combo-tracker (defmethod combo-tracker-method-12 combo-tracker ((obj combo-tracker) (arg0 vector) (arg1 vector) (arg2 process) (arg3 time-frame)) (initialize obj arg0 arg1) (set! (-> obj target) (process->handle arg2)) @@ -284,6 +318,8 @@ obj ) +;; definition for method 11 of type combo-tracker +;; INFO: Used lq/sq (defmethod point-tracker-method-11 combo-tracker ((obj combo-tracker) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 float)) (local-vars (at-0 int)) (with-pp @@ -338,6 +374,7 @@ ) ) +;; definition for function traj2d-calc-initial-speed-using-tilt (defun traj2d-calc-initial-speed-using-tilt ((arg0 traj2d-params)) (let ((f0-4 (* (- (* (-> arg0 x) (tan (-> arg0 initial-tilt))) (-> arg0 y)) (/ 2.0 (-> arg0 gravity))))) (cond @@ -355,6 +392,7 @@ ) ) +;; definition for function traj3d-calc-initial-velocity-using-tilt (defun traj3d-calc-initial-velocity-using-tilt ((arg0 traj3d-params)) (vector-! (-> arg0 diff) (-> arg0 dest) (-> arg0 src)) (let ((s5-0 (new 'stack-no-clear 'traj2d-params))) @@ -390,6 +428,9 @@ ) ) +;; definition for method 9 of type cubic-curve +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. (defmethod cubic-curve-method-9 cubic-curve ((obj cubic-curve) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector)) (rlet ((acc :class vf) (vf0 :class vf) @@ -434,6 +475,7 @@ ) ) +;; definition for method 10 of type cubic-curve (defmethod cubic-curve-method-10 cubic-curve ((obj cubic-curve) (arg0 vector) (arg1 float)) (let ((v1-0 (new 'stack-no-clear 'trajectory))) (let ((f0-1 (* arg1 arg1))) @@ -445,6 +487,7 @@ arg0 ) +;; definition for method 11 of type cubic-curve (defmethod cubic-curve-method-11 cubic-curve ((obj cubic-curve) (arg0 vector) (arg1 float)) (let ((v1-0 (new 'stack-no-clear 'trajectory))) (set-vector! (-> v1-0 initial-position) 0.0 1.0 (* 2.0 arg1) (* 3.0 arg1 arg1)) @@ -454,6 +497,7 @@ arg0 ) +;; definition for method 12 of type cubic-curve (defmethod cubic-curve-method-12 cubic-curve ((obj cubic-curve) (arg0 vector) (arg1 float)) (let ((v1-0 (new 'stack-no-clear 'trajectory))) (set-vector! (-> v1-0 initial-position) 0.0 0.0 2.0 (* 6.0 arg1)) @@ -463,6 +507,9 @@ arg0 ) +;; definition for method 13 of type cubic-curve +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. (defmethod debug-draw-curve cubic-curve ((obj cubic-curve)) (let ((s5-0 (new 'stack-no-clear 'trajectory)) (s4-0 10) diff --git a/test/decompiler/reference/jak2/engine/process-drawable/simple-nav-sphere_REF.gc b/test/decompiler/reference/jak2/engine/process-drawable/simple-nav-sphere_REF.gc index c2f184bd95..3867b9b8f5 100644 --- a/test/decompiler/reference/jak2/engine/process-drawable/simple-nav-sphere_REF.gc +++ b/test/decompiler/reference/jak2/engine/process-drawable/simple-nav-sphere_REF.gc @@ -40,7 +40,7 @@ (go empty-state) ) (('move-trans) - (collide-shape-method-29 (-> self root-override) (the-as vector (-> event param 0))) + (move-to-point! (-> self root-override) (the-as vector (-> event param 0))) #t ) (('set-radius) @@ -49,7 +49,7 @@ ) (set! (-> collide-shape nav-radius) radius) (set! (-> collide-shape root-prim local-sphere w) radius) - (collide-shape-method-46 collide-shape) + (update-transforms collide-shape) ) #t ) @@ -107,7 +107,7 @@ (gp-0 (new 'stack-no-clear 'vector)) ) (vector<-cspace! gp-0 (-> (the-as process-drawable v1-0) node-list data (-> self track-joint))) - (collide-shape-method-29 (-> self root-override) gp-0) + (move-to-point! (-> self root-override) gp-0) ) (none) ) @@ -144,7 +144,7 @@ (set! (-> v1-11 prim-core collide-with) (collide-spec)) ) 0 - (collide-shape-method-46 s5-0) + (update-transforms s5-0) (set! (-> self root-override) s5-0) ) (logclear! (-> self mask) (process-mask actor-pause enemy)) diff --git a/test/decompiler/reference/jak2/engine/spatial-hash/spatial-hash-h_REF.gc b/test/decompiler/reference/jak2/engine/spatial-hash/spatial-hash-h_REF.gc index 658815cee4..c0a96ba1fa 100644 --- a/test/decompiler/reference/jak2/engine/spatial-hash/spatial-hash-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/spatial-hash/spatial-hash-h_REF.gc @@ -1,5 +1,7 @@ +;;-*-Lisp-*- (in-package goal) +;; definition of type grid-hash-word (deftype grid-hash-word (uint8) () :method-count-assert 9 @@ -7,6 +9,7 @@ :flag-assert #x900000001 ) +;; definition of type grid-hash-box (deftype grid-hash-box (structure) ((min int8 3 :offset-assert 0) (max int8 3 :offset-assert 3) @@ -17,6 +20,7 @@ :flag-assert #x900000006 ) +;; definition for method 3 of type grid-hash-box (defmethod inspect grid-hash-box ((obj grid-hash-box)) (when (not obj) (set! obj obj) @@ -29,6 +33,7 @@ obj ) +;; definition of type grid-hash (deftype grid-hash (basic) ((work grid-hash-work :offset-assert 4) (search-box grid-hash-box :inline :offset-assert 8) @@ -72,6 +77,7 @@ ) ) +;; definition for method 3 of type grid-hash (defmethod inspect grid-hash ((obj grid-hash)) (when (not obj) (set! obj obj) @@ -99,6 +105,7 @@ obj ) +;; definition of type find-nav-sphere-ids-params (deftype find-nav-sphere-ids-params (structure) ((bsphere sphere :inline :offset-assert 0) (y-threshold float :offset-assert 16) @@ -112,6 +119,7 @@ :flag-assert #x900000020 ) +;; definition for method 3 of type find-nav-sphere-ids-params (defmethod inspect find-nav-sphere-ids-params ((obj find-nav-sphere-ids-params)) (when (not obj) (set! obj obj) @@ -128,6 +136,7 @@ obj ) +;; definition of type sphere-hash (deftype sphere-hash (grid-hash) ((sphere-array (inline-array sphere) :offset-assert 88) (max-object-count int16 :offset-assert 92) @@ -151,6 +160,7 @@ ) ) +;; definition for method 3 of type sphere-hash (defmethod inspect sphere-hash ((obj sphere-hash)) (when (not obj) (set! obj obj) @@ -183,6 +193,7 @@ obj ) +;; definition of type hash-object-info (deftype hash-object-info (structure) ((object basic :offset-assert 0) ) @@ -191,6 +202,7 @@ :flag-assert #x900000004 ) +;; definition for method 3 of type hash-object-info (defmethod inspect hash-object-info ((obj hash-object-info)) (when (not obj) (set! obj obj) @@ -202,6 +214,7 @@ obj ) +;; definition of type spatial-hash (deftype spatial-hash (sphere-hash) ((object-array (pointer hash-object-info) :offset-assert 104) (mem-object-array (pointer hash-object-info) :offset-assert 108) @@ -213,7 +226,7 @@ (:methods (spatial-hash-method-34 (_type_ vector hash-object-info) int 34) (spatial-hash-method-35 (_type_) none 35) - (spatial-hash-method-36 (_type_ sphere (pointer collide-shape) int) int 36) + (fill-actor-list-for-sphere (_type_ sphere (pointer collide-shape) int) int 36) (spatial-hash-method-37 (_type_) none 37) (spatial-hash-method-38 (_type_) none 38) (spatial-hash-method-39 (_type_ object hash-object-info) none 39) @@ -221,6 +234,7 @@ ) ) +;; definition for method 3 of type spatial-hash (defmethod inspect spatial-hash ((obj spatial-hash)) (when (not obj) (set! obj obj) @@ -256,4 +270,5 @@ obj ) +;; failed to figure out what this is: 0 diff --git a/test/decompiler/reference/jak2/engine/target/board/board-h_REF.gc b/test/decompiler/reference/jak2/engine/target/board/board-h_REF.gc index 57c43b5ae6..30e9234c6c 100644 --- a/test/decompiler/reference/jak2/engine/target/board/board-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/board/board-h_REF.gc @@ -449,7 +449,7 @@ (set! (-> s5-0 2 y) (+ 16384.0 (-> s5-0 2 y))) (set! (-> s5-0 2 r) 2867.2) (let ((v1-55 gp-0)) - (set! (-> v1-55 spheres) s5-0) + (set! (-> v1-55 best-dist) (the-as float s5-0)) (set! (-> v1-55 num-spheres) (the-as uint 3)) (set! (-> v1-55 collide-with) (logclear (-> self control root-prim prim-core collide-with) diff --git a/test/decompiler/reference/jak2/engine/target/board/board-states_REF.gc b/test/decompiler/reference/jak2/engine/target/board/board-states_REF.gc index c7fb52fe87..4ee146baa7 100644 --- a/test/decompiler/reference/jak2/engine/target/board/board-states_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/board/board-states_REF.gc @@ -82,7 +82,7 @@ (when (and (board-on-ground?) (>= (- (-> self clock frame-counter) (-> self board unknown-time-frame02)) (seconds 0.2)) ) - (if (logtest? (-> self control status) (cshape-moving-flags csmf11)) + (if (logtest? (-> self control status) (collide-status impact-surface)) (+! (-> self board turn-anim-duck-vel) (lerp-scale 0.0 15.0 (-> self control unknown-float21) 0.0 81920.0)) ) (let ((f0-38 (vector-dot (the-as vector (-> self board up-vector)) (-> self board up-vector 1)))) @@ -357,7 +357,7 @@ (if (< (vector-length (-> self control transv)) 114688.0) (vector-normalize! (-> self control transv) 114688.0) ) - (when (not (logtest? (-> self control old-status) (cshape-moving-flags on-surface))) + (when (not (logtest? (-> self control old-status) (collide-status on-surface))) (let ((gp-0 (new 'stack-no-clear 'vector))) (set! (-> gp-0 quad) (-> self control trans quad)) (set! (-> gp-0 y) (+ 2048.0 (-> gp-0 y))) @@ -999,7 +999,7 @@ ) ) ) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! arg2 (cond ((the-as object arg2) (empty) @@ -1558,7 +1558,7 @@ ) (else (init-var-jump arg0 arg1 #t #f (-> self control transv) 1.0) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control unknown-float36) (fmax 0.0 (fmin 1.0 (* 0.00004359654 (+ -11468.8 (-> self control unknown-float05))))) ) @@ -1741,7 +1741,7 @@ ) (else (init-var-jump arg0 arg1 #t #f (-> self control transv) 1.0) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control unknown-float36) (fmax 0.0 (fmin 1.0 (* 0.00004359654 (+ -11468.8 (-> self control unknown-float05))))) ) @@ -2269,7 +2269,7 @@ (none) ) :exit (behavior () - (logclear! (-> self control status) (cshape-moving-flags csmf16)) + (logclear! (-> self control status) (collide-status probe-hit)) (let ((v1-2 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) (set! (-> v1-2 command) (sound-command set-param)) (set! (-> v1-2 id) (the-as sound-id (-> self board ride-sound-id))) @@ -2287,7 +2287,7 @@ (let ((gp-0 (new 'stack-no-clear 'vector))) (set! (-> gp-0 quad) (-> self control trans quad)) (let ((s5-0 (new 'stack-no-clear 'collide-query))) - (if (collide-shape-moving-method-55 + (if (find-ground (-> self control) s5-0 (logclear (-> self control root-prim prim-core collide-with) (collide-spec water)) @@ -2301,7 +2301,7 @@ (if (< (-> self control trans y) (-> self control gspot-pos y)) (set! (-> gp-0 quad) (-> self control gspot-pos quad)) ) - (collide-shape-method-29 + (move-to-point! (-> self control) (vector+! (new 'stack-no-clear 'vector) gp-0 (new 'static 'vector :y 204.8 :w 1.0)) ) @@ -2592,7 +2592,7 @@ :enter (behavior () (set! (-> self board shock-offsetv) 0.0) (set! (-> self state-time) (-> self clock frame-counter)) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control unknown-surface00) *board-jump-mods*) (set! (-> self board mods-backup) (-> self control unknown-surface00)) (let ((a0-5 (target-time-to-ground))) @@ -2708,7 +2708,7 @@ :frame-num 0.0 ) (until (ja-done? 0) - (when (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (when (logtest? (-> self control status) (collide-status on-surface)) (set! (-> self board turn-anim-duck-vel) 0.0) (goto cfg-19) ) @@ -2722,7 +2722,7 @@ ) (label cfg-19) (send-event (ppointer->process (-> self sidekick)) 'matrix 'board) - (logior! (-> self control status) (cshape-moving-flags on-surface)) + (logior! (-> self control status) (collide-status on-surface)) (go target-board-hit-ground) (none) ) @@ -2745,7 +2745,7 @@ (logclear! (-> self focus-status) (focus-status halfpipe)) (set! (-> self board shock-offsetv) 0.0) (set! (-> self state-time) (-> self clock frame-counter)) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (none) ) :exit target-board-exit @@ -2820,7 +2820,7 @@ :post (behavior () (set! (-> self control unknown-float30) 0.0) (set! (-> self control unknown-float29) 0.0) - (vector-seek! (-> self control unknown-vector04) *null-vector* (* 16384.0 (-> self clock seconds-per-frame))) + (vector-seek! (-> self control draw-offset) *null-vector* (* 16384.0 (-> self clock seconds-per-frame))) (target-no-move-post) (target-board-effect) (none) @@ -2839,7 +2839,7 @@ (logclear! (-> self focus-status) (focus-status halfpipe)) (set! (-> self board shock-offsetv) 0.0) (set! (-> self state-time) (-> self clock frame-counter)) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control unknown-surface00) (new 'static 'surface :name 'jump :turnv 131072.0 @@ -2998,9 +2998,9 @@ (not (or (logtest? v1-114 (the-as water-flags a0-35)) (begin (let ((v1-117 #t)) - (set! a0-35 (the-as int (logand (-> self control status) (cshape-moving-flags on-water)))) + (set! a0-35 (the-as int (logand (-> self control status) (collide-status on-water)))) (set! a0-35 a0-35) - (cmove-#f-zero v1-116 (the-as cshape-moving-flags a0-35) v1-117) + (cmove-#f-zero v1-116 (the-as collide-status a0-35) v1-117) ) v1-116 ) @@ -3019,7 +3019,7 @@ :post (behavior () (set! (-> self control unknown-float30) 0.0) (set! (-> self control unknown-float29) 0.0) - (vector-seek! (-> self control unknown-vector04) *null-vector* (* 16384.0 (-> self clock seconds-per-frame))) + (vector-seek! (-> self control draw-offset) *null-vector* (* 16384.0 (-> self clock seconds-per-frame))) (target-post) (target-board-effect) (none) @@ -3099,8 +3099,8 @@ ) :enter (-> target-clone-anim enter) :exit (behavior () - (set! (-> self control unknown-vector04 y) (the-as float (-> self control unknown-word04))) - (set! (-> self control unknown-vector05 y) (-> self control unknown-vector04 y)) + (set! (-> self control draw-offset y) (the-as float (-> self control unknown-word04))) + (set! (-> self control cspace-offset y) (-> self control draw-offset y)) (send-event (ppointer->process (-> self sidekick)) 'matrix 'board) ((-> target-clone-anim exit)) ((-> target-board-start exit)) @@ -3108,8 +3108,8 @@ (none) ) :code (behavior ((arg0 handle)) - (set! (-> self control unknown-word04) (the-as uint (-> self control unknown-vector04 y))) - (set! (-> self control unknown-vector04 y) 0.0) + (set! (-> self control unknown-word04) (the-as uint (-> self control draw-offset y))) + (set! (-> self control draw-offset y) 0.0) (send-event (ppointer->process (-> self sidekick)) 'matrix 'play-anim) (clone-anim arg0 #t "") (go target-board-stance) @@ -3208,14 +3208,14 @@ (cond ((= (-> self game mode) 'debug) (let ((s4-1 (new-stack-vector0))) - (set! (-> s4-1 quad) (-> self control unknown-vector23 quad)) + (set! (-> s4-1 quad) (-> self control last-trans-on-surf quad)) (ja-channel-set! 0) (let ((s3-1 (-> self clock frame-counter))) (until (>= (- (-> self clock frame-counter) s3-1) (seconds 1)) (suspend) ) ) - (collide-shape-method-29 (-> self control) s4-1) + (move-to-point! (-> self control) s4-1) ) (set! (-> self control unknown-vector15 quad) (-> self control trans quad)) (send-event *camera* 'teleport) diff --git a/test/decompiler/reference/jak2/engine/target/board/target-board_REF.gc b/test/decompiler/reference/jak2/engine/target/board/target-board_REF.gc index 356c491cd0..844e091df8 100644 --- a/test/decompiler/reference/jak2/engine/target/board/target-board_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/board/target-board_REF.gc @@ -563,7 +563,7 @@ (let ((v1-82 (-> self node-list data))) (set! (-> v1-82 0 param0) cspace<-transformq+world-trans!) (set! (-> v1-82 0 param1) (the-as basic (-> self control trans))) - (set! (-> v1-82 0 param2) (the-as basic (-> self control unknown-vector05))) + (set! (-> v1-82 0 param2) (the-as basic (-> self control cspace-offset))) ) (target-collide-set! 'board 0.0) (set! (-> self state-flags) (logior (state-flags lleg-no-ik rleg-no-ik) (-> self state-flags))) @@ -642,7 +642,7 @@ (let ((v1-43 (-> self node-list data))) (set! (-> v1-43 0 param0) cspace<-transformq+trans!) (set! (-> v1-43 0 param1) (the-as basic (-> self control trans))) - (set! (-> v1-43 0 param2) (the-as basic (-> self control unknown-vector05))) + (set! (-> v1-43 0 param2) (the-as basic (-> self control cspace-offset))) ) (target-collide-set! 'normal 0.0) (set! (-> self control reaction) target-collision-reaction) @@ -654,7 +654,7 @@ (sound-stop (the-as sound-id (-> self board spin-sound-id))) (set! (-> self board spin-sound-id) (the-as uint 0)) (send-event (ppointer->process (-> self sidekick)) 'matrix 'normal) - (set! (-> self control unknown-vector05 quad) (the-as uint128 0)) + (set! (-> self control cspace-offset quad) (the-as uint128 0)) (remove-setting! 'sound-flava) (remove-setting! 'mode-sound-bank) (target-exit) @@ -684,18 +684,18 @@ ;; definition for function board-on-ground? (defbehavior board-on-ground? target () - (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (logtest? (-> self control status) (collide-status on-surface)) ) ;; definition for function target-board-smack-surface? ;; INFO: Used lq/sq (defbehavior target-board-smack-surface? target () - (when (and (logtest? (-> self control status) (cshape-moving-flags t-wall)) + (when (and (logtest? (-> self control status) (collide-status touch-wall)) (< (+ (-> self clock frame-counter) (seconds -0.05)) (-> self control unknown-time-frame07)) (< 0.7 (-> self control touch-angle)) (< 73728.0 (-> self control unknown-float05)) (and (< (vector-dot (-> self control unknown-vector25) (-> self control dynam gravity-normal)) 0.3) - (zero? (logand (-> self control status) (cshape-moving-flags t-act))) + (zero? (logand (-> self control status) (collide-status touch-actor))) ) ) (set! (-> self board smack-surface-time) (-> self clock frame-counter)) @@ -785,7 +785,7 @@ ) (cond ((and (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame07)) (seconds 0.1)) - (< 0.3 (-> self control unknown-float27)) + (< 0.3 (-> self control blocked-factor)) ) (set! f0-28 f1-23) ) @@ -823,7 +823,7 @@ "ltransv" (the-as rgba (-> (new 'static 'array uint64 1 #x8000ff00) 0)) ) - (set! (-> s5-0 quad) (-> self control unknwon-vector27 quad)) + (set! (-> s5-0 quad) (-> self control btransv quad)) (vector-float*! s5-0 s5-0 0.5) (vector+! s5-0 s5-0 (-> self control trans)) (add-debug-text-sphere @@ -918,11 +918,11 @@ (set! gp-0 4) ) ((and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) - (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (zero? (logand (-> self control status) (collide-status on-surface))) ) (set! gp-0 1) ) - ((not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + ((not (logtest? (-> self control status) (collide-status on-surface))) (set! gp-0 2) ) ) @@ -1170,11 +1170,11 @@ ) ) ) - (set! (-> self control unknown-vector04 y) + (set! (-> self control draw-offset y) (+ (-> self board cushion-base) (-> self board cushion-offset) (-> self board shock-offset)) ) - (if (< (-> self control unknown-vector04 y) 0.0) - (set! (-> self control unknown-vector04 y) 0.0) + (if (< (-> self control draw-offset y) 0.0) + (set! (-> self control draw-offset y) 0.0) ) 0 (none) @@ -1239,7 +1239,7 @@ (set! (-> a2-6 ignore-process1) #f) (set! (-> a2-6 ignore-pat) (-> v1-30 pat-ignore-mask)) (set! (-> a2-6 action-mask) (collide-action solid)) - (collide-shape-method-32 v1-30 (-> v1-30 transv) a2-6 (meters 1)) + (fill-cache-integrate-and-collide v1-30 (-> v1-30 transv) a2-6 (meters 1)) ) (when (logtest? (-> self control root-prim prim-core action) (collide-action check-edge)) (logclear! (-> *collide-edge-board-spec* flags) (collide-edge-spec-flags one)) @@ -1267,7 +1267,7 @@ (let* ((v1-60 gp-0) (f30-0 (sqrtf (+ (* (-> v1-60 x) (-> v1-60 x)) (* (-> v1-60 z) (-> v1-60 z))))) ) - (when (and (logtest? (-> self control status) (cshape-moving-flags t-wall)) + (when (and (logtest? (-> self control status) (collide-status touch-wall)) (and (< 16384.0 f30-0) (not (and (-> self next-state) (= (-> self next-state name) 'target-board-smack))) (not (logtest? (focus-status halfpipe) (-> self focus-status))) @@ -1294,7 +1294,7 @@ ) (s3-3 (vector-matrix*! (new 'stack-no-clear 'vector) s3-2 (-> self control unknown-matrix00))) ) - (logior! (-> self control status) (cshape-moving-flags csmf15)) + (logior! (-> self control status) (collide-status glance)) (set! (-> self board glance-time) (-> self clock frame-counter)) (let ((v1-99 s2-2)) (set! (-> self board glance-speed) (sqrtf (+ (* (-> v1-99 x) (-> v1-99 x)) (* (-> v1-99 z) (-> v1-99 z))))) @@ -1314,7 +1314,7 @@ (when (and (< (vector-dot s4-3 s5-3) -0.77) (zero? (logand (-> self focus-status) (focus-status dead hit)))) (cond ((not (and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) - (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (zero? (logand (-> self control status) (collide-status on-surface))) ) ) (if (< 32768.0 f30-0) @@ -1400,7 +1400,7 @@ (defbehavior target-board-pre-move target () (cond ((and (and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) - (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (zero? (logand (-> self control status) (collide-status on-surface))) ) (begin (set! (-> self board in-air-time) (-> self clock frame-counter)) @@ -1580,7 +1580,7 @@ (set! (-> self board unknown-time-frame00) (-> self clock frame-counter)) ) ) - (when (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (when (and (not (logtest? (-> self control status) (collide-status on-surface))) (< 0.0 f28-0) (or (and (or (< (target-height-above-ground) 4096.0) (< (- (-> self clock frame-counter) (-> self board unknown-time-frame00)) (seconds 0.1)) @@ -1794,7 +1794,7 @@ (seek! (-> self board cushion-offset) 0.0 (* 20480.0 (-> self clock seconds-per-frame))) ) ((and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) - (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (zero? (logand (-> self control status) (collide-status on-surface))) ) (seek! (-> self board cushion-offset) @@ -2056,7 +2056,7 @@ ) ) (if (probe-test (-> self control) s3-5 (new 'static 'pat-surface :noentity #x1 :noboard #x1 :probe #x1)) - (set! (-> self control status) (logior (cshape-moving-flags csmf16) (-> self control status))) + (set! (-> self control status) (logior (collide-status probe-hit) (-> self control status))) (move-by-vector! (-> self control) s3-5) ) ) @@ -2197,10 +2197,10 @@ ) (set! s4-3 (logior s4-3 32)) ) - (if (logtest? (cshape-moving-flags csmf16) (-> self control status)) + (if (logtest? (collide-status probe-hit) (-> self control status)) (set! s4-3 (logior s4-3 64)) ) - (logclear! (-> self control status) (cshape-moving-flags csmf16)) + (logclear! (-> self control status) (collide-status probe-hit)) (when (and (< (- (-> self clock frame-counter) (-> self board ride-time)) (seconds 0.2)) (nonzero? s4-3)) (if (logtest? s4-3 1) (format #t "exit speed ~M~%" f30-2) @@ -2260,7 +2260,7 @@ ) ) ((logtest? s4-3 42) - (collide-shape-method-29 (-> self control) gp-0) + (move-to-point! (-> self control) gp-0) (set! (-> self control transv quad) (-> s5-0 quad)) ) ) @@ -2435,7 +2435,7 @@ (set! (-> a2-4 ignore-process1) #f) (set! (-> a2-4 ignore-pat) (-> v1-103 pat-ignore-mask)) (set! (-> a2-4 action-mask) (collide-action solid)) - (collide-shape-method-32 v1-103 (-> v1-103 transv) a2-4 (meters 1)) + (fill-cache-integrate-and-collide v1-103 (-> v1-103 transv) a2-4 (meters 1)) ) (when (logtest? (-> self control root-prim prim-core action) (collide-action check-edge)) (logclear! (-> *collide-edge-board-spec* flags) (collide-edge-spec-flags two)) @@ -2496,10 +2496,10 @@ (vector-! (new 'stack-no-clear 'vector) s3-2 (-> self control trans)) (new 'static 'pat-surface :noentity #x1 :noboard #x1 :probe #x1) ) - (set! (-> self control status) (logior (cshape-moving-flags csmf16) (-> self control status))) + (set! (-> self control status) (logior (collide-status probe-hit) (-> self control status))) ) - (if (and (-> self board ride-lock-on) (zero? (logand (cshape-moving-flags csmf16) (-> self control status)))) - (collide-shape-method-29 (-> self control) s3-2) + (if (and (-> self board ride-lock-on) (zero? (logand (collide-status probe-hit) (-> self control status)))) + (move-to-point! (-> self control) s3-2) ) ) (set! (-> self control transv quad) (-> s5-3 quad)) @@ -2664,7 +2664,7 @@ ) ) (let ((f0-59 (fmin - (if (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (if (logtest? (-> self control status) (collide-status on-surface)) (seek (-> self board turn-anim-duck) 0.0 (-> self clock seconds-per-frame)) (-> self board turn-anim-duck) ) diff --git a/test/decompiler/reference/jak2/engine/target/gun/gun-blue-shot_REF.gc b/test/decompiler/reference/jak2/engine/target/gun/gun-blue-shot_REF.gc index a31534a280..9429d18a58 100644 --- a/test/decompiler/reference/jak2/engine/target/gun/gun-blue-shot_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/gun/gun-blue-shot_REF.gc @@ -244,8 +244,10 @@ ;; definition for method 38 of type gun-blue-shot (defmethod made-impact? gun-blue-shot ((obj gun-blue-shot)) "TODO - queries the collision cache, return true/false" - (let ((v1-0 (-> obj root-override))) - (let ((a1-0 (new 'stack-no-clear 'collide-query))) + (let ((v1-0 (-> obj root-override)) + (t1-0 (new 'stack-no-clear 'collide-query)) + ) + (let ((a1-0 t1-0)) (set! (-> a1-0 radius) (-> v1-0 root-prim prim-core world-sphere w)) (set! (-> a1-0 collide-with) (-> v1-0 root-prim prim-core collide-with)) (set! (-> a1-0 ignore-process0) obj) @@ -253,7 +255,7 @@ (set! (-> a1-0 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) (set! (-> a1-0 action-mask) (collide-action solid)) ) - (collide-shape-moving-method-65 v1-0 (-> v1-0 transv) -12288.0 12697.6 -2048.0) + (fill-and-try-snap-to-surface v1-0 (-> v1-0 transv) -12288.0 12697.6 -2048.0 t1-0) ) ) @@ -261,7 +263,7 @@ ;; WARN: Return type mismatch int vs none. (defun gun-blue-shot-move ((arg0 gun-blue-shot)) (projectile-move-fill-line-sphere arg0) - (if (logtest? (-> arg0 root-override status) (cshape-moving-flags t-surface)) + (if (logtest? (-> arg0 root-override status) (collide-status touch-surface)) (go (method-of-object arg0 impact)) ) 0 @@ -270,17 +272,17 @@ ;; definition for function cshape-reaction-blue-shot ;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs cshape-moving-flags. +;; WARN: Return type mismatch int vs collide-status. (defun cshape-reaction-blue-shot ((arg0 control-info) (arg1 collide-query) (arg2 vector) (arg3 vector)) (vector-reset! arg2) (let ((a1-1 (new 'stack-no-clear 'vector))) - (vector-float*! a1-1 (-> arg1 move-dist) (the-as float (-> arg1 spheres))) + (vector-float*! a1-1 (-> arg1 move-dist) (-> arg1 best-dist)) (move-by-vector! arg0 a1-1) ) (set! (-> (the-as gun-blue-shot (-> arg0 process)) collide-normal quad) (-> arg1 best-other-tri normal quad)) (let ((v0-1 4)) (logior! (-> arg0 status) v0-1) - (the-as cshape-moving-flags v0-1) + (the-as collide-status v0-1) ) ) @@ -291,7 +293,9 @@ (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-blue-shot) - (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) (set! (-> s5-0 penetrate-using) (penetrate jak-blue-shot)) (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) (set! (-> s5-0 total-prims) (the-as uint 3)) diff --git a/test/decompiler/reference/jak2/engine/target/gun/gun-red-shot_REF.gc b/test/decompiler/reference/jak2/engine/target/gun/gun-red-shot_REF.gc index 811266fad5..8fd4df7026 100644 --- a/test/decompiler/reference/jak2/engine/target/gun/gun-red-shot_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/gun/gun-red-shot_REF.gc @@ -292,7 +292,7 @@ (let ((s4-0 (-> obj root-override root-prim prim-core collide-with))) (set! *actor-list-length* 0) (if (logtest? s4-0 (collide-spec hit-by-others-list)) - (set! *actor-list-length* (spatial-hash-method-36 *actor-hash* (the-as sphere s5-0) *actor-list* 256)) + (set! *actor-list-length* (fill-actor-list-for-sphere *actor-hash* (the-as sphere s5-0) *actor-list* 256)) ) (when (logtest? s4-0 (collide-spec player-list)) (let ((a0-6 (-> *collide-player-list* alive-list next0))) @@ -449,8 +449,8 @@ (.mul.x.vf vf1 vf1 vf2 :mask #b111) (.svf (&-> v1-2 quad) vf1) ) - (collide-shape-method-37 gp-0 (-> gp-0 transv)) - (if (logtest? (-> gp-0 status) (cshape-moving-flags t-surface t-wall)) + (integrate-and-collide! gp-0 (-> gp-0 transv)) + (if (logtest? (-> gp-0 status) (collide-status touch-surface touch-wall)) (sound-play "red-shot-hit") ) ) @@ -460,8 +460,10 @@ ;; definition for method 24 of type gun-red-shot (defmethod gun-red-shot-method-24 gun-red-shot ((obj gun-red-shot)) - (let ((v1-0 (-> obj root-override))) - (let ((a1-0 (new 'stack-no-clear 'collide-query))) + (let ((v1-0 (-> obj root-override)) + (t1-0 (new 'stack-no-clear 'collide-query)) + ) + (let ((a1-0 t1-0)) (set! (-> a1-0 radius) (-> v1-0 root-prim prim-core world-sphere w)) (set! (-> a1-0 collide-with) (-> v1-0 root-prim prim-core collide-with)) (set! (-> a1-0 ignore-process0) obj) @@ -469,7 +471,7 @@ (set! (-> a1-0 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) (set! (-> a1-0 action-mask) (collide-action solid)) ) - (if (collide-shape-moving-method-65 v1-0 (-> v1-0 transv) -6144.0 0.0 -2048.0) + (if (fill-and-try-snap-to-surface v1-0 (-> v1-0 transv) -6144.0 0.0 -2048.0 t1-0) #t ) ) @@ -558,9 +560,11 @@ (let ((s5-0 (new 'process 'collide-shape-moving self (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) - (the-as (function control-info collide-query vector vector cshape-moving-flags) cshape-reaction-just-move) + (the-as (function control-info collide-query vector vector collide-status) cshape-reaction-just-move) + ) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (set! (-> s5-0 no-reaction) nothing) (set! (-> s5-0 penetrate-using) (penetrate jak-red-shot)) (let ((v1-10 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) (set! (-> v1-10 prim-core collide-as) (collide-spec projectile)) @@ -586,7 +590,7 @@ (quaternion-copy! (-> s5-1 quat) (-> (the-as process-drawable (-> self parent 0)) root quat)) (vector-identity! (-> s5-1 scale)) ) - (collide-shape-method-46 (-> self root-override)) + (update-transforms (-> self root-override)) (set! (-> self event-hook) gun-red-shot-event-handler) (set! (-> self mask) (logior (process-mask projectile) (-> self mask))) (logclear! (-> self mask) (process-mask enemy)) diff --git a/test/decompiler/reference/jak2/engine/target/gun/gun-yellow-shot_REF.gc b/test/decompiler/reference/jak2/engine/target/gun/gun-yellow-shot_REF.gc index 320d101fb5..34d46fb7d8 100644 --- a/test/decompiler/reference/jak2/engine/target/gun/gun-yellow-shot_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/gun/gun-yellow-shot_REF.gc @@ -296,8 +296,10 @@ ;; definition for method 38 of type gun-yellow-shot (defmethod made-impact? gun-yellow-shot ((obj gun-yellow-shot)) "TODO - queries the collision cache, return true/false" - (let ((v1-0 (-> obj root-override))) - (let ((a0-1 (new 'stack-no-clear 'collide-query))) + (let ((v1-0 (-> obj root-override)) + (t1-0 (new 'stack-no-clear 'collide-query)) + ) + (let ((a0-1 t1-0)) (set! (-> a0-1 radius) (-> v1-0 root-prim prim-core world-sphere w)) (set! (-> a0-1 collide-with) (-> v1-0 root-prim prim-core collide-with)) (set! (-> a0-1 ignore-process0) obj) @@ -305,8 +307,8 @@ (set! (-> a0-1 ignore-pat) (-> v1-0 pat-ignore-mask)) (set! (-> a0-1 action-mask) (collide-action solid)) ) - (when (collide-shape-moving-method-65 v1-0 (-> v1-0 transv) -10240.0 12697.6 -4096.0) - (if (logtest? (-> obj root-override status) (cshape-moving-flags t-act)) + (when (fill-and-try-snap-to-surface v1-0 (-> v1-0 transv) -10240.0 12697.6 -4096.0 t1-0) + (if (logtest? (-> obj root-override status) (collide-status touch-actor)) (set! (-> obj hit-actor?) #t) ) #t @@ -329,8 +331,8 @@ ) ) ) - (when (logtest? (-> s5-0 status) (cshape-moving-flags t-surface)) - (if (logtest? (-> arg0 root-override status) (cshape-moving-flags t-act)) + (when (logtest? (-> s5-0 status) (collide-status touch-surface)) + (if (logtest? (-> arg0 root-override status) (collide-status touch-actor)) (set! (-> arg0 hit-actor?) #t) ) (let ((v1-14 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> arg0 tail-pos) (-> s5-0 trans)) 2048.0)) @@ -338,7 +340,7 @@ ) (set! (-> a1-5 quad) (-> s5-0 trans quad)) (vector+! a1-5 a1-5 v1-14) - (collide-shape-method-29 (-> arg0 root-override) a1-5) + (move-to-point! (-> arg0 root-override) a1-5) ) (go (method-of-object arg0 impact)) ) @@ -354,9 +356,11 @@ (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) - (the-as (function control-info collide-query vector vector cshape-moving-flags) cshape-reaction-just-move) + (the-as (function control-info collide-query vector vector collide-status) cshape-reaction-just-move) + ) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (set! (-> s5-0 no-reaction) nothing) (set! (-> s5-0 penetrate-using) (penetrate jak-yellow-shot)) (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) (set! (-> s5-0 total-prims) (the-as uint 3)) diff --git a/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc b/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc index c166bfde95..7dfc6a86b5 100644 --- a/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc @@ -70,7 +70,7 @@ ) ;; definition for function reverse-conversions -;; WARN: Return type mismatch cshape-moving-flags vs none. +;; WARN: Return type mismatch collide-status vs none. (defbehavior reverse-conversions target ((arg0 vector)) (let ((v1-1 (-> self control unknown-vector00))) (set! (-> self control unknown-float05) (sqrtf (+ (* (-> v1-1 x) (-> v1-1 x)) (* (-> v1-1 z) (-> v1-1 z))))) @@ -329,31 +329,31 @@ (format arg1 "~0k~9S ~9S ~9S ~9S ~9S ~9S~%" - (if (logtest? (-> arg0 control status) (cshape-moving-flags on-surface)) + (if (logtest? (-> arg0 control status) (collide-status on-surface)) "on-surface" "" ) - (if (logtest? (-> arg0 control status) (cshape-moving-flags on-ground)) + (if (logtest? (-> arg0 control status) (collide-status on-ground)) "on-ground" "" ) - (if (logtest? (-> arg0 control status) (cshape-moving-flags t-surface)) + (if (logtest? (-> arg0 control status) (collide-status touch-surface)) "t-surface" "" ) - (if (logtest? (-> arg0 control status) (cshape-moving-flags t-wall)) + (if (logtest? (-> arg0 control status) (collide-status touch-wall)) "t-wall" "" ) - (if (logtest? (-> arg0 control status) (cshape-moving-flags t-act)) + (if (logtest? (-> arg0 control status) (collide-status touch-actor)) "t-act" "" ) (cond - ((logtest? (-> arg0 control status) (cshape-moving-flags t-ceil)) + ((logtest? (-> arg0 control status) (collide-status touch-ceiling)) "t-ceil" ) - ((logtest? (-> arg0 control status) (cshape-moving-flags on-water)) + ((logtest? (-> arg0 control status) (collide-status on-water)) "on-water" ) (else @@ -645,7 +645,7 @@ (< 0.7 (-> self control unknown-float12)) (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame07)) (seconds 0.3)) (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame08)) (seconds 0.3)) - (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (logtest? (-> self control status) (collide-status on-surface)) (and (< 0.7 (-> self control surface-angle)) #t) ) ) @@ -657,10 +657,10 @@ ;; INFO: Used lq/sq (defbehavior wall-hide? target () (when (and (< 0.7 (-> self control unknown-float12)) - (< 0.7 (-> self control unknown-float27)) + (< 0.7 (-> self control blocked-factor)) (and (< (-> self control unknown-float05) 8192.0) - (logtest? (-> self control status) (cshape-moving-flags t-wall)) - (not (logtest? (-> self control status) (cshape-moving-flags t-act))) + (logtest? (-> self control status) (collide-status touch-wall)) + (not (logtest? (-> self control status) (collide-status touch-actor))) (or (= (-> self control unknown-pat-surface00 event) (pat-event hide)) (let ((a0-2 (level-get-target-inside *level*))) (and a0-2 (logtest? (-> a0-2 info level-flags) 1)) @@ -802,11 +802,11 @@ (set! (-> self control unknown-float08) f0-6) ) (let ((f0-8 (* arg1 (-> self control unknown-surface01 target-speed)))) - (set! (-> self control unknown-vector01 quad) (-> (vector-normalize! gp-0 f0-8) quad)) + (set! (-> self control target-transv quad) (-> (vector-normalize! gp-0 f0-8) quad)) ) ) (let ((gp-1 (new-stack-vector0))) - (vector-matrix*! gp-1 (-> self control unknown-vector01) (-> self control unknown-matrix01)) + (vector-matrix*! gp-1 (-> self control target-transv) (-> self control unknown-matrix01)) (vector-float*! gp-1 gp-1 0.5) (vector+! gp-1 gp-1 (-> self control trans)) (add-debug-text-sphere @@ -912,11 +912,11 @@ ;; definition for function add-thrust ;; INFO: Used lq/sq (defbehavior add-thrust target () - (let ((s5-0 (-> self control unknown-vector01)) + (let ((s5-0 (-> self control target-transv)) (gp-0 (-> self control unknown-vector00)) ) (let ((s4-0 (new 'stack-no-clear 'vector))) - (set! (-> s4-0 quad) (-> self control unknown-vector01 quad)) + (set! (-> s4-0 quad) (-> self control target-transv quad)) (target-bend-vel-turn gp-0) (target-add-slide-factor s5-0) (let ((t9-2 vector-xz-normalize!) @@ -963,7 +963,7 @@ ) ) ) - (let* ((s2-0 (-> self control unknwon-vector27)) + (let* ((s2-0 (-> self control btransv)) (s3-1 (vector-matrix*! (new 'stack-no-clear 'vector) s2-0 (-> self control unknown-matrix00))) ) (if (< (-> s4-0 x) 0.0) @@ -978,12 +978,12 @@ (set! (-> s3-1 z) (fmax (fmin 0.0 (-> s3-1 z)) (-> s4-0 z))) (set! (-> s3-1 z) (fmax 0.0 (fmin (-> s3-1 z) (-> s4-0 z)))) ) - (if (< 0.2 (-> self control unknown-float27)) + (if (< 0.2 (-> self control blocked-factor)) (vector-seek! s3-1 s4-0 (* 122880.0 (-> self clock seconds-per-frame))) ) (vector-matrix*! s2-0 s3-1 (-> self control unknown-matrix01)) (let ((f28-0 (vector-vector-xz-distance s3-1 s4-0))) - (when (and (not (logtest? (-> self control status) (cshape-moving-flags t-surface))) + (when (and (not (logtest? (-> self control status) (collide-status touch-surface))) (let ((v1-51 gp-0)) (< (sqrtf (+ (* (-> v1-51 x) (-> v1-51 x)) (* (-> v1-51 z) (-> v1-51 z)))) (sqrtf (+ (* (-> s3-1 x) (-> s3-1 x)) (* (-> s3-1 z) (-> s3-1 z)))) @@ -999,8 +999,8 @@ ) ) ) - (if (and (not (logtest? (-> self control status) (cshape-moving-flags t-wall))) - (logtest? (-> self control old-status) (cshape-moving-flags t-wall)) + (if (and (not (logtest? (-> self control status) (collide-status touch-wall))) + (logtest? (-> self control old-status) (collide-status touch-wall)) (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) (< 0.0 (-> gp-0 y)) (< 0.0 (vector-dot @@ -1018,8 +1018,8 @@ (if (< (- (-> self clock frame-counter) (-> self control unknown-time-frame09)) (seconds 0.2)) (set! f30-0 (+ 204800.0 f30-0)) ) - (if (and (not (logtest? (-> self control status) (cshape-moving-flags t-wall))) - (and (logtest? (-> self control old-status) (cshape-moving-flags t-wall)) + (if (and (not (logtest? (-> self control status) (collide-status touch-wall))) + (and (logtest? (-> self control old-status) (collide-status touch-wall)) (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) (< 0.0 (-> gp-0 y)) (< (-> gp-0 z) 0.0) @@ -1056,7 +1056,7 @@ "ltransv" (new 'static 'rgba :g #xff :a #x80) ) - (set! (-> gp-1 quad) (-> self control unknwon-vector27 quad)) + (set! (-> gp-1 quad) (-> self control btransv quad)) (vector-float*! gp-1 gp-1 0.5) (vector+! gp-1 gp-1 (-> self control trans)) (add-debug-text-sphere @@ -1164,7 +1164,7 @@ (-> self control unknown-vector03) ) ((and (or (not (logtest? (logior (-> self control status) (-> self control old-status)) - (cshape-moving-flags on-surface t-surface) + (collide-status on-surface touch-surface) ) ) (< (- (-> self clock frame-counter) (-> self control unknown-time-frame07)) (seconds 0.5)) @@ -1411,7 +1411,7 @@ (dotimes (s5-0 2) (let ((a1-4 (not (or (logtest? (state-flags lleg-no-ik rleg-no-ik) (-> self state-flags)) (and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) - (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (zero? (logand (-> self control status) (collide-status on-surface))) ) (logtest? (focus-status edge-grab pole flut pilot mech) (-> self focus-status)) ) @@ -1556,7 +1556,7 @@ ) ) (cond - ((logtest? (-> self control old-status) (cshape-moving-flags on-surface)) + ((logtest? (-> self control old-status) (collide-status on-surface)) (if (>= (+ (-> self clock frame-counter) (seconds -0.035)) (-> self control unknown-time-frame03)) (vector-reset! (-> self control unknown-vector18)) ) @@ -1576,7 +1576,7 @@ ) ) ) - (set! (-> self control unknown-vector17 quad) (-> self control unknown-vector18 quad)) + (set! (-> self control collide-extra-velocity quad) (-> self control unknown-vector18 quad)) (set! (-> self control unknown-vector14 quad) (-> self control local-normal quad)) 0 (none) @@ -1625,20 +1625,20 @@ (quaternion-copy! (-> self control unknown-quaternion03) (-> self control quat-for-control)) ((-> self control unknown-surface01 active-hook)) (cond - ((logtest? (-> self control status) (cshape-moving-flags on-surface)) + ((logtest? (-> self control status) (collide-status on-surface)) (set! (-> self control unknown-time-frame06) (-> self clock frame-counter)) (set! (-> self control unknown-vector21 quad) (-> self control trans quad)) (if (and (>= (-> self control coverage) 1.0) - (not (logtest? (-> self control status) (cshape-moving-flags t-act on-water))) - (logtest? (-> self control status) (cshape-moving-flags on-ground)) + (not (logtest? (-> self control status) (collide-status touch-actor on-water))) + (logtest? (-> self control status) (collide-status on-ground)) ) - (set! (-> self control unknown-vector23 quad) (-> self control trans quad)) + (set! (-> self control last-trans-on-surf quad) (-> self control trans quad)) ) ((-> self control unknown-surface01 touch-hook)) ) (else (let ((v1-49 (-> self control trans))) - (when (logtest? (-> self control old-status) (cshape-moving-flags on-surface)) + (when (logtest? (-> self control old-status) (collide-status on-surface)) (set! (-> self control unknown-vector42 quad) (-> self control unknown-vector21 quad)) (set! (-> self control unknown-vector43 quad) (-> self control unknown-vector21 quad)) ) @@ -1734,17 +1734,16 @@ (set! (-> self control unknown-time-frame20) (-> self clock frame-counter)) (cond ((logtest? (focus-status mech indax) (-> self focus-status)) - (if (not (and (-> self next-state) - (let ((v1-179 (-> self next-state name))) - (or (= v1-179 'target-falling) - (= v1-179 'target-board-falling) - (= v1-179 'target-gun-falling) - (= v1-179 'target-mech-falling) - (= v1-179 'target-mech-carry-falling) - (= v1-179 'target-carry-falling) - (= v1-179 'target-indax-falling) - ) - ) + (if (not (and (-> self next-state) (let ((v1-179 (-> self next-state name))) + (or (= v1-179 'target-falling) + (= v1-179 'target-board-falling) + (= v1-179 'target-gun-falling) + (= v1-179 'target-mech-falling) + (= v1-179 'target-mech-carry-falling) + (= v1-179 'target-carry-falling) + (= v1-179 'target-indax-falling) + ) + ) ) ) (send-event self 'change-mode 'falling) @@ -1785,7 +1784,7 @@ ) ) ) - (collide-shape-method-29 (-> self control) a1-36) + (move-to-point! (-> self control) a1-36) ) (set! (-> self control surf) *standard-ground-surface*) ) @@ -1800,7 +1799,7 @@ (or (= v1-211 'target-walk) (= v1-211 'target-gun-walk)) ) ) - (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (zero? (logand (-> self control status) (collide-status on-surface))) ) ) (and (< f0-17 0.0) @@ -1843,11 +1842,10 @@ ) ) ) - (set! (-> self control unknown-float30) - (if (logtest? (-> self control status) (cshape-moving-flags on-surface)) - 32.0 - 2.0 - ) + (set! (-> self control unknown-float30) (if (logtest? (-> self control status) (collide-status on-surface)) + 32.0 + 2.0 + ) ) (let ((v1-248 (-> *setting-control* user-current beard))) (when (!= (-> self beard?) v1-248) @@ -1870,7 +1868,7 @@ ;; definition for function post-flag-setup ;; WARN: Return type mismatch int vs none. (defbehavior post-flag-setup target () - (if (logtest? (-> self control status) (cshape-moving-flags t-wall t-act)) + (if (logtest? (-> self control status) (collide-status touch-wall touch-actor)) (set! (-> self control unknown-time-frame07) (-> self clock frame-counter)) ) (when (logtest? (-> self state-flags) (state-flags tinvul1)) @@ -1961,13 +1959,13 @@ ;; INFO: Used lq/sq (defbehavior bend-gravity target () (if (and (logtest? (-> self control root-prim prim-core action) (collide-action no-normal-reset)) - (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (zero? (logand (-> self control status) (collide-status on-surface))) ) (return #f) ) (let ((f0-1 - (if (and (logtest? (-> self control status) (cshape-moving-flags t-wall)) - (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (if (and (logtest? (-> self control status) (collide-status touch-wall)) + (zero? (logand (-> self control status) (collide-status on-surface))) ) 0.0 (-> self control unknown-float29) @@ -2170,15 +2168,15 @@ ) (vector-float*! (-> self control rider-last-move) s4-1 (-> self clock frames-per-second)) (set! (-> self control rider-time) (-> self clock frame-counter)) - (vector+! s3-1 s3-1 (-> self control unknown-vector05)) - (collide-shape-method-29 (-> self control) s3-1) + (vector+! s3-1 s3-1 (-> self control cspace-offset)) + (move-to-point! (-> self control) s3-1) ) (set! (-> self control unknown-float33) 0.0) (set! (-> self control unknown-vector21 quad) (-> self control trans quad)) ) (else (vector-normalize! s4-1 1228.8) - (let ((a1-20 (vector+! (new 'stack-no-clear 'vector) s4-1 (-> self control unknown-vector05)))) + (let ((a1-20 (vector+! (new 'stack-no-clear 'vector) s4-1 (-> self control cspace-offset)))) (move-by-vector! (-> self control) a1-20) ) (vector-float*! (-> self control rider-last-move) s4-1 (-> self clock frames-per-second)) @@ -2196,8 +2194,8 @@ (vector-! a1-23 (-> s5-0 center-hold) (-> self control unknown-vector31)) (vector-float*! (-> self control rider-last-move) s4-1 (-> self clock frames-per-second)) (set! (-> self control rider-time) (-> self clock frame-counter)) - (vector+! a1-23 a1-23 (-> self control unknown-vector05)) - (collide-shape-method-29 (-> self control) a1-23) + (vector+! a1-23 a1-23 (-> self control cspace-offset)) + (move-to-point! (-> self control) a1-23) ) (set! (-> self control unknown-float33) 0.0) (set! (-> self control unknown-vector21 quad) (-> self control trans quad)) @@ -2344,7 +2342,7 @@ ) (else (set! (-> self control unknown-symbol02) (the-as float #t)) - (collide-shape-method-29 + (move-to-point! (-> self control) (vector-! (new 'stack-no-clear 'vector) s5-0 (-> self control unknown-vector31)) ) @@ -2365,7 +2363,7 @@ (set-quaternion! (-> self control) (-> self control dir-targ)) (joint-control-method-10 (-> self skel)) (draw-control-method-14 (-> self draw) (-> self node-list) (-> self skel)) - (collide-shape-method-46 (-> self control)) + (update-transforms (-> self control)) (none) ) @@ -2391,7 +2389,7 @@ ((logtest? (focus-status board pilot mech indax) (-> self focus-status)) (set! (-> self control unknown-vector15 quad) (-> self control trans quad)) ) - ((or (logtest? (-> self control status) (cshape-moving-flags on-water)) + ((or (logtest? (-> self control status) (collide-status on-water)) (let ((v1-23 (-> self water flags))) (and (logtest? (water-flags touch-water) v1-23) (logtest? (water-flags under-water swimming) v1-23) @@ -2440,7 +2438,7 @@ (-> self control unknown-vector15) ) ((and (or (logtest? (water-flags touch-water) (-> self water flags)) - (logtest? (-> self control status) (cshape-moving-flags on-water)) + (logtest? (-> self control status) (collide-status on-water)) ) (logtest? (-> self water flags) (water-flags mud)) ) @@ -2522,7 +2520,7 @@ ) ) (let ((a2-5 - (matrix<-no-trans-transformq! (-> self control unknown-matrix02) (the-as transformq (-> self control trans))) + (matrix<-no-trans-transformq! (-> self control ctrl-orientation) (the-as transformq (-> self control trans))) ) ) (vector-matrix*! (-> self control unknown-vector28) (-> *TARGET-bank* head-offset) a2-5) @@ -2567,7 +2565,7 @@ ;; WARN: Return type mismatch int vs none. (defbehavior do-target-gspot target () (cond - ((and (logtest? (-> self control status) (cshape-moving-flags on-surface)) + ((and (logtest? (-> self control status) (collide-status on-surface)) (!= (-> self control unknown-surface00 mode) 'swim) (!= (-> self control unknown-surface00 mode) 'dive) (not (and (-> self next-state) (= (-> self next-state name) 'target-flop))) @@ -2579,7 +2577,7 @@ ) (else (let ((gp-0 (new 'stack-no-clear 'collide-query))) - (if (collide-shape-moving-method-55 + (if (find-ground (-> self control) gp-0 (logclear (-> self control root-prim prim-core collide-with) (collide-spec water)) @@ -2685,7 +2683,7 @@ (set! (-> a2-3 ignore-pat) (-> v1-52 pat-ignore-mask)) ) (set! (-> a2-3 action-mask) (collide-action solid)) - (collide-shape-method-32 (-> self control) (-> self control transv) a2-3 (meters 1)) + (fill-cache-integrate-and-collide (-> self control) (-> self control transv) a2-3 (meters 1)) ) (if (and (logtest? (-> self control root-prim prim-core action) (collide-action check-edge)) (>= (vector-dot @@ -2821,7 +2819,7 @@ (set! (-> a2-0 ignore-pat) (-> v1-30 pat-ignore-mask)) ) (set! (-> a2-0 action-mask) (collide-action solid)) - (collide-shape-method-32 (-> self control) (-> self control transv) a2-0 (meters 1)) + (fill-cache-integrate-and-collide (-> self control) (-> self control transv) a2-0 (meters 1)) ) (if (and (logtest? (-> self control root-prim prim-core action) (collide-action check-edge)) (>= (vector-dot @@ -2950,7 +2948,7 @@ (set! (-> a2-0 ignore-pat) (-> v1-29 pat-ignore-mask)) ) (set! (-> a2-0 action-mask) (collide-action solid)) - (collide-shape-method-32 (-> self control) (-> self control transv) a2-0 (meters 1)) + (fill-cache-integrate-and-collide (-> self control) (-> self control transv) a2-0 (meters 1)) ) (if (and (logtest? (-> self control root-prim prim-core action) (collide-action check-edge)) (>= (vector-dot @@ -3044,9 +3042,9 @@ (do-rotations2) (reverse-conversions (-> self control transv)) (vector-! - (-> self control unknown-vector05) - (-> self control unknown-vector04) - (-> self control unknown-vector07) + (-> self control cspace-offset) + (-> self control draw-offset) + (-> self control anim-collide-offset-world) ) (let ((a1-3 (new 'stack-no-clear 'overlaps-others-params))) (set! (-> a1-3 options) (overlaps-others-options oo0)) @@ -3116,9 +3114,7 @@ (clear-record-tags! *history* (history-channel collide-status) (-> gp-4 unknown-halfword00) (the-as uint 2)) ) ) - (set! (-> v1-68 collide-status) - (the-as collide-status (logior (-> gp-4 status) (cshape-moving-flags csmf08))) - ) + (set! (-> v1-68 collide-status) (logior (-> gp-4 status) (collide-status no-touch))) (set! (-> v1-68 vector z) (the-as float (-> gp-4 reaction-flag))) ) ) @@ -3131,9 +3127,9 @@ ;; definition for function target-no-ja-move-post (defbehavior target-no-ja-move-post target () (vector-! - (-> self control unknown-vector05) - (-> self control unknown-vector04) - (-> self control unknown-vector07) + (-> self control cspace-offset) + (-> self control draw-offset) + (-> self control anim-collide-offset-world) ) (let ((a1-2 (new 'stack-no-clear 'overlaps-others-params))) (set! (-> a1-2 options) (overlaps-others-options oo0)) @@ -3162,7 +3158,7 @@ (target-exit) (target-timed-invulnerable-off self 0) (target-timed-invulnerable-off self 2) - (set! (-> self control status) (cshape-moving-flags)) + (set! (-> self control status) (collide-status)) (set! (-> self control unknown-dynamics00) *standard-dynamics*) (set! (-> self control surf) *standard-ground-surface*) (set! (-> self control unknown-vector02 quad) (-> self control unknown-dynamics00 gravity-normal quad)) @@ -3216,7 +3212,9 @@ (let ((s0-0 (new 'process 'control-info obj (collide-list-enum hit-by-others)))) (set! (-> s0-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s0-0 reaction) target-collision-reaction) - (set! (-> s0-0 no-reaction) target-collision-no-reaction) + (set! (-> s0-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) target-collision-no-reaction) + ) (set! sv-16 (new 'process 'collide-shape-prim-group s0-0 (the-as uint 9) 1)) (set! (-> s0-0 total-prims) (the-as uint 10)) (set! (-> sv-16 prim-core action) (collide-action solid can-ride)) @@ -3297,7 +3295,7 @@ (set! (-> v1-69 event-self) 'touched) ) (set! (-> obj game) *game-info*) - (collide-shape-method-29 (-> obj control) (-> arg0 trans)) + (move-to-point! (-> obj control) (-> arg0 trans)) (set! (-> obj control unknown-vector15 quad) (-> arg0 trans quad)) (set! (-> obj focus-search) (new 'process 'boxed-array collide-shape 128)) (set! (-> obj focus-search length) 0) @@ -3321,7 +3319,7 @@ (let ((v1-94 (-> obj node-list data))) (set! (-> v1-94 0 param0) cspace<-transformq+trans!) (set! (-> v1-94 0 param1) (the-as basic (-> obj control trans))) - (set! (-> v1-94 0 param2) (the-as basic (-> obj control unknown-vector05))) + (set! (-> v1-94 0 param2) (the-as basic (-> obj control cspace-offset))) ) (set! (-> obj skel override) (new 'process 'boxed-array float 54)) (set! (-> obj draw light-index) (the-as uint 30)) diff --git a/test/decompiler/reference/jak2/engine/target/sidekick_REF.gc b/test/decompiler/reference/jak2/engine/target/sidekick_REF.gc new file mode 100644 index 0000000000..8a40ecb783 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/target/sidekick_REF.gc @@ -0,0 +1,513 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(defskelgroup skel-sidekick daxter 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 3) + :longest-edge (meters 1) + :shadow 3 + :texture-level 6 + :sort 1 + :origin-joint-index 6 + :shadow-joint-index 6 + ) + +;; failed to figure out what this is: +(defskelgroup skel-sidekick-highres daxter-highres 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 3) + :longest-edge (meters 1) + :shadow 2 + :sort 1 + :origin-joint-index 6 + :shadow-joint-index 6 + ) + +;; definition for symbol *sidekick-remap*, type pair +(define *sidekick-remap* + '(("run-to-stance-left" "run-to-stance") + ("run-to-stance-loop-left" "run-to-stance-loop") + ("stance-loop-left" "stance-loop") + ("run-to-stance-right" "run-to-stance") + ("run-to-stance-loop-right" "run-to-stance-loop") + ("stance-loop-right" "stance-loop") + ("run-to-stance-up" "run-to-stance") + ("run-to-stance-loop-up" "run-to-stance-loop") + ("stance-loop-up" "stance-loop") + ("run-to-stance-down" "run-to-stance") + ("run-to-stance-loop-down" "run-to-stance-loop") + ("stance-loop-down" "stance-loop") + ("run-right" "run") + ("run-left" "run") + ("walk-right" "walk") + ("walk-left" "walk") + ("gun-hit-elec" "hit-elec") + ("gun-attack-from-stance-end" + "gun-attack-from-stance-end" + "gun-attack-from-stance-end" + "gun-attack-from-stance-end" + "gun-attack-from-stance-end-alt1" + ) + ("gun-attack-butt-end" + "gun-attack-butt-end" + "gun-attack-butt-end" + "gun-attack-butt-end" + "gun-attack-butt-end" + "gun-attack-butt-end-alt1" + ) + ("pole-cycle" "pole-cycle" "pole-cycle2") + ("hit-from-front-alt1" "hit-from-front") + ("board-jump" + ,(lambda :behavior sidekick + ((arg0 object) (arg1 vector) (arg2 object)) + (let* ((v1-0 (-> self parent-override)) + (gp-0 (if v1-0 + (-> v1-0 0 self-override) + ) + ) + ) + (when (>= (- (-> self clock frame-counter) (-> self special-anim-time)) (seconds 1)) + (set! (-> self special-anim-interp) 0.0) + (set! (-> self special-anim-frame) 0.0) + ) + (cond + ((or (and (= (-> gp-0 control unknown-surface00 name) 'spin) (!= (-> gp-0 board trotyv) 0.0)) + (!= (-> self special-anim-interp) 0.0) + ) + (case arg2 + ((1) + (set! (-> self special-anim-time) (-> self clock frame-counter)) + (cond + ((= (-> gp-0 control unknown-surface00 name) 'spin) + (set! (-> arg1 z) + (* (lerp-scale 0.0 5.0 (fabs (-> gp-0 board trotyv)) 0.0 182044.44) (-> self special-anim-interp)) + ) + (set! (-> self special-anim-frame) (-> arg1 z)) + (seek! (-> self special-anim-interp) 1.0 (* 8.0 (-> self clock seconds-per-frame))) + ) + (else + (seek! (-> self special-anim-interp) 0.0 (* 4.0 (-> self clock seconds-per-frame))) + (set! (-> arg1 z) (* (-> self special-anim-frame) (-> self special-anim-interp))) + ) + ) + ) + ) + (if (>= (-> gp-0 board trotyv) 0.0) + "board-spin-ccw" + "board-spin-cw" + ) + ) + (else + "board-jump" + ) + ) + ) + ) + ) + ) + ) + +;; definition for function cspace<-cspace+transformq! +(defun cspace<-cspace+transformq! ((arg0 cspace) (arg1 cspace) (arg2 transformq)) + (rlet ((acc :class vf) + (Q :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (let ((s4-0 (-> arg0 bone transform))) + (quaternion->matrix s4-0 (-> arg2 quat)) + (.lvf vf1 (&-> (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) quad)) + (.lvf vf2 (&-> (-> arg1 bone) transform trans quad)) + (.lvf vf6 (&-> arg2 trans quad)) + (.lvf vf3 (&-> s4-0 vector 0 quad)) + (.lvf vf4 (&-> s4-0 vector 1 quad)) + (.lvf vf5 (&-> s4-0 vector 2 quad)) + (.div.vf Q vf0 vf2 :fsf #b11 :ftf #b11) + (.wait.vf) + (.mul.vf vf2 vf2 Q :mask #b111) + (.mov.vf vf2 vf0 :mask #b1000) + (.mul.x.vf vf3 vf3 vf1) + (.mul.y.vf vf4 vf4 vf1) + (.mul.z.vf vf5 vf5 vf1) + (.mul.x.vf acc vf3 vf6) + (.add.mul.y.vf acc vf4 vf6 acc) + (.add.mul.z.vf acc vf5 vf6 acc) + (.add.mul.w.vf vf2 vf2 vf0 acc :mask #b111) + (.svf (&-> s4-0 trans quad) vf2) + (.svf (&-> s4-0 vector 0 quad) vf3) + (.svf (&-> s4-0 vector 1 quad) vf4) + (.svf (&-> s4-0 vector 2 quad) vf5) + s4-0 + ) + ) + ) + +;; definition for function target-sidekick-setup +;; WARN: Return type mismatch int vs none. +(defbehavior target-sidekick-setup target ((arg0 symbol)) + (if (zero? (-> self sidekick)) + (set! (-> self sidekick) (the-as (pointer sidekick) #f)) + ) + (cond + (arg0 + (if (not (-> self sidekick)) + (set! (-> self sidekick) (process-spawn sidekick :init init-sidekick :from *16k-dead-pool* :to self)) + ) + ) + ((-> self sidekick) + (deactivate (-> self sidekick 0)) + (set! (-> self sidekick) (the-as (pointer sidekick) #f)) + ) + ) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate sidekick-clone (sidekick) + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (local-vars (v0-0 object)) + (case event-type + (('matrix) + (case (-> event param 0) + (('play-anim) + (set! v0-0 (-> self node-list data)) + (set! (-> (the-as (inline-array cspace) v0-0) 0 param0) cspace<-cspace+transformq!) + (set! (-> (the-as (inline-array cspace) v0-0) 0 param1) + (the-as basic (-> self parent-override 0 node-list data)) + ) + (set! (-> (the-as (inline-array cspace) v0-0) 0 param2) (the-as basic (-> self offset))) + ) + (('copy-parent) + (set! v0-0 (-> self node-list data)) + (set! (-> (the-as (inline-array cspace) v0-0) 0 param0) cspace<-cspace!) + (set! (-> (the-as (inline-array cspace) v0-0) 0 param1) + (the-as basic (-> self parent-override 0 node-list data)) + ) + (set! (-> (the-as (inline-array cspace) v0-0) 0 param2) #f) + ) + (('root) + (set! v0-0 (-> self node-list data)) + (set! (-> (the-as (inline-array cspace) v0-0) 0 param0) cspace<-cspace-normalized!) + (set! (-> (the-as (inline-array cspace) v0-0) 0 param1) + (the-as basic (-> self parent-override 0 node-list data)) + ) + (set! (-> (the-as (inline-array cspace) v0-0) 0 param2) #f) + ) + (('indax) + (set! v0-0 (-> self node-list data)) + (set! (-> (the-as (inline-array cspace) v0-0) 0 param0) cspace<-transformq+trans!) + (set! (-> (the-as (inline-array cspace) v0-0) 0 param1) + (the-as basic (-> self parent-override 0 control trans)) + ) + (set! (-> (the-as (inline-array cspace) v0-0) 0 param2) + (the-as basic (-> self parent-override 0 control cspace-offset)) + ) + ) + (('board) + (set! v0-0 (-> self node-list data)) + (set! (-> (the-as (inline-array cspace) v0-0) 0 param0) cspace<-cspace-normalized!) + (set! (-> (the-as (inline-array cspace) v0-0) 0 param1) + (the-as basic (-> self parent-override 0 node-list data 25)) + ) + (set! (-> (the-as (inline-array cspace) v0-0) 0 param2) #f) + ) + (else + (set! v0-0 (-> self node-list data)) + (set! (-> (the-as (inline-array cspace) v0-0) 0 param0) cspace<-cspace+transformq!) + (set! (-> (the-as (inline-array cspace) v0-0) 0 param1) + (the-as basic (-> self parent-override 0 control unknown-cspacei1un23i1 parent)) + ) + (set! (-> (the-as (inline-array cspace) v0-0) 0 param2) (the-as basic (-> self offset))) + ) + ) + v0-0 + ) + (('shadow) + (set! v0-0 (-> event param 0)) + (set! (-> self shadow-in-movie?) (the-as symbol v0-0)) + v0-0 + ) + (('blend-shape) + (cond + ((-> event param 0) + (set! v0-0 (logior (-> self skel status) (joint-control-status blend-shape))) + (set! (-> self skel status) (the-as joint-control-status v0-0)) + ) + (else + (set! v0-0 (logclear (-> self skel status) (joint-control-status blend-shape))) + (set! (-> self skel status) (the-as joint-control-status v0-0)) + ) + ) + v0-0 + ) + ) + ) + :code (the-as (function none :behavior sidekick) looping-code) + :post (behavior () + (let ((v1-0 (-> self parent-override))) + (when (not (and (-> (if v1-0 + (-> v1-0 0 self-override) + ) + next-state + ) + (let ((v1-4 (-> self parent-override))) + (= (-> (if v1-4 + (-> v1-4 0 self-override) + ) + next-state + name + ) + 'process-drawable-art-error + ) + ) + ) + ) + (quaternion-rotate-y! + (-> self root quat) + (-> self parent-override 0 control quat) + (-> self parent-override 0 upper-body twist z) + ) + (set! (-> self anim-seed) (-> self parent-override 0 anim-seed)) + (set! (-> self draw status) (-> self parent-override 0 draw status)) + (logclear! (-> self draw status) (draw-control-status no-draw-bounds2)) + (let ((gp-0 0)) + (cond + ((and (not (logtest? (-> self parent-override 0 focus-status) (focus-status edge-grab))) + (> (-> self parent-override 0 skel float-channels) 0) + ) + (let ((gp-1 (-> self skel))) + (joint-control-copy! gp-1 (-> self parent-override 0 skel)) + (set! (-> gp-1 root-channel) + (the-as (inline-array joint-control-channel) (-> gp-1 channel (-> gp-1 active-channels))) + ) + (dotimes (s5-0 (the-as int (-> self parent-override 0 skel float-channels))) + (let ((s4-0 (-> gp-1 channel (+ s5-0 (-> gp-1 active-channels))))) + (mem-copy! + (the-as pointer s4-0) + (the-as + pointer + (-> self parent-override 0 skel channel (+ s5-0 (-> self parent-override 0 skel active-channels))) + ) + 64 + ) + (set! (-> s4-0 frame-interp 0) (-> s4-0 frame-interp 1)) + (set! (-> s4-0 command) (joint-control-command blend)) + ) + ) + (dotimes (v1-58 (the-as int (-> gp-1 allocated-length))) + (set! (-> gp-1 channel v1-58 parent) gp-1) + ) + (+! (-> gp-1 active-channels) (-> self parent-override 0 skel float-channels)) + (set! (-> gp-1 float-channels) (the-as uint 0)) + ) + (set! gp-0 1) + ) + (else + (joint-control-copy! (-> self skel) (-> self parent-override 0 skel)) + ) + ) + (joint-control-remap! + (-> self skel) + (-> self draw art-group) + (-> self parent-override 0 draw art-group) + *sidekick-remap* + (the-as int (-> self anim-seed)) + "" + ) + (cond + ((zero? gp-0) + (set! (-> self skel effect channel-offset) (-> self parent-override 0 skel effect channel-offset)) + ) + ((= gp-0 1) + (set! (-> self skel effect channel-offset) 0) + 0 + ) + ) + ) + (let ((v1-85 (-> self parent-override 0 draw color-mult quad))) + (set! (-> self draw color-mult quad) v1-85) + ) + (let ((v1-89 (-> self parent-override 0 draw color-emissive quad))) + (set! (-> self draw color-emissive quad) v1-89) + ) + (set! (-> self draw force-fade) (-> self parent-override 0 draw force-fade)) + (set! (-> self draw death-vertex-skip) (-> self parent-override 0 draw death-vertex-skip)) + (set! (-> self draw death-effect) (-> self parent-override 0 draw death-effect)) + (set! (-> self draw death-timer) (-> self parent-override 0 draw death-timer)) + (set! (-> self draw death-timer-org) (-> self parent-override 0 draw death-timer-org)) + (set! (-> self draw death-draw-overlap) (-> self parent-override 0 draw death-draw-overlap)) + (quaternion-copy! (-> self offset quat) (-> self root quat)) + (let ((f0-3 (* (-> self parent-override 0 darkjak-interp) (-> self parent-override 0 darkjak-giant-interp)))) + (set! (-> self offset trans x) (* 286.72 f0-3)) + (set! (-> self offset trans y) (* 204.8 f0-3)) + (set! (-> self offset trans z) (* 409.6 f0-3)) + ) + (joint-control-method-10 (-> self skel)) + (when *debug-segment* + (let ((gp-2 (-> *display* frames (-> *display* on-screen) profile-array data 0)) + (v1-132 'target-post) + (s5-1 *profile-target-post-color*) + ) + (when (and *dproc* *debug-segment*) + (let ((s4-1 (-> gp-2 data (-> gp-2 count)))) + (let ((s3-0 (-> gp-2 base-time))) + (set! (-> s4-1 name) v1-132) + (set! (-> s4-1 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s3-0)))) + ) + (set! (-> s4-1 depth) (the-as uint (-> gp-2 depth))) + (set! (-> s4-1 color) s5-1) + (set! (-> gp-2 segment (-> gp-2 depth)) s4-1) + ) + (+! (-> gp-2 count) 1) + (+! (-> gp-2 depth) 1) + (set! (-> gp-2 max-depth) (max (-> gp-2 max-depth) (-> gp-2 depth))) + ) + ) + 0 + ) + (draw-control-method-14 (-> self draw) (-> self node-list) (-> self skel)) + (when *debug-segment* + (let ((gp-3 (-> *display* frames (-> *display* on-screen) profile-array data 0))) + (when (and *dproc* *debug-segment*) + (let* ((v1-158 (+ (-> gp-3 depth) -1)) + (s5-2 (-> gp-3 segment v1-158)) + (s4-2 (-> gp-3 base-time)) + ) + (when (>= v1-158 0) + (set! (-> s5-2 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s4-2)))) + (+! (-> gp-3 depth) -1) + ) + ) + ) + ) + 0 + ) + ) + ) + (when *display-sidekick-stats* + (format *stdcon* "~%") + (debug-print-channels (-> self skel) (the-as symbol *stdcon*)) + (add-debug-sphere + *display-sidekick-stats* + (bucket-id debug-no-zbuf1) + (-> self parent-override 0 control unknown-cspacei1un23i1 parent bone transform trans) + (meters 0.1) + (new 'static 'rgba :g #xff :a #x80) + ) + (add-debug-sphere + *display-sidekick-stats* + (bucket-id debug-no-zbuf1) + (-> self node-list data 3 bone transform trans) + (meters 0.1) + (new 'static 'rgba :r #xff :g #xff :a #x80) + ) + (add-debug-sphere + *display-sidekick-stats* + (bucket-id debug-no-zbuf1) + (-> self node-list data 0 bone transform trans) + (meters 0.1) + (new 'static 'rgba :r #xff :a #x80) + ) + (add-debug-matrix + *display-sidekick-stats* + (bucket-id debug-no-zbuf1) + (-> self node-list data 0 bone transform) + (meters 2) + ) + ) + (set! (-> self draw shadow) + (the-as shadow-geo (if (or (and (movie?) (-> self shadow-in-movie?)) + (logtest? (focus-status indax) (-> self parent-override 0 focus-status)) + ) + (-> self draw art-group data 3) + ) + ) + ) + (let ((a0-53 (-> self skel effect))) + (if a0-53 + (effect-control-method-9 a0-53) + ) + ) + (if (logtest? (-> self skel status) (joint-control-status blend-shape blend-shape-valid)) + (merc-blend-shape self) + ) + (if (logtest? (-> self skel status) (joint-control-status eye-anim-valid eye-anim)) + (merc-eye-anim self) + ) + (when (!= (not (-> *setting-control* user-current mirror)) (not (-> self mirror))) + (cond + ((-> self mirror) + (deactivate (-> self mirror 0)) + (set! (-> self mirror) (the-as (pointer process-drawable) #f)) + ) + (else + (let* ((s5-3 (get-process *default-dead-pool* manipy #x4000)) + (gp-4 + (when s5-3 + (let ((t9-22 (method-of-type manipy activate))) + (t9-22 (the-as manipy s5-3) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) + ) + (let ((gp-5 run-function-in-process) + (s4-3 s5-3) + (s3-1 manipy-init) + (s2-0 (-> self root trans)) + (s1-0 (-> self entity)) + (t0-4 (art-group-get-by-name *level* "skel-sidekick" (the-as (pointer uint32) #f))) + (t1-1 #f) + ) + 0 + ((the-as (function object object object object object object none) gp-5) s4-3 s3-1 s2-0 s1-0 t0-4 t1-1) + ) + (the-as (pointer process-drawable) (-> s5-3 ppointer)) + ) + ) + ) + (send-event (ppointer->process gp-4) 'anim-mode 'mirror) + (send-event (ppointer->process gp-4) 'mirror #t) + (set! (-> self mirror) gp-4) + (let ((v0-29 (-> gp-4 0 node-list data))) + (set! (-> v0-29 0 param0) cspace<-cspace!) + (set! (-> v0-29 0 param1) (the-as basic (-> self node-list data))) + (set! (-> v0-29 0 param2) #f) + ) + ) + ) + ) + ) + (none) + ) + ) + +;; definition for function init-sidekick +;; WARN: Return type mismatch object vs none. +(defbehavior init-sidekick sidekick () + (set! (-> self mask) (logior (process-mask sidekick) (-> self mask))) + (set! (-> self root) (new 'process 'trsqv)) + (vector-identity! (-> self root scale)) + (quaternion-identity! (-> self root quat)) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-sidekick" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (set! (-> self draw shadow-ctrl) *target-shadow-control*) + (logior! (-> self skel status) (joint-control-status sync-math blend-shape eye-anim)) + (set! (-> self draw light-index) (the-as uint 30)) + (let ((v1-14 (-> self node-list data))) + (set! (-> v1-14 0 param0) cspace<-cspace+transformq!) + (set! (-> v1-14 0 param1) (the-as basic (-> self parent-override 0 control unknown-cspacei1un23i1 parent))) + (set! (-> v1-14 0 param2) (the-as basic (-> self offset))) + ) + (set! (-> self shadow-in-movie?) #t) + (set! (-> self mirror) (the-as (pointer process-drawable) #f)) + (go sidekick-clone) + (none) + ) diff --git a/test/decompiler/reference/jak2/engine/target/target-carry_REF.gc b/test/decompiler/reference/jak2/engine/target/target-carry_REF.gc index c686a1cac3..04ab2d6537 100644 --- a/test/decompiler/reference/jak2/engine/target/target-carry_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-carry_REF.gc @@ -84,7 +84,7 @@ (set! (-> s5-0 0 quad) (-> self control unknown-sphere-array00 2 prim-core world-sphere quad)) (set! (-> s5-0 0 r) (lerp-scale (-> *TARGET-bank* body-radius) 7372.8 f30-0 0.0 1.0)) (let ((v1-17 gp-0)) - (set! (-> v1-17 spheres) s5-0) + (set! (-> v1-17 best-dist) (the-as float s5-0)) (set! (-> v1-17 num-spheres) (the-as uint 1)) (set! (-> v1-17 collide-with) (-> self control root-prim prim-core collide-with)) (set! (-> v1-17 ignore-process0) #f) @@ -368,7 +368,7 @@ ) (set! (-> s5-1 0 quad) (-> s4-0 root-prim prim-core world-sphere quad)) (let ((v1-64 gp-5)) - (set! (-> v1-64 spheres) s5-1) + (set! (-> v1-64 best-dist) (the-as float s5-1)) (set! (-> v1-64 num-spheres) (the-as uint 1)) (set! (-> v1-64 collide-with) (-> self control root-prim prim-core collide-with)) (set! (-> v1-64 ignore-process0) #f) @@ -557,7 +557,7 @@ (none) ) :trans (behavior () - (if (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (if (logtest? (-> self control status) (collide-status on-surface)) (go target-carry-hit-ground #f) ) (let* ((f0-0 (target-move-dist (-> *TARGET-bank* stuck-time))) @@ -576,7 +576,7 @@ ) #t ) - (logior! (-> self control status) (cshape-moving-flags on-surface)) + (logior! (-> self control status) (collide-status on-surface)) (go target-carry-hit-ground 'stuck) ) ) @@ -682,7 +682,7 @@ (set! (-> self state-time) (-> self clock frame-counter)) (sound-play "jump" :vol 70) (init-var-jump arg0 arg1 #t #f (-> self control transv) 2.0) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control unknown-surface00) *carry-jump-mods*) (set! (-> self control unknown-float36) (fmax 0.0 (fmin 1.0 (* 0.00004359654 (+ -11468.8 (-> self control unknown-float05))))) @@ -784,7 +784,7 @@ ) (set! (-> s5-0 0 quad) (-> s4-0 root-prim prim-core world-sphere quad)) (let ((v1-38 gp-3)) - (set! (-> v1-38 spheres) s5-0) + (set! (-> v1-38 best-dist) (the-as float s5-0)) (set! (-> v1-38 num-spheres) (the-as uint 1)) (set! (-> v1-38 collide-with) (-> self control root-prim prim-core collide-with)) (set! (-> v1-38 ignore-process0) #f) diff --git a/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc b/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc index 8a2e2df224..5e79d5c5c7 100644 --- a/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc @@ -107,7 +107,7 @@ (let ((a1-1 'eco-red)) (target-danger-set! (-> self control unknown-symbol04) a1-1) ) - (collide-shape-method-46 (-> self control)) + (update-transforms (-> self control)) (let ((a1-2 (new 'stack-no-clear 'overlaps-others-params))) (set! (-> a1-2 options) (overlaps-others-options)) (set! (-> a1-2 collide-with-filter) (the-as collide-spec -1)) @@ -115,7 +115,7 @@ (find-overlapping-shapes (-> self control) a1-2) ) (target-danger-set! (-> self control unknown-symbol04) #f) - (collide-shape-method-46 (-> self control)) + (update-transforms (-> self control)) (if (and (or (>= (- (-> self clock frame-counter) (-> (the-as fact-info-target (-> self fact-override)) darkjak-start-time)) (-> (the-as fact-info-target (-> self fact-override)) darkjak-effect-time) ) @@ -339,7 +339,7 @@ (set-setting! 'bg-b 'abs #x3dcccccd 0) (set-forward-vel 0.0) (let ((s5-0 0)) - (while (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (while (not (logtest? (-> self control status) (collide-status on-surface))) (target-falling-anim-trans) (+! s5-0 (- (-> self clock frame-counter) (-> self clock old-frame-counter))) (if (>= s5-0 300) @@ -476,7 +476,7 @@ (not (and v1-10 (= v1-10 (-> self draw art-group data 412)))) ) (let ((gp-0 0)) - (while (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (while (not (logtest? (-> self control status) (collide-status on-surface))) (target-falling-anim-trans) (+! gp-0 (- (-> self clock frame-counter) (-> self clock old-frame-counter))) (if (>= gp-0 300) @@ -489,7 +489,7 @@ ) ) (cond - ((logtest? (-> self control status) (cshape-moving-flags on-water)) + ((logtest? (-> self control status) (collide-status on-water)) ) (else (let ((v1-30 (ja-group))) @@ -771,7 +771,7 @@ (when (not (ja-min? 0)) (cond ((and (>= (ja-frame-num 0) 20.0) - (and (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (and (and (not (logtest? (-> self control status) (collide-status on-surface))) (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) @@ -864,7 +864,7 @@ (let ((gp-1 (new-stack-vector0))) (vector-matrix*! gp-1 (-> self control transv) (-> self control unknown-matrix00)) (set! (-> gp-1 y) 0.0) - (vector-matrix*! (-> self control unknown-vector44) gp-1 (-> self control unknown-matrix01)) + (vector-matrix*! (-> self control align-xz-vel) gp-1 (-> self control unknown-matrix01)) ) (when (!= (the-as float (-> self control unknown-word04)) 0.0) (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) @@ -989,11 +989,11 @@ (set! (-> *run-attack-mods* turnvv) 0.0) ) (if (< 2 sv-24) - (set! sv-20 (* sv-20 (fmin 1.0 (-> self control unknown-float44)))) + (set! sv-20 (* sv-20 (fmin 1.0 (-> self control zx-vel-frac)))) ) (set! sv-24 (+ sv-24 1)) ) - (if (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (if (and (not (logtest? (-> self control status) (collide-status on-surface))) (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) @@ -1049,7 +1049,7 @@ (seek! (-> (the-as (pointer float) arg0) 0) arg1 (* 4.0 (-> self clock seconds-per-frame))) (set! (-> self control unknown-float40) (-> (the-as (pointer float) arg0) 0)) (target-danger-set! 'bomb #f) - (collide-shape-method-46 (-> self control)) + (update-transforms (-> self control)) (let ((a1-2 (new 'stack-no-clear 'overlaps-others-params))) (set! (-> a1-2 options) (overlaps-others-options)) (set! (-> a1-2 collide-with-filter) (the-as collide-spec -1)) @@ -1058,7 +1058,7 @@ ) (set! (-> self control unknown-float40) 0.0) (target-danger-set! 'bomb #f) - (collide-shape-method-46 (-> self control)) + (update-transforms (-> self control)) 0 (none) ) @@ -1208,7 +1208,7 @@ ) (suspend) (ja :num! (seek! max (lerp-scale 1.5 0.3 f30-0 30.0 210.0))) - (set! v1-100 (or (ja-done? 0) (logtest? (-> self control status) (cshape-moving-flags on-surface)))) + (set! v1-100 (or (ja-done? 0) (logtest? (-> self control status) (collide-status on-surface)))) ) ) (logclear! (-> self state-flags) (state-flags sf6)) @@ -1502,7 +1502,7 @@ (suspend) (ja :num! (seek! (ja-aframe 90.0 0))) ) - (logior! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logior! (-> self control status) (collide-status on-surface on-ground touch-surface)) (send-event (handle->process (-> self notify)) 'notify 'attack 16) (go target-darkjak-get-off) (none) @@ -1642,7 +1642,7 @@ :enter (-> target-attack-uppercut-jump enter) :exit (-> target-darkjak-bomb0 exit) :trans (behavior () - (if (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (if (logtest? (-> self control status) (collide-status on-surface)) (go target-hit-ground #f) ) (mod-var-jump #t #t (cpad-hold? (-> self control cpad number) x) (-> self control transv)) @@ -1845,7 +1845,7 @@ 327680.0 ) ) - (set! sv-40 (spatial-hash-method-36 *actor-hash* sv-56 (-> sv-32 data) (-> sv-32 allocated-length))) + (set! sv-40 (fill-actor-list-for-sphere *actor-hash* sv-56 (-> sv-32 data) (-> sv-32 allocated-length))) (set! (-> sv-32 length) sv-40) (countdown (s5-0 sv-40) (let* ((s4-0 (-> sv-32 s5-0 process)) @@ -2002,7 +2002,7 @@ (set! (-> s5-1 0 y) (+ 12697.6 (-> s5-1 0 y))) (set! (-> s5-1 0 r) 11878.4) (let ((v1-29 gp-1)) - (set! (-> v1-29 spheres) s5-1) + (set! (-> v1-29 best-dist) (the-as float s5-1)) (set! (-> v1-29 num-spheres) (the-as uint 1)) (set! (-> v1-29 collide-with) (logclear (-> self control root-prim prim-core collide-with) diff --git a/test/decompiler/reference/jak2/engine/target/target-gun_REF.gc b/test/decompiler/reference/jak2/engine/target/target-gun_REF.gc index 91f1160083..22becc0337 100644 --- a/test/decompiler/reference/jak2/engine/target/target-gun_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-gun_REF.gc @@ -1180,7 +1180,7 @@ ) (set! (-> s3-0 w) (* 0.5 (vector-vector-distance gp-0 s5-0))) (set! (-> s4-1 length) - (spatial-hash-method-36 *actor-hash* (the-as sphere s3-0) (-> s4-1 data) (-> s4-1 allocated-length)) + (fill-actor-list-for-sphere *actor-hash* (the-as sphere s3-0) (-> s4-1 data) (-> s4-1 allocated-length)) ) ) ) @@ -1200,7 +1200,7 @@ (let ((gp-0 (the-as basic #f))) (when (and (or (< (- (-> self clock frame-counter) (-> self control unknown-time-frame29)) (seconds 0.2)) (and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) - (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (zero? (logand (-> self control status) (collide-status on-surface))) ) (or (logtest? (surface-flag gun-direct) (-> self control unknown-surface01 flags)) (= (-> self gun gun-type) (pickup-type eco-dark)) @@ -1226,7 +1226,7 @@ ) ) ((or (and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) - (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (zero? (logand (-> self control status) (collide-status on-surface))) ) (logtest? (surface-flag gun-direct) (-> self control unknown-surface01 flags)) ) @@ -1314,7 +1314,7 @@ ) ) (and (or (and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) - (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (zero? (logand (-> self control status) (collide-status on-surface))) ) (logtest? (surface-flag gun-direct) (-> self control unknown-surface01 flags)) ) @@ -1660,9 +1660,9 @@ ) ((= (-> self control unknown-symbol00) 'gun) (cond - ((or (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + ((or (and (not (logtest? (-> self control status) (collide-status on-surface))) (or (and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) - (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (zero? (logand (-> self control status) (collide-status on-surface))) ) (< 2048.0 (target-height-above-ground)) ) @@ -1687,7 +1687,7 @@ (set! (-> s5-2 0 quad) (-> self control unknown-sphere-array00 2 prim-core world-sphere quad)) (set! (-> s5-2 0 r) (lerp-scale (-> *TARGET-bank* body-radius) 7372.8 f30-1 0.0 1.0)) (let ((v1-212 gp-3)) - (set! (-> v1-212 spheres) s5-2) + (set! (-> v1-212 best-dist) (the-as float s5-2)) (set! (-> v1-212 num-spheres) (the-as uint 1)) (set! (-> v1-212 collide-with) (-> self control root-prim prim-core collide-with)) (set! (-> v1-212 ignore-process0) #f) @@ -1845,7 +1845,7 @@ (set! (-> self gun upper-body twist-speed-x) 0.6) ) ((and (or (and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) - (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (zero? (logand (-> self control status) (collide-status on-surface))) ) (logtest? (surface-flag gun-direct) (-> self control unknown-surface01 flags)) ) @@ -2922,7 +2922,7 @@ (set! (-> a2-1 ignore-process1) #f) (set! (-> a2-1 ignore-pat) (-> v1-33 pat-ignore-mask)) (set! (-> a2-1 action-mask) (collide-action solid)) - (collide-shape-method-32 v1-33 (-> v1-33 transv) a2-1 (meters 1)) + (fill-cache-integrate-and-collide v1-33 (-> v1-33 transv) a2-1 (meters 1)) ) (if (and (logtest? (-> self control root-prim prim-core action) (collide-action check-edge)) (>= (vector-dot diff --git a/test/decompiler/reference/jak2/engine/target/target-swim_REF.gc b/test/decompiler/reference/jak2/engine/target/target-swim_REF.gc index 3bac848202..6194e8ee90 100644 --- a/test/decompiler/reference/jak2/engine/target/target-swim_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-swim_REF.gc @@ -372,7 +372,7 @@ (seek! (-> self control unknown-float001) -6144.0 (* 4096.0 (-> self clock seconds-per-frame))) (seek! (-> self control unknown-float001) 0.0 (* 2048.0 (-> self clock seconds-per-frame))) ) - (set! (-> self control unknown-vector04 y) (-> self control unknown-float001)) + (set! (-> self control draw-offset y) (-> self control unknown-float001)) ) ;; failed to figure out what this is: @@ -420,8 +420,8 @@ ) :trans (behavior () ((-> self state-hook)) - (if (and (logtest? (-> self control status) (cshape-moving-flags on-surface)) - (zero? (logand (-> self control status) (cshape-moving-flags on-water))) + (if (and (logtest? (-> self control status) (collide-status on-surface)) + (zero? (logand (-> self control status) (collide-status on-water))) ) (set-zero! (-> self water bob)) ) @@ -543,8 +543,8 @@ :exit (-> target-swim-stance exit) :trans (behavior () ((-> self state-hook)) - (if (and (logtest? (-> self control status) (cshape-moving-flags on-surface)) - (zero? (logand (-> self control status) (cshape-moving-flags on-water))) + (if (and (logtest? (-> self control status) (collide-status on-surface)) + (zero? (logand (-> self control status) (collide-status on-water))) ) (set-zero! (-> self water bob)) ) @@ -843,7 +843,7 @@ (go target-swim-up) ) (if (or (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame27)) s5-0) - (and (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (and (logtest? (-> self control status) (collide-status on-surface)) (and (< (-> self water swim-depth) 8192.0) (>= (- (-> self clock frame-counter) (-> self state-time)) gp-0)) ) ) @@ -923,7 +923,7 @@ ) (if (and (cpad-pressed? (-> self control cpad number) circle square) (or (< (- (-> self clock frame-counter) (-> self control unknown-time-frame27)) (seconds 10)) - (logtest? (-> self control status) (cshape-moving-flags t-ceil)) + (logtest? (-> self control status) (collide-status touch-ceiling)) ) (and (< (-> *TARGET-bank* min-dive-depth) (target-height-above-ground)) (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) @@ -1031,7 +1031,7 @@ (cond ((< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (set! (-> self water flags) (logior (water-flags jump-out) (-> self water flags))) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) ) (else (set! (-> self trans-hook) (-> target-jump trans)) diff --git a/test/decompiler/reference/jak2/engine/target/target-util_REF.gc b/test/decompiler/reference/jak2/engine/target/target-util_REF.gc index 93d3aa583e..0df2af7fc2 100644 --- a/test/decompiler/reference/jak2/engine/target/target-util_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-util_REF.gc @@ -816,7 +816,7 @@ (logior! (-> self control penetrate-using) (penetrate touch board)) ) ((= arg0 'racer) - (set! (-> gp-0 unknown-vector04 y) 4096.0) + (set! (-> gp-0 draw-offset y) 4096.0) (sphere<-vector+r! (the-as sphere (-> gp-0 root-prim local-sphere)) (new 'static 'vector :y 8192.0 :w 1.0) @@ -849,7 +849,7 @@ (logior! (-> self control penetrate-using) (penetrate touch mech)) ) ((= arg0 'mech-carry) - (set! (-> gp-0 unknown-vector04 y) 0.0) + (set! (-> gp-0 draw-offset y) 0.0) (sphere<-vector+r! (the-as sphere (-> gp-0 root-prim local-sphere)) (new 'static 'vector :y 12288.0 :w 1.0) @@ -868,7 +868,7 @@ ((= arg0 'duck) (set! (-> self control unknown-float31) arg1) (let ((f30-1 (- 1.0 arg1))) - (set! (-> gp-0 unknown-vector04 y) 0.0) + (set! (-> gp-0 draw-offset y) 0.0) (sphere<-vector+r! (the-as sphere (-> gp-0 root-prim local-sphere)) (-> *TARGET-bank* root-offset) @@ -908,7 +908,7 @@ ) ((= arg0 'indax) (let ((f30-2 0.2)) - (set! (-> gp-0 unknown-vector04 y) 0.0) + (set! (-> gp-0 draw-offset y) 0.0) (sphere<-vector+r! (the-as sphere (-> gp-0 root-prim local-sphere)) (-> *TARGET-bank* root-offset) @@ -943,7 +943,7 @@ ((= arg0 'tube) (set! (-> self control unknown-float31) arg1) (let ((f30-3 (- 1.0 arg1))) - (set! (-> gp-0 unknown-vector04 y) 0.0) + (set! (-> gp-0 draw-offset y) 0.0) (sphere<-vector+r! (the-as sphere (-> gp-0 root-prim local-sphere)) (-> *TARGET-bank* root-offset) @@ -974,7 +974,7 @@ (logior! (-> self control penetrate-using) (penetrate touch tube)) ) ((= arg0 'carry) - (set! (-> gp-0 unknown-vector04 y) 0.0) + (set! (-> gp-0 draw-offset y) 0.0) (sphere<-vector+r! (the-as sphere (-> gp-0 root-prim local-sphere)) (-> *TARGET-bank* root-offset) @@ -1004,7 +1004,7 @@ ) ((= arg0 'gun) (set! (-> self control unknown-float31) arg1) - (set! (-> gp-0 unknown-vector04 y) 0.0) + (set! (-> gp-0 draw-offset y) 0.0) (sphere<-vector+r! (the-as sphere (-> gp-0 root-prim local-sphere)) (-> *TARGET-bank* root-offset) @@ -1058,7 +1058,7 @@ ) (else (set! (-> self control unknown-float31) 0.0) - (set! (-> gp-0 unknown-vector04 y) 0.0) + (set! (-> gp-0 draw-offset y) 0.0) (sphere<-vector+r! (the-as sphere (-> gp-0 root-prim local-sphere)) (-> *TARGET-bank* root-offset) @@ -1233,10 +1233,10 @@ (>= (- (-> *display* game-clock frame-counter) (the-as int (-> self game kiosk-timeout))) (seconds 60)) ) (and (>= (- (-> self clock frame-counter) (-> self ambient-time)) (seconds 30)) - (not (logtest? (-> self control status) (cshape-moving-flags t-act))) - (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (not (logtest? (-> self control status) (collide-status touch-actor))) + (logtest? (-> self control status) (collide-status on-surface)) (not (or (logtest? (water-flags touch-water) (-> self water flags)) - (logtest? (-> self control status) (cshape-moving-flags on-water)) + (logtest? (-> self control status) (collide-status on-water)) ) ) (zero? (logand (focus-status dead hit grabbed in-head edge-grab pole flut tube board mech dark indax teleporting) @@ -1275,11 +1275,11 @@ ;; definition for function can-jump? (defbehavior can-jump? target ((arg0 symbol)) - (and (or (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (and (or (logtest? (-> self control status) (collide-status on-surface)) (< (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) - (and (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (and (logtest? (-> self control status) (collide-status on-surface)) (< 0.866 (-> self control surface-angle)) ) (and (= arg0 'board) @@ -1315,7 +1315,7 @@ ;; definition for function jump-hit-ground-stuck? (defbehavior jump-hit-ground-stuck? target () - (or (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (or (logtest? (-> self control status) (collide-status on-surface)) (when (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) ) @@ -1344,7 +1344,7 @@ ;; definition for function fall-test ;; WARN: Return type mismatch object vs none. (defbehavior fall-test target ((arg0 (state symbol target)) (arg1 float)) - (when (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (when (and (not (logtest? (-> self control status) (collide-status on-surface))) (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) @@ -1364,11 +1364,11 @@ ;; definition for function slide-down-test ;; WARN: Return type mismatch object vs none. (defbehavior slide-down-test target () - (if (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface csmf07))) + (if (and (not (logtest? (-> self control status) (collide-status on-surface touch-edge))) (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) - (logtest? (-> self control status) (cshape-moving-flags t-surface)) + (logtest? (-> self control status) (collide-status touch-surface)) (< 0.5 (-> self control surface-angle)) ) (go target-slide-down) @@ -1380,16 +1380,16 @@ (defbehavior smack-surface? target ((arg0 symbol)) (and (< 0.7 (-> self control touch-angle)) (and (< (-> self control surface-angle) 0.3) - (logtest? (-> self control status) (cshape-moving-flags t-wall)) - (or arg0 (zero? (logand (-> self control status) (cshape-moving-flags t-act)))) + (logtest? (-> self control status) (collide-status touch-wall)) + (or arg0 (zero? (logand (-> self control status) (collide-status touch-actor)))) ) ) ) ;; definition for function can-roll? (defbehavior can-roll? target () - (and (logtest? (-> self control status) (cshape-moving-flags on-surface)) - (or (not (logtest? (-> self control status) (cshape-moving-flags t-wall))) + (and (logtest? (-> self control status) (collide-status on-surface)) + (or (not (logtest? (-> self control status) (collide-status touch-wall))) (>= 0.7 (-> self control touch-angle)) ) (< (-> self control unknown-float17) 0.7) @@ -1410,7 +1410,7 @@ ;; definition for function can-duck? (defbehavior can-duck? target () - (and (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (and (logtest? (-> self control status) (collide-status on-surface)) (>= (-> self control unknown-float0000) 0.7) (not (logtest? (water-flags under-water swimming) (-> self water flags))) (not (logtest? (-> self state-flags) (state-flags sf9))) @@ -1435,7 +1435,7 @@ (set! (-> s4-0 1 y) (+ 2867.2 (-> *TARGET-bank* body-radius) (-> s4-0 1 y))) (set! (-> s4-0 1 r) (-> *TARGET-bank* body-radius)) (let ((v1-12 gp-0)) - (set! (-> v1-12 spheres) s4-0) + (set! (-> v1-12 best-dist) (the-as float s4-0)) (set! (-> v1-12 num-spheres) (the-as uint 2)) (set! (-> v1-12 collide-with) (logclear (-> arg0 control root-prim prim-core collide-with) @@ -1605,7 +1605,7 @@ (set! (-> arg1 control unknown-time-frame25) arg0) ) ) - (collide-shape-method-49 (-> arg1 control) 2 #x8000 0) + (modify-collide-as! (-> arg1 control) 2 (collide-spec jak-vulnerable) (collide-spec)) (logior! (-> arg1 focus-status) (focus-status ignore)) 0 (none) @@ -1630,7 +1630,7 @@ ) (when (not (logtest? (state-flags tinvul1 tinvul2) (-> arg0 state-flags))) (logclear! (-> arg0 draw status) (draw-control-status no-draw-bounds)) - (collide-shape-method-49 (-> arg0 control) 2 0 #x8000) + (modify-collide-as! (-> arg0 control) 2 (collide-spec) (collide-spec jak-vulnerable)) ) 0 (none) @@ -2115,7 +2115,7 @@ ) ) ((= arg0 7) - (-> v1-0 unknown-vector23) + (-> v1-0 last-trans-on-surf) ) ((= arg0 8) (-> v1-0 unknown-vector42) diff --git a/test/decompiler/reference/jak2/engine/target/target_REF.gc b/test/decompiler/reference/jak2/engine/target/target_REF.gc index 5160a090a2..95c0bcad68 100644 --- a/test/decompiler/reference/jak2/engine/target/target_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target_REF.gc @@ -10,7 +10,7 @@ (if (and (cpad-pressed? (-> self control cpad number) circle) (can-feet? #f)) (go target-attack-air #f) ) - (if (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (if (logtest? (-> self control status) (collide-status on-surface)) (go target-hit-ground #f) ) (when (if (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) @@ -20,7 +20,7 @@ ) #t ) - (logior! (-> self control status) (cshape-moving-flags on-surface)) + (logior! (-> self control status) (collide-status on-surface)) (go target-hit-ground 'stuck) ) (if (!= (-> self state-time) (-> self clock frame-counter)) @@ -290,7 +290,7 @@ (if (and (cpad-pressed? (-> self control cpad number) square) (can-hands? #t)) (go target-running-attack) ) - (if (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (if (and (not (logtest? (-> self control status) (collide-status on-surface))) (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) (seconds 0.08)) ) (go target-falling #f) @@ -332,12 +332,12 @@ (none) ) :trans (behavior () - (when (or (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (when (or (logtest? (-> self control status) (collide-status on-surface)) (if (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) #t ) ) - (logior! (-> self control status) (cshape-moving-flags on-surface)) + (logior! (-> self control status) (collide-status on-surface)) (if (using-gun? self) (go target-stance) (go target-duck-stance #f) @@ -461,7 +461,7 @@ (none) ) :trans (behavior () - (if (and (or (and (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (if (and (or (and (logtest? (-> self control status) (collide-status on-surface)) (and (< 0.9 (-> self control surface-angle)) (!= (-> self control cur-pat material) 14) (!= (-> self control cur-pat event) 7) @@ -523,7 +523,7 @@ (go target-running-attack) ) (when (= (-> self control unknown-float15) 0.0) - (logior! (-> self control status) (cshape-moving-flags on-surface)) + (logior! (-> self control status) (collide-status on-surface)) (if (using-gun? self) (go target-stance) (go target-duck-stance #f) @@ -582,7 +582,7 @@ (set! arg0 (* arg0 (-> self darkjak-giant-interp))) (set! arg1 (* arg1 (-> self darkjak-giant-interp))) ) - (logclear! (-> self control status) (cshape-moving-flags csmf14)) + (logclear! (-> self control status) (collide-status touch-ceiling-sticky)) (set! (-> self control unknown-time-frame19) (-> self clock frame-counter)) (delete-back-vel) (let* ((f0-4 arg5) @@ -717,11 +717,11 @@ ) (set! (-> v1-62 y) (* 0.5 (-> v1-62 y))) ) - (set! v0-1 (-> self control unknown-vector06)) + (set! v0-1 (-> self control anim-collide-offset-local)) (set! (-> v0-1 quad) (-> v1-62 quad)) ) (else - (set! v0-1 (-> self control unknown-vector06)) + (set! v0-1 (-> self control anim-collide-offset-local)) (set! (-> v0-1 quad) (the-as uint128 0)) ) ) @@ -1115,7 +1115,7 @@ (set! (-> self state-time) (-> self clock frame-counter)) (sound-play "jump" :vol 70) (init-var-jump arg0 arg1 #t #t (-> self control transv) 2.0) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! arg2 (cond (arg2 (empty) @@ -1404,7 +1404,7 @@ ) (set! (-> self state-time) (-> self clock frame-counter)) (init-var-jump arg0 arg1 #t #t (-> self control transv) 2.0) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (if (!= (-> self control unknown-surface00) *slide-jump-mods*) (set! (-> self control unknown-surface00) *double-jump-mods*) ) @@ -1544,7 +1544,7 @@ (go target-duck-high-jump arg0 arg1 (the-as symbol arg2)) ) (set! (-> self state-time) (-> self clock frame-counter)) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (sound-play "jump" :pitch 0.3) (init-var-jump arg0 arg1 #t #t (-> self control transv) 2.0) (set! (-> self control unknown-surface00) (cond @@ -1622,7 +1622,7 @@ :event target-standard-event-handler :enter (behavior ((arg0 float) (arg1 float) (arg2 symbol)) (set! (-> self state-time) (-> self clock frame-counter)) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control unknown-surface00) *turn-around-mods*) (case arg2 (('launch) @@ -1677,7 +1677,7 @@ (set! (-> self state-time) (-> self clock frame-counter)) (sound-play "jump" :vol 80 :pitch -0.4) (init-var-jump arg0 arg1 #t #f (-> self control transv) 2.0) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (cond ((= arg2 'launch) (set! (-> self neck flex-blend) 0.0) @@ -1891,9 +1891,7 @@ ) ) ) - (if (and (< (-> *TARGET-bank* fall-far) f0-2) - (zero? (logand (-> self control status) (cshape-moving-flags on-water))) - ) + (if (and (< (-> *TARGET-bank* fall-far) f0-2) (zero? (logand (-> self control status) (collide-status on-water)))) (go target-hit-ground-hard f0-2) ) ) @@ -2501,7 +2499,7 @@ (when (!= (-> self state-time) (-> self clock frame-counter)) (when (and (or (smack-surface? #t) (and (>= (-> self control unknown-float19) 0.7) - (zero? (logand (-> self control status) (cshape-moving-flags t-act))) + (zero? (logand (-> self control status) (collide-status touch-actor))) ) ) (begin @@ -2652,7 +2650,7 @@ (when (not (ja-min? 0)) (cond ((and (>= (ja-aframe-num 0) 20.0) - (and (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (and (and (not (logtest? (-> self control status) (collide-status on-surface))) (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) @@ -2697,7 +2695,7 @@ (let ((s5-1 (new-stack-vector0))) (vector-matrix*! s5-1 (-> self control transv) (-> self control unknown-matrix00)) (set! (-> s5-1 y) 0.0) - (vector-matrix*! (-> self control unknown-vector44) s5-1 (-> self control unknown-matrix01)) + (vector-matrix*! (-> self control align-xz-vel) s5-1 (-> self control unknown-matrix01)) ) (when (!= (the-as float (-> self control unknown-word04)) 0.0) (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) @@ -2800,12 +2798,12 @@ (set! (-> *run-attack-mods* turnvv) 0.0) ) (if (< 2 gp-2) - (set! f30-0 (* f30-0 (fmin 1.0 (-> self control unknown-float44)))) + (set! f30-0 (* f30-0 (fmin 1.0 (-> self control zx-vel-frac)))) ) (+! gp-2 1) ) ) - (if (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (if (and (not (logtest? (-> self control status) (collide-status on-surface))) (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) @@ -2921,7 +2919,7 @@ ) :enter (behavior ((arg0 symbol)) (set! (-> self state-time) (-> self clock frame-counter)) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (target-start-attack) (target-danger-set! 'spin-air #f) (set! (-> self control unknown-surface00) *jump-attack-mods*) @@ -3002,7 +3000,7 @@ (none) ) :trans (behavior () - (when (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (when (logtest? (-> self control status) (collide-status on-surface)) (set-quaternion! (-> self control) (-> self control dir-targ)) (go target-hit-ground #f) ) @@ -3276,7 +3274,7 @@ ) (set! (-> self state-time) (-> self clock frame-counter)) (init-var-jump arg0 arg1 #t #f (-> self control transv) 2.0) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self neck flex-blend) 0.0) (set! (-> self control unknown-surface00) *uppercut-jump-mods*) (target-start-attack) @@ -3289,7 +3287,7 @@ ) :exit target-exit :trans (behavior () - (if (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (if (logtest? (-> self control status) (collide-status on-surface)) (go target-hit-ground #f) ) (when (and (cpad-pressed? (-> self control cpad number) square) @@ -3470,7 +3468,7 @@ (set-forward-vel (-> self control unknown-float05)) ) (set! (-> self state-time) (-> self clock frame-counter)) - (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) (set! (-> self control unknown-surface00) *flop-mods*) (set! (-> self neck flex-blend) 0.0) (set! (-> self control unknown-word04) (the-as uint 0)) @@ -3513,16 +3511,16 @@ ) :trans (behavior () (delete-back-vel) - (let ((gp-1 (logtest? (-> self control status) (cshape-moving-flags on-surface)))) + (let ((gp-1 (logtest? (-> self control status) (collide-status on-surface)))) (when (and (not gp-1) (let ((v1-6 (ja-group))) (and v1-6 (or (= v1-6 (-> self draw art-group data 53)) (= v1-6 (-> self draw art-group data 55)))) ) ) (when (and (or (< (target-move-dist (seconds 0.1)) 1638.4) - (and (logtest? (-> self control status) (cshape-moving-flags t-wall)) (< 0.7 (-> self control poly-angle))) + (and (logtest? (-> self control status) (collide-status touch-wall)) (< 0.7 (-> self control poly-angle))) ) - (not (logtest? (-> self control status) (cshape-moving-flags t-act))) + (not (logtest? (-> self control status) (collide-status touch-actor))) (>= (the-as uint (-> self control unknown-word04)) (the-as uint 2)) ) (set! (-> self control unknown-time-frame14) (-> self clock frame-counter)) @@ -3530,7 +3528,7 @@ ) ) (when gp-1 - (logior! (-> self control status) (cshape-moving-flags on-surface)) + (logior! (-> self control status) (collide-status on-surface)) (when (or (and (= (-> (the-as fact-info-target (-> self fact-override)) eco-type) 2) (>= (-> (the-as fact-info-target (-> self fact-override)) eco-level) 1.0) ) @@ -3636,11 +3634,11 @@ ) (let ((f30-0 1.0)) (let ((v1-58 (new-stack-vector0))) - (let ((f0-17 (vector-dot (-> self control dynam gravity-normal) (-> self control unknown-vector44)))) + (let ((f0-17 (vector-dot (-> self control dynam gravity-normal) (-> self control align-xz-vel)))) 0.0 (vector-! v1-58 - (-> self control unknown-vector44) + (-> self control align-xz-vel) (vector-float*! v1-58 (-> self control dynam gravity-normal) f0-17) ) ) @@ -3649,8 +3647,8 @@ (f2-0 -368640.0) ) (vector+! - (-> self control unknown-vector44) - (vector-float*! (-> self control unknown-vector44) (-> self control dynam gravity-normal) f2-0) + (-> self control align-xz-vel) + (vector-float*! (-> self control align-xz-vel) (-> self control dynam gravity-normal) f2-0) (vector-float*! v1-58 v1-58 (/ f0-18 f1-1)) ) ) @@ -3683,7 +3681,7 @@ (set! (-> gp-1 param 0) 0.0) (joint-control-channel-group-eval! gp-1 (the-as art-joint-anim #f) num-func-chan) ) - (set! f30-0 (* f30-0 (fmin 1.0 (-> self control unknown-float44)))) + (set! f30-0 (* f30-0 (fmin 1.0 (-> self control zx-vel-frac)))) (let ((v1-77 (new-stack-vector0)) (f0-33 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) ) @@ -3952,13 +3950,13 @@ (let ((s3-2 (new-stack-vector0))) (vector-matrix*! s3-2 (-> self control transv) (-> self control unknown-matrix00)) (set! (-> s3-2 y) 0.0) - (vector-matrix*! (-> self control unknown-vector44) s3-2 (-> self control unknown-matrix01)) + (vector-matrix*! (-> self control align-xz-vel) s3-2 (-> self control unknown-matrix01)) ) ) ) (suspend) (ja :num! (seek!)) - (set! f30-0 (* f30-0 (fmin 1.0 (-> self control unknown-float44)))) + (set! f30-0 (* f30-0 (fmin 1.0 (-> self control zx-vel-frac)))) ) ) (if (and (or (< (- (-> self clock frame-counter) (the-as time-frame gp-0)) @@ -4105,20 +4103,20 @@ (let ((s4-1 (new-stack-vector0))) (vector-matrix*! s4-1 (-> self control transv) (-> self control unknown-matrix00)) (set! (-> s4-1 y) 0.0) - (vector-matrix*! (-> self control unknown-vector44) s4-1 (-> self control unknown-matrix01)) + (vector-matrix*! (-> self control align-xz-vel) s4-1 (-> self control unknown-matrix01)) ) (suspend) (ja :num! (seek!)) - (set! f30-0 (* f30-0 (fmin 1.0 (-> self control unknown-float44)))) + (set! f30-0 (* f30-0 (fmin 1.0 (-> self control zx-vel-frac)))) (set! v1-37 (or (ja-max? 0) - (and (>= (ja-aframe-num 0) 4.0) (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (and (>= (ja-aframe-num 0) 4.0) (logtest? (-> self control status) (collide-status on-surface))) ) ) ) ) (set! (-> self state-time) (-> self clock frame-counter)) - (while (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (while (not (logtest? (-> self control status) (collide-status on-surface))) (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.01)) (let ((v1-50 (ja-group))) (when (not (and v1-50 (= v1-50 (-> self draw art-group data 27)))) diff --git a/test/decompiler/reference/jak2/levels/common/battle_REF.gc b/test/decompiler/reference/jak2/levels/common/battle_REF.gc index b2b69fb752..41428ce2d9 100644 --- a/test/decompiler/reference/jak2/levels/common/battle_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/battle_REF.gc @@ -1,5 +1,7 @@ +;;-*-Lisp-*- (in-package goal) +;; definition of type battle-info (deftype battle-info (basic) ((id int8 :offset-assert 4) (notice-spec uint64 :offset-assert 8) @@ -23,6 +25,7 @@ :flag-assert #x900000048 ) +;; definition for method 3 of type battle-info (defmethod inspect battle-info ((obj battle-info)) (when (not obj) (set! obj obj) @@ -49,6 +52,7 @@ obj ) +;; definition of type battle-ally (deftype battle-ally (structure) ((entity entity-actor :offset-assert 0) ) @@ -57,6 +61,7 @@ :flag-assert #x900000004 ) +;; definition for method 3 of type battle-ally (defmethod inspect battle-ally ((obj battle-ally)) (when (not obj) (set! obj obj) @@ -68,6 +73,7 @@ obj ) +;; definition of type battle-ally-array (deftype battle-ally-array (inline-array-class) ((data battle-ally :inline :dynamic :offset-assert 16) ) @@ -76,6 +82,7 @@ :flag-assert #x900000010 ) +;; definition for method 3 of type battle-ally-array (defmethod inspect battle-ally-array ((obj battle-ally-array)) (when (not obj) (set! obj obj) @@ -89,8 +96,10 @@ obj ) +;; failed to figure out what this is: (set! (-> battle-ally-array heap-base) (the-as uint 16)) +;; definition of type battle-breed (deftype battle-breed (structure) ((breed-type type :offset-assert 0) (percent float :offset-assert 4) @@ -100,6 +109,7 @@ :flag-assert #x900000008 ) +;; definition for method 3 of type battle-breed (defmethod inspect battle-breed ((obj battle-breed)) (when (not obj) (set! obj obj) @@ -112,6 +122,7 @@ obj ) +;; definition of type battle-breed-array (deftype battle-breed-array (inline-array-class) ((data battle-breed :inline :dynamic :offset-assert 16) ) @@ -120,6 +131,7 @@ :flag-assert #x900000010 ) +;; definition for method 3 of type battle-breed-array (defmethod inspect battle-breed-array ((obj battle-breed-array)) (when (not obj) (set! obj obj) @@ -133,8 +145,10 @@ obj ) +;; failed to figure out what this is: (set! (-> battle-breed-array heap-base) (the-as uint 16)) +;; definition of type battle-spawner (deftype battle-spawner (structure) ((flags uint64 :offset-assert 0) (entity entity-actor :offset-assert 8) @@ -155,6 +169,7 @@ :flag-assert #x900000050 ) +;; definition for method 3 of type battle-spawner (defmethod inspect battle-spawner ((obj battle-spawner)) (when (not obj) (set! obj obj) @@ -178,6 +193,7 @@ obj ) +;; definition of type battle-spawner-array (deftype battle-spawner-array (inline-array-class) ((data battle-spawner :inline :dynamic :offset-assert 16) ) @@ -186,6 +202,7 @@ :flag-assert #x900000010 ) +;; definition for method 3 of type battle-spawner-array (defmethod inspect battle-spawner-array ((obj battle-spawner-array)) (when (not obj) (set! obj obj) @@ -199,8 +216,10 @@ obj ) +;; failed to figure out what this is: (set! (-> battle-spawner-array heap-base) (the-as uint 80)) +;; definition of type battle (deftype battle (process-drawable) ((info battle-info :offset-assert 200) (flags uint8 :offset-assert 204) @@ -259,6 +278,7 @@ ) ) +;; definition for method 3 of type battle (defmethod inspect battle ((obj battle)) (when (not obj) (set! obj obj) @@ -286,6 +306,7 @@ obj ) +;; definition for symbol *battles*, type (array battle-info) (define *battles* (new 'static 'boxed-array :type battle-info (new 'static 'battle-info :notice-spec #x1 @@ -850,6 +871,21 @@ ) ) +;; definition for function battle-event-handler +;; WARN: Return type mismatch none vs object. +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 13] +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 23] +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 33] +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 37] +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 39] +;; WARN: disable def twice: 9. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +;; WARN: disable def twice: 19. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +;; WARN: disable def twice: 29. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 54] +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 72] +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 103] +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 122] +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 147] (defbehavior battle-event-handler battle ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) (let ((v1-0 arg2)) (the-as object (cond @@ -919,6 +955,9 @@ ) ) +;; definition for method 27 of type battle +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. (defmethod battle-method-27 battle ((obj battle)) (local-vars (sv-16 string) (sv-32 string)) (let ((s4-0 (-> obj root trans)) @@ -984,6 +1023,8 @@ (none) ) +;; definition for method 26 of type battle +;; INFO: Used lq/sq (defmethod battle-method-26 battle ((obj battle) (arg0 battle-spawner)) (local-vars (a2-5 float) (a2-12 float)) (rlet ((vf1 :class vf) @@ -1000,7 +1041,7 @@ ) (set! *actor-list-length* 0) (if (logtest? s5-0 512) - (set! *actor-list-length* (spatial-hash-method-36 *actor-hash* (the-as sphere gp-0) *actor-list* 256)) + (set! *actor-list-length* (fill-actor-list-for-sphere *actor-hash* (the-as sphere gp-0) *actor-list* 256)) ) (when (logtest? s5-0 1024) (let ((a0-2 (-> *collide-player-list* alive-list next0))) @@ -1099,6 +1140,7 @@ ) ) +;; definition for method 25 of type battle (defmethod battle-method-25 battle ((obj battle) (arg0 battle-spawner)) (when (not (logtest? (the-as int (-> obj flags)) 8)) (let ((f0-0 (-> obj info spawner-blocked-by-player-xz))) @@ -1115,12 +1157,14 @@ #f ) +;; definition for method 37 of type battle (defmethod battle-method-37 battle ((obj battle) (arg0 battle-spawner)) (and (not (handle->process (-> arg0 creature))) (or (>= (-> arg0 ready-index) 0) (not (battle-method-25 obj arg0))) ) ) +;; definition for method 36 of type battle (defmethod battle-method-36 battle ((obj battle)) (let ((s5-0 (-> obj spawners length)) (v1-2 (-> obj info pick-logic)) @@ -1168,6 +1212,7 @@ (the-as battle-spawner #f) ) +;; definition for method 41 of type battle (defmethod battle-method-41 battle ((obj battle) (arg0 battle-spawner)) (let ((f0-0 (rand-vu)) (v1-0 0) @@ -1186,6 +1231,8 @@ ) ) +;; definition for method 38 of type battle +;; WARN: Return type mismatch int vs handle. (defmethod battle-method-38 battle ((obj battle) (arg0 battle-breed) (arg1 transformq)) (let* ((s3-0 (-> arg0 breed-type)) (s4-0 (get-process *default-dead-pool* s3-0 #x4000)) @@ -1206,6 +1253,8 @@ ) ) +;; definition for method 39 of type battle +;; INFO: Used lq/sq (defmethod battle-method-39 battle ((obj battle) (arg0 battle-spawner) (arg1 symbol)) (with-pp (let ((s3-0 (new 'stack-no-clear 'vector)) @@ -1268,6 +1317,7 @@ ) ) +;; definition for method 30 of type battle (defmethod battle-method-30 battle ((obj battle) (arg0 process)) (let ((v1-0 (if (type? arg0 nav-enemy) (the-as nav-enemy arg0) @@ -1293,6 +1343,7 @@ (the-as battle-spawner #f) ) +;; definition for method 51 of type battle (defmethod battle-method-51 battle ((obj battle) (arg0 battle-spawner) (arg1 symbol)) (when (and (logtest? (the-as int (-> obj flags)) 2) (zero? (logand (the-as int (-> obj flags)) 4))) (let ((v1-5 (-> arg0 noticed-attack-time))) @@ -1343,6 +1394,7 @@ #f ) +;; definition for method 46 of type battle (defmethod battle-method-46 battle ((obj battle) (arg0 battle-spawner)) (when (-> arg0 intro-path) (let ((v1-1 (-> arg0 creature-index)) @@ -1353,6 +1405,7 @@ ) ) +;; definition for method 43 of type battle (defmethod battle-method-43 battle ((obj battle) (arg0 battle-spawner) (arg1 touch-tracker)) (let ((s3-0 (+ (-> arg0 creature-index) 1)) (s4-0 (new 'stack-no-clear 'vector)) @@ -1382,6 +1435,7 @@ ) ) +;; definition for method 45 of type battle (defmethod battle-method-45 battle ((obj battle) (arg0 battle-spawner) (arg1 touch-tracker)) (when (logtest? (-> arg0 flags) 1) (if (-> arg0 intro-path) @@ -1391,6 +1445,7 @@ ) ) +;; definition for method 42 of type battle (defmethod battle-method-42 battle ((obj battle) (arg0 battle-spawner) (arg1 touch-tracker)) (let ((s5-0 (-> arg0 creature))) (set! (-> arg0 creature) (the-as handle #f)) @@ -1406,6 +1461,8 @@ ) ) +;; definition for method 44 of type battle +;; WARN: Return type mismatch int vs none. (defmethod battle-method-44 battle ((obj battle) (arg0 battle-spawner)) (when (= (-> arg0 mode) 2) (+! (-> arg0 creature-index) 1) @@ -1416,6 +1473,7 @@ (none) ) +;; definition for method 52 of type battle (defmethod battle-method-52 battle ((obj battle)) (let ((gp-0 0)) (dotimes (s4-0 (-> obj spawners length)) @@ -1427,6 +1485,8 @@ ) ) +;; definition for method 40 of type battle +;; WARN: Return type mismatch int vs none. (defmethod battle-method-40 battle ((obj battle)) (set! (-> obj spawn-initial-creatures?) #f) (let ((s5-0 (-> obj spawners))) @@ -1447,6 +1507,8 @@ (none) ) +;; definition for method 35 of type battle +;; WARN: Return type mismatch int vs none. (defmethod battle-method-35 battle ((obj battle)) (let ((v1-0 (-> obj info))) (rand-vu-int-range @@ -1457,6 +1519,7 @@ (none) ) +;; failed to figure out what this is: (defstate idle (battle) :virtual #t :event battle-event-handler @@ -1495,6 +1558,7 @@ :code (the-as (function none :behavior battle) sleep-code) ) +;; failed to figure out what this is: (defstate notice (battle) :virtual #t :event battle-event-handler @@ -1530,6 +1594,7 @@ ) ) +;; definition for method 49 of type battle (defmethod battle-method-49 battle ((obj battle)) (let ((v1-0 (-> obj allies)) (gp-0 (-> obj allies length)) @@ -1552,6 +1617,7 @@ ) ) +;; definition for method 50 of type battle (defmethod battle-method-50 battle ((obj battle)) (with-pp (let ((s5-0 (battle-method-52 obj)) @@ -1626,6 +1692,7 @@ ) ) +;; failed to figure out what this is: (defstate hostile (battle) :virtual #t :event battle-event-handler @@ -1659,6 +1726,7 @@ :code (the-as (function none :behavior battle) sleep-code) ) +;; failed to figure out what this is: (defstate beaten (battle) :virtual #t :event battle-event-handler @@ -1678,6 +1746,8 @@ :code (the-as (function none :behavior battle) sleep-code) ) +;; definition for method 47 of type battle +;; WARN: Return type mismatch uint8 vs none. (defmethod battle-method-47 battle ((obj battle)) (let ((a3-0 (-> obj info play-battle-music))) (when (and a3-0 (zero? (logand (the-as int (-> obj flags)) 16))) @@ -1695,6 +1765,8 @@ (none) ) +;; definition for method 48 of type battle +;; WARN: Return type mismatch int vs none. (defmethod battle-method-48 battle ((obj battle)) (when (logtest? (the-as int (-> obj flags)) 16) (remove-setting! 'sound-mode) @@ -1704,6 +1776,7 @@ (none) ) +;; definition for method 7 of type battle-spawner-array (defmethod relocate battle-spawner-array ((obj battle-spawner-array) (arg0 int)) (dotimes (v1-0 (-> obj length)) (let ((a2-3 (-> obj data v1-0))) @@ -1716,6 +1789,8 @@ obj ) +;; definition for method 7 of type battle +;; WARN: Return type mismatch process-drawable vs battle. (defmethod relocate battle ((obj battle) (arg0 int)) (&+! (-> obj spawners) arg0) (&+! (-> obj allies) arg0) @@ -1725,6 +1800,9 @@ ) ) +;; definition for method 29 of type battle +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. (defmethod battle-method-29 battle ((obj battle) (arg0 battle-spawner) (arg1 entity-actor)) (local-vars (sv-16 res-tag) (sv-32 res-tag)) (let ((s2-0 0) @@ -1809,6 +1887,8 @@ (none) ) +;; definition for method 32 of type battle +;; INFO: Used lq/sq (defmethod battle-method-32 battle ((obj battle) (arg0 battle-spawner) (arg1 entity-actor)) (local-vars (v0-4 object)) (set! (-> arg0 flags) (the-as uint 0)) @@ -1854,12 +1934,17 @@ v0-4 ) +;; definition for method 31 of type battle +;; WARN: Return type mismatch int vs none. (defmethod battle-method-31 battle ((obj battle) (arg0 battle-ally) (arg1 entity-actor)) (set! (-> arg0 entity) arg1) 0 (none) ) +;; definition for method 28 of type battle +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. (defmethod battle-method-28 battle ((obj battle)) (local-vars (v0-4 battle-ally-array) (sv-16 res-tag) (sv-32 entity-actor)) (set! sv-16 (new 'static 'res-tag)) @@ -1925,6 +2010,8 @@ (none) ) +;; definition for method 33 of type battle +;; WARN: Return type mismatch int vs none. (defmethod battle-method-33 battle ((obj battle)) (set! (-> obj spawn-initial-creatures?) #t) (set! (-> obj count) (the-as uint 0)) @@ -1964,6 +2051,8 @@ (none) ) +;; definition for method 34 of type battle +;; WARN: Return type mismatch int vs none. (defmethod battle-method-34 battle ((obj battle)) (if (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status subtask-complete))) (go (method-of-object obj beaten)) @@ -1973,6 +2062,8 @@ (none) ) +;; definition for method 11 of type battle +;; INFO: Used lq/sq (defmethod init-from-entity! battle ((obj battle) (arg0 entity-actor)) (set! (-> obj mask) (logior (process-mask enemy) (-> obj mask))) (let ((s4-0 (new 'process 'trsqv))) diff --git a/test/decompiler/reference/jak2/levels/common/cty-guard-turret-button_REF.gc b/test/decompiler/reference/jak2/levels/common/cty-guard-turret-button_REF.gc index 3912ae3a16..7bf8952355 100644 --- a/test/decompiler/reference/jak2/levels/common/cty-guard-turret-button_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/cty-guard-turret-button_REF.gc @@ -86,7 +86,7 @@ (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 12288.0) (set! (-> s5-0 root-prim) s4-0) ) - (collide-shape-method-54 s5-0) + (pusher-init s5-0) (let ((v1-10 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) (set! (-> v1-10 prim-core collide-as) (collide-spec pusher)) (set! (-> v1-10 prim-core collide-with) (collide-spec jak bot enemy hit-by-others-list player-list)) diff --git a/test/decompiler/reference/jak2/levels/common/guard-projectile_REF.gc b/test/decompiler/reference/jak2/levels/common/guard-projectile_REF.gc index 96937a4bcf..33525b33ac 100644 --- a/test/decompiler/reference/jak2/levels/common/guard-projectile_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/guard-projectile_REF.gc @@ -610,8 +610,8 @@ ) ) ) - (when (logtest? (-> s5-0 status) (cshape-moving-flags t-surface)) - (if (logtest? (-> arg0 root-override status) (cshape-moving-flags t-act)) + (when (logtest? (-> s5-0 status) (collide-status touch-surface)) + (if (logtest? (-> arg0 root-override status) (collide-status touch-actor)) (set! (-> arg0 hit-actor?) #t) ) (go (method-of-object arg0 impact)) @@ -624,8 +624,10 @@ ;; definition for method 38 of type guard-shot (defmethod made-impact? guard-shot ((obj guard-shot)) "TODO - queries the collision cache, return true/false" - (let ((v1-0 (-> obj root-override))) - (let ((a0-1 (new 'stack-no-clear 'collide-query))) + (let ((v1-0 (-> obj root-override)) + (t1-0 (new 'stack-no-clear 'collide-query)) + ) + (let ((a0-1 t1-0)) (set! (-> a0-1 radius) (-> v1-0 root-prim prim-core world-sphere w)) (set! (-> a0-1 collide-with) (-> v1-0 root-prim prim-core collide-with)) (set! (-> a0-1 ignore-process0) obj) @@ -633,8 +635,8 @@ (set! (-> a0-1 ignore-pat) (-> v1-0 pat-ignore-mask)) (set! (-> a0-1 action-mask) (collide-action solid)) ) - (when (collide-shape-moving-method-65 v1-0 (-> v1-0 transv) -6144.0 0.0 -2048.0) - (if (logtest? (-> obj root-override status) (cshape-moving-flags t-act)) + (when (fill-and-try-snap-to-surface v1-0 (-> v1-0 transv) -6144.0 0.0 -2048.0 t1-0) + (if (logtest? (-> obj root-override status) (collide-status touch-actor)) (set! (-> obj hit-actor?) #t) ) #t @@ -649,9 +651,11 @@ (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) - (the-as (function control-info collide-query vector vector cshape-moving-flags) cshape-reaction-just-move) + (the-as (function control-info collide-query vector vector collide-status) cshape-reaction-just-move) + ) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (set! (-> s5-0 no-reaction) nothing) (set! (-> s5-0 penetrate-using) (penetrate enemy-yellow-shot)) (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) (set! (-> s5-0 total-prims) (the-as uint 3)) @@ -766,7 +770,9 @@ (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) projectile-bounce-reaction) - (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) (set! (-> s5-0 penetrate-using) (penetrate explode)) (let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) (set! (-> v1-7 prim-core action) (collide-action solid)) @@ -842,10 +848,10 @@ (let* ((a2-0 (-> obj root-override)) (v1-0 (-> a2-0 status)) ) - (if (logtest? v1-0 (cshape-moving-flags t-surface)) + (if (logtest? v1-0 (collide-status touch-surface)) (vector-float*! (-> a2-0 transv) (-> a2-0 transv) 0.2) ) - (when (and (logtest? v1-0 (cshape-moving-flags csmf11)) + (when (and (logtest? v1-0 (collide-status impact-surface)) (>= (- (-> self clock frame-counter) (-> obj played-bounce-time)) (seconds 0.3)) ) (set! (-> obj played-bounce-time) (-> self clock frame-counter)) @@ -1026,10 +1032,10 @@ ;; definition for method 38 of type guard-lazer-shot (defmethod made-impact? guard-lazer-shot ((obj guard-lazer-shot)) "TODO - queries the collision cache, return true/false" - (let ((gp-0 (-> obj root-override))) - (let* ((s5-0 (new 'stack-no-clear 'collide-query)) - (v1-0 s5-0) - ) + (let ((gp-0 (-> obj root-override)) + (s5-0 (new 'stack-no-clear 'collide-query)) + ) + (let ((v1-0 s5-0)) (set! (-> v1-0 radius) (-> gp-0 root-prim prim-core world-sphere w)) (set! (-> v1-0 collide-with) (-> gp-0 root-prim prim-core collide-with)) (set! (-> v1-0 ignore-process0) obj) @@ -1042,7 +1048,7 @@ (let* ((s4-1 (vector-! (new 'stack-no-clear 'vector) (-> gp-0 trans) (get-trans (the-as process-focusable a0-2) 3))) (f0-2 (- (vector-length s4-1))) ) - (collide-shape-moving-method-65 gp-0 s4-1 f0-2 0.0 -3072.0) + (fill-and-try-snap-to-surface gp-0 s4-1 f0-2 0.0 -3072.0 s5-0) ) ) ) @@ -1053,7 +1059,7 @@ ;; WARN: Return type mismatch int vs none. (defun guard-lazer-shot-move ((arg0 guard-lazer-shot)) (projectile-move-fill-line-sphere arg0) - (if (logtest? (-> arg0 root-override status) (cshape-moving-flags t-surface)) + (if (logtest? (-> arg0 root-override status) (collide-status touch-surface)) (go (method-of-object arg0 impact)) ) 0 @@ -1067,7 +1073,9 @@ (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) - (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) (set! (-> s5-0 penetrate-using) (penetrate enemy-yellow-shot)) (let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) (set! (-> v1-7 prim-core collide-as) (collide-spec projectile)) @@ -1122,7 +1130,3 @@ 0 (none) ) - - - - diff --git a/test/decompiler/reference/jak2/levels/common/metalhead-projectile_REF.gc b/test/decompiler/reference/jak2/levels/common/metalhead-projectile_REF.gc index dfc2b0327e..98e084e4ea 100644 --- a/test/decompiler/reference/jak2/levels/common/metalhead-projectile_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/metalhead-projectile_REF.gc @@ -534,7 +534,7 @@ ) ) ) - (if (logtest? (-> s5-0 status) (cshape-moving-flags t-surface)) + (if (logtest? (-> s5-0 status) (collide-status touch-surface)) (go (method-of-object arg0 impact)) ) ) @@ -549,9 +549,11 @@ (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) - (the-as (function control-info collide-query vector vector cshape-moving-flags) cshape-reaction-just-move) + (the-as (function control-info collide-query vector vector collide-status) cshape-reaction-just-move) + ) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (set! (-> s5-0 no-reaction) nothing) (set! (-> s5-0 penetrate-using) (penetrate enemy-yellow-shot)) (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) (set! (-> s5-0 total-prims) (the-as uint 3)) @@ -869,7 +871,7 @@ ) (set! (-> v1-1 prim-core collide-as) (collide-spec enemy)) ) - (collide-shape-method-46 (-> self root-override)) + (update-transforms (-> self root-override)) (let ((a1-0 (new 'stack-no-clear 'overlaps-others-params))) (set! (-> a1-0 options) (overlaps-others-options)) (set! (-> a1-0 collide-with-filter) (the-as collide-spec -1)) @@ -919,7 +921,7 @@ (go (method-of-object arg0 impact)) ) ) - (if (logtest? (-> arg0 root-override status) (cshape-moving-flags t-surface)) + (if (logtest? (-> arg0 root-override status) (collide-status touch-surface)) (go (method-of-object arg0 impact)) ) 0 @@ -955,9 +957,11 @@ (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) - (the-as (function control-info collide-query vector vector cshape-moving-flags) gren-cshape-reaction-canister) + (the-as (function control-info collide-query vector vector collide-status) gren-cshape-reaction-canister) + ) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) - (set! (-> s5-0 no-reaction) nothing) (set! (-> s5-0 penetrate-using) (penetrate enemy-dark-shot)) (let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) (set! (-> v1-7 prim-core collide-as) (collide-spec projectile)) @@ -1031,7 +1035,3 @@ (the-as (pointer metalhead-grenade-shot) (spawn-projectile metalhead-shot gp-0 arg0 *default-dead-pool*)) ) ) - - - - diff --git a/test/offline/config/jak2/config.jsonc b/test/offline/config/jak2/config.jsonc index f5c992ec4c..18cc3c3fac 100644 --- a/test/offline/config/jak2/config.jsonc +++ b/test/offline/config/jak2/config.jsonc @@ -190,6 +190,16 @@ "(method 18 ocean)", "check-normals", // ocean-texture + // collide-shape + "(method 18 collide-shape-prim-group)", + "(method 19 collide-shape-prim)", + "(method 36 collide-shape)", + "(method 12 collide-shape-prim-group)", + "(method 13 collide-shape-prim)", + "collide-shape-draw-debug-marks", + + + "i-hopefully-will-never-exist-dont-add-anything-after-me-please" ],