Skip to content

Commit

Permalink
[jak3] Fix crash with volcano platforms (#3676)
Browse files Browse the repository at this point in the history
Ended up being a simple fix to a stack type in rigid-body.

Co-authored-by: water111 <[email protected]>
  • Loading branch information
water111 and water111 authored Sep 22, 2024
1 parent 4e33746 commit f60a155
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
6 changes: 6 additions & 0 deletions decompiler/config/jak3/all-types.gc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion decompiler/config/jak3/ntsc_v1/stack_structures.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -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"]],
Expand Down
14 changes: 10 additions & 4 deletions goal_src/jak3/engine/physics/rigid-body.gc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)))
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f60a155

Please sign in to comment.