Files
jak-project/test/decompiler/reference/jak2/engine/physics/rigid-body_REF.gc
T
Tyler Wilding e975eab15a decompiler: Apply docstring indentation fix to all game versions (#3614)
Previously was only applying to game versions above Jak 2, Fixes #3342
2024-07-29 21:57:07 -04:00

1571 lines
56 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; definition of type rigid-body-work
(deftype rigid-body-work (structure)
((max-ang-momentum float)
(max-ang-velocity float)
)
)
;; definition for method 3 of type rigid-body-work
(defmethod inspect ((this rigid-body-work))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this 'rigid-body-work)
(format #t "~1Tmax-ang-momentum: ~f~%" (-> this max-ang-momentum))
(format #t "~1Tmax-ang-velocity: ~f~%" (-> this max-ang-velocity))
(label cfg-4)
this
)
;; definition for symbol *rigid-body-work*, type rigid-body-work
(define *rigid-body-work* (new 'static 'rigid-body-work))
;; definition for method 0 of type rigid-body-control
(defmethod new rigid-body-control ((allocation symbol) (type-to-make type) (arg0 process))
(let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
(set! (-> v0-0 process) arg0)
v0-0
)
)
;; definition for method 7 of type rigid-body-control
(defmethod relocate ((this rigid-body-control) (offset int))
(&+! (-> this process) offset)
this
)
;; definition for method 9 of type rigid-body-info
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-info-method-9 ((this rigid-body-info))
(let ((f24-0 (-> this mass))
(f28-0 (-> this inertial-tensor-box 0))
(f30-0 (-> this inertial-tensor-box 1))
(f26-0 (-> this inertial-tensor-box 2))
)
(let ((f0-0 f24-0))
(set! (-> this inv-mass) (/ 1.0 f0-0))
)
(matrix-identity! (-> this inertial-tensor))
(matrix-identity! (-> this inv-inertial-tensor))
(let ((f0-4 (* 0.083333336 f24-0)))
(let* ((f1-1 f30-0)
(f1-3 (* f1-1 f1-1))
(f2-0 f26-0)
)
(set! (-> this inertial-tensor vector 0 x) (* f0-4 (+ f1-3 (* f2-0 f2-0))))
)
(let ((f1-6 f28-0))
(set! (-> this inertial-tensor vector 1 y) (* f0-4 (+ (* f1-6 f1-6) (* f26-0 f26-0))))
)
(set! (-> this inertial-tensor vector 2 z) (* f0-4 (+ (* f28-0 f28-0) (* f30-0 f30-0))))
)
)
(let ((f0-6 (-> this inertial-tensor vector 0 x)))
(set! (-> this inv-inertial-tensor vector 0 x) (/ 1.0 f0-6))
)
(let ((f0-9 (-> this inertial-tensor vector 1 y)))
(set! (-> this inv-inertial-tensor vector 1 y) (/ 1.0 f0-9))
)
(let ((f0-12 (-> this inertial-tensor vector 2 z)))
(set! (-> this inv-inertial-tensor vector 2 z) (/ 1.0 f0-12))
)
0
(none)
)
;; definition for method 16 of type rigid-body
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defmethod clear-force-torque! ((this rigid-body))
(set! (-> this force quad) (the-as uint128 0))
(set! (-> this torque quad) (the-as uint128 0))
0
(none)
)
;; definition for method 17 of type rigid-body
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defmethod clear-momentum! ((this rigid-body))
(set! (-> this lin-momentum quad) (the-as uint128 0))
(set! (-> this ang-momentum quad) (the-as uint128 0))
0
(none)
)
;; definition for method 24 of type rigid-body
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-method-24 ((this rigid-body))
(when #t
(quaternion->matrix (-> this matrix) (-> this rotation))
(let ((s5-0 (new 'stack-no-clear 'vector)))
(vector-rotate*! s5-0 (-> this info cm-offset-joint) (-> this matrix))
(vector-! (-> this matrix trans) (-> this position) s5-0)
)
)
0
(none)
)
;; definition for method 26 of type rigid-body
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-method-26 ((this rigid-body) (arg0 vector) (arg1 quaternion))
(let ((s3-0 (new 'stack-no-clear 'inline-array 'vector 8)))
(quaternion->matrix (the-as matrix (-> s3-0 1)) arg1)
(vector-rotate*! (-> s3-0 0) (-> this info cm-offset-joint) (the-as matrix (-> s3-0 1)))
(vector+! (-> this position) arg0 (-> s3-0 0))
)
(quaternion-copy! (-> this rotation) arg1)
(quaternion-normalize! (-> this rotation))
(rigid-body-method-24 this)
0
(none)
)
;; definition for method 25 of type rigid-body
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-method-25 ((this rigid-body) (arg0 rigid-body-info) (arg1 vector) (arg2 quaternion) (arg3 function))
(set! (-> this work) *rigid-body-work*)
(set! (-> this info) arg0)
(set! (-> this force-callback) (the-as (function object float none) arg3))
(rigid-body-info-method-9 (-> this info))
(let ((v1-3 this))
(set! (-> v1-3 force quad) (the-as uint128 0))
(set! (-> v1-3 torque quad) (the-as uint128 0))
)
0
(clear-momentum! this)
(rigid-body-method-26 this arg1 arg2)
(rigid-body-method-13 this)
0
(none)
)
;; definition for method 22 of type rigid-body
(defmethod rigid-body-method-22 ((this rigid-body) (arg0 vector) (arg1 vector))
(let ((v1-1 (vector-! (new 'stack-no-clear 'vector) arg0 (-> this position))))
(vector-cross! arg1 (-> this ang-velocity) v1-1)
)
(vector+! arg1 arg1 (-> this lin-velocity))
arg1
)
;; definition for function matrix-3x3-triple-transpose-product
;; INFO: Used lq/sq
(defun matrix-3x3-triple-transpose-product ((arg0 matrix) (arg1 matrix) (arg2 matrix))
(let ((s5-0 (new 'stack-no-clear 'inline-array 'matrix 3)))
(let* ((v1-0 (-> s5-0 0))
(a3-0 arg1)
(a0-1 (-> a3-0 quad 0))
(a1-1 (-> a3-0 quad 1))
(a2-1 (-> a3-0 quad 2))
(a3-1 (-> a3-0 trans quad))
)
(set! (-> v1-0 quad 0) a0-1)
(set! (-> v1-0 quad 1) a1-1)
(set! (-> v1-0 quad 2) a2-1)
(set! (-> v1-0 trans quad) a3-1)
)
(vector-reset! (-> s5-0 0 trans))
(matrix-transpose! (-> s5-0 1) (-> s5-0 0))
(matrix*! (-> s5-0 2) arg2 (-> s5-0 0))
(matrix*! arg0 (-> s5-0 1) (-> s5-0 2))
)
arg0
)
;; definition for method 12 of type rigid-body
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-method-12 ((this rigid-body) (arg0 float))
(local-vars (v1-6 float))
(rlet ((acc :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
)
(init-vf0-vector)
(let ((a2-0 (-> this lin-momentum)))
(let ((v1-0 (-> this lin-momentum)))
(let ((a0-1 (-> this force)))
(let ((a3-0 arg0))
(.mov vf7 a3-0)
)
(.lvf vf5 (&-> a0-1 quad))
)
(.lvf vf4 (&-> v1-0 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 (&-> a2-0 quad) vf6)
)
(let ((a2-1 (-> this ang-momentum)))
(let ((v1-1 (-> this ang-momentum)))
(let ((a0-2 (-> this torque)))
(let ((a1-1 arg0))
(.mov vf7 a1-1)
)
(.lvf vf5 (&-> a0-2 quad))
)
(.lvf vf4 (&-> v1-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 (&-> a2-1 quad) vf6)
)
(let* ((f0-3 (* 500000000.0 (-> this info mass)))
(f1-1 f0-3)
(f1-3 (* f1-1 f1-1))
)
(.lvf vf1 (&-> (-> this ang-momentum) quad))
(.add.w.vf vf2 vf0 vf0 :mask #b1)
(.mul.vf vf1 vf1 vf1)
(.mul.x.vf acc vf2 vf1 :mask #b1)
(.add.mul.y.vf acc vf2 vf1 acc :mask #b1)
(.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1)
(.mov v1-6 vf1)
(if (< f1-3 v1-6)
(vector-normalize! (-> this ang-momentum) f0-3)
)
)
(set! (-> this force quad) (the-as uint128 0))
(set! (-> this torque quad) (the-as uint128 0))
0
0
(none)
)
)
;; definition for method 13 of type rigid-body
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-method-13 ((this rigid-body))
(let ((v1-0 (-> this info)))
(vector-float*! (-> this lin-velocity) (-> this lin-momentum) (-> v1-0 inv-mass))
(matrix-3x3-triple-transpose-product (-> this inv-i-world) (-> this matrix) (-> v1-0 inv-inertial-tensor))
)
(vector-rotate*! (-> this ang-velocity) (-> this ang-momentum) (-> this inv-i-world))
0
(none)
)
;; definition for method 14 of type rigid-body
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-method-14 ((this rigid-body) (arg0 float))
(rlet ((acc :class vf)
(vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
)
(init-vf0-vector)
(let ((a1-1 (-> this position)))
(let ((v1-0 (-> this position)))
(let ((a0-1 (-> this lin-velocity)))
(let ((a2-0 arg0))
(.mov vf7 a2-0)
)
(.lvf vf5 (&-> a0-1 quad))
)
(.lvf vf4 (&-> v1-0 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 (&-> a1-1 quad) vf6)
)
(let ((s4-0 (new 'stack-no-clear 'quaternion)))
(set! (-> (the-as vector (&-> s4-0 x)) quad) (-> this ang-velocity quad))
(set! (-> s4-0 w) 0.0)
(quaternion*! s4-0 s4-0 (-> this rotation))
(quaternion-float*! s4-0 s4-0 0.5)
(+! (-> this rotation x) (* (-> s4-0 x) arg0))
(+! (-> this rotation y) (* (-> s4-0 y) arg0))
(+! (-> this rotation z) (* (-> s4-0 z) arg0))
(+! (-> this rotation w) (* (-> s4-0 w) arg0))
)
(quaternion-normalize! (-> this rotation))
(rigid-body-method-24 this)
0
(none)
)
)
;; definition for function damping-time-adjust
(defun damping-time-adjust ((arg0 float) (arg1 float))
(let ((f0-0 0.0)
(f1-0 1.0)
(f2-2 (* (+ -1.0 arg0) arg1))
(f3-2 0.016666668)
)
(fmax f0-0 (+ f1-0 (* f2-2 (/ 1.0 f3-2))))
)
)
;; definition for method 9 of type rigid-body
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-method-9 ((this rigid-body) (arg0 collide-shape-moving) (arg1 float))
(rigid-body-method-12 this arg1)
(let ((v1-2 (-> this info)))
(let* ((a0-2 (-> this lin-momentum))
(a1-2 (-> this lin-momentum))
(f3-0 (-> v1-2 linear-damping))
(f2-0 arg1)
(f0-0 0.0)
(f1-0 1.0)
(f2-1 (* (+ -1.0 f3-0) f2-0))
(f3-2 0.016666668)
)
(vector-float*! a0-2 a1-2 (fmax f0-0 (+ f1-0 (* f2-1 (/ 1.0 f3-2)))))
)
(let* ((a0-4 (-> this ang-momentum))
(a1-3 (-> this ang-momentum))
(f3-5 (-> v1-2 angular-damping))
(f2-3 arg1)
(f0-3 0.0)
(f1-2 1.0)
(f2-4 (* (+ -1.0 f3-5) f2-3))
(f3-7 0.016666668)
)
(vector-float*! a0-4 a1-3 (fmax f0-3 (+ f1-2 (* f2-4 (/ 1.0 f3-7)))))
)
)
(rigid-body-method-13 this)
(if (logtest? (-> this flags) (rigid-body-flag enable-collision))
(collide-shape-moving-method-63 arg0 this arg1)
(rigid-body-method-14 this arg1)
)
0
(none)
)
;; definition for method 67 of type collide-shape-moving
;; WARN: Return type mismatch int vs none.
(defmethod collide-with-all-collide-cache-prims ((this collide-shape-moving) (arg0 matrix) (arg1 collide-query))
(rlet ((acc :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)
(vf8 :class vf)
)
(init-vf0-vector)
(let ((s4-0 *collide-cache*)
(s3-0 (-> this root-prim))
(s2-0 1)
)
(b! (nonzero? (-> s3-0 prim-core prim-type)) cfg-2 :delay (empty-form))
(let ((v1-2 s3-0))
(set! s3-0 (-> (the-as collide-shape-prim-group v1-2) child 0))
(set! s2-0 (the-as int (-> v1-2 specific 0)))
)
(label cfg-2)
(b! #t cfg-13 :delay (nop!))
(label cfg-3)
(+! s2-0 -1)
(let ((v1-4 -1))
(b! (!= (-> s3-0 prim-core prim-type) v1-4) cfg-12 :delay (nop!))
)
(.lvf vf5 (&-> s3-0 local-sphere quad))
(.lvf vf1 (&-> arg0 quad 0))
(.lvf vf2 (&-> arg0 quad 1))
(.lvf vf3 (&-> arg0 quad 2))
(.lvf vf4 (&-> arg0 trans quad))
(.lvf vf6 (&-> s3-0 prim-core world-sphere quad))
(.mul.x.vf acc vf1 vf5)
(.add.mul.y.vf acc vf2 vf5 acc)
(.add.mul.z.vf acc vf3 vf5 acc)
(.add.mul.w.vf vf7 vf4 vf0 acc :mask #b111)
(.sub.vf vf8 vf7 vf6 :mask #b111)
(.svf (&-> arg1 move-dist quad) vf8)
(let ((s1-0 (the-as collide-cache-prim (-> s4-0 prims))))
(countdown (s0-0 (-> s4-0 num-prims))
(when (logtest? (-> s3-0 prim-core collide-with) (-> s1-0 prim-core collide-as))
(if (>= (the-as int (-> s1-0 prim-core prim-type)) 0)
(collide-with-collide-cache-prim-mesh s3-0 arg1 s1-0)
(collide-with-collide-cache-prim-sphere s3-0 arg1 s1-0)
)
)
(&+! s1-0 48)
)
)
(label cfg-12)
(&+! s3-0 80)
(label cfg-13)
(b! (nonzero? s2-0) cfg-3 :delay (nop!))
)
0
(none)
)
)
;; definition for function transform-rigid-body-prims
(defun transform-rigid-body-prims ((arg0 collide-shape-prim) (arg1 matrix))
(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 arg0)
(a0-1 1)
)
(when (= (-> v1-0 prim-core prim-type) (prim-type group))
(let ((a0-2 (the-as collide-shape-prim-group v1-0)))
(set! v1-0 (-> a0-2 child 0))
(set! a0-1 (the-as int (-> a0-2 num-children)))
)
)
(while (nonzero? a0-1)
(+! a0-1 -1)
(.lvf vf5 (&-> v1-0 local-sphere quad))
(.lvf vf1 (&-> arg1 quad 0))
(.lvf vf2 (&-> arg1 quad 1))
(.lvf vf3 (&-> arg1 quad 2))
(.lvf vf4 (&-> arg1 trans quad))
(.mul.x.vf acc vf1 vf5)
(.add.mul.y.vf acc vf2 vf5 acc)
(.add.mul.z.vf acc vf3 vf5 acc)
(.add.mul.w.vf vf5 vf4 vf0 acc :mask #b111)
(.svf (&-> v1-0 prim-core world-sphere quad) vf5)
(&+! v1-0 80)
)
)
#f
)
)
;; definition for method 63 of type collide-shape-moving
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defmethod collide-shape-moving-method-63 ((this collide-shape-moving) (arg0 rigid-body) (arg1 float))
(local-vars (s3-0 rigid-body))
(with-pp
(rlet ((acc :class vf)
(Q :class vf)
(vf0 :class vf)
(vf6 :class vf)
(vf7 :class vf)
(vf8 :class vf)
(vf9 :class vf)
)
(init-vf0-vector)
(let ((s5-0 (new 'stack-no-clear 'rb-work)))
(set! (-> s5-0 dt) arg1)
(set! (-> s5-0 float-1) 1.0)
(set! (-> s5-0 cnt) 0)
(until (not (and (< 0.05 (-> s5-0 float-1)) (< (-> s5-0 cnt) (the-as int (-> this max-iteration-count)))))
(set! (-> s5-0 cquery best-dist) -100000000.0)
(set! (-> s5-0 cquery best-my-prim) #f)
(set! (-> s5-0 cquery num-spheres) (the-as uint #f))
(set! (-> s5-0 vec-1 quad) (-> arg0 position quad))
(quaternion-copy! (-> s5-0 quat-1) (-> arg0 rotation))
(rigid-body-method-14 arg0 (* (-> s5-0 float-1) (-> s5-0 dt)))
(mem-copy! (the-as pointer (-> s5-0 mat-1)) (the-as pointer (-> arg0 matrix)) 64)
(set! (-> arg0 position quad) (-> s5-0 vec-1 quad))
(quaternion-copy! (-> arg0 rotation) (-> s5-0 quat-1))
(rigid-body-method-24 arg0)
(transform-rigid-body-prims (-> this root-prim) (-> arg0 matrix))
(collide-with-all-collide-cache-prims this (-> s5-0 mat-1) (-> s5-0 cquery))
(let ((f30-0 (-> s5-0 cquery best-dist)))
(b! (>= f30-0 0.0) cfg-3 :delay #f)
(rigid-body-method-14 arg0 (* (-> s5-0 float-1) (-> s5-0 dt)))
(rigid-body-method-13 arg0)
(transform-rigid-body-prims (-> this root-prim) (-> arg0 matrix))
(set! (-> s5-0 float-1) 0.0)
(b! #t cfg-44 :delay (nop!))
(label cfg-3)
(update-from-step-size *touching-list* f30-0)
(rigid-body-method-14 arg0 (* (-> s5-0 float-1) (-> s5-0 dt) f30-0))
)
(rigid-body-method-13 arg0)
(transform-rigid-body-prims (-> this root-prim) (-> arg0 matrix))
(mem-copy! (the-as pointer (-> s5-0 mat-1)) (the-as pointer (-> arg0 matrix)) 64)
(set! s3-0 (the-as rigid-body #f))
(b! (not (-> s5-0 cquery num-spheres)) cfg-12 :delay (empty-form))
(let ((a0-20 (-> (the-as collide-shape-prim (-> s5-0 cquery num-spheres)) cshape process)))
(b! (zero? (-> a0-20 rbody)) cfg-12 :delay (empty-form))
(set! s3-0 (-> a0-20 rbody state))
(b! (not (logtest? (-> s3-0 flags) (rigid-body-flag active))) cfg-11 :delay (nop!))
(b! (logtest? (-> s3-0 flags) (rigid-body-flag enable-physics)) cfg-10 :delay (empty-form))
(send-event a0-20 'enable-physics)
)
(label cfg-10)
(b! #t cfg-12 :delay (nop!))
(label cfg-11)
(set! s3-0 (the-as rigid-body #f))
(label cfg-12)
(let ((v1-37 (-> s5-0 cquery best-my-prim)))
(.lvf vf7 (&-> (-> s5-0 cquery) best-other-tri intersect quad))
(.lvf vf6 (&-> v1-37 prim-core world-sphere quad))
(.sub.vf vf8 vf6 vf7)
(.mul.vf vf9 vf8 vf8 :mask #b111)
(.mul.x.vf acc vf0 vf9 :mask #b1000)
(.add.mul.y.vf acc vf0 vf9 acc :mask #b1000)
(.add.mul.z.vf vf9 vf0 vf9 acc :mask #b1000)
(.isqrt.vf Q vf0 vf9 :fsf #b11 :ftf #b11)
(.mov.vf vf8 vf0 :mask #b1000)
(.wait.vf)
(.mul.vf vf8 vf8 Q :mask #b111)
(.nop.vf)
(.nop.vf)
(.nop.vf)
(.svf (&-> s5-0 vec-5 quad) vf8)
(.svf (&-> s5-0 vec-2 quad) vf7)
(set! (-> s5-0 prim-id) (the-as int (-> v1-37 prim-id)))
)
(rigid-body-method-22 arg0 (-> s5-0 vec-2) (-> s5-0 vec-3))
(b! (not s3-0) cfg-14 :delay (empty-form))
(rigid-body-method-13 s3-0)
(rigid-body-method-22 s3-0 (-> s5-0 vec-2) (-> s5-0 vec-4))
(vector-! (-> s5-0 vec-3) (-> s5-0 vec-3) (-> s5-0 vec-4))
(label cfg-14)
(set! (-> s5-0 float-4) 0.0)
(set! (-> s5-0 float-2) (+ -409.6 (vector-dot (-> s5-0 vec-3) (-> s5-0 vec-5))))
(set! (-> s5-0 float-3) 0.0)
(b! (>= (-> s5-0 float-2) 0.0) cfg-39)
(vector-! (-> s5-0 vec-6) (-> s5-0 vec-2) (-> arg0 position))
(vector-cross! (-> s5-0 vec-7) (-> s5-0 vec-6) (-> s5-0 vec-5))
(vector-rotate*! (-> s5-0 vec-7) (-> s5-0 vec-7) (-> arg0 inv-i-world))
(vector-cross! (-> s5-0 vec-7) (-> s5-0 vec-7) (-> s5-0 vec-6))
(set! (-> s5-0 float-3) (+ (-> arg0 info inv-mass) (vector-dot (-> s5-0 vec-5) (-> s5-0 vec-7))))
(let ((f30-1 (-> arg0 info bounce-factor)))
(cond
(s3-0
(vector-! (-> s5-0 vec-6) (-> s5-0 vec-2) (-> s3-0 position))
(vector-cross! (-> s5-0 vec-7) (-> s5-0 vec-6) (-> s5-0 vec-5))
(vector-rotate*! (-> s5-0 vec-7) (-> s5-0 vec-7) (-> s3-0 inv-i-world))
(vector-cross! (-> s5-0 vec-7) (-> s5-0 vec-7) (-> s5-0 vec-6))
(+! (-> s5-0 float-3) (+ (-> s3-0 info inv-mass) (vector-dot (-> s5-0 vec-5) (-> s5-0 vec-7))))
(set! f30-1
(fmax
(fmax f30-1 (-> s3-0 info bounce-factor))
(* (-> arg0 info bounce-mult-factor) (-> s3-0 info bounce-mult-factor))
)
)
)
(else
)
)
(set! (-> s5-0 float-4) (* (+ 1.0 f30-1) (/ (- (-> s5-0 float-2)) (-> s5-0 float-3))))
)
(vector-float*! (-> s5-0 vec-8) (-> s5-0 vec-5) (-> s5-0 float-4))
(let ((f30-2 (-> arg0 info mass)))
(if s3-0
(set! f30-2 (fmin f30-2 (-> s3-0 info mass)))
)
(vector+float*! (-> s5-0 vec-9) (-> s5-0 vec-3) (-> s5-0 vec-5) (- (-> s5-0 float-2)))
(vector-normalize! (-> s5-0 vec-9) 1.0)
(let ((f0-31
(* -1.0
(fmin
(* (vector-dot (-> s5-0 vec-9) (-> s5-0 vec-3)) f30-2)
(* (-> arg0 info friction-factor) (-> s5-0 float-4))
)
)
)
)
(vector+float*! (-> s5-0 vec-8) (-> s5-0 vec-8) (-> s5-0 vec-9) f0-31)
)
)
(rigid-body-method-18 arg0 (-> s5-0 vec-2) (-> s5-0 vec-8))
(when s3-0
(vector-float*! (-> s5-0 vec-8) (-> s5-0 vec-8) -1.0)
(rigid-body-method-18 s3-0 (-> s5-0 vec-2) (-> s5-0 vec-8))
)
(rigid-body-method-12 arg0 1.0)
(rigid-body-method-13 arg0)
(let ((f30-3 (-> s5-0 cquery best-dist)))
(when (< f30-3 0.0001)
(vector+float*! (-> arg0 position) (-> arg0 position) (-> s5-0 vec-5) 40.96)
(rigid-body-method-24 arg0)
)
(set! (-> s5-0 float-1) (- (-> s5-0 float-1) (* f30-3 (-> s5-0 float-1))))
)
(set! (-> s5-0 pat-id) (-> s5-0 cquery best-other-tri pat))
(let ((v1-103 pp))
(let ((a0-49 (the-as object (-> s5-0 cquery num-spheres))))
(if (the-as uint a0-49)
(set! v1-103 (-> (the-as collide-shape-prim-mesh a0-49) cshape process))
)
)
(set! (-> s5-0 rbody) s3-0)
(send-event (-> this process) 'impact-impulse :from v1-103 (-> s5-0 vec-2))
)
(b! (not s3-0) cfg-32 :delay (empty-form))
(rigid-body-method-12 s3-0 1.0)
(rigid-body-method-13 s3-0)
(let ((s2-0 (-> (the-as collide-shape-prim-mesh (-> s5-0 cquery num-spheres)) cshape)))
(transform-rigid-body-prims (-> s2-0 root-prim) (-> s3-0 matrix))
(vector-float*! (-> s5-0 vec-5) (-> s5-0 vec-5) -1.0)
(vector-float*! (-> s5-0 vec-3) (-> s5-0 vec-3) -1.0)
(set! (-> s5-0 rbody) arg0)
(send-event (-> s2-0 process) 'impact-impulse :from (-> this process) (-> s5-0 vec-2))
)
(label cfg-32)
(+! (-> s5-0 cnt) 1)
)
(b! #t cfg-42 :delay (nop!))
(label cfg-39)
(b! (not s3-0) cfg-41 :delay (empty-form))
(set! (-> arg0 blocked-by)
(the-as rigid-body-object (-> (the-as collide-shape-prim-mesh (-> s5-0 cquery num-spheres)) cshape process))
)
0
(label cfg-41)
(vector+float*! (-> arg0 position) (-> arg0 position) (-> s5-0 vec-5) 40.96)
(rigid-body-method-24 arg0)
0
(label cfg-42)
(when (< 0.0 (-> s5-0 float-1))
(rigid-body-method-14 arg0 (* (-> s5-0 float-1) (-> s5-0 dt)))
(rigid-body-method-13 arg0)
(transform-rigid-body-prims (-> this root-prim) (-> arg0 matrix))
(set! (-> s5-0 float-1) 0.0)
)
(label cfg-44)
(let ((f0-47 (* (- 1.0 (-> s5-0 float-1)) (-> s5-0 dt))))
(set! (-> arg0 time-remaining) (- (-> arg0 time-remaining) f0-47))
)
)
0
(none)
)
)
)
;; definition for method 15 of type rigid-body
;; INFO: Used lq/sq
;; WARN: Stack slot offset 632 signed mismatch
;; WARN: Stack slot offset 632 signed mismatch
;; WARN: Stack slot offset 632 signed mismatch
;; WARN: Stack slot offset 632 signed mismatch
;; WARN: Stack slot offset 632 signed mismatch
;; WARN: Stack slot offset 632 signed mismatch
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-method-15 ((this rigid-body) (arg0 collide-shape-moving) (arg1 float))
(local-vars
(sv-576 vector)
(sv-624 vector)
(sv-628 vector)
(sv-632 float)
(sv-704 vector)
(sv-708 vector)
(sv-712 vector)
(sv-716 vector)
)
(rlet ((acc :class vf)
(vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
)
(init-vf0-vector)
(-> this work)
(let ((s4-0 (-> this info))
(s3-0 (new 'stack-no-clear 'collide-query))
(f30-0 1.0)
(s2-0 0)
)
(set! (-> s3-0 start-pos quad) (-> this position quad))
(let ((v1-3 s3-0))
(set! (-> v1-3 radius) (-> arg0 root-prim prim-core world-sphere w))
(set! (-> v1-3 collide-with) (-> arg0 root-prim prim-core collide-with))
(set! (-> v1-3 ignore-process0) #f)
(set! (-> v1-3 ignore-process1) #f)
(set! (-> v1-3 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1))
(set! (-> v1-3 action-mask) (collide-action solid))
)
(until (>= s2-0 4)
(vector-float*! (-> s3-0 move-dist) (-> this lin-velocity) (* f30-0 arg1))
(let ((f28-0 (probe-using-line-sphere *collide-cache* s3-0)))
(b! (>= f28-0 0.0) cfg-3)
(rigid-body-method-14 this (* f30-0 arg1))
(b! #t cfg-9 :delay (nop!))
(label cfg-3)
(rigid-body-method-14 this (* f30-0 arg1 f28-0))
(set! sv-576 (new 'stack-no-clear 'vector))
(set! sv-624 (new 'stack-no-clear 'vector))
(set! sv-628 (new 'stack-no-clear 'vector))
(vector-! sv-576 (-> this position) (-> s3-0 best-other-tri intersect))
(vector-normalize! sv-576 1.0)
(set! sv-632 (vector-dot sv-576 (-> this lin-momentum)))
(when (< sv-632 0.0)
(vector-float*! sv-624 sv-576 sv-632)
(vector-! sv-628 (-> this lin-momentum) sv-624)
(vector-float*! sv-628 sv-628 (- 1.0 (-> s4-0 friction-factor)))
(vector-float*! sv-624 sv-624 (- (-> s4-0 bounce-factor)))
(vector+! (-> this lin-momentum) sv-628 sv-624)
(vector-float*! (-> this lin-velocity) (-> this lin-momentum) (-> s4-0 inv-mass))
)
(b! (>= f28-0 0.0001) cfg-7 :delay #f)
(vector+float*! (-> this position) (-> this position) sv-576 409.6)
(label cfg-7)
(set! sv-704 (new 'stack-no-clear 'vector))
(set! sv-708 (new 'stack-no-clear 'vector))
(set! sv-712 (new 'stack-no-clear 'vector))
(set! sv-716 (new 'stack-no-clear 'vector))
(vector-! sv-704 (-> s3-0 best-other-tri intersect) (-> this position))
(rigid-body-method-22 this (-> s3-0 best-other-tri intersect) sv-708)
(vector+float*! sv-708 sv-708 sv-576 (- (vector-dot sv-708 sv-576)))
(vector-float*! sv-712 sv-708 (* -1.0 (-> s4-0 mass) (-> s4-0 friction-factor)))
(vector-cross! sv-716 sv-704 sv-712)
(let ((a1-20 (-> this ang-momentum)))
(let ((v1-46 (-> this ang-momentum)))
(let ((a0-27 sv-716))
(let ((a2-6 1.0))
(.mov vf7 a2-6)
)
(.lvf vf5 (&-> a0-27 quad))
)
(.lvf vf4 (&-> v1-46 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 (&-> a1-20 quad) vf6)
)
(vector-rotate*! (-> this ang-velocity) (-> this ang-momentum) (-> this inv-i-world))
(set! f30-0 (* f30-0 (- 1.0 f28-0)))
)
(+! s2-0 1)
)
)
(label cfg-9)
0
0
(none)
)
)
;; definition for method 18 of type rigid-body
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-method-18 ((this rigid-body) (arg0 vector) (arg1 vector))
(vector+! (-> this force) (-> this force) arg1)
(let ((a3-1 (new 'stack-no-clear 'vector))
(v1-1 (new 'stack-no-clear 'vector))
)
(vector-! a3-1 arg0 (-> this position))
(vector-cross! v1-1 a3-1 arg1)
(vector+! (-> this torque) (-> this torque) v1-1)
)
0
(none)
)
;; definition for method 21 of type rigid-body
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-method-21 ((this rigid-body) (arg0 vector) (arg1 vector) (arg2 float))
(vector+! (-> this force) (-> this force) arg1)
(let* ((t0-2 (vector-! (new 'stack-no-clear 'vector) arg0 (-> this position)))
(v1-3 (vector-cross! (new 'stack-no-clear 'vector) t0-2 arg1))
)
(let ((f0-0 (vector-length t0-2)))
(if (< arg2 f0-0)
(vector-float*! v1-3 v1-3 (/ arg2 f0-0))
)
)
(vector+! (-> this torque) (-> this torque) v1-3)
)
0
(none)
)
;; definition for method 19 of type rigid-body
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-method-19 ((this rigid-body) (arg0 vector) (arg1 vector))
(let ((s5-0 (new 'stack-no-clear 'vector))
(s4-0 (new 'stack-no-clear 'vector))
)
(-> this work)
(vector-rotate*! s4-0 arg1 (-> this matrix))
(vector-rotate*! s5-0 arg0 (-> this matrix))
(vector+! s5-0 s5-0 (-> this position))
(rigid-body-method-18 this s5-0 s4-0)
)
0
(none)
)
;; definition for method 20 of type rigid-body
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-method-20 ((this rigid-body) (arg0 vector))
(vector+! (-> this force) (-> this force) arg0)
0
(none)
)
;; definition for method 23 of type rigid-body
(defmethod rigid-body-method-23 ((this rigid-body) (arg0 vector))
(let ((gp-0 (new 'stack-no-clear 'vector)))
(vector-rotate*! gp-0 (-> this info cm-offset-joint) (-> this matrix))
(vector-! arg0 (-> this position) gp-0)
)
arg0
)
;; definition for method 28 of type rigid-body
;; WARN: Return type mismatch int vs none.
(defmethod print-force-torque ((this rigid-body) (arg0 object))
(format arg0 " force ~M ~M ~M" (-> this force x) (-> this force y) (-> this force z))
(format arg0 " torque ~M ~M ~M~%" (-> this torque x) (-> this torque y) (-> this torque z))
0
(none)
)
;; definition for method 30 of type rigid-body
;; WARN: Return type mismatch int vs none.
(defmethod print-momentum ((this rigid-body) (arg0 object))
(format arg0 " lin-mom ~M ~M ~M" (-> this lin-momentum x) (-> this lin-momentum y) (-> this lin-momentum z))
(format
arg0
" ang-mom ~M ~M ~M~%"
(-> this ang-momentum x)
(-> this ang-momentum y)
(-> this ang-momentum z)
)
0
(none)
)
;; definition for method 31 of type rigid-body
;; WARN: Return type mismatch int vs none.
(defmethod print-velocity ((this rigid-body) (arg0 object))
(format arg0 " lin-vel ~M ~M ~M" (-> this lin-velocity x) (-> this lin-velocity y) (-> this lin-velocity z))
(format
arg0
" ang-vel ~f ~f ~f~%"
(-> this ang-velocity x)
(-> this ang-velocity y)
(-> this ang-velocity z)
)
0
(none)
)
;; definition for method 29 of type rigid-body
;; WARN: Return type mismatch int vs none.
(defmethod print-position-rotation ((this rigid-body) (arg0 object))
(format arg0 " position ~M ~M ~M" (-> this position x) (-> this position y) (-> this position z))
(format
arg0
" rotation ~f ~f ~f ~f~%"
(-> this rotation x)
(-> this rotation y)
(-> this rotation z)
(-> this rotation w)
)
0
(none)
)
;; definition for method 27 of type rigid-body
;; WARN: Return type mismatch int vs none.
(defmethod print-physics ((this rigid-body) (arg0 object))
(print-force-torque this arg0)
(print-position-rotation this arg0)
(print-momentum this arg0)
(print-velocity this arg0)
0
(none)
)
;; definition for method 10 of type rigid-body-control
;; WARN: Return type mismatch int vs object.
(defmethod rigid-body-control-method-10 ((this rigid-body-control) (arg0 rigid-body-object) (arg1 float) (arg2 float))
(let* ((s4-1 (max 1 (min 4 (+ (the int (* 0.9999 (/ arg1 arg2))) 1))))
(f30-0 (/ arg1 (the float s4-1)))
(s3-0 (-> this state force-callback))
)
(while (nonzero? s4-1)
(+! s4-1 -1)
(s3-0 arg0 f30-0)
(let ((v1-2 this)
(a1-2 (-> arg0 root))
(f0-4 f30-0)
)
(rigid-body-method-9 (-> v1-2 state) a1-2 f0-4)
)
)
)
0
)
;; definition for method 11 of type rigid-body
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-method-11 ((this rigid-body) (arg0 collide-shape-moving))
(quaternion-copy! (-> arg0 quat) (-> this rotation))
(rigid-body-method-23 this (-> arg0 trans))
(set! (-> arg0 transv quad) (-> this lin-velocity quad))
0
(none)
)
;; definition for method 26 of type rigid-body-object
(defmethod get-inv-mass ((this rigid-body-object))
(-> this info info inv-mass)
)
;; definition for method 35 of type rigid-body-object
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-object-method-35 ((this rigid-body-object))
(let ((a0-1 (-> this info name)))
(when (nonzero? a0-1)
(set! (-> this info) (the-as rigid-body-object-constants (-> a0-1 value)))
(set! (-> this rbody state info) (-> this info info))
)
)
(rigid-body-info-method-9 (-> this info info))
(set! (-> this rbody state force-callback) (method-of-object this rigid-body-object-method-29))
0
(none)
)
;; definition for method 50 of type rigid-body-object
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-object-method-50 ((this rigid-body-object) (arg0 float))
(when (logtest? (-> this flags) (rigid-body-object-flag player-impulse-force player-contact-force))
(when (logtest? (-> this flags) (rigid-body-object-flag player-impulse-force))
(logclear! (-> this flags) (rigid-body-object-flag player-impulse-force))
(vector-float*! (-> this player-force) (-> this player-force) (/ 1.0 arg0))
)
(let ((v1-10 (-> this rbody))
(a1-1 (-> this player-force-position))
(a2-2 (-> this player-force))
)
(rigid-body-method-18 (-> v1-10 state) a1-1 a2-2)
)
)
0
(none)
)
;; definition for method 29 of type rigid-body-object
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-object-method-29 ((this rigid-body-object) (arg0 float))
(let ((a1-1 (new 'stack-no-clear 'vector)))
(vector-reset! a1-1)
(set! (-> a1-1 y) (* -1.0 (-> this info extra gravity) (-> this rbody state info mass)))
(rigid-body-method-20 (-> this rbody state) a1-1)
)
0
(none)
)
;; definition for method 30 of type rigid-body-object
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-object-method-30 ((this rigid-body-object))
(rigid-body-control-method-10 (-> this rbody) this (seconds-per-frame) (-> this max-time-step))
(logclear! (-> this flags) (rigid-body-object-flag player-impulse-force player-contact-force))
0
(none)
)
;; definition for method 51 of type rigid-body-object
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-object-method-51 ((this rigid-body-object))
(rigid-body-control-method-10
(-> this rbody)
this
(-> this rbody state time-remaining)
(-> this max-time-step)
)
0
(none)
)
;; definition for method 52 of type rigid-body-object
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-object-method-52 ((this rigid-body-object))
(logclear! (-> this flags) (rigid-body-object-flag player-impulse-force player-contact-force))
0
(none)
)
;; definition for method 34 of type rigid-body-object
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-object-method-34 ((this rigid-body-object))
(go (method-of-object this idle))
0
(none)
)
;; definition for method 31 of type rigid-body-object
;; WARN: Return type mismatch int vs none.
(defmethod alloc-and-init-rigid-body-control ((this rigid-body-object) (arg0 rigid-body-object-constants))
(set! (-> this info) arg0)
(set! (-> this rbody) (new 'process 'rigid-body-control this))
(update-transforms (-> this root))
(rigid-body-method-25
(-> this rbody state)
(-> this info info)
(-> this root trans)
(-> this root quat)
(method-of-object this rigid-body-object-method-29)
)
(rigid-body-object-method-35 this)
(set! (-> this max-time-step) (-> arg0 extra max-time-step))
(set! (-> this root max-iteration-count) (the-as uint 4))
(let ((v1-15 (-> this skel root-channel 0)))
(set! (-> v1-15 num-func) num-func-identity)
(set! (-> v1-15 frame-num) 0.0)
)
0
(none)
)
;; definition for method 32 of type rigid-body-object
;; WARN: Return type mismatch int vs none.
(defmethod allocate-and-init-cshape ((this rigid-body-object))
(let ((s5-0 (new 'process 'collide-shape-moving this (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)
(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))
(set! (-> s4-0 prim-core action) (collide-action solid))
(set! (-> s4-0 transform-index) 3)
(set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 12288.0)
(set! (-> s5-0 total-prims) (the-as uint 1))
(set! (-> s5-0 root-prim) s4-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))
(set! (-> s5-0 backup-collide-with) (-> v1-16 prim-core collide-with))
)
(set! (-> this root) s5-0)
)
0
(none)
)
;; definition for symbol *rigid-body-object-constants*, type rigid-body-object-constants
(define *rigid-body-object-constants* (new 'static 'rigid-body-object-constants
:info (new 'static 'rigid-body-info
:mass 2.0
:inv-mass 0.5
:linear-damping 1.0
:angular-damping 1.0
:bounce-factor 0.5
:friction-factor 0.1
:cm-offset-joint (new 'static 'vector :w 1.0)
:inertial-tensor-box (new 'static 'array meters 3 (meters 4) (meters 4) (meters 4))
)
:extra (new 'static 'rigid-body-object-extra-info
:max-time-step 0.033333335
:gravity (meters 80)
:idle-distance (meters 50)
:attack-force-scale 1.0
)
:name '*rigid-body-object-constants*
)
)
;; definition for method 33 of type rigid-body-object
;; WARN: Return type mismatch int vs none.
(defmethod init-skel-and-rigid-body ((this rigid-body-object))
(alloc-and-init-rigid-body-control this *rigid-body-object-constants*)
0
(none)
)
;; definition for method 11 of type rigid-body-object
;; WARN: Return type mismatch int vs none.
(defmethod init-from-entity! ((this rigid-body-object) (arg0 entity-actor))
"Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that.
This commonly includes things such as:
- stack size
- collision information
- loading the skeleton group / bones
- sounds"
(allocate-and-init-cshape this)
(process-drawable-from-entity! this arg0)
(init-skel-and-rigid-body this)
(rigid-body-object-method-34 this)
0
(none)
)
;; definition for method 36 of type rigid-body-object
;; WARN: Return type mismatch int vs none.
(defmethod do-engine-sounds ((this rigid-body-object))
0
(none)
)
;; definition for method 37 of type rigid-body-object
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-object-method-37 ((this rigid-body-object))
(rigid-body-object-method-30 this)
(do-engine-sounds this)
(let ((v1-4 (-> this rbody))
(a1-0 (-> this root))
)
(rigid-body-method-11 (-> v1-4 state) a1-0)
)
(transform-post)
0
(none)
)
;; definition for method 40 of type rigid-body-object
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-object-method-40 ((this rigid-body-object))
(logior! (-> this flags) (rigid-body-object-flag enable-collision))
(let ((v1-3 (-> this root root-prim)))
(set! (-> v1-3 prim-core collide-as) (-> this root backup-collide-as))
(set! (-> v1-3 prim-core collide-with) (-> this root backup-collide-with))
)
0
(none)
)
;; definition for method 41 of type rigid-body-object
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-object-method-41 ((this rigid-body-object))
(logclear! (-> this flags) (rigid-body-object-flag enable-collision))
(let ((v1-3 (-> this root root-prim)))
(set! (-> v1-3 prim-core collide-as) (collide-spec))
(set! (-> v1-3 prim-core collide-with) (collide-spec))
)
0
0
(none)
)
;; definition for method 38 of type rigid-body-object
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-object-method-38 ((this rigid-body-object))
(when (not (logtest? (-> this rbody state flags) (rigid-body-flag enable-physics)))
(logior! (-> this rbody state flags) (rigid-body-flag enable-physics))
(rigid-body-method-26 (-> this rbody state) (-> this root trans) (-> this root quat))
(vector-float*! (-> this rbody state lin-momentum) (-> this root transv) (-> this info info mass))
(vector-reset! (-> this rbody state ang-momentum))
)
0
(none)
)
;; definition for method 39 of type rigid-body-object
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-object-method-39 ((this rigid-body-object))
(logclear! (-> this rbody state flags) (rigid-body-flag enable-physics))
0
(none)
)
;; definition for method 42 of type rigid-body-object
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-object-method-42 ((this rigid-body-object))
(logior! (-> this flags) (rigid-body-object-flag disturbed))
(set-time! (-> this disturbed-time))
(if (not (logtest? (-> this rbody state flags) (rigid-body-flag enable-physics)))
(rigid-body-object-method-38 this)
)
0
(none)
)
;; definition for method 43 of type rigid-body-object
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-object-method-43 ((this rigid-body-object))
(go (method-of-object this active))
0
(none)
)
;; definition for method 44 of type rigid-body-object
;; WARN: Return type mismatch int vs none.
(defmethod apply-damage ((this rigid-body-object) (arg0 float) (arg1 rigid-body-impact))
0
(none)
)
;; definition for method 45 of type rigid-body-object
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-object-method-45 ((this rigid-body-object) (arg0 rigid-body-impact))
0
(none)
)
;; definition for method 49 of type rigid-body-object
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defmethod rigid-body-object-method-49 ((this rigid-body-object) (arg0 rigid-body-impact) (arg1 touching-shapes-entry))
(set! (-> arg0 rbody) #f)
(set! (-> arg0 prim-id) (the-as uint 0))
(vector-reset! (-> arg0 normal))
(vector-reset! (-> arg0 velocity))
(set! (-> arg0 point quad) (-> this root trans quad))
(when arg1
(let ((s3-0 (-> arg1 head)))
(when s3-0
(get-intersect-point (-> arg0 point) s3-0 (-> this root) arg1)
(let ((s5-1 (get-touched-prim s3-0 (-> this root) arg1)))
(when s5-1
(set! (-> arg0 prim-id) (-> s5-1 prim-id))
(vector-! (-> arg0 normal) (-> arg0 point) (the-as vector (-> s5-1 prim-core)))
(vector-normalize! (-> arg0 normal) 1.0)
(vector+float*!
(-> arg0 point)
(the-as vector (-> s5-1 prim-core))
(-> arg0 normal)
(-> s5-1 prim-core world-sphere w)
)
)
)
)
)
)
0
(none)
)
;; definition for method 47 of type rigid-body-object
;; INFO: Used lq/sq
(defmethod rigid-body-object-method-47 ((this rigid-body-object)
(arg0 process-drawable)
(arg1 attack-info)
(arg2 touching-shapes-entry)
(arg3 penetrate)
)
(local-vars (f0-2 float))
(when arg2
(let ((s5-0 (new 'stack-no-clear 'rigid-body-impact)))
(rigid-body-object-method-49 this s5-0 arg2)
(if (logtest? (attack-mask attacker-velocity) (-> arg1 mask))
(set! (-> s5-0 velocity quad) (-> arg1 attacker-velocity quad))
(vector-! (-> s5-0 velocity) (-> s5-0 point) (-> arg0 root trans))
)
0.0
0.0
(let ((f1-0 (cond
((logtest? (penetrate enemy-yellow-shot) arg3)
(set! f0-2 8192.0)
0.025
)
((logtest? (penetrate jak-yellow-shot jak-blue-shot) arg3)
(set! f0-2 8192.0)
0.05
)
((logtest? (penetrate jak-red-shot) arg3)
(set! f0-2 16384.0)
0.05
)
((logtest? (penetrate explode jak-dark-shot enemy-dark-shot) arg3)
(set! f0-2 81920.0)
1.5
)
((logtest? arg3 (penetrate punch))
(set! f0-2 40960.0)
0.1
)
((logtest? arg3 (penetrate flop spin))
(set! f0-2 20480.0)
0.05
)
(else
(set! f0-2 8192.0)
0.01
)
)
)
)
(set! (-> s5-0 impulse) (* f0-2 (-> this info extra attack-force-scale)))
(apply-damage this (* 0.667 f1-0) s5-0)
)
(rigid-body-object-method-42 this)
(let ((s4-1 (new 'stack-no-clear 'vector)))
(set! (-> s4-1 quad) (-> s5-0 velocity quad))
(vector-normalize! s4-1 1.0)
(vector-float*! s4-1 s4-1 (-> s5-0 impulse))
(let ((v1-46 (-> this rbody))
(a1-6 (-> s5-0 point))
(a2-3 s4-1)
)
(rigid-body-method-18 (-> v1-46 state) a1-6 a2-3)
)
(let ((v1-49 (-> this rbody))
(f0-7 1.0)
)
(rigid-body-method-12 (-> v1-49 state) f0-7)
)
(rigid-body-method-13 (-> this rbody state))
(when #t
(add-debug-x #t (bucket-id debug-no-zbuf1) (-> s5-0 point) *color-blue*)
(add-debug-vector #t (bucket-id debug-no-zbuf1) (-> s5-0 point) s4-1 (meters 0.00024414062) *color-blue*)
)
)
(rigid-body-object-method-45 this s5-0)
)
(if (and (-> this next-state) (= (-> this next-state name) 'idle))
(rigid-body-object-method-43 this)
)
#t
)
)
;; definition for method 48 of type rigid-body-object
;; INFO: Used lq/sq
(defmethod rigid-body-object-method-48 ((this rigid-body-object) (arg0 process-focusable) (arg1 touching-shapes-entry))
(local-vars (v1-2 symbol))
(b! (not (logtest? (process-mask target crate enemy) (-> arg0 mask))) cfg-5 :likely-delay (set! v1-2 #t))
(b! (not (logtest? (-> arg0 mask) (process-mask target))) cfg-5 :likely-delay (set! v1-2 #f))
(set! v1-2 (focus-test? arg0 dangerous pilot))
(label cfg-5)
(b! v1-2 cfg-17 :delay (nop!))
(let ((s5-0 (new 'stack-no-clear 'rigid-body-impact))
(s4-0 (new 'stack-no-clear 'vector))
(f30-0 (get-inv-mass arg0))
)
(rigid-body-object-method-49 this s5-0 arg1)
(cond
((logtest? (-> this rbody state flags) (rigid-body-flag enable-physics))
(let ((v1-14 (-> this rbody))
(a1-3 (-> s5-0 point))
(a2-2 (-> s5-0 velocity))
)
(rigid-body-method-22 (-> v1-14 state) a1-3 a2-2)
)
)
(else
(set! (-> s5-0 velocity quad) (-> this root transv quad))
)
)
(let ((v1-18 (-> arg0 root)))
(set! (-> s4-0 quad) (-> v1-18 transv quad))
(vector-! (-> s5-0 velocity) (-> v1-18 transv) (-> s5-0 velocity))
)
(let ((f0-1 (vector-dot (-> s5-0 velocity) (-> s5-0 normal))))
(when (< f0-1 0.0)
(set! (-> s5-0 impulse) (/ f0-1 (+ f30-0 (-> this info info inv-mass))))
(vector+float*! s4-0 s4-0 (-> s5-0 normal) (* -3.1 f30-0 (-> s5-0 impulse)))
(set! (-> s4-0 y) (fmax (* 49152.0 f30-0) (-> s4-0 y)))
(rigid-body-object-method-42 this)
(let ((a2-4 (new 'stack-no-clear 'vector)))
(vector-float*! a2-4 (-> s5-0 normal) (-> s5-0 impulse))
(let ((v1-31 (-> this rbody))
(a1-8 (-> s5-0 point))
)
(rigid-body-method-18 (-> v1-31 state) a1-8 a2-4)
)
)
(let ((v1-34 (-> this rbody))
(f0-10 1.0)
)
(rigid-body-method-12 (-> v1-34 state) f0-10)
)
(rigid-body-method-13 (-> this rbody state))
(when #f
(add-debug-x #t (bucket-id debug-no-zbuf1) (-> s5-0 point) *color-blue*)
(add-debug-vector
#t
(bucket-id debug-no-zbuf1)
(-> s5-0 point)
(-> s5-0 normal)
(- (-> s5-0 impulse))
*color-blue*
)
)
(rigid-body-object-method-45 this s5-0)
(if (and (-> this next-state) (= (-> this next-state name) 'idle))
(rigid-body-object-method-43 this)
)
)
)
)
(label cfg-17)
#t
)
;; definition for method 46 of type rigid-body-object
;; INFO: Used lq/sq
(defmethod rigid-body-object-method-46 ((this rigid-body-object) (arg0 process-drawable) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(case arg2
(('impact-impulse)
(let ((s5-1 (-> arg3 param 0)))
(if (!= this arg0)
(rigid-body-object-method-42 this)
)
(rigid-body-object-method-45 this (the-as rigid-body-impact s5-1))
)
(if (and (-> this next-state) (= (-> this next-state name) 'idle))
(rigid-body-object-method-43 this)
)
)
(('touched)
(if (= this *debug-actor*)
(format *stdcon* "rigid-body-object got touched~%")
)
(when (zero? (-> arg0 rbody))
(let ((s3-0 (if (type? arg0 process-focusable)
(the-as process-focusable arg0)
)
)
)
(when s3-0
(when (logtest? (-> s3-0 mask) (process-mask target))
(logior! (-> this flags) (rigid-body-object-flag player-touching))
(set-time! (-> this player-touch-time))
(rigid-body-object-method-42 this)
)
(if (not (logtest? (-> s3-0 mask) (process-mask target)))
(rigid-body-object-method-48 this s3-0 (the-as touching-shapes-entry (-> arg3 param 0)))
)
)
)
)
)
(('attack)
(let ((s3-1 (the-as attack-info (-> arg3 param 1)))
(t0-1 (get-penetrate-using-from-attack-event arg0 arg3))
)
(when (!= (-> s3-1 id) (-> this incoming-attack-id))
(set! (-> this incoming-attack-id) (-> s3-1 id))
(rigid-body-object-method-47 this arg0 s3-1 (the-as touching-shapes-entry (-> arg3 param 0)) t0-1)
)
)
)
(('edge-grabbed 'pilot-edge-grab)
(let ((s5-2 (the-as object (-> arg3 param 0))))
(when (not (logtest? (-> this flags) (rigid-body-object-flag player-impulse-force)))
(let ((a0-25 (if (type? arg0 process-focusable)
(the-as process-focusable arg0)
)
)
)
(when a0-25
(let ((f0-1 (/ 163840.0 (get-inv-mass a0-25))))
(logior! (-> this flags) (rigid-body-object-flag player-touching player-edge-grabbing player-contact-force))
(set! (-> this player-force-position quad) (-> (the-as attack-info s5-2) attacker-velocity quad))
(vector-reset! (-> this player-force))
(set! (-> this player-force y) (* -1.0 f0-1))
)
)
)
)
)
(not (logtest? (-> this focus-status) (focus-status dead inactive)))
)
(('ridden)
(let ((v1-45 (the-as object (-> arg3 param 0))))
(when (the-as uint v1-45)
(let* ((s5-3 (handle->process (-> (the-as focus v1-45) handle)))
(a0-34 (if (type? s5-3 process-focusable)
(the-as process-focusable s5-3)
)
)
)
(when (and a0-34
(logtest? (-> a0-34 mask) (process-mask target))
(not (logtest? (-> a0-34 focus-status) (focus-status on-water under-water)))
)
(when (not (logtest? (-> this flags) (rigid-body-object-flag player-impulse-force)))
(logior! (-> this flags) (rigid-body-object-flag player-touching player-standing-on player-contact-force))
(set! (-> this player-force-position quad) (-> a0-34 root trans quad))
(vector-reset! (-> this player-force))
(let ((f0-4 (/ 163840.0 (get-inv-mass a0-34)))
(f1-1 1.0)
)
(set! (-> this player-force y) (* -1.0 f0-4 f1-1))
)
)
)
)
)
)
)
(('bonk)
(when #t
(let ((a0-38 (if (type? arg0 process-focusable)
(the-as process-focusable arg0)
)
)
)
(when a0-38
(logior! (-> this flags) (rigid-body-object-flag player-touching player-impulse-force))
(set! (-> this player-force-position quad) (-> a0-38 root trans quad))
(let ((f30-2 (* 0.00012207031 (the-as float (-> arg3 param 1))))
(f0-9 (/ 163840.0 (get-inv-mass a0-38)))
)
(vector-reset! (-> this player-force))
(set! (-> this player-force y) (* -0.1 f0-9 f30-2))
)
)
)
)
)
(('enable-physics)
(rigid-body-object-method-42 this)
)
)
)
;; definition for function rigid-body-object-event-handler
(defbehavior rigid-body-object-event-handler rigid-body-object ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(rigid-body-object-method-46 self (the-as process-drawable arg0) arg1 arg2 arg3)
)
;; failed to figure out what this is:
(defstate idle (rigid-body-object)
:virtual #t
:trans (behavior ()
(if (and *target* (and (>= (-> self info extra idle-distance)
(vector-vector-distance (-> self root trans) (-> *target* control trans))
)
(not (logtest? (focus-status teleporting) (-> *target* focus-status)))
)
)
(go-virtual active)
)
)
:code sleep-code
:post ja-post
)
;; failed to figure out what this is:
(defstate active (rigid-body-object)
:virtual #t
:event rigid-body-object-event-handler
:trans (behavior ()
(if (or (not *target*) (or (< (+ 4096.0 (-> self info extra idle-distance))
(vector-vector-distance (-> self root trans) (-> *target* control trans))
)
(focus-test? *target* teleporting)
)
)
(go-virtual idle)
)
)
:code sleep-code
:post (behavior ()
(rigid-body-object-method-37 self)
)
)