format/j1: first 25ish files

This commit is contained in:
Tyler Wilding
2024-05-18 15:08:39 -04:00
parent 9f2bcf6519
commit 44c08d23a5
27 changed files with 7315 additions and 13190 deletions
+1
View File
@@ -197,6 +197,7 @@ const std::unordered_map<std::string, FormFormattingConfig> 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)},
+14 -17
View File
@@ -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))))
+21 -34
View File
@@ -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))
+41 -107
View File
@@ -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))
+200 -436
View File
@@ -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)))
+63 -77
View File
@@ -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)))
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+26 -53
View File
@@ -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
"#<cspace ~S @ #x~X>"
(if (-> this joint)
(-> this joint name)
"nojoint"
)
this
)
this
)
(format #t "#<cspace ~S @ #x~X>" (if (-> this joint) (-> this joint name) "nojoint") this)
this)
+183 -347
View File
@@ -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 <GMJ>: 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 <GMJ>: 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 <GMJ>: 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 <GMJ>: 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 <GMJ>: 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 <GMJ>: 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 <GMJ>: 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 <GMJ>: 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))
+43 -46
View File
@@ -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
File diff suppressed because it is too large Load Diff
@@ -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))
+14 -38
View File
@@ -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))
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+4 -17
View File
@@ -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)
+216 -460
View File
@@ -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))))
File diff suppressed because it is too large Load Diff
+15 -10
View File
@@ -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))
+123 -314
View File
@@ -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)
+268 -335
View File
@@ -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))
File diff suppressed because it is too large Load Diff
+23 -27
View File
@@ -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)))
+92 -162
View File
@@ -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))
+85 -116
View File
@@ -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))
+237 -75
View File
@@ -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)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;