diff --git a/decompiler/config/jak3/all-types.gc b/decompiler/config/jak3/all-types.gc index 6f7e883f3..24dede393 100644 --- a/decompiler/config/jak3/all-types.gc +++ b/decompiler/config/jak3/all-types.gc @@ -42180,6 +42180,12 @@ ;; rigid-body ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(deftype rigid-body-stack (structure) + ((vec vector :inline) + (mat matrix :inline) + ) + ) + (deftype rigid-body-work (structure) ((max-ang-momentum float :offset-assert 0) (max-ang-velocity float :offset-assert 4) diff --git a/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc b/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc index d230162e8..a3a4667eb 100644 --- a/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc +++ b/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc @@ -429,7 +429,7 @@ "(method 22 rigid-body-control)": [[16, ["inline-array", "vector", 2]]], "(method 23 rigid-body-control)": [[16, ["inline-array", "vector", 2]]], "(method 24 rigid-body-control)": [[16, ["inline-array", "vector", 2]]], - "(method 28 rigid-body-control)": [[16, "rigid-body-impact"]], + "(method 28 rigid-body-control)": [[16, "rigid-body-stack"]], "(method 50 rigid-body-object)": [[16, "rigid-body-impact"]], "(method 51 rigid-body-object)": [[16, "rigid-body-impact"]], "ptest": [[16, "vector"]], diff --git a/goal_src/jak3/engine/physics/rigid-body.gc b/goal_src/jak3/engine/physics/rigid-body.gc index d23a6745c..a184d0ad8 100644 --- a/goal_src/jak3/engine/physics/rigid-body.gc +++ b/goal_src/jak3/engine/physics/rigid-body.gc @@ -5,6 +5,12 @@ ;; name in dgo: rigid-body ;; dgos: GAME +(deftype rigid-body-stack (structure) + ((vec vector :inline) + (mat matrix :inline) + ) + ) + ;; DECOMP BEGINS (deftype rigid-body-work (structure) @@ -92,10 +98,10 @@ ) (defmethod rigid-body-control-method-28 ((this rigid-body-control) (arg0 vector) (arg1 quaternion)) - (let ((s3-0 (new 'stack-no-clear 'rigid-body-impact))) - (quaternion->matrix (the-as matrix (-> s3-0 normal)) arg1) - (vector-rotate*! (-> s3-0 point) (-> this info cm-offset-joint) (the-as matrix (-> s3-0 normal))) - (vector+! (-> this position) arg0 (-> s3-0 point)) + (let ((s3-0 (new 'stack-no-clear 'rigid-body-stack))) + (quaternion->matrix (-> s3-0 mat) arg1) + (vector-rotate*! (-> s3-0 vec) (-> this info cm-offset-joint) (-> s3-0 mat)) + (vector+! (-> this position) arg0 (-> s3-0 vec)) ) (quaternion-copy! (the-as quaternion (-> this rot)) arg1) (quaternion-normalize! (the-as quaternion (-> this rot))) diff --git a/test/decompiler/reference/jak3/engine/physics/rigid-body_REF.gc b/test/decompiler/reference/jak3/engine/physics/rigid-body_REF.gc index e7293aec4..1bc0d6def 100644 --- a/test/decompiler/reference/jak3/engine/physics/rigid-body_REF.gc +++ b/test/decompiler/reference/jak3/engine/physics/rigid-body_REF.gc @@ -114,10 +114,10 @@ ;; definition for method 28 of type rigid-body-control ;; WARN: Return type mismatch int vs none. (defmethod rigid-body-control-method-28 ((this rigid-body-control) (arg0 vector) (arg1 quaternion)) - (let ((s3-0 (new 'stack-no-clear 'rigid-body-impact))) - (quaternion->matrix (the-as matrix (-> s3-0 normal)) arg1) - (vector-rotate*! (-> s3-0 point) (-> this info cm-offset-joint) (the-as matrix (-> s3-0 normal))) - (vector+! (-> this position) arg0 (-> s3-0 point)) + (let ((s3-0 (new 'stack-no-clear 'rigid-body-stack))) + (quaternion->matrix (-> s3-0 mat) arg1) + (vector-rotate*! (-> s3-0 vec) (-> this info cm-offset-joint) (-> s3-0 mat)) + (vector+! (-> this position) arg0 (-> s3-0 vec)) ) (quaternion-copy! (the-as quaternion (-> this rot)) arg1) (quaternion-normalize! (the-as quaternion (-> this rot)))