[jak3] Fix crash in subrails (#3863)

After the change to vector ops, subrails was crashing. This fixes the
crash by fixing a stack type and also marks those new vector op
functions as inline.

Co-authored-by: water111 <awaterford1111445@gmail.com>
This commit is contained in:
water111
2025-02-16 17:40:23 -05:00
committed by GitHub
parent af9a8dd7f1
commit 23118be428
4 changed files with 12 additions and 7 deletions
@@ -1883,7 +1883,7 @@
],
"(method 97 h-sled)": [
[16, "collide-query"],
[560, ["inline-array", "vector", 1]],
[560, ["inline-array", "matrix", 1]],
[624, "vector"]
],
"(method 152 h-sled)": [[16, "comb-sentry-stack-var0"]],
+5
View File
@@ -9,6 +9,7 @@
(defun vector-cross! ((arg0 vector) (arg1 vector) (arg2 vector))
"Compute the cross product. The w component is set to junk."
(declare (inline))
(rlet ((acc :class vf)
(vf1 :class vf)
(vf2 :class vf)
@@ -62,6 +63,7 @@
(defun vector*! ((arg0 vector) (arg1 vector) (arg2 vector))
"Elementwise product. Set w = 1."
(declare (inline))
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
@@ -79,6 +81,7 @@
(defun vector+*! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 float))
"set arg0 = arg1 + (arg3 * arg2). The w component will be set to 1."
(declare (inline))
(rlet ((acc :class vf)
(vf0 :class vf)
(vf4 :class vf)
@@ -100,6 +103,7 @@
(defun vector-*! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 float))
"Set arg0 = arg1 - (arg3 * arg2). The w component will be set to 1."
(declare (inline))
(rlet ((acc :class vf)
(vf0 :class vf)
(vf4 :class vf)
@@ -194,6 +198,7 @@
(defun vector+float*! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 float))
"arg0 = arg1 + arg2 * arg3."
(declare (inline))
(rlet ((acc :class vf)
(vf0 :class vf)
(vf1 :class vf)
+3 -3
View File
@@ -1483,9 +1483,9 @@
(vector-normalize! (-> this side-dir) 1.0)
)
(when (logtest? (-> this v-flags) (vehicle-flag on-ground))
(let ((s2-1 (new 'stack-no-clear 'inline-array 'vector 1)))
(matrix-from-two-vectors! (the-as matrix (-> s2-1 0)) (-> this prev-tunnel-dir) (-> this tunnel-dir))
(vector-rotate*! (-> s3-0 lin-momentum) (-> s3-0 lin-momentum) (the-as matrix (-> s2-1 0)))
(let ((s2-1 (new 'stack-no-clear 'inline-array 'matrix 1)))
(matrix-from-two-vectors! (-> s2-1 0) (-> this prev-tunnel-dir) (-> this tunnel-dir))
(vector-rotate*! (-> s3-0 lin-momentum) (-> s3-0 lin-momentum) (-> s2-1 0))
)
(init-velocities! (-> this rbody))
)
+3 -3
View File
@@ -1676,9 +1676,9 @@
(vector-normalize! (-> this side-dir) 1.0)
)
(when (logtest? (-> this v-flags) (vehicle-flag on-ground))
(let ((s2-1 (new 'stack-no-clear 'inline-array 'vector 1)))
(matrix-from-two-vectors! (the-as matrix (-> s2-1 0)) (-> this prev-tunnel-dir) (-> this tunnel-dir))
(vector-rotate*! (-> s3-0 lin-momentum) (-> s3-0 lin-momentum) (the-as matrix (-> s2-1 0)))
(let ((s2-1 (new 'stack-no-clear 'inline-array 'matrix 1)))
(matrix-from-two-vectors! (-> s2-1 0) (-> this prev-tunnel-dir) (-> this tunnel-dir))
(vector-rotate*! (-> s3-0 lin-momentum) (-> s3-0 lin-momentum) (-> s2-1 0))
)
(init-velocities! (-> this rbody))
)