Files
jak-project/test/decompiler/reference/jak1/engine/common-obs/rigid-body_REF.gc
T
Hat Kid 122de4ecf5 jak1: clean up control-info names and other misc cleanup (#4295)
After spending the last month staring at and comparing Jak 3 and Jak 1
versions of a bunch of `target` code for my jetboard mod, I figured this
would be a good opportunity to revive this ancient PR #1714 along with
some other small misc fixes/improvements.

Instead of directly replacing the old fields, I decided to opt for using
overlay fields to maintain backwards compatibility with existing manual
patches, files without ref tests and mods that might use these fields.
2026-05-31 15:08:41 +02:00

867 lines
33 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; definition for method 11 of type rigid-body
;; INFO: Used lq/sq
;; INFO: Return type mismatch int vs none.
(defmethod clear-force-torque! ((this rigid-body))
(set! (-> this force quad) (-> *null-vector* quad))
(set! (-> this torque quad) (-> *null-vector* quad))
0
(none)
)
;; definition for method 12 of type rigid-body
;; INFO: Used lq/sq
;; INFO: Return type mismatch int vs none.
(defmethod clear-momentum! ((this rigid-body))
(set! (-> this lin-momentum quad) (-> *null-vector* quad))
(set! (-> this ang-momentum quad) (-> *null-vector* quad))
0
(none)
)
;; definition for method 21 of type rigid-body
;; INFO: Return type mismatch int vs none.
(defmethod rigid-body-method-21 ((this rigid-body))
(quaternion->matrix (-> this matrix) (-> this rotation))
(rigid-body-method-18 this (-> this matrix vector 3))
0
(none)
)
;; definition for method 22 of type rigid-body
;; INFO: Used lq/sq
;; INFO: Return type mismatch int vs none.
(defmethod rigid-body-method-22 ((this rigid-body) (arg0 vector) (arg1 quaternion) (arg2 float) (arg3 float))
(clear-force-torque! this)
(clear-momentum! this)
(vector+! (-> this position) arg0 (-> this cm-offset-joint))
(quaternion-copy! (-> this rotation) arg1)
(quaternion-normalize! (-> this rotation))
(set! (-> this lin-momentum-damping-factor) arg2)
(set! (-> this ang-momentum-damping-factor) arg3)
(rigid-body-method-21 this)
(set! (-> this lin-velocity quad) (-> *null-vector* quad))
(set! (-> this ang-velocity quad) (-> *null-vector* quad))
(set! (-> this inv-i-world vector 0 quad) (the-as uint128 0))
(set! (-> this inv-i-world vector 1 quad) (the-as uint128 0))
(set! (-> this inv-i-world vector 2 quad) (the-as uint128 0))
(set! (-> this inv-i-world vector 3 quad) (the-as uint128 0))
(set! (-> this max-ang-velocity) 0.0)
(set! (-> this max-ang-momentum) 0.0)
0
(none)
)
;; definition for method 9 of type rigid-body
;; INFO: Return type mismatch int vs none.
(defmethod rigid-body-method-9 ((this rigid-body) (arg0 float) (arg1 float) (arg2 float) (arg3 float))
(set! (-> this mass) arg0)
(let ((f0-1 arg0))
(set! (-> this inv-mass) (/ 1.0 f0-1))
)
(matrix-identity! (-> this inertial-tensor))
(matrix-identity! (-> this inv-inertial-tensor))
(let* ((f0-4 arg0)
(f1-1 12.0)
(f0-5 (* f0-4 (/ 1.0 f1-1)))
)
(set! (-> this inertial-tensor vector 0 x) (* f0-5 (+ (square arg2) (square arg3))))
(set! (-> this inertial-tensor vector 1 y) (* f0-5 (+ (square arg1) (square arg3))))
(set! (-> this inertial-tensor vector 2 z) (* f0-5 (+ (square arg1) (square arg2))))
)
(let ((f0-7 (-> this inertial-tensor vector 0 x)))
(set! (-> this inv-inertial-tensor vector 0 x) (/ 1.0 f0-7))
)
(let ((f0-10 (-> this inertial-tensor vector 1 y)))
(set! (-> this inv-inertial-tensor vector 1 y) (/ 1.0 f0-10))
)
(let ((f0-13 (-> this inertial-tensor vector 2 z)))
(set! (-> this inv-inertial-tensor vector 2 z) (/ 1.0 f0-13))
)
0
(none)
)
;; definition for method 17 of type rigid-body
(defmethod rigid-body-method-17 ((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
(defun matrix-3x3-triple-transpose-product ((arg0 matrix) (arg1 matrix) (arg2 matrix))
(let ((s2-0 (new 'stack-no-clear 'matrix))
(s3-0 (new 'stack-no-clear 'matrix))
)
(matrix-transpose! s2-0 arg1)
(cond
(#t
(matrix*! s3-0 arg1 arg2)
(matrix*! arg0 s3-0 s2-0)
)
(else
(matrix*! s3-0 s2-0 arg2)
(matrix*! arg0 s3-0 arg1)
)
)
)
arg0
)
;; definition for method 10 of type rigid-body
;; INFO: Used lq/sq
;; INFO: Return type mismatch int vs none.
(defmethod rigid-body-method-10 ((this rigid-body) (arg0 float))
(vector+*! (-> this lin-momentum) (-> this lin-momentum) (-> this force) arg0)
(vector+*! (-> this ang-momentum) (-> this ang-momentum) (-> this torque) arg0)
(vector-float*! (-> this lin-momentum) (-> this lin-momentum) (-> this lin-momentum-damping-factor))
(vector-float*! (-> this ang-momentum) (-> this ang-momentum) (-> this ang-momentum-damping-factor))
(vector-float*! (-> this lin-velocity) (-> this lin-momentum) (-> this inv-mass))
(set! (-> this matrix vector 3 quad) (-> *null-vector* quad))
(matrix-3x3-triple-transpose-product (-> this inv-i-world) (-> this matrix) (-> this inv-inertial-tensor))
(vector-rotate*! (-> this ang-velocity) (-> this ang-momentum) (-> this inv-i-world))
(vector+*! (-> this position) (-> this position) (-> this lin-velocity) arg0)
(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))
(quaternion->matrix (-> this matrix) (-> this rotation))
(rigid-body-method-18 this (-> this matrix vector 3))
0
(none)
)
;; definition for method 13 of type rigid-body
;; INFO: Return type mismatch int vs none.
(defmethod rigid-body-method-13 ((this rigid-body) (arg0 vector) (arg1 vector))
(vector+! (-> this force) (-> this force) arg1)
(let* ((v1-2 (vector-! (new 'stack-no-clear 'vector) arg0 (-> this position)))
(a1-2 (vector-cross! (new 'stack-no-clear 'vector) v1-2 arg1))
)
(vector+! (-> this torque) (-> this torque) a1-2)
)
0
(none)
)
;; definition for method 16 of type rigid-body
;; INFO: Return type mismatch int vs none.
(defmethod rigid-body-method-16 ((this rigid-body) (arg0 vector) (arg1 vector) (arg2 float))
(vector+! (-> this force) (-> this force) arg1)
(let* ((a0-3 (vector-! (new 'stack-no-clear 'vector) arg0 (-> this position)))
(s4-1 (vector-cross! (new 'stack-no-clear 'vector) a0-3 arg1))
)
(let ((f0-0 (vector-length a0-3)))
(if (< arg2 f0-0)
(vector-float*! s4-1 s4-1 (/ arg2 f0-0))
)
)
(vector+! (-> this torque) (-> this torque) s4-1)
)
0
(none)
)
;; definition for method 14 of type rigid-body
;; INFO: Return type mismatch int vs none.
(defmethod rigid-body-method-14 ((this rigid-body) (arg0 vector) (arg1 vector))
(let ((s5-0 (new 'stack-no-clear 'vector))
(s4-0 (new 'stack-no-clear 'vector))
)
(vector-rotate*! s4-0 arg1 (-> this matrix))
(vector-rotate*! s5-0 arg0 (-> this matrix))
(vector+! s5-0 s5-0 (-> this position))
(rigid-body-method-13 this s5-0 s4-0)
)
0
(none)
)
;; definition for method 15 of type rigid-body
;; INFO: Return type mismatch int vs none.
(defmethod rigid-body-method-15 ((this rigid-body) (arg0 vector))
(vector+! (-> this force) (-> this force) arg0)
0
(none)
)
;; definition for method 18 of type rigid-body
(defmethod rigid-body-method-18 ((this rigid-body) (arg0 vector))
(let ((gp-0 (new 'stack-no-clear 'vector)))
(vector-rotate*! gp-0 (-> this cm-offset-joint) (-> this matrix))
(vector-! arg0 (-> this position) gp-0)
)
arg0
)
;; definition for method 19 of type rigid-body
;; INFO: Return type mismatch int vs none.
(defmethod print-stats ((this rigid-body))
(format #t " force ~M ~M ~M" (-> this force x) (-> this force y) (-> this force z))
(format #t " torque ~f ~f ~f~%" (-> this torque x) (-> this torque y) (-> this torque z))
(format #t " position ~M ~M ~M" (-> this position x) (-> this position y) (-> this position z))
(format
#t
" rotation ~f ~f ~f ~f~%"
(-> this rotation x)
(-> this rotation y)
(-> this rotation z)
(-> this rotation w)
)
(format #t " lin-mom ~M ~M ~M" (-> this lin-momentum x) (-> this lin-momentum y) (-> this lin-momentum z))
(format #t " ang-mom ~f ~f ~f~%" (-> this ang-momentum x) (-> this ang-momentum y) (-> this ang-momentum z))
(format #t " lin-vel ~M ~M ~M" (-> this lin-velocity x) (-> this lin-velocity y) (-> this lin-velocity z))
(format #t " ang-vel ~f ~f ~f~%" (-> this ang-velocity x) (-> this ang-velocity y) (-> this ang-velocity z))
0
(none)
)
;; definition for method 20 of type rigid-body
;; INFO: Return type mismatch int vs none.
(defmethod rigid-body-method-20 ((this rigid-body))
(format #t " force ~M ~M ~M" (-> this force x) (-> this force y) (-> this force z))
(format #t " torque ~f ~f ~f~%" (-> this torque x) (-> this torque y) (-> this torque z))
0
(none)
)
;; definition of type rigid-body-platform-constants
(deftype rigid-body-platform-constants (structure)
((drag-factor float)
(buoyancy-factor float)
(max-buoyancy-depth meters)
(gravity-factor float)
(gravity meters)
(player-weight meters)
(player-bonk-factor float)
(player-dive-factor float)
(player-force-distance meters)
(player-force-clamp meters)
(player-force-timeout time-frame)
(explosion-force meters)
(linear-damping float)
(angular-damping float)
(control-point-count int32)
(mass float)
(inertial-tensor-x meters)
(inertial-tensor-y meters)
(inertial-tensor-z meters)
(cm-joint-x meters)
(cm-joint-y meters)
(cm-joint-z meters)
(idle-distance meters)
(platform symbol)
(sound-name string)
)
)
;; definition for method 3 of type rigid-body-platform-constants
(defmethod inspect ((this rigid-body-platform-constants))
(format #t "[~8x] ~A~%" this 'rigid-body-platform-constants)
(format #t "~Tdrag-factor: ~f~%" (-> this drag-factor))
(format #t "~Tbuoyancy-factor: ~f~%" (-> this buoyancy-factor))
(format #t "~Tmax-buoyancy-depth: (meters ~m)~%" (-> this max-buoyancy-depth))
(format #t "~Tgravity-factor: ~f~%" (-> this gravity-factor))
(format #t "~Tgravity: (meters ~m)~%" (-> this gravity))
(format #t "~Tplayer-weight: (meters ~m)~%" (-> this player-weight))
(format #t "~Tplayer-bonk-factor: ~f~%" (-> this player-bonk-factor))
(format #t "~Tplayer-dive-factor: ~f~%" (-> this player-dive-factor))
(format #t "~Tplayer-force-distance: (meters ~m)~%" (-> this player-force-distance))
(format #t "~Tplayer-force-clamp: (meters ~m)~%" (-> this player-force-clamp))
(format #t "~Tplayer-force-timeout: ~D~%" (-> this player-force-timeout))
(format #t "~Texplosion-force: (meters ~m)~%" (-> this explosion-force))
(format #t "~Tlinear-damping: ~f~%" (-> this linear-damping))
(format #t "~Tangular-damping: ~f~%" (-> this angular-damping))
(format #t "~Tcontrol-point-count: ~D~%" (-> this control-point-count))
(format #t "~Tmass: ~f~%" (-> this mass))
(format #t "~Tinertial-tensor-x: (meters ~m)~%" (-> this inertial-tensor-x))
(format #t "~Tinertial-tensor-y: (meters ~m)~%" (-> this inertial-tensor-y))
(format #t "~Tinertial-tensor-z: (meters ~m)~%" (-> this inertial-tensor-z))
(format #t "~Tcm-joint-x: (meters ~m)~%" (-> this cm-joint-x))
(format #t "~Tcm-joint-y: (meters ~m)~%" (-> this cm-joint-y))
(format #t "~Tcm-joint-z: (meters ~m)~%" (-> this cm-joint-z))
(format #t "~Tidle-distance: (meters ~m)~%" (-> this idle-distance))
(format #t "~Tplatform: ~A~%" (-> this platform))
(format #t "~Tsound-name: ~A~%" (-> this sound-name))
this
)
;; definition of type rigid-body-control-point-inline-array
(deftype rigid-body-control-point-inline-array (inline-array-class)
((data rigid-body-control-point :inline :dynamic :offset 16)
)
)
;; definition for method 3 of type rigid-body-control-point-inline-array
(defmethod inspect ((this rigid-body-control-point-inline-array))
(format #t "[~8x] ~A~%" this (-> this type))
(format #t "~Tlength: ~D~%" (-> this length))
(format #t "~Tallocated-length: ~D~%" (-> this allocated-length))
(format #t "~Tdata[0] @ #x~X~%" (-> this data))
this
)
;; failed to figure out what this is:
(set! (-> rigid-body-control-point-inline-array heap-base) (the-as uint 48))
;; definition of type rigid-body-platform
(deftype rigid-body-platform (process-drawable)
((root-overlay collide-shape-moving :overlay-at root)
(info rigid-body-platform-constants)
(rbody rigid-body :inline)
(control-point-array rigid-body-control-point-inline-array)
(player-velocity vector :inline)
(player-velocity-prev vector :inline)
(player-force-position vector :inline)
(player-force vector :inline)
(sim-time-remaining float)
(float-height-offset float)
(player-attack-id int32)
(player-bonk-timeout time-frame)
(water-anim water-anim)
(player-contact basic)
(player-impulse collide-shape-prim-mesh)
)
(:state-methods
rigid-body-platform-idle
rigid-body-platform-float
)
(:methods
(rigid-body-platform-method-22 (_type_ vector float) float)
(rigid-body-platform-method-23 (_type_ float) none)
(rigid-body-platform-method-24 (_type_ rigid-body-control-point float) none)
(rigid-body-platform-method-25 (_type_) none)
(rigid-body-platform-method-26 (_type_) none)
(rigid-body-platform-method-27 (_type_ vector) none)
(rigid-body-platform-method-28 (_type_) none)
(rigid-body-platform-method-29 (_type_ rigid-body-platform-constants) none)
(rigid-body-platform-method-30 (_type_) none)
(rigid-body-platform-method-31 (_type_) none)
(rigid-body-platform-method-32 (_type_) sound-id)
(rigid-body-platform-method-33 (_type_) object)
(rigid-body-platform-method-34 (_type_) none)
)
)
;; definition for method 3 of type rigid-body-platform
(defmethod inspect ((this rigid-body-platform))
(let ((t9-0 (method-of-type process-drawable inspect)))
(t9-0 this)
)
(format #t "~T~Tinfo: #<rigid-body-platform-constants @ #x~X>~%" (-> this info))
(format #t "~T~Trbody: #<rigid-body @ #x~X>~%" (-> this rbody))
(format #t "~T~Tcontrol-point-array: ~A~%" (-> this control-point-array))
(format #t "~T~Tplayer-velocity: #<vector @ #x~X>~%" (-> this player-velocity))
(format #t "~T~Tplayer-velocity-prev: #<vector @ #x~X>~%" (-> this player-velocity-prev))
(format #t "~T~Tplayer-force-position: #<vector @ #x~X>~%" (-> this player-force-position))
(format #t "~T~Tplayer-force: #<vector @ #x~X>~%" (-> this player-force))
(format #t "~T~Tsim-time-remaining: ~f~%" (-> this sim-time-remaining))
(format #t "~T~Tfloat-height-offset: ~f~%" (-> this float-height-offset))
(format #t "~T~Tplayer-attack-id: ~D~%" (-> this player-attack-id))
(format #t "~T~Tplayer-bonk-timeout: ~D~%" (-> this player-bonk-timeout))
(format #t "~T~Twater-anim: ~A~%" (-> this water-anim))
(format #t "~T~Tplayer-contact: ~A~%" (-> this player-contact))
(format #t "~T~Tplayer-impulse: ~A~%" (-> this player-impulse))
this
)
;; definition for method 7 of type rigid-body-platform
(defmethod relocate ((this rigid-body-platform) (offset int))
(if (nonzero? (-> this control-point-array))
(set! (-> this control-point-array)
(the-as rigid-body-control-point-inline-array (+ (the-as int (-> this control-point-array)) offset))
)
)
(call-parent-method this offset)
)
;; definition for method 22 of type rigid-body-platform
(defmethod rigid-body-platform-method-22 ((this rigid-body-platform) (arg0 vector) (arg1 float))
(let ((v1-0 (-> this water-anim)))
0.0
(+ (the-as float (cond
(v1-0
(let* ((a2-1 v1-0)
(a0-1 (if a2-1
(-> a2-1 ppointer-water-anim 3)
)
)
)
(if a0-1
(get-ripple-height a0-1 arg0)
(-> v1-0 ppointer-water-anim 9)
)
)
)
(else
(ocean-get-height arg0)
)
)
)
(-> this float-height-offset)
)
)
)
;; definition for method 24 of type rigid-body-platform
;; INFO: Return type mismatch int vs none.
(defmethod rigid-body-platform-method-24 ((this rigid-body-platform) (arg0 rigid-body-control-point) (arg1 float))
(set! (-> arg0 world-pos w) (rigid-body-platform-method-22 this (-> arg0 world-pos) arg1))
(let* ((s4-0 (new 'stack-no-clear 'vector))
(f0-2 (- (-> arg0 world-pos w) (-> arg0 world-pos y)))
(f30-0 (/ f0-2 (-> this info max-buoyancy-depth)))
)
(when (< 0.0 f0-2)
(vector-float*! s4-0 *y-vector* (* (-> this rbody mass)
(fmin 1.0 f30-0)
(/ (-> this info gravity) (the float (-> this info control-point-count)))
(-> this info gravity-factor)
(-> this info buoyancy-factor)
)
)
(rigid-body-method-13 (-> this rbody) (-> arg0 world-pos) s4-0)
(vector-float*! s4-0 (-> arg0 velocity) (* -1.0 (-> this info drag-factor) (fmin 1.0 f30-0)))
(rigid-body-method-13 (-> this rbody) (-> arg0 world-pos) s4-0)
)
)
0
0
(none)
)
;; definition for method 25 of type rigid-body-platform
;; INFO: Return type mismatch int vs none.
(defmethod rigid-body-platform-method-25 ((this rigid-body-platform))
(when (or (-> this player-impulse) (-> this player-contact))
(set! (-> this player-impulse) #f)
(rigid-body-method-16
(-> this rbody)
(-> this player-force-position)
(-> this player-force)
(-> this info player-force-distance)
)
)
0
(none)
)
;; definition for method 26 of type rigid-body-platform
;; INFO: Return type mismatch int vs none.
(defmethod rigid-body-platform-method-26 ((this rigid-body-platform))
(let ((a1-0 (new 'stack-no-clear 'vector)))
(vector-float*!
a1-0
*y-vector*
(* -1.0 (-> this info gravity-factor) (-> this info gravity) (-> this rbody mass))
)
(rigid-body-method-15 (-> this rbody) a1-0)
)
0
(none)
)
;; definition for method 27 of type rigid-body-platform
;; INFO: Return type mismatch int vs none.
(defmethod rigid-body-platform-method-27 ((this rigid-body-platform) (arg0 vector))
(let ((gp-0 (new 'stack-no-clear 'vector)))
(vector-! gp-0 arg0 (-> this rbody position))
(set! (-> gp-0 y) 0.0)
(let* ((f0-1 (vector-length gp-0))
(f1-1 (* 10.0 (fmax 0.0 (fmin 4096.0 (+ -4096.0 f0-1)))))
)
(when (< 0.0 f1-1)
(vector-float*! gp-0 gp-0 (/ f1-1 f0-1))
(rigid-body-method-15 (-> this rbody) gp-0)
)
)
)
0
(none)
)
;; definition for method 23 of type rigid-body-platform
;; INFO: Return type mismatch int vs none.
(defmethod rigid-body-platform-method-23 ((this rigid-body-platform) (arg0 float))
(let ((s4-0 (-> this rbody matrix)))
(dotimes (s3-0 (-> this info control-point-count))
(let ((s2-0 (-> this control-point-array data s3-0)))
(vector-matrix*! (-> s2-0 world-pos) (-> s2-0 local-pos) s4-0)
(rigid-body-method-17 (-> this rbody) (-> s2-0 world-pos) (-> s2-0 velocity))
(rigid-body-platform-method-24 this s2-0 arg0)
)
)
)
(rigid-body-platform-method-26 this)
(rigid-body-platform-method-25 this)
0
(none)
)
;; definition for method 28 of type rigid-body-platform
;; INFO: Used lq/sq
;; INFO: Return type mismatch int vs none.
(defmethod rigid-body-platform-method-28 ((this rigid-body-platform))
(if (-> this info platform)
(detect-riders! (-> this root-overlay))
)
(set! (-> this player-velocity-prev quad) (-> this player-velocity quad))
(if *target*
(set! (-> this player-velocity quad) (-> *target* control transv quad))
(set! (-> this player-velocity quad) (-> *null-vector* quad))
)
(+! (-> this sim-time-remaining)
(* 0.0033333334 (the float (- (current-time) (-> *display* old-base-frame-counter))))
)
(let ((f30-0 0.016666668)
(f28-0 (* 0.0033333334 (the float (logand #xffffff (current-time)))))
)
(while (>= (-> this sim-time-remaining) (/ f30-0 2))
(clear-force-torque! (-> this rbody))
(rigid-body-platform-method-23 this f28-0)
(rigid-body-method-10 (-> this rbody) f30-0)
(set! (-> this sim-time-remaining) (- (-> this sim-time-remaining) f30-0))
)
)
(set! (-> this player-contact) #f)
0
(none)
)
;; definition for function rigid-body-platform-event-handler
;; INFO: Used lq/sq
;; INFO: Return type mismatch vector vs object.
(defbehavior rigid-body-platform-event-handler rigid-body-platform ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(case arg2
(('bonk)
(when (time-elapsed? (-> self player-bonk-timeout) (-> self info player-force-timeout))
(set-time! (-> self player-bonk-timeout))
(let* ((s5-0 arg0)
(v1-7 (if (and (nonzero? s5-0) (type-type? (-> s5-0 type) process-drawable))
s5-0
)
)
)
(when v1-7
(set! (-> self player-impulse) (the-as collide-shape-prim-mesh #t))
(set! (-> self player-force-position quad) (-> (the-as process-drawable v1-7) root trans quad))
(let ((f0-4 (fmin
(* 0.00012207031
(the-as float (-> arg3 param 1))
(-> self info player-bonk-factor)
(-> self info player-weight)
)
(-> self info player-force-clamp)
)
)
)
(vector-float*! (-> self player-force) *y-vector* (- f0-4))
)
)
)
)
)
(('attack)
(let ((v1-16 (-> arg3 param 2)))
(when (!= v1-16 (-> self player-attack-id))
(set! (-> self player-attack-id) (the-as int v1-16))
(cond
((= (-> arg3 param 1) 'flop)
(when (time-elapsed? (-> self player-bonk-timeout) (-> self info player-force-timeout))
(set-time! (-> self player-bonk-timeout))
(let* ((gp-1 arg0)
(v1-24 (if (and (nonzero? gp-1) (type-type? (-> gp-1 type) process-drawable))
gp-1
)
)
)
(when v1-24
(set! (-> self player-impulse) (the-as collide-shape-prim-mesh #t))
(set! (-> self player-force-position quad) (-> (the-as process-drawable v1-24) root trans quad))
(let ((f0-9 (fmin
(* 16.0 (-> self info player-weight) (-> self info player-dive-factor))
(-> self info player-force-clamp)
)
)
)
(vector-float*! (-> self player-force) *y-vector* (- f0-9))
)
)
)
)
)
((= (-> arg3 param 1) 'explode)
(let* ((gp-2 arg0)
(v1-34 (if (and (nonzero? gp-2) (type-type? (-> gp-2 type) process-drawable))
gp-2
)
)
)
(when v1-34
(set! (-> self player-impulse) (the-as collide-shape-prim-mesh #t))
(set! (-> self player-force-position quad) (-> (the-as process-drawable v1-34) root trans quad))
(vector-! (-> self player-force) (-> self rbody position) (-> (the-as process-drawable v1-34) root trans))
(vector-normalize! (-> self player-force) (-> self info explosion-force))
)
)
)
(else
(the-as vector #f)
)
)
)
)
)
(('impulse)
(let ((s5-1 arg0))
(when (if (and (nonzero? s5-1) (type-type? (-> s5-1 type) process-drawable))
s5-1
)
(set! (-> self player-impulse) (the-as collide-shape-prim-mesh #t))
(set! (-> self player-force-position quad) (-> self rbody position quad))
(let ((v0-0 (-> self player-force)))
(set! (-> v0-0 quad) (-> (the-as vector (-> arg3 param 0)) quad))
v0-0
)
)
)
)
(('edge-grabbed)
(let ((v1-44 (-> arg3 param 0)))
(when (not (-> self player-impulse))
(set! (-> self player-contact) #t)
(set! (-> self player-force-position quad) (-> (the-as vector (+ v1-44 32)) quad))
(vector-float*! (-> self player-force) *y-vector* (* -1.0 (-> self info player-weight)))
)
)
)
(('ridden)
(let ((v1-48 (the-as object (-> arg3 param 0))))
(when (the-as uint v1-48)
(let ((v1-50 (handle->process (-> (the-as (pointer handle) v1-48) 0))))
(when (and v1-50 (= v1-50 *target*) (!= (-> *target* control mod-surface mode) 'swim))
(when (not (-> self player-impulse))
(set! (-> self player-contact) #t)
(set! (-> self player-force-position quad) (-> (the-as process-drawable v1-50) root trans quad))
(set! (-> self player-force quad) (-> *null-vector* quad))
(vector+*! (-> self player-force) (-> self player-force) *y-vector* (* -1.0 (-> self info player-weight)))
)
)
)
)
)
)
)
)
;; definition for function rigid-body-platform-post
(defbehavior rigid-body-platform-post rigid-body-platform ()
(set! (-> self rbody lin-momentum-damping-factor) (-> self info linear-damping))
(set! (-> self rbody ang-momentum-damping-factor) (-> self info angular-damping))
(if (-> self player-impulse)
(sound-play-by-name
(string->sound-name (-> self info sound-name))
(new-sound-id)
1024
0
0
(sound-group sfx)
#t
)
)
(rigid-body-platform-method-28 self)
(quaternion-copy! (-> self root-overlay quat) (-> self rbody rotation))
(rigid-body-method-18 (-> self rbody) (-> self root-overlay trans))
(if (-> self info platform)
(rider-post)
(transform-post)
)
)
;; failed to figure out what this is:
(defstate rigid-body-platform-idle (rigid-body-platform)
:virtual #t
:trans (behavior ()
(if (and *target* (>= (-> self info idle-distance)
(vector-vector-distance (-> self root-overlay trans) (-> *target* control trans))
)
)
(go-virtual rigid-body-platform-float)
)
)
:code (behavior ()
(loop
(suspend)
)
)
:post ja-post
)
;; failed to figure out what this is:
(defstate rigid-body-platform-float (rigid-body-platform)
:virtual #t
:event rigid-body-platform-event-handler
:trans (behavior ()
(if (or (not *target*) (< (-> self info idle-distance)
(vector-vector-distance (-> self root-overlay trans) (-> *target* control trans))
)
)
(go-virtual rigid-body-platform-idle)
)
)
:code (behavior ()
(loop
(suspend)
)
)
:post rigid-body-platform-post
)
;; definition for method 29 of type rigid-body-platform
;; INFO: Used lq/sq
;; INFO: Return type mismatch int vs none.
(defmethod rigid-body-platform-method-29 ((this rigid-body-platform) (arg0 rigid-body-platform-constants))
(set! (-> this info) arg0)
(set! (-> this control-point-array)
(new 'process 'rigid-body-control-point-inline-array (-> this info control-point-count))
)
(logior! (-> this skel status) (janim-status inited))
(update-transforms! (-> this root-overlay))
(set-vector!
(-> this rbody cm-offset-joint)
(-> this info cm-joint-x)
(-> this info cm-joint-y)
(-> this info cm-joint-z)
1.0
)
(rigid-body-method-22
(-> this rbody)
(-> this root-overlay trans)
(-> this root-overlay quat)
(-> this info linear-damping)
(-> this info angular-damping)
)
(rigid-body-method-9
(-> this rbody)
(-> this info mass)
(-> this info inertial-tensor-x)
(-> this info inertial-tensor-y)
(-> this info inertial-tensor-z)
)
(set! (-> this player-impulse) #f)
(set! (-> this player-contact) #f)
(set-time! (-> this player-bonk-timeout))
(set! (-> this player-force quad) (-> *null-vector* quad))
(set! (-> this player-velocity quad) (-> *null-vector* quad))
(set! (-> this player-velocity-prev quad) (-> *null-vector* quad))
(set! (-> this water-anim) (the-as water-anim (entity-actor-lookup (-> this entity) 'water-actor 0)))
0
(none)
)
;; definition for method 30 of type rigid-body-platform
;; INFO: Return type mismatch int vs none.
(defmethod rigid-body-platform-method-30 ((this rigid-body-platform))
(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) default-collision-reaction)
(set! (-> s5-0 no-reaction)
(the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
)
(alloc-riders s5-0 1)
(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-kind ground-object))
(set! (-> s4-0 collide-with) (collide-kind target))
(set! (-> s4-0 prim-core action) (collide-action solid rider-plat-sticky))
(set! (-> s4-0 prim-core offense) (collide-offense indestructible))
(set! (-> s4-0 transform-index) 0)
(set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 20480.0)
(set-root-prim! s5-0 s4-0)
)
(set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
(backup-collide-with-as s5-0)
(set! (-> this root-overlay) s5-0)
)
0
(none)
)
;; definition for symbol *rigid-body-platform-constants*, type rigid-body-platform-constants
(define *rigid-body-platform-constants* (new 'static 'rigid-body-platform-constants
:drag-factor 0.8
:buoyancy-factor 1.5
:max-buoyancy-depth (meters 1.5)
:gravity-factor 1.0
:gravity (meters 10)
:player-weight (meters 6.6)
:player-bonk-factor 1.0
:player-dive-factor 1.0
:player-force-distance (meters 1000)
:player-force-clamp (meters 1000000)
:player-force-timeout (seconds 0.1)
:explosion-force (meters 1000)
:linear-damping 1.0
:angular-damping 1.0
:control-point-count 1
:mass 2.0
:inertial-tensor-x (meters 3)
:inertial-tensor-y (meters 2)
:inertial-tensor-z (meters 3)
:idle-distance (meters 50)
:platform #t
:sound-name #f
)
)
;; definition for method 34 of type rigid-body-platform
;; INFO: Return type mismatch int vs none.
(defmethod rigid-body-platform-method-34 ((this rigid-body-platform))
(go (method-of-object this rigid-body-platform-idle))
0
(none)
)
;; definition for method 31 of type rigid-body-platform
;; INFO: Return type mismatch int vs none.
(defmethod rigid-body-platform-method-31 ((this rigid-body-platform))
(set! (-> this float-height-offset) 0.0)
(rigid-body-platform-method-29 this *rigid-body-platform-constants*)
(let ((s5-0 (-> this info control-point-count)))
(dotimes (s4-0 s5-0)
(let ((s3-0 (-> this control-point-array data s4-0)))
(let ((f30-0 (* 65536.0 (/ (the float s4-0) (the float s5-0)))))
(set! (-> s3-0 local-pos x) (* 12288.0 (sin f30-0)))
(set! (-> s3-0 local-pos y) -10240.0)
(set! (-> s3-0 local-pos z) (* 12288.0 (cos f30-0)))
)
(set! (-> s3-0 local-pos w) 1.0)
)
)
)
0
(none)
)
;; definition for method 11 of type rigid-body-platform
;; INFO: Return type mismatch int vs none.
(defmethod init-from-entity! ((this rigid-body-platform) (arg0 entity-actor))
(logior! (-> this mask) (process-mask platform))
(rigid-body-platform-method-30 this)
(process-drawable-from-entity! this arg0)
(rigid-body-platform-method-31 this)
(rigid-body-platform-method-34 this)
0
(none)
)