diff --git a/common/formatter/rules/rule_config.cpp b/common/formatter/rules/rule_config.cpp index 340a06223f..499b7818b6 100644 --- a/common/formatter/rules/rule_config.cpp +++ b/common/formatter/rules/rule_config.cpp @@ -197,6 +197,7 @@ const std::unordered_map opengoal_form_config {"let*", new_binding_rule(5)}, {"rlet", new_binding_rule(5)}, {"when", new_flow_rule(2)}, + {"#when", new_flow_rule(2)}, {"countdown", new_flow_rule(2)}, {"until", new_flow_rule(2)}, {"loop", new_flow_rule(2)}, diff --git a/goal_src/jak1/compiler-setup.gc b/goal_src/jak1/compiler-setup.gc index 611421d1c0..d7231aad37 100644 --- a/goal_src/jak1/compiler-setup.gc +++ b/goal_src/jak1/compiler-setup.gc @@ -1,6 +1,6 @@ -;; -;; Compiler Setup for Jak 1 -;; +#|@file +Compiler Setup for Jak 1 +|# ;; load kernel type definitions. ;; these types/functions are provided by Jak 1's runtime. @@ -11,7 +11,9 @@ ;; jak 1 - specific library stuff. -(defmacro __get_jak1_full_game () *jak1-full-game*) +(defmacro __get_jak1_full_game () + *jak1-full-game*) + (defconstant *jak1-full-game* (__get_jak1_full_game)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -20,26 +22,21 @@ (defmacro basic? (obj) ;; todo, make this more efficient - `(= 4 (logand (the integer ,obj) #b111)) - ) + `(= 4 (logand (the integer ,obj) #b111))) (defmacro pair? (obj) ;; todo, make this more efficient ;`(= 2 (logand (the integer ,obj) #b111)) - `(< (shl (the-as int ,obj) 62) 0) - ) + `(< (shl (the-as int ,obj) 62) 0)) (defmacro not-pair? (obj) - `(>= (shl (the-as int ,obj) 62) 0) - ) + `(>= (shl (the-as int ,obj) 62) 0)) (defmacro binteger? (obj) - `(zero? (logand (the integer ,obj) #b111)) - ) + `(zero? (logand (the integer ,obj) #b111))) (defmacro rtype-of (obj) - `(cond ((binteger? ,obj) binteger) - ((pair? ,obj) pair) - (else (-> (the basic ,obj) type)) - ) - ) + `(cond + ((binteger? ,obj) binteger) + ((pair? ,obj) pair) + (else (-> (the basic ,obj) type)))) diff --git a/goal_src/jak1/engine/anim/aligner-h.gc b/goal_src/jak1/engine/anim/aligner-h.gc index 1dc18153d0..d2648659d4 100644 --- a/goal_src/jak1/engine/anim/aligner-h.gc +++ b/goal_src/jak1/engine/anim/aligner-h.gc @@ -1,14 +1,8 @@ ;;-*-Lisp-*- (in-package goal) (bundles "ENGINE.CGO" "GAME.CGO") - (require "engine/draw/drawable-h.gc") (require "kernel/gstate.gc") - -;; name: aligner-h.gc -;; name in dgo: aligner-h -;; dgos: GAME, ENGINE - (defenum align-flags :bitfield #t :type uint32 @@ -18,53 +12,46 @@ (defenum align-opts :bitfield #t :type uint32 - (adjust-x-vel) ;; adjust x - (adjust-y-vel) ;; adjust y + (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 + (adjust-quat) ;; adjust the orientation (alop0) (alop1) (alop2) (alop3) (alop4) (alop5) - (no-gravity) ;; do not apply any gravity + (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. ) ;; DECOMP BEGINS (deftype align-control (basic) - ((flags align-flags) - (process process-drawable) - (frame-group art-joint-anim) - (frame-num float) - (matrix matrix 2 :inline) - (transform transform 2 :inline) - (delta transformq :inline) - (last-speed meters) - (align transformq :inline :overlay-at (-> transform 0 trans x)) - ) + ((flags align-flags) + (process process-drawable) + (frame-group art-joint-anim) + (frame-num float) + (matrix matrix 2 :inline) + (transform transform 2 :inline) + (delta transformq :inline) + (last-speed meters) + (align transformq :inline :overlay-at (-> transform 0 trans x))) (:methods - (new (symbol type process-drawable) _type_) - (compute-alignment! (_type_) transformq) - (align! (_type_ align-opts float float float) trsqv) - (align-vel-and-quat-only! (_type_ align-opts vector int float float) trsqv) - (first-transform (_type_) transform) - (snd-transform (_type_) transform) - ) - ) - + (new (symbol type process-drawable) _type_) + (compute-alignment! (_type_) transformq) + (align! (_type_ align-opts float float float) trsqv) + (align-vel-and-quat-only! (_type_ align-opts vector int float float) trsqv) + (first-transform (_type_) transform) + (snd-transform (_type_) transform))) (defmethod new align-control ((allocation symbol) (type-to-make type) (proc process-drawable)) "Create a new align-control." (let ((this (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (when (zero? this) (go process-drawable-art-error "memory") - (return (the align-control 0)) - ) + (return (the align-control 0))) (set! (-> this process) proc) - this - ) - ) + this)) diff --git a/goal_src/jak1/engine/anim/aligner.gc b/goal_src/jak1/engine/anim/aligner.gc index 3e32d206cc..1935efdb89 100644 --- a/goal_src/jak1/engine/anim/aligner.gc +++ b/goal_src/jak1/engine/anim/aligner.gc @@ -1,14 +1,9 @@ ;;-*-Lisp-*- (in-package goal) (bundles "ENGINE.CGO" "GAME.CGO") - (require "engine/anim/aligner-h.gc") (require "engine/common-obs/process-drawable.gc") -;; name: aligner.gc -;; name in dgo: aligner -;; dgos: GAME, ENGINE - ;; DECOMP BEGINS ;; ERROR: Unsupported inline assembly instruction kind - [lw ra, return-from-thread(s7)] @@ -22,46 +17,26 @@ (v1-5 (-> a0-3 frame-group)) (a0-4 (-> a0-3 command)) (a1-0 'stack) - (a2-0 (= a0-4 a1-0)) - ) + (a2-0 (= a0-4 a1-0))) (cond - ((or a2-0 (begin (set! a1-0 'stack1) (= a0-4 a1-0))) - ) + ((or a2-0 (begin (set! a1-0 'stack1) (= a0-4 a1-0)))) (else - (when (!= (-> v1-5 type) art-joint-anim) - ;; og:preserve-this - (go process-drawable-art-error "align joint-anim") - (abandon-thread) - 0 - ) - ) - ) - ) - ) - ) + (when (!= (-> v1-5 type) art-joint-anim) + ;; og:preserve-this + (go process-drawable-art-error "align joint-anim") + (abandon-thread) + 0)))))) (let* ((a0-8 (-> this process skel root-channel 0)) (v1-16 (-> a0-8 frame-group)) - (f0-0 (-> a0-8 frame-num)) - ) + (f0-0 (-> a0-8 frame-num))) (= (-> a0-8 num-func) num-func-loop!) (cond - ((or (not v1-16) (!= (-> this frame-group) v1-16)) - (set! a0-9 #t) - ) - ((= (-> a0-8 num-func) num-func-loop!) - (set! a0-9 (< (* (-> a0-8 param 0) (- f0-0 (-> this frame-num))) 0.0)) - ) - (else - (set! a0-9 (= f0-0 0.0)) - ) - ) - (if a0-9 - (logior! (-> this flags) (align-flags disabled)) - (logclear! (-> this flags) (align-flags disabled)) - ) + ((or (not v1-16) (!= (-> this frame-group) v1-16)) (set! a0-9 #t)) + ((= (-> a0-8 num-func) num-func-loop!) (set! a0-9 (< (* (-> a0-8 param 0) (- f0-0 (-> this frame-num))) 0.0))) + (else (set! a0-9 (= f0-0 0.0)))) + (if a0-9 (logior! (-> this flags) (align-flags disabled)) (logclear! (-> this flags) (align-flags disabled))) (set! (-> this frame-group) v1-16) - (set! (-> this frame-num) f0-0) - ) + (set! (-> this frame-num) f0-0)) (mem-copy! (the-as pointer (-> this transform 1)) (the-as pointer (-> this transform)) 48) (quaternion-copy! (the-as quaternion (-> this transform 1 rot)) (-> this align quat)) (set! (-> this transform 1 scale quad) (-> this align scale quad)) @@ -70,13 +45,11 @@ (v1-19 (-> a3-0 0 vector 0 quad)) (a0-18 (-> a3-0 0 vector 1 quad)) (a1-12 (-> a3-0 0 vector 2 quad)) - (a3-1 (-> a3-0 0 vector 3 quad)) - ) + (a3-1 (-> a3-0 0 vector 3 quad))) (set! (-> a2-5 0 quad) v1-19) (set! (-> a2-5 1 quad) a0-18) (set! (-> a2-5 2 quad) a1-12) - (set! (-> a2-5 3 quad) a3-1) - ) + (set! (-> a2-5 3 quad) a3-1)) (let ((s5-1 (-> this process node-list data 1))) (cspace<-matrix-no-push-joint! s5-1 (-> this process skel)) (let* ((v1-23 (-> this matrix)) @@ -84,104 +57,65 @@ (a0-21 (-> a3-2 vector 0 quad)) (a1-14 (-> a3-2 vector 1 quad)) (a2-6 (-> a3-2 vector 2 quad)) - (a3-3 (-> a3-2 vector 3 quad)) - ) + (a3-3 (-> a3-2 vector 3 quad))) (set! (-> v1-23 0 vector 0 quad) a0-21) (set! (-> v1-23 0 vector 1 quad) a1-14) (set! (-> v1-23 0 vector 2 quad) a2-6) - (set! (-> v1-23 0 vector 3 quad) a3-3) - ) - (vector*! (the-as vector (-> this transform)) (-> s5-1 bone transform vector 3) (-> this process root scale)) - ) - (vector-! - (the-as vector (-> this delta)) - (the-as vector (-> this transform)) - (the-as vector (-> this transform 1)) - ) - (set-vector! - (-> this align scale) - (vector-length (the-as vector (-> this matrix))) - (vector-length (-> this matrix 0 vector 1)) - (vector-length (-> this matrix 0 vector 2)) - 1.0 - ) + (set! (-> v1-23 0 vector 3 quad) a3-3)) + (vector*! (the-as vector (-> this transform)) (-> s5-1 bone transform vector 3) (-> this process root scale))) + (vector-! (the-as vector (-> this delta)) (the-as vector (-> this transform)) (the-as vector (-> this transform 1))) + (set-vector! (-> this align scale) + (vector-length (the-as vector (-> this matrix))) + (vector-length (-> this matrix 0 vector 1)) + (vector-length (-> this matrix 0 vector 2)) + 1.0) (vector-! (-> this delta scale) (-> this align scale) (-> this transform 1 scale)) (let ((a2-8 (matrix-inv-scale! (new 'stack-no-clear 'matrix) (-> this align scale)))) - (quaternion-normalize! - (matrix->quaternion (-> this align quat) (matrix*! a2-8 (the-as matrix (-> this matrix)) a2-8)) - ) - ) - (let ((a1-24 (quaternion-inverse! (new 'stack-no-clear 'quaternion) (the-as quaternion (-> this transform 1 rot)))) - ) - (quaternion-normalize! (quaternion*! (-> this delta quat) a1-24 (-> this align quat))) - ) - (-> this delta) - ) - ) + (quaternion-normalize! (matrix->quaternion (-> this align quat) (matrix*! a2-8 (the-as matrix (-> this matrix)) a2-8)))) + (let ((a1-24 (quaternion-inverse! (new 'stack-no-clear 'quaternion) (the-as quaternion (-> this transform 1 rot))))) + (quaternion-normalize! (quaternion*! (-> this delta quat) a1-24 (-> this align quat)))) + (-> this delta))) (defmethod first-transform ((this align-control)) - (the-as transform (-> this transform)) - ) + (the-as transform (-> this transform))) (defmethod snd-transform ((this align-control)) - (-> this transform 1) - ) + (-> this transform 1)) (defmethod align! ((this align-control) (arg0 align-opts) (arg1 float) (arg2 float) (arg3 float)) (when (not (logtest? (-> this flags) (align-flags disabled))) (let* ((a0-1 (-> this process)) (t9-0 (method-of-object a0-1 apply-alignment)) (v1-4 (-> this delta)) - (t1-0 (new 'stack-no-clear 'vector)) - ) + (t1-0 (new 'stack-no-clear 'vector))) (set! (-> t1-0 x) arg1) (set! (-> t1-0 y) arg2) (set! (-> t1-0 z) arg3) (set! (-> t1-0 w) 1.0) - (t9-0 a0-1 arg0 v1-4 t1-0) - ) - ) - (-> this process root) - ) + (t9-0 a0-1 arg0 v1-4 t1-0))) + (-> this process root)) (defmethod set-and-limit-velocity ((this trsqv) (arg0 int) (arg1 vector) (arg2 float)) (let ((gp-0 (-> this transv))) (when (logtest? arg0 4) (set! (-> gp-0 x) (-> arg1 x)) (set! (-> gp-0 z) (-> arg1 z)) - (let ((f0-4 (fmin (* (vector-xz-length arg1) (-> *display* frames-per-second)) arg2))) - (vector-xz-normalize! gp-0 f0-4) - ) - ) - ) - this - ) + (let ((f0-4 (fmin (* (vector-xz-length arg1) (-> *display* frames-per-second)) arg2))) (vector-xz-normalize! gp-0 f0-4)))) + this) (defmethod align-vel-and-quat-only! ((this align-control) (arg0 align-opts) (arg1 vector) (arg2 int) (arg3 float) (arg4 float)) (when (not (logtest? (-> this flags) (align-flags disabled))) (let ((s5-0 (-> this delta))) (let ((s3-0 (-> this process root transv))) (if (logtest? arg0 (align-opts adjust-y-vel)) - (set! (-> s3-0 y) (* (-> s5-0 trans y) arg3 (-> *display* frames-per-second))) - ) + (set! (-> s3-0 y) (* (-> s5-0 trans y) arg3 (-> *display* frames-per-second)))) (when (logtest? arg0 (align-opts adjust-xz-vel)) (set! (-> s3-0 x) (-> arg1 x)) (set! (-> s3-0 z) (-> arg1 z)) - (let ((f0-8 (* (fmin (vector-xz-length arg1) (* (vector-xz-length (-> s5-0 trans)) arg4)) - (-> *display* frames-per-second) - ) - ) - (t9-2 vector-xz-normalize!) - ) + (let ((f0-8 (* (fmin (vector-xz-length arg1) (* (vector-xz-length (-> s5-0 trans)) arg4)) (-> *display* frames-per-second))) + (t9-2 vector-xz-normalize!)) (set! (-> this last-speed) f0-8) - (t9-2 s3-0 f0-8) - ) - ) - ) + (t9-2 s3-0 f0-8)))) (if (logtest? arg0 (align-opts adjust-quat)) - (quaternion-normalize! (quaternion*! (-> this process root quat) (-> this process root quat) (-> s5-0 quat))) - ) - ) - ) - (-> this process root) - ) + (quaternion-normalize! (quaternion*! (-> this process root quat) (-> this process root quat) (-> s5-0 quat)))))) + (-> this process root)) diff --git a/goal_src/jak1/engine/anim/joint-exploder.gc b/goal_src/jak1/engine/anim/joint-exploder.gc index b1c793f46f..13b9af5d00 100644 --- a/goal_src/jak1/engine/anim/joint-exploder.gc +++ b/goal_src/jak1/engine/anim/joint-exploder.gc @@ -1,250 +1,165 @@ ;;-*-Lisp-*- (in-package goal) (bundles "GAME.CGO") - (require "engine/collide/collide-cache.gc") (require "engine/common-obs/process-drawable.gc") -;; name: joint-exploder.gc -;; name in dgo: joint-exploder -;; dgos: GAME, COMMON, L1 - ;; DECOMP BEGINS (deftype joint-exploder-tuning (structure) - ((explosion uint64) - (duration time-frame) - (gravity float) - (rot-speed float) - (fountain-rand-transv-lo vector :inline) - (fountain-rand-transv-hi vector :inline) - (away-from-focal-pt vector :inline :overlay-at fountain-rand-transv-lo) - (away-from-rand-transv-xz-lo float :overlay-at (-> fountain-rand-transv-hi x)) - (away-from-rand-transv-xz-hi float :overlay-at (-> fountain-rand-transv-hi y)) - (away-from-rand-transv-y-lo float :overlay-at (-> fountain-rand-transv-hi z)) - (away-from-rand-transv-y-hi float :overlay-at (-> fountain-rand-transv-hi w)) - ) + ((explosion uint64) + (duration time-frame) + (gravity float) + (rot-speed float) + (fountain-rand-transv-lo vector :inline) + (fountain-rand-transv-hi vector :inline) + (away-from-focal-pt vector :inline :overlay-at fountain-rand-transv-lo) + (away-from-rand-transv-xz-lo float :overlay-at (-> fountain-rand-transv-hi x)) + (away-from-rand-transv-xz-hi float :overlay-at (-> fountain-rand-transv-hi y)) + (away-from-rand-transv-y-lo float :overlay-at (-> fountain-rand-transv-hi z)) + (away-from-rand-transv-y-hi float :overlay-at (-> fountain-rand-transv-hi w))) (:methods - (new (symbol type int) _type_) - ) - ) - + (new (symbol type int) _type_))) (deftype joint-exploder-static-joint-params (structure) - ((joint-index int16) - (parent-joint-index int16) - ) - ) - + ((joint-index int16) + (parent-joint-index int16))) (deftype joint-exploder-static-params (basic) - ((joints (array joint-exploder-static-joint-params)) - ) - ) - + ((joints (array joint-exploder-static-joint-params)))) (deftype joint-exploder-joint (structure) - ((next int16) - (prev int16) - (joint-index int16) - (rspeed float) - (mat matrix :inline) - (rmat matrix :inline) - (transv vector :inline) - (prev-pos vector :inline) - ) - ) - + ((next int16) + (prev int16) + (joint-index int16) + (rspeed float) + (mat matrix :inline) + (rmat matrix :inline) + (transv vector :inline) + (prev-pos vector :inline))) (deftype joint-exploder-joints (basic) - ((num-joints int32) - (joint joint-exploder-joint :inline :dynamic :offset 16) - ) + ((num-joints int32) + (joint joint-exploder-joint :inline :dynamic :offset 16)) (:methods - (new (symbol type joint-exploder-static-params) _type_) - ) - ) - + (new (symbol type joint-exploder-static-params) _type_))) (deftype joint-exploder-list (structure) - ((head int32) - (pre-moved? symbol) - (bbox-valid? symbol) - (bbox bounding-box :inline) - ) - ) - + ((head int32) + (pre-moved? symbol) + (bbox-valid? symbol) + (bbox bounding-box :inline))) (deftype joint-exploder (process-drawable) - ((parent-override (pointer process-drawable) :overlay-at parent) - (die-if-below-y float) - (die-if-beyond-xz-dist-sqrd float) - (joints joint-exploder-joints) - (static-params joint-exploder-static-params) - (anim art-joint-anim) - (scale-vector vector :inline) - (tuning joint-exploder-tuning :inline) - (lists joint-exploder-list 5 :inline) - ) + ((parent-override (pointer process-drawable) :overlay-at parent) + (die-if-below-y float) + (die-if-beyond-xz-dist-sqrd float) + (joints joint-exploder-joints) + (static-params joint-exploder-static-params) + (anim art-joint-anim) + (scale-vector vector :inline) + (tuning joint-exploder-tuning :inline) + (lists joint-exploder-list 5 :inline)) (:methods - (joint-exploder-method-20 (_type_ joint-exploder-list int) int) - (joint-exploder-method-21 (_type_ joint-exploder-list joint-exploder-joint) none) - (joint-exploder-method-22 (_type_ joint-exploder-list) symbol) - (joint-exploder-method-23 (_type_) symbol) - (joint-exploder-method-24 (_type_ joint-exploder-list int) int) - (joint-exploder-method-25 (_type_ joint-exploder-list) symbol) - (joint-exploder-method-26 (_type_ joint-exploder-list int) int) - (joint-exploder-method-27 (_type_ joint-exploder-list int) joint-exploder-list) - (joint-exploder-method-28 (_type_ joint-exploder-list) none) - ) + (joint-exploder-method-20 (_type_ joint-exploder-list int) int) + (joint-exploder-method-21 (_type_ joint-exploder-list joint-exploder-joint) none) + (joint-exploder-method-22 (_type_ joint-exploder-list) symbol) + (joint-exploder-method-23 (_type_) symbol) + (joint-exploder-method-24 (_type_ joint-exploder-list int) int) + (joint-exploder-method-25 (_type_ joint-exploder-list) symbol) + (joint-exploder-method-26 (_type_ joint-exploder-list int) int) + (joint-exploder-method-27 (_type_ joint-exploder-list int) joint-exploder-list) + (joint-exploder-method-28 (_type_ joint-exploder-list) none)) (:states - joint-exploder-shatter - ) - ) - + joint-exploder-shatter)) (defmethod asize-of ((this joint-exploder-joints)) - (the-as int (+ (-> this type size) (* 176 (-> this num-joints)))) - ) + (the-as int (+ (-> this type size) (* 176 (-> this num-joints))))) (defmethod new joint-exploder-joints ((allocation symbol) (type-to-make type) (arg0 joint-exploder-static-params)) (let* ((gp-0 (-> arg0 joints length)) - (v0-0 (object-new allocation type-to-make (the-as int (+ (-> type-to-make size) (* 176 gp-0))))) - ) + (v0-0 (object-new allocation type-to-make (the-as int (+ (-> type-to-make size) (* 176 gp-0)))))) (set! (-> v0-0 num-joints) gp-0) - v0-0 - ) - ) + v0-0)) (defun joint-exploder-joint-callback ((arg0 joint-exploder)) (let ((gp-0 (-> arg0 node-list))) (let ((s4-0 (-> arg0 joints))) (countdown (s3-0 (-> s4-0 num-joints)) (let* ((v1-3 (-> s4-0 joint s3-0)) - (a0-5 (-> gp-0 data (-> v1-3 joint-index) bone transform)) - ) - (matrix*! a0-5 (-> v1-3 rmat) (-> v1-3 mat)) - ) - ) - ) + (a0-5 (-> gp-0 data (-> v1-3 joint-index) bone transform))) + (matrix*! a0-5 (-> v1-3 rmat) (-> v1-3 mat))))) (let ((s5-1 (-> arg0 scale-vector))) (countdown (s4-1 (-> gp-0 length)) - (let ((a2-1 (-> gp-0 data s4-1 bone transform))) - (scale-matrix! a2-1 s5-1 a2-1) - ) - ) - ) - ) + (let ((a2-1 (-> gp-0 data s4-1 bone transform))) (scale-matrix! a2-1 s5-1 a2-1))))) 0 - (none) - ) + (none)) (defmethod joint-exploder-method-24 ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) (let ((v0-0 (joint-exploder-method-26 this arg0 arg1))) (let* ((v1-1 (-> this joints)) - (v1-2 (-> v1-1 joint arg1)) - ) + (v1-2 (-> v1-1 joint arg1))) (set! (-> v1-2 mat vector 0 quad) (the-as uint128 0)) (set! (-> v1-2 mat vector 1 quad) (the-as uint128 0)) (set! (-> v1-2 mat vector 2 quad) (the-as uint128 0)) - (set! (-> v1-2 mat vector 3 quad) (-> this root trans quad)) - ) - v0-0 - ) - ) + (set! (-> v1-2 mat vector 3 quad) (-> this root trans quad))) + v0-0)) (defmethod joint-exploder-method-26 ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) (let* ((v1-0 (-> this joints)) (a2-1 (-> v1-0 joint arg1)) (a0-4 (-> a2-1 prev)) - (v0-0 (-> a2-1 next)) - ) + (v0-0 (-> a2-1 next))) (cond ((>= a0-4 0) (set! (-> v1-0 joint a0-4 next) v0-0) - (if (>= v0-0 0) - (set! (-> (the-as joint-exploder-joint (-> v1-0 joint v0-0)) prev) a0-4) - ) - ) + (if (>= v0-0 0) (set! (-> (the-as joint-exploder-joint (-> v1-0 joint v0-0)) prev) a0-4))) (else - (set! (-> arg0 head) v0-0) - (cond - ((>= v0-0 0) - (let ((v1-2 (-> v1-0 joint v0-0))) - (set! (-> v1-2 prev) -1) - ) - ) - (else - (set! (-> arg0 bbox-valid?) #f) - ) - ) - ) - ) - v0-0 - ) - ) + (set! (-> arg0 head) v0-0) + (cond + ((>= v0-0 0) (let ((v1-2 (-> v1-0 joint v0-0))) (set! (-> v1-2 prev) -1))) + (else (set! (-> arg0 bbox-valid?) #f))))) + v0-0)) (defmethod joint-exploder-method-20 ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) (let* ((v1-0 (-> this joints)) (a3-0 (-> v1-0 joint arg1)) - (a0-4 (-> arg0 head)) - ) + (a0-4 (-> arg0 head))) (set! (-> arg0 head) arg1) (set! (-> a3-0 prev) -1) (set! (-> a3-0 next) a0-4) (when (>= a0-4 0) (set! (-> (the-as joint-exploder-joint (-> v1-0 joint a0-4)) prev) arg1) - arg1 - ) - ) - ) + arg1))) (defmethod joint-exploder-method-21 ((this joint-exploder) (arg0 joint-exploder-list) (arg1 joint-exploder-joint)) (let ((a1-1 (-> arg1 mat vector 3))) (cond - ((-> arg0 bbox-valid?) - (add-point! (-> arg0 bbox) (the-as vector3s a1-1)) - ) + ((-> arg0 bbox-valid?) (add-point! (-> arg0 bbox) (the-as vector3s a1-1))) (else - (set! (-> arg0 bbox-valid?) #t) - (set! (-> arg0 bbox min quad) (-> a1-1 quad)) - (set! (-> arg0 bbox max quad) (-> a1-1 quad)) - ) - ) - ) + (set! (-> arg0 bbox-valid?) #t) + (set! (-> arg0 bbox min quad) (-> a1-1 quad)) + (set! (-> arg0 bbox max quad) (-> a1-1 quad))))) (add-point! (-> arg0 bbox) (the-as vector3s (-> arg1 prev-pos))) - (none) - ) + (none)) (defmethod joint-exploder-method-27 ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) (local-vars (sv-16 int) (sv-32 int) (sv-48 int)) (let ((s4-0 (the-as joint-exploder-list #f))) (let ((v1-0 1)) (until (= v1-0 5) - (let ((a0-4 (-> this lists v1-0))) - (when (< (-> a0-4 head) 0) - (set! s4-0 a0-4) - (goto cfg-6) - ) - ) - (+! v1-0 1) - ) - ) + (let ((a0-4 (-> this lists v1-0))) (when (< (-> a0-4 head) 0) (set! s4-0 a0-4) (goto cfg-6))) + (+! v1-0 1))) (label cfg-6) (let ((s3-0 (the-as object s4-0))) (cond ((the-as joint-exploder-list s3-0) (set! (-> (the-as joint-exploder-list s3-0) pre-moved?) #t) - (set! (-> (the-as joint-exploder-list s3-0) bbox-valid?) #f) - ) - (else - (set! s3-0 (-> this lists)) - ) - ) + (set! (-> (the-as joint-exploder-list s3-0) bbox-valid?) #f)) + (else (set! s3-0 (-> this lists)))) (set! (-> arg0 bbox-valid?) #f) (let ((s2-0 (-> this joints)) - (s1-0 (-> arg0 head)) - ) + (s1-0 (-> arg0 head))) (cond ((zero? arg1) (let ((f30-0 (* 0.5 (+ (-> arg0 bbox min x) (-> arg0 bbox max x))))) @@ -255,17 +170,8 @@ (set! sv-16 (joint-exploder-method-26 this arg0 s1-0)) (joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0) (set! s1-0 sv-16) - (joint-exploder-method-21 this (the-as joint-exploder-list s3-0) s0-0) - ) - (else - (joint-exploder-method-21 this arg0 s0-0) - (set! s1-0 (-> s0-0 next)) - ) - ) - ) - ) - ) - ) + (joint-exploder-method-21 this (the-as joint-exploder-list s3-0) s0-0)) + (else (joint-exploder-method-21 this arg0 s0-0) (set! s1-0 (-> s0-0 next)))))))) ((= arg1 1) (let ((f30-1 (* 0.5 (+ (-> arg0 bbox min y) (-> arg0 bbox max y))))) (while (>= s1-0 0) @@ -275,17 +181,8 @@ (set! sv-32 (joint-exploder-method-26 this arg0 s1-0)) (joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0) (set! s1-0 sv-32) - (joint-exploder-method-21 this (the-as joint-exploder-list s3-0) s0-1) - ) - (else - (joint-exploder-method-21 this arg0 s0-1) - (set! s1-0 (-> s0-1 next)) - ) - ) - ) - ) - ) - ) + (joint-exploder-method-21 this (the-as joint-exploder-list s3-0) s0-1)) + (else (joint-exploder-method-21 this arg0 s0-1) (set! s1-0 (-> s0-1 next)))))))) ((= arg1 2) (let ((f30-2 (* 0.5 (+ (-> arg0 bbox min z) (-> arg0 bbox max z))))) (while (>= s1-0 0) @@ -295,67 +192,33 @@ (set! sv-48 (joint-exploder-method-26 this arg0 s1-0)) (joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0) (set! s1-0 sv-48) - (joint-exploder-method-21 this (the-as joint-exploder-list s3-0) s0-2) - ) - (else - (joint-exploder-method-21 this arg0 s0-2) - (set! s1-0 (-> s0-2 next)) - ) - ) - ) - ) - ) - ) - ) - ) - ) - s4-0 - ) - ) + (joint-exploder-method-21 this (the-as joint-exploder-list s3-0) s0-2)) + (else (joint-exploder-method-21 this arg0 s0-2) (set! s1-0 (-> s0-2 next))))))))))) + s4-0)) (defmethod joint-exploder-method-28 ((this joint-exploder) (arg0 joint-exploder-list)) (when (and (-> arg0 bbox-valid?) (>= (-> arg0 head) 0)) (cond ((< 20480.0 (- (-> arg0 bbox max x) (-> arg0 bbox min x))) - (let ((a1-2 (joint-exploder-method-27 this arg0 0))) - (if a1-2 - (joint-exploder-method-28 this a1-2) - ) - ) - (joint-exploder-method-28 this arg0) - ) + (let ((a1-2 (joint-exploder-method-27 this arg0 0))) (if a1-2 (joint-exploder-method-28 this a1-2))) + (joint-exploder-method-28 this arg0)) ((< 20480.0 (- (-> arg0 bbox max y) (-> arg0 bbox min y))) - (let ((a1-5 (joint-exploder-method-27 this arg0 1))) - (if a1-5 - (joint-exploder-method-28 this a1-5) - ) - ) - (joint-exploder-method-28 this arg0) - ) + (let ((a1-5 (joint-exploder-method-27 this arg0 1))) (if a1-5 (joint-exploder-method-28 this a1-5))) + (joint-exploder-method-28 this arg0)) ((< 20480.0 (- (-> arg0 bbox max z) (-> arg0 bbox min z))) - (let ((a1-8 (joint-exploder-method-27 this arg0 2))) - (if a1-8 - (joint-exploder-method-28 this a1-8) - ) - ) - (joint-exploder-method-28 this arg0) - ) - ) - ) - (none) - ) + (let ((a1-8 (joint-exploder-method-27 this arg0 2))) (if a1-8 (joint-exploder-method-28 this a1-8))) + (joint-exploder-method-28 this arg0)))) + (none)) (defmethod joint-exploder-method-25 ((this joint-exploder) (arg0 joint-exploder-list)) (set! (-> arg0 bbox-valid?) #f) (set! (-> arg0 pre-moved?) #t) (let ((s4-0 (-> this joints)) (f30-0 (* (-> this tuning gravity) (seconds-per-frame))) - (s3-0 (-> arg0 head)) - ) + (s3-0 (-> arg0 head))) (while (>= s3-0 0) (let* ((s2-0 (-> s4-0 joint s3-0)) - (s1-0 (-> s2-0 mat vector 3)) - ) + (s1-0 (-> s2-0 mat vector 3))) (set! (-> s2-0 prev-pos quad) (-> s1-0 quad)) (+! (-> s2-0 transv y) f30-0) (vector-v+! s1-0 s1-0 (-> s2-0 transv)) @@ -364,156 +227,101 @@ (f5-0 (-> s2-0 rmat vector 0 x)) (f4-0 (-> s2-0 rmat vector 0 y)) (f3-0 (-> s2-0 rmat vector 1 x)) - (f1-2 (-> s2-0 rmat vector 1 y)) - ) + (f1-2 (-> s2-0 rmat vector 1 y))) (set! (-> s2-0 rmat vector 0 x) (- (* f5-0 f0-3) (* f4-0 f2-1))) (set! (-> s2-0 rmat vector 0 y) (+ (* f5-0 f2-1) (* f4-0 f0-3))) (set! (-> s2-0 rmat vector 1 x) (- (* f3-0 f0-3) (* f1-2 f2-1))) - (set! (-> s2-0 rmat vector 1 y) (+ (* f3-0 f2-1) (* f1-2 f0-3))) - ) + (set! (-> s2-0 rmat vector 1 y) (+ (* f3-0 f2-1) (* f1-2 f0-3)))) (cond ((or (< (-> s1-0 y) (-> this die-if-below-y)) - (< (-> this die-if-beyond-xz-dist-sqrd) (vector-vector-xz-distance s1-0 (-> this root trans))) - ) - (set! s3-0 (joint-exploder-method-24 this arg0 s3-0)) - ) - (else - (joint-exploder-method-21 this arg0 s2-0) - (set! s3-0 (-> s2-0 next)) - ) - ) - ) - ) - ) - #f - ) + (< (-> this die-if-beyond-xz-dist-sqrd) (vector-vector-xz-distance s1-0 (-> this root trans)))) + (set! s3-0 (joint-exploder-method-24 this arg0 s3-0))) + (else (joint-exploder-method-21 this arg0 s2-0) (set! s3-0 (-> s2-0 next))))))) + #f) (defmethod joint-exploder-method-22 ((this joint-exploder) (arg0 joint-exploder-list)) - (fill-using-bounding-box - *collide-cache* - (-> arg0 bbox) - (collide-kind background) - this - (new 'static 'pat-surface :noentity #x1) - ) + (fill-using-bounding-box *collide-cache* + (-> arg0 bbox) + (collide-kind background) + this + (new 'static 'pat-surface :noentity #x1)) (let ((gp-1 (-> this joints)) - (v1-2 (-> arg0 head)) - ) + (v1-2 (-> arg0 head))) (while (>= v1-2 0) (let ((s5-1 (-> gp-1 joint v1-2))) (let ((s4-0 (-> s5-1 mat vector 3)) (a2-1 (new 'stack-no-clear 'vector)) - (s3-0 (new 'stack-no-clear 'collide-tri-result)) - ) + (s3-0 (new 'stack-no-clear 'collide-tri-result))) (vector-! a2-1 s4-0 (-> s5-1 prev-pos)) - (when (>= (probe-using-line-sphere - *collide-cache* - (-> s5-1 prev-pos) - a2-1 - 40.96 - (collide-kind background) - s3-0 - (new 'static 'pat-surface :noentity #x1) - ) - 0.0 - ) + (when (>= (probe-using-line-sphere *collide-cache* + (-> s5-1 prev-pos) + a2-1 + 40.96 + (collide-kind background) + s3-0 + (new 'static 'pat-surface :noentity #x1)) + 0.0) (set! (-> s4-0 quad) (-> s3-0 intersect quad)) (let ((f28-0 (vector-xz-length (-> s5-1 transv)))) (vector-reflect! (-> s5-1 transv) (-> s5-1 transv) (-> s3-0 normal)) (let ((f30-0 (-> s5-1 transv y))) (set! (-> s5-1 transv y) 0.0) (vector-normalize! (-> s5-1 transv) (* 0.75 f28-0)) - (set! (-> s5-1 transv y) (* 0.7 f30-0)) - ) - ) + (set! (-> s5-1 transv y) (* 0.7 f30-0)))) (+! (-> s4-0 y) (* 40.96 (-> s3-0 normal y))) (set! (-> s4-0 w) 1.0) - (set! (-> s5-1 rspeed) (* 0.5 (-> s5-1 rspeed))) - ) - ) - (set! v1-2 (-> s5-1 next)) - ) - ) - ) - #f - ) + (set! (-> s5-1 rspeed) (* 0.5 (-> s5-1 rspeed))))) + (set! v1-2 (-> s5-1 next))))) + #f) (defstate joint-exploder-shatter (joint-exploder) - :enter (behavior () - (set-time! (-> self state-time)) - ) - :trans (behavior () - (let* ((f1-0 (the float (- (current-time) (-> self state-time)))) - (f0-2 (- 1.0 (/ f1-0 (the float (-> self tuning duration))))) - (f1-2 (- 1.0 (/ f1-0 (* 0.75 (the float (-> self tuning duration)))))) - ) - (if (< f1-2 0.0) - (set! f1-2 0.0) - ) - (set-vector! (-> self scale-vector) f0-2 f1-2 f0-2 1.0) - ) - (dotimes (v1-8 5) - (set! (-> self lists v1-8 pre-moved?) #f) - ) - (dotimes (gp-0 5) - (let ((s5-0 (-> self lists gp-0))) - (when (>= (-> s5-0 head) 0) - (when (not (-> s5-0 pre-moved?)) - (joint-exploder-method-25 self s5-0) - (if (nonzero? gp-0) - (joint-exploder-method-28 self s5-0) - ) - ) - ) - ) - ) - (let ((gp-1 (new 'stack-no-clear 'bounding-box))) - (let ((v1-26 (-> self root trans))) - (set! (-> gp-1 min quad) (-> v1-26 quad)) - (set! (-> gp-1 max quad) (-> v1-26 quad)) - ) - (dotimes (s5-1 5) - (let ((s4-0 (-> self lists s5-1))) - (if (-> s4-0 bbox-valid?) - (add-box! gp-1 (-> s4-0 bbox)) - ) - (if (nonzero? s5-1) - (joint-exploder-method-22 self s4-0) - ) - ) - ) - (let ((s5-2 (-> self draw bounds))) - (set-vector! - s5-2 - (* 0.5 (+ (-> gp-1 min x) (-> gp-1 max x))) - (* 0.5 (+ (-> gp-1 min y) (-> gp-1 max y))) - (* 0.5 (+ (-> gp-1 min z) (-> gp-1 max z))) - 1.0 - ) - (let ((f0-12 (+ 16384.0 (vector-vector-distance s5-2 (-> gp-1 max))))) - (vector-! s5-2 s5-2 (-> self root trans)) - (set! (-> s5-2 w) f0-12) - ) - ) - ) - 0 - ) - :code (behavior () - (set-time! (-> self state-time)) - (until (time-elapsed? (-> self state-time) (-> self tuning duration)) - (suspend) - (ja :num! (loop!)) - ) - ) - :post ja-post - ) + :enter + (behavior () + (set-time! (-> self state-time))) + :trans + (behavior () + (let* ((f1-0 (the float (- (current-time) (-> self state-time)))) + (f0-2 (- 1.0 (/ f1-0 (the float (-> self tuning duration))))) + (f1-2 (- 1.0 (/ f1-0 (* 0.75 (the float (-> self tuning duration))))))) + (if (< f1-2 0.0) (set! f1-2 0.0)) + (set-vector! (-> self scale-vector) f0-2 f1-2 f0-2 1.0)) + (dotimes (v1-8 5) + (set! (-> self lists v1-8 pre-moved?) #f)) + (dotimes (gp-0 5) + (let ((s5-0 (-> self lists gp-0))) + (when (>= (-> s5-0 head) 0) + (when (not (-> s5-0 pre-moved?)) + (joint-exploder-method-25 self s5-0) + (if (nonzero? gp-0) (joint-exploder-method-28 self s5-0)))))) + (let ((gp-1 (new 'stack-no-clear 'bounding-box))) + (let ((v1-26 (-> self root trans))) (set! (-> gp-1 min quad) (-> v1-26 quad)) (set! (-> gp-1 max quad) (-> v1-26 quad))) + (dotimes (s5-1 5) + (let ((s4-0 (-> self lists s5-1))) + (if (-> s4-0 bbox-valid?) (add-box! gp-1 (-> s4-0 bbox))) + (if (nonzero? s5-1) (joint-exploder-method-22 self s4-0)))) + (let ((s5-2 (-> self draw bounds))) + (set-vector! s5-2 + (* 0.5 (+ (-> gp-1 min x) (-> gp-1 max x))) + (* 0.5 (+ (-> gp-1 min y) (-> gp-1 max y))) + (* 0.5 (+ (-> gp-1 min z) (-> gp-1 max z))) + 1.0) + (let ((f0-12 (+ 16384.0 (vector-vector-distance s5-2 (-> gp-1 max))))) + (vector-! s5-2 s5-2 (-> self root trans)) + (set! (-> s5-2 w) f0-12)))) + 0) + :code + (behavior () + (set-time! (-> self state-time)) + (until (time-elapsed? (-> self state-time) (-> self tuning duration)) + (suspend) + (ja :num! (loop!)))) + :post ja-post) (defmethod joint-exploder-method-23 ((this joint-exploder)) (let ((gp-0 (-> this joints))) (dotimes (s4-0 (-> gp-0 num-joints)) (let ((v1-2 (-> this static-params joints s4-0)) - (s3-0 (-> gp-0 joint s4-0)) - ) + (s3-0 (-> gp-0 joint s4-0))) (let ((a0-6 (-> v1-2 parent-joint-index))) (set! (-> s3-0 prev) (+ s4-0 -1)) (set! (-> s3-0 next) (+ s4-0 1)) @@ -521,95 +329,61 @@ (set! (-> s3-0 rspeed) (-> this tuning rot-speed)) (cond ((>= a0-6 0) - (if (zero? a0-6) - (set! a0-6 (-> v1-2 joint-index)) - ) + (if (zero? a0-6) (set! a0-6 (-> v1-2 joint-index))) (let* ((a3-0 (-> this parent-override 0 node-list data a0-6 bone transform)) (a2-0 (-> s3-0 mat)) (v1-9 (-> a3-0 vector 0 quad)) (a0-8 (-> a3-0 vector 1 quad)) (a1-4 (-> a3-0 vector 2 quad)) - (a3-1 (-> a3-0 vector 3 quad)) - ) + (a3-1 (-> a3-0 vector 3 quad))) (set! (-> a2-0 vector 0 quad) v1-9) (set! (-> a2-0 vector 1 quad) a0-8) (set! (-> a2-0 vector 2 quad) a1-4) - (set! (-> a2-0 vector 3 quad) a3-1) - ) - (matrix-identity! (-> s3-0 rmat)) - ) + (set! (-> a2-0 vector 3 quad) a3-1)) + (matrix-identity! (-> s3-0 rmat))) (else - (let* ((a3-2 (-> this node-list data (-> v1-2 joint-index) bone transform)) - (a2-1 (-> s3-0 mat)) - (v1-15 (-> a3-2 vector 0 quad)) - (a0-11 (-> a3-2 vector 1 quad)) - (a1-5 (-> a3-2 vector 2 quad)) - (a3-3 (-> a3-2 vector 3 quad)) - ) - (set! (-> a2-1 vector 0 quad) v1-15) - (set! (-> a2-1 vector 1 quad) a0-11) - (set! (-> a2-1 vector 2 quad) a1-5) - (set! (-> a2-1 vector 3 quad) a3-3) - ) - (matrix-identity! (-> s3-0 rmat)) - ) - ) - ) + (let* ((a3-2 (-> this node-list data (-> v1-2 joint-index) bone transform)) + (a2-1 (-> s3-0 mat)) + (v1-15 (-> a3-2 vector 0 quad)) + (a0-11 (-> a3-2 vector 1 quad)) + (a1-5 (-> a3-2 vector 2 quad)) + (a3-3 (-> a3-2 vector 3 quad))) + (set! (-> a2-1 vector 0 quad) v1-15) + (set! (-> a2-1 vector 1 quad) a0-11) + (set! (-> a2-1 vector 2 quad) a1-5) + (set! (-> a2-1 vector 3 quad) a3-3)) + (matrix-identity! (-> s3-0 rmat))))) (case (-> this tuning explosion) ((1) (vector-! (-> s3-0 transv) (-> s3-0 mat vector 3) (-> this tuning fountain-rand-transv-lo)) - (vector-normalize! - (-> s3-0 transv) - (rand-vu-float-range (-> this tuning fountain-rand-transv-hi x) (-> this tuning fountain-rand-transv-hi y)) - ) + (vector-normalize! (-> s3-0 transv) + (rand-vu-float-range (-> this tuning fountain-rand-transv-hi x) (-> this tuning fountain-rand-transv-hi y))) (+! (-> s3-0 transv y) - (rand-vu-float-range (-> this tuning fountain-rand-transv-hi z) (-> this tuning fountain-rand-transv-hi w)) - ) - (set! (-> s3-0 transv w) 1.0) - ) + (rand-vu-float-range (-> this tuning fountain-rand-transv-hi z) (-> this tuning fountain-rand-transv-hi w))) + (set! (-> s3-0 transv w) 1.0)) (else - (let ((s1-1 (-> this tuning fountain-rand-transv-lo)) - (s2-1 (-> this tuning fountain-rand-transv-hi)) - ) - (set-vector! - (-> s3-0 transv) - (rand-vu-float-range (-> s1-1 x) (-> s2-1 x)) - (rand-vu-float-range (-> s1-1 y) (-> s2-1 y)) - (rand-vu-float-range (-> s1-1 z) (-> s2-1 z)) - 1.0 - ) - ) - ) - ) - ) - ) + (let ((s1-1 (-> this tuning fountain-rand-transv-lo)) + (s2-1 (-> this tuning fountain-rand-transv-hi))) + (set-vector! (-> s3-0 transv) + (rand-vu-float-range (-> s1-1 x) (-> s2-1 x)) + (rand-vu-float-range (-> s1-1 y) (-> s2-1 y)) + (rand-vu-float-range (-> s1-1 z) (-> s2-1 z)) + 1.0)))))) (when (nonzero? (-> gp-0 num-joints)) - (let ((v1-26 (-> gp-0 joint (+ (-> gp-0 num-joints) -1)))) - (set! (-> v1-26 next) -1) - ) + (let ((v1-26 (-> gp-0 joint (+ (-> gp-0 num-joints) -1)))) (set! (-> v1-26 next) -1)) (let ((v1-27 (the-as joint-exploder-list (&-> this stack 224)))) (set! (-> v1-27 head) 0) (let ((s5-1 (-> v1-27 bbox))) (let ((v1-28 (the-as structure (-> gp-0 joint 0 mat vector 3)))) (set! (-> s5-1 min quad) (-> (the-as matrix v1-28) vector 0 quad)) - (set! (-> s5-1 max quad) (-> (the-as matrix v1-28) vector 0 quad)) - ) + (set! (-> s5-1 max quad) (-> (the-as matrix v1-28) vector 0 quad))) (dotimes (s4-1 (-> gp-0 num-joints)) - (add-point! s5-1 (the-as vector3s (+ (the-as uint (-> gp-0 joint 0 mat vector 3)) (* 176 s4-1)))) - ) - ) - ) - #f - ) - ) - ) + (add-point! s5-1 (the-as vector3s (+ (the-as uint (-> gp-0 joint 0 mat vector 3)) (* 176 s4-1))))))) + #f))) (defmethod relocate ((this joint-exploder) (arg0 int)) - (if (nonzero? (-> this joints)) - (&+! (-> this joints) arg0) - ) - (the-as joint-exploder ((method-of-type process-drawable relocate) this arg0)) - ) + (if (nonzero? (-> this joints)) (&+! (-> this joints) arg0)) + (the-as joint-exploder ((method-of-type process-drawable relocate) this arg0))) (defbehavior joint-exploder-init-by-other joint-exploder ((arg0 skeleton-group) (arg1 int) (arg2 joint-exploder-static-params) (arg3 joint-exploder-static-params)) (set! (-> self static-params) arg3) @@ -620,15 +394,13 @@ (let ((a0-6 (-> self lists v1-1))) (set! (-> a0-6 head) -1) (set! (-> a0-6 bbox-valid?) #f) - (set! (-> a0-6 pre-moved?) #f) - ) - ) + (set! (-> a0-6 pre-moved?) #f))) (logior! (-> self mask) (process-mask enemy)) (set! (-> self root) (new 'process 'trsqv)) (set! (-> self root trans quad) (-> self parent-override 0 root trans quad)) (quaternion-copy! (-> self root quat) (-> self parent-override 0 root quat)) (set! (-> self root scale quad) (-> self parent-override 0 root scale quad)) - (initialize-skeleton self arg0 '()) + (initialize-skeleton self arg0 ()) (logior! (-> self skel status) (janim-status inited)) (set! (-> self anim) (the-as art-joint-anim (-> self draw art-group data arg1))) (ja-channel-set! 1) @@ -638,13 +410,11 @@ (set! (-> self die-if-below-y) (+ -102400.0 (-> self root trans y))) (set! (-> self skel postbind-function) joint-exploder-joint-callback) (go joint-exploder-shatter) - (none) - ) + (none)) (defmethod new joint-exploder-tuning ((allocation symbol) (type-to-make type) (arg0 int)) (let ((t9-0 (method-of-type structure new)) - (v1-1 type-to-make) - ) + (v1-1 type-to-make)) (-> type-to-make size) (let ((v0-0 (the-as joint-exploder-tuning (t9-0 allocation v1-1)))) (set! (-> v0-0 explosion) (the-as uint arg0)) @@ -654,17 +424,11 @@ (cond ((zero? arg0) (set-vector! (-> v0-0 fountain-rand-transv-lo) -81920.0 20480.0 -81920.0 1.0) - (set-vector! (-> v0-0 fountain-rand-transv-hi) 81920.0 61440.0 81920.0 1.0) - ) + (set-vector! (-> v0-0 fountain-rand-transv-hi) 81920.0 61440.0 81920.0 1.0)) ((= arg0 1) (vector-reset! (-> v0-0 fountain-rand-transv-lo)) (set! (-> v0-0 fountain-rand-transv-hi x) 49152.0) (set! (-> v0-0 fountain-rand-transv-hi y) 163840.0) (set! (-> v0-0 fountain-rand-transv-hi z) 20480.0) - (set! (-> v0-0 fountain-rand-transv-hi w) 61440.0) - ) - ) - v0-0 - ) - ) - ) + (set! (-> v0-0 fountain-rand-transv-hi w) 61440.0))) + v0-0))) diff --git a/goal_src/jak1/engine/anim/joint-h.gc b/goal_src/jak1/engine/anim/joint-h.gc index c611d08531..8e7b6ab107 100644 --- a/goal_src/jak1/engine/anim/joint-h.gc +++ b/goal_src/jak1/engine/anim/joint-h.gc @@ -1,7 +1,6 @@ ;;-*-Lisp-*- (in-package goal) (bundles "ENGINE.CGO" "GAME.CGO") - (require "kernel-defs.gc") ;; name: joint-h.gc @@ -9,11 +8,15 @@ ;; dgos: GAME, ENGINE (declare-type joint-control basic) + (declare-type effect-control basic) (define-extern cspace<-parented-transformq-joint! (function cspace transformq none)) + (define-extern cspace<-transformq! (function cspace transformq matrix)) + (define-extern vector<-cspace! (function vector cspace vector)) + (define-extern create-interpolated-joint-animation-frame (function (inline-array vector) int process-drawable int)) (defenum janim-status @@ -27,8 +30,7 @@ (spool 5) (blerc-done 6) (eye-done 7) - (eye 8) - ) + (eye 8)) ;; DECOMP BEGINS @@ -38,87 +40,71 @@ ;; A single joint control channel. It can control some number of joints through a single animation. ;; Multiple channels are blended together to create smooth transitions between animations. (deftype joint-control-channel (structure) - ((parent joint-control) - (command symbol) - (frame-interp float) - (frame-group art-joint-anim) - (frame-num float) - (num-func (function joint-control-channel float float float)) - (param float 2) - (group-sub-index int16) - (group-size int16) - (dist meters) - (eval-time uint32) - (inspector-amount float) - ) + ((parent joint-control) + (command symbol) + (frame-interp float) + (frame-group art-joint-anim) + (frame-num float) + (num-func (function joint-control-channel float float float)) + (param float 2) + (group-sub-index int16) + (group-size int16) + (dist meters) + (eval-time uint32) + (inspector-amount float)) (:methods - (debug-print-frames (_type_) _type_) - ) - ) - + (debug-print-frames (_type_) _type_))) (deftype joint-control (basic) - ((status janim-status) - (allocated-length int16) - (root-channel (inline-array joint-control-channel) :offset 16) - (blend-index int32) - (active-channels int32) - (generate-frame-function (function (inline-array vector) int process-drawable int)) - (prebind-function (function pointer int process-drawable none)) - (postbind-function (function process-drawable none)) - (effect effect-control) - (channel joint-control-channel 3 :inline) - (frame-group0 art-joint-anim :overlay-at (-> channel 0 frame-group)) - (frame-num0 float :overlay-at (-> channel 0 frame-num)) - (frame-interp0 float :overlay-at (-> channel 0 frame-interp)) - (frame-group1 art-joint-anim :offset 108) - (frame-num1 float :offset 112) - (frame-interp1 float :offset 104) - (frame-group2 art-joint-anim :offset 156) - (frame-num2 float :offset 160) - (frame-interp2 float :offset 152) - ) + ((status janim-status) + (allocated-length int16) + (root-channel (inline-array joint-control-channel) :offset 16) + (blend-index int32) + (active-channels int32) + (generate-frame-function (function (inline-array vector) int process-drawable int)) + (prebind-function (function pointer int process-drawable none)) + (postbind-function (function process-drawable none)) + (effect effect-control) + (channel joint-control-channel 3 :inline) + (frame-group0 art-joint-anim :overlay-at (-> channel 0 frame-group)) + (frame-num0 float :overlay-at (-> channel 0 frame-num)) + (frame-interp0 float :overlay-at (-> channel 0 frame-interp)) + (frame-group1 art-joint-anim :offset 108) + (frame-num1 float :offset 112) + (frame-interp1 float :offset 104) + (frame-group2 art-joint-anim :offset 156) + (frame-num2 float :offset 160) + (frame-interp2 float :offset 152)) (:methods - (new (symbol type int) _type_) - (current-cycle-distance (_type_) float) - (debug-print-channels (_type_ symbol) int) - ) - ) - + (new (symbol type int) _type_) + (current-cycle-distance (_type_) float) + (debug-print-channels (_type_ symbol) int))) (deftype matrix-stack (structure) - ((top matrix) - (data matrix 24 :inline) - ) - ) - + ((top matrix) + (data matrix 24 :inline))) (deftype channel-upload-info (structure) - ((fixed joint-anim-compressed-fixed) - (fixed-qwc int32) - (frame joint-anim-compressed-frame) - (frame-qwc int32) - (amount float) - (interp float) - ) - :pack-me - ) - + ((fixed joint-anim-compressed-fixed) + (fixed-qwc int32) + (frame joint-anim-compressed-frame) + (frame-qwc int32) + (amount float) + (interp float)) + :pack-me) (deftype joint-work (structure) - ((temp-mtx matrix :inline) - (joint-stack matrix-stack :inline) - (fix-jmp-table (function none) 16) - (frm-jmp-table (function none) 16) - (pair-jmp-table (function none) 16) - (uploads channel-upload-info 24 :inline) - (num-uploads int32) - (mtx-acc matrix 2 :inline) - (tq-acc transformq 100 :inline) - (jacp-hdr joint-anim-compressed-hdr :inline) - (fixed-data joint-anim-compressed-fixed :inline) - (frame-data joint-anim-compressed-frame 2 :inline) - (flatten-array float 576 :overlay-at mtx-acc) - (flattened vector 24 :inline :overlay-at mtx-acc) - ) - ) + ((temp-mtx matrix :inline) + (joint-stack matrix-stack :inline) + (fix-jmp-table (function none) 16) + (frm-jmp-table (function none) 16) + (pair-jmp-table (function none) 16) + (uploads channel-upload-info 24 :inline) + (num-uploads int32) + (mtx-acc matrix 2 :inline) + (tq-acc transformq 100 :inline) + (jacp-hdr joint-anim-compressed-hdr :inline) + (fixed-data joint-anim-compressed-fixed :inline) + (frame-data joint-anim-compressed-frame 2 :inline) + (flatten-array float 576 :overlay-at mtx-acc) + (flattened vector 24 :inline :overlay-at mtx-acc))) diff --git a/goal_src/jak1/engine/anim/joint-mod-h.gc b/goal_src/jak1/engine/anim/joint-mod-h.gc index 2b01f7bae8..ef391ad8c7 100644 --- a/goal_src/jak1/engine/anim/joint-mod-h.gc +++ b/goal_src/jak1/engine/anim/joint-mod-h.gc @@ -1,7 +1,6 @@ ;;-*-Lisp-*- (in-package goal) (bundles "ENGINE.CGO" "GAME.CGO") - (require "engine/geometry/geometry.gc") (require "engine/game/main-h.gc") (require "engine/debug/debug-h.gc") @@ -22,76 +21,70 @@ ;; an animation. For example, this is used to point Jak's head toward an attacking enemy. (define-extern joint-mod-look-at-handler (function cspace transformq none)) + (define-extern joint-mod-world-look-at-handler (function cspace transformq none)) + (define-extern joint-mod-rotate-handler (function cspace transformq none)) + (define-extern joint-mod-joint-set-handler (function cspace transformq none)) + (define-extern joint-mod-joint-set*-handler (function cspace transformq none)) ;; There are several modes available for joint-mod. (defenum joint-mod-handler-mode - :bitfield #t - :type uint32 - (flex-blend 0) ;; 1 - (look-at 1) ;; 2 - (world-look-at 2) ;; 4 - (rotate 3) ;; 8 - (joint-set 4) ;; 16 - (joint-set* 5) ;; 32 - ;; ?? ;; 64 - (reset 7) ;; 128 - ) + :bitfield #t + :type uint32 + (flex-blend 0) ;; 1 + (look-at 1) ;; 2 + (world-look-at 2) ;; 4 + (rotate 3) ;; 8 + (joint-set 4) ;; 16 + (joint-set* 5) ;; 32 + ;; ?? ;; 64 + (reset 7) ;; 128 + ) ;; The joint-mod itself represents a modification to a single joint. ;; Although the mode is a bitfield, it appears that multiple kinds of mods cannot be ;; activated at the same time. (deftype joint-mod (basic) - ((mode joint-mod-handler-mode) - (process process-drawable) - (joint cspace) - (target vector :inline) - (twist vector :inline) - (twist-max vector :inline) - (trans vector :inline) - (quat quaternion :inline) - (scale vector :inline) - (notice-time time-frame) - (flex-blend float) - (blend float) - (max-dist meters) - (ignore-angle degrees) - (up uint8) - (nose uint8) - (ear uint8) - (shutting-down? symbol) - (parented-scale? symbol :overlay-at max-dist) - ) + ((mode joint-mod-handler-mode) + (process process-drawable) + (joint cspace) + (target vector :inline) + (twist vector :inline) + (twist-max vector :inline) + (trans vector :inline) + (quat quaternion :inline) + (scale vector :inline) + (notice-time time-frame) + (flex-blend float) + (blend float) + (max-dist meters) + (ignore-angle degrees) + (up uint8) + (nose uint8) + (ear uint8) + (shutting-down? symbol) + (parented-scale? symbol :overlay-at max-dist)) (:methods - (new (symbol type joint-mod-handler-mode process-drawable int) _type_) - (set-mode! (_type_ joint-mod-handler-mode) _type_) - (set-target! (_type_ vector) none) - (look-at-enemy! (_type_ vector symbol process) none) - (reset-blend! (_type_) _type_) - (set-twist! (_type_ float float float) vector) - (set-trs! (_type_ vector quaternion vector) none) - (shut-down! (_type_) none) - ) - ) - + (new (symbol type joint-mod-handler-mode process-drawable int) _type_) + (set-mode! (_type_ joint-mod-handler-mode) _type_) + (set-target! (_type_ vector) none) + (look-at-enemy! (_type_ vector symbol process) none) + (reset-blend! (_type_) _type_) + (set-twist! (_type_ float float float) vector) + (set-trs! (_type_ vector quaternion vector) none) + (shut-down! (_type_) none))) (defun-debug joint-mod-debug-draw ((mod joint-mod)) "Draw a frame at the bone." ;; I believe this draws a set of coordinate axes that represent the transformation matrix. (add-debug-matrix #t (bucket-id debug-no-zbuf) (-> mod joint bone transform)) 0 - (none) - ) + (none)) -(defmethod new joint-mod ((allocation symbol) - (type-to-make type) - (mode joint-mod-handler-mode) - (proc process-drawable) - (joint-idx int) - ) +(defmethod new joint-mod ((allocation symbol) (type-to-make type) (mode joint-mod-handler-mode) (proc process-drawable) (joint-idx int)) "Construct a new joint-mod. It will work on the given process-drawable's joint." (let ((this (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (set! (-> this process) proc) @@ -107,9 +100,7 @@ (set! (-> this ignore-angle) 65536.0) (set! (-> this flex-blend) 1.0) (set! (-> this shutting-down?) #f) - this - ) - ) + this)) (defmethod set-mode! ((this joint-mod) (handler-mode joint-mod-handler-mode)) "Set up the joint-mod for the given mode. You can only pick one mode at a time." @@ -121,31 +112,26 @@ (set! (-> joint param1) #f) (set! (-> joint param2) #f) (set! (-> this blend) 0.0) - (set! (-> this flex-blend) 1.0) - ) + (set! (-> this flex-blend) 1.0)) (((joint-mod-handler-mode reset)) (set! (-> joint param0) #f) (set! (-> joint param1) #f) (set! (-> joint param2) #f) (set! (-> this blend) 0.0) - (set! (-> this shutting-down?) #f) - ) + (set! (-> this shutting-down?) #f)) (((joint-mod-handler-mode look-at)) (set! (-> joint param0) joint-mod-look-at-handler) (set! (-> joint param1) this) - (set! (-> joint param2) #f) - ) + (set! (-> joint param2) #f)) (((joint-mod-handler-mode world-look-at)) (set! (-> joint param0) joint-mod-world-look-at-handler) (set! (-> joint param1) this) - (set! (-> joint param2) #f) - ) + (set! (-> joint param2) #f)) (((joint-mod-handler-mode rotate)) (set! (-> joint param0) joint-mod-rotate-handler) (set! (-> joint param1) this) (set! (-> joint param2) #f) - (set! (-> this blend) 1.0) - ) + (set! (-> this blend) 1.0)) (((joint-mod-handler-mode joint-set)) (set! (-> joint param0) joint-mod-joint-set-handler) (set! (-> joint param1) this) @@ -153,8 +139,7 @@ (vector-reset! (-> this trans)) (quaternion-identity! (-> this quat)) (set-vector! (-> this scale) 1.0 1.0 1.0 1.0) - (set! (-> this max-dist) (the-as meters #f)) - ) + (set! (-> this max-dist) (the-as meters #f))) (((joint-mod-handler-mode joint-set*)) (set! (-> joint param0) joint-mod-joint-set*-handler) (set! (-> joint param1) this) @@ -162,80 +147,51 @@ (vector-reset! (-> this trans)) (quaternion-identity! (-> this quat)) (set-vector! (-> this scale) 1.0 1.0 1.0 1.0) - (set! (-> this max-dist) (the-as meters #f)) - ) - ) - ) - this - ) + (set! (-> this max-dist) (the-as meters #f))))) + this) (defmethod reset-blend! ((this joint-mod)) "Reset the blend to 0." (set! (-> this blend) 0.0) - this - ) + this) (defmethod shut-down! ((this joint-mod)) "Shut down and set the blend to zero." (set! (-> this shutting-down?) #t) (set! (-> this blend) 0.0) - (none) - ) + (none)) (defmethod set-twist! ((this joint-mod) (x float) (y float) (z float)) "Set the twist. You can use #f to not change the current value." - (if x - (set! (-> this twist x) x) - ) - (if y - (set! (-> this twist y) y) - ) - (if z - (set! (-> this twist z) z) - ) - (-> this twist) - ) + (if x (set! (-> this twist x) x)) + (if y (set! (-> this twist y) y)) + (if z (set! (-> this twist z) z)) + (-> this twist)) (defmethod set-trs! ((this joint-mod) (trans vector) (rot quaternion) (scale vector)) - (if trans - (set! (-> this trans quad) (-> trans quad)) - ) - (if rot - (quaternion-copy! (-> this quat) rot) - ) - (if scale - (set! (-> this scale quad) (-> scale quad)) - ) + (if trans (set! (-> this trans quad) (-> trans quad))) + (if rot (quaternion-copy! (-> this quat) rot)) + (if scale (set! (-> this scale quad) (-> scale quad))) 0 - (none) - ) + (none)) (defmethod set-target! ((this joint-mod) (target-trans vector)) "Set the joint-mod to look-at if we aren't in a mode, and look at the given target-trans." ;; set mode, if we aren't in one. - (if (= (-> this mode) (joint-mod-handler-mode reset)) - (set-mode! this (joint-mod-handler-mode look-at)) - ) + (if (= (-> this mode) (joint-mod-handler-mode reset)) (set-mode! this (joint-mod-handler-mode look-at))) ;; how far are we from the target? (let ((distance (vector-vector-distance (-> this process root trans) target-trans))) (set! (-> this shutting-down?) #f) (set! (-> this target quad) (-> target-trans quad)) - (if (< distance (-> this max-dist)) - (set! (-> this blend) 1.0) - (set! (-> this blend) 0.0) - ) - ) + (if (< distance (-> this max-dist)) (set! (-> this blend) 1.0) (set! (-> this blend) 0.0))) 0 - (none) - ) + (none)) ;; this type is for storing what we tried to look at last. (deftype try-to-look-at-info (basic) - ((who handle) - (horz float) - (vert float) - ) - ) + ((who handle) + (horz float) + (vert float))) ;; this is the last thing we tried to look at. ;; There's only one global instance of this, likely used by Jak looking at enemies. @@ -244,159 +200,86 @@ (defmethod look-at-enemy! ((this joint-mod) (target-trans vector) (option symbol) (proc process)) "Set up animation for Jak looking at an enemy. If option is 'attacking, remember when this happened. Will only override an existing look-at if this one is closer, or option is 'force." - (when (= option 'attacking) ;; make sure we got a process-drawable (let* ((s3-0 proc) - (proc-drawable (if (and (nonzero? s3-0) (type-type? (-> s3-0 type) process-drawable)) - (the-as process-drawable s3-0) - ) - ) - ) + (proc-drawable (if (and (nonzero? s3-0) (type-type? (-> s3-0 type) process-drawable)) (the-as process-drawable s3-0)))) (when proc-drawable ;; get enemy fact info (let* ((s0-0 (-> proc-drawable fact)) - (enemy-facts (the-as fact-info-enemy (if (and (nonzero? s0-0) (type-type? (-> s0-0 type) fact-info-enemy)) - (the-as fact-info-enemy s0-0) - ) - ) - ) - ) + (enemy-facts (the-as fact-info-enemy + (if (and (nonzero? s0-0) (type-type? (-> s0-0 type) fact-info-enemy)) (the-as fact-info-enemy s0-0))))) ;; check that we have enemy facts, and that we are within the notice distance - (when (and enemy-facts (< (vector-vector-distance (-> this process root trans) (-> proc-drawable root trans)) - (-> enemy-facts cam-notice-dist) - ) - ) + (when (and enemy-facts + (< (vector-vector-distance (-> this process root trans) (-> proc-drawable root trans)) (-> enemy-facts cam-notice-dist))) ;; success! we consider this a noticed and remember when (set-time! (-> this notice-time)) ;; and update the look at data (set! (-> last-try-to-look-at-data who) (process->handle proc)) ;; not sure what these are yet. (if (< (-> last-try-to-look-at-data vert) (-> enemy-facts cam-vert)) - (set! (-> last-try-to-look-at-data vert) (-> enemy-facts cam-vert)) - ) + (set! (-> last-try-to-look-at-data vert) (-> enemy-facts cam-vert))) (if (< (-> last-try-to-look-at-data horz) (-> enemy-facts cam-horz)) - (set! (-> last-try-to-look-at-data horz) (-> enemy-facts cam-horz)) - ) - ) - ) - ) - ) - ) + (set! (-> last-try-to-look-at-data horz) (-> enemy-facts cam-horz)))))))) (let ((dist (vector-vector-distance (-> this process root trans) target-trans))) (when (and (or (= (-> this blend) 0.0) - (or (< dist (vector-vector-distance (-> this process root trans) (-> this target))) (= option 'force)) - ) - (< dist (-> this max-dist)) - ) - (if (= (-> this mode) (joint-mod-handler-mode reset)) - (set-mode! this (joint-mod-handler-mode look-at)) - ) + (or (< dist (vector-vector-distance (-> this process root trans) (-> this target))) (= option 'force))) + (< dist (-> this max-dist))) + (if (= (-> this mode) (joint-mod-handler-mode reset)) (set-mode! this (joint-mod-handler-mode look-at))) (set! (-> this target quad) (-> target-trans quad)) (set! (-> this blend) 1.0) - (set! (-> this shutting-down?) #f) - ) - ) + (set! (-> this shutting-down?) #f))) 0 - (none) - ) + (none)) (defun joint-mod-look-at-handler ((csp cspace) (xform transformq)) "Update bone transforms for look-at" (local-vars (sv-48 vector) (sv-52 vector) (sv-56 vector)) (let ((gp-0 (the-as joint-mod (-> csp param1)))) (cspace<-parented-transformq-joint! csp xform) - (set! sv-48 (vector-normalize-copy! - (new 'stack-no-clear 'vector) - (-> gp-0 process node-list data 0 bone transform vector 1) - 1.0 - ) - ) + (set! sv-48 + (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> gp-0 process node-list data 0 bone transform vector 1) 1.0)) (set! sv-52 (vector-normalize! (-> csp bone transform vector (-> gp-0 nose)) 1.0)) - (set! sv-56 (vector-normalize! - (vector-! (new 'stack-no-clear 'vector) (-> gp-0 target) (-> csp bone transform vector 3)) - 1.0 - ) - ) + (set! sv-56 + (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> gp-0 target) (-> csp bone transform vector 3)) 1.0)) (let* ((f30-0 (vector-y-angle sv-52)) (a0-9 (vector-flatten! (new-stack-vector0) sv-56 sv-48)) (f0-0 (vector-y-angle a0-9)) - (f0-1 (deg-diff f30-0 f0-0)) - ) - (if (< (-> gp-0 ignore-angle) (fabs f0-1)) - (set! f0-1 0.0) - ) - (let ((f30-1 - (fmax (fmin (* f0-1 (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max y)) (- (-> gp-0 twist-max y))) - ) - ) - (if (and (-> gp-0 shutting-down?) (= (-> gp-0 twist y) f30-1)) - (set-mode! gp-0 (joint-mod-handler-mode reset)) - ) - (set! (-> gp-0 twist y) (deg-seek (-> gp-0 twist y) f30-1 (* 0.1 (fabs (deg-diff f30-1 (-> gp-0 twist y)))))) - ) - ) + (f0-1 (deg-diff f30-0 f0-0))) + (if (< (-> gp-0 ignore-angle) (fabs f0-1)) (set! f0-1 0.0)) + (let ((f30-1 (fmax (fmin (* f0-1 (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max y)) (- (-> gp-0 twist-max y))))) + (if (and (-> gp-0 shutting-down?) (= (-> gp-0 twist y) f30-1)) (set-mode! gp-0 (joint-mod-handler-mode reset))) + (set! (-> gp-0 twist y) (deg-seek (-> gp-0 twist y) f30-1 (* 0.1 (fabs (deg-diff f30-1 (-> gp-0 twist y)))))))) (let ((v1-15 (-> gp-0 up))) (cond - ((zero? v1-15) - (quaternion-rotate-x! (-> xform quat) (-> xform quat) (-> gp-0 twist y)) - ) - ((= v1-15 1) - (quaternion-rotate-local-y! (-> xform quat) (-> xform quat) (-> gp-0 twist y)) - ) - (else - (quaternion-rotate-z! (-> xform quat) (-> xform quat) (-> gp-0 twist y)) - ) - ) - ) - (let* ((s3-1 (vector-normalize-copy! - (new 'stack-no-clear 'vector) - (the-as vector (-> gp-0 process node-list data 0 bone transform)) - 1.0 - ) - ) + ((zero? v1-15) (quaternion-rotate-x! (-> xform quat) (-> xform quat) (-> gp-0 twist y))) + ((= v1-15 1) (quaternion-rotate-local-y! (-> xform quat) (-> xform quat) (-> gp-0 twist y))) + (else (quaternion-rotate-z! (-> xform quat) (-> xform quat) (-> gp-0 twist y))))) + (let* ((s3-1 (vector-normalize-copy! (new 'stack-no-clear 'vector) + (the-as vector (-> gp-0 process node-list data 0 bone transform)) + 1.0)) (f30-2 (vector-x-angle sv-52)) (s3-2 (vector-flatten! (new-stack-vector0) sv-56 s3-1)) (f0-15 (vector-x-angle s3-2)) - (f0-21 (fmax - (fmin (* (- (deg-diff f30-2 f0-15)) (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max x)) - (- (-> gp-0 twist-max x)) - ) - ) - ) - (if (< (vector-dot s3-2 sv-52) 0.1) - (set! f0-21 0.0) - ) - (set! (-> gp-0 twist x) (deg-seek (-> gp-0 twist x) f0-21 (* 0.1 (fabs (deg-diff f0-21 (-> gp-0 twist x)))))) - ) + (f0-21 (fmax (fmin (* (- (deg-diff f30-2 f0-15)) (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max x)) + (- (-> gp-0 twist-max x))))) + (if (< (vector-dot s3-2 sv-52) 0.1) (set! f0-21 0.0)) + (set! (-> gp-0 twist x) (deg-seek (-> gp-0 twist x) f0-21 (* 0.1 (fabs (deg-diff f0-21 (-> gp-0 twist x))))))) (let ((v1-27 (-> gp-0 ear))) (cond - ((zero? v1-27) - (quaternion-rotate-x! (-> xform quat) (-> xform quat) (-> gp-0 twist x)) - ) - ((= v1-27 1) - (quaternion-rotate-local-y! (-> xform quat) (-> xform quat) (-> gp-0 twist x)) - ) - (else - (quaternion-rotate-z! (-> xform quat) (-> xform quat) (-> gp-0 twist x)) - ) - ) - ) + ((zero? v1-27) (quaternion-rotate-x! (-> xform quat) (-> xform quat) (-> gp-0 twist x))) + ((= v1-27 1) (quaternion-rotate-local-y! (-> xform quat) (-> xform quat) (-> gp-0 twist x))) + (else (quaternion-rotate-z! (-> xform quat) (-> xform quat) (-> gp-0 twist x))))) (cspace<-parented-transformq-joint! csp xform) (if (and (= (-> gp-0 process type) target) (!= (-> gp-0 blend) 0.0)) - (add-debug-text-sphere - *display-target-marks* - (bucket-id debug-no-zbuf) - (-> gp-0 target) - 819.2 - "look" - (new 'static 'rgba :r #xff :g #xff :a #x80) - ) - ) - ) + (add-debug-text-sphere *display-target-marks* + (bucket-id debug-no-zbuf) + (-> gp-0 target) + 819.2 + "look" + (new 'static 'rgba :r #xff :g #xff :a #x80)))) 0 - (none) - ) + (none)) (defun joint-mod-world-look-at-handler ((arg0 cspace) (arg1 transformq)) (local-vars (sv-48 vector) (sv-52 vector) (sv-56 vector)) @@ -404,163 +287,91 @@ (let ((s5-0 (-> arg0 bone transform))) (cspace<-parented-transformq-joint! arg0 arg1) (set! sv-48 - (vector-normalize-copy! - (new 'stack-no-clear 'vector) - (-> gp-0 process node-list data 0 bone transform vector 1) - 1.0 - ) - ) + (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> gp-0 process node-list data 0 bone transform vector 1) 1.0)) (set! sv-52 (vector-normalize! (-> s5-0 vector (-> gp-0 nose)) 1.0)) - (set! sv-56 - (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> gp-0 target) (-> s5-0 vector 3)) 1.0) - ) + (set! sv-56 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> gp-0 target) (-> s5-0 vector 3)) 1.0)) (let* ((f30-0 (vector-y-angle sv-52)) (a0-7 (vector-flatten! (new-stack-vector0) sv-56 sv-48)) (f0-0 (vector-y-angle a0-7)) - (f0-1 (deg-diff f30-0 f0-0)) - ) - (if (< (-> gp-0 ignore-angle) (fabs f0-1)) - (set! f0-1 0.0) - ) - (let ((f0-5 - (fmax (fmin (* f0-1 (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max y)) (- (-> gp-0 twist-max y))) - ) - ) - (set! (-> gp-0 twist y) - (deg-seek (-> gp-0 twist y) f0-5 (fmax 1.0 (* 0.1 (fabs (deg-diff f0-5 (-> gp-0 twist y)))))) - ) - ) - ) + (f0-1 (deg-diff f30-0 f0-0))) + (if (< (-> gp-0 ignore-angle) (fabs f0-1)) (set! f0-1 0.0)) + (let ((f0-5 (fmax (fmin (* f0-1 (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max y)) (- (-> gp-0 twist-max y))))) + (set! (-> gp-0 twist y) (deg-seek (-> gp-0 twist y) f0-5 (fmax 1.0 (* 0.1 (fabs (deg-diff f0-5 (-> gp-0 twist y))))))))) (when (!= (-> gp-0 twist y) 0.0) (let ((a2-3 (matrix-rotate-y! (new 'stack-no-clear 'matrix) (-> gp-0 twist y))) - (s4-2 (-> s5-0 vector 3 quad)) - ) + (s4-2 (-> s5-0 vector 3 quad))) (matrix*! s5-0 s5-0 a2-3) - (set! (-> s5-0 vector 3 quad) s4-2) - ) - ) - (let* ((s4-3 - (vector-normalize-copy! - (new 'stack-no-clear 'vector) - (the-as vector (-> gp-0 process node-list data 0 bone transform)) - 1.0 - ) - ) + (set! (-> s5-0 vector 3 quad) s4-2))) + (let* ((s4-3 (vector-normalize-copy! (new 'stack-no-clear 'vector) + (the-as vector (-> gp-0 process node-list data 0 bone transform)) + 1.0)) (f30-2 (vector-x-angle sv-52)) (s4-4 (vector-flatten! (new-stack-vector0) sv-56 s4-3)) (f0-14 (vector-x-angle s4-4)) - (f0-20 - (fmax - (fmin (* (- (deg-diff f30-2 f0-14)) (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max x)) - (- (-> gp-0 twist-max x)) - ) - ) - ) - (if (< (vector-dot s4-4 sv-52) 0.1) - (set! f0-20 0.0) - ) - (set! (-> gp-0 twist x) - (deg-seek (-> gp-0 twist x) f0-20 (fmax 1.0 (* 0.1 (fabs (deg-diff f0-20 (-> gp-0 twist x)))))) - ) - ) + (f0-20 (fmax (fmin (* (- (deg-diff f30-2 f0-14)) (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max x)) + (- (-> gp-0 twist-max x))))) + (if (< (vector-dot s4-4 sv-52) 0.1) (set! f0-20 0.0)) + (set! (-> gp-0 twist x) (deg-seek (-> gp-0 twist x) f0-20 (fmax 1.0 (* 0.1 (fabs (deg-diff f0-20 (-> gp-0 twist x)))))))) (when (!= (-> gp-0 twist x) 0.0) (let* ((v1-20 (-> gp-0 ear)) - (a1-17 ((cond - ((zero? v1-20) - matrix-rotate-x! - ) - ((= v1-20 1) - matrix-rotate-y! - ) - (else - matrix-rotate-z! - ) - ) - (new 'stack-no-clear 'matrix) - (-> gp-0 twist x) - ) - ) - ) - (matrix*! s5-0 a1-17 s5-0) - ) - ) - ) + (a1-17 ((cond ((zero? v1-20) matrix-rotate-x!) + ((= v1-20 1) matrix-rotate-y!) + (else matrix-rotate-z!)) + (new 'stack-no-clear 'matrix) + (-> gp-0 twist x)))) + (matrix*! s5-0 a1-17 s5-0)))) (if (and (= (-> gp-0 process type) target) (!= (-> gp-0 blend) 0.0)) - (add-debug-text-sphere - *display-target-marks* - (bucket-id debug-no-zbuf) - (-> gp-0 target) - 819.2 - "look" - (new 'static 'rgba :r #xff :g #xff :a #x80) - ) - ) - ) + (add-debug-text-sphere *display-target-marks* + (bucket-id debug-no-zbuf) + (-> gp-0 target) + 819.2 + "look" + (new 'static 'rgba :r #xff :g #xff :a #x80)))) 0 - (none) - ) + (none)) (defun joint-mod-rotate-handler ((arg0 cspace) (arg1 transformq)) (let ((s4-0 (the-as joint-mod (-> arg0 param1))) - (s3-0 (new 'static 'inline-array vector 3 - (new 'static 'vector :x 1.0 :w 1.0) - (new 'static 'vector :y 1.0 :w 1.0) - (new 'static 'vector :z 1.0 :w 1.0) - ) - ) - ) + (s3-0 (new 'static + 'inline-array + vector + 3 + (new 'static 'vector :x 1.0 :w 1.0) + (new 'static 'vector :y 1.0 :w 1.0) + (new 'static 'vector :z 1.0 :w 1.0)))) (let* ((v1-2 (-> s3-0 (-> s4-0 ear))) - (a1-2 (quaternion-axis-angle! - (new 'stack-no-clear 'quaternion) - (-> v1-2 x) - (-> v1-2 y) - (-> v1-2 z) - (* (-> s4-0 twist x) (-> s4-0 blend) (-> s4-0 flex-blend)) - ) - ) - ) - (quaternion-normalize! (quaternion*! (-> arg1 quat) a1-2 (-> arg1 quat))) - ) + (a1-2 (quaternion-axis-angle! (new 'stack-no-clear 'quaternion) + (-> v1-2 x) + (-> v1-2 y) + (-> v1-2 z) + (* (-> s4-0 twist x) (-> s4-0 blend) (-> s4-0 flex-blend))))) + (quaternion-normalize! (quaternion*! (-> arg1 quat) a1-2 (-> arg1 quat)))) (let* ((v1-6 (-> s3-0 (-> s4-0 up))) - (a1-4 (quaternion-axis-angle! - (new 'stack-no-clear 'quaternion) - (-> v1-6 x) - (-> v1-6 y) - (-> v1-6 z) - (* (-> s4-0 twist y) (-> s4-0 blend) (-> s4-0 flex-blend)) - ) - ) - ) - (quaternion-normalize! (quaternion*! (-> arg1 quat) a1-4 (-> arg1 quat))) - ) + (a1-4 (quaternion-axis-angle! (new 'stack-no-clear 'quaternion) + (-> v1-6 x) + (-> v1-6 y) + (-> v1-6 z) + (* (-> s4-0 twist y) (-> s4-0 blend) (-> s4-0 flex-blend))))) + (quaternion-normalize! (quaternion*! (-> arg1 quat) a1-4 (-> arg1 quat)))) (let* ((v1-10 (-> s3-0 (-> s4-0 nose))) - (a1-6 (quaternion-axis-angle! - (new 'stack-no-clear 'quaternion) - (-> v1-10 x) - (-> v1-10 y) - (-> v1-10 z) - (* (-> s4-0 twist z) (-> s4-0 blend) (-> s4-0 flex-blend)) - ) - ) - ) - (quaternion-normalize! (quaternion*! (-> arg1 quat) a1-6 (-> arg1 quat))) - ) - ) + (a1-6 (quaternion-axis-angle! (new 'stack-no-clear 'quaternion) + (-> v1-10 x) + (-> v1-10 y) + (-> v1-10 z) + (* (-> s4-0 twist z) (-> s4-0 blend) (-> s4-0 flex-blend))))) + (quaternion-normalize! (quaternion*! (-> arg1 quat) a1-6 (-> arg1 quat))))) (cspace<-parented-transformq-joint! arg0 arg1) 0 - (none) - ) + (none)) (defun joint-mod-joint-set-handler ((arg0 cspace) (arg1 transformq)) (let ((s4-0 (the-as joint-mod (-> arg0 param1)))) (set! (-> arg1 trans quad) (-> s4-0 trans quad)) (quaternion-copy! (-> arg1 quat) (-> s4-0 quat)) - (set! (-> arg1 scale quad) (-> s4-0 scale quad)) - ) + (set! (-> arg1 scale quad) (-> s4-0 scale quad))) (cspace<-parented-transformq-joint! arg0 arg1) 0 - (none) - ) + (none)) (defun joint-mod-joint-set*-handler ((arg0 cspace) (arg1 transformq)) (let ((s5-0 (the-as joint-mod (-> arg0 param1)))) @@ -568,45 +379,38 @@ (quaternion-normalize! (quaternion*! (-> arg1 quat) (-> arg1 quat) (-> s5-0 quat))) (vector*! (-> arg1 scale) (-> arg1 scale) (-> s5-0 scale)) (cspace<-parented-transformq-joint! arg0 arg1) - (if (-> s5-0 max-dist) - (set-vector! (-> arg0 bone scale) 1.0 1.0 1.0 1.0) - ) - ) + (if (-> s5-0 max-dist) (set-vector! (-> arg0 bone scale) 1.0 1.0 1.0 1.0))) 0 - (none) - ) + (none)) -(define *joint-axis-vectors* (new 'static 'inline-array vector 6 - (new 'static 'vector :x 1.0 :w 1.0) - (new 'static 'vector :y 1.0 :w 1.0) - (new 'static 'vector :z 1.0 :w 1.0) - (new 'static 'vector :x -1.0 :w 1.0) - (new 'static 'vector :y -1.0 :w 1.0) - (new 'static 'vector :z -1.0 :w 1.0) - ) - ) +(define *joint-axis-vectors* + (new 'static + 'inline-array + vector + 6 + (new 'static 'vector :x 1.0 :w 1.0) + (new 'static 'vector :y 1.0 :w 1.0) + (new 'static 'vector :z 1.0 :w 1.0) + (new 'static 'vector :x -1.0 :w 1.0) + (new 'static 'vector :y -1.0 :w 1.0) + (new 'static 'vector :z -1.0 :w 1.0))) ;; These joint-mod types contain a bit of extra state required for special types of joint-mods (deftype joint-mod-wheel (basic) - ((last-position vector :inline) - (angle float) - (process process-drawable) - (wheel-radius float) - (wheel-axis int8) - ) + ((last-position vector :inline) + (angle float) + (process process-drawable) + (wheel-radius float) + (wheel-axis int8)) (:methods - (new (symbol type process-drawable int float int) _type_) - ) - ) - + (new (symbol type process-drawable int float int) _type_))) (defun joint-mod-wheel-callback ((arg0 cspace) (arg1 transformq)) (let ((s4-0 (the-as joint-mod-wheel (-> arg0 param1)))) (let ((v1-1 (-> s4-0 process root)) (s1-0 (new-stack-vector0)) (s3-0 (new-stack-vector0)) - (s2-0 (new-stack-vector0)) - ) + (s2-0 (new-stack-vector0))) 0.0 0.0 (vector-z-quaternion! s2-0 (-> v1-1 quat)) @@ -616,16 +420,11 @@ (let* ((f0-3 (vector-dot s2-0 s3-0)) (f1-0 65536.0) (f2-1 (* 6.28318 (-> s4-0 wheel-radius))) - (f0-4 (* f1-0 (/ 1.0 f2-1) f0-3)) - ) - (+! (-> s4-0 angle) f0-4) - ) - ) - (quaternion-vector-angle! (-> arg1 quat) (-> *joint-axis-vectors* (-> s4-0 wheel-axis)) (-> s4-0 angle)) - ) + (f0-4 (* f1-0 (/ 1.0 f2-1) f0-3))) + (+! (-> s4-0 angle) f0-4))) + (quaternion-vector-angle! (-> arg1 quat) (-> *joint-axis-vectors* (-> s4-0 wheel-axis)) (-> s4-0 angle))) (cspace<-parented-transformq-joint! arg0 arg1) - (none) - ) + (none)) (defmethod new joint-mod-wheel ((allocation symbol) (type-to-make type) (arg0 process-drawable) (arg1 int) (arg2 float) (arg3 int)) (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) @@ -636,56 +435,30 @@ (set-vector! (-> v0-0 last-position) 0.0 0.0 0.0 1.0) (let ((v1-5 (-> arg0 node-list data arg1))) (set! (-> v1-5 param0) joint-mod-wheel-callback) - (set! (-> v1-5 param1) v0-0) - ) - v0-0 - ) - ) + (set! (-> v1-5 param1) v0-0)) + v0-0)) (deftype joint-mod-set-local (basic) - ((transform transformq :inline) - (set-rotation symbol) - (set-scale symbol) - (set-translation symbol) - (enable symbol) - ) + ((transform transformq :inline) + (set-rotation symbol) + (set-scale symbol) + (set-translation symbol) + (enable symbol)) (:methods - (new (symbol type process-drawable int symbol symbol symbol) _type_) - ) - ) - + (new (symbol type process-drawable int symbol symbol symbol) _type_))) (defun joint-mod-set-local-callback ((arg0 cspace) (arg1 transformq)) (let ((v1-0 (the-as joint-mod-set-local (-> arg0 param1)))) (cond ((-> v1-0 enable) - (if (not (-> v1-0 set-translation)) - (set! (-> v1-0 transform trans quad) (-> arg1 trans quad)) - ) - (if (not (-> v1-0 set-rotation)) - (set! (-> v1-0 transform quat vec quad) (-> arg1 quat vec quad)) - ) - (if (not (-> v1-0 set-scale)) - (set! (-> v1-0 transform scale quad) (-> arg1 scale quad)) - ) - (cspace<-parented-transformq-joint! arg0 (-> v1-0 transform)) - ) - (else - (cspace<-parented-transformq-joint! arg0 arg1) - ) - ) - ) - (none) - ) + (if (not (-> v1-0 set-translation)) (set! (-> v1-0 transform trans quad) (-> arg1 trans quad))) + (if (not (-> v1-0 set-rotation)) (set! (-> v1-0 transform quat vec quad) (-> arg1 quat vec quad))) + (if (not (-> v1-0 set-scale)) (set! (-> v1-0 transform scale quad) (-> arg1 scale quad))) + (cspace<-parented-transformq-joint! arg0 (-> v1-0 transform))) + (else (cspace<-parented-transformq-joint! arg0 arg1)))) + (none)) -(defmethod new joint-mod-set-local ((allocation symbol) - (type-to-make type) - (arg0 process-drawable) - (arg1 int) - (arg2 symbol) - (arg3 symbol) - (arg4 symbol) - ) +(defmethod new joint-mod-set-local ((allocation symbol) (type-to-make type) (arg0 process-drawable) (arg1 int) (arg2 symbol) (arg3 symbol) (arg4 symbol)) (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (set! (-> v0-0 set-translation) arg2) (set! (-> v0-0 set-rotation) arg3) @@ -696,32 +469,20 @@ (set! (-> v0-0 transform scale quad) (-> *identity-vector* quad)) (let ((v1-8 (-> arg0 node-list data arg1))) (set! (-> v1-8 param0) joint-mod-set-local-callback) - (set! (-> v1-8 param1) v0-0) - ) - v0-0 - ) - ) + (set! (-> v1-8 param1) v0-0)) + v0-0)) (deftype joint-mod-set-world (basic) - ((transform transformq :inline) - (node-index int32) - (enable basic) - ) + ((transform transformq :inline) + (node-index int32) + (enable basic)) (:methods - (new (symbol type process-drawable int basic) _type_) - ) - ) - + (new (symbol type process-drawable int basic) _type_))) (defun joint-mod-set-world-callback ((arg0 cspace) (arg1 transformq)) (let ((v1-0 (the-as joint-mod-set-world (-> arg0 param1)))) - (if (-> v1-0 enable) - (cspace<-transformq! arg0 (-> v1-0 transform)) - (cspace<-parented-transformq-joint! arg0 arg1) - ) - ) - (none) - ) + (if (-> v1-0 enable) (cspace<-transformq! arg0 (-> v1-0 transform)) (cspace<-parented-transformq-joint! arg0 arg1))) + (none)) (defmethod new joint-mod-set-world ((allocation symbol) (type-to-make type) (arg0 process-drawable) (arg1 int) (arg2 basic)) (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) @@ -732,46 +493,31 @@ (set! (-> v0-0 transform scale quad) (-> *identity-vector* quad)) (let ((v1-7 (-> arg0 node-list data arg1))) (set! (-> v1-7 param0) joint-mod-set-world-callback) - (set! (-> v1-7 param1) v0-0) - ) - v0-0 - ) - ) + (set! (-> v1-7 param1) v0-0)) + v0-0)) (deftype joint-mod-blend-local (basic) - ((transform transformq :inline) - (blend-transform transformq :inline) - (node-index int32) - (blend float) - (enable basic) - ) + ((transform transformq :inline) + (blend-transform transformq :inline) + (node-index int32) + (blend float) + (enable basic)) (:methods - (new (symbol type process-drawable int basic) _type_) - ) - ) - + (new (symbol type process-drawable int basic) _type_))) (defun joint-mod-blend-local-callback ((arg0 cspace) (arg1 transformq)) (let ((gp-0 (the-as joint-mod-blend-local (-> arg0 param1)))) (cond ((-> gp-0 enable) - (vector-lerp! - (the-as vector (-> gp-0 blend-transform)) - (-> arg1 trans) - (the-as vector (-> gp-0 transform)) - (-> gp-0 blend) - ) + (vector-lerp! (the-as vector (-> gp-0 blend-transform)) + (-> arg1 trans) + (the-as vector (-> gp-0 transform)) + (-> gp-0 blend)) (vector-lerp! (-> gp-0 blend-transform scale) (-> arg1 scale) (-> gp-0 transform scale) (-> gp-0 blend)) (quaternion-slerp! (-> gp-0 blend-transform quat) (-> arg1 quat) (-> gp-0 transform quat) (-> gp-0 blend)) - (cspace<-parented-transformq-joint! arg0 (-> gp-0 blend-transform)) - ) - (else - (cspace<-parented-transformq-joint! arg0 arg1) - ) - ) - ) - (none) - ) + (cspace<-parented-transformq-joint! arg0 (-> gp-0 blend-transform))) + (else (cspace<-parented-transformq-joint! arg0 arg1)))) + (none)) (defmethod new joint-mod-blend-local ((allocation symbol) (type-to-make type) (arg0 process-drawable) (arg1 int) (arg2 basic)) (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) @@ -783,42 +529,27 @@ (set! (-> v0-0 transform scale quad) (-> *identity-vector* quad)) (let ((v1-7 (-> arg0 node-list data arg1))) (set! (-> v1-7 param0) joint-mod-blend-local-callback) - (set! (-> v1-7 param1) v0-0) - ) - v0-0 - ) - ) + (set! (-> v1-7 param1) v0-0)) + v0-0)) (deftype joint-mod-spinner (basic) - ((spin-axis vector :inline) - (angle float) - (spin-rate float) - (enable basic) - ) + ((spin-axis vector :inline) + (angle float) + (spin-rate float) + (enable basic)) (:methods - (new (symbol type process-drawable int vector float) _type_) - ) - ) - + (new (symbol type process-drawable int vector float) _type_))) (defun joint-mod-spinner-callback ((arg0 cspace) (arg1 transformq)) (let ((gp-0 (the-as joint-mod-spinner (-> arg0 param1)))) (when (-> gp-0 enable) (let ((f30-0 (+ (-> gp-0 angle) (* (-> gp-0 spin-rate) (seconds-per-frame))))) - (if (< 32768.0 f30-0) - (set! f30-0 (+ -65536.0 f30-0)) - ) - (if (< f30-0 -32768.0) - (set! f30-0 (+ 65536.0 f30-0)) - ) + (if (< 32768.0 f30-0) (set! f30-0 (+ -65536.0 f30-0))) + (if (< f30-0 -32768.0) (set! f30-0 (+ 65536.0 f30-0))) (quaternion-vector-angle! (-> arg1 quat) (-> gp-0 spin-axis) f30-0) - (set! (-> gp-0 angle) f30-0) - ) - ) - ) + (set! (-> gp-0 angle) f30-0)))) (cspace<-parented-transformq-joint! arg0 arg1) - (none) - ) + (none)) (defmethod new joint-mod-spinner ((allocation symbol) (type-to-make type) (arg0 process-drawable) (arg1 int) (arg2 vector) (arg3 float)) (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) @@ -828,8 +559,5 @@ (set! (-> v0-0 angle) 0.0) (let ((v1-6 (-> arg0 node-list data arg1))) (set! (-> v1-6 param0) joint-mod-spinner-callback) - (set! (-> v1-6 param1) v0-0) - ) - v0-0 - ) - ) + (set! (-> v1-6 param1) v0-0)) + v0-0)) diff --git a/goal_src/jak1/engine/anim/joint.gc b/goal_src/jak1/engine/anim/joint.gc index a8a2982054..1be00caad1 100644 --- a/goal_src/jak1/engine/anim/joint.gc +++ b/goal_src/jak1/engine/anim/joint.gc @@ -1,7 +1,6 @@ ;;-*-Lisp-*- (in-package goal) (bundles "ENGINE.CGO" "GAME.CGO") - (require "engine/entity/res.gc") (require "engine/gfx/background/subdivide-h.gc") (require "engine/math/transformq.gc") @@ -28,22 +27,19 @@ ;; request to decompress data from an animation (deftype joint-decomp-request (structure) - ((jacc joint-anim-compressed-control) - (frame int) + ((jacc joint-anim-compressed-control) + (frame int) (frame-interp float) - (amount float)) - ) + (amount float))) (deftype blend-tree-stack-frame (structure) - ((weights float 24) - (quads vector 6 :inline :overlay-at weights)) - ) + ((weights float 24) + (quads vector 6 :inline :overlay-at weights))) (deftype new-joint-decompressor-work (structure) - ((requests joint-decomp-request 24 :inline) + ((requests joint-decomp-request 24 :inline) (num-requests int32) - (blend-stack blend-tree-stack-frame 4 :inline) - ) + (blend-stack blend-tree-stack-frame 4 :inline)) (:methods (eval-blend-tree! (_type_ joint-control) none) (output-blend-tree! (_type_ joint-control) none) @@ -51,50 +47,38 @@ (init-frame! (_type_ joint-anim-frame int) none) (process-request! (_type_ joint-decomp-request joint-anim-frame int) none) (process-requests! (_type_ joint-anim-frame int) none) - (finalize-frame! (_type_ joint-anim-frame int) none) - ) - ) + (finalize-frame! (_type_ joint-anim-frame int) none))) (define *new-joint-decompressor-work* (new 'global 'new-joint-decompressor-work)) (defun new-joint-decompressor ((dst joint-anim-frame) (num-joints int) (jc joint-control)) "Decompress a joint animation!" - ;; determine anim weights, write them out to the joint-control for other stuff to see. (eval-blend-tree! *new-joint-decompressor-work* jc) (output-blend-tree! *new-joint-decompressor-work* jc) - ;; figure out which animations need decompression (build-requests! *new-joint-decompressor-work* jc) - ;; run the decompression (init-frame! *new-joint-decompressor-work* dst num-joints) (process-requests! *new-joint-decompressor-work* dst num-joints) (finalize-frame! *new-joint-decompressor-work* dst num-joints) - - (none) - ) + (none)) (defmethod eval-blend-tree! ((this new-joint-decompressor-work) (jc joint-control)) "Evaluate weights of all channels, producing the final per-animation weights in the first stack-frame." - (let ((num-channels (-> jc active-channels)) - (stack-top 0) - ) + (stack-top 0)) (when (> num-channels 24) (break!) ;; insufficient weights per stack frame ) - ;; loop over channels (dotimes (chan-idx num-channels) (let ((chan (-> jc channel chan-idx))) (case (-> chan command) - (('push) ;; push new anim to stack frame (when (> stack-top 4) (break!) ;; insufficient stack frames. ) - ;; init all weights to zero: (let ((new-frame (-> this blend-stack stack-top))) (vector-zero! (-> new-frame quads 0)) @@ -104,18 +88,15 @@ (vector-zero! (-> new-frame quads 4)) (vector-zero! (-> new-frame quads 5)) ;; except for this channel - (set! (-> new-frame weights chan-idx) 1.0) - ) + (set! (-> new-frame weights chan-idx) 1.0)) (+! stack-top 1) ;; bump stack pointer! ) - ;; blend case: note that push1/stack1 always are a pair, so we can treat push1 as blend and ignore ;; the stack1 as an optimization. (('blend 'push1) (let* ((sf (-> this blend-stack (- stack-top 1))) ;; modify most recent stack frame (new-weight (-> chan frame-interp)) (old-weight (- 1.0 new-weight))) - ;; do the multiplies: (rlet ((temp :class vf) (weight-vec :class vf)) @@ -123,21 +104,14 @@ (dotimes (i 6) (.lvf temp (&-> sf quads i quad)) (.mul.x.vf temp temp weight-vec) - (.svf (&-> sf quads i quad) temp) - ) - (+! (-> sf weights chan-idx) new-weight) - ) - ) - ) - + (.svf (&-> sf quads i quad) temp)) + (+! (-> sf weights chan-idx) new-weight)))) ;; stack case: pop two frames, add together, push result. (('stack) (let* ((sf0 (-> this blend-stack (- stack-top 1))) (sf1 (-> this blend-stack (- stack-top 2))) (weight0 (-> chan frame-interp)) (weight1 (- 1.0 weight0))) - - (rlet ((temp0 :class vf) (temp1 :class vf) (weight0-vec :class vf) @@ -150,153 +124,105 @@ (.mul.x.vf temp0 temp0 weight0-vec) (.mul.x.vf temp1 temp1 weight1-vec) (.add.vf temp0 temp0 temp1) - (.svf (&-> sf1 quads i quad) temp0) - ) - ) + (.svf (&-> sf1 quads i quad) temp0))) (-! stack-top 1) ;; pop stack frame - ) - ) - - ) - ) - ) - ) - - (none) - ) + )))))) + (none)) (defmethod output-blend-tree! ((this new-joint-decompressor-work) (jc joint-control)) "Copy result of the blend tree evaluation into the joint-control." (let ((num-channels (-> jc active-channels))) (dotimes (chan-idx num-channels) - (set! (-> jc channel chan-idx inspector-amount) (-> this blend-stack 0 weights chan-idx)) - ) - ) - (none) - ) - - + (set! (-> jc channel chan-idx inspector-amount) (-> this blend-stack 0 weights chan-idx)))) + (none)) (defmethod build-requests! ((this new-joint-decompressor-work) (jc joint-control)) "Use the anim weights computed by eval-blend-tree! to build decompression requests" - (set! (-> this num-requests) 0) - (let ((num-channels (-> jc active-channels))) (dotimes (chan-idx num-channels) (let ((weight (-> this blend-stack 0 weights chan-idx)) (chan (-> jc channel chan-idx))) (when (> weight 0.001) ;; only both if weight is nonzero (let* ((req (-> this requests (-> this num-requests))) ;; request to create - (jacc (-> chan frame-group frames)) ;; compressed animation - (frame-num (-> chan frame-num)) ;; floating-point frame (eg 1.23) - (base-frame (the int frame-num)) ;; integer round-down frame (eg 1) + (jacc (-> chan frame-group frames)) ;; compressed animation + (frame-num (-> chan frame-num)) ;; floating-point frame (eg 1.23) + (base-frame (the int frame-num)) ;; integer round-down frame (eg 1) (frac-frame (- frame-num (the float base-frame))) ;; interp to next frame (eg 0.23) - (last-frame (the int (- (-> jacc num-frames) 1))) - ) + (last-frame (the int (- (-> jacc num-frames) 1)))) (+! (-> this num-requests) 1) - ;; check our frame group is valid ;; TODO - ;; make sure we didn't go off the end of the animation: (when (>= base-frame last-frame) (set! frac-frame 0.0) - (set! base-frame last-frame) - ) - + (set! base-frame last-frame)) ;; set up request (set! (-> req jacc) jacc) (set! (-> req frame) base-frame) (set! (-> req frame-interp) frac-frame) - (set! (-> req amount) weight) - ) - ) - ) - ) - ) - (none) - ) + (set! (-> req amount) weight)))))) + (none)) (defmethod init-frame! ((this new-joint-decompressor-work) (output-frame joint-anim-frame) (num-joints int)) "Initialize an output frame by zeroing the data." (let ((num-qwc 8) ;; 2x matrix, each 4 qw (data (the (pointer uint128) output-frame))) (when (> num-joints 2) ;; we have transformq's - (+! num-qwc (* 3 (- num-joints 2))) - ) - + (+! num-qwc (* 3 (- num-joints 2)))) (let ((data-end (&+ data (* num-qwc 16)))) (rlet ((zero :class vf)) (.xor.vf zero zero zero) (while (!= data data-end) ;; this loop is 5 instructions :) (.svf data zero) - (&+! data 16) - ) - ) - ) - - ) - (none) - ) + (&+! data 16))))) + (none)) (defmethod process-requests! ((this new-joint-decompressor-work) (output-frame joint-anim-frame) (num-joints int)) "Decompress all pending animation requests." (dotimes (i (-> this num-requests)) - (process-request! this (-> this requests i) output-frame num-joints) - ) + (process-request! this (-> this requests i) output-frame num-joints)) (set! (-> this num-requests) 0) - (none) - ) + (none)) (defmacro fderef-s16 (ptr) - `(the float (-> (the (pointer int16) ,ptr))) - ) + `(the float (-> (the (pointer int16) ,ptr)))) (defmacro deref-f32 (ptr) - `(-> (the (pointer float) ,ptr)) - ) + `(-> (the (pointer float) ,ptr))) (defconstant QUAT_SCALE 0.000030517578125) + (defconstant SCALE_SCALE 0.000244140625) (defun add-scaled-matrix! ((dest matrix) (src matrix) (scale float)) (dotimes (i 16) - (+! (-> dest data i) (* scale (-> src data i))) - ) - ) + (+! (-> dest data i) (* scale (-> src data i))))) (defun decomp-fixed ((output-frame joint-anim-frame) (num-joints int) (anim joint-anim-compressed-fixed) (amount float)) "Decompress the fixed part." - (let* ((mbits (-> anim hdr matrix-bits)) (data (the pointer (&-> anim data 0 quad))) (data64 (the (pointer uint64) (&+ data (-> anim offset-64)))) (data32 (the (pointer uint32) (&+ data (-> anim offset-32)))) (data16 (the (pointer uint16) (&+ data (-> anim offset-16)))) - (ctrl-ptr (-> anim hdr control-bits)) - ) + (ctrl-ptr (-> anim hdr control-bits))) ;; process matrix: (when (zero? (logand mbits 1)) ;; matrix comes from fixed data (add-scaled-matrix! (-> output-frame matrices 0) (the matrix data64) amount) - (&+! data64 64) - ) - + (&+! data64 64)) (when (zero? (logand mbits 2)) ;; matrix comes from fixed data (add-scaled-matrix! (-> output-frame matrices 1) (the matrix data64) amount) - (&+! data64 64) - ) - + (&+! data64 64)) ;; process tq's (dotimes (tqi num-joints) ;; TODO - not sure if this is too many?? (let* ((ctrl-idx (/ tqi 8)) (ctrl-shift (* 4 (mod tqi 8))) (ctrl (logand #b1111 (sar (-> ctrl-ptr ctrl-idx) ctrl-shift))) ;(tq (-> output-frame data tqi)) - (tq (-> (the (inline-array transformq) (-> output-frame data)) tqi)) - ) + (tq (-> (the (inline-array transformq) (-> output-frame data)) tqi))) ;; TRANS (when (zero? (logand ctrl #b0001)) ;; we have trans @@ -308,8 +234,7 @@ (+! (-> tq trans y) (* amount (deref-f32 data64))) (&+! data64 4) (+! (-> tq trans z) (* amount (deref-f32 data32))) - (&+! data32 4) - ) + (&+! data32 4)) (else ;; little trans (+! (-> tq trans x) (* amount (fderef-s16 data32) 4.)) @@ -317,18 +242,18 @@ (+! (-> tq trans y) (* amount (fderef-s16 data32) 4.)) (&+! data32 2) (+! (-> tq trans z) (* amount (fderef-s16 data16) 4.)) - (&+! data16 2) - ) - ) - ) + (&+! data16 2)))) ;; QUAT (when (zero? (logand ctrl #b0010)) (let ((temp (new 'stack-no-clear 'vector))) - (set! (-> temp x) (fderef-s16 data64)) (&+! data64 2) - (set! (-> temp y) (fderef-s16 data64)) (&+! data64 2) - (set! (-> temp z) (fderef-s16 data64)) (&+! data64 2) - (set! (-> temp w) (fderef-s16 data64)) (&+! data64 2) - + (set! (-> temp x) (fderef-s16 data64)) + (&+! data64 2) + (set! (-> temp y) (fderef-s16 data64)) + (&+! data64 2) + (set! (-> temp z) (fderef-s16 data64)) + (&+! data64 2) + (set! (-> temp w) (fderef-s16 data64)) + (&+! data64 2) (let ((dot (+ (* (-> temp x) (-> tq quat x)) (* (-> temp y) (-> tq quat y)) (* (-> temp z) (-> tq quat z)) @@ -337,15 +262,11 @@ (*! (-> temp x) -1.) (*! (-> temp y) -1.) (*! (-> temp z) -1.) - (*! (-> temp w) -1.) - ) + (*! (-> temp w) -1.)) (+! (-> tq quat x) (* amount (-> temp x) QUAT_SCALE)) (+! (-> tq quat y) (* amount (-> temp y) QUAT_SCALE)) (+! (-> tq quat z) (* amount (-> temp z) QUAT_SCALE)) - (+! (-> tq quat w) (* amount (-> temp w) QUAT_SCALE)) - ) - ) - ) + (+! (-> tq quat w) (* amount (-> temp w) QUAT_SCALE))))) ;; SCALE (when (zero? (logand ctrl #b0100)) (+! (-> tq scale x) (* amount (fderef-s16 data32) SCALE_SCALE)) @@ -353,47 +274,36 @@ (+! (-> tq scale y) (* amount (fderef-s16 data32) SCALE_SCALE)) (&+! data32 2) (+! (-> tq scale z) (* amount (fderef-s16 data16) SCALE_SCALE)) - (&+! data16 2) - ) - ) - ) - ) + (&+! data16 2))))) + (none)) - (none) - ) - -(defun decomp-frame ((output-frame joint-anim-frame) (num-joints int) (anim joint-anim-compressed-frame) (amount float) (hdr joint-anim-compressed-hdr)) +(defun decomp-frame ((output-frame joint-anim-frame) (num-joints int) + (anim joint-anim-compressed-frame) + (amount float) + (hdr joint-anim-compressed-hdr)) "Decompress the fixed part." - (let* ((mbits (-> hdr matrix-bits)) (data (the pointer (-> anim data))) (data64 (the (pointer uint64) (&+ data (-> anim offset-64)))) (data32 (the (pointer uint32) (&+ data (-> anim offset-32)))) (data16 (the (pointer uint16) (&+ data (-> anim offset-16)))) - (ctrl-ptr (-> hdr control-bits)) - ) + (ctrl-ptr (-> hdr control-bits))) ;; process matrix: (when (nonzero? (logand mbits 1)) ;; matrix comes from fixed data (add-scaled-matrix! (-> output-frame matrices 0) (the matrix data64) amount) - (&+! data64 64) - ) - + (&+! data64 64)) (when (nonzero? (logand mbits 2)) ;; matrix comes from fixed data (add-scaled-matrix! (-> output-frame matrices 1) (the matrix data64) amount) - (&+! data64 64) - ) - + (&+! data64 64)) ;; process tq's (dotimes (tqi num-joints) ;; TODO - not sure if this is too many?? (let* ((ctrl-idx (/ tqi 8)) (ctrl-shift (* 4 (mod tqi 8))) (ctrl (logand #b1111 (sar (-> ctrl-ptr ctrl-idx) ctrl-shift))) ;(tq (-> output-frame data tqi)) - (tq (-> (the (inline-array transformq) (-> output-frame data)) tqi)) - ) - + (tq (-> (the (inline-array transformq) (-> output-frame data)) tqi))) ;; TRANS (when (nonzero? (logand ctrl #b0001)) ;; we have trans @@ -405,8 +315,7 @@ (+! (-> tq trans y) (* amount (deref-f32 data64))) (&+! data64 4) (+! (-> tq trans z) (* amount (deref-f32 data32))) - (&+! data32 4) - ) + (&+! data32 4)) (else ;; little trans (+! (-> tq trans x) (* amount (fderef-s16 data32) 4.)) @@ -414,19 +323,18 @@ (+! (-> tq trans y) (* amount (fderef-s16 data32) 4.)) (&+! data32 2) (+! (-> tq trans z) (* amount (fderef-s16 data16) 4.)) - (&+! data16 2) - ) - ) - ) + (&+! data16 2)))) ;; QUAT (when (nonzero? (logand ctrl #b0010)) (let ((temp (new 'stack-no-clear 'vector))) - - (set! (-> temp x) (fderef-s16 data64)) (&+! data64 2) - (set! (-> temp y) (fderef-s16 data64)) (&+! data64 2) - (set! (-> temp z) (fderef-s16 data64)) (&+! data64 2) - (set! (-> temp w) (fderef-s16 data64)) (&+! data64 2) - + (set! (-> temp x) (fderef-s16 data64)) + (&+! data64 2) + (set! (-> temp y) (fderef-s16 data64)) + (&+! data64 2) + (set! (-> temp z) (fderef-s16 data64)) + (&+! data64 2) + (set! (-> temp w) (fderef-s16 data64)) + (&+! data64 2) (let ((dot (+ (* (-> temp x) (-> tq quat x)) (* (-> temp y) (-> tq quat y)) (* (-> temp z) (-> tq quat z)) @@ -435,15 +343,11 @@ (*! (-> temp x) -1.) (*! (-> temp y) -1.) (*! (-> temp z) -1.) - (*! (-> temp w) -1.) - ) + (*! (-> temp w) -1.)) (+! (-> tq quat x) (* amount (-> temp x) QUAT_SCALE)) (+! (-> tq quat y) (* amount (-> temp y) QUAT_SCALE)) (+! (-> tq quat z) (* amount (-> temp z) QUAT_SCALE)) - (+! (-> tq quat w) (* amount (-> temp w) QUAT_SCALE)) - ) - ) - ) + (+! (-> tq quat w) (* amount (-> temp w) QUAT_SCALE))))) ;; SCALE (when (nonzero? (logand ctrl #b0100)) (+! (-> tq scale x) (* amount (fderef-s16 data32) SCALE_SCALE)) @@ -451,62 +355,39 @@ (+! (-> tq scale y) (* amount (fderef-s16 data32) SCALE_SCALE)) (&+! data32 2) (+! (-> tq scale z) (* amount (fderef-s16 data16) SCALE_SCALE)) - (&+! data16 2) - ) - ) - ) - ) - - (none) - ) + (&+! data16 2))))) + (none)) (defmethod process-request! ((this new-joint-decompressor-work) (request joint-decomp-request) (output-frame joint-anim-frame) (num-joints int)) "Decompress a single animation, adding to accumulator" - ;; first, the fixed part (decomp-fixed output-frame num-joints (-> request jacc fixed) (-> request amount)) - ;; base frame - (decomp-frame - output-frame - num-joints - (-> request jacc data (-> request frame)) - (* (- 1.0 (-> request frame-interp)) (-> request amount)) - (-> request jacc fixed hdr) - ) - + (decomp-frame output-frame + num-joints + (-> request jacc data (-> request frame)) + (* (- 1.0 (-> request frame-interp)) (-> request amount)) + (-> request jacc fixed hdr)) ;; interpolate to next frame (cond ((!= 0.0 (-> request frame-interp)) - (decomp-frame - output-frame - num-joints - (-> request jacc data (+ 1 (-> request frame))) - (* (-> request frame-interp) (-> request amount)) - (-> request jacc fixed hdr)) - ) - (else - ) - ) - - (none) - ) + (decomp-frame output-frame + num-joints + (-> request jacc data (+ 1 (-> request frame))) + (* (-> request frame-interp) (-> request amount)) + (-> request jacc fixed hdr))) + (else)) + (none)) (defmethod finalize-frame! ((this new-joint-decompressor-work) (output-frame joint-anim-frame) (num-joints int)) (when (<= num-joints 2) - (return #f) - ) - + (return #f)) (dotimes (tqi (- num-joints 2)) (let ((tq (-> (the (inline-array transformq) (-> output-frame data)) tqi))) (set! (-> tq trans w) 1.0) (set! (-> tq scale w) 1.0) - (quaternion-normalize! (-> tq quat)) - ) - ) - (none) - ) - + (quaternion-normalize! (-> tq quat)))) + (none)) ;; DECOMP BEGINS @@ -516,97 +397,70 @@ (defmethod print ((this joint)) (format #t "#<~A ~S ~D @ #x~X>" (-> this type) (-> this name) (-> this number) this) - this - ) + this) (defmethod mem-usage ((this joint) (arg0 memory-usage-block) (arg1 int)) (set! (-> arg0 length) (max 66 (-> arg0 length))) (set! (-> arg0 data 65 name) "joint") (+! (-> arg0 data 65 count) 1) - (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 65 used) v1-6) - (+! (-> arg0 data 65 total) (logand -16 (+ v1-6 15))) - ) - this - ) + (let ((v1-6 (asize-of this))) (+! (-> arg0 data 65 used) v1-6) (+! (-> arg0 data 65 total) (logand -16 (+ v1-6 15)))) + this) (defmethod print ((this joint-anim)) (format #t "#<~A ~S ~D [~D] @ #x~X>" (-> this type) (-> this name) (-> this number) (-> this length) this) - this - ) + this) (defmethod length ((this joint-anim)) - (-> this length) - ) + (-> this length)) -(defmethod inspect joint-anim-matrix ((this joint-anim-matrix)) +(defmethod inspect joint-anim-matrix + ((this joint-anim-matrix)) (format #t "[~8x] ~A~%" this (-> this type)) (format #t "~Tname: ~A~%" (-> this name)) (format #t "~Tnumber: ~D~%" (-> this number)) (format #t "~Tdata[~D]: @ #x~X~%" (-> this length) (-> this data)) - this - ) + this) (defmethod asize-of ((this joint-anim-matrix)) - (the-as int (+ (-> joint-anim-matrix size) (* (-> this length) 64))) - ) + (the-as int (+ (-> joint-anim-matrix size) (* (-> this length) 64)))) -(defmethod inspect joint-anim-transformq ((this joint-anim-transformq)) +(defmethod inspect joint-anim-transformq + ((this joint-anim-transformq)) (format #t "[~8x] ~A~%" this (-> this type)) (format #t "~Tname: ~A~%" (-> this name)) (format #t "~Tnumber: ~D~%" (-> this number)) (format #t "~Tdata[~D]: @ #x~X~%" (-> this length) (-> this data)) (dotimes (s5-0 (-> this length)) - (format #t "~T [~D] ~`transformq`P~%" s5-0 (-> this data s5-0)) - ) - this - ) + (format #t "~T [~D] ~`transformq`P~%" s5-0 (-> this data s5-0))) + this) (defmethod asize-of ((this joint-anim-transformq)) - (the-as int (+ (-> joint-anim-transformq size) (* 48 (-> this length)))) - ) + (the-as int (+ (-> joint-anim-transformq size) (* 48 (-> this length))))) (defmethod asize-of ((this joint-anim-drawable)) - (the-as int (+ (-> joint-anim-drawable size) (* (-> this length) 4))) - ) + (the-as int (+ (-> joint-anim-drawable size) (* (-> this length) 4)))) (defun joint-anim-login ((arg0 joint-anim-drawable)) (dotimes (s5-0 (-> arg0 length)) - (if (-> arg0 data s5-0) - (login (-> arg0 data s5-0)) - ) - ) - arg0 - ) + (if (-> arg0 data s5-0) (login (-> arg0 data s5-0)))) + arg0) (defun joint-anim-inspect-elt ((arg0 joint-anim) (arg1 float)) "Inspect a single element in a joint anim. The float is rounded to an int." (case (-> arg0 type) ((joint-anim-matrix) - ((method-of-type matrix inspect) - (the-as matrix (-> (the-as joint-anim-matrix arg0) data (the int arg1) vector)) - ) - ) - ((joint-anim-transformq) - (format #t "~`transform`P~%" (-> (the-as joint-anim-transformq arg0) data (the int arg1))) - ) - ) - arg0 - ) + ((method-of-type matrix inspect) (the-as matrix (-> (the-as joint-anim-matrix arg0) data (the int arg1) vector)))) + ((joint-anim-transformq) (format #t "~`transform`P~%" (-> (the-as joint-anim-transformq arg0) data (the int arg1))))) + arg0) (defmethod mem-usage ((this joint-anim-drawable) (arg0 memory-usage-block) (arg1 int)) (set! (-> arg0 length) (max 77 (-> arg0 length))) (set! (-> arg0 data 76 name) "joint-anim-drawable") (+! (-> arg0 data 76 count) 1) - (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 76 used) v1-6) - (+! (-> arg0 data 76 total) (logand -16 (+ v1-6 15))) - ) + (let ((v1-6 (asize-of this))) (+! (-> arg0 data 76 used) v1-6) (+! (-> arg0 data 76 total) (logand -16 (+ v1-6 15)))) (dotimes (s3-0 (-> this length)) - (mem-usage (-> this data s3-0) arg0 arg1) - ) - this - ) + (mem-usage (-> this data s3-0) arg0 arg1)) + this) (defun jacc-mem-usage ((arg0 joint-anim-compressed-control) (arg1 memory-usage-block) (arg2 int)) (set! (-> arg1 length) (max 68 (-> arg1 length))) @@ -614,42 +468,28 @@ (+! (-> arg1 data 67 count) 1) (let ((v1-7 (+ (* (-> arg0 num-frames) 4) 16))) (+! (-> arg1 data 67 used) v1-7) - (+! (-> arg1 data 67 total) (logand -16 (+ v1-7 15))) - ) + (+! (-> arg1 data 67 total) (logand -16 (+ v1-7 15)))) (set! (-> arg1 length) (max 69 (-> arg1 length))) (set! (-> arg1 data 68 name) "joint-anim-fixed") (+! (-> arg1 data 68 count) 1) (let ((v1-17 (+ (-> arg0 fixed-qwc) 16))) (+! (-> arg1 data 68 used) v1-17) - (+! (-> arg1 data 68 total) (logand -16 (+ v1-17 15))) - ) + (+! (-> arg1 data 68 total) (logand -16 (+ v1-17 15)))) (dotimes (v1-21 (the-as int (-> arg0 num-frames))) (set! (-> arg1 length) (max 70 (-> arg1 length))) (set! (-> arg1 data 69 name) "joint-anim-frame") (+! (-> arg1 data 69 count) 1) (let ((a2-15 (* (-> arg0 frame-qwc) 16))) (+! (-> arg1 data 69 used) a2-15) - (+! (-> arg1 data 69 total) (logand -16 (+ a2-15 15))) - ) - ) - arg0 - ) + (+! (-> arg1 data 69 total) (logand -16 (+ a2-15 15))))) + arg0) (defmethod print ((this joint-control-channel)) - (format - #t - "#" - (-> this command) - (-> this frame-group) - (-> this frame-num) - this - ) - this - ) + (format #t "#" (-> this command) (-> this frame-group) (-> this frame-num) this) + this) (defmethod asize-of ((this joint-control)) - (the-as int (+ (-> this type size) (* 48 (-> this allocated-length)))) - ) + (the-as int (+ (-> this type size) (* 48 (-> this allocated-length))))) (defmethod new joint-control ((allocation symbol) (type-to-make type) (arg0 int)) "Create a new joint-control with enough room for the given number of channels" @@ -662,68 +502,40 @@ (set! (-> v0-0 postbind-function) #f) (set! (-> v0-0 effect) #f) (dotimes (v1-4 arg0) - (set! (-> v0-0 channel v1-4 parent) v0-0) - ) + (set! (-> v0-0 channel v1-4 parent) v0-0)) (set! (-> v0-0 blend-index) -1) - v0-0 - ) - ) + v0-0)) (defmethod debug-print-frames ((this joint-control-channel)) "Print the current frame of each joint on this channel. Note: this only appears to work for uncompressed joint animations." (let ((s5-0 (-> this frame-group)) - (f30-0 (-> this frame-num)) - ) + (f30-0 (-> this frame-num))) (dotimes (s4-0 (length s5-0)) (format #t "joint ~A ~D " (-> s5-0 data s4-0 name) s4-0) - (joint-anim-inspect-elt (-> s5-0 data s4-0) f30-0) - ) - ) - this - ) + (joint-anim-inspect-elt (-> s5-0 data s4-0) f30-0))) + this) (defmethod debug-print-channels ((this joint-control) (arg0 symbol)) "Print each active channel to the given stream." (dotimes (s4-0 (-> this active-channels)) (let* ((v1-6 (if (and (-> this channel s4-0 frame-group) (nonzero? (-> this channel s4-0 frame-group))) - (-> this channel s4-0 frame-group) - ) - ) - - ) - (format - arg0 - "ch:~2d ~C ~-35S f: ~6,,2f ~4,,2f ~4,,2f%~%" - s4-0 ;; channel index - (case (-> this channel s4-0 command) ;; how we got added. - (('push) - 80 - ) - (('push1) - 112 - ) - (('blend) - 66 - ) - (('stack) - 83 - ) - (('stack1) - 115 - ) - ) - (if v1-6 (-> v1-6 name) "(none)") ;; name of anim (can be "none" in the real game) - (+ (* (-> this channel s4-0 frame-num) (if v1-6 (-> v1-6 artist-step) 1.0)) ;; frame number - (if v1-6 (-> v1-6 artist-base) 0.0) - ) - (-> this channel s4-0 frame-interp) - (-> this channel s4-0 inspector-amount) - ) - ) - ) - 0 - ) + (-> this channel s4-0 frame-group)))) + (format arg0 + "ch:~2d ~C ~-35S f: ~6,,2f ~4,,2f ~4,,2f%~%" + s4-0 ;; channel index + (case (-> this channel s4-0 command) ;; how we got added. + (('push) 80) + (('push1) 112) + (('blend) 66) + (('stack) 83) + (('stack1) 115)) + (if v1-6 (-> v1-6 name) "(none)") ;; name of anim (can be "none" in the real game) + (+ (* (-> this channel s4-0 frame-num) (if v1-6 (-> v1-6 artist-step) 1.0)) ;; frame number + (if v1-6 (-> v1-6 artist-base) 0.0)) + (-> this channel s4-0 frame-interp) + (-> this channel s4-0 inspector-amount)))) + 0) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Art @@ -739,65 +551,46 @@ ;; art-joint-anim: used for animations. Provides joint-anim-compressed and eye-anim. (defmethod needs-link? ((this art)) - #f - ) + #f) (defmethod lookup-art ((this art) (arg0 string) (arg1 type)) "Look-up an art with the given name and type." - (the-as joint #f) - ) + (the-as joint #f)) (defmethod lookup-idx-of-art ((this art) (arg0 string) (arg1 type)) "Look up the index of an art with the given name and type." - (the-as int #f) - ) + (the-as int #f)) (defmethod print ((this art)) (format #t "#<~A ~S :length ~D @ #x~X>" (-> this type) (-> this name) (-> this length) this) - this - ) + this) (defmethod length ((this art)) - (-> this length) - ) + (-> this length)) (defmethod login ((this art)) ;; not sure why we have to do this, but if the res-lump isn't properly set up to point to the tags ;; do it manually. (if (and (-> this extra) (zero? (-> this extra tag))) - (set! (-> this extra tag) (&+ (the-as (pointer res-tag) (-> this extra)) 28)) - ) - this - ) + (set! (-> this extra tag) (&+ (the-as (pointer res-tag) (-> this extra)) 28))) + this) (defmethod mem-usage ((this art-mesh-anim) (arg0 memory-usage-block) (arg1 int)) (set! (-> arg0 length) (max 72 (-> arg0 length))) (set! (-> arg0 data 71 name) "art-mesh-anim") (+! (-> arg0 data 71 count) 1) - (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 71 used) v1-6) - (+! (-> arg0 data 71 total) (logand -16 (+ v1-6 15))) - ) - (if (-> this extra) - (mem-usage (-> this extra) arg0 (logior arg1 512)) - ) + (let ((v1-6 (asize-of this))) (+! (-> arg0 data 71 used) v1-6) (+! (-> arg0 data 71 total) (logand -16 (+ v1-6 15)))) + (if (-> this extra) (mem-usage (-> this extra) arg0 (logior arg1 512))) (dotimes (s3-0 (-> this length)) - (mem-usage (-> this data s3-0) arg0 arg1) - ) - this - ) + (mem-usage (-> this data s3-0) arg0 arg1)) + this) (defmethod mem-usage ((this art-joint-anim) (arg0 memory-usage-block) (arg1 int)) (set! (-> arg0 length) (max 75 (-> arg0 length))) (set! (-> arg0 data 74 name) "art-joint-anim") (+! (-> arg0 data 74 count) 1) - (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 74 used) v1-6) - (+! (-> arg0 data 74 total) (logand -16 (+ v1-6 15))) - ) - (if (-> this extra) - (mem-usage (-> this extra) arg0 (logior arg1 512)) - ) + (let ((v1-6 (asize-of this))) (+! (-> arg0 data 74 used) v1-6) (+! (-> arg0 data 74 total) (logand -16 (+ v1-6 15)))) + (if (-> this extra) (mem-usage (-> this extra) arg0 (logior arg1 512))) (jacc-mem-usage (-> this frames) arg0 arg1) (dotimes (s4-1 (-> this length)) (set! (-> arg0 length) (max 67 (-> arg0 length))) @@ -805,26 +598,21 @@ (+! (-> arg0 data 66 count) 1) (let ((v1-22 (asize-of (-> this data s4-1)))) (+! (-> arg0 data 66 used) v1-22) - (+! (-> arg0 data 66 total) (logand -16 (+ v1-22 15))) - ) - ) + (+! (-> arg0 data 66 total) (logand -16 (+ v1-22 15))))) (when (and (nonzero? (-> this eye-anim-data)) (-> this eye-anim-data)) (set! (-> arg0 length) (max 109 (-> arg0 length))) (set! (-> arg0 data 108 name) "eye-anim") (+! (-> arg0 data 108 count) 1) (let ((v1-41 (* (* (+ (-> this eye-anim-data max-frame) 1) 2) 8))) (+! (-> arg0 data 108 used) v1-41) - (+! (-> arg0 data 108 total) (logand -16 (+ v1-41 15))) - ) - ) - this - ) + (+! (-> arg0 data 108 total) (logand -16 (+ v1-41 15))))) + this) (defmethod asize-of ((this art-joint-anim)) - (the-as int (+ (-> art size) (* (-> this length) 4))) - ) + (the-as int (+ (-> art size) (* (-> this length) 4)))) -(defmethod inspect art-group ((this art-group)) +(defmethod inspect art-group + ((this art-group)) "Print the arts in an art-group" (format #t "[~8x] ~A~%" this (-> this type)) (format #t "~Tinfo: ~A~%" (-> this info)) @@ -834,235 +622,141 @@ (format #t "~Tdata[~D]: @ #x~X~%" (-> this length) (-> this data)) (dotimes (s5-0 (-> this length)) (if (-> this data s5-0) - (format #t "~T [~D] ~A (~D bytes)~%"s5-0 (-> this data s5-0) (mem-size (-> this data s5-0) #f 0)) - (format #t "~T [~D] ~A (~D bytes)~%" s5-0 (-> this data s5-0) 0) - ) - ) - this - ) - + (format #t "~T [~D] ~A (~D bytes)~%" s5-0 (-> this data s5-0) (mem-size (-> this data s5-0) #f 0)) + (format #t "~T [~D] ~A (~D bytes)~%" s5-0 (-> this data s5-0) 0))) + this) (defmethod needs-link? ((this art-group)) "Does this art-group need to be added to the level's art group? Some animations are streamed in, and need to be linked/unlinked to the level's list of art groups." - (the-as symbol (and (-> this length) - (type-type? (-> this data 0 type) art-joint-anim) - (!= (-> this name) (-> (the-as art-joint-anim (-> this data 0)) master-art-group-name)) - ) - ) - ) + (the-as symbol + (and (-> this length) + (type-type? (-> this data 0 type) art-joint-anim) + (!= (-> this name) (-> (the-as art-joint-anim (-> this data 0)) master-art-group-name))))) (defmethod lookup-art ((this art-group) (arg0 string) (arg1 type)) "Get the art with the given name and type. Set type to false if you don't care." - (the-as - joint - (cond - (arg1 - (let ((s3-0 (+ (length (-> this name)) 1))) - (dotimes (s2-0 (-> this length)) - (if (and (-> this data s2-0) ;; entry is populated - (= (-> this data s2-0 type) arg1) ;; type is right - (or (name= arg0 (-> this data s2-0 name)) (string-charp= arg0 (&-> (-> this data s2-0 name) data s3-0))) ;; name is right. also seek past ag name, and try again. - ) - (return (the-as joint (-> this data s2-0))) - ) - ) - ) - (the-as art-element #f) - ) - (else - ;; no type (also no weird after ag name check) - (dotimes (s4-1 (-> this length)) - (if (and (-> this data s4-1) (name= arg0 (-> this data s4-1 name))) - (return (the-as joint (-> this data s4-1))) - ) - ) - (the-as art-element #f) - ) - ) - ) - ) + (the-as joint + (cond + (arg1 + (let ((s3-0 (+ (length (-> this name)) 1))) + (dotimes (s2-0 (-> this length)) + (if (and (-> this data s2-0) ;; entry is populated + (= (-> this data s2-0 type) arg1) ;; type is right + (or (name= arg0 (-> this data s2-0 name)) (string-charp= arg0 (&-> (-> this data s2-0 name) data s3-0))) ;; name is right. also seek past ag name, and try again. + ) + (return (the-as joint (-> this data s2-0)))))) + (the-as art-element #f)) + (else + ;; no type (also no weird after ag name check) + (dotimes (s4-1 (-> this length)) + (if (and (-> this data s4-1) (name= arg0 (-> this data s4-1 name))) (return (the-as joint (-> this data s4-1))))) + (the-as art-element #f))))) (defmethod lookup-idx-of-art ((this art-group) (arg0 string) (arg1 type)) "Get the index of the art with the given name and type. Set type to false if you don't care. Will return #f if the art is not found." (cond (arg1 - (let ((s3-0 (+ (length (-> this name)) 1))) - (dotimes (s2-0 (-> this length)) - (if (and (-> this data s2-0) - (= (-> this data s2-0 type) arg1) - (or (name= arg0 (-> this data s2-0 name)) (string-charp= arg0 (&-> (-> this data s2-0 name) data s3-0))) - ) - (return s2-0) - ) - ) - ) - (the-as int #f) - ) + (let ((s3-0 (+ (length (-> this name)) 1))) + (dotimes (s2-0 (-> this length)) + (if (and (-> this data s2-0) + (= (-> this data s2-0 type) arg1) + (or (name= arg0 (-> this data s2-0 name)) (string-charp= arg0 (&-> (-> this data s2-0 name) data s3-0)))) + (return s2-0)))) + (the-as int #f)) (else - (dotimes (s4-1 (-> this length)) - (if (and (-> this data s4-1) (name= arg0 (-> this data s4-1 name))) - (return s4-1) - ) - ) - (the-as int #f) - ) - ) - ) + (dotimes (s4-1 (-> this length)) + (if (and (-> this data s4-1) (name= arg0 (-> this data s4-1 name))) (return s4-1))) + (the-as int #f)))) (defmethod login ((this art-group)) "Log in all the arts in a group." (dotimes (s5-0 (-> this length)) - (if (-> this data s5-0) - (set! (-> this data s5-0) (login (-> this data s5-0))) - ) - ) - this - ) + (if (-> this data s5-0) (set! (-> this data s5-0) (login (-> this data s5-0))))) + this) (defmethod mem-usage ((this art-group) (arg0 memory-usage-block) (arg1 int)) (set! (-> arg0 length) (max 71 (-> arg0 length))) (set! (-> arg0 data 70 name) "art-group") (+! (-> arg0 data 70 count) 1) - (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 70 used) v1-6) - (+! (-> arg0 data 70 total) (logand -16 (+ v1-6 15))) - ) - (if (-> this extra) - (mem-usage (-> this extra) arg0 (logior arg1 512)) - ) + (let ((v1-6 (asize-of this))) (+! (-> arg0 data 70 used) v1-6) (+! (-> arg0 data 70 total) (logand -16 (+ v1-6 15)))) + (if (-> this extra) (mem-usage (-> this extra) arg0 (logior arg1 512))) (dotimes (s3-0 (-> this length)) - (if (-> this data s3-0) - (mem-usage (-> this data s3-0) arg0 arg1) - ) - ) - this - ) + (if (-> this data s3-0) (mem-usage (-> this data s3-0) arg0 arg1))) + this) (defmethod relocate ((this art-group) (arg0 kheap) (arg1 (pointer uint8))) "Handle a loaded art-group." (let ((s4-0 (clear *temp-string*))) (string<-charp s4-0 arg1) - (set! this (cond - ((not this) - (format 0 "ERROR: art-group ~A is not a valid file.~%" s4-0) - (the-as art-group #f) - ) - ((not (type-type? (-> this type) art-group)) - (format 0 "ERROR: art-group ~A is not a art-group.~%" s4-0) - (the-as art-group #f) - ) - ((not (file-info-correct-version? (-> this info) (file-kind art-group) 0)) - (the-as art-group #f) - ) - (else - (let ((s5-1 (-> *level* loading-level))) - (if (or (not s5-1) (= (-> s5-1 name) 'default)) - (login this) ;; not part of level load, just normal login. - ) - (if s5-1 - (set-loaded-art (-> s5-1 art-group) this) ;; part of level load, add to level's ag, but don't log in yet. - ) - ) - this - ) + (set! this + (cond + ((not this) (format 0 "ERROR: art-group ~A is not a valid file.~%" s4-0) (the-as art-group #f)) + ((not (type-type? (-> this type) art-group)) + (format 0 "ERROR: art-group ~A is not a art-group.~%" s4-0) + (the-as art-group #f)) + ((not (file-info-correct-version? (-> this info) (file-kind art-group) 0)) (the-as art-group #f)) + (else + (let ((s5-1 (-> *level* loading-level))) + (if (or (not s5-1) (= (-> s5-1 name) 'default)) + (login this) ;; not part of level load, just normal login. ) - ) - ) - (none) - ) + (if s5-1 + (set-loaded-art (-> s5-1 art-group) this) ;; part of level load, add to level's ag, but don't log in yet. + )) + this)))) + (none)) (defmethod asize-of ((this art-mesh-geo)) - (the-as int (+ (-> art size) (* (-> this length) 4))) - ) + (the-as int (+ (-> art size) (* (-> this length) 4)))) (defmethod mem-usage ((this art-mesh-geo) (arg0 memory-usage-block) (arg1 int)) (set! (-> arg0 length) (max 73 (-> arg0 length))) (set! (-> arg0 data 72 name) "art-mesh-geo") (+! (-> arg0 data 72 count) 1) - (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 72 used) v1-6) - (+! (-> arg0 data 72 total) (logand -16 (+ v1-6 15))) - ) - (if (-> this extra) - (mem-usage (-> this extra) arg0 (logior arg1 512)) - ) + (let ((v1-6 (asize-of this))) (+! (-> arg0 data 72 used) v1-6) (+! (-> arg0 data 72 total) (logand -16 (+ v1-6 15)))) + (if (-> this extra) (mem-usage (-> this extra) arg0 (logior arg1 512))) (dotimes (s3-0 (-> this length)) - (mem-usage (-> this data s3-0) arg0 arg1) - ) - this - ) + (mem-usage (-> this data s3-0) arg0 arg1)) + this) (defmethod login ((this art-joint-anim)) (if (and (-> this extra) (zero? (-> this extra tag))) - (set! (-> this extra tag) (&+ (the-as (pointer res-tag) (-> this extra)) 28)) - ) - this - ) + (set! (-> this extra tag) (&+ (the-as (pointer res-tag) (-> this extra)) 28))) + this) (defmethod asize-of ((this art-joint-geo)) - (the-as int (+ (-> art size) (* (-> this length) 4))) - ) + (the-as int (+ (-> art size) (* (-> this length) 4)))) (defmethod lookup-art ((this art-joint-geo) (arg0 string) (arg1 type)) (cond (arg1 - (dotimes (s3-0 (-> this length)) - (if (and (= (-> this data s3-0 type) arg1) (name= arg0 (-> this data s3-0 name))) - (return (-> this data s3-0)) - ) - ) - (the-as joint #f) - ) + (dotimes (s3-0 (-> this length)) + (if (and (= (-> this data s3-0 type) arg1) (name= arg0 (-> this data s3-0 name))) (return (-> this data s3-0)))) + (the-as joint #f)) (else - (dotimes (s4-1 (-> this length)) - (if (name= arg0 (-> this data s4-1 name)) - (return (-> this data s4-1)) - ) - ) - (the-as joint #f) - ) - ) - ) + (dotimes (s4-1 (-> this length)) + (if (name= arg0 (-> this data s4-1 name)) (return (-> this data s4-1)))) + (the-as joint #f)))) (defmethod lookup-idx-of-art ((this art-joint-geo) (arg0 string) (arg1 type)) (cond (arg1 - (dotimes (s3-0 (-> this length)) - (if (and (= (-> this data s3-0 type) arg1) (name= arg0 (-> this data s3-0 name))) - (return s3-0) - ) - ) - (the-as int #f) - ) - (else - (dotimes (s4-1 (-> this length)) - (if (name= arg0 (-> this data s4-1 name)) - (return s4-1) - ) - ) - (the-as int #f) - ) - ) - ) + (dotimes (s3-0 (-> this length)) + (if (and (= (-> this data s3-0 type) arg1) (name= arg0 (-> this data s3-0 name))) (return s3-0))) + (the-as int #f)) + (else (dotimes (s4-1 (-> this length)) (if (name= arg0 (-> this data s4-1 name)) (return s4-1))) (the-as int #f)))) (defmethod mem-usage ((this art-joint-geo) (arg0 memory-usage-block) (arg1 int)) (set! (-> arg0 length) (max 74 (-> arg0 length))) (set! (-> arg0 data 73 name) "art-joint-geo") (+! (-> arg0 data 73 count) 1) - (let ((v1-6 (asize-of this))) - (+! (-> arg0 data 73 used) v1-6) - (+! (-> arg0 data 73 total) (logand -16 (+ v1-6 15))) - ) - (if (-> this extra) - (mem-usage (-> this extra) arg0 (logior arg1 512)) - ) + (let ((v1-6 (asize-of this))) (+! (-> arg0 data 73 used) v1-6) (+! (-> arg0 data 73 total) (logand -16 (+ v1-6 15)))) + (if (-> this extra) (mem-usage (-> this extra) arg0 (logior arg1 512))) (dotimes (s3-0 (-> this length)) - (mem-usage (-> this data s3-0) arg0 arg1) - ) - this - ) + (mem-usage (-> this data s3-0) arg0 arg1)) + this) ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Joint Control! @@ -1072,76 +766,49 @@ "Run the joint control num-func callback, remember the current time" ((-> arg0 num-func) arg0 (-> arg0 param 0) (-> arg0 param 1)) (set! (-> arg0 eval-time) (the-as uint (current-time))) - (none) - ) + (none)) (defun joint-control-channel-eval! ((arg0 joint-control-channel) (arg1 (function joint-control-channel float float float))) "Set the joint control num-func, and evaluate it." (set! (-> arg0 num-func) arg1) (arg1 arg0 (-> arg0 param 0) (-> arg0 param 1)) (set! (-> arg0 eval-time) (the-as uint (current-time))) - (none) - ) + (none)) (defun joint-control-channel-group-eval! ((arg0 joint-control-channel) (arg1 art-joint-anim) (arg2 (function joint-control-channel float float float))) "Set the joint control num-func, maybe update the anim, and maybe evaluate it." (set! (-> arg0 num-func) arg2) (cond - ((= (-> arg0 command) 'stack) - ) + ((= (-> arg0 command) 'stack)) (else - (if arg1 - (set! (-> arg0 frame-group) arg1) - ) - (arg2 arg0 (-> arg0 param 0) (-> arg0 param 1)) - (set! (-> arg0 eval-time) (the-as uint (current-time))) - ) - ) - 0 - ) + (if arg1 (set! (-> arg0 frame-group) arg1)) + (arg2 arg0 (-> arg0 param 0) (-> arg0 param 1)) + (set! (-> arg0 eval-time) (the-as uint (current-time))))) + 0) (defun joint-control-channel-group! ((arg0 joint-control-channel) (arg1 art-joint-anim) (arg2 (function joint-control-channel float float float))) "Set the joint control num-func and maybe update the anim." (set! (-> arg0 num-func) arg2) (cond - ((= (-> arg0 command) 'stack) - ) - (arg1 - (set! (-> arg0 frame-group) arg1) - ) - ) - 0 - ) + ((= (-> arg0 command) 'stack)) + (arg1 (set! (-> arg0 frame-group) arg1))) + 0) (defun joint-control-copy! ((arg0 joint-control) (arg1 joint-control)) "Copy one joint control to another." - ;; set fields (set! (-> arg0 blend-index) (-> arg1 blend-index)) (set! (-> arg0 active-channels) (-> arg1 active-channels)) ;; figure out which slot the source is, and remember that we're a copy. (set! (-> arg0 root-channel) - (the-as - (inline-array joint-control-channel) - (-> arg0 - channel - (/ (&- (the-as pointer (-> arg1 root-channel)) (the-as uint (the-as pointer (-> arg1 channel)))) 48) - ) - ) - ) + (the-as (inline-array joint-control-channel) + (-> arg0 channel (/ (&- (the-as pointer (-> arg1 root-channel)) (the-as uint (the-as pointer (-> arg1 channel)))) 48)))) ;; copy channels - (mem-copy! - (the-as pointer (-> arg0 channel)) - (the-as pointer (-> arg1 channel)) - (* 48 (-> arg0 allocated-length)) - ) - + (mem-copy! (the-as pointer (-> arg0 channel)) (the-as pointer (-> arg1 channel)) (* 48 (-> arg0 allocated-length))) ;; set parents of channels to point to the dest. (dotimes (v1-7 (-> arg0 allocated-length)) - (set! (-> arg0 channel v1-7 parent) arg0) - ) - arg0 - ) + (set! (-> arg0 channel v1-7 parent) arg0)) + arg0) ;; ERROR: Failed load: (set! v1-29 (l.wu (+ a0-9 -4))) at op 75 (defun joint-control-remap! ((arg0 joint-control) (arg1 art-group) (arg2 art-group) (arg3 pair) (arg4 int) (arg5 string)) @@ -1154,15 +821,13 @@ (sv-52 object) (sv-56 int) (sv-64 joint) - (sv-80 string) - ) + (sv-80 string)) (set! sv-16 (+ (length (-> arg2 name)) 1)) (set! sv-24 #t) (set! sv-32 arg4) (set! sv-40 2) (while (and (< sv-40 (-> arg1 length)) (!= (-> arg1 data sv-40 type) art-joint-anim)) - (set! sv-40 (+ sv-40 1)) - ) + (set! sv-40 (+ sv-40 1))) (dotimes (s2-1 (-> arg0 active-channels)) (set! sv-48 (-> arg0 channel s2-1)) (when (-> sv-48 frame-group) @@ -1171,35 +836,20 @@ (set! sv-52 (nassoc *temp-string* arg3)) (when sv-52 (let ((s1-1 sv-32) - (a0-9 sv-52) - ) - (set! sv-56 (mod s1-1 (+ ((method-of-type (rtype-of a0-9) length) a0-9) -1))) - ) + (a0-9 sv-52)) + (set! sv-56 (mod s1-1 (+ ((method-of-type (rtype-of a0-9) length) a0-9) -1)))) (let ((s1-2 format) - (s0-0 (clear *temp-string*)) - ) + (s0-0 (clear *temp-string*))) (set! sv-80 "~S") - (let ((a2-2 (ref sv-52 (+ sv-56 1)))) - (s1-2 s0-0 sv-80 a2-2) - ) - ) - ) - ) + (let ((a2-2 (ref sv-52 (+ sv-56 1)))) (s1-2 s0-0 sv-80 a2-2))))) (set! sv-64 (lookup-art arg1 *temp-string* art-joint-anim)) (cond - (sv-64 - (set! (-> sv-48 frame-group) (the-as art-joint-anim sv-64)) - ) + (sv-64 (set! (-> sv-48 frame-group) (the-as art-joint-anim sv-64))) (else - (set! (-> sv-48 frame-group) (the-as art-joint-anim (-> arg1 data sv-40))) - (set! (-> sv-48 frame-num) 0.0) - (set! sv-24 (the-as symbol #f)) - ) - ) - ) - ) - sv-24 - ) + (set! (-> sv-48 frame-group) (the-as art-joint-anim (-> arg1 data sv-40))) + (set! (-> sv-48 frame-num) 0.0) + (set! sv-24 (the-as symbol #f)))))) + sv-24) (defun flatten-joint-control-to-spr ((arg0 joint-control)) "Take the current state of the given joint-control and upload it to the scratchpad @@ -1217,14 +867,12 @@ (vf6 :class vf) (vf7 :class vf) (vf8 :class vf) - (vf9 :class vf) - ) + (vf9 :class vf)) (let ((nb-channels (-> arg0 active-channels))) - (let ((f0-0 1.0) ;; one - (v1-0 0) ;; offset in spad + (let ((f0-0 1.0) ;; one + (v1-0 0) ;; offset in spad (a1-0 (-> (scratchpad-object terrain-context) work foreground joint-work flattened)) ;; start of data. ) - ;; loop over active channels. ;; (dotimes (a0-1 nb-channels) @@ -1241,16 +889,12 @@ (set! (-> a1-0 4 quad) (the-as uint128 0)) (set! (-> a1-0 5 quad) (the-as uint128 0)) ;; and this thing stores the normal weight. - (set! (-> (the-as (pointer float) a2-4)) f0-0) - ) + (set! (-> (the-as (pointer float) a2-4)) f0-0)) ;; advance. - (set! a1-0 (the-as (inline-array vector) (-> a1-0 6))) - ) + (set! a1-0 (the-as (inline-array vector) (-> a1-0 6)))) (('blend 'push1) (let ((f1-0 (-> a2-3 frame-interp))) - (let ((a2-5 (- f0-0 f1-0))) - (.mov vf1 a2-5) - ) + (let ((a2-5 (- f0-0 f1-0))) (.mov vf1 a2-5)) (let ((a1-1 (the-as (inline-array vector) (-> a1-0 -6)))) (.lvf vf2 (&-> a1-1 0 quad)) (let ((a2-6 (&+ (the-as pointer a1-1) v1-0))) @@ -1271,23 +915,14 @@ (.svf (&-> a1-1 3 quad) vf5) (.svf (&-> a1-1 4 quad) vf6) (.svf (&-> a1-1 5 quad) vf7) - (set! (-> (the-as (pointer float) a2-6)) (+ (-> (the-as (pointer float) a2-6) 0) f1-0)) - ) - (set! a1-0 (the-as (inline-array vector) (-> a1-1 6))) - ) - ) - ) + (set! (-> (the-as (pointer float) a2-6)) (+ (-> (the-as (pointer float) a2-6) 0) f1-0))) + (set! a1-0 (the-as (inline-array vector) (-> a1-1 6)))))) (('stack) (let* ((f2-2 (-> a2-3 frame-interp)) (f1-2 (- f0-0 f2-2)) - (a1-2 (the-as (inline-array vector) (-> a1-0 -12))) - ) - (let ((a2-7 f2-2)) - (.mov vf1 a2-7) - ) - (let ((a2-8 f1-2)) - (.mov vf2 a2-8) - ) + (a1-2 (the-as (inline-array vector) (-> a1-0 -12)))) + (let ((a2-7 f2-2)) (.mov vf1 a2-7)) + (let ((a2-8 f1-2)) (.mov vf2 a2-8)) (.lvf vf3 (&-> a1-2 0 quad)) (.lvf vf4 (&-> a1-2 1 quad)) (.lvf vf5 (&-> a1-2 2 quad)) @@ -1324,14 +959,8 @@ (.svf (&-> a1-2 3 quad) vf6) (.svf (&-> a1-2 4 quad) vf7) (.svf (&-> a1-2 5 quad) vf8) - (set! a1-0 (the-as (inline-array vector) (-> a1-2 6))) - ) - ) - ) - ) - (+! v1-0 4) - ) - ) + (set! a1-0 (the-as (inline-array vector) (-> a1-2 6))))))) + (+! v1-0 4))) (let ((upl-idx 0)) (dotimes (ch nb-channels) (when (< 0.001 (-> (scratchpad-object terrain-context) work foreground joint-work flatten-array ch)) @@ -1339,139 +968,74 @@ (s2-0 (-> v1-9 frame-group frames)) (f0-2 (-> v1-9 frame-num)) (s1-0 (the int f0-2)) - (f30-0 (- f0-2 (the float s1-0))) - ) + (f30-0 (- f0-2 (the float s1-0)))) (let ((s0-0 (+ (-> s2-0 num-frames) -1))) - (if (not (-> v1-9 frame-group)) - (format 0 "Channel ~D skel ~A frame-group is #f!!!~%" ch arg0) - ) + (if (not (-> v1-9 frame-group)) (format 0 "Channel ~D skel ~A frame-group is #f!!!~%" ch arg0)) (when (>= s1-0 (the-as int s0-0)) (set! f30-0 0.0) - (set! s1-0 (the-as int s0-0)) - ) - ) + (set! s1-0 (the-as int s0-0)))) (let ((v1-18 (-> (scratchpad-object terrain-context) work foreground joint-work uploads upl-idx))) (set! (-> v1-18 fixed) (-> s2-0 fixed)) (set! (-> v1-18 fixed-qwc) (the-as int (-> s2-0 fixed-qwc))) (set! (-> v1-18 frame) (-> s2-0 data s1-0)) - (set! (-> v1-18 frame-qwc) (the-as int (if (= f30-0 0.0) - (-> s2-0 frame-qwc) - (* (-> s2-0 frame-qwc) 2) - ) - ) - ) + (set! (-> v1-18 frame-qwc) (the-as int (if (= f30-0 0.0) (-> s2-0 frame-qwc) (* (-> s2-0 frame-qwc) 2)))) (set! (-> v1-18 amount) (-> (scratchpad-object terrain-context) work foreground joint-work flatten-array ch)) - (set! (-> v1-18 interp) f30-0) - ) - ) - (+! upl-idx 1) - ) - ) - (set! (-> (scratchpad-object terrain-context) work foreground joint-work num-uploads) upl-idx) - ) + (set! (-> v1-18 interp) f30-0))) + (+! upl-idx 1))) + (set! (-> (scratchpad-object terrain-context) work foreground joint-work num-uploads) upl-idx)) (dotimes (v1-24 nb-channels) (set! (-> arg0 channel v1-24 inspector-amount) - (-> (scratchpad-object terrain-context) work foreground joint-work flatten-array v1-24) - ) - ) - ) - 0 - ) - ) + (-> (scratchpad-object terrain-context) work foreground joint-work flatten-array v1-24)))) + 0)) (defun matrix-from-joint-anim-frame ((arg0 joint-anim-compressed-control) (arg1 int) (arg2 int)) (let ((v1-1 (the-as object (-> arg0 fixed data))) - (v0-0 (the-as object (-> arg0 data arg2 data))) - ) + (v0-0 (the-as object (-> arg0 data arg2 data)))) (cond ((not (logtest? (-> arg0 fixed hdr matrix-bits) 1)) - (set! v1-1 (cond - ((zero? arg1) - (return (the-as matrix v1-1)) - v1-1 - ) - (else - (-> (the-as (inline-array vector) v1-1) 4) - ) - ) - ) - ) - ((zero? arg1) - (return (the-as matrix v0-0)) - ) - (else - (set! v0-0 (-> (the-as (inline-array vector) v0-0) 4)) - ) - ) - (if (not (logtest? (-> arg0 fixed hdr matrix-bits) 2)) - (return (the-as matrix v1-1)) - ) - (the-as matrix v0-0) - ) - ) + (set! v1-1 + (cond + ((zero? arg1) (return (the-as matrix v1-1)) v1-1) + (else (-> (the-as (inline-array vector) v1-1) 4))))) + ((zero? arg1) (return (the-as matrix v0-0))) + (else (set! v0-0 (-> (the-as (inline-array vector) v0-0) 4)))) + (if (not (logtest? (-> arg0 fixed hdr matrix-bits) 2)) (return (the-as matrix v1-1))) + (the-as matrix v0-0))) (defun matrix-from-control-channel! ((arg0 matrix) (arg1 joint) (arg2 joint-control-channel)) (let ((s4-0 (-> arg2 frame-group)) - (s5-0 (-> arg1 number)) - ) - (if (>= s5-0 2) - (format 0 "ERROR: Call to matrix-from-control-channel! on joint ~D~%" s5-0) - ) + (s5-0 (-> arg1 number))) + (if (>= s5-0 2) (format 0 "ERROR: Call to matrix-from-control-channel! on joint ~D~%" s5-0)) (let* ((f30-0 (fmax 0.0 (fmin (-> arg2 frame-num) (the float (+ (-> s4-0 data 0 length) -1))))) - (f0-1 f30-0) - ) + (f0-1 f30-0)) (cond ((= (the float (the int f0-1)) f0-1) (let* ((a2-3 (matrix-from-joint-anim-frame (-> s4-0 frames) s5-0 (the int f30-0))) (v1-7 (-> a2-3 vector 0 quad)) (a0-3 (-> a2-3 vector 1 quad)) (a1-3 (-> a2-3 vector 2 quad)) - (a2-4 (-> a2-3 vector 3 quad)) - ) + (a2-4 (-> a2-3 vector 3 quad))) (set! (-> arg0 vector 0 quad) v1-7) (set! (-> arg0 vector 1 quad) a0-3) (set! (-> arg0 vector 2 quad) a1-3) - (set! (-> arg0 vector 3 quad) a2-4) - ) - arg0 - ) + (set! (-> arg0 vector 3 quad) a2-4)) + arg0) (else - (let ((s3-1 (matrix-from-joint-anim-frame (-> s4-0 frames) s5-0 (the int f30-0))) - (a2-7 (matrix-from-joint-anim-frame (-> s4-0 frames) s5-0 (+ (the int f30-0) 1))) - (f0-9 (- f30-0 (the float (the int f30-0)))) - ) - (matrix-lerp! arg0 s3-1 a2-7 f0-9) - ) - ) - ) - ) - ) - ) + (let ((s3-1 (matrix-from-joint-anim-frame (-> s4-0 frames) s5-0 (the int f30-0))) + (a2-7 (matrix-from-joint-anim-frame (-> s4-0 frames) s5-0 (+ (the int f30-0) 1))) + (f0-9 (- f30-0 (the float (the int f30-0))))) + (matrix-lerp! arg0 s3-1 a2-7 f0-9))))))) (defun matrix-from-control-pair! ((arg0 matrix) (arg1 matrix) (arg2 joint)) (let ((f30-0 (-> arg1 vector 0 z))) (cond - ((>= 0.0 f30-0) - (empty) - arg0 - ) - ((>= f30-0 1.0) - (matrix-from-control-channel! arg0 arg2 (the-as joint-control-channel arg1)) - ) + ((>= 0.0 f30-0) (empty) arg0) + ((>= f30-0 1.0) (matrix-from-control-channel! arg0 arg2 (the-as joint-control-channel arg1))) (else - (let ((a2-3 (matrix-from-control-channel! - (the-as matrix (-> (scratchpad-object terrain-context) work)) - arg2 - (the-as joint-control-channel arg1) - ) - ) - ) - (matrix-lerp! arg0 arg0 a2-3 f30-0) - ) - ) - ) - ) - ) + (let ((a2-3 (matrix-from-control-channel! (the-as matrix (-> (scratchpad-object terrain-context) work)) + arg2 + (the-as joint-control-channel arg1)))) + (matrix-lerp! arg0 arg0 a2-3 f30-0)))))) (defun matrix-from-control! ((arg0 matrix-stack) (arg1 joint) (arg2 joint-control) (arg3 symbol)) (set! (-> arg0 top) (the-as matrix (-> arg0 data))) @@ -1479,16 +1043,10 @@ (dotimes (s2-0 (-> arg2 active-channels)) (let* ((a2-1 (-> arg2 channel s2-0)) (v1-4 (-> a2-1 command)) - (s1-0 64) - ) + (s1-0 64)) (cond ((and (= arg3 'no-push) (= v1-4 'push1)) - (matrix-from-control-channel! - (the-as matrix (&- (the-as pointer (-> arg0 top)) (the-as uint s1-0))) - arg1 - a2-1 - ) - ) + (matrix-from-control-channel! (the-as matrix (&- (the-as pointer (-> arg0 top)) (the-as uint s1-0))) arg1 a2-1)) ((and (= arg3 'no-push) (= v1-4 'stack)) (set! (-> arg0 top) (the-as matrix (&- (the-as pointer (-> arg0 top)) (the-as uint s1-0)))) (let* ((v1-10 (the-as matrix (&- (the-as pointer (-> arg0 top)) (the-as uint s1-0)))) @@ -1496,40 +1054,27 @@ (a0-10 (-> a3-1 vector 0 quad)) (a1-4 (-> a3-1 vector 1 quad)) (a2-2 (-> a3-1 vector 2 quad)) - (a3-2 (-> a3-1 vector 3 quad)) - ) + (a3-2 (-> a3-1 vector 3 quad))) (set! (-> v1-10 vector 0 quad) a0-10) (set! (-> v1-10 vector 1 quad) a1-4) (set! (-> v1-10 vector 2 quad) a2-2) - (set! (-> v1-10 vector 3 quad) a3-2) - ) - ) + (set! (-> v1-10 vector 3 quad) a3-2))) ((= v1-4 'push) (matrix-from-control-channel! (-> arg0 top) arg1 a2-1) (set! (-> arg0 top) (the-as matrix (+ (the-as uint (-> arg0 top)) s1-0))) ;(return (-> arg0 data 0)) ) ((or (= v1-4 'blend) (= v1-4 'push1)) - (matrix-from-control-pair! - (the-as matrix (&- (the-as pointer (-> arg0 top)) (the-as uint s1-0))) - (the-as matrix a2-1) - arg1 - ) - ) + (matrix-from-control-pair! (the-as matrix (&- (the-as pointer (-> arg0 top)) (the-as uint s1-0))) + (the-as matrix a2-1) + arg1)) ((= v1-4 'stack) (set! (-> arg0 top) (the-as matrix (&- (the-as pointer (-> arg0 top)) (the-as uint s1-0)))) (let ((a1-8 (&- (the-as pointer (-> arg0 top)) (the-as uint s1-0))) (v1-19 (-> arg0 top)) - (f0-0 (-> a2-1 frame-interp)) - ) - (matrix-lerp! (the-as matrix a1-8) (the-as matrix a1-8) v1-19 f0-0) - ) - ) - ) - ) - ) - (the-as matrix (-> arg0 data)) - ) + (f0-0 (-> a2-1 frame-interp))) + (matrix-lerp! (the-as matrix a1-8) (the-as matrix a1-8) v1-19 f0-0)))))) + (the-as matrix (-> arg0 data))) (defmethod reset-and-assign-geo! ((this cspace) (arg0 basic)) (set! (-> this parent) #f) @@ -1538,17 +1083,13 @@ (set! (-> this param0) #f) (set! (-> this param1) #f) (set! (-> this param2) #f) - this - ) + this) (defmethod new cspace ((allocation symbol) (type-to-make type) (arg0 basic)) (let ((t9-0 (method-of-type structure new)) - (v1-1 type-to-make) - ) + (v1-1 type-to-make)) (-> type-to-make size) - ((method-of-type cspace reset-and-assign-geo!) (the-as cspace (t9-0 allocation v1-1)) arg0) - ) - ) + ((method-of-type cspace reset-and-assign-geo!) (the-as cspace (t9-0 allocation v1-1)) arg0))) (defun cspace<-cspace! ((arg0 cspace) (arg1 cspace)) (let ((v0-0 (-> arg0 bone transform))) @@ -1556,76 +1097,55 @@ (v1-2 (-> a2-0 vector 0 quad)) (a0-1 (-> a2-0 vector 1 quad)) (a1-1 (-> a2-0 vector 2 quad)) - (a2-1 (-> a2-0 vector 3 quad)) - ) + (a2-1 (-> a2-0 vector 3 quad))) (set! (-> v0-0 vector 0 quad) v1-2) (set! (-> v0-0 vector 1 quad) a0-1) (set! (-> v0-0 vector 2 quad) a1-1) - (set! (-> v0-0 vector 3 quad) a2-1) - ) - v0-0 - ) - ) + (set! (-> v0-0 vector 3 quad) a2-1)) + v0-0)) (defun cspace<-rot-yxy! ((arg0 cspace) (arg1 transform)) (let ((s5-0 (-> arg0 bone transform))) (matrix-rotate-yxy! s5-0 (-> arg1 rot)) - (scale-matrix! s5-0 (-> arg1 scale) s5-0) - ) - ) + (scale-matrix! s5-0 (-> arg1 scale) s5-0))) (defun cspace<-transform-yxy! ((arg0 cspace) (arg1 transform)) (let ((s4-0 (-> arg0 bone transform)) (s5-0 (new 'stack-no-clear 'matrix)) - (s3-0 (new 'stack-no-clear 'matrix)) - ) + (s3-0 (new 'stack-no-clear 'matrix))) (matrix-identity! s4-0) (matrix-translate! s4-0 (-> arg1 trans)) (matrix-rotate-yxy! s5-0 (-> arg1 rot)) (matrix*! s3-0 s5-0 s4-0) - (scale-matrix! s4-0 (-> arg1 scale) s3-0) - ) - ) + (scale-matrix! s4-0 (-> arg1 scale) s3-0))) (defun cspace<-transformq! ((arg0 cspace) (arg1 transformq)) - (matrix<-transformq! (-> arg0 bone transform) arg1) - ) + (matrix<-transformq! (-> arg0 bone transform) arg1)) (defun cspace<-transformq+trans! ((arg0 cspace) (arg1 transformq) (arg2 vector)) - (matrix<-transformq+trans! (-> arg0 bone transform) arg1 arg2) - ) + (matrix<-transformq+trans! (-> arg0 bone transform) arg1 arg2)) (defun cspace<-transformq+world-trans! ((arg0 cspace) (arg1 transformq) (arg2 vector)) - (matrix<-transformq+world-trans! (-> arg0 bone transform) arg1 arg2) - ) + (matrix<-transformq+world-trans! (-> arg0 bone transform) arg1 arg2)) (defun cspace-calc-total-matrix! ((arg0 cspace) (arg1 matrix)) - (matrix*! arg1 (-> arg0 bone transform) (-> *math-camera* camera-temp)) - ) + (matrix*! arg1 (-> arg0 bone transform) (-> *math-camera* camera-temp))) (defun cspace<-matrix-no-push-joint! ((arg0 cspace) (arg1 joint-control)) - (let ((v1-2 (matrix-from-control! - (-> (scratchpad-object terrain-context) work foreground joint-work joint-stack) - (-> arg0 joint) - arg1 - 'no-push - ) - ) - (v0-1 (-> arg0 bone transform)) - ) + (let ((v1-2 (matrix-from-control! (-> (scratchpad-object terrain-context) work foreground joint-work joint-stack) + (-> arg0 joint) + arg1 + 'no-push)) + (v0-1 (-> arg0 bone transform))) (let ((a0-4 (-> v1-2 vector 0 quad)) (a1-2 (-> v1-2 vector 1 quad)) (a2-1 (-> v1-2 vector 2 quad)) - (v1-3 (-> v1-2 vector 3 quad)) - ) + (v1-3 (-> v1-2 vector 3 quad))) (set! (-> v0-1 vector 0 quad) a0-4) (set! (-> v0-1 vector 1 quad) a1-2) (set! (-> v0-1 vector 2 quad) a2-1) - (set! (-> v0-1 vector 3 quad) v1-3) - ) - v0-1 - ) - ) + (set! (-> v0-1 vector 3 quad) v1-3)) + v0-1)) (defun cspace<-matrix-joint! ((arg0 cspace) (arg1 matrix)) (let ((v0-0 (-> arg0 bone transform))) @@ -1633,20 +1153,15 @@ (v1-1 (-> a2-0 vector 0 quad)) (a0-1 (-> a2-0 vector 1 quad)) (a1-1 (-> a2-0 vector 2 quad)) - (a2-1 (-> a2-0 vector 3 quad)) - ) + (a2-1 (-> a2-0 vector 3 quad))) (set! (-> v0-0 vector 0 quad) v1-1) (set! (-> v0-0 vector 1 quad) a0-1) (set! (-> v0-0 vector 2 quad) a1-1) - (set! (-> v0-0 vector 3 quad) a2-1) - ) - v0-0 - ) - ) + (set! (-> v0-0 vector 3 quad) a2-1)) + v0-0)) (defun cspace<-parented-matrix-joint! ((arg0 cspace) (arg1 matrix)) - (matrix*! (-> arg0 bone transform) arg1 (-> arg0 parent bone transform)) - ) + (matrix*! (-> arg0 bone transform) arg1 (-> arg0 parent bone transform))) ;; tricky ones: ;; cspace<-parented-transformq-joint! @@ -1670,6 +1185,7 @@ ;; all run by create-interpolated-joint-animation-frame (def-mips2c cspace<-parented-transformq-joint! (function cspace transformq none)) + ; (defun cspace<-parented-transformq-joint! ((arg0 cspace) (arg1 transformq)) ; (nop!) ; ;; the ops in these funcs were scrambled for pipeline optimization. screw that. @@ -1798,86 +1314,72 @@ ; ) (define-extern decompress-fixed-data-to-accumulator (function none)) + (define-extern decompress-frame-data-to-accumulator (function none)) + (define-extern decompress-frame-data-pair-to-accumulator (function none)) -;; ERROR: function was not converted to expressions. Cannot decompile. ;; ERROR: function was not converted to expressions. Cannot decompile. ;; ERROR: function was not converted to expressions. Cannot decompile. - +;; ERROR: function was not converted to expressions. Cannot decompile. (defun make-joint-jump-tables () -#| - #x3ee6b6f9, // = 9 ^ 1055307504 - #x3ee6b6ff, // = 15 ^ 1055307504 - #x3ee6b6e2, // = 18 ^ 1055307504 - #x3ee6b6e4, // = 20 ^ 1055307504 - #x3ee6b6e5, // = 21 ^ 1055307504 - #x3ee6b6eb, // = 27 ^ 1055307504 - #x3ee6b6ee, // = 30 ^ 1055307504 - #x3ee6b6f6, // = 6 ^ 1055307504 - #x3ee6b6fc, // = 12 ^ 1055307504 - #x3ee6b6ff, // = 15 ^ 1055307504 - #x3ee6b6e3, // = 19 ^ 1055307504 - #x3ee6b6e4, // = 20 ^ 1055307504 - #x3ee6b6e8, // = 24 ^ 1055307504 - #x3ee6b6eb, // = 27 ^ 1055307504 - #x3ee6b6ef, // = 31 ^ 1055307504 - #x3ee6b6f6, // = 6 ^ 1055307504 - |# + #| + #x3ee6b6f9, // = 9 ^ 1055307504 + #x3ee6b6ff, // = 15 ^ 1055307504 + #x3ee6b6e2, // = 18 ^ 1055307504 + #x3ee6b6e4, // = 20 ^ 1055307504 + #x3ee6b6e5, // = 21 ^ 1055307504 + #x3ee6b6eb, // = 27 ^ 1055307504 + #x3ee6b6ee, // = 30 ^ 1055307504 + #x3ee6b6f6, // = 6 ^ 1055307504 + #x3ee6b6fc, // = 12 ^ 1055307504 + #x3ee6b6ff, // = 15 ^ 1055307504 + #x3ee6b6e3, // = 19 ^ 1055307504 + #x3ee6b6e4, // = 20 ^ 1055307504 + #x3ee6b6e8, // = 24 ^ 1055307504 + #x3ee6b6eb, // = 27 ^ 1055307504 + #x3ee6b6ef, // = 31 ^ 1055307504 + #x3ee6b6f6, // = 6 ^ 1055307504 + |# (set! (-> (scratchpad-object terrain-context) work foreground joint-work fix-jmp-table 0) - (the-as (function none) (+ 0 #x3ee6b6f9)) - ) + (the-as (function none) (+ 0 #x3ee6b6f9))) (set! (-> (scratchpad-object terrain-context) work foreground joint-work fix-jmp-table 1) - (the-as (function none) (+ 0 #x3ee6b6ff)) - ) + (the-as (function none) (+ 0 #x3ee6b6ff))) (set! (-> (scratchpad-object terrain-context) work foreground joint-work fix-jmp-table 2) - (the-as (function none) (+ 0 #x3ee6b6e2)) - ) + (the-as (function none) (+ 0 #x3ee6b6e2))) (set! (-> (scratchpad-object terrain-context) work foreground joint-work fix-jmp-table 3) - (the-as (function none) (+ 0 #x3ee6b6e4)) - ) + (the-as (function none) (+ 0 #x3ee6b6e4))) (set! (-> (scratchpad-object terrain-context) work foreground joint-work fix-jmp-table 4) - (the-as (function none) (+ 0 #x3ee6b6e5)) - ) + (the-as (function none) (+ 0 #x3ee6b6e5))) (set! (-> (scratchpad-object terrain-context) work foreground joint-work fix-jmp-table 5) - (the-as (function none) (+ 0 #x3ee6b6eb)) - ) + (the-as (function none) (+ 0 #x3ee6b6eb))) (set! (-> (scratchpad-object terrain-context) work foreground joint-work fix-jmp-table 6) - (the-as (function none) (+ 0 #x3ee6b6ee)) - ) + (the-as (function none) (+ 0 #x3ee6b6ee))) (set! (-> (scratchpad-object terrain-context) work foreground joint-work fix-jmp-table 7) - (the-as (function none) (+ 0 #x3ee6b6f6)) - ) + (the-as (function none) (+ 0 #x3ee6b6f6))) (set! (-> (scratchpad-object terrain-context) work foreground joint-work fix-jmp-table 8) - (the-as (function none) (+ 0 #x3ee6b6fc)) - ) + (the-as (function none) (+ 0 #x3ee6b6fc))) (set! (-> (scratchpad-object terrain-context) work foreground joint-work fix-jmp-table 9) - (the-as (function none) (+ 0 #x3ee6b6ff)) - ) + (the-as (function none) (+ 0 #x3ee6b6ff))) (set! (-> (scratchpad-object terrain-context) work foreground joint-work fix-jmp-table 10) - (the-as (function none) (+ 0 #x3ee6b6e3)) - ) + (the-as (function none) (+ 0 #x3ee6b6e3))) (set! (-> (scratchpad-object terrain-context) work foreground joint-work fix-jmp-table 11) - (the-as (function none) (+ 0 #x3ee6b6e4)) - ) + (the-as (function none) (+ 0 #x3ee6b6e4))) (set! (-> (scratchpad-object terrain-context) work foreground joint-work fix-jmp-table 12) - (the-as (function none) (+ 0 #x3ee6b6e8)) - ) + (the-as (function none) (+ 0 #x3ee6b6e8))) (set! (-> (scratchpad-object terrain-context) work foreground joint-work fix-jmp-table 13) - (the-as (function none) (+ 0 #x3ee6b6eb)) - ) + (the-as (function none) (+ 0 #x3ee6b6eb))) (set! (-> (scratchpad-object terrain-context) work foreground joint-work fix-jmp-table 14) - (the-as (function none) (+ 0 #x3ee6b6ef)) - ) + (the-as (function none) (+ 0 #x3ee6b6ef))) (set! (-> (scratchpad-object terrain-context) work foreground joint-work fix-jmp-table 15) - (the-as (function none) (+ 0 #x3ee6b6f6)) - ) - - - (let ((arr (new 'static 'array uint32 16 + (the-as (function none) (+ 0 #x3ee6b6f6))) + (let ((arr (new 'static + 'array + uint32 + 16 #x7b2191b ;; = 6 ^ 129112349 #x7b21914 ;; = 9 ^ 129112349 #x7b21916 ;; = 11 ^ 129112349 @@ -1897,12 +1399,11 @@ ))) (dotimes (i 16) (set! (-> (scratchpad-object terrain-context) work foreground joint-work frm-jmp-table i) - (the-as (function none) (-> arr i)) - ) - ) - ) - - (let ((arr (new 'static 'array uint32 16 + (the-as (function none) (-> arr i))))) + (let ((arr (new 'static + 'array + uint32 + 16 #x4d7666df ;; = 6 ^ 1299605209 #x4d7666d0 ;; = 9 ^ 1299605209 #x4d7666d2 ;; = 11 ^ 1299605209 @@ -1922,12 +1423,8 @@ ))) (dotimes (i 16) (set! (-> (scratchpad-object terrain-context) work foreground joint-work pair-jmp-table i) - (the-as (function none) (-> arr i)) - ) - ) - ) - 0 - ) + (the-as (function none) (-> arr i))))) + 0) ; (defun calc-animation-from-spr ((arg0 (inline-array vector)) (arg1 int)) ; (declare (asm-func object) @@ -1958,17 +1455,7 @@ (def-mips2c calc-animation-from-spr (function (inline-array vector) int none)) (defun create-interpolated-joint-animation-frame ((arg0 (inline-array vector)) (arg1 int) (arg2 process-drawable)) - (cond - (*use-new-decompressor* - (new-joint-decompressor (the joint-anim-frame arg0) arg1 (-> arg2 skel)) - ) - (else - (flatten-joint-control-to-spr (-> arg2 skel)) - (make-joint-jump-tables) - (calc-animation-from-spr arg0 arg1) - ) - ) - - 0 - ) + (*use-new-decompressor* (new-joint-decompressor (the joint-anim-frame arg0) arg1 (-> arg2 skel))) + (else (flatten-joint-control-to-spr (-> arg2 skel)) (make-joint-jump-tables) (calc-animation-from-spr arg0 arg1))) + 0) diff --git a/goal_src/jak1/engine/anim/mspace-h.gc b/goal_src/jak1/engine/anim/mspace-h.gc index bf7189d6b6..7911c312d5 100644 --- a/goal_src/jak1/engine/anim/mspace-h.gc +++ b/goal_src/jak1/engine/anim/mspace-h.gc @@ -1,7 +1,6 @@ ;;-*-Lisp-*- (in-package goal) (bundles "ENGINE.CGO" "GAME.CGO") - (require "kernel/gcommon.gc") ;; name: mspace-h.gc @@ -20,42 +19,32 @@ ;; - The skeleton: This is an inline array of bones. (called skeleton) ;; - The joint-control (not in this file): this has the logic for running joint animations. (called skel) - ;; First, the joint. This type just describes how the skeleton is connected and the bind pose. (deftype joint (basic) - ((name string) - (number int32) - (parent joint) - (bind-pose matrix :inline) - ) - ) + ((name string) + (number int32) + (parent joint) + (bind-pose matrix :inline))) ;; I believe this stores offsets, in bytes, of where there are stored ;; (possibly in the scratchpad) (deftype bone-cache (structure) - ((bone-matrix uint32) - (parent-matrix uint32) - (dummy uint32) - (frame uint32) - ) - ) + ((bone-matrix uint32) + (parent-matrix uint32) + (dummy uint32) + (frame uint32))) ;; The "bone" stores the final positions of the bodies. ;; This is a world space transform. (deftype bone (structure) - ((transform matrix :inline) - (position vector :inline :overlay-at (-> transform vector 3)) - (scale vector :inline) - (cache bone-cache :inline) - ) - ) + ((transform matrix :inline) + (position vector :inline :overlay-at (-> transform vector 3)) + (scale vector :inline) + (cache bone-cache :inline))) ;; Like a real skeleton, this is a collection of bones for a single character. (deftype skeleton (inline-array-class) - ((bones bone :inline :dynamic) - ) - ) - + ((bones bone :inline :dynamic))) (set! (-> skeleton heap-base) (the-as uint 96)) @@ -72,39 +61,23 @@ ;; node 4 is the first real joint (for jak, it's upper body). (deftype cspace (structure) - ((parent cspace) - (joint joint) - (joint-num int16) - (geo basic) - (bone bone) - (param0 function) - (param1 basic) - (param2 basic) - ) + ((parent cspace) + (joint joint) + (joint-num int16) + (geo basic) + (bone bone) + (param0 function) + (param1 basic) + (param2 basic)) (:methods - (new (symbol type basic) _type_) - (reset-and-assign-geo! (_type_ basic) _type_) - ) - ) - + (new (symbol type basic) _type_) + (reset-and-assign-geo! (_type_ basic) _type_))) (deftype cspace-array (inline-array-class) - ((data cspace :inline :dynamic) - ) - ) - + ((data cspace :inline :dynamic))) (set! (-> cspace-array heap-base) (the-as uint 32)) (defmethod print ((this cspace)) - (format - #t - "#" - (if (-> this joint) - (-> this joint name) - "nojoint" - ) - this - ) - this - ) + (format #t "#" (if (-> this joint) (-> this joint name) "nojoint") this) + this) diff --git a/goal_src/jak1/engine/camera/cam-combiner.gc b/goal_src/jak1/engine/camera/cam-combiner.gc index 939a8ca735..80b530f1bb 100644 --- a/goal_src/jak1/engine/camera/cam-combiner.gc +++ b/goal_src/jak1/engine/camera/cam-combiner.gc @@ -1,7 +1,6 @@ ;;-*-Lisp-*- (in-package goal) (bundles "ENGINE.CGO" "GAME.CGO") - (require "engine/gfx/hw/display.gc") (require "engine/camera/camera.gc") @@ -12,281 +11,179 @@ ;; DECOMP BEGINS (defstate cam-combiner-active (camera-combiner) - :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (case message - (('point-of-interest) - (cond - ((-> block param 0) - (set! (-> self tracking use-point-of-interest) #t) - (set! (-> self tracking point-of-interest quad) (-> (the-as vector (-> block param 0)) quad)) - (set! (-> self tracking point-of-interest-blend target) 1.0) - ) - (else - (set! (-> self tracking use-point-of-interest) #f) - (set! (-> self tracking point-of-interest-blend target) 0.0) - ) - ) - ) - (('set-interpolation) - (set! (-> self interp-val) 0.0) - (set! (-> self interp-step) (/ 5.0 (the float (-> block param 0)))) - ) - (('teleport) - (when (nonzero? (-> self tracking-status)) - (cam-calc-follow! (-> self tracking) (-> self trans) #f) - (slave-set-rotation! - (-> self tracking) - (-> self trans) - (the-as float (-> self tracking-options)) - (-> self fov) - #f - ) - ) - ) - (('stop-tracking) - (set! (-> self tracking-status) (the-as uint 0)) - 0 - ) - (('start-tracking) - (cond - ((< argc 1) - (let ((t9-2 format) - (a0-15 0) - (a1-3 "ERROR : missing camera-slave parameter to *camera-combiner* start-tracking~%") - ) - (let ((v1-7 (-> block param 0))) - (rtype-of v1-7) - ) - (t9-2 a0-15 a1-3) - ) - ) - ((let ((t9-3 type-type?) - (v1-8 (-> block param 0)) - ) - (not (t9-3 (rtype-of v1-8) camera-slave)) - ) - (let ((t9-4 format) - (a0-18 0) - (a1-5 "ERROR : invalid type '~A' to *camera-combiner* start-tracking~%") - (v1-10 (-> block param 0)) - ) - (t9-4 a0-18 a1-5 (rtype-of v1-10)) - ) - ) - ((zero? (-> self tracking-status)) - (set! (-> self tracking-status) (the-as uint 1)) - (let ((gp-1 (the-as object (-> block param 0)))) - (set! (-> self tracking-options) (the-as int (-> (the-as camera-slave gp-1) options))) - (set! (-> self tracking no-follow) (-> (the-as camera-slave gp-1) tracking no-follow)) - (copy-cam-float-seeker (-> self tracking tilt-adjust) (-> (the-as camera-slave gp-1) tracking tilt-adjust)) - (copy-cam-float-seeker - (-> self tracking underwater-blend) - (-> (the-as camera-slave gp-1) tracking underwater-blend) - ) - (set! (-> self tracking use-point-of-interest) (-> (the-as camera-slave gp-1) tracking use-point-of-interest)) - (set! (-> self tracking point-of-interest quad) - (-> (the-as camera-slave gp-1) tracking point-of-interest quad) - ) - (copy-cam-float-seeker - (-> self tracking point-of-interest-blend) - (-> (the-as camera-slave gp-1) tracking point-of-interest-blend) - ) - (let ((gp-2 (+ (the-as uint gp-1) 108))) - (cam-calc-follow! (-> self tracking) (the-as vector gp-2) #f) - (slave-set-rotation! - (-> self tracking) - (the-as vector gp-2) - (the-as float (-> self tracking-options)) - (-> self fov) - #f - ) - ) - ) - ) - ) - ) - (('copy-tracking) - (cond - ((< argc 1) - (let ((t9-10 format) - (a0-27 0) - (a1-11 "ERROR : missing camera-slave parameter to *camera-combiner* copy-tracking~%") - ) - (let ((v1-23 (-> block param 0))) - (rtype-of v1-23) - ) - (t9-10 a0-27 a1-11) - ) - ) - ((let ((t9-11 type-type?) - (v1-24 (-> block param 0)) - ) - (not (t9-11 (rtype-of v1-24) camera-slave)) - ) - (let ((t9-12 format) - (a0-30 0) - (a1-13 "ERROR : invalid type '~A' to *camera-combiner* copy-tracking~%") - (v1-25 (-> block param 0)) - ) - (t9-12 a0-30 a1-13 (rtype-of v1-25)) - ) - ) - ((nonzero? (-> self tracking-status)) - #f - ) - (else - (set! (-> self tracking-status) (the-as uint 1)) - (let ((gp-3 (the-as camera-slave (-> block param 0)))) - (set! (-> self tracking-options) (the-as int (-> gp-3 options))) - (set! (-> self tracking no-follow) (-> gp-3 tracking no-follow)) - (copy-cam-float-seeker (-> self tracking tilt-adjust) (-> gp-3 tracking tilt-adjust)) - (copy-cam-float-seeker (-> self tracking underwater-blend) (-> gp-3 tracking underwater-blend)) - (set! (-> self tracking follow-off quad) (-> gp-3 tracking follow-off quad)) - (set! (-> self tracking follow-pt quad) (-> gp-3 tracking follow-pt quad)) - (let* ((a2-17 (-> self tracking)) - (a3-3 (-> gp-3 tracking)) - (v1-36 (-> a3-3 inv-mat vector 0 quad)) - (a0-37 (-> a3-3 inv-mat vector 1 quad)) - (a1-16 (-> a3-3 inv-mat vector 2 quad)) - (a3-4 (-> a3-3 inv-mat vector 3 quad)) - ) - (set! (-> a2-17 inv-mat vector 0 quad) v1-36) - (set! (-> a2-17 inv-mat vector 1 quad) a0-37) - (set! (-> a2-17 inv-mat vector 2 quad) a1-16) - (set! (-> a2-17 inv-mat vector 3 quad) a3-4) - ) - (set! (-> self tracking use-point-of-interest) (-> gp-3 tracking use-point-of-interest)) - (set! (-> self tracking point-of-interest quad) (-> gp-3 tracking point-of-interest quad)) - (copy-cam-float-seeker (-> self tracking point-of-interest-blend) (-> gp-3 tracking point-of-interest-blend)) - ) - ) - ) - ) - ) - ) - :code (behavior () - (local-vars (sv-160 cam-rotation-tracker)) - (loop - (when (and (not (logtest? (-> *camera* master-options) 2)) (!= (-> self tracking-status) 0)) - (set! (-> self tracking-status) (the-as uint 0)) - 0 - ) - (when *camera* - (let ((s5-0 (-> *camera* slave 0)) - (s4-0 (-> *camera* slave 1)) - (f30-0 (parameter-ease-sin-clamp (-> self interp-val))) - (gp-0 (new-stack-vector0)) - ) - (set! (-> gp-0 quad) (-> self trans quad)) - (when s5-0 - (cond - (s4-0 - (vector-lerp-clamp! (-> self trans) (-> s5-0 0 trans) (-> s4-0 0 trans) f30-0) - (set! (-> self fov) (lerp-clamp (-> s5-0 0 fov) (-> s4-0 0 fov) f30-0)) - (set! (-> self dist-from-src) (vector-vector-distance (-> self trans) (-> s5-0 0 trans))) - (set! (-> self dist-from-dest) (vector-vector-distance (-> self trans) (-> s4-0 0 trans))) - (cond - ((= (-> self tracking-status) 1) - (cam-calc-follow! (-> self tracking) (-> self trans) #t) - (slave-set-rotation! - (-> self tracking) - (-> self trans) - (the-as float (-> self tracking-options)) - (-> self fov) - #t - ) - (let* ((a2-4 (-> self inv-camera-rot)) - (a3-2 (-> self tracking)) - (v1-20 (-> a3-2 inv-mat vector 0 quad)) - (a0-10 (-> a3-2 inv-mat vector 1 quad)) - (a1-6 (-> a3-2 inv-mat vector 2 quad)) - (a3-3 (-> a3-2 inv-mat vector 3 quad)) - ) - (set! (-> a2-4 vector 0 quad) v1-20) - (set! (-> a2-4 vector 1 quad) a0-10) - (set! (-> a2-4 vector 2 quad) a1-6) - (set! (-> a2-4 vector 3 quad) a3-3) - ) - ) - (else + :event + (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('point-of-interest) + (cond + ((-> block param 0) + (set! (-> self tracking use-point-of-interest) #t) + (set! (-> self tracking point-of-interest quad) (-> (the-as vector (-> block param 0)) quad)) + (set! (-> self tracking point-of-interest-blend target) 1.0)) + (else (set! (-> self tracking use-point-of-interest) #f) (set! (-> self tracking point-of-interest-blend target) 0.0)))) + (('set-interpolation) + (set! (-> self interp-val) 0.0) + (set! (-> self interp-step) (/ 5.0 (the float (-> block param 0))))) + (('teleport) + (when (nonzero? (-> self tracking-status)) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self tracking-options)) (-> self fov) #f))) + (('stop-tracking) (set! (-> self tracking-status) (the-as uint 0)) 0) + (('start-tracking) + (cond + ((< argc 1) + (let ((t9-2 format) + (a0-15 0) + (a1-3 "ERROR : missing camera-slave parameter to *camera-combiner* start-tracking~%")) + (let ((v1-7 (-> block param 0))) (rtype-of v1-7)) + (t9-2 a0-15 a1-3))) + ((let ((t9-3 type-type?) + (v1-8 (-> block param 0))) + (not (t9-3 (rtype-of v1-8) camera-slave))) + (let ((t9-4 format) + (a0-18 0) + (a1-5 "ERROR : invalid type '~A' to *camera-combiner* start-tracking~%") + (v1-10 (-> block param 0))) + (t9-4 a0-18 a1-5 (rtype-of v1-10)))) + ((zero? (-> self tracking-status)) + (set! (-> self tracking-status) (the-as uint 1)) + (let ((gp-1 (the-as object (-> block param 0)))) + (set! (-> self tracking-options) (the-as int (-> (the-as camera-slave gp-1) options))) + (set! (-> self tracking no-follow) (-> (the-as camera-slave gp-1) tracking no-follow)) + (copy-cam-float-seeker (-> self tracking tilt-adjust) (-> (the-as camera-slave gp-1) tracking tilt-adjust)) + (copy-cam-float-seeker (-> self tracking underwater-blend) (-> (the-as camera-slave gp-1) tracking underwater-blend)) + (set! (-> self tracking use-point-of-interest) (-> (the-as camera-slave gp-1) tracking use-point-of-interest)) + (set! (-> self tracking point-of-interest quad) (-> (the-as camera-slave gp-1) tracking point-of-interest quad)) + (copy-cam-float-seeker (-> self tracking point-of-interest-blend) + (-> (the-as camera-slave gp-1) tracking point-of-interest-blend)) + (let ((gp-2 (+ (the-as uint gp-1) 108))) + (cam-calc-follow! (-> self tracking) (the-as vector gp-2) #f) + (slave-set-rotation! (-> self tracking) (the-as vector gp-2) (the-as float (-> self tracking-options)) (-> self fov) #f)))))) + (('copy-tracking) + (cond + ((< argc 1) + (let ((t9-10 format) + (a0-27 0) + (a1-11 "ERROR : missing camera-slave parameter to *camera-combiner* copy-tracking~%")) + (let ((v1-23 (-> block param 0))) (rtype-of v1-23)) + (t9-10 a0-27 a1-11))) + ((let ((t9-11 type-type?) + (v1-24 (-> block param 0))) + (not (t9-11 (rtype-of v1-24) camera-slave))) + (let ((t9-12 format) + (a0-30 0) + (a1-13 "ERROR : invalid type '~A' to *camera-combiner* copy-tracking~%") + (v1-25 (-> block param 0))) + (t9-12 a0-30 a1-13 (rtype-of v1-25)))) + ((nonzero? (-> self tracking-status)) #f) + (else + (set! (-> self tracking-status) (the-as uint 1)) + (let ((gp-3 (the-as camera-slave (-> block param 0)))) + (set! (-> self tracking-options) (the-as int (-> gp-3 options))) + (set! (-> self tracking no-follow) (-> gp-3 tracking no-follow)) + (copy-cam-float-seeker (-> self tracking tilt-adjust) (-> gp-3 tracking tilt-adjust)) + (copy-cam-float-seeker (-> self tracking underwater-blend) (-> gp-3 tracking underwater-blend)) + (set! (-> self tracking follow-off quad) (-> gp-3 tracking follow-off quad)) + (set! (-> self tracking follow-pt quad) (-> gp-3 tracking follow-pt quad)) + (let* ((a2-17 (-> self tracking)) + (a3-3 (-> gp-3 tracking)) + (v1-36 (-> a3-3 inv-mat vector 0 quad)) + (a0-37 (-> a3-3 inv-mat vector 1 quad)) + (a1-16 (-> a3-3 inv-mat vector 2 quad)) + (a3-4 (-> a3-3 inv-mat vector 3 quad))) + (set! (-> a2-17 inv-mat vector 0 quad) v1-36) + (set! (-> a2-17 inv-mat vector 1 quad) a0-37) + (set! (-> a2-17 inv-mat vector 2 quad) a1-16) + (set! (-> a2-17 inv-mat vector 3 quad) a3-4)) + (set! (-> self tracking use-point-of-interest) (-> gp-3 tracking use-point-of-interest)) + (set! (-> self tracking point-of-interest quad) (-> gp-3 tracking point-of-interest quad)) + (copy-cam-float-seeker (-> self tracking point-of-interest-blend) (-> gp-3 tracking point-of-interest-blend)))))))) + :code + (behavior () + (local-vars (sv-160 cam-rotation-tracker)) + (loop (when (and (not (logtest? (-> *camera* master-options) 2)) (!= (-> self tracking-status) 0)) + (set! (-> self tracking-status) (the-as uint 0)) + 0) + (when *camera* + (let ((s5-0 (-> *camera* slave 0)) + (s4-0 (-> *camera* slave 1)) + (f30-0 (parameter-ease-sin-clamp (-> self interp-val))) + (gp-0 (new-stack-vector0))) + (set! (-> gp-0 quad) (-> self trans quad)) + (when s5-0 + (cond + (s4-0 + (vector-lerp-clamp! (-> self trans) (-> s5-0 0 trans) (-> s4-0 0 trans) f30-0) + (set! (-> self fov) (lerp-clamp (-> s5-0 0 fov) (-> s4-0 0 fov) f30-0)) + (set! (-> self dist-from-src) (vector-vector-distance (-> self trans) (-> s5-0 0 trans))) + (set! (-> self dist-from-dest) (vector-vector-distance (-> self trans) (-> s4-0 0 trans))) + (cond + ((= (-> self tracking-status) 1) + (cam-calc-follow! (-> self tracking) (-> self trans) #t) + (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self tracking-options)) (-> self fov) #t) + (let* ((a2-4 (-> self inv-camera-rot)) + (a3-2 (-> self tracking)) + (v1-20 (-> a3-2 inv-mat vector 0 quad)) + (a0-10 (-> a3-2 inv-mat vector 1 quad)) + (a1-6 (-> a3-2 inv-mat vector 2 quad)) + (a3-3 (-> a3-2 inv-mat vector 3 quad))) + (set! (-> a2-4 vector 0 quad) v1-20) + (set! (-> a2-4 vector 1 quad) a0-10) + (set! (-> a2-4 vector 2 quad) a1-6) + (set! (-> a2-4 vector 3 quad) a3-3))) + (else (set! sv-160 (-> s5-0 0 tracking)) (let ((s2-0 (-> s5-0 0 trans)) (s5-1 (-> s4-0 0 tracking)) - (s0-0 (-> s4-0 0 trans)) - ) + (s0-0 (-> s4-0 0 trans))) (cond ((= (-> self tracking-status) 3) (cam-calc-follow! (-> self tracking) s2-0 #t) (slave-set-rotation! (-> self tracking) s2-0 (the-as float (-> self tracking-options)) (-> self fov) #t) (set! sv-160 (-> self tracking)) - (set! s2-0 (-> self trans)) - ) + (set! s2-0 (-> self trans))) ((= (-> self tracking-status) 2) (cam-calc-follow! (-> self tracking) s0-0 #t) (slave-set-rotation! (-> self tracking) s0-0 (the-as float (-> self tracking-options)) (-> self fov) #t) (set! s5-1 (-> self tracking)) - (set! s0-0 (-> self trans)) - ) - ) + (set! s0-0 (-> self trans)))) (let ((s1-0 (new 'stack-no-clear 'matrix))) (dotimes (v1-35 3) - (set! (-> s1-0 vector v1-35 quad) (the-as uint128 0)) - ) + (set! (-> s1-0 vector v1-35 quad) (the-as uint128 0))) 0.0 0.0 0.0 (let ((s4-1 (new-stack-vector0))) 0.0 (let ((s3-0 (new-stack-matrix0))) - (vector-! - (the-as vector (-> s1-0 vector)) - (the-as vector (-> sv-160 inv-mat)) - (the-as vector (-> s5-1 inv-mat)) - ) + (vector-! (the-as vector (-> s1-0 vector)) (the-as vector (-> sv-160 inv-mat)) (the-as vector (-> s5-1 inv-mat))) (vector-! (-> s1-0 vector 1) (-> sv-160 inv-mat vector 1) (-> s5-1 inv-mat vector 1)) (vector-! (-> s1-0 vector 2) (-> sv-160 inv-mat vector 2) (-> s5-1 inv-mat vector 2)) (let ((f26-0 (vector-length (the-as vector (-> s1-0 vector)))) (f28-0 (vector-length (-> s1-0 vector 1))) - (f0-13 (vector-length (-> s1-0 vector 2))) - ) + (f0-13 (vector-length (-> s1-0 vector 2)))) (cond - ((and (< f26-0 f28-0) (< f26-0 f0-13)) - (vector-cross! s4-1 (-> s1-0 vector 1) (-> s1-0 vector 2)) - ) - ((and (< f28-0 f26-0) (< f28-0 f0-13)) - (vector-cross! s4-1 (the-as vector (-> s1-0 vector)) (-> s1-0 vector 2)) - ) - (else - (vector-cross! s4-1 (the-as vector (-> s1-0 vector)) (-> s1-0 vector 1)) - ) - ) - ) + ((and (< f26-0 f28-0) (< f26-0 f0-13)) (vector-cross! s4-1 (-> s1-0 vector 1) (-> s1-0 vector 2))) + ((and (< f28-0 f26-0) (< f28-0 f0-13)) (vector-cross! s4-1 (the-as vector (-> s1-0 vector)) (-> s1-0 vector 2))) + (else (vector-cross! s4-1 (the-as vector (-> s1-0 vector)) (-> s1-0 vector 1))))) (vector-normalize! s4-1 1.0) (let ((f0-16 (fabs (vector-dot (the-as vector (-> sv-160 inv-mat)) s4-1))) (f1-2 (fabs (vector-dot (-> sv-160 inv-mat vector 1) s4-1))) - (f2-2 (fabs (vector-dot (-> sv-160 inv-mat vector 2) s4-1))) - ) + (f2-2 (fabs (vector-dot (-> sv-160 inv-mat vector 2) s4-1)))) (cond ((and (< f0-16 f1-2) (< f0-16 f2-2)) (vector-flatten! (the-as vector (-> s1-0 vector)) (the-as vector (-> sv-160 inv-mat)) s4-1) - (vector-flatten! (-> s1-0 vector 1) (the-as vector (-> s5-1 inv-mat)) s4-1) - ) + (vector-flatten! (-> s1-0 vector 1) (the-as vector (-> s5-1 inv-mat)) s4-1)) ((< f1-2 f2-2) (vector-flatten! (the-as vector (-> s1-0 vector)) (-> sv-160 inv-mat vector 1) s4-1) - (vector-flatten! (-> s1-0 vector 1) (-> s5-1 inv-mat vector 1) s4-1) - ) + (vector-flatten! (-> s1-0 vector 1) (-> s5-1 inv-mat vector 1) s4-1)) (else - (vector-flatten! (the-as vector (-> s1-0 vector)) (-> sv-160 inv-mat vector 2) s4-1) - (vector-flatten! (-> s1-0 vector 1) (-> s5-1 inv-mat vector 2) s4-1) - ) - ) - ) + (vector-flatten! (the-as vector (-> s1-0 vector)) (-> sv-160 inv-mat vector 2) s4-1) + (vector-flatten! (-> s1-0 vector 1) (-> s5-1 inv-mat vector 2) s4-1)))) (vector-normalize! (the-as vector (-> s1-0 vector)) 1.0) (vector-normalize! (-> s1-0 vector 1) 1.0) (vector-cross! (-> s1-0 vector 2) (the-as vector (-> s1-0 vector)) (-> s1-0 vector 1)) - (if (< (vector-dot (-> s1-0 vector 2) s4-1) 0.0) - (vector-negate! s4-1 s4-1) - ) + (if (< (vector-dot (-> s1-0 vector 2) s4-1) 0.0) (vector-negate! s4-1 s4-1)) (let ((f28-1 (acos (vector-dot (the-as vector (-> s1-0 vector)) (-> s1-0 vector 1))))) (cond ((logtest? (-> *camera* master-options) 8) @@ -297,136 +194,75 @@ (vector-flatten! (the-as vector (-> s1-0 vector)) (the-as vector (-> s1-0 vector)) (-> *camera* local-down)) (vector-flatten! (-> s1-0 vector 1) (-> s1-0 vector 1) (-> *camera* local-down)) (when (and (< 4096.0 (vector-normalize-ret-len! (the-as vector (-> s1-0 vector)) 1.0)) - (< 4096.0 (vector-normalize-ret-len! (-> s1-0 vector 1) 1.0)) - ) + (< 4096.0 (vector-normalize-ret-len! (-> s1-0 vector 1) 1.0))) (vector-cross! (-> s1-0 vector 2) (-> s1-0 vector 1) (the-as vector (-> s1-0 vector))) - (when (< (vector-dot (-> s1-0 vector 2) s4-1) -0.01) - ) - ) - ) - ) + (when (< (vector-dot (-> s1-0 vector 2) s4-1) -0.01))))) ((and (< 16384.0 f28-1) (< (vector-dot (-> self flip-control-axis) s4-1) 0.0)) - (logxor! (-> *camera* master-options) 16) - ) - ) + (logxor! (-> *camera* master-options) 16))) (set! (-> self flip-control-axis quad) (-> s4-1 quad)) (when (logtest? (-> *camera* master-options) 16) (set! f28-1 (- 65536.0 f28-1)) - (vector-negate! s4-1 s4-1) - ) - (let ((f30-1 (* f28-1 (- 1.0 f30-0)))) - (matrix-axis-sin-cos! s3-0 s4-1 (sin f30-1) (cos f30-1)) - ) - ) - (matrix*! (-> self inv-camera-rot) (the-as matrix s5-1) s3-0) - ) - ) - ) - ) - ) - ) - (cond - ((and (< 0.0 (-> *camera* outro-t-step)) (< (-> *camera* outro-t) (-> *camera* outro-exit-value))) - ) - ((and (< (-> *camera* outro-t-step) 0.0) (< (-> *camera* outro-exit-value) (-> *camera* outro-t))) - ) - ((paused?) - ) - (else - (+! (-> self interp-val) (* (-> self interp-step) (-> *display* time-adjust-ratio))) - ) - ) - (when (>= (-> self interp-val) 1.0) - (deactivate (-> *camera* slave 0 0)) - (set! (-> *camera* slave 0) (-> *camera* slave 1)) - (set! (-> *camera* slave 1) (the-as (pointer camera-slave) #f)) - (+! (-> *camera* num-slaves) -1) - ) - ) - (else - (set! (-> self dist-from-src) 409600.0) - (set! (-> self dist-from-dest) 0.0) - (set! (-> self trans quad) (-> s5-0 0 trans quad)) - (set! (-> self fov) (-> s5-0 0 fov)) - (cond - ((= (-> self tracking-status) 2) - (set! (-> self tracking-status) (the-as uint 1)) - ) - ((= (-> self tracking-status) 3) - (set! (-> self tracking-status) (the-as uint 0)) - 0 - ) - ) - (cond - ((= (-> self tracking-status) 1) - (cam-calc-follow! (-> self tracking) (-> self trans) #t) - (slave-set-rotation! - (-> self tracking) - (-> self trans) - (the-as float (-> self tracking-options)) - (-> self fov) - #t - ) - (let* ((v1-143 (-> self inv-camera-rot)) - (a3-8 (-> self tracking)) - (a0-80 (-> a3-8 inv-mat vector 0 quad)) - (a1-45 (-> a3-8 inv-mat vector 1 quad)) - (a2-21 (-> a3-8 inv-mat vector 2 quad)) - (a3-9 (-> a3-8 inv-mat vector 3 quad)) - ) - (set! (-> v1-143 vector 0 quad) a0-80) - (set! (-> v1-143 vector 1 quad) a1-45) - (set! (-> v1-143 vector 2 quad) a2-21) - (set! (-> v1-143 vector 3 quad) a3-9) - ) - ) - (else + (vector-negate! s4-1 s4-1)) + (let ((f30-1 (* f28-1 (- 1.0 f30-0)))) (matrix-axis-sin-cos! s3-0 s4-1 (sin f30-1) (cos f30-1)))) + (matrix*! (-> self inv-camera-rot) (the-as matrix s5-1) s3-0))))))) + (cond + ((and (< 0.0 (-> *camera* outro-t-step)) (< (-> *camera* outro-t) (-> *camera* outro-exit-value)))) + ((and (< (-> *camera* outro-t-step) 0.0) (< (-> *camera* outro-exit-value) (-> *camera* outro-t)))) + ((paused?)) + (else (+! (-> self interp-val) (* (-> self interp-step) (-> *display* time-adjust-ratio))))) + (when (>= (-> self interp-val) 1.0) + (deactivate (-> *camera* slave 0 0)) + (set! (-> *camera* slave 0) (-> *camera* slave 1)) + (set! (-> *camera* slave 1) (the-as (pointer camera-slave) #f)) + (+! (-> *camera* num-slaves) -1))) + (else + (set! (-> self dist-from-src) 409600.0) + (set! (-> self dist-from-dest) 0.0) + (set! (-> self trans quad) (-> s5-0 0 trans quad)) + (set! (-> self fov) (-> s5-0 0 fov)) + (cond + ((= (-> self tracking-status) 2) (set! (-> self tracking-status) (the-as uint 1))) + ((= (-> self tracking-status) 3) (set! (-> self tracking-status) (the-as uint 0)) 0)) + (cond + ((= (-> self tracking-status) 1) + (cam-calc-follow! (-> self tracking) (-> self trans) #t) + (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self tracking-options)) (-> self fov) #t) + (let* ((v1-143 (-> self inv-camera-rot)) + (a3-8 (-> self tracking)) + (a0-80 (-> a3-8 inv-mat vector 0 quad)) + (a1-45 (-> a3-8 inv-mat vector 1 quad)) + (a2-21 (-> a3-8 inv-mat vector 2 quad)) + (a3-9 (-> a3-8 inv-mat vector 3 quad))) + (set! (-> v1-143 vector 0 quad) a0-80) + (set! (-> v1-143 vector 1 quad) a1-45) + (set! (-> v1-143 vector 2 quad) a2-21) + (set! (-> v1-143 vector 3 quad) a3-9))) + (else (let* ((v1-144 (-> self inv-camera-rot)) (a3-10 (-> s5-0 0 tracking)) (a0-82 (-> a3-10 inv-mat vector 0 quad)) (a1-46 (-> a3-10 inv-mat vector 1 quad)) (a2-22 (-> a3-10 inv-mat vector 2 quad)) - (a3-11 (-> a3-10 inv-mat vector 3 quad)) - ) + (a3-11 (-> a3-10 inv-mat vector 3 quad))) (set! (-> v1-144 vector 0 quad) a0-82) (set! (-> v1-144 vector 1 quad) a1-46) (set! (-> v1-144 vector 2 quad) a2-22) - (set! (-> v1-144 vector 3 quad) a3-11) - ) - ) - ) - ) - ) - ) - (vector-! (-> self velocity) (-> self trans) gp-0) - ) - ) - (if (and *dproc* *debug-segment*) - (add-frame - (-> *display* frames (-> *display* on-screen) frame profile-bar 0) - 'camera - (new 'static 'rgba :b #xff :a #x80) - ) - ) - (suspend) - ) - ) - ) + (set! (-> v1-144 vector 3 quad) a3-11))))))) + (vector-! (-> self velocity) (-> self trans) gp-0))) + (if (and *dproc* *debug-segment*) + (add-frame (-> *display* frames (-> *display* on-screen) frame profile-bar 0) 'camera (new 'static 'rgba :b #xff :a #x80))) + (suspend)))) (defbehavior cam-combiner-init camera-combiner () (stack-size-set! (-> self main-thread) 512) (set! *camera-combiner* self) (vector-reset! (-> self trans)) (matrix-identity! (-> self inv-camera-rot)) - (if *math-camera* - (set! (-> self fov) (-> *math-camera* fov)) - (set! (-> self fov) 11650.845) - ) + (if *math-camera* (set! (-> self fov) (-> *math-camera* fov)) (set! (-> self fov) 11650.845)) (set! (-> self interp-val) 0.0) (set! (-> self interp-step) 0.125) (set! (-> self tracking-status) (the-as uint 0)) (vector-reset! (-> self velocity)) (go cam-combiner-active) 0 - (none) - ) + (none)) diff --git a/goal_src/jak1/engine/camera/cam-debug-h.gc b/goal_src/jak1/engine/camera/cam-debug-h.gc index 74cd2b5a8b..b4fe2d921e 100644 --- a/goal_src/jak1/engine/camera/cam-debug-h.gc +++ b/goal_src/jak1/engine/camera/cam-debug-h.gc @@ -1,7 +1,6 @@ ;;-*-Lisp-*- (in-package goal) (bundles "ENGINE.CGO" "GAME.CGO") - (require "kernel-defs.gc") ;; name: cam-debug-h.gc @@ -10,38 +9,66 @@ ;; TODO - for misty-obs (define-extern *camera-old-level* string) ;; unknown type + (define-extern *camera-old-cpu* int) ;; unknown type + (define-extern *camera-old-vu* int) ;; unknown type + (define-extern *camera-old-tfrag-bytes* int) ;; unknown type + (define-extern *camera-old-stat-string-tfrag* string) ;; unknown type + (define-extern *camera-old-stat-string-tfrag-near* string) ;; unknown type + (define-extern *camera-old-stat-string-total* string) ;; unknown type + ;; TODO - for cam-layout (define-extern camera-line-setup (function vector4w none)) + (define-extern camera-line-draw (function vector vector symbol)) + (define-extern camera-line (function vector vector vector4w none)) + (define-extern camera-cross (function vector vector vector vector4w meters basic)) + (define-extern camera-fov-frame (function matrix vector float float float vector4w none)) + (define-extern cam-slave-options->string (function cam-slave-options object string)) + (define-extern cam-index-options->string (function cam-index-options object string)) + (define-extern debug-set-camera-pos-rot! (function vector matrix vector)) + (define-extern camera-slave-debug (function camera-slave none)) + ;; TODO - for cam-states (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)) + (define-extern cam-debug-reset-coll-tri (function none)) ;; not confirmed + ;; TODO - for rolling-lightning-mole (define-extern camera-line-rel (function vector vector vector4w none)) (declare-type clm basic) + (define-extern *clm* clm) ;; unknown type + (define-extern *clm-edit* clm) + (define-extern *clm-focalpull-attr* clm) ;; unknown type + (define-extern *clm-index-attr* clm) ;; unknown type + (define-extern *clm-intro-attr* clm) ;; unknown type + (define-extern *clm-spline-attr* clm) ;; unknown type + (define-extern *clm-vol-attr* clm) ;; unknown type + (define-extern *clm-select* clm) ;; unknown type ;; DECOMP BEGINS @@ -58,16 +85,11 @@ (set! *redline-index* (+ *redline-index* 1)) (when (>= *redline-index* 400) (set! *redline-index* 0) - 0 - ) - (none) - ) + 0) + (none)) (defun float-lookup-redline ((arg0 float)) - (let ((a0-3 (mod (+ (the int arg0) -1 *redline-index*) 400))) - (-> *redline-table* a0-3) - ) - ) + (let ((a0-3 (mod (+ (the int arg0) -1 *redline-index*) 400))) (-> *redline-table* a0-3))) (define *blueline-table* (the-as (pointer float) (malloc 'debug 1600))) @@ -78,16 +100,11 @@ (set! *blueline-index* (+ *blueline-index* 1)) (when (>= *blueline-index* 400) (set! *blueline-index* 0) - 0 - ) - (none) - ) + 0) + (none)) (defun float-lookup-blueline ((arg0 float)) - (let ((a0-3 (mod (+ (the int arg0) -1 *blueline-index*) 400))) - (-> *blueline-table* a0-3) - ) - ) + (let ((a0-3 (mod (+ (the int arg0) -1 *blueline-index*) 400))) (-> *blueline-table* a0-3))) (define *greenline-table* (the-as (pointer float) (malloc 'debug 1600))) @@ -98,16 +115,11 @@ (set! *greenline-index* (+ *greenline-index* 1)) (when (>= *greenline-index* 400) (set! *greenline-index* 0) - 0 - ) - (none) - ) + 0) + (none)) (defun float-lookup-greenline ((arg0 float)) - (let ((a0-3 (mod (+ (the int arg0) -1 *greenline-index*) 400))) - (-> *greenline-table* a0-3) - ) - ) + (let ((a0-3 (mod (+ (the int arg0) -1 *greenline-index*) 400))) (-> *greenline-table* a0-3))) (define *yellowline-table* (the-as (pointer float) (malloc 'debug 1600))) @@ -118,16 +130,11 @@ (set! *yellowline-index* (+ *yellowline-index* 1)) (when (>= *yellowline-index* 400) (set! *yellowline-index* 0) - 0 - ) - (none) - ) + 0) + (none)) (defun float-lookup-yellowline ((arg0 float)) - (let ((a0-3 (mod (+ (the int arg0) -1 *yellowline-index*) 400))) - (-> *yellowline-table* a0-3) - ) - ) + (let ((a0-3 (mod (+ (the int arg0) -1 *yellowline-index*) 400))) (-> *yellowline-table* a0-3))) (define *timeplot-table* (the-as (pointer float) (malloc 'debug 1600))) @@ -138,20 +145,10 @@ (set! *timeplot-index* (+ *timeplot-index* 1)) (when (>= *timeplot-index* 400) (set! *timeplot-index* 0) - 0 - ) - (none) - ) + 0) + (none)) (defun float-lookup-timeplot ((arg0 float)) - (let ((a0-3 (mod (+ (the int arg0) -1 *timeplot-index*) 400))) - (-> *timeplot-table* a0-3) - ) - ) + (let ((a0-3 (mod (+ (the int arg0) -1 *timeplot-index*) 400))) (-> *timeplot-table* a0-3))) (define-perm *cam-layout* symbol #f) - -0 - - - diff --git a/goal_src/jak1/engine/camera/cam-debug.gc b/goal_src/jak1/engine/camera/cam-debug.gc index 4d721788ed..0fd61211d7 100644 --- a/goal_src/jak1/engine/camera/cam-debug.gc +++ b/goal_src/jak1/engine/camera/cam-debug.gc @@ -1,7 +1,6 @@ ;;-*-Lisp-*- (in-package goal) (bundles "ENGINE.CGO" "GAME.CGO") - (require "engine/collide/pat-h.gc") (require "engine/anim/joint-mod-h.gc") (require "engine/math/euler.gc") @@ -22,20 +21,17 @@ ;; failed to figure out what this is: (when (or (not *camera-old-cpu*) (zero? *camera-old-cpu*)) (set! *camera-old-cpu* 0) - 0 - ) + 0) ;; failed to figure out what this is: (when (or (not *camera-old-vu*) (zero? *camera-old-vu*)) (set! *camera-old-vu* 0) - 0 - ) + 0) ;; failed to figure out what this is: (when (or (not *camera-old-tfrag-bytes*) (zero? *camera-old-tfrag-bytes*)) (set! *camera-old-tfrag-bytes* 0) - 0 - ) + 0) ;; definition (perm) for symbol *camera-old-level*, type string (define-perm *camera-old-level* string (new 'global 'string 128 (the-as string #f))) @@ -51,30 +47,29 @@ ;; definition of type cam-dbg-scratch (deftype cam-dbg-scratch (structure) - ((linevec4w vector4w 2 :inline :offset-assert 0) - (color vector :inline :offset-assert 32) - (plotvec vector4w 2 :inline :offset-assert 48) - (linevec vector4w 2 :inline :offset-assert 80) - (rel-vec vector :inline :offset-assert 112) - (sphere-v-start vector :inline :offset-assert 128) - (sphere-v-end vector :inline :offset-assert 144) - (sphere-v-down vector :inline :offset-assert 160) - (sphere-vec vector :inline :offset-assert 176) - (crossvec vector 3 :inline :offset-assert 192) - (bboxvec vector 6 :inline :offset-assert 240) - (fov-vv vector 4 :inline :offset-assert 336) - (fov-src vector :inline :offset-assert 400) - (fov-dest vector :inline :offset-assert 416) - (fov-vert vector :inline :offset-assert 432) - (fov-horz vector :inline :offset-assert 448) - ) + ((linevec4w vector4w 2 :inline :offset-assert 0) + (color vector :inline :offset-assert 32) + (plotvec vector4w 2 :inline :offset-assert 48) + (linevec vector4w 2 :inline :offset-assert 80) + (rel-vec vector :inline :offset-assert 112) + (sphere-v-start vector :inline :offset-assert 128) + (sphere-v-end vector :inline :offset-assert 144) + (sphere-v-down vector :inline :offset-assert 160) + (sphere-vec vector :inline :offset-assert 176) + (crossvec vector 3 :inline :offset-assert 192) + (bboxvec vector 6 :inline :offset-assert 240) + (fov-vv vector 4 :inline :offset-assert 336) + (fov-src vector :inline :offset-assert 400) + (fov-dest vector :inline :offset-assert 416) + (fov-vert vector :inline :offset-assert 432) + (fov-horz vector :inline :offset-assert 448)) :method-count-assert 9 - :size-assert #x1d0 - :flag-assert #x9000001d0 - ) + :size-assert #x1d0 + :flag-assert #x9000001d0) ;; definition for method 3 of type cam-dbg-scratch -(defmethod inspect cam-dbg-scratch ((obj cam-dbg-scratch)) +(defmethod inspect cam-dbg-scratch + ((obj cam-dbg-scratch)) (format #t "[~8x] ~A~%" obj 'cam-dbg-scratch) (format #t "~Tlinevec4w[2] @ #x~X~%" (-> obj linevec4w)) (format #t "~Tcolor: ~`vector`P~%" (-> obj color)) @@ -92,181 +87,115 @@ (format #t "~Tfov-dest: ~`vector`P~%" (-> obj fov-dest)) (format #t "~Tfov-vert: ~`vector`P~%" (-> obj fov-vert)) (format #t "~Tfov-horz: ~`vector`P~%" (-> obj fov-horz)) - obj - ) + obj) ;; definition for function cam-slave-options->string ;; INFO: Return type mismatch object vs string. (defun cam-slave-options->string ((arg0 cam-slave-options) (arg1 object)) - (if (= (logand (cam-slave-options AIR_EXIT) arg0) (cam-slave-options AIR_EXIT)) - (format arg1 "AIR_EXIT ") - ) - (if (= (logand (cam-slave-options STICKY_ANGLE) arg0) (cam-slave-options STICKY_ANGLE)) - (format arg1 "STICKY_ANGLE ") - ) - (if (= (logand arg0 (cam-slave-options NO_ROTATE)) (cam-slave-options NO_ROTATE)) - (format arg1 "NO_ROTATE ") - ) - (if (= (logand arg0 (cam-slave-options BIKE_MODE)) (cam-slave-options BIKE_MODE)) - (format arg1 "BIKE_MODE ") - ) + (if (= (logand (cam-slave-options AIR_EXIT) arg0) (cam-slave-options AIR_EXIT)) (format arg1 "AIR_EXIT ")) + (if (= (logand (cam-slave-options STICKY_ANGLE) arg0) (cam-slave-options STICKY_ANGLE)) (format arg1 "STICKY_ANGLE ")) + (if (= (logand arg0 (cam-slave-options NO_ROTATE)) (cam-slave-options NO_ROTATE)) (format arg1 "NO_ROTATE ")) + (if (= (logand arg0 (cam-slave-options BIKE_MODE)) (cam-slave-options BIKE_MODE)) (format arg1 "BIKE_MODE ")) (if (= (logand arg0 (cam-slave-options BLOCK_SHIFT_BUTTONS)) (cam-slave-options BLOCK_SHIFT_BUTTONS)) - (format arg1 "BLOCK_SHIFT_BUTTONS ") - ) + (format arg1 "BLOCK_SHIFT_BUTTONS ")) (if (= (logand arg0 (cam-slave-options GOTO_GOOD_POINT)) (cam-slave-options GOTO_GOOD_POINT)) - (format arg1 "GOTO_GOOD_POINT ") - ) + (format arg1 "GOTO_GOOD_POINT ")) (if (= (logand arg0 (cam-slave-options SHRINK_MAX_ANGLE)) (cam-slave-options SHRINK_MAX_ANGLE)) - (format arg1 "SHRINK_MAX_ANGLE ") - ) + (format arg1 "SHRINK_MAX_ANGLE ")) (if (= (logand arg0 (cam-slave-options MOVEMENT_BLOCKED)) (cam-slave-options MOVEMENT_BLOCKED)) - (format arg1 "MOVEMENT_BLOCKED ") - ) - (if (= (logand arg0 (cam-slave-options LINE_OF_SIGHT)) (cam-slave-options LINE_OF_SIGHT)) - (format arg1 "LINE_OF_SIGHT ") - ) + (format arg1 "MOVEMENT_BLOCKED ")) + (if (= (logand arg0 (cam-slave-options LINE_OF_SIGHT)) (cam-slave-options LINE_OF_SIGHT)) (format arg1 "LINE_OF_SIGHT ")) (if (= (logand arg0 (cam-slave-options PLAYER_MOVING_CAMERA)) (cam-slave-options PLAYER_MOVING_CAMERA)) - (format arg1 "PLAYER_MOVING_CAMERA ") - ) - (if (= (logand arg0 (cam-slave-options DRAG)) (cam-slave-options DRAG)) - (format arg1 "DRAG ") - ) + (format arg1 "PLAYER_MOVING_CAMERA ")) + (if (= (logand arg0 (cam-slave-options DRAG)) (cam-slave-options DRAG)) (format arg1 "DRAG ")) (if (= (logand arg0 (cam-slave-options FIND_HIDDEN_TARGET)) (cam-slave-options FIND_HIDDEN_TARGET)) - (format arg1 "FIND_HIDDEN_TARGET ") - ) - (if (= (logand arg0 (cam-slave-options COLLIDE)) (cam-slave-options COLLIDE)) - (format arg1 "COLLIDE ") - ) - (if (= (logand arg0 (cam-slave-options JUMP_PITCHES)) (cam-slave-options JUMP_PITCHES)) - (format arg1 "JUMP_PITCHES ") - ) - (if (= (logand arg0 (cam-slave-options ALLOW_Z_ROT)) (cam-slave-options ALLOW_Z_ROT)) - (format arg1 "ALLOW_Z_ROT ") - ) - (if (= (logand arg0 (cam-slave-options MOVE_SPHERICAL)) (cam-slave-options MOVE_SPHERICAL)) - (format arg1 "MOVE_SPHERICAL ") - ) - (if (= (logand arg0 (cam-slave-options SAME_SIDE)) (cam-slave-options SAME_SIDE)) - (format arg1 "SAME_SIDE ") - ) - (if (= (logand arg0 (cam-slave-options BUTT_CAM)) (cam-slave-options BUTT_CAM)) - (format arg1 "BUTT_CAM ") - ) - (the-as string arg1) - ) + (format arg1 "FIND_HIDDEN_TARGET ")) + (if (= (logand arg0 (cam-slave-options COLLIDE)) (cam-slave-options COLLIDE)) (format arg1 "COLLIDE ")) + (if (= (logand arg0 (cam-slave-options JUMP_PITCHES)) (cam-slave-options JUMP_PITCHES)) (format arg1 "JUMP_PITCHES ")) + (if (= (logand arg0 (cam-slave-options ALLOW_Z_ROT)) (cam-slave-options ALLOW_Z_ROT)) (format arg1 "ALLOW_Z_ROT ")) + (if (= (logand arg0 (cam-slave-options MOVE_SPHERICAL)) (cam-slave-options MOVE_SPHERICAL)) (format arg1 "MOVE_SPHERICAL ")) + (if (= (logand arg0 (cam-slave-options SAME_SIDE)) (cam-slave-options SAME_SIDE)) (format arg1 "SAME_SIDE ")) + (if (= (logand arg0 (cam-slave-options BUTT_CAM)) (cam-slave-options BUTT_CAM)) (format arg1 "BUTT_CAM ")) + (the-as string arg1)) ;; definition for function cam-index-options->string ;; INFO: Return type mismatch object vs string. (defun cam-index-options->string ((arg0 cam-index-options) (arg1 object)) - (if (= (logand arg0 (cam-index-options SPHERICAL)) (cam-index-options SPHERICAL)) - (format arg1 "RADIAL ") - ) - (if (= (logand arg0 (cam-index-options RADIAL)) (cam-index-options RADIAL)) - (format arg1 "SPHERICAL ") - ) - (the-as string arg1) - ) + (if (= (logand arg0 (cam-index-options SPHERICAL)) (cam-index-options SPHERICAL)) (format arg1 "RADIAL ")) + (if (= (logand arg0 (cam-index-options RADIAL)) (cam-index-options RADIAL)) (format arg1 "SPHERICAL ")) + (the-as string arg1)) ;; definition for function slave-los-state->string (defun slave-los-state->string ((arg0 slave-los-state)) (case arg0 - (((slave-los-state between)) - "between" - ) - (((slave-los-state ccw)) - "ccw" - ) - (((slave-los-state cw)) - "cw" - ) - (((slave-los-state none)) - "none" - ) - (else - "*unknown*" - ) - ) - ) + (((slave-los-state between)) "between") + (((slave-los-state ccw)) "ccw") + (((slave-los-state cw)) "cw") + (((slave-los-state none)) "none") + (else "*unknown*"))) ;; definition for function cam-line-dma ;; Used lq/sq (defun cam-line-dma () (let* ((v1-3 (-> *display* frames (-> *display* on-screen) frame debug-buf)) - (a2-0 (-> v1-3 base)) - ) + (a2-0 (-> v1-3 base))) (let ((a0-3 (the-as object (-> v1-3 base)))) (let* ((a1-0 v1-3) - (a3-0 (the-as object (-> a1-0 base))) - ) + (a3-0 (the-as object (-> a1-0 base)))) (set! (-> (the-as dma-packet a3-0) dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) (set! (-> (the-as dma-packet a3-0) vif0) (new 'static 'vif-tag)) (set! (-> (the-as dma-packet a3-0) vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1)) - (set! (-> a1-0 base) (&+ (the-as pointer a3-0) 16)) - ) + (set! (-> a1-0 base) (&+ (the-as pointer a3-0) 16))) (let* ((a1-1 v1-3) - (a3-2 (the-as object (-> a1-1 base))) - ) + (a3-2 (the-as object (-> a1-1 base)))) (set! (-> (the-as gs-gif-tag a3-2) tag) - (new 'static 'gif-tag64 - :nloop #x1 - :eop #x1 - :pre #x1 - :prim (new 'static 'gs-prim :prim (gs-prim-type line) :iip #x1 :abe #x1) - :nreg #x4 - ) - ) + (new 'static + 'gif-tag64 + :nloop #x1 + :eop #x1 + :pre #x1 + :prim + (new 'static 'gs-prim :prim (gs-prim-type line) :iip #x1 :abe #x1) + :nreg #x4)) (set! (-> (the-as gs-gif-tag a3-2) regs) - (new 'static 'gif-tag-regs - :regs0 (gif-reg-id rgbaq) - :regs1 (gif-reg-id xyzf2) - :regs2 (gif-reg-id rgbaq) - :regs3 (gif-reg-id xyzf2) - ) - ) - (set! (-> a1-1 base) (&+ (the-as pointer a3-2) 16)) - ) + (new 'static + 'gif-tag-regs + :regs0 + (gif-reg-id rgbaq) + :regs1 + (gif-reg-id xyzf2) + :regs2 + (gif-reg-id rgbaq) + :regs3 + (gif-reg-id xyzf2))) + (set! (-> a1-1 base) (&+ (the-as pointer a3-2) 16))) (let* ((a1-2 v1-3) - (a3-4 (-> a1-2 base)) - ) + (a3-4 (-> a1-2 base))) (set! (-> (the-as (pointer uint128) a3-4) 0) (-> (the-as vector (+ 32 (scratchpad-object int))) quad)) - (set! (-> (the-as (pointer uint128) a3-4) 1) (-> (the-as vector (-> (scratchpad-object cam-dbg-scratch) linevec4w)) quad)) - (set! (-> a1-2 base) (&+ a3-4 32)) - ) + (set! (-> (the-as (pointer uint128) a3-4) 1) + (-> (the-as vector (-> (scratchpad-object cam-dbg-scratch) linevec4w)) quad)) + (set! (-> a1-2 base) (&+ a3-4 32))) (let* ((a3-6 v1-3) - (a1-3 (-> a3-6 base)) - ) + (a1-3 (-> a3-6 base))) (set! (-> (the-as (pointer uint128) a1-3) 0) (-> (the-as vector (+ 32 (scratchpad-object int))) quad)) (set! (-> (the-as (pointer uint128) a1-3) 1) (-> (the-as vector (+ 16 (scratchpad-object int))) quad)) - (set! (-> a3-6 base) (&+ a1-3 32)) - ) + (set! (-> a3-6 base) (&+ a1-3 32))) (let ((a3-10 (/ (the-as int (+ (- -16 (the-as int a0-3)) (the-as int (-> v1-3 base)))) 16))) (cond ((nonzero? a3-10) (logior! (-> (the-as dma-packet a0-3) dma) (shr (shl a3-10 48) 48)) - (logior! (-> (the-as (pointer uint64) a0-3) 1) (shl (shr (shl a3-10 48) 48) 32)) - ) - (else - (set! (-> v1-3 base) (the-as (pointer uint64) a0-3)) - ) - ) - ) - ) + (logior! (-> (the-as (pointer uint64) a0-3) 1) (shl (shr (shl a3-10 48) 48) 32))) + (else (set! (-> v1-3 base) (the-as (pointer uint64) a0-3)))))) (let ((a3-16 (-> v1-3 base))) (let ((a0-4 (the-as object (-> v1-3 base)))) (set! (-> (the-as dma-packet a0-4) dma) (new 'static 'dma-tag :id (dma-tag-id next))) (set! (-> (the-as dma-packet a0-4) vif0) (new 'static 'vif-tag)) (set! (-> (the-as dma-packet a0-4) vif1) (new 'static 'vif-tag)) - (set! (-> v1-3 base) (&+ (the-as pointer a0-4) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) frame bucket-group) + (set! (-> v1-3 base) (&+ (the-as pointer a0-4) 16))) + (dma-bucket-insert-tag (-> *display* frames (-> *display* on-screen) frame bucket-group) (bucket-id debug-no-zbuf) a2-0 - (the-as (pointer dma-tag) a3-16) - ) - ) - ) - ) + (the-as (pointer dma-tag) a3-16))))) ;; definition for function camera-line2d (defun camera-line2d ((arg0 vector4w) (arg1 vector4w)) @@ -276,21 +205,18 @@ (set! (-> (scratchpad-object cam-dbg-scratch) linevec4w 1 x) (* (+ (-> arg1 x) 1792) 16)) (set! (-> (scratchpad-object cam-dbg-scratch) linevec4w 1 y) (* (- (-> *video-parms* screen-maxy) (-> arg1 y)) 16)) (set! (-> (scratchpad-object cam-dbg-scratch) linevec4w 1 z) #x7fffff) - (cam-line-dma) - ) + (cam-line-dma)) ;; definition for function camera-plot-float-func ;; INFO: Return type mismatch int vs none. ;; Used lq/sq (defun camera-plot-float-func ((arg0 float) (arg1 float) (arg2 float) (arg3 float) (arg4 (function float float)) (arg5 vector4w)) (let ((f30-0 (- arg1 arg0)) - (f24-0 (- arg3 arg2)) - ) + (f24-0 (- arg3 arg2))) 0.0 0.0 (let ((f28-0 (/ 200.0 f24-0)) - (f26-0 (/ 400.0 f30-0)) - ) + (f26-0 (/ 400.0 f30-0))) (set! (-> (scratchpad-object cam-dbg-scratch) color x) (the-as float 128)) (set! (-> (scratchpad-object cam-dbg-scratch) color y) (the-as float 128)) (set! (-> (scratchpad-object cam-dbg-scratch) color z) (the-as float 128)) @@ -300,91 +226,56 @@ (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 0 y) 20) (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 1 x) (-> (scratchpad-object cam-dbg-scratch) plotvec 0 x)) (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 1 y) (+ (the int (* f28-0 f24-0)) 20)) - (camera-line2d - (the-as vector4w (+ 48 (scratchpad-object int))) - (the-as vector4w (+ 64 (scratchpad-object int))) - ) - ) + (camera-line2d (the-as vector4w (+ 48 (scratchpad-object int))) (the-as vector4w (+ 64 (scratchpad-object int))))) (when (and (< arg2 0.0) (< 0.0 arg3)) (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 0 x) 20) (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 0 y) (+ (the int (* f28-0 f24-0 (/ (- arg2) f24-0))) 20)) (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 1 x) (+ (the int (* f26-0 f30-0)) 20)) (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 1 y) (-> (scratchpad-object cam-dbg-scratch) plotvec 0 y)) - (camera-line2d - (the-as vector4w (+ 48 (scratchpad-object int))) - (the-as vector4w (+ 64 (scratchpad-object int))) - ) - ) + (camera-line2d (the-as vector4w (+ 48 (scratchpad-object int))) (the-as vector4w (+ 64 (scratchpad-object int))))) (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 0 x) 20) (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 0 y) 20) (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 1 x) (+ (the int (* f26-0 f30-0)) 20)) (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 1 y) 20) - (camera-line2d - (the-as vector4w (+ 48 (scratchpad-object int))) - (the-as vector4w (+ 64 (scratchpad-object int))) - ) + (camera-line2d (the-as vector4w (+ 48 (scratchpad-object int))) (the-as vector4w (+ 64 (scratchpad-object int)))) (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 0 x) 20) (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 0 y) (+ (the int (* f28-0 f24-0)) 20)) (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 1 x) (+ (the int (* f26-0 f30-0)) 20)) (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 1 y) (+ (the int (* f28-0 f24-0)) 20)) - (camera-line2d - (the-as vector4w (+ 48 (scratchpad-object int))) - (the-as vector4w (+ 64 (scratchpad-object int))) - ) + (camera-line2d (the-as vector4w (+ 48 (scratchpad-object int))) (the-as vector4w (+ 64 (scratchpad-object int)))) (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 0 x) 20) (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 0 y) 20) (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 1 x) 20) (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 1 y) (+ (the int (* f28-0 f24-0)) 20)) - (camera-line2d - (the-as vector4w (+ 48 (scratchpad-object int))) - (the-as vector4w (+ 64 (scratchpad-object int))) - ) + (camera-line2d (the-as vector4w (+ 48 (scratchpad-object int))) (the-as vector4w (+ 64 (scratchpad-object int)))) (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 0 x) (+ (the int (* f26-0 f30-0)) 20)) (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 0 y) 20) (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 1 x) (+ (the int (* f26-0 f30-0)) 20)) (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 1 y) (+ (the int (* f28-0 f24-0)) 20)) - (camera-line2d - (the-as vector4w (+ 48 (scratchpad-object int))) - (the-as vector4w (+ 64 (scratchpad-object int))) - ) - (let ((v1-62 (-> arg5 quad))) - (set! (-> (scratchpad-object cam-dbg-scratch) color quad) v1-62) - ) + (camera-line2d (the-as vector4w (+ 48 (scratchpad-object int))) (the-as vector4w (+ 64 (scratchpad-object int)))) + (let ((v1-62 (-> arg5 quad))) (set! (-> (scratchpad-object cam-dbg-scratch) color quad) v1-62)) (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 1 x) 20) (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 1 y) (+ (the int (* f28-0 (- (arg4 arg0) arg2))) 20)) (let ((s3-1 1)) (while (>= (the int (* f26-0 f30-0)) s3-1) (let ((v1-67 (-> (scratchpad-object cam-dbg-scratch) plotvec 1 quad))) - (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 0 quad) v1-67) - ) + (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 0 quad) v1-67)) (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 1 x) (+ s3-1 20)) (set! (-> (scratchpad-object cam-dbg-scratch) plotvec 1 y) - (+ (the int (* f28-0 (- (arg4 (+ arg0 (* f30-0 (/ (the float s3-1) (* f26-0 f30-0))))) arg2))) 20) - ) - (camera-line2d - (the-as vector4w (+ 48 (scratchpad-object int))) - (the-as vector4w (+ 64 (scratchpad-object int))) - ) - (+! s3-1 1) - ) - ) - ) - ) + (+ (the int (* f28-0 (- (arg4 (+ arg0 (* f30-0 (/ (the float s3-1) (* f26-0 f30-0))))) arg2))) 20)) + (camera-line2d (the-as vector4w (+ 48 (scratchpad-object int))) (the-as vector4w (+ 64 (scratchpad-object int)))) + (+! s3-1 1))))) 0 - (none) - ) + (none)) ;; definition for function camera-line-setup ;; INFO: Return type mismatch int vs none. ;; Used lq/sq (defun camera-line-setup ((arg0 vector4w)) - (let ((v1-0 (-> arg0 quad))) - (set! (-> (scratchpad-object cam-dbg-scratch) color quad) v1-0) - ) + (let ((v1-0 (-> arg0 quad))) (set! (-> (scratchpad-object cam-dbg-scratch) color quad) v1-0)) (init-for-transform *identity-matrix*) 0 - (none) - ) + (none)) ;; definition for function camera-line-draw ;; INFO: Return type mismatch int vs symbol. @@ -394,25 +285,16 @@ (set! (-> (the-as (pointer uint128) (+ 96 (scratchpad-object int)))) (-> arg1 quad)) (set! (-> (scratchpad-object cam-dbg-scratch) linevec 0 w) (the-as int 1.0)) (set! (-> (scratchpad-object cam-dbg-scratch) linevec 1 w) (the-as int 1.0)) - (transform-float-point - (the-as vector (+ 80 (scratchpad-object int))) - (the-as vector4w (-> (scratchpad-object cam-dbg-scratch) linevec4w)) - ) - (transform-float-point - (the-as vector (+ 96 (scratchpad-object int))) - (the-as vector4w (+ 16 (scratchpad-object int))) - ) + (transform-float-point (the-as vector (+ 80 (scratchpad-object int))) + (the-as vector4w (-> (scratchpad-object cam-dbg-scratch) linevec4w))) + (transform-float-point (the-as vector (+ 96 (scratchpad-object int))) (the-as vector4w (+ 16 (scratchpad-object int)))) (cond ((< (the-as uint #xe00000) (the-as uint (-> (scratchpad-object cam-dbg-scratch) linevec4w 0 z))) - (return (the-as symbol #f)) - ) + (return (the-as symbol #f))) ((< (the-as uint #xe00000) (the-as uint (-> (scratchpad-object cam-dbg-scratch) linevec4w 1 z))) - (return (the-as symbol #f)) - ) - ) + (return (the-as symbol #f)))) (cam-line-dma) - (the-as symbol 0) - ) + (the-as symbol 0)) ;; definition for function camera-line ;; INFO: Return type mismatch int vs none. @@ -420,27 +302,20 @@ (camera-line-setup arg2) (camera-line-draw arg0 arg1) 0 - (none) - ) + (none)) ;; definition for function camera-line-rel (defun camera-line-rel ((arg0 vector) (arg1 vector) (arg2 vector4w)) (vector+! (the-as vector (+ 112 (scratchpad-object int))) arg0 arg1) (camera-line arg0 (the-as vector (+ 112 (scratchpad-object int))) arg2) - (none) - ) + (none)) ;; definition for function camera-line-rel-len (defun camera-line-rel-len ((arg0 vector) (arg1 vector) (arg2 float) (arg3 vector4w)) (vector-normalize-copy! (the-as vector (+ 112 (scratchpad-object int))) arg1 arg2) - (vector+! - (the-as vector (+ 112 (scratchpad-object int))) - (the-as vector (+ 112 (scratchpad-object int))) - arg0 - ) + (vector+! (the-as vector (+ 112 (scratchpad-object int))) (the-as vector (+ 112 (scratchpad-object int))) arg0) (camera-line arg0 (the-as vector (+ 112 (scratchpad-object int))) arg3) - (none) - ) + (none)) ;; definition for function camera-sphere ;; INFO: Return type mismatch int vs none. @@ -448,100 +323,48 @@ (camera-line-setup (the-as vector4w arg2)) (dotimes (s4-0 10) (let ((f30-1 (* arg1 (sin (* 3276.8 (the float s4-0))))) - (f28-1 (* arg1 (sin (* 3276.8 (the float (+ s4-0 1)))))) - ) + (f28-1 (* arg1 (sin (* 3276.8 (the float (+ s4-0 1))))))) (set! (-> (scratchpad-object cam-dbg-scratch) sphere-v-start y) - (+ (-> arg0 y) (* (cos (* 3276.8 (the float s4-0))) arg1)) - ) - (set! (-> (scratchpad-object cam-dbg-scratch) sphere-v-end y) - (-> (scratchpad-object cam-dbg-scratch) sphere-v-start y) - ) - (set! (-> (scratchpad-object cam-dbg-scratch) sphere-v-down y) (+ (-> arg0 y) (* (cos (* 3276.8 (the float (+ s4-0 1)))) arg1))) + (+ (-> arg0 y) (* (cos (* 3276.8 (the float s4-0))) arg1))) + (set! (-> (scratchpad-object cam-dbg-scratch) sphere-v-end y) (-> (scratchpad-object cam-dbg-scratch) sphere-v-start y)) + (set! (-> (scratchpad-object cam-dbg-scratch) sphere-v-down y) + (+ (-> arg0 y) (* (cos (* 3276.8 (the float (+ s4-0 1)))) arg1))) (dotimes (s3-0 10) - (set! (-> (scratchpad-object cam-dbg-scratch) sphere-v-start x) (+ (-> arg0 x) (* (cos (* 6553.6 (the float s3-0))) f30-1))) - (set! (-> (scratchpad-object cam-dbg-scratch) sphere-v-start z) (+ (-> arg0 z) (* (sin (* 6553.6 (the float s3-0))) f30-1))) - (set! (-> (scratchpad-object cam-dbg-scratch) sphere-v-end x) (+ (-> arg0 x) (* (cos (* 6553.6 (the float (+ s3-0 1)))) f30-1))) - (set! (-> (scratchpad-object cam-dbg-scratch) sphere-v-end z) (+ (-> arg0 z) (* (sin (* 6553.6 (the float (+ s3-0 1)))) f30-1))) - (set! (-> (scratchpad-object cam-dbg-scratch) sphere-v-down x) (+ (-> arg0 x) (* (cos (* 6553.6 (the float s3-0))) f28-1))) - (set! (-> (scratchpad-object cam-dbg-scratch) sphere-v-down z) (+ (-> arg0 z) (* (sin (* 6553.6 (the float s3-0))) f28-1))) - (camera-line-draw - (the-as vector (+ 128 (scratchpad-object int))) - (the-as vector (+ 144 (scratchpad-object int))) - ) - (camera-line-draw - (the-as vector (+ 128 (scratchpad-object int))) - (the-as vector (+ 160 (scratchpad-object int))) - ) - ) - ) - ) + (set! (-> (scratchpad-object cam-dbg-scratch) sphere-v-start x) + (+ (-> arg0 x) (* (cos (* 6553.6 (the float s3-0))) f30-1))) + (set! (-> (scratchpad-object cam-dbg-scratch) sphere-v-start z) + (+ (-> arg0 z) (* (sin (* 6553.6 (the float s3-0))) f30-1))) + (set! (-> (scratchpad-object cam-dbg-scratch) sphere-v-end x) + (+ (-> arg0 x) (* (cos (* 6553.6 (the float (+ s3-0 1)))) f30-1))) + (set! (-> (scratchpad-object cam-dbg-scratch) sphere-v-end z) + (+ (-> arg0 z) (* (sin (* 6553.6 (the float (+ s3-0 1)))) f30-1))) + (set! (-> (scratchpad-object cam-dbg-scratch) sphere-v-down x) + (+ (-> arg0 x) (* (cos (* 6553.6 (the float s3-0))) f28-1))) + (set! (-> (scratchpad-object cam-dbg-scratch) sphere-v-down z) + (+ (-> arg0 z) (* (sin (* 6553.6 (the float s3-0))) f28-1))) + (camera-line-draw (the-as vector (+ 128 (scratchpad-object int))) (the-as vector (+ 144 (scratchpad-object int)))) + (camera-line-draw (the-as vector (+ 128 (scratchpad-object int))) (the-as vector (+ 160 (scratchpad-object int))))))) 0 - (none) - ) + (none)) ;; definition for function camera-cross ;; INFO: Return type mismatch none vs basic. (defun camera-cross ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector4w) (arg4 meters)) (vector-normalize-copy! (the-as vector (+ 192 (scratchpad-object int))) arg0 arg4) - (vector+! - (the-as vector (+ 208 (scratchpad-object int))) - arg2 - (the-as vector (+ 192 (scratchpad-object int))) - ) - (vector-! - (the-as vector (+ 224 (scratchpad-object int))) - arg2 - (the-as vector (+ 192 (scratchpad-object int))) - ) - (camera-line - (the-as vector (+ 208 (scratchpad-object int))) - (the-as vector (+ 224 (scratchpad-object int))) - arg3 - ) - (vector-cross! - (the-as vector (+ 192 (scratchpad-object int))) - (the-as vector (+ 192 (scratchpad-object int))) - arg1 - ) + (vector+! (the-as vector (+ 208 (scratchpad-object int))) arg2 (the-as vector (+ 192 (scratchpad-object int)))) + (vector-! (the-as vector (+ 224 (scratchpad-object int))) arg2 (the-as vector (+ 192 (scratchpad-object int)))) + (camera-line (the-as vector (+ 208 (scratchpad-object int))) (the-as vector (+ 224 (scratchpad-object int))) arg3) + (vector-cross! (the-as vector (+ 192 (scratchpad-object int))) (the-as vector (+ 192 (scratchpad-object int))) arg1) (vector-normalize! (the-as vector (+ 192 (scratchpad-object int))) arg4) - (vector+! - (the-as vector (+ 208 (scratchpad-object int))) - arg2 - (the-as vector (+ 192 (scratchpad-object int))) - ) - (vector-! - (the-as vector (+ 224 (scratchpad-object int))) - arg2 - (the-as vector (+ 192 (scratchpad-object int))) - ) - (camera-line - (the-as vector (+ 208 (scratchpad-object int))) - (the-as vector (+ 224 (scratchpad-object int))) - arg3 - ) - (vector-cross! - (the-as vector (+ 192 (scratchpad-object int))) - (the-as vector (+ 192 (scratchpad-object int))) - arg0 - ) + (vector+! (the-as vector (+ 208 (scratchpad-object int))) arg2 (the-as vector (+ 192 (scratchpad-object int)))) + (vector-! (the-as vector (+ 224 (scratchpad-object int))) arg2 (the-as vector (+ 192 (scratchpad-object int)))) + (camera-line (the-as vector (+ 208 (scratchpad-object int))) (the-as vector (+ 224 (scratchpad-object int))) arg3) + (vector-cross! (the-as vector (+ 192 (scratchpad-object int))) (the-as vector (+ 192 (scratchpad-object int))) arg0) (vector-normalize! (the-as vector (+ 192 (scratchpad-object int))) arg4) - (vector+! - (the-as vector (+ 208 (scratchpad-object int))) - arg2 - (the-as vector (+ 192 (scratchpad-object int))) - ) - (vector-! - (the-as vector (+ 224 (scratchpad-object int))) - arg2 - (the-as vector (+ 192 (scratchpad-object int))) - ) - (the-as basic (camera-line - (the-as vector (+ 208 (scratchpad-object int))) - (the-as vector (+ 224 (scratchpad-object int))) - arg3 - ) - ) - ) + (vector+! (the-as vector (+ 208 (scratchpad-object int))) arg2 (the-as vector (+ 192 (scratchpad-object int)))) + (vector-! (the-as vector (+ 224 (scratchpad-object int))) arg2 (the-as vector (+ 192 (scratchpad-object int)))) + (the-as basic + (camera-line (the-as vector (+ 208 (scratchpad-object int))) (the-as vector (+ 224 (scratchpad-object int))) arg3))) ;; definition for function camera-bounding-box-draw ;; INFO: Return type mismatch int vs none. @@ -566,53 +389,32 @@ (camera-line-draw (-> arg0 max) (the-as vector (+ 288 (scratchpad-object int)))) (camera-line-draw (-> arg0 max) (the-as vector (+ 304 (scratchpad-object int)))) (camera-line-draw (-> arg0 max) (the-as vector (+ 320 (scratchpad-object int)))) - (camera-line-draw - (the-as vector (+ 240 (scratchpad-object int))) - (the-as vector (+ 304 (scratchpad-object int))) - ) - (camera-line-draw - (the-as vector (+ 304 (scratchpad-object int))) - (the-as vector (+ 272 (scratchpad-object int))) - ) - (camera-line-draw - (the-as vector (+ 272 (scratchpad-object int))) - (the-as vector (+ 288 (scratchpad-object int))) - ) - (camera-line-draw - (the-as vector (+ 288 (scratchpad-object int))) - (the-as vector (+ 256 (scratchpad-object int))) - ) - (camera-line-draw - (the-as vector (+ 256 (scratchpad-object int))) - (the-as vector (+ 320 (scratchpad-object int))) - ) - (camera-line-draw - (the-as vector (+ 320 (scratchpad-object int))) - (the-as vector (+ 240 (scratchpad-object int))) - ) + (camera-line-draw (the-as vector (+ 240 (scratchpad-object int))) (the-as vector (+ 304 (scratchpad-object int)))) + (camera-line-draw (the-as vector (+ 304 (scratchpad-object int))) (the-as vector (+ 272 (scratchpad-object int)))) + (camera-line-draw (the-as vector (+ 272 (scratchpad-object int))) (the-as vector (+ 288 (scratchpad-object int)))) + (camera-line-draw (the-as vector (+ 288 (scratchpad-object int))) (the-as vector (+ 256 (scratchpad-object int)))) + (camera-line-draw (the-as vector (+ 256 (scratchpad-object int))) (the-as vector (+ 320 (scratchpad-object int)))) + (camera-line-draw (the-as vector (+ 320 (scratchpad-object int))) (the-as vector (+ 240 (scratchpad-object int)))) 0 - (none) - ) + (none)) ;; definition of type cam-debug-tri (deftype cam-debug-tri (structure) - ((vertex vector 3 :inline :offset-assert 0) - (intersect vector :inline :offset-assert 48) - (color vector4w :offset-assert 64) - ) + ((vertex vector 3 :inline :offset-assert 0) + (intersect vector :inline :offset-assert 48) + (color vector4w :offset-assert 64)) :method-count-assert 9 - :size-assert #x44 - :flag-assert #x900000044 - ) + :size-assert #x44 + :flag-assert #x900000044) ;; definition for method 3 of type cam-debug-tri -(defmethod inspect cam-debug-tri ((obj cam-debug-tri)) +(defmethod inspect cam-debug-tri + ((obj cam-debug-tri)) (format #t "[~8x] ~A~%" obj 'cam-debug-tri) (format #t "~Tvertex[3] @ #x~X~%" (-> obj vertex)) (format #t "~Tintersect: #~%" (-> obj intersect)) (format #t "~Tcolor: #~%" (-> obj color)) - obj - ) + obj) ;; definition for symbol *cam-debug-los-tri-current*, type int (define *cam-debug-los-tri-current* 0) @@ -632,58 +434,43 @@ (set! *cam-debug-los-tri-current* 0) (set! *cam-debug-coll-tri-current* 0) 0 - (none) - ) + (none)) ;; definition for function cam-debug-add-los-tri ;; INFO: Return type mismatch int vs none. ;; Used lq/sq (defun cam-debug-add-los-tri ((arg0 (inline-array collide-cache-tri)) (arg1 vector) (arg2 vector)) (cond - ((>= *cam-debug-los-tri-current* 460) - ) + ((>= *cam-debug-los-tri-current* 460)) (else - (let ((v1-3 (-> *cam-debug-los-tri* *cam-debug-los-tri-current*))) - (set! (-> v1-3 vertex 0 quad) (-> arg0 0 vertex 0 quad)) - (set! (-> v1-3 vertex 1 quad) (-> arg0 0 vertex 1 quad)) - (set! (-> v1-3 vertex 2 quad) (-> arg0 0 vertex 2 quad)) - (set! (-> v1-3 intersect quad) (-> arg1 quad)) - (set! (-> v1-3 color) (the-as vector4w arg2)) - ) - (set! *cam-debug-los-tri-current* (+ *cam-debug-los-tri-current* 1)) - (if (= *cam-debug-los-tri-current* 460) - (format 0 "ERROR : cam-debug-add-los-tri overflow~%") - ) - ) - ) + (let ((v1-3 (-> *cam-debug-los-tri* *cam-debug-los-tri-current*))) + (set! (-> v1-3 vertex 0 quad) (-> arg0 0 vertex 0 quad)) + (set! (-> v1-3 vertex 1 quad) (-> arg0 0 vertex 1 quad)) + (set! (-> v1-3 vertex 2 quad) (-> arg0 0 vertex 2 quad)) + (set! (-> v1-3 intersect quad) (-> arg1 quad)) + (set! (-> v1-3 color) (the-as vector4w arg2))) + (set! *cam-debug-los-tri-current* (+ *cam-debug-los-tri-current* 1)) + (if (= *cam-debug-los-tri-current* 460) (format 0 "ERROR : cam-debug-add-los-tri overflow~%")))) 0 - (none) - ) + (none)) ;; definition for function cam-debug-add-coll-tri ;; INFO: Return type mismatch int vs none. ;; Used lq/sq (defun cam-debug-add-coll-tri ((arg0 cam-debug-tri) (arg1 vector) (arg2 cam-debug-tri)) (cond - ((>= *cam-debug-coll-tri-current* 460) - ) + ((>= *cam-debug-coll-tri-current* 460)) (else - (let ((v1-3 (-> *cam-debug-coll-tri* *cam-debug-coll-tri-current*))) - (set! (-> v1-3 vertex 0 quad) (-> arg0 vertex 0 quad)) - (set! (-> v1-3 vertex 1 quad) (-> arg0 vertex 1 quad)) - (set! (-> v1-3 vertex 2 quad) (-> arg0 vertex 2 quad)) - (set! (-> v1-3 intersect quad) (-> arg1 quad)) - (set! (-> v1-3 color) (the-as vector4w arg2)) - ) - (set! *cam-debug-coll-tri-current* (+ *cam-debug-coll-tri-current* 1)) - (if (>= *cam-debug-coll-tri-current* 460) - (format 0 "ERROR : cam-debug-add-coll-tri overflow~%") - ) - ) - ) + (let ((v1-3 (-> *cam-debug-coll-tri* *cam-debug-coll-tri-current*))) + (set! (-> v1-3 vertex 0 quad) (-> arg0 vertex 0 quad)) + (set! (-> v1-3 vertex 1 quad) (-> arg0 vertex 1 quad)) + (set! (-> v1-3 vertex 2 quad) (-> arg0 vertex 2 quad)) + (set! (-> v1-3 intersect quad) (-> arg1 quad)) + (set! (-> v1-3 color) (the-as vector4w arg2))) + (set! *cam-debug-coll-tri-current* (+ *cam-debug-coll-tri-current* 1)) + (if (>= *cam-debug-coll-tri-current* 460) (format 0 "ERROR : cam-debug-add-coll-tri overflow~%")))) 0 - (none) - ) + (none)) ;; definition for function cam-debug-draw-tris ;; Used lq/sq @@ -691,58 +478,34 @@ (camera-line-setup (new 'stack 'vector4w)) (when *display-cam-los-marks* (dotimes (gp-1 *cam-debug-los-tri-current*) - (let ((v1-7 (-> *cam-debug-los-tri* gp-1 color quad))) - (set! (-> (scratchpad-object cam-dbg-scratch) color quad) v1-7) - ) - (camera-line-draw - (the-as vector (+ (the-as uint (-> *cam-debug-los-tri* 0)) (* 80 gp-1))) - (the-as vector (+ (the-as uint (-> *cam-debug-los-tri* 0 vertex 1)) (* 80 gp-1))) - ) - (camera-line-draw - (the-as vector (+ (the-as uint (-> *cam-debug-los-tri* 0 vertex 1)) (* 80 gp-1))) - (the-as vector (+ (the-as uint (-> *cam-debug-los-tri* 0 vertex 2)) (* 80 gp-1))) - ) - (camera-line-draw - (the-as vector (+ (the-as uint (-> *cam-debug-los-tri* 0 vertex 2)) (* 80 gp-1))) - (the-as vector (+ (the-as uint (-> *cam-debug-los-tri* 0)) (* 80 gp-1))) - ) - (camera-cross - (new 'static 'vector :y 1024.0) - (new 'static 'vector :z 1024.0) - (-> *cam-debug-los-tri* gp-1 intersect) - (-> *cam-debug-los-tri* gp-1 color) - (meters 0.25) - ) - ) - ) + (let ((v1-7 (-> *cam-debug-los-tri* gp-1 color quad))) (set! (-> (scratchpad-object cam-dbg-scratch) color quad) v1-7)) + (camera-line-draw (the-as vector (+ (the-as uint (-> *cam-debug-los-tri* 0)) (* 80 gp-1))) + (the-as vector (+ (the-as uint (-> *cam-debug-los-tri* 0 vertex 1)) (* 80 gp-1)))) + (camera-line-draw (the-as vector (+ (the-as uint (-> *cam-debug-los-tri* 0 vertex 1)) (* 80 gp-1))) + (the-as vector (+ (the-as uint (-> *cam-debug-los-tri* 0 vertex 2)) (* 80 gp-1)))) + (camera-line-draw (the-as vector (+ (the-as uint (-> *cam-debug-los-tri* 0 vertex 2)) (* 80 gp-1))) + (the-as vector (+ (the-as uint (-> *cam-debug-los-tri* 0)) (* 80 gp-1)))) + (camera-cross (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + (-> *cam-debug-los-tri* gp-1 intersect) + (-> *cam-debug-los-tri* gp-1 color) + (meters 0.25)))) (when *display-cam-coll-marks* (dotimes (gp-2 *cam-debug-coll-tri-current*) (let ((v1-34 (-> *cam-debug-coll-tri* gp-2 color quad))) - (set! (-> (scratchpad-object cam-dbg-scratch) color quad) v1-34) - ) - (camera-line-draw - (the-as vector (+ (the-as uint (-> *cam-debug-coll-tri* 0)) (* 80 gp-2))) - (the-as vector (+ (the-as uint (-> *cam-debug-coll-tri* 0 vertex 1)) (* 80 gp-2))) - ) - (camera-line-draw - (the-as vector (+ (the-as uint (-> *cam-debug-coll-tri* 0 vertex 1)) (* 80 gp-2))) - (the-as vector (+ (the-as uint (-> *cam-debug-coll-tri* 0 vertex 2)) (* 80 gp-2))) - ) - (camera-line-draw - (the-as vector (+ (the-as uint (-> *cam-debug-coll-tri* 0 vertex 2)) (* 80 gp-2))) - (the-as vector (+ (the-as uint (-> *cam-debug-coll-tri* 0)) (* 80 gp-2))) - ) - (camera-cross - (new 'static 'vector :y 1024.0) - (new 'static 'vector :z 1024.0) - (-> *cam-debug-coll-tri* gp-2 intersect) - (-> *cam-debug-coll-tri* gp-2 color) - (meters 0.25) - ) - ) - #f - ) - ) + (set! (-> (scratchpad-object cam-dbg-scratch) color quad) v1-34)) + (camera-line-draw (the-as vector (+ (the-as uint (-> *cam-debug-coll-tri* 0)) (* 80 gp-2))) + (the-as vector (+ (the-as uint (-> *cam-debug-coll-tri* 0 vertex 1)) (* 80 gp-2)))) + (camera-line-draw (the-as vector (+ (the-as uint (-> *cam-debug-coll-tri* 0 vertex 1)) (* 80 gp-2))) + (the-as vector (+ (the-as uint (-> *cam-debug-coll-tri* 0 vertex 2)) (* 80 gp-2)))) + (camera-line-draw (the-as vector (+ (the-as uint (-> *cam-debug-coll-tri* 0 vertex 2)) (* 80 gp-2))) + (the-as vector (+ (the-as uint (-> *cam-debug-coll-tri* 0)) (* 80 gp-2)))) + (camera-cross (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + (-> *cam-debug-coll-tri* gp-2 intersect) + (-> *cam-debug-coll-tri* gp-2 color) + (meters 0.25))) + #f)) ;; definition for function camera-fov-draw (defun camera-fov-draw ((arg0 int) (arg1 int) (arg2 vector) (arg3 float) (arg4 float) (arg5 vector4w)) @@ -751,257 +514,152 @@ (vector+float*! (the-as vector (+ 368 (scratchpad-object int))) arg2 (the-as vector arg0) arg4) (vector+float*! (the-as vector (+ 384 (scratchpad-object int))) arg2 (the-as vector arg1) arg4) (camera-line-setup arg5) - (camera-line-draw - (the-as vector (+ 336 (scratchpad-object int))) - (the-as vector (+ 352 (scratchpad-object int))) - ) - (camera-line-draw - (the-as vector (+ 352 (scratchpad-object int))) - (the-as vector (+ 368 (scratchpad-object int))) - ) - (camera-line-draw - (the-as vector (+ 368 (scratchpad-object int))) - (the-as vector (+ 384 (scratchpad-object int))) - ) - ) + (camera-line-draw (the-as vector (+ 336 (scratchpad-object int))) (the-as vector (+ 352 (scratchpad-object int)))) + (camera-line-draw (the-as vector (+ 352 (scratchpad-object int))) (the-as vector (+ 368 (scratchpad-object int)))) + (camera-line-draw (the-as vector (+ 368 (scratchpad-object int))) (the-as vector (+ 384 (scratchpad-object int))))) ;; definition for function camera-fov-frame ;; INFO: Return type mismatch symbol vs none. ;; Used lq/sq (defun camera-fov-frame ((arg0 matrix) (arg1 vector) (arg2 float) (arg3 float) (arg4 float) (arg5 vector4w)) (vector-float*! (the-as vector (+ 432 (scratchpad-object int))) (-> arg0 vector 1) (* arg3 (tan arg2))) - (vector-float*! - (the-as vector (+ 448 (scratchpad-object int))) - (the-as vector (-> arg0 vector)) - (* arg4 (tan arg2)) - ) - (vector+! - (the-as vector (+ 400 (scratchpad-object int))) - (-> arg0 vector 2) - (vector+! - (the-as vector (+ 400 (scratchpad-object int))) - (the-as vector (+ 432 (scratchpad-object int))) - (the-as vector (+ 448 (scratchpad-object int))) - ) - ) + (vector-float*! (the-as vector (+ 448 (scratchpad-object int))) (the-as vector (-> arg0 vector)) (* arg4 (tan arg2))) + (vector+! (the-as vector (+ 400 (scratchpad-object int))) + (-> arg0 vector 2) + (vector+! (the-as vector (+ 400 (scratchpad-object int))) + (the-as vector (+ 432 (scratchpad-object int))) + (the-as vector (+ 448 (scratchpad-object int))))) (vector-normalize! (the-as vector (+ 400 (scratchpad-object int))) 1.0) - (vector+! - (the-as vector (+ 416 (scratchpad-object int))) - (-> arg0 vector 2) - (vector-! - (the-as vector (+ 416 (scratchpad-object int))) - (the-as vector (+ 432 (scratchpad-object int))) - (the-as vector (+ 448 (scratchpad-object int))) - ) - ) + (vector+! (the-as vector (+ 416 (scratchpad-object int))) + (-> arg0 vector 2) + (vector-! (the-as vector (+ 416 (scratchpad-object int))) + (the-as vector (+ 432 (scratchpad-object int))) + (the-as vector (+ 448 (scratchpad-object int))))) (vector-normalize! (the-as vector (+ 416 (scratchpad-object int))) 1.0) (camera-fov-draw (+ 400 (scratchpad-object int)) (+ 416 (scratchpad-object int)) arg1 4096.0 20480.0 arg5) (set! (-> (the-as (pointer uint128) (+ 400 (scratchpad-object int)))) - (-> (the-as vector (+ 416 (scratchpad-object int))) quad) - ) - (vector-! - (the-as vector (+ 416 (scratchpad-object int))) - (-> arg0 vector 2) - (vector+! - (the-as vector (+ 416 (scratchpad-object int))) - (the-as vector (+ 432 (scratchpad-object int))) - (the-as vector (+ 448 (scratchpad-object int))) - ) - ) + (-> (the-as vector (+ 416 (scratchpad-object int))) quad)) + (vector-! (the-as vector (+ 416 (scratchpad-object int))) + (-> arg0 vector 2) + (vector+! (the-as vector (+ 416 (scratchpad-object int))) + (the-as vector (+ 432 (scratchpad-object int))) + (the-as vector (+ 448 (scratchpad-object int))))) (vector-normalize! (the-as vector (+ 416 (scratchpad-object int))) 1.0) (camera-fov-draw (+ 400 (scratchpad-object int)) (+ 416 (scratchpad-object int)) arg1 4096.0 20480.0 arg5) (set! (-> (the-as (pointer uint128) (+ 400 (scratchpad-object int)))) - (-> (the-as vector (+ 416 (scratchpad-object int))) quad) - ) - (vector-! - (the-as vector (+ 416 (scratchpad-object int))) - (-> arg0 vector 2) - (vector-! - (the-as vector (+ 416 (scratchpad-object int))) - (the-as vector (+ 432 (scratchpad-object int))) - (the-as vector (+ 448 (scratchpad-object int))) - ) - ) + (-> (the-as vector (+ 416 (scratchpad-object int))) quad)) + (vector-! (the-as vector (+ 416 (scratchpad-object int))) + (-> arg0 vector 2) + (vector-! (the-as vector (+ 416 (scratchpad-object int))) + (the-as vector (+ 432 (scratchpad-object int))) + (the-as vector (+ 448 (scratchpad-object int))))) (vector-normalize! (the-as vector (+ 416 (scratchpad-object int))) 1.0) (camera-fov-draw (+ 400 (scratchpad-object int)) (+ 416 (scratchpad-object int)) arg1 4096.0 20480.0 arg5) (set! (-> (the-as (pointer uint128) (+ 400 (scratchpad-object int)))) - (-> (the-as vector (+ 416 (scratchpad-object int))) quad) - ) - (vector+! - (the-as vector (+ 416 (scratchpad-object int))) - (-> arg0 vector 2) - (vector+! - (the-as vector (+ 416 (scratchpad-object int))) - (the-as vector (+ 432 (scratchpad-object int))) - (the-as vector (+ 448 (scratchpad-object int))) - ) - ) + (-> (the-as vector (+ 416 (scratchpad-object int))) quad)) + (vector+! (the-as vector (+ 416 (scratchpad-object int))) + (-> arg0 vector 2) + (vector+! (the-as vector (+ 416 (scratchpad-object int))) + (the-as vector (+ 432 (scratchpad-object int))) + (the-as vector (+ 448 (scratchpad-object int))))) (vector-normalize! (the-as vector (+ 416 (scratchpad-object int))) 1.0) (camera-fov-draw (+ 400 (scratchpad-object int)) (+ 416 (scratchpad-object int)) arg1 4096.0 20480.0 arg5) - (none) - ) + (none)) ;; definition for method 11 of type tracking-spline ;; INFO: Return type mismatch int vs none. -(defmethod print-nth-point tracking-spline ((obj tracking-spline) (arg0 int)) - (if (= arg0 (-> obj used-point)) - (format 0 "u") - (format 0 " ") - ) - (if (= arg0 (-> obj next-to-last-point)) - (format 0 "n") - (format 0 " ") - ) - (if (= arg0 (-> obj end-point)) - (format 0 "e") - (format 0 " ") - ) +(defmethod print-nth-point tracking-spline + ((obj tracking-spline) (arg0 int)) + (if (= arg0 (-> obj used-point)) (format 0 "u") (format 0 " ")) + (if (= arg0 (-> obj next-to-last-point)) (format 0 "n") (format 0 " ")) + (if (= arg0 (-> obj end-point)) (format 0 "e") (format 0 " ")) (if (= arg0 -134250495) - (format 0 " ~D~%" arg0) - (format - 0 - " ~D ~M ~M ~M~%" - arg0 - (-> obj point arg0 position x) - (-> obj point arg0 position y) - (-> obj point arg0 position z) - ) - ) + (format 0 " ~D~%" arg0) + (format 0 + " ~D ~M ~M ~M~%" + arg0 + (-> obj point arg0 position x) + (-> obj point arg0 position y) + (-> obj point arg0 position z))) 0 - (none) - ) + (none)) -(defmethod tracking-spline-method-12 tracking-spline ((obj tracking-spline)) +(defmethod tracking-spline-method-12 tracking-spline + ((obj tracking-spline)) (let ((s5-0 (-> obj used-point))) (while (!= s5-0 -134250495) (print-nth-point obj s5-0) - (set! s5-0 (-> obj point s5-0 next)) - ) - (print-nth-point obj s5-0) - ) + (set! s5-0 (-> obj point s5-0 next))) + (print-nth-point obj s5-0)) 0 - (none) - ) + (none)) -(defmethod tracking-spline-method-23 tracking-spline ((obj tracking-spline)) +(defmethod tracking-spline-method-23 tracking-spline + ((obj tracking-spline)) (let ((s5-0 (-> obj used-point)) - (s4-0 (-> obj point (-> obj used-point) next)) - ) + (s4-0 (-> obj point (-> obj used-point) next))) (let ((s3-0 (new 'stack-no-clear 'vector))) (when (!= s4-0 -134250495) (tracking-spline-method-19 obj 0.0 s3-0 (the-as tracking-spline-sampler #f)) - (camera-cross - (new 'static 'vector :y 1024.0) - (new 'static 'vector :z 1024.0) - s3-0 - (new 'static 'vector4w :x #xff :w #x80) - (meters 0.25) - ) + (camera-cross (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s3-0 + (new 'static 'vector4w :x #xff :w #x80) + (meters 0.25)) (tracking-spline-method-19 obj (-> obj sample-len) s3-0 (the-as tracking-spline-sampler #f)) - (camera-cross - (new 'static 'vector :y 1024.0) - (new 'static 'vector :z 1024.0) - s3-0 - (new 'static 'vector4w :x #xff :w #x80) - (meters 0.25) - ) - ) - ) + (camera-cross (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s3-0 + (new 'static 'vector4w :x #xff :w #x80) + (meters 0.25)))) (while (!= s4-0 -134250495) - (camera-line - (the-as vector (-> obj point s5-0)) - (the-as vector (-> obj point s4-0)) - (new 'static 'vector4w :x #x80 :y #x80 :z #x80 :w #x80) - ) + (camera-line (the-as vector (-> obj point s5-0)) + (the-as vector (-> obj point s4-0)) + (new 'static 'vector4w :x #x80 :y #x80 :z #x80 :w #x80)) (set! s5-0 s4-0) - (set! s4-0 (-> obj point s4-0 next)) - ) - ) + (set! s4-0 (-> obj point s4-0 next)))) (let ((s5-1 (new 'stack-no-clear 'vector))) - (camera-line - (-> obj debug-out-position) - (-> obj debug-old-position) - (new 'static 'vector4w :x #xff :y #xff :w #x80) - ) + (camera-line (-> obj debug-out-position) (-> obj debug-old-position) (new 'static 'vector4w :x #xff :y #xff :w #x80)) (vector-! s5-1 (-> obj debug-out-position) (-> obj debug-old-position)) (tracking-spline-method-20 obj s5-1 (-> obj debug-last-point)) - (camera-line-rel (-> obj debug-old-position) s5-1 (new 'static 'vector4w :x #xff :z #xff :w #x80)) - ) + (camera-line-rel (-> obj debug-old-position) s5-1 (new 'static 'vector4w :x #xff :z #xff :w #x80))) 0 - (none) - ) + (none)) (defun debug-euler ((arg0 cam-dbg-scratch)) (let ((s4-0 (new 'stack-no-clear 'euler-angles)) - (gp-0 (new 'stack-no-clear 'matrix)) - ) + (gp-0 (new 'stack-no-clear 'matrix))) (matrix->eul s4-0 (the-as matrix (&-> arg0 sphere-vec w)) 21) (format *stdcon* "euler angles x ~R y ~R z ~R~%" (-> s4-0 x) (-> s4-0 y) (-> s4-0 z)) - (format - *stdcon* - "~f ~f ~f ~f~%" - (-> arg0 sphere-vec w) - (-> arg0 crossvec 0 x) - (-> arg0 crossvec 0 y) - (-> arg0 crossvec 0 z) - ) - (format - *stdcon* - "~f ~f ~f ~f~%" - (-> arg0 crossvec 0 w) - (-> arg0 crossvec 1 x) - (-> arg0 crossvec 1 y) - (-> arg0 crossvec 1 z) - ) - (format - *stdcon* - "~f ~f ~f ~f~%" - (-> arg0 crossvec 1 w) - (-> arg0 crossvec 2 x) - (-> arg0 crossvec 2 y) - (-> arg0 crossvec 2 z) - ) - (format - *stdcon* - "~f ~f ~f ~f~%" - (-> arg0 crossvec 2 w) - (-> arg0 bboxvec 0 x) - (-> arg0 bboxvec 0 y) - (-> arg0 bboxvec 0 z) - ) + (format *stdcon* + "~f ~f ~f ~f~%" + (-> arg0 sphere-vec w) + (-> arg0 crossvec 0 x) + (-> arg0 crossvec 0 y) + (-> arg0 crossvec 0 z)) + (format *stdcon* + "~f ~f ~f ~f~%" + (-> arg0 crossvec 0 w) + (-> arg0 crossvec 1 x) + (-> arg0 crossvec 1 y) + (-> arg0 crossvec 1 z)) + (format *stdcon* + "~f ~f ~f ~f~%" + (-> arg0 crossvec 1 w) + (-> arg0 crossvec 2 x) + (-> arg0 crossvec 2 y) + (-> arg0 crossvec 2 z)) + (format *stdcon* + "~f ~f ~f ~f~%" + (-> arg0 crossvec 2 w) + (-> arg0 bboxvec 0 x) + (-> arg0 bboxvec 0 y) + (-> arg0 bboxvec 0 z)) (eul->matrix gp-0 s4-0) - (format - *stdcon* - "~f ~f ~f ~f~%" - (-> gp-0 vector 0 x) - (-> gp-0 vector 0 y) - (-> gp-0 vector 0 z) - (-> gp-0 vector 0 w) - ) - (format - *stdcon* - "~f ~f ~f ~f~%" - (-> gp-0 vector 1 x) - (-> gp-0 vector 1 y) - (-> gp-0 vector 1 z) - (-> gp-0 vector 1 w) - ) - (format - *stdcon* - "~f ~f ~f ~f~%" - (-> gp-0 vector 2 x) - (-> gp-0 vector 2 y) - (-> gp-0 vector 2 z) - (-> gp-0 vector 2 w) - ) - (format - *stdcon* - "~f ~f ~f ~f~%" - (-> gp-0 vector 3 x) - (-> gp-0 vector 3 y) - (-> gp-0 vector 3 z) - (-> gp-0 vector 3 w) - ) + (format *stdcon* "~f ~f ~f ~f~%" (-> gp-0 vector 0 x) (-> gp-0 vector 0 y) (-> gp-0 vector 0 z) (-> gp-0 vector 0 w)) + (format *stdcon* "~f ~f ~f ~f~%" (-> gp-0 vector 1 x) (-> gp-0 vector 1 y) (-> gp-0 vector 1 z) (-> gp-0 vector 1 w)) + (format *stdcon* "~f ~f ~f ~f~%" (-> gp-0 vector 2 x) (-> gp-0 vector 2 y) (-> gp-0 vector 2 z) (-> gp-0 vector 2 w)) + (format *stdcon* "~f ~f ~f ~f~%" (-> gp-0 vector 3 x) (-> gp-0 vector 3 y) (-> gp-0 vector 3 z) (-> gp-0 vector 3 w)) (if (or (< 0.001 (fabs (- (-> arg0 sphere-vec w) (-> gp-0 vector 0 x)))) (< 0.001 (fabs (- (-> arg0 crossvec 0 x) (-> gp-0 vector 0 y)))) (< 0.001 (fabs (- (-> arg0 crossvec 0 y) (-> gp-0 vector 0 z)))) @@ -1017,100 +675,63 @@ (< 0.001 (fabs (- (-> arg0 crossvec 2 w) (-> gp-0 vector 3 x)))) (< 0.001 (fabs (- (-> arg0 bboxvec 0 x) (-> gp-0 vector 3 y)))) (< 0.001 (fabs (- (-> arg0 bboxvec 0 y) (-> gp-0 vector 3 z)))) - (< 0.001 (fabs (- (-> arg0 bboxvec 0 z) (-> gp-0 vector 3 w)))) - ) - (format *stdcon* "different~%") - (format *stdcon* "same~%") - ) - ) - ) + (< 0.001 (fabs (- (-> arg0 bboxvec 0 z) (-> gp-0 vector 3 w))))) + (format *stdcon* "different~%") + (format *stdcon* "same~%")))) (defun bike-cam-limit ((arg0 float)) (let* ((f0-1 (* 10012.444 arg0)) - (f30-0 (fmax 0.0 f0-1)) - ) - (if (< f30-0 8192.0) - (* (/ 1.0 (- 1.0 (cos 21845.334))) (+ (- (cos 21845.334)) (cos (* 2.6666667 (- 8192.0 f30-0))))) - 1.0 - ) - ) - ) + (f30-0 (fmax 0.0 f0-1))) + (if (< f30-0 8192.0) (* (/ 1.0 (- 1.0 (cos 21845.334))) (+ (- (cos 21845.334)) (cos (* 2.6666667 (- 8192.0 f30-0))))) 1.0))) (defun camera-slave-debug ((arg0 camera-slave)) (when *display-camera-marks* (let ((f30-0 (* 0.5 (-> *camera-combiner* fov)))) - (camera-fov-frame - (-> *camera-combiner* inv-camera-rot) - (camera-pos) - f30-0 - 0.75 - 1.0 - (new 'static 'vector4w :z #xff :w #x80) - ) - ) + (camera-fov-frame (-> *camera-combiner* inv-camera-rot) + (camera-pos) + f30-0 + 0.75 + 1.0 + (new 'static 'vector4w :z #xff :w #x80))) (cond ((= (-> arg0 blend-to-type) 2) (let ((f0-2 (* 0.5 (-> arg0 fov)))) - (camera-fov-frame - (the-as matrix (-> *camera-combiner* tracking)) - (-> arg0 trans) - f0-2 - 0.75 - 1.0 - (new 'static 'vector4w :y #xff :w #x80) - ) - ) - ) + (camera-fov-frame (the-as matrix (-> *camera-combiner* tracking)) + (-> arg0 trans) + f0-2 + 0.75 + 1.0 + (new 'static 'vector4w :y #xff :w #x80)))) (else - (let ((f0-4 (* 0.5 (-> arg0 fov)))) - (camera-fov-frame - (the-as matrix (-> arg0 tracking)) - (-> arg0 trans) - f0-4 - 0.75 - 1.0 - (new 'static 'vector4w :y #xff :w #x80) - ) - ) - ) - ) + (let ((f0-4 (* 0.5 (-> arg0 fov)))) + (camera-fov-frame (the-as matrix (-> arg0 tracking)) + (-> arg0 trans) + f0-4 + 0.75 + 1.0 + (new 'static 'vector4w :y #xff :w #x80))))) (tracking-spline-method-23 (-> arg0 position-spline)) (let ((s5-1 (new-stack-vector0))) (let ((s4-1 (new-stack-vector0))) (new-stack-matrix0) (cond - ((or (= (-> arg0 next-state name) 'cam-fixed) (or (= (-> arg0 next-state name) 'cam-eye) - (= (-> arg0 next-state name) 'cam-point-watch) - (= (-> arg0 next-state name) 'cam-free-floating) - (= (-> arg0 next-state name) 'cam-orbit) - ) - ) + ((or (= (-> arg0 next-state name) 'cam-fixed) + (or (= (-> arg0 next-state name) 'cam-eye) + (= (-> arg0 next-state name) 'cam-point-watch) + (= (-> arg0 next-state name) 'cam-free-floating) + (= (-> arg0 next-state name) 'cam-orbit))) (vector+float*! s5-1 (-> arg0 trans) (-> *camera* local-down) 4096.0) - (camera-line (-> arg0 trans) s5-1 (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80)) - ) + (camera-line (-> arg0 trans) s5-1 (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80))) ((= (-> arg0 blend-to-type) 2) - (camera-line - (-> *camera-combiner* tracking follow-pt) - (-> arg0 trans) - (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80) - ) + (camera-line (-> *camera-combiner* tracking follow-pt) + (-> arg0 trans) + (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80)) (vector+float*! s5-1 (-> *camera-combiner* tracking follow-pt) (-> *camera* local-down) 4096.0) - (camera-line - (-> *camera-combiner* tracking follow-pt) - s5-1 - (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80) - ) - ) + (camera-line (-> *camera-combiner* tracking follow-pt) s5-1 (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80))) (else - (camera-line - (-> arg0 tracking follow-pt) - (-> arg0 trans) - (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80) - ) - (vector+float*! s5-1 (-> arg0 tracking follow-pt) (-> *camera* local-down) 4096.0) - (camera-line (-> arg0 tracking follow-pt) s5-1 (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80)) - ) - ) + (camera-line (-> arg0 tracking follow-pt) (-> arg0 trans) (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80)) + (vector+float*! s5-1 (-> arg0 tracking follow-pt) (-> *camera* local-down) 4096.0) + (camera-line (-> arg0 tracking follow-pt) s5-1 (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80)))) (set! (-> s4-1 quad) (-> arg0 trans quad)) (cond ((= (-> arg0 blend-to-type) 2) @@ -1119,212 +740,129 @@ (vector+float*! s5-1 s4-1 (-> *camera-combiner* tracking inv-mat vector 1) 2048.0) (camera-line s4-1 s5-1 (new 'static 'vector4w :y #xff :w #x80)) (vector+float*! s5-1 s4-1 (-> *camera-combiner* tracking inv-mat vector 2) 2048.0) - (camera-line s4-1 s5-1 (new 'static 'vector4w :z #xff :w #x80)) - ) + (camera-line s4-1 s5-1 (new 'static 'vector4w :z #xff :w #x80))) (else - (vector+float*! s5-1 s4-1 (the-as vector (-> arg0 tracking)) 2048.0) - (camera-line s4-1 s5-1 (new 'static 'vector4w :x #xff :w #x80)) - (vector+float*! s5-1 s4-1 (-> arg0 tracking inv-mat vector 1) 2048.0) - (camera-line s4-1 s5-1 (new 'static 'vector4w :y #xff :w #x80)) - (vector+float*! s5-1 s4-1 (-> arg0 tracking inv-mat vector 2) 2048.0) - (camera-line s4-1 s5-1 (new 'static 'vector4w :z #xff :w #x80)) - ) - ) - ) + (vector+float*! s5-1 s4-1 (the-as vector (-> arg0 tracking)) 2048.0) + (camera-line s4-1 s5-1 (new 'static 'vector4w :x #xff :w #x80)) + (vector+float*! s5-1 s4-1 (-> arg0 tracking inv-mat vector 1) 2048.0) + (camera-line s4-1 s5-1 (new 'static 'vector4w :y #xff :w #x80)) + (vector+float*! s5-1 s4-1 (-> arg0 tracking inv-mat vector 2) 2048.0) + (camera-line s4-1 s5-1 (new 'static 'vector4w :z #xff :w #x80))))) (vector--float*! s5-1 (-> *camera* tpos-curr) (-> *camera* local-down) (-> *camera* foot-offset)) (camera-sphere s5-1 512.0 (the-as vector (new 'static 'vector4w :y #xff :w #x80))) (vector--float*! s5-1 (-> *camera* tpos-curr) (-> *camera* local-down) (-> *camera* head-offset)) - (camera-sphere s5-1 512.0 (the-as vector (new 'static 'vector4w :y #xff :w #x80))) - ) + (camera-sphere s5-1 512.0 (the-as vector (new 'static 'vector4w :y #xff :w #x80)))) (cond ((= (-> arg0 next-state name) 'cam-string) (camera-sphere (-> arg0 desired-pos) 512.0 (the-as vector (new 'static 'vector4w :z #xff :w #x80))) (camera-line-rel (-> *camera* tpos-curr-adj) (-> arg0 view-flat) (new 'static 'vector4w :z #xff :w #x80)) - (camera-line - (-> arg0 string-trans) - (the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 (-> arg0 los-tgt-spline-pt)))) - (new 'static 'vector4w :y #xff :w #x80) - ) - (camera-line - (-> arg0 los-last-pos) - (the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 (-> arg0 los-tgt-spline-pt)))) - (new 'static 'vector4w :x #xff :w #x80) - ) - ) + (camera-line (-> arg0 string-trans) + (the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 (-> arg0 los-tgt-spline-pt)))) + (new 'static 'vector4w :y #xff :w #x80)) + (camera-line (-> arg0 los-last-pos) + (the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 (-> arg0 los-tgt-spline-pt)))) + (new 'static 'vector4w :x #xff :w #x80))) ((= (-> arg0 next-state name) 'cam-circular) (let ((s5-2 (new-stack-vector0))) (vector+float*! s5-2 (-> arg0 pivot-pt) (-> *camera* local-down) 4096.0) - (camera-line (-> arg0 pivot-pt) s5-2 (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80)) - ) - (camera-line (-> arg0 pivot-pt) (-> arg0 trans) (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80)) - ) + (camera-line (-> arg0 pivot-pt) s5-2 (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80))) + (camera-line (-> arg0 pivot-pt) (-> arg0 trans) (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80))) ((= (-> arg0 next-state name) 'cam-spline) (let ((s5-3 (new 'stack 'curve)) - (s4-2 (res-lump-struct (-> arg0 cam-entity) 'spline-offset structure)) - ) - (if (not s4-2) - (set! s4-2 (new-stack-vector0)) - ) + (s4-2 (res-lump-struct (-> arg0 cam-entity) 'spline-offset structure))) + (if (not s4-2) (set! s4-2 (new-stack-vector0))) (when (get-curve-data! (-> arg0 cam-entity) s5-3 'campath 'campath-k -1000000000.0) (let ((s3-0 (new-stack-vector0)) (s2-0 (new-stack-vector0)) - (gp-1 (res-lump-data (-> arg0 cam-entity) 'campoints pointer :time 1.0)) - ) + (gp-1 (res-lump-data (-> arg0 cam-entity) 'campoints pointer :time 1.0))) (curve-get-pos! s2-0 0.0 s5-3) (vector+! s2-0 s2-0 (the-as vector s4-2)) (dotimes (s1-0 8) (set! (-> s3-0 quad) (-> s2-0 quad)) (curve-get-pos! s2-0 (* 0.125 (the float (+ s1-0 1))) s5-3) (vector+! s2-0 s2-0 (the-as vector s4-2)) - (camera-line s3-0 s2-0 (new 'static 'vector4w :x #xff :y #xff :w #x80)) - ) + (camera-line s3-0 s2-0 (new 'static 'vector4w :x #xff :y #xff :w #x80))) (dotimes (s1-1 (-> s5-3 num-cverts)) (vector+! s3-0 (-> s5-3 cverts s1-1) (the-as vector s4-2)) (vector+! s2-0 (-> s5-3 cverts (mod (+ s1-1 1) (-> s5-3 num-cverts))) (the-as vector s4-2)) - (camera-line s3-0 s2-0 (new 'static 'vector4w :y #xff :z #xff :w #x80)) - ) + (camera-line s3-0 s2-0 (new 'static 'vector4w :y #xff :z #xff :w #x80))) (if gp-1 - (camera-line - (the-as vector (&+ gp-1 0)) - (the-as vector (&+ gp-1 16)) - (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80) - ) - (camera-line - (-> s5-3 cverts 0) - (-> s5-3 cverts (+ (-> s5-3 num-cverts) -1)) - (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80) - ) - ) - ) - ) - ) - ) - ) - ) + (camera-line (the-as vector (&+ gp-1 0)) + (the-as vector (&+ gp-1 16)) + (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80)) + (camera-line (-> s5-3 cverts 0) + (-> s5-3 cverts (+ (-> s5-3 num-cverts) -1)) + (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80))))))))) 0 - (none) - ) + (none)) (defun master-draw-coordinates ((arg0 vector)) (let ((s5-0 (new-stack-vector0)) - (gp-0 (new-stack-vector0)) - ) - (let ((a0-1 (new-stack-matrix0))) - (set-vector! s5-0 0.0 8192.0 0.0 1.0) - (matrix-rotate-yxz! a0-1 s5-0) - ) - (vector+! - gp-0 - (-> *camera-combiner* trans) - (vector-normalize-copy! gp-0 (-> *camera-combiner* inv-camera-rot vector 2) 24576.0) - ) + (gp-0 (new-stack-vector0))) + (let ((a0-1 (new-stack-matrix0))) (set-vector! s5-0 0.0 8192.0 0.0 1.0) (matrix-rotate-yxz! a0-1 s5-0)) + (vector+! gp-0 + (-> *camera-combiner* trans) + (vector-normalize-copy! gp-0 (-> *camera-combiner* inv-camera-rot vector 2) 24576.0)) (let ((a1-2 s5-0) (v1-4 gp-0) - (a0-3 s5-0) - ) + (a0-3 s5-0)) (set! (-> a0-3 x) 4096.0) (set! (-> a0-3 y) 0.0) (set! (-> a0-3 z) 0.0) (set! (-> a0-3 w) 1.0) - (vector+! a1-2 v1-4 a0-3) - ) - (add-debug-line - #t - (bucket-id debug-no-zbuf) - gp-0 - s5-0 - (new 'static 'rgba :r #xff :a #x80) - #f - (the-as rgba -1) - ) + (vector+! a1-2 v1-4 a0-3)) + (add-debug-line #t (bucket-id debug-no-zbuf) gp-0 s5-0 (new 'static 'rgba :r #xff :a #x80) #f (the-as rgba -1)) (let ((a1-5 s5-0) (v1-5 gp-0) - (a0-5 s5-0) - ) + (a0-5 s5-0)) (set! (-> a0-5 x) 0.0) (set! (-> a0-5 y) 4096.0) (set! (-> a0-5 z) 0.0) (set! (-> a0-5 w) 1.0) - (vector+! a1-5 v1-5 a0-5) - ) - (add-debug-line - #t - (bucket-id debug-no-zbuf) - gp-0 - s5-0 - (new 'static 'rgba :g #xff :a #x80) - #f - (the-as rgba -1) - ) + (vector+! a1-5 v1-5 a0-5)) + (add-debug-line #t (bucket-id debug-no-zbuf) gp-0 s5-0 (new 'static 'rgba :g #xff :a #x80) #f (the-as rgba -1)) (let ((a1-8 s5-0) (v1-6 gp-0) - (a0-7 s5-0) - ) + (a0-7 s5-0)) (set! (-> a0-7 x) 0.0) (set! (-> a0-7 y) 0.0) (set! (-> a0-7 z) 4096.0) (set! (-> a0-7 w) 1.0) - (vector+! a1-8 v1-6 a0-7) - ) - (add-debug-line - #t - (bucket-id debug-no-zbuf) - gp-0 - s5-0 - (new 'static 'rgba :b #xff :a #x80) - #f - (the-as rgba -1) - ) + (vector+! a1-8 v1-6 a0-7)) + (add-debug-line #t (bucket-id debug-no-zbuf) gp-0 s5-0 (new 'static 'rgba :b #xff :a #x80) #f (the-as rgba -1)) (when arg0 (set! (-> s5-0 quad) (-> arg0 quad)) (vector-normalize! s5-0 4096.0) (vector+! s5-0 gp-0 s5-0) - (add-debug-line - #t - (bucket-id debug-no-zbuf) - gp-0 - s5-0 - (new 'static 'rgba :r #x7f :g #x7f :a #x80) - #f - (the-as rgba -1) - ) - ) - ) + (add-debug-line #t (bucket-id debug-no-zbuf) gp-0 s5-0 (new 'static 'rgba :r #x7f :g #x7f :a #x80) #f (the-as rgba -1)))) 0 - (none) - ) + (none)) (deftype cam-collision-record (structure) - ((pos vector :inline :offset-assert 0) - (vel vector :inline :offset-assert 16) - (desired-pos vector :inline :offset-assert 32) - (cam-tpos-cur vector :inline :offset-assert 48) - (cam-tpos-old vector :inline :offset-assert 64) - (view-flat vector :inline :offset-assert 80) - (string-min-val vector :inline :offset-assert 96) - (string-max-val vector :inline :offset-assert 112) - (view-off vector :inline :offset-assert 128) - (min-z-override float :offset-assert 144) - (string-push-z float :offset-assert 148) - (view-off-param float :offset-assert 152) - (frame int32 :offset-assert 156) - (iteration int32 :offset-assert 160) - (move-type symbol :offset-assert 164) - ) + ((pos vector :inline :offset-assert 0) + (vel vector :inline :offset-assert 16) + (desired-pos vector :inline :offset-assert 32) + (cam-tpos-cur vector :inline :offset-assert 48) + (cam-tpos-old vector :inline :offset-assert 64) + (view-flat vector :inline :offset-assert 80) + (string-min-val vector :inline :offset-assert 96) + (string-max-val vector :inline :offset-assert 112) + (view-off vector :inline :offset-assert 128) + (min-z-override float :offset-assert 144) + (string-push-z float :offset-assert 148) + (view-off-param float :offset-assert 152) + (frame int32 :offset-assert 156) + (iteration int32 :offset-assert 160) + (move-type symbol :offset-assert 164)) :method-count-assert 9 - :size-assert #xa8 - :flag-assert #x9000000a8 - ) - + :size-assert #xa8 + :flag-assert #x9000000a8) (deftype cam-collision-record-array (inline-array-class) - ((data cam-collision-record :dynamic :offset-assert 16) - ) + ((data cam-collision-record :dynamic :offset-assert 16)) :method-count-assert 9 - :size-assert #x10 - :flag-assert #x900000010 - ) - + :size-assert #x10 + :flag-assert #x900000010) (set! (-> cam-collision-record-array heap-base) (the-as uint 176)) @@ -1338,12 +876,7 @@ (defun cam-collision-record-save ((arg0 vector) (arg1 vector) (arg2 int) (arg3 symbol) (arg4 camera-slave)) (when *record-cam-collide-history* - (let ((v1-5 (the-as - cam-collision-record - (+ (+ (* 176 *cam-collision-record-last*) 12) (the-as int *cam-collision-record*)) - ) - ) - ) + (let ((v1-5 (the-as cam-collision-record (+ (+ (* 176 *cam-collision-record-last*) 12) (the-as int *cam-collision-record*))))) (set! (-> v1-5 pos quad) (-> arg0 quad)) (set! (-> v1-5 vel quad) (-> arg1 quad)) (set! (-> v1-5 view-flat quad) (-> arg4 view-flat quad)) @@ -1358,71 +891,40 @@ (set! (-> v1-5 move-type) arg3) (set! (-> v1-5 min-z-override) (-> arg4 min-z-override)) (set! (-> v1-5 string-push-z) (-> *camera* string-push-z)) - (set! (-> v1-5 view-off-param) (-> arg4 view-off-param)) - ) + (set! (-> v1-5 view-off-param) (-> arg4 view-off-param))) (set! *cam-collision-record-show* *cam-collision-record-last*) (set! *cam-collision-record-last* (+ *cam-collision-record-last* 1)) (set! *cam-collision-record-last* (mod *cam-collision-record-last* 600)) (when (= *cam-collision-record-last* *cam-collision-record-first*) (set! *cam-collision-record-first* (+ *cam-collision-record-first* 1)) - (set! *cam-collision-record-first* (mod *cam-collision-record-first* 600)) - ) - ) + (set! *cam-collision-record-first* (mod *cam-collision-record-first* 600)))) 0 - (none) - ) + (none)) (defun cam-collision-record-step ((arg0 int)) (set! *cam-collision-record-show* (+ *cam-collision-record-show* arg0)) (while (>= *cam-collision-record-show* 600) - (set! *cam-collision-record-show* (+ *cam-collision-record-show* -600)) - ) + (set! *cam-collision-record-show* (+ *cam-collision-record-show* -600))) (while (< *cam-collision-record-show* 0) - (set! *cam-collision-record-show* (+ *cam-collision-record-show* 600)) - ) + (set! *cam-collision-record-show* (+ *cam-collision-record-show* 600))) 0 - (none) - ) + (none)) (defun cam-collision-record-draw () (cond - ((cpad-pressed? 0 down) - (cam-collision-record-step 1) - ) - ((cpad-hold? 0 right) - (cam-collision-record-step 1) - ) - ((cpad-pressed? 0 up) - (cam-collision-record-step -1) - ) - ((cpad-hold? 0 left) - (cam-collision-record-step -1) - ) - ) - (let ((s5-0 (the-as - cam-collision-record - (+ (+ (* 176 *cam-collision-record-show*) 12) (the-as int *cam-collision-record*)) - ) - ) + ((cpad-pressed? 0 down) (cam-collision-record-step 1)) + ((cpad-hold? 0 right) (cam-collision-record-step 1)) + ((cpad-pressed? 0 up) (cam-collision-record-step -1)) + ((cpad-hold? 0 left) (cam-collision-record-step -1))) + (let ((s5-0 (the-as cam-collision-record (+ (+ (* 176 *cam-collision-record-show*) 12) (the-as int *cam-collision-record*)))) (s4-0 (new 'stack 'vector4w)) - (gp-0 (new 'stack 'vector4w)) - ) + (gp-0 (new 'stack 'vector4w))) (format *stdcon* "move-type ~A~%" (-> s5-0 move-type)) (cond - ((= (-> s5-0 move-type) 'normal) - (set! (-> s4-0 x) 255) - (set! (-> s4-0 y) 255) - ) - ((= (-> s5-0 move-type) 'jump) - (set! (-> s4-0 x) 255) - ) - ((= (-> s5-0 move-type) 'no-hit) - (set! (-> s4-0 y) 255) - ) - (else - (set! (-> s4-0 z) 255) - ) - ) + ((= (-> s5-0 move-type) 'normal) (set! (-> s4-0 x) 255) (set! (-> s4-0 y) 255)) + ((= (-> s5-0 move-type) 'jump) (set! (-> s4-0 x) 255)) + ((= (-> s5-0 move-type) 'no-hit) (set! (-> s4-0 y) 255)) + (else (set! (-> s4-0 z) 255))) (set! (-> s4-0 w) 128) (set! (-> gp-0 x) 127) (set! (-> gp-0 y) 127) @@ -1430,48 +932,25 @@ (set! (-> gp-0 w) 128) (camera-line-rel-len (-> s5-0 pos) (-> s5-0 vel) (fmax 81.92 (vector-length (-> s5-0 vel))) s4-0) (let* ((s3-1 (new 'stack-no-clear 'collide-tri-result)) - (f30-1 - (fill-and-probe-using-line-sphere - *collide-cache* - (-> s5-0 pos) - (-> s5-0 vel) - (-> *CAMERA-bank* collide-move-rad) - (collide-kind background) - (the-as process #f) - s3-1 - (new 'static 'pat-surface :nocamera #x1) - ) - ) - (s2-1 (new 'stack-no-clear 'vector)) - ) + (f30-1 (fill-and-probe-using-line-sphere *collide-cache* + (-> s5-0 pos) + (-> s5-0 vel) + (-> *CAMERA-bank* collide-move-rad) + (collide-kind background) + (the-as process #f) + s3-1 + (new 'static 'pat-surface :nocamera #x1))) + (s2-1 (new 'stack-no-clear 'vector))) (format *stdcon* "frame ~D iteration ~D travel ~f~%" (-> s5-0 frame) (-> s5-0 iteration) f30-1) - (format - *stdcon* - "mzo ~M psz ~M vop ~f~%" - (-> s5-0 min-z-override) - (-> s5-0 string-push-z) - (-> s5-0 view-off-param) - ) + (format *stdcon* "mzo ~M psz ~M vop ~f~%" (-> s5-0 min-z-override) (-> s5-0 string-push-z) (-> s5-0 view-off-param)) (format *stdcon* "pos ~M ~M ~M~%" (-> s5-0 pos x) (-> s5-0 pos y) (-> s5-0 pos z)) (format *stdcon* "vel ~M ~M ~M~%" (-> s5-0 vel x) (-> s5-0 vel y) (-> s5-0 vel z)) (format *stdcon* "des ~M ~M ~M~%" (-> s5-0 desired-pos x) (-> s5-0 desired-pos y) (-> s5-0 desired-pos z)) (format *stdcon* "flt ~M ~M ~M~%" (-> s5-0 view-flat x) (-> s5-0 view-flat y) (-> s5-0 view-flat z)) (format *stdcon* "cur ~M ~M ~M~%" (-> s5-0 cam-tpos-cur x) (-> s5-0 cam-tpos-cur y) (-> s5-0 cam-tpos-cur z)) (format *stdcon* "old ~M ~M ~M~%" (-> s5-0 cam-tpos-old x) (-> s5-0 cam-tpos-old y) (-> s5-0 cam-tpos-old z)) - (format - *stdcon* - "smn ~M ~M ~M~%" - (-> s5-0 string-min-val x) - (-> s5-0 string-min-val y) - (-> s5-0 string-min-val z) - ) - (format - *stdcon* - "smx ~M ~M ~M~%" - (-> s5-0 string-max-val x) - (-> s5-0 string-max-val y) - (-> s5-0 string-max-val z) - ) + (format *stdcon* "smn ~M ~M ~M~%" (-> s5-0 string-min-val x) (-> s5-0 string-min-val y) (-> s5-0 string-min-val z)) + (format *stdcon* "smx ~M ~M ~M~%" (-> s5-0 string-max-val x) (-> s5-0 string-max-val y) (-> s5-0 string-max-val z)) (format *stdcon* "vof ~M ~M ~M~%" (-> s5-0 view-off x) (-> s5-0 view-off y) (-> s5-0 view-off z)) (when (>= f30-1 0.0) (camera-line (the-as vector (-> s3-1 vertex)) (-> s3-1 vertex 1) s4-0) @@ -1480,73 +959,43 @@ (vector-! s2-1 (-> s5-0 pos) (-> s3-1 intersect)) (vector-normalize! s2-1 1.0) (camera-line-rel-len (-> s3-1 intersect) s2-1 (-> *CAMERA-bank* collide-move-rad) gp-0) - (camera-line-rel-len (-> s3-1 intersect) (-> s3-1 normal) (-> *CAMERA-bank* collide-move-rad) gp-0) - ) - ) - ) + (camera-line-rel-len (-> s3-1 intersect) (-> s3-1 normal) (-> *CAMERA-bank* collide-move-rad) gp-0)))) 0 - (none) - ) + (none)) (defun camera-master-debug ((arg0 camera-master)) (when *display-cam-other* (let ((f0-1 (* 0.5 (-> *camera-other-fov* data)))) - (camera-fov-frame - *camera-other-matrix* - *camera-other-trans* - f0-1 - 0.75 - 1.0 - (new 'static 'vector4w :x #xff :w #x80) - ) - ) + (camera-fov-frame *camera-other-matrix* *camera-other-trans* f0-1 0.75 1.0 (new 'static 'vector4w :x #xff :w #x80))) (camera-line *camera-other-trans* *camera-other-root* (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80)) (let ((s4-0 (new 'stack-no-clear 'vector)) - (s5-0 *camera-other-trans*) - ) + (s5-0 *camera-other-trans*)) (vector+float*! s4-0 s5-0 (the-as vector (-> *camera-other-matrix* vector)) 2048.0) (camera-line s5-0 s4-0 (new 'static 'vector4w :x #xff :w #x80)) (vector+float*! s4-0 s5-0 (-> *camera-other-matrix* vector 1) 2048.0) (camera-line s5-0 s4-0 (new 'static 'vector4w :y #xff :w #x80)) (vector+float*! s4-0 s5-0 (-> *camera-other-matrix* vector 2) 2048.0) - (camera-line s5-0 s4-0 (new 'static 'vector4w :z #xff :w #x80)) - ) - ) + (camera-line s5-0 s4-0 (new 'static 'vector4w :z #xff :w #x80)))) (when *display-camera-last-attacker* (format *stdcon* "last attacker '") - (let ((v1-12 (handle->process (-> last-try-to-look-at-data who)))) - (if v1-12 - (format *stdcon* "~S" (-> v1-12 name)) - ) - ) - (format *stdcon* "'~%") - ) + (let ((v1-12 (handle->process (-> last-try-to-look-at-data who)))) (if v1-12 (format *stdcon* "~S" (-> v1-12 name)))) + (format *stdcon* "'~%")) (when *display-camera-old-stats* - (format - *stdcon* - "old ~S cpu ~D old vu ~D (go to menu before comparing)~%" - *camera-old-level* - *camera-old-cpu* - *camera-old-vu* - ) + (format *stdcon* + "old ~S cpu ~D old vu ~D (go to menu before comparing)~%" + *camera-old-level* + *camera-old-cpu* + *camera-old-vu*) (format *stdcon* "old tfrag-mem ~D~%" (sar *camera-old-tfrag-bytes* 10)) (format *stdcon* "~S~%" *camera-old-stat-string-tfrag-near*) (format *stdcon* "~S~%" *camera-old-stat-string-tfrag*) - (format *stdcon* "~S~%" *camera-old-stat-string-total*) - ) - (if *display-cam-collide-history* - (cam-collision-record-draw) - ) - (if *display-cam-master-marks* - (tracking-spline-method-23 (-> arg0 target-spline)) - ) - (if *display-xyz-axes* - (master-draw-coordinates (the-as vector #f)) - ) + (format *stdcon* "~S~%" *camera-old-stat-string-total*)) + (if *display-cam-collide-history* (cam-collision-record-draw)) + (if *display-cam-master-marks* (tracking-spline-method-23 (-> arg0 target-spline))) + (if *display-xyz-axes* (master-draw-coordinates (the-as vector #f))) (cam-debug-draw-tris) 0 - (none) - ) + (none)) (defun debug-set-camera-pos-rot! ((arg0 vector) (arg1 matrix)) (when (and *camera* *camera-combiner*) @@ -1556,17 +1005,13 @@ (v1-10 (-> arg1 vector 0 quad)) (a0-4 (-> arg1 vector 1 quad)) (a1-2 (-> arg1 vector 2 quad)) - (a3-0 (-> arg1 vector 3 quad)) - ) + (a3-0 (-> arg1 vector 3 quad))) (set! (-> a2-0 vector 0 quad) v1-10) (set! (-> a2-0 vector 1 quad) a0-4) (set! (-> a2-0 vector 2 quad) a1-2) - (set! (-> a2-0 vector 3 quad) a3-0) - ) - (send-event *camera* 'change-state cam-fixed 0) - ) - arg0 - ) + (set! (-> a2-0 vector 3 quad) a3-0)) + (send-event *camera* 'change-state cam-fixed 0)) + arg0) (defun external-cam-reset! () (vector-reset! (-> *math-camera* trans)) @@ -1577,15 +1022,11 @@ (a0-2 (-> a3-0 vector 0 quad)) (a1-0 (-> a3-0 vector 1 quad)) (a2-0 (-> a3-0 vector 2 quad)) - (a3-1 (-> a3-0 vector 3 quad)) - ) + (a3-1 (-> a3-0 vector 3 quad))) (set! (-> v1-6 vector 0 quad) a0-2) (set! (-> v1-6 vector 1 quad) a1-0) (set! (-> v1-6 vector 2 quad) a2-0) - (set! (-> v1-6 vector 3 quad) a3-1) - ) - (set! (-> *math-camera* trans quad) (-> *camera-combiner* trans quad)) - ) + (set! (-> v1-6 vector 3 quad) a3-1)) + (set! (-> *math-camera* trans quad) (-> *camera-combiner* trans quad))) 0 - (none) - ) + (none)) diff --git a/goal_src/jak1/engine/camera/cam-interface-h.gc b/goal_src/jak1/engine/camera/cam-interface-h.gc index fa298ae759..bcf814e99a 100644 --- a/goal_src/jak1/engine/camera/cam-interface-h.gc +++ b/goal_src/jak1/engine/camera/cam-interface-h.gc @@ -1,7 +1,6 @@ ;;-*-Lisp-*- (in-package goal) (bundles "ENGINE.CGO" "GAME.CGO") - (require "engine/camera/camera-h.gc") (require "engine/math/matrix-h.gc") @@ -11,14 +10,21 @@ ;; NOTE - forward declaration needed for cam-interface (define-extern *camera-dummy-vector* vector) + (define-extern *camera* camera-master) ;; unknown type (define *camera-read-analog* #t) + (define *camera-read-buttons* #t) + (define *cam-free-move-along-z* #t) + (define-perm *camera-init-mat* matrix #f) + (define-perm *camera* camera-master #f) + (define-perm *camera-combiner* camera-combiner #f) + (define-perm *camera-orbit-target* (pointer process-drawable) #f) (define-extern position-in-front-of-camera! (function vector float float vector)) diff --git a/goal_src/jak1/engine/camera/cam-interface.gc b/goal_src/jak1/engine/camera/cam-interface.gc index 38a111d2cd..73ad9368d0 100644 --- a/goal_src/jak1/engine/camera/cam-interface.gc +++ b/goal_src/jak1/engine/camera/cam-interface.gc @@ -1,7 +1,6 @@ ;;-*-Lisp-*- (in-package goal) (bundles "ENGINE.CGO" "GAME.CGO") - (require "engine/camera/cam-interface-h.gc") (require "engine/math/quaternion.gc") (require "kernel/gstate.gc") @@ -13,73 +12,50 @@ ;; name in dgo: cam-interface ;; dgos: GAME, ENGINE - ;; definition for function position-in-front-of-camera! (defun position-in-front-of-camera! ((arg0 vector) (arg1 float) (arg2 float)) (vector-float*! arg0 (-> *math-camera* inv-camera-rot vector 2) arg1) (vector+float*! arg0 arg0 (-> *math-camera* inv-camera-rot vector 1) arg2) (vector+! arg0 arg0 (-> *math-camera* trans)) - arg0 - ) + arg0) ;; definition for function matrix-local->world (defun matrix-local->world ((arg0 symbol) (arg1 symbol)) - (if arg0 - (-> *math-camera* inv-camera-rot-smooth) - (-> *math-camera* inv-camera-rot) - ) - ) + (if arg0 (-> *math-camera* inv-camera-rot-smooth) (-> *math-camera* inv-camera-rot))) ;; definition for function matrix-world->local (defun matrix-world->local () - (-> *math-camera* camera-rot) - ) + (-> *math-camera* camera-rot)) (define-perm *camera-dummy-vector* vector (vector-reset! (new 'global 'vector))) ;; definition for function camera-pos ;; INFO: Return type mismatch object vs vector. (defun camera-pos () - (the-as vector (cond - (*camera-combiner* - (-> *camera-combiner* stack) - ) - (*math-camera* - (-> *math-camera* trans) - ) - (else - *camera-dummy-vector* - ) - ) - ) - ) + (the-as vector + (cond + (*camera-combiner* (-> *camera-combiner* stack)) + (*math-camera* (-> *math-camera* trans)) + (else *camera-dummy-vector*)))) ;; definition for function math-camera-pos (defun math-camera-pos () - (-> *math-camera* trans) - ) + (-> *math-camera* trans)) ;; definition for function camera-angle (defun camera-angle () (let ((f0-0 (-> *math-camera* camera-rot data 0)) - (f1-0 (-> *math-camera* camera-rot data 2)) - ) - (atan f1-0 f0-0) - ) - ) + (f1-0 (-> *math-camera* camera-rot data 2))) + (atan f1-0 f0-0))) ;; definition for function camera-teleport-to-entity ;; INFO: Return type mismatch int vs none. ;; Used lq/sq (defbehavior camera-teleport-to-entity process ((arg0 entity-actor)) (let ((gp-0 (new 'stack 'transformq))) - (set! (-> gp-0 trans quad) - (-> (the-as transform (-> arg0 extra)) scale quad) - ) + (set! (-> gp-0 trans quad) (-> (the-as transform (-> arg0 extra)) scale quad)) (quaternion-copy! (-> gp-0 quat) (-> arg0 quat)) (vector-identity! (-> gp-0 scale)) - (send-event *camera* 'teleport-to-transformq gp-0) - ) + (send-event *camera* 'teleport-to-transformq gp-0)) 0 - (none) - ) + (none)) diff --git a/goal_src/jak1/engine/camera/cam-layout.gc b/goal_src/jak1/engine/camera/cam-layout.gc index cf003b6262..211d13bc86 100644 --- a/goal_src/jak1/engine/camera/cam-layout.gc +++ b/goal_src/jak1/engine/camera/cam-layout.gc @@ -1,7 +1,6 @@ ;;-*-Lisp-*- (in-package goal) (bundles "ENGINE.CGO" "GAME.CGO") - (require "engine/ps2/pad.gc") (require "engine/geometry/vol-h.gc") (require "engine/camera/camera.gc") @@ -18,80 +17,59 @@ (define *camera-layout-blink* #f) (deftype cam-layout-bank (basic) - ((spline-t float) - (spline-step float) - (intro-t float) - (intro-step float) - (debug-t float) - (debug-step float) - ) - ) + ((spline-t float) + (spline-step float) + (intro-t float) + (intro-step float) + (debug-t float) + (debug-step float))) - -(define *CAM_LAYOUT-bank* (new 'static 'cam-layout-bank - :spline-t 0.01 - :spline-step 0.0016666667 - :intro-t 0.01 - :intro-step 0.0016666667 - :debug-t 0.01 - :debug-step 0.0033333334 - ) - ) +(define *CAM_LAYOUT-bank* + (new 'static + 'cam-layout-bank + :spline-t 0.01 + :spline-step 0.0016666667 + :intro-t 0.01 + :intro-step 0.0016666667 + :debug-t 0.01 + :debug-step 0.0033333334)) (define *camera-layout-message-ypos* 30) -(deftype clm-basic (basic) - () - ) - +(deftype clm-basic (basic) ()) (deftype clm-item-action (structure) - ((button uint64) - (options uint64) - (func symbol) - (parm0 int32 :offset 20) - (parm0-basic basic :overlay-at parm0) - (parm1-basic basic :offset 24) - (parm1 symbol :overlay-at parm1-basic) - ) - ) - + ((button uint64) + (options uint64) + (func symbol) + (parm0 int32 :offset 20) + (parm0-basic basic :overlay-at parm0) + (parm1-basic basic :offset 24) + (parm1 symbol :overlay-at parm1-basic))) (deftype clm-item (clm-basic) - ((description string) - (button-symbol symbol) - (action clm-item-action :inline) - ) - ) - + ((description string) + (button-symbol symbol) + (action clm-item-action :inline))) (deftype clm-list-item (basic) - ((description string) - (track-val symbol) - (val-func symbol) - (val-parm0 int32 :offset 16) - (val-parm0-basic basic :overlay-at val-parm0) - (val-parm1-basic basic :offset 20) - (val-parm1 symbol :overlay-at val-parm1-basic) - (actions (array clm-item-action)) - ) - ) - + ((description string) + (track-val symbol) + (val-func symbol) + (val-parm0 int32 :offset 16) + (val-parm0-basic basic :overlay-at val-parm0) + (val-parm1-basic basic :offset 20) + (val-parm1 symbol :overlay-at val-parm1-basic) + (actions (array clm-item-action)))) (deftype clm-list (clm-basic) - ((tracker symbol) - (cur-list-item int32) - (items (array clm-list-item)) - ) - ) - + ((tracker symbol) + (cur-list-item int32) + (items (array clm-list-item)))) (deftype clm (basic) - ((title string) - (items (array clm-basic)) - ) - ) - + ((title string) + (items (array clm-basic)))) (define *volume-point-current* 0) @@ -102,10 +80,7 @@ (define *volume-normal* (new 'debug 'vector-array 600)) (deftype volume-descriptor-array (inline-array-class) - ((data plane-volume :inline :dynamic :offset 16) - ) - ) - + ((data plane-volume :inline :dynamic :offset 16))) (set! (-> volume-descriptor-array heap-base) (the-as uint 24)) @@ -114,55 +89,37 @@ (define *volume-descriptor* (the-as vol-control (new 'debug 'volume-descriptor-array 100))) (deftype cam-layout (process) - ((cam-entity entity-camera) - (num-entities int32) - (cur-entity int32) - (num-volumes int32) - (cur-volume int32) - (first-pvol int32) - (first-cutoutvol int32) - (res-key float) - ) + ((cam-entity entity-camera) + (num-entities int32) + (cur-entity int32) + (num-volumes int32) + (cur-volume int32) + (first-pvol int32) + (first-cutoutvol int32) + (res-key float)) :heap-base #x200 (:states - cam-layout-active - ) - ) - + cam-layout-active)) (defun cam-layout-print ((arg0 int) (arg1 int) (arg2 string)) (let* ((s5-0 (-> *display* frames (-> *display* on-screen) frame debug-buf)) - (gp-0 (-> s5-0 base)) - ) + (gp-0 (-> s5-0 base))) (draw-string-xy arg2 s5-0 arg0 arg1 (font-color white) (font-flags shadow kerning)) (let ((a3-4 (-> s5-0 base))) (let ((v1-4 (the-as object (-> s5-0 base)))) (set! (-> (the-as dma-packet v1-4) dma) (new 'static 'dma-tag :id (dma-tag-id next))) (set! (-> (the-as dma-packet v1-4) vif0) (new 'static 'vif-tag)) (set! (-> (the-as dma-packet v1-4) vif1) (new 'static 'vif-tag)) - (set! (-> s5-0 base) (&+ (the-as pointer v1-4) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) frame bucket-group) + (set! (-> s5-0 base) (&+ (the-as pointer v1-4) 16))) + (dma-bucket-insert-tag (-> *display* frames (-> *display* on-screen) frame bucket-group) (bucket-id debug) gp-0 - (the-as (pointer dma-tag) a3-4) - ) - ) - ) - ) + (the-as (pointer dma-tag) a3-4))))) (defun cam-layout-intersect-dist ((arg0 vector) (arg1 vector) (arg2 vector)) (let ((f0-1 (vector-dot arg1 arg0)) - (f1-1 (vector-dot arg2 arg0)) - ) - (the-as float (if (< 0.00001 (fabs f1-1)) - (/ (- (-> arg0 w) f0-1) f1-1) - 409600000.0 - ) - ) - ) - ) + (f1-1 (vector-dot arg2 arg0))) + (the-as float (if (< 0.00001 (fabs f1-1)) (/ (- (-> arg0 w) f0-1) f1-1) 409600000.0)))) (defbehavior cam-layout-entity-volume-info-create cam-layout ((arg0 entity-camera) (arg1 symbol)) (local-vars @@ -177,516 +134,342 @@ (sv-240 vector) (sv-256 int) (sv-272 int) - (sv-288 int) - ) + (sv-288 int)) (let ((s4-0 0)) - (loop - (set! sv-16 (new 'static 'res-tag)) - (let ((s3-0 (the-as (inline-array vector) ((method-of-type res-lump get-property-data) - arg0 - arg1 - 'exact - (the float s4-0) - (the-as pointer #f) - (& sv-16) - *res-static-buf* - ) - ) - ) - ) + (loop (set! sv-16 (new 'static 'res-tag)) + (let ((s3-0 (the-as (inline-array vector) + ((method-of-type res-lump get-property-data) arg0 + arg1 + 'exact + (the float s4-0) + (the-as pointer #f) + (& sv-16) + *res-static-buf*)))) (cond (s3-0 - (when (>= *volume-descriptor-current* 100) - (format 0 "ERROR : camera editing out of volume descriptors~%") - (return #f) - ) - (let ((s2-0 (-> *volume-descriptor* pos-vol *volume-descriptor-current*))) - (set! (-> s2-0 volume-type) arg1) - (set! (-> s2-0 point-count) 0) - (set! (-> s2-0 first-point) (the-as (pointer vector) (-> *volume-point* data *volume-point-current*))) - (set! (-> s2-0 normal-count) 0) - (set! (-> s2-0 first-normal) (the-as (pointer vector) (-> *volume-normal* data *volume-normal-current*))) - (set! *volume-descriptor-current* (+ *volume-descriptor-current* 1)) - (+! (-> self num-volumes) 1) - (dotimes (s1-0 (the-as int (-> sv-16 elt-count))) - (set! sv-192 (new 'stack-no-clear 'vector)) - (set! (-> sv-192 quad) (the-as uint128 0)) - (set! sv-208 (new 'stack-no-clear 'vector)) - (set! (-> sv-208 quad) (the-as uint128 0)) - (set! sv-224 (new 'stack-no-clear 'vector)) - (set! (-> sv-224 quad) (the-as uint128 0)) - (set! sv-240 (new 'stack-no-clear 'vector)) - (set! (-> sv-240 quad) (the-as uint128 0)) - 0.0 - 0.0 - 0.0 - (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) - (let ((s0-0 (new-stack-vector0))) - (set! sv-256 0) - (set! sv-272 0) - (while (< sv-272 (the-as int (-> sv-16 elt-count))) - (when (!= s1-0 sv-272) - (vector-float*! sv-192 (-> s3-0 sv-272) (-> s3-0 sv-272 w)) - (vector-cross! sv-208 (-> s3-0 sv-272) (-> s3-0 s1-0)) - (vector-normalize! sv-208 (the-as float 1.0)) - (vector-cross! sv-224 sv-208 (-> s3-0 sv-272)) - (vector-normalize! sv-224 (the-as float 1.0)) - (let ((f0-6 (cam-layout-intersect-dist (-> s3-0 s1-0) sv-192 sv-224))) - (when (!= f0-6 409600000.0) - (vector+float*! sv-240 sv-192 sv-224 f0-6) - (set! sv-160 (new-stack-vector0)) - (set! sv-164 0.0) - (set! sv-168 0) - (set! sv-176 (new-stack-vector0)) - (set! (-> sv-160 quad) (-> sv-240 quad)) - (set! sv-288 0) - (while (< sv-288 (the-as int (-> sv-16 elt-count))) - (when (and (!= sv-288 s1-0) (!= sv-288 sv-272)) - (let ((f30-0 (cam-layout-intersect-dist (-> s3-0 sv-288) sv-160 sv-208))) - (cond - ((= f30-0 409600000.0) - ) - ((zero? sv-168) - (vector+float*! sv-160 sv-160 sv-208 f30-0) - (set! (-> sv-176 quad) (-> s3-0 sv-288 quad)) - (set! sv-164 8192000.0) - (set! sv-168 1) - ) - ((begin (vector-float*! sv-240 sv-208 f30-0) (>= (vector-dot sv-240 sv-176) 0.0)) - ) - ((>= (vector-dot sv-240 (-> s3-0 sv-288)) 0.0) - (when (< (fabs f30-0) (fabs sv-164)) - (set! sv-164 f30-0) - (set! sv-168 (+ sv-168 1)) - ) - ) - (else - (vector+float*! sv-160 sv-160 sv-208 f30-0) - (set! (-> sv-176 quad) (-> s3-0 sv-288 quad)) - (set! sv-168 (+ sv-168 1)) - (if (< (fabs f30-0) (fabs sv-164)) - (set! sv-164 (- sv-164 f30-0)) - (set! sv-164 0.0) - ) - ) - ) - ) - ) - (set! sv-288 (+ sv-288 1)) - ) - (cond - ((zero? sv-168) - ) - ((= sv-164 0.0) - ) - (else - (dotimes (v1-87 (the-as int (-> sv-16 elt-count))) - (when (and (!= v1-87 s1-0) (!= v1-87 sv-272)) - (if (< 4096.0 (- (vector-dot sv-160 (-> s3-0 v1-87)) (-> s3-0 v1-87 w))) - (goto cfg-47) - ) - ) - ) - (vector+float*! sv-240 sv-160 sv-208 sv-164) - (cond - ((>= *volume-point-current* 999) - (format 0 "ERROR : camera editing out of volume points~%") - ) - (else - (set! (-> *volume-point* data *volume-point-current* quad) (-> sv-160 quad)) - (set! (-> *volume-point* data (+ *volume-point-current* 1) quad) (-> sv-240 quad)) - (set! *volume-point-current* (+ *volume-point-current* 2)) - (+! (-> s2-0 point-count) 2) - ) - ) - (vector+! s0-0 s0-0 sv-160) - (vector+! s0-0 s0-0 sv-240) - (set! sv-256 (+ sv-256 2)) - sv-256 - ) - ) - ) - ) - ) - (label cfg-47) - (set! sv-272 (+ sv-272 1)) - ) - (when (nonzero? sv-256) - (vector-float*! s0-0 s0-0 (/ 1.0 (the float sv-256))) - (cond - ((>= *volume-normal-current* 599) - (format 0 "ERROR : camera editing out of volume normals~%") - ) - (else - (set! (-> *volume-normal* data *volume-normal-current* quad) (-> s0-0 quad)) - (set! (-> *volume-normal* data (+ *volume-normal-current* 1) quad) (-> s3-0 s1-0 quad)) - (set! *volume-normal-current* (+ *volume-normal-current* 2)) - (set! (-> s2-0 normal-count) (+ (-> s2-0 normal-count) 2)) - ) - ) - ) - ) - ) - ) - ) - (else - (return #f) - ) - ) - ) - (+! s4-0 1) - ) - ) - (the-as symbol #f) - ) + (when (>= *volume-descriptor-current* 100) + (format 0 "ERROR : camera editing out of volume descriptors~%") + (return #f)) + (let ((s2-0 (-> *volume-descriptor* pos-vol *volume-descriptor-current*))) + (set! (-> s2-0 volume-type) arg1) + (set! (-> s2-0 point-count) 0) + (set! (-> s2-0 first-point) (the-as (pointer vector) (-> *volume-point* data *volume-point-current*))) + (set! (-> s2-0 normal-count) 0) + (set! (-> s2-0 first-normal) (the-as (pointer vector) (-> *volume-normal* data *volume-normal-current*))) + (set! *volume-descriptor-current* (+ *volume-descriptor-current* 1)) + (+! (-> self num-volumes) 1) + (dotimes (s1-0 (the-as int (-> sv-16 elt-count))) + (set! sv-192 (new 'stack-no-clear 'vector)) + (set! (-> sv-192 quad) (the-as uint128 0)) + (set! sv-208 (new 'stack-no-clear 'vector)) + (set! (-> sv-208 quad) (the-as uint128 0)) + (set! sv-224 (new 'stack-no-clear 'vector)) + (set! (-> sv-224 quad) (the-as uint128 0)) + (set! sv-240 (new 'stack-no-clear 'vector)) + (set! (-> sv-240 quad) (the-as uint128 0)) + 0.0 + 0.0 + 0.0 + (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) + (let ((s0-0 (new-stack-vector0))) + (set! sv-256 0) + (set! sv-272 0) + (while (< sv-272 (the-as int (-> sv-16 elt-count))) + (when (!= s1-0 sv-272) + (vector-float*! sv-192 (-> s3-0 sv-272) (-> s3-0 sv-272 w)) + (vector-cross! sv-208 (-> s3-0 sv-272) (-> s3-0 s1-0)) + (vector-normalize! sv-208 (the-as float 1.0)) + (vector-cross! sv-224 sv-208 (-> s3-0 sv-272)) + (vector-normalize! sv-224 (the-as float 1.0)) + (let ((f0-6 (cam-layout-intersect-dist (-> s3-0 s1-0) sv-192 sv-224))) + (when (!= f0-6 409600000.0) + (vector+float*! sv-240 sv-192 sv-224 f0-6) + (set! sv-160 (new-stack-vector0)) + (set! sv-164 0.0) + (set! sv-168 0) + (set! sv-176 (new-stack-vector0)) + (set! (-> sv-160 quad) (-> sv-240 quad)) + (set! sv-288 0) + (while (< sv-288 (the-as int (-> sv-16 elt-count))) + (when (and (!= sv-288 s1-0) (!= sv-288 sv-272)) + (let ((f30-0 (cam-layout-intersect-dist (-> s3-0 sv-288) sv-160 sv-208))) + (cond + ((= f30-0 409600000.0)) + ((zero? sv-168) + (vector+float*! sv-160 sv-160 sv-208 f30-0) + (set! (-> sv-176 quad) (-> s3-0 sv-288 quad)) + (set! sv-164 8192000.0) + (set! sv-168 1)) + ((begin (vector-float*! sv-240 sv-208 f30-0) (>= (vector-dot sv-240 sv-176) 0.0))) + ((>= (vector-dot sv-240 (-> s3-0 sv-288)) 0.0) + (when (< (fabs f30-0) (fabs sv-164)) + (set! sv-164 f30-0) + (set! sv-168 (+ sv-168 1)))) + (else + (vector+float*! sv-160 sv-160 sv-208 f30-0) + (set! (-> sv-176 quad) (-> s3-0 sv-288 quad)) + (set! sv-168 (+ sv-168 1)) + (if (< (fabs f30-0) (fabs sv-164)) (set! sv-164 (- sv-164 f30-0)) (set! sv-164 0.0)))))) + (set! sv-288 (+ sv-288 1))) + (cond + ((zero? sv-168)) + ((= sv-164 0.0)) + (else + (dotimes (v1-87 (the-as int (-> sv-16 elt-count))) + (when (and (!= v1-87 s1-0) (!= v1-87 sv-272)) + (if (< 4096.0 (- (vector-dot sv-160 (-> s3-0 v1-87)) (-> s3-0 v1-87 w))) (goto cfg-47)))) + (vector+float*! sv-240 sv-160 sv-208 sv-164) + (cond + ((>= *volume-point-current* 999) (format 0 "ERROR : camera editing out of volume points~%")) + (else + (set! (-> *volume-point* data *volume-point-current* quad) (-> sv-160 quad)) + (set! (-> *volume-point* data (+ *volume-point-current* 1) quad) (-> sv-240 quad)) + (set! *volume-point-current* (+ *volume-point-current* 2)) + (+! (-> s2-0 point-count) 2))) + (vector+! s0-0 s0-0 sv-160) + (vector+! s0-0 s0-0 sv-240) + (set! sv-256 (+ sv-256 2)) + sv-256))))) + (label cfg-47) + (set! sv-272 (+ sv-272 1))) + (when (nonzero? sv-256) + (vector-float*! s0-0 s0-0 (/ 1.0 (the float sv-256))) + (cond + ((>= *volume-normal-current* 599) (format 0 "ERROR : camera editing out of volume normals~%")) + (else + (set! (-> *volume-normal* data *volume-normal-current* quad) (-> s0-0 quad)) + (set! (-> *volume-normal* data (+ *volume-normal-current* 1) quad) (-> s3-0 s1-0 quad)) + (set! *volume-normal-current* (+ *volume-normal-current* 2)) + (set! (-> s2-0 normal-count) (+ (-> s2-0 normal-count) 2))))))))) + (else (return #f)))) + (+! s4-0 1))) + (the-as symbol #f)) (defbehavior cam-layout-entity-volume-info cam-layout () (dotimes (gp-0 (-> self num-volumes)) (cond ((and (= gp-0 (-> self cur-volume)) (= *camera-layout-blink* 'volume) - (not (logtest? (-> *display* real-actual-frame-counter) 8)) - ) - ) + (not (logtest? (-> *display* real-actual-frame-counter) 8)))) (else - (let ((s5-0 (-> *volume-descriptor* pos-vol gp-0))) - (let ((a0-7 (new 'static 'vector4w :w #x80))) - (cond - ((= (-> s5-0 volume-type) 'vol) - (set! (-> a0-7 x) 0) - (set! (-> a0-7 y) 192) - (set! (-> a0-7 z) 0) - 0 - ) - ((= (-> s5-0 volume-type) 'pvol) - (set! (-> a0-7 x) 128) - (set! (-> a0-7 y) 128) - (set! (-> a0-7 z) 128) - ) - ((= (-> s5-0 volume-type) 'cutoutvol) - (set! (-> a0-7 x) 192) - (set! (-> a0-7 y) 0) - (set! (-> a0-7 z) 0) - 0 - ) - ) - (camera-line-setup a0-7) - ) - (let ((s4-0 (the-as object (-> s5-0 first-point)))) - (dotimes (s3-0 (/ (-> s5-0 point-count) 2)) - (camera-line-draw (the-as vector s4-0) (&+ (the-as vector s4-0) 16)) - (set! s4-0 (&-> (the-as (inline-array plane-volume) s4-0) 1 first-point)) - ) - ) - ) - ) - ) - ) - #f - ) + (let ((s5-0 (-> *volume-descriptor* pos-vol gp-0))) + (let ((a0-7 (new 'static 'vector4w :w #x80))) + (cond + ((= (-> s5-0 volume-type) 'vol) (set! (-> a0-7 x) 0) (set! (-> a0-7 y) 192) (set! (-> a0-7 z) 0) 0) + ((= (-> s5-0 volume-type) 'pvol) (set! (-> a0-7 x) 128) (set! (-> a0-7 y) 128) (set! (-> a0-7 z) 128)) + ((= (-> s5-0 volume-type) 'cutoutvol) (set! (-> a0-7 x) 192) (set! (-> a0-7 y) 0) (set! (-> a0-7 z) 0) 0)) + (camera-line-setup a0-7)) + (let ((s4-0 (the-as object (-> s5-0 first-point)))) + (dotimes (s3-0 (/ (-> s5-0 point-count) 2)) + (camera-line-draw (the-as vector s4-0) (&+ (the-as vector s4-0) 16)) + (set! s4-0 (&-> (the-as (inline-array plane-volume) s4-0) 1 first-point)))))))) + #f) (defun v-slrp! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 float)) (let ((s2-0 (new-stack-vector0)) (s1-0 (new-stack-vector0)) - (s0-0 (new-stack-vector0)) - ) + (s0-0 (new-stack-vector0))) 0.0 0.0 0.0 0.0 (cond - ((< 1.0 arg3) - (set! arg3 (the-as float 1.0)) - ) - ((< arg3 0.0) - (set! arg3 (the-as float 0.0)) - ) - ) + ((< 1.0 arg3) (set! arg3 (the-as float 1.0))) + ((< arg3 0.0) (set! arg3 (the-as float 0.0)))) (vector-normalize-copy! s2-0 arg1 (the-as float 1.0)) (vector-normalize-copy! s1-0 arg2 (the-as float 1.0)) (vector-cross! s0-0 s2-0 s1-0) (let* ((f30-0 (vector-length s0-0)) - (f28-0 (asin f30-0)) - ) + (f28-0 (asin f30-0))) (vector-float*! arg0 arg1 (/ (sin (* (- 1.0 arg3) f28-0)) f30-0)) - (vector+float*! arg0 arg0 arg2 (/ (sin (* arg3 f28-0)) f30-0)) - ) - ) - ) + (vector+float*! arg0 arg0 arg2 (/ (sin (* arg3 f28-0)) f30-0))))) (deftype interp-test-info (structure) - ((from vector :inline) - (to vector :inline) - (origin vector :inline) - (color vector4w) - (axis vector) - (disp string) - ) - ) - + ((from vector :inline) + (to vector :inline) + (origin vector :inline) + (color vector4w) + (axis vector) + (disp string))) (defun interp-test ((arg0 (function vector vector vector float vector float none)) (arg1 interp-test-info)) (let ((s3-0 (new-stack-vector0)) - (gp-0 (new-stack-vector0)) - ) + (gp-0 (new-stack-vector0))) (arg0 s3-0 (-> arg1 from) (-> arg1 to) (the-as float 0.0) (-> arg1 axis) (the-as float 65536.0)) (vector+! s3-0 s3-0 (-> arg1 origin)) (dotimes (s2-0 10) (set! (-> gp-0 quad) (-> s3-0 quad)) (arg0 s3-0 (-> arg1 from) (-> arg1 to) (* 0.1 (+ 1.0 (the float s2-0))) (-> arg1 axis) (the-as float 65536.0)) (vector+! s3-0 s3-0 (-> arg1 origin)) - (camera-line s3-0 gp-0 (-> arg1 color)) - ) + (camera-line s3-0 gp-0 (-> arg1 color))) (arg0 gp-0 (-> arg1 from) (-> arg1 to) (-> *CAM_LAYOUT-bank* debug-t) (-> arg1 axis) (the-as float 65536.0)) (format *stdcon* "~S ~f~%" (-> arg1 disp) (vector-length gp-0)) (vector+! gp-0 gp-0 (-> arg1 origin)) (camera-line (-> arg1 origin) gp-0 (-> arg1 color)) - (camera-cross (new 'static 'vector :y 1024.0) (new 'static 'vector :z 1024.0) gp-0 (-> arg1 color) (meters 1)) - ) - ) + (camera-cross (new 'static 'vector :y 1024.0) (new 'static 'vector :z 1024.0) gp-0 (-> arg1 color) (meters 1)))) (defun interp-test-deg ((arg0 (function vector vector vector vector float none)) (arg1 interp-test-info)) (let ((s3-0 (new-stack-vector0)) - (gp-0 (new-stack-vector0)) - ) + (gp-0 (new-stack-vector0))) (arg0 s3-0 (-> arg1 from) (-> arg1 to) (-> arg1 axis) (the-as float 0.0)) (vector+! s3-0 s3-0 (-> arg1 origin)) (dotimes (s2-0 10) (set! (-> gp-0 quad) (-> s3-0 quad)) (arg0 s3-0 (-> arg1 from) (-> arg1 to) (-> arg1 axis) (* 182.04445 (* 18.0 (+ 1.0 (the float s2-0))))) (vector+! s3-0 s3-0 (-> arg1 origin)) - (camera-line s3-0 gp-0 (-> arg1 color)) - ) + (camera-line s3-0 gp-0 (-> arg1 color))) (arg0 gp-0 (-> arg1 from) (-> arg1 to) (-> arg1 axis) (* 182.04445 (* 180.0 (-> *CAM_LAYOUT-bank* debug-t)))) (format *stdcon* "~S ~f~%" (-> arg1 disp) (vector-length gp-0)) (vector+! gp-0 gp-0 (-> arg1 origin)) (camera-line (-> arg1 origin) gp-0 (-> arg1 color)) - (camera-cross (new 'static 'vector :y 1024.0) (new 'static 'vector :z 1024.0) gp-0 (-> arg1 color) (meters 1)) - ) - ) + (camera-cross (new 'static 'vector :y 1024.0) (new 'static 'vector :z 1024.0) gp-0 (-> arg1 color) (meters 1)))) (defun cam-layout-entity-info ((arg0 entity-actor)) - (if (not arg0) - (return #f) - ) + (if (not arg0) (return #f)) (let ((s5-0 (new-stack-matrix0)) - (s4-0 (new-stack-vector0)) - ) + (s4-0 (new-stack-vector0))) (when (and (cam-slave-get-vector-with-offset arg0 s4-0 'trans) - (or (!= *camera-layout-blink* 'camera) (logtest? (-> *display* real-actual-frame-counter) 8)) - ) + (or (!= *camera-layout-blink* 'camera) (logtest? (-> *display* real-actual-frame-counter) 8))) (cam-slave-get-rot arg0 s5-0) - (camera-fov-frame - s5-0 - s4-0 - (* 0.5 (cam-slave-get-fov arg0)) - (the-as float 0.75) - (the-as float 1.0) - (new 'static 'vector4w :z #xff :w #x80) - ) - ) - ) + (camera-fov-frame s5-0 + s4-0 + (* 0.5 (cam-slave-get-fov arg0)) + (the-as float 0.75) + (the-as float 1.0) + (new 'static 'vector4w :z #xff :w #x80)))) (let ((s5-1 (new-stack-vector0))) (if (and (cam-slave-get-vector-with-offset arg0 s5-1 'pivot) - (or (!= *camera-layout-blink* 'pivot) (logtest? (-> *display* real-actual-frame-counter) 8)) - ) - (camera-cross - (new 'static 'vector :y 1024.0) - (new 'static 'vector :z 1024.0) - s5-1 - (new 'static 'vector4w :x #x80 :w #x80) - (meters 1) - ) - ) - ) + (or (!= *camera-layout-blink* 'pivot) (logtest? (-> *display* real-actual-frame-counter) 8))) + (camera-cross (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s5-1 + (new 'static 'vector4w :x #x80 :w #x80) + (meters 1)))) (let ((s5-2 (new-stack-vector0))) (if (and (cam-slave-get-vector-with-offset arg0 s5-2 'align) - (or (!= *camera-layout-blink* 'align) (logtest? (-> *display* real-actual-frame-counter) 8)) - ) - (camera-cross - (new 'static 'vector :y 1024.0) - (new 'static 'vector :z 1024.0) - s5-2 - (new 'static 'vector4w :y #x80 :w #x80) - (meters 1) - ) - ) - ) + (or (!= *camera-layout-blink* 'align) (logtest? (-> *display* real-actual-frame-counter) 8))) + (camera-cross (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s5-2 + (new 'static 'vector4w :y #x80 :w #x80) + (meters 1)))) (let ((s5-3 (new-stack-vector0))) (if (and (cam-slave-get-vector-with-offset arg0 s5-3 'interesting) - (or (!= *camera-layout-blink* 'interesting) (logtest? (-> *display* real-actual-frame-counter) 8)) - ) - (camera-cross - (new 'static 'vector :y 1024.0) - (new 'static 'vector :z 1024.0) - s5-3 - (new 'static 'vector4w :x #x80 :z #x80 :w #x80) - (meters 1) - ) - ) - ) + (or (!= *camera-layout-blink* 'interesting) (logtest? (-> *display* real-actual-frame-counter) 8))) + (camera-cross (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s5-3 + (new 'static 'vector4w :x #x80 :z #x80 :w #x80) + (meters 1)))) (let ((s3-1 (new 'stack 'curve)) (s2-0 (new-stack-vector0)) (s5-4 (new-stack-vector0)) - (s4-1 (new-stack-vector0)) - ) + (s4-1 (new-stack-vector0))) (when (and (get-curve-data! arg0 s3-1 'campath 'campath-k (the-as float -1000000000.0)) - (or (!= *camera-layout-blink* 'spline) (logtest? (-> *display* real-actual-frame-counter) 8)) - ) + (or (!= *camera-layout-blink* 'spline) (logtest? (-> *display* real-actual-frame-counter) 8))) (cond ((cam-slave-get-vector-with-offset arg0 s4-1 'pivot) (curve-get-pos! s5-4 (the-as float 0.0) s3-1) - (vector-! s4-1 s4-1 s5-4) - ) + (vector-! s4-1 s4-1 s5-4)) (else - (set! (-> s4-1 quad) - (-> (the-as - vector - ((method-of-type res-lump get-property-struct) - arg0 - 'spline-offset - 'interp - (the-as float -1000000000.0) - s4-1 - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - quad - ) - ) - ) - ) + (set! (-> s4-1 quad) + (-> (the-as vector + ((method-of-type res-lump get-property-struct) arg0 + 'spline-offset + 'interp + (the-as float -1000000000.0) + s4-1 + (the-as (pointer res-tag) #f) + *res-static-buf*)) + quad)))) (curve-get-pos! s5-4 (the-as float 0.0) s3-1) (vector+! s5-4 s5-4 s4-1) (dotimes (s1-1 8) (set! (-> s2-0 quad) (-> s5-4 quad)) (curve-get-pos! s5-4 (* 0.125 (the float (+ s1-1 1))) s3-1) (vector+! s5-4 s5-4 s4-1) - (camera-line s2-0 s5-4 (new 'static 'vector4w :x #xff :y #xff :w #x80)) - ) + (camera-line s2-0 s5-4 (new 'static 'vector4w :x #xff :y #xff :w #x80))) (curve-get-pos! s5-4 (-> *CAM_LAYOUT-bank* spline-t) s3-1) (vector+! s5-4 s5-4 s4-1) - (camera-cross - (new 'static 'vector :y 1024.0) - (new 'static 'vector :z 1024.0) - s5-4 - (new 'static 'vector4w :x #xff :y #xff :w #x80) - (meters 1) - ) - ) - ) + (camera-cross (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s5-4 + (new 'static 'vector4w :x #xff :y #xff :w #x80) + (meters 1)))) (let ((s3-2 (new 'stack 'curve)) (s2-1 (new-stack-vector0)) (s5-5 (new-stack-vector0)) (s4-2 (new-stack-vector0)) - (s1-2 (new 'stack 'curve)) - ) + (s1-2 (new 'stack 'curve))) (when (and (get-curve-data! arg0 s3-2 'intro 'intro-k (the-as float -1000000000.0)) - (or (!= *camera-layout-blink* 'intro) (logtest? (-> *display* real-actual-frame-counter) 8)) - ) + (or (!= *camera-layout-blink* 'intro) (logtest? (-> *display* real-actual-frame-counter) 8))) (cond ((cam-slave-get-vector-with-offset arg0 s4-2 'pivot) (curve-get-pos! s5-5 (the-as float 1.0) s3-2) - (vector-! s4-2 s4-2 s5-5) - ) + (vector-! s4-2 s4-2 s5-5)) ((get-curve-data! arg0 s1-2 'campath 'campath-k (the-as float -1000000000.0)) (curve-get-pos! s4-2 (the-as float 0.0) s1-2) (curve-get-pos! s5-5 (the-as float 1.0) s3-2) - (vector-! s4-2 s4-2 s5-5) - ) + (vector-! s4-2 s4-2 s5-5)) ((cam-slave-get-vector-with-offset arg0 s4-2 'trans) (curve-get-pos! s5-5 (the-as float 1.0) s3-2) - (vector-! s4-2 s4-2 s5-5) - ) - ) + (vector-! s4-2 s4-2 s5-5))) (curve-get-pos! s5-5 (the-as float 0.0) s3-2) (vector+! s5-5 s5-5 s4-2) (dotimes (s1-3 8) (set! (-> s2-1 quad) (-> s5-5 quad)) (curve-get-pos! s5-5 (* 0.125 (the float (+ s1-3 1))) s3-2) (vector+! s5-5 s5-5 s4-2) - (camera-line s2-1 s5-5 (new 'static 'vector4w :z #xff :w #x80)) - ) + (camera-line s2-1 s5-5 (new 'static 'vector4w :z #xff :w #x80))) (curve-get-pos! s5-5 (-> *CAM_LAYOUT-bank* intro-t) s3-2) (vector+! s5-5 s5-5 s4-2) - (camera-cross - (new 'static 'vector :y 1024.0) - (new 'static 'vector :z 1024.0) - s5-5 - (new 'static 'vector4w :z #xff :w #x80) - (meters 1) - ) + (camera-cross (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s5-5 + (new 'static 'vector4w :z #xff :w #x80) + (meters 1)) (curve-get-pos! s5-5 (cam-slave-get-float arg0 'intro-exitValue (the-as float 0.0)) s3-2) (vector+! s5-5 s5-5 s4-2) - (camera-cross - (new 'static 'vector :y 1024.0) - (new 'static 'vector :z 1024.0) - s5-5 - (new 'static 'vector4w :z #xff :w #x80) - (meters 1) - ) - ) - ) + (camera-cross (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s5-5 + (new 'static 'vector4w :z #xff :w #x80) + (meters 1)))) (let ((s2-3 (res-lump-data arg0 'campoints pointer :time (the-as float 1.0))) (v1-95 (res-lump-struct arg0 'campoints-offset structure :time (the-as float -1000000000.0))) (s4-3 (new 'stack-no-clear 'vector)) (s3-3 (new 'stack-no-clear 'vector)) - (s5-6 (new 'static 'vector)) - ) + (s5-6 (new 'static 'vector))) (when (and s2-3 (or (!= *camera-layout-blink* 'index) (logtest? (-> *display* real-actual-frame-counter) 8))) (cond (v1-95 - (vector+! s4-3 (the-as vector (&+ s2-3 0)) (the-as vector v1-95)) - (vector+! s3-3 (the-as vector (&+ s2-3 16)) (the-as vector v1-95)) - ) + (vector+! s4-3 (the-as vector (&+ s2-3 0)) (the-as vector v1-95)) + (vector+! s3-3 (the-as vector (&+ s2-3 16)) (the-as vector v1-95))) (else - (set! (-> s4-3 quad) (-> (the-as (pointer uint128) (&+ s2-3 0)))) - (set! (-> s3-3 quad) (-> (the-as (pointer uint128) (&+ s2-3 16)))) - ) - ) + (set! (-> s4-3 quad) (-> (the-as (pointer uint128) (&+ s2-3 0)))) + (set! (-> s3-3 quad) (-> (the-as (pointer uint128) (&+ s2-3 16)))))) (camera-line s4-3 s3-3 (new 'static 'vector4w :y #x80 :w #x80)) (vector-lerp-clamp! s5-6 s4-3 s3-3 (-> *CAM_LAYOUT-bank* spline-t)) - (camera-cross - (new 'static 'vector :y 1024.0) - (new 'static 'vector :z 1024.0) - s5-6 - (new 'static 'vector4w :x #xff :y #xff :w #x80) - (meters 1) - ) - ) - ) + (camera-cross (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s5-6 + (new 'static 'vector4w :x #xff :y #xff :w #x80) + (meters 1)))) (let ((s4-4 (res-lump-data arg0 'focalpull pointer :time (the-as float 1.0))) - (s5-7 (new 'static 'vector)) - ) + (s5-7 (new 'static 'vector))) (when (and s4-4 (or (!= *camera-layout-blink* 'focalpull) (logtest? (-> *display* real-actual-frame-counter) 8))) - (camera-line - (the-as vector (&+ s4-4 0)) - (the-as vector (&+ s4-4 16)) - (new 'static 'vector4w :y #xff :z #xff :w #x80) - ) - (vector-lerp-clamp! - s5-7 - (the-as vector (&+ s4-4 0)) - (the-as vector (&+ s4-4 16)) - (-> *CAM_LAYOUT-bank* spline-t) - ) - (camera-cross - (new 'static 'vector :y 1024.0) - (new 'static 'vector :z 1024.0) - s5-7 - (new 'static 'vector4w :y #xff :z #xff :w #x80) - (meters 1) - ) - ) - ) + (camera-line (the-as vector (&+ s4-4 0)) (the-as vector (&+ s4-4 16)) (new 'static 'vector4w :y #xff :z #xff :w #x80)) + (vector-lerp-clamp! s5-7 (the-as vector (&+ s4-4 0)) (the-as vector (&+ s4-4 16)) (-> *CAM_LAYOUT-bank* spline-t)) + (camera-cross (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s5-7 + (new 'static 'vector4w :y #xff :z #xff :w #x80) + (meters 1)))) (let ((s5-8 (new 'stack 'interp-test-info)) - (s4-5 (new-stack-vector0)) - ) + (s4-5 (new-stack-vector0))) (when (and (cam-slave-get-vector-with-offset arg0 (-> s5-8 origin) 'pivot) (cam-slave-get-vector-with-offset arg0 (-> s5-8 to) 'align) - (cam-slave-get-vector-with-offset arg0 (-> s5-8 from) 'trans) - ) + (cam-slave-get-vector-with-offset arg0 (-> s5-8 from) 'trans)) (camera-line (-> s5-8 from) (-> s5-8 origin) (new 'static 'vector4w :x #x80 :y #x80 :z #x80 :w #x80)) (camera-line (-> s5-8 to) (-> s5-8 origin) (new 'static 'vector4w :x #x80 :y #x80 :z #x80 :w #x80)) (vector-! (-> s5-8 from) (-> s5-8 from) (-> s5-8 origin)) @@ -697,10 +480,7 @@ (camera-line (-> s5-8 origin) s4-5 (new 'static 'vector4w :x #x80 :y #x80 :z #x80 :w #x80)) (when (not (paused?)) (+! (-> *CAM_LAYOUT-bank* debug-t) (-> *CAM_LAYOUT-bank* debug-step)) - (if (< 1.0 (-> *CAM_LAYOUT-bank* debug-t)) - (set! (-> *CAM_LAYOUT-bank* debug-t) 0.0) - ) - ) + (if (< 1.0 (-> *CAM_LAYOUT-bank* debug-t)) (set! (-> *CAM_LAYOUT-bank* debug-t) 0.0))) (set! (-> s5-8 axis) #f) (set! (-> s5-8 disp) "li") (set! (-> s5-8 color) (new 'static 'vector4w :x #xff :w #x80)) @@ -720,123 +500,92 @@ (interp-test (the-as (function vector vector vector float vector float none) v-slrp2!) s5-8) (set! (-> s5-8 disp) "si3d") (set! (-> s5-8 color) (new 'static 'vector4w :x #xff :y #xff :w #x80)) - (interp-test-deg (the-as (function vector vector vector vector float none) v-slrp3!) s5-8) - ) - ) - ) + (interp-test-deg (the-as (function vector vector vector vector float none) v-slrp3!) s5-8)))) (defun clmf-button-test () (cam-layout-print 16 *camera-layout-message-ypos* "button test") (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8)) (set! *camera-read-analog* #f) - #f - ) + #f) (defun clmf-bna () (cam-layout-print 16 *camera-layout-message-ypos* "button not applicable") (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8)) (set! *camera-read-analog* #f) - #t - ) + #t) (defun clmf-implement () (cam-layout-print 16 *camera-layout-message-ypos* "button not implemented yet") (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8)) (set! *camera-read-analog* #f) - #t - ) + #t) (defun clmf-input ((arg0 vector) (arg1 vector) (arg2 int)) (vector-reset! arg0) (vector-reset! arg1) (cond ((cpad-hold? arg2 l3) - (set! (-> arg0 z) (- (-> arg0 z) (analog-input - (the-as int (-> *cpad-list* cpads arg2 rightx)) - (the-as float 128.0) - (the-as float 48.0) - (the-as float 110.0) - (the-as float 1.0) - ) - ) - ) - ) + (set! (-> arg0 z) + (- (-> arg0 z) + (analog-input (the-as int (-> *cpad-list* cpads arg2 rightx)) + (the-as float 128.0) + (the-as float 48.0) + (the-as float 110.0) + (the-as float 1.0))))) (else - (set! (-> arg0 y) (- (-> arg0 y) (analog-input - (the-as int (-> *cpad-list* cpads arg2 rightx)) - (the-as float 128.0) - (the-as float 48.0) - (the-as float 110.0) - (the-as float 1.0) - ) - ) - ) - (+! (-> arg0 x) (analog-input - (the-as int (-> *cpad-list* cpads arg2 righty)) - (the-as float 128.0) - (the-as float 48.0) - (the-as float 110.0) - (the-as float 1.0) - ) - ) - (set! (-> arg1 x) (- (-> arg1 x) (analog-input - (the-as int (-> *cpad-list* cpads arg2 leftx)) - (the-as float 128.0) - (the-as float 48.0) - (the-as float 110.0) - (the-as float 1.0) - ) - ) - ) - (when *camera-read-buttons* - (if (cpad-hold? arg2 r1) - (set! (-> arg1 y) (+ 0.5 - (analog-input - (the-as int (-> *cpad-list* cpads arg2 abutton 9)) + (set! (-> arg0 y) + (- (-> arg0 y) + (analog-input (the-as int (-> *cpad-list* cpads arg2 rightx)) + (the-as float 128.0) + (the-as float 48.0) + (the-as float 110.0) + (the-as float 1.0)))) + (+! (-> arg0 x) + (analog-input (the-as int (-> *cpad-list* cpads arg2 righty)) + (the-as float 128.0) + (the-as float 48.0) + (the-as float 110.0) + (the-as float 1.0))) + (set! (-> arg1 x) + (- (-> arg1 x) + (analog-input (the-as int (-> *cpad-list* cpads arg2 leftx)) + (the-as float 128.0) + (the-as float 48.0) + (the-as float 110.0) + (the-as float 1.0)))) + (when *camera-read-buttons* + (if (cpad-hold? arg2 r1) + (set! (-> arg1 y) + (+ 0.5 + (analog-input (the-as int (-> *cpad-list* cpads arg2 abutton 9)) + (the-as float 0.0) + (the-as float 32.0) + (the-as float 230.0) + (the-as float 0.5)) + (-> arg1 y))))) + (when *camera-read-buttons* + (if (cpad-hold? arg2 l1) + (set! (-> arg1 y) + (- (-> arg1 y) + (+ 0.5 + (analog-input (the-as int (-> *cpad-list* cpads arg2 abutton 8)) (the-as float 0.0) (the-as float 32.0) (the-as float 230.0) - (the-as float 0.5) - ) - (-> arg1 y) - ) - ) - ) - ) - (when *camera-read-buttons* - (if (cpad-hold? arg2 l1) - (set! (-> arg1 y) (- (-> arg1 y) (+ 0.5 (analog-input - (the-as int (-> *cpad-list* cpads arg2 abutton 8)) - (the-as float 0.0) - (the-as float 32.0) - (the-as float 230.0) - (the-as float 0.5) - ) - ) - ) - ) - ) - ) - (set! (-> arg1 z) (- (-> arg1 z) (analog-input - (the-as int (-> *cpad-list* cpads arg2 lefty)) - (the-as float 128.0) - (the-as float 48.0) - (the-as float 110.0) - (the-as float 1.0) - ) - ) - ) - ) - ) + (the-as float 0.5))))))) + (set! (-> arg1 z) + (- (-> arg1 z) + (analog-input (the-as int (-> *cpad-list* cpads arg2 lefty)) + (the-as float 128.0) + (the-as float 48.0) + (the-as float 110.0) + (the-as float 1.0)))))) (let ((s5-1 (new-stack-matrix0))) (let ((a2-8 (new-stack-vector0))) (set! (-> a2-8 y) -1.0) - (forward-down-nopitch->inv-matrix s5-1 (-> *math-camera* inv-camera-rot vector 2) a2-8) - ) - (vector-matrix*! arg1 arg1 s5-1) - ) - arg1 - ) + (forward-down-nopitch->inv-matrix s5-1 (-> *math-camera* inv-camera-rot vector 2) a2-8)) + (vector-matrix*! arg1 arg1 s5-1)) + arg1) (defbehavior clmf-pos-rot cam-layout ((arg0 symbol) (arg1 symbol)) (local-vars (s2-0 structure) (s3-1 structure) (sv-192 matrix)) @@ -846,136 +595,87 @@ (cam-layout-print 16 *camera-layout-message-ypos* "x/y rot: right stick") (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8)) (cam-layout-print 16 *camera-layout-message-ypos* "z rot: press left stick & move right") - (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8)) - ) + (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8))) (let ((s5-0 (new-stack-vector0)) - (s4-0 (new-stack-vector0)) - ) + (s4-0 (new-stack-vector0))) (set! s3-1 (cond - ((or (zero? arg0) (not arg0)) - #f - ) + ((or (zero? arg0) (not arg0)) #f) (else - (if (not (res-lump-struct (-> self cam-entity) arg0 structure :time (the-as float -1000000000.0))) - (add-data! - (-> self cam-entity) - (new 'static 'res-tag :name arg0 :key-frame -1000000000.0 :elt-count #x1 :inlined? #x1 :elt-type vector) - (the-as pointer (new 'static 'vector)) - ) - ) - (set! s3-1 (res-lump-struct (-> self cam-entity) arg0 structure :time (the-as float -1000000000.0))) - (when (and (not s3-1) (logtest? (-> *display* real-actual-frame-counter) 8)) - (clear *temp-string*) - (format *temp-string* "ERROR : can't add ~A" 'vector) - (cam-layout-print 120 100 *temp-string*) - ) - s3-1 - ) - ) - ) + (if (not (res-lump-struct (-> self cam-entity) arg0 structure :time (the-as float -1000000000.0))) + (add-data! (-> self cam-entity) + (new 'static 'res-tag :name arg0 :key-frame -1000000000.0 :elt-count #x1 :inlined? #x1 :elt-type vector) + (the-as pointer (new 'static 'vector)))) + (set! s3-1 (res-lump-struct (-> self cam-entity) arg0 structure :time (the-as float -1000000000.0))) + (when (and (not s3-1) (logtest? (-> *display* real-actual-frame-counter) 8)) + (clear *temp-string*) + (format *temp-string* "ERROR : can't add ~A" 'vector) + (cam-layout-print 120 100 *temp-string*)) + s3-1))) (set! s2-0 (cond - ((or (zero? arg1) (not arg1)) - #f - ) + ((or (zero? arg1) (not arg1)) #f) (else - (if (not (res-lump-struct (-> self cam-entity) arg1 structure :time (the-as float -1000000000.0))) - (add-data! - (-> self cam-entity) - (new 'static 'res-tag :name arg1 :key-frame -1000000000.0 :elt-count #x1 :inlined? #x1 :elt-type quaternion) - (the-as pointer (quaternion-identity! (new 'static 'quaternion))) - ) - ) - (set! s2-0 (res-lump-struct (-> self cam-entity) arg1 structure :time (the-as float -1000000000.0))) - (when (and (not s2-0) (logtest? (-> *display* real-actual-frame-counter) 8)) - (clear *temp-string*) - (format *temp-string* "ERROR : can't add ~A" 'quaternion) - (cam-layout-print 120 100 *temp-string*) - ) - s2-0 - ) - ) - ) + (if (not (res-lump-struct (-> self cam-entity) arg1 structure :time (the-as float -1000000000.0))) + (add-data! (-> self cam-entity) + (new 'static 'res-tag :name arg1 :key-frame -1000000000.0 :elt-count #x1 :inlined? #x1 :elt-type quaternion) + (the-as pointer (quaternion-identity! (new 'static 'quaternion))))) + (set! s2-0 (res-lump-struct (-> self cam-entity) arg1 structure :time (the-as float -1000000000.0))) + (when (and (not s2-0) (logtest? (-> *display* real-actual-frame-counter) 8)) + (clear *temp-string*) + (format *temp-string* "ERROR : can't add ~A" 'quaternion) + (cam-layout-print 120 100 *temp-string*)) + s2-0))) (let ((s1-1 (new 'stack-no-clear 'matrix))) (set! sv-192 (new 'stack-no-clear 'matrix)) (let ((s0-1 (new 'stack-no-clear 'vector))) - (if (not s3-1) - (return #f) - ) + (if (not s3-1) (return #f)) (clmf-input s5-0 s4-0 0) (vector+float*! (the-as vector s3-1) (the-as vector s3-1) s4-0 (the-as float 409.6)) (cond - ((not arg1) - (the-as quaternion #f) - ) - ((zero? arg1) - (the-as quaternion #f) - ) + ((not arg1) (the-as quaternion #f)) + ((zero? arg1) (the-as quaternion #f)) (else - (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) sv-192) - (vector-float*! s5-0 s5-0 100.0) - (matrix-rotate-x! s1-1 (- (-> s5-0 x))) - (matrix*! sv-192 s1-1 sv-192) - (matrix-rotate-y! s1-1 (-> s5-0 y)) - (matrix*! sv-192 sv-192 s1-1) - (matrix-rotate-z! s1-1 (- (-> s5-0 z))) - (matrix*! sv-192 s1-1 sv-192) - (matrix->quaternion (the-as quaternion s0-1) sv-192) - (quaternion-inverse! (the-as quaternion s2-0) (the-as quaternion (-> self cam-entity connect))) - (quaternion*! (the-as quaternion s2-0) (the-as quaternion s0-1) (the-as quaternion s2-0)) - (quaternion-normalize! (the-as quaternion s2-0)) - ) - ) - ) - ) - ) + (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) sv-192) + (vector-float*! s5-0 s5-0 100.0) + (matrix-rotate-x! s1-1 (- (-> s5-0 x))) + (matrix*! sv-192 s1-1 sv-192) + (matrix-rotate-y! s1-1 (-> s5-0 y)) + (matrix*! sv-192 sv-192 s1-1) + (matrix-rotate-z! s1-1 (- (-> s5-0 z))) + (matrix*! sv-192 s1-1 sv-192) + (matrix->quaternion (the-as quaternion s0-1) sv-192) + (quaternion-inverse! (the-as quaternion s2-0) (the-as quaternion (-> self cam-entity connect))) + (quaternion*! (the-as quaternion s2-0) (the-as quaternion s0-1) (the-as quaternion s2-0)) + (quaternion-normalize! (the-as quaternion s2-0))))))) (set! *camera-read-analog* #f) - #t - ) + #t) (defbehavior clmf-next-volume cam-layout ((arg0 int)) - (if (zero? (-> self num-volumes)) - (return #f) - ) + (if (zero? (-> self num-volumes)) (return #f)) (set! (-> self cur-volume) (mod (+ arg0 (-> self cur-volume)) (-> self num-volumes))) (while (< (-> self cur-volume) 0) - (+! (-> self cur-volume) (-> self num-volumes)) - ) - #t - ) + (+! (-> self cur-volume) (-> self num-volumes))) + #t) (defun clmf-next-vol-dpad () (local-vars (a0-1 int)) (cam-layout-print 16 *camera-layout-message-ypos* "dpad selects volume") (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8)) (cond - ((cpad-pressed? 0 down) - (set! a0-1 1) - ) - ((cpad-pressed? 0 right) - (set! a0-1 1) - ) - ((cpad-pressed? 0 up) - (set! a0-1 -1) - ) - ((cpad-pressed? 0 left) - (set! a0-1 -1) - ) - (else - (set! a0-1 0) - ) - ) + ((cpad-pressed? 0 down) (set! a0-1 1)) + ((cpad-pressed? 0 right) (set! a0-1 1)) + ((cpad-pressed? 0 up) (set! a0-1 -1)) + ((cpad-pressed? 0 left) (set! a0-1 -1)) + (else (set! a0-1 0))) (clmf-next-volume a0-1) (set! *camera-read-analog* #f) - #t - ) + #t) (defun clmf-to-edit-cam () (clmf-next-volume 0) (set! *clm* *clm-edit*) - #t - ) + #t) (define *last-cur-entity* -1) @@ -983,23 +683,15 @@ (let ((v1-0 (/ arg0 8))) (when (zero? (-> self num-entities)) (set! (-> self cam-entity) #f) - (return #f) - ) - (if (= (- v1-0) (-> self num-entities)) - (set! v1-0 -1) - ) - (if (= v1-0 (-> self num-entities)) - (set! v1-0 1) - ) - (set! (-> self cur-entity) (mod (+ v1-0 (-> self cur-entity)) (-> self num-entities))) - ) + (return #f)) + (if (= (- v1-0) (-> self num-entities)) (set! v1-0 -1)) + (if (= v1-0 (-> self num-entities)) (set! v1-0 1)) + (set! (-> self cur-entity) (mod (+ v1-0 (-> self cur-entity)) (-> self num-entities)))) (while (< (-> self cur-entity) 0) - (+! (-> self cur-entity) (-> self num-entities)) - ) + (+! (-> self cur-entity) (-> self num-entities))) (set! *last-cur-entity* (-> self cur-entity)) (let ((v1-8 (-> self cur-entity)) - (a0-13 (-> *camera-engine* alive-list next0)) - ) + (a0-13 (-> *camera-engine* alive-list next0))) *camera-engine* (let ((a1-3 (-> a0-13 next0))) (while (!= a0-13 (-> *camera-engine* alive-list-end)) @@ -1017,59 +709,43 @@ (set! (-> self first-cutoutvol) (-> self num-volumes)) (cam-layout-entity-volume-info-create (-> self cam-entity) 'cutoutvol) (set! (-> *CAM_LAYOUT-bank* intro-step) (cam-slave-get-intro-step (-> self cam-entity))) - (return #f) - ) - (else - (+! v1-8 -1) - ) - ) - ) + (return #f)) + (else (+! v1-8 -1)))) (set! a0-13 a1-3) *camera-engine* - (set! a1-3 (-> a1-3 next0)) - ) - ) - ) - #t - ) + (set! a1-3 (-> a1-3 next0))))) + #t) (defbehavior clmf-to-vol-attr cam-layout () (set! (-> self res-key) (the float (-> self cur-volume))) (set! *clm* *clm-vol-attr*) - #t - ) + #t) (defun clmf-to-spline-attr () (set! *clm* *clm-spline-attr*) - #t - ) + #t) (defun clmf-to-intro-attr () (set! *clm* *clm-intro-attr*) - #t - ) + #t) (defun clmf-to-index-attr () (set! *clm* *clm-index-attr*) - #t - ) + #t) (defun clmf-to-focalpull-attr () (set! *clm* *clm-focalpull-attr*) - #t - ) + #t) (defbehavior clmf-to-edit cam-layout () (set! (-> self res-key) -1000000000.0) (set! *clm* *clm-edit*) - #t - ) + #t) (defun clmf-to-select () (set! *camera-layout-blink* #f) (set! *clm* *clm-select*) - #t - ) + #t) (defbehavior clmf-look-through cam-layout () (set! (-> *camera-other-fov* data) (cam-slave-get-fov (-> self cam-entity))) @@ -1078,357 +754,213 @@ (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) *camera-other-matrix*) (set! *camera-look-through-other* 10) (set! *camera-read-analog* #f) - #f - ) + #f) (defun fov->maya ((arg0 float)) - (the-as float (if (= arg0 0.0) - 0.0 - (/ 12.700255 (tan (* 0.5 arg0))) - ) - ) - ) + (the-as float (if (= arg0 0.0) 0.0 (/ 12.700255 (tan (* 0.5 arg0)))))) (defun cam-layout-save-cam-rot ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((s3-0 (-> arg2 quat)) - (s5-0 (res-lump-struct arg2 'rot-offset vector :time (the-as float -1000000000.0))) - ) - (if arg0 - (format #t "setup rot ~f ~f ~f ~f~%" (-> s3-0 x) (-> s3-0 y) (-> s3-0 z) (-> s3-0 w)) - ) - (the-as string (when s5-0 - (if arg0 - (format #t "rot offset ~f ~f ~f ~f~%" (-> s5-0 x) (-> s5-0 y) (-> s5-0 z) (-> s5-0 w)) - ) - (format - arg1 - " tag rot-offset ~f ~f ~f ~f // vector (quaternion)~%" - (-> s5-0 x) - (-> s5-0 y) - (-> s5-0 z) - (-> s5-0 w) - ) - ) - ) - ) - ) + (s5-0 (res-lump-struct arg2 'rot-offset vector :time (the-as float -1000000000.0)))) + (if arg0 (format #t "setup rot ~f ~f ~f ~f~%" (-> s3-0 x) (-> s3-0 y) (-> s3-0 z) (-> s3-0 w))) + (the-as string + (when s5-0 + (if arg0 (format #t "rot offset ~f ~f ~f ~f~%" (-> s5-0 x) (-> s5-0 y) (-> s5-0 z) (-> s5-0 w))) + (format arg1 + " tag rot-offset ~f ~f ~f ~f // vector (quaternion)~%" + (-> s5-0 x) + (-> s5-0 y) + (-> s5-0 z) + (-> s5-0 w)))))) (defun cam-layout-save-cam-trans ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((s1-0 (-> arg2 trans)) (s5-0 (method-of-type res-lump get-property-struct)) - (s2-0 arg2) - ) + (s2-0 arg2)) (format (clear *res-key-string*) "~S~S" 'trans '-offset) - (let ((s5-1 (the-as vector (s5-0 - s2-0 - (string->symbol *res-key-string*) - 'interp - (the-as float -1000000000.0) - #f - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - ) + (let ((s5-1 (the-as vector + (s5-0 s2-0 + (string->symbol *res-key-string*) + 'interp + (the-as float -1000000000.0) + #f + (the-as (pointer res-tag) #f) + *res-static-buf*)))) (let ((s2-1 (res-lump-struct arg2 'translation_info vector :time (the-as float -1000000000.0))) - (s3-1 (new-stack-vector0)) - ) - (if arg0 - (format #t "setup trans ~M ~M ~M (maya)~%" (-> s1-0 x) (-> s1-0 y) (-> s1-0 z)) - ) + (s3-1 (new-stack-vector0))) + (if arg0 (format #t "setup trans ~M ~M ~M (maya)~%" (-> s1-0 x) (-> s1-0 y) (-> s1-0 z))) (set! (-> s3-1 quad) (-> s1-0 quad)) (when (the-as structure s5-1) - (if arg0 - (format #t "offset ~M ~M ~M (added)~%" (-> s5-1 x) (-> s5-1 y) (-> s5-1 z)) - ) - (vector+! s3-1 s3-1 s5-1) - ) + (if arg0 (format #t "offset ~M ~M ~M (added)~%" (-> s5-1 x) (-> s5-1 y) (-> s5-1 z))) + (vector+! s3-1 s3-1 s5-1)) (when s2-1 - (if arg0 - (format #t "level-trans ~M ~M ~M (subtracted)~%" (-> s2-1 x) (-> s2-1 y) (-> s2-1 z)) - ) - (vector-! s3-1 s3-1 s2-1) - ) + (if arg0 (format #t "level-trans ~M ~M ~M (subtracted)~%" (-> s2-1 x) (-> s2-1 y) (-> s2-1 z))) + (vector-! s3-1 s3-1 s2-1)) (set! s2-1 (the-as vector (or s5-1 s2-1))) (set! arg0 (and (the-as symbol s2-1) arg0)) - (if arg0 - (format #t "final trans ~M ~M ~M (maya)~%" (-> s3-1 x) (-> s3-1 y) (-> s3-1 z)) - ) - ) - (the-as string (if s5-1 - (format - arg1 - " tag trans-offset METERS(~M) METERS(~M) METERS(~M) 1.0 // vector~%" - (-> s5-1 x) - (-> s5-1 y) - (-> s5-1 z) - ) - ) - ) - ) - ) - ) + (if arg0 (format #t "final trans ~M ~M ~M (maya)~%" (-> s3-1 x) (-> s3-1 y) (-> s3-1 z)))) + (the-as string + (if s5-1 + (format arg1 + " tag trans-offset METERS(~M) METERS(~M) METERS(~M) 1.0 // vector~%" + (-> s5-1 x) + (-> s5-1 y) + (-> s5-1 z))))))) (defun cam-layout-save-pivot ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((s2-0 (res-lump-struct arg2 'pivot vector :time (the-as float -1000000000.0))) - (s3-0 (method-of-type res-lump get-property-struct)) - ) + (s3-0 (method-of-type res-lump get-property-struct))) (format (clear *res-key-string*) "~S~S" 'pivot '-offset) - (let ((s5-1 (the-as vector (s3-0 - arg2 - (string->symbol *res-key-string*) - 'interp - (the-as float -1000000000.0) - #f - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - (s3-1 (new-stack-vector0)) - ) - (the-as string (when s2-0 - (if s5-1 - (vector+! s3-1 s2-0 s5-1) - (set! (-> s3-1 quad) (-> s2-0 quad)) - ) - (if arg0 - (format #t "setup pivot ~M ~M ~M~%" (-> s2-0 x) (-> s2-0 y) (-> s2-0 z)) - ) - (when s5-1 - (when arg0 - (format #t "offset ~M ~M ~M~%" (-> s5-1 x) (-> s5-1 y) (-> s5-1 z)) - (format #t "final pivot ~M ~M ~M~%" (-> s3-1 x) (-> s3-1 y) (-> s3-1 z)) - ) - (format - arg1 - " tag pivot-offset METERS(~M) METERS(~M) METERS(~M) 1.0 // vector~%" - (-> s5-1 x) - (-> s5-1 y) - (-> s5-1 z) - ) - ) - ) - ) - ) - ) - ) + (let ((s5-1 (the-as vector + (s3-0 arg2 + (string->symbol *res-key-string*) + 'interp + (the-as float -1000000000.0) + #f + (the-as (pointer res-tag) #f) + *res-static-buf*))) + (s3-1 (new-stack-vector0))) + (the-as string + (when s2-0 + (if s5-1 (vector+! s3-1 s2-0 s5-1) (set! (-> s3-1 quad) (-> s2-0 quad))) + (if arg0 (format #t "setup pivot ~M ~M ~M~%" (-> s2-0 x) (-> s2-0 y) (-> s2-0 z))) + (when s5-1 + (when arg0 + (format #t "offset ~M ~M ~M~%" (-> s5-1 x) (-> s5-1 y) (-> s5-1 z)) + (format #t "final pivot ~M ~M ~M~%" (-> s3-1 x) (-> s3-1 y) (-> s3-1 z))) + (format arg1 + " tag pivot-offset METERS(~M) METERS(~M) METERS(~M) 1.0 // vector~%" + (-> s5-1 x) + (-> s5-1 y) + (-> s5-1 z)))))))) (defun cam-layout-save-align ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((s2-0 (res-lump-struct arg2 'align vector :time (the-as float -1000000000.0))) - (s3-0 (method-of-type res-lump get-property-struct)) - ) + (s3-0 (method-of-type res-lump get-property-struct))) (format (clear *res-key-string*) "~S~S" 'align '-offset) - (let ((s5-1 (the-as vector (s3-0 - arg2 - (string->symbol *res-key-string*) - 'interp - (the-as float -1000000000.0) - #f - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - (s3-1 (new-stack-vector0)) - ) - (the-as string (when s2-0 - (if s5-1 - (vector+! s3-1 s2-0 s5-1) - (set! (-> s3-1 quad) (-> s2-0 quad)) - ) - (if arg0 - (format #t "setup align ~M ~M ~M~%" (-> s2-0 x) (-> s2-0 y) (-> s2-0 z)) - ) - (when s5-1 - (when arg0 - (format #t "offset ~M ~M ~M~%" (-> s5-1 x) (-> s5-1 y) (-> s5-1 z)) - (format #t "final align ~M ~M ~M~%" (-> s3-1 x) (-> s3-1 y) (-> s3-1 z)) - ) - (format - arg1 - " tag align-offset METERS(~M) METERS(~M) METERS(~M) 1.0 // vector~%" - (-> s5-1 x) - (-> s5-1 y) - (-> s5-1 z) - ) - ) - ) - ) - ) - ) - ) + (let ((s5-1 (the-as vector + (s3-0 arg2 + (string->symbol *res-key-string*) + 'interp + (the-as float -1000000000.0) + #f + (the-as (pointer res-tag) #f) + *res-static-buf*))) + (s3-1 (new-stack-vector0))) + (the-as string + (when s2-0 + (if s5-1 (vector+! s3-1 s2-0 s5-1) (set! (-> s3-1 quad) (-> s2-0 quad))) + (if arg0 (format #t "setup align ~M ~M ~M~%" (-> s2-0 x) (-> s2-0 y) (-> s2-0 z))) + (when s5-1 + (when arg0 + (format #t "offset ~M ~M ~M~%" (-> s5-1 x) (-> s5-1 y) (-> s5-1 z)) + (format #t "final align ~M ~M ~M~%" (-> s3-1 x) (-> s3-1 y) (-> s3-1 z))) + (format arg1 + " tag align-offset METERS(~M) METERS(~M) METERS(~M) 1.0 // vector~%" + (-> s5-1 x) + (-> s5-1 y) + (-> s5-1 z)))))))) (defun cam-layout-save-interesting ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((s2-0 (res-lump-struct arg2 'interesting vector :time (the-as float -1000000000.0))) - (s3-0 (method-of-type res-lump get-property-struct)) - ) + (s3-0 (method-of-type res-lump get-property-struct))) (format (clear *res-key-string*) "~S~S" 'interesting '-offset) - (let ((s5-1 (the-as vector (s3-0 - arg2 - (string->symbol *res-key-string*) - 'interp - (the-as float -1000000000.0) - #f - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - (s3-1 (new-stack-vector0)) - ) - (the-as string (when s2-0 - (if s5-1 - (vector+! s3-1 s2-0 s5-1) - (set! (-> s3-1 quad) (-> s2-0 quad)) - ) - (if arg0 - (format #t "setup interesting ~M ~M ~M~%" (-> s2-0 x) (-> s2-0 y) (-> s2-0 z)) - ) - (when s5-1 - (when arg0 - (format #t "offset ~M ~M ~M~%" (-> s5-1 x) (-> s5-1 y) (-> s5-1 z)) - (format #t "final interesting ~M ~M ~M~%" (-> s3-1 x) (-> s3-1 y) (-> s3-1 z)) - ) - (format - arg1 - " tag interesting-offset METERS(~M) METERS(~M) METERS(~M) 1.0 // vector~%" - (-> s5-1 x) - (-> s5-1 y) - (-> s5-1 z) - ) - ) - ) - ) - ) - ) - ) + (let ((s5-1 (the-as vector + (s3-0 arg2 + (string->symbol *res-key-string*) + 'interp + (the-as float -1000000000.0) + #f + (the-as (pointer res-tag) #f) + *res-static-buf*))) + (s3-1 (new-stack-vector0))) + (the-as string + (when s2-0 + (if s5-1 (vector+! s3-1 s2-0 s5-1) (set! (-> s3-1 quad) (-> s2-0 quad))) + (if arg0 (format #t "setup interesting ~M ~M ~M~%" (-> s2-0 x) (-> s2-0 y) (-> s2-0 z))) + (when s5-1 + (when arg0 + (format #t "offset ~M ~M ~M~%" (-> s5-1 x) (-> s5-1 y) (-> s5-1 z)) + (format #t "final interesting ~M ~M ~M~%" (-> s3-1 x) (-> s3-1 y) (-> s3-1 z))) + (format arg1 + " tag interesting-offset METERS(~M) METERS(~M) METERS(~M) 1.0 // vector~%" + (-> s5-1 x) + (-> s5-1 y) + (-> s5-1 z)))))))) (defun cam-layout-save-fov ((arg0 symbol) (arg1 string) (arg2 entity-actor)) - (let ((f30-0 ((method-of-type res-lump get-property-value-float) - arg2 - 'fov - 'interp - (the-as float -1000000000.0) - (the-as float 0.0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - (s3-0 (method-of-type res-lump get-property-value-float)) - ) + (let ((f30-0 ((method-of-type res-lump get-property-value-float) arg2 + 'fov + 'interp + (the-as float -1000000000.0) + (the-as float 0.0) + (the-as (pointer res-tag) #f) + *res-static-buf*)) + (s3-0 (method-of-type res-lump get-property-value-float))) (format (clear *res-key-string*) "~S~S" 'fov '-offset) - (let ((f28-0 - (s3-0 - arg2 - (string->symbol *res-key-string*) - 'interp - (the-as float -1000000000.0) - (the-as float 0.0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) + (let ((f28-0 (s3-0 arg2 + (string->symbol *res-key-string*) + 'interp + (the-as float -1000000000.0) + (the-as float 0.0) + (the-as (pointer res-tag) #f) + *res-static-buf*))) (cond - ((= f30-0 0.0) - (if arg0 - (format #t "setup fov deg 0.0 (defaults to 64.0)~%") - ) - (set! f30-0 11650.845) - ) - (arg0 - (format #t "setup fov deg ~R (~f in maya)~%" f30-0 (fov->maya f30-0)) - ) - ) - (the-as - string - (when (!= f28-0 0.0) - (when arg0 - (format #t "offset ~R~%" f28-0) - (format #t "final ~R (~f in maya) ~%" (+ f30-0 f28-0) (fov->maya (+ f30-0 f28-0))) - ) - (format arg1 " tag fov-offset DEG(~R) // float~%" f28-0) - ) - ) - ) - ) - ) + ((= f30-0 0.0) (if arg0 (format #t "setup fov deg 0.0 (defaults to 64.0)~%")) (set! f30-0 11650.845)) + (arg0 (format #t "setup fov deg ~R (~f in maya)~%" f30-0 (fov->maya f30-0)))) + (the-as string + (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~R~%" f28-0) + (format #t "final ~R (~f in maya) ~%" (+ f30-0 f28-0) (fov->maya (+ f30-0 f28-0)))) + (format arg1 " tag fov-offset DEG(~R) // float~%" f28-0)))))) (defun cam-layout-save-focalpull ((arg0 symbol) (arg1 string) (arg2 entity-actor)) - (let ((f30-0 ((method-of-type res-lump get-property-value-float) - arg2 - 'focalPull - 'interp - (the-as float -1000000000.0) - (the-as float 0.0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - (s3-0 (method-of-type res-lump get-property-value-float)) - ) + (let ((f30-0 ((method-of-type res-lump get-property-value-float) arg2 + 'focalPull + 'interp + (the-as float -1000000000.0) + (the-as float 0.0) + (the-as (pointer res-tag) #f) + *res-static-buf*)) + (s3-0 (method-of-type res-lump get-property-value-float))) (format (clear *res-key-string*) "~S~S" 'focalPull '-offset) - (let ((f28-0 - (s3-0 - arg2 - (string->symbol *res-key-string*) - 'interp - (the-as float -1000000000.0) - (the-as float 0.0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - (if arg0 - (format #t "setup focalPull deg ~R (~f in maya)~%" f30-0 (fov->maya f30-0)) - ) - (the-as - string - (when (!= f28-0 0.0) - (when arg0 - (format #t "offset ~R~%" f28-0) - (format #t "final ~R (~f in maya) ~%" (+ f30-0 f28-0) (fov->maya (+ f30-0 f28-0))) - ) - (format arg1 " tag focalPull-offset DEG(~R) // float~%" f28-0) - ) - ) - ) - ) - ) + (let ((f28-0 (s3-0 arg2 + (string->symbol *res-key-string*) + 'interp + (the-as float -1000000000.0) + (the-as float 0.0) + (the-as (pointer res-tag) #f) + *res-static-buf*))) + (if arg0 (format #t "setup focalPull deg ~R (~f in maya)~%" f30-0 (fov->maya f30-0))) + (the-as string + (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~R~%" f28-0) + (format #t "final ~R (~f in maya) ~%" (+ f30-0 f28-0) (fov->maya (+ f30-0 f28-0)))) + (format arg1 " tag focalPull-offset DEG(~R) // float~%" f28-0)))))) (defun cam-layout-save-flags ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((s4-0 (res-lump-value arg2 'flags uint128 :time (the-as float -1000000000.0))) (s5-0 (method-of-type res-lump get-property-value)) - (s1-0 arg2) - ) + (s1-0 arg2)) (format (clear *res-key-string*) "~S~S" 'flags '-on) - (let ((s5-1 (s5-0 - s1-0 - (string->symbol *res-key-string*) - 'interp - (the-as float -1000000000.0) - (the-as uint128 0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - (s1-1 (method-of-type res-lump get-property-value)) - ) + (let ((s5-1 (s5-0 s1-0 + (string->symbol *res-key-string*) + 'interp + (the-as float -1000000000.0) + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf*)) + (s1-1 (method-of-type res-lump get-property-value))) (format (clear *res-key-string*) "~S~S" 'flags '-off) - (let ((s3-1 (s1-1 - arg2 - (string->symbol *res-key-string*) - 'interp - (the-as float -1000000000.0) - (the-as uint128 0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) + (let ((s3-1 (s1-1 arg2 + (string->symbol *res-key-string*) + 'interp + (the-as float -1000000000.0) + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf*))) (when arg0 (format #t "setup flags ") (cam-slave-options->string (the-as cam-slave-options s4-0) #t) @@ -1441,48 +973,32 @@ (format #t "~%") (let ((s4-1 (logclear (logior s4-0 s5-1) s3-1))) (format #t "final ") - (cam-slave-options->string (the-as cam-slave-options s4-1) #t) - ) - (format #t "~%") - ) + (cam-slave-options->string (the-as cam-slave-options s4-1) #t)) + (format #t "~%")) (format arg1 " tag flags-on 0x~X // int32~%" s5-1) - (the-as string (format arg1 " tag flags-off 0x~X // int32~%" s3-1)) - ) - ) - ) - ) + (the-as string (format arg1 " tag flags-off 0x~X // int32~%" s3-1)))))) (defun cam-layout-save-focalpull-flags ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((s4-0 (res-lump-value arg2 'focalpull-flags uint128 :time (the-as float -1000000000.0))) (s5-0 (method-of-type res-lump get-property-value)) - (s1-0 arg2) - ) + (s1-0 arg2)) (format (clear *res-key-string*) "~S~S" 'focalpull-flags '-on) - (let ((s5-1 (s5-0 - s1-0 - (string->symbol *res-key-string*) - 'interp - (the-as float -1000000000.0) - (the-as uint128 0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - (s1-1 (method-of-type res-lump get-property-value)) - ) + (let ((s5-1 (s5-0 s1-0 + (string->symbol *res-key-string*) + 'interp + (the-as float -1000000000.0) + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf*)) + (s1-1 (method-of-type res-lump get-property-value))) (format (clear *res-key-string*) "~S~S" 'focalpull-flags '-off) - (let ((s3-1 - (s1-1 - arg2 - (string->symbol *res-key-string*) - 'interp - (the-as float -1000000000.0) - (the-as uint128 0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) + (let ((s3-1 (s1-1 arg2 + (string->symbol *res-key-string*) + 'interp + (the-as float -1000000000.0) + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf*))) (when arg0 (format #t "setup focalpull-flags ") (cam-index-options->string (the-as cam-index-options s4-0) #t) @@ -1495,51 +1011,32 @@ (format #t "~%") (let ((s4-1 (logclear (logior s4-0 s5-1) s3-1))) (format #t "final ") - (cam-index-options->string (the-as cam-index-options s4-1) #t) - ) - (format #t "~%") - ) + (cam-index-options->string (the-as cam-index-options s4-1) #t)) + (format #t "~%")) (format arg1 " tag focalpull-flags-on 0x~X // int32~%" s5-1) - (the-as - string - (format arg1 " tag focalpull-flags-off 0x~X // int32~%" s3-1) - ) - ) - ) - ) - ) + (the-as string (format arg1 " tag focalpull-flags-off 0x~X // int32~%" s3-1)))))) (defun cam-layout-save-campoints-flags ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((s4-0 (res-lump-value arg2 'campoints-flags uint128 :time (the-as float -1000000000.0))) (s5-0 (method-of-type res-lump get-property-value)) - (s1-0 arg2) - ) + (s1-0 arg2)) (format (clear *res-key-string*) "~S~S" 'campoints-flags '-on) - (let ((s5-1 (s5-0 - s1-0 - (string->symbol *res-key-string*) - 'interp - (the-as float -1000000000.0) - (the-as uint128 0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - (s1-1 (method-of-type res-lump get-property-value)) - ) + (let ((s5-1 (s5-0 s1-0 + (string->symbol *res-key-string*) + 'interp + (the-as float -1000000000.0) + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf*)) + (s1-1 (method-of-type res-lump get-property-value))) (format (clear *res-key-string*) "~S~S" 'campoints-flags '-off) - (let ((s3-1 - (s1-1 - arg2 - (string->symbol *res-key-string*) - 'interp - (the-as float -1000000000.0) - (the-as uint128 0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) + (let ((s3-1 (s1-1 arg2 + (string->symbol *res-key-string*) + 'interp + (the-as float -1000000000.0) + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf*))) (when arg0 (format #t "setup campoints-flags ") (cam-index-options->string (the-as cam-index-options s4-0) #t) @@ -1552,552 +1049,319 @@ (format #t "~%") (let ((s4-1 (logclear (logior s4-0 s5-1) s3-1))) (format #t "final ") - (cam-index-options->string (the-as cam-index-options s4-1) #t) - ) - (format #t "~%") - ) + (cam-index-options->string (the-as cam-index-options s4-1) #t)) + (format #t "~%")) (format arg1 " tag campoints-flags-on 0x~X // int32~%" s5-1) - (the-as - string - (format arg1 " tag campoints-flags-off 0x~X // int32~%" s3-1) - ) - ) - ) - ) - ) + (the-as string (format arg1 " tag campoints-flags-off 0x~X // int32~%" s3-1)))))) (defun cam-layout-save-introsplinetime ((arg0 symbol) (arg1 string) (arg2 entity-actor)) - (let ((f30-0 ((method-of-type res-lump get-property-value-float) - arg2 - 'intro-time - 'interp - (the-as float -1000000000.0) - (the-as float 0.0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - (s3-0 (method-of-type res-lump get-property-value-float)) - ) + (let ((f30-0 ((method-of-type res-lump get-property-value-float) arg2 + 'intro-time + 'interp + (the-as float -1000000000.0) + (the-as float 0.0) + (the-as (pointer res-tag) #f) + *res-static-buf*)) + (s3-0 (method-of-type res-lump get-property-value-float))) (format (clear *res-key-string*) "~S~S" 'intro-time '-offset) - (let ((f28-0 - (s3-0 - arg2 - (string->symbol *res-key-string*) - 'interp - (the-as float -1000000000.0) - (the-as float 0.0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) + (let ((f28-0 (s3-0 arg2 + (string->symbol *res-key-string*) + 'interp + (the-as float -1000000000.0) + (the-as float 0.0) + (the-as (pointer res-tag) #f) + *res-static-buf*))) (cond - ((= f30-0 0.0) - (if arg0 - (format #t "setup intro-time 0.0 (defaults to 1 sec)~%") - ) - (set! f30-0 1.0) - ) - (arg0 - (format #t "setup intro-time ~f~%" f30-0) - ) - ) - (the-as - string - (when (!= f28-0 0.0) - (when arg0 - (format #t "offset ~f~%" f28-0) - (format #t "final ~f~%" (+ f30-0 f28-0)) - ) - (format arg1 " tag intro-time-offset SECONDS(~f) // float~%" f28-0) - ) - ) - ) - ) - ) + ((= f30-0 0.0) (if arg0 (format #t "setup intro-time 0.0 (defaults to 1 sec)~%")) (set! f30-0 1.0)) + (arg0 (format #t "setup intro-time ~f~%" f30-0))) + (the-as string + (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~f~%" f28-0) + (format #t "final ~f~%" (+ f30-0 f28-0))) + (format arg1 " tag intro-time-offset SECONDS(~f) // float~%" f28-0)))))) (defun cam-layout-save-introsplineexitval ((arg0 symbol) (arg1 string) (arg2 entity-actor)) - (let ((f30-0 ((method-of-type res-lump get-property-value-float) - arg2 - 'intro-exitValue - 'interp - (the-as float -1000000000.0) - (the-as float 0.0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - (s3-0 (method-of-type res-lump get-property-value-float)) - ) + (let ((f30-0 ((method-of-type res-lump get-property-value-float) arg2 + 'intro-exitValue + 'interp + (the-as float -1000000000.0) + (the-as float 0.0) + (the-as (pointer res-tag) #f) + *res-static-buf*)) + (s3-0 (method-of-type res-lump get-property-value-float))) (format (clear *res-key-string*) "~S~S" 'intro-exitValue '-offset) - (let ((f28-0 - (s3-0 - arg2 - (string->symbol *res-key-string*) - 'interp - (the-as float -1000000000.0) - (the-as float 0.0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) + (let ((f28-0 (s3-0 arg2 + (string->symbol *res-key-string*) + 'interp + (the-as float -1000000000.0) + (the-as float 0.0) + (the-as (pointer res-tag) #f) + *res-static-buf*))) (when arg0 - (if (= f30-0 0.0) - (format #t "setup intro-exitValue 0.0 (defaults to 0.5)~%") - (format #t "setup intro-exitValue ~f~%" f30-0) - ) - ) - (the-as - string - (when (!= f28-0 0.0) - (when arg0 - (format #t "offset ~f~%" f28-0) - (format #t "final ~f~%" (+ f30-0 f28-0)) - ) - (format arg1 " tag intro-exitValue-offset ~f // float~%" f28-0) - ) - ) - ) - ) - ) + (if (= f30-0 0.0) (format #t "setup intro-exitValue 0.0 (defaults to 0.5)~%") (format #t "setup intro-exitValue ~f~%" f30-0))) + (the-as string + (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~f~%" f28-0) + (format #t "final ~f~%" (+ f30-0 f28-0))) + (format arg1 " tag intro-exitValue-offset ~f // float~%" f28-0)))))) (defun cam-layout-save-interptime ((arg0 symbol) (arg1 string) (arg2 entity-actor)) - (let ((f30-0 ((method-of-type res-lump get-property-value-float) - arg2 - 'interpTime - 'interp - (the-as float -1000000000.0) - (the-as float 0.0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - (s3-0 (method-of-type res-lump get-property-value-float)) - ) + (let ((f30-0 ((method-of-type res-lump get-property-value-float) arg2 + 'interpTime + 'interp + (the-as float -1000000000.0) + (the-as float 0.0) + (the-as (pointer res-tag) #f) + *res-static-buf*)) + (s3-0 (method-of-type res-lump get-property-value-float))) (format (clear *res-key-string*) "~S~S" 'interpTime '-offset) - (let ((f28-0 - (s3-0 - arg2 - (string->symbol *res-key-string*) - 'interp - (the-as float -1000000000.0) - (the-as float 0.0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - (if arg0 - (format #t "setup interpTime ~f~%" f30-0) - ) - (the-as - string - (when (!= f28-0 0.0) - (when arg0 - (format #t "offset ~f~%" f28-0) - (format #t "final ~f~%" (+ f30-0 f28-0)) - ) - (format arg1 " tag interpTime-offset SECONDS(~f) // float~%" f28-0) - ) - ) - ) - ) - ) + (let ((f28-0 (s3-0 arg2 + (string->symbol *res-key-string*) + 'interp + (the-as float -1000000000.0) + (the-as float 0.0) + (the-as (pointer res-tag) #f) + *res-static-buf*))) + (if arg0 (format #t "setup interpTime ~f~%" f30-0)) + (the-as string + (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~f~%" f28-0) + (format #t "final ~f~%" (+ f30-0 f28-0))) + (format arg1 " tag interpTime-offset SECONDS(~f) // float~%" f28-0)))))) (defun cam-layout-save-splineoffset ((arg0 symbol) (arg1 string) (arg2 entity-actor)) - (the-as - string - (when (and (not (res-lump-struct arg2 'pivot structure :time (the-as float -1000000000.0))) - (res-lump-struct arg2 'spline-offset structure :time (the-as float -1000000000.0)) - ) - (let ((s4-1 (res-lump-struct arg2 'spline-offset vector :time (the-as float -1000000000.0)))) - (when s4-1 - (if arg0 - (format #t "spline offset ~M ~M ~M~%" (-> s4-1 x) (-> s4-1 y) (-> s4-1 z)) - ) - (format - arg1 - " tag spline-offset METERS(~M) METERS(~M) METERS(~M) 1.0 // vector~%" - (-> s4-1 x) - (-> s4-1 y) - (-> s4-1 z) - ) - ) - ) - ) - ) - ) + (the-as string + (when (and (not (res-lump-struct arg2 'pivot structure :time (the-as float -1000000000.0))) + (res-lump-struct arg2 'spline-offset structure :time (the-as float -1000000000.0))) + (let ((s4-1 (res-lump-struct arg2 'spline-offset vector :time (the-as float -1000000000.0)))) + (when s4-1 + (if arg0 (format #t "spline offset ~M ~M ~M~%" (-> s4-1 x) (-> s4-1 y) (-> s4-1 z))) + (format arg1 + " tag spline-offset METERS(~M) METERS(~M) METERS(~M) 1.0 // vector~%" + (-> s4-1 x) + (-> s4-1 y) + (-> s4-1 z))))))) (defun cam-layout-save-spline-follow-dist-offset ((arg0 symbol) (arg1 string) (arg2 entity-actor)) - (the-as string (when (and (not (res-lump-struct arg2 'pivot structure :time (the-as float -1000000000.0))) - ((method-of-type res-lump get-property-value-float) - arg2 - 'spline-follow-dist-offset - 'interp - (the-as float -1000000000.0) - (the-as float #f) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - (let ((f30-0 ((method-of-type res-lump get-property-value-float) - arg2 - 'spline-follow-dist-offset - 'interp - (the-as float -1000000000.0) - (the-as float 0.0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - (when (the int f30-0) - (if arg0 - (format #t "spline follow dist offset ~M~%" f30-0) - ) - (format arg1 " tag spline-follow-dist-offset METERS(~M)~%" f30-0) - ) - ) - ) - ) - ) + (the-as string + (when (and (not (res-lump-struct arg2 'pivot structure :time (the-as float -1000000000.0))) + ((method-of-type res-lump get-property-value-float) arg2 + 'spline-follow-dist-offset + 'interp + (the-as float -1000000000.0) + (the-as float #f) + (the-as (pointer res-tag) #f) + *res-static-buf*)) + (let ((f30-0 ((method-of-type res-lump get-property-value-float) arg2 + 'spline-follow-dist-offset + 'interp + (the-as float -1000000000.0) + (the-as float 0.0) + (the-as (pointer res-tag) #f) + *res-static-buf*))) + (when (the int f30-0) + (if arg0 (format #t "spline follow dist offset ~M~%" f30-0)) + (format arg1 " tag spline-follow-dist-offset METERS(~M)~%" f30-0)))))) (defun cam-layout-save-campointsoffset ((arg0 symbol) (arg1 string) (arg2 entity-actor)) (let ((s5-0 (res-lump-struct arg2 'campoints-offset vector :time (the-as float -1000000000.0)))) - (the-as string (when s5-0 - (if arg0 - (format #t "index offset ~M ~M ~M~%" (-> s5-0 x) (-> s5-0 y) (-> s5-0 z)) - ) - (format - arg1 - " tag campoints-offset METERS(~M) METERS(~M) METERS(~M) 1.0 // vector~%" - (-> s5-0 x) - (-> s5-0 y) - (-> s5-0 z) - ) - ) - ) - ) - ) + (the-as string + (when s5-0 + (if arg0 (format #t "index offset ~M ~M ~M~%" (-> s5-0 x) (-> s5-0 y) (-> s5-0 z))) + (format arg1 + " tag campoints-offset METERS(~M) METERS(~M) METERS(~M) 1.0 // vector~%" + (-> s5-0 x) + (-> s5-0 y) + (-> s5-0 z)))))) (defun cam-layout-save-tiltAdjust ((arg0 symbol) (arg1 string) (arg2 entity-actor)) - (let ((f30-0 ((method-of-type res-lump get-property-value-float) - arg2 - 'tiltAdjust - 'interp - (the-as float -1000000000.0) - (the-as float 0.0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - (s3-0 (method-of-type res-lump get-property-value-float)) - ) + (let ((f30-0 ((method-of-type res-lump get-property-value-float) arg2 + 'tiltAdjust + 'interp + (the-as float -1000000000.0) + (the-as float 0.0) + (the-as (pointer res-tag) #f) + *res-static-buf*)) + (s3-0 (method-of-type res-lump get-property-value-float))) (format (clear *res-key-string*) "~S~S" 'tiltAdjust '-offset) - (let ((f28-0 - (s3-0 - arg2 - (string->symbol *res-key-string*) - 'interp - (the-as float -1000000000.0) - (the-as float 0.0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - (if arg0 - (format #t "setup tiltAdjust deg ~R~%" f30-0) - ) - (the-as - string - (when (!= f28-0 0.0) - (when arg0 - (format #t "offset ~R~%" f28-0) - (format #t "final ~R~%" (+ f30-0 f28-0)) - ) - (format arg1 " tag tiltAdjust-offset DEG(~R) // float~%" f28-0) - ) - ) - ) - ) - ) + (let ((f28-0 (s3-0 arg2 + (string->symbol *res-key-string*) + 'interp + (the-as float -1000000000.0) + (the-as float 0.0) + (the-as (pointer res-tag) #f) + *res-static-buf*))) + (if arg0 (format #t "setup tiltAdjust deg ~R~%" f30-0)) + (the-as string + (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~R~%" f28-0) + (format #t "final ~R~%" (+ f30-0 f28-0))) + (format arg1 " tag tiltAdjust-offset DEG(~R) // float~%" f28-0)))))) (defun cam-layout-save-stringMinLength ((arg0 symbol) (arg1 string) (arg2 entity-actor)) - (let ((f30-0 ((method-of-type res-lump get-property-value-float) - arg2 - 'stringMinLength - 'interp - (the-as float -1000000000.0) - (the-as float 0.0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - (s3-0 (method-of-type res-lump get-property-value-float)) - ) + (let ((f30-0 ((method-of-type res-lump get-property-value-float) arg2 + 'stringMinLength + 'interp + (the-as float -1000000000.0) + (the-as float 0.0) + (the-as (pointer res-tag) #f) + *res-static-buf*)) + (s3-0 (method-of-type res-lump get-property-value-float))) (format (clear *res-key-string*) "~S~S" 'stringMinLength '-offset) - (let ((f28-0 - (s3-0 - arg2 - (string->symbol *res-key-string*) - 'interp - (the-as float -1000000000.0) - (the-as float 0.0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - (if arg0 - (format #t "setup stringMinLength ~M~%" f30-0) - ) - (the-as - string - (when (!= f28-0 0.0) - (when arg0 - (format #t "offset ~M~%" f28-0) - (format #t "final ~M~%" (+ f30-0 f28-0)) - ) - (format arg1 " tag stringMinLength-offset METERS(~M) // float~%" f28-0) - ) - ) - ) - ) - ) + (let ((f28-0 (s3-0 arg2 + (string->symbol *res-key-string*) + 'interp + (the-as float -1000000000.0) + (the-as float 0.0) + (the-as (pointer res-tag) #f) + *res-static-buf*))) + (if arg0 (format #t "setup stringMinLength ~M~%" f30-0)) + (the-as string + (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~M~%" f28-0) + (format #t "final ~M~%" (+ f30-0 f28-0))) + (format arg1 " tag stringMinLength-offset METERS(~M) // float~%" f28-0)))))) (defun cam-layout-save-stringMaxLength ((arg0 symbol) (arg1 string) (arg2 entity-actor)) - (let ((f30-0 ((method-of-type res-lump get-property-value-float) - arg2 - 'stringMaxLength - 'interp - (the-as float -1000000000.0) - (the-as float 0.0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - (s3-0 (method-of-type res-lump get-property-value-float)) - ) + (let ((f30-0 ((method-of-type res-lump get-property-value-float) arg2 + 'stringMaxLength + 'interp + (the-as float -1000000000.0) + (the-as float 0.0) + (the-as (pointer res-tag) #f) + *res-static-buf*)) + (s3-0 (method-of-type res-lump get-property-value-float))) (format (clear *res-key-string*) "~S~S" 'stringMaxLength '-offset) - (let ((f28-0 - (s3-0 - arg2 - (string->symbol *res-key-string*) - 'interp - (the-as float -1000000000.0) - (the-as float 0.0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - (if arg0 - (format #t "setup stringMaxLength ~M~%" f30-0) - ) - (the-as - string - (when (!= f28-0 0.0) - (when arg0 - (format #t "offset ~M~%" f28-0) - (format #t "final ~M~%" (+ f30-0 f28-0)) - ) - (format arg1 " tag stringMaxLength-offset METERS(~M) // float~%" f28-0) - ) - ) - ) - ) - ) + (let ((f28-0 (s3-0 arg2 + (string->symbol *res-key-string*) + 'interp + (the-as float -1000000000.0) + (the-as float 0.0) + (the-as (pointer res-tag) #f) + *res-static-buf*))) + (if arg0 (format #t "setup stringMaxLength ~M~%" f30-0)) + (the-as string + (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~M~%" f28-0) + (format #t "final ~M~%" (+ f30-0 f28-0))) + (format arg1 " tag stringMaxLength-offset METERS(~M) // float~%" f28-0)))))) (defun cam-layout-save-stringMinHeight ((arg0 symbol) (arg1 string) (arg2 entity-actor)) - (let ((f30-0 ((method-of-type res-lump get-property-value-float) - arg2 - 'stringMinHeight - 'interp - (the-as float -1000000000.0) - (the-as float 0.0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - (s3-0 (method-of-type res-lump get-property-value-float)) - ) + (let ((f30-0 ((method-of-type res-lump get-property-value-float) arg2 + 'stringMinHeight + 'interp + (the-as float -1000000000.0) + (the-as float 0.0) + (the-as (pointer res-tag) #f) + *res-static-buf*)) + (s3-0 (method-of-type res-lump get-property-value-float))) (format (clear *res-key-string*) "~S~S" 'stringMinHeight '-offset) - (let ((f28-0 - (s3-0 - arg2 - (string->symbol *res-key-string*) - 'interp - (the-as float -1000000000.0) - (the-as float 0.0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - (if arg0 - (format #t "setup stringMinHeight ~M~%" f30-0) - ) - (the-as - string - (when (!= f28-0 0.0) - (when arg0 - (format #t "offset ~M~%" f28-0) - (format #t "final ~M~%" (+ f30-0 f28-0)) - ) - (format arg1 " tag stringMinHeight-offset METERS(~M) // float~%" f28-0) - ) - ) - ) - ) - ) + (let ((f28-0 (s3-0 arg2 + (string->symbol *res-key-string*) + 'interp + (the-as float -1000000000.0) + (the-as float 0.0) + (the-as (pointer res-tag) #f) + *res-static-buf*))) + (if arg0 (format #t "setup stringMinHeight ~M~%" f30-0)) + (the-as string + (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~M~%" f28-0) + (format #t "final ~M~%" (+ f30-0 f28-0))) + (format arg1 " tag stringMinHeight-offset METERS(~M) // float~%" f28-0)))))) (defun cam-layout-save-stringMaxHeight ((arg0 symbol) (arg1 string) (arg2 entity-actor)) - (let ((f30-0 ((method-of-type res-lump get-property-value-float) - arg2 - 'stringMaxHeight - 'interp - (the-as float -1000000000.0) - (the-as float 0.0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - (s3-0 (method-of-type res-lump get-property-value-float)) - ) + (let ((f30-0 ((method-of-type res-lump get-property-value-float) arg2 + 'stringMaxHeight + 'interp + (the-as float -1000000000.0) + (the-as float 0.0) + (the-as (pointer res-tag) #f) + *res-static-buf*)) + (s3-0 (method-of-type res-lump get-property-value-float))) (format (clear *res-key-string*) "~S~S" 'stringMaxHeight '-offset) - (let ((f28-0 - (s3-0 - arg2 - (string->symbol *res-key-string*) - 'interp - (the-as float -1000000000.0) - (the-as float 0.0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - (if arg0 - (format #t "setup stringMaxHeight ~M~%" f30-0) - ) - (the-as - string - (when (!= f28-0 0.0) - (when arg0 - (format #t "offset ~M~%" f28-0) - (format #t "final ~M~%" (+ f30-0 f28-0)) - ) - (format arg1 " tag stringMaxHeight-offset METERS(~M) // float~%" f28-0) - ) - ) - ) - ) - ) + (let ((f28-0 (s3-0 arg2 + (string->symbol *res-key-string*) + 'interp + (the-as float -1000000000.0) + (the-as float 0.0) + (the-as (pointer res-tag) #f) + *res-static-buf*))) + (if arg0 (format #t "setup stringMaxHeight ~M~%" f30-0)) + (the-as string + (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~M~%" f28-0) + (format #t "final ~M~%" (+ f30-0 f28-0))) + (format arg1 " tag stringMaxHeight-offset METERS(~M) // float~%" f28-0)))))) (defun cam-layout-save-stringCliffHeight ((arg0 symbol) (arg1 string) (arg2 entity-actor)) - (let ((f30-0 ((method-of-type res-lump get-property-value-float) - arg2 - 'stringCliffHeight - 'interp - (the-as float -1000000000.0) - (the-as float 0.0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - (s3-0 (method-of-type res-lump get-property-value-float)) - ) + (let ((f30-0 ((method-of-type res-lump get-property-value-float) arg2 + 'stringCliffHeight + 'interp + (the-as float -1000000000.0) + (the-as float 0.0) + (the-as (pointer res-tag) #f) + *res-static-buf*)) + (s3-0 (method-of-type res-lump get-property-value-float))) (format (clear *res-key-string*) "~S~S" 'stringCliffHeight '-offset) - (let ((f28-0 - (s3-0 - arg2 - (string->symbol *res-key-string*) - 'interp - (the-as float -1000000000.0) - (the-as float 0.0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - (if arg0 - (format #t "setup stringCliffHeight ~M~%" f30-0) - ) - (the-as - string - (when (!= f28-0 0.0) - (when arg0 - (format #t "offset ~M~%" f28-0) - (format #t "final ~M~%" (+ f30-0 f28-0)) - ) - (format arg1 " tag stringCliffHeight-offset METERS(~M) // float~%" f28-0) - ) - ) - ) - ) - ) + (let ((f28-0 (s3-0 arg2 + (string->symbol *res-key-string*) + 'interp + (the-as float -1000000000.0) + (the-as float 0.0) + (the-as (pointer res-tag) #f) + *res-static-buf*))) + (if arg0 (format #t "setup stringCliffHeight ~M~%" f30-0)) + (the-as string + (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~M~%" f28-0) + (format #t "final ~M~%" (+ f30-0 f28-0))) + (format arg1 " tag stringCliffHeight-offset METERS(~M) // float~%" f28-0)))))) (defun cam-layout-save-maxAngle ((arg0 symbol) (arg1 string) (arg2 entity-actor)) - (let ((f30-0 ((method-of-type res-lump get-property-value-float) - arg2 - 'maxAngle - 'interp - (the-as float -1000000000.0) - (the-as float 0.0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - (s3-0 (method-of-type res-lump get-property-value-float)) - ) + (let ((f30-0 ((method-of-type res-lump get-property-value-float) arg2 + 'maxAngle + 'interp + (the-as float -1000000000.0) + (the-as float 0.0) + (the-as (pointer res-tag) #f) + *res-static-buf*)) + (s3-0 (method-of-type res-lump get-property-value-float))) (format (clear *res-key-string*) "~S~S" 'maxAngle '-offset) - (let ((f28-0 (s3-0 - arg2 - (string->symbol *res-key-string*) - 'interp - (the-as float -1000000000.0) - (the-as float 0.0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - (if arg0 - (format #t "setup maxAngle ~R~%" f30-0) - ) - (the-as string (when (!= f28-0 0.0) - (when arg0 - (format #t "offset ~R~%" f28-0) - (format #t "final ~R~%" (+ f30-0 f28-0)) - ) - (format arg1 " tag maxAngle-offset DEG(~R) // float~%" f28-0) - ) - ) - ) - ) - ) + (let ((f28-0 (s3-0 arg2 + (string->symbol *res-key-string*) + 'interp + (the-as float -1000000000.0) + (the-as float 0.0) + (the-as (pointer res-tag) #f) + *res-static-buf*))) + (if arg0 (format #t "setup maxAngle ~R~%" f30-0)) + (the-as string + (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~R~%" f28-0) + (format #t "final ~R~%" (+ f30-0 f28-0))) + (format arg1 " tag maxAngle-offset DEG(~R) // float~%" f28-0)))))) (defbehavior clmf-save-single cam-layout ((arg0 entity-camera) (arg1 symbol) (arg2 symbol)) (clear *temp-string*) (if arg2 - (format - *temp-string* - "dd_next/caminfo/~s.cam" - (res-lump-struct arg0 'name structure :time (the-as float -1000000000.0)) - ) - (format *temp-string* "dd_next/caminfo/garbage") - ) + (format *temp-string* "dd_next/caminfo/~s.cam" (res-lump-struct arg0 'name structure :time (the-as float -1000000000.0))) + (format *temp-string* "dd_next/caminfo/garbage")) (let ((s4-2 (new 'stack 'file-stream *temp-string* 'write))) (if arg1 - (format - #t - "---------camera '~S'------------~%" - (res-lump-struct arg0 'name structure :time (the-as float -1000000000.0)) - ) - ) + (format #t + "---------camera '~S'------------~%" + (res-lump-struct arg0 'name structure :time (the-as float -1000000000.0)))) (format s4-2 "#include /next/config_data/standard.m2d~%") (format s4-2 "camera ~s {~%" (res-lump-struct arg0 'name structure :time (the-as float -1000000000.0))) (cam-layout-save-cam-rot arg1 (the-as string s4-2) (the-as entity-actor arg0)) @@ -2124,117 +1388,76 @@ (cam-layout-save-campoints-flags arg1 (the-as string s4-2) (the-as entity-actor arg0)) (cam-layout-save-focalpull-flags arg1 (the-as string s4-2) (the-as entity-actor arg0)) (format s4-2 "}~%") - (file-stream-close s4-2) - ) - ) + (file-stream-close s4-2))) (defbehavior clmf-save-one cam-layout ((arg0 symbol)) (let ((s5-1 (logtest? (the-as int arg0) 8)) - (gp-1 (logtest? (the-as int arg0) 16)) - ) - (if s5-1 - (format #t "~%~%~%=================================~%") - ) + (gp-1 (logtest? (the-as int arg0) 16))) + (if s5-1 (format #t "~%~%~%=================================~%")) (clmf-save-single (-> self cam-entity) s5-1 gp-1) - (if s5-1 - (format #t "===============================~%~%~%~%") - ) + (if s5-1 (format #t "===============================~%~%~%~%")) (if gp-1 - (format - #t - "'~S' save completed~%" - (res-lump-struct (-> self cam-entity) 'name structure :time (the-as float -1000000000.0)) - ) - ) - ) - #t - ) + (format #t + "'~S' save completed~%" + (res-lump-struct (-> self cam-entity) 'name structure :time (the-as float -1000000000.0))))) + #t) (defbehavior clmf-save-all cam-layout ((arg0 symbol)) (let ((s5-1 (logtest? (the-as int arg0) 8)) - (gp-1 (logtest? (the-as int arg0) 16)) - ) - (if s5-1 - (format #t "~%~%~%=================================~%") - ) + (gp-1 (logtest? (the-as int arg0) 16))) + (if s5-1 (format #t "~%~%~%=================================~%")) (let ((v1-5 (-> *camera-engine* alive-list next0))) *camera-engine* (let ((s4-0 (-> v1-5 next0))) (while (!= v1-5 (-> *camera-engine* alive-list-end)) - (let ((a0-4 (-> (the-as connection v1-5) param1))) - (clmf-save-single (the-as entity-camera a0-4) s5-1 gp-1) - ) + (let ((a0-4 (-> (the-as connection v1-5) param1))) (clmf-save-single (the-as entity-camera a0-4) s5-1 gp-1)) (set! v1-5 s4-0) *camera-engine* - (set! s4-0 (-> s4-0 next0)) - ) - ) - ) - (if s5-1 - (format #t "===============================~%~%~%~%") - ) - (if gp-1 - (format #t "camera save all completed~%") - ) - ) - #t - ) + (set! s4-0 (-> s4-0 next0))))) + (if s5-1 (format #t "===============================~%~%~%~%")) + (if gp-1 (format #t "camera save all completed~%"))) + #t) (deftype clmf-cam-flag-toggle-info (structure) - ((key float) - (force-on int32) - (force-off int32) - ) - ) - + ((key float) + (force-on int32) + (force-off int32))) (defbehavior clmf-cam-flag-toggle cam-layout ((arg0 int) (arg1 int)) (let ((s4-0 (/ arg0 8)) - (gp-0 (new 'stack 'clmf-cam-flag-toggle-info)) - ) + (gp-0 (new 'stack 'clmf-cam-flag-toggle-info))) (set! (-> gp-0 key) (-> self res-key)) (cond ((and (= arg1 'vol-flags) (>= (-> self res-key) (the float (-> self first-cutoutvol)))) (set! (-> gp-0 key) (- (-> gp-0 key) (the float (-> self first-cutoutvol)))) - (set! arg1 (the-as int 'cutoutvol-flags)) - ) + (set! arg1 (the-as int 'cutoutvol-flags))) ((and (= arg1 'vol-flags) (>= (-> self res-key) (the float (-> self first-pvol)))) (set! (-> gp-0 key) (- (-> gp-0 key) (the float (-> self first-pvol)))) - (set! arg1 (the-as int 'pvol-flags)) - ) - ) + (set! arg1 (the-as int 'pvol-flags)))) (let ((s3-0 (method-of-type res-lump get-property-value)) - (s2-0 (-> self cam-entity)) - ) + (s2-0 (-> self cam-entity))) (format (clear *res-key-string*) "~S~S" (the-as object arg1) '-on) - (set! (-> gp-0 force-on) (the-as int (s3-0 - s2-0 - (string->symbol *res-key-string*) - 'exact - (-> gp-0 key) - (the-as uint128 0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - ) + (set! (-> gp-0 force-on) + (the-as int + (s3-0 s2-0 + (string->symbol *res-key-string*) + 'exact + (-> gp-0 key) + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf*)))) (let ((s3-1 (method-of-type res-lump get-property-value)) - (s2-1 (-> self cam-entity)) - ) + (s2-1 (-> self cam-entity))) (format (clear *res-key-string*) "~S~S" (the-as object arg1) '-off) - (set! (-> gp-0 force-off) (the-as int (s3-1 - s2-1 - (string->symbol *res-key-string*) - 'exact - (-> gp-0 key) - (the-as uint128 0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - ) + (set! (-> gp-0 force-off) + (the-as int + (s3-1 s2-1 + (string->symbol *res-key-string*) + 'exact + (-> gp-0 key) + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf*)))) (cond ((logtest? (-> gp-0 force-off) s4-0) (logclear! (-> gp-0 force-off) s4-0) @@ -2242,1113 +1465,1132 @@ (let* ((s4-1 (-> self cam-entity)) (s3-2 (method-of-object s4-1 add-32bit-data!)) (s2-2 (logior (shl #x10000 32) (shr (shl (the-as int int32) 32) 32))) - (s1-2 (shl (the-as int (-> gp-0 key)) 32)) - ) + (s1-2 (shl (the-as int (-> gp-0 key)) 32))) (format (clear *res-key-string*) "~S~S" (the-as object arg1) '-off) - (s3-2 - s4-1 - (the-as - res-tag - (make-u128 s2-2 (logior s1-2 (shr (shl (the-as int (string->symbol *res-key-string*)) 32) 32))) - ) - (-> gp-0 force-off) - ) - ) + (s3-2 s4-1 + (the-as res-tag (make-u128 s2-2 (logior s1-2 (shr (shl (the-as int (string->symbol *res-key-string*)) 32) 32)))) + (-> gp-0 force-off))) (let* ((s4-2 (-> self cam-entity)) (s3-3 (method-of-object s4-2 add-32bit-data!)) (s2-3 (logior (shl #x10000 32) (shr (shl (the-as int int32) 32) 32))) - (s1-3 (shl (the-as int (-> gp-0 key)) 32)) - ) + (s1-3 (shl (the-as int (-> gp-0 key)) 32))) (format (clear *res-key-string*) "~S~S" (the-as object arg1) '-on) - (s3-3 - s4-2 - (the-as - res-tag - (make-u128 s2-3 (logior s1-3 (shr (shl (the-as int (string->symbol *res-key-string*)) 32) 32))) - ) - (-> gp-0 force-on) - ) - ) - ) + (s3-3 s4-2 + (the-as res-tag (make-u128 s2-3 (logior s1-3 (shr (shl (the-as int (string->symbol *res-key-string*)) 32) 32)))) + (-> gp-0 force-on)))) ((logtest? (-> gp-0 force-on) s4-0) (logclear! (-> gp-0 force-on) s4-0) (let* ((s4-3 (-> self cam-entity)) (s3-4 (method-of-object s4-3 add-32bit-data!)) (s2-4 (logior (shl #x10000 32) (shr (shl (the-as int int32) 32) 32))) - (s1-4 (shl (the-as int (-> gp-0 key)) 32)) - ) + (s1-4 (shl (the-as int (-> gp-0 key)) 32))) (format (clear *res-key-string*) "~S~S" (the-as object arg1) '-on) - (s3-4 - s4-3 - (the-as - res-tag - (make-u128 s2-4 (logior s1-4 (shr (shl (the-as int (string->symbol *res-key-string*)) 32) 32))) - ) - (-> gp-0 force-on) - ) - ) - ) + (s3-4 s4-3 + (the-as res-tag (make-u128 s2-4 (logior s1-4 (shr (shl (the-as int (string->symbol *res-key-string*)) 32) 32)))) + (-> gp-0 force-on)))) (else - (logior! (-> gp-0 force-off) s4-0) - (let* ((s4-4 (-> self cam-entity)) - (s3-5 (method-of-object s4-4 add-32bit-data!)) - (s2-5 (logior (shl #x10000 32) (shr (shl (the-as int int32) 32) 32))) - (s1-5 (shl (the-as int (-> gp-0 key)) 32)) - ) - (format (clear *res-key-string*) "~S~S" (the-as object arg1) '-off) - (s3-5 - s4-4 - (the-as - res-tag - (make-u128 s2-5 (logior s1-5 (shr (shl (the-as int (string->symbol *res-key-string*)) 32) 32))) - ) - (-> gp-0 force-off) - ) - ) - ) - ) - ) - #t - ) + (logior! (-> gp-0 force-off) s4-0) + (let* ((s4-4 (-> self cam-entity)) + (s3-5 (method-of-object s4-4 add-32bit-data!)) + (s2-5 (logior (shl #x10000 32) (shr (shl (the-as int int32) 32) 32))) + (s1-5 (shl (the-as int (-> gp-0 key)) 32))) + (format (clear *res-key-string*) "~S~S" (the-as object arg1) '-off) + (s3-5 s4-4 + (the-as res-tag (make-u128 s2-5 (logior s1-5 (shr (shl (the-as int (string->symbol *res-key-string*)) 32) 32)))) + (-> gp-0 force-off)))))) + #t) (defbehavior clmf-cam-flag cam-layout ((arg0 string) (arg1 uint) (arg2 uint)) (let ((s5-0 (/ (the-as int arg1) 8)) - (f30-0 (-> self res-key)) - ) + (f30-0 (-> self res-key))) (cond ((and (= arg2 'vol-flags) (>= (-> self res-key) (the float (-> self first-cutoutvol)))) (set! f30-0 (- f30-0 (the float (-> self first-cutoutvol)))) - (set! arg2 (the-as uint 'cutoutvol-flags)) - ) + (set! arg2 (the-as uint 'cutoutvol-flags))) ((and (= arg2 'vol-flags) (>= (-> self res-key) (the float (-> self first-pvol)))) (set! f30-0 (- f30-0 (the float (-> self first-pvol)))) - (set! arg2 (the-as uint 'pvol-flags)) - ) - ) + (set! arg2 (the-as uint 'pvol-flags)))) (let ((s3-0 (method-of-type res-lump get-property-value)) - (s2-0 (-> self cam-entity)) - ) + (s2-0 (-> self cam-entity))) (format (clear *res-key-string*) "~S~S" (the-as object arg2) '-off) (cond - ((logtest? (s3-0 - s2-0 - (string->symbol *res-key-string*) - 'exact - f30-0 - (the-as uint128 0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - s5-0 - ) - (format arg0 ": off") - ) - ((let ((s3-1 (method-of-type res-lump get-property-value)) - (s2-1 (-> self cam-entity)) - ) - (format (clear *res-key-string*) "~S~S" (the-as object arg2) '-on) - (logtest? (s3-1 - s2-1 - (string->symbol *res-key-string*) - 'exact - f30-0 - (the-as uint128 0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - s5-0 - ) - ) - (format arg0 ": on") - ) - ((not (logtest? ((method-of-type res-lump get-property-value) - (-> self cam-entity) - (the-as symbol arg2) + ((logtest? (s3-0 s2-0 + (string->symbol *res-key-string*) 'exact f30-0 (the-as uint128 0) (the-as (pointer res-tag) #f) - *res-static-buf* - ) - s5-0 - ) - ) - (format arg0 ": off(maya)") - ) - (else - (format arg0 ": on(maya)") - ) - ) - ) - ) - #t - ) + *res-static-buf*) + s5-0) + (format arg0 ": off")) + ((let ((s3-1 (method-of-type res-lump get-property-value)) + (s2-1 (-> self cam-entity))) + (format (clear *res-key-string*) "~S~S" (the-as object arg2) '-on) + (logtest? (s3-1 s2-1 + (string->symbol *res-key-string*) + 'exact + f30-0 + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf*) + s5-0)) + (format arg0 ": on")) + ((not (logtest? ((method-of-type res-lump get-property-value) (-> self cam-entity) + (the-as symbol arg2) + 'exact + f30-0 + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf*) + s5-0)) + (format arg0 ": off(maya)")) + (else (format arg0 ": on(maya)"))))) + #t) (defbehavior clmf-cam-float-adjust cam-layout ((arg0 symbol) (arg1 (pointer float))) (cam-layout-print 16 *camera-layout-message-ypos* "left stick adjusts value") (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8)) - (let ((f30-0 ((method-of-type res-lump get-property-value-float) - (-> self cam-entity) - arg0 - 'interp - (the-as float -1000000000.0) - (the-as float 0.0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - (f0-0 (-> arg1 0)) - ) - (if (= f0-0 0.0) - (set! f0-0 1.0) - ) - (let ((f0-2 - (+ f30-0 - (analog-input - (the-as int (-> *cpad-list* cpads 0 leftx)) - (the-as float 128.0) - (the-as float 48.0) - (the-as float 110.0) - f0-0 - ) - ) - ) - ) - (add-32bit-data! - (-> self cam-entity) - (new 'static 'res-tag :name arg0 :key-frame -1000000000.0 :elt-count #x1 :elt-type float) - f0-2 - ) - ) - ) + (let ((f30-0 ((method-of-type res-lump get-property-value-float) (-> self cam-entity) + arg0 + 'interp + (the-as float -1000000000.0) + (the-as float 0.0) + (the-as (pointer res-tag) #f) + *res-static-buf*)) + (f0-0 (-> arg1 0))) + (if (= f0-0 0.0) (set! f0-0 1.0)) + (let ((f0-2 (+ f30-0 + (analog-input (the-as int (-> *cpad-list* cpads 0 leftx)) + (the-as float 128.0) + (the-as float 48.0) + (the-as float 110.0) + f0-0)))) + (add-32bit-data! (-> self cam-entity) + (new 'static 'res-tag :name arg0 :key-frame -1000000000.0 :elt-count #x1 :elt-type float) + f0-2))) (set! *camera-read-analog* #f) - #t - ) + #t) (defbehavior clmf-cam-meters cam-layout ((arg0 meters) (arg1 symbol)) - (let ((f0-0 (cam-slave-get-float (-> self cam-entity) arg1 (the-as float 0.0)))) - (format arg0 ": ~M" f0-0) - ) - #t - ) + (let ((f0-0 (cam-slave-get-float (-> self cam-entity) arg1 (the-as float 0.0)))) (format arg0 ": ~M" f0-0)) + #t) (defbehavior clmf-cam-fov cam-layout ((arg0 degrees) (arg1 symbol)) (format arg0 ": ~R" (cam-slave-get-fov (-> self cam-entity))) - #t - ) + #t) (defbehavior clmf-cam-deg cam-layout ((arg0 degrees) (arg1 symbol)) (format arg0 ": ~R" (cam-slave-get-float (-> self cam-entity) arg1 (the-as float 0.0))) - #t - ) + #t) (defbehavior clmf-cam-intro-time cam-layout ((arg0 float) (arg1 symbol)) (let ((f30-0 (cam-slave-get-intro-step (-> self cam-entity)))) (format arg0 ": ~f" (/ 0.016666668 f30-0)) - (set! (-> *CAM_LAYOUT-bank* intro-step) f30-0) - ) - #t - ) + (set! (-> *CAM_LAYOUT-bank* intro-step) f30-0)) + #t) (defbehavior clmf-cam-interp-time cam-layout ((arg0 float) (arg1 symbol)) (format arg0 ": ~f" (cam-slave-get-interp-time (-> self cam-entity))) - #t - ) + #t) (defbehavior clmf-cam-float cam-layout ((arg0 float) (arg1 symbol)) (format arg0 ": ~f" (cam-slave-get-float (-> self cam-entity) arg1 (the-as float 0.0))) - #t - ) + #t) (defbehavior clmf-cam-string cam-layout ((arg0 string) (arg1 symbol)) (local-vars (sv-16 res-tag)) (format arg0 ":") (set! sv-16 (new 'static 'res-tag)) - (let ((s5-1 (res-lump-data (-> self cam-entity) arg1 pointer :tag-ptr (& sv-16) :time (the-as float -1000000000.0))) - ) + (let ((s5-1 (res-lump-data (-> self cam-entity) arg1 pointer :tag-ptr (& sv-16) :time (the-as float -1000000000.0)))) (when s5-1 (dotimes (s4-0 (the-as int (-> sv-16 elt-count))) - (format arg0 " ~S" (-> (the-as (pointer uint32) (&+ s5-1 (* s4-0 4))))) - ) - ) - ) - #t - ) + (format arg0 " ~S" (-> (the-as (pointer uint32) (&+ s5-1 (* s4-0 4)))))))) + #t) (define *clm-focalpull-attr* - (new 'static 'clm - :title "---focalpull attributes--" - :items (new 'static 'boxed-array :type clm-basic - (new 'static 'clm-item - :description " ok" - :button-symbol 'square - :action (new 'static 'clm-item-action :button #x8000 :options #x1 :func '*clm-edit*) - ) - (new 'static 'clm-item - :description "adjust" - :button-symbol 'x - :action (new 'static 'clm-item-action :button #x4000 :func #f) - ) - (new 'static 'clm-list - :tracker #f - :items (new 'static 'boxed-array :type clm-list-item - (new 'static 'clm-list-item - :description "radial " - :track-val #f - :val-func 'clmf-cam-flag - :val-parm0 16 - :val-parm1-basic 'focalpull-flags - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action - :button #x4000 - :options #x1 - :func 'clmf-cam-flag-toggle - :parm0 16 - :parm1-basic 'focalpull-flags - ) - ) - ) - (new 'static 'clm-list-item - :description "spherical " - :track-val #f - :val-func 'clmf-cam-flag - :val-parm0 8 - :val-parm1-basic 'focalpull-flags - :actions (new 'static 'boxed-array :type clm-item-action (new 'static 'clm-item-action - :button #x4000 - :options #x1 - :func 'clmf-cam-flag-toggle - :parm0 8 - :parm1-basic 'focalpull-flags - ) - ) - ) - ) - ) - ) - ) - ) + (new 'static + 'clm + :title "---focalpull attributes--" + :items + (new 'static + 'boxed-array + :type + clm-basic + (new 'static + 'clm-item + :description " ok" + :button-symbol 'square + :action + (new 'static 'clm-item-action :button #x8000 :options #x1 :func '*clm-edit*)) + (new 'static + 'clm-item + :description "adjust" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :func #f)) + (new 'static + 'clm-list + :tracker #f + :items + (new 'static + 'boxed-array + :type + clm-list-item + (new 'static + 'clm-list-item + :description "radial " + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 16 + :val-parm1-basic 'focalpull-flags + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static + 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 16 + :parm1-basic 'focalpull-flags))) + (new 'static + 'clm-list-item + :description "spherical " + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 8 + :val-parm1-basic 'focalpull-flags + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static + 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 8 + :parm1-basic 'focalpull-flags)))))))) (define *clm-index-attr* - (new 'static 'clm - :title "---index attributes--" - :items (new 'static 'boxed-array :type clm-basic - (new 'static 'clm-item - :description " ok" - :button-symbol 'square - :action (new 'static 'clm-item-action :button #x8000 :options #x1 :func '*clm-edit*) - ) - (new 'static 'clm-item - :description "adjust" - :button-symbol 'x - :action (new 'static 'clm-item-action :button #x4000 :func #f) - ) - (new 'static 'clm-list - :tracker #f - :items (new 'static 'boxed-array :type clm-list-item - (new 'static 'clm-list-item - :description "radial " - :track-val #f - :val-func 'clmf-cam-flag - :val-parm0 16 - :val-parm1-basic 'campoints-flags - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action - :button #x4000 - :options #x1 - :func 'clmf-cam-flag-toggle - :parm0 16 - :parm1-basic 'campoints-flags - ) - ) - ) - (new 'static 'clm-list-item - :description "spherical " - :track-val #f - :val-func 'clmf-cam-flag - :val-parm0 8 - :val-parm1-basic 'campoints-flags - :actions (new 'static 'boxed-array :type clm-item-action (new 'static 'clm-item-action - :button #x4000 - :options #x1 - :func 'clmf-cam-flag-toggle - :parm0 8 - :parm1-basic 'campoints-flags - ) - ) - ) - ) - ) - ) - ) - ) + (new 'static + 'clm + :title "---index attributes--" + :items + (new 'static + 'boxed-array + :type + clm-basic + (new 'static + 'clm-item + :description " ok" + :button-symbol 'square + :action + (new 'static 'clm-item-action :button #x8000 :options #x1 :func '*clm-edit*)) + (new 'static + 'clm-item + :description "adjust" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :func #f)) + (new 'static + 'clm-list + :tracker #f + :items + (new 'static + 'boxed-array + :type + clm-list-item + (new 'static + 'clm-list-item + :description "radial " + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 16 + :val-parm1-basic 'campoints-flags + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static + 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 16 + :parm1-basic 'campoints-flags))) + (new 'static + 'clm-list-item + :description "spherical " + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 8 + :val-parm1-basic 'campoints-flags + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static + 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 8 + :parm1-basic 'campoints-flags)))))))) (define *clm-intro-attr* - (new 'static 'clm - :title "---intro attributes--" - :items (new 'static 'boxed-array :type clm-basic - (new 'static 'clm-item - :description " ok" - :button-symbol 'square - :action (new 'static 'clm-item-action :button #x8000 :options #x1 :func '*clm-edit*) - ) - (new 'static 'clm-item - :description "adjust" - :button-symbol 'x - :action (new 'static 'clm-item-action :button #x4000 :func #f) - ) - (new 'static 'clm-list - :tracker #f - :items (new 'static 'boxed-array :type clm-list-item - (new 'static 'clm-list-item - :description "time " - :track-val #f - :val-func 'clmf-cam-intro-time - :val-parm0-basic 'intro-time - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action - :button #x4000 - :func 'clmf-cam-float-adjust - :parm0-basic 'intro-time-offset - :parm1-basic (new 'static 'bfloat :data 0.01) - ) - ) - ) - (new 'static 'clm-list-item - :description "exitValue" - :track-val #f - :val-func 'clmf-cam-float - :val-parm0-basic 'intro-exitValue - :actions (new 'static 'boxed-array :type clm-item-action (new 'static 'clm-item-action - :button #x4000 - :func 'clmf-cam-float-adjust - :parm0-basic 'intro-exitValue-offset - :parm1-basic (new 'static 'bfloat :data 0.001) - ) - ) - ) - ) - ) - ) - ) - ) + (new 'static + 'clm + :title "---intro attributes--" + :items + (new 'static + 'boxed-array + :type + clm-basic + (new 'static + 'clm-item + :description " ok" + :button-symbol 'square + :action + (new 'static 'clm-item-action :button #x8000 :options #x1 :func '*clm-edit*)) + (new 'static + 'clm-item + :description "adjust" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :func #f)) + (new 'static + 'clm-list + :tracker #f + :items + (new 'static + 'boxed-array + :type + clm-list-item + (new 'static + 'clm-list-item + :description "time " + :track-val #f + :val-func 'clmf-cam-intro-time + :val-parm0-basic 'intro-time + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static + 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'intro-time-offset + :parm1-basic + (new 'static 'bfloat :data 0.01)))) + (new 'static + 'clm-list-item + :description "exitValue" + :track-val #f + :val-func 'clmf-cam-float + :val-parm0-basic 'intro-exitValue + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static + 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'intro-exitValue-offset + :parm1-basic + (new 'static 'bfloat :data 0.001))))))))) (define *clm-spline-attr* - (new 'static 'clm - :title "---spline attributes--" - :items (new 'static 'boxed-array :type clm-basic - (new 'static 'clm-item - :description " ok" - :button-symbol 'square - :action (new 'static 'clm-item-action :button #x8000 :options #x1 :func '*clm-edit*) - ) - (new 'static 'clm-item - :description "adjust" - :button-symbol 'x - :action (new 'static 'clm-item-action :button #x4000 :func #f) - ) - (new 'static 'clm-list - :tracker #f - :items (new 'static 'boxed-array :type clm-list-item - (new 'static 'clm-list-item - :description "followDist" - :track-val #f - :val-func 'clmf-cam-meters - :val-parm0-basic 'spline-follow-dist - :actions (new 'static 'boxed-array :type clm-item-action (new 'static 'clm-item-action - :button #x4000 - :func 'clmf-cam-float-adjust - :parm0-basic 'spline-follow-dist-offset - :parm1-basic (new 'static 'bfloat :data 409.6) - ) - ) - ) - ) - ) - ) - ) - ) + (new 'static + 'clm + :title "---spline attributes--" + :items + (new 'static + 'boxed-array + :type + clm-basic + (new 'static + 'clm-item + :description " ok" + :button-symbol 'square + :action + (new 'static 'clm-item-action :button #x8000 :options #x1 :func '*clm-edit*)) + (new 'static + 'clm-item + :description "adjust" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :func #f)) + (new 'static + 'clm-list + :tracker #f + :items + (new 'static + 'boxed-array + :type + clm-list-item + (new 'static + 'clm-list-item + :description "followDist" + :track-val #f + :val-func 'clmf-cam-meters + :val-parm0-basic 'spline-follow-dist + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static + 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'spline-follow-dist-offset + :parm1-basic + (new 'static 'bfloat :data 409.6))))))))) (define *clm-vol-attr* - (new 'static 'clm - :title "---volume attributes--" - :items (new 'static 'boxed-array :type clm-basic - (new 'static 'clm-item - :description " ok" - :button-symbol 'square - :action (new 'static 'clm-item-action :button #x8000 :options #x1 :func '*clm-edit*) - ) - (new 'static 'clm-item - :description "adjust" - :button-symbol 'x - :action (new 'static 'clm-item-action :button #x4000 :func #f) - ) - (new 'static 'clm-list - :tracker #f - :items (new 'static 'boxed-array :type clm-list-item - (new 'static 'clm-list-item - :description "airSwitch" - :track-val #f - :val-func 'clmf-cam-flag - :val-parm0 8 - :val-parm1-basic 'vol-flags - :actions (new 'static 'boxed-array :type clm-item-action (new 'static 'clm-item-action - :button #x4000 - :options #x1 - :func 'clmf-cam-flag-toggle - :parm0 8 - :parm1-basic 'vol-flags - ) - ) - ) - ) - ) - ) - ) - ) + (new 'static + 'clm + :title "---volume attributes--" + :items + (new 'static + 'boxed-array + :type + clm-basic + (new 'static + 'clm-item + :description " ok" + :button-symbol 'square + :action + (new 'static 'clm-item-action :button #x8000 :options #x1 :func '*clm-edit*)) + (new 'static + 'clm-item + :description "adjust" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :func #f)) + (new 'static + 'clm-list + :tracker #f + :items + (new 'static + 'boxed-array + :type + clm-list-item + (new 'static + 'clm-list-item + :description "airSwitch" + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 8 + :val-parm1-basic 'vol-flags + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static 'clm-item-action :button #x4000 :options #x1 :func 'clmf-cam-flag-toggle :parm0 8 :parm1-basic 'vol-flags)))))))) (define *clm-cam-attr* - (new 'static 'clm - :title "---camera attributes--" - :items (new 'static 'boxed-array :type clm-basic - (new 'static 'clm-item - :description " ok" - :button-symbol 'square - :action (new 'static 'clm-item-action :button #x8000 :options #x1 :func '*clm-edit*) - ) - (new 'static 'clm-item - :description "adjust" - :button-symbol 'x - :action (new 'static 'clm-item-action :button #x4000 :func #f) - ) - (new 'static 'clm-list - :tracker #f - :items (new 'static 'boxed-array :type clm-list-item - (new 'static 'clm-list-item - :description "drag " - :track-val #f - :val-func 'clmf-cam-flag - :val-parm0 #x400 - :val-parm1-basic 'flags - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action - :button #x4000 - :options #x1 - :func 'clmf-cam-flag-toggle - :parm0 #x400 - :parm1-basic 'flags - ) - ) - ) - (new 'static 'clm-list-item - :description "fov " - :track-val #f - :val-func 'clmf-cam-fov - :val-parm0-basic 'fov - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action - :button #x4000 - :func 'clmf-cam-float-adjust - :parm0-basic 'fov-offset - :parm1-basic (new 'static 'bfloat :data 91.022224) - ) - ) - ) - (new 'static 'clm-list-item - :description "focalPull " - :track-val #f - :val-func 'clmf-cam-deg - :val-parm0-basic 'focalPull - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action - :button #x4000 - :func 'clmf-cam-float-adjust - :parm0-basic 'focalPull-offset - :parm1-basic (new 'static 'bfloat :data 91.022224) - ) - ) - ) - (new 'static 'clm-list-item - :description "interpTime " - :track-val #f - :val-func 'clmf-cam-interp-time - :val-parm0-basic 'interpTime - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action - :button #x4000 - :func 'clmf-cam-float-adjust - :parm0-basic 'interpTime-offset - :parm1-basic (new 'static 'bfloat :data 0.01) - ) - ) - ) - (new 'static 'clm-list-item - :description "sameSide " - :track-val #f - :val-func 'clmf-cam-flag - :val-parm0 16 - :val-parm1-basic 'flags - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action - :button #x4000 - :options #x1 - :func 'clmf-cam-flag-toggle - :parm0 16 - :parm1-basic 'flags - ) - ) - ) - (new 'static 'clm-list-item - :description "spherical " - :track-val #f - :val-func 'clmf-cam-flag - :val-parm0 32 - :val-parm1-basic 'flags - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action - :button #x4000 - :options #x1 - :func 'clmf-cam-flag-toggle - :parm0 32 - :parm1-basic 'flags - ) - ) - ) - (new 'static 'clm-list-item - :description "MinLength " - :track-val #f - :val-func 'clmf-cam-meters - :val-parm0-basic 'stringMinLength - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action - :button #x4000 - :func 'clmf-cam-float-adjust - :parm0-basic 'stringMinLength-offset - :parm1-basic (new 'static 'bfloat :data 409.6) - ) - ) - ) - (new 'static 'clm-list-item - :description "MaxLength " - :track-val #f - :val-func 'clmf-cam-meters - :val-parm0-basic 'stringMaxLength - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action - :button #x4000 - :func 'clmf-cam-float-adjust - :parm0-basic 'stringMaxLength-offset - :parm1-basic (new 'static 'bfloat :data 409.6) - ) - ) - ) - (new 'static 'clm-list-item - :description "MinHeight " - :track-val #f - :val-func 'clmf-cam-meters - :val-parm0-basic 'stringMinHeight - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action - :button #x4000 - :func 'clmf-cam-float-adjust - :parm0-basic 'stringMinHeight-offset - :parm1-basic (new 'static 'bfloat :data 409.6) - ) - ) - ) - (new 'static 'clm-list-item - :description "MaxHeight " - :track-val #f - :val-func 'clmf-cam-meters - :val-parm0-basic 'stringMaxHeight - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action - :button #x4000 - :func 'clmf-cam-float-adjust - :parm0-basic 'stringMaxHeight-offset - :parm1-basic (new 'static 'bfloat :data 409.6) - ) - ) - ) - (new 'static 'clm-list-item - :description "cliffHeight" - :track-val #f - :val-func 'clmf-cam-meters - :val-parm0-basic 'stringCliffHeight - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action - :button #x4000 - :func 'clmf-cam-float-adjust - :parm0-basic 'stringCliffHeight-offset - :parm1-basic (new 'static 'bfloat :data 409.6) - ) - ) - ) - (new 'static 'clm-list-item - :description "alternates " - :track-val #f - :val-func 'clmf-cam-string - :val-parm0-basic 'alternates - :actions (new 'static 'boxed-array :type clm-item-action) - ) - (new 'static 'clm-list-item - :description "maxAngle " - :track-val #f - :val-func 'clmf-cam-deg - :val-parm0-basic 'maxAngle - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action - :button #x4000 - :func 'clmf-cam-float-adjust - :parm0-basic 'maxAngle-offset - :parm1-basic (new 'static 'bfloat :data 91.022224) - ) - ) - ) - (new 'static 'clm-list-item - :description "shrinkAngle" - :track-val #f - :val-func 'clmf-cam-flag - :val-parm0 #x4000 - :val-parm1-basic 'flags - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action - :button #x4000 - :options #x1 - :func 'clmf-cam-flag-toggle - :parm0 #x4000 - :parm1-basic 'flags - ) - ) - ) - (new 'static 'clm-list-item - :description "noRotate " - :track-val #f - :val-func 'clmf-cam-flag - :val-parm0 #x40000 - :val-parm1-basic 'flags - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action - :button #x4000 - :options #x1 - :func 'clmf-cam-flag-toggle - :parm0 #x40000 - :parm1-basic 'flags - ) - ) - ) - (new 'static 'clm-list-item - :description "tiltAdjust " - :track-val #f - :val-func 'clmf-cam-deg - :val-parm0-basic 'tiltAdjust - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action - :button #x4000 - :func 'clmf-cam-float-adjust - :parm0-basic 'tiltAdjust-offset - :parm1-basic (new 'static 'bfloat :data 91.022224) - ) - ) - ) - (new 'static 'clm-list-item - :description "stickyAngle" - :track-val #f - :val-func 'clmf-cam-flag - :val-parm0 #x80000 - :val-parm1-basic 'flags - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action - :button #x4000 - :options #x1 - :func 'clmf-cam-flag-toggle - :parm0 #x80000 - :parm1-basic 'flags - ) - ) - ) - (new 'static 'clm-list-item - :description "airExit" - :track-val #f - :val-func 'clmf-cam-flag - :val-parm0 #x100000 - :val-parm1-basic 'flags - :actions (new 'static 'boxed-array :type clm-item-action (new 'static 'clm-item-action - :button #x4000 - :options #x1 - :func 'clmf-cam-flag-toggle - :parm0 #x100000 - :parm1-basic 'flags - ) - ) - ) - ) - ) - ) - ) - ) + (new 'static + 'clm + :title "---camera attributes--" + :items + (new 'static + 'boxed-array + :type + clm-basic + (new 'static + 'clm-item + :description " ok" + :button-symbol 'square + :action + (new 'static 'clm-item-action :button #x8000 :options #x1 :func '*clm-edit*)) + (new 'static + 'clm-item + :description "adjust" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :func #f)) + (new 'static + 'clm-list + :tracker #f + :items + (new 'static + 'boxed-array + :type + clm-list-item + (new 'static + 'clm-list-item + :description "drag " + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 #x400 + :val-parm1-basic 'flags + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static 'clm-item-action :button #x4000 :options #x1 :func 'clmf-cam-flag-toggle :parm0 #x400 :parm1-basic 'flags))) + (new 'static + 'clm-list-item + :description "fov " + :track-val #f + :val-func 'clmf-cam-fov + :val-parm0-basic 'fov + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static + 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'fov-offset + :parm1-basic + (new 'static 'bfloat :data 91.022224)))) + (new 'static + 'clm-list-item + :description "focalPull " + :track-val #f + :val-func 'clmf-cam-deg + :val-parm0-basic 'focalPull + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static + 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'focalPull-offset + :parm1-basic + (new 'static 'bfloat :data 91.022224)))) + (new 'static + 'clm-list-item + :description "interpTime " + :track-val #f + :val-func 'clmf-cam-interp-time + :val-parm0-basic 'interpTime + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static + 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'interpTime-offset + :parm1-basic + (new 'static 'bfloat :data 0.01)))) + (new 'static + 'clm-list-item + :description "sameSide " + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 16 + :val-parm1-basic 'flags + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static 'clm-item-action :button #x4000 :options #x1 :func 'clmf-cam-flag-toggle :parm0 16 :parm1-basic 'flags))) + (new 'static + 'clm-list-item + :description "spherical " + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 32 + :val-parm1-basic 'flags + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static 'clm-item-action :button #x4000 :options #x1 :func 'clmf-cam-flag-toggle :parm0 32 :parm1-basic 'flags))) + (new 'static + 'clm-list-item + :description "MinLength " + :track-val #f + :val-func 'clmf-cam-meters + :val-parm0-basic 'stringMinLength + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static + 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'stringMinLength-offset + :parm1-basic + (new 'static 'bfloat :data 409.6)))) + (new 'static + 'clm-list-item + :description "MaxLength " + :track-val #f + :val-func 'clmf-cam-meters + :val-parm0-basic 'stringMaxLength + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static + 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'stringMaxLength-offset + :parm1-basic + (new 'static 'bfloat :data 409.6)))) + (new 'static + 'clm-list-item + :description "MinHeight " + :track-val #f + :val-func 'clmf-cam-meters + :val-parm0-basic 'stringMinHeight + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static + 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'stringMinHeight-offset + :parm1-basic + (new 'static 'bfloat :data 409.6)))) + (new 'static + 'clm-list-item + :description "MaxHeight " + :track-val #f + :val-func 'clmf-cam-meters + :val-parm0-basic 'stringMaxHeight + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static + 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'stringMaxHeight-offset + :parm1-basic + (new 'static 'bfloat :data 409.6)))) + (new 'static + 'clm-list-item + :description "cliffHeight" + :track-val #f + :val-func 'clmf-cam-meters + :val-parm0-basic 'stringCliffHeight + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static + 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'stringCliffHeight-offset + :parm1-basic + (new 'static 'bfloat :data 409.6)))) + (new 'static + 'clm-list-item + :description "alternates " + :track-val #f + :val-func 'clmf-cam-string + :val-parm0-basic 'alternates + :actions + (new 'static 'boxed-array :type clm-item-action)) + (new 'static + 'clm-list-item + :description "maxAngle " + :track-val #f + :val-func 'clmf-cam-deg + :val-parm0-basic 'maxAngle + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static + 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'maxAngle-offset + :parm1-basic + (new 'static 'bfloat :data 91.022224)))) + (new 'static + 'clm-list-item + :description "shrinkAngle" + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 #x4000 + :val-parm1-basic 'flags + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static 'clm-item-action :button #x4000 :options #x1 :func 'clmf-cam-flag-toggle :parm0 #x4000 :parm1-basic 'flags))) + (new 'static + 'clm-list-item + :description "noRotate " + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 #x40000 + :val-parm1-basic 'flags + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static 'clm-item-action :button #x4000 :options #x1 :func 'clmf-cam-flag-toggle :parm0 #x40000 :parm1-basic 'flags))) + (new 'static + 'clm-list-item + :description "tiltAdjust " + :track-val #f + :val-func 'clmf-cam-deg + :val-parm0-basic 'tiltAdjust + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static + 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'tiltAdjust-offset + :parm1-basic + (new 'static 'bfloat :data 91.022224)))) + (new 'static + 'clm-list-item + :description "stickyAngle" + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 #x80000 + :val-parm1-basic 'flags + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static 'clm-item-action :button #x4000 :options #x1 :func 'clmf-cam-flag-toggle :parm0 #x80000 :parm1-basic 'flags))) + (new 'static + 'clm-list-item + :description "airExit" + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 #x100000 + :val-parm1-basic 'flags + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static 'clm-item-action :button #x4000 :options #x1 :func 'clmf-cam-flag-toggle :parm0 #x100000 :parm1-basic 'flags)))))))) (define *clm-cam-lookthrough* - (new 'static 'clm - :title "---cam-lookthrough---" - :items (new 'static 'boxed-array :type clm-basic - (new 'static 'clm-item - :description " " - :button-symbol 'x - :action (new 'static 'clm-item-action :button #x4000 :options #x4 :func 'clmf-look-through) - ) - (new 'static 'clm-item - :description " ok" - :button-symbol 'square - :action (new 'static 'clm-item-action :button #x8000 :options #x1 :func 'clmf-to-edit) - ) - (new 'static 'clm-item - :description "pos/rot" - :button-symbol 'x - :action (new 'static 'clm-item-action - :button #x4000 - :options #x8 - :func 'clmf-pos-rot - :parm0-basic 'trans-offset - :parm1-basic 'rot-offset - ) - ) - (new 'static 'clm-item - :description " adjust" - :button-symbol 'x - :action (new 'static 'clm-item-action :button #x4000 :func #f) - ) - (new 'static 'clm-list - :tracker #f - :items (new 'static 'boxed-array :type clm-list-item - (new 'static 'clm-list-item - :description "fov" - :track-val #f - :val-func 'clmf-cam-fov - :val-parm0-basic 'fov - :actions (new 'static 'boxed-array :type clm-item-action (new 'static 'clm-item-action - :button #x4000 - :func 'clmf-cam-float-adjust - :parm0-basic 'fov-offset - :parm1-basic (new 'static 'bfloat :data 91.022224) - ) - ) - ) - ) - ) - ) - ) - ) + (new 'static + 'clm + :title "---cam-lookthrough---" + :items + (new 'static + 'boxed-array + :type + clm-basic + (new 'static + 'clm-item + :description " " + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :options #x4 :func 'clmf-look-through)) + (new 'static + 'clm-item + :description " ok" + :button-symbol 'square + :action + (new 'static 'clm-item-action :button #x8000 :options #x1 :func 'clmf-to-edit)) + (new 'static + 'clm-item + :description "pos/rot" + :button-symbol 'x + :action + (new 'static + 'clm-item-action + :button #x4000 + :options #x8 + :func 'clmf-pos-rot + :parm0-basic 'trans-offset + :parm1-basic 'rot-offset)) + (new 'static + 'clm-item + :description " adjust" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :func #f)) + (new 'static + 'clm-list + :tracker #f + :items + (new 'static + 'boxed-array + :type + clm-list-item + (new 'static + 'clm-list-item + :description "fov" + :track-val #f + :val-func 'clmf-cam-fov + :val-parm0-basic 'fov + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static + 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'fov-offset + :parm1-basic + (new 'static 'bfloat :data 91.022224))))))))) (define *clm-edit* - (new 'static 'clm - :title "---edit---" - :items (new 'static 'boxed-array :type clm-basic - (new 'static 'clm-item - :description " ok" - :button-symbol 'square - :action (new 'static 'clm-item-action :button #x8000 :options #x1 :func 'clmf-to-select) - ) - (new 'static 'clm-item - :description "attributes" - :button-symbol 'x - :action (new 'static 'clm-item-action :button #x4000 :options #x1 :func #f) - ) - (new 'static 'clm-item - :description " edit part" - :button-symbol 'circle - :action (new 'static 'clm-item-action :button #x2000 :options #x1 :func #f) - ) - (new 'static 'clm-item - :description "scale/next" - :button-symbol 'r2 - :action (new 'static 'clm-item-action :button #x200 :func #f) - ) - (new 'static 'clm-item - :description " pos/rot" - :button-symbol 'l2 - :action (new 'static 'clm-item-action :button #x100 :func #f) - ) - (new 'static 'clm-list - :tracker '*camera-layout-blink* - :items (new 'static 'boxed-array :type clm-list-item - (new 'static 'clm-list-item - :description "camera " - :track-val 'camera - :val-func #f - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action :button #x4000 :options #x1 :func '*clm-cam-attr*) - (new 'static 'clm-item-action :button #x2000 :func '*clm-cam-lookthrough*) - (new 'static 'clm-item-action :button #x200 :func 'clmf-bna) - (new 'static 'clm-item-action - :button #x100 - :func 'clmf-pos-rot - :parm0-basic 'trans-offset - :parm1-basic 'rot-offset - ) - ) - ) - (new 'static 'clm-list-item - :description "volume " - :track-val 'volume - :val-func #f - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action :button #x4000 :options #x1 :func 'clmf-to-vol-attr) - (new 'static 'clm-item-action :button #x2000 :func 'clmf-implement) - (new 'static 'clm-item-action :button #x200 :func 'clmf-next-vol-dpad) - (new 'static 'clm-item-action :button #x100 :func 'clmf-implement) - ) - ) - (new 'static 'clm-list-item - :description "align " - :track-val 'align - :val-func #f - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action :button #x4000 :func 'clmf-bna) - (new 'static 'clm-item-action :button #x2000 :func 'clmf-bna) - (new 'static 'clm-item-action :button #x200 :func 'clmf-bna) - (new 'static 'clm-item-action :button #x100 :func 'clmf-pos-rot :parm0-basic 'align-offset :parm1-basic #f) - ) - ) - (new 'static 'clm-list-item - :description "pivot " - :track-val 'pivot - :val-func #f - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action :button #x4000 :func 'clmf-bna) - (new 'static 'clm-item-action :button #x2000 :func 'clmf-bna) - (new 'static 'clm-item-action :button #x200 :func 'clmf-bna) - (new 'static 'clm-item-action :button #x100 :func 'clmf-pos-rot :parm0-basic 'pivot-offset :parm1-basic #f) - ) - ) - (new 'static 'clm-list-item - :description "interesting" - :track-val 'interesting - :val-func #f - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action :button #x4000 :func 'clmf-bna) - (new 'static 'clm-item-action :button #x2000 :func 'clmf-bna) - (new 'static 'clm-item-action :button #x200 :func 'clmf-bna) - (new 'static 'clm-item-action - :button #x100 - :func 'clmf-pos-rot - :parm0-basic 'interesting-offset - :parm1-basic #f - ) - ) - ) - (new 'static 'clm-list-item - :description "spline " - :track-val 'spline - :val-func #f - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action :button #x4000 :func 'clmf-to-spline-attr) - (new 'static 'clm-item-action :button #x2000 :func 'clmf-implement) - (new 'static 'clm-item-action :button #x200 :func 'clmf-implement) - (new 'static 'clm-item-action :button #x100 :func 'clmf-pos-rot :parm0-basic 'spline-offset :parm1-basic #f) - ) - ) - (new 'static 'clm-list-item - :description "intro " - :track-val 'intro - :val-func #f - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action :button #x4000 :options #x1 :func 'clmf-to-intro-attr) - (new 'static 'clm-item-action :button #x2000 :func 'clmf-implement) - (new 'static 'clm-item-action :button #x200 :func 'clmf-implement) - (new 'static 'clm-item-action :button #x100 :func 'clmf-implement) - ) - ) - (new 'static 'clm-list-item - :description "index " - :track-val 'index - :val-func #f - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action :button #x4000 :options #x1 :func 'clmf-to-index-attr) - (new 'static 'clm-item-action :button #x2000 :func 'clmf-implement) - (new 'static 'clm-item-action :button #x200 :func 'clmf-implement) - (new 'static 'clm-item-action :button #x100 :func 'clmf-pos-rot :parm0-basic 'campoints-offset) - ) - ) - (new 'static 'clm-list-item - :description "focalpull" - :track-val 'focalpull - :val-func #f - :actions (new 'static 'boxed-array :type clm-item-action - (new 'static 'clm-item-action :button #x4000 :options #x1 :func 'clmf-to-focalpull-attr) - (new 'static 'clm-item-action :button #x2000 :func 'clmf-implement) - (new 'static 'clm-item-action :button #x200 :func 'clmf-implement) - (new 'static 'clm-item-action :button #x100 :func 'clmf-implement) - ) - ) - ) - ) - ) - ) - ) + (new 'static + 'clm + :title "---edit---" + :items + (new 'static + 'boxed-array + :type + clm-basic + (new 'static + 'clm-item + :description " ok" + :button-symbol 'square + :action + (new 'static 'clm-item-action :button #x8000 :options #x1 :func 'clmf-to-select)) + (new 'static + 'clm-item + :description "attributes" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :options #x1 :func #f)) + (new 'static + 'clm-item + :description " edit part" + :button-symbol 'circle + :action + (new 'static 'clm-item-action :button #x2000 :options #x1 :func #f)) + (new 'static + 'clm-item + :description "scale/next" + :button-symbol 'r2 + :action + (new 'static 'clm-item-action :button #x200 :func #f)) + (new 'static + 'clm-item + :description " pos/rot" + :button-symbol 'l2 + :action + (new 'static 'clm-item-action :button #x100 :func #f)) + (new 'static + 'clm-list + :tracker '*camera-layout-blink* + :items + (new 'static + 'boxed-array + :type + clm-list-item + (new 'static + 'clm-list-item + :description "camera " + :track-val 'camera + :val-func #f + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static 'clm-item-action :button #x4000 :options #x1 :func '*clm-cam-attr*) + (new 'static 'clm-item-action :button #x2000 :func '*clm-cam-lookthrough*) + (new 'static 'clm-item-action :button #x200 :func 'clmf-bna) + (new 'static 'clm-item-action :button #x100 :func 'clmf-pos-rot :parm0-basic 'trans-offset :parm1-basic 'rot-offset))) + (new 'static + 'clm-list-item + :description "volume " + :track-val 'volume + :val-func #f + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static 'clm-item-action :button #x4000 :options #x1 :func 'clmf-to-vol-attr) + (new 'static 'clm-item-action :button #x2000 :func 'clmf-implement) + (new 'static 'clm-item-action :button #x200 :func 'clmf-next-vol-dpad) + (new 'static 'clm-item-action :button #x100 :func 'clmf-implement))) + (new 'static + 'clm-list-item + :description "align " + :track-val 'align + :val-func #f + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static 'clm-item-action :button #x4000 :func 'clmf-bna) + (new 'static 'clm-item-action :button #x2000 :func 'clmf-bna) + (new 'static 'clm-item-action :button #x200 :func 'clmf-bna) + (new 'static 'clm-item-action :button #x100 :func 'clmf-pos-rot :parm0-basic 'align-offset :parm1-basic #f))) + (new 'static + 'clm-list-item + :description "pivot " + :track-val 'pivot + :val-func #f + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static 'clm-item-action :button #x4000 :func 'clmf-bna) + (new 'static 'clm-item-action :button #x2000 :func 'clmf-bna) + (new 'static 'clm-item-action :button #x200 :func 'clmf-bna) + (new 'static 'clm-item-action :button #x100 :func 'clmf-pos-rot :parm0-basic 'pivot-offset :parm1-basic #f))) + (new 'static + 'clm-list-item + :description "interesting" + :track-val 'interesting + :val-func #f + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static 'clm-item-action :button #x4000 :func 'clmf-bna) + (new 'static 'clm-item-action :button #x2000 :func 'clmf-bna) + (new 'static 'clm-item-action :button #x200 :func 'clmf-bna) + (new 'static 'clm-item-action :button #x100 :func 'clmf-pos-rot :parm0-basic 'interesting-offset :parm1-basic #f))) + (new 'static + 'clm-list-item + :description "spline " + :track-val 'spline + :val-func #f + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static 'clm-item-action :button #x4000 :func 'clmf-to-spline-attr) + (new 'static 'clm-item-action :button #x2000 :func 'clmf-implement) + (new 'static 'clm-item-action :button #x200 :func 'clmf-implement) + (new 'static 'clm-item-action :button #x100 :func 'clmf-pos-rot :parm0-basic 'spline-offset :parm1-basic #f))) + (new 'static + 'clm-list-item + :description "intro " + :track-val 'intro + :val-func #f + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static 'clm-item-action :button #x4000 :options #x1 :func 'clmf-to-intro-attr) + (new 'static 'clm-item-action :button #x2000 :func 'clmf-implement) + (new 'static 'clm-item-action :button #x200 :func 'clmf-implement) + (new 'static 'clm-item-action :button #x100 :func 'clmf-implement))) + (new 'static + 'clm-list-item + :description "index " + :track-val 'index + :val-func #f + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static 'clm-item-action :button #x4000 :options #x1 :func 'clmf-to-index-attr) + (new 'static 'clm-item-action :button #x2000 :func 'clmf-implement) + (new 'static 'clm-item-action :button #x200 :func 'clmf-implement) + (new 'static 'clm-item-action :button #x100 :func 'clmf-pos-rot :parm0-basic 'campoints-offset))) + (new 'static + 'clm-list-item + :description "focalpull" + :track-val 'focalpull + :val-func #f + :actions + (new 'static + 'boxed-array + :type + clm-item-action + (new 'static 'clm-item-action :button #x4000 :options #x1 :func 'clmf-to-focalpull-attr) + (new 'static 'clm-item-action :button #x2000 :func 'clmf-implement) + (new 'static 'clm-item-action :button #x200 :func 'clmf-implement) + (new 'static 'clm-item-action :button #x100 :func 'clmf-implement)))))))) (define *clm-save-all* - (new 'static 'clm - :title "---save all?---" - :items (new 'static 'boxed-array :type clm-basic - (new 'static 'clm-item - :description " save all" - :button-symbol 'x - :action (new 'static 'clm-item-action :button #x4000 :options #x1 :func 'clmf-save-all :parm0 16) - ) - (new 'static 'clm-item - :description "print all" - :button-symbol 'square - :action (new 'static 'clm-item-action :button #x8000 :options #x1 :func 'clmf-save-all :parm0 8) - ) - (new 'static 'clm-item - :description " done" - :button-symbol 'triangle - :action (new 'static 'clm-item-action :button #x1000 :options #x1 :func 'clmf-to-select) - ) - ) - ) - ) + (new 'static + 'clm + :title "---save all?---" + :items + (new 'static + 'boxed-array + :type + clm-basic + (new 'static + 'clm-item + :description " save all" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :options #x1 :func 'clmf-save-all :parm0 16)) + (new 'static + 'clm-item + :description "print all" + :button-symbol 'square + :action + (new 'static 'clm-item-action :button #x8000 :options #x1 :func 'clmf-save-all :parm0 8)) + (new 'static + 'clm-item + :description " done" + :button-symbol 'triangle + :action + (new 'static 'clm-item-action :button #x1000 :options #x1 :func 'clmf-to-select))))) (define *clm-save-one* - (new 'static 'clm - :title "---single save?---" - :items (new 'static 'boxed-array :type clm-basic - (new 'static 'clm-item - :description " single save" - :button-symbol 'x - :action (new 'static 'clm-item-action :button #x4000 :options #x1 :func 'clmf-save-one :parm0 16) - ) - (new 'static 'clm-item - :description "single print" - :button-symbol 'square - :action (new 'static 'clm-item-action :button #x8000 :options #x1 :func 'clmf-save-one :parm0 8) - ) - (new 'static 'clm-item - :description " done" - :button-symbol 'triangle - :action (new 'static 'clm-item-action :button #x1000 :options #x1 :func 'clmf-to-select) - ) - ) - ) - ) + (new 'static + 'clm + :title "---single save?---" + :items + (new 'static + 'boxed-array + :type + clm-basic + (new 'static + 'clm-item + :description " single save" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :options #x1 :func 'clmf-save-one :parm0 16)) + (new 'static + 'clm-item + :description "single print" + :button-symbol 'square + :action + (new 'static 'clm-item-action :button #x8000 :options #x1 :func 'clmf-save-one :parm0 8)) + (new 'static + 'clm-item + :description " done" + :button-symbol 'triangle + :action + (new 'static 'clm-item-action :button #x1000 :options #x1 :func 'clmf-to-select))))) (define *clm-select* - (new 'static 'clm - :title "---camera---" - :items (new 'static 'boxed-array :type clm-basic - (new 'static 'clm-item - :description " edit" - :button-symbol 'x - :action (new 'static 'clm-item-action :button #x4000 :options #x3 :func 'clmf-to-edit-cam) - ) - (new 'static 'clm-item - :description "save one" - :button-symbol 'triangle - :action (new 'static 'clm-item-action :button #x1000 :options #x3 :func '*clm-save-one*) - ) - (new 'static 'clm-item - :description " next" - :button-symbol 'down - :action (new 'static 'clm-item-action :button #x40 :options #x3 :func 'clmf-next-entity :parm0 8) - ) - (new 'static 'clm-item - :description " prev" - :button-symbol 'up - :action (new 'static 'clm-item-action :button #x10 :options #x3 :func 'clmf-next-entity :parm0 -8) - ) - (new 'static 'clm-item - :description " next 5" - :button-symbol 'right - :action (new 'static 'clm-item-action :button #x20 :options #x3 :func 'clmf-next-entity :parm0 40) - ) - (new 'static 'clm-item - :description " prev 5" - :button-symbol 'left - :action (new 'static 'clm-item-action :button #x80 :options #x3 :func 'clmf-next-entity :parm0 -40) - ) - ) - ) - ) + (new 'static + 'clm + :title "---camera---" + :items + (new 'static + 'boxed-array + :type + clm-basic + (new 'static + 'clm-item + :description " edit" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :options #x3 :func 'clmf-to-edit-cam)) + (new 'static + 'clm-item + :description "save one" + :button-symbol 'triangle + :action + (new 'static 'clm-item-action :button #x1000 :options #x3 :func '*clm-save-one*)) + (new 'static + 'clm-item + :description " next" + :button-symbol 'down + :action + (new 'static 'clm-item-action :button #x40 :options #x3 :func 'clmf-next-entity :parm0 8)) + (new 'static + 'clm-item + :description " prev" + :button-symbol 'up + :action + (new 'static 'clm-item-action :button #x10 :options #x3 :func 'clmf-next-entity :parm0 -8)) + (new 'static + 'clm-item + :description " next 5" + :button-symbol 'right + :action + (new 'static 'clm-item-action :button #x20 :options #x3 :func 'clmf-next-entity :parm0 40)) + (new 'static + 'clm-item + :description " prev 5" + :button-symbol 'left + :action + (new 'static 'clm-item-action :button #x80 :options #x3 :func 'clmf-next-entity :parm0 -40))))) (define *clm* *clm-select*) (defbehavior cam-layout-do-action cam-layout ((arg0 clm-item-action)) (let ((s5-0 (-> arg0 func value))) (cond - ((not s5-0) - #f - ) - ((zero? s5-0) - #f - ) - ((and (not (-> self cam-entity)) (logtest? (-> arg0 options) 2)) - #f - ) - ((and (logtest? (-> arg0 options) 8) (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (-> arg0 button))) - #f - ) + ((not s5-0) #f) + ((zero? s5-0) #f) + ((and (not (-> self cam-entity)) (logtest? (-> arg0 options) 2)) #f) + ((and (logtest? (-> arg0 options) 8) (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (-> arg0 button))) #f) ((and (not (logtest? (-> arg0 options) 12)) (logtest? (-> arg0 options) 1) - (not (logtest? (-> *cpad-list* cpads 0 button0-rel 0) (-> arg0 button))) - ) - #f - ) - ((and (not (logtest? (-> arg0 options) 13)) - (not (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (-> arg0 button))) - ) - #f - ) - ((type-type? (-> (the-as basic s5-0) type) clm) - (set! *clm* (the-as clm s5-0)) - #t - ) + (not (logtest? (-> *cpad-list* cpads 0 button0-rel 0) (-> arg0 button)))) + #f) + ((and (not (logtest? (-> arg0 options) 13)) (not (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (-> arg0 button)))) + #f) + ((type-type? (-> (the-as basic s5-0) type) clm) (set! *clm* (the-as clm s5-0)) #t) ((type-type? (-> (the-as basic s5-0) type) function) - ((the-as (function object symbol symbol) s5-0) (-> arg0 parm0) (the-as symbol (-> arg0 parm1-basic))) - ) - ) - ) - ) + ((the-as (function object symbol symbol) s5-0) (-> arg0 parm0) (the-as symbol (-> arg0 parm1-basic))))))) (defbehavior cam-layout-function-call cam-layout ((arg0 symbol) (arg1 string) (arg2 int) (arg3 basic)) (let ((gp-0 (-> arg0 value))) (cond - ((not gp-0) - ) - ((zero? gp-0) - ) - ((type-type? (-> (the-as basic gp-0) type) function) - ((the-as (function string int basic none) gp-0) arg1 arg2 arg3) - ) - ) - ) - #f - ) + ((not gp-0)) + ((zero? gp-0)) + ((type-type? (-> (the-as basic gp-0) type) function) ((the-as (function string int basic none) gp-0) arg1 arg2 arg3)))) + #f) (defbehavior cam-layout-do-menu cam-layout ((arg0 clm)) (set! *camera-layout-message-ypos* 30) (+! (-> *CAM_LAYOUT-bank* spline-t) (-> *CAM_LAYOUT-bank* spline-step)) - (if (< 1.01 (-> *CAM_LAYOUT-bank* spline-t)) - (set! (-> *CAM_LAYOUT-bank* spline-t) -0.09) - ) + (if (< 1.01 (-> *CAM_LAYOUT-bank* spline-t)) (set! (-> *CAM_LAYOUT-bank* spline-t) -0.09)) (+! (-> *CAM_LAYOUT-bank* intro-t) (-> *CAM_LAYOUT-bank* intro-step)) - (if (< 1.01 (-> *CAM_LAYOUT-bank* intro-t)) - (set! (-> *CAM_LAYOUT-bank* intro-t) -0.09) - ) + (if (< 1.01 (-> *CAM_LAYOUT-bank* intro-t)) (set! (-> *CAM_LAYOUT-bank* intro-t) -0.09)) (let ((s5-0 30)) (let ((s4-0 (cam-state-from-entity (-> self cam-entity)))) (set! *camera-read-analog* #t) (let ((s3-0 (-> self cam-entity))) (clear *temp-string*) - (if s3-0 - (format *temp-string* "\"~S\"~%" (res-lump-struct s3-0 'name structure :time (the-as float -1000000000.0))) - ) - ) - (if (not s4-0) - (format *temp-string* "no cameras in this level") - (format *temp-string* "~S" (-> s4-0 name)) - ) - ) + (if s3-0 (format *temp-string* "\"~S\"~%" (res-lump-struct s3-0 'name structure :time (the-as float -1000000000.0))))) + (if (not s4-0) (format *temp-string* "no cameras in this level") (format *temp-string* "~S" (-> s4-0 name)))) (cam-layout-print 320 s5-0 *temp-string*) (let ((s5-1 (+ s5-0 16))) (clear *temp-string*) @@ -3365,121 +2607,64 @@ (let ((s3-1 (the-as clm-list (-> arg0 items s5-2)))) (dotimes (s2-1 (-> s3-1 items length)) (clear *temp-string*) - (format - *temp-string* - "~S~S" - (if (= s2-1 (-> s3-1 cur-list-item)) - "> " - " " - ) - (-> s3-1 items s2-1 description) - ) - (cam-layout-function-call - (-> s3-1 items s2-1 val-func) - *temp-string* - (-> s3-1 items s2-1 val-parm0) - (-> s3-1 items s2-1 val-parm1-basic) - ) + (format *temp-string* "~S~S" (if (= s2-1 (-> s3-1 cur-list-item)) "> " " ") (-> s3-1 items s2-1 description)) + (cam-layout-function-call (-> s3-1 items s2-1 val-func) + *temp-string* + (-> s3-1 items s2-1 val-parm0) + (-> s3-1 items s2-1 val-parm1-basic)) (cam-layout-print 320 s4-2 *temp-string*) - (+! s4-2 8) - ) - ) + (+! s4-2 8))) (clear *temp-string*) (format *temp-string* "------------") (cam-layout-print 320 s4-2 *temp-string*) - (set! s4-1 (+ s4-2 8)) - ) - ) - ((and (not (-> self cam-entity)) (logtest? (-> (the-as clm-item (-> arg0 items s5-2)) action options) 2)) - ) - ((logtest? (-> (the-as clm-item (-> arg0 items s5-2)) action options) 4) - ) + (set! s4-1 (+ s4-2 8)))) + ((and (not (-> self cam-entity)) (logtest? (-> (the-as clm-item (-> arg0 items s5-2)) action options) 2))) + ((logtest? (-> (the-as clm-item (-> arg0 items s5-2)) action options) 4)) (else - (let ((s3-2 (-> arg0 items s5-2))) - (clear *temp-string*) - (format - *temp-string* - "~S: ~A~%" - (-> (the-as clm-item s3-2) description) - (if (logtest? (-> (the-as clm-item (-> arg0 items s5-2)) action options) 8) - 'default - (-> (the-as clm-item s3-2) button-symbol) - ) - ) - ) - (cam-layout-print 320 s4-1 *temp-string*) - (+! s4-1 8) - ) - ) - ) - ) - ) - ) - (if (= *master-mode* 'menu) - (goto cfg-65) - ) + (let ((s3-2 (-> arg0 items s5-2))) + (clear *temp-string*) + (format *temp-string* + "~S: ~A~%" + (-> (the-as clm-item s3-2) description) + (if (logtest? (-> (the-as clm-item (-> arg0 items s5-2)) action options) 8) + 'default + (-> (the-as clm-item s3-2) button-symbol)))) + (cam-layout-print 320 s4-1 *temp-string*) + (+! s4-1 8))))))) + (if (= *master-mode* 'menu) (goto cfg-65)) (dotimes (s5-3 (-> arg0 items length)) (cond ((type-type? (-> arg0 items s5-3 type) clm-list) (let ((s4-3 (-> arg0 items s5-3)) - (s3-3 0) - ) + (s3-3 0)) (if (-> (the-as clm-list s4-3) tracker) - (set! (-> (the-as clm-list s4-3) tracker value) - (-> (the-as clm-list s4-3) items (-> (the-as clm-list s4-3) cur-list-item) track-val) - ) - ) + (set! (-> (the-as clm-list s4-3) tracker value) + (-> (the-as clm-list s4-3) items (-> (the-as clm-list s4-3) cur-list-item) track-val))) (dotimes (s2-2 (-> (the-as clm-list s4-3) items (-> (the-as clm-list s4-3) cur-list-item) actions length)) - (if (cam-layout-do-action - (-> (the-as clm-list s4-3) items (-> (the-as clm-list s4-3) cur-list-item) actions s2-2) - ) - (goto cfg-65) - ) - ) + (if (cam-layout-do-action (-> (the-as clm-list s4-3) items (-> (the-as clm-list s4-3) cur-list-item) actions s2-2)) + (goto cfg-65))) (cond - ((cpad-pressed? 0 down) - (set! s3-3 1) - ) - ((cpad-pressed? 0 right) - (set! s3-3 1) - ) - ((cpad-pressed? 0 up) - (set! s3-3 -1) - ) - ((cpad-pressed? 0 left) - (set! s3-3 -1) - ) - ) + ((cpad-pressed? 0 down) (set! s3-3 1)) + ((cpad-pressed? 0 right) (set! s3-3 1)) + ((cpad-pressed? 0 up) (set! s3-3 -1)) + ((cpad-pressed? 0 left) (set! s3-3 -1))) (when (nonzero? s3-3) (set! (-> (the-as clm-list s4-3) cur-list-item) - (mod (+ (-> (the-as clm-list s4-3) cur-list-item) s3-3) (-> (the-as clm-list s4-3) items length)) - ) + (mod (+ (-> (the-as clm-list s4-3) cur-list-item) s3-3) (-> (the-as clm-list s4-3) items length))) (while (< (-> (the-as clm-list s4-3) cur-list-item) 0) - (+! (-> (the-as clm-list s4-3) cur-list-item) (-> (the-as clm-list s4-3) items length)) - ) - (goto cfg-65) - ) - ) - ) - ((cam-layout-do-action (-> (the-as clm-item (-> arg0 items s5-3)) action)) - (goto cfg-65) - ) - ) - ) + (+! (-> (the-as clm-list s4-3) cur-list-item) (-> (the-as clm-list s4-3) items length))) + (goto cfg-65)))) + ((cam-layout-do-action (-> (the-as clm-item (-> arg0 items s5-3)) action)) (goto cfg-65)))) (label cfg-65) - (none) - ) + (none)) (defstate cam-layout-active (cam-layout) - :code (behavior () - (loop - (cam-layout-entity-info (the-as entity-actor (-> self cam-entity))) - (cam-layout-entity-volume-info) - (cam-layout-do-menu *clm*) - (suspend) - ) - ) - ) + :code + (behavior () + (loop (cam-layout-entity-info (the-as entity-actor (-> self cam-entity))) + (cam-layout-entity-volume-info) + (cam-layout-do-menu *clm*) + (suspend)))) (defbehavior cam-layout-init cam-layout () (set! (-> self res-key) -1000000000.0) @@ -3492,51 +2677,30 @@ (+! (-> self num-entities) 1) (set! v1-2 a0-2) *camera-engine* - (set! a0-2 (-> a0-2 next0)) - ) - ) - ) + (set! a0-2 (-> a0-2 next0))))) (set! (-> self cur-entity) *last-cur-entity*) (clmf-next-entity 0) (set! *clm* *clm-select*) (go cam-layout-active) - (none) - ) + (none)) (defun cam-layout-stop () (set! *cam-layout* #f) - (kill-by-name 'cam-layout *active-pool*) - ) + (kill-by-name 'cam-layout *active-pool*)) (defun cam-layout-start () - (let ((a0-1 (new 'global 'file-stream "dd_next/caminfo/garbage" 'read))) - (file-stream-close a0-1) - ) + (let ((a0-1 (new 'global 'file-stream "dd_next/caminfo/garbage" 'read))) (file-stream-close a0-1)) (cond ((not *cam-layout*) (let ((v1-4 (process-spawn-function cam-layout cam-layout-init :from *camera-dead-pool*))) (cond - (v1-4 - (logclear! (-> v1-4 0 mask) (process-mask pause menu)) - (set! *cam-layout* #t) - (set! *camera-layout-blink* #f) - ) - (else - (format 0 "ERROR : no process available to start cam editing mode~%") - ) - ) - ) - ) - (else - (format 0 "ERROR : cam editing mode already started~%") - ) - ) + (v1-4 (logclear! (-> v1-4 0 mask) (process-mask pause menu)) (set! *cam-layout* #t) (set! *camera-layout-blink* #f)) + (else (format 0 "ERROR : no process available to start cam editing mode~%"))))) + (else (format 0 "ERROR : cam editing mode already started~%"))) *cam-layout* - (none) - ) + (none)) (defun cam-layout-restart () (cam-layout-stop) (cam-layout-start) - (none) - ) + (none)) diff --git a/goal_src/jak1/engine/camera/cam-master.gc b/goal_src/jak1/engine/camera/cam-master.gc index 5e3aa07d21..2229c641f5 100644 --- a/goal_src/jak1/engine/camera/cam-master.gc +++ b/goal_src/jak1/engine/camera/cam-master.gc @@ -1,7 +1,6 @@ ;;-*-Lisp-*- (in-package goal) (bundles "ENGINE.CGO" "GAME.CGO") - (require "engine/game/projectiles-h.gc") (require "engine/physics/dynamics-h.gc") (require "engine/gfx/mood/weather-part.gc") @@ -21,29 +20,26 @@ ;; DECOMP BEGINS (deftype camera-master-bank (basic) - ((onscreen-head-height meters) - (onscreen-foot-height meters) - (target-height meters) - (up-move-to-pitch-ratio-in-air float) - (down-move-to-pitch-ratio-in-air float) - (up-move-to-pitch-on-ground float) - (down-move-to-pitch-on-ground float) - (pitch-off-blend float) - ) - ) + ((onscreen-head-height meters) + (onscreen-foot-height meters) + (target-height meters) + (up-move-to-pitch-ratio-in-air float) + (down-move-to-pitch-ratio-in-air float) + (up-move-to-pitch-on-ground float) + (down-move-to-pitch-on-ground float) + (pitch-off-blend float))) - -(define *CAMERA_MASTER-bank* (new 'static 'camera-master-bank - :onscreen-head-height (meters 2.65) - :onscreen-foot-height (meters -0.5) - :target-height (meters 2.15) - :up-move-to-pitch-ratio-in-air 1.0 - :down-move-to-pitch-ratio-in-air 0.5 - :up-move-to-pitch-on-ground 0.9 - :down-move-to-pitch-on-ground 0.9 - :pitch-off-blend 0.5 - ) - ) +(define *CAMERA_MASTER-bank* + (new 'static + 'camera-master-bank + :onscreen-head-height (meters 2.65) + :onscreen-foot-height (meters -0.5) + :target-height (meters 2.15) + :up-move-to-pitch-ratio-in-air 1.0 + :down-move-to-pitch-ratio-in-air 0.5 + :up-move-to-pitch-on-ground 0.9 + :down-move-to-pitch-on-ground 0.9 + :pitch-off-blend 0.5)) (defbehavior reset-follow camera-master () (set! (-> self tpos-old quad) (-> (target-cam-pos) quad)) @@ -51,8 +47,7 @@ (set! (-> self tpos-old-adj quad) (-> self tpos-old quad)) (set! (-> self tpos-curr-adj quad) (-> self tpos-old quad)) (set! (-> self tpos-tgt quad) (-> self tpos-old quad)) - (set! (-> self upspeed) 0.0) - ) + (set! (-> self upspeed) 0.0)) (defbehavior reset-target-tracking camera-master () (set! (-> self tpos-old quad) (-> (target-cam-pos) quad)) @@ -69,67 +64,42 @@ (set! (-> self target-height) (-> *CAMERA_MASTER-bank* target-height)) (set! (-> self on-ground) (not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags jump)) - (not (logtest? (-> *target* control status) (cshape-moving-flags onsurf))) - ) - ) - ) + (not (logtest? (-> *target* control status) (cshape-moving-flags onsurf)))))) (set! (-> self on-pole) #f) (set! (-> self ease-t) 1.0) (set! (-> self string-max target y) (-> self stringMaxHeight)) (set! (-> self string-max target z) (-> self stringMaxLength)) (set! (-> self string-push-z) (fmax (-> self string-min value z) (-> *CAMERA-bank* default-string-push-z))) (cond - ((time-elapsed? - (the-as time-frame (if *target* - (the-as int (-> *target* neck notice-time)) - 0 - ) - ) - (-> *CAMERA-bank* attack-timeout) - ) - (set! (-> self being-attacked) #f) - ) + ((time-elapsed? (the-as time-frame (if *target* (the-as int (-> *target* neck notice-time)) 0)) + (-> *CAMERA-bank* attack-timeout)) + (set! (-> self being-attacked) #f)) (else - (set-time! (-> self attack-start)) - (set! (-> self being-attacked) #t) - (when (and (not (logtest? (-> self master-options) 64)) - (or (!= (-> last-try-to-look-at-data horz) 0.0) (!= (-> last-try-to-look-at-data vert) 0.0)) - ) - (set! (-> self string-max target y) (fmax (-> self string-max target y) (-> last-try-to-look-at-data vert))) - (set! (-> self string-max target z) (fmax (-> self string-max target z) (-> last-try-to-look-at-data horz))) - (set! (-> self string-push-z) (fmax (-> self string-push-z) (-> self string-max target z))) - ) - ) - ) + (set-time! (-> self attack-start)) + (set! (-> self being-attacked) #t) + (when (and (not (logtest? (-> self master-options) 64)) + (or (!= (-> last-try-to-look-at-data horz) 0.0) (!= (-> last-try-to-look-at-data vert) 0.0))) + (set! (-> self string-max target y) (fmax (-> self string-max target y) (-> last-try-to-look-at-data vert))) + (set! (-> self string-max target z) (fmax (-> self string-max target z) (-> last-try-to-look-at-data horz))) + (set! (-> self string-push-z) (fmax (-> self string-push-z) (-> self string-max target z)))))) (cond ((and (logtest? (-> *target* water flags) (water-flags wt12)) - (not (logtest? (-> *target* water flags) (water-flags wt04))) - ) - (set! (-> self under-water) 2) - ) - (else - (set! (-> self under-water) 0) - 0 - ) - ) + (not (logtest? (-> *target* water flags) (water-flags wt04)))) + (set! (-> self under-water) 2)) + (else (set! (-> self under-water) 0) 0)) (let ((gp-1 (new 'stack-no-clear 'vector))) (vector--float*! gp-1 (-> self tpos-curr-adj) (-> self local-down) (-> self target-height)) - (the-as symbol (tracking-spline-method-10 (-> self target-spline) gp-1)) - ) - ) + (the-as symbol (tracking-spline-method-10 (-> self target-spline) gp-1)))) (defbehavior reset-drawable-follow camera-master () (let ((v1-2 (the-as target (-> self drawable-target process 0)))) (if (nonzero? (-> v1-2 node-list)) - (vector<-cspace! (-> self tpos-old) (-> v1-2 node-list data (-> self which-bone))) - (set! (-> self tpos-old quad) (-> v1-2 control trans quad)) - ) - ) + (vector<-cspace! (-> self tpos-old) (-> v1-2 node-list data (-> self which-bone))) + (set! (-> self tpos-old quad) (-> v1-2 control trans quad)))) (set! (-> self tpos-curr quad) (-> self tpos-old quad)) (set! (-> self tpos-old-adj quad) (-> self tpos-old quad)) (set! (-> self tpos-curr-adj quad) (-> self tpos-old quad)) - (set! (-> self upspeed) 0.0) - ) + (set! (-> self upspeed) 0.0)) (defbehavior reset-drawable-tracking camera-master () (let ((gp-0 (the-as target (-> self drawable-target process 0)))) @@ -141,45 +111,35 @@ (a0-4 (-> a3-0 vector 0 quad)) (a1-4 (-> a3-0 vector 1 quad)) (a2-0 (-> a3-0 vector 2 quad)) - (a3-1 (-> a3-0 vector 3 quad)) - ) + (a3-1 (-> a3-0 vector 3 quad))) (set! (-> v1-6 vector 0 quad) a0-4) (set! (-> v1-6 vector 1 quad) a1-4) (set! (-> v1-6 vector 2 quad) a2-0) - (set! (-> v1-6 vector 3 quad) a3-1) - ) + (set! (-> v1-6 vector 3 quad) a3-1)) (set! (-> self tgt-rot-mat vector 3 quad) (the-as uint128 0)) (let* ((v1-8 (-> self tgt-face-mat)) (a3-2 (-> self tgt-rot-mat)) (a0-5 (-> a3-2 vector 0 quad)) (a1-5 (-> a3-2 vector 1 quad)) (a2-1 (-> a3-2 vector 2 quad)) - (a3-3 (-> a3-2 vector 3 quad)) - ) + (a3-3 (-> a3-2 vector 3 quad))) (set! (-> v1-8 vector 0 quad) a0-5) (set! (-> v1-8 vector 1 quad) a1-5) (set! (-> v1-8 vector 2 quad) a2-1) - (set! (-> v1-8 vector 3 quad) a3-3) - ) - ) + (set! (-> v1-8 vector 3 quad) a3-3))) (else - (set! (-> self tpos-old quad) (-> gp-0 control trans quad)) - (quaternion->matrix (-> self tgt-rot-mat) (-> gp-0 control quat)) - (let* ((v1-11 (-> self tgt-face-mat)) - (a3-4 (-> self tgt-rot-mat)) - (a0-10 (-> a3-4 vector 0 quad)) - (a1-7 (-> a3-4 vector 1 quad)) - (a2-2 (-> a3-4 vector 2 quad)) - (a3-5 (-> a3-4 vector 3 quad)) - ) - (set! (-> v1-11 vector 0 quad) a0-10) - (set! (-> v1-11 vector 1 quad) a1-7) - (set! (-> v1-11 vector 2 quad) a2-2) - (set! (-> v1-11 vector 3 quad) a3-5) - ) - ) - ) - ) + (set! (-> self tpos-old quad) (-> gp-0 control trans quad)) + (quaternion->matrix (-> self tgt-rot-mat) (-> gp-0 control quat)) + (let* ((v1-11 (-> self tgt-face-mat)) + (a3-4 (-> self tgt-rot-mat)) + (a0-10 (-> a3-4 vector 0 quad)) + (a1-7 (-> a3-4 vector 1 quad)) + (a2-2 (-> a3-4 vector 2 quad)) + (a3-5 (-> a3-4 vector 3 quad))) + (set! (-> v1-11 vector 0 quad) a0-10) + (set! (-> v1-11 vector 1 quad) a1-7) + (set! (-> v1-11 vector 2 quad) a2-2) + (set! (-> v1-11 vector 3 quad) a3-5))))) (set! (-> self tpos-curr quad) (-> self tpos-old quad)) (set! (-> self tpos-old-adj quad) (-> self tpos-old quad)) (set! (-> self tpos-curr-adj quad) (-> self tpos-old quad)) @@ -198,24 +158,18 @@ (set! (-> self under-water) 0) (let ((gp-1 (new 'stack-no-clear 'vector))) (vector--float*! gp-1 (-> self tpos-curr-adj) (-> self local-down) (-> self target-height)) - (the-as symbol (tracking-spline-method-10 (-> self target-spline) gp-1)) - ) - ) + (the-as symbol (tracking-spline-method-10 (-> self target-spline) gp-1)))) (defbehavior master-track-target camera-master () (cond ((and (logtest? (-> self master-options) 2) (!= (-> self drawable-target) #f) - (not (handle->process (-> self drawable-target))) - ) + (not (handle->process (-> self drawable-target)))) (logand! (-> self master-options) -3) - (set! (-> self drawable-target) (the-as handle #f)) - ) + (set! (-> self drawable-target) (the-as handle #f))) ((and (logtest? (-> self master-options) 2) (handle->process (-> self drawable-target))) (let ((gp-0 (-> self drawable-target process 0))) - (if (paused?) - (return (the-as symbol #f)) - ) + (if (paused?) (return (the-as symbol #f))) (set! (-> self tpos-old quad) (-> self tpos-curr quad)) (set! (-> self tpos-old-adj quad) (-> self tpos-curr-adj quad)) (cond @@ -225,343 +179,192 @@ (a0-17 (-> a3-0 vector 0 quad)) (a1-4 (-> a3-0 vector 1 quad)) (a2-0 (-> a3-0 vector 2 quad)) - (a3-1 (-> a3-0 vector 3 quad)) - ) + (a3-1 (-> a3-0 vector 3 quad))) (set! (-> v1-24 vector 0 quad) a0-17) (set! (-> v1-24 vector 1 quad) a1-4) (set! (-> v1-24 vector 2 quad) a2-0) - (set! (-> v1-24 vector 3 quad) a3-1) - ) + (set! (-> v1-24 vector 3 quad) a3-1)) (set! (-> self tgt-rot-mat vector 3 quad) (the-as uint128 0)) (let* ((a2-1 (-> self tgt-face-mat)) (a3-2 (-> self tgt-rot-mat)) (v1-26 (-> a3-2 vector 0 quad)) (a0-18 (-> a3-2 vector 1 quad)) (a1-5 (-> a3-2 vector 2 quad)) - (a3-3 (-> a3-2 vector 3 quad)) - ) + (a3-3 (-> a3-2 vector 3 quad))) (set! (-> a2-1 vector 0 quad) v1-26) (set! (-> a2-1 vector 1 quad) a0-18) (set! (-> a2-1 vector 2 quad) a1-5) - (set! (-> a2-1 vector 3 quad) a3-3) - ) - (vector<-cspace! (-> self tpos-curr) (-> (the-as target gp-0) node-list data (-> self which-bone))) - ) + (set! (-> a2-1 vector 3 quad) a3-3)) + (vector<-cspace! (-> self tpos-curr) (-> (the-as target gp-0) node-list data (-> self which-bone)))) (else - (quaternion->matrix (-> self tgt-rot-mat) (-> (the-as target gp-0) control quat)) - (let* ((a2-3 (-> self tgt-face-mat)) - (a3-4 (-> self tgt-rot-mat)) - (v1-31 (-> a3-4 vector 0 quad)) - (a0-21 (-> a3-4 vector 1 quad)) - (a1-9 (-> a3-4 vector 2 quad)) - (a3-5 (-> a3-4 vector 3 quad)) - ) - (set! (-> a2-3 vector 0 quad) v1-31) - (set! (-> a2-3 vector 1 quad) a0-21) - (set! (-> a2-3 vector 2 quad) a1-9) - (set! (-> a2-3 vector 3 quad) a3-5) - ) - ) - ) - ) + (quaternion->matrix (-> self tgt-rot-mat) (-> (the-as target gp-0) control quat)) + (let* ((a2-3 (-> self tgt-face-mat)) + (a3-4 (-> self tgt-rot-mat)) + (v1-31 (-> a3-4 vector 0 quad)) + (a0-21 (-> a3-4 vector 1 quad)) + (a1-9 (-> a3-4 vector 2 quad)) + (a3-5 (-> a3-4 vector 3 quad))) + (set! (-> a2-3 vector 0 quad) v1-31) + (set! (-> a2-3 vector 1 quad) a0-21) + (set! (-> a2-3 vector 2 quad) a1-9) + (set! (-> a2-3 vector 3 quad) a3-5))))) (let ((v1-32 (new-stack-vector0))) 0.0 (vector-! v1-32 (-> self tpos-curr-adj) (-> self tpos-curr)) (let* ((f0-2 (vector-dot v1-32 (-> self local-down))) (f0-3 (if (< 0.0 f0-2) - (* f0-2 (-> *CAMERA_MASTER-bank* up-move-to-pitch-on-ground)) - (* f0-2 (-> *CAMERA_MASTER-bank* down-move-to-pitch-on-ground)) - ) - ) - ) - (vector+float*! (-> self tpos-curr-adj) (-> self tpos-curr) (-> self local-down) f0-3) - ) - ) + (* f0-2 (-> *CAMERA_MASTER-bank* up-move-to-pitch-on-ground)) + (* f0-2 (-> *CAMERA_MASTER-bank* down-move-to-pitch-on-ground))))) + (vector+float*! (-> self tpos-curr-adj) (-> self tpos-curr) (-> self local-down) f0-3))) (let ((gp-1 (new 'stack-no-clear 'vector))) (vector--float*! gp-1 (-> self tpos-curr-adj) (-> self local-down) (-> self target-height)) - (tracking-spline-method-17 (-> self target-spline) gp-1 2048.0 0.0 #f) - ) - (tracking-spline-method-22 (-> self target-spline) 40960.0) - ) - ((handle->process (-> self drawable-target)) - (logior! (-> self master-options) 2) - (reset-drawable-tracking) - ) - ) - (the-as - symbol - (cond - ((handle->process (-> self drawable-target)) - #f - ) - ((and *target* (logtest? (-> self master-options) 2)) - (if (paused?) - (return (the-as symbol #f)) - ) - (cond - ((time-elapsed? - (the-as time-frame (if *target* - (the-as int (-> *target* neck notice-time)) - 0 - ) - ) - (-> *CAMERA-bank* attack-timeout) - ) - (set! (-> self being-attacked) #f) - ) - (else - (if (not (-> self being-attacked)) - (set-time! (-> self attack-start)) - ) - (set! (-> self being-attacked) #t) - (when (and (not (logtest? (-> self master-options) 64)) - (or (!= (-> last-try-to-look-at-data horz) 0.0) (!= (-> last-try-to-look-at-data vert) 0.0)) - ) - (set! (-> self string-max target y) (fmax (-> self string-max target y) (-> last-try-to-look-at-data vert))) - (set! (-> self string-max target z) (fmax (-> self string-max target z) (-> last-try-to-look-at-data horz))) - (set! (-> self string-push-z) (fmax (-> self string-push-z) (-> self string-max target z))) - ) - ) - ) - (cond - ((and (logtest? (-> *target* water flags) (water-flags wt12)) - (not (logtest? (-> *target* water flags) (water-flags wt04))) - ) - (set! (-> self under-water) 2) - ) - ((> (-> self under-water) 0) - (+! (-> self under-water) -1) - ) - ) - (set! (-> self tpos-old quad) (-> self tpos-curr quad)) - (set! (-> self tpos-old-adj quad) (-> self tpos-curr-adj quad)) - (quaternion->matrix (-> self tgt-rot-mat) (-> *target* control dir-targ)) - (quaternion->matrix (-> self tgt-face-mat) (-> *target* control unknown-quaternion00)) - (cond - ((< (-> self ease-t) 1.0) - (new 'stack-no-clear 'vector) + (tracking-spline-method-17 (-> self target-spline) gp-1 2048.0 0.0 #f)) + (tracking-spline-method-22 (-> self target-spline) 40960.0)) + ((handle->process (-> self drawable-target)) (logior! (-> self master-options) 2) (reset-drawable-tracking))) + (the-as symbol (cond - ((logtest? (-> self master-options) 32) - (vector-lerp! - (-> self tpos-curr) - (-> self ease-from) - (-> self ease-to) - (parameter-ease-sin-clamp (-> self ease-t)) - ) - (logand! (-> self master-options) -33) - ) - (else - (vector-lerp! - (-> self tpos-curr) - (-> self ease-from) - (target-cam-pos) - (parameter-ease-sin-clamp (-> self ease-t)) - ) - ) - ) - (+! (-> self ease-t) (-> self ease-step)) - ) - (else - (set! (-> self tpos-curr quad) (-> (target-cam-pos) quad)) - ) - ) - (when (logtest? (-> *target* control root-prim prim-core action) (collide-action edgegrab-cam)) - (if *display-cam-los-debug* - (format *stdcon* "ride edge~%") - ) - (let ((s4-2 (new 'stack-no-clear 'collide-tri-result)) - (gp-5 (new 'stack-no-clear 'vector)) - (s5-2 (new 'stack-no-clear 'vector)) - ) - (vector--float*! s5-2 (-> self tpos-curr) (-> self local-down) (-> self target-height)) - (vector-float*! gp-5 (-> self tgt-rot-mat vector 2) 4915.2) - (vector-! s5-2 s5-2 gp-5) - (let ((f0-20 - (fill-and-probe-using-line-sphere - *collide-cache* - s5-2 - gp-5 - 4300.8 - (collide-kind background) - (the-as process #f) - s4-2 - (new 'static 'pat-surface :nocamera #x1 :nolineofsight #x1) - ) - ) - ) - (if (and (< 0.0 f0-20) (< f0-20 1.0)) - (vector+float*! (-> self tpos-curr) (-> self tpos-curr) gp-5 (+ -1.0 f0-20)) - ) - ) - ) - ) - (set! (-> self on-ground) - (not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags jump)) - (not (logtest? (-> *target* control status) (cshape-moving-flags onsurf))) - ) - ) - ) - (let ((gp-6 (new-stack-vector0))) - 0.0 - (cond - ((and (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags jump)) - (not (logtest? (-> *target* control status) (cshape-moving-flags onsurf))) - ) - (!= (-> *target* control unknown-surface00 name) 'launch-jump) - ) - (if *display-cam-los-debug* - (format *stdcon* "air tracking~%") - ) - (vector+float*! (-> self tpos-curr-adj) (-> self tpos-curr-adj) (-> self local-down) (-> self upspeed)) - (vector+float*! (-> self tpos-tgt) (-> self tpos-tgt) (-> self local-down) (-> self upspeed)) - (vector-! gp-6 (-> self tpos-curr) (-> self tpos-tgt)) - (let ((f30-0 (vector-dot gp-6 (-> self local-down)))) - (vector--float*! gp-6 gp-6 (-> self local-down) f30-0) - (if (< 0.0 f30-0) - (set! (-> self upspeed) (* 0.5 (-> self upspeed))) - ) - (vector+! (-> self tpos-tgt) (-> self tpos-tgt) gp-6) - (let ((f0-30 (* 0.05 f30-0))) - (vector+float*! (-> self tpos-tgt) (-> self tpos-tgt) (-> self local-down) f0-30) - ) - ) - (vector-! gp-6 (-> self tpos-curr-adj) (-> self tpos-tgt)) - (let* ((f0-32 (vector-dot gp-6 (-> self local-down))) - (f0-33 (if (< 0.0 f0-32) - (* f0-32 (-> *CAMERA_MASTER-bank* up-move-to-pitch-ratio-in-air)) - (* f0-32 (-> *CAMERA_MASTER-bank* down-move-to-pitch-ratio-in-air)) - ) - ) - ) - (vector+float*! (-> self tpos-curr-adj) (-> self tpos-tgt) (-> self local-down) f0-33) - ) - (vector-! gp-6 (-> *target* control shadow-pos) (-> self tpos-curr-adj)) - (let* ((f0-35 (vector-dot gp-6 (-> self local-down))) - (f0-36 (* 0.03 f0-35)) - ) - (if (and (< f0-36 0.0) (< f0-36 (-> self upspeed))) - (set! (-> self upspeed) f0-36) - ) - ) - ) - (else - (if *display-cam-los-debug* - (format *stdcon* "ground tracking~%") - ) - (vector-! gp-6 (-> self tpos-curr) (-> self tpos-old)) - (let ((f0-38 (vector-dot gp-6 (-> self local-down)))) + ((handle->process (-> self drawable-target)) #f) + ((and *target* (logtest? (-> self master-options) 2)) + (if (paused?) (return (the-as symbol #f))) + (cond + ((time-elapsed? (the-as time-frame (if *target* (the-as int (-> *target* neck notice-time)) 0)) + (-> *CAMERA-bank* attack-timeout)) + (set! (-> self being-attacked) #f)) + (else + (if (not (-> self being-attacked)) (set-time! (-> self attack-start))) + (set! (-> self being-attacked) #t) + (when (and (not (logtest? (-> self master-options) 64)) + (or (!= (-> last-try-to-look-at-data horz) 0.0) (!= (-> last-try-to-look-at-data vert) 0.0))) + (set! (-> self string-max target y) (fmax (-> self string-max target y) (-> last-try-to-look-at-data vert))) + (set! (-> self string-max target z) (fmax (-> self string-max target z) (-> last-try-to-look-at-data horz))) + (set! (-> self string-push-z) (fmax (-> self string-push-z) (-> self string-max target z)))))) + (cond + ((and (logtest? (-> *target* water flags) (water-flags wt12)) + (not (logtest? (-> *target* water flags) (water-flags wt04)))) + (set! (-> self under-water) 2)) + ((> (-> self under-water) 0) (+! (-> self under-water) -1))) + (set! (-> self tpos-old quad) (-> self tpos-curr quad)) + (set! (-> self tpos-old-adj quad) (-> self tpos-curr-adj quad)) + (quaternion->matrix (-> self tgt-rot-mat) (-> *target* control dir-targ)) + (quaternion->matrix (-> self tgt-face-mat) (-> *target* control unknown-quaternion00)) + (cond + ((< (-> self ease-t) 1.0) + (new 'stack-no-clear 'vector) + (cond + ((logtest? (-> self master-options) 32) + (vector-lerp! (-> self tpos-curr) (-> self ease-from) (-> self ease-to) (parameter-ease-sin-clamp (-> self ease-t))) + (logand! (-> self master-options) -33)) + (else + (vector-lerp! (-> self tpos-curr) (-> self ease-from) (target-cam-pos) (parameter-ease-sin-clamp (-> self ease-t))))) + (+! (-> self ease-t) (-> self ease-step))) + (else (set! (-> self tpos-curr quad) (-> (target-cam-pos) quad)))) + (when (logtest? (-> *target* control root-prim prim-core action) (collide-action edgegrab-cam)) + (if *display-cam-los-debug* (format *stdcon* "ride edge~%")) + (let ((s4-2 (new 'stack-no-clear 'collide-tri-result)) + (gp-5 (new 'stack-no-clear 'vector)) + (s5-2 (new 'stack-no-clear 'vector))) + (vector--float*! s5-2 (-> self tpos-curr) (-> self local-down) (-> self target-height)) + (vector-float*! gp-5 (-> self tgt-rot-mat vector 2) 4915.2) + (vector-! s5-2 s5-2 gp-5) + (let ((f0-20 (fill-and-probe-using-line-sphere *collide-cache* + s5-2 + gp-5 + 4300.8 + (collide-kind background) + (the-as process #f) + s4-2 + (new 'static 'pat-surface :nocamera #x1 :nolineofsight #x1)))) + (if (and (< 0.0 f0-20) (< f0-20 1.0)) (vector+float*! (-> self tpos-curr) (-> self tpos-curr) gp-5 (+ -1.0 f0-20)))))) + (set! (-> self on-ground) + (not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags jump)) + (not (logtest? (-> *target* control status) (cshape-moving-flags onsurf)))))) + (let ((gp-6 (new-stack-vector0))) + 0.0 (cond - ((logtest? (-> *target* water flags) (water-flags wt09)) - (set! (-> self upspeed) 0.0) - ) - ((< 0.0 f0-38) - (set! (-> self upspeed) 0.0) - ) + ((and (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags jump)) + (not (logtest? (-> *target* control status) (cshape-moving-flags onsurf)))) + (!= (-> *target* control unknown-surface00 name) 'launch-jump)) + (if *display-cam-los-debug* (format *stdcon* "air tracking~%")) + (vector+float*! (-> self tpos-curr-adj) (-> self tpos-curr-adj) (-> self local-down) (-> self upspeed)) + (vector+float*! (-> self tpos-tgt) (-> self tpos-tgt) (-> self local-down) (-> self upspeed)) + (vector-! gp-6 (-> self tpos-curr) (-> self tpos-tgt)) + (let ((f30-0 (vector-dot gp-6 (-> self local-down)))) + (vector--float*! gp-6 gp-6 (-> self local-down) f30-0) + (if (< 0.0 f30-0) (set! (-> self upspeed) (* 0.5 (-> self upspeed)))) + (vector+! (-> self tpos-tgt) (-> self tpos-tgt) gp-6) + (let ((f0-30 (* 0.05 f30-0))) (vector+float*! (-> self tpos-tgt) (-> self tpos-tgt) (-> self local-down) f0-30))) + (vector-! gp-6 (-> self tpos-curr-adj) (-> self tpos-tgt)) + (let* ((f0-32 (vector-dot gp-6 (-> self local-down))) + (f0-33 (if (< 0.0 f0-32) + (* f0-32 (-> *CAMERA_MASTER-bank* up-move-to-pitch-ratio-in-air)) + (* f0-32 (-> *CAMERA_MASTER-bank* down-move-to-pitch-ratio-in-air))))) + (vector+float*! (-> self tpos-curr-adj) (-> self tpos-tgt) (-> self local-down) f0-33)) + (vector-! gp-6 (-> *target* control shadow-pos) (-> self tpos-curr-adj)) + (let* ((f0-35 (vector-dot gp-6 (-> self local-down))) + (f0-36 (* 0.03 f0-35))) + (if (and (< f0-36 0.0) (< f0-36 (-> self upspeed))) (set! (-> self upspeed) f0-36)))) (else - (set! (-> self upspeed) f0-38) - ) - ) - ) - (set! (-> self tpos-tgt quad) (-> self tpos-curr quad)) - (vector-! gp-6 (-> self tpos-curr-adj) (-> self tpos-curr)) - (let* ((f0-42 (vector-dot gp-6 (-> self local-down))) - (f0-43 (if (< 0.0 f0-42) - (* f0-42 (-> *CAMERA_MASTER-bank* up-move-to-pitch-on-ground)) - (* f0-42 (-> *CAMERA_MASTER-bank* down-move-to-pitch-on-ground)) - ) - ) - ) - (vector+float*! (-> self tpos-curr-adj) (-> self tpos-curr) (-> self local-down) f0-43) - ) - ) - ) - ) - (if (not (logtest? (-> self slave-options) 16)) - (reset-follow) - ) - (let ((v1-196 (-> *target* water flags))) - (when (and (logtest? v1-196 (water-flags wt09)) (logtest? v1-196 (water-flags wt11 wt12))) - (let ((f0-45 (- (-> *target* water base-height) (-> self target-height)))) - (if (< (-> self tpos-curr-adj y) f0-45) - (set! (-> self tpos-curr-adj y) f0-45) - ) - ) - ) - ) - (vector+! (-> self pitch-off) (-> self pitch-off) (-> self tpos-curr)) - (vector-! (-> self pitch-off) (-> self pitch-off) (-> self tpos-old)) - (vector-float*! (-> self pitch-off) (-> self pitch-off) (-> *CAMERA_MASTER-bank* pitch-off-blend)) - (let ((gp-7 (new 'stack-no-clear 'vector))) - (vector--float*! gp-7 (-> self tpos-curr-adj) (-> self local-down) (-> self target-height)) - (let ((v1-207 (new 'stack-no-clear 'vector))) - 0.0 - (vector-! v1-207 (-> *target* control shadow-pos) gp-7) - (let* ((f0-50 (vector-dot v1-207 (-> self local-down))) - (f0-51 (+ -4096.0 f0-50)) - ) - (if (< f0-51 0.0) - (vector+float*! gp-7 gp-7 (-> self local-down) f0-51) - ) - ) - ) - (tracking-spline-method-17 (-> self target-spline) gp-7 2048.0 0.0 #f) - ) - (the-as symbol (tracking-spline-method-22 (-> self target-spline) 40960.0)) - ) - (*target* - (logior! (-> self master-options) 2) - (reset-target-tracking) - ) - ((logtest? (-> self master-options) 2) - (let ((v0-1 (the-as symbol (logand -3 (-> self master-options))))) - (set! (-> self master-options) (the-as uint v0-1)) - v0-1 - ) - ) - ) - ) - ) + (if *display-cam-los-debug* (format *stdcon* "ground tracking~%")) + (vector-! gp-6 (-> self tpos-curr) (-> self tpos-old)) + (let ((f0-38 (vector-dot gp-6 (-> self local-down)))) + (cond + ((logtest? (-> *target* water flags) (water-flags wt09)) (set! (-> self upspeed) 0.0)) + ((< 0.0 f0-38) (set! (-> self upspeed) 0.0)) + (else (set! (-> self upspeed) f0-38)))) + (set! (-> self tpos-tgt quad) (-> self tpos-curr quad)) + (vector-! gp-6 (-> self tpos-curr-adj) (-> self tpos-curr)) + (let* ((f0-42 (vector-dot gp-6 (-> self local-down))) + (f0-43 (if (< 0.0 f0-42) + (* f0-42 (-> *CAMERA_MASTER-bank* up-move-to-pitch-on-ground)) + (* f0-42 (-> *CAMERA_MASTER-bank* down-move-to-pitch-on-ground))))) + (vector+float*! (-> self tpos-curr-adj) (-> self tpos-curr) (-> self local-down) f0-43))))) + (if (not (logtest? (-> self slave-options) 16)) (reset-follow)) + (let ((v1-196 (-> *target* water flags))) + (when (and (logtest? v1-196 (water-flags wt09)) (logtest? v1-196 (water-flags wt11 wt12))) + (let ((f0-45 (- (-> *target* water base-height) (-> self target-height)))) + (if (< (-> self tpos-curr-adj y) f0-45) (set! (-> self tpos-curr-adj y) f0-45))))) + (vector+! (-> self pitch-off) (-> self pitch-off) (-> self tpos-curr)) + (vector-! (-> self pitch-off) (-> self pitch-off) (-> self tpos-old)) + (vector-float*! (-> self pitch-off) (-> self pitch-off) (-> *CAMERA_MASTER-bank* pitch-off-blend)) + (let ((gp-7 (new 'stack-no-clear 'vector))) + (vector--float*! gp-7 (-> self tpos-curr-adj) (-> self local-down) (-> self target-height)) + (let ((v1-207 (new 'stack-no-clear 'vector))) + 0.0 + (vector-! v1-207 (-> *target* control shadow-pos) gp-7) + (let* ((f0-50 (vector-dot v1-207 (-> self local-down))) + (f0-51 (+ -4096.0 f0-50))) + (if (< f0-51 0.0) (vector+float*! gp-7 gp-7 (-> self local-down) f0-51)))) + (tracking-spline-method-17 (-> self target-spline) gp-7 2048.0 0.0 #f)) + (the-as symbol (tracking-spline-method-22 (-> self target-spline) 40960.0))) + (*target* (logior! (-> self master-options) 2) (reset-target-tracking)) + ((logtest? (-> self master-options) 2) + (let ((v0-1 (the-as symbol (logand -3 (-> self master-options))))) + (set! (-> self master-options) (the-as uint v0-1)) + v0-1))))) (defun in-cam-entity-volume? ((arg0 vector) (arg1 entity) (arg2 float) (arg3 symbol)) (local-vars (sv-16 res-tag)) (let ((s2-0 0)) - (loop - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (the-as object ((method-of-type res-lump get-property-data) - arg1 - arg3 - 'exact - (the float s2-0) - (the-as pointer #f) - (& sv-16) - *res-static-buf* - ) - ) - ) - ) + (loop (set! sv-16 (new 'static 'res-tag)) + (let ((v1-1 (the-as object + ((method-of-type res-lump get-property-data) arg1 + arg3 + 'exact + (the float s2-0) + (the-as pointer #f) + (& sv-16) + *res-static-buf*)))) (cond - ((not (the-as pointer v1-1)) - (return #f) - ) + ((not (the-as pointer v1-1)) (return #f)) (else - (dotimes (a0-2 (the-as int (-> sv-16 elt-count))) - (if (< arg2 (- (vector-dot arg0 (-> (the-as (inline-array vector) v1-1) a0-2)) - (-> (the-as (inline-array vector) v1-1) a0-2 w) - ) - ) - (goto cfg-12) - ) - ) - (return #t) - ) - ) - ) + (dotimes (a0-2 (the-as int (-> sv-16 elt-count))) + (if (< arg2 + (- (vector-dot arg0 (-> (the-as (inline-array vector) v1-1) a0-2)) (-> (the-as (inline-array vector) v1-1) a0-2 w))) + (goto cfg-12))) + (return #t)))) (label cfg-12) - (+! s2-0 1) - ) - ) - (the-as symbol #f) - ) + (+! s2-0 1))) + (the-as symbol #f)) (defbehavior master-unset-region camera-master () (when (-> self cam-entity) @@ -575,104 +378,61 @@ (send-event *camera* 'point-of-interest #f) (set! (-> *camera-combiner* tracking point-of-interest-blend target) 0.0) (if (not (send-event *camera* 'query-state *camera-base-mode*)) - (send-event *camera* 'change-state *camera-base-mode* (seconds 1.5)) - ) + (send-event *camera* 'change-state *camera-base-mode* (seconds 1.5))) (set! (-> *camera-combiner* tracking tilt-adjust target) (-> *CAMERA-bank* default-tilt-adjust)) - (send-event *camera* 'clear-slave-option #x10000) - ) - ) + (send-event *camera* 'clear-slave-option #x10000))) (defbehavior master-base-region camera-master ((arg0 entity)) (logior! (-> self master-options) 64) - (set! (-> self stringMinHeight) - (cam-slave-get-float arg0 'stringMinHeight (-> *CAMERA-bank* default-string-min-y)) - ) - (set! (-> self stringMaxHeight) - (cam-slave-get-float arg0 'stringMaxHeight (-> *CAMERA-bank* default-string-max-y)) - ) - (set! (-> self stringMinLength) - (cam-slave-get-float arg0 'stringMinLength (-> *CAMERA-bank* default-string-min-z)) - ) - (set! (-> self stringMaxLength) - (cam-slave-get-float arg0 'stringMaxLength (-> *CAMERA-bank* default-string-max-z)) - ) + (set! (-> self stringMinHeight) (cam-slave-get-float arg0 'stringMinHeight (-> *CAMERA-bank* default-string-min-y))) + (set! (-> self stringMaxHeight) (cam-slave-get-float arg0 'stringMaxHeight (-> *CAMERA-bank* default-string-max-y))) + (set! (-> self stringMinLength) (cam-slave-get-float arg0 'stringMinLength (-> *CAMERA-bank* default-string-min-z))) + (set! (-> self stringMaxLength) (cam-slave-get-float arg0 'stringMaxLength (-> *CAMERA-bank* default-string-max-z))) (let ((s5-0 (new 'stack-no-clear 'vector))) (if (cam-slave-get-vector-with-offset (the-as entity-actor arg0) s5-0 'interesting) - (send-event *camera* 'point-of-interest s5-0) - ) - ) - (if (< 405504.0 (-> self stringMaxLength)) - (set! (-> self stringMaxLength) (-> *CAMERA-bank* default-string-max-z)) - ) + (send-event *camera* 'point-of-interest s5-0))) + (if (< 405504.0 (-> self stringMaxLength)) (set! (-> self stringMaxLength) (-> *CAMERA-bank* default-string-max-z))) (set! (-> self stringCliffHeight) (cam-slave-get-float arg0 'stringCliffHeight 163840.0)) (if (not (send-event *camera* 'query-state *camera-base-mode*)) - (send-event *camera* 'change-state *camera-base-mode* (seconds 1.5)) - ) - (if (logtest? #x10000 (cam-slave-get-flags (-> self cam-entity) 'flags)) - (send-event *camera* 'set-slave-option #x10000) - ) + (send-event *camera* 'change-state *camera-base-mode* (seconds 1.5))) + (if (logtest? #x10000 (cam-slave-get-flags (-> self cam-entity) 'flags)) (send-event *camera* 'set-slave-option #x10000)) (set! (-> *camera-combiner* tracking tilt-adjust target) - (cam-slave-get-float arg0 'tiltAdjust (-> *CAMERA-bank* default-tilt-adjust)) - ) - ) + (cam-slave-get-float arg0 'tiltAdjust (-> *CAMERA-bank* default-tilt-adjust)))) (defun setup-slave-for-hopefull ((arg0 camera-slave)) (when (= (-> arg0 blend-to-type) 2) (cam-calc-follow! (-> arg0 tracking) (-> arg0 trans) #f) - (slave-set-rotation! (-> arg0 tracking) (-> arg0 trans) (the-as float (-> arg0 options)) (-> arg0 fov) #f) - ) - (none) - ) + (slave-set-rotation! (-> arg0 tracking) (-> arg0 trans) (the-as float (-> arg0 options)) (-> arg0 fov) #f)) + (none)) (defbehavior master-is-hopeful-better? camera-master ((arg0 camera-slave) (arg1 camera-slave)) (if (not *camera-combiner*) - #f - (< (vector-dot (-> arg0 tracking inv-mat vector 2) (-> *camera-combiner* inv-camera-rot vector 2)) - (vector-dot (-> arg1 tracking inv-mat vector 2) (-> *camera-combiner* inv-camera-rot vector 2)) - ) - ) - ) + #f + (< (vector-dot (-> arg0 tracking inv-mat vector 2) (-> *camera-combiner* inv-camera-rot vector 2)) + (vector-dot (-> arg1 tracking inv-mat vector 2) (-> *camera-combiner* inv-camera-rot vector 2))))) (defbehavior master-switch-to-entity camera-master ((arg0 entity)) - (local-vars - (v0-21 object) - (gp-0 (pointer process)) - (sv-16 res-tag) - (sv-112 process) - (sv-128 string) - (sv-144 string) - ) + (local-vars (v0-21 object) (gp-0 (pointer process)) (sv-16 res-tag) (sv-112 process) (sv-128 string) (sv-144 string)) (set! (-> self cam-entity) arg0) 10 (let ((s4-0 (cam-state-from-entity arg0))) (cond - ((= s4-0 *camera-base-mode*) - (master-base-region arg0) - (return #t) - ) + ((= s4-0 *camera-base-mode*) (master-base-region arg0) (return #t)) (s4-0 - (let ((s3-0 (get-process *camera-dead-pool* camera-slave #x4000))) - (set! gp-0 (when s3-0 - (let ((t9-3 (method-of-type camera-slave activate))) - (t9-3 (the-as camera-slave s3-0) self 'camera-slave (the-as pointer #x70004000)) - ) - (run-now-in-process s3-0 cam-slave-init s4-0 arg0) - (-> s3-0 ppointer) - ) - ) - ) - (when (not gp-0) - (format 0 "ERROR : primary region activate failed~%") - (return #f) - ) - (setup-slave-for-hopefull (the-as camera-slave (ppointer->process gp-0))) - ) + (let ((s3-0 (get-process *camera-dead-pool* camera-slave #x4000))) + (set! gp-0 + (when s3-0 + (let ((t9-3 (method-of-type camera-slave activate))) + (t9-3 (the-as camera-slave s3-0) self 'camera-slave (the-as pointer #x70004000))) + (run-now-in-process s3-0 cam-slave-init s4-0 arg0) + (-> s3-0 ppointer)))) + (when (not gp-0) + (format 0 "ERROR : primary region activate failed~%") + (return #f)) + (setup-slave-for-hopefull (the-as camera-slave (ppointer->process gp-0)))) (else - (format 0 "ERROR : camera region '~S' didn't produce a state~%" (res-lump-struct arg0 'name structure)) - (return #f) - ) - ) - ) + (format 0 "ERROR : camera region '~S' didn't produce a state~%" (res-lump-struct arg0 'name structure)) + (return #f)))) (set! sv-16 (new 'static 'res-tag)) (let ((s4-2 (res-lump-data arg0 'alternates (pointer string) :tag-ptr (& sv-16)))) (when s4-2 @@ -681,842 +441,466 @@ (set! v0-21 (cond (s2-0 - (let ((s0-0 (cam-state-from-entity s2-0))) - (cond - ((= s0-0 *camera-base-mode*) - (deactivate (-> gp-0 0)) - (master-base-region s2-0) - (return #t) - v0-21 - ) - (s0-0 - (set! sv-112 (get-process *camera-dead-pool* camera-slave #x4000)) - (let ((s1-0 (when sv-112 - (let ((t9-15 (method-of-type camera-slave activate))) - (t9-15 (the-as camera-slave sv-112) self 'camera-slave (the-as pointer #x70004000)) - ) - (run-now-in-process sv-112 cam-slave-init s0-0 s2-0) - (-> sv-112 ppointer) - ) - ) - ) - (cond - (s1-0 - (setup-slave-for-hopefull (the-as camera-slave (ppointer->process s1-0))) - (cond - ((master-is-hopeful-better? - (the-as camera-slave (ppointer->process gp-0)) - (the-as camera-slave (ppointer->process s1-0)) - ) - (deactivate (-> gp-0 0)) - (set! gp-0 s1-0) - gp-0 - ) - (else - (deactivate (-> s1-0 0)) - ) - ) - ) - (else - (format 0 "ERROR : alternate region activate failed~%") - ) - ) - ) - ) - (else - (let ((s1-1 format) - (s0-1 0) - ) - (set! sv-128 "ERROR : alternate camera region '~S' didn't produce a state~%") - (let ((a2-10 (res-lump-struct s2-0 'name structure))) - (s1-1 s0-1 sv-128 a2-10) - ) - ) - ) - ) - ) - ) + (let ((s0-0 (cam-state-from-entity s2-0))) + (cond + ((= s0-0 *camera-base-mode*) (deactivate (-> gp-0 0)) (master-base-region s2-0) (return #t) v0-21) + (s0-0 + (set! sv-112 (get-process *camera-dead-pool* camera-slave #x4000)) + (let ((s1-0 (when sv-112 + (let ((t9-15 (method-of-type camera-slave activate))) + (t9-15 (the-as camera-slave sv-112) self 'camera-slave (the-as pointer #x70004000))) + (run-now-in-process sv-112 cam-slave-init s0-0 s2-0) + (-> sv-112 ppointer)))) + (cond + (s1-0 + (setup-slave-for-hopefull (the-as camera-slave (ppointer->process s1-0))) + (cond + ((master-is-hopeful-better? (the-as camera-slave (ppointer->process gp-0)) + (the-as camera-slave (ppointer->process s1-0))) + (deactivate (-> gp-0 0)) + (set! gp-0 s1-0) + gp-0) + (else (deactivate (-> s1-0 0))))) + (else (format 0 "ERROR : alternate region activate failed~%"))))) + (else + (let ((s1-1 format) + (s0-1 0)) + (set! sv-128 "ERROR : alternate camera region '~S' didn't produce a state~%") + (let ((a2-10 (res-lump-struct s2-0 'name structure))) (s1-1 s0-1 sv-128 a2-10))))))) (else - (let ((s2-1 format) - (s1-2 0) - (s0-2 "ERROR : alternate '~S' not found for '~S'~%") - ) - (set! sv-144 (-> s4-2 s3-2)) - (let ((a3-8 (res-lump-struct arg0 'name structure))) - (s2-1 s1-2 s0-2 sv-144 a3-8) - ) - ) - ) - ) - ) - ) - ) - ) - ) + (let ((s2-1 format) + (s1-2 0) + (s0-2 "ERROR : alternate '~S' not found for '~S'~%")) + (set! sv-144 (-> s4-2 s3-2)) + (let ((a3-8 (res-lump-struct arg0 'name structure))) (s2-1 s1-2 s0-2 sv-144 a3-8)))))))))) (let ((v1-48 (the int (* 300.0 (cam-slave-get-interp-time (-> (the-as camera-slave (-> gp-0 0)) cam-entity)))))) - (if (nonzero? (-> self force-blend)) - (set! v1-48 (min v1-48 (the-as int (-> self force-blend-time)))) - ) - (send-event *camera* 'change-state (ppointer->process gp-0) v1-48) - ) - #t - ) + (if (nonzero? (-> self force-blend)) (set! v1-48 (min v1-48 (the-as int (-> self force-blend-time))))) + (send-event *camera* 'change-state (ppointer->process gp-0) v1-48)) + #t) (defbehavior master-check-regions camera-master () (cond - ((send-event *camera* 'query-state cam-eye) - #f - ) - ((or (not *target*) (logtest? (-> self master-options) 1)) - (master-unset-region) - ) + ((send-event *camera* 'query-state cam-eye) #f) + ((or (not *target*) (logtest? (-> self master-options) 1)) (master-unset-region)) ((and (logtest? (-> self master-options) 4) (not (-> self on-ground)) - (or (not (-> self cam-entity)) (not (logtest? #x20000 (cam-slave-get-flags (-> self cam-entity) 'flags)))) - ) - #f - ) + (or (not (-> self cam-entity)) (not (logtest? #x20000 (cam-slave-get-flags (-> self cam-entity) 'flags))))) + #f) ((and (-> self cam-entity) (not (in-cam-entity-volume? (target-pos 0) (-> self cam-entity) 0.0 'cutoutvol)) (or (in-cam-entity-volume? (target-pos 0) (-> self cam-entity) 1024.0 'pvol) (in-cam-entity-volume? (target-pos 0) (-> self cam-entity) 1024.0 'vol) - (and (not ((method-of-type res-lump get-property-data) - (-> self cam-entity) - 'pvol - 'exact - 0.0 - (the-as pointer #f) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - (not ((method-of-type res-lump get-property-data) - (-> self cam-entity) - 'vol - 'exact - 0.0 - (the-as pointer #f) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - ) - ) - #f - ) + (and (not ((method-of-type res-lump get-property-data) (-> self cam-entity) + 'pvol + 'exact + 0.0 + (the-as pointer #f) + (the-as (pointer res-tag) #f) + *res-static-buf*)) + (not ((method-of-type res-lump get-property-data) (-> self cam-entity) + 'vol + 'exact + 0.0 + (the-as pointer #f) + (the-as (pointer res-tag) #f) + *res-static-buf*))))) + #f) (else - (let ((v1-17 (-> *camera-engine* alive-list next0))) - *camera-engine* - (let ((gp-5 (-> v1-17 next0))) - (while (!= v1-17 (-> *camera-engine* alive-list-end)) - (let ((s5-1 (-> (the-as connection v1-17) param1))) - (when (and (not (in-cam-entity-volume? (target-pos 0) (the-as entity s5-1) 1024.0 'cutoutvol)) - (in-cam-entity-volume? (target-pos 0) (the-as entity s5-1) 0.0 'vol) - ) - (if (master-switch-to-entity (the-as entity s5-1)) - (return #t) - ) - ) - ) - (set! v1-17 gp-5) - *camera-engine* - (set! gp-5 (-> gp-5 next0)) - ) - ) - ) - (master-unset-region) - ) - ) - ) + (let ((v1-17 (-> *camera-engine* alive-list next0))) + *camera-engine* + (let ((gp-5 (-> v1-17 next0))) + (while (!= v1-17 (-> *camera-engine* alive-list-end)) + (let ((s5-1 (-> (the-as connection v1-17) param1))) + (when (and (not (in-cam-entity-volume? (target-pos 0) (the-as entity s5-1) 1024.0 'cutoutvol)) + (in-cam-entity-volume? (target-pos 0) (the-as entity s5-1) 0.0 'vol)) + (if (master-switch-to-entity (the-as entity s5-1)) (return #t)))) + (set! v1-17 gp-5) + *camera-engine* + (set! gp-5 (-> gp-5 next0))))) + (master-unset-region)))) (defstate cam-master-active (camera-master) - :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (local-vars (v0-0 object)) - (rlet ((vf0 :class vf)) - (init-vf0-vector) - (let ((v1-0 message)) - (cond - ((= v1-0 'dist-from-interp-src) - (set! v0-0 (cond - ((not *camera-combiner*) - 409600.0 - ) - ((= (-> *camera-combiner* interp-val) 0.0) - 0.0 - ) - (else - (-> *camera-combiner* dist-from-src) - ) - ) - ) - ) - ((= v1-0 'dist-from-interp-dest) - (set! v0-0 (cond - ((not *camera-combiner*) - 0.0 - ) - ((= (-> *camera-combiner* interp-val) 0.0) - 409600.0 - ) - (else - (-> *camera-combiner* dist-from-dest) - ) - ) - ) - ) - ((= v1-0 'level-deactivate) - (set! v0-0 (if (and (-> self cam-entity) (= (-> (get-level (-> self cam-entity)) name) (-> block param 0))) - (master-unset-region) - ) - ) - ) - ((= v1-0 'clear-entity) - (set! v0-0 (master-unset-region)) - ) - ((= v1-0 'no-intro) - (set! v0-0 3) - (set! (-> self no-intro) (the-as uint v0-0)) - ) - ((= v1-0 'force-blend) - (set! (-> self force-blend) (the-as uint 3)) - (set! v0-0 (-> block param 0)) - (set! (-> self force-blend-time) (the-as uint v0-0)) - ) - ((= v1-0 'teleport-to-transformq) - (set! v0-0 (when (> argc 0) - (let ((gp-1 (the-as object (-> block param 0)))) - (send-event self 'change-state cam-free-floating 0) - (dotimes (s5-1 (-> self num-slaves)) - (set! (-> self slave s5-1 0 trans quad) (-> (the-as matrix gp-1) vector 0 quad)) - (quaternion->matrix - (the-as matrix (-> self slave s5-1 0 tracking)) - (the-as quaternion (+ (the-as uint gp-1) 16)) - ) - ) - ) - (send-event self 'teleport) - ) - ) - ) - ((= v1-0 'teleport-to-other-start-string) - (let ((gp-2 (new 'stack-no-clear 'vector))) - (set! (-> *camera-combiner* trans quad) (-> *camera-other-trans* quad)) - (vector-! gp-2 (-> self tpos-curr-adj) *camera-other-trans*) - (vector-normalize! gp-2 1.0) - (forward-down->inv-matrix (-> *camera-combiner* inv-camera-rot) gp-2 (new 'static 'vector :y -1.0)) - ) - (send-event self 'change-state cam-free-floating 0) - (send-event self 'teleport) - (let ((a1-10 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-10 from) self) - (set! (-> a1-10 num-params) 2) - (set! (-> a1-10 message) 'change-state) - (set! (-> a1-10 param 0) (the-as uint *camera-base-mode*)) - (set! (-> a1-10 param 1) (the-as uint 0)) - (set! v0-0 (send-event-function self a1-10)) - ) - ) - ((= v1-0 'teleport-to-vector-start-string) - (set! v0-0 - (when (> argc 0) - (let ((v1-43 (the-as object (-> block param 0))) - (gp-3 (new 'stack-no-clear 'vector)) - ) - (set! (-> *camera-combiner* trans quad) (-> (the-as vector v1-43) quad)) - (vector-! gp-3 (-> self tpos-curr-adj) (the-as vector v1-43)) - (vector-normalize! gp-3 1.0) - (forward-down->inv-matrix (-> *camera-combiner* inv-camera-rot) gp-3 (new 'static 'vector :y -1.0)) - ) - (send-event self 'change-state cam-free-floating 0) - (send-event self 'change-state *camera-base-mode* 0) - ) - ) - ) - ((= v1-0 'change-pov) - (let ((v1-52 (the-as object (-> block param 0)))) - (cond - ((< argc 2) - (set! (-> self pov-bone) 0) - 0 - ) - (else - (set! (-> self pov-bone) (the-as int (-> block param 1))) - ) - ) - (set! v0-0 (cond - ((not (the-as process v1-52)) - (set! (-> self pov-handle) (the-as handle #f)) - #f - ) - (else - (set! v0-0 (process->handle (the-as process v1-52))) - (set! (-> self pov-handle) (the-as handle v0-0)) - v0-0 - ) - ) - ) - ) - ) - ((= v1-0 'change-target-bone) - (set! v0-0 (-> block param 0)) - (set! (-> self which-bone) (the-as int v0-0)) - ) - ((= v1-0 'change-target) - (let ((v1-56 (the-as object (-> block param 0)))) - (cond - ((< argc 2) - (set! (-> self which-bone) 0) - 0 - ) - (else - (set! (-> self which-bone) (the-as int (-> block param 1))) - ) - ) - (cond - ((not (the-as process v1-56)) - (set! (-> self drawable-target) (the-as handle #f)) - (logand! (-> self master-options) -3) - ) - ((= (the-as process v1-56) *target*) - (set! (-> self drawable-target) (the-as handle #f)) - (logior! (-> self master-options) 2) - (reset-target-tracking) - ) - (else - (set! (-> self drawable-target) (process->handle (the-as process v1-56))) - (logior! (-> self master-options) 2) - (reset-drawable-tracking) - ) - ) - ) - (set! (-> *camera-combiner* tracking no-follow) #f) - (set! v0-0 #f) - ) - ((= v1-0 'reset-root) - (dotimes (gp-4 (-> self num-slaves)) - (set! (-> self slave gp-4 0 trans quad) (the-as uint128 0)) - (matrix-identity! (the-as matrix (-> self slave gp-4 0 tracking))) - ) - (vector-reset! (-> *camera-combiner* trans)) - (set! v0-0 (matrix-identity! (the-as matrix (-> *camera-combiner* tracking)))) - ) - ((= v1-0 'set-fov) - (set! (-> *camera-combiner* fov) (the-as float (-> block param 0))) - (dotimes (v1-86 (-> self num-slaves)) - (set! (-> self slave v1-86 0 fov) (the-as float (-> block param 0))) - ) - (set! v0-0 #f) - ) - ((= v1-0 'query-fov) - (set! v0-0 (if (> (-> self num-slaves) 0) - (-> self slave 0 0 fov) - 11650.845 - ) - ) - ) - ((= v1-0 'intro-done?) - (set! v0-0 #t) - (dotimes (v1-91 (-> self num-slaves)) - (if (< (-> self slave v1-91 0 intro-t) 1.0) - (set! v0-0 #f) - ) - ) - ) - ((= v1-0 'query-state) - (let ((v1-95 (+ (-> self num-slaves) -1))) - (while (not (or (< v1-95 0) (= (-> self slave v1-95 0 next-state) (-> block param 0)))) - (+! v1-95 -1) - ) - (set! v0-0 (and (>= v1-95 0) (= (-> self slave v1-95 0 next-state) (-> block param 0)))) - ) - ) - ((= v1-0 'change-to-entity-by-name) - (let ((a0-75 (entity-by-name (the-as string (-> block param 0))))) + :event + (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (local-vars (v0-0 object)) + (rlet ((vf0 :class vf)) + (init-vf0-vector) + (let ((v1-0 message)) + (cond + ((= v1-0 'dist-from-interp-src) (set! v0-0 - (if a0-75 - (master-switch-to-entity a0-75) - (format 0 "ERROR : camera entity '~S' not found for change-to-entity-by-name~%" (-> block param 0)) - ) - ) - ) - ) - ((= v1-0 'change-state) - (let ((s1-0 (the-as uint #f)) - (s2-0 (the-as (pointer process) #f)) - (s5-2 (the-as (pointer camera-slave) #f)) - ) - (let ((s3-0 (the-as object #f)) - (s4-1 (the-as (pointer camera-slave) #f)) - ) - (let ((t9-22 type-type?) - (v1-101 (-> block param 0)) - ) - (cond - ((t9-22 (rtype-of v1-101) state) - (set! s1-0 (-> block param 0)) - ) - ((let ((t9-23 type-type?) - (v1-103 (-> block param 0)) - ) - (t9-23 (rtype-of v1-103) camera-slave) - ) - (set! s2-0 (process->ppointer (the-as process (-> block param 0)))) - ) - (else - (let ((t9-24 format) - (a0-82 0) - (a1-25 "ERROR : invalid type '~A' to *camera* change-state~%") - (v1-106 (-> block param 0)) - ) - (t9-24 a0-82 a1-25 (rtype-of v1-106)) - ) - ) - ) - ) - (if (and (> (-> self num-slaves) 0) - (or (= (-> self slave 0 0 next-state name) 'cam-stick) (= (-> self slave 0 0 next-state name) 'cam-string)) - ) - (set! (-> self view-off-param-save) (-> self slave 0 0 view-off-param)) - ) - (set! (-> self changer) (the-as uint (process->ppointer proc))) + (cond + ((not *camera-combiner*) 409600.0) + ((= (-> *camera-combiner* interp-val) 0.0) 0.0) + (else (-> *camera-combiner* dist-from-src))))) + ((= v1-0 'dist-from-interp-dest) + (set! v0-0 + (cond + ((not *camera-combiner*) 0.0) + ((= (-> *camera-combiner* interp-val) 0.0) 409600.0) + (else (-> *camera-combiner* dist-from-dest))))) + ((= v1-0 'level-deactivate) + (set! v0-0 + (if (and (-> self cam-entity) (= (-> (get-level (-> self cam-entity)) name) (-> block param 0))) (master-unset-region)))) + ((= v1-0 'clear-entity) (set! v0-0 (master-unset-region))) + ((= v1-0 'no-intro) (set! v0-0 3) (set! (-> self no-intro) (the-as uint v0-0))) + ((= v1-0 'force-blend) + (set! (-> self force-blend) (the-as uint 3)) + (set! v0-0 (-> block param 0)) + (set! (-> self force-blend-time) (the-as uint v0-0))) + ((= v1-0 'teleport-to-transformq) + (set! v0-0 + (when (> argc 0) + (let ((gp-1 (the-as object (-> block param 0)))) + (send-event self 'change-state cam-free-floating 0) + (dotimes (s5-1 (-> self num-slaves)) + (set! (-> self slave s5-1 0 trans quad) (-> (the-as matrix gp-1) vector 0 quad)) + (quaternion->matrix (the-as matrix (-> self slave s5-1 0 tracking)) (the-as quaternion (+ (the-as uint gp-1) 16))))) + (send-event self 'teleport)))) + ((= v1-0 'teleport-to-other-start-string) + (let ((gp-2 (new 'stack-no-clear 'vector))) + (set! (-> *camera-combiner* trans quad) (-> *camera-other-trans* quad)) + (vector-! gp-2 (-> self tpos-curr-adj) *camera-other-trans*) + (vector-normalize! gp-2 1.0) + (forward-down->inv-matrix (-> *camera-combiner* inv-camera-rot) gp-2 (new 'static 'vector :y -1.0))) + (send-event self 'change-state cam-free-floating 0) + (send-event self 'teleport) + (let ((a1-10 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-10 from) self) + (set! (-> a1-10 num-params) 2) + (set! (-> a1-10 message) 'change-state) + (set! (-> a1-10 param 0) (the-as uint *camera-base-mode*)) + (set! (-> a1-10 param 1) (the-as uint 0)) + (set! v0-0 (send-event-function self a1-10)))) + ((= v1-0 'teleport-to-vector-start-string) + (set! v0-0 + (when (> argc 0) + (let ((v1-43 (the-as object (-> block param 0))) + (gp-3 (new 'stack-no-clear 'vector))) + (set! (-> *camera-combiner* trans quad) (-> (the-as vector v1-43) quad)) + (vector-! gp-3 (-> self tpos-curr-adj) (the-as vector v1-43)) + (vector-normalize! gp-3 1.0) + (forward-down->inv-matrix (-> *camera-combiner* inv-camera-rot) gp-3 (new 'static 'vector :y -1.0))) + (send-event self 'change-state cam-free-floating 0) + (send-event self 'change-state *camera-base-mode* 0)))) + ((= v1-0 'change-pov) + (let ((v1-52 (the-as object (-> block param 0)))) (cond - ((<= (-> self num-slaves) 0) - (cond - (s2-0 - (let ((a1-26 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-26 from) self) - (set! (-> a1-26 num-params) 1) - (set! (-> a1-26 message) 'slave-activated) - (let ((v1-126 s2-0)) - (set! (-> a1-26 param 0) (the-as uint (if v1-126 - (-> (the-as camera-slave (-> v1-126 0)) self) - ) - ) - ) - ) - (send-event-function self a1-26) - ) - ) - (else - (let ((gp-5 (the-as camera-slave (get-process *camera-dead-pool* camera-slave #x4000)))) - (set! s2-0 (when gp-5 - (let ((t9-27 (method-of-type camera-slave activate))) - (t9-27 gp-5 self 'camera-slave (the-as pointer #x70004000)) - ) - (run-now-in-process gp-5 cam-slave-init s1-0 #f) - (-> gp-5 ppointer) - ) - ) - ) + ((< argc 2) (set! (-> self pov-bone) 0) 0) + (else (set! (-> self pov-bone) (the-as int (-> block param 1))))) + (set! v0-0 + (cond + ((not (the-as process v1-52)) (set! (-> self pov-handle) (the-as handle #f)) #f) + (else (set! v0-0 (process->handle (the-as process v1-52))) (set! (-> self pov-handle) (the-as handle v0-0)) v0-0))))) + ((= v1-0 'change-target-bone) (set! v0-0 (-> block param 0)) (set! (-> self which-bone) (the-as int v0-0))) + ((= v1-0 'change-target) + (let ((v1-56 (the-as object (-> block param 0)))) + (cond + ((< argc 2) (set! (-> self which-bone) 0) 0) + (else (set! (-> self which-bone) (the-as int (-> block param 1))))) + (cond + ((not (the-as process v1-56)) (set! (-> self drawable-target) (the-as handle #f)) (logand! (-> self master-options) -3)) + ((= (the-as process v1-56) *target*) + (set! (-> self drawable-target) (the-as handle #f)) + (logior! (-> self master-options) 2) + (reset-target-tracking)) + (else + (set! (-> self drawable-target) (process->handle (the-as process v1-56))) + (logior! (-> self master-options) 2) + (reset-drawable-tracking)))) + (set! (-> *camera-combiner* tracking no-follow) #f) + (set! v0-0 #f)) + ((= v1-0 'reset-root) + (dotimes (gp-4 (-> self num-slaves)) + (set! (-> self slave gp-4 0 trans quad) (the-as uint128 0)) + (matrix-identity! (the-as matrix (-> self slave gp-4 0 tracking)))) + (vector-reset! (-> *camera-combiner* trans)) + (set! v0-0 (matrix-identity! (the-as matrix (-> *camera-combiner* tracking))))) + ((= v1-0 'set-fov) + (set! (-> *camera-combiner* fov) (the-as float (-> block param 0))) + (dotimes (v1-86 (-> self num-slaves)) + (set! (-> self slave v1-86 0 fov) (the-as float (-> block param 0)))) + (set! v0-0 #f)) + ((= v1-0 'query-fov) (set! v0-0 (if (> (-> self num-slaves) 0) (-> self slave 0 0 fov) 11650.845))) + ((= v1-0 'intro-done?) + (set! v0-0 #t) + (dotimes (v1-91 (-> self num-slaves)) + (if (< (-> self slave v1-91 0 intro-t) 1.0) (set! v0-0 #f)))) + ((= v1-0 'query-state) + (let ((v1-95 (+ (-> self num-slaves) -1))) + (while (not (or (< v1-95 0) (= (-> self slave v1-95 0 next-state) (-> block param 0)))) + (+! v1-95 -1)) + (set! v0-0 (and (>= v1-95 0) (= (-> self slave v1-95 0 next-state) (-> block param 0)))))) + ((= v1-0 'change-to-entity-by-name) + (let ((a0-75 (entity-by-name (the-as string (-> block param 0))))) + (set! v0-0 + (if a0-75 + (master-switch-to-entity a0-75) + (format 0 "ERROR : camera entity '~S' not found for change-to-entity-by-name~%" (-> block param 0)))))) + ((= v1-0 'change-state) + (let ((s1-0 (the-as uint #f)) + (s2-0 (the-as (pointer process) #f)) + (s5-2 (the-as (pointer camera-slave) #f))) + (let ((s3-0 (the-as object #f)) + (s4-1 (the-as (pointer camera-slave) #f))) + (let ((t9-22 type-type?) + (v1-101 (-> block param 0))) + (cond + ((t9-22 (rtype-of v1-101) state) (set! s1-0 (-> block param 0))) + ((let ((t9-23 type-type?) + (v1-103 (-> block param 0))) + (t9-23 (rtype-of v1-103) camera-slave)) + (set! s2-0 (process->ppointer (the-as process (-> block param 0))))) + (else + (let ((t9-24 format) + (a0-82 0) + (a1-25 "ERROR : invalid type '~A' to *camera* change-state~%") + (v1-106 (-> block param 0))) + (t9-24 a0-82 a1-25 (rtype-of v1-106)))))) + (if (and (> (-> self num-slaves) 0) + (or (= (-> self slave 0 0 next-state name) 'cam-stick) (= (-> self slave 0 0 next-state name) 'cam-string))) + (set! (-> self view-off-param-save) (-> self slave 0 0 view-off-param))) + (set! (-> self changer) (the-as uint (process->ppointer proc))) + (cond + ((<= (-> self num-slaves) 0) + (cond + (s2-0 + (let ((a1-26 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-26 from) self) + (set! (-> a1-26 num-params) 1) + (set! (-> a1-26 message) 'slave-activated) + (let ((v1-126 s2-0)) (set! (-> a1-26 param 0) (the-as uint (if v1-126 (-> (the-as camera-slave (-> v1-126 0)) self))))) + (send-event-function self a1-26))) + (else + (let ((gp-5 (the-as camera-slave (get-process *camera-dead-pool* camera-slave #x4000)))) + (set! s2-0 + (when gp-5 + (let ((t9-27 (method-of-type camera-slave activate))) (t9-27 gp-5 self 'camera-slave (the-as pointer #x70004000))) + (run-now-in-process gp-5 cam-slave-init s1-0 #f) + (-> gp-5 ppointer)))) + (cond + (s2-0) + (else (format 0 "ERROR : replacement slave failed to activate~%"))))) + (when s2-0 + (send-event *camera-combiner* 'stop-tracking) + (if (= (-> (the-as camera-slave (-> s2-0 0)) blend-to-type) 2) + (send-event *camera-combiner* 'start-tracking (if s2-0 (-> (the-as camera-slave (-> s2-0 0)) self)))))) + ((zero? (-> block param 1)) + (if *math-camera* (set! (-> *math-camera* reset) 1)) + (when (< 1 (-> self num-slaves)) + (if (= (-> self changer) (-> self slave 1)) (set! s5-2 (-> self slave 1)) (deactivate (-> self slave 1 0))) + (set! (-> self slave 1) (the-as (pointer camera-slave) #f)) + (+! (-> self num-slaves) -1)) + (cond + (s2-0 + (if (= (-> self changer) (-> self slave 0)) (set! s5-2 (-> self slave 0)) (deactivate (-> self slave 0 0))) + (set! (-> self slave 0) (the-as (pointer camera-slave) #f)) + (+! (-> self num-slaves) -1) + (let ((a1-33 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-33 from) self) + (set! (-> a1-33 num-params) 1) + (set! (-> a1-33 message) 'slave-activated) + (let ((v1-166 s2-0)) (set! (-> a1-33 param 0) (the-as uint (if v1-166 (-> (the-as camera-slave (-> v1-166 0)) self))))) + (send-event-function self a1-33))) + ((not (and (= (-> self slave 0 0 next-state) *camera-base-mode*) (= (-> self slave 0 0 next-state) s1-0))) + (send-event (ppointer->process (-> self slave 0)) 'change-state-no-go s1-0) + (set! s4-1 (-> self slave 0)) + (set! s3-0 s1-0) + (set! s2-0 (-> self slave 0)))) + (when s2-0 + (send-event *camera-combiner* 'stop-tracking) + (when (= (-> (the-as camera-slave (-> s2-0 0)) blend-to-type) 2) + (let ((a1-36 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-36 from) self) + (set! (-> a1-36 num-params) 1) + (set! (-> a1-36 message) 'start-tracking) + (let ((v1-191 s2-0)) (set! (-> a1-36 param 0) (the-as uint (if v1-191 (-> (the-as camera-slave (-> v1-191 0)) self))))) + (send-event-function *camera-combiner* a1-36))))) + (else + (when (< 1 (-> self num-slaves)) + (if (= (-> self changer) (-> self slave 0)) (set! s5-2 (-> self slave 0)) (deactivate (-> self slave 0 0))) + (set! (-> self slave 0) (-> self slave 1)) + (set! (-> self slave 1) (the-as (pointer camera-slave) #f)) + (+! (-> self num-slaves) -1)) + (when (< 0.0 (-> self slave 0 0 intro-t-step)) + (set! (-> self outro-t) (-> self slave 0 0 intro-t)) + (set! (-> self outro-t-step) (/ -5.0 (the float (-> block param 1)))) + (set! (-> self outro-exit-value) (-> self slave 0 0 outro-exit-value)) + (curve-copy! (-> self outro-curve) (-> self slave 0 0 intro-curve))) + (if (nonzero? (-> self no-intro)) (set! (-> self outro-t) 0.0)) + (when (not (and (= (-> self slave 0 0 next-state) *camera-base-mode*) (= (-> self slave 0 0 next-state) s1-0))) (cond (s2-0 - ) - (else - (format 0 "ERROR : replacement slave failed to activate~%") - ) - ) - ) - ) - (when s2-0 - (send-event *camera-combiner* 'stop-tracking) - (if (= (-> (the-as camera-slave (-> s2-0 0)) blend-to-type) 2) - (send-event *camera-combiner* 'start-tracking (if s2-0 - (-> (the-as camera-slave (-> s2-0 0)) self) - ) - ) - ) - ) - ) - ((zero? (-> block param 1)) - (if *math-camera* - (set! (-> *math-camera* reset) 1) - ) - (when (< 1 (-> self num-slaves)) - (if (= (-> self changer) (-> self slave 1)) - (set! s5-2 (-> self slave 1)) - (deactivate (-> self slave 1 0)) - ) - (set! (-> self slave 1) (the-as (pointer camera-slave) #f)) - (+! (-> self num-slaves) -1) - ) - (cond - (s2-0 - (if (= (-> self changer) (-> self slave 0)) - (set! s5-2 (-> self slave 0)) - (deactivate (-> self slave 0 0)) - ) - (set! (-> self slave 0) (the-as (pointer camera-slave) #f)) - (+! (-> self num-slaves) -1) - (let ((a1-33 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-33 from) self) - (set! (-> a1-33 num-params) 1) - (set! (-> a1-33 message) 'slave-activated) - (let ((v1-166 s2-0)) - (set! (-> a1-33 param 0) (the-as uint (if v1-166 - (-> (the-as camera-slave (-> v1-166 0)) self) - ) - ) - ) - ) - (send-event-function self a1-33) - ) - ) - ((not (and (= (-> self slave 0 0 next-state) *camera-base-mode*) (= (-> self slave 0 0 next-state) s1-0))) - (send-event (ppointer->process (-> self slave 0)) 'change-state-no-go s1-0) - (set! s4-1 (-> self slave 0)) - (set! s3-0 s1-0) - (set! s2-0 (-> self slave 0)) - ) - ) - (when s2-0 - (send-event *camera-combiner* 'stop-tracking) - (when (= (-> (the-as camera-slave (-> s2-0 0)) blend-to-type) 2) - (let ((a1-36 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-36 from) self) - (set! (-> a1-36 num-params) 1) - (set! (-> a1-36 message) 'start-tracking) - (let ((v1-191 s2-0)) - (set! (-> a1-36 param 0) (the-as uint (if v1-191 - (-> (the-as camera-slave (-> v1-191 0)) self) - ) - ) - ) - ) - (send-event-function *camera-combiner* a1-36) - ) - ) - ) - ) - (else - (when (< 1 (-> self num-slaves)) - (if (= (-> self changer) (-> self slave 0)) - (set! s5-2 (-> self slave 0)) - (deactivate (-> self slave 0 0)) - ) - (set! (-> self slave 0) (-> self slave 1)) - (set! (-> self slave 1) (the-as (pointer camera-slave) #f)) - (+! (-> self num-slaves) -1) - ) - (when (< 0.0 (-> self slave 0 0 intro-t-step)) - (set! (-> self outro-t) (-> self slave 0 0 intro-t)) - (set! (-> self outro-t-step) (/ -5.0 (the float (-> block param 1)))) - (set! (-> self outro-exit-value) (-> self slave 0 0 outro-exit-value)) - (curve-copy! (-> self outro-curve) (-> self slave 0 0 intro-curve)) - ) - (if (nonzero? (-> self no-intro)) - (set! (-> self outro-t) 0.0) - ) - (when (not (and (= (-> self slave 0 0 next-state) *camera-base-mode*) (= (-> self slave 0 0 next-state) s1-0))) - (cond - (s2-0 (let ((a1-38 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-38 from) self) (set! (-> a1-38 num-params) 1) (set! (-> a1-38 message) 'slave-activated) - (let ((v1-228 s2-0)) - (set! (-> a1-38 param 0) (the-as uint (if v1-228 - (-> (the-as camera-slave (-> v1-228 0)) self) - ) - ) - ) - ) - (send-event-function self a1-38) - ) - ) - (else + (let ((v1-228 s2-0)) (set! (-> a1-38 param 0) (the-as uint (if v1-228 (-> (the-as camera-slave (-> v1-228 0)) self))))) + (send-event-function self a1-38))) + (else (let ((s2-1 (get-process *camera-dead-pool* camera-slave #x4000))) - (set! s2-0 (when s2-1 - (let ((t9-42 (method-of-type camera-slave activate))) - (t9-42 (the-as camera-slave s2-1) self 'camera-slave (the-as pointer #x70004000)) - ) - (run-now-in-process s2-1 cam-slave-init s1-0 #f) - (-> s2-1 ppointer) - ) - ) - ) + (set! s2-0 + (when s2-1 + (let ((t9-42 (method-of-type camera-slave activate))) + (t9-42 (the-as camera-slave s2-1) self 'camera-slave (the-as pointer #x70004000))) + (run-now-in-process s2-1 cam-slave-init s1-0 #f) + (-> s2-1 ppointer)))) (cond - (s2-0 - ) - (else - (format #t "ERROR : secondary slave activate failed~%") - ) - ) - ) - ) - (when s2-0 - (send-event *camera-combiner* 'set-interpolation (-> block param 1)) - (set! s4-1 (-> self slave 0)) - (cond - ((zero? (-> self slave 0 0 blend-from-type)) - (send-event (ppointer->process (-> self slave 0)) 'change-state-no-go cam-fixed) - (send-event *camera-combiner* 'stop-tracking) - (set! s3-0 cam-fixed) - ) - (else - (send-event (ppointer->process (-> self slave 0)) 'change-state-no-go cam-decel) - (set! s3-0 cam-decel) - ) - ) - (let ((v1-261 (-> *camera-combiner* tracking-status))) - (cond - ((zero? v1-261) - (let ((v1-263 (-> (the-as camera-slave (-> s2-0 0)) blend-to-type))) - (cond - ((zero? v1-263) - ) - ((= v1-263 1) - ) - ((= v1-263 2) - (if (= (-> self slave 0 0 blend-from-type) 1) - (send-event *camera-combiner* 'copy-tracking (ppointer->process (-> self slave 0))) - (send-event *camera-combiner* 'start-tracking (ppointer->process (-> self slave 0))) - ) - (set! (-> *camera-combiner* tracking-status) (the-as uint 2)) - ) - ) - ) - ) - ((= v1-261 1) - (let ((v1-280 (-> (the-as camera-slave (-> s2-0 0)) blend-to-type))) - (cond - ((zero? v1-280) - (set! (-> *camera-combiner* tracking-status) (the-as uint 3)) - ) - ((= v1-280 1) - (set! (-> *camera-combiner* tracking-status) (the-as uint 3)) - ) - ((= v1-280 2) - ) - ) - ) - ) - ((= v1-261 2) - (let ((v1-286 (-> (the-as camera-slave (-> s2-0 0)) blend-to-type))) - (cond - ((zero? v1-286) - (set! (-> *camera-combiner* tracking-status) (the-as uint 0)) - 0 - ) - ((= v1-286 1) - (set! (-> *camera-combiner* tracking-status) (the-as uint 0)) - 0 - ) - ((= v1-286 2) - ) - ) - ) - ) - ((= v1-261 3) - (let ((v1-295 (-> (the-as camera-slave (-> s2-0 0)) blend-to-type))) - (cond - ((zero? v1-295) - (set! (-> *camera-combiner* tracking-status) (the-as uint 0)) - 0 - ) - ((= v1-295 1) - (set! (-> *camera-combiner* tracking-status) (the-as uint 0)) - 0 - ) - ((= v1-295 2) - (set! (-> *camera-combiner* tracking-status) (the-as uint 2)) - ) - ) - ) - ) - ) - ) - ) - ) - ) - ) - (if s4-1 - (send-event - (if s4-1 - (-> (the-as camera-slave (-> s4-1 0)) self) - ) - 'go - s3-0 - ) - ) - ) - (if s5-2 - (deactivate (-> s5-2 0)) - ) - ) - (set! v0-0 #t) - ) - ((= v1-0 'slave-activated) - (set! v0-0 - (cond - ((< (-> self num-slaves) 2) - (set! (-> self slave (-> self num-slaves)) - (the-as (pointer camera-slave) (process->ppointer (the-as process (-> block param 0)))) - ) - (+! (-> self num-slaves) 1) - (logior! (-> self master-options) 8) - (set! (-> *camera-combiner* tracking tilt-adjust target) (-> (the-as projectile (-> block param 0)) max-turn)) - ) - (else - (format 0 "ERROR: ERROR : Exceeded maximum number of camera slaves!~%") - (deactivate (the-as camera-slave (-> block param 0))) - ) - ) - ) - ) - ((= v1-0 'ease-in) - (cond - ((< argc 1) - (set! (-> self ease-t) 0.0) - (logand! (-> self master-options) -33) - ) - ((< argc 2) - (if (< (the-as float (-> block param 0)) (-> self ease-t)) - (set! (-> self ease-t) (the-as float (-> block param 0))) - ) - (logand! (-> self master-options) -33) - ) - (else - (if (< (the-as float (-> block param 0)) (-> self ease-t)) - (set! (-> self ease-t) (the-as float (-> block param 0))) - ) - (set! (-> self ease-to quad) (-> (the-as vector (-> block param 1)) quad)) - (logior! (-> self master-options) 32) - ) - ) - (set! (-> self ease-step) 0.033333335) - (set! v0-0 (-> self ease-from)) - (set! (-> (the-as vector v0-0) quad) (-> self tpos-curr-adj quad)) - ) - ((= v1-0 'damp-up) - (let ((f0-22 0.0)) - (set! (-> self upspeed) f0-22) - (set! v0-0 f0-22) - ) - ) - ((= v1-0 'reset-follow) - (set! v0-0 (if (handle->process (-> self drawable-target)) - (reset-drawable-follow) - (reset-follow) - ) - ) - ) - ((= v1-0 'teleport) - (cond - ((and (logtest? (-> self master-options) 2) (handle->process (-> self drawable-target))) - (reset-drawable-tracking) - ) - ((and *target* (logtest? (-> self master-options) 2)) - (reset-target-tracking) - ) - ) - (countdown (gp-6 (-> self num-slaves)) - (send-event (ppointer->process (-> self slave gp-6)) message) - ) - (let ((a1-54 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-54 from) self) - (set! (-> a1-54 num-params) 0) - (set! (-> a1-54 message) message) - (set! v0-0 (send-event-function *camera-combiner* a1-54)) - ) - ) - ((= v1-0 'toggle-slave-option) - (logxor! (-> self slave-options) (-> block param 0)) - (let ((a0-193 (-> self slave 0)) - (v1-360 (-> self slave 1)) - ) - (if a0-193 - (logxor! (-> a0-193 0 options) (-> block param 0)) - ) - (set! v0-0 (when v1-360 - (set! v0-0 (logxor (-> v1-360 0 options) (-> block param 0))) - (set! (-> v1-360 0 options) (the-as uint v0-0)) - v0-0 - ) - ) - ) - ) - (else - (set! v0-0 - (cond - ((= v1-0 'slave-option?) - (if (nonzero? (-> self num-slaves)) - (logtest? (-> self slave (+ (-> self num-slaves) -1) 0 options) (-> block param 0)) - ) - ) - ((= v1-0 'set-slave-option) - (when (nonzero? (-> self num-slaves)) - (set! v0-0 (logior (-> self slave (+ (-> self num-slaves) -1) 0 options) (-> block param 0))) - (set! (-> self slave (+ (-> self num-slaves) -1) 0 options) (the-as uint v0-0)) - v0-0 - ) - ) - ((= v1-0 'clear-slave-option) - (when (nonzero? (-> self num-slaves)) - (set! v0-0 (logclear (-> self slave (+ (-> self num-slaves) -1) 0 options) (-> block param 0))) - (set! (-> self slave (+ (-> self num-slaves) -1) 0 options) (the-as uint v0-0)) - v0-0 - ) - ) - ((= v1-0 'no-follow) - (when (nonzero? (-> self num-slaves)) - (set! (-> self slave (+ (-> self num-slaves) -1) 0 tracking no-follow) #t) - (vector-reset! (-> self slave (+ (-> self num-slaves) -1) 0 tracking follow-off)) - ) - (set! (-> *camera-combiner* tracking no-follow) #t) - (set! v0-0 (-> *camera-combiner* tracking follow-off)) - (.svf (&-> (the-as vector v0-0) quad) vf0) - v0-0 - ) - ((= v1-0 'yes-follow) - (if (nonzero? (-> self num-slaves)) - (set! (-> self slave (+ (-> self num-slaves) -1) 0 tracking no-follow) #f) - ) - (set! (-> *camera-combiner* tracking no-follow) #f) - #f - ) - ((= v1-0 'blend-from-as-fixed) - (when (nonzero? (-> self num-slaves)) - (set! (-> self slave (+ (-> self num-slaves) -1) 0 blend-from-type) (the-as uint 0)) - 0 - ) - ) - ((= v1-0 'point-of-interest) - (when (nonzero? (-> self num-slaves)) - (let ((a1-60 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-60 from) proc) - (set! (-> a1-60 num-params) argc) - (set! (-> a1-60 message) message) - (set! (-> a1-60 param 0) (-> block param 0)) - (set! (-> a1-60 param 1) (-> block param 1)) - (set! (-> a1-60 param 2) (-> block param 2)) - (set! (-> a1-60 param 3) (-> block param 3)) - (set! (-> a1-60 param 4) (-> block param 4)) - (set! (-> a1-60 param 5) (-> block param 5)) - (set! (-> a1-60 param 6) (-> block param 6)) - (send-event-function (ppointer->process (-> self slave (+ (-> self num-slaves) -1))) a1-60) - ) - ) - (let ((a1-61 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-61 from) proc) - (set! (-> a1-61 num-params) argc) - (set! (-> a1-61 message) message) - (set! (-> a1-61 param 0) (-> block param 0)) - (set! (-> a1-61 param 1) (-> block param 1)) - (set! (-> a1-61 param 2) (-> block param 2)) - (set! (-> a1-61 param 3) (-> block param 3)) - (set! (-> a1-61 param 4) (-> block param 4)) - (set! (-> a1-61 param 5) (-> block param 5)) - (set! (-> a1-61 param 6) (-> block param 6)) - (send-event-function *camera-combiner* a1-61) - ) - ) - ((= v1-0 'part-water-drip) - (set-time! (-> self water-drip-time)) - (set! (-> self water-drip-mult) (the-as float (-> block param 0))) - (set! (-> self water-drip-speed) (the-as float (-> block param 1))) - ) - (else + (s2-0) + (else (format #t "ERROR : secondary slave activate failed~%"))))) + (when s2-0 + (send-event *camera-combiner* 'set-interpolation (-> block param 1)) + (set! s4-1 (-> self slave 0)) + (cond + ((zero? (-> self slave 0 0 blend-from-type)) + (send-event (ppointer->process (-> self slave 0)) 'change-state-no-go cam-fixed) + (send-event *camera-combiner* 'stop-tracking) + (set! s3-0 cam-fixed)) + (else (send-event (ppointer->process (-> self slave 0)) 'change-state-no-go cam-decel) (set! s3-0 cam-decel))) + (let ((v1-261 (-> *camera-combiner* tracking-status))) + (cond + ((zero? v1-261) + (let ((v1-263 (-> (the-as camera-slave (-> s2-0 0)) blend-to-type))) + (cond + ((zero? v1-263)) + ((= v1-263 1)) + ((= v1-263 2) + (if (= (-> self slave 0 0 blend-from-type) 1) + (send-event *camera-combiner* 'copy-tracking (ppointer->process (-> self slave 0))) + (send-event *camera-combiner* 'start-tracking (ppointer->process (-> self slave 0)))) + (set! (-> *camera-combiner* tracking-status) (the-as uint 2)))))) + ((= v1-261 1) + (let ((v1-280 (-> (the-as camera-slave (-> s2-0 0)) blend-to-type))) + (cond + ((zero? v1-280) (set! (-> *camera-combiner* tracking-status) (the-as uint 3))) + ((= v1-280 1) (set! (-> *camera-combiner* tracking-status) (the-as uint 3))) + ((= v1-280 2))))) + ((= v1-261 2) + (let ((v1-286 (-> (the-as camera-slave (-> s2-0 0)) blend-to-type))) + (cond + ((zero? v1-286) (set! (-> *camera-combiner* tracking-status) (the-as uint 0)) 0) + ((= v1-286 1) (set! (-> *camera-combiner* tracking-status) (the-as uint 0)) 0) + ((= v1-286 2))))) + ((= v1-261 3) + (let ((v1-295 (-> (the-as camera-slave (-> s2-0 0)) blend-to-type))) + (cond + ((zero? v1-295) (set! (-> *camera-combiner* tracking-status) (the-as uint 0)) 0) + ((= v1-295 1) (set! (-> *camera-combiner* tracking-status) (the-as uint 0)) 0) + ((= v1-295 2) (set! (-> *camera-combiner* tracking-status) (the-as uint 2)))))))))))) + (if s4-1 (send-event (if s4-1 (-> (the-as camera-slave (-> s4-1 0)) self)) 'go s3-0))) + (if s5-2 (deactivate (-> s5-2 0)))) + (set! v0-0 #t)) + ((= v1-0 'slave-activated) + (set! v0-0 + (cond + ((< (-> self num-slaves) 2) + (set! (-> self slave (-> self num-slaves)) + (the-as (pointer camera-slave) (process->ppointer (the-as process (-> block param 0))))) + (+! (-> self num-slaves) 1) + (logior! (-> self master-options) 8) + (set! (-> *camera-combiner* tracking tilt-adjust target) (-> (the-as projectile (-> block param 0)) max-turn))) + (else + (format 0 "ERROR: ERROR : Exceeded maximum number of camera slaves!~%") + (deactivate (the-as camera-slave (-> block param 0))))))) + ((= v1-0 'ease-in) + (cond + ((< argc 1) (set! (-> self ease-t) 0.0) (logand! (-> self master-options) -33)) + ((< argc 2) + (if (< (the-as float (-> block param 0)) (-> self ease-t)) (set! (-> self ease-t) (the-as float (-> block param 0)))) + (logand! (-> self master-options) -33)) + (else + (if (< (the-as float (-> block param 0)) (-> self ease-t)) (set! (-> self ease-t) (the-as float (-> block param 0)))) + (set! (-> self ease-to quad) (-> (the-as vector (-> block param 1)) quad)) + (logior! (-> self master-options) 32))) + (set! (-> self ease-step) 0.033333335) + (set! v0-0 (-> self ease-from)) + (set! (-> (the-as vector v0-0) quad) (-> self tpos-curr-adj quad))) + ((= v1-0 'damp-up) (let ((f0-22 0.0)) (set! (-> self upspeed) f0-22) (set! v0-0 f0-22))) + ((= v1-0 'reset-follow) + (set! v0-0 (if (handle->process (-> self drawable-target)) (reset-drawable-follow) (reset-follow)))) + ((= v1-0 'teleport) + (cond + ((and (logtest? (-> self master-options) 2) (handle->process (-> self drawable-target))) (reset-drawable-tracking)) + ((and *target* (logtest? (-> self master-options) 2)) (reset-target-tracking))) + (countdown (gp-6 (-> self num-slaves)) + (send-event (ppointer->process (-> self slave gp-6)) message)) + (let ((a1-54 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-54 from) self) + (set! (-> a1-54 num-params) 0) + (set! (-> a1-54 message) message) + (set! v0-0 (send-event-function *camera-combiner* a1-54)))) + ((= v1-0 'toggle-slave-option) + (logxor! (-> self slave-options) (-> block param 0)) + (let ((a0-193 (-> self slave 0)) + (v1-360 (-> self slave 1))) + (if a0-193 (logxor! (-> a0-193 0 options) (-> block param 0))) + (set! v0-0 + (when v1-360 + (set! v0-0 (logxor (-> v1-360 0 options) (-> block param 0))) + (set! (-> v1-360 0 options) (the-as uint v0-0)) + v0-0)))) + (else + (set! v0-0 + (cond + ((= v1-0 'slave-option?) + (if (nonzero? (-> self num-slaves)) (logtest? (-> self slave (+ (-> self num-slaves) -1) 0 options) (-> block param 0)))) + ((= v1-0 'set-slave-option) + (when (nonzero? (-> self num-slaves)) + (set! v0-0 (logior (-> self slave (+ (-> self num-slaves) -1) 0 options) (-> block param 0))) + (set! (-> self slave (+ (-> self num-slaves) -1) 0 options) (the-as uint v0-0)) + v0-0)) + ((= v1-0 'clear-slave-option) + (when (nonzero? (-> self num-slaves)) + (set! v0-0 (logclear (-> self slave (+ (-> self num-slaves) -1) 0 options) (-> block param 0))) + (set! (-> self slave (+ (-> self num-slaves) -1) 0 options) (the-as uint v0-0)) + v0-0)) + ((= v1-0 'no-follow) + (when (nonzero? (-> self num-slaves)) + (set! (-> self slave (+ (-> self num-slaves) -1) 0 tracking no-follow) #t) + (vector-reset! (-> self slave (+ (-> self num-slaves) -1) 0 tracking follow-off))) + (set! (-> *camera-combiner* tracking no-follow) #t) + (set! v0-0 (-> *camera-combiner* tracking follow-off)) + (.svf (&-> (the-as vector v0-0) quad) vf0) + v0-0) + ((= v1-0 'yes-follow) + (if (nonzero? (-> self num-slaves)) (set! (-> self slave (+ (-> self num-slaves) -1) 0 tracking no-follow) #f)) + (set! (-> *camera-combiner* tracking no-follow) #f) + #f) + ((= v1-0 'blend-from-as-fixed) + (when (nonzero? (-> self num-slaves)) + (set! (-> self slave (+ (-> self num-slaves) -1) 0 blend-from-type) (the-as uint 0)) + 0)) + ((= v1-0 'point-of-interest) + (when (nonzero? (-> self num-slaves)) + (let ((a1-60 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-60 from) proc) + (set! (-> a1-60 num-params) argc) + (set! (-> a1-60 message) message) + (set! (-> a1-60 param 0) (-> block param 0)) + (set! (-> a1-60 param 1) (-> block param 1)) + (set! (-> a1-60 param 2) (-> block param 2)) + (set! (-> a1-60 param 3) (-> block param 3)) + (set! (-> a1-60 param 4) (-> block param 4)) + (set! (-> a1-60 param 5) (-> block param 5)) + (set! (-> a1-60 param 6) (-> block param 6)) + (send-event-function (ppointer->process (-> self slave (+ (-> self num-slaves) -1))) a1-60))) + (let ((a1-61 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-61 from) proc) + (set! (-> a1-61 num-params) argc) + (set! (-> a1-61 message) message) + (set! (-> a1-61 param 0) (-> block param 0)) + (set! (-> a1-61 param 1) (-> block param 1)) + (set! (-> a1-61 param 2) (-> block param 2)) + (set! (-> a1-61 param 3) (-> block param 3)) + (set! (-> a1-61 param 4) (-> block param 4)) + (set! (-> a1-61 param 5) (-> block param 5)) + (set! (-> a1-61 param 6) (-> block param 6)) + (send-event-function *camera-combiner* a1-61))) + ((= v1-0 'part-water-drip) + (set-time! (-> self water-drip-time)) + (set! (-> self water-drip-mult) (the-as float (-> block param 0))) + (set! (-> self water-drip-speed) (the-as float (-> block param 1)))) + (else (countdown (s3-1 (-> self num-slaves)) (let ((a1-62 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-62 from) proc) @@ -1529,99 +913,59 @@ (set! (-> a1-62 param 4) (-> block param 4)) (set! (-> a1-62 param 5) (-> block param 5)) (set! (-> a1-62 param 6) (-> block param 6)) - (send-event-function (ppointer->process (-> self slave s3-1)) a1-62) - ) - ) - #f - ) - ) - ) - ) - ) - ) - v0-0 - ) - ) - :enter (behavior () - (if (and (nonzero? camera-master-debug) *debug-segment*) - (add-connection *debug-engine* self camera-master-debug self #f #f) - ) - ) - :trans (behavior () - (when (not (paused?)) - (vector-negate! - (-> self local-down) - (vector-normalize-copy! (-> self local-down) (-> *standard-dynamics* gravity) 1.0) - ) - (cam-master-effect) - ) - ) - :code (behavior () - (loop - (if (and *dproc* *debug-segment*) - (add-frame - (-> *display* frames (-> *display* on-screen) frame profile-bar 0) - 'camera - (new 'static 'rgba :r #x40 :b #x40 :a #x80) - ) - ) - (set! (-> self string-min target y) (-> self stringMinHeight)) - (set! (-> self string-max target y) (-> self stringMaxHeight)) - (set! (-> self string-min target z) (-> self stringMinLength)) - (set! (-> self string-max target z) (-> self stringMaxLength)) - (set! (-> self string-push-z) (fmax (-> self string-min value z) (-> *CAMERA-bank* default-string-push-z))) - (master-track-target) - (set! (-> last-try-to-look-at-data horz) 0.0) - (set! (-> last-try-to-look-at-data vert) 0.0) - (when (send-event *camera* 'slave-option? #x4000) - (set! (-> self string-min target y) 18432.0) - (set! (-> self string-max target y) 18432.041) - ) + (send-event-function (ppointer->process (-> self slave s3-1)) a1-62))) + #f)))))) + v0-0)) + :enter + (behavior () + (if (and (nonzero? camera-master-debug) *debug-segment*) + (add-connection *debug-engine* self camera-master-debug self #f #f))) + :trans + (behavior () (when (not (paused?)) - (update! (-> self string-min) (the-as vector #f)) - (update! (-> self string-max) (the-as vector #f)) - (master-check-regions) - ) - (set! (-> self string-min value x) - (fmin (-> self string-min value x) (+ -4.096 (-> self string-max value x))) - ) - (set! (-> self string-min value y) - (fmin (-> self string-min value y) (+ -4.096 (-> self string-max value y))) - ) - (set! (-> self string-min value z) - (fmin (-> self string-min value z) (+ -4.096 (-> self string-max value z))) - ) - (if (nonzero? (-> self no-intro)) - (+! (-> self no-intro) -1) - ) - (if (nonzero? (-> self force-blend)) - (+! (-> self force-blend) -1) - ) - (suspend) - ) - ) - ) + (vector-negate! (-> self local-down) (vector-normalize-copy! (-> self local-down) (-> *standard-dynamics* gravity) 1.0)) + (cam-master-effect))) + :code + (behavior () + (loop (if (and *dproc* *debug-segment*) + (add-frame (-> *display* frames (-> *display* on-screen) frame profile-bar 0) + 'camera + (new 'static 'rgba :r #x40 :b #x40 :a #x80))) + (set! (-> self string-min target y) (-> self stringMinHeight)) + (set! (-> self string-max target y) (-> self stringMaxHeight)) + (set! (-> self string-min target z) (-> self stringMinLength)) + (set! (-> self string-max target z) (-> self stringMaxLength)) + (set! (-> self string-push-z) (fmax (-> self string-min value z) (-> *CAMERA-bank* default-string-push-z))) + (master-track-target) + (set! (-> last-try-to-look-at-data horz) 0.0) + (set! (-> last-try-to-look-at-data vert) 0.0) + (when (send-event *camera* 'slave-option? #x4000) + (set! (-> self string-min target y) 18432.0) + (set! (-> self string-max target y) 18432.041)) + (when (not (paused?)) + (update! (-> self string-min) (the-as vector #f)) + (update! (-> self string-max) (the-as vector #f)) + (master-check-regions)) + (set! (-> self string-min value x) (fmin (-> self string-min value x) (+ -4.096 (-> self string-max value x)))) + (set! (-> self string-min value y) (fmin (-> self string-min value y) (+ -4.096 (-> self string-max value y)))) + (set! (-> self string-min value z) (fmin (-> self string-min value z) (+ -4.096 (-> self string-max value z)))) + (if (nonzero? (-> self no-intro)) (+! (-> self no-intro) -1)) + (if (nonzero? (-> self force-blend)) (+! (-> self force-blend) -1)) + (suspend)))) (deftype list-keeper (process) - ((dummy float) - ) - ) - + ((dummy float))) (defstate list-keeper-active (camera-master) - :code (behavior () - (loop - (change-to-last-brother self) - (suspend) - ) - ) - ) + :code + (behavior () + (loop (change-to-last-brother self) + (suspend)))) (defbehavior list-keeper-init camera-master () (go list-keeper-active) 0 - (none) - ) + (none)) (defbehavior cam-master-init camera-master () (set! *camera* self) @@ -1630,8 +974,7 @@ (set! (-> self master-options) (the-as uint 4)) (set! (-> self num-slaves) 0) (dotimes (v1-5 2) - (set! (-> self slave v1-5) (the-as (pointer camera-slave) #f)) - ) + (set! (-> self slave v1-5) (the-as (pointer camera-slave) #f))) (set! (-> self slave-options) (the-as uint 560)) (set! (-> self view-off-param-save) 1.0) (set! (-> self changer) (the-as uint (process->ppointer self))) @@ -1650,33 +993,21 @@ (init! (-> self string-min) gp-0 40.96 409.6 0.9) (set! (-> gp-0 y) (-> *CAMERA-bank* default-string-max-y)) (set! (-> gp-0 z) (-> *CAMERA-bank* default-string-max-z)) - (init! (-> self string-max) gp-0 40.96 409.6 0.9) - ) + (init! (-> self string-max) gp-0 40.96 409.6 0.9)) (set! (-> self outro-t-step) 0.0) (set! (-> self drawable-target) (the-as handle #f)) (set! (-> self which-bone) 0) - (let ((a1-3 (new-stack-vector0))) - (tracking-spline-method-10 (-> self target-spline) a1-3) - ) + (let ((a1-3 (new-stack-vector0))) (tracking-spline-method-10 (-> self target-spline) a1-3)) (set! (-> self pov-handle) (the-as handle #f)) (set! (-> self pov-bone) 0) (cond - ((process-spawn-function list-keeper list-keeper-init :from *camera-dead-pool* :to self) - ) - (else - (format 0 "ERROR : master camera list keeper failed to activate~%") - ) - ) + ((process-spawn-function list-keeper list-keeper-init :from *camera-dead-pool* :to self)) + (else (format 0 "ERROR : master camera list keeper failed to activate~%"))) (cond - ((process-spawn-function camera-slave cam-slave-init cam-free-floating #f :from *camera-dead-pool* :to self) - ) - (else - (format 0 "ERROR : first slave failed to activate~%") - ) - ) + ((process-spawn-function camera-slave cam-slave-init cam-free-floating #f :from *camera-dead-pool* :to self)) + (else (format 0 "ERROR : first slave failed to activate~%"))) (set! (-> self water-drip) (create-launch-control group-rain-screend-drop self)) (set! (-> self water-drip-time) (seconds -60)) (go cam-master-active) 0 - (none) - ) + (none)) diff --git a/goal_src/jak1/engine/camera/cam-start.gc b/goal_src/jak1/engine/camera/cam-start.gc index f85fde398a..3261fc1bf1 100644 --- a/goal_src/jak1/engine/camera/cam-start.gc +++ b/goal_src/jak1/engine/camera/cam-start.gc @@ -1,7 +1,6 @@ ;;-*-Lisp-*- (in-package goal) (bundles "ENGINE.CGO" "GAME.CGO") - (require "engine/camera/cam-combiner.gc") ;; name: cam-start.gc @@ -17,28 +16,16 @@ (set! *camera* #f) (set! *camera-combiner* #f) (set! *camera-base-mode* cam-string) - (none) - ) + (none)) (defun cam-start ((arg0 symbol)) (cam-stop) (process-spawn camera-combiner :init cam-combiner-init :from *camera-dead-pool* :to *camera-pool*) (set! *camera* (the-as camera-master - (ppointer->process - (process-spawn-function camera-master cam-master-init :from *camera-master-dead-pool* :to *camera-pool*) - ) - ) - ) - (if arg0 - (reset-cameras) - ) + (ppointer->process (process-spawn-function camera-master cam-master-init :from *camera-master-dead-pool* :to *camera-pool*)))) + (if arg0 (reset-cameras)) 0 - (none) - ) + (none)) (cam-start #f) - - - - diff --git a/goal_src/jak1/engine/camera/cam-states-dbg.gc b/goal_src/jak1/engine/camera/cam-states-dbg.gc index 7e0351a960..679a1416e6 100644 --- a/goal_src/jak1/engine/camera/cam-states-dbg.gc +++ b/goal_src/jak1/engine/camera/cam-states-dbg.gc @@ -1,7 +1,6 @@ ;;-*-Lisp-*- (in-package goal) (bundles "ENGINE.CGO" "GAME.CGO") - (require "engine/camera/camera.gc") (require "pc/pckernel-impl.gc") @@ -12,87 +11,60 @@ ;; DECOMP BEGINS (deftype cam-point-watch-bank (basic) - ((speed float) - (rot-speed degrees) - ) - ) - + ((speed float) + (rot-speed degrees))) (define *CAM_POINT_WATCH-bank* (new 'static 'cam-point-watch-bank :speed 1600.0 :rot-speed (degrees 0.6))) (defstate cam-point-watch (camera-slave) - :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (case message - (('teleport) - #f - ) - (else - (cam-standard-event-handler proc argc message block) - ) - ) - ) - :enter (behavior () - (when (not (-> self enter-has-run)) - (set! (-> self pivot-rad) 40960.0) - (set! (-> self blend-from-type) (the-as uint 1)) - (set! (-> self blend-to-type) (the-as uint 1)) - ) - ) - :code (behavior () - (loop - (let ((s5-0 (new-stack-vector0)) - (gp-0 (new-stack-vector0)) - ) - (when *camera-read-analog* - (let ((f28-0 (analog-input (the-as int (-> *cpad-list* cpads 0 leftx)) 128.0 48.0 110.0 -1.0)) - (f30-0 (analog-input (the-as int (-> *cpad-list* cpads 0 lefty)) 128.0 48.0 110.0 -1.0)) - (f26-0 (analog-input (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 48.0 110.0 -1.0)) - (f0-0 (analog-input (the-as int (-> *cpad-list* cpads 0 righty)) 128.0 48.0 110.0 -1.0)) - ) - (cond - ((cpad-hold? (-> *CAMERA-bank* joypad) r2) - (set! (-> s5-0 y) (- (-> s5-0 y) (* 0.2 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f26-0)))) - (set! (-> s5-0 x) (- (-> s5-0 x) (* 0.2 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f0-0)))) - (+! (-> gp-0 x) (* 0.2 (-> *CAM_POINT_WATCH-bank* speed) f28-0)) - (+! (-> gp-0 z) (* 0.2 (-> *CAM_POINT_WATCH-bank* speed) f30-0)) - ) - (else - (set! (-> s5-0 y) (- (-> s5-0 y) (* 2.0 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f26-0)))) - (set! (-> s5-0 x) (- (-> s5-0 x) (* 2.0 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f0-0)))) - (+! (-> gp-0 x) (* 2.0 (-> *CAM_POINT_WATCH-bank* speed) f28-0)) - (+! (-> gp-0 z) (* 2.0 (-> *CAM_POINT_WATCH-bank* speed) f30-0)) - ) - ) - ) - (let ((s4-0 (new-stack-vector0))) - (let ((s3-0 (new-stack-matrix0))) - (matrix-axis-angle! s3-0 (the-as vector (-> self tracking)) (- (-> s5-0 x))) - (vector-matrix*! s4-0 (-> self tracking inv-mat vector 2) s3-0) - (matrix-axis-angle! s3-0 (-> *camera* local-down) (- (-> s5-0 y))) - (vector-matrix*! s4-0 s4-0 s3-0) - ) - (forward-down->inv-matrix (the-as matrix (-> self tracking)) s4-0 (-> *camera* local-down)) - ) - (set! (-> self pivot-rad) (- (-> self pivot-rad) (-> gp-0 z))) - (if (< (-> self pivot-rad) 4096.0) - (set! (-> self pivot-rad) 4096.0) - ) - (set-vector! gp-0 0.0 0.0 (- (-> self pivot-rad)) 1.0) - (vector-matrix*! (-> self trans) gp-0 (the-as matrix (-> self tracking))) - ) - ) - (suspend) - 0 - ) - ) - ) + :event + (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('teleport) #f) + (else (cam-standard-event-handler proc argc message block)))) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self pivot-rad) 40960.0) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (the-as uint 1)))) + :code + (behavior () + (loop (let ((s5-0 (new-stack-vector0)) + (gp-0 (new-stack-vector0))) + (when *camera-read-analog* + (let ((f28-0 (analog-input (the-as int (-> *cpad-list* cpads 0 leftx)) 128.0 48.0 110.0 -1.0)) + (f30-0 (analog-input (the-as int (-> *cpad-list* cpads 0 lefty)) 128.0 48.0 110.0 -1.0)) + (f26-0 (analog-input (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 48.0 110.0 -1.0)) + (f0-0 (analog-input (the-as int (-> *cpad-list* cpads 0 righty)) 128.0 48.0 110.0 -1.0))) + (cond + ((cpad-hold? (-> *CAMERA-bank* joypad) r2) + (set! (-> s5-0 y) (- (-> s5-0 y) (* 0.2 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f26-0)))) + (set! (-> s5-0 x) (- (-> s5-0 x) (* 0.2 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f0-0)))) + (+! (-> gp-0 x) (* 0.2 (-> *CAM_POINT_WATCH-bank* speed) f28-0)) + (+! (-> gp-0 z) (* 0.2 (-> *CAM_POINT_WATCH-bank* speed) f30-0))) + (else + (set! (-> s5-0 y) (- (-> s5-0 y) (* 2.0 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f26-0)))) + (set! (-> s5-0 x) (- (-> s5-0 x) (* 2.0 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f0-0)))) + (+! (-> gp-0 x) (* 2.0 (-> *CAM_POINT_WATCH-bank* speed) f28-0)) + (+! (-> gp-0 z) (* 2.0 (-> *CAM_POINT_WATCH-bank* speed) f30-0))))) + (let ((s4-0 (new-stack-vector0))) + (let ((s3-0 (new-stack-matrix0))) + (matrix-axis-angle! s3-0 (the-as vector (-> self tracking)) (- (-> s5-0 x))) + (vector-matrix*! s4-0 (-> self tracking inv-mat vector 2) s3-0) + (matrix-axis-angle! s3-0 (-> *camera* local-down) (- (-> s5-0 y))) + (vector-matrix*! s4-0 s4-0 s3-0)) + (forward-down->inv-matrix (the-as matrix (-> self tracking)) s4-0 (-> *camera* local-down))) + (set! (-> self pivot-rad) (- (-> self pivot-rad) (-> gp-0 z))) + (if (< (-> self pivot-rad) 4096.0) (set! (-> self pivot-rad) 4096.0)) + (set-vector! gp-0 0.0 0.0 (- (-> self pivot-rad)) 1.0) + (vector-matrix*! (-> self trans) gp-0 (the-as matrix (-> self tracking))))) + (suspend) + 0))) (deftype cam-free-bank (basic) - ((speed float) - (rot-speed degrees) - ) - ) - + ((speed float) + (rot-speed degrees))) (define *CAM_FREE-bank* (new 'static 'cam-free-bank :speed 1600.0 :rot-speed (degrees 0.6))) @@ -100,350 +72,186 @@ (when (and (!= *master-mode* 'menu) (not *cam-layout*)) (when *camera-read-buttons* (if (cpad-hold? arg3 x) - (set! (-> arg0 x) - (- (-> arg0 x) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input - (the-as int (-> *cpad-list* cpads arg3 abutton 6)) - 0.0 - 32.0 - 230.0 - (-> *CAM_FREE-bank* rot-speed) - ) - ) - ) - ) - ) - ) + (set! (-> arg0 x) + (- (-> arg0 x) + (+ (-> *CAM_FREE-bank* rot-speed) + (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 6)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* rot-speed))))))) (when *camera-read-buttons* (if (cpad-hold? arg3 triangle) - (+! (-> arg0 x) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input - (the-as int (-> *cpad-list* cpads arg3 abutton 4)) - 0.0 - 32.0 - 230.0 - (-> *CAM_FREE-bank* rot-speed) - ) - ) - ) - ) - ) + (+! (-> arg0 x) + (+ (-> *CAM_FREE-bank* rot-speed) + (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 4)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* rot-speed)))))) (when *camera-read-buttons* (if (cpad-hold? arg3 square) - (+! (-> arg0 y) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input - (the-as int (-> *cpad-list* cpads arg3 abutton 7)) - 0.0 - 32.0 - 230.0 - (-> *CAM_FREE-bank* rot-speed) - ) - ) - ) - ) - ) + (+! (-> arg0 y) + (+ (-> *CAM_FREE-bank* rot-speed) + (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 7)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* rot-speed)))))) (when *camera-read-buttons* (if (cpad-hold? arg3 circle) - (set! (-> arg0 y) - (- (-> arg0 y) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input - (the-as int (-> *cpad-list* cpads arg3 abutton 5)) - 0.0 - 32.0 - 230.0 - (-> *CAM_FREE-bank* rot-speed) - ) - ) - ) - ) - ) - ) - ) + (set! (-> arg0 y) + (- (-> arg0 y) + (+ (-> *CAM_FREE-bank* rot-speed) + (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 5)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* rot-speed)))))))) (when arg2 (when *camera-read-buttons* (if (cpad-hold? arg3 l2) - (+! (-> arg0 z) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input - (the-as int (-> *cpad-list* cpads arg3 abutton 10)) - 0.0 - 32.0 - 230.0 - (-> *CAM_FREE-bank* rot-speed) - ) - ) - ) - ) - ) + (+! (-> arg0 z) + (+ (-> *CAM_FREE-bank* rot-speed) + (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 10)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* rot-speed)))))) (when *camera-read-buttons* (if (cpad-hold? arg3 r2) - (set! (-> arg0 z) - (- (-> arg0 z) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input - (the-as int (-> *cpad-list* cpads arg3 abutton 11)) - 0.0 - 32.0 - 230.0 - (-> *CAM_FREE-bank* rot-speed) - ) - ) - ) - ) - ) - ) - ) + (set! (-> arg0 z) + (- (-> arg0 z) + (+ (-> *CAM_FREE-bank* rot-speed) + (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 11)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* rot-speed)))))))) (cond - ((not *cam-free-move-along-z*) - ) - ((not *camera-read-analog*) - ) + ((not *cam-free-move-along-z*)) + ((not *camera-read-analog*)) ((cpad-hold? arg3 r2) (when *camera-read-buttons* (if (cpad-hold? arg3 r1) - (+! (-> arg1 y) (+ (* 0.2 (-> *CAM_FREE-bank* speed)) (analog-input - (the-as int (-> *cpad-list* cpads arg3 abutton 9)) - 0.0 - 32.0 - 230.0 - (* 0.2 (-> *CAM_FREE-bank* speed)) - ) - ) - ) - ) - ) + (+! (-> arg1 y) + (+ (* 0.2 (-> *CAM_FREE-bank* speed)) + (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 9)) 0.0 32.0 230.0 (* 0.2 (-> *CAM_FREE-bank* speed))))))) (when *camera-read-buttons* (if (cpad-hold? arg3 l1) - (set! (-> arg1 y) - (- (-> arg1 y) (+ (* 0.2 (-> *CAM_FREE-bank* speed)) (analog-input - (the-as int (-> *cpad-list* cpads arg3 abutton 8)) - 0.0 - 32.0 - 230.0 - (* 0.2 (-> *CAM_FREE-bank* speed)) - ) - ) - ) - ) - ) - ) - ) + (set! (-> arg1 y) + (- (-> arg1 y) + (+ (* 0.2 (-> *CAM_FREE-bank* speed)) + (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 8)) 0.0 32.0 230.0 (* 0.2 (-> *CAM_FREE-bank* speed))))))))) (else - (when *camera-read-buttons* - (if (cpad-hold? arg3 r1) - (+! (-> arg1 y) - (+ (-> *CAM_FREE-bank* speed) - (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 9)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)) - ) - ) - ) - ) - (when *camera-read-buttons* - (if (cpad-hold? arg3 l1) - (set! (-> arg1 y) - (- (-> arg1 y) - (+ (-> *CAM_FREE-bank* speed) - (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 8)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)) - ) - ) - ) - ) - ) - ) - ) + (when *camera-read-buttons* + (if (cpad-hold? arg3 r1) + (+! (-> arg1 y) + (+ (-> *CAM_FREE-bank* speed) + (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 9)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)))))) + (when *camera-read-buttons* + (if (cpad-hold? arg3 l1) + (set! (-> arg1 y) + (- (-> arg1 y) + (+ (-> *CAM_FREE-bank* speed) + (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 8)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed))))))))) (when (and (!= *master-mode* 'menu) (not *cam-layout*)) (when *camera-read-buttons* (if (cpad-hold? arg3 left) - (+! (-> arg1 x) - (+ (-> *CAM_FREE-bank* speed) - (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 1)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)) - ) - ) - ) - ) + (+! (-> arg1 x) + (+ (-> *CAM_FREE-bank* speed) + (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 1)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)))))) (when *camera-read-buttons* (if (cpad-hold? arg3 right) - (set! (-> arg1 x) - (- (-> arg1 x) - (+ (-> *CAM_FREE-bank* speed) - (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 0)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)) - ) - ) - ) - ) - ) + (set! (-> arg1 x) + (- (-> arg1 x) + (+ (-> *CAM_FREE-bank* speed) + (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 0)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed))))))) (when *camera-read-buttons* (if (cpad-hold? arg3 up) - (+! (-> arg1 z) - (+ (-> *CAM_FREE-bank* speed) - (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 2)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)) - ) - ) - ) - ) + (+! (-> arg1 z) + (+ (-> *CAM_FREE-bank* speed) + (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 2)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)))))) (when *camera-read-buttons* (if (cpad-hold? arg3 down) - (set! (-> arg1 z) - (- (-> arg1 z) - (+ (-> *CAM_FREE-bank* speed) - (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 3)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)) - ) - ) - ) - ) - ) - ) + (set! (-> arg1 z) + (- (-> arg1 z) + (+ (-> *CAM_FREE-bank* speed) + (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 3)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)))))))) (when *camera-read-analog* (let ((f28-14 (analog-input (the-as int (-> *cpad-list* cpads arg3 leftx)) 128.0 48.0 110.0 -1.0)) (f30-14 (analog-input (the-as int (-> *cpad-list* cpads arg3 lefty)) 128.0 48.0 110.0 -1.0)) - (f24-0 (analog-input-horizontal-first (the-as int (-> *cpad-list* cpads arg3 rightx)) 128.0 48.0 110.0 -1.0)) ;; changed for pc port - (f26-0 (analog-input-vertical-first (the-as int (-> *cpad-list* cpads arg3 righty)) 128.0 48.0 110.0 -1.0)) ;; changed for pc port + (f24-0 (analog-input-horizontal-first (the-as int (-> *cpad-list* cpads arg3 rightx)) 128.0 48.0 110.0 -1.0)) ;; changed for pc port + (f26-0 (analog-input-vertical-first (the-as int (-> *cpad-list* cpads arg3 righty)) 128.0 48.0 110.0 -1.0)) ;; changed for pc port ) (when *display-load-boundaries* (when (and (!= arg3 1) (not (cpad-hold? 1 x)) (not (cpad-hold? 1 r1)) - (not (logtest? (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons r2))) - ) + (not (logtest? (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons r2)))) (+! f28-14 (analog-input (the-as int (-> *cpad-list* cpads 1 leftx)) 128.0 48.0 110.0 -1.0)) (+! f30-14 (analog-input (the-as int (-> *cpad-list* cpads 1 lefty)) 128.0 48.0 110.0 -1.0)) (+! f24-0 (analog-input (the-as int (-> *cpad-list* cpads 1 rightx)) 128.0 48.0 110.0 -1.0)) - (+! f26-0 (analog-input (the-as int (-> *cpad-list* cpads 1 righty)) 128.0 48.0 110.0 -1.0)) - ) - ) + (+! f26-0 (analog-input (the-as int (-> *cpad-list* cpads 1 righty)) 128.0 48.0 110.0 -1.0)))) (cond ((cpad-hold? arg3 r2) (cond ((cpad-hold? arg3 l2) (set! (-> arg0 y) (- (-> arg0 y) (* 0.5 (-> *CAM_FREE-bank* rot-speed) (- f24-0)))) - (set! (-> arg0 x) (- (-> arg0 x) (* 0.5 (-> *CAM_FREE-bank* rot-speed) (- f26-0)))) - ) + (set! (-> arg0 x) (- (-> arg0 x) (* 0.5 (-> *CAM_FREE-bank* rot-speed) (- f26-0))))) (else - (set! (-> arg0 y) (- (-> arg0 y) (* (- f24-0) (-> *CAM_FREE-bank* rot-speed)))) - (set! (-> arg0 x) (- (-> arg0 x) (* (- f26-0) (-> *CAM_FREE-bank* rot-speed)))) - ) - ) + (set! (-> arg0 y) (- (-> arg0 y) (* (- f24-0) (-> *CAM_FREE-bank* rot-speed)))) + (set! (-> arg0 x) (- (-> arg0 x) (* (- f26-0) (-> *CAM_FREE-bank* rot-speed)))))) (+! (-> arg1 x) (* 0.2 (-> *CAM_FREE-bank* speed) f28-14)) - (+! (-> arg1 z) (* 0.2 (-> *CAM_FREE-bank* speed) f30-14)) - ) + (+! (-> arg1 z) (* 0.2 (-> *CAM_FREE-bank* speed) f30-14))) ((cpad-hold? arg3 l2) (+! (-> arg1 x) (* f28-14 (-> *CAM_FREE-bank* speed))) (+! (-> arg1 y) (* f26-0 (-> *CAM_FREE-bank* speed))) - (+! (-> arg1 z) (* f30-14 (-> *CAM_FREE-bank* speed))) - ) + (+! (-> arg1 z) (* f30-14 (-> *CAM_FREE-bank* speed)))) (else - (set! (-> arg0 y) (- (-> arg0 y) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f24-0)))) - (set! (-> arg0 x) (- (-> arg0 x) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f26-0)))) - (+! (-> arg1 x) (* 2.0 (-> *CAM_FREE-bank* speed) f28-14)) - (+! (-> arg1 z) (* 2.0 (-> *CAM_FREE-bank* speed) f30-14)) - ) - ) - ) - ) + (set! (-> arg0 y) (- (-> arg0 y) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f24-0)))) + (set! (-> arg0 x) (- (-> arg0 x) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f26-0)))) + (+! (-> arg1 x) (* 2.0 (-> *CAM_FREE-bank* speed) f28-14)) + (+! (-> arg1 z) (* 2.0 (-> *CAM_FREE-bank* speed) f30-14)))))) (vector-float*! arg0 arg0 (-> *display* time-adjust-ratio)) - (vector-float*! arg1 arg1 (-> *display* time-adjust-ratio)) - ) + (vector-float*! arg1 arg1 (-> *display* time-adjust-ratio))) (deftype camera-free-floating-move-info (structure) - ((rv vector :inline) - (tv vector :inline) - (up vector :inline) - (tm matrix :inline) - ) - ) - + ((rv vector :inline) + (tv vector :inline) + (up vector :inline) + (tm matrix :inline))) (defun cam-free-floating-move ((arg0 matrix) (arg1 vector) (arg2 vector) (arg3 int)) - (if (logtest? (-> *cpad-list* cpads arg3 valid) 128) - (return (the-as vector #f)) - ) - (if (= *master-mode* 'menu) - (return (the-as vector #f)) - ) + (if (logtest? (-> *cpad-list* cpads arg3 valid) 128) (return (the-as vector #f))) + (if (= *master-mode* 'menu) (return (the-as vector #f))) (let ((s3-0 (new 'stack 'camera-free-floating-move-info))) (cam-free-floating-input (-> s3-0 rv) (-> s3-0 tv) (not arg2) arg3) (cond (arg2 - (matrix-axis-angle! (-> s3-0 tm) arg2 (-> s3-0 rv y)) - (matrix*! arg0 arg0 (-> s3-0 tm)) - (cond - ((< (vector-dot (-> arg0 vector 1) arg2) 0.0) - (forward-down->inv-matrix arg0 (-> arg0 vector 2) arg2) - ) - (else - (vector-negate! (-> s3-0 up) arg2) - (forward-down->inv-matrix arg0 (-> arg0 vector 2) (-> s3-0 up)) - ) - ) - ) - (else - (matrix-axis-angle! (-> s3-0 tm) (-> arg0 vector 1) (- (-> s3-0 rv y))) - (matrix*! arg0 arg0 (-> s3-0 tm)) - ) - ) + (matrix-axis-angle! (-> s3-0 tm) arg2 (-> s3-0 rv y)) + (matrix*! arg0 arg0 (-> s3-0 tm)) + (cond + ((< (vector-dot (-> arg0 vector 1) arg2) 0.0) (forward-down->inv-matrix arg0 (-> arg0 vector 2) arg2)) + (else (vector-negate! (-> s3-0 up) arg2) (forward-down->inv-matrix arg0 (-> arg0 vector 2) (-> s3-0 up))))) + (else (matrix-axis-angle! (-> s3-0 tm) (-> arg0 vector 1) (- (-> s3-0 rv y))) (matrix*! arg0 arg0 (-> s3-0 tm)))) (matrix-axis-angle! (-> s3-0 tm) (the-as vector (-> arg0 vector)) (- (-> s3-0 rv x))) (matrix*! arg0 arg0 (-> s3-0 tm)) (matrix-axis-angle! (-> s3-0 tm) (-> arg0 vector 2) (- (-> s3-0 rv z))) (matrix*! arg0 arg0 (-> s3-0 tm)) (vector-matrix*! (-> s3-0 tv) (-> s3-0 tv) arg0) - (vector+! arg1 arg1 (-> s3-0 tv)) - ) - ) + (vector+! arg1 arg1 (-> s3-0 tv)))) (defstate cam-free-floating (camera-slave) - :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (case message - (('teleport) - #f - ) - (else - (cam-standard-event-handler proc argc message block) - ) - ) - ) - :enter (behavior () - (when (not (-> self enter-has-run)) - (set! (-> self blend-from-type) (the-as uint 1)) - (set! (-> self blend-to-type) (the-as uint 1)) - (send-event *camera-combiner* 'stop-tracking) - ) - ) - :code (behavior () - (loop - (let ((a2-0 (-> *camera* local-down))) - (if (logtest? (-> self options) 8) - (set! a2-0 (the-as vector #f)) - ) - (cam-free-floating-move - (the-as matrix (-> self tracking)) - (-> self trans) - a2-0 - (the-as int (-> *CAMERA-bank* joypad)) - ) - ) - (suspend) - ) - ) - ) + :event + (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('teleport) #f) + (else (cam-standard-event-handler proc argc message block)))) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (the-as uint 1)) + (send-event *camera-combiner* 'stop-tracking))) + :code + (behavior () + (loop (let ((a2-0 (-> *camera* local-down))) + (if (logtest? (-> self options) 8) (set! a2-0 (the-as vector #f))) + (cam-free-floating-move (the-as matrix (-> self tracking)) (-> self trans) a2-0 (the-as int (-> *CAMERA-bank* joypad)))) + (suspend)))) (deftype camera-orbit-info (structure) - ((radius float) - (rot float) - (target-off vector :inline) - (orbit-off vector :inline) - (radius-lerp float) - ) - ) - + ((radius float) + (rot float) + (target-off vector :inline) + (orbit-off vector :inline) + (radius-lerp float))) (deftype CAM_ORBIT-bank (basic) - ((RADIUS_MAX float) - (RADIUS_MIN float) - (TARGET_OFF_ADJUST float) - (ORBIT_OFF_ADJUST float) - ) - ) + ((RADIUS_MAX float) + (RADIUS_MIN float) + (TARGET_OFF_ADJUST float) + (ORBIT_OFF_ADJUST float))) - -(define *CAM_ORBIT-bank* (new 'static 'CAM_ORBIT-bank - :RADIUS_MAX 61440.0 - :RADIUS_MIN 409.6 - :TARGET_OFF_ADJUST 81.92 - :ORBIT_OFF_ADJUST 81.92 - ) - ) +(define *CAM_ORBIT-bank* + (new 'static 'CAM_ORBIT-bank :RADIUS_MAX 61440.0 :RADIUS_MIN 409.6 :TARGET_OFF_ADJUST 81.92 :ORBIT_OFF_ADJUST 81.92)) (define *camera-orbit-info* (new 'static 'camera-orbit-info)) @@ -454,114 +262,62 @@ (set! (-> *camera-orbit-info* orbit-off y) 4096.0) (defstate cam-orbit (camera-slave) - :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (case message - (('teleport) - #f - ) - (else - (cam-standard-event-handler proc argc message block) - ) - ) - ) - :enter (behavior () - (when (not (-> self enter-has-run)) - (if (not *camera-orbit-target*) - (cam-slave-go cam-free-floating) - ) - (let ((v1-4 (new-stack-vector0))) - (vector-! v1-4 (-> self trans) (-> *camera-orbit-target* 0 root trans)) - (set! (-> *camera-orbit-info* rot) (atan (-> v1-4 x) (-> v1-4 z))) - ) - (set! (-> self blend-from-type) (the-as uint 1)) - (set! (-> self blend-to-type) (the-as uint 1)) - ) - ) - :exit (behavior () - '() - ) - :code (behavior () - (loop - (if (not *camera-orbit-target*) - (cam-slave-go cam-free-floating) - ) - (when *camera-read-analog* - (let ((f0-0 (analog-input (the-as int (-> *cpad-list* cpads 0 righty)) 128.0 32.0 110.0 0.05))) - (cond - ((< (* 0.05 (- 1.0 (-> *camera-orbit-info* radius-lerp))) f0-0) - (+! (-> *camera-orbit-info* radius-lerp) (* 0.05 (- 1.0 (-> *camera-orbit-info* radius-lerp)))) - ) - ((< f0-0 (* 0.05 (- (-> *camera-orbit-info* radius-lerp)))) - (+! (-> *camera-orbit-info* radius-lerp) (* 0.05 (- (-> *camera-orbit-info* radius-lerp)))) - ) - (else - (+! (-> *camera-orbit-info* radius-lerp) f0-0) - ) - ) - ) - (set! (-> *camera-orbit-info* radius) - (lerp (-> *CAM_ORBIT-bank* RADIUS_MIN) (-> *CAM_ORBIT-bank* RADIUS_MAX) (-> *camera-orbit-info* radius-lerp)) - ) - ) - (cond - ((cpad-hold? 0 l2) - (if (cpad-hold? 0 l1) + :event + (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('teleport) #f) + (else (cam-standard-event-handler proc argc message block)))) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (if (not *camera-orbit-target*) (cam-slave-go cam-free-floating)) + (let ((v1-4 (new-stack-vector0))) + (vector-! v1-4 (-> self trans) (-> *camera-orbit-target* 0 root trans)) + (set! (-> *camera-orbit-info* rot) (atan (-> v1-4 x) (-> v1-4 z)))) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (the-as uint 1)))) + :exit + (behavior () + ()) + :code + (behavior () + (loop (if (not *camera-orbit-target*) (cam-slave-go cam-free-floating)) + (when *camera-read-analog* + (let ((f0-0 (analog-input (the-as int (-> *cpad-list* cpads 0 righty)) 128.0 32.0 110.0 0.05))) + (cond + ((< (* 0.05 (- 1.0 (-> *camera-orbit-info* radius-lerp))) f0-0) + (+! (-> *camera-orbit-info* radius-lerp) (* 0.05 (- 1.0 (-> *camera-orbit-info* radius-lerp))))) + ((< f0-0 (* 0.05 (- (-> *camera-orbit-info* radius-lerp)))) + (+! (-> *camera-orbit-info* radius-lerp) (* 0.05 (- (-> *camera-orbit-info* radius-lerp))))) + (else (+! (-> *camera-orbit-info* radius-lerp) f0-0)))) + (set! (-> *camera-orbit-info* radius) + (lerp (-> *CAM_ORBIT-bank* RADIUS_MIN) (-> *CAM_ORBIT-bank* RADIUS_MAX) (-> *camera-orbit-info* radius-lerp)))) + (cond + ((cpad-hold? 0 l2) + (if (cpad-hold? 0 l1) (set! (-> *camera-orbit-info* target-off y) - (- (-> *camera-orbit-info* target-off y) (-> *CAM_ORBIT-bank* TARGET_OFF_ADJUST)) - ) - ) - (if (cpad-hold? 0 r1) - (+! (-> *camera-orbit-info* target-off y) (-> *CAM_ORBIT-bank* TARGET_OFF_ADJUST)) - ) - ) - (else - (if (cpad-hold? 0 l1) - (set! (-> *camera-orbit-info* orbit-off y) - (- (-> *camera-orbit-info* orbit-off y) (-> *CAM_ORBIT-bank* ORBIT_OFF_ADJUST)) - ) - ) - (if (cpad-hold? 0 r1) - (+! (-> *camera-orbit-info* orbit-off y) (-> *CAM_ORBIT-bank* ORBIT_OFF_ADJUST)) - ) - ) - ) - (when *camera-read-analog* - (let ((f0-20 - (analog-input (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 32.0 110.0 (* 21845.334 (seconds-per-frame))) - ) - ) - (set! (-> *camera-orbit-info* rot) - (the float (sar (shl (the int (+ (-> *camera-orbit-info* rot) f0-20)) 48) 48)) - ) - ) - ) - (let ((gp-0 (new-stack-vector0))) - (let ((s5-0 (new-stack-vector0))) - (set-vector! - (-> self trans) - (+ (-> *camera-orbit-target* 0 root trans x) - (* (sin (-> *camera-orbit-info* rot)) (-> *camera-orbit-info* radius)) - ) - (-> *camera-orbit-target* 0 root trans y) - (+ (-> *camera-orbit-target* 0 root trans z) - (* (cos (-> *camera-orbit-info* rot)) (-> *camera-orbit-info* radius)) - ) - 1.0 - ) - (vector+! (-> self trans) (-> self trans) (-> *camera-orbit-info* orbit-off)) - (vector+! - (-> self tracking follow-pt) - (-> *camera-orbit-target* 0 root trans) - (-> *camera-orbit-info* target-off) - ) - (vector-! s5-0 (-> self trans) (-> self tracking follow-pt)) - (set! (-> gp-0 y) (the float (sar (shl (the int (+ 32768.0 (atan (-> s5-0 x) (-> s5-0 z)))) 48) 48))) - (set! (-> gp-0 x) (atan (-> s5-0 y) (vector-xz-length s5-0))) - ) - (set! (-> gp-0 z) 0.0) - (matrix-rotate-zxy! (the-as matrix (-> self tracking)) gp-0) - ) - (suspend) - ) - ) - ) + (- (-> *camera-orbit-info* target-off y) (-> *CAM_ORBIT-bank* TARGET_OFF_ADJUST)))) + (if (cpad-hold? 0 r1) (+! (-> *camera-orbit-info* target-off y) (-> *CAM_ORBIT-bank* TARGET_OFF_ADJUST)))) + (else + (if (cpad-hold? 0 l1) + (set! (-> *camera-orbit-info* orbit-off y) + (- (-> *camera-orbit-info* orbit-off y) (-> *CAM_ORBIT-bank* ORBIT_OFF_ADJUST)))) + (if (cpad-hold? 0 r1) (+! (-> *camera-orbit-info* orbit-off y) (-> *CAM_ORBIT-bank* ORBIT_OFF_ADJUST))))) + (when *camera-read-analog* + (let ((f0-20 (analog-input (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 32.0 110.0 (* 21845.334 (seconds-per-frame))))) + (set! (-> *camera-orbit-info* rot) (the float (sar (shl (the int (+ (-> *camera-orbit-info* rot) f0-20)) 48) 48))))) + (let ((gp-0 (new-stack-vector0))) + (let ((s5-0 (new-stack-vector0))) + (set-vector! (-> self trans) + (+ (-> *camera-orbit-target* 0 root trans x) (* (sin (-> *camera-orbit-info* rot)) (-> *camera-orbit-info* radius))) + (-> *camera-orbit-target* 0 root trans y) + (+ (-> *camera-orbit-target* 0 root trans z) (* (cos (-> *camera-orbit-info* rot)) (-> *camera-orbit-info* radius))) + 1.0) + (vector+! (-> self trans) (-> self trans) (-> *camera-orbit-info* orbit-off)) + (vector+! (-> self tracking follow-pt) (-> *camera-orbit-target* 0 root trans) (-> *camera-orbit-info* target-off)) + (vector-! s5-0 (-> self trans) (-> self tracking follow-pt)) + (set! (-> gp-0 y) (the float (sar (shl (the int (+ 32768.0 (atan (-> s5-0 x) (-> s5-0 z)))) 48) 48))) + (set! (-> gp-0 x) (atan (-> s5-0 y) (vector-xz-length s5-0)))) + (set! (-> gp-0 z) 0.0) + (matrix-rotate-zxy! (the-as matrix (-> self tracking)) gp-0)) + (suspend)))) diff --git a/goal_src/jak1/engine/camera/cam-states.gc b/goal_src/jak1/engine/camera/cam-states.gc index deb33c1970..1d00599549 100644 --- a/goal_src/jak1/engine/camera/cam-states.gc +++ b/goal_src/jak1/engine/camera/cam-states.gc @@ -1,7 +1,6 @@ ;;-*-Lisp-*- (in-package goal) (bundles "ENGINE.CGO" "GAME.CGO") - (require "engine/camera/pov-camera-h.gc") (require "engine/collide/collide-mesh-h.gc") (require "engine/camera/camera.gc") @@ -15,1001 +14,619 @@ ;; dgos: GAME, ENGINE ;; note: changed for high fps - ;; DECOMP BEGINS (defstate cam-fixed (camera-slave) - :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (case message - (('teleport) - #f - ) - (else - (cam-standard-event-handler proc argc message block) - ) - ) - ) - :enter (behavior () - (when (not (-> self enter-has-run)) - (set! (-> self saved-pt quad) (-> self trans quad)) - (set! (-> self blend-from-type) (the-as uint 1)) - (set! (-> self blend-to-type) (the-as uint 0)) - 0 - ) - ) - :code (behavior () - (loop - (when (not (paused?)) - (let ((gp-0 (new 'stack-no-clear 'vector))) - (set! (-> self trans quad) (-> self saved-pt quad)) - (cam-curve-pos (-> self trans) gp-0 (the-as curve #f) #f) - (when (!= (-> gp-0 w) 0.0) - (vector-normalize! gp-0 (the-as float 1.0)) - (forward-down->inv-matrix (the-as matrix (-> self tracking)) gp-0 (-> *camera* local-down)) - ) - ) - ) - (suspend) - ) - ) - ) + :event + (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('teleport) #f) + (else (cam-standard-event-handler proc argc message block)))) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self saved-pt quad) (-> self trans quad)) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (the-as uint 0)) + 0)) + :code + (behavior () + (loop (when (not (paused?)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (set! (-> self trans quad) (-> self saved-pt quad)) + (cam-curve-pos (-> self trans) gp-0 (the-as curve #f) #f) + (when (!= (-> gp-0 w) 0.0) + (vector-normalize! gp-0 (the-as float 1.0)) + (forward-down->inv-matrix (the-as matrix (-> self tracking)) gp-0 (-> *camera* local-down))))) + (suspend)))) (defstate cam-fixed-read-entity (camera-slave) - :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (case message - (('teleport) - #f - ) - (else - (cam-standard-event-handler proc argc message block) - ) - ) - ) - :enter (behavior () - (cond - ((-> self enter-has-run) - ) - ((-> self cam-entity) - (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) (-> self trans) 'trans) - (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) - (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) - (cam-curve-setup (-> self trans)) - ((-> cam-fixed enter)) - ) - (else - (format #t "ERROR : cam-fixed-read-entity enter without entity~%") - ) - ) - (let ((gp-0 (new 'stack-no-clear 'vector))) - (if (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) gp-0 'interesting) - (send-event *camera* 'point-of-interest gp-0) - ) - ) - (go cam-fixed) - ) - :code (behavior () - (loop - (format *stdcon* "ERROR : stayed in cam-fixed-read-entity~%") - (suspend) - ) - ) - ) + :event + (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('teleport) #f) + (else (cam-standard-event-handler proc argc message block)))) + :enter + (behavior () + (cond + ((-> self enter-has-run)) + ((-> self cam-entity) + (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) (-> self trans) 'trans) + (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) + (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) + (cam-curve-setup (-> self trans)) + ((-> cam-fixed enter))) + (else (format #t "ERROR : cam-fixed-read-entity enter without entity~%"))) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (if (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) gp-0 'interesting) + (send-event *camera* 'point-of-interest gp-0))) + (go cam-fixed)) + :code + (behavior () + (loop (format *stdcon* "ERROR : stayed in cam-fixed-read-entity~%") + (suspend)))) (defstate cam-pov (camera-slave) - :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (case message - (('teleport) - #f - ) - (else - (cam-standard-event-handler proc argc message block) - ) - ) - ) - :enter (behavior () - (when (not (-> self enter-has-run)) - (set! (-> self blend-from-type) (the-as uint 1)) - (set! (-> self blend-to-type) (the-as uint 1)) - ) - ) - :trans (behavior () - (when (not (handle->process (-> *camera* pov-handle))) - (set! (-> self blend-from-type) (the-as uint 0)) - (cam-slave-go cam-fixed) - ) - ) - :code (behavior () - (loop - (when (not (paused?)) - (vector<-cspace! - (-> self trans) - (-> (the-as pov-camera (-> *camera* pov-handle process 0)) node-list data (-> *camera* pov-bone)) - ) - (let* ((v1-5 (-> self tracking)) - (a3-0 (-> (the-as pov-camera (-> *camera* pov-handle process 0)) - node-list - data - (-> *camera* pov-bone) - bone - transform - ) - ) - (a0-8 (-> a3-0 vector 0 quad)) - (a1-9 (-> a3-0 vector 1 quad)) - (a2-0 (-> a3-0 vector 2 quad)) - (a3-1 (-> a3-0 vector 3 quad)) - ) - (set! (-> v1-5 inv-mat vector 0 quad) a0-8) - (set! (-> v1-5 inv-mat vector 1 quad) a1-9) - (set! (-> v1-5 inv-mat vector 2 quad) a2-0) - (set! (-> v1-5 inv-mat vector 3 quad) a3-1) - ) - (vector-reset! (-> self tracking inv-mat vector 3)) - ) - (suspend) - ) - ) - ) + :event + (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('teleport) #f) + (else (cam-standard-event-handler proc argc message block)))) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (the-as uint 1)))) + :trans + (behavior () + (when (not (handle->process (-> *camera* pov-handle))) + (set! (-> self blend-from-type) (the-as uint 0)) + (cam-slave-go cam-fixed))) + :code + (behavior () + (loop (when (not (paused?)) + (vector<-cspace! (-> self trans) + (-> (the-as pov-camera (-> *camera* pov-handle process 0)) node-list data (-> *camera* pov-bone))) + (let* ((v1-5 (-> self tracking)) + (a3-0 (-> (the-as pov-camera (-> *camera* pov-handle process 0)) node-list data (-> *camera* pov-bone) bone transform)) + (a0-8 (-> a3-0 vector 0 quad)) + (a1-9 (-> a3-0 vector 1 quad)) + (a2-0 (-> a3-0 vector 2 quad)) + (a3-1 (-> a3-0 vector 3 quad))) + (set! (-> v1-5 inv-mat vector 0 quad) a0-8) + (set! (-> v1-5 inv-mat vector 1 quad) a1-9) + (set! (-> v1-5 inv-mat vector 2 quad) a2-0) + (set! (-> v1-5 inv-mat vector 3 quad) a3-1)) + (vector-reset! (-> self tracking inv-mat vector 3))) + (suspend)))) (defstate cam-pov180 (camera-slave) - :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (case message - (('teleport) - #f - ) - (else - (cam-standard-event-handler proc argc message block) - ) - ) - ) - :enter (behavior () - (when (not (-> self enter-has-run)) - (set! (-> self blend-from-type) (the-as uint 1)) - (set! (-> self blend-to-type) (the-as uint 1)) - ) - ) - :trans (behavior () - (when (not (handle->process (-> *camera* pov-handle))) - (set! (-> self blend-from-type) (the-as uint 0)) - (cam-slave-go cam-fixed) - ) - ) - :code (behavior () - (let ((gp-0 (new 'stack-no-clear 'vector)) - (s5-0 (new 'stack-no-clear 'vector)) - (s4-0 #t) - ) - (vector<-cspace! - gp-0 - (-> (the-as pov-camera (-> *camera* pov-handle process 0)) node-list data (-> *camera* pov-bone)) - ) - (let ((v1-11 (-> (the-as pov-camera (-> *camera* pov-handle process 0)) - node-list - data - (-> *camera* pov-bone) - bone - transform - ) - ) - ) - (vector-normalize-copy! s5-0 (-> v1-11 vector 2) (the-as float 1.0)) - ) - (loop - (when (not (paused?)) - (let ((s0-0 - (-> (the-as pov-camera (-> *camera* pov-handle process 0)) - node-list - data - (-> *camera* pov-bone) - bone - transform - ) - ) - (s1-0 - (-> (the-as pov-camera (-> *camera* pov-handle process 0)) node-list data (-> *camera* pov-bone) bone scale) - ) - (s3-0 (new 'stack-no-clear 'vector)) - ) - (let ((s2-0 (new 'stack-no-clear 'vector))) - (vector<-cspace! - s2-0 - (-> (the-as pov-camera (-> *camera* pov-handle process 0)) node-list data (-> *camera* pov-bone)) - ) - (vector-normalize-copy! s3-0 (-> s0-0 vector 2) (the-as float 1.0)) - (set! s4-0 - (cond - ((and (< (vector-vector-distance s2-0 gp-0) 40960.0) (< (cos (the-as float 3640.889)) (vector-dot s5-0 s3-0))) - (set! (-> self trans quad) (-> s2-0 quad)) - (vector-negate! (the-as vector (-> self tracking)) (the-as vector (-> s0-0 vector))) - (set! (-> self tracking inv-mat vector 1 quad) (-> s0-0 vector 1 quad)) - (vector-negate! (-> self tracking inv-mat vector 2) (-> s0-0 vector 2)) - (set! (-> self fov) (* 2.0 (atan (/ 12.700255 (* 20.3 (-> s1-0 x))) (the-as float 1.0)))) - (vector-float*! (the-as vector (-> self tracking)) (the-as vector (-> self tracking)) (/ 1.0 (-> s1-0 x))) - (vector-reset! (-> self tracking inv-mat vector 3)) - (if s4-0 - (set! s4-0 #f) - ) - s4-0 - ) - (else - #t - ) - ) - ) - (set! (-> gp-0 quad) (-> s2-0 quad)) - ) - (set! (-> s5-0 quad) (-> s3-0 quad)) - ) - ) - (suspend) - ) - ) - ) - ) + :event + (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('teleport) #f) + (else (cam-standard-event-handler proc argc message block)))) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (the-as uint 1)))) + :trans + (behavior () + (when (not (handle->process (-> *camera* pov-handle))) + (set! (-> self blend-from-type) (the-as uint 0)) + (cam-slave-go cam-fixed))) + :code + (behavior () + (let ((gp-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + (s4-0 #t)) + (vector<-cspace! gp-0 (-> (the-as pov-camera (-> *camera* pov-handle process 0)) node-list data (-> *camera* pov-bone))) + (let ((v1-11 (-> (the-as pov-camera (-> *camera* pov-handle process 0)) node-list data (-> *camera* pov-bone) bone transform))) + (vector-normalize-copy! s5-0 (-> v1-11 vector 2) (the-as float 1.0))) + (loop (when (not (paused?)) + (let ((s0-0 (-> (the-as pov-camera (-> *camera* pov-handle process 0)) node-list data (-> *camera* pov-bone) bone transform)) + (s1-0 (-> (the-as pov-camera (-> *camera* pov-handle process 0)) node-list data (-> *camera* pov-bone) bone scale)) + (s3-0 (new 'stack-no-clear 'vector))) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (vector<-cspace! s2-0 (-> (the-as pov-camera (-> *camera* pov-handle process 0)) node-list data (-> *camera* pov-bone))) + (vector-normalize-copy! s3-0 (-> s0-0 vector 2) (the-as float 1.0)) + (set! s4-0 + (cond + ((and (< (vector-vector-distance s2-0 gp-0) 40960.0) (< (cos (the-as float 3640.889)) (vector-dot s5-0 s3-0))) + (set! (-> self trans quad) (-> s2-0 quad)) + (vector-negate! (the-as vector (-> self tracking)) (the-as vector (-> s0-0 vector))) + (set! (-> self tracking inv-mat vector 1 quad) (-> s0-0 vector 1 quad)) + (vector-negate! (-> self tracking inv-mat vector 2) (-> s0-0 vector 2)) + (set! (-> self fov) (* 2.0 (atan (/ 12.700255 (* 20.3 (-> s1-0 x))) (the-as float 1.0)))) + (vector-float*! (the-as vector (-> self tracking)) (the-as vector (-> self tracking)) (/ 1.0 (-> s1-0 x))) + (vector-reset! (-> self tracking inv-mat vector 3)) + (if s4-0 (set! s4-0 #f)) + s4-0) + (else #t))) + (set! (-> gp-0 quad) (-> s2-0 quad))) + (set! (-> s5-0 quad) (-> s3-0 quad)))) + (suspend))))) (defstate cam-pov-track (camera-slave) :event cam-standard-event-handler - :enter (behavior () - (when (not (-> self enter-has-run)) - (set! (-> self blend-from-type) (the-as uint 2)) - (set! (-> self blend-to-type) (the-as uint 2)) - ) - (let ((gp-0 (new 'stack-no-clear 'vector))) - (if (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) gp-0 'interesting) - (send-event *camera* 'point-of-interest gp-0) - ) - ) - ) - :trans (behavior () - (if (or (not (handle->process (-> *camera* pov-handle))) (not (logtest? (-> *camera* master-options) 2))) - (cam-slave-go cam-free-floating) - ) - ) - :code (behavior () - (loop - (if (not (paused?)) - (vector<-cspace! - (-> self trans) - (-> (the-as pov-camera (-> *camera* pov-handle process 0)) node-list data (-> *camera* pov-bone)) - ) - ) - (suspend) - ) - ) - ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (the-as uint 2))) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (if (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) gp-0 'interesting) + (send-event *camera* 'point-of-interest gp-0)))) + :trans + (behavior () + (if (or (not (handle->process (-> *camera* pov-handle))) (not (logtest? (-> *camera* master-options) 2))) + (cam-slave-go cam-free-floating))) + :code + (behavior () + (loop (if (not (paused?)) + (vector<-cspace! (-> self trans) + (-> (the-as pov-camera (-> *camera* pov-handle process 0)) node-list data (-> *camera* pov-bone)))) + (suspend)))) (defbehavior cam-standoff-calc-trans camera-slave () (if (-> self tracking no-follow) - (vector+! (-> self trans) (-> *camera* tpos-curr-adj) (-> self pivot-pt)) - (vector+! (-> self trans) (-> self tracking follow-pt) (-> self pivot-pt)) - ) - ) + (vector+! (-> self trans) (-> *camera* tpos-curr-adj) (-> self pivot-pt)) + (vector+! (-> self trans) (-> self tracking follow-pt) (-> self pivot-pt)))) (defstate cam-standoff (camera-slave) - :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (case message - (('set-standoff-dist) - (vector-normalize! (-> self pivot-pt) (the-as float (-> block param 0))) - (cam-standoff-calc-trans) - ) - (('set-standoff-height) - (vector-flatten! (-> self pivot-pt) (-> self pivot-pt) (-> *camera* local-down)) - (vector--float*! - (-> self pivot-pt) - (-> self pivot-pt) - (-> *camera* local-down) - (the-as float (-> block param 0)) - ) - (cam-standoff-calc-trans) - ) - (else - (cam-standard-event-handler proc argc message block) - ) - ) - ) - :enter (behavior () - (when (not (-> self enter-has-run)) - (vector-! (-> self pivot-pt) (-> self trans) (-> *camera* tpos-curr-adj)) - (cond - ((logtest? (-> self options) #x8000) - (set! (-> self blend-from-type) (the-as uint 0)) - (set! (-> self blend-to-type) (the-as uint 0)) - 0 - ) - (else - (set! (-> self blend-from-type) (the-as uint 2)) - (set! (-> self blend-to-type) (the-as uint 2)) - ) - ) - ) - (cam-calc-follow! (-> self tracking) (-> self trans) #f) - ) - :trans (behavior () - (if (not (logtest? (-> *camera* master-options) 2)) - (cam-slave-go cam-free-floating) - ) - ) - :code (behavior () - (loop - (when (not (paused?)) - (cam-calc-follow! (-> self tracking) (-> self trans) #t) - (cam-standoff-calc-trans) - ) - (suspend) - ) - ) - ) + :event + (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('set-standoff-dist) (vector-normalize! (-> self pivot-pt) (the-as float (-> block param 0))) (cam-standoff-calc-trans)) + (('set-standoff-height) + (vector-flatten! (-> self pivot-pt) (-> self pivot-pt) (-> *camera* local-down)) + (vector--float*! (-> self pivot-pt) (-> self pivot-pt) (-> *camera* local-down) (the-as float (-> block param 0))) + (cam-standoff-calc-trans)) + (else (cam-standard-event-handler proc argc message block)))) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (vector-! (-> self pivot-pt) (-> self trans) (-> *camera* tpos-curr-adj)) + (cond + ((logtest? (-> self options) #x8000) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (the-as uint 0)) + 0) + (else (set! (-> self blend-from-type) (the-as uint 2)) (set! (-> self blend-to-type) (the-as uint 2))))) + (cam-calc-follow! (-> self tracking) (-> self trans) #f)) + :trans + (behavior () + (if (not (logtest? (-> *camera* master-options) 2)) (cam-slave-go cam-free-floating))) + :code + (behavior () + (loop (when (not (paused?)) + (cam-calc-follow! (-> self tracking) (-> self trans) #t) + (cam-standoff-calc-trans)) + (suspend)))) (defstate cam-standoff-read-entity (camera-slave) :event cam-standard-event-handler - :enter (behavior () - (cond - ((-> self enter-has-run) - ) - ((-> self cam-entity) - (let ((gp-0 (new-stack-vector0)) - (s5-0 (new-stack-vector0)) - ) - (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) gp-0 'trans) - (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) s5-0 'align) - (vector-! (-> self pivot-pt) gp-0 s5-0) - ) - (vector+! (-> self trans) (-> *camera* tpos-curr-adj) (-> self pivot-pt)) - (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) - (logior! (-> self options) (cam-slave-get-flags (-> self cam-entity) 'flags)) - (if (logtest? (-> self options) #x8000) + :enter + (behavior () + (cond + ((-> self enter-has-run)) + ((-> self cam-entity) + (let ((gp-0 (new-stack-vector0)) + (s5-0 (new-stack-vector0))) + (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) gp-0 'trans) + (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) s5-0 'align) + (vector-! (-> self pivot-pt) gp-0 s5-0)) + (vector+! (-> self trans) (-> *camera* tpos-curr-adj) (-> self pivot-pt)) + (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) + (logior! (-> self options) (cam-slave-get-flags (-> self cam-entity) 'flags)) + (if (logtest? (-> self options) #x8000) (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) (set! (-> self tracking tilt-adjust target) - (cam-slave-get-float (-> self cam-entity) 'tiltAdjust (-> *CAMERA-bank* default-tilt-adjust)) - ) - ) - ((-> cam-standoff enter)) - ) - (else - (format #t "ERROR : cam-standoff-read-entity enter without entity~%") - ) - ) - (let ((gp-2 (new 'stack-no-clear 'vector))) - (if (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) gp-2 'interesting) - (send-event *camera* 'point-of-interest gp-2) - ) - ) - (go cam-standoff) - ) - :code (behavior () - (loop - (format *stdcon* "ERROR : stayed in cam-standoff-read-entity~%") - (suspend) - ) - ) - ) + (cam-slave-get-float (-> self cam-entity) 'tiltAdjust (-> *CAMERA-bank* default-tilt-adjust)))) + ((-> cam-standoff enter))) + (else (format #t "ERROR : cam-standoff-read-entity enter without entity~%"))) + (let ((gp-2 (new 'stack-no-clear 'vector))) + (if (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) gp-2 'interesting) + (send-event *camera* 'point-of-interest gp-2))) + (go cam-standoff)) + :code + (behavior () + (loop (format *stdcon* "ERROR : stayed in cam-standoff-read-entity~%") + (suspend)))) (deftype cam-eye-bank (basic) - ((rot-speed float) - (max-degrees float) - (max-fov float) - (min-fov float) - ) - ) - + ((rot-speed float) + (max-degrees float) + (max-fov float) + (min-fov float))) (define *CAM_EYE-bank* - (new 'static 'cam-eye-bank :rot-speed 364.0889 :max-degrees 12743.111 :max-fov 11650.845 :min-fov 6189.511) - ) + (new 'static 'cam-eye-bank :rot-speed 364.0889 :max-degrees 12743.111 :max-fov 11650.845 :min-fov 6189.511)) ;; main first-person camera ;; og:preserve-this modified for high fps (defstate cam-eye (camera-slave) - :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (case message - (('teleport) - #f - ) - (else - (cam-standard-event-handler proc argc message block) - ) - ) - ) - :enter (behavior () - (when (not (-> self enter-has-run)) - (let ((v1-3 (vector-float*! (new-stack-vector0) (-> *camera* local-down) (+ 1024.0 (-> *camera* target-height))))) - (vector-! (-> self trans) (-> *camera* tpos-curr) v1-3) - ) - (set! (-> self blend-from-type) (the-as uint 0)) - (set! (-> self blend-to-type) (the-as uint 0)) - 0 - ) - (set! (-> self fov) 11650.845) - ) - :exit (behavior () - (if (and *target* - (logtest? (-> *camera* master-options) 2) - (logtest? (-> *target* state-flags) (state-flags first-person-mode)) - ) - (send-event *target* 'end-mode) - ) - ) - :trans (behavior () - (if (not (logtest? (-> *camera* master-options) 2)) - (go cam-free-floating) - ) - ) - :code (behavior () - (let ((gp-0 (current-time))) - (loop - (when (not (paused?)) - (let ((s4-0 (vector-reset! (new-stack-vector0))) - (s5-0 (new-stack-matrix0)) - ) - (when *camera-read-analog* - (let ((f30-0 (analog-input-horizontal-first ;; og:preserve-this changed for pc port - (the-as int (+ (-> *cpad-list* cpads 0 rightx) -256 (-> *cpad-list* cpads 0 leftx))) - (the-as float 0.0) - (the-as float 48.0) - (the-as float 110.0) - (the-as float -1.0) - ) - ) - (f0-0 (analog-input-vertical-first ;; og:preserve-this changed for pc port - (the-as int (+ (-> *cpad-list* cpads 0 righty) -256 (-> *cpad-list* cpads 0 lefty))) - (the-as float 0.0) - (the-as float 48.0) - (the-as float 110.0) - (the-as float -1.0) - ) - ) - ) - (set! (-> s4-0 y) (- (-> s4-0 y) (* (- f30-0) (* (-> *display* time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed))))) ;; og:preserve-this changed for high fps - (set! (-> s4-0 x) (- (-> s4-0 x) (* (- f0-0) (* (-> *display* time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed))))) ;; og:preserve-this changed for high fps - ) - ) - (cond - ((< (* (-> *display* time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed)) (-> s4-0 x)) ;; og:preserve-this changed for high fps - (set! (-> s4-0 x) (* (-> *display* time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed))) ;; og:preserve-this changed for high fps - ) - ((< (-> s4-0 x) (- (* (-> *display* time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed)))) ;; og:preserve-this changed for high fps - (set! (-> s4-0 x) (- (* (-> *display* time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed)))) ;; og:preserve-this changed for high fps - ) - ) - (cond - ((< (* (-> *display* time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed)) (-> s4-0 y)) ;; og:preserve-this changed for high fps - (set! (-> s4-0 y) (* (-> *display* time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed))) ;; og:preserve-this changed for high fps - ) - ((< (-> s4-0 y) (- (* (-> *display* time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed)))) ;; og:preserve-this changed for high fps - (set! (-> s4-0 y) (- (* (-> *display* time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed)))) ;; og:preserve-this changed for high fps - ) - ) - (cond - ((and (= (-> s4-0 x) 0.0) (= (-> s4-0 y) 0.0)) - (set! gp-0 (current-time)) - ) - (else - (let ((v1-44 (min 10 (max 1 (- (current-time) gp-0))))) - (vector-float*! s4-0 s4-0 (* 0.1 (the float v1-44))) - ) - ) - ) - (matrix-axis-angle! s5-0 (-> *camera* local-down) (-> s4-0 y)) - (matrix*! (the-as matrix (-> self tracking)) (the-as matrix (-> self tracking)) s5-0) - (when (not (logtest? (-> self options) 8)) - (if (< (vector-dot (-> self tracking inv-mat vector 1) (-> *camera* local-down)) 0.0) - (forward-down->inv-matrix - (the-as matrix (-> self tracking)) - (-> self tracking inv-mat vector 2) - (-> *camera* local-down) - ) - (forward-down->inv-matrix - (the-as matrix (-> self tracking)) - (-> self tracking inv-mat vector 2) - (vector-negate! (new-stack-vector0) (-> *camera* local-down)) - ) - ) - ) - (matrix-axis-angle! s5-0 (the-as vector (-> self tracking)) (- (-> s4-0 x))) - (matrix*! (the-as matrix (-> self tracking)) (the-as matrix (-> self tracking)) s5-0) - ) - (when (not (logtest? (-> self options) 8)) - (let ((f30-1 (vector-dot (-> *camera* local-down) (-> self tracking inv-mat vector 2)))) - (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) - (when (< (sin (-> *CAM_EYE-bank* max-degrees)) (fabs f30-1)) - (vector--float*! - (-> self tracking inv-mat vector 2) - (-> self tracking inv-mat vector 2) - (-> *camera* local-down) - f30-1 - ) - (vector-normalize! (-> self tracking inv-mat vector 2) (cos (-> *CAM_EYE-bank* max-degrees))) - (if (< f30-1 0.0) - (vector--float*! - (-> self tracking inv-mat vector 2) - (-> self tracking inv-mat vector 2) - (-> *camera* local-down) - (sin (-> *CAM_EYE-bank* max-degrees)) - ) - (vector+float*! - (-> self tracking inv-mat vector 2) - (-> self tracking inv-mat vector 2) - (-> *camera* local-down) - (sin (-> *CAM_EYE-bank* max-degrees)) - ) - ) - (vector-cross! - (-> self tracking inv-mat vector 1) - (-> self tracking inv-mat vector 2) - (the-as vector (-> self tracking)) - ) - (set! (-> self tracking inv-mat vector 1 w) 0.0) - ) - ) - ) - ) - (let ((v1-76 (vector-float*! (new-stack-vector0) (-> *camera* local-down) (+ 1024.0 (-> *camera* target-height))))) - (vector-! (-> self trans) (-> *camera* tpos-curr) v1-76) - ) - (suspend) - ) - ) - ) - ) + :event + (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('teleport) #f) + (else (cam-standard-event-handler proc argc message block)))) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (let ((v1-3 (vector-float*! (new-stack-vector0) (-> *camera* local-down) (+ 1024.0 (-> *camera* target-height))))) + (vector-! (-> self trans) (-> *camera* tpos-curr) v1-3)) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (the-as uint 0)) + 0) + (set! (-> self fov) 11650.845)) + :exit + (behavior () + (if (and *target* + (logtest? (-> *camera* master-options) 2) + (logtest? (-> *target* state-flags) (state-flags first-person-mode))) + (send-event *target* 'end-mode))) + :trans + (behavior () + (if (not (logtest? (-> *camera* master-options) 2)) (go cam-free-floating))) + :code + (behavior () + (let ((gp-0 (current-time))) + (loop (when (not (paused?)) + (let ((s4-0 (vector-reset! (new-stack-vector0))) + (s5-0 (new-stack-matrix0))) + (when *camera-read-analog* + (let ((f30-0 (analog-input-horizontal-first ;; og:preserve-this changed for pc port + (the-as int (+ (-> *cpad-list* cpads 0 rightx) -256 (-> *cpad-list* cpads 0 leftx))) + (the-as float 0.0) + (the-as float 48.0) + (the-as float 110.0) + (the-as float -1.0))) + (f0-0 (analog-input-vertical-first ;; og:preserve-this changed for pc port + (the-as int (+ (-> *cpad-list* cpads 0 righty) -256 (-> *cpad-list* cpads 0 lefty))) + (the-as float 0.0) + (the-as float 48.0) + (the-as float 110.0) + (the-as float -1.0)))) + (set! (-> s4-0 y) (- (-> s4-0 y) (* (- f30-0) (* (-> *display* time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed))))) ;; og:preserve-this changed for high fps + (set! (-> s4-0 x) (- (-> s4-0 x) (* (- f0-0) (* (-> *display* time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed))))) ;; og:preserve-this changed for high fps + )) + (cond + ((< (* (-> *display* time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed)) (-> s4-0 x)) ;; og:preserve-this changed for high fps + (set! (-> s4-0 x) (* (-> *display* time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed))) ;; og:preserve-this changed for high fps + ) + ((< (-> s4-0 x) (- (* (-> *display* time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed)))) ;; og:preserve-this changed for high fps + (set! (-> s4-0 x) (- (* (-> *display* time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed)))) ;; og:preserve-this changed for high fps + )) + (cond + ((< (* (-> *display* time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed)) (-> s4-0 y)) ;; og:preserve-this changed for high fps + (set! (-> s4-0 y) (* (-> *display* time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed))) ;; og:preserve-this changed for high fps + ) + ((< (-> s4-0 y) (- (* (-> *display* time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed)))) ;; og:preserve-this changed for high fps + (set! (-> s4-0 y) (- (* (-> *display* time-adjust-ratio) (-> *CAM_EYE-bank* rot-speed)))) ;; og:preserve-this changed for high fps + )) + (cond + ((and (= (-> s4-0 x) 0.0) (= (-> s4-0 y) 0.0)) (set! gp-0 (current-time))) + (else (let ((v1-44 (min 10 (max 1 (- (current-time) gp-0))))) (vector-float*! s4-0 s4-0 (* 0.1 (the float v1-44)))))) + (matrix-axis-angle! s5-0 (-> *camera* local-down) (-> s4-0 y)) + (matrix*! (the-as matrix (-> self tracking)) (the-as matrix (-> self tracking)) s5-0) + (when (not (logtest? (-> self options) 8)) + (if (< (vector-dot (-> self tracking inv-mat vector 1) (-> *camera* local-down)) 0.0) + (forward-down->inv-matrix (the-as matrix (-> self tracking)) + (-> self tracking inv-mat vector 2) + (-> *camera* local-down)) + (forward-down->inv-matrix (the-as matrix (-> self tracking)) + (-> self tracking inv-mat vector 2) + (vector-negate! (new-stack-vector0) (-> *camera* local-down))))) + (matrix-axis-angle! s5-0 (the-as vector (-> self tracking)) (- (-> s4-0 x))) + (matrix*! (the-as matrix (-> self tracking)) (the-as matrix (-> self tracking)) s5-0)) + (when (not (logtest? (-> self options) 8)) + (let ((f30-1 (vector-dot (-> *camera* local-down) (-> self tracking inv-mat vector 2)))) + (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) + (when (< (sin (-> *CAM_EYE-bank* max-degrees)) (fabs f30-1)) + (vector--float*! (-> self tracking inv-mat vector 2) (-> self tracking inv-mat vector 2) (-> *camera* local-down) f30-1) + (vector-normalize! (-> self tracking inv-mat vector 2) (cos (-> *CAM_EYE-bank* max-degrees))) + (if (< f30-1 0.0) + (vector--float*! (-> self tracking inv-mat vector 2) + (-> self tracking inv-mat vector 2) + (-> *camera* local-down) + (sin (-> *CAM_EYE-bank* max-degrees))) + (vector+float*! (-> self tracking inv-mat vector 2) + (-> self tracking inv-mat vector 2) + (-> *camera* local-down) + (sin (-> *CAM_EYE-bank* max-degrees)))) + (vector-cross! (-> self tracking inv-mat vector 1) + (-> self tracking inv-mat vector 2) + (the-as vector (-> self tracking))) + (set! (-> self tracking inv-mat vector 1 w) 0.0))))) + (let ((v1-76 (vector-float*! (new-stack-vector0) (-> *camera* local-down) (+ 1024.0 (-> *camera* target-height))))) + (vector-! (-> self trans) (-> *camera* tpos-curr) v1-76)) + (suspend))))) (deftype cam-billy-bank (basic) - ((rot-speed float) - (tilt-degrees float) - ) - ) - + ((rot-speed float) + (tilt-degrees float))) (define *CAM_BILLY-bank* (new 'static 'cam-billy-bank :rot-speed 364.0889 :tilt-degrees -1820.4445)) (defstate cam-billy (camera-slave) - :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (case message - (('teleport) - #f - ) - (else - (cam-standard-event-handler proc argc message block) - ) - ) - ) - :enter (behavior () - (when (not (-> self enter-has-run)) - (let ((v1-3 (vector-float*! (new-stack-vector0) (-> *camera* local-down) (-> *camera* target-height)))) - (vector-! (-> self trans) (-> *camera* tpos-curr) v1-3) - ) - (set! (-> self blend-from-type) (the-as uint 0)) - (set! (-> self blend-to-type) (the-as uint 0)) - 0 - ) - (set! (-> self fov) 9830.4) - (matrix-rotate-y! (the-as matrix (-> self tracking)) (the-as float -32768.0)) - ) - :exit (behavior () - '() - ) - :trans (behavior () - (if (not (logtest? (-> *camera* master-options) 2)) - (go cam-free-floating) - ) - ) - :code (behavior () - (loop - (when (not (paused?)) - (let ((s5-0 (vector-reset! (new-stack-vector0))) - (s4-0 (vector-reset! (new-stack-vector0))) - (s3-0 (vector-reset! (new-stack-vector0))) - (s2-0 (new-stack-vector0)) - (gp-0 (new-stack-matrix0)) - ) - 0.0 - (when *camera-read-analog* - (let ((f1-0 - (analog-input-horizontal-first ;; og:preserve-this changed for pc port - (the-as int (+ (-> *cpad-list* cpads 0 rightx) -256 (-> *cpad-list* cpads 0 leftx))) - (the-as float 0.0) - (the-as float 48.0) - (the-as float 110.0) - (the-as float -1.0) - ) - ) - ) - (set! (-> s5-0 y) (- (-> s5-0 y) (* (- f1-0) (* (-> *display* time-adjust-ratio) (-> *CAM_BILLY-bank* rot-speed))))) ;; og:preserve-this changed for high fps - ) - ) - (cond - ((< (* (-> *display* time-adjust-ratio) (-> *CAM_BILLY-bank* rot-speed)) (-> s5-0 y)) ;; og:preserve-this changed for high fps - (set! (-> s5-0 y) (* (-> *display* time-adjust-ratio) (-> *CAM_BILLY-bank* rot-speed))) ;; og:preserve-this changed for high fps - ) - ((< (-> s5-0 y) (- (* (-> *display* time-adjust-ratio) (-> *CAM_BILLY-bank* rot-speed)))) ;; og:preserve-this changed for high fps - (set! (-> s5-0 y) (- (* (-> *display* time-adjust-ratio) (-> *CAM_BILLY-bank* rot-speed)))) ;; og:preserve-this changed for high fps - ) - ) - (set! (-> s3-0 x) (sin (the-as float 37319.11))) - (set! (-> s3-0 z) (cos (the-as float 37319.11))) - (set! (-> s4-0 x) (-> s3-0 z)) - (set! (-> s4-0 z) (- (-> s3-0 x))) - (vector-flatten! s2-0 (-> self tracking inv-mat vector 2) (-> *camera* local-down)) - (vector-normalize! s2-0 (the-as float 1.0)) - (let ((f0-14 (acos (vector-dot (-> self tracking inv-mat vector 2) s3-0)))) - (if (< (vector-dot (-> self tracking inv-mat vector 2) s4-0) 0.0) - (set! f0-14 (- f0-14)) - ) - (let ((f0-18 (cond - ((and (< 0.0 f0-14) (< 0.0 (-> s5-0 y))) - (fmin (-> s5-0 y) (fmax 0.0 (* 0.5 (- 10922.667 f0-14)))) - ) - ((and (< f0-14 0.0) (< (-> s5-0 y) 0.0)) - (fmax (-> s5-0 y) (fmin 0.0 (* 0.5 (- -10922.667 f0-14)))) - ) - (else - (-> s5-0 y) - ) - ) - ) - ) - (matrix-axis-angle! gp-0 (-> *camera* local-down) f0-18) - ) - ) - (vector-matrix*! (-> self tracking inv-mat vector 2) (-> self tracking inv-mat vector 2) gp-0) - ) - (set! (-> self tracking inv-mat vector 2 y) 0.0) - (vector-normalize! (-> self tracking inv-mat vector 2) (cos (-> *CAM_BILLY-bank* tilt-degrees))) - (set! (-> self tracking inv-mat vector 2 y) (sin (-> *CAM_BILLY-bank* tilt-degrees))) - (vector-cross! - (the-as vector (-> self tracking)) - (-> self tracking inv-mat vector 2) - (-> *camera* local-down) - ) - (vector-normalize! (the-as vector (-> self tracking)) (the-as float 1.0)) - (vector-cross! - (-> self tracking inv-mat vector 1) - (-> self tracking inv-mat vector 2) - (the-as vector (-> self tracking)) - ) - ) - (vector--float*! (-> self trans) (-> *camera* tpos-curr) (-> *camera* local-down) (-> *camera* target-height)) - (suspend) - ) - ) - ) + :event + (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('teleport) #f) + (else (cam-standard-event-handler proc argc message block)))) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (let ((v1-3 (vector-float*! (new-stack-vector0) (-> *camera* local-down) (-> *camera* target-height)))) + (vector-! (-> self trans) (-> *camera* tpos-curr) v1-3)) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (the-as uint 0)) + 0) + (set! (-> self fov) 9830.4) + (matrix-rotate-y! (the-as matrix (-> self tracking)) (the-as float -32768.0))) + :exit + (behavior () + ()) + :trans + (behavior () + (if (not (logtest? (-> *camera* master-options) 2)) (go cam-free-floating))) + :code + (behavior () + (loop (when (not (paused?)) + (let ((s5-0 (vector-reset! (new-stack-vector0))) + (s4-0 (vector-reset! (new-stack-vector0))) + (s3-0 (vector-reset! (new-stack-vector0))) + (s2-0 (new-stack-vector0)) + (gp-0 (new-stack-matrix0))) + 0.0 + (when *camera-read-analog* + (let ((f1-0 (analog-input-horizontal-first ;; og:preserve-this changed for pc port + (the-as int (+ (-> *cpad-list* cpads 0 rightx) -256 (-> *cpad-list* cpads 0 leftx))) + (the-as float 0.0) + (the-as float 48.0) + (the-as float 110.0) + (the-as float -1.0)))) + (set! (-> s5-0 y) (- (-> s5-0 y) (* (- f1-0) (* (-> *display* time-adjust-ratio) (-> *CAM_BILLY-bank* rot-speed))))) ;; og:preserve-this changed for high fps + )) + (cond + ((< (* (-> *display* time-adjust-ratio) (-> *CAM_BILLY-bank* rot-speed)) (-> s5-0 y)) ;; og:preserve-this changed for high fps + (set! (-> s5-0 y) (* (-> *display* time-adjust-ratio) (-> *CAM_BILLY-bank* rot-speed))) ;; og:preserve-this changed for high fps + ) + ((< (-> s5-0 y) (- (* (-> *display* time-adjust-ratio) (-> *CAM_BILLY-bank* rot-speed)))) ;; og:preserve-this changed for high fps + (set! (-> s5-0 y) (- (* (-> *display* time-adjust-ratio) (-> *CAM_BILLY-bank* rot-speed)))) ;; og:preserve-this changed for high fps + )) + (set! (-> s3-0 x) (sin (the-as float 37319.11))) + (set! (-> s3-0 z) (cos (the-as float 37319.11))) + (set! (-> s4-0 x) (-> s3-0 z)) + (set! (-> s4-0 z) (- (-> s3-0 x))) + (vector-flatten! s2-0 (-> self tracking inv-mat vector 2) (-> *camera* local-down)) + (vector-normalize! s2-0 (the-as float 1.0)) + (let ((f0-14 (acos (vector-dot (-> self tracking inv-mat vector 2) s3-0)))) + (if (< (vector-dot (-> self tracking inv-mat vector 2) s4-0) 0.0) (set! f0-14 (- f0-14))) + (let ((f0-18 (cond + ((and (< 0.0 f0-14) (< 0.0 (-> s5-0 y))) (fmin (-> s5-0 y) (fmax 0.0 (* 0.5 (- 10922.667 f0-14))))) + ((and (< f0-14 0.0) (< (-> s5-0 y) 0.0)) (fmax (-> s5-0 y) (fmin 0.0 (* 0.5 (- -10922.667 f0-14))))) + (else (-> s5-0 y))))) + (matrix-axis-angle! gp-0 (-> *camera* local-down) f0-18))) + (vector-matrix*! (-> self tracking inv-mat vector 2) (-> self tracking inv-mat vector 2) gp-0)) + (set! (-> self tracking inv-mat vector 2 y) 0.0) + (vector-normalize! (-> self tracking inv-mat vector 2) (cos (-> *CAM_BILLY-bank* tilt-degrees))) + (set! (-> self tracking inv-mat vector 2 y) (sin (-> *CAM_BILLY-bank* tilt-degrees))) + (vector-cross! (the-as vector (-> self tracking)) (-> self tracking inv-mat vector 2) (-> *camera* local-down)) + (vector-normalize! (the-as vector (-> self tracking)) (the-as float 1.0)) + (vector-cross! (-> self tracking inv-mat vector 1) + (-> self tracking inv-mat vector 2) + (the-as vector (-> self tracking)))) + (vector--float*! (-> self trans) (-> *camera* tpos-curr) (-> *camera* local-down) (-> *camera* target-height)) + (suspend)))) (defstate cam-spline (camera-slave) :event cam-standard-event-handler - :enter (behavior () - (cond - ((-> self enter-has-run) - ) - ((-> self cam-entity) - (let ((gp-0 (new-stack-vector0))) - (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) - (logior! (-> self options) (cam-slave-get-flags (-> self cam-entity) 'flags)) - (if (logtest? (-> self options) #x8000) + :enter + (behavior () + (cond + ((-> self enter-has-run)) + ((-> self cam-entity) + (let ((gp-0 (new-stack-vector0))) + (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) + (logior! (-> self options) (cam-slave-get-flags (-> self cam-entity) 'flags)) + (if (logtest? (-> self options) #x8000) (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) (set! (-> self tracking tilt-adjust target) - (cam-slave-get-float (-> self cam-entity) 'tiltAdjust (-> *CAMERA-bank* default-tilt-adjust)) - ) - ) - (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) gp-0 'trans) - (cam-curve-setup gp-0) - ) - (vector-negate! (-> self saved-pt) (-> self spline-offset)) - (let ((a0-8 (res-lump-struct (-> self cam-entity) 'spline-offset structure :time (the-as float -1000000000.0)))) - (if a0-8 - (vector+! (-> self spline-offset) (-> self spline-offset) (the-as vector a0-8)) - ) - ) - (set! (-> self trans quad) (-> self saved-pt quad)) - (cam-calc-follow! (-> self tracking) (-> self trans) #f) - (set! (-> self spline-follow-dist) - (cam-slave-get-float (-> self cam-entity) 'spline-follow-dist (the-as float 0.0)) - ) - (cond - ((< 0.0 (-> self spline-follow-dist)) - (let ((s5-1 (new 'stack-no-clear 'vector)) - (gp-1 (new 'stack-no-clear 'vector)) - ) - (curve-get-pos! s5-1 (the-as float 0.0) (-> self spline-curve)) - (curve-get-pos! gp-1 (the-as float 1.0) (-> self spline-curve)) - (if (< (vector-vector-distance-squared s5-1 (-> self tracking follow-pt)) - (vector-vector-distance-squared gp-1 (-> self tracking follow-pt)) - ) - (set! (-> self spline-follow-dist) (- (-> self spline-follow-dist))) - ) - ) - (set! (-> self spline-tt) (curve-closest-point - (-> self spline-curve) - (-> self tracking follow-pt) - (the-as float 0.5) - (the-as float -4096.0) - 10 - (-> self spline-follow-dist) - ) - ) - ) - (else - (set! (-> self spline-follow-dist) 0.0) - ) - ) - (cam-curve-pos (-> self trans) (the-as vector #f) (the-as curve #f) #t) - (cond - ((logtest? (-> self options) #x8000) - (set! (-> self blend-from-type) (the-as uint 0)) - (set! (-> self blend-to-type) (the-as uint 0)) - 0 - ) - (else - (set! (-> self blend-from-type) (the-as uint 2)) - (set! (-> self blend-to-type) (the-as uint 2)) - ) - ) - ) - (else - (format #t "ERROR : cam-spline enter without entity~%") - ) - ) - (let ((gp-2 (new 'stack-no-clear 'vector))) - (if (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) gp-2 'interesting) - (send-event *camera* 'point-of-interest gp-2) - ) - ) - ) - :trans (behavior () - (if (not (logtest? (-> *camera* master-options) 2)) - (cam-slave-go cam-free-floating) - ) - ) - :code (behavior () - (loop - (when (not (paused?)) - (cam-calc-follow! (-> self tracking) (-> self trans) #t) - (new 'stack 'curve) - (set! (-> self trans quad) (-> self saved-pt quad)) - (cam-curve-pos (-> self trans) (the-as vector #f) (the-as curve #f) #t) - ) - (suspend) - ) - ) - ) + (cam-slave-get-float (-> self cam-entity) 'tiltAdjust (-> *CAMERA-bank* default-tilt-adjust)))) + (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) gp-0 'trans) + (cam-curve-setup gp-0)) + (vector-negate! (-> self saved-pt) (-> self spline-offset)) + (let ((a0-8 (res-lump-struct (-> self cam-entity) 'spline-offset structure :time (the-as float -1000000000.0)))) + (if a0-8 (vector+! (-> self spline-offset) (-> self spline-offset) (the-as vector a0-8)))) + (set! (-> self trans quad) (-> self saved-pt quad)) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (set! (-> self spline-follow-dist) (cam-slave-get-float (-> self cam-entity) 'spline-follow-dist (the-as float 0.0))) + (cond + ((< 0.0 (-> self spline-follow-dist)) + (let ((s5-1 (new 'stack-no-clear 'vector)) + (gp-1 (new 'stack-no-clear 'vector))) + (curve-get-pos! s5-1 (the-as float 0.0) (-> self spline-curve)) + (curve-get-pos! gp-1 (the-as float 1.0) (-> self spline-curve)) + (if (< (vector-vector-distance-squared s5-1 (-> self tracking follow-pt)) + (vector-vector-distance-squared gp-1 (-> self tracking follow-pt))) + (set! (-> self spline-follow-dist) (- (-> self spline-follow-dist))))) + (set! (-> self spline-tt) + (curve-closest-point (-> self spline-curve) + (-> self tracking follow-pt) + (the-as float 0.5) + (the-as float -4096.0) + 10 + (-> self spline-follow-dist)))) + (else (set! (-> self spline-follow-dist) 0.0))) + (cam-curve-pos (-> self trans) (the-as vector #f) (the-as curve #f) #t) + (cond + ((logtest? (-> self options) #x8000) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (the-as uint 0)) + 0) + (else (set! (-> self blend-from-type) (the-as uint 2)) (set! (-> self blend-to-type) (the-as uint 2))))) + (else (format #t "ERROR : cam-spline enter without entity~%"))) + (let ((gp-2 (new 'stack-no-clear 'vector))) + (if (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) gp-2 'interesting) + (send-event *camera* 'point-of-interest gp-2)))) + :trans + (behavior () + (if (not (logtest? (-> *camera* master-options) 2)) (cam-slave-go cam-free-floating))) + :code + (behavior () + (loop (when (not (paused?)) + (cam-calc-follow! (-> self tracking) (-> self trans) #t) + (new 'stack 'curve) + (set! (-> self trans quad) (-> self saved-pt quad)) + (cam-curve-pos (-> self trans) (the-as vector #f) (the-as curve #f) #t)) + (suspend)))) (defstate cam-decel (camera-slave) - :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (case message - (('teleport) - #f - ) - (else - (cam-standard-event-handler proc argc message block) - ) - ) - ) - :enter (behavior () - (if (not (-> self enter-has-run)) - (set! (-> self saved-pt quad) (-> self trans quad)) - ) - ) - :code (behavior () - (loop - (when (not (paused?)) - (let ((s5-0 (new-stack-vector0)) - (gp-0 (new-stack-vector0)) - ) - (when (!= (-> *camera* outro-t-step) 0.0) - (curve-get-pos! s5-0 (parameter-ease-sin-clamp (-> *camera* outro-t)) (-> *camera* outro-curve)) - (+! (-> *camera* outro-t) (* (-> *camera* outro-t-step) (-> *display* time-adjust-ratio))) - (curve-get-pos! gp-0 (parameter-ease-sin-clamp (-> *camera* outro-t)) (-> *camera* outro-curve)) - (vector-! gp-0 gp-0 s5-0) - (cond - ((or (and (< (-> *camera* outro-t-step) 0.0) (>= (-> *camera* outro-exit-value) (-> *camera* outro-t))) - (and (< 0.0 (-> *camera* outro-t-step)) (>= (-> *camera* outro-t) (-> *camera* outro-exit-value))) - ) - (set! (-> *camera* outro-t) (-> *camera* outro-exit-value)) - (set! (-> *camera* outro-t-step) 0.0) - (vector+! (-> self velocity) (-> self velocity) gp-0) - (send-event *camera* 'outro-done) - ) - (else - (vector+! (-> self trans) (-> self trans) gp-0) - ) - ) - ) - ) - (vector-float*! (-> self velocity) (-> self velocity) 0.9) - (vector+! (-> self trans) (-> self trans) (-> self velocity)) - ) - (suspend) - ) - ) - ) + :event + (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('teleport) #f) + (else (cam-standard-event-handler proc argc message block)))) + :enter + (behavior () + (if (not (-> self enter-has-run)) (set! (-> self saved-pt quad) (-> self trans quad)))) + :code + (behavior () + (loop (when (not (paused?)) + (let ((s5-0 (new-stack-vector0)) + (gp-0 (new-stack-vector0))) + (when (!= (-> *camera* outro-t-step) 0.0) + (curve-get-pos! s5-0 (parameter-ease-sin-clamp (-> *camera* outro-t)) (-> *camera* outro-curve)) + (+! (-> *camera* outro-t) (* (-> *camera* outro-t-step) (-> *display* time-adjust-ratio))) + (curve-get-pos! gp-0 (parameter-ease-sin-clamp (-> *camera* outro-t)) (-> *camera* outro-curve)) + (vector-! gp-0 gp-0 s5-0) + (cond + ((or (and (< (-> *camera* outro-t-step) 0.0) (>= (-> *camera* outro-exit-value) (-> *camera* outro-t))) + (and (< 0.0 (-> *camera* outro-t-step)) (>= (-> *camera* outro-t) (-> *camera* outro-exit-value)))) + (set! (-> *camera* outro-t) (-> *camera* outro-exit-value)) + (set! (-> *camera* outro-t-step) 0.0) + (vector+! (-> self velocity) (-> self velocity) gp-0) + (send-event *camera* 'outro-done)) + (else (vector+! (-> self trans) (-> self trans) gp-0))))) + (vector-float*! (-> self velocity) (-> self velocity) 0.9) + (vector+! (-> self trans) (-> self trans) (-> self velocity))) + (suspend)))) (defstate cam-endlessfall (camera-slave) - :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (case message - (('teleport) - #f - ) - (else - (cam-standard-event-handler proc argc message block) - ) - ) - ) - :enter (behavior () - (when (not (-> self enter-has-run)) - (set! (-> self blend-from-type) (the-as uint 2)) - (set! (-> self blend-to-type) (the-as uint 2)) - ) - ) - :code (behavior () - (let ((gp-0 (new 'stack-no-clear 'cam-vector-seeker)) - (f30-0 (-> self velocity y)) - ) - (let ((s4-0 (new 'stack-no-clear 'vector)) - (s5-0 (new 'stack-no-clear 'vector)) - ) - (set! (-> s4-0 quad) (-> self trans quad)) - (set! (-> s4-0 y) 0.0) - (set! (-> s5-0 quad) (-> self velocity quad)) - (set! (-> s5-0 y) 0.0) - (init! gp-0 s4-0 (the-as float 81.92) (fmax 819.2 (vector-length s5-0)) (the-as float 0.75)) - (set! (-> gp-0 vel quad) (-> s5-0 quad)) - ) - (loop - (when (not (paused?)) - (set! (-> gp-0 target x) (-> (target-pos 0) x)) - (set! (-> gp-0 target z) (-> (target-pos 0) z)) - (update! gp-0 (the-as vector #f)) - (when (< 819.2 (-> gp-0 max-vel)) - (set! (-> gp-0 max-vel) (* 0.9 (-> gp-0 max-vel))) - (if (< (-> gp-0 max-vel) 819.2) - (set! (-> gp-0 max-vel) 819.2) - ) - ) - (set! f30-0 (* 0.9 f30-0)) - (+! (-> self trans y) f30-0) - (set! (-> self trans x) (-> gp-0 value x)) - (set! (-> self trans z) (-> gp-0 value z)) - ) - (suspend) - ) - ) - ) - ) + :event + (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('teleport) #f) + (else (cam-standard-event-handler proc argc message block)))) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (the-as uint 2)))) + :code + (behavior () + (let ((gp-0 (new 'stack-no-clear 'cam-vector-seeker)) + (f30-0 (-> self velocity y))) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s4-0 quad) (-> self trans quad)) + (set! (-> s4-0 y) 0.0) + (set! (-> s5-0 quad) (-> self velocity quad)) + (set! (-> s5-0 y) 0.0) + (init! gp-0 s4-0 (the-as float 81.92) (fmax 819.2 (vector-length s5-0)) (the-as float 0.75)) + (set! (-> gp-0 vel quad) (-> s5-0 quad))) + (loop (when (not (paused?)) + (set! (-> gp-0 target x) (-> (target-pos 0) x)) + (set! (-> gp-0 target z) (-> (target-pos 0) z)) + (update! gp-0 (the-as vector #f)) + (when (< 819.2 (-> gp-0 max-vel)) + (set! (-> gp-0 max-vel) (* 0.9 (-> gp-0 max-vel))) + (if (< (-> gp-0 max-vel) 819.2) (set! (-> gp-0 max-vel) 819.2))) + (set! f30-0 (* 0.9 f30-0)) + (+! (-> self trans y) f30-0) + (set! (-> self trans x) (-> gp-0 value x)) + (set! (-> self trans z) (-> gp-0 value z))) + (suspend))))) (defbehavior cam-circular-position-into-max-angle camera-slave ((arg0 vector) (arg1 vector) (arg2 float)) (let* ((f30-0 (vector-normalize-ret-len! arg0 (the-as float 1.0))) (f26-0 (vector-normalize-ret-len! arg1 (the-as float 1.0))) (f0-1 (vector-dot arg0 arg1)) (f28-0 (acos f0-1)) - (s3-0 (new 'stack-no-clear 'matrix)) - ) + (s3-0 (new 'stack-no-clear 'matrix))) (when *camera-read-analog* - (let ((f24-0 (analog-input-horizontal-third ;; og:preserve-this changed for pc port + (let ((f24-0 (analog-input-horizontal-third ;; og:preserve-this changed for pc port (the-as int (-> *cpad-list* cpads 0 rightx)) (the-as float 128.0) (the-as float 32.0) (the-as float 110.0) - (* 8192.0 (seconds-per-frame)) - ) - ) - (f1-2 (analog-input-vertical-third ;; og:preserve-this changed for pc port + (* 8192.0 (seconds-per-frame)))) + (f1-2 (analog-input-vertical-third ;; og:preserve-this changed for pc port (the-as int (-> *cpad-list* cpads 0 righty)) (the-as float 128.0) (the-as float 32.0) (the-as float 110.0) - (* 8192.0 (seconds-per-frame)) - ) - ) - (s2-0 (new-stack-matrix0)) - ) + (* 8192.0 (seconds-per-frame)))) + (s2-0 (new-stack-matrix0))) (let ((v1-20 (new 'stack-no-clear 'vector))) 0.0 - (if (< (-> self pivot-rad) f30-0) - (set! f24-0 (- f24-0)) - ) + (if (< (-> self pivot-rad) f30-0) (set! f24-0 (- f24-0))) (vector-cross! v1-20 arg1 arg0) (let ((f0-9 (vector-dot v1-20 (-> *camera* local-down)))) - (if (< f1-2 0.0) - (set! f1-2 (fmax f1-2 (* -0.15 f28-0))) - ) - (if (< f0-9 0.0) - (set! f1-2 (- f1-2)) - ) + (if (< f1-2 0.0) (set! f1-2 (fmax f1-2 (* -0.15 f28-0)))) + (if (< f0-9 0.0) (set! f1-2 (- f1-2))) (let* ((f1-3 (+ f24-0 f1-2)) - (f1-5 (fmin (* 8192.0 (seconds-per-frame)) (fmax (* -8192.0 (seconds-per-frame)) f1-3))) - ) + (f1-5 (fmin (* 8192.0 (seconds-per-frame)) (fmax (* -8192.0 (seconds-per-frame)) f1-3)))) (cond - ((and (< 0.0 f1-5) (< 0.0 f0-9) (< (-> self max-angle-curr) f28-0)) - (set! f1-5 0.0) - ) - ((and (< 0.0 f1-5) (< 0.0 f0-9)) - (set! f1-5 (fmin f1-5 (* 0.15 (- (-> self max-angle-curr) f28-0)))) - ) - ((and (< f1-5 0.0) (< f0-9 0.0) (< (-> self max-angle-curr) f28-0)) - (set! f1-5 0.0) - ) - ((and (< f1-5 0.0) (< f0-9 0.0)) - (set! f1-5 (fmax f1-5 (* 0.15 (- f28-0 (-> self max-angle-curr))))) - ) - ) - (matrix-axis-angle! s2-0 (-> *camera* local-down) f1-5) - ) - ) - ) - (vector-matrix*! arg1 arg1 s2-0) - ) - (let ((f0-15 (vector-dot arg0 arg1))) - (set! f28-0 (acos f0-15)) - ) - ) + ((and (< 0.0 f1-5) (< 0.0 f0-9) (< (-> self max-angle-curr) f28-0)) (set! f1-5 0.0)) + ((and (< 0.0 f1-5) (< 0.0 f0-9)) (set! f1-5 (fmin f1-5 (* 0.15 (- (-> self max-angle-curr) f28-0))))) + ((and (< f1-5 0.0) (< f0-9 0.0) (< (-> self max-angle-curr) f28-0)) (set! f1-5 0.0)) + ((and (< f1-5 0.0) (< f0-9 0.0)) (set! f1-5 (fmax f1-5 (* 0.15 (- f28-0 (-> self max-angle-curr))))))) + (matrix-axis-angle! s2-0 (-> *camera* local-down) f1-5)))) + (vector-matrix*! arg1 arg1 s2-0)) + (let ((f0-15 (vector-dot arg0 arg1))) (set! f28-0 (acos f0-15)))) (cond ((< (-> self max-angle-curr) f28-0) - (matrix-from-two-vectors-max-angle! - s3-0 - arg1 - arg0 - (* (fmin 1.0 (* arg2 (-> *display* time-adjust-ratio))) (- f28-0 (-> self max-angle-curr))) - ) - (vector-matrix*! arg0 arg1 s3-0) - ) + (matrix-from-two-vectors-max-angle! s3-0 + arg1 + arg0 + (* (fmin 1.0 (* arg2 (-> *display* time-adjust-ratio))) (- f28-0 (-> self max-angle-curr)))) + (vector-matrix*! arg0 arg1 s3-0)) ((and (logtest? (-> self options) 2) (or (and (>= f26-0 (+ -8192.0 f30-0)) (>= f30-0 (+ -8192.0 (-> self pivot-rad)))) - (and (>= (+ 8192.0 f30-0) f26-0) (>= (+ 8192.0 (-> self pivot-rad)) f30-0)) - ) - ) + (and (>= (+ 8192.0 f30-0) f26-0) (>= (+ 8192.0 (-> self pivot-rad)) f30-0)))) (let ((s2-1 (new 'stack-no-clear 'vector))) (vector-cross! s2-1 arg1 arg0) (vector-normalize! s2-1 (the-as float 1.0)) - (matrix-axis-angle! - s3-0 - s2-1 - (* (fmin 1.0 (* arg2 (-> *display* time-adjust-ratio))) (- (-> self max-angle-curr) f28-0)) - ) - ) - (vector-matrix*! arg0 arg1 s3-0) - ) - (else - (set! (-> arg0 quad) (-> arg1 quad)) - (if (logtest? (-> self options) 2048) - (set! (-> self max-angle-curr) f28-0) - ) - ) - ) - ) - (vector-normalize! arg0 (-> self pivot-rad)) - ) + (matrix-axis-angle! s3-0 + s2-1 + (* (fmin 1.0 (* arg2 (-> *display* time-adjust-ratio))) (- (-> self max-angle-curr) f28-0)))) + (vector-matrix*! arg0 arg1 s3-0)) + (else (set! (-> arg0 quad) (-> arg1 quad)) (if (logtest? (-> self options) 2048) (set! (-> self max-angle-curr) f28-0))))) + (vector-normalize! arg0 (-> self pivot-rad))) (defbehavior cam-circular-position camera-slave ((arg0 symbol)) (let ((gp-0 (new 'stack-no-clear 'vector))) (let ((s5-0 (new 'stack-no-clear 'vector))) (if (logtest? (-> self options) 130) - (vector-! gp-0 (-> self circular-follow) (-> self pivot-pt)) - (vector-! gp-0 (-> self pivot-pt) (-> self circular-follow)) - ) + (vector-! gp-0 (-> self circular-follow) (-> self pivot-pt)) + (vector-! gp-0 (-> self pivot-pt) (-> self circular-follow))) (vector-! s5-0 (-> self trans) (-> self pivot-pt)) (when (not (logtest? (-> self options) 4)) (vector-flatten! gp-0 gp-0 (-> *camera* local-down)) - (vector-flatten! s5-0 s5-0 (-> *camera* local-down)) - ) + (vector-flatten! s5-0 s5-0 (-> *camera* local-down))) (cond ((logtest? (-> self options) 128) (let ((f0-1 (- (vector-length gp-0) (-> self pivot-rad)))) - (if (>= 0.0 f0-1) - (vector-reset! gp-0) - (vector-normalize! gp-0 f0-1) - ) - ) - ) + (if (>= 0.0 f0-1) (vector-reset! gp-0) (vector-normalize! gp-0 f0-1)))) ((not arg0) (set! (-> self max-angle-curr) (-> self max-angle-offset)) - (cam-circular-position-into-max-angle gp-0 s5-0 (the-as float 1.0)) - ) - (else - (cam-circular-position-into-max-angle gp-0 s5-0 (the-as float 0.05)) - ) - ) - ) - (vector+! (-> self trans) gp-0 (-> self pivot-pt)) - ) - ) + (cam-circular-position-into-max-angle gp-0 s5-0 (the-as float 1.0))) + (else (cam-circular-position-into-max-angle gp-0 s5-0 (the-as float 0.05))))) + (vector+! (-> self trans) gp-0 (-> self pivot-pt)))) (defbehavior cam-circular-code camera-slave () (set! (-> self pivot-pt quad) (-> self saved-pt quad)) @@ -1018,164 +635,107 @@ (vector-! a2-1 (-> *camera* tpos-curr-adj) (-> self pivot-pt)) (vector-! (-> self circular-follow) (-> self circular-follow) (-> self pivot-pt)) (if (logtest? (-> self options) 4) - (v-slrp3! - (-> self circular-follow) - (-> self circular-follow) - a2-1 - (the-as vector #f) - (* 182.04445 (-> *display* time-adjust-ratio)) - ) - (v-slrp3! - (-> self circular-follow) - (-> self circular-follow) - a2-1 - (-> *camera* local-down) - (* 182.04445 (-> *display* time-adjust-ratio)) - ) - ) - ) + (v-slrp3! (-> self circular-follow) + (-> self circular-follow) + a2-1 + (the-as vector #f) + (* 182.04445 (-> *display* time-adjust-ratio))) + (v-slrp3! (-> self circular-follow) + (-> self circular-follow) + a2-1 + (-> *camera* local-down) + (* 182.04445 (-> *display* time-adjust-ratio))))) (vector+! (-> self circular-follow) (-> self circular-follow) (-> self pivot-pt)) (cam-circular-position #t) (if (!= (-> self fov1) 0.0) - (set! (-> self fov) - (lerp-clamp - (-> self fov0) - (-> self fov1) - (parameter-ease-sin-clamp (cam-index-method-10 (-> self fov-index) (-> *camera* tpos-curr-adj))) - ) - ) - ) - ) + (set! (-> self fov) + (lerp-clamp (-> self fov0) + (-> self fov1) + (parameter-ease-sin-clamp (cam-index-method-10 (-> self fov-index) (-> *camera* tpos-curr-adj))))))) (defstate cam-circular (camera-slave) - :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (case message - (('teleport) - #f - ) - (('outro-done) - (set! (-> self trans quad) (-> *camera-combiner* trans quad)) - (cam-circular-position #f) - ) - (else - (cam-standard-event-handler proc argc message block) - ) - ) - ) - :enter (behavior () - (cond - ((-> self enter-has-run) - ) - (else - (let ((gp-0 (new-stack-vector0))) - (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) - (set! (-> self view-off-param) 1.0) - (set! (-> self circular-follow quad) (-> *camera* tpos-curr-adj quad)) - (set! (-> self max-angle-offset) 0.0) - (cond - ((-> self cam-entity) - (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) (-> self saved-pt) 'pivot) - (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) gp-0 'trans) - (set! (-> self pivot-rad) (vector-length (vector-! gp-0 gp-0 (-> self saved-pt)))) - (logior! (-> self options) (cam-slave-get-flags (-> self cam-entity) 'flags)) - (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) - (set! (-> self tracking tilt-adjust target) - (cam-slave-get-float (-> self cam-entity) 'tiltAdjust (-> *CAMERA-bank* default-tilt-adjust)) - ) - (set! (-> self max-angle-offset) (cam-slave-get-float (-> self cam-entity) 'maxAngle (the-as float 0.0))) - (if (< (-> self max-angle-offset) 0.0) - (set! (-> self max-angle-offset) 0.0) - ) - (set! (-> self fov1) (cam-slave-get-float (-> self cam-entity) 'focalPull (the-as float 0.0))) - (cond - ((and (!= (-> self fov1) 0.0) - (cam-index-method-9 (-> self fov-index) 'focalpull (-> self cam-entity) (-> self saved-pt) (the-as curve #f)) - ) - (set! (-> self fov0) (-> self fov)) - (set! (-> self fov) (lerp-clamp - (-> self fov0) - (-> self fov1) - (cam-index-method-10 (-> self fov-index) (-> *camera* tpos-curr-adj)) - ) - ) - ) - (else - (set! (-> self fov1) 0.0) - ) - ) - (cam-curve-setup (-> self saved-pt)) - (set! (-> self pivot-pt quad) (-> self saved-pt quad)) - (cam-curve-pos (-> self pivot-pt) (the-as vector #f) (the-as curve #f) #f) - ) - ((logtest? (-> self options) 128) - (vector-! (-> self pivot-pt) (-> *camera* tpos-curr-adj) (-> self trans)) - (vector-flatten! (-> self pivot-pt) (-> self pivot-pt) (-> *camera* local-down)) - (set! (-> self pivot-rad) (vector-length (-> self pivot-pt))) - (set! (-> self pivot-pt quad) (-> self trans quad)) - (set! (-> self saved-pt quad) (-> self pivot-pt quad)) - ) - (else + :event + (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('teleport) #f) + (('outro-done) (set! (-> self trans quad) (-> *camera-combiner* trans quad)) (cam-circular-position #f)) + (else (cam-standard-event-handler proc argc message block)))) + :enter + (behavior () + (cond + ((-> self enter-has-run)) + (else + (let ((gp-0 (new-stack-vector0))) + (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) + (set! (-> self view-off-param) 1.0) + (set! (-> self circular-follow quad) (-> *camera* tpos-curr-adj quad)) + (set! (-> self max-angle-offset) 0.0) + (cond + ((-> self cam-entity) + (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) (-> self saved-pt) 'pivot) + (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) gp-0 'trans) + (set! (-> self pivot-rad) (vector-length (vector-! gp-0 gp-0 (-> self saved-pt)))) + (logior! (-> self options) (cam-slave-get-flags (-> self cam-entity) 'flags)) + (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) + (set! (-> self tracking tilt-adjust target) + (cam-slave-get-float (-> self cam-entity) 'tiltAdjust (-> *CAMERA-bank* default-tilt-adjust))) + (set! (-> self max-angle-offset) (cam-slave-get-float (-> self cam-entity) 'maxAngle (the-as float 0.0))) + (if (< (-> self max-angle-offset) 0.0) (set! (-> self max-angle-offset) 0.0)) + (set! (-> self fov1) (cam-slave-get-float (-> self cam-entity) 'focalPull (the-as float 0.0))) + (cond + ((and (!= (-> self fov1) 0.0) + (cam-index-method-9 (-> self fov-index) 'focalpull (-> self cam-entity) (-> self saved-pt) (the-as curve #f))) + (set! (-> self fov0) (-> self fov)) + (set! (-> self fov) + (lerp-clamp (-> self fov0) (-> self fov1) (cam-index-method-10 (-> self fov-index) (-> *camera* tpos-curr-adj))))) + (else (set! (-> self fov1) 0.0))) + (cam-curve-setup (-> self saved-pt)) + (set! (-> self pivot-pt quad) (-> self saved-pt quad)) + (cam-curve-pos (-> self pivot-pt) (the-as vector #f) (the-as curve #f) #f)) + ((logtest? (-> self options) 128) + (vector-! (-> self pivot-pt) (-> *camera* tpos-curr-adj) (-> self trans)) + (vector-flatten! (-> self pivot-pt) (-> self pivot-pt) (-> *camera* local-down)) + (set! (-> self pivot-rad) (vector-length (-> self pivot-pt))) + (set! (-> self pivot-pt quad) (-> self trans quad)) + (set! (-> self saved-pt quad) (-> self pivot-pt quad))) + (else (vector-! (-> self pivot-pt) (-> *camera* tpos-curr-adj) (-> self trans)) (vector-float*! (-> self pivot-pt) (-> self pivot-pt) 0.5) (vector-flatten! (-> self pivot-pt) (-> self pivot-pt) (-> *camera* local-down)) (set! (-> self pivot-rad) (vector-length (-> self pivot-pt))) (vector+! (-> self pivot-pt) (-> self trans) (-> self pivot-pt)) - (set! (-> self saved-pt quad) (-> self pivot-pt quad)) - ) - ) - ) - (cam-circular-position #f) - (set! (-> self blend-from-type) (the-as uint 2)) - (set! (-> self blend-to-type) (the-as uint 2)) - ) - ) - (let ((gp-3 (new 'stack-no-clear 'vector))) - (if (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) gp-3 'interesting) - (send-event *camera* 'point-of-interest gp-3) - ) - ) - ) - :trans (behavior () - (if (not (logtest? (-> *camera* master-options) 2)) - (cam-slave-go cam-free-floating) - ) - ) - :code (behavior () - (loop - (if (not (paused?)) - (cam-circular-code) - ) - (suspend) - ) - ) - ) + (set! (-> self saved-pt quad) (-> self pivot-pt quad))))) + (cam-circular-position #f) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (the-as uint 2)))) + (let ((gp-3 (new 'stack-no-clear 'vector))) + (if (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) gp-3 'interesting) + (send-event *camera* 'point-of-interest gp-3)))) + :trans + (behavior () + (if (not (logtest? (-> *camera* master-options) 2)) (cam-slave-go cam-free-floating))) + :code + (behavior () + (loop (if (not (paused?)) (cam-circular-code)) + (suspend)))) (defstate cam-lookat (camera-slave) :event cam-standard-event-handler - :enter (behavior () - (when (not (-> self enter-has-run)) - (set! (-> self blend-from-type) (the-as uint 2)) - (set! (-> self blend-to-type) (the-as uint 2)) - ) - ) - :trans (behavior () - (if (not (logtest? (-> *camera* master-options) 2)) - (cam-slave-go cam-free-floating) - ) - ) - :code (behavior () - (loop - (suspend) - ) - ) - ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (the-as uint 2)))) + :trans + (behavior () + (if (not (logtest? (-> *camera* master-options) 2)) (cam-slave-go cam-free-floating))) + :code + (behavior () + (loop (suspend)))) (deftype cam-string-bank (basic) - ((los-coll-rad meters) - (los-coll-rad2 meters) - ) - ) - + ((los-coll-rad meters) + (los-coll-rad2 meters))) (define *CAM_STRING-bank* (new 'static 'cam-string-bank :los-coll-rad (meters 1) :los-coll-rad2 (meters 0.5))) @@ -1184,51 +744,35 @@ (s4-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'collide-tri-result)) (f30-0 0.0) - (s2-0 (new 'stack-no-clear 'matrix)) - ) + (s2-0 (new 'stack-no-clear 'matrix))) (vector-flatten! s5-0 (-> *camera-combiner* inv-camera-rot vector 2) (-> *camera* local-down)) (if (= (vector-normalize-ret-len! s5-0 (- (+ 1024.0 (-> *CAMERA-bank* default-string-min-z)))) 0.0) - (set! (-> s5-0 z) (+ 1024.0 (-> *CAMERA-bank* default-string-min-z))) - ) + (set! (-> s5-0 z) (+ 1024.0 (-> *CAMERA-bank* default-string-min-z)))) (vector--float*! s5-0 s5-0 (-> *camera* local-down) (-> *CAMERA-bank* default-string-min-y)) (set! (-> arg0 quad) (-> s5-0 quad)) - (loop - (vector--float*! s4-0 arg0 (-> *camera* local-down) (-> *camera* target-height)) - (if (< (fill-and-probe-using-line-sphere - *collide-cache* - (-> *camera* tpos-curr-adj) - arg0 - (the-as float 409.6) - (collide-kind background cak-3 wall-object ground-object cak-14) - (the-as process #f) - s3-0 - (new 'static 'pat-surface :nocamera #x1) - ) - 0.0 - ) - (return #t) - ) - (set! f30-0 (cond - ((>= -32768.0 f30-0) - (format #t "cam-string didn't find a spot~%") - (set! (-> arg0 quad) (-> s5-0 quad)) - (return #f) - f30-0 - ) - ((< 0.0 f30-0) - (- f30-0) - ) - (else - (- 5461.3335 f30-0) - ) - ) - ) + (loop (vector--float*! s4-0 arg0 (-> *camera* local-down) (-> *camera* target-height)) + (if (< (fill-and-probe-using-line-sphere *collide-cache* + (-> *camera* tpos-curr-adj) + arg0 + (the-as float 409.6) + (collide-kind background cak-3 wall-object ground-object cak-14) + (the-as process #f) + s3-0 + (new 'static 'pat-surface :nocamera #x1)) + 0.0) + (return #t)) + (set! f30-0 + (cond + ((>= -32768.0 f30-0) + (format #t "cam-string didn't find a spot~%") + (set! (-> arg0 quad) (-> s5-0 quad)) + (return #f) + f30-0) + ((< 0.0 f30-0) (- f30-0)) + (else (- 5461.3335 f30-0)))) (matrix-axis-angle! s2-0 (-> *camera* local-down) f30-0) - (vector-matrix*! arg0 s5-0 s2-0) - ) - ) - (the-as symbol #f) - ) + (vector-matrix*! arg0 s5-0 s2-0))) + (the-as symbol #f)) (defbehavior cam-string-set-position-rel! camera-slave ((arg0 vector)) (vector-flatten! (-> self view-flat) arg0 (-> *camera* local-down)) @@ -1237,175 +781,112 @@ (set! (-> self string-trans quad) (-> self desired-pos quad)) (tracking-spline-method-10 (-> self position-spline) (-> self desired-pos)) (vector-reset! (-> self velocity)) - (let ((v0-3 (logand -4097 (-> self options)))) - (set! (-> self options) v0-3) - (the-as int v0-3) - ) - ) + (let ((v0-3 (logand -4097 (-> self options)))) (set! (-> self options) v0-3) (the-as int v0-3))) (defun string-push-help () - (the-as float 409.6) - ) + (the-as float 409.6)) (defun-debug cam-draw-collide-cache ((arg0 collide-cache)) (let ((gp-0 (-> arg0 tris))) (countdown (s5-0 (-> arg0 num-tris)) (let ((t1-0 #x40000080)) - (add-debug-flat-triangle - #t - (bucket-id debug-no-zbuf) - (the-as vector (-> gp-0 0)) - (-> gp-0 0 vertex 1) - (-> gp-0 0 vertex 2) - (the-as rgba t1-0) - ) - ) - (set! gp-0 (the-as (inline-array collide-cache-tri) (-> gp-0 1))) - ) - ) + (add-debug-flat-triangle #t + (bucket-id debug-no-zbuf) + (the-as vector (-> gp-0 0)) + (-> gp-0 0 vertex 1) + (-> gp-0 0 vertex 2) + (the-as rgba t1-0))) + (set! gp-0 (the-as (inline-array collide-cache-tri) (-> gp-0 1))))) 0 - (none) - ) + (none)) (deftype los-dist (structure) - ((par-dist float) - (lat-dist float) - (vert-dist float) - ) - ) - + ((par-dist float) + (lat-dist float) + (vert-dist float))) (deftype collide-los-dist-info (structure) - ((min-par float) - (max-par float) - (min-lat float) - (max-lat float) - (min-vp float) - (max-vp float) - (min-vn float) - (max-vn float) - (count int32) - ) - ) - + ((min-par float) + (max-par float) + (min-lat float) + (max-lat float) + (min-vp float) + (max-vp float) + (min-vn float) + (max-vn float) + (count int32))) (defun dist-info-init ((arg0 collide-los-dist-info)) (set! (-> arg0 min-par) 1.0) (set! (-> arg0 max-par) 0.0) (set! (-> arg0 count) 0) 0 - (none) - ) + (none)) (defun dist-info-valid? ((arg0 collide-los-dist-info)) - (>= (-> arg0 max-par) (-> arg0 min-par)) - ) + (>= (-> arg0 max-par) (-> arg0 min-par))) (defun dist-info-append ((arg0 collide-los-dist-info) (arg1 vector)) (cond ((dist-info-valid? arg0) - (if (< (-> arg1 x) (-> arg0 min-par)) - (set! (-> arg0 min-par) (-> arg1 x)) - ) - (if (< (-> arg0 max-par) (-> arg1 x)) - (set! (-> arg0 max-par) (-> arg1 x)) - ) - (if (< (-> arg1 y) (-> arg0 min-lat)) - (set! (-> arg0 min-lat) (-> arg1 y)) - ) - (if (< (-> arg0 max-lat) (-> arg1 y)) - (set! (-> arg0 max-lat) (-> arg1 y)) - ) + (if (< (-> arg1 x) (-> arg0 min-par)) (set! (-> arg0 min-par) (-> arg1 x))) + (if (< (-> arg0 max-par) (-> arg1 x)) (set! (-> arg0 max-par) (-> arg1 x))) + (if (< (-> arg1 y) (-> arg0 min-lat)) (set! (-> arg0 min-lat) (-> arg1 y))) + (if (< (-> arg0 max-lat) (-> arg1 y)) (set! (-> arg0 max-lat) (-> arg1 y))) (cond ((< (-> arg1 y) 0.0) - (if (< (-> arg1 z) (-> arg0 min-vn)) - (set! (-> arg0 min-vn) (-> arg1 z)) - ) - (if (< (-> arg0 max-vn) (-> arg1 z)) - (set! (-> arg0 max-vn) (-> arg1 z)) - ) - ) + (if (< (-> arg1 z) (-> arg0 min-vn)) (set! (-> arg0 min-vn) (-> arg1 z))) + (if (< (-> arg0 max-vn) (-> arg1 z)) (set! (-> arg0 max-vn) (-> arg1 z)))) (else - (if (< (-> arg1 z) (-> arg0 min-vp)) - (set! (-> arg0 min-vp) (-> arg1 z)) - ) - (if (< (-> arg0 max-vp) (-> arg1 z)) - (set! (-> arg0 max-vp) (-> arg1 z)) - ) - ) - ) - ) + (if (< (-> arg1 z) (-> arg0 min-vp)) (set! (-> arg0 min-vp) (-> arg1 z))) + (if (< (-> arg0 max-vp) (-> arg1 z)) (set! (-> arg0 max-vp) (-> arg1 z)))))) (else - (set! (-> arg0 min-par) (-> arg1 x)) - (set! (-> arg0 max-par) (-> arg1 x)) - (set! (-> arg0 min-lat) (-> arg1 y)) - (set! (-> arg0 max-lat) (-> arg1 y)) - (set! (-> arg0 min-vp) 0.0) - (set! (-> arg0 max-vp) 0.0) - (set! (-> arg0 min-vn) 0.0) - (set! (-> arg0 max-vn) 0.0) - (cond - ((< (-> arg1 y) 0.0) - (set! (-> arg0 min-vn) (-> arg1 z)) - (set! (-> arg0 max-vn) (-> arg1 z)) - ) - (else - (set! (-> arg0 min-vp) (-> arg1 z)) - (set! (-> arg0 max-vp) (-> arg1 z)) - ) - ) - ) - ) + (set! (-> arg0 min-par) (-> arg1 x)) + (set! (-> arg0 max-par) (-> arg1 x)) + (set! (-> arg0 min-lat) (-> arg1 y)) + (set! (-> arg0 max-lat) (-> arg1 y)) + (set! (-> arg0 min-vp) 0.0) + (set! (-> arg0 max-vp) 0.0) + (set! (-> arg0 min-vn) 0.0) + (set! (-> arg0 max-vn) 0.0) + (cond + ((< (-> arg1 y) 0.0) (set! (-> arg0 min-vn) (-> arg1 z)) (set! (-> arg0 max-vn) (-> arg1 z))) + (else (set! (-> arg0 min-vp) (-> arg1 z)) (set! (-> arg0 max-vp) (-> arg1 z)))))) (+! (-> arg0 count) 1) - (none) - ) + (none)) (defun dist-info-print ((arg0 collide-los-dist-info) (arg1 string)) (cond ((dist-info-valid? arg0) - (format - *stdcon* - "~S ~2,D mn ~,,2M mx ~,,2M mnl ~,,2M mxl ~,,2M~%" - arg1 - (-> arg0 count) - (-> arg0 min-par) - (-> arg0 max-par) - (-> arg0 min-lat) - (-> arg0 max-lat) - ) - (format - *stdcon* - " mnvp ~,,2M mxvp ~,,2M mnvn ~,,2M mxvn ~,,2M~%" - (-> arg0 min-vp) - (-> arg0 max-vp) - (-> arg0 min-vn) - (-> arg0 max-vn) - ) - ) - (else - (format *stdcon* "~S invalid~%" arg1) - ) - ) - ) + (format *stdcon* + "~S ~2,D mn ~,,2M mx ~,,2M mnl ~,,2M mxl ~,,2M~%" + arg1 + (-> arg0 count) + (-> arg0 min-par) + (-> arg0 max-par) + (-> arg0 min-lat) + (-> arg0 max-lat)) + (format *stdcon* + " mnvp ~,,2M mxvp ~,,2M mnvn ~,,2M mxvn ~,,2M~%" + (-> arg0 min-vp) + (-> arg0 max-vp) + (-> arg0 min-vn) + (-> arg0 max-vn))) + (else (format *stdcon* "~S invalid~%" arg1)))) (deftype collide-los-result (structure) - ((lateral vector :inline) - (cw collide-los-dist-info :inline) - (ccw collide-los-dist-info :inline) - (straddle collide-los-dist-info :inline) - (lateral-valid symbol) - ) - ) + ((lateral vector :inline) + (cw collide-los-dist-info :inline) + (ccw collide-los-dist-info :inline) + (straddle collide-los-dist-info :inline) + (lateral-valid symbol))) - -(defun los-cw-ccw ((arg0 (inline-array collide-cache-tri)) - (arg1 vector) - (arg2 vector) - (arg3 float) - (arg4 clip-travel-vector-to-mesh-return-info) - (arg5 vector) - (arg6 float) - ) +(defun los-cw-ccw ((arg0 (inline-array collide-cache-tri)) (arg1 vector) + (arg2 vector) + (arg3 float) + (arg4 clip-travel-vector-to-mesh-return-info) + (arg5 vector) + (arg6 float)) (local-vars (sv-128 float) (sv-144 vector) (sv-160 vector) (sv-176 vector) (sv-192 vector) (sv-208 int)) (with-pp (set! sv-128 arg3) @@ -1417,303 +898,162 @@ (let ((s5-0 (new 'stack-no-clear 'matrix))) (set! sv-192 (new 'stack-no-clear 'vector)) (let ((f30-0 0.0) - (s0-0 #f) - ) + (s0-0 #f)) (set! sv-208 0) (while (< sv-208 4) (cond - ((= sv-208 3) - (vector-! sv-160 sv-144 (the-as vector (&-> pp stack 368))) - (set! (-> s5-0 vector sv-208 z) 0.0) - ) + ((= sv-208 3) (vector-! sv-160 sv-144 (the-as vector (&-> pp stack 368))) (set! (-> s5-0 vector sv-208 z) 0.0)) (else - (vector-! sv-160 sv-144 (-> arg0 0 vertex sv-208)) - (set! (-> s5-0 vector sv-208 z) (vector-dot sv-160 (-> *camera* local-down))) - (vector-! sv-160 (-> arg0 0 vertex sv-208) (the-as vector (&-> pp stack 368))) - ) - ) + (vector-! sv-160 sv-144 (-> arg0 0 vertex sv-208)) + (set! (-> s5-0 vector sv-208 z) (vector-dot sv-160 (-> *camera* local-down))) + (vector-! sv-160 (-> arg0 0 vertex sv-208) (the-as vector (&-> pp stack 368))))) (vector-flatten! sv-160 sv-160 (-> *camera* local-down)) (vector-cross! sv-176 sv-160 arg2) (let ((f28-0 (vector-dot sv-176 (-> *camera* local-down)))) (cond - ((< (* f28-0 f30-0) 0.0) - (set! s0-0 #t) - ) - ((!= f28-0 0.0) - (set! f30-0 f28-0) - ) - ) + ((< (* f28-0 f30-0) 0.0) (set! s0-0 #t)) + ((!= f28-0 0.0) (set! f30-0 f28-0))) (set! (-> s5-0 vector sv-208 x) (vector-dot sv-160 arg2)) (cond - ((= sv-208 3) - (vector-! sv-192 sv-144 (the-as vector (&-> pp stack 368))) - (vector-flatten! sv-192 sv-192 arg1) - ) - (else - (vector--float*! sv-192 sv-160 arg2 (-> s5-0 vector sv-208 x)) - ) - ) + ((= sv-208 3) (vector-! sv-192 sv-144 (the-as vector (&-> pp stack 368))) (vector-flatten! sv-192 sv-192 arg1)) + (else (vector--float*! sv-192 sv-160 arg2 (-> s5-0 vector sv-208 x)))) (if (< f28-0 0.0) - (set! (-> s5-0 vector sv-208 y) (- (vector-length sv-192))) - (set! (-> s5-0 vector sv-208 y) (vector-length sv-192)) - ) - ) + (set! (-> s5-0 vector sv-208 y) (- (vector-length sv-192))) + (set! (-> s5-0 vector sv-208 y) (vector-length sv-192)))) (set! (-> s5-0 vector sv-208 x) (- sv-128 (-> s5-0 vector sv-208 x))) - (set! sv-208 (+ sv-208 1)) - ) + (set! sv-208 (+ sv-208 1))) (cond ((and s0-0 (!= s4-0 -100000000.0)) (dotimes (s4-1 4) - (dist-info-append - (the-as collide-los-dist-info (-> gp-0 vert-0)) - (the-as vector (+ (the-as uint s5-0) (* s4-1 16))) - ) - ) - #f - ) + (dist-info-append (the-as collide-los-dist-info (-> gp-0 vert-0)) (the-as vector (+ (the-as uint s5-0) (* s4-1 16))))) + #f) ((< (-> s5-0 vector 3 y) 0.0) (dotimes (s4-2 4) (when (>= (-> s5-0 vector 3 y) (-> s5-0 vector s4-2 y)) (set! (-> s5-0 vector s4-2 y) (- (-> s5-0 vector s4-2 y))) - (dist-info-append - (the-as collide-los-dist-info (-> gp-0 next-normal)) - (the-as vector (+ (the-as uint s5-0) (* s4-2 16))) - ) - ) - ) - #f - ) + (dist-info-append (the-as collide-los-dist-info (-> gp-0 next-normal)) + (the-as vector (+ (the-as uint s5-0) (* s4-2 16)))))) + #f) (else - (dotimes (s4-3 4) - (if (>= (-> s5-0 vector s4-3 y) (-> s5-0 vector 3 y)) - (dist-info-append - (the-as collide-los-dist-info (-> gp-0 intersection)) - (the-as vector (+ (the-as uint s5-0) (* s4-3 16))) - ) - ) - ) - #f - ) - ) - ) - ) - ) - ) - ) - ) + (dotimes (s4-3 4) + (if (>= (-> s5-0 vector s4-3 y) (-> s5-0 vector 3 y)) + (dist-info-append (the-as collide-los-dist-info (-> gp-0 intersection)) + (the-as vector (+ (the-as uint s5-0) (* s4-3 16)))))) + #f)))))))) (defun cam-los-spline-collide ((arg0 vector) (arg1 vector) (arg2 pat-surface)) (let ((s5-0 (new 'stack-no-clear 'vector)) (s4-0 *collide-cache*) - (f30-0 2.0) - ) + (f30-0 2.0)) 0.0 (vector-! s5-0 arg1 arg0) - (fill-using-line-sphere - s4-0 - arg0 - s5-0 - (-> *CAM_STRING-bank* los-coll-rad2) - (collide-kind background cak-3 wall-object ground-object cak-14) - (the-as process-drawable #f) - arg2 - ) + (fill-using-line-sphere s4-0 + arg0 + s5-0 + (-> *CAM_STRING-bank* los-coll-rad2) + (collide-kind background cak-3 wall-object ground-object cak-14) + (the-as process-drawable #f) + arg2) (let* ((f0-2 (vector-length s5-0)) - (f28-0 - (cond - ((< f0-2 (-> *CAMERA-bank* min-detectable-velocity)) - 0.0 - ) - (else - (let* ((f0-3 (/ (* 3.0 (- (-> *CAM_STRING-bank* los-coll-rad2) (-> *CAMERA-bank* collide-move-rad))) f0-2)) - (f0-4 (- 1.0 f0-3)) - ) - (fmin 1.0 (fmax 0.0 f0-4)) - ) - ) - ) - ) + (f28-0 (cond + ((< f0-2 (-> *CAMERA-bank* min-detectable-velocity)) 0.0) + (else + (let* ((f0-3 (/ (* 3.0 (- (-> *CAM_STRING-bank* los-coll-rad2) (-> *CAMERA-bank* collide-move-rad))) f0-2)) + (f0-4 (- 1.0 f0-3))) + (fmin 1.0 (fmax 0.0 f0-4)))))) (s3-0 (-> s4-0 tris)) (s2-0 (new 'stack-no-clear 'vector)) - (s1-0 (new 'stack-no-clear 'vector)) - ) + (s1-0 (new 'stack-no-clear 'vector))) (countdown (s4-1 (-> s4-0 num-tris)) - (let ((f0-7 (moving-sphere-triangle-intersect arg0 s5-0 (-> *CAM_STRING-bank* los-coll-rad2) (-> s3-0 0) s2-0 s1-0)) - ) + (let ((f0-7 (moving-sphere-triangle-intersect arg0 s5-0 (-> *CAM_STRING-bank* los-coll-rad2) (-> s3-0 0) s2-0 s1-0))) (cond - ((or (< f0-7 0.0) (< f28-0 f0-7)) - ) - ((< f0-7 f30-0) - (set! f30-0 f0-7) - ) - ) - ) - (set! s3-0 (the-as (inline-array collide-cache-tri) (-> s3-0 1))) - ) - ) - (if (= f30-0 2.0) - (set! f30-0 -1.0) - ) - f30-0 - ) - ) + ((or (< f0-7 0.0) (< f28-0 f0-7))) + ((< f0-7 f30-0) (set! f30-0 f0-7)))) + (set! s3-0 (the-as (inline-array collide-cache-tri) (-> s3-0 1))))) + (if (= f30-0 2.0) (set! f30-0 -1.0)) + f30-0)) (defbehavior cam-los-setup-lateral camera-slave ((arg0 clip-travel-vector-to-mesh-return-info) (arg1 vector) (arg2 vector)) (cond ((dist-info-valid? (the-as collide-los-dist-info (-> arg0 vert-0))) (let ((f30-0 (-> arg0 vert-0 z)) - (f28-0 (-> arg0 vert-0 w)) - ) + (f28-0 (-> arg0 vert-0 w))) (if (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection))) - (set! f28-0 (fmax f28-0 (-> arg0 intersection w))) - ) + (set! f28-0 (fmax f28-0 (-> arg0 intersection w)))) (if (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))) - (set! f30-0 (fmin f30-0 (- (-> arg0 next-normal w)))) - ) + (set! f30-0 (fmin f30-0 (- (-> arg0 next-normal w))))) (cond ((= (-> self los-state) (slave-los-state ccw)) - (if *display-cam-los-debug* - (format *stdcon* "straddle stick ccw~%") - ) - (vector-normalize! arg1 (+ f28-0 (-> *CAM_STRING-bank* los-coll-rad))) - ) + (if *display-cam-los-debug* (format *stdcon* "straddle stick ccw~%")) + (vector-normalize! arg1 (+ f28-0 (-> *CAM_STRING-bank* los-coll-rad)))) ((= (-> self los-state) (slave-los-state cw)) - (if *display-cam-los-debug* - (format *stdcon* "straddle stick cw~%") - ) - (vector-normalize! arg1 (- f30-0 (-> *CAM_STRING-bank* los-coll-rad))) - ) + (if *display-cam-los-debug* (format *stdcon* "straddle stick cw~%")) + (vector-normalize! arg1 (- f30-0 (-> *CAM_STRING-bank* los-coll-rad)))) ((and (or (< 0.01 (-> arg0 vert-1 y)) - (and (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))) - (< 0.01 (the-as float (-> arg0 gap-poly))) - ) - ) + (and (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))) (< 0.01 (the-as float (-> arg0 gap-poly))))) (or (< (-> arg0 vert-1 x) -0.01) - (and (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))) - (< (the-as float (-> arg0 poly)) -0.01) - ) - ) + (and (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))) (< (the-as float (-> arg0 poly)) -0.01))) (and (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection))) - (or (< (-> arg0 boundary-normal y) 0.01) (< -0.01 (-> arg0 boundary-normal x))) - ) - ) - (when (not (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal)))) - ) - (if (not (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection)))) - (format #t "s diag ccw invalid cw~%") - ) - (if *display-cam-los-debug* - (format *stdcon* "straddle diagonal ccw~%") - ) + (or (< (-> arg0 boundary-normal y) 0.01) (< -0.01 (-> arg0 boundary-normal x))))) + (when (not (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))))) + (if (not (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection)))) (format #t "s diag ccw invalid cw~%")) + (if *display-cam-los-debug* (format *stdcon* "straddle diagonal ccw~%")) (set! (-> self los-state) (slave-los-state ccw)) - (vector-normalize! arg1 (+ f28-0 (-> *CAM_STRING-bank* los-coll-rad))) - ) + (vector-normalize! arg1 (+ f28-0 (-> *CAM_STRING-bank* los-coll-rad)))) ((and (or (< 0.01 (-> arg0 vert-1 w)) - (and (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection))) - (< 0.01 (-> arg0 boundary-normal y)) - ) - ) + (and (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection))) (< 0.01 (-> arg0 boundary-normal y)))) (or (< (-> arg0 vert-1 z) -0.01) - (and (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection))) - (< (-> arg0 boundary-normal x) -0.01) - ) - ) + (and (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection))) (< (-> arg0 boundary-normal x) -0.01))) (and (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))) - (or (< (the-as float (-> arg0 gap-poly)) 0.01) (< -0.01 (the-as float (-> arg0 poly)))) - ) - ) - (if (not (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal)))) - (format #t "s diag cw invalid ccw~%") - ) - (when (not (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection)))) - ) - (if *display-cam-los-debug* - (format *stdcon* "straddle diagonal cw~%") - ) + (or (< (the-as float (-> arg0 gap-poly)) 0.01) (< -0.01 (the-as float (-> arg0 poly)))))) + (if (not (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal)))) (format #t "s diag cw invalid ccw~%")) + (when (not (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection))))) + (if *display-cam-los-debug* (format *stdcon* "straddle diagonal cw~%")) (set! (-> self los-state) (slave-los-state cw)) - (vector-normalize! arg1 (- f30-0 (-> *CAM_STRING-bank* los-coll-rad))) - ) + (vector-normalize! arg1 (- f30-0 (-> *CAM_STRING-bank* los-coll-rad)))) ((< f28-0 (- f30-0)) - (if *display-cam-los-debug* - (format *stdcon* "straddle ccw~%") - ) + (if *display-cam-los-debug* (format *stdcon* "straddle ccw~%")) (set! (-> self los-state) (slave-los-state ccw)) - (vector-normalize! arg1 (+ f28-0 (-> *CAM_STRING-bank* los-coll-rad))) - ) + (vector-normalize! arg1 (+ f28-0 (-> *CAM_STRING-bank* los-coll-rad)))) (else - (if *display-cam-los-debug* - (format *stdcon* "straddle cw~%") - ) - (set! (-> self los-state) (slave-los-state cw)) - (vector-normalize! arg1 (- f30-0 (-> *CAM_STRING-bank* los-coll-rad))) - ) - ) - ) - ) + (if *display-cam-los-debug* (format *stdcon* "straddle cw~%")) + (set! (-> self los-state) (slave-los-state cw)) + (vector-normalize! arg1 (- f30-0 (-> *CAM_STRING-bank* los-coll-rad))))))) ((and (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection))) (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))) (< 0.01 (the-as float (-> arg0 gap-poly))) (< (the-as float (-> arg0 poly)) -0.01) - (or (< (-> arg0 boundary-normal y) 0.01) (< -0.01 (-> arg0 boundary-normal x))) - ) - (if *display-cam-los-debug* - (format *stdcon* "diagonal ccw~%") - ) + (or (< (-> arg0 boundary-normal y) 0.01) (< -0.01 (-> arg0 boundary-normal x)))) + (if *display-cam-los-debug* (format *stdcon* "diagonal ccw~%")) (set! (-> self los-state) (slave-los-state ccw)) - (vector-normalize! arg1 (- (-> *CAM_STRING-bank* los-coll-rad) (-> arg0 next-normal z))) - ) + (vector-normalize! arg1 (- (-> *CAM_STRING-bank* los-coll-rad) (-> arg0 next-normal z)))) ((and (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection))) (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))) (< 0.01 (-> arg0 boundary-normal y)) (< (-> arg0 boundary-normal x) -0.01) - (or (< (the-as float (-> arg0 gap-poly)) 0.01) (< -0.01 (the-as float (-> arg0 poly)))) - ) - (if *display-cam-los-debug* - (format *stdcon* "diagonal cw~%") - ) + (or (< (the-as float (-> arg0 gap-poly)) 0.01) (< -0.01 (the-as float (-> arg0 poly))))) + (if *display-cam-los-debug* (format *stdcon* "diagonal cw~%")) (set! (-> self los-state) (slave-los-state cw)) - (vector-normalize! arg1 (- (-> arg0 intersection z) (-> *CAM_STRING-bank* los-coll-rad))) - ) + (vector-normalize! arg1 (- (-> arg0 intersection z) (-> *CAM_STRING-bank* los-coll-rad)))) ((and (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection))) - (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))) - ) + (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal)))) (set! (-> self los-state) (slave-los-state between)) - (vector-normalize! arg1 (the-as float 0.0001)) - ) + (vector-normalize! arg1 (the-as float 0.0001))) ((dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection))) - (if *display-cam-los-debug* - (format *stdcon* "regular cw~%") - ) + (if *display-cam-los-debug* (format *stdcon* "regular cw~%")) (set! (-> self los-state) (slave-los-state cw)) - (vector-normalize! arg1 (- (-> arg0 intersection z) (-> *CAM_STRING-bank* los-coll-rad))) - ) + (vector-normalize! arg1 (- (-> arg0 intersection z) (-> *CAM_STRING-bank* los-coll-rad)))) ((dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))) - (if *display-cam-los-debug* - (format *stdcon* "regular ccw~%") - ) + (if *display-cam-los-debug* (format *stdcon* "regular ccw~%")) (set! (-> self los-state) (slave-los-state ccw)) - (vector-normalize! arg1 (- (-> *CAM_STRING-bank* los-coll-rad) (-> arg0 next-normal z))) - ) - (else - (set! (-> self los-state) (slave-los-state none)) - (vector-reset! arg1) - ) - ) + (vector-normalize! arg1 (- (-> *CAM_STRING-bank* los-coll-rad) (-> arg0 next-normal z)))) + (else (set! (-> self los-state) (slave-los-state none)) (vector-reset! arg1))) (cond - ((= (vector-length arg1) 0.0) - (set! (-> arg0 vert-next y) (the-as float #f)) - #f - ) + ((= (vector-length arg1) 0.0) (set! (-> arg0 vert-next y) (the-as float #f)) #f) (else - (vector-! (the-as vector (&-> arg0 found-boundary)) arg1 arg2) - (vector-normalize! (the-as vector (&-> arg0 found-boundary)) (the-as float 1.0)) - (let ((v0-45 #t)) - (set! (-> arg0 vert-next y) (the-as float v0-45)) - v0-45 - ) - ) - ) - ) + (vector-! (the-as vector (&-> arg0 found-boundary)) arg1 arg2) + (vector-normalize! (the-as vector (&-> arg0 found-boundary)) (the-as float 1.0)) + (let ((v0-45 #t)) (set! (-> arg0 vert-next y) (the-as float v0-45)) v0-45)))) ;; ERROR: Unsupported inline assembly instruction kind - [mula.s f2, f5] ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f3, f6] @@ -1724,43 +1064,30 @@ (dist-info-init (the-as collide-los-dist-info (-> arg2 next-normal))) (dist-info-init (the-as collide-los-dist-info (-> arg2 vert-0))) (let ((s4-0 (new 'stack-no-clear 'vector)) - (s2-0 (new 'stack-no-clear 'vector)) - ) + (s2-0 (new 'stack-no-clear 'vector))) (vector-normalize-copy! s2-0 arg1 (the-as float 1.0)) (vector-flatten! s4-0 arg1 (-> *camera* local-down)) (let ((s0-0 *collide-cache*) (f26-0 (vector-length arg1)) - (f30-0 (vector-normalize-ret-len! s4-0 (the-as float 1.0))) - ) - (fill-using-line-sphere - s0-0 - arg0 - arg1 - (-> *CAM_STRING-bank* los-coll-rad) - (collide-kind background cak-3 wall-object ground-object cak-14) - (the-as process-drawable #f) - arg3 - ) + (f30-0 (vector-normalize-ret-len! s4-0 (the-as float 1.0)))) + (fill-using-line-sphere s0-0 + arg0 + arg1 + (-> *CAM_STRING-bank* los-coll-rad) + (collide-kind background cak-3 wall-object ground-object cak-14) + (the-as process-drawable #f) + arg3) (let ((s1-1 (-> s0-0 tris)) (f28-0 (/ 2048.0 f26-0)) - (f26-1 (/ (+ -8192.0 f26-0) f26-0)) - ) - (if (< f26-1 0.0) - (set! f26-1 0.0) - ) - (if (< 1.0 f28-0) - (set! f28-0 1.0) - ) + (f26-1 (/ (+ -8192.0 f26-0) f26-0))) + (if (< f26-1 0.0) (set! f26-1 0.0)) + (if (< 1.0 f28-0) (set! f28-0 1.0)) (countdown (s0-1 (-> s0-0 num-tris)) (set! sv-240 (new 'stack-no-clear 'vector)) (set! sv-224 (new 'stack-no-clear 'vector)) - (let ((f0-7 - (moving-sphere-triangle-intersect arg0 arg1 (-> *CAM_STRING-bank* los-coll-rad) (-> s1-1 0) sv-240 sv-224) - ) - ) + (let ((f0-7 (moving-sphere-triangle-intersect arg0 arg1 (-> *CAM_STRING-bank* los-coll-rad) (-> s1-1 0) sv-240 sv-224))) (cond - ((or (< f0-7 0.0) (< 1.0 f0-7)) - ) + ((or (< f0-7 0.0) (< 1.0 f0-7))) ((let ((f1-2 0.0)) (let* ((v1-21 arg1) (f2-0 (-> v1-21 x)) @@ -1768,329 +1095,177 @@ (f4-0 (-> v1-21 z)) (f5-0 (-> sv-224 x)) (f6-0 (-> sv-224 y)) - (f7-0 (-> sv-224 z)) - ) + (f7-0 (-> sv-224 z))) ;; og:preserve-this inlined vector-dot ; (.mula.s f2-0 f5-0) ; (.madda.s f3-0 f6-0) ; (.madd.s f2-1 f4-0 f7-0) - (set! f2-1 (+ (* f2-0 f5-0) (* f3-0 f6-0) (* f4-0 f7-0))) - ) - (< f1-2 f2-1) - ) + (set! f2-1 (+ (* f2-0 f5-0) (* f3-0 f6-0) (* f4-0 f7-0)))) + (< f1-2 f2-1)) (when (< f28-0 f0-7) (let* ((t1-2 (new 'stack-no-clear 'vector)) (t0-2 (new 'stack-no-clear 'vector)) - (f24-0 - (moving-sphere-triangle-intersect arg0 arg1 (-> *CAM_STRING-bank* los-coll-rad2) (-> s1-1 0) t0-2 t1-2) - ) - ) + (f24-0 (moving-sphere-triangle-intersect arg0 arg1 (-> *CAM_STRING-bank* los-coll-rad2) (-> s1-1 0) t0-2 t1-2))) (los-cw-ccw s1-1 s2-0 s4-0 f30-0 arg2 sv-240 f24-0) (when *debug-segment* (cond ((= f24-0 -100000000.0) (let ((t9-11 cam-debug-add-los-tri) (a0-13 s1-1) - (a2-7 (new 'static 'vector :x (the-as float #x80) :w (the-as float #x80))) - ) - (t9-11 a0-13 sv-240 a2-7) - ) - ) + (a2-7 (new 'static 'vector :x (the-as float #x80) :w (the-as float #x80)))) + (t9-11 a0-13 sv-240 a2-7))) (else - (cam-debug-add-los-tri - s1-1 - sv-240 - (new 'static 'vector :x (the-as float #x80) :y (the-as float #x80) :w (the-as float #x80)) - ) - ) - ) - ) - ) - ) - ) + (cam-debug-add-los-tri s1-1 + sv-240 + (new 'static 'vector :x (the-as float #x80) :y (the-as float #x80) :w (the-as float #x80))))))))) ((< f0-7 f26-1) (let* ((t1-4 (new 'stack-no-clear 'vector)) (t0-4 (new 'stack-no-clear 'vector)) - (f24-1 - (moving-sphere-triangle-intersect arg0 arg1 (-> *CAM_STRING-bank* los-coll-rad2) (-> s1-1 0) t0-4 t1-4) - ) - ) + (f24-1 (moving-sphere-triangle-intersect arg0 arg1 (-> *CAM_STRING-bank* los-coll-rad2) (-> s1-1 0) t0-4 t1-4))) (los-cw-ccw s1-1 s2-0 s4-0 f30-0 arg2 sv-240 f24-1) (when *debug-segment* (if (= f24-1 -100000000.0) - (cam-debug-add-los-tri s1-1 sv-240 (new 'static 'vector :y (the-as float #x80) :w (the-as float #x80))) - (cam-debug-add-los-tri s1-1 sv-240 (new 'static 'vector :z (the-as float #x80) :w (the-as float #x80))) - ) - ) - ) - ) - ) - ) - (set! s1-1 (the-as (inline-array collide-cache-tri) (-> s1-1 1))) - ) - ) - ) - ) + (cam-debug-add-los-tri s1-1 sv-240 (new 'static 'vector :y (the-as float #x80) :w (the-as float #x80))) + (cam-debug-add-los-tri s1-1 sv-240 (new 'static 'vector :z (the-as float #x80) :w (the-as float #x80))))))))) + (set! s1-1 (the-as (inline-array collide-cache-tri) (-> s1-1 1))))))) (let ((s4-1 (new 'stack-no-clear 'vector))) 0.0 (vector-cross! s4-1 arg1 (-> *camera* local-down)) (cond - ((!= (-> self los-tgt-spline-pt-incarnation) - (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation) - ) + ((!= (-> self los-tgt-spline-pt-incarnation) (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation)) (when *display-cam-los-debug* (format *stdcon* "emergency point jump~%") - (format 0 "emergency point jump~%") - ) + (format 0 "emergency point jump~%")) (set! (-> self los-tgt-spline-pt) (-> *camera* target-spline used-point)) - (set! (-> self los-tgt-spline-pt-incarnation) - (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation) - ) + (set! (-> self los-tgt-spline-pt-incarnation) (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation)) (logior! (-> self options) 4096) - (set! (-> self good-point quad) - (-> *camera* target-spline point (-> *camera* target-spline used-point) position quad) - ) + (set! (-> self good-point quad) (-> *camera* target-spline point (-> *camera* target-spline used-point) position quad)) (set! (-> self los-last-pos quad) (-> self good-point quad)) (when *debug-segment* (let ((a1-22 (new 'stack-no-clear 'vector))) (vector-! a1-22 (-> self good-point) (-> self string-trans)) - (cam-collision-record-save (-> self string-trans) a1-22 -3 'jump self) - ) - ) + (cam-collision-record-save (-> self string-trans) a1-22 -3 'jump self))) (set! (-> self desired-pos quad) (-> self good-point quad)) (set! (-> self string-trans quad) (-> self good-point quad)) (vector-! (-> self view-flat) (-> self string-trans) (-> *camera* tpos-curr-adj)) (vector-flatten! (-> self view-flat) (-> self view-flat) (-> *camera* local-down)) (vector-reset! (-> self velocity)) (let ((f0-11 (vector-length (-> self view-flat)))) - (if (< f0-11 (-> self min-z-override)) - (set! (-> self min-z-override) f0-11) - ) - ) - ) + (if (< f0-11 (-> self min-z-override)) (set! (-> self min-z-override) f0-11)))) (else - (let ((f30-1 - (cam-los-spline-collide - (the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 (-> *camera* target-spline end-point)))) - arg0 - (new 'static 'pat-surface :nocamera #x1 :nolineofsight #x1) - ) - ) - ) - (cond - ((< f30-1 0.0) - (if *display-cam-los-debug* - (format *stdcon* "good ~f~%" f30-1) - ) - (set! (-> self los-tgt-spline-pt) (-> *camera* target-spline end-point)) - (set! (-> self los-tgt-spline-pt-incarnation) - (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation) - ) - (set! (-> self los-last-pos quad) (-> arg0 quad)) - ) - ((begin - (if *display-cam-los-debug* - (format - *stdcon* - "looking vel ~M u ~f pt ~D" - (vector-length (-> self velocity)) - f30-1 - (-> self los-tgt-spline-pt) - ) - ) - (set! s2-2 (-> self los-tgt-spline-pt)) - (set! s1-3 -134250495) - (while (and (!= s2-2 -134250495) - (begin - (set! f30-1 - (cam-los-spline-collide - (the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 s2-2))) - arg0 - (new 'static 'pat-surface :nocamera #x1 :nolineofsight #x1) - ) - ) - (< f30-1 0.0) - ) - ) - (set! s1-3 s2-2) - (set! s2-2 (-> *camera* target-spline point s2-2 next)) - ) - (and (= s2-2 (-> *camera* target-spline used-point)) - (!= (-> *camera* target-spline point s2-2 next) -134250495) - ) - ) - (when *display-cam-los-debug* - (format 0 "looking at used point~%") - (format *stdcon* " at used point~%") - ) - (set! (-> self los-tgt-spline-pt) (-> *camera* target-spline point s2-2 next)) - (set! (-> self los-tgt-spline-pt-incarnation) - (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation) - ) - (logior! (-> self options) 4096) - (set! (-> self good-point quad) (-> *camera* target-spline point s2-2 position quad)) - (set! (-> self los-last-pos quad) (-> self good-point quad)) - (when *debug-segment* - (let ((a1-38 (new 'stack-no-clear 'vector))) - (vector-! a1-38 (-> self good-point) (-> self string-trans)) - (cam-collision-record-save (-> self string-trans) a1-38 -3 'jump self) - ) - ) - (set! (-> self desired-pos quad) (-> self good-point quad)) - (set! (-> self string-trans quad) (-> self good-point quad)) - (vector-! (-> self view-flat) (-> self string-trans) (-> *camera* tpos-curr-adj)) - (vector-flatten! (-> self view-flat) (-> self view-flat) (-> *camera* local-down)) - (vector-reset! (-> self velocity)) - (let ((f0-14 (vector-length (-> self view-flat)))) - (if (< f0-14 (-> self min-z-override)) - (set! (-> self min-z-override) f0-14) - ) - ) - ) - ((!= s1-3 -134250495) - (if *display-cam-los-debug* - (format *stdcon* " ok~%") - ) - (set! (-> self los-tgt-spline-pt) s1-3) - (set! (-> self los-tgt-spline-pt-incarnation) - (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation) - ) - (set! (-> self los-last-pos quad) (-> arg0 quad)) - ) - (else + (let ((f30-1 (cam-los-spline-collide (the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 (-> *camera* target-spline end-point)))) + arg0 + (new 'static 'pat-surface :nocamera #x1 :nolineofsight #x1)))) + (cond + ((< f30-1 0.0) + (if *display-cam-los-debug* (format *stdcon* "good ~f~%" f30-1)) + (set! (-> self los-tgt-spline-pt) (-> *camera* target-spline end-point)) + (set! (-> self los-tgt-spline-pt-incarnation) (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation)) + (set! (-> self los-last-pos quad) (-> arg0 quad))) + ((begin (if *display-cam-los-debug* - (format *stdcon* "~%failed u ~f cur ~D seen ~D tgt-pt ~D~%" f30-1 s2-2 s1-3 (-> self los-tgt-spline-pt)) - ) - (let ((s3-1 (new 'stack-no-clear 'vector))) - 0.0 - (vector-! - s3-1 - (-> self los-last-pos) - (the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 (-> self los-tgt-spline-pt)))) - ) - (let ((f28-1 (vector-length s3-1))) - (if (= f28-1 0.0) - (set! f28-1 0.4096) - ) - (let ((f30-2 (cond - ((and (= (-> self string-vel-dir) 6) - (< (-> *CAMERA-bank* min-detectable-velocity) (vector-length (-> self velocity))) - ) - (fmin 1.0 (+ 0.001 f30-1)) - ) - ((= (-> self string-vel-dir) 6) - (fmin 0.9999 f30-1) - ) - (else - (fmax 0.001 (+ -0.001 f30-1)) - ) - ) - ) - ) - (let ((s2-3 (new 'stack-no-clear 'vector))) - (vector-! - s2-3 - (-> *camera* tpos-curr-adj) - (the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 (-> self los-tgt-spline-pt)))) - ) - (vector-flatten! s2-3 s2-3 (-> *camera* local-down)) - (cond - ((and (< (fabs (- (-> self desired-pos y) (-> self trans y))) 8192.0) - (< f28-1 (+ 1024.0 (-> self string-min-val z))) - (< (vector-length s2-3) 8192.0) - ) - (set! f30-2 0.0) - ) - ((< f28-1 (+ 1024.0 (-> self string-min-val z))) - ) - ((< (* f28-1 f30-2) (-> self string-min-val z)) - (set! f30-2 (/ (-> self string-min-val z) f28-1)) - ) - ) - ) - (when (< 0.0 f30-2) - (vector-! s3-1 (-> *camera* tpos-curr) (-> *camera* tpos-old)) - (vector-! - (-> self good-point) + (format *stdcon* "looking vel ~M u ~f pt ~D" (vector-length (-> self velocity)) f30-1 (-> self los-tgt-spline-pt))) + (set! s2-2 (-> self los-tgt-spline-pt)) + (set! s1-3 -134250495) + (while (and (!= s2-2 -134250495) + (begin + (set! f30-1 + (cam-los-spline-collide (the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 s2-2))) + arg0 + (new 'static 'pat-surface :nocamera #x1 :nolineofsight #x1))) + (< f30-1 0.0))) + (set! s1-3 s2-2) + (set! s2-2 (-> *camera* target-spline point s2-2 next))) + (and (= s2-2 (-> *camera* target-spline used-point)) (!= (-> *camera* target-spline point s2-2 next) -134250495))) + (when *display-cam-los-debug* + (format 0 "looking at used point~%") + (format *stdcon* " at used point~%")) + (set! (-> self los-tgt-spline-pt) (-> *camera* target-spline point s2-2 next)) + (set! (-> self los-tgt-spline-pt-incarnation) (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation)) + (logior! (-> self options) 4096) + (set! (-> self good-point quad) (-> *camera* target-spline point s2-2 position quad)) + (set! (-> self los-last-pos quad) (-> self good-point quad)) + (when *debug-segment* + (let ((a1-38 (new 'stack-no-clear 'vector))) + (vector-! a1-38 (-> self good-point) (-> self string-trans)) + (cam-collision-record-save (-> self string-trans) a1-38 -3 'jump self))) + (set! (-> self desired-pos quad) (-> self good-point quad)) + (set! (-> self string-trans quad) (-> self good-point quad)) + (vector-! (-> self view-flat) (-> self string-trans) (-> *camera* tpos-curr-adj)) + (vector-flatten! (-> self view-flat) (-> self view-flat) (-> *camera* local-down)) + (vector-reset! (-> self velocity)) + (let ((f0-14 (vector-length (-> self view-flat)))) + (if (< f0-14 (-> self min-z-override)) (set! (-> self min-z-override) f0-14)))) + ((!= s1-3 -134250495) + (if *display-cam-los-debug* (format *stdcon* " ok~%")) + (set! (-> self los-tgt-spline-pt) s1-3) + (set! (-> self los-tgt-spline-pt-incarnation) (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation)) + (set! (-> self los-last-pos quad) (-> arg0 quad))) + (else + (if *display-cam-los-debug* + (format *stdcon* "~%failed u ~f cur ~D seen ~D tgt-pt ~D~%" f30-1 s2-2 s1-3 (-> self los-tgt-spline-pt))) + (let ((s3-1 (new 'stack-no-clear 'vector))) + 0.0 + (vector-! s3-1 (-> self los-last-pos) - (the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 (-> self los-tgt-spline-pt)))) - ) - (vector-float*! (-> self good-point) (-> self good-point) f30-2) - (vector+! - (-> self good-point) - (-> self good-point) - (the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 (-> self los-tgt-spline-pt)))) - ) - (set! (-> self los-last-pos quad) (-> self good-point quad)) - (when *display-cam-los-debug* - (format 0 "going because u(~f) > 0 frame ~D~%" f30-2 (current-time)) - (format *stdcon* " going because u(~f) > 0 frame ~D~%" f30-2 (current-time)) - ) - (logior! (-> self options) 4096) - ) - ) - ) - ) - ) - ) - ) - ) - ) + (the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 (-> self los-tgt-spline-pt))))) + (let ((f28-1 (vector-length s3-1))) + (if (= f28-1 0.0) (set! f28-1 0.4096)) + (let ((f30-2 (cond + ((and (= (-> self string-vel-dir) 6) (< (-> *CAMERA-bank* min-detectable-velocity) (vector-length (-> self velocity)))) + (fmin 1.0 (+ 0.001 f30-1))) + ((= (-> self string-vel-dir) 6) (fmin 0.9999 f30-1)) + (else (fmax 0.001 (+ -0.001 f30-1)))))) + (let ((s2-3 (new 'stack-no-clear 'vector))) + (vector-! s2-3 + (-> *camera* tpos-curr-adj) + (the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 (-> self los-tgt-spline-pt))))) + (vector-flatten! s2-3 s2-3 (-> *camera* local-down)) + (cond + ((and (< (fabs (- (-> self desired-pos y) (-> self trans y))) 8192.0) + (< f28-1 (+ 1024.0 (-> self string-min-val z))) + (< (vector-length s2-3) 8192.0)) + (set! f30-2 0.0)) + ((< f28-1 (+ 1024.0 (-> self string-min-val z)))) + ((< (* f28-1 f30-2) (-> self string-min-val z)) (set! f30-2 (/ (-> self string-min-val z) f28-1))))) + (when (< 0.0 f30-2) + (vector-! s3-1 (-> *camera* tpos-curr) (-> *camera* tpos-old)) + (vector-! (-> self good-point) + (-> self los-last-pos) + (the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 (-> self los-tgt-spline-pt))))) + (vector-float*! (-> self good-point) (-> self good-point) f30-2) + (vector+! (-> self good-point) + (-> self good-point) + (the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 (-> self los-tgt-spline-pt))))) + (set! (-> self los-last-pos quad) (-> self good-point quad)) + (when *display-cam-los-debug* + (format 0 "going because u(~f) > 0 frame ~D~%" f30-2 (current-time)) + (format *stdcon* " going because u(~f) > 0 frame ~D~%" f30-2 (current-time))) + (logior! (-> self options) 4096)))))))))) (if *display-cam-los-debug* - (format - *stdcon* - "los-last ~M ~M ~M~%" - (-> self los-last-pos x) - (-> self los-last-pos y) - (-> self los-last-pos z) - ) - ) - (cam-los-setup-lateral arg2 s4-1 arg1) - ) + (format *stdcon* "los-last ~M ~M ~M~%" (-> self los-last-pos x) (-> self los-last-pos y) (-> self los-last-pos z))) + (cam-los-setup-lateral arg2 s4-1 arg1)) (cond - ((not (logtest? (-> self options) 1024)) - ) - ((= (-> self string-vel-dir) 5) - ) - ((and (= (-> self string-vel-dir) 2) (= (-> self los-state) (slave-los-state cw))) - ) - ((and (= (-> self string-vel-dir) 1) (= (-> self los-state) (slave-los-state ccw))) - ) - ) + ((not (logtest? (-> self options) 1024))) + ((= (-> self string-vel-dir) 5)) + ((and (= (-> self string-vel-dir) 2) (= (-> self los-state) (slave-los-state cw)))) + ((and (= (-> self string-vel-dir) 1) (= (-> self los-state) (slave-los-state ccw))))) (when *display-cam-los-debug* (format *stdcon* "state ~S" (slave-los-state->string (-> self los-state))) (cond - ((zero? (-> self string-vel-dir)) - (format *stdcon* " vzero") - ) - ((= (-> self string-vel-dir) 2) - (format *stdcon* " vcw") - ) - ((= (-> self string-vel-dir) 1) - (format *stdcon* " vccw") - ) - ((= (-> self string-vel-dir) 3) - (format *stdcon* " up") - ) - ((= (-> self string-vel-dir) 4) - (format *stdcon* " down") - ) - ((= (-> self string-vel-dir) 6) - (format *stdcon* " long") - ) - ((= (-> self string-vel-dir) 5) - (format *stdcon* " short") - ) - ) - (format *stdcon* "~%") - ) + ((zero? (-> self string-vel-dir)) (format *stdcon* " vzero")) + ((= (-> self string-vel-dir) 2) (format *stdcon* " vcw")) + ((= (-> self string-vel-dir) 1) (format *stdcon* " vccw")) + ((= (-> self string-vel-dir) 3) (format *stdcon* " up")) + ((= (-> self string-vel-dir) 4) (format *stdcon* " down")) + ((= (-> self string-vel-dir) 6) (format *stdcon* " long")) + ((= (-> self string-vel-dir) 5) (format *stdcon* " short"))) + (format *stdcon* "~%")) (when *display-cam-los-info* (dist-info-print (the-as collide-los-dist-info (-> arg2 intersection)) "cw ") (dist-info-print (the-as collide-los-dist-info (-> arg2 next-normal)) "ccw ") - (dist-info-print (the-as collide-los-dist-info (-> arg2 vert-0)) "strdl") - ) - (the-as symbol 0) - ) + (dist-info-print (the-as collide-los-dist-info (-> arg2 vert-0)) "strdl")) + (the-as symbol 0)) (defbehavior cam-string-follow camera-slave () (let ((f30-0 (vector-length (-> self view-flat)))) @@ -2101,74 +1276,38 @@ (vector-cross! s5-0 (-> self view-flat) (-> *camera* local-down)) (vector-normalize! s5-0 (the-as float 1.0)) (vector-! gp-0 (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj)) - (vector-flatten! gp-0 gp-0 s5-0) - ) - (if (< (vector-dot gp-0 (-> self view-flat)) 0.0) - (vector-! (-> self view-flat) (-> self view-flat) gp-0) - ) - ) - ) + (vector-flatten! gp-0 gp-0 s5-0)) + (if (< (vector-dot gp-0 (-> self view-flat)) 0.0) (vector-! (-> self view-flat) (-> self view-flat) gp-0)))) (else - (let ((v1-9 (new 'stack-no-clear 'vector))) - (vector-! v1-9 (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj)) - (vector-! (-> self view-flat) (-> self view-flat) v1-9) - ) - ) - ) + (let ((v1-9 (new 'stack-no-clear 'vector))) + (vector-! v1-9 (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj)) + (vector-! (-> self view-flat) (-> self view-flat) v1-9)))) (vector-flatten! (-> self view-flat) (-> self view-flat) (-> *camera* local-down)) (let* ((f28-0 (vector-length (-> self view-flat))) (f0-3 (fmin (-> *camera* string-push-z) (-> self view-off z))) (f26-0 (-> self view-off z)) - (f0-4 (fmin f0-3 (-> self min-z-override))) - ) + (f0-4 (fmin f0-3 (-> self min-z-override)))) (cond ((logtest? (-> self options) #x4000) (let ((a0-17 (new-stack-vector0))) 0.0 (vector-! a0-17 (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj)) (let ((f0-6 (vector-length a0-17))) - (set! f0-4 (lerp-clamp - (the-as float 28672.0) - (the-as float 32768.0) - (parameter-ease-sin-clamp (* 0.00081380206 (+ -409.6 f0-6))) - ) - ) - ) - ) + (set! f0-4 + (lerp-clamp (the-as float 28672.0) (the-as float 32768.0) (parameter-ease-sin-clamp (* 0.00081380206 (+ -409.6 f0-6))))))) (set! f26-0 f0-4) - (+! (-> self fov) (fmax -91.022224 (fmin 91.022224 (* 0.1 (- 17294.223 (-> self fov)))))) - ) - (else - (+! (-> self fov) (fmax -182.04445 (fmin 182.04445 (* 0.1 (- 11650.845 (-> self fov)))))) - ) - ) + (+! (-> self fov) (fmax -91.022224 (fmin 91.022224 (* 0.1 (- 17294.223 (-> self fov))))))) + (else (+! (-> self fov) (fmax -182.04445 (fmin 182.04445 (* 0.1 (- 11650.845 (-> self fov)))))))) (cond - ((< f28-0 f0-4) - (vector-normalize! (-> self view-flat) f0-4) - ) - ((and (< f30-0 f28-0) - (or (= (-> self los-state) (slave-los-state ccw)) (= (-> self los-state) (slave-los-state cw))) - ) - (vector-normalize! (-> self view-flat) f30-0) - ) - ((< f26-0 f28-0) - (vector-normalize! (-> self view-flat) f26-0) - (set! (-> self min-z-override) f26-0) - f26-0 - ) - (else - (set! (-> self min-z-override) f28-0) - f28-0 - ) - ) - ) - ) - ) + ((< f28-0 f0-4) (vector-normalize! (-> self view-flat) f0-4)) + ((and (< f30-0 f28-0) (or (= (-> self los-state) (slave-los-state ccw)) (= (-> self los-state) (slave-los-state cw)))) + (vector-normalize! (-> self view-flat) f30-0)) + ((< f26-0 f28-0) (vector-normalize! (-> self view-flat) f26-0) (set! (-> self min-z-override) f26-0) f26-0) + (else (set! (-> self min-z-override) f28-0) f28-0))))) (defbehavior cam-string-line-of-sight camera-slave () (let ((gp-0 (new 'stack-no-clear 'clip-travel-vector-to-mesh-return-info)) - (s5-0 (new 'stack-no-clear 'vector)) - ) + (s5-0 (new 'stack-no-clear 'vector))) (new 'stack-no-clear 'vector) (let ((f30-0 (vector-length (-> self view-flat)))) (vector--float*! s5-0 (-> *camera* tpos-curr) (-> *camera* local-down) (-> *camera* target-height)) @@ -2179,201 +1318,105 @@ (let ((a0-6 (new 'stack-no-clear 'vector))) (vector-! a0-6 (-> *camera* tpos-curr) (-> *camera* tpos-old)) (if (and (< (-> self string-min-val z) f30-0) (< (-> *CAMERA-bank* min-detectable-velocity) (vector-length a0-6))) - (set! f30-0 (+ -204.8 f30-0)) - ) - ) - ) + (set! f30-0 (+ -204.8 f30-0))))) (if (< f30-0 (fmin (-> self string-min-val z) (-> self min-z-override))) - (set! f30-0 (fmin (-> self string-min-val z) (-> self min-z-override))) - ) - (if (< f30-0 (-> self min-z-override)) - (set! (-> self min-z-override) f30-0) - ) + (set! f30-0 (fmin (-> self string-min-val z) (-> self min-z-override)))) + (if (< f30-0 (-> self min-z-override)) (set! (-> self min-z-override) f30-0)) (let ((s4-0 (new 'stack-no-clear 'vector)) (s5-1 (new 'stack-no-clear 'vector)) - (s3-0 (new 'stack-no-clear 'matrix)) - ) + (s3-0 (new 'stack-no-clear 'matrix))) 0.0 (vector-flatten! s4-0 (the-as vector (&-> gp-0 found-boundary)) (-> *camera* local-down)) (vector-normalize! s4-0 (the-as float 1.0)) (vector-normalize-copy! s5-1 (-> self view-flat) (the-as float 1.0)) - (let ((f0-12 (lerp-clamp - (the-as float 418.7022) - (the-as float 364.0889) - (/ (- f30-0 (-> self string-min-val z)) (- (-> self string-max-val z) (-> self string-min-val z))) - ) - ) - ) - (matrix-from-two-vectors-max-angle-partial! s3-0 s5-1 s4-0 f0-12 (the-as float 0.5)) - ) - (vector-matrix*! (-> self view-flat) (-> self view-flat) s3-0) - ) - (vector-normalize! (-> self view-flat) f30-0) - ) - ) - ) - ) + (let ((f0-12 (lerp-clamp (the-as float 418.7022) + (the-as float 364.0889) + (/ (- f30-0 (-> self string-min-val z)) (- (-> self string-max-val z) (-> self string-min-val z)))))) + (matrix-from-two-vectors-max-angle-partial! s3-0 s5-1 s4-0 f0-12 (the-as float 0.5))) + (vector-matrix*! (-> self view-flat) (-> self view-flat) s3-0)) + (vector-normalize! (-> self view-flat) f30-0))))) (defun cam-dist-analog-input ((arg0 int) (arg1 float)) (let ((f0-0 0.0)) (cond - ((< arg0 28) - (set! f0-0 (- (fmin arg1 (* 0.083333336 (- 28.0 (the float arg0)) arg1)))) - ) - ((< 160 arg0) - (set! f0-0 (fmin arg1 (* 0.0125 (+ -160.0 (the float arg0)) arg1))) - ) - ) + ((< arg0 28) (set! f0-0 (- (fmin arg1 (* 0.083333336 (- 28.0 (the float arg0)) arg1))))) + ((< 160 arg0) (set! f0-0 (fmin arg1 (* 0.0125 (+ -160.0 (the float arg0)) arg1))))) ;; changed for pc port, only used for Third-Person Vertical camera - (#if PC_PORT - (* (if (-> *pc-settings* third-camera-v-inverted?) 1.0 -1.0) f0-0) - f0-0 - ) - ) - ) + (#if PC_PORT (* (if (-> *pc-settings* third-camera-v-inverted?) 1.0 -1.0) f0-0) f0-0))) ;; main third-person camera (defbehavior cam-string-joystick camera-slave () (logand! (-> self options) -257) (let ((f28-0 (cam-dist-analog-input (the-as int (-> *cpad-list* cpads 0 righty)) (the-as float 0.05))) (f0-2 (/ (- (vector-length (-> self view-flat)) (-> self string-min-val z)) - (- (-> self string-max-val z) (-> self string-min-val z)) - ) - ) - (f30-0 (-> self view-off-param)) - ) - (if (-> self have-phony-joystick) - (set! f28-0 (* 0.05 (-> self phony-joystick-y))) - ) - (if (and (-> *camera* being-attacked) (not (time-elapsed? (-> *camera* attack-start) (seconds 0.25)))) - (set! f28-0 0.05) - ) - (if (!= f28-0 0.0) - (logior! (-> self options) 256) - ) + (- (-> self string-max-val z) (-> self string-min-val z)))) + (f30-0 (-> self view-off-param))) + (if (-> self have-phony-joystick) (set! f28-0 (* 0.05 (-> self phony-joystick-y)))) + (if (and (-> *camera* being-attacked) (not (time-elapsed? (-> *camera* attack-start) (seconds 0.25)))) (set! f28-0 0.05)) + (if (!= f28-0 0.0) (logior! (-> self options) 256)) (let ((f26-0 (fmin 1.0 f0-2))) (let ((f0-3 f26-0)) (when (< f26-0 0.0) - (let ((f0-6 - (/ (- (-> self string-min-val z) (vector-length (-> self view-flat))) (* 0.5 (-> self string-min-val z))) - ) - ) - (set! f0-3 (fmin 0.75 f0-6)) - ) - ) + (let ((f0-6 (/ (- (-> self string-min-val z) (vector-length (-> self view-flat))) (* 0.5 (-> self string-min-val z))))) + (set! f0-3 (fmin 0.75 f0-6)))) (let ((f1-10 (-> self string-min-val y)) - (f2-3 (-> self string-max-val y)) - ) - (set! (-> self view-off y) (lerp f1-10 f2-3 f0-3)) - ) - ) + (f2-3 (-> self string-max-val y))) + (set! (-> self view-off y) (lerp f1-10 f2-3 f0-3)))) (when (< f26-0 0.0) (let ((v1-28 (new 'stack-no-clear 'vector))) (vector-! v1-28 (-> self string-trans) (-> *camera* tpos-curr-adj)) (let ((f0-12 (- (- (vector-dot v1-28 (-> *camera* local-down))) (-> *camera* target-height)))) - (set! (-> self view-off y) (fmin (-> *camera* stringCliffHeight) (fmax f0-12 (-> self view-off y)))) - ) - ) - ) + (set! (-> self view-off y) (fmin (-> *camera* stringCliffHeight) (fmax f0-12 (-> self view-off y))))))) (let ((f0-16 (fmax 0.0 f26-0))) (cond - ((logtest? (-> self options) #x4000) - ) - ((not *camera-read-analog*) - ) - ((and (>= 0.0 f28-0) (>= 0.0 f0-16)) - ) - ((and (>= f28-0 0.0) (>= f0-16 1.0)) - ) - ((and (< 0.0 f28-0) - (or (= (-> self los-state) (slave-los-state ccw)) (= (-> self los-state) (slave-los-state cw))) - ) - ) + ((logtest? (-> self options) #x4000)) + ((not *camera-read-analog*)) + ((and (>= 0.0 f28-0) (>= 0.0 f0-16))) + ((and (>= f28-0 0.0) (>= f0-16 1.0))) + ((and (< 0.0 f28-0) (or (= (-> self los-state) (slave-los-state ccw)) (= (-> self los-state) (slave-los-state cw))))) ((< (* 0.05 (- 1.0 f0-16)) f28-0) (let ((f0-17 (+ f0-16 (* 0.05 (- 1.0 f0-16))))) (set! (-> self view-off-param) (fmax (-> self view-off-param) f0-17)) - (vector-normalize! (-> self view-flat) (lerp (-> self string-min-val z) (-> self string-max-val z) f0-17)) - ) - ) - ((< f28-0 (* 0.05 (- f0-16))) - (set! (-> self view-off-param) (+ f0-16 (* 0.05 (- f0-16)))) - ) + (vector-normalize! (-> self view-flat) (lerp (-> self string-min-val z) (-> self string-max-val z) f0-17)))) + ((< f28-0 (* 0.05 (- f0-16))) (set! (-> self view-off-param) (+ f0-16 (* 0.05 (- f0-16))))) ((< 0.0 f28-0) (let ((f0-19 (+ f0-16 (* f28-0 (-> *display* time-adjust-ratio))))) (set! (-> self view-off-param) (fmax (-> self view-off-param) f0-19)) - (vector-normalize! (-> self view-flat) (lerp (-> self string-min-val z) (-> self string-max-val z) f0-19)) - ) - ) - ((< f28-0 0.0) - (set! (-> self view-off-param) (+ f0-16 (* f28-0 (-> *display* time-adjust-ratio)))) - ) - ) - ) - ) + (vector-normalize! (-> self view-flat) (lerp (-> self string-min-val z) (-> self string-max-val z) f0-19)))) + ((< f28-0 0.0) (set! (-> self view-off-param) (+ f0-16 (* f28-0 (-> *display* time-adjust-ratio)))))))) (if (= f28-0 0.0) - (set! (-> self view-off z) (-> self string-max-val z)) - (set! (-> self view-off z) - (lerp (-> self string-min-val z) (-> self string-max-val z) (-> self view-off-param)) - ) - ) - (if (-> *camera* being-attacked) - (set! (-> self view-off-param) f30-0) - ) - ) + (set! (-> self view-off z) (-> self string-max-val z)) + (set! (-> self view-off z) (lerp (-> self string-min-val z) (-> self string-max-val z) (-> self view-off-param)))) + (if (-> *camera* being-attacked) (set! (-> self view-off-param) f30-0))) (when *camera-read-analog* - (let ((f0-29 (analog-input-horizontal-third ;; changed for pc port + (let ((f0-29 (analog-input-horizontal-third ;; changed for pc port (the-as int (-> *cpad-list* cpads 0 rightx)) (the-as float 128.0) (the-as float 32.0) (the-as float 110.0) - (* 21845.334 (seconds-per-frame)) - ) - ) + (* 21845.334 (seconds-per-frame)))) (s4-0 (new-stack-matrix0)) (gp-2 (new-stack-vector0)) - (s5-2 (new-stack-vector0)) - ) - (if (-> self have-phony-joystick) - (set! f0-29 (* 21845.334 (-> self phony-joystick-x) (seconds-per-frame))) - ) + (s5-2 (new-stack-vector0))) + (if (-> self have-phony-joystick) (set! f0-29 (* 21845.334 (-> self phony-joystick-x) (seconds-per-frame)))) (cond ((and (= (-> self los-state) (slave-los-state ccw)) (< 0.0 f0-29)) - (let ((f0-34 - (fmax (-> self string-min-val z) (fmin (-> self string-max-val z) (vector-length (-> self view-flat)))) - ) - ) - (set! f0-29 (* 21845.334 (+ 0.1 (/ (-> self string-min-val z) f0-34)) (seconds-per-frame))) - ) - ) + (let ((f0-34 (fmax (-> self string-min-val z) (fmin (-> self string-max-val z) (vector-length (-> self view-flat)))))) + (set! f0-29 (* 21845.334 (+ 0.1 (/ (-> self string-min-val z) f0-34)) (seconds-per-frame))))) ((and (= (-> self los-state) (slave-los-state cw)) (< f0-29 0.0)) - (let ((f0-40 - (fmax (-> self string-min-val z) (fmin (-> self string-max-val z) (vector-length (-> self view-flat)))) - ) - ) - (set! f0-29 (* -21845.334 (+ 0.1 (/ (-> self string-min-val z) f0-40)) (seconds-per-frame))) - ) - ) - ) + (let ((f0-40 (fmax (-> self string-min-val z) (fmin (-> self string-max-val z) (vector-length (-> self view-flat)))))) + (set! f0-29 (* -21845.334 (+ 0.1 (/ (-> self string-min-val z) f0-40)) (seconds-per-frame)))))) (cond ((!= f0-29 0.0) (logior! (-> self options) 256) (matrix-axis-angle! s4-0 (-> *camera* local-down) f0-29) - (vector-matrix*! (-> self view-flat) (-> self view-flat) s4-0) - ) + (vector-matrix*! (-> self view-flat) (-> self view-flat) s4-0)) ((logtest? (-> self options) 1) (vector-normalize-copy! gp-2 (-> self view-flat) (the-as float 1.0)) (vector-flatten! s5-2 (-> *camera* tgt-rot-mat vector 2) (-> *camera* local-down)) (vector-normalize! s5-2 (the-as float -1.0)) - (matrix-from-two-vectors-max-angle-partial! - s4-0 - gp-2 - s5-2 - (* 10922.667 (seconds-per-frame)) - (the-as float 0.05) - ) - (vector-matrix*! (-> self view-flat) (-> self view-flat) s4-0) - ) - ) + (matrix-from-two-vectors-max-angle-partial! s4-0 gp-2 s5-2 (* 10922.667 (seconds-per-frame)) (the-as float 0.05)) + (vector-matrix*! (-> self view-flat) (-> self view-flat) s4-0))) (when (logtest? (-> self options) #x4000) (vector-normalize-copy! gp-2 (-> self view-flat) (the-as float 1.0)) (vector-flatten! s5-2 (-> *camera* tgt-rot-mat vector 2) (-> *camera* local-down)) @@ -2381,54 +1424,33 @@ (let ((f0-47 (acos (vector-dot s5-2 gp-2)))) (when (and (< 8192.0 f0-47) (< f0-47 32585.955)) (matrix-from-two-vectors-max-angle! s4-0 gp-2 s5-2 (fmin 546.13336 (* 0.5 (+ -8192.0 f0-47)))) - (vector-matrix*! (-> self view-flat) (-> self view-flat) s4-0) - ) - ) - ) - ) - ) - ) + (vector-matrix*! (-> self view-flat) (-> self view-flat) s4-0))))))) (defbehavior cam-string-find-hidden camera-slave () (let ((s4-0 (new 'stack-no-clear 'collide-tri-result)) (s5-0 (new 'stack-no-clear 'vector)) - (gp-0 (new 'stack-no-clear 'vector)) - ) + (gp-0 (new 'stack-no-clear 'vector))) (vector--float*! s5-0 (-> *camera* tpos-curr-adj) (-> *camera* local-down) (-> *camera* target-height)) (vector-! s5-0 s5-0 (-> self string-trans)) (cond - ((< (fill-and-probe-using-line-sphere - *collide-cache* - (-> self string-trans) - s5-0 - (the-as float 40.96) - (collide-kind background cak-3 wall-object ground-object cak-14) - (the-as process #f) - s4-0 - (new 'static 'pat-surface :nocamera #x1) - ) - 0.0 - ) + ((< (fill-and-probe-using-line-sphere *collide-cache* + (-> self string-trans) + s5-0 + (the-as float 40.96) + (collide-kind background cak-3 wall-object ground-object cak-14) + (the-as process #f) + s4-0 + (new 'static 'pat-surface :nocamera #x1)) + 0.0) (set! (-> self time-dist-too-far) (the-as uint 0)) - 0 - ) - ((< (-> self time-dist-too-far) (the-as uint 600)) - (+! (-> self time-dist-too-far) 1) - ) + 0) + ((< (-> self time-dist-too-far) (the-as uint 600)) (+! (-> self time-dist-too-far) 1)) ((cam-string-find-position-rel! gp-0) (cam-string-set-position-rel! gp-0) (set! (-> self time-dist-too-far) (the-as uint 0)) - 0 - ) - (else - (format 0 "camera position search failed~%") - (set! (-> self time-dist-too-far) (the-as uint 0)) - 0 - ) - ) - ) - (none) - ) + 0) + (else (format 0 "camera position search failed~%") (set! (-> self time-dist-too-far) (the-as uint 0)) 0))) + (none)) ;; WARN: Stack slot load at 240 mismatch: defined as size 4, got size 16 ;; WARN: Stack slot load at 256 mismatch: defined as size 4, got size 16 @@ -2439,14 +1461,11 @@ (defbehavior cam-string-move camera-slave () (local-vars (sv-240 float) (sv-256 float)) (vector-! (-> self velocity) (-> self desired-pos) (-> self string-trans)) - (if *display-cam-los-debug* - (format *stdcon* "vel ~M~%" (vector-length (-> self velocity))) - ) + (if *display-cam-los-debug* (format *stdcon* "vel ~M~%" (vector-length (-> self velocity)))) (let ((s5-1 (new 'stack-no-clear 'vector)) (s4-1 (new 'stack-no-clear 'vector)) (gp-1 (new 'stack-no-clear 'vector)) - (s3-0 (new 'stack-no-clear 'vector)) - ) + (s3-0 (new 'stack-no-clear 'vector))) (vector-! s3-0 (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj)) (vector+float*! s5-1 (-> self velocity) s3-0 (the-as float 0.5)) (vector-normalize! s5-1 (the-as float 1.0)) @@ -2454,460 +1473,250 @@ (vector-cross! gp-1 s4-1 s5-1) (cond ((and (< (vector-length (-> self velocity)) (-> *CAMERA-bank* min-detectable-velocity)) - (< (vector-length s3-0) (-> *CAMERA-bank* min-detectable-velocity)) - ) + (< (vector-length s3-0) (-> *CAMERA-bank* min-detectable-velocity))) (set! (-> self string-vel-dir) (the-as uint 0)) - 0 - ) + 0) ((< (cos (the-as float 5461.3335)) (vector-dot (-> *camera* local-down) s5-1)) - (set! (-> self string-vel-dir) (the-as uint 4)) - ) + (set! (-> self string-vel-dir) (the-as uint 4))) ((< (vector-dot (-> *camera* local-down) s5-1) (- (cos (the-as float 5461.3335)))) - (set! (-> self string-vel-dir) (the-as uint 3)) - ) - ((< (cos (the-as float 5461.3335)) (vector-dot s4-1 s5-1)) - (set! (-> self string-vel-dir) (the-as uint 6)) - ) - ((< (vector-dot s4-1 s5-1) (- (cos (the-as float 5461.3335)))) - (set! (-> self string-vel-dir) (the-as uint 5)) - ) - ((< (vector-dot (-> *camera* local-down) gp-1) 0.0) - (set! (-> self string-vel-dir) (the-as uint 1)) - ) - (else - (set! (-> self string-vel-dir) (the-as uint 2)) - ) - ) - ) + (set! (-> self string-vel-dir) (the-as uint 3))) + ((< (cos (the-as float 5461.3335)) (vector-dot s4-1 s5-1)) (set! (-> self string-vel-dir) (the-as uint 6))) + ((< (vector-dot s4-1 s5-1) (- (cos (the-as float 5461.3335)))) (set! (-> self string-vel-dir) (the-as uint 5))) + ((< (vector-dot (-> *camera* local-down) gp-1) 0.0) (set! (-> self string-vel-dir) (the-as uint 1))) + (else (set! (-> self string-vel-dir) (the-as uint 2))))) 0.0 (let ((f30-2 1.0) (s5-2 (new-stack-vector0)) - (gp-2 0) - ) + (gp-2 0)) (let ((s4-2 (new 'stack-no-clear 'collide-tri-result)) - (s3-1 (new 'stack-no-clear 'vector)) - ) + (s3-1 (new 'stack-no-clear 'vector))) (when *debug-segment* (if (>= (-> *CAMERA-bank* min-detectable-velocity) (vector-length (-> self velocity))) - (cam-collision-record-save (-> self string-trans) (-> self velocity) -1 'no-hit self) - ) - ) - (while (and (< 0.01 f30-2) - (and (< (-> *CAMERA-bank* min-detectable-velocity) (vector-length (-> self velocity))) (< gp-2 4)) - ) + (cam-collision-record-save (-> self string-trans) (-> self velocity) -1 'no-hit self))) + (while (and (< 0.01 f30-2) (and (< (-> *CAMERA-bank* min-detectable-velocity) (vector-length (-> self velocity))) (< gp-2 4))) (vector-float*! s5-2 (-> self velocity) f30-2) - (if *debug-segment* - (cam-collision-record-save (-> self string-trans) s5-2 gp-2 'normal self) - ) + (if *debug-segment* (cam-collision-record-save (-> self string-trans) s5-2 gp-2 'normal self)) (let ((f28-1 (if (logtest? (-> self options) 32) - (fill-and-probe-using-line-sphere - *collide-cache* - (-> self string-trans) - s5-2 - (-> *CAMERA-bank* collide-move-rad) - (collide-kind background cak-3 wall-object ground-object cak-14) - (the-as process #f) - s4-2 - (new 'static 'pat-surface :nocamera #x1) - ) - -100000000.0 - ) - ) - ) + (fill-and-probe-using-line-sphere *collide-cache* + (-> self string-trans) + s5-2 + (-> *CAMERA-bank* collide-move-rad) + (collide-kind background cak-3 wall-object ground-object cak-14) + (the-as process #f) + s4-2 + (new 'static 'pat-surface :nocamera #x1)) + -100000000.0))) (when *display-cam-los-debug* (let ((s2-0 format) (s1-0 *stdcon*) - (s0-0 "vp ~f vr ~f r ~f ta ~f~%") - ) + (s0-0 "vp ~f vr ~f r ~f ta ~f~%")) (set! sv-240 (vector-length s5-2)) (set! sv-256 f30-2) (let ((t0-3 (/ (vector-length s5-2) f30-2)) - (t1-1 f28-1) - ) - (s2-0 s1-0 s0-0 sv-240 sv-256 t0-3 t1-1) - ) - ) - ) + (t1-1 f28-1)) + (s2-0 s1-0 s0-0 sv-240 sv-256 t0-3 t1-1)))) (cond ((>= f28-1 0.0) (let* ((f1-7 (fmax 0.01 (/ 40.96 (vector-length s5-2)))) - (f0-24 (fmax 0.0 (- f28-1 f1-7))) - ) - (vector+float*! (-> self string-trans) (-> self string-trans) s5-2 f0-24) - ) + (f0-24 (fmax 0.0 (- f28-1 f1-7)))) + (vector+float*! (-> self string-trans) (-> self string-trans) s5-2 f0-24)) (vector-! s3-1 (-> self string-trans) (-> s4-2 intersect)) (vector-normalize! s3-1 (the-as float 1.0)) (vector-flatten! (-> self velocity) (-> self velocity) s3-1) (set! f30-2 (- f30-2 (* f30-2 f28-1))) - (+! gp-2 1) - ) - (else - (vector+! (-> self string-trans) (-> self string-trans) s5-2) - (set! f30-2 0.0) - ) - ) - ) - ) - ) + (+! gp-2 1)) + (else (vector+! (-> self string-trans) (-> self string-trans) s5-2) (set! f30-2 0.0)))))) (cond - ((zero? gp-2) - (logand! (-> self options) -1025) - (if *display-cam-los-debug* - (format *stdcon* "not blocked~%") - ) - ) + ((zero? gp-2) (logand! (-> self options) -1025) (if *display-cam-los-debug* (format *stdcon* "not blocked~%"))) (else - (logior! (-> self options) 1024) - (if *display-cam-los-debug* - (format *stdcon* "blocked ~D ~f~%" gp-2 f30-2) - ) - (let ((gp-3 (new-stack-vector0)) - (f30-3 (vector-length (-> self view-flat))) - ) - (vector-! gp-3 (-> self string-trans) (-> *camera* tpos-curr-adj)) - (vector-flatten! gp-3 gp-3 (-> *camera* local-down)) - (let ((f28-3 (vector-length gp-3))) - (cond - ((< f28-3 f30-3) - (vector-normalize-copy! (-> self view-flat) gp-3 f28-3) - (set! (-> self min-z-override) f28-3) - f28-3 - ) - (else - (vector-normalize-copy! (-> self view-flat) gp-3 f30-3) - ) - ) - ) - ) - ) - ) - ) + (logior! (-> self options) 1024) + (if *display-cam-los-debug* (format *stdcon* "blocked ~D ~f~%" gp-2 f30-2)) + (let ((gp-3 (new-stack-vector0)) + (f30-3 (vector-length (-> self view-flat)))) + (vector-! gp-3 (-> self string-trans) (-> *camera* tpos-curr-adj)) + (vector-flatten! gp-3 gp-3 (-> *camera* local-down)) + (let ((f28-3 (vector-length gp-3))) + (cond + ((< f28-3 f30-3) (vector-normalize-copy! (-> self view-flat) gp-3 f28-3) (set! (-> self min-z-override) f28-3) f28-3) + (else (vector-normalize-copy! (-> self view-flat) gp-3 f30-3)))))))) (when *display-cam-los-debug* (let ((a0-43 (new-stack-vector0))) (vector-! a0-43 (-> self desired-pos) (-> self string-trans)) - (format *stdcon* "vel ~M~%" (vector-length a0-43)) - ) - ) - ) + (format *stdcon* "vel ~M~%" (vector-length a0-43))))) (defbehavior cam-string-code camera-slave () - (if *debug-segment* - (cam-debug-reset-coll-tri) - ) + (if *debug-segment* (cam-debug-reset-coll-tri)) (cam-string-follow) - (if (logtest? (-> self options) 512) - (cam-string-line-of-sight) - ) - (if (not (paused?)) - (cam-string-joystick) - ) + (if (logtest? (-> self options) 512) (cam-string-line-of-sight)) + (if (not (paused?)) (cam-string-joystick)) (let ((gp-0 (new-stack-vector0))) - (vector--float*! - gp-0 - (-> self view-flat) - (-> *camera* local-down) - (+ (-> *camera* target-height) (-> self view-off y)) - ) - (vector+! (-> self desired-pos) (-> *camera* tpos-curr-adj) gp-0) - ) - (if (logtest? (-> self options) 64) - (cam-string-find-hidden) - ) + (vector--float*! gp-0 (-> self view-flat) (-> *camera* local-down) (+ (-> *camera* target-height) (-> self view-off y))) + (vector+! (-> self desired-pos) (-> *camera* tpos-curr-adj) gp-0)) + (if (logtest? (-> self options) 64) (cam-string-find-hidden)) (cond ((logtest? (-> self options) 4096) (when *debug-segment* (let ((a1-1 (new 'stack-no-clear 'vector))) (vector-! a1-1 (-> self good-point) (-> self string-trans)) - (cam-collision-record-save (-> self string-trans) a1-1 -2 'jump self) - ) - ) + (cam-collision-record-save (-> self string-trans) a1-1 -2 'jump self))) (logand! (-> self options) -4097) (set! (-> self desired-pos quad) (-> self good-point quad)) (cam-string-move) (vector-! (-> self view-flat) (-> self string-trans) (-> *camera* tpos-curr-adj)) (vector-flatten! (-> self view-flat) (-> self view-flat) (-> *camera* local-down)) (let ((f0-2 (vector-length (-> self view-flat)))) - (if (< f0-2 (-> self min-z-override)) - (set! (-> self min-z-override) f0-2) - ) - ) - ) - (else - (cam-string-move) - ) - ) - (tracking-spline-method-17 - (-> self position-spline) - (-> self string-trans) - (the-as float 0.04096) - (the-as float 4096.0) - #t - ) + (if (< f0-2 (-> self min-z-override)) (set! (-> self min-z-override) f0-2)))) + (else (cam-string-move))) + (tracking-spline-method-17 (-> self position-spline) + (-> self string-trans) + (the-as float 0.04096) + (the-as float 4096.0) + #t) (cond ((and (logtest? (-> self options) #x4000) (logtest? (-> self options) 256)) - (tracking-spline-method-21 - (-> self position-spline) - (-> self trans) - (the-as float 102.4) - (the-as float 4096.0) - ) - ) + (tracking-spline-method-21 (-> self position-spline) (-> self trans) (the-as float 102.4) (the-as float 4096.0))) ((logtest? (-> self options) #x4000) - (tracking-spline-method-21 - (-> self position-spline) - (-> self trans) - (the-as float 40.96) - (the-as float 4096.0) - ) - ) + (tracking-spline-method-21 (-> self position-spline) (-> self trans) (the-as float 40.96) (the-as float 4096.0))) ((logtest? (-> self options) 256) - (tracking-spline-method-21 - (-> self position-spline) - (-> self trans) - (the-as float 102.4) - (the-as float 2457.6) - ) - ) - (else - (tracking-spline-method-21 - (-> self position-spline) - (-> self trans) - (the-as float 20.48) - (the-as float 2457.6) - ) - ) - ) - ) + (tracking-spline-method-21 (-> self position-spline) (-> self trans) (the-as float 102.4) (the-as float 2457.6))) + (else (tracking-spline-method-21 (-> self position-spline) (-> self trans) (the-as float 20.48) (the-as float 2457.6))))) (defbehavior set-string-parms camera-slave () (when (not (-> self string-val-locked)) (set! (-> self string-min-val quad) (-> *camera* string-min value quad)) - (let ((v0-0 (-> self string-max-val))) - (set! (-> v0-0 quad) (-> *camera* string-max value quad)) - v0-0 - ) - ) - ) + (let ((v0-0 (-> self string-max-val))) (set! (-> v0-0 quad) (-> *camera* string-max value quad)) v0-0))) (defstate cam-string (camera-slave) - :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (case message - (('teleport) - (let ((gp-0 (new-stack-vector0))) - (cam-string-find-position-rel! gp-0) - (cam-string-set-position-rel! gp-0) - ) - ) - (('joystick) - (set! (-> self phony-joystick-x) (the-as float (-> block param 0))) - (set! (-> self phony-joystick-y) (the-as float (-> block param 1))) - (let ((v0-1 (the-as object #t))) - (set! (-> self have-phony-joystick) (the-as symbol v0-1)) - v0-1 - ) - ) - (('set-dist) - (cond - ((-> block param 0) - (set! (-> self string-val-locked) #t) - (set! (-> self string-min-val quad) (-> (the-as vector (-> block param 0)) quad)) - (set! (-> self string-max-val quad) (-> (the-as vector (-> block param 1)) quad)) - (set! (-> self string-max-val x) (fmax (-> self string-max-val x) (-> self string-min-val x))) - (set! (-> self string-max-val y) (fmax (-> self string-max-val y) (-> self string-min-val y))) - (set! (-> self string-max-val z) (fmax (-> self string-max-val z) (-> self string-min-val z))) - ) - (else - (set! (-> self string-val-locked) #f) - #f - ) - ) - ) - (('blocked-side?) - (-> self los-state) - ) - (else - (cam-standard-event-handler proc argc message block) - ) - ) - ) - :enter (behavior () - (when (not (-> self enter-has-run)) - (set-string-parms) - (set! *camera-base-mode* cam-string) - (set! (-> self string-vel-dir) (the-as uint 0)) - (set! (-> self fov) 11650.845) - (set! (-> self los-tgt-spline-pt) (-> *camera* target-spline end-point)) - (set! (-> self los-tgt-spline-pt-incarnation) - (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation) - ) - (set! (-> self min-z-override) (-> self string-max-val z)) - (if (!= (-> *camera* outro-t-step) 0.0) - (set! (-> self min-z-override) (-> self string-min-val z)) - ) - (let ((gp-0 (new-stack-vector0))) - 0.0 - (set! (-> self view-off-param) (-> *camera* view-off-param-save)) - (set! (-> self view-off x) 0.0) - (let ((f0-7 (-> self string-min-val y)) - (f1-1 (-> self string-max-val y)) - ) - (set! (-> self view-off y) (lerp f0-7 f1-1 (-> self view-off-param))) - ) - (set! (-> self view-off z) - (lerp (-> self string-min-val z) (-> self string-max-val z) (-> self view-off-param)) - ) - (let ((f30-0 (cond - ((!= (-> *camera* outro-t-step) 0.0) - (curve-get-pos! gp-0 (-> *camera* outro-exit-value) (-> *camera* outro-curve)) - (vector-! gp-0 gp-0 (-> *camera* tpos-curr-adj)) - (vector-flatten! (-> self view-flat) gp-0 (-> *camera* local-down)) - (vector-length (-> self view-flat)) - ) - (else - (vector-flatten! (-> self view-flat) (-> self tracking inv-mat vector 2) (-> *camera* local-down)) - (vector-negate! (-> self view-flat) (-> self view-flat)) - 0.0 - ) - ) - ) - ) - (let ((f1-4 (fmin (-> *camera* string-push-z) (-> self min-z-override))) - (f0-17 (-> self view-off z)) - ) - (cond - ((< f30-0 f1-4) - (set! f30-0 f1-4) - ) - ((< f0-17 f30-0) - (set! f30-0 f0-17) - ) - ) - ) - (vector-normalize! (-> self view-flat) f30-0) - (let ((f30-1 (/ (- f30-0 (-> self string-min-val z)) (- (-> self string-max-val z) (-> self string-min-val z))))) - (if (< 1.0 f30-1) - (set! f30-1 1.0) - ) - (if (< f30-1 0.0) - (set! f30-1 0.0) - ) - (let ((f0-22 (-> self string-min-val y)) - (f1-7 (-> self string-max-val y)) - ) - (set! (-> self view-off y) (lerp f0-22 f1-7 f30-1)) - ) - (set! (-> self view-off z) (lerp (-> self string-min-val z) (-> self string-max-val z) f30-1)) - ) - ) - ) - (vector--float*! - (-> self desired-pos) - (-> self view-flat) - (-> *camera* local-down) - (+ (-> *camera* target-height) (-> self view-off y)) - ) - (vector+! (-> self desired-pos) (-> self desired-pos) (-> *camera* tpos-curr-adj)) - (set! (-> self string-trans quad) (-> self desired-pos quad)) - (vector-reset! (-> self velocity)) - (let ((s4-0 (new 'stack-no-clear 'collide-tri-result)) - (s5-0 (new 'stack-no-clear 'vector)) - (gp-1 (new 'stack-no-clear 'vector)) - ) - (vector--float*! s5-0 (-> *camera* tpos-curr-adj) (-> *camera* local-down) (-> *camera* target-height)) - (vector-! gp-1 (-> self string-trans) s5-0) - (let ((f0-31 (fill-and-probe-using-line-sphere - *collide-cache* - s5-0 - gp-1 - (-> *CAMERA-bank* collide-move-rad) - (collide-kind background cak-3 wall-object ground-object cak-14) - (the-as process #f) - s4-0 - (new 'static 'pat-surface :nocamera #x1 :nolineofsight #x1) - ) - ) - ) - (when (and (< 0.0 f0-31) (< f0-31 1.0)) - (vector-float*! gp-1 gp-1 f0-31) - (vector-flatten! (-> self view-flat) gp-1 (-> *camera* local-down)) - (let ((f0-32 (vector-length (-> self view-flat)))) - (cond - ((< f0-32 8192.0) - (let ((gp-2 (new-stack-vector0))) - (cam-string-find-position-rel! gp-2) - (cam-string-set-position-rel! gp-2) - ) - ) - (else - (if (< f0-32 (-> self min-z-override)) - (set! (-> self min-z-override) f0-32) - ) - (let ((f30-2 (/ (- f0-32 (-> self string-min-val z)) (- (-> self string-max-val z) (-> self string-min-val z))))) - (if (< 1.0 f30-2) - (set! f30-2 1.0) - ) - (if (< f30-2 0.0) - (set! f30-2 0.0) - ) - (let ((f0-36 (-> self string-min-val y)) - (f1-16 (-> self string-max-val y)) - ) - (set! (-> self view-off y) (lerp f0-36 f1-16 f30-2)) - ) - (set! (-> self view-off z) (lerp (-> self string-min-val z) (-> self string-max-val z) f30-2)) - ) - (vector--float*! - (-> self desired-pos) - (-> self view-flat) - (-> *camera* local-down) - (+ (-> *camera* target-height) (-> self view-off y)) - ) - (vector+! (-> self desired-pos) (-> self desired-pos) (-> *camera* tpos-curr-adj)) - (set! (-> self string-trans quad) (-> self desired-pos quad)) - (vector-reset! (-> self velocity)) - ) - ) - ) - ) - ) - ) - (set! (-> self trans quad) (-> self string-trans quad)) - (set! (-> self los-last-pos quad) (-> self string-trans quad)) - (tracking-spline-method-10 (-> self position-spline) (-> self string-trans)) - (set! (-> self blend-from-type) (the-as uint 2)) - (set! (-> self blend-to-type) (the-as uint 2)) - ) - ) - :trans (behavior () - (if (not (logtest? (-> *camera* master-options) 2)) - (cam-slave-go cam-free-floating) - ) - ) - :code (behavior () - (loop - (when (not (paused?)) + :event + (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('teleport) (let ((gp-0 (new-stack-vector0))) (cam-string-find-position-rel! gp-0) (cam-string-set-position-rel! gp-0))) + (('joystick) + (set! (-> self phony-joystick-x) (the-as float (-> block param 0))) + (set! (-> self phony-joystick-y) (the-as float (-> block param 1))) + (let ((v0-1 (the-as object #t))) (set! (-> self have-phony-joystick) (the-as symbol v0-1)) v0-1)) + (('set-dist) + (cond + ((-> block param 0) + (set! (-> self string-val-locked) #t) + (set! (-> self string-min-val quad) (-> (the-as vector (-> block param 0)) quad)) + (set! (-> self string-max-val quad) (-> (the-as vector (-> block param 1)) quad)) + (set! (-> self string-max-val x) (fmax (-> self string-max-val x) (-> self string-min-val x))) + (set! (-> self string-max-val y) (fmax (-> self string-max-val y) (-> self string-min-val y))) + (set! (-> self string-max-val z) (fmax (-> self string-max-val z) (-> self string-min-val z)))) + (else (set! (-> self string-val-locked) #f) #f))) + (('blocked-side?) (-> self los-state)) + (else (cam-standard-event-handler proc argc message block)))) + :enter + (behavior () + (when (not (-> self enter-has-run)) (set-string-parms) - (cam-string-code) - (tracking-spline-method-9 (-> self position-spline)) - (set! (-> self have-phony-joystick) #f) - ) - (suspend) - ) - ) - ) + (set! *camera-base-mode* cam-string) + (set! (-> self string-vel-dir) (the-as uint 0)) + (set! (-> self fov) 11650.845) + (set! (-> self los-tgt-spline-pt) (-> *camera* target-spline end-point)) + (set! (-> self los-tgt-spline-pt-incarnation) (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation)) + (set! (-> self min-z-override) (-> self string-max-val z)) + (if (!= (-> *camera* outro-t-step) 0.0) (set! (-> self min-z-override) (-> self string-min-val z))) + (let ((gp-0 (new-stack-vector0))) + 0.0 + (set! (-> self view-off-param) (-> *camera* view-off-param-save)) + (set! (-> self view-off x) 0.0) + (let ((f0-7 (-> self string-min-val y)) + (f1-1 (-> self string-max-val y))) + (set! (-> self view-off y) (lerp f0-7 f1-1 (-> self view-off-param)))) + (set! (-> self view-off z) (lerp (-> self string-min-val z) (-> self string-max-val z) (-> self view-off-param))) + (let ((f30-0 (cond + ((!= (-> *camera* outro-t-step) 0.0) + (curve-get-pos! gp-0 (-> *camera* outro-exit-value) (-> *camera* outro-curve)) + (vector-! gp-0 gp-0 (-> *camera* tpos-curr-adj)) + (vector-flatten! (-> self view-flat) gp-0 (-> *camera* local-down)) + (vector-length (-> self view-flat))) + (else + (vector-flatten! (-> self view-flat) (-> self tracking inv-mat vector 2) (-> *camera* local-down)) + (vector-negate! (-> self view-flat) (-> self view-flat)) + 0.0)))) + (let ((f1-4 (fmin (-> *camera* string-push-z) (-> self min-z-override))) + (f0-17 (-> self view-off z))) + (cond + ((< f30-0 f1-4) (set! f30-0 f1-4)) + ((< f0-17 f30-0) (set! f30-0 f0-17)))) + (vector-normalize! (-> self view-flat) f30-0) + (let ((f30-1 (/ (- f30-0 (-> self string-min-val z)) (- (-> self string-max-val z) (-> self string-min-val z))))) + (if (< 1.0 f30-1) (set! f30-1 1.0)) + (if (< f30-1 0.0) (set! f30-1 0.0)) + (let ((f0-22 (-> self string-min-val y)) + (f1-7 (-> self string-max-val y))) + (set! (-> self view-off y) (lerp f0-22 f1-7 f30-1))) + (set! (-> self view-off z) (lerp (-> self string-min-val z) (-> self string-max-val z) f30-1))))) + (vector--float*! (-> self desired-pos) + (-> self view-flat) + (-> *camera* local-down) + (+ (-> *camera* target-height) (-> self view-off y))) + (vector+! (-> self desired-pos) (-> self desired-pos) (-> *camera* tpos-curr-adj)) + (set! (-> self string-trans quad) (-> self desired-pos quad)) + (vector-reset! (-> self velocity)) + (let ((s4-0 (new 'stack-no-clear 'collide-tri-result)) + (s5-0 (new 'stack-no-clear 'vector)) + (gp-1 (new 'stack-no-clear 'vector))) + (vector--float*! s5-0 (-> *camera* tpos-curr-adj) (-> *camera* local-down) (-> *camera* target-height)) + (vector-! gp-1 (-> self string-trans) s5-0) + (let ((f0-31 (fill-and-probe-using-line-sphere *collide-cache* + s5-0 + gp-1 + (-> *CAMERA-bank* collide-move-rad) + (collide-kind background cak-3 wall-object ground-object cak-14) + (the-as process #f) + s4-0 + (new 'static 'pat-surface :nocamera #x1 :nolineofsight #x1)))) + (when (and (< 0.0 f0-31) (< f0-31 1.0)) + (vector-float*! gp-1 gp-1 f0-31) + (vector-flatten! (-> self view-flat) gp-1 (-> *camera* local-down)) + (let ((f0-32 (vector-length (-> self view-flat)))) + (cond + ((< f0-32 8192.0) + (let ((gp-2 (new-stack-vector0))) (cam-string-find-position-rel! gp-2) (cam-string-set-position-rel! gp-2))) + (else + (if (< f0-32 (-> self min-z-override)) (set! (-> self min-z-override) f0-32)) + (let ((f30-2 (/ (- f0-32 (-> self string-min-val z)) (- (-> self string-max-val z) (-> self string-min-val z))))) + (if (< 1.0 f30-2) (set! f30-2 1.0)) + (if (< f30-2 0.0) (set! f30-2 0.0)) + (let ((f0-36 (-> self string-min-val y)) + (f1-16 (-> self string-max-val y))) + (set! (-> self view-off y) (lerp f0-36 f1-16 f30-2))) + (set! (-> self view-off z) (lerp (-> self string-min-val z) (-> self string-max-val z) f30-2))) + (vector--float*! (-> self desired-pos) + (-> self view-flat) + (-> *camera* local-down) + (+ (-> *camera* target-height) (-> self view-off y))) + (vector+! (-> self desired-pos) (-> self desired-pos) (-> *camera* tpos-curr-adj)) + (set! (-> self string-trans quad) (-> self desired-pos quad)) + (vector-reset! (-> self velocity)))))))) + (set! (-> self trans quad) (-> self string-trans quad)) + (set! (-> self los-last-pos quad) (-> self string-trans quad)) + (tracking-spline-method-10 (-> self position-spline) (-> self string-trans)) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (the-as uint 2)))) + :trans + (behavior () + (if (not (logtest? (-> *camera* master-options) 2)) (cam-slave-go cam-free-floating))) + :code + (behavior () + (loop (when (not (paused?)) + (set-string-parms) + (cam-string-code) + (tracking-spline-method-9 (-> self position-spline)) + (set! (-> self have-phony-joystick) #f)) + (suspend)))) (deftype cam-stick-bank (basic) - ((max-z meters) - (min-z meters) - (max-y meters) - (min-y meters) - ) - ) - + ((max-z meters) + (min-z meters) + (max-y meters) + (min-y meters))) (define *CAM_STICK-bank* - (new 'static 'cam-stick-bank :max-z (meters 30) :min-z (meters 5) :max-y (meters 15) :min-y (meters 2)) - ) + (new 'static 'cam-stick-bank :max-z (meters 30) :min-z (meters 5) :max-y (meters 15) :min-y (meters 2))) (defbehavior cam-stick-code camera-slave () (cam-calc-follow! (-> self tracking) (-> self trans) #t) @@ -2915,306 +1724,195 @@ (vector-flatten! (-> self view-flat) (-> self view-flat) (-> *camera* local-down)) (vector-normalize! (-> self view-flat) (-> self view-off z)) (vector-! gp-0 (-> self view-flat) (vector-float*! gp-0 (-> *camera* local-down) (-> self view-off y))) - (vector+! (-> self desired-pos) (-> self tracking follow-pt) gp-0) - ) + (vector+! (-> self desired-pos) (-> self tracking follow-pt) gp-0)) (let ((v1-3 (new-stack-vector0)) - (gp-1 (new-stack-vector0)) - ) + (gp-1 (new-stack-vector0))) (vector-! v1-3 (-> self desired-pos) (-> self trans)) (vector-float*! v1-3 v1-3 0.2) (vector-! gp-1 v1-3 (-> self velocity)) - (if (< 409.6 (vector-length gp-1)) - (vector-normalize! gp-1 (the-as float 409.6)) - ) - (vector+! (-> self velocity) (-> self velocity) gp-1) - ) + (if (< 409.6 (vector-length gp-1)) (vector-normalize! gp-1 (the-as float 409.6))) + (vector+! (-> self velocity) (-> self velocity) gp-1)) 0.0 (let ((f30-1 1.0) (gp-2 (new-stack-vector0)) (s5-0 (new-stack-vector0)) (s4-0 4) - (s2-0 0) - ) + (s2-0 0)) (let ((s3-0 (new 'stack-no-clear 'collide-tri-result))) - (while (and (< 0.01 f30-1) - (and (< (-> *CAMERA-bank* min-detectable-velocity) (vector-length (-> self velocity))) (> s4-0 0)) - ) + (while (and (< 0.01 f30-1) (and (< (-> *CAMERA-bank* min-detectable-velocity) (vector-length (-> self velocity))) (> s4-0 0))) (+! s4-0 -1) (vector-float*! gp-2 (-> self velocity) f30-1) (let ((f28-0 (if (logtest? (-> self options) 32) - (fill-and-probe-using-line-sphere - *collide-cache* - (-> self trans) - gp-2 - (-> *CAMERA-bank* collide-move-rad) - (collide-kind background cak-3 wall-object ground-object cak-14) - (the-as process #f) - s3-0 - (new 'static 'pat-surface :nocamera #x1) - ) - -100000000.0 - ) - ) - ) + (fill-and-probe-using-line-sphere *collide-cache* + (-> self trans) + gp-2 + (-> *CAMERA-bank* collide-move-rad) + (collide-kind background cak-3 wall-object ground-object cak-14) + (the-as process #f) + s3-0 + (new 'static 'pat-surface :nocamera #x1)) + -100000000.0))) (cond ((>= f28-0 0.0) (vector+float*! (-> self trans) (-> self trans) gp-2 f28-0) (set! (-> s5-0 quad) (-> s3-0 normal quad)) (vector-flatten! (-> self velocity) (-> self velocity) s5-0) (set! f30-1 (- f30-1 (* f30-1 f28-0))) - (set! s2-0 1) - ) - (else - (vector+! (-> self trans) (-> self trans) gp-2) - (set! f30-1 0.0) - ) - ) - ) - ) - ) + (set! s2-0 1)) + (else (vector+! (-> self trans) (-> self trans) gp-2) (set! f30-1 0.0)))))) (when (nonzero? s2-0) 0 (let ((gp-3 (new-stack-vector0))) 0.0 (vector-! gp-3 (-> self trans) (-> self tracking follow-pt)) (vector-flatten! gp-3 gp-3 (-> *camera* local-down)) - (let ((f0-14 (/ (- (vector-length gp-3) (-> *CAM_STICK-bank* min-z)) - (- (-> *CAM_STICK-bank* max-z) (-> *CAM_STICK-bank* min-z)) - ) - ) - ) + (let ((f0-14 (/ (- (vector-length gp-3) (-> *CAM_STICK-bank* min-z)) (- (-> *CAM_STICK-bank* max-z) (-> *CAM_STICK-bank* min-z))))) (cond - ((< f0-14 0.0) - (set! f0-14 0.0) - ) - ((< 1.0 f0-14) - (set! f0-14 1.0) - ) - ) + ((< f0-14 0.0) (set! f0-14 0.0)) + ((< 1.0 f0-14) (set! f0-14 1.0))) (cond - ((< (- f0-14 (-> self view-off-param)) -0.001) - (set! (-> self view-off-param) f0-14) - ) - ((< 0.001 (- f0-14 (-> self view-off-param))) - (vector-normalize-copy! (-> self view-flat) gp-3 (-> self view-off z)) - ) - ) - ) - ) - ) - ) + ((< (- f0-14 (-> self view-off-param)) -0.001) (set! (-> self view-off-param) f0-14)) + ((< 0.001 (- f0-14 (-> self view-off-param))) (vector-normalize-copy! (-> self view-flat) gp-3 (-> self view-off z)))))))) (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self options)) (-> self fov) #t) - (none) - ) + (none)) ;; third person camera (in debug menu, and fishermans-boat-player-control w/o autopilot?) (defstate cam-stick (camera-slave) :event cam-standard-event-handler - :enter (behavior () - (when (not (-> self enter-has-run)) - (set! (-> self view-off-param) (-> *camera* view-off-param-save)) - (set! (-> self view-off x) 0.0) - (set! (-> self view-off y) - (lerp (-> *CAM_STICK-bank* min-y) (-> *CAM_STICK-bank* max-y) (-> self view-off-param)) - ) - (set! (-> self view-off z) - (lerp (-> *CAM_STICK-bank* min-z) (-> *CAM_STICK-bank* max-z) (-> self view-off-param)) - ) - (cam-calc-follow! (-> self tracking) (-> self trans) #f) - (vector-flatten! (-> self view-flat) (-> self tracking inv-mat vector 2) (-> *camera* local-down)) - (vector-negate! (-> self view-flat) (-> self view-flat)) - (vector-normalize! (-> self view-flat) (-> self view-off z)) - (vector--float*! (-> self desired-pos) (-> self view-flat) (-> *camera* local-down) (-> self view-off y)) - (vector+! (-> self desired-pos) (-> self desired-pos) (-> self tracking follow-pt)) - (set! (-> self trans quad) (-> self desired-pos quad)) - (vector-reset! (-> self velocity)) - (set! (-> self blend-from-type) (the-as uint 2)) - (set! (-> self blend-to-type) (the-as uint 2)) - (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self options)) (-> self fov) #f) - ) - ) - :trans (behavior () - (if (not (logtest? (-> *camera* master-options) 2)) - (cam-slave-go cam-free-floating) - ) - (when (not (paused?)) - (when *camera-read-analog* - (let ((f0-0 - (analog-input-vertical-third ;; og:preserve-this changed for pc port - (the-as int (-> *cpad-list* cpads 0 righty)) - (the-as float 128.0) - (the-as float 32.0) - (the-as float 110.0) - (the-as float 0.05) - ) - ) - ) - (cond - ((< (* 0.05 (- 1.0 (-> self view-off-param))) f0-0) - (+! (-> self view-off-param) (* 0.05 (- 1.0 (-> self view-off-param)))) - ) - ((< f0-0 (* 0.05 (- (-> self view-off-param)))) - (+! (-> self view-off-param) (* 0.05 (- (-> self view-off-param)))) - ) - (else - (+! (-> self view-off-param) f0-0) - ) - ) - ) - ) - (set! (-> self view-off y) - (lerp (-> *CAM_STICK-bank* min-y) (-> *CAM_STICK-bank* max-y) (-> self view-off-param)) - ) - (set! (-> self view-off z) - (lerp (-> *CAM_STICK-bank* min-z) (-> *CAM_STICK-bank* max-z) (-> self view-off-param)) - ) - (when *camera-read-analog* - (let ((f0-16 (analog-input-horizontal-third ;; og:preserve-this changed for pc port - (the-as int (-> *cpad-list* cpads 0 rightx)) - (the-as float 128.0) - (the-as float 32.0) - (the-as float 110.0) - (* 21845.334 (seconds-per-frame)) - ) - ) - (gp-0 (new-stack-matrix0)) - (s3-0 (new-stack-vector0)) - (s5-0 (new-stack-vector0)) - (s4-0 (new-stack-vector0)) - ) - (cond - ((!= f0-16 0.0) - (matrix-axis-angle! gp-0 (-> *camera* local-down) f0-16) - (vector-matrix*! (-> self view-flat) (-> self view-flat) gp-0) - ) - ((logtest? (-> self options) 1) - (set-vector! s5-0 0.0 0.0 1.0 1.0) - (vector-normalize-copy! s5-0 (-> self view-flat) (the-as float 1.0)) - (set! (-> s3-0 quad) (-> *camera* tgt-rot-mat vector 2 quad)) - (vector-flatten! s3-0 s3-0 (-> *camera* local-down)) - (vector-negate! s3-0 s3-0) - (set! (-> s4-0 quad) (-> s5-0 quad)) - (vector-normalize-copy! s4-0 s3-0 (the-as float 1.0)) - (matrix-from-two-vectors-max-angle-partial! - gp-0 - s5-0 - s4-0 - (* 10922.667 (seconds-per-frame)) - (the-as float 0.05) - ) - (vector-matrix*! (-> self view-flat) (-> self view-flat) gp-0) - ) - ) - ) - ) - ) - ) - :code (behavior () - (loop - (if (not (paused?)) - (cam-stick-code) - ) - (suspend) - ) - ) - ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self view-off-param) (-> *camera* view-off-param-save)) + (set! (-> self view-off x) 0.0) + (set! (-> self view-off y) (lerp (-> *CAM_STICK-bank* min-y) (-> *CAM_STICK-bank* max-y) (-> self view-off-param))) + (set! (-> self view-off z) (lerp (-> *CAM_STICK-bank* min-z) (-> *CAM_STICK-bank* max-z) (-> self view-off-param))) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (vector-flatten! (-> self view-flat) (-> self tracking inv-mat vector 2) (-> *camera* local-down)) + (vector-negate! (-> self view-flat) (-> self view-flat)) + (vector-normalize! (-> self view-flat) (-> self view-off z)) + (vector--float*! (-> self desired-pos) (-> self view-flat) (-> *camera* local-down) (-> self view-off y)) + (vector+! (-> self desired-pos) (-> self desired-pos) (-> self tracking follow-pt)) + (set! (-> self trans quad) (-> self desired-pos quad)) + (vector-reset! (-> self velocity)) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (the-as uint 2)) + (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self options)) (-> self fov) #f))) + :trans + (behavior () + (if (not (logtest? (-> *camera* master-options) 2)) (cam-slave-go cam-free-floating)) + (when (not (paused?)) + (when *camera-read-analog* + (let ((f0-0 (analog-input-vertical-third ;; og:preserve-this changed for pc port + (the-as int (-> *cpad-list* cpads 0 righty)) + (the-as float 128.0) + (the-as float 32.0) + (the-as float 110.0) + (the-as float 0.05)))) + (cond + ((< (* 0.05 (- 1.0 (-> self view-off-param))) f0-0) + (+! (-> self view-off-param) (* 0.05 (- 1.0 (-> self view-off-param))))) + ((< f0-0 (* 0.05 (- (-> self view-off-param)))) (+! (-> self view-off-param) (* 0.05 (- (-> self view-off-param))))) + (else (+! (-> self view-off-param) f0-0))))) + (set! (-> self view-off y) (lerp (-> *CAM_STICK-bank* min-y) (-> *CAM_STICK-bank* max-y) (-> self view-off-param))) + (set! (-> self view-off z) (lerp (-> *CAM_STICK-bank* min-z) (-> *CAM_STICK-bank* max-z) (-> self view-off-param))) + (when *camera-read-analog* + (let ((f0-16 (analog-input-horizontal-third ;; og:preserve-this changed for pc port + (the-as int (-> *cpad-list* cpads 0 rightx)) + (the-as float 128.0) + (the-as float 32.0) + (the-as float 110.0) + (* 21845.334 (seconds-per-frame)))) + (gp-0 (new-stack-matrix0)) + (s3-0 (new-stack-vector0)) + (s5-0 (new-stack-vector0)) + (s4-0 (new-stack-vector0))) + (cond + ((!= f0-16 0.0) + (matrix-axis-angle! gp-0 (-> *camera* local-down) f0-16) + (vector-matrix*! (-> self view-flat) (-> self view-flat) gp-0)) + ((logtest? (-> self options) 1) + (set-vector! s5-0 0.0 0.0 1.0 1.0) + (vector-normalize-copy! s5-0 (-> self view-flat) (the-as float 1.0)) + (set! (-> s3-0 quad) (-> *camera* tgt-rot-mat vector 2 quad)) + (vector-flatten! s3-0 s3-0 (-> *camera* local-down)) + (vector-negate! s3-0 s3-0) + (set! (-> s4-0 quad) (-> s5-0 quad)) + (vector-normalize-copy! s4-0 s3-0 (the-as float 1.0)) + (matrix-from-two-vectors-max-angle-partial! gp-0 s5-0 s4-0 (* 10922.667 (seconds-per-frame)) (the-as float 0.05)) + (vector-matrix*! (-> self view-flat) (-> self view-flat) gp-0))))))) + :code + (behavior () + (loop (if (not (paused?)) (cam-stick-code)) + (suspend)))) (deftype cam-bike-bank (basic) - ((max-z meters) - (min-z meters) - (max-y meters) - (min-y meters) - ) - ) - + ((max-z meters) + (min-z meters) + (max-y meters) + (min-y meters))) (define *CAM_BIKE-bank* - (new 'static 'cam-bike-bank :max-z (meters 6) :min-z (meters 10) :max-y (meters 3) :min-y (meters 5)) - ) + (new 'static 'cam-bike-bank :max-z (meters 6) :min-z (meters 10) :max-y (meters 3) :min-y (meters 5))) (defbehavior cam-calc-bike-follow! camera-slave ((arg0 cam-rotation-tracker) (arg1 vector) (arg2 symbol)) (vector-float*! (-> arg0 follow-off) (-> *camera* tgt-face-mat vector 2) 155648.0) (vector+! (-> arg0 follow-pt) (-> *camera* tpos-curr-adj) (-> arg0 follow-off)) - (vector--float*! - (-> arg0 follow-pt) - (-> arg0 follow-pt) - (-> *camera* local-down) - (+ 12288.0 (-> *camera* target-height)) - ) - (-> arg0 follow-pt) - ) + (vector--float*! (-> arg0 follow-pt) + (-> arg0 follow-pt) + (-> *camera* local-down) + (+ 12288.0 (-> *camera* target-height))) + (-> arg0 follow-pt)) (defbehavior cam-bike-code camera-slave () (let ((s4-0 (new-stack-matrix0))) (let ((gp-0 (new-stack-vector0)) - (s5-0 (new-stack-vector0)) - ) + (s5-0 (new-stack-vector0))) (vector-normalize-copy! gp-0 (-> self view-flat) (the-as float 1.0)) (vector-flatten! s5-0 (-> *camera* tgt-rot-mat vector 2) (-> *camera* local-down)) (vector-normalize! s5-0 (the-as float -1.0)) - (matrix-from-two-vectors-partial-linear! s4-0 gp-0 s5-0 (the-as float 0.2)) - ) - (vector-matrix*! (-> self view-flat) (-> self view-flat) s4-0) - ) + (matrix-from-two-vectors-partial-linear! s4-0 gp-0 s5-0 (the-as float 0.2))) + (vector-matrix*! (-> self view-flat) (-> self view-flat) s4-0)) (let ((gp-1 (new-stack-vector0))) 0.0 (vector-! gp-1 (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj)) (let ((f30-0 (vector-length gp-1))) - (set! (-> self view-off z) (lerp-clamp - (-> *CAM_BIKE-bank* max-z) - (-> *CAM_BIKE-bank* min-z) - (parameter-ease-sin-clamp (* 0.00081380206 (+ -409.6 f30-0))) - ) - ) - (set! (-> self view-off y) (lerp-clamp - (-> *CAM_BIKE-bank* max-y) - (-> *CAM_BIKE-bank* min-y) - (parameter-ease-sin-clamp (* 0.00081380206 (+ -409.6 f30-0))) - ) - ) - ) + (set! (-> self view-off z) + (lerp-clamp (-> *CAM_BIKE-bank* max-z) + (-> *CAM_BIKE-bank* min-z) + (parameter-ease-sin-clamp (* 0.00081380206 (+ -409.6 f30-0))))) + (set! (-> self view-off y) + (lerp-clamp (-> *CAM_BIKE-bank* max-y) + (-> *CAM_BIKE-bank* min-y) + (parameter-ease-sin-clamp (* 0.00081380206 (+ -409.6 f30-0)))))) (vector-flatten! (-> self view-flat) (-> self view-flat) (-> *camera* local-down)) (vector-normalize! (-> self view-flat) (-> self view-off z)) (vector-! gp-1 (-> self view-flat) (vector-float*! gp-1 (-> *camera* local-down) (-> self view-off y))) - (vector+! (-> self desired-pos) (-> *camera* tpos-curr-adj) gp-1) - ) + (vector+! (-> self desired-pos) (-> *camera* tpos-curr-adj) gp-1)) (let ((v1-20 (new-stack-vector0)) - (gp-2 (new-stack-vector0)) - ) + (gp-2 (new-stack-vector0))) (vector-! v1-20 (-> self desired-pos) (-> self trans)) (vector-float*! v1-20 v1-20 0.2) (vector-! gp-2 v1-20 (-> self velocity)) - (if (< 409.6 (vector-length gp-2)) - (vector-normalize! gp-2 (the-as float 409.6)) - ) - (vector+! (-> self velocity) (-> self velocity) gp-2) - ) + (if (< 409.6 (vector-length gp-2)) (vector-normalize! gp-2 (the-as float 409.6))) + (vector+! (-> self velocity) (-> self velocity) gp-2)) 0.0 (let ((f30-2 1.0) (gp-3 (new-stack-vector0)) (s5-3 4) - (s4-3 (new 'stack-no-clear 'collide-tri-result)) - ) - (while (and (< 0.01 f30-2) - (and (< (-> *CAMERA-bank* min-detectable-velocity) (vector-length (-> self velocity))) (> s5-3 0)) - ) + (s4-3 (new 'stack-no-clear 'collide-tri-result))) + (while (and (< 0.01 f30-2) (and (< (-> *CAMERA-bank* min-detectable-velocity) (vector-length (-> self velocity))) (> s5-3 0))) (+! s5-3 -1) (vector-float*! gp-3 (-> self velocity) f30-2) (let ((f28-0 (if (logtest? (-> self options) 32) - (fill-and-probe-using-line-sphere - *collide-cache* - (-> self trans) - gp-3 - (the-as float 4096.0) - (collide-kind background cak-3 wall-object ground-object cak-14) - (the-as process #f) - s4-3 - (new 'static 'pat-surface :nocamera #x1) - ) - -100000000.0 - ) - ) - ) + (fill-and-probe-using-line-sphere *collide-cache* + (-> self trans) + gp-3 + (the-as float 4096.0) + (collide-kind background cak-3 wall-object ground-object cak-14) + (the-as process #f) + s4-3 + (new 'static 'pat-surface :nocamera #x1)) + -100000000.0))) (cond ((>= f28-0 0.0) (vector+float*! (-> self trans) (-> self trans) gp-3 f28-0) @@ -3223,57 +1921,39 @@ (let ((s3-2 (new-stack-vector0))) (vector-! s3-2 (-> self trans) (-> *camera* tpos-curr-adj)) (vector-flatten! s3-2 s3-2 (-> *camera* local-down)) - (vector-normalize-copy! (-> self view-flat) s3-2 (-> self view-off z)) - ) - ) - (else - (vector+! (-> self trans) (-> self trans) gp-3) - (set! f30-2 0.0) - ) - ) - ) - ) - ) + (vector-normalize-copy! (-> self view-flat) s3-2 (-> self view-off z)))) + (else (vector+! (-> self trans) (-> self trans) gp-3) (set! f30-2 0.0)))))) (cam-calc-bike-follow! (-> self tracking) (-> self trans) #t) (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self options)) (-> self fov) #t) - (none) - ) + (none)) (defstate cam-bike (camera-slave) :event cam-standard-event-handler - :enter (behavior () - (when (not (-> self enter-has-run)) - (set! (-> *camera* foot-offset) 4096.0) - (set! (-> *camera* head-offset) 16384.0) - (set! (-> self view-off x) 0.0) - (set! (-> self view-off y) (-> *CAM_BIKE-bank* max-y)) - (set! (-> self view-off z) (-> *CAM_BIKE-bank* max-z)) - (vector-flatten! (-> self view-flat) (-> self tracking inv-mat vector 2) (-> *camera* local-down)) - (vector-negate! (-> self view-flat) (-> self view-flat)) - (vector-normalize! (-> self view-flat) (-> self view-off z)) - (vector--float*! (-> self desired-pos) (-> self view-flat) (-> *camera* local-down) (-> self view-off y)) - (vector+! (-> self desired-pos) (-> self desired-pos) (-> *camera* tpos-curr-adj)) - (set! (-> self trans quad) (-> self desired-pos quad)) - (vector-reset! (-> self velocity)) - (set! (-> self blend-from-type) (the-as uint 0)) - (set! (-> self blend-to-type) (the-as uint 1)) - (cam-calc-bike-follow! (-> self tracking) (-> self trans) #f) - (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self options)) (-> self fov) #f) - ) - ) - :trans (behavior () - (if (not (logtest? (-> *camera* master-options) 2)) - (cam-slave-go cam-free-floating) - ) - ) - :code (behavior () - (loop - (if (not (paused?)) - (cam-bike-code) - ) - (suspend) - ) - ) - ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> *camera* foot-offset) 4096.0) + (set! (-> *camera* head-offset) 16384.0) + (set! (-> self view-off x) 0.0) + (set! (-> self view-off y) (-> *CAM_BIKE-bank* max-y)) + (set! (-> self view-off z) (-> *CAM_BIKE-bank* max-z)) + (vector-flatten! (-> self view-flat) (-> self tracking inv-mat vector 2) (-> *camera* local-down)) + (vector-negate! (-> self view-flat) (-> self view-flat)) + (vector-normalize! (-> self view-flat) (-> self view-off z)) + (vector--float*! (-> self desired-pos) (-> self view-flat) (-> *camera* local-down) (-> self view-off y)) + (vector+! (-> self desired-pos) (-> self desired-pos) (-> *camera* tpos-curr-adj)) + (set! (-> self trans quad) (-> self desired-pos quad)) + (vector-reset! (-> self velocity)) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (the-as uint 1)) + (cam-calc-bike-follow! (-> self tracking) (-> self trans) #f) + (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self options)) (-> self fov) #f))) + :trans + (behavior () + (if (not (logtest? (-> *camera* master-options) 2)) (cam-slave-go cam-free-floating))) + :code + (behavior () + (loop (if (not (paused?)) (cam-bike-code)) + (suspend)))) (define *camera-base-mode* cam-string) diff --git a/goal_src/jak1/engine/camera/cam-update-h.gc b/goal_src/jak1/engine/camera/cam-update-h.gc index cf765dd2da..c2d98f84f9 100644 --- a/goal_src/jak1/engine/camera/cam-update-h.gc +++ b/goal_src/jak1/engine/camera/cam-update-h.gc @@ -1,7 +1,6 @@ ;;-*-Lisp-*- (in-package goal) (bundles "ENGINE.CGO" "GAME.CGO") - (require "engine/math/matrix.gc") (require "engine/util/smush-control-h.gc") @@ -11,19 +10,25 @@ (defenum external-cam-option :bitfield #t - (allow-z 0) - ) + (allow-z 0)) (define *external-cam-options* (external-cam-option)) -(define *external-cam-mode* #f) -(define-perm *camera-look-through-other* int 0) -(define-perm *camera-other-fov* bfloat (new 'static 'bfloat :data 11650.845)) -(define-perm *camera-other-trans* vector (vector-reset! (new 'global 'vector))) -(define-perm *camera-other-matrix* matrix (matrix-identity! (new 'global 'matrix))) -(define-perm *camera-smush-control* smush-control (set-zero! (new 'global 'smush-control))) -(define-perm *camera-other-root* vector (vector-reset! (new 'global 'vector))) +(define *external-cam-mode* #f) + +(define-perm *camera-look-through-other* int 0) + +(define-perm *camera-other-fov* bfloat (new 'static 'bfloat :data 11650.845)) + +(define-perm *camera-other-trans* vector (vector-reset! (new 'global 'vector))) + +(define-perm *camera-other-matrix* matrix (matrix-identity! (new 'global 'matrix))) + +(define-perm *camera-smush-control* smush-control (set-zero! (new 'global 'smush-control))) + +(define-perm *camera-other-root* vector (vector-reset! (new 'global 'vector))) ;; TODO - actually defined in cam-states-dbg (define-extern cam-free-floating-move (function matrix vector vector int vector)) + (define-extern cam-free-floating-input (function vector vector symbol int vector)) diff --git a/goal_src/jak1/engine/camera/cam-update.gc b/goal_src/jak1/engine/camera/cam-update.gc index 828088361e..3fb6c35ea9 100644 --- a/goal_src/jak1/engine/camera/cam-update.gc +++ b/goal_src/jak1/engine/camera/cam-update.gc @@ -1,7 +1,6 @@ ;;-*-Lisp-*- (in-package goal) (bundles "ENGINE.CGO" "GAME.CGO") - (require "engine/gfx/tie/tie-h.gc") (require "engine/level/bsp-h.gc") (require "engine/gfx/math-camera.gc") @@ -28,10 +27,8 @@ (set! (-> (&-> arg0 0 data arg4) 0) (-> s4-0 x)) (set! (-> (&-> arg0 0 data arg4) 4) (-> s4-0 y)) (set! (-> (&-> arg0 0 data arg4) 8) (-> s4-0 z)) - (set! (-> (&-> arg0 0 data arg4) 12) (-> s4-0 w)) - ) - (none) - ) + (set! (-> (&-> arg0 0 data arg4) 12) (-> s4-0 w))) + (none)) (defun set-point ((arg0 vector) (arg1 float) (arg2 float) (arg3 float)) "Set a vector to an xyz point (sets w = 1.0)" @@ -39,8 +36,7 @@ (set! (-> arg0 y) arg2) (set! (-> arg0 z) arg3) (set! (-> arg0 w) 1.0) - (none) - ) + (none)) (defun update-view-planes ((arg0 math-camera) (arg1 (inline-array plane)) (arg2 float)) "Compute the frustum planes from the given camera." @@ -50,8 +46,7 @@ (let ((f30-0 (* arg2 (-> arg0 x-ratio) (-> arg0 d))) (f26-0 (* arg2 (-> arg0 y-ratio) (-> arg0 d))) (f28-0 (* arg2 (-> arg0 x-ratio) (-> arg0 f))) - (f24-0 (* arg2 (-> arg0 y-ratio) (-> arg0 f))) - ) + (f24-0 (* arg2 (-> arg0 y-ratio) (-> arg0 f)))) (set-point (-> s5-0 hither-top-left) (- f30-0) f26-0 (-> arg0 d)) (set-point (-> s5-0 hither-top-right) f30-0 f26-0 (-> arg0 d)) (set-point (-> s5-0 hither-bottom-left) (- f30-0) (- f26-0) (-> arg0 d)) @@ -59,8 +54,7 @@ (set-point (-> s5-0 yon-top-left) (- f28-0) f24-0 (-> arg0 f)) (set-point (-> s5-0 yon-top-right) f28-0 f24-0 (-> arg0 f)) (set-point (-> s5-0 yon-bottom-left) (- f28-0) (- f24-0) (-> arg0 f)) - (set-point (-> s5-0 yon-bottom-right) f28-0 (- f24-0) (-> arg0 f)) - ) + (set-point (-> s5-0 yon-bottom-right) f28-0 (- f24-0) (-> arg0 f))) (vector-matrix*! (-> s5-0 hither-top-left) (-> s5-0 hither-top-left) (-> arg0 inv-camera-rot)) (vector-matrix*! (-> s5-0 hither-top-right) (-> s5-0 hither-top-right) (-> arg0 inv-camera-rot)) (vector-matrix*! (-> s5-0 hither-bottom-left) (-> s5-0 hither-bottom-left) (-> arg0 inv-camera-rot)) @@ -72,14 +66,11 @@ (let ((s2-0 (new-stack-vector0)) (s3-1 (new-stack-vector0)) (s1-0 (new-stack-vector0)) - (s0-0 (new-stack-vector0)) - ) + (s0-0 (new-stack-vector0))) (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) (set! sv-240 (new 'stack-no-clear 'vector)) (set! (-> sv-240 quad) (the-as uint128 0)) - (let ((v1-5 (-> arg0 inv-camera-rot vector 3 quad))) - (set! (-> sv-240 quad) v1-5) - ) + (let ((v1-5 (-> arg0 inv-camera-rot vector 3 quad))) (set! (-> sv-240 quad) v1-5)) (vector-! s2-0 (-> s5-0 yon-top-left) sv-240) (vector-! s3-1 (-> s5-0 yon-top-right) sv-240) (vector-! s1-0 (-> s5-0 yon-bottom-left) sv-240) @@ -88,15 +79,9 @@ (plane-from-points arg1 s0-0 s3-1 sv-240 1) (plane-from-points arg1 s3-1 s2-0 sv-240 2) (let ((t9-20 plane-from-points) - (t0-3 3) - ) - (t9-20 arg1 s1-0 s0-0 sv-240 t0-3) - ) - ) - ) - ) - (none) - ) + (t0-3 3)) + (t9-20 arg1 s1-0 s0-0 sv-240 t0-3))))) + (none)) ;; if we should still attempt vis updates when outside of the bsp's boxes. (define *update-leaf-when-outside-bsp* #t) @@ -112,29 +97,17 @@ (dotimes (s5-0 (-> *level* length)) (let ((v1-4 (-> *level* level s5-0))) (when (= (-> v1-4 status) 'active) - (if (and (nonzero? (-> v1-4 bsp nodes)) - (or *update-leaf-when-outside-bsp* (-> v1-4 inside-boxes?)) - ) - ;; will store in the bsp's current-leaf-idx. - (bsp-camera-asm (-> v1-4 bsp) (-> arg0 trans)) - ) - ) - ) - ) - + (if (and (nonzero? (-> v1-4 bsp nodes)) (or *update-leaf-when-outside-bsp* (-> v1-4 inside-boxes?))) + ;; will store in the bsp's current-leaf-idx. + (bsp-camera-asm (-> v1-4 bsp) (-> arg0 trans)))))) ;; do vis updates. (dotimes (gp-1 (-> *level* length)) (let ((s5-1 (-> *level* level gp-1))) (when (= (-> s5-1 status) 'active) (let ((a2-0 (/ (+ (-> s5-1 bsp visible-list-length) 15) 16))) - ;; start by setting all-visible to something truthy (either original, or #t) ;; below, we'll try to figure out a way to get vis data and set this back to #f. - (set! (-> s5-1 all-visible?) (if (-> s5-1 all-visible?) - (-> s5-1 all-visible?) - #t - ) - ) + (set! (-> s5-1 all-visible?) (if (-> s5-1 all-visible?) (-> s5-1 all-visible?) #t)) (cond ((or (not (-> s5-1 force-all-visible?)) (-> s5-1 inside-boxes?)) ;; we are inside the level's bsp, we should attempt vis stuff. @@ -142,101 +115,57 @@ ((or *artist-all-visible* (zero? (-> s5-1 bsp nodes))) ;; we have no bsp, or manual override all visible. Copy the all vis list ;; to our vis string. - (quad-copy! (-> s5-1 vis-bits) (-> s5-1 bsp all-visible-list) a2-0) - ) + (quad-copy! (-> s5-1 vis-bits) (-> s5-1 bsp all-visible-list) a2-0)) ((begin ;; our vis info (set! s4-0 (-> s5-1 vis-info (-> s5-1 vis-self-index))) ;; adj vis info (idx will be 7 if there's no adj right now, and will give us #f) (set! s3-0 (-> s5-1 vis-info (-> s5-1 vis-adj-index))) - (let ((v1-32 #f)) ;; should use self vis (set! a0-16 #f) ;; should use adj vis - ;; see if we want self vis (when s4-0 (set! v1-32 (nonzero? (logand (shl #x8000 16) (-> s4-0 flags)))) - ;; not sure when this would happen, but make sure that our leaf ;; index is in bounds (maybe if you use the wrong version of levels) - (if (< (-> s4-0 length) (-> s4-0 from-bsp current-leaf-idx)) - (set! v1-32 #f) - ) - ) - + (if (< (-> s4-0 length) (-> s4-0 from-bsp current-leaf-idx)) (set! v1-32 #f))) ;; see if we want adj vis. (when s3-0 (set! a0-16 (nonzero? (logand (shl #x8000 16) (-> s3-0 flags)))) - (if (< (-> s3-0 length) (-> s3-0 from-bsp current-leaf-idx)) - (set! a0-16 #f) - ) - ) + (if (< (-> s3-0 length) (-> s3-0 from-bsp current-leaf-idx)) (set! a0-16 #f))) v1-32 ;; this is the cond condition, and is if we want the self vis. - ) - ) + )) ;; want self. clear all visible if we aren't loading. - (if (!= (-> s5-1 all-visible?) 'loading) - (set! (-> s5-1 all-visible?) #f) - ) + (if (!= (-> s5-1 all-visible?) 'loading) (set! (-> s5-1 all-visible?) #f)) (when (update-vis! s5-1 s4-0 (-> s4-0 ramdisk) (-> s4-0 string-block)) ;; success! Remove all other vis strings. ;; if update vis failed (due to still loading, etc), keep previous. (countdown (v1-40 8) (let ((a0-22 (-> s5-1 vis-info v1-40))) (when a0-22 - (if (!= a0-22 s4-0) - (set! (-> a0-22 current-vis-string) (the-as uint -1)) - ) - ) - ) - ) + (if (!= a0-22 s4-0) (set! (-> a0-22 current-vis-string) (the-as uint -1)))))) ;; successful vis update, remove all-visible. - (set! (-> s5-1 all-visible?) #f) - ) - ) + (set! (-> s5-1 all-visible?) #f))) ;; same case as above, but if we want to use the other vis. (a0-16 - (if (!= (-> s5-1 all-visible?) 'loading) - (set! (-> s5-1 all-visible?) #f) - ) - (when - (update-vis! s5-1 s3-0 (-> s3-0 ramdisk) (-> s3-0 string-block)) - (countdown (v1-50 8) - (let ((a0-27 (-> s5-1 vis-info v1-50))) - (when a0-27 - (if (!= a0-27 s3-0) - (set! (-> a0-27 current-vis-string) (the-as uint -1)) - ) - ) - ) - ) - (set! (-> s5-1 all-visible?) #f) - ) - ) + (if (!= (-> s5-1 all-visible?) 'loading) (set! (-> s5-1 all-visible?) #f)) + (when (update-vis! s5-1 s3-0 (-> s3-0 ramdisk) (-> s3-0 string-block)) + (countdown (v1-50 8) + (let ((a0-27 (-> s5-1 vis-info v1-50))) + (when a0-27 + (if (!= a0-27 s3-0) (set! (-> a0-27 current-vis-string) (the-as uint -1)))))) + (set! (-> s5-1 all-visible?) #f))) ((and (= (-> s5-1 all-visible?) 'loading) (-> *level* play?)) ;; if we're in between vis, then leave the old string. ) (else - ;; couldn't find any vis, just make everything visible - (quad-copy! (-> s5-1 vis-bits) (-> s5-1 bsp all-visible-list) a2-0) - ) - ) - ) + ;; couldn't find any vis, just make everything visible + (quad-copy! (-> s5-1 vis-bits) (-> s5-1 bsp all-visible-list) a2-0)))) (else - ;; outside boxes, and force all visible is set. - (quad-copy! (-> s5-1 vis-bits) (-> s5-1 bsp all-visible-list) a2-0) - ) - ) - ) - (if (and *stats-bsp* (= *master-mode* 'game)) - (format *stdcon* "~0kleaf-index = ~d~%" (-> s5-1 bsp current-leaf-idx)) - ) - ) - ) - ) - #f - ) - ) + ;; outside boxes, and force all visible is set. + (quad-copy! (-> s5-1 vis-bits) (-> s5-1 bsp all-visible-list) a2-0)))) + (if (and *stats-bsp* (= *master-mode* 'game)) (format *stdcon* "~0kleaf-index = ~d~%" (-> s5-1 bsp current-leaf-idx)))))) + #f)) (define *save-camera-inv-rot* (new 'global 'matrix)) @@ -244,48 +173,27 @@ (defun move-camera-from-pad ((arg0 math-camera)) (let ((v1-0 *external-cam-mode*) - (s5-0 0) - ) + (s5-0 0)) (cond - ((= v1-0 'locked) - (set! v1-0 #f) - ) - ((= v1-0 'pad-1) - (set! s5-0 1) - ) - ((not *camera-combiner*) - (set! v1-0 'pad-0) - ) - ) + ((= v1-0 'locked) (set! v1-0 #f)) + ((= v1-0 'pad-1) (set! s5-0 1)) + ((not *camera-combiner*) (set! v1-0 'pad-0))) (when v1-0 - (let ((s4-1 - (vector-negate-in-place! (vector-normalize-copy! (new-stack-vector0) (-> *standard-dynamics* gravity) 1.0)) - ) - ) - (if (= (vector-length s4-1) 0.0) - (set! (-> s4-1 y) -1.0) - ) - (if (logtest? *external-cam-options* (external-cam-option allow-z)) - (set! s4-1 (the-as vector #f)) - ) - (cam-free-floating-move *save-camera-inv-rot* (-> arg0 trans) s4-1 s5-0) - ) - ) - ) + (let ((s4-1 (vector-negate-in-place! (vector-normalize-copy! (new-stack-vector0) (-> *standard-dynamics* gravity) 1.0)))) + (if (= (vector-length s4-1) 0.0) (set! (-> s4-1 y) -1.0)) + (if (logtest? *external-cam-options* (external-cam-option allow-z)) (set! s4-1 (the-as vector #f))) + (cam-free-floating-move *save-camera-inv-rot* (-> arg0 trans) s4-1 s5-0)))) (let* ((a2-2 (-> *math-camera* inv-camera-rot)) (a3-1 *save-camera-inv-rot*) (v1-11 (-> a3-1 vector 0 quad)) (a0-14 (-> a3-1 vector 1 quad)) (a1-2 (-> a3-1 vector 2 quad)) - (a3-2 (-> a3-1 vector 3 quad)) - ) + (a3-2 (-> a3-1 vector 3 quad))) (set! (-> a2-2 vector 0 quad) v1-11) (set! (-> a2-2 vector 1 quad) a0-14) (set! (-> a2-2 vector 2 quad) a1-2) - (set! (-> a2-2 vector 3 quad) a3-2) - ) - arg0 - ) + (set! (-> a2-2 vector 3 quad) a3-2)) + arg0) ;; og:preserve-this PAL patch here (moved from cam-debug) (defun external-cam-reset! () @@ -297,18 +205,14 @@ (a0-2 (-> a3-0 vector 0 quad)) (a1-0 (-> a3-0 vector 1 quad)) (a2-0 (-> a3-0 vector 2 quad)) - (a3-1 (-> a3-0 vector 3 quad)) - ) + (a3-1 (-> a3-0 vector 3 quad))) (set! (-> v1-6 vector 0 quad) a0-2) (set! (-> v1-6 vector 1 quad) a1-0) (set! (-> v1-6 vector 2 quad) a2-0) - (set! (-> v1-6 vector 3 quad) a3-1) - ) - (set! (-> *math-camera* trans quad) (-> *camera-combiner* trans quad)) - ) + (set! (-> v1-6 vector 3 quad) a3-1)) + (set! (-> *math-camera* trans quad) (-> *camera-combiner* trans quad))) 0 - (none) - ) + (none)) (define *start-timer* (the-as int #f)) @@ -319,87 +223,51 @@ (defun update-camera () (when *start-timer* (when (= *timer-value* 180) - (format - #t - "Player pos = ~F ~F ~F~%" - (-> *target* control trans x) - (-> *target* control trans y) - (-> *target* control trans z) - ) - (set! (-> *start-pos* quad) (-> *target* control trans quad)) - ) + (format #t + "Player pos = ~F ~F ~F~%" + (-> *target* control trans x) + (-> *target* control trans y) + (-> *target* control trans z)) + (set! (-> *start-pos* quad) (-> *target* control trans quad))) (when (= *timer-value* 480) - (format - #t - "Player pos = ~F ~F ~F~%" - (-> *target* control trans x) - (-> *target* control trans y) - (-> *target* control trans z) - ) - (format - #t - "Dist = ~F~%" - (* 0.00024414062 (vector-vector-xz-distance (-> *target* control trans) *start-pos*)) - ) - (set! *start-timer* (the-as int #f)) - ) - (if (< 179 *timer-value*) - (format *stdcon* "~%~%Time = ~D~%" *timer-value*) - ) - (set! *timer-value* (+ *timer-value* 1)) - ) + (format #t + "Player pos = ~F ~F ~F~%" + (-> *target* control trans x) + (-> *target* control trans y) + (-> *target* control trans z)) + (format #t "Dist = ~F~%" (* 0.00024414062 (vector-vector-xz-distance (-> *target* control trans) *start-pos*))) + (set! *start-timer* (the-as int #f))) + (if (< 179 *timer-value*) (format *stdcon* "~%~%Time = ~D~%" *timer-value*)) + (set! *timer-value* (+ *timer-value* 1))) (when (not *start-timer*) (set! *timer-value* 0) - 0 - ) + 0) (dotimes (gp-1 2) (let ((s5-1 (-> *level* level gp-1))) (when (!= (-> s5-1 status) 'inactive) (let ((a0-14 (new-stack-vector0))) (vector-! a0-14 (the-as vector (-> s5-1 info bsphere)) (-> *math-camera* trans)) - (set! (-> s5-1 level-distance) (fmax 0.0 (- (vector-length a0-14) (-> s5-1 info bsphere w)))) - ) + (set! (-> s5-1 level-distance) (fmax 0.0 (- (vector-length a0-14) (-> s5-1 info bsphere w))))) (when *display-level-spheres* - (add-debug-sphere - #t - (bucket-id debug-no-zbuf) - (-> s5-1 info bsphere) - (-> s5-1 info bsphere w) - (new 'static 'rgba :r #xff :a #x80) - ) - (format - *stdcon* - "~f ~f ~f ~f~%" - (* 0.00024414062 (-> s5-1 info bsphere x)) - (* 0.00024414062 (-> s5-1 info bsphere y)) - (* 0.00024414062 (-> s5-1 info bsphere z)) - (* 0.00024414062 (-> s5-1 info bsphere w)) - ) - ) - ) - ) - ) - (update-math-camera - *math-camera* - (-> *setting-control* current video-mode) - (-> *setting-control* current aspect-ratio) - ) + (add-debug-sphere #t + (bucket-id debug-no-zbuf) + (-> s5-1 info bsphere) + (-> s5-1 info bsphere w) + (new 'static 'rgba :r #xff :a #x80)) + (format *stdcon* + "~f ~f ~f ~f~%" + (* 0.00024414062 (-> s5-1 info bsphere x)) + (* 0.00024414062 (-> s5-1 info bsphere y)) + (* 0.00024414062 (-> s5-1 info bsphere z)) + (* 0.00024414062 (-> s5-1 info bsphere w))))))) + (update-math-camera *math-camera* (-> *setting-control* current video-mode) (-> *setting-control* current aspect-ratio)) (update! *camera-smush-control*) (cond - ((or (= *master-mode* 'pause) (= *master-mode* 'progress) *progress-process*) - ) - ((>= *camera-look-through-other* 2) - (set! *camera-look-through-other* 1) - ) - ((and (= *camera-look-through-other* 1) (!= *master-mode* 'menu)) - (set! *camera-look-through-other* 0) - 0 - ) - ) + ((or (= *master-mode* 'pause) (= *master-mode* 'progress) *progress-process*)) + ((>= *camera-look-through-other* 2) (set! *camera-look-through-other* 1)) + ((and (= *camera-look-through-other* 1) (!= *master-mode* 'menu)) (set! *camera-look-through-other* 0) 0)) (cond - (*external-cam-mode* - (move-camera-from-pad *math-camera*) - ) + (*external-cam-mode* (move-camera-from-pad *math-camera*)) ((nonzero? *camera-look-through-other*) (set! (-> *math-camera* fov) (-> *camera-other-fov* data)) (set! (-> *math-camera* trans quad) (-> *camera-other-trans* quad)) @@ -409,26 +277,21 @@ (v1-86 (-> a3-4 vector 0 quad)) (a0-29 (-> a3-4 vector 1 quad)) (a1-10 (-> a3-4 vector 2 quad)) - (a3-5 (-> a3-4 vector 3 quad)) - ) + (a3-5 (-> a3-4 vector 3 quad))) (set! (-> a2-9 vector 0 quad) v1-86) (set! (-> a2-9 vector 1 quad) a0-29) (set! (-> a2-9 vector 2 quad) a1-10) - (set! (-> a2-9 vector 3 quad) a3-5) - ) + (set! (-> a2-9 vector 3 quad) a3-5)) (let* ((a2-10 *save-camera-inv-rot*) (a3-6 *camera-other-matrix*) (v1-87 (-> a3-6 vector 0 quad)) (a0-30 (-> a3-6 vector 1 quad)) (a1-11 (-> a3-6 vector 2 quad)) - (a3-7 (-> a3-6 vector 3 quad)) - ) + (a3-7 (-> a3-6 vector 3 quad))) (set! (-> a2-10 vector 0 quad) v1-87) (set! (-> a2-10 vector 1 quad) a0-30) (set! (-> a2-10 vector 2 quad) a1-11) - (set! (-> a2-10 vector 3 quad) a3-7) - ) - ) + (set! (-> a2-10 vector 3 quad) a3-7))) ((and *camera-combiner* (not *external-cam-mode*)) (set! (-> *math-camera* fov) (-> *camera-combiner* fov)) (set! (-> *math-camera* trans quad) (-> *camera-combiner* trans quad)) @@ -438,151 +301,104 @@ (a0-36 (-> a3-8 vector 0 quad)) (a1-12 (-> a3-8 vector 1 quad)) (a2-11 (-> a3-8 vector 2 quad)) - (a3-9 (-> a3-8 vector 3 quad)) - ) + (a3-9 (-> a3-8 vector 3 quad))) (set! (-> v1-100 vector 0 quad) a0-36) (set! (-> v1-100 vector 1 quad) a1-12) (set! (-> v1-100 vector 2 quad) a2-11) - (set! (-> v1-100 vector 3 quad) a3-9) - ) + (set! (-> v1-100 vector 3 quad) a3-9)) (let* ((v1-101 *save-camera-inv-rot*) (a3-10 (-> *camera-combiner* inv-camera-rot)) (a0-38 (-> a3-10 vector 0 quad)) (a1-13 (-> a3-10 vector 1 quad)) (a2-12 (-> a3-10 vector 2 quad)) - (a3-11 (-> a3-10 vector 3 quad)) - ) + (a3-11 (-> a3-10 vector 3 quad))) (set! (-> v1-101 vector 0 quad) a0-38) (set! (-> v1-101 vector 1 quad) a1-13) (set! (-> v1-101 vector 2 quad) a2-12) - (set! (-> v1-101 vector 3 quad) a3-11) - ) - ) - (else - (move-camera-from-pad *math-camera*) - ) - ) + (set! (-> v1-101 vector 3 quad) a3-11))) + (else (move-camera-from-pad *math-camera*))) (matrix-transpose! (-> *math-camera* camera-rot) (-> *math-camera* inv-camera-rot)) (cond - (*camera-no-mip-correction* - (set! (-> *math-camera* fov-correction-factor) 1.0) - ) + (*camera-no-mip-correction* (set! (-> *math-camera* fov-correction-factor) 1.0)) (else - (let ((f0-28 (fmin 11650.845 (-> *math-camera* fov)))) - (set! (-> *math-camera* fov-correction-factor) (* 0.00008583069 f0-28)) - ) - ) - ) + (let ((f0-28 (fmin 11650.845 (-> *math-camera* fov)))) + (set! (-> *math-camera* fov-correction-factor) (* 0.00008583069 f0-28))))) (if (< 0.0 (-> *math-camera* smooth-t)) - (set! (-> *math-camera* smooth-t) (- (-> *math-camera* smooth-t) (-> *math-camera* smooth-step))) - ) + (set! (-> *math-camera* smooth-t) (- (-> *math-camera* smooth-t) (-> *math-camera* smooth-step)))) (cond ((< 0.0 (-> *math-camera* smooth-t)) (let ((gp-2 (new-stack-quaternion0))) (matrix->quaternion gp-2 (-> *math-camera* inv-camera-rot)) (quaternion-slerp! gp-2 gp-2 (-> *math-camera* inv-camera-rot-smooth-from) (-> *math-camera* smooth-t)) - (quaternion->matrix (-> *math-camera* inv-camera-rot-smooth) gp-2) - ) - ) + (quaternion->matrix (-> *math-camera* inv-camera-rot-smooth) gp-2))) (else - (let* ((v1-124 (-> *math-camera* inv-camera-rot-smooth)) - (a3-13 (-> *math-camera* inv-camera-rot)) - (a0-45 (-> a3-13 vector 0 quad)) - (a1-18 (-> a3-13 vector 1 quad)) - (a2-14 (-> a3-13 vector 2 quad)) - (a3-14 (-> a3-13 vector 3 quad)) - ) - (set! (-> v1-124 vector 0 quad) a0-45) - (set! (-> v1-124 vector 1 quad) a1-18) - (set! (-> v1-124 vector 2 quad) a2-14) - (set! (-> v1-124 vector 3 quad) a3-14) - ) - ) - ) + (let* ((v1-124 (-> *math-camera* inv-camera-rot-smooth)) + (a3-13 (-> *math-camera* inv-camera-rot)) + (a0-45 (-> a3-13 vector 0 quad)) + (a1-18 (-> a3-13 vector 1 quad)) + (a2-14 (-> a3-13 vector 2 quad)) + (a3-14 (-> a3-13 vector 3 quad))) + (set! (-> v1-124 vector 0 quad) a0-45) + (set! (-> v1-124 vector 1 quad) a1-18) + (set! (-> v1-124 vector 2 quad) a2-14) + (set! (-> v1-124 vector 3 quad) a3-14)))) (if (and (!= *master-mode* 'menu) *display-camera-info*) - (format - *stdcon* - "cam pos ~M ~M ~M~%" - (-> *math-camera* trans x) - (-> *math-camera* trans y) - (-> *math-camera* trans z) - ) - ) + (format *stdcon* "cam pos ~M ~M ~M~%" (-> *math-camera* trans x) (-> *math-camera* trans y) (-> *math-camera* trans z))) (when (zero? (-> *math-camera* reset)) (let* ((v1-136 (-> *math-camera* prev-camera-temp)) (a3-16 (-> *math-camera* camera-temp)) (a0-50 (-> a3-16 vector 0 quad)) (a1-20 (-> a3-16 vector 1 quad)) (a2-16 (-> a3-16 vector 2 quad)) - (a3-17 (-> a3-16 vector 3 quad)) - ) + (a3-17 (-> a3-16 vector 3 quad))) (set! (-> v1-136 vector 0 quad) a0-50) (set! (-> v1-136 vector 1 quad) a1-20) (set! (-> v1-136 vector 2 quad) a2-16) - (set! (-> v1-136 vector 3 quad) a3-17) - ) - ) + (set! (-> v1-136 vector 3 quad) a3-17))) (let ((gp-3 (-> *math-camera* camera-temp)) (s4-1 (-> *math-camera* camera-rot)) (s5-2 (-> *math-camera* inv-camera-rot)) - (s3-0 (-> *math-camera* trans)) - ) + (s3-0 (-> *math-camera* trans))) (let ((s2-0 (new-stack-vector0))) (set! (-> s2-0 x) (- (-> s3-0 x))) (set! (-> s2-0 y) (- (-> s3-0 y))) (set! (-> s2-0 z) (- (-> s3-0 z))) (set! (-> s2-0 w) 1.0) (vector-matrix*! s2-0 s2-0 s4-1) - (set! (-> s4-1 vector 3 quad) (-> s2-0 quad)) - ) + (set! (-> s4-1 vector 3 quad) (-> s2-0 quad))) (matrix*! gp-3 s4-1 (-> *math-camera* perspective)) - (set! (-> s5-2 vector 3 quad) (-> s3-0 quad)) - ) + (set! (-> s5-2 vector 3 quad) (-> s3-0 quad))) (when (nonzero? (-> *math-camera* reset)) (let* ((v1-148 (-> *math-camera* prev-camera-temp)) (a3-18 (-> *math-camera* camera-temp)) (a0-54 (-> a3-18 vector 0 quad)) (a1-23 (-> a3-18 vector 1 quad)) (a2-19 (-> a3-18 vector 2 quad)) - (a3-19 (-> a3-18 vector 3 quad)) - ) + (a3-19 (-> a3-18 vector 3 quad))) (set! (-> v1-148 vector 0 quad) a0-54) (set! (-> v1-148 vector 1 quad) a1-23) (set! (-> v1-148 vector 2 quad) a2-19) - (set! (-> v1-148 vector 3 quad) a3-19) - ) + (set! (-> v1-148 vector 3 quad) a3-19)) (set! (-> *math-camera* reset) 0) - 0 - ) + 0) (let ((f0-45 (-> *math-camera* fog-min)) - (f1-10 (-> *math-camera* fog-max)) - ) + (f1-10 (-> *math-camera* fog-max))) (let ((f2-0 (-> *math-camera* d))) (set! (-> *instance-tie-work* hmge-d x) f0-45) (set! (-> *instance-tie-work* hmge-d y) f1-10) (set! (-> *instance-tie-work* hmge-d z) (* 32.0 f2-0)) (set! (-> *instance-tie-work* hmge-d w) (* f2-0 (-> *math-camera* hmge-scale w))) - (let ((v1-160 (-> *math-camera* hvdf-off quad))) - (set! (-> *instance-tie-work* hvdf-offset quad) v1-160) - ) + (let ((v1-160 (-> *math-camera* hvdf-off quad))) (set! (-> *instance-tie-work* hvdf-offset quad) v1-160)) (set! (-> *instance-shrub-work* hmge-d x) f0-45) (set! (-> *instance-shrub-work* hmge-d y) f1-10) (set! (-> *instance-shrub-work* hmge-d z) (* 3.0 f2-0)) (set! (-> *instance-shrub-work* hmge-d w) (* f2-0 (-> *math-camera* hmge-scale w))) - (set! (-> *instance-shrub-work* billboard-const x) - (/ (-> *math-camera* x-pix) (* f2-0 (-> *math-camera* x-ratio))) - ) - (set! (-> *instance-shrub-work* billboard-const y) - (/ (-> *math-camera* y-pix) (* f2-0 (-> *math-camera* y-ratio))) - ) - ) + (set! (-> *instance-shrub-work* billboard-const x) (/ (-> *math-camera* x-pix) (* f2-0 (-> *math-camera* x-ratio)))) + (set! (-> *instance-shrub-work* billboard-const y) (/ (-> *math-camera* y-pix) (* f2-0 (-> *math-camera* y-ratio))))) (set! (-> *instance-shrub-work* billboard-const z) f0-45) - (set! (-> *instance-shrub-work* billboard-const w) f1-10) - ) + (set! (-> *instance-shrub-work* billboard-const w) f1-10)) (set! (-> *instance-shrub-work* constants w) (the-as float (-> *math-camera* vis-gifs 0 fog0))) - (let ((a0-56 (-> *math-camera* hvdf-off quad))) - (set! (-> *instance-shrub-work* hvdf-offset quad) a0-56) - ) + (let ((a0-56 (-> *math-camera* hvdf-off quad))) (set! (-> *instance-shrub-work* hvdf-offset quad) a0-56)) (update-view-planes *math-camera* (-> *math-camera* plane) 1.0) (update-view-planes *math-camera* (-> *math-camera* guard-plane) 4.0) (set! (-> *instance-shrub-work* guard-plane 0 quad) (-> *math-camera* guard-plane 0 quad)) @@ -594,12 +410,5 @@ (set! (-> *instance-tie-work* guard-plane 2 quad) (-> *math-camera* guard-plane 2 quad)) (set! (-> *instance-tie-work* guard-plane 3 quad) (-> *math-camera* guard-plane 3 quad)) (update-visible *math-camera*) - (if (not (paused?)) - (update-wind *wind-work* *wind-scales*) - ) - #f - ) - - - - + (if (not (paused?)) (update-wind *wind-work* *wind-scales*)) + #f) diff --git a/goal_src/jak1/engine/camera/camera-h.gc b/goal_src/jak1/engine/camera/camera-h.gc index eca37c4723..2776695aa7 100644 --- a/goal_src/jak1/engine/camera/camera-h.gc +++ b/goal_src/jak1/engine/camera/camera-h.gc @@ -1,7 +1,6 @@ ;;-*-Lisp-*- (in-package goal) (bundles "ENGINE.CGO" "GAME.CGO") - (require "engine/math/vector-h.gc") (require "engine/gfx/hw/display-h.gc") @@ -11,23 +10,33 @@ ;; TODO - for cam-layout (define-extern v-slrp2! (function vector vector vector float vector float vector)) + (define-extern v-slrp3! (function vector vector vector vector float vector)) + (declare-type camera-slave process) + (declare-type camera-master process) + (declare-type tracking-point structure) + (declare-type cam-rotation-tracker structure) + (declare-type camera-combiner process) + ;; TODO - for cam-master ;; TODO - for camera (define-extern camera-line-rel-len (function vector vector float vector4w none)) + (define-extern cam-calc-follow! (function cam-rotation-tracker vector symbol vector)) + (define-extern slave-set-rotation! (function cam-rotation-tracker vector float float symbol none)) + ;; TODO - for cam-combiner (define-extern paused? (function symbol)) + ;; TODO - for cam-start (define-extern cam-master-init (function none :behavior camera-master)) - (defenum cam-slave-options :bitfield #t (BUTT_CAM) @@ -47,135 +56,112 @@ (BIKE_MODE) (NO_ROTATE) (STICKY_ANGLE) - (AIR_EXIT) - ) + (AIR_EXIT)) (defenum cam-index-options :type uint32 :bitfield #t (RADIAL) - (SPHERICAL) - ) + (SPHERICAL)) (defenum slave-los-state :type uint32 (none 0) (cw 1) (ccw 2) - (between 3) - ) + (between 3)) ;; DECOMP BEGINS (deftype camera-bank (basic) - ((collide-move-rad float) - (joypad uint32) - (min-detectable-velocity float) - (attack-timeout time-frame) - (default-string-max-y meters) - (default-string-min-y meters) - (default-string-max-z meters) - (default-string-min-z meters) - (default-string-push-z meters) - (default-tilt-adjust degrees) - ) - ) + ((collide-move-rad float) + (joypad uint32) + (min-detectable-velocity float) + (attack-timeout time-frame) + (default-string-max-y meters) + (default-string-min-y meters) + (default-string-max-z meters) + (default-string-min-z meters) + (default-string-push-z meters) + (default-tilt-adjust degrees))) - -(define *CAMERA-bank* (new 'static 'camera-bank - :collide-move-rad 1638.4 - :min-detectable-velocity 40.96 - :attack-timeout (seconds 0.25) - :default-string-max-y (meters 3) - :default-string-min-y (meters 1) - :default-string-max-z (meters 12.5) - :default-string-min-z (meters 5) - :default-string-push-z (meters 10) - :default-tilt-adjust (degrees -6.5000005) - ) - ) +(define *CAMERA-bank* + (new + 'static + 'camera-bank + :collide-move-rad 1638.4 + :min-detectable-velocity 40.96 + :attack-timeout (seconds 0.25) + :default-string-max-y (meters 3) + :default-string-min-y (meters 1) + :default-string-max-z (meters 12.5) + :default-string-min-z (meters 5) + :default-string-push-z (meters 10) + :default-tilt-adjust (degrees -6.5000005))) (deftype cam-index (structure) - ((flags cam-index-options) - (vec vector 2 :inline :offset 16) - ) + ((flags cam-index-options) + (vec vector 2 :inline :offset 16)) (:methods - (cam-index-method-9 (_type_ symbol entity vector curve) symbol) - (cam-index-method-10 (_type_ vector) float) - ) - ) - + (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) - ) - ) - + ((position vector :inline) + (direction vector :inline) + (tp-length float) + (next int32) + (incarnation int32))) (deftype tracking-spline-sampler (structure) - ((cur-pt int32) - (partial-pt float) - ) - ) - + ((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) - ) + ((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) - (print-nth-point (_type_ int) none) - (tracking-spline-method-12 (_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 tracking-spline-sampler) vector) - (tracking-spline-method-19 (_type_ float vector tracking-spline-sampler) vector) - (tracking-spline-method-20 (_type_ vector int) none) - (tracking-spline-method-21 (_type_ vector float float) vector) - (tracking-spline-method-22 (_type_ float) none) - (tracking-spline-method-23 (_type_) none) - ) - ) - + (tracking-spline-method-9 (_type_) none) + (tracking-spline-method-10 (_type_ vector) none) + (print-nth-point (_type_ int) none) + (tracking-spline-method-12 (_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 tracking-spline-sampler) vector) + (tracking-spline-method-19 (_type_ float vector tracking-spline-sampler) vector) + (tracking-spline-method-20 (_type_ vector int) none) + (tracking-spline-method-21 (_type_ vector float float) vector) + (tracking-spline-method-22 (_type_ float) none) + (tracking-spline-method-23 (_type_) none))) (deftype cam-float-seeker (structure) - ((target float) - (value float) - (vel float) - (accel float) - (max-vel float) - (max-partial float) - ) + ((target float) + (value float) + (vel float) + (accel float) + (max-vel float) + (max-partial float)) :pack-me (:methods - (init-cam-float-seeker (_type_ float float float float) none) - (copy-cam-float-seeker (_type_ _type_) none) - (update! (_type_ float) none) - (jump-to-target! (_type_ float) float) - ) - ) - + (init-cam-float-seeker (_type_ float float float float) none) + (copy-cam-float-seeker (_type_ _type_) none) + (update! (_type_ float) none) + (jump-to-target! (_type_ float) float))) (defmethod init-cam-float-seeker ((this cam-float-seeker) (arg0 float) (arg1 float) (arg2 float) (arg3 float)) (set! (-> this target) arg0) @@ -185,8 +171,7 @@ (set! (-> this max-vel) arg2) (set! (-> this max-partial) arg3) 0 - (none) - ) + (none)) (defmethod copy-cam-float-seeker ((this cam-float-seeker) (arg0 cam-float-seeker)) (set! (-> this target) (-> arg0 target)) @@ -196,278 +181,226 @@ (set! (-> this max-vel) (-> arg0 max-vel)) (set! (-> this max-partial) (-> arg0 max-partial)) 0 - (none) - ) + (none)) (defmethod update! ((this cam-float-seeker) (offset float)) 0.0 0.0 (let* ((pos-error (- (+ (-> this target) offset) (-> this value))) - (partial-velocity-limit (* (-> this max-partial) (fabs pos-error))) - ) - (let ((daccel (* pos-error (* (-> this accel) (-> *display* time-adjust-ratio))))) - (+! (-> this vel) daccel) - ) + (partial-velocity-limit (* (-> this max-partial) (fabs pos-error)))) + (let ((daccel (* pos-error (* (-> this accel) (-> *display* time-adjust-ratio))))) (+! (-> this vel) daccel)) (let ((abs-vel (fabs (-> this vel))) - (abs-vel-limit (fmin partial-velocity-limit (-> this max-vel))) - ) - (if (< abs-vel-limit abs-vel) - (set! (-> this vel) (* (-> this vel) (/ abs-vel-limit abs-vel))) - ) - ) - ) - (let ((dpos (* (-> this vel) (-> *display* time-adjust-ratio)))) - (+! (-> this value) dpos) - ) + (abs-vel-limit (fmin partial-velocity-limit (-> this max-vel)))) + (if (< abs-vel-limit abs-vel) (set! (-> this vel) (* (-> this vel) (/ abs-vel-limit abs-vel)))))) + (let ((dpos (* (-> this vel) (-> *display* time-adjust-ratio)))) (+! (-> this value) dpos)) 0 - (none) - ) + (none)) (defmethod jump-to-target! ((this cam-float-seeker) (arg0 float)) (set! (-> this value) (+ (-> this target) arg0)) - (set! (-> this vel) 0.0) - ) + (set! (-> this vel) 0.0)) (deftype cam-vector-seeker (structure) - ((target vector :inline) - (value vector :inline) - (vel vector :inline) - (accel float) - (max-vel float) - (max-partial float) - ) + ((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) - ) - ) - + (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 - (set! (-> this target quad) (-> arg0 quad)) - (set! (-> this value quad) (-> arg0 quad)) - ) - (else - (vector-reset! (-> this target)) - (vector-reset! (-> this value)) - ) - ) + (arg0 (set! (-> this target quad) (-> arg0 quad)) (set! (-> this value quad) (-> arg0 quad))) + (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) - ) + (none)) (defmethod update! ((this cam-vector-seeker) (arg0 vector)) (let ((gp-0 (new 'stack-no-clear 'vector))) 0.0 (cond - (arg0 - (vector+! gp-0 (-> this target) arg0) - (vector-! gp-0 gp-0 (-> this value)) - ) - (else - (vector-! gp-0 (-> this target) (-> this value)) - ) - ) + (arg0 (vector+! gp-0 (-> this target) arg0) (vector-! gp-0 gp-0 (-> this value))) + (else (vector-! gp-0 (-> this target) (-> this value)))) (let ((f30-1 (* (-> this max-partial) (vector-length gp-0)))) (vector-float*! gp-0 gp-0 (* (-> this accel) (-> *display* time-adjust-ratio))) (vector+! (-> this vel) (-> this vel) gp-0) (let ((f0-4 (vector-length (-> this vel))) - (f1-2 (fmin f30-1 (-> this max-vel))) - ) - (if (< f1-2 f0-4) - (vector-float*! (-> this vel) (-> this vel) (/ f1-2 f0-4)) - ) - ) - ) + (f1-2 (fmin f30-1 (-> this max-vel)))) + (if (< f1-2 f0-4) (vector-float*! (-> this vel) (-> this vel) (/ f1-2 f0-4))))) (vector-float*! gp-0 (-> this vel) (-> *display* time-adjust-ratio)) - (vector+! (-> this value) (-> this value) gp-0) - ) + (vector+! (-> this value) (-> this value) gp-0)) 0 - (none) - ) + (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) - (use-point-of-interest basic) - (point-of-interest vector :inline) - (point-of-interest-blend cam-float-seeker :inline) - (underwater-blend cam-float-seeker :inline) - ) - ) - + ((inv-mat matrix :inline) + (no-follow basic) + (follow-pt vector :inline) + (follow-off vector :inline) + (follow-blend float) + (tilt-adjust cam-float-seeker :inline) + (use-point-of-interest basic) + (point-of-interest vector :inline) + (point-of-interest-blend cam-float-seeker :inline) + (underwater-blend 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) - ) + ((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)) (:states - cam-combiner-active - ) - ) - + 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) - (unknown-symbol symbol :offset 412) - (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 uint32) - (cam-entity entity) - (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 basic) - (spline-curve curve :inline) - (spline-offset vector :inline) - (index cam-index :inline) - (saved-pt vector :inline) - (spline-tt float) - (spline-follow-dist float) - (change-event-from (pointer process-drawable)) - (enter-has-run symbol) - (blend-from-type uint64) - (blend-to-type uint64) - (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) - ) + ((trans vector :inline) + (fov float) + (fov0 float) + (fov1 float) + (fov-index cam-index :inline) + (tracking cam-rotation-tracker :inline) + (view-off-param float) + (unknown-symbol symbol :offset 412) + (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 uint32) + (cam-entity entity) + (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 basic) + (spline-curve curve :inline) + (spline-offset vector :inline) + (index cam-index :inline) + (saved-pt vector :inline) + (spline-tt float) + (spline-follow-dist float) + (change-event-from (pointer process-drawable)) + (enter-has-run symbol) + (blend-from-type uint64) + (blend-to-type uint64) + (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)) (:states - *camera-base-mode* - cam-bike - cam-billy - 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-mistycannon - cam-orbit - cam-periscope - cam-point-watch - cam-pov - cam-pov-track - cam-pov180 - cam-robotboss - cam-spline - cam-standoff - cam-standoff-read-entity - cam-stick - cam-string - ) - ) - + *camera-base-mode* + cam-bike + cam-billy + 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-mistycannon + cam-orbit + cam-periscope + cam-point-watch + cam-pov + cam-pov-track + cam-pov180 + cam-robotboss + cam-spline + cam-standoff + cam-standoff-read-entity + cam-stick + cam-string)) (deftype camera-master (process) - ((master-options uint32) - (num-slaves int32) - (slave (pointer camera-slave) 2) - (slave-options uint32) - (view-off-param-save float) - (changer uint32) - (cam-entity entity) - (stringMinLength float) - (stringMaxLength float) - (stringMinHeight float) - (stringMaxHeight float) - (string-min cam-vector-seeker :inline) - (string-max cam-vector-seeker :inline) - (string-push-z float) - (stringCliffHeight float) - (no-intro uint32) - (force-blend uint32) - (force-blend-time uint32) - (local-down vector :inline) - (drawable-target handle) - (which-bone int32) - (pov-handle handle) - (pov-bone int32) - (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) - (target-height float) - (tpos-old-adj vector :inline) - (tpos-curr-adj vector :inline) - (tpos-tgt vector :inline) - (upspeed float) - (pitch-off vector :inline) - (foot-offset float) - (head-offset float) - (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) - ) + ((master-options uint32) + (num-slaves int32) + (slave (pointer camera-slave) 2) + (slave-options uint32) + (view-off-param-save float) + (changer uint32) + (cam-entity entity) + (stringMinLength float) + (stringMaxLength float) + (stringMinHeight float) + (stringMaxHeight float) + (string-min cam-vector-seeker :inline) + (string-max cam-vector-seeker :inline) + (string-push-z float) + (stringCliffHeight float) + (no-intro uint32) + (force-blend uint32) + (force-blend-time uint32) + (local-down vector :inline) + (drawable-target handle) + (which-bone int32) + (pov-handle handle) + (pov-bone int32) + (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) + (target-height float) + (tpos-old-adj vector :inline) + (tpos-curr-adj vector :inline) + (tpos-tgt vector :inline) + (upspeed float) + (pitch-off vector :inline) + (foot-offset float) + (head-offset float) + (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)) (:states - cam-master-active - list-keeper-active - ) - ) + cam-master-active + list-keeper-active)) diff --git a/goal_src/jak1/engine/camera/camera.gc b/goal_src/jak1/engine/camera/camera.gc index b77ac65803..4ac8f6cf5b 100644 --- a/goal_src/jak1/engine/camera/camera.gc +++ b/goal_src/jak1/engine/camera/camera.gc @@ -1,7 +1,6 @@ ;;-*-Lisp-*- (in-package goal) (bundles "ENGINE.CGO" "GAME.CGO") - (require "engine/engine/engines.gc") (require "engine/entity/res.gc") (require "engine/camera/cam-debug-h.gc") @@ -17,7 +16,6 @@ ;; name in dgo: camera ;; dgos: GAME, ENGINE - ;; DECOMP BEGINS (define *cam-res-string* (new 'global 'string 64 (the-as string #f))) @@ -25,384 +23,171 @@ (defun cam-slave-get-vector-with-offset ((arg0 entity-actor) (arg1 vector) (arg2 symbol)) (local-vars (s3-0 structure)) (cond - ((= arg2 'trans) - (set! s3-0 (-> arg0 trans)) - ) - ((= arg2 'rot) - (set! s3-0 (-> arg0 quat)) - ) - (else - (set! s3-0 (res-lump-struct arg0 arg2 structure)) - ) - ) + ((= arg2 'trans) (set! s3-0 (-> arg0 trans))) + ((= arg2 'rot) (set! s3-0 (-> arg0 quat))) + (else (set! s3-0 (res-lump-struct arg0 arg2 structure)))) (let ((s2-0 (method-of-type res-lump get-property-struct))) (format (clear *res-key-string*) "~S~S" arg2 '-offset) - (let ((a0-6 (s2-0 - arg0 - (string->symbol *res-key-string*) - 'interp - -1000000000.0 - #f - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) + (let ((a0-6 (s2-0 arg0 (string->symbol *res-key-string*) 'interp -1000000000.0 #f (the-as (pointer res-tag) #f) *res-static-buf*))) (cond - ((and s3-0 a0-6) - (vector+! arg1 (the-as vector s3-0) (the-as vector a0-6)) - #t - ) - ((the-as vector s3-0) - (set! (-> arg1 quad) (-> (the-as vector s3-0) quad)) - #t - ) - (else - #f - ) - ) - ) - ) - ) + ((and s3-0 a0-6) (vector+! arg1 (the-as vector s3-0) (the-as vector a0-6)) #t) + ((the-as vector s3-0) (set! (-> arg1 quad) (-> (the-as vector s3-0) quad)) #t) + (else #f))))) (defun cam-slave-get-flags ((arg0 entity) (arg1 symbol)) (let ((gp-0 (res-lump-value arg0 arg1 uint128)) (s3-0 (method-of-type res-lump get-property-value)) - (s2-0 arg0) - ) + (s2-0 arg0)) (format (clear *res-key-string*) "~S~S" arg1 '-on) - (let ((s3-1 (s3-0 - s2-0 - (string->symbol *res-key-string*) - 'interp - -1000000000.0 - (the-as uint128 0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - (s2-1 (method-of-type res-lump get-property-value)) - ) + (let ((s3-1 (s3-0 s2-0 + (string->symbol *res-key-string*) + 'interp + -1000000000.0 + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf*)) + (s2-1 (method-of-type res-lump get-property-value))) (format (clear *res-key-string*) "~S~S" arg1 '-off) - (let ((v1-3 (s2-1 - arg0 - (string->symbol *res-key-string*) - 'interp - -1000000000.0 - (the-as uint128 0) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - (logclear (logior gp-0 s3-1) v1-3) - ) - ) - ) - ) + (let ((v1-3 (s2-1 arg0 + (string->symbol *res-key-string*) + 'interp + -1000000000.0 + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf*))) + (logclear (logior gp-0 s3-1) v1-3))))) (defun cam-slave-get-float ((arg0 entity) (arg1 symbol) (arg2 float)) (let ((f30-0 (res-lump-float arg0 arg1 :default arg2)) - (s4-0 (method-of-type res-lump get-property-value-float)) - ) + (s4-0 (method-of-type res-lump get-property-value-float))) (format (clear *res-key-string*) "~S~S" arg1 '-offset) - (+ f30-0 (s4-0 - arg0 - (string->symbol *res-key-string*) - 'interp - -1000000000.0 - 0.0 - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - ) + (+ f30-0 + (s4-0 arg0 (string->symbol *res-key-string*) 'interp -1000000000.0 0.0 (the-as (pointer res-tag) #f) *res-static-buf*)))) (defun cam-slave-get-fov ((arg0 entity)) (let ((f30-0 (res-lump-float arg0 'fov)) - (s5-0 (method-of-type res-lump get-property-value-float)) - ) + (s5-0 (method-of-type res-lump get-property-value-float))) (format (clear *res-key-string*) "~S~S" 'fov '-offset) - (let ((f0-0 (s5-0 - arg0 - (string->symbol *res-key-string*) - 'interp - -1000000000.0 - 0.0 - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - (if (= f30-0 0.0) - (+ 11650.845 f0-0) - (+ f30-0 f0-0) - ) - ) - ) - ) + (let ((f0-0 (s5-0 arg0 (string->symbol *res-key-string*) 'interp -1000000000.0 0.0 (the-as (pointer res-tag) #f) *res-static-buf*))) + (if (= f30-0 0.0) (+ 11650.845 f0-0) (+ f30-0 f0-0))))) (defun cam-slave-get-intro-step ((arg0 entity)) (let ((f30-0 (res-lump-float arg0 'intro-time)) - (s5-0 (method-of-type res-lump get-property-value-float)) - ) + (s5-0 (method-of-type res-lump get-property-value-float))) (format (clear *res-key-string*) "~S~S" 'intro-time '-offset) - (let ((f0-1 (+ f30-0 (s5-0 - arg0 - (string->symbol *res-key-string*) - 'interp - -1000000000.0 - 0.0 - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - ) - (if (>= 0.0 f0-1) - 0.004166667 - (/ 0.016666668 f0-1) - ) - ) - ) - ) + (let ((f0-1 (+ f30-0 + (s5-0 arg0 (string->symbol *res-key-string*) 'interp -1000000000.0 0.0 (the-as (pointer res-tag) #f) *res-static-buf*)))) + (if (>= 0.0 f0-1) 0.004166667 (/ 0.016666668 f0-1))))) (defun cam-slave-get-interp-time ((arg0 entity)) (let ((f30-0 (res-lump-float arg0 'interpTime)) - (s5-0 (method-of-type res-lump get-property-value-float)) - ) + (s5-0 (method-of-type res-lump get-property-value-float))) (format (clear *res-key-string*) "~S~S" 'interpTime '-offset) - (let ((f0-1 (+ f30-0 (s5-0 - arg0 - (string->symbol *res-key-string*) - 'interp - -1000000000.0 - 0.0 - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - ) - (if (>= 0.001 f0-1) - (set! f0-1 0.0) - ) - f0-1 - ) - ) - ) + (let ((f0-1 (+ f30-0 + (s5-0 arg0 (string->symbol *res-key-string*) 'interp -1000000000.0 0.0 (the-as (pointer res-tag) #f) *res-static-buf*)))) + (if (>= 0.001 f0-1) (set! f0-1 0.0)) + f0-1))) (defun cam-slave-get-rot ((arg0 entity-actor) (arg1 matrix)) (let ((s4-0 (method-of-type res-lump get-property-struct)) - (s3-0 arg0) - ) + (s3-0 arg0)) (format (clear *res-key-string*) "~S~S" 'rot '-offset) - (let ((a1-3 (s4-0 - s3-0 - (string->symbol *res-key-string*) - 'interp - -1000000000.0 - #f - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) + (let ((a1-3 (s4-0 s3-0 (string->symbol *res-key-string*) 'interp -1000000000.0 #f (the-as (pointer res-tag) #f) *res-static-buf*))) (cond (a1-3 - (let ((s4-1 (new 'stack-no-clear 'quaternion))) - (quaternion*! s4-1 (the-as quaternion a1-3) (-> arg0 quat)) - (quaternion-normalize! s4-1) - (quaternion->matrix arg1 s4-1) - ) - ) - (else - (quaternion->matrix arg1 (-> arg0 quat)) - ) - ) - ) - ) - arg1 - ) + (let ((s4-1 (new 'stack-no-clear 'quaternion))) + (quaternion*! s4-1 (the-as quaternion a1-3) (-> arg0 quat)) + (quaternion-normalize! s4-1) + (quaternion->matrix arg1 s4-1))) + (else (quaternion->matrix arg1 (-> arg0 quat)))))) + arg1) (defun cam-state-from-entity ((arg0 entity)) (let ((s5-0 (new 'stack 'curve))) - (the-as state (cond - ((not arg0) - (the-as (state camera-slave) #f) - ) - ((res-lump-struct arg0 'pivot structure) - cam-circular - ) - ((res-lump-struct arg0 'align structure) - cam-standoff-read-entity - ) - ((get-curve-data! arg0 s5-0 'campath 'campath-k -1000000000.0) - cam-spline - ) - ((< 0.0 (cam-slave-get-float arg0 'stringMaxLength 0.0)) - *camera-base-mode* - ) - (else - cam-fixed-read-entity - ) - ) - ) - ) - ) + (the-as state + (cond + ((not arg0) (the-as (state camera-slave) #f)) + ((res-lump-struct arg0 'pivot structure) cam-circular) + ((res-lump-struct arg0 'align structure) cam-standoff-read-entity) + ((get-curve-data! arg0 s5-0 'campath 'campath-k -1000000000.0) cam-spline) + ((< 0.0 (cam-slave-get-float arg0 'stringMaxLength 0.0)) *camera-base-mode*) + (else cam-fixed-read-entity))))) (defun parameter-ease-none ((arg0 object)) - arg0 - ) + arg0) (defun parameter-ease-clamp ((arg0 float)) (cond - ((>= arg0 1.0) - (set! arg0 1.0) - ) - ((>= 0.0 arg0) - (set! arg0 0.0) - ) - ) - arg0 - ) + ((>= arg0 1.0) (set! arg0 1.0)) + ((>= 0.0 arg0) (set! arg0 0.0))) + arg0) (defun parameter-ease-lerp-clamp ((arg0 float)) (cond - ((>= arg0 1.0) - 1.0 - ) - ((>= 0.0 arg0) - 0.0 - ) - ((>= 0.25 arg0) - (* 0.5 arg0) - ) - ((>= arg0 0.75) - (- 1.0 (* 0.5 (- 1.0 arg0))) - ) - (else - (+ 0.125 (* 1.5 (+ -0.25 arg0))) - ) - ) - ) + ((>= arg0 1.0) 1.0) + ((>= 0.0 arg0) 0.0) + ((>= 0.25 arg0) (* 0.5 arg0)) + ((>= arg0 0.75) (- 1.0 (* 0.5 (- 1.0 arg0)))) + (else (+ 0.125 (* 1.5 (+ -0.25 arg0)))))) (defun parameter-ease-sqrt-clamp ((arg0 float)) (cond - ((>= arg0 1.0) - 1.0 - ) - ((>= 0.0 arg0) - 0.0 - ) - ((>= 0.5 arg0) - (* 0.5 (- 1.0 (sqrtf (- 1.0 (* 2.0 arg0))))) - ) - (else - (* 0.5 (+ 1.0 (sqrtf (+ -1.0 (* 2.0 arg0))))) - ) - ) - ) + ((>= arg0 1.0) 1.0) + ((>= 0.0 arg0) 0.0) + ((>= 0.5 arg0) (* 0.5 (- 1.0 (sqrtf (- 1.0 (* 2.0 arg0)))))) + (else (* 0.5 (+ 1.0 (sqrtf (+ -1.0 (* 2.0 arg0)))))))) (defun fourth-power ((arg0 float)) - (let ((f0-2 (* arg0 arg0))) - (* f0-2 f0-2) - ) - ) + (let ((f0-2 (* arg0 arg0))) (* f0-2 f0-2))) (defun third-power ((arg0 float)) - (* arg0 arg0 arg0) - ) + (* arg0 arg0 arg0)) (defun parameter-ease-sqr-clamp ((arg0 float)) (cond - ((>= arg0 1.0) - 1.0 - ) - ((>= 0.0 arg0) - 0.0 - ) + ((>= arg0 1.0) 1.0) + ((>= 0.0 arg0) 0.0) ((>= 0.5 arg0) (let ((f0-3 0.5) - (f1-4 (* 2.0 arg0)) - ) - (* f0-3 (* f1-4 f1-4)) - ) - ) + (f1-4 (* 2.0 arg0))) + (* f0-3 (* f1-4 f1-4)))) (else - (let ((f0-5 1.0) - (f1-7 0.5) - (f2-2 (* 2.0 (- 1.0 arg0))) - ) - (- f0-5 (* f1-7 (* f2-2 f2-2))) - ) - ) - ) - ) + (let ((f0-5 1.0) + (f1-7 0.5) + (f2-2 (* 2.0 (- 1.0 arg0)))) + (- f0-5 (* f1-7 (* f2-2 f2-2))))))) (defun parameter-ease-sin-clamp ((arg0 float)) (cond - ((>= arg0 1.0) - 1.0 - ) - ((>= 0.0 arg0) - 0.0 - ) - (else - (+ 0.5 (* 0.5 (sin (* 182.04445 (+ -90.0 (* 180.0 arg0)))))) - ) - ) - ) + ((>= arg0 1.0) 1.0) + ((>= 0.0 arg0) 0.0) + (else (+ 0.5 (* 0.5 (sin (* 182.04445 (+ -90.0 (* 180.0 arg0))))))))) (defmethod cam-index-method-9 ((this cam-index) (arg0 symbol) (arg1 entity) (arg2 vector) (arg3 curve)) (local-vars (sv-32 (function _varargs_ object))) (format (clear *cam-res-string*) "~S-flags" arg0) (set! (-> this flags) (the-as cam-index-options (cam-slave-get-flags arg1 (string->symbol *res-key-string*)))) (let ((s3-2 (res-lump-data arg1 arg0 pointer)) - (s0-1 (method-of-type res-lump get-property-struct)) - ) + (s0-1 (method-of-type res-lump get-property-struct))) (set! sv-32 format) (let ((a0-7 (clear *res-key-string*)) (a1-4 "~S~S") - (a3-2 '-offset) - ) - (sv-32 a0-7 a1-4 arg0 a3-2) - ) - (let ((v0-8 (s0-1 - arg1 - (string->symbol *res-key-string*) - 'interp - -1000000000.0 - #f - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) + (a3-2 '-offset)) + (sv-32 a0-7 a1-4 arg0 a3-2)) + (let ((v0-8 (s0-1 arg1 (string->symbol *res-key-string*) 'interp -1000000000.0 #f (the-as (pointer res-tag) #f) *res-static-buf*))) (cond (s3-2 - (cond - (v0-8 - (vector+! (the-as vector (-> this vec)) (the-as vector (&+ s3-2 0)) (the-as vector v0-8)) - (vector+! (-> this vec 1) (the-as vector (&+ s3-2 16)) (the-as vector v0-8)) - ) - (else - (set! (-> this vec 0 quad) (-> (the-as (pointer uint128) (&+ s3-2 0)))) - (set! (-> this vec 1 quad) (-> (the-as (pointer uint128) (&+ s3-2 16)))) - ) - ) - ) + (cond + (v0-8 + (vector+! (the-as vector (-> this vec)) (the-as vector (&+ s3-2 0)) (the-as vector v0-8)) + (vector+! (-> this vec 1) (the-as vector (&+ s3-2 16)) (the-as vector v0-8))) + (else + (set! (-> this vec 0 quad) (-> (the-as (pointer uint128) (&+ s3-2 0)))) + (set! (-> this vec 1 quad) (-> (the-as (pointer uint128) (&+ s3-2 16))))))) (arg3 - (set! (-> this vec 0 quad) (-> arg3 cverts 0 quad)) - (set! (-> this vec 1 quad) (-> arg3 cverts (+ (-> arg3 num-cverts) -1) quad)) - ) - (else - (return #f) - ) - ) - ) - ) + (set! (-> this vec 0 quad) (-> arg3 cverts 0 quad)) + (set! (-> this vec 1 quad) (-> arg3 cverts (+ (-> arg3 num-cverts) -1) quad))) + (else (return #f))))) (let ((s4-1 (new-stack-vector0))) 0.0 (cond @@ -412,24 +197,18 @@ (vector-! s4-1 (the-as vector (-> this vec)) arg2) (set! (-> this vec 1 x) (vector-length s4-1)) (set! (-> this vec 1 w) (- (-> this vec 1 w) (-> this vec 1 x))) - (set! (-> this vec 0 quad) (-> arg2 quad)) - ) + (set! (-> this vec 0 quad) (-> arg2 quad))) ((logtest? (-> this flags) (cam-index-options RADIAL)) (vector-! s4-1 (-> this vec 1) arg2) (set! (-> this vec 1 w) (vector-length s4-1)) (vector-! s4-1 (the-as vector (-> this vec)) arg2) (set! (-> this vec 1 x) (vector-length s4-1)) (set! (-> this vec 1 w) (- (-> this vec 1 w) (-> this vec 1 x))) - (set! (-> this vec 0 quad) (-> arg2 quad)) - ) + (set! (-> this vec 0 quad) (-> arg2 quad))) (else - (vector-! (-> this vec 1) (-> this vec 1) (the-as vector (-> this vec))) - (set! (-> this vec 1 w) (vector-normalize-ret-len! (-> this vec 1) 1.0)) - ) - ) - ) - #t - ) + (vector-! (-> this vec 1) (-> this vec 1) (the-as vector (-> this vec))) + (set! (-> this vec 1 w) (vector-normalize-ret-len! (-> this vec 1) 1.0))))) + #t) (defmethod cam-index-method-10 ((this cam-index) (arg0 vector)) (let ((s5-0 (new-stack-vector0))) @@ -438,17 +217,9 @@ (cond ((logtest? (-> this flags) (cam-index-options SPHERICAL)) (vector-flatten! s5-0 s5-0 (-> *camera* local-down)) - (/ (- (vector-length s5-0) (-> this vec 1 x)) (-> this vec 1 w)) - ) - ((logtest? (-> this flags) (cam-index-options RADIAL)) - (/ (- (vector-length s5-0) (-> this vec 1 x)) (-> this vec 1 w)) - ) - (else - (/ (vector-dot s5-0 (-> this vec 1)) (-> this vec 1 w)) - ) - ) - ) - ) + (/ (- (vector-length s5-0) (-> this vec 1 x)) (-> this vec 1 w))) + ((logtest? (-> this flags) (cam-index-options RADIAL)) (/ (- (vector-length s5-0) (-> this vec 1 x)) (-> this vec 1 w))) + (else (/ (vector-dot s5-0 (-> this vec 1)) (-> this vec 1 w)))))) (defmethod tracking-spline-method-10 ((this tracking-spline) (arg0 vector)) (set! (-> this point 0 position quad) (-> arg0 quad)) @@ -466,65 +237,46 @@ (let ((v1-6 1)) (while (!= v1-6 31) (set! (-> this point v1-6 next) (+ v1-6 1)) - (+! v1-6 1) - ) - (set! (-> this point v1-6 next) -134250495) - ) + (+! v1-6 1)) + (set! (-> this point v1-6 next) -134250495)) 0 - (none) - ) + (none)) (defmethod tracking-spline-method-13 ((this tracking-spline) (arg0 int)) (let ((v1-3 (-> this point arg0 next))) (cond - ((= v1-3 -134250495) - ) - ((= (-> this point v1-3 next) -134250495) - ) + ((= v1-3 -134250495)) + ((= (-> this point v1-3 next) -134250495)) (else - (set! (-> this point arg0 next) (-> this point v1-3 next)) - (set! (-> this summed-len) (- (-> this summed-len) (-> this point v1-3 tp-length))) - (set! (-> this point v1-3 next) (-> this free-point)) - (set! (-> this free-point) v1-3) - (+! (-> this point v1-3 incarnation) 1) - (let ((v1-11 (-> this point arg0 next))) - (set! (-> this summed-len) (- (-> this summed-len) (-> this point arg0 tp-length))) - (vector-! - (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 arg0))) - (the-as vector (-> this point v1-11)) - (the-as vector (-> this point arg0)) - ) - ) - (set! (-> this point arg0 tp-length) - (vector-normalize-ret-len! (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 arg0))) 1.0) - ) - (+! (-> this summed-len) (-> this point arg0 tp-length)) - (+! (-> this used-count) -1) - ) - ) - ) + (set! (-> this point arg0 next) (-> this point v1-3 next)) + (set! (-> this summed-len) (- (-> this summed-len) (-> this point v1-3 tp-length))) + (set! (-> this point v1-3 next) (-> this free-point)) + (set! (-> this free-point) v1-3) + (+! (-> this point v1-3 incarnation) 1) + (let ((v1-11 (-> this point arg0 next))) + (set! (-> this summed-len) (- (-> this summed-len) (-> this point arg0 tp-length))) + (vector-! (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 arg0))) + (the-as vector (-> this point v1-11)) + (the-as vector (-> this point arg0)))) + (set! (-> this point arg0 tp-length) + (vector-normalize-ret-len! (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 arg0))) 1.0)) + (+! (-> this summed-len) (-> this point arg0 tp-length)) + (+! (-> this used-count) -1)))) 0 - (none) - ) + (none)) (defmethod tracking-spline-method-14 ((this tracking-spline) (arg0 tracking-spline-sampler)) (let ((v1-0 (-> this used-point))) (set! (-> this partial-point) (-> arg0 partial-pt)) (when (= (-> this next-to-last-point) v1-0) (set! (-> this summed-len) (-> this point v1-0 tp-length)) - (if (= (-> arg0 cur-pt) (-> this end-point)) - (set! (-> this partial-point) 0.99999) - ) - ) + (if (= (-> arg0 cur-pt) (-> this end-point)) (set! (-> this partial-point) 0.99999))) (when (!= (-> arg0 cur-pt) v1-0) - (while (and (!= (-> this point v1-0 next) (-> arg0 cur-pt)) - (!= (-> this point v1-0 next) (-> this next-to-last-point)) - ) + (while (and (!= (-> this point v1-0 next) (-> arg0 cur-pt)) (!= (-> this point v1-0 next) (-> this next-to-last-point))) (set! (-> this summed-len) (- (-> this summed-len) (-> this point v1-0 tp-length))) (+! (-> this point v1-0 incarnation) 1) (+! (-> this used-count) -1) - (set! v1-0 (-> this point v1-0 next)) - ) + (set! v1-0 (-> this point v1-0 next))) (set! (-> this summed-len) (- (-> this summed-len) (-> this point v1-0 tp-length))) (+! (-> this point v1-0 incarnation) 1) (+! (-> this used-count) -1) @@ -532,312 +284,197 @@ (set! (-> this free-point) (-> this used-point)) (set! (-> this used-point) (-> arg0 cur-pt)) (cond - ((= (-> arg0 cur-pt) (-> this end-point)) - (set! (-> this partial-point) 0.0) - (set! (-> this summed-len) 0.0) - ) + ((= (-> arg0 cur-pt) (-> this end-point)) (set! (-> this partial-point) 0.0) (set! (-> this summed-len) 0.0)) ((= (-> arg0 cur-pt) (-> this next-to-last-point)) - (set! (-> this summed-len) (-> this point (-> this next-to-last-point) tp-length)) - ) - ) - ) - ) + (set! (-> this summed-len) (-> this point (-> this next-to-last-point) tp-length)))))) 0 - (none) - ) + (none)) (defmethod tracking-spline-method-15 ((this tracking-spline)) (let ((s5-0 (new 'stack-no-clear 'tracking-spline-sampler))) (let ((a2-0 (new 'stack-no-clear 'tracking-point))) (set! (-> s5-0 cur-pt) (-> this used-point)) (set! (-> s5-0 partial-pt) (-> this partial-point)) - (tracking-spline-method-19 this (-> this sample-len) (the-as vector a2-0) s5-0) - ) + (tracking-spline-method-19 this (-> this sample-len) (the-as vector a2-0) s5-0)) (if (or (= (-> s5-0 cur-pt) (-> this end-point)) (= (-> s5-0 cur-pt) (-> this next-to-last-point)) - (= (-> this point (-> s5-0 cur-pt) next) (-> this next-to-last-point)) - ) - (set! (-> s5-0 cur-pt) (-> this used-point)) - ) + (= (-> this point (-> s5-0 cur-pt) next) (-> this next-to-last-point))) + (set! (-> s5-0 cur-pt) (-> this used-point))) (let ((v1-15 (-> this point (-> s5-0 cur-pt) next))) (when (!= v1-15 -134250495) (let ((a0-14 (-> this point v1-15 next)) (a1-1 v1-15) - (f0-2 -2.0) - ) + (f0-2 -2.0)) 0.0 (while (not (or (= a0-14 -134250495) (= a0-14 (-> this end-point)))) - (let ((f1-2 (vector-dot - (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 v1-15))) - (the-as vector (+ (the-as uint (the-as vector (-> this point 0 direction))) (* 48 a0-14))) - ) - ) - ) + (let ((f1-2 (vector-dot (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 v1-15))) + (the-as vector (+ (the-as uint (the-as vector (-> this point 0 direction))) (* 48 a0-14)))))) (when (>= f1-2 f0-2) (set! f0-2 f1-2) - (set! a1-1 v1-15) - ) - ) + (set! a1-1 v1-15))) (set! v1-15 a0-14) - (set! a0-14 (-> this point v1-15 next)) - ) - (if (< -2.0 f0-2) - (tracking-spline-method-13 this a1-1) - ) - ) - ) - ) - ) + (set! a0-14 (-> this point v1-15 next))) + (if (< -2.0 f0-2) (tracking-spline-method-13 this a1-1)))))) 0 - (none) - ) + (none)) (defmethod tracking-spline-method-16 ((this tracking-spline) (arg0 float)) (let ((s4-0 (new 'stack-no-clear 'tracking-spline-sampler))) (let ((a2-0 (new 'stack-no-clear 'vector))) (set! (-> s4-0 cur-pt) (-> this used-point)) (set! (-> s4-0 partial-pt) (-> this partial-point)) - (tracking-spline-method-19 this (-> this sample-len) a2-0 s4-0) - ) + (tracking-spline-method-19 this (-> this sample-len) a2-0 s4-0)) (let ((s4-1 (-> this point (-> s4-0 cur-pt) next))) (when (!= s4-1 -134250495) (let ((v1-11 (-> this point s4-1 next))) (while (not (or (= v1-11 -134250495) (= (-> this point v1-11 next) -134250495) (= (-> this point v1-11 next) (-> this end-point)) - (= (-> this point v1-11 next) (-> this next-to-last-point)) - ) - ) + (= (-> this point v1-11 next) (-> this next-to-last-point)))) (if (< (* (-> this point s4-1 tp-length) - (+ 1.0 (vector-dot - (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 s4-1))) - (the-as vector (+ (the-as uint (the-as vector (-> this point 0 direction))) (* 48 v1-11))) - ) - ) - ) - arg0 - ) - (tracking-spline-method-13 this s4-1) - (set! s4-1 v1-11) - ) - (set! v1-11 (-> this point s4-1 next)) - ) - ) - ) - ) - ) + (+ 1.0 + (vector-dot (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 s4-1))) + (the-as vector (+ (the-as uint (the-as vector (-> this point 0 direction))) (* 48 v1-11)))))) + arg0) + (tracking-spline-method-13 this s4-1) + (set! s4-1 v1-11)) + (set! v1-11 (-> this point s4-1 next))))))) 0 - (none) - ) + (none)) (defmethod tracking-spline-method-17 ((this tracking-spline) (arg0 vector) (arg1 float) (arg2 float) (arg3 symbol)) (let ((s3-0 (-> this free-point)) - (s2-0 (-> this end-point)) - ) - (vector-! - (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 s2-0))) - arg0 - (the-as vector (-> this point s2-0)) - ) + (s2-0 (-> this end-point))) + (vector-! (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 s2-0))) + arg0 + (the-as vector (-> this point s2-0))) (set! (-> this point s2-0 tp-length) - (vector-normalize-ret-len! (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 s2-0))) 1.0) - ) - (if (< (-> this point s2-0 tp-length) arg1) - (return 0) - ) + (vector-normalize-ret-len! (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 s2-0))) 1.0)) + (if (< (-> this point s2-0 tp-length) arg1) (return 0)) (when (and arg3 (= s3-0 -134250495)) (tracking-spline-method-15 this) - (set! s3-0 (-> this free-point)) - ) + (set! s3-0 (-> this free-point))) (cond - ((= s3-0 -134250495) - (format 0 "ERROR : pos spline overflow~%") - ) + ((= s3-0 -134250495) (format 0 "ERROR : pos spline overflow~%")) (else - (+! (-> this summed-len) (-> this point s2-0 tp-length)) - (set! (-> this free-point) (-> this point s3-0 next)) - (set! (-> this point s2-0 next) s3-0) - (set! (-> this end-point) s3-0) - (set! (-> this next-to-last-point) s2-0) - (set! (-> this point s3-0 next) -134250495) - (set! (-> this point s3-0 position quad) (-> arg0 quad)) - (+! (-> this used-count) 1) - (if (< 0.0 arg2) - (tracking-spline-method-16 this arg2) - ) - ) - ) - ) - 0 - ) + (+! (-> this summed-len) (-> this point s2-0 tp-length)) + (set! (-> this free-point) (-> this point s3-0 next)) + (set! (-> this point s2-0 next) s3-0) + (set! (-> this end-point) s3-0) + (set! (-> this next-to-last-point) s2-0) + (set! (-> this point s3-0 next) -134250495) + (set! (-> this point s3-0 position quad) (-> arg0 quad)) + (+! (-> this used-count) 1) + (if (< 0.0 arg2) (tracking-spline-method-16 this arg2))))) + 0) (defmethod tracking-spline-method-18 ((this tracking-spline) (arg0 float) (arg1 vector) (arg2 tracking-spline-sampler)) (local-vars (f0-4 float)) (when (not arg2) (set! arg2 (new 'stack-no-clear 'tracking-spline-sampler)) (set! (-> arg2 cur-pt) (-> this used-point)) - (set! (-> arg2 partial-pt) (-> this partial-point)) - ) + (set! (-> arg2 partial-pt) (-> this partial-point))) 0.0 - (loop - (cond - ((= (-> arg2 cur-pt) (-> this end-point)) - (set! (-> arg2 partial-pt) 0.0) - (vector+! arg1 arg1 (the-as vector (-> this point (-> arg2 cur-pt)))) - (return arg1) - ) - ((begin (set! f0-4 (+ (-> arg2 partial-pt) (/ arg0 (-> this point (-> arg2 cur-pt) tp-length)))) (< f0-4 1.0)) - (set! (-> arg2 partial-pt) f0-4) - (let ((s5-0 (new 'stack-no-clear 'tracking-spline-sampler))) - (let ((a2-5 (-> this point (-> arg2 cur-pt) next))) - (vector-lerp! - (the-as vector s5-0) - (the-as vector (-> this point (-> arg2 cur-pt))) - (the-as vector (-> this point a2-5)) - f0-4 - ) - ) - (vector+! arg1 arg1 (the-as vector s5-0)) - ) - (return arg1) - ) - (else - (let ((f0-7 (* (- 1.0 (-> arg2 partial-pt)) (-> this point (-> arg2 cur-pt) tp-length)))) - (set! arg0 (- arg0 f0-7)) - ) - (set! (-> arg2 partial-pt) 0.0) - (set! (-> arg2 cur-pt) (-> this point (-> arg2 cur-pt) next)) - ) - ) - ) - (the-as vector #f) - ) + (loop (cond + ((= (-> arg2 cur-pt) (-> this end-point)) + (set! (-> arg2 partial-pt) 0.0) + (vector+! arg1 arg1 (the-as vector (-> this point (-> arg2 cur-pt)))) + (return arg1)) + ((begin + (set! f0-4 (+ (-> arg2 partial-pt) (/ arg0 (-> this point (-> arg2 cur-pt) tp-length)))) + (< f0-4 1.0)) + (set! (-> arg2 partial-pt) f0-4) + (let ((s5-0 (new 'stack-no-clear 'tracking-spline-sampler))) + (let ((a2-5 (-> this point (-> arg2 cur-pt) next))) + (vector-lerp! (the-as vector s5-0) + (the-as vector (-> this point (-> arg2 cur-pt))) + (the-as vector (-> this point a2-5)) + f0-4)) + (vector+! arg1 arg1 (the-as vector s5-0))) + (return arg1)) + (else + (let ((f0-7 (* (- 1.0 (-> arg2 partial-pt)) (-> this point (-> arg2 cur-pt) tp-length)))) (set! arg0 (- arg0 f0-7))) + (set! (-> arg2 partial-pt) 0.0) + (set! (-> arg2 cur-pt) (-> this point (-> arg2 cur-pt) next))))) + (the-as vector #f)) (defmethod tracking-spline-method-19 ((this tracking-spline) (arg0 float) (arg1 vector) (arg2 tracking-spline-sampler)) (vector-reset! arg1) (tracking-spline-method-18 this arg0 arg1 arg2) - arg1 - ) + arg1) (defmethod tracking-spline-method-20 ((this tracking-spline) (arg0 vector) (arg1 int)) (let ((s3-0 (new 'stack-no-clear 'vector))) - (vector-! - s3-0 - (the-as vector (-> this point (-> this used-point))) - (the-as vector (-> this point (-> this end-point))) - ) + (vector-! s3-0 (the-as vector (-> this point (-> this used-point))) (the-as vector (-> this point (-> this end-point)))) (let* ((f0-0 (vector-length s3-0)) - (f1-1 (* 0.33333334 (- 1.5 (* 0.00024414062 f0-0)))) - ) + (f1-1 (* 0.33333334 (- 1.5 (* 0.00024414062 f0-0))))) 0.0 (let* ((f1-2 (fmax 0.0 f1-1)) (f30-0 (+ 0.3 f1-2)) (f0-1 (cond ((< (-> *CAMERA-bank* min-detectable-velocity) (-> this summed-len)) (vector-float*! s3-0 s3-0 (/ 1.0 f0-0)) - (/ f0-0 (-> this summed-len)) - ) - (else - (vector-reset! s3-0) - 0.0 - ) - ) - ) + (/ f0-0 (-> this summed-len))) + (else (vector-reset! s3-0) 0.0))) (f0-2 (+ -0.2 f0-1)) (f1-9 (* 2.0 f0-2)) (f28-0 (fmin 1.0 (fmax 0.05 f1-9))) (v1-8 (-> this used-point)) - (s2-0 (new 'stack-no-clear 'vector)) - ) + (s2-0 (new 'stack-no-clear 'vector))) (while (and (!= v1-8 (-> this end-point)) (!= v1-8 (-> this next-to-last-point)) (!= v1-8 arg1)) (let ((s1-0 (-> this point v1-8 next))) - (vector-! - s2-0 - (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 s1-0))) - (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 v1-8))) - ) + (vector-! s2-0 + (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 s1-0))) + (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 v1-8)))) (let* ((f0-4 (vector-normalize-ret-len! s2-0 1.0)) (f0-5 (* 0.5 f0-4)) - (f26-0 (* (fmin 1.0 f0-5) f30-0 (vector-dot arg0 s2-0))) - ) + (f26-0 (* (fmin 1.0 f0-5) f30-0 (vector-dot arg0 s2-0)))) (let ((f2-7 (vector-dot s2-0 s3-0))) (cond - ((>= 0.0 f2-7) - ) - (else - (set! f26-0 (* f26-0 (fmax 0.0 (- 0.75 (fabs (* f28-0 f2-7)))))) - ) - ) - ) + ((>= 0.0 f2-7)) + (else (set! f26-0 (* f26-0 (fmax 0.0 (- 0.75 (fabs (* f28-0 f2-7))))))))) (cond ((< f26-0 0.0) (if (and *debug-segment* *display-camera-marks*) - (camera-line-rel-len - (the-as vector (-> this point s1-0)) - s2-0 - (* -40.96 f26-0) - (the-as vector4w (new 'static 'inline-array qword 1 - (new 'static 'qword :data (new 'static 'array uint32 4 #xff #xff #x0 #x80)) - ) - ) - ) - ) - (vector--float*! arg0 arg0 s2-0 f26-0) - ) + (camera-line-rel-len (the-as vector (-> this point s1-0)) + s2-0 + (* -40.96 f26-0) + (the-as vector4w + (new 'static 'inline-array qword 1 (new 'static 'qword :data (new 'static 'array uint32 4 #xff #xff #x0 #x80)))))) + (vector--float*! arg0 arg0 s2-0 f26-0)) ((and *debug-segment* *display-camera-marks*) - (camera-line-rel-len - (the-as vector (-> this point s1-0)) - s2-0 - (* 40.96 f26-0) - (the-as vector4w (new 'static 'inline-array qword 1 - (new 'static 'qword :data (new 'static 'array uint32 4 #x80 #x80 #x0 #x80)) - ) - ) - ) - ) - ) - ) - (set! v1-8 s1-0) - ) - ) - ) - ) - ) + (camera-line-rel-len (the-as vector (-> this point s1-0)) + s2-0 + (* 40.96 f26-0) + (the-as vector4w + (new 'static 'inline-array qword 1 (new 'static 'qword :data (new 'static 'array uint32 4 #x80 #x80 #x0 #x80)))))))) + (set! v1-8 s1-0)))))) 0 - (none) - ) + (none)) (defmethod tracking-spline-method-21 ((this tracking-spline) (arg0 vector) (arg1 float) (arg2 float)) (let ((v1-0 (-> this used-point)) - (f0-0 (-> this partial-point)) - ) + (f0-0 (-> this partial-point))) (let ((f1-0 (-> this summed-len))) 0.0 0.0 (let* ((f1-1 (- f1-0 (* f0-0 (-> this point v1-0 tp-length)))) (f2-5 (* 0.1 f1-1)) - (f2-8 (* (fmin arg1 (- f2-5 (-> this max-move))) (-> *display* time-adjust-ratio))) - ) - (set! (-> this max-move) (fmin arg2 (+ (-> this max-move) f2-8))) - ) - ) + (f2-8 (* (fmin arg1 (- f2-5 (-> this max-move))) (-> *display* time-adjust-ratio)))) + (set! (-> this max-move) (fmin arg2 (+ (-> this max-move) f2-8))))) (set! (-> this max-move) (fmax 0.4096 (-> this max-move))) (let ((f1-8 (-> this summed-len))) 0.0 (let* ((f2-14 (- f1-8 (* f0-0 (-> this point v1-0 tp-length)))) - (f2-16 (fmin 204.8 (- f2-14 (-> this sample-len)))) - ) - (set! (-> this sample-len) (fmin 16384.0 (+ (-> this sample-len) f2-16))) - ) - ) + (f2-16 (fmin 204.8 (- f2-14 (-> this sample-len))))) + (set! (-> this sample-len) (fmin 16384.0 (+ (-> this sample-len) f2-16))))) (let ((s4-0 (new 'stack-no-clear 'tracking-spline-sampler))) (set! (-> s4-0 cur-pt) v1-0) (set! (-> s4-0 partial-pt) f0-0) (tracking-spline-method-19 this (* (-> this max-move) (-> *display* time-adjust-ratio)) arg0 s4-0) (tracking-spline-method-14 this s4-0) (dotimes (s3-0 63) - (tracking-spline-method-18 this (* 0.015625 (-> this sample-len)) arg0 s4-0) - ) + (tracking-spline-method-18 this (* 0.015625 (-> this sample-len)) arg0 s4-0)) (vector-float*! arg0 arg0 0.015625) (let ((a2-3 (-> s4-0 cur-pt))) (set! (-> this debug-last-point) a2-3) @@ -846,14 +483,9 @@ (set! (-> this debug-out-position quad) (-> arg0 quad)) (vector-! s4-1 arg0 (-> this old-position)) (tracking-spline-method-20 this s4-1 a2-3) - (vector+! arg0 (-> this old-position) s4-1) - ) - ) - ) - ) + (vector+! arg0 (-> this old-position) s4-1))))) (set! (-> this old-position quad) (-> arg0 quad)) - arg0 - ) + arg0) (defmethod tracking-spline-method-22 ((this tracking-spline) (arg0 float)) (when (< arg0 (-> this summed-len)) @@ -861,107 +493,77 @@ (let ((a2-0 (new 'stack-no-clear 'vector))) (set! (-> s5-0 cur-pt) (-> this used-point)) (set! (-> s5-0 partial-pt) 0.0) - (tracking-spline-method-19 this (- (-> this summed-len) arg0) a2-0 s5-0) - ) - (tracking-spline-method-14 this s5-0) - ) - ) + (tracking-spline-method-19 this (- (-> this summed-len) arg0) a2-0 s5-0)) + (tracking-spline-method-14 this s5-0))) 0 - (none) - ) + (none)) (defmethod tracking-spline-method-9 ((this tracking-spline)) (let ((v1-0 (-> this used-point)) (s4-0 0) - (s5-0 0) - ) + (s5-0 0)) (while (!= v1-0 -134250495) (set! s5-0 (logior s5-0 (ash 1 v1-0))) (+! s4-0 1) - (set! v1-0 (-> this point v1-0 next)) - ) + (set! v1-0 (-> this point v1-0 next))) (when (!= s4-0 (-> this used-count)) - (if *debug-segment* - (format 0 "ERROR: tracking spline used count ~D actual ~D~%" (-> this used-count) s4-0) - ) - (set! (-> this used-count) s4-0) - ) + (if *debug-segment* (format 0 "ERROR: tracking spline used count ~D actual ~D~%" (-> this used-count) s4-0)) + (set! (-> this used-count) s4-0)) (let ((v1-9 (-> this free-point)) - (a3-1 0) - ) + (a3-1 0)) (while (!= v1-9 -134250495) (+! a3-1 1) - (set! v1-9 (-> this point v1-9 next)) - ) + (set! v1-9 (-> this point v1-9 next))) (when (!= a3-1 (- 32 (-> this used-count))) - (if *debug-segment* - (format 0 "ERROR: tracking spline free count ~D actual ~D~%" (- 32 (-> this used-count)) a3-1) - ) + (if *debug-segment* (format 0 "ERROR: tracking spline free count ~D actual ~D~%" (- 32 (-> this used-count)) a3-1)) (set! (-> this free-point) -134250495) (dotimes (v1-21 32) (when (not (logtest? s5-0 1)) (set! (-> this point v1-21 next) (-> this free-point)) - (set! (-> this free-point) v1-21) - ) - (set! s5-0 (shr s5-0 1)) - ) - ) - ) - ) + (set! (-> this free-point) v1-21)) + (set! s5-0 (shr s5-0 1)))))) 0 - (none) - ) + (none)) (defbehavior cam-slave-init-vars camera-slave () (cond (*camera* - (set! (-> self options) (-> *camera* slave-options)) - (set! (-> self change-event-from) (the-as (pointer process-drawable) (-> *camera* changer))) - ) + (set! (-> self options) (-> *camera* slave-options)) + (set! (-> self change-event-from) (the-as (pointer process-drawable) (-> *camera* changer)))) (else - (set! (-> self options) (the-as uint 0)) - (set! (-> self change-event-from) (the-as (pointer process-drawable) #f)) - ) - ) + (set! (-> self options) (the-as uint 0)) + (set! (-> self change-event-from) (the-as (pointer process-drawable) #f)))) (cond (*camera-combiner* - (set! (-> self trans quad) (-> *camera-combiner* trans quad)) - (let* ((v1-9 (-> self tracking)) - (a3-0 (-> *camera-combiner* inv-camera-rot)) - (a0-1 (-> a3-0 vector 0 quad)) - (a1-0 (-> a3-0 vector 1 quad)) - (a2-0 (-> a3-0 vector 2 quad)) - (a3-1 (-> a3-0 vector 3 quad)) - ) - (set! (-> v1-9 inv-mat vector 0 quad) a0-1) - (set! (-> v1-9 inv-mat vector 1 quad) a1-0) - (set! (-> v1-9 inv-mat vector 2 quad) a2-0) - (set! (-> v1-9 inv-mat vector 3 quad) a3-1) - ) - (when *camera-init-mat* - (let* ((a2-1 (-> self tracking)) - (a3-2 *camera-init-mat*) - (v1-12 (-> a3-2 vector 0 quad)) - (a0-2 (-> a3-2 vector 1 quad)) - (a1-1 (-> a3-2 vector 2 quad)) - (a3-3 (-> a3-2 vector 3 quad)) - ) - (set! (-> a2-1 inv-mat vector 0 quad) v1-12) - (set! (-> a2-1 inv-mat vector 1 quad) a0-2) - (set! (-> a2-1 inv-mat vector 2 quad) a1-1) - (set! (-> a2-1 inv-mat vector 3 quad) a3-3) - ) - ) - (set! (-> self fov) (-> *camera-combiner* fov)) - (set! (-> self velocity quad) (-> *camera-combiner* velocity quad)) - ) + (set! (-> self trans quad) (-> *camera-combiner* trans quad)) + (let* ((v1-9 (-> self tracking)) + (a3-0 (-> *camera-combiner* inv-camera-rot)) + (a0-1 (-> a3-0 vector 0 quad)) + (a1-0 (-> a3-0 vector 1 quad)) + (a2-0 (-> a3-0 vector 2 quad)) + (a3-1 (-> a3-0 vector 3 quad))) + (set! (-> v1-9 inv-mat vector 0 quad) a0-1) + (set! (-> v1-9 inv-mat vector 1 quad) a1-0) + (set! (-> v1-9 inv-mat vector 2 quad) a2-0) + (set! (-> v1-9 inv-mat vector 3 quad) a3-1)) + (when *camera-init-mat* + (let* ((a2-1 (-> self tracking)) + (a3-2 *camera-init-mat*) + (v1-12 (-> a3-2 vector 0 quad)) + (a0-2 (-> a3-2 vector 1 quad)) + (a1-1 (-> a3-2 vector 2 quad)) + (a3-3 (-> a3-2 vector 3 quad))) + (set! (-> a2-1 inv-mat vector 0 quad) v1-12) + (set! (-> a2-1 inv-mat vector 1 quad) a0-2) + (set! (-> a2-1 inv-mat vector 2 quad) a1-1) + (set! (-> a2-1 inv-mat vector 3 quad) a3-3))) + (set! (-> self fov) (-> *camera-combiner* fov)) + (set! (-> self velocity quad) (-> *camera-combiner* velocity quad))) (else - (vector-reset! (-> self trans)) - (matrix-identity! (the-as matrix (-> self tracking))) - (set! (-> self fov) 11650.845) - (vector-reset! (-> self velocity)) - ) - ) + (vector-reset! (-> self trans)) + (matrix-identity! (the-as matrix (-> self tracking))) + (set! (-> self fov) 11650.845) + (vector-reset! (-> self velocity)))) (set! (-> self time-dist-too-far) (the-as uint 0)) (set! (-> self intro-t) 1.0) (set! (-> self intro-t-step) 0.0) @@ -970,13 +572,7 @@ (set! (-> self enter-has-run) #f) (set! (-> self cam-entity) #f) (set! (-> self tracking no-follow) #f) - (init-cam-float-seeker - (-> self tracking tilt-adjust) - (-> *CAMERA-bank* default-tilt-adjust) - 9.102222 - 91.022224 - 0.25 - ) + (init-cam-float-seeker (-> self tracking tilt-adjust) (-> *CAMERA-bank* default-tilt-adjust) 9.102222 91.022224 0.25) (set! (-> self tracking follow-blend) 1.0) (set! (-> self have-phony-joystick) #f) (set! (-> self string-val-locked) #f) @@ -984,189 +580,116 @@ (init-cam-float-seeker (-> self tracking underwater-blend) 0.0 0.007 0.03 0.125) (set! (-> self tracking use-point-of-interest) #f) (tracking-spline-method-10 (-> self position-spline) (-> self trans)) - (none) - ) + (none)) (defun cam-slave-go ((arg0 state)) (with-pp (cam-slave-init-vars) - (let ((t9-1 (the-as (function object) enter-state))) - (set! (-> pp next-state) arg0) - (t9-1) - ) + (let ((t9-1 (the-as (function object) enter-state))) (set! (-> pp next-state) arg0) (t9-1)) 0 - (none) - ) - ) + (none))) (defbehavior cam-slave-init camera-slave ((arg0 state) (arg1 entity)) (stack-size-set! (-> self main-thread) 512) (change-to-last-brother self) - (if (and (nonzero? camera-slave-debug) *debug-segment*) - (add-connection *debug-engine* self camera-slave-debug self #f #f) - ) + (if (and (nonzero? camera-slave-debug) *debug-segment*) (add-connection *debug-engine* self camera-slave-debug self #f #f)) (cam-slave-init-vars) (let ((v1-7 'cam-voicebox) - (a0-4 (the-as basic (-> arg0 name))) - ) + (a0-4 (the-as basic (-> arg0 name)))) (cond - ((= (the-as symbol a0-4) v1-7) - ) - (arg1 - (set! (-> self cam-entity) arg1) - ) + ((= (the-as symbol a0-4) v1-7)) + (arg1 (set! (-> self cam-entity) arg1)) (else - (let ((a1-3 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-3 from) self) - (set! (-> a1-3 num-params) 1) - (set! (-> a1-3 message) 'slave-activated) - (set! (-> a1-3 param 0) (the-as uint self)) - (let ((t9-4 send-event-function)) - (set! a0-4 *camera*) - (t9-4 (the-as camera-master a0-4) a1-3) - ) - ) - ) - ) - (let ((t9-5 (the-as (function object object) (-> arg0 enter)))) - (if t9-5 - (t9-5 (the-as symbol a0-4)) - ) - ) + (let ((a1-3 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-3 from) self) + (set! (-> a1-3 num-params) 1) + (set! (-> a1-3 message) 'slave-activated) + (set! (-> a1-3 param 0) (the-as uint self)) + (let ((t9-4 send-event-function)) (set! a0-4 *camera*) (t9-4 (the-as camera-master a0-4) a1-3))))) + (let ((t9-5 (the-as (function object object) (-> arg0 enter)))) (if t9-5 (t9-5 (the-as symbol a0-4)))) (set! (-> self enter-has-run) #t) (set! (-> self event-hook) (-> arg0 event)) (let ((t9-6 (the-as (function object object) enter-state))) (set! (-> self next-state) arg0) - (t9-6 (the-as symbol a0-4)) - ) - ) + (t9-6 (the-as symbol a0-4)))) 0 - (none) - ) + (none)) (defbehavior cam-standard-event-handler camera-slave ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) (case arg2 (('go) (let ((v1-1 (-> arg3 param 0)) - (t9-0 (the-as (function object) enter-state)) - ) + (t9-0 (the-as (function object) enter-state))) (set! (-> self next-state) (the-as state v1-1)) - (t9-0) - ) - ) + (t9-0))) (('change-state 'change-state-no-go) (let ((s5-0 (the-as object (-> arg3 param 0)))) (cam-slave-init-vars) - (let ((t9-2 (the-as (function object) (-> (the-as state s5-0) enter)))) - (if t9-2 - (t9-2) - ) - ) + (let ((t9-2 (the-as (function object) (-> (the-as state s5-0) enter)))) (if t9-2 (t9-2))) (set! (-> self enter-has-run) #t) (set! (-> self event-hook) (-> (the-as state s5-0) event)) (when (= arg2 'change-state) - (let ((t9-3 (the-as (function object) enter-state))) - (set! (-> self next-state) (the-as state s5-0)) - (t9-3) - ) - ) - ) - ) + (let ((t9-3 (the-as (function object) enter-state))) (set! (-> self next-state) (the-as state s5-0)) (t9-3))))) (('point-of-interest) (cond ((-> arg3 param 0) (set! (-> self tracking use-point-of-interest) #t) (set! (-> self tracking point-of-interest quad) (-> (the-as vector (-> arg3 param 0)) quad)) - (set! (-> self tracking point-of-interest-blend target) 1.0) - ) - (else - (set! (-> self tracking use-point-of-interest) #f) - (set! (-> self tracking point-of-interest-blend target) 0.0) - ) - ) - ) + (set! (-> self tracking point-of-interest-blend target) 1.0)) + (else (set! (-> self tracking use-point-of-interest) #f) (set! (-> self tracking point-of-interest-blend target) 0.0)))) (('teleport) (cam-calc-follow! (-> self tracking) (-> self trans) #f) - (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self options)) (-> self fov) #f) - ) - ) - ) + (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self options)) (-> self fov) #f)))) (defbehavior cam-curve-pos camera-slave ((arg0 vector) (arg1 vector) (arg2 curve) (arg3 symbol)) (let ((s5-0 (new-stack-vector0))) 0.0 (let ((s2-0 (new-stack-vector0))) - (if arg1 - (set! (-> arg1 w) 0.0) - ) + (if arg1 (set! (-> arg1 w) 0.0)) (when (< (-> self intro-t) 1.0) (+! (-> self intro-t) (* (-> self intro-t-step) (-> *display* time-adjust-ratio))) - (if (< 1.0 (-> self intro-t)) - (set! (-> self intro-t) 1.0) - ) + (if (< 1.0 (-> self intro-t)) (set! (-> self intro-t) 1.0)) (curve-get-pos! s5-0 (parameter-ease-sin-clamp (-> self intro-t)) (-> self intro-curve)) (vector+! s5-0 s5-0 (-> self intro-offset)) (vector+! arg0 arg0 s5-0) (cond - ((not arg1) - ) + ((not arg1)) ((< (-> self intro-t) 0.5) (curve-get-pos! s2-0 (+ 0.0001 (parameter-ease-sin-clamp (-> self intro-t))) (-> self intro-curve)) (vector+! s2-0 s2-0 (-> self intro-offset)) (vector-! arg1 s2-0 s5-0) - (set! (-> arg1 w) 1.0) - ) + (set! (-> arg1 w) 1.0)) (else - (curve-get-pos! s2-0 (+ -0.0001 (parameter-ease-sin-clamp (-> self intro-t))) (-> self intro-curve)) - (vector+! s2-0 s2-0 (-> self intro-offset)) - (vector-! arg1 s5-0 s2-0) - (set! (-> arg1 w) 1.0) - ) - ) - ) - ) + (curve-get-pos! s2-0 (+ -0.0001 (parameter-ease-sin-clamp (-> self intro-t))) (-> self intro-curve)) + (vector+! s2-0 s2-0 (-> self intro-offset)) + (vector-! arg1 s5-0 s2-0) + (set! (-> arg1 w) 1.0))))) (cond - ((not (-> self spline-exists)) - ) + ((not (-> self spline-exists))) ((= (-> self spline-follow-dist) 0.0) (let ((f0-18 (if arg3 - (cam-index-method-10 (-> self index) (-> self tracking follow-pt)) - (cam-index-method-10 (-> self index) (-> *camera* tpos-curr-adj)) - ) - ) - ) - (curve-get-pos! s5-0 f0-18 (-> self spline-curve)) - ) + (cam-index-method-10 (-> self index) (-> self tracking follow-pt)) + (cam-index-method-10 (-> self index) (-> *camera* tpos-curr-adj))))) + (curve-get-pos! s5-0 f0-18 (-> self spline-curve))) (vector+! s5-0 s5-0 (-> self spline-offset)) - (vector+! arg0 arg0 s5-0) - ) + (vector+! arg0 arg0 s5-0)) (else - (let ((s3-1 (new 'stack-no-clear 'vector))) - (curve-length (-> self spline-curve)) - (if arg3 - (set! (-> s3-1 quad) (-> self tracking follow-pt quad)) - (set! (-> s3-1 quad) (-> *camera* tpos-curr-adj quad)) - ) - (set! (-> self spline-tt) - (curve-closest-point (-> self spline-curve) s3-1 (-> self spline-tt) 1024.0 10 (-> self spline-follow-dist)) - ) - ) - (curve-get-pos! s5-0 (-> self spline-tt) (-> self spline-curve)) - (vector+! s5-0 s5-0 (-> self spline-offset)) - (vector+! arg0 arg0 s5-0) - ) - ) - ) - arg0 - ) + (let ((s3-1 (new 'stack-no-clear 'vector))) + (curve-length (-> self spline-curve)) + (if arg3 (set! (-> s3-1 quad) (-> self tracking follow-pt quad)) (set! (-> s3-1 quad) (-> *camera* tpos-curr-adj quad))) + (set! (-> self spline-tt) + (curve-closest-point (-> self spline-curve) s3-1 (-> self spline-tt) 1024.0 10 (-> self spline-follow-dist)))) + (curve-get-pos! s5-0 (-> self spline-tt) (-> self spline-curve)) + (vector+! s5-0 s5-0 (-> self spline-offset)) + (vector+! arg0 arg0 s5-0)))) + arg0) (defbehavior cam-curve-setup camera-slave ((arg0 vector)) (when (get-curve-data! (-> self cam-entity) (-> self spline-curve) 'campath 'campath-k -1000000000.0) (curve-get-pos! (-> self spline-offset) 0.0 (-> self spline-curve)) (vector-negate! (-> self spline-offset) (-> self spline-offset)) (cam-index-method-9 (-> self index) 'campoints (-> self cam-entity) arg0 (-> self spline-curve)) - (set! (-> self spline-exists) #t) - ) + (set! (-> self spline-exists) #t)) (cond ((get-curve-data! (-> self cam-entity) (-> self intro-curve) 'intro 'intro-k -1000000000.0) (curve-get-pos! (-> self intro-offset) 1.0 (-> self intro-curve)) @@ -1174,42 +697,28 @@ (set! (-> self intro-t) 0.0) (set! (-> self intro-t-step) (cam-slave-get-intro-step (-> self cam-entity))) (set! (-> self outro-exit-value) (cam-slave-get-float (-> self cam-entity) 'intro-exitValue 0.0)) - (if (= (-> self outro-exit-value) 0.0) - (set! (-> self outro-exit-value) 0.5) - ) - ) - (else - (set! (-> self intro-t) 1.0) - (set! (-> self intro-t-step) 0.0) - ) - ) - (if (nonzero? (-> *camera* no-intro)) - (set! (-> self intro-t) 1.0) - ) + (if (= (-> self outro-exit-value) 0.0) (set! (-> self outro-exit-value) 0.5))) + (else (set! (-> self intro-t) 1.0) (set! (-> self intro-t-step) 0.0))) + (if (nonzero? (-> *camera* no-intro)) (set! (-> self intro-t) 1.0)) 0 - (none) - ) + (none)) (defun cam-calc-follow! ((arg0 cam-rotation-tracker) (arg1 vector) (arg2 symbol)) (cond (arg2 - (update! (-> arg0 tilt-adjust) 0.0) - (update! (-> arg0 point-of-interest-blend) 0.0) - (update! (-> arg0 underwater-blend) 0.0) - ) + (update! (-> arg0 tilt-adjust) 0.0) + (update! (-> arg0 point-of-interest-blend) 0.0) + (update! (-> arg0 underwater-blend) 0.0)) (else - (jump-to-target! (-> arg0 tilt-adjust) 0.0) - (jump-to-target! (-> arg0 point-of-interest-blend) 0.0) - (jump-to-target! (-> arg0 underwater-blend) 0.0) - ) - ) + (jump-to-target! (-> arg0 tilt-adjust) 0.0) + (jump-to-target! (-> arg0 point-of-interest-blend) 0.0) + (jump-to-target! (-> arg0 underwater-blend) 0.0))) (cond ((send-event *camera* 'slave-option? #x4000) (let ((s3-0 (new 'stack-no-clear 'vector)) (s2-0 (new 'stack-no-clear 'vector)) (f30-0 (vector-vector-distance (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj))) - (s5-1 (new 'stack-no-clear 'vector)) - ) + (s5-1 (new 'stack-no-clear 'vector))) (vector-flatten! s3-0 (-> *camera* tgt-face-mat vector 2) (-> *camera* local-down)) (vector-normalize! s3-0 1.0) (vector-! s2-0 (-> *camera* tpos-curr-adj) arg1) @@ -1218,93 +727,55 @@ (vector-float*! s5-1 (-> *camera* tgt-face-mat vector 2) 32768.0) (let* ((f30-1 (lerp-clamp 0.7 0.4 (parameter-ease-sin-clamp (* 0.00081380206 (+ -409.6 f30-0))))) (f0-4 (acos (vector-dot s2-0 s3-0))) - (f28-0 (fmax 1820.4445 f0-4)) - ) + (f28-0 (fmax 1820.4445 f0-4))) (if (< f28-0 8192.0) - (vector-float*! - s5-1 - s5-1 - (+ f30-1 - (* (/ (- 1.0 f30-1) (- 1.0 (cos 32768.0))) (+ (- (cos 32768.0)) (cos (* 5.142857 (- 8192.0 f28-0))))) - ) - ) - ) - ) + (vector-float*! s5-1 + s5-1 + (+ f30-1 (* (/ (- 1.0 f30-1) (- 1.0 (cos 32768.0))) (+ (- (cos 32768.0)) (cos (* 5.142857 (- 8192.0 f28-0))))))))) (cond - ((< (-> *camera* ease-t) 1.0) - ) + ((< (-> *camera* ease-t) 1.0)) ((< (-> arg0 follow-blend) 1.0) (let* ((f0-18 (-> arg0 follow-blend)) (f0-19 (* f0-18 f0-18)) - (f0-20 (* f0-19 f0-19)) - ) + (f0-20 (* f0-19 f0-19))) (vector-! s5-1 s5-1 (-> arg0 follow-off)) - (vector-float*! s5-1 s5-1 f0-20) - ) + (vector-float*! s5-1 s5-1 f0-20)) (+! (-> arg0 follow-blend) (* 0.016666668 (-> *display* time-adjust-ratio))) - (vector+! (-> arg0 follow-off) (-> arg0 follow-off) s5-1) - ) - (else - (set! (-> arg0 follow-off quad) (-> s5-1 quad)) - ) - ) - ) + (vector+! (-> arg0 follow-off) (-> arg0 follow-off) s5-1)) + (else (set! (-> arg0 follow-off quad) (-> s5-1 quad))))) (vector+! (-> arg0 follow-pt) (-> *camera* tpos-curr-adj) (-> arg0 follow-off)) - (vector--float*! - (-> arg0 follow-pt) - (-> arg0 follow-pt) - (-> *camera* local-down) - (+ 12288.0 (-> *camera* target-height)) - ) - ) + (vector--float*! (-> arg0 follow-pt) + (-> arg0 follow-pt) + (-> *camera* local-down) + (+ 12288.0 (-> *camera* target-height)))) (else - 0.0 - (let ((s3-2 (new-stack-vector0))) - (set! (-> arg0 follow-blend) 0.0) - (cond - ((-> arg0 no-follow) - (vector-reset! s3-2) - ) - (else - (vector-! s3-2 (-> *camera* tpos-curr-adj) arg1) - (vector-normalize! s3-2 1.0) - (let* ((f0-28 (vector-dot (-> *camera* tgt-rot-mat vector 2) s3-2)) - (f30-2 (cond - ((< f0-28 0.0) - 1.0 - ) - (else - (let* ((f0-29 (* f0-28 f0-28)) - (f0-30 (- 1.0 f0-29)) - ) - (* f0-30 (* f0-30 f0-30)) - ) - ) - ) - ) - ) - (vector-! s3-2 arg1 (-> *camera* tpos-curr-adj)) - (vector-flatten! s3-2 s3-2 (-> *camera* local-down)) - (let* ((f0-33 (* 0.000022194603 (+ -20480.0 (vector-length s3-2)))) - (f0-34 (fmin 1.0 f0-33)) - (f0-35 (fmax 0.0 f0-34)) - ) - (vector-float*! s3-2 (-> *camera* tgt-rot-mat vector 2) (* (lerp 2048.0 8192.0 f0-35) f30-2)) - ) - ) - ) - ) - (if arg2 - (vector-seek-3d-smooth! (-> arg0 follow-off) s3-2 (* 20480.0 (seconds-per-frame)) 0.05) - (set! (-> arg0 follow-off quad) (-> s3-2 quad)) - ) - ) - (vector+! (-> arg0 follow-pt) (-> *camera* tpos-curr-adj) (-> arg0 follow-off)) - (vector--float*! (-> arg0 follow-pt) (-> arg0 follow-pt) (-> *camera* local-down) (-> *camera* target-height)) - ) - ) - (-> arg0 follow-pt) - ) + 0.0 + (let ((s3-2 (new-stack-vector0))) + (set! (-> arg0 follow-blend) 0.0) + (cond + ((-> arg0 no-follow) (vector-reset! s3-2)) + (else + (vector-! s3-2 (-> *camera* tpos-curr-adj) arg1) + (vector-normalize! s3-2 1.0) + (let* ((f0-28 (vector-dot (-> *camera* tgt-rot-mat vector 2) s3-2)) + (f30-2 (cond + ((< f0-28 0.0) 1.0) + (else + (let* ((f0-29 (* f0-28 f0-28)) + (f0-30 (- 1.0 f0-29))) + (* f0-30 (* f0-30 f0-30))))))) + (vector-! s3-2 arg1 (-> *camera* tpos-curr-adj)) + (vector-flatten! s3-2 s3-2 (-> *camera* local-down)) + (let* ((f0-33 (* 0.000022194603 (+ -20480.0 (vector-length s3-2)))) + (f0-34 (fmin 1.0 f0-33)) + (f0-35 (fmax 0.0 f0-34))) + (vector-float*! s3-2 (-> *camera* tgt-rot-mat vector 2) (* (lerp 2048.0 8192.0 f0-35) f30-2)))))) + (if arg2 + (vector-seek-3d-smooth! (-> arg0 follow-off) s3-2 (* 20480.0 (seconds-per-frame)) 0.05) + (set! (-> arg0 follow-off quad) (-> s3-2 quad)))) + (vector+! (-> arg0 follow-pt) (-> *camera* tpos-curr-adj) (-> arg0 follow-off)) + (vector--float*! (-> arg0 follow-pt) (-> arg0 follow-pt) (-> *camera* local-down) (-> *camera* target-height)))) + (-> arg0 follow-pt)) (defun mat-remove-z-rot ((arg0 matrix) (arg1 vector)) (let ((s4-0 (new-stack-vector0))) @@ -1318,107 +789,60 @@ (when (< f30-0 0.99999) (vector-cross! s4-0 (-> arg0 vector 1) s4-0) (let ((f0-4 (vector-length s4-0))) - (if (< 0.0 (vector-dot s4-0 (-> arg0 vector 2))) - (set! f0-4 (- f0-4)) - ) - (matrix-axis-sin-cos! s5-0 (-> arg0 vector 2) f0-4 f30-0) - ) - (matrix*! arg0 arg0 s5-0) - ) - ) - ) - ) - arg0 - ) + (if (< 0.0 (vector-dot s4-0 (-> arg0 vector 2))) (set! f0-4 (- f0-4))) + (matrix-axis-sin-cos! s5-0 (-> arg0 vector 2) f0-4 f30-0)) + (matrix*! arg0 arg0 s5-0))))) + arg0) (defun slave-matrix-blend-2 ((arg0 matrix) (arg1 float) (arg2 vector) (arg3 matrix)) (let ((s1-0 (new-stack-vector0)) - (s4-0 (new-stack-quaternion0)) - ) + (s4-0 (new-stack-quaternion0))) (let ((s2-0 (new-stack-quaternion0)) - (gp-0 (new-stack-quaternion0)) - ) + (gp-0 (new-stack-quaternion0))) 0.0 (let* ((f0-1 (cond - ((logtest? (the-as int arg1) 4) - (vector-length arg2) - ) - (else - (vector-flatten! s1-0 arg2 (-> *camera* local-down)) - (vector-length s1-0) - ) - ) - ) - (f0-3 (* 0.00048828125 (+ -1024.0 f0-1))) - ) + ((logtest? (the-as int arg1) 4) (vector-length arg2)) + (else (vector-flatten! s1-0 arg2 (-> *camera* local-down)) (vector-length s1-0)))) + (f0-3 (* 0.00048828125 (+ -1024.0 f0-1)))) (cond - ((< f0-3 0.0) - (set! f0-3 0.0) - ) - ((< 1.0 f0-3) - (set! f0-3 1.0) - ) - ) + ((< f0-3 0.0) (set! f0-3 0.0)) + ((< 1.0 f0-3) (set! f0-3 1.0))) (let ((f30-0 (* 364.0889 (-> *display* time-adjust-ratio) f0-3))) (matrix->quaternion s4-0 arg0) (matrix->quaternion s2-0 arg3) (quaternion-conjugate! gp-0 s4-0) (quaternion*! gp-0 gp-0 s2-0) (quaternion-normalize! gp-0) - (if (< (-> gp-0 w) 0.0) - (quaternion-negate! gp-0 gp-0) - ) + (if (< (-> gp-0 w) 0.0) (quaternion-negate! gp-0 gp-0)) (let ((f28-0 (acos (-> gp-0 w)))) - (if (< (* 0.25 (-> *display* time-adjust-ratio) f28-0) f30-0) - (set! f30-0 (* 0.25 (-> *display* time-adjust-ratio) f28-0)) - ) + (if (< (* 0.25 (-> *display* time-adjust-ratio) f28-0) f30-0) (set! f30-0 (* 0.25 (-> *display* time-adjust-ratio) f28-0))) (cond - ((< (-> gp-0 w) 0.9999999) - (quaternion-float*! gp-0 gp-0 (/ (sin f30-0) (sin f28-0))) - (set! (-> gp-0 w) (cos f30-0)) - ) - (else - (quaternion-identity! gp-0) - ) - ) - ) - ) - ) - (quaternion*! s4-0 s4-0 gp-0) - ) + ((< (-> gp-0 w) 0.9999999) (quaternion-float*! gp-0 gp-0 (/ (sin f30-0) (sin f28-0))) (set! (-> gp-0 w) (cos f30-0))) + (else (quaternion-identity! gp-0)))))) + (quaternion*! s4-0 s4-0 gp-0)) (quaternion-normalize! s4-0) - (quaternion->matrix arg0 s4-0) - ) - ) + (quaternion->matrix arg0 s4-0))) (defun vector-into-frustum-nosmooth! ((arg0 matrix) (arg1 vector) (arg2 float)) (local-vars (sv-112 (inline-array vector)) (sv-128 vector) (sv-144 vector) (sv-160 vector) (sv-176 vector)) (rlet ((vf0 :class vf) (vf1 :class vf) - (vf2 :class vf) - ) + (vf2 :class vf)) (init-vf0-vector) (let ((s5-0 (new-stack-matrix0))) (let ((s3-0 (new-stack-vector0)) - (s2-0 (new-stack-vector0)) - ) + (s2-0 (new-stack-vector0))) 0.0 0.0 (let ((f30-0 1.0) - (s4-0 #t) - ) + (s4-0 #t)) (vector-! s3-0 (-> *camera* tpos-curr) arg1) (vector-flatten! s3-0 s3-0 (-> arg0 vector 1)) (vector-normalize! s3-0 1.0) (let ((f28-0 (vector-dot s3-0 (the-as vector (-> arg0 vector))))) (set! sv-128 s2-0) (set! sv-112 (-> arg0 vector)) - (let ((f0-6 (* 0.8 (tan (* 0.5 arg2))))) - (.lvf vf1 (&-> sv-112 0 quad)) - (let ((v1-6 f0-6)) - (.mov vf2 v1-6) - ) - ) + (let ((f0-6 (* 0.8 (tan (* 0.5 arg2))))) (.lvf vf1 (&-> sv-112 0 quad)) (let ((v1-6 f0-6)) (.mov vf2 v1-6))) (.add.x.vf vf1 vf0 vf0 :mask #b1000) (.mul.x.vf vf1 vf1 vf2 :mask #b111) (.svf (&-> sv-128 quad) vf1) @@ -1426,15 +850,10 @@ (vector-normalize! s2-0 1.0) (let ((f0-8 (vector-dot s2-0 (the-as vector (-> arg0 vector))))) (when (< f0-8 (fabs f28-0)) - (if (< f28-0 0.0) - (vector--float*! s2-0 s2-0 (the-as vector (-> arg0 vector)) (* 2.0 f0-8)) - ) + (if (< f28-0 0.0) (vector--float*! s2-0 s2-0 (the-as vector (-> arg0 vector)) (* 2.0 f0-8))) (matrix-from-two-vectors! s5-0 s2-0 s3-0) (vector-matrix*! (-> arg0 vector 2) (-> arg0 vector 2) s5-0) - (vector-cross! (the-as vector (-> arg0 vector)) (-> arg0 vector 1) (-> arg0 vector 2)) - ) - ) - ) + (vector-cross! (the-as vector (-> arg0 vector)) (-> arg0 vector 1) (-> arg0 vector 2))))) (vector-! s3-0 (-> *camera* tpos-curr) (-> *camera* pitch-off)) (vector-! s3-0 s3-0 arg1) (vector--float*! s3-0 s3-0 (-> *camera* local-down) (-> *camera* foot-offset)) @@ -1443,12 +862,7 @@ (let ((f28-1 (vector-dot s3-0 (-> arg0 vector 1)))) (set! sv-160 s2-0) (set! sv-144 (-> arg0 vector 1)) - (let ((f0-15 (* 0.525 (tan (* 0.5 arg2))))) - (.lvf vf1 (&-> sv-144 quad)) - (let ((v1-23 f0-15)) - (.mov vf2 v1-23) - ) - ) + (let ((f0-15 (* 0.525 (tan (* 0.5 arg2))))) (.lvf vf1 (&-> sv-144 quad)) (let ((v1-23 f0-15)) (.mov vf2 v1-23))) (.add.x.vf vf1 vf0 vf0 :mask #b1000) (.mul.x.vf vf1 vf1 vf2 :mask #b111) (.svf (&-> sv-160 quad) vf1) @@ -1457,10 +871,7 @@ (let ((f0-17 (vector-dot s2-0 (-> arg0 vector 1)))) (when (and (< f28-1 0.0) (< f0-17 (- f28-1))) (vector--float*! s2-0 s2-0 (-> arg0 vector 1) (* 2.0 f0-17)) - (set! f30-0 (vector-dot s2-0 s3-0)) - ) - ) - ) + (set! f30-0 (vector-dot s2-0 s3-0))))) (vector-! s3-0 (-> *camera* tpos-curr) (-> *camera* pitch-off)) (vector-! s3-0 s3-0 arg1) (vector--float*! s3-0 s3-0 (-> *camera* local-down) (-> *camera* head-offset)) @@ -1469,43 +880,16 @@ (let ((f28-2 (vector-dot s3-0 (-> arg0 vector 1)))) (let ((s0-1 s2-0)) (set! sv-176 (-> arg0 vector 1)) - (let ((f0-25 (* 0.525 (tan (* 0.5 arg2))))) - (vector-float*! s0-1 sv-176 f0-25) - ) - ) + (let ((f0-25 (* 0.525 (tan (* 0.5 arg2))))) (vector-float*! s0-1 sv-176 f0-25))) (vector+! s2-0 s2-0 (-> arg0 vector 2)) (vector-normalize! s2-0 1.0) (let ((f0-27 (vector-dot s2-0 (-> arg0 vector 1)))) (cond - ((and (< 0.0 f28-2) (< f0-27 f28-2)) - (set! f30-0 (vector-dot s2-0 s3-0)) - (set! s4-0 #f) - ) - ((< f30-0 0.0) - (let ((f0-32 (- (vector-dot s2-0 s3-0)))) - (if (< f0-32 f30-0) - (set! f30-0 f0-32) - ) - ) - ) - ) - ) - ) - (let ((f0-34 (if s4-0 - (- (acos f30-0)) - (acos f30-0) - ) - ) - ) - (matrix-axis-angle! s5-0 (the-as vector (-> arg0 vector)) f0-34) - ) - ) - ) - (vector-matrix*! (-> arg0 vector 2) (-> arg0 vector 2) s5-0) - ) - (vector-cross! (-> arg0 vector 1) (-> arg0 vector 2) (the-as vector (-> arg0 vector))) - ) - ) + ((and (< 0.0 f28-2) (< f0-27 f28-2)) (set! f30-0 (vector-dot s2-0 s3-0)) (set! s4-0 #f)) + ((< f30-0 0.0) (let ((f0-32 (- (vector-dot s2-0 s3-0)))) (if (< f0-32 f30-0) (set! f30-0 f0-32))))))) + (let ((f0-34 (if s4-0 (- (acos f30-0)) (acos f30-0)))) (matrix-axis-angle! s5-0 (the-as vector (-> arg0 vector)) f0-34)))) + (vector-matrix*! (-> arg0 vector 2) (-> arg0 vector 2) s5-0)) + (vector-cross! (-> arg0 vector 1) (-> arg0 vector 2) (the-as vector (-> arg0 vector))))) ;; ERROR: Unsupported inline assembly instruction kind - [mula.s f0, f3] ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] @@ -1517,17 +901,14 @@ (sv-208 vector) (sv-224 matrix) (sv-240 (function matrix vector float vector)) - (sv-256 matrix) - ) + (sv-256 matrix)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) - (vf6 :class vf) - ) + (vf6 :class vf)) (init-vf0-vector) (let ((s1-0 (new-stack-vector0)) - (s5-0 (new-stack-matrix0)) - ) + (s5-0 (new-stack-matrix0))) (let ((f30-0 (-> arg0 tilt-adjust value))) (cond ((< 0.0001 (-> arg0 point-of-interest-blend value)) @@ -1538,21 +919,12 @@ (vector-! sv-192 (-> arg0 point-of-interest) arg1) (vector-normalize! sv-192 (* f28-0 (-> arg0 point-of-interest-blend value))) (let ((v1-3 s1-0)) - (let ((a0-5 s1-0)) - (.mov.vf vf6 vf0 :mask #b1000) - (.lvf vf4 (&-> a0-5 quad)) - ) + (let ((a0-5 s1-0)) (.mov.vf vf6 vf0 :mask #b1000) (.lvf vf4 (&-> a0-5 quad))) (.lvf vf5 (&-> sv-192 quad)) (.add.vf vf6 vf4 vf5 :mask #b111) - (.svf (&-> v1-3 quad) vf6) - ) - (vector-normalize! s1-0 f28-0) - ) - ) - (else - (vector-! s1-0 (-> arg0 follow-pt) arg1) - ) - ) + (.svf (&-> v1-3 quad) vf6)) + (vector-normalize! s1-0 f28-0))) + (else (vector-! s1-0 (-> arg0 follow-pt) arg1))) (forward-down->inv-matrix s5-0 s1-0 (-> *camera* local-down)) (when (!= f30-0 0.0) 0.0 @@ -1566,91 +938,56 @@ (f2-0 (-> sv-208 z)) (f3-0 (-> v1-11 x)) (f4-0 (-> v1-11 y)) - (f5-0 (-> v1-11 z)) - ) + (f5-0 (-> v1-11 z))) ;; og:preserve-this inlined vector-dot ; (.mula.s f0-7 f3-0) ; (.madda.s f1-1 f4-0) ; (.madd.s f0-8 f2-0 f5-0) - (set! f0-8 (+ (* f0-7 f3-0) (* f1-1 f4-0) (* f2-0 f5-0))) - ) + (set! f0-8 (+ (* f0-7 f3-0) (* f1-1 f4-0) (* f2-0 f5-0)))) (let* ((f28-1 f0-8) - (f0-10 (acos (fabs f28-1))) - ) + (f0-10 (acos (fabs f28-1)))) (cond ((< 0.0 f30-0) - (set! f30-0 (if (< 0.0 f28-1) - (fmin f30-0 (fmax 0.0 (+ -2730.6667 f0-10))) - (fmin f30-0 (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-10)))) - ) - ) - ) + (set! f30-0 + (if (< 0.0 f28-1) (fmin f30-0 (fmax 0.0 (+ -2730.6667 f0-10))) (fmin f30-0 (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-10))))))) ((< f30-0 0.0) - (set! f30-0 (if (< 0.0 f28-1) - (fmax f30-0 (- (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-10))))) - (fmax f30-0 (- (fmax 0.0 (+ -2730.6667 f0-10)))) - ) - ) - ) - ) - ) + (set! f30-0 + (if (< 0.0 f28-1) + (fmax f30-0 (- (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-10))))) + (fmax f30-0 (- (fmax 0.0 (+ -2730.6667 f0-10))))))))) (matrix-rotate-x! sv-224 f30-0) (let ((t9-7 matrix*!) (a0-16 s5-0) - (a2-3 s5-0) - ) - (t9-7 a0-16 sv-224 a2-3) - ) - ) - ) + (a2-3 s5-0)) + (t9-7 a0-16 sv-224 a2-3)))) (if (and (= (-> *camera* under-water) 2) *target* (!= (-> *target* next-state name) 'target-swim-up)) - (set! (-> arg0 underwater-blend target) 1.0) - (set! (-> arg0 underwater-blend target) 0.0) - ) + (set! (-> arg0 underwater-blend target) 1.0) + (set! (-> arg0 underwater-blend target) 0.0)) (set! sv-240 vector-into-frustum-nosmooth!) (set! sv-256 s5-0) - (let ((a2-5 (lerp-clamp arg3 (* 0.25 arg3) (-> arg0 underwater-blend value)))) - (sv-240 sv-256 arg1 a2-5) - ) + (let ((a2-5 (lerp-clamp arg3 (* 0.25 arg3) (-> arg0 underwater-blend value)))) (sv-240 sv-256 arg1 a2-5)) (cond - (arg4 - (slave-matrix-blend-2 (-> arg0 inv-mat) arg2 s1-0 s5-0) - ) + (arg4 (slave-matrix-blend-2 (-> arg0 inv-mat) arg2 s1-0 s5-0)) (else - (let* ((v1-31 (-> arg0 inv-mat)) - (a3-2 s5-0) - (a0-22 (-> a3-2 vector 0 quad)) - (a1-16 (-> a3-2 vector 1 quad)) - (a2-7 (-> a3-2 vector 2 quad)) - (a3-3 (-> a3-2 vector 3 quad)) - ) - (set! (-> v1-31 vector 0 quad) a0-22) - (set! (-> v1-31 vector 1 quad) a1-16) - (set! (-> v1-31 vector 2 quad) a2-7) - (set! (-> v1-31 vector 3 quad) a3-3) - ) - ) - ) - ) + (let* ((v1-31 (-> arg0 inv-mat)) + (a3-2 s5-0) + (a0-22 (-> a3-2 vector 0 quad)) + (a1-16 (-> a3-2 vector 1 quad)) + (a2-7 (-> a3-2 vector 2 quad)) + (a3-3 (-> a3-2 vector 3 quad))) + (set! (-> v1-31 vector 0 quad) a0-22) + (set! (-> v1-31 vector 1 quad) a1-16) + (set! (-> v1-31 vector 2 quad) a2-7) + (set! (-> v1-31 vector 3 quad) a3-3))))) (mat-remove-z-rot (-> arg0 inv-mat) (-> *camera* local-down)) 0 - (none) - ) - ) + (none))) ;; ERROR: Unsupported inline assembly instruction kind - [mula.s f0, f3] ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defun v-slrp2! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 float) (arg4 vector) (arg5 float)) - (local-vars - (f0-10 float) - (f28-0 float) - (f30-0 float) - (sv-144 float) - (sv-160 vector) - (sv-176 matrix) - (sv-192 vector) - ) + (local-vars (f0-10 float) (f28-0 float) (f30-0 float) (sv-144 float) (sv-160 vector) (sv-176 matrix) (sv-192 vector)) (set! sv-144 arg5) (let ((s0-0 (new-stack-vector0))) (set! sv-160 (new 'stack-no-clear 'vector)) @@ -1666,35 +1003,24 @@ (set! (-> sv-176 vector 2 quad) (the-as uint128 0)) (set! (-> sv-176 vector 3 quad) (the-as uint128 0)) (cond - ((< 1.0 arg3) - (set! arg3 1.0) - ) - ((< arg3 0.0) - (set! arg3 0.0) - ) - ) + ((< 1.0 arg3) (set! arg3 1.0)) + ((< arg3 0.0) (set! arg3 0.0))) (cond (arg4 - (vector-flatten! s0-0 arg1 arg4) - (vector-flatten! sv-160 arg2 arg4) - (set! f30-0 (vector-normalize-ret-len! s0-0 1.0)) - (set! f28-0 (vector-normalize-ret-len! sv-160 1.0)) - (vector-normalize! (vector-cross! s3-0 sv-160 s0-0) 1.0) - (let ((f26-0 (vector-dot arg4 s3-0))) - (vector-normalize-copy! s3-0 arg4 1.0) - (if (< f26-0 0.0) - (vector-negate! s3-0 s3-0) - ) - ) - ) + (vector-flatten! s0-0 arg1 arg4) + (vector-flatten! sv-160 arg2 arg4) + (set! f30-0 (vector-normalize-ret-len! s0-0 1.0)) + (set! f28-0 (vector-normalize-ret-len! sv-160 1.0)) + (vector-normalize! (vector-cross! s3-0 sv-160 s0-0) 1.0) + (let ((f26-0 (vector-dot arg4 s3-0))) + (vector-normalize-copy! s3-0 arg4 1.0) + (if (< f26-0 0.0) (vector-negate! s3-0 s3-0)))) (else - (set! (-> s0-0 quad) (-> arg1 quad)) - (set! (-> sv-160 quad) (-> arg2 quad)) - (set! f30-0 (vector-normalize-ret-len! s0-0 1.0)) - (set! f28-0 (vector-normalize-ret-len! sv-160 1.0)) - (vector-normalize! (vector-cross! s3-0 arg2 arg1) 1.0) - ) - ) + (set! (-> s0-0 quad) (-> arg1 quad)) + (set! (-> sv-160 quad) (-> arg2 quad)) + (set! f30-0 (vector-normalize-ret-len! s0-0 1.0)) + (set! f28-0 (vector-normalize-ret-len! sv-160 1.0)) + (vector-normalize! (vector-cross! s3-0 arg2 arg1) 1.0))) (let ((t9-10 acos)) (let* ((v1-18 s0-0) (f0-9 (-> v1-18 x)) @@ -1702,47 +1028,30 @@ (f2-0 (-> v1-18 z)) (f3-0 (-> sv-160 x)) (f4-0 (-> sv-160 y)) - (f5-0 (-> sv-160 z)) - ) + (f5-0 (-> sv-160 z))) ;; og:preserve-this inlined vector-dot ; (.mula.s f0-9 f3-0) ; (.madda.s f1-2 f4-0) ; (.madd.s f0-10 f2-0 f5-0) - (set! f0-10 (+ (* f2-0 f5-0) (* f1-2 f4-0) (* f0-9 f3-0))) - ) + (set! f0-10 (+ (* f2-0 f5-0) (* f1-2 f4-0) (* f0-9 f3-0)))) (let* ((f1-3 (t9-10 f0-10)) - (f0-12 (* arg3 f1-3)) - ) + (f0-12 (* arg3 f1-3))) (when (< sv-144 f0-12) (set! f0-12 sv-144) - (set! arg3 (/ sv-144 f1-3)) - ) + (set! arg3 (/ sv-144 f1-3))) (let* ((f0-13 (cos f0-12)) (t9-12 matrix-axis-sin-cos!) (a0-20 sv-176) (a1-13 s3-0) (f1-5 1.0) - (f2-3 f0-13) - ) - (t9-12 a0-20 a1-13 (sqrtf (- f1-5 (* f2-3 f2-3))) f0-13) - ) - ) - ) + (f2-3 f0-13)) + (t9-12 a0-20 a1-13 (sqrtf (- f1-5 (* f2-3 f2-3))) f0-13)))) (vector-matrix*! arg0 s0-0 sv-176) - (let ((s0-1 vector-normalize!)) - (set! sv-192 arg0) - (let ((a1-16 (lerp f30-0 f28-0 arg3))) - (s0-1 sv-192 a1-16) - ) - ) + (let ((s0-1 vector-normalize!)) (set! sv-192 arg0) (let ((a1-16 (lerp f30-0 f28-0 arg3))) (s0-1 sv-192 a1-16))) (when arg4 (vector+float*! arg0 arg0 s3-0 (vector-dot arg1 s3-0)) - (vector+float*! arg0 arg0 s3-0 (* arg3 (vector-dot (vector-! (new-stack-vector0) arg2 arg1) s3-0))) - ) - ) - ) - arg0 - ) + (vector+float*! arg0 arg0 s3-0 (* arg3 (vector-dot (vector-! (new-stack-vector0) arg2 arg1) s3-0)))))) + arg0) ;; ERROR: Unsupported inline assembly instruction kind - [mula.s f0, f3] ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] @@ -1756,32 +1065,25 @@ 0.0 0.0 (let ((s3-0 (new-stack-vector0)) - (f30-0 1.0) - ) + (f30-0 1.0)) 0.0 (let ((s0-0 (new-stack-matrix0))) (cond (arg3 - (vector-flatten! s1-0 arg1 arg3) - (vector-flatten! sv-160 arg2 arg3) - (set! f28-0 (vector-normalize-ret-len! s1-0 1.0)) - (set! f26-0 (vector-normalize-ret-len! sv-160 1.0)) - (vector-normalize! (vector-cross! s3-0 sv-160 s1-0) 1.0) - (let ((f24-0 (vector-dot arg3 s3-0))) - (vector-normalize-copy! s3-0 arg3 1.0) - (if (< f24-0 0.0) - (vector-negate! s3-0 s3-0) - ) - ) - ) + (vector-flatten! s1-0 arg1 arg3) + (vector-flatten! sv-160 arg2 arg3) + (set! f28-0 (vector-normalize-ret-len! s1-0 1.0)) + (set! f26-0 (vector-normalize-ret-len! sv-160 1.0)) + (vector-normalize! (vector-cross! s3-0 sv-160 s1-0) 1.0) + (let ((f24-0 (vector-dot arg3 s3-0))) + (vector-normalize-copy! s3-0 arg3 1.0) + (if (< f24-0 0.0) (vector-negate! s3-0 s3-0)))) (else - (set! (-> s1-0 quad) (-> arg1 quad)) - (set! (-> sv-160 quad) (-> arg2 quad)) - (set! f28-0 (vector-normalize-ret-len! s1-0 1.0)) - (set! f26-0 (vector-normalize-ret-len! sv-160 1.0)) - (vector-normalize! (vector-cross! s3-0 arg2 arg1) 1.0) - ) - ) + (set! (-> s1-0 quad) (-> arg1 quad)) + (set! (-> sv-160 quad) (-> arg2 quad)) + (set! f28-0 (vector-normalize-ret-len! s1-0 1.0)) + (set! f26-0 (vector-normalize-ret-len! sv-160 1.0)) + (vector-normalize! (vector-cross! s3-0 arg2 arg1) 1.0))) (let ((t9-10 acos)) (let* ((v1-9 s1-0) (f0-6 (-> v1-9 x)) @@ -1789,38 +1091,26 @@ (f2-0 (-> v1-9 z)) (f3-0 (-> sv-160 x)) (f4-0 (-> sv-160 y)) - (f5-0 (-> sv-160 z)) - ) + (f5-0 (-> sv-160 z))) ;; og:preserve-this inlined vector-dot ; (.mula.s f0-6 f3-0) ; (.madda.s f1-0 f4-0) ; (.madd.s f0-7 f2-0 f5-0) - (set! f0-7 (+ (* f0-6 f3-0) (* f1-0 f4-0) (* f2-0 f5-0))) - ) + (set! f0-7 (+ (* f0-6 f3-0) (* f1-0 f4-0) (* f2-0 f5-0)))) (let ((f0-8 (t9-10 f0-7))) (when (< sv-144 f0-8) (set! f30-0 (/ sv-144 f0-8)) - (set! f0-8 sv-144) - ) + (set! f0-8 sv-144)) (let* ((f0-9 (cos f0-8)) (t9-12 matrix-axis-sin-cos!) (a0-20 s0-0) (a1-13 s3-0) (f1-3 1.0) - (f2-1 f0-9) - ) - (t9-12 a0-20 a1-13 (sqrtf (- f1-3 (* f2-1 f2-1))) f0-9) - ) - ) - ) - (vector-matrix*! arg0 s1-0 s0-0) - ) + (f2-1 f0-9)) + (t9-12 a0-20 a1-13 (sqrtf (- f1-3 (* f2-1 f2-1))) f0-9)))) + (vector-matrix*! arg0 s1-0 s0-0)) (vector-normalize! arg0 (lerp f28-0 f26-0 f30-0)) (when arg3 (vector+float*! arg0 arg0 s3-0 (vector-dot arg1 s3-0)) - (vector+float*! arg0 arg0 s3-0 (* f30-0 (vector-dot (vector-! (new-stack-vector0) arg2 arg1) s3-0))) - ) - ) - ) - arg0 - ) + (vector+float*! arg0 arg0 s3-0 (* f30-0 (vector-dot (vector-! (new-stack-vector0) arg2 arg1) s3-0)))))) + arg0) diff --git a/goal_src/jak1/engine/camera/pov-camera-h.gc b/goal_src/jak1/engine/camera/pov-camera-h.gc index 62e01fa949..ad1929636b 100644 --- a/goal_src/jak1/engine/camera/pov-camera-h.gc +++ b/goal_src/jak1/engine/camera/pov-camera-h.gc @@ -1,7 +1,6 @@ ;;-*-Lisp-*- (in-package goal) (bundles "ENGINE.CGO" "GAME.CGO") - (require "engine/game/game-h.gc") ;; name: pov-camera-h.gc @@ -13,11 +12,12 @@ :type int32 (notify-of-abort 0) (allow-abort 1) - (inherit-orientation 2) - ) + (inherit-orientation 2)) (declare-type pov-camera process-drawable) -(define-extern pov-camera-init-by-other (function vector skeleton-group string pov-camera-flag process-drawable pair none :behavior pov-camera)) ;; TODO - not confirmed -- sunken-elevator + +(define-extern pov-camera-init-by-other + (function vector skeleton-group string pov-camera-flag process-drawable pair none :behavior pov-camera)) ;; TODO - not confirmed -- sunken-elevator ;; DECOMP BEGINS @@ -25,28 +25,24 @@ ;; for example, the introduction to orbs in geyser, or the camera that shows you where the steps to fire canyon ;; are. (deftype pov-camera (process-drawable) - ((cspace-array cspace-array :overlay-at root) - (flags pov-camera-flag) - (debounce-start-time time-frame) - (notify-handle handle) - (anim-name string) - (command-list pair) - (mask-to-clear process-mask) - (music-volume-movie float) - (sfx-volume-movie float) - ) + ((cspace-array cspace-array :overlay-at root) + (flags pov-camera-flag) + (debounce-start-time time-frame) + (notify-handle handle) + (anim-name string) + (command-list pair) + (mask-to-clear process-mask) + (music-volume-movie float) + (sfx-volume-movie float)) (:state-methods - pov-camera-abort - pov-camera-done-playing - pov-camera-playing - pov-camera-start-playing - pov-camera-startup - ) + pov-camera-abort + pov-camera-done-playing + pov-camera-playing + pov-camera-start-playing + pov-camera-startup) (:methods - (check-for-abort (_type_) symbol) - (target-grabbed? (_type_) symbol) - (pre-startup-callback (_type_) none) - (target-released? (_type_) symbol) - (set-stack-size! (_type_) none) - ) - ) + (check-for-abort (_type_) symbol) + (target-grabbed? (_type_) symbol) + (pre-startup-callback (_type_) none) + (target-released? (_type_) symbol) + (set-stack-size! (_type_) none))) diff --git a/goal_src/jak1/engine/camera/pov-camera.gc b/goal_src/jak1/engine/camera/pov-camera.gc index e6b2b78165..34f1f1d460 100644 --- a/goal_src/jak1/engine/camera/pov-camera.gc +++ b/goal_src/jak1/engine/camera/pov-camera.gc @@ -1,7 +1,6 @@ ;;-*-Lisp-*- (in-package goal) (bundles "ENGINE.CGO" "GAME.CGO") - (require "engine/camera/pov-camera-h.gc") (require "engine/common-obs/water.gc") @@ -13,52 +12,37 @@ (defmethod check-for-abort ((this pov-camera)) (when (or (and (time-elapsed? (-> this debounce-start-time) (seconds 0.2)) (cpad-pressed? 0 triangle)) - (logtest? (-> this flags) (pov-camera-flag allow-abort)) - ) + (logtest? (-> this flags) (pov-camera-flag allow-abort))) (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle)) (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle)) (when (logtest? (-> this flags) (pov-camera-flag notify-of-abort)) (send-event (handle->process (-> this notify-handle)) 'notify 'abort-request) - #t - ) - ) - ) + #t))) (defmethod target-grabbed? ((this pov-camera)) - (or (not *target*) (process-grab? *target*)) - ) + (or (not *target*) (process-grab? *target*))) (defmethod target-released? ((this pov-camera)) - (or (not *target*) (process-release? *target*)) - ) + (or (not *target*) (process-release? *target*))) (defstate pov-camera-startup (pov-camera) :virtual #t - :code (behavior () - (go-virtual pov-camera-start-playing) - ) - ) + :code + (behavior () + (go-virtual pov-camera-start-playing))) (defstate pov-camera-start-playing (pov-camera) :virtual #t - :code (behavior () - (logclear! (-> self mask) (process-mask actor-pause)) - (while (not (target-grabbed? self)) - (suspend) - ) - (let ((gp-0 0)) - (let ((v1-7 (lookup-art (-> self draw jgeo) "camera" (the-as type #f)))) - (if v1-7 - (set! gp-0 (+ (-> v1-7 number) 1)) - ) - ) - (let ((v1-10 (process-spawn othercam self gp-0 #t #t :to self))) - (send-event (ppointer->process v1-10) 'mask (-> self mask-to-clear)) - ) - ) - (go-virtual pov-camera-playing) - ) - ) + :code + (behavior () + (logclear! (-> self mask) (process-mask actor-pause)) + (while (not (target-grabbed? self)) + (suspend)) + (let ((gp-0 0)) + (let ((v1-7 (lookup-art (-> self draw jgeo) "camera" (the-as type #f)))) (if v1-7 (set! gp-0 (+ (-> v1-7 number) 1)))) + (let ((v1-10 (process-spawn othercam self gp-0 #t #t :to self))) + (send-event (ppointer->process v1-10) 'mask (-> self mask-to-clear)))) + (go-virtual pov-camera-playing))) (defbehavior pov-camera-play-and-reposition pov-camera ((arg0 art-joint-anim) (arg1 vector) (arg2 float)) (let ((s4-0 #f)) @@ -67,110 +51,82 @@ (let ((v1-4 (and (not s4-0) (< (the float (+ (-> (ja-group) data 0 length) -4)) (ja-frame-num 0))))) (when v1-4 (set! s4-0 #t) - (send-event *camera* 'teleport-to-vector-start-string arg1) - ) - ) + (send-event *camera* 'teleport-to-vector-start-string arg1))) (suspend) - (ja :num! (seek! max arg2)) - ) - ) + (ja :num! (seek! max arg2)))) 0 - (none) - ) + (none)) (defstate pov-camera-playing (pov-camera) :virtual #t - :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (case message - (('abort) - (when (logtest? (-> self flags) (pov-camera-flag notify-of-abort)) - (logior! (-> self flags) (pov-camera-flag allow-abort)) - (if (= (-> self anim-name type) string) - (go-virtual pov-camera-abort) - ) - ) - ) - ) - ) - :enter (behavior () - (set-time! (-> self debounce-start-time)) - (if (= (-> self anim-name type) string) - (backup-load-state-and-set-cmds *load-state* (-> self command-list)) - ) - ) - :exit (behavior () - (if (= (-> self anim-name type) string) - (restore-load-state-and-cleanup *load-state*) - ) - (remove-setting! 'music-volume) - (remove-setting! 'sfx-volume) - ) - :code (behavior () - (add-setting! 'music-volume 'rel (-> self music-volume-movie) 0) - (add-setting! 'sfx-volume 'rel (-> self sfx-volume-movie) 0) - (cond - ((= (-> self anim-name type) string) - (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0) - (until (ja-done? 0) - (check-for-abort self) - (suspend) - (ja :num! (seek!)) - ) - ) - ((= (-> self anim-name type) spool-anim) - (ja-play-spooled-anim - (the-as spool-anim (-> self anim-name)) - (the-as art-joint-anim #f) - (the-as art-joint-anim #f) - (method-of-object self check-for-abort) - ) - ) - ) - (go-virtual pov-camera-done-playing) - ) - :post (behavior () - (if (= (-> self anim-name type) string) - (execute-commands-up-to *load-state* (ja-aframe-num 0)) - ) - (ja-post) - ) - ) + :event + (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('abort) + (when (logtest? (-> self flags) (pov-camera-flag notify-of-abort)) + (logior! (-> self flags) (pov-camera-flag allow-abort)) + (if (= (-> self anim-name type) string) (go-virtual pov-camera-abort)))))) + :enter + (behavior () + (set-time! (-> self debounce-start-time)) + (if (= (-> self anim-name type) string) (backup-load-state-and-set-cmds *load-state* (-> self command-list)))) + :exit + (behavior () + (if (= (-> self anim-name type) string) (restore-load-state-and-cleanup *load-state*)) + (remove-setting! 'music-volume) + (remove-setting! 'sfx-volume)) + :code + (behavior () + (add-setting! 'music-volume 'rel (-> self music-volume-movie) 0) + (add-setting! 'sfx-volume 'rel (-> self sfx-volume-movie) 0) + (cond + ((= (-> self anim-name type) string) + (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (check-for-abort self) + (suspend) + (ja :num! (seek!)))) + ((= (-> self anim-name type) spool-anim) + (ja-play-spooled-anim (the-as spool-anim (-> self anim-name)) + (the-as art-joint-anim #f) + (the-as art-joint-anim #f) + (method-of-object self check-for-abort)))) + (go-virtual pov-camera-done-playing)) + :post + (behavior () + (if (= (-> self anim-name type) string) (execute-commands-up-to *load-state* (ja-aframe-num 0))) + (ja-post))) (defstate pov-camera-abort (pov-camera) :virtual #t - :enter (behavior () - (logior! (-> self flags) (pov-camera-flag allow-abort)) - ) - :code (behavior () - (set-blackout-frames (seconds 0.035)) - (suspend) - (suspend) - (go-virtual pov-camera-done-playing) - ) - ) + :enter + (behavior () + (logior! (-> self flags) (pov-camera-flag allow-abort))) + :code + (behavior () + (set-blackout-frames (seconds 0.035)) + (suspend) + (suspend) + (go-virtual pov-camera-done-playing))) (defstate pov-camera-done-playing (pov-camera) :virtual #t - :code (behavior () - (while (not (target-released? self)) + :code + (behavior () + (while (not (target-released? self)) + (suspend)) + (send-event (handle->process (-> self notify-handle)) 'notify 'die) (suspend) - ) - (send-event (handle->process (-> self notify-handle)) 'notify 'die) - (suspend) - (suspend) - (cleanup-for-death self) - (deactivate self) - ) - ) + (suspend) + (cleanup-for-death self) + (deactivate self))) (defmethod pre-startup-callback ((this pov-camera)) 0 - (none) - ) + (none)) (defmethod set-stack-size! ((this pov-camera)) - (none) - ) + (none)) (defbehavior pov-camera-init-by-other pov-camera ((arg0 vector) (arg1 skeleton-group) (arg2 string) (arg3 pov-camera-flag) (arg4 process-drawable) (arg5 pair)) (set-stack-size! self) @@ -179,24 +135,15 @@ (set! (-> self command-list) arg5) (set! (-> self music-volume-movie) 100.0) (set! (-> self sfx-volume-movie) 100.0) - (if arg4 - (set! (-> self notify-handle) (process->handle arg4)) - (set! (-> self notify-handle) (the-as handle #f)) - ) + (if arg4 (set! (-> self notify-handle) (process->handle arg4)) (set! (-> self notify-handle) (the-as handle #f))) (set-time! (-> self debounce-start-time)) (logclear! (-> self mask) (process-mask actor-pause movie enemy platform projectile)) (set! (-> self root) (new 'process 'trsqv)) (set! (-> self root trans quad) (-> arg0 quad)) (when (logtest? (-> self flags) (pov-camera-flag inherit-orientation)) - (let ((v1-20 (if (and (nonzero? arg4) (type-type? (-> arg4 type) process-drawable)) - arg4 - ) - ) - ) - (quaternion-copy! (-> self root quat) (-> v1-20 root quat)) - ) - ) - (initialize-skeleton self arg1 '()) + (let ((v1-20 (if (and (nonzero? arg4) (type-type? (-> arg4 type) process-drawable)) arg4))) + (quaternion-copy! (-> self root quat) (-> v1-20 root quat)))) + (initialize-skeleton self arg1 ()) (logior! (-> self draw status) (draw-status skip-bones)) (logior! (-> self skel status) (janim-status inited)) (set! (-> self anim-name) arg2) @@ -204,36 +151,19 @@ ((= (-> arg2 type) string) (logior! (-> self skel status) (janim-status spool)) (let ((s5-1 (lookup-art (-> self draw art-group) arg2 art-joint-anim))) - (if (not s5-1) - (go process-drawable-art-error arg2) - ) + (if (not s5-1) (go process-drawable-art-error arg2)) (ja-channel-set! 1) - (set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim s5-1)) - ) - ) - ((= (-> arg2 type) spool-anim) - ) - ) + (set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim s5-1)))) + ((= (-> arg2 type) spool-anim))) (set! (-> self mask-to-clear) (process-mask movie enemy platform projectile)) - (set! (-> self event-hook) (lambda :behavior pov-camera - ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (case arg2 - (('mask) - (let ((v0-0 (the-as number (-> arg3 param 0)))) - (set! (-> self mask-to-clear) (the-as process-mask v0-0)) - v0-0 - ) - ) - (('music-movie-volume) - (set! (-> self music-volume-movie) (the-as float (-> arg3 param 0))) - ) - (('sfx-movie-volume) - (set! (-> self sfx-volume-movie) (the-as float (-> arg3 param 0))) - ) - ) - ) - ) + (set! (-> self event-hook) + (lambda :behavior + pov-camera + ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('mask) (let ((v0-0 (the-as number (-> arg3 param 0)))) (set! (-> self mask-to-clear) (the-as process-mask v0-0)) v0-0)) + (('music-movie-volume) (set! (-> self music-volume-movie) (the-as float (-> arg3 param 0)))) + (('sfx-movie-volume) (set! (-> self sfx-volume-movie) (the-as float (-> arg3 param 0))))))) (pre-startup-callback self) (go-virtual pov-camera-startup) - (none) - ) + (none)) diff --git a/goal_src/jak1/engine/collide/collide-cache-h.gc b/goal_src/jak1/engine/collide/collide-cache-h.gc index 22a7f387e0..0e27e2fbcb 100644 --- a/goal_src/jak1/engine/collide/collide-cache-h.gc +++ b/goal_src/jak1/engine/collide/collide-cache-h.gc @@ -1,7 +1,6 @@ ;;-*-Lisp-*- (in-package goal) (bundles "ENGINE.CGO" "GAME.CGO") - (require "kernel-defs.gc") ;; name: collide-cache-h.gc @@ -9,7 +8,9 @@ ;; dgos: GAME, ENGINE (define-extern collide-cache-using-line-sphere-test (function vector symbol)) + (define-extern collide-cache-using-y-probe-test (function vector symbol)) + (define-extern collide-cache-using-box-test (function vector symbol)) ;; DECOMP BEGINS @@ -19,45 +20,35 @@ ;;;;;;;;;;;;;;;;;;;;;;; (deftype collide-using-spheres-params (structure) - ((spheres (inline-array sphere)) - (num-spheres uint32) - (collide-with collide-kind) - (proc process-drawable) - (ignore-pat pat-surface) - (solid-only basic) - ) - ) + ((spheres (inline-array sphere)) + (num-spheres uint32) + (collide-with collide-kind) + (proc process-drawable) + (ignore-pat pat-surface) + (solid-only basic))) ;; primitive using sphere-sphere (deftype collide-puss-sphere (structure) - ((bsphere sphere :inline) - (bbox4w bounding-box4w :inline) - ) - ) - + ((bsphere sphere :inline) + (bbox4w bounding-box4w :inline))) (deftype collide-puss-work (structure) - ((closest-pt vector :inline) - (tri-normal vector :inline) - (tri-bbox4w bounding-box4w :inline) - (spheres-bbox4w bounding-box4w :inline) - (spheres collide-puss-sphere 64 :inline) - ) + ((closest-pt vector :inline) + (tri-normal vector :inline) + (tri-bbox4w bounding-box4w :inline) + (spheres-bbox4w bounding-box4w :inline) + (spheres collide-puss-sphere 64 :inline)) (:methods - (collide-puss-work-method-9 (_type_ object object) symbol) - (collide-puss-work-method-10 (_type_ object object) symbol) - ) - ) + (collide-puss-work-method-9 (_type_ object object) symbol) + (collide-puss-work-method-10 (_type_ object object) symbol))) ;; primitive using y probe (deftype collide-puyp-work (structure) - ((best-u float) - (ignore-pat pat-surface) - (tri-out collide-tri-result) - (start-pos vector :inline) - (move-dist vector :inline) - ) - ) + ((best-u float) + (ignore-pat pat-surface) + (tri-out collide-tri-result) + (start-pos vector :inline) + (move-dist vector :inline))) ;;;;;;;;;;;;;;;;;;;;;;; ;; Main Cache Types @@ -66,105 +57,88 @@ ;; The triangles stored in the cache. ;; This is a common return type of collision queries. (deftype collide-cache-tri (structure) - ((vertex vector 3 :inline) ;; actual locations - (extra-quad uint128 :offset 48) - (pat pat-surface :overlay-at extra-quad) ; metadata about the surface of this tri - (prim-index uint16 :offset 52) ; in the collide-cache-prim list - (user16 uint16 :offset 54) - (user32 uint32 2 :offset 56) - ) - ) + ((vertex vector 3 :inline) ;; actual locations + (extra-quad uint128 :offset 48) + (pat pat-surface :overlay-at extra-quad) ; metadata about the surface of this tri + (prim-index uint16 :offset 52) ; in the collide-cache-prim list + (user16 uint16 :offset 54) + (user32 uint32 2 :offset 56))) ;; The primitives stored in the cache. ;; The "core" is extracted from the normal collide-shape-prim and placed inline here. (deftype collide-cache-prim (structure) - ((prim-core collide-prim-core :inline) - (extra-quad uint128) - (ccache collide-cache :overlay-at extra-quad) - (prim collide-shape-prim :offset 36) - (first-tri uint16 :offset 40) - (num-tris uint16 :offset 42) - (unused uint8 4 :offset 44) - (world-sphere vector :inline :overlay-at (-> prim-core world-sphere)) - (collide-as collide-kind :overlay-at (-> prim-core collide-as)) - (action collide-action :overlay-at (-> prim-core action)) - (offense collide-offense :overlay-at (-> prim-core offense)) - (prim-type int8 :overlay-at (-> prim-core prim-type)) - ) + ((prim-core collide-prim-core :inline) + (extra-quad uint128) + (ccache collide-cache :overlay-at extra-quad) + (prim collide-shape-prim :offset 36) + (first-tri uint16 :offset 40) + (num-tris uint16 :offset 42) + (unused uint8 4 :offset 44) + (world-sphere vector :inline :overlay-at (-> prim-core world-sphere)) + (collide-as collide-kind :overlay-at (-> prim-core collide-as)) + (action collide-action :overlay-at (-> prim-core action)) + (offense collide-offense :overlay-at (-> prim-core offense)) + (prim-type int8 :overlay-at (-> prim-core prim-type))) (:methods - (resolve-moving-sphere-tri (_type_ collide-tri-result collide-prim-core vector float collide-action) float) - (resolve-moving-sphere-sphere (_type_ collide-tri-result collide-prim-core vector float collide-action) float) - ) - ) + (resolve-moving-sphere-tri (_type_ collide-tri-result collide-prim-core vector float collide-action) float) + (resolve-moving-sphere-sphere (_type_ collide-tri-result collide-prim-core vector float collide-action) float))) ;; The actual cache! (deftype collide-cache (basic) - ((num-tris int32) - (num-prims int32) - (num-prims-u uint32 :overlay-at num-prims) - (ignore-mask pat-surface) - (proc process-drawable) - (collide-box bounding-box :inline) - (collide-box4w bounding-box4w :inline) - (collide-with collide-kind) - (prims collide-cache-prim 100 :inline) - (tris collide-cache-tri 461 :inline) - ) + ((num-tris int32) + (num-prims int32) + (num-prims-u uint32 :overlay-at num-prims) + (ignore-mask pat-surface) + (proc process-drawable) + (collide-box bounding-box :inline) + (collide-box4w bounding-box4w :inline) + (collide-with collide-kind) + (prims collide-cache-prim 100 :inline) + (tris collide-cache-tri 461 :inline)) (:methods - (debug-draw (_type_) none) - (fill-and-probe-using-line-sphere (_type_ vector vector float collide-kind process collide-tri-result pat-surface) float) - (fill-and-probe-using-spheres (_type_ collide-using-spheres-params) symbol) - (fill-and-probe-using-y-probe (_type_ vector float collide-kind process-drawable collide-tri-result pat-surface) float) - (fill-using-bounding-box (_type_ bounding-box collide-kind process-drawable pat-surface) none) - (fill-using-line-sphere (_type_ vector vector float collide-kind process-drawable pat-surface) none) - (fill-using-spheres (_type_ collide-using-spheres-params) none) - (fill-using-y-probe (_type_ vector float collide-kind process-drawable pat-surface) none) - (initialize (_type_) none) - (probe-using-line-sphere (_type_ vector vector float collide-kind collide-tri-result pat-surface) float) - (probe-using-spheres (_type_ collide-using-spheres-params) symbol) - (probe-using-y-probe (_type_ vector float collide-kind collide-tri-result pat-surface) float) - (fill-from-background (_type_ (function bsp-header int collide-list none) (function collide-cache object none)) none) - (fill-from-foreground-using-box (_type_) none) - (fill-from-foreground-using-line-sphere (_type_) none) - (fill-from-foreground-using-y-probe (_type_) none) - (fill-from-water (_type_ water-control) none) - (load-mesh-from-spad-in-box (_type_ collide-frag-mesh) none) - (collide-cache-method-27 (_type_) none) - (collide-cache-method-28 (_type_) none) - (collide-cache-method-29 (_type_ collide-frag-mesh) none) - (puyp-mesh (_type_ collide-puyp-work collide-cache-prim) none) - (puyp-sphere (_type_ collide-puyp-work collide-cache-prim) vector) - (unpack-background-collide-mesh (_type_ object object object) none) - ) - ) - + (debug-draw (_type_) none) + (fill-and-probe-using-line-sphere (_type_ vector vector float collide-kind process collide-tri-result pat-surface) float) + (fill-and-probe-using-spheres (_type_ collide-using-spheres-params) symbol) + (fill-and-probe-using-y-probe (_type_ vector float collide-kind process-drawable collide-tri-result pat-surface) float) + (fill-using-bounding-box (_type_ bounding-box collide-kind process-drawable pat-surface) none) + (fill-using-line-sphere (_type_ vector vector float collide-kind process-drawable pat-surface) none) + (fill-using-spheres (_type_ collide-using-spheres-params) none) + (fill-using-y-probe (_type_ vector float collide-kind process-drawable pat-surface) none) + (initialize (_type_) none) + (probe-using-line-sphere (_type_ vector vector float collide-kind collide-tri-result pat-surface) float) + (probe-using-spheres (_type_ collide-using-spheres-params) symbol) + (probe-using-y-probe (_type_ vector float collide-kind collide-tri-result pat-surface) float) + (fill-from-background (_type_ (function bsp-header int collide-list none) (function collide-cache object none)) none) + (fill-from-foreground-using-box (_type_) none) + (fill-from-foreground-using-line-sphere (_type_) none) + (fill-from-foreground-using-y-probe (_type_) none) + (fill-from-water (_type_ water-control) none) + (load-mesh-from-spad-in-box (_type_ collide-frag-mesh) none) + (collide-cache-method-27 (_type_) none) + (collide-cache-method-28 (_type_) none) + (collide-cache-method-29 (_type_ collide-frag-mesh) none) + (puyp-mesh (_type_ collide-puyp-work collide-cache-prim) none) + (puyp-sphere (_type_ collide-puyp-work collide-cache-prim) vector) + (unpack-background-collide-mesh (_type_ object object object) none))) (deftype collide-list-item (structure) - ((mesh collide-frag-mesh) - (inst basic) - ) - ) - + ((mesh collide-frag-mesh) + (inst basic))) (deftype collide-list (structure) - ((num-items int32) - (items collide-list-item 256 :inline) - ) - ) - + ((num-items int32) + (items collide-list-item 256 :inline))) (deftype collide-work (structure) - ((collide-sphere-neg-r sphere :inline) - (collide-box4w bounding-box4w :inline) - (inv-mat matrix :inline) - ) - ) - + ((collide-sphere-neg-r sphere :inline) + (collide-box4w bounding-box4w :inline) + (inv-mat matrix :inline))) (define-perm *collide-work* collide-work (new 'global 'collide-work)) ;; og:preserve-this (defglobalconstant BIG_COLLIDE_CACHE_SIZE 5000) + (define-perm *collide-cache* collide-cache (new 'global 'collide-cache)) (#when PC_PORT @@ -173,11 +147,6 @@ ;; but start it at the default. (define *collide-cache-max-tris* 460) (defmacro activate-big-collide-cache! () - `(set! *collide-cache-max-tris* BIG_COLLIDE_CACHE_SIZE) - ) - ) - - - + `(set! *collide-cache-max-tris* BIG_COLLIDE_CACHE_SIZE))) (define-perm *collide-list* collide-list (new 'global 'collide-list)) diff --git a/goal_src/jak1/kernel-defs.gc b/goal_src/jak1/kernel-defs.gc index feca93142a..afaaa7432a 100644 --- a/goal_src/jak1/kernel-defs.gc +++ b/goal_src/jak1/kernel-defs.gc @@ -7,54 +7,103 @@ ;; fixed symbols (define-extern #f symbol) + (define-extern #t symbol) + (define-extern function type) + (define-extern basic type) + (define-extern string type) + (define-extern symbol type) + (define-extern type type) + (define-extern object type) + (define-extern link-block type) + (define-extern integer type) + (define-extern sinteger type) + (define-extern uinteger type) + (define-extern binteger type) + (define-extern int8 type) + (define-extern int16 type) + (define-extern int32 type) + (define-extern int64 type) + (define-extern int128 type) + (define-extern uint8 type) + (define-extern uint16 type) + (define-extern uint32 type) + (define-extern uint64 type) + (define-extern uint128 type) + (define-extern float type) + (define-extern process-tree type) + (define-extern process type) + (define-extern thread type) + (define-extern structure type) + (define-extern pair type) + (define-extern pointer type) + (define-extern number type) + (define-extern array type) + (define-extern vu-function type) + (define-extern connectable type) + (define-extern stack-frame type) + (define-extern file-stream type) + (define-extern kheap type) + (define-extern nothing (function none)) + (define-extern delete-basic (function basic none)) + (define-extern static symbol) + (define-extern global kheap) + (define-extern debug kheap) -(define-extern loading-level kheap) ;; not a kheap at boot + +(define-extern loading-level kheap) ;; not a kheap at boot + (define-extern loading-package kheap) ;; not a kheap at boot + (define-extern process-level-heap kheap) ;; not a kheap at boot + (define-extern stack symbol) + (define-extern scratch symbol) + (define-extern *scratch-top* pointer) + (define-extern zero-func (function int)) + ;; asize-of-basic-func - has a bug ;; copy-basic-func - has a bug ;; level - unknown type @@ -67,12 +116,11 @@ (defenum kmalloc-flags :bitfield #t - (align-16 4) - (align-64 6) - (align-256 8) - (memset 12) - (top 13) - ) + (align-16 4) + (align-64 6) + (align-256 8) + (memset 12) + (top 13)) (defenum link-flag :bitfield #t @@ -82,24 +130,36 @@ (execute-login 2) (print-login 3) (force-debug 4) - (fast-link 5) - ) - + (fast-link 5)) (define-extern string->symbol (function string symbol)) + (define-extern print (function object object)) + (define-extern inspect (function object object)) + (define-extern load (function string kheap object)) + (define-extern loado (function string kheap object)) + (define-extern unload (function string none)) + (define-extern _format (function _varargs_ object)) + (define-extern malloc (function symbol int pointer)) + (define-extern kmalloc (function kheap int kmalloc-flags string pointer)) + (define-extern new-dynamic-structure (function symbol type int structure)) + (define-extern method-set! (function type int object none)) ;; may actually return function. + (define-extern link (function pointer pointer int kheap int pointer)) + (define-extern dgo-load (function string kheap link-flag int none)) + (define-extern link-begin (function pointer (pointer uint8) int kheap link-flag int)) + (define-extern link-resume (function int)) (defenum mc-status-code @@ -121,8 +181,7 @@ (no-space 14) (bad-version 15) (no-process 16) - (no-auto-save 17) - ) + (no-auto-save 17)) (defenum language-enum :type int64 @@ -132,26 +191,37 @@ (spanish) (italian) (japanese) - (uk-english) - ) + (uk-english)) (define-extern mc-run (function none)) + (define-extern mc-format (function int mc-status-code)) + (define-extern mc-unformat (function int mc-status-code)) + (define-extern mc-create-file (function int uint mc-status-code)) + (define-extern mc-save (function int int pointer int mc-status-code)) + (define-extern mc-load (function int int pointer mc-status-code)) + (declare-type mc-slot-info structure) + (define-extern mc-sync (function int)) + (define-extern mc-get-slot-info (function int mc-slot-info none)) (define-extern mc-check-result (function int)) + ;; mc-makefile (define-extern kset-language (function language-enum int)) (define-extern *debug-segment* symbol) + (define-extern *enable-method-set* int) + (define-extern *boot-video-mode* int) + (define-extern *deci-count* int) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -160,62 +230,96 @@ ;; *listener-link-block* (define-extern *listener-function* (function object)) + ;; kernel-dispatcher ;; kernel-packages (define-extern *print-column* binteger) + ;; *print-column* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; kmachine - InitMachineScheme ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - (define-extern put-display-env (function object none)) + (define-extern syncv (function int int)) + (define-extern sync-path (function int int int)) + (define-extern reset-path (function none)) + (define-extern reset-graph (function int int int int none)) (define-extern dma-sync (function pointer int int int)) + ;; gs-put-imr ;; gs-get-imr (define-extern gs-store-image (function object object object)) + (define-extern flush-cache (function int none)) + (declare-type cpad-info basic) + (declare-type discord-info structure) + (define-extern cpad-open (function cpad-info int cpad-info)) + (define-extern cpad-get-data (function cpad-info cpad-info)) + (define-extern install-handler (function int function int)) ;; check return val + ;; install-debug-handler (defconstant SCE_SEEK_SET 0) + (defconstant SCE_SEEK_CUR 1) + (defconstant SCE_SEEK_END 2) + (define-extern file-stream-open (function file-stream basic basic file-stream)) + (define-extern file-stream-close (function file-stream file-stream)) + (define-extern file-stream-length (function file-stream int)) + (define-extern file-stream-seek (function file-stream int int int)) + (define-extern file-stream-read (function file-stream pointer int int)) + (define-extern file-stream-write (function file-stream pointer uint uint)) (defconstant GAME_TERRITORY_SCEA 0) + (defconstant GAME_TERRITORY_SCEE 1) + (defconstant GAME_TERRITORY_SCEI 2) (define-extern scf-get-language (function language-enum)) + (declare-type scf-time structure) + (define-extern scf-get-time (function scf-time none)) + (define-extern scf-get-aspect (function uint)) + (define-extern scf-get-volume (function int)) + (define-extern scf-get-territory (function int)) ;; not actually a scf function... + (define-extern scf-get-timeout (function int)) + (define-extern scf-get-inactive-timeout (function int)) + ;; dma-to-iop (define-extern kernel-shutdown (function none)) + (define-extern aybabtu (function int int)) ;; this is just sceCdMmode + ;; *stack-top* ;; *stack-base* ;; *stack-size* (define-extern *kernel-boot-message* symbol) + ;; *kernel-boot-mode* ;; *kernel-boot-level* @@ -224,8 +328,8 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-extern rpc-call (function int uint uint uint int uint int uint)) -(define-extern rpc-busy? (function int uint)) +(define-extern rpc-busy? (function int uint)) ;;;;;;;;;;;;;;;;;;;;;;;; ;;;; kernel types @@ -237,66 +341,64 @@ ;; So these deftypes generate no code. (defenum process-mask - :bitfield #t :type uint32 - (execute 0) ;; 1 - (draw 1) ;; 2 - (pause 2) ;; 4 - (menu 3) ;; 8 - (progress 4) ;; 16 - (actor-pause 5) ;; 32 - (sleep 6) ;; 64 - (sleep-code 7) ;; 128 - (process-tree 8) ;; 256 not an actual process, just a "tree node" for organization - (heap-shrunk 9) ;; 512 - (going 10) ;; 1024 - (movie 11) ;; 2048 - (movie-subject 12) ;; 4096 - (target 13) ;; 8192 - (sidekick 14) ;; 16384 - (crate 15) ;; 32768 - (collectable 16) ;; 65536 - (enemy 17) ;; 131072 - (camera 18) ;; 262144 - (platform 19) ;; 524288 - (ambient 20) ;; 1048576 - (entity 21) ;; 2097152 - (projectile 22) ;; 4194304 - (attackable 23) ;; 8388608 - (death 24) ;; 16777216 - ) + :bitfield #t + :type uint32 + (execute 0) ;; 1 + (draw 1) ;; 2 + (pause 2) ;; 4 + (menu 3) ;; 8 + (progress 4) ;; 16 + (actor-pause 5) ;; 32 + (sleep 6) ;; 64 + (sleep-code 7) ;; 128 + (process-tree 8) ;; 256 not an actual process, just a "tree node" for organization + (heap-shrunk 9) ;; 512 + (going 10) ;; 1024 + (movie 11) ;; 2048 + (movie-subject 12) ;; 4096 + (target 13) ;; 8192 + (sidekick 14) ;; 16384 + (crate 15) ;; 32768 + (collectable 16) ;; 65536 + (enemy 17) ;; 131072 + (camera 18) ;; 262144 + (platform 19) ;; 524288 + (ambient 20) ;; 1048576 + (entity 21) ;; 2097152 + (projectile 22) ;; 4194304 + (attackable 23) ;; 8388608 + (death 24) ;; 16777216 + ) (declare-type process basic) -(declare-type entity-actor basic) -(deftype process-tree (basic) - ((name basic :offset-assert 4) - (mask process-mask :offset-assert 8) - (parent (pointer process-tree) :offset-assert 12) - (brother (pointer process-tree) :offset-assert 16) - (child (pointer process-tree) :offset-assert 20) - (ppointer (pointer process) :offset-assert 24) - (self process-tree :offset-assert 28) - ) +(declare-type entity-actor basic) + +(deftype process-tree (basic) + ((name basic :offset-assert 4) + (mask process-mask :offset-assert 8) + (parent (pointer process-tree) :offset-assert 12) + (brother (pointer process-tree) :offset-assert 16) + (child (pointer process-tree) :offset-assert 20) + (ppointer (pointer process) :offset-assert 24) + (self process-tree :offset-assert 28)) (:methods (new (symbol type basic) _type_) (activate (_type_ process-tree basic pointer) process-tree) ;; 9 - (deactivate (_type_) none) ;; 10 - (init-from-entity! (_type_ entity-actor) none) ;; 11 + (deactivate (_type_) none) ;; 10 + (init-from-entity! (_type_ entity-actor) none) ;; 11 (run-logic? (_type_) symbol) ;; 12 (process-tree-method-13 () none) ;; 13 ) - :size-assert #x20 :method-count-assert 14 :no-runtime-type ;; already defined by kscheme. Don't do it again. ) - (deftype stack-frame (basic) - ((name symbol :offset 4) - (next stack-frame :offset 8) ;; which way does this point? - ) - + ((name symbol :offset 4) + ;; which way does this point? + (next stack-frame :offset 8)) :size-assert #xc :method-count-assert 9 :flag-assert #x90000000c @@ -306,18 +408,19 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; PC Port functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (defenum pc-renderer-tree-type - (none 0) + (none 0) (tfrag3 1) - (tie3 2) + (tie3 2) (invalid)) (defenum pc-collision-mode - (none 0) - (mode 1) - (event 2) + (none 0) + (mode 1) + (event 2) (material 3) - (skip 4) + (skip 4) (skiphide 5)) (defenum pc-gfx-hack @@ -325,96 +428,155 @@ ;; TODO - make a common kernel-defs (define-extern __read-ee-timer (function uint)) + (define-extern __mem-move (function pointer pointer uint none)) + (define-extern __send-gfx-dma-chain (function object object none)) + (define-extern __pc-texture-upload-now (function object object none)) + (define-extern __pc-texture-relocate (function object object object none)) + (define-extern __pc-get-mips2c (function string function)) + (define-extern __pc-set-levels (function string string none)) ;; Input Related Functions (define-extern pc-get-controller-count (function int)) + (define-extern pc-get-controller-name (function int string symbol)) + (deftype bind-assignment-info (structure) - ((port int32) - (device-type int32) - (for-buttons? symbol) - (input-idx int32) + ((port int32) + (device-type int32) + (for-buttons? symbol) + (input-idx int32) (analog-min-range? symbol))) + (define-extern pc-get-current-bind (function bind-assignment-info string symbol)) + (define-extern pc-waiting-for-bind? (function symbol)) + (define-extern pc-set-waiting-for-bind! (function int symbol symbol int none)) + (define-extern pc-stop-waiting-for-bind! (function none)) + (define-extern pc-set-controller! (function int int none)) + (define-extern pc-get-keyboard-enabled? (function symbol)) + (define-extern pc-set-keyboard-enabled! (function symbol none)) + (define-extern pc-set-mouse-options! (function symbol symbol symbol none)) + (define-extern pc-set-mouse-camera-sens! (function float float none)) + (define-extern pc-current-controller-has-led? (function symbol)) + (define-extern pc-current-controller-has-rumble? (function symbol)) + (define-extern pc-set-controller-led! (function int int int int none)) + (define-extern pc-ignore-background-controller-events! (function symbol none)) + (define-extern pc-reset-bindings-to-defaults! (function int int none)) + (define-extern pc-set-auto-hide-cursor! (function symbol none)) ;; Display Related Functions (define-extern pc-get-display-mode (function symbol)) + (define-extern pc-get-active-display-size (function (pointer int64) (pointer int64) none)) + (define-extern pc-get-active-display-refresh-rate (function int)) + (define-extern pc-get-display-count (function int)) + (define-extern pc-get-display-name (function int string symbol)) + (define-extern pc-get-os (function symbol)) + (define-extern pc-get-window-size (function (pointer int64) (pointer int64) none)) + (define-extern pc-get-window-scale (function (pointer float) (pointer float) none)) + (define-extern pc-set-window-size (function int int none)) + (define-extern pc-set-fullscreen-display (function int none)) + (define-extern pc-set-display-mode (function symbol none)) + (define-extern pc-get-num-resolutions (function int)) + (define-extern pc-get-resolution (function int (pointer int64) (pointer int64) none)) (define-extern pc-set-frame-rate (function int none)) + (define-extern pc-set-vsync (function symbol none)) + (define-extern pc-renderer-tree-set-lod (function pc-renderer-tree-type int none)) + (define-extern pc-set-letterbox (function int int none)) + (define-extern pc-set-collision (function symbol none)) + (define-extern pc-set-collision-wireframe (function symbol none)) + (define-extern pc-get-collision-mask (function pc-collision-mode int symbol)) + (define-extern pc-set-collision-mask (function pc-collision-mode int symbol none)) + (define-extern pc-set-collision-mode (function pc-collision-mode none)) + (define-extern pc-discord-rpc-update (function discord-info none)) + (define-extern pc-discord-rpc-set (function int none)) + (define-extern pc-filepath-exists? (function string symbol)) + (define-extern pc-mkdir-file-path (function string none)) + (define-extern pc-sound-set-flava-hack (function int none)) + (define-extern pc-sound-set-fade-hack (function int none)) + (define-extern pc-set-window-lock (function symbol none)) + (define-extern pc-set-game-resolution (function int int none)) + (define-extern pc-set-msaa (function int none)) + (define-extern pc-set-gfx-hack (function pc-gfx-hack symbol none)) + (define-extern pc-get-unix-timestamp (function int)) + (define-extern pc-filter-debug-string? (function string float symbol)) + (define-extern pc-screen-shot (function none)) + (declare-type screen-shot-settings structure) + (define-extern pc-register-screen-shot-settings (function screen-shot-settings none)) (defenum pc-prof-event (begin 0) (end 1) - (instant 2) - ) + (instant 2)) (define-extern pc-prof (function string pc-prof-event none)) (defmacro get-user () - `(quote ,*user*) - ) + `(quote ,*user*)) + (defconstant *user* (get-user)) (define-extern pc-rand (function int)) ;; Constants generated within the C++ runtime (define-extern *pc-user-dir-base-path* string) + (define-extern *pc-settings-folder* string) + (define-extern *pc-settings-built-sha* string) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;