Files
jak-project/goal_src/jak1/engine/anim/aligner-h.gc
T
2022-06-29 22:20:09 -04:00

73 lines
2.2 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: aligner-h.gc
;; name in dgo: aligner-h
;; dgos: GAME, ENGINE
(defenum align-flags
:bitfield #t
:type uint32
(disabled) ;; set by aligner if it determined it shouldn't perform alignment.
)
(defenum align-opts
:bitfield #t
:type uint32
(adjust-x-vel) ;; adjust x
(adjust-y-vel) ;; adjust y
(adjust-xz-vel) ;; adjust both x and z. (don't set this with adjust-x)
(keep-other-velocities) ;; if set, keep xz plane velocities if their alignment isn't requested
(adjust-quat) ;; adjust the orientation
(alop0)
(alop1)
(alop2)
(alop3)
(alop4)
(alop5)
(no-gravity) ;; do not apply any gravity
(ignore-y-if-zero) ;; if set and the alignment velocity is 0 in y, don't apply it.
)
(deftype align-control (basic)
((flags align-flags :offset-assert 4)
(process process-drawable :offset-assert 8)
(frame-group art-joint-anim :offset-assert 12)
(frame-num float :offset-assert 16)
(matrix matrix 2 :inline :offset-assert 32)
(transform transform 2 :inline :offset-assert 160)
(delta transformq :inline :offset-assert 256)
(last-speed meters :offset-assert 304)
(align transformq :inline :offset 160)
)
:method-count-assert 14
:size-assert #x134
:flag-assert #xe00000134
(:methods
(new (symbol type process) _type_ :behavior process-drawable 0)
(compute-alignment! (_type_) transformq 9)
(align! (_type_ align-opts float float float) trsqv 10)
(align-vel-and-quat-only! (_type_ align-opts vector int float float) trsqv 11) ;; 3rd arg is unused
(first-transform (_type_) transform 12)
(snd-transform (_type_) transform 13)
)
)
(defmethod new align-control ((allocation symbol) (type-to-make type) (proc process))
"Create a new align-control."
(let ((obj (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
(when (zero? obj)
(go process-drawable-art-error "memory")
(return (the align-control 0))
)
(set! (-> obj process) (the-as process-drawable proc))
obj
)
)