mirror of
https://github.com/open-goal/jak-project
synced 2026-07-04 21:35:47 -04:00
3ee2b4423c
This PR does a few cleanups: - improve method names/comments/flags for `enemy.gc` and a few other files - fix `new-stack-matrix0` not working for jak 3 - add `matrix-copy!` detection for jak 3 - add `vector-copy!` detection --------- Co-authored-by: water111 <awaterford1111445@gmail.com>
512 lines
16 KiB
Common Lisp
512 lines
16 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: camera-h.gc
|
|
;; name in dgo: camera-h
|
|
;; dgos: GAME
|
|
|
|
;; +++cam-index-options
|
|
(defenum cam-index-options
|
|
:type uint32
|
|
:bitfield #t
|
|
(SPHERICAL)
|
|
(RADIAL)
|
|
)
|
|
;; ---cam-index-options
|
|
|
|
|
|
;; +++slave-los-state
|
|
(defenum slave-los-state
|
|
:type uint32
|
|
(none 0)
|
|
(cw 1)
|
|
(ccw 2)
|
|
(between 3)
|
|
)
|
|
;; ---slave-los-state
|
|
|
|
|
|
;; +++camera-blend-to-type
|
|
(defenum camera-blend-to-type
|
|
:type uint64
|
|
(unknown-0 0)
|
|
(unknown-1 1)
|
|
(unknown-2 2)
|
|
)
|
|
;; ---camera-blend-to-type
|
|
|
|
|
|
;; +++camera-blend-from-type
|
|
(defenum camera-blend-from-type
|
|
:type uint64
|
|
(unknown-0 0)
|
|
(unknown-1 1)
|
|
(unknown-2 2)
|
|
)
|
|
;; ---camera-blend-from-type
|
|
|
|
|
|
;; +++cam-slave-options-u32
|
|
(defenum cam-slave-options-u32
|
|
:type uint32
|
|
:bitfield #t
|
|
:copy-entries cam-slave-options
|
|
)
|
|
;; ---cam-slave-options-u32
|
|
|
|
|
|
;; +++cam-master-options-u32
|
|
(defenum cam-master-options-u32
|
|
:type uint32
|
|
:bitfield #t
|
|
:copy-entries cam-master-options
|
|
)
|
|
;; ---cam-master-options-u32
|
|
|
|
(define-extern cam-stop (function symbol))
|
|
(define-extern cam-start (function symbol none))
|
|
|
|
(declare-type camera-slave process)
|
|
(declare-type cam-rotation-tracker structure)
|
|
(declare-type camera-master process)
|
|
|
|
;; camera
|
|
(define-extern camera-line-rel-len (function vector vector float vector4w none))
|
|
(define-extern camera-slave-debug (function camera-slave none))
|
|
(define-extern cam-calc-follow! (function cam-rotation-tracker vector symbol vector))
|
|
(define-extern slave-set-rotation! (function cam-rotation-tracker vector cam-slave-options-u32 float symbol none))
|
|
(define-extern cam-master-effect (function none :behavior camera-master))
|
|
(define-extern camera-master-debug (function camera-master none))
|
|
|
|
;; cam-master
|
|
(define-extern group-rain-screend-drop sparticle-launch-group)
|
|
|
|
;; cam-states
|
|
(define-extern cam-debug-reset-coll-tri (function none))
|
|
(define-extern cam-debug-add-los-tri (function (inline-array collide-cache-tri) vector vector none))
|
|
(define-extern cam-collision-record-save (function vector vector int symbol camera-slave none))
|
|
(define-extern slave-los-state->string (function slave-los-state string))
|
|
|
|
;; cam-layout
|
|
(define-extern camera-line-setup (function vector4w none))
|
|
(define-extern camera-line-draw (function vector vector none))
|
|
(define-extern camera-line (function vector vector vector4w none))
|
|
(define-extern camera-cross (function vector vector vector vector4w meters none))
|
|
(define-extern camera-fov-frame (function matrix vector float float float vector4w symbol))
|
|
(define-extern cam-slave-options->string (function cam-slave-options object string))
|
|
(define-extern cam-index-options->string (function cam-index-options object string))
|
|
|
|
;; cam-start
|
|
(define-extern reset-cameras (function none))
|
|
|
|
;; cam-interface
|
|
(define-extern camera-angle (function float))
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
(deftype cam-index (structure)
|
|
((flags cam-index-options)
|
|
(vec vector 2 :inline)
|
|
)
|
|
(:methods
|
|
(cam-index-method-9 (_type_ symbol entity vector curve) symbol)
|
|
(cam-index-method-10 (_type_ vector) float)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype tracking-point (structure)
|
|
((position vector :inline)
|
|
(direction vector :inline)
|
|
(tp-length float)
|
|
(next int32)
|
|
(incarnation int32)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype tracking-spline-sampler (structure)
|
|
((cur-pt int32)
|
|
(partial-pt float)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype tracking-spline (structure)
|
|
((point tracking-point 32 :inline)
|
|
(summed-len float)
|
|
(free-point int32)
|
|
(used-point int32)
|
|
(partial-point float)
|
|
(end-point int32)
|
|
(next-to-last-point int32)
|
|
(max-move float)
|
|
(sample-len float)
|
|
(used-count int32)
|
|
(old-position vector :inline)
|
|
(debug-old-position vector :inline)
|
|
(debug-out-position vector :inline)
|
|
(debug-last-point int32)
|
|
)
|
|
(:methods
|
|
(tracking-spline-method-9 (_type_) none)
|
|
(tracking-spline-method-10 (_type_ vector) none)
|
|
(debug-point-info (_type_ int) none)
|
|
(debug-all-points (_type_) none)
|
|
(tracking-spline-method-13 (_type_ int) none)
|
|
(tracking-spline-method-14 (_type_ tracking-spline-sampler) none)
|
|
(tracking-spline-method-15 (_type_) none)
|
|
(tracking-spline-method-16 (_type_ float) none)
|
|
(tracking-spline-method-17 (_type_ vector float float symbol) int)
|
|
(tracking-spline-method-18 (_type_ float vector vector tracking-spline-sampler) vector)
|
|
(tracking-spline-method-19 (_type_ float vector vector tracking-spline-sampler) vector)
|
|
(tracking-spline-method-20 (_type_ vector int) none)
|
|
(tracking-spline-method-21 (_type_ vector float float float float vector) vector)
|
|
(tracking-spline-method-22 (_type_ float) symbol)
|
|
(debug-draw-spline (_type_) none)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype cam-float-seeker (structure)
|
|
((target float)
|
|
(value float)
|
|
(vel float)
|
|
(accel float)
|
|
(max-vel float)
|
|
(max-partial float)
|
|
)
|
|
:pack-me
|
|
(:methods
|
|
(init (_type_ float float float float) none)
|
|
(copy-to (_type_ _type_) none)
|
|
(update! (_type_ float) none)
|
|
(jump-to-target! (_type_ float) float)
|
|
)
|
|
)
|
|
|
|
|
|
(defmethod init ((this cam-float-seeker) (arg0 float) (arg1 float) (arg2 float) (arg3 float))
|
|
(set! (-> this target) arg0)
|
|
(set! (-> this value) arg0)
|
|
(set! (-> this vel) 0.0)
|
|
(set! (-> this accel) arg1)
|
|
(set! (-> this max-vel) arg2)
|
|
(set! (-> this max-partial) arg3)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod copy-to ((this cam-float-seeker) (arg0 cam-float-seeker))
|
|
(set! (-> this target) (-> arg0 target))
|
|
(set! (-> this value) (-> arg0 value))
|
|
(set! (-> this vel) (-> arg0 vel))
|
|
(set! (-> this accel) (-> arg0 accel))
|
|
(set! (-> this max-vel) (-> arg0 max-vel))
|
|
(set! (-> this max-partial) (-> arg0 max-partial))
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod update! ((this cam-float-seeker) (arg0 float))
|
|
0.0
|
|
0.0
|
|
(let ((f0-2 (-> *display* dog-ratio)))
|
|
0.0
|
|
(while (< 0.001 f0-2)
|
|
(let ((f1-2 (if (< 1.0 f0-2)
|
|
1.0
|
|
f0-2
|
|
)
|
|
)
|
|
)
|
|
(set! f0-2 (+ -1.0 f0-2))
|
|
(let* ((f3-2 (- (+ (-> this target) arg0) (-> this value)))
|
|
(f2-4 (* (-> this max-partial) (fabs f3-2)))
|
|
)
|
|
(let ((f3-3 (* f3-2 (-> this accel))))
|
|
(+! (-> this vel) f3-3)
|
|
)
|
|
(let ((f3-6 (fabs (-> this vel)))
|
|
(f2-5 (fmin f2-4 (-> this max-vel)))
|
|
)
|
|
(if (< f2-5 f3-6)
|
|
(set! (-> this vel) (* (-> this vel) (/ f2-5 f3-6)))
|
|
)
|
|
)
|
|
)
|
|
(let ((f1-3 (* (-> this vel) f1-2)))
|
|
(+! (-> this value) f1-3)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod jump-to-target! ((this cam-float-seeker) (arg0 float))
|
|
(set! (-> this value) (+ (-> this target) arg0))
|
|
(set! (-> this vel) 0.0)
|
|
0.0
|
|
)
|
|
|
|
(deftype cam-vector-seeker (structure)
|
|
((target vector :inline)
|
|
(value vector :inline)
|
|
(vel vector :inline)
|
|
(accel float)
|
|
(max-vel float)
|
|
(max-partial float)
|
|
)
|
|
(:methods
|
|
(init (_type_ vector float float float) none)
|
|
(update! (_type_ vector) none)
|
|
)
|
|
)
|
|
|
|
|
|
(defmethod init ((this cam-vector-seeker) (arg0 vector) (arg1 float) (arg2 float) (arg3 float))
|
|
(cond
|
|
(arg0
|
|
(vector-copy! (-> this target) arg0)
|
|
(vector-copy! (-> this value) arg0)
|
|
)
|
|
(else
|
|
(vector-reset! (-> this target))
|
|
(vector-reset! (-> this value))
|
|
)
|
|
)
|
|
(vector-reset! (-> this vel))
|
|
(set! (-> this accel) arg1)
|
|
(set! (-> this max-vel) arg2)
|
|
(set! (-> this max-partial) arg3)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod update! ((this cam-vector-seeker) (arg0 vector))
|
|
(let ((v1-0 (new 'stack-no-clear 'vector)))
|
|
0.0
|
|
(let ((f0-1 (-> *display* dog-ratio)))
|
|
0.0
|
|
(while (< 0.001 f0-1)
|
|
(let ((f1-2 (if (< 1.0 f0-1)
|
|
1.0
|
|
f0-1
|
|
)
|
|
)
|
|
)
|
|
(set! f0-1 (+ -1.0 f0-1))
|
|
(cond
|
|
(arg0
|
|
(vector+! v1-0 (-> this target) arg0)
|
|
(vector-! v1-0 v1-0 (-> this value))
|
|
)
|
|
(else
|
|
(vector-! v1-0 (-> this target) (-> this value))
|
|
)
|
|
)
|
|
(let ((f2-2 (* (-> this max-partial) (vector-length v1-0))))
|
|
(vector-float*! v1-0 v1-0 (-> this accel))
|
|
(vector+! (-> this vel) (-> this vel) v1-0)
|
|
(let ((f3-2 (vector-length (-> this vel)))
|
|
(f2-3 (fmin f2-2 (-> this max-vel)))
|
|
)
|
|
(if (< f2-3 f3-2)
|
|
(vector-float*! (-> this vel) (-> this vel) (/ f2-3 f3-2))
|
|
)
|
|
)
|
|
)
|
|
(vector-float*! v1-0 (-> this vel) f1-2)
|
|
)
|
|
(vector+! (-> this value) (-> this value) v1-0)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(deftype cam-rotation-tracker (structure)
|
|
((inv-mat matrix :inline)
|
|
(no-follow basic)
|
|
(follow-pt vector :inline)
|
|
(follow-off vector :inline)
|
|
(follow-blend float)
|
|
(tilt-adjust cam-float-seeker :inline)
|
|
(point-of-interest-blend cam-float-seeker :inline)
|
|
(underwater-blend cam-float-seeker :inline)
|
|
(looking-at vector :inline)
|
|
(looking-interesting vector :inline)
|
|
(old-cam-trans vector :inline)
|
|
(follow-height-extra cam-float-seeker :inline)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype camera-combiner (process)
|
|
((trans vector :inline)
|
|
(inv-camera-rot matrix :inline)
|
|
(fov float)
|
|
(interp-val float)
|
|
(interp-step float)
|
|
(dist-from-src float)
|
|
(dist-from-dest float)
|
|
(flip-control-axis vector :inline)
|
|
(velocity vector :inline)
|
|
(tracking-status uint64)
|
|
(tracking-options int32)
|
|
(tracking cam-rotation-tracker :inline)
|
|
(fast-rot basic)
|
|
)
|
|
(:states
|
|
cam-combiner-active
|
|
)
|
|
)
|
|
|
|
|
|
(deftype camera-slave (process)
|
|
((trans vector :inline)
|
|
(fov float)
|
|
(fov0 float)
|
|
(fov1 float)
|
|
(fov-index cam-index :inline)
|
|
(tracking cam-rotation-tracker :inline)
|
|
(view-off-param float)
|
|
(view-off vector :inline)
|
|
(joystick-saved-view-off vector :inline)
|
|
(min-z-override float)
|
|
(view-flat vector :inline)
|
|
(string-vel-dir uint32)
|
|
(string-trans vector :inline)
|
|
(position-spline tracking-spline :inline)
|
|
(pivot-pt vector :inline)
|
|
(pivot-rad float)
|
|
(circular-follow vector :inline)
|
|
(max-angle-offset float)
|
|
(max-angle-curr float)
|
|
(options cam-slave-options-u32)
|
|
(cam-entity entity)
|
|
(butt-timer time-frame)
|
|
(butt-seek basic)
|
|
(butt-vector vector :inline)
|
|
(velocity vector :inline)
|
|
(desired-pos vector :inline)
|
|
(time-dist-too-far uint32)
|
|
(los-state slave-los-state)
|
|
(good-point vector :inline)
|
|
(los-tgt-spline-pt int32)
|
|
(los-tgt-spline-pt-incarnation int32)
|
|
(los-last-pos vector :inline)
|
|
(intro-curve curve :inline)
|
|
(intro-offset vector :inline)
|
|
(intro-t float)
|
|
(intro-t-step float)
|
|
(outro-exit-value float)
|
|
(spline-exists symbol)
|
|
(spline-curve curve :inline)
|
|
(spline-offset vector :inline)
|
|
(index cam-index :inline)
|
|
(saved-pt vector :inline)
|
|
(spline-tt float)
|
|
(spline-follow-dist float)
|
|
(enter-has-run symbol)
|
|
(blend-from-type camera-blend-from-type)
|
|
(blend-to-type camera-blend-to-type)
|
|
(have-phony-joystick basic)
|
|
(phony-joystick-x float)
|
|
(phony-joystick-y float)
|
|
(string-min-val vector :inline)
|
|
(string-max-val vector :inline)
|
|
(string-val-locked basic)
|
|
(relative-position vector :inline)
|
|
(string-relative basic)
|
|
(slope-adjust cam-float-seeker :inline)
|
|
(slope-quat quaternion :inline)
|
|
)
|
|
(:states
|
|
cam-bike
|
|
cam-bt-gun
|
|
cam-circular
|
|
cam-decel
|
|
cam-endlessfall
|
|
cam-eye
|
|
cam-fixed
|
|
cam-fixed-read-entity
|
|
cam-free-floating
|
|
cam-launcher-longfall
|
|
cam-launcher-shortfall
|
|
cam-lookat
|
|
cam-no-trans
|
|
cam-point-watch
|
|
cam-pov
|
|
cam-pov-track
|
|
cam-pov180
|
|
cam-power-game
|
|
cam-really-fixed
|
|
cam-remote
|
|
cam-scorpion-gun
|
|
cam-spline
|
|
cam-standoff
|
|
cam-standoff-read-entity
|
|
cam-stick
|
|
cam-string
|
|
cam-tube-sled
|
|
cam-turret
|
|
)
|
|
)
|
|
|
|
|
|
(deftype camera-master (process)
|
|
((master-options cam-master-options-u32)
|
|
(settings cam-setting-data)
|
|
(slave (pointer camera-slave))
|
|
(decel (pointer camera-slave))
|
|
(slave-options cam-slave-options-u32)
|
|
(view-off-param-save float)
|
|
(changer uint32)
|
|
(string-min cam-vector-seeker :inline)
|
|
(string-max cam-vector-seeker :inline)
|
|
(string-push-z float)
|
|
(local-down vector :inline)
|
|
(focus focus :inline)
|
|
(being-attacked symbol)
|
|
(attack-start time-frame)
|
|
(on-ground symbol)
|
|
(under-water int32)
|
|
(on-pole symbol)
|
|
(tgt-rot-mat matrix :inline)
|
|
(tgt-face-mat matrix :inline)
|
|
(tpos-old vector :inline)
|
|
(tpos-curr vector :inline)
|
|
(tpos-old-adj vector :inline)
|
|
(tpos-curr-adj vector :inline)
|
|
(tpos-tgt vector :inline)
|
|
(upspeed float)
|
|
(pitch-off vector :inline)
|
|
(target-spline tracking-spline :inline)
|
|
(ease-from vector :inline)
|
|
(ease-t float)
|
|
(ease-step float)
|
|
(ease-to vector :inline)
|
|
(outro-curve curve :inline)
|
|
(outro-t float)
|
|
(outro-t-step float)
|
|
(outro-exit-value float)
|
|
(water-drip-time time-frame)
|
|
(water-drip sparticle-launch-control)
|
|
(water-drip-mult float)
|
|
(water-drip-speed float)
|
|
(interest-dist float)
|
|
)
|
|
(:methods
|
|
(camera-master-method-14 (_type_ vector) vector)
|
|
(camera-master-method-15 (_type_ vector) vector)
|
|
(camera-master-method-16 (_type_ symbol) int)
|
|
)
|
|
(:states
|
|
cam-master-active
|
|
)
|
|
)
|