[game] edge grab, small fixes, add zoomer (#1083)

* fix a few small things

* fix tests

* another fix

* fix tests
This commit is contained in:
water111
2022-01-17 14:36:29 -05:00
committed by GitHub
parent dc77c3ccd2
commit dc663d8a1f
27 changed files with 2442 additions and 187 deletions
+4 -3
View File
@@ -13,7 +13,8 @@
(define-extern vector<-cspace! (function vector cspace vector))
(define-extern create-interpolated-joint-animation-frame (function (inline-array vector) int process-drawable int))
;; DECOMP BEGINS
;; These types are specific to joint control.
;; See mspace-h.gc for the actual joint types
(deftype joint-control-channel (structure)
((parent joint-control :offset-assert 0)
@@ -33,7 +34,7 @@
:size-assert #x30
:flag-assert #xa00000030
(:methods
(dummy-9 (_type_) _type_ 9)
(debug-print-frames (_type_) _type_ 9)
)
)
@@ -65,7 +66,7 @@
(:methods
(new (symbol type int) _type_ 0)
(dummy-9 (_type_) float 9)
(dummy-10 (_type_ symbol) int 10)
(debug-print-channels (_type_ symbol) int 10)
)
)
+122 -78
View File
@@ -5,8 +5,15 @@
;; name in dgo: joint
;; dgos: GAME, ENGINE
;; a joint is just used to store the tree structure of a skeleton + bind pose.
;; it's mostly used as a more user-friendly interface
;; DECOMP BEGINS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Basic Methods for joint/joint-control
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defmethod print joint ((obj joint))
(format #t "#<~A ~S ~D @ #x~X>" (-> obj type) (-> obj name) (-> obj number) obj)
obj
@@ -32,6 +39,13 @@
(-> obj length)
)
(defmethod inspect joint-anim-matrix ((obj joint-anim-matrix))
(format #t "[~8x] ~A~%" obj (-> obj type))
(format #t "~Tname: ~A~%" (-> obj name))
(format #t "~Tnumber: ~D~%" (-> obj number))
(format #t "~Tdata[~D]: @ #x~X~%" (-> obj length) (-> obj data))
obj
)
(defmethod asize-of joint-anim-matrix ((obj joint-anim-matrix))
(the-as int (+ (-> joint-anim-matrix size) (* (-> obj length) 64)))
@@ -66,6 +80,7 @@
)
(defun joint-anim-inspect-elt ((arg0 joint-anim) (arg1 float))
"Inspect a single element in a joint anim. The float is rounded to an int."
(case (-> arg0 type)
((joint-anim-matrix)
((method-of-type matrix inspect)
@@ -121,14 +136,12 @@
)
(defmethod print joint-control-channel ((obj joint-control-channel))
(format
#t
"#<joint-control-channel ~A ~A ~F @ #x~X>"
(-> obj command)
(-> obj frame-group)
(-> obj frame-num)
obj
)
(format #t "#<joint-control-channel ~A ~A ~F @ #x~X>"
(-> obj command)
(-> obj frame-group)
(-> obj frame-num)
obj
)
obj
)
@@ -137,6 +150,7 @@
)
(defmethod new joint-control ((allocation symbol) (type-to-make type) (arg0 int))
"Create a new joint-control with enough room for the given number of channels"
(let ((v0-0 (object-new allocation type-to-make (the-as int (+ (-> type-to-make size) (* 48 arg0))))))
(set! (-> v0-0 allocated-length) arg0)
(set! (-> v0-0 active-channels) 0)
@@ -153,7 +167,9 @@
)
)
(defmethod dummy-9 joint-control-channel ((obj joint-control-channel))
(defmethod debug-print-frames joint-control-channel ((obj joint-control-channel))
"Print the current frame of each joint on this channel.
Note: this only appears to work for uncompressed joint animations."
(let ((s5-0 (-> obj frame-group))
(f30-0 (-> obj frame-num))
)
@@ -165,54 +181,39 @@
obj
)
(defmethod dummy-10 joint-control ((obj joint-control) (arg0 symbol))
(defmethod debug-print-channels joint-control ((obj joint-control) (arg0 symbol))
"Print each active channel to the given stream."
(dotimes (s4-0 (-> obj active-channels))
(let* ((v1-6 (if (and (-> obj channel s4-0 frame-group) (nonzero? (-> obj channel s4-0 frame-group)))
(-> obj channel s4-0 frame-group)
)
)
(t9-0 format)
(a0-5 arg0)
(a1-1 "ch:~2d ~C ~-35S f: ~6,,2f ~4,,2f ~4,,2f%~%")
(a2-0 s4-0)
(a3-3 (-> obj channel s4-0 command))
(a3-4 (cond
((= a3-3 'push)
80
)
((= a3-3 'push1)
112
)
((= a3-3 'blend)
66
)
((= a3-3 'stack)
83
)
((= a3-3 'stack1)
115
)
)
)
)
(t9-0
a0-5
a1-1
a2-0
a3-4
(if v1-6
(-> v1-6 name)
"(none)"
)
(+ (* (-> obj channel s4-0 frame-num) (if v1-6
(-> v1-6 artist-step)
1.0
)
(format
arg0
"ch:~2d ~C ~-35S f: ~6,,2f ~4,,2f ~4,,2f%~%"
s4-0 ;; channel index
(case (-> obj channel s4-0 command) ;; how we got added.
(('push)
80
)
(if v1-6
(-> v1-6 artist-base)
0.0
(('push1)
112
)
(('blend)
66
)
(('stack)
83
)
(('stack1)
115
)
)
(if v1-6 (-> v1-6 name) "(none)") ;; name of anim (can be "none" in the real game)
(+ (* (-> obj channel s4-0 frame-num) (if v1-6 (-> v1-6 artist-step) 1.0)) ;; frame number
(if v1-6 (-> v1-6 artist-base) 0.0)
)
(-> obj channel s4-0 frame-interp)
(-> obj channel s4-0 inspector-amount)
@@ -222,15 +223,30 @@
0
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Art
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; The "art" class is a super-general parent class for all art.
;; There's an "art-group" class, which typically contains all the animations
;; geometry, and shadow info for a character.
;; The most general art class shouldn't really be used for anything.
;; art-mesh-anim: not used
;; art-joint-anim: used for animations. Provides joint-anim-compressed and eye-anim.
(defmethod needs-link? art ((obj art))
#f
)
(defmethod dummy-10 art ((obj art) (arg0 string) (arg1 type))
"Look-up an art with the given name and type."
(the-as joint #f)
)
(defmethod dummy-11 art ((obj art) (arg0 string) (arg1 type))
"Look up the index of an art with the given name and type."
(the-as int #f)
)
@@ -244,6 +260,8 @@
)
(defmethod login art ((obj art))
;; not sure why we have to do this, but if the res-lump isn't properly set up to point to the tags
;; do it manually.
(if (and (-> obj extra) (zero? (-> obj extra tag)))
(set! (-> obj extra tag) (&+ (the-as (pointer res-tag) (-> obj extra)) 28))
)
@@ -307,6 +325,7 @@
;; definition for method 3 of type art-group
(defmethod inspect art-group ((obj art-group))
"Print the arts in an art-group"
(format #t "[~8x] ~A~%" obj (-> obj type))
(format #t "~Tinfo: ~A~%" (-> obj info))
(format #t "~Tlength: ~D~%" (-> obj length))
@@ -315,13 +334,7 @@
(format #t "~Tdata[~D]: @ #x~X~%" (-> obj length) (-> obj data))
(dotimes (s5-0 (-> obj length))
(if (-> obj data s5-0)
(format
#t
"~T [~D] ~A (~D bytes)~%"
s5-0
(-> obj data s5-0)
(mem-size (-> obj data s5-0) #f 0)
)
(format #t "~T [~D] ~A (~D bytes)~%"s5-0 (-> obj data s5-0) (mem-size (-> obj data s5-0) #f 0))
(format #t "~T [~D] ~A (~D bytes)~%" s5-0 (-> obj data s5-0) 0)
)
)
@@ -329,26 +342,29 @@
)
(defmethod needs-link? art-group ((obj art-group))
(the-as symbol (and
(-> obj length)
(type-type? (-> obj data 0 type) art-joint-anim)
(!= (-> obj name) (-> (the-as art-joint-anim (-> obj data 0)) master-art-group-name))
)
"Does this art-group need to be added to the level's art group?
Some animations are streamed in, and need to be linked/unlinked to the level's list of art groups."
(the-as symbol (and (-> obj length)
(type-type? (-> obj data 0 type) art-joint-anim)
(!= (-> obj name) (-> (the-as art-joint-anim (-> obj data 0)) master-art-group-name))
)
)
)
(defmethod dummy-10 art-group ((obj art-group) (arg0 string) (arg1 type))
"Get the art with the given name and type. Set type to false if you don't care."
(the-as
joint
(cond
(arg1
(let ((s3-0 (+ (length (-> obj name)) 1)))
(dotimes (s2-0 (-> obj length))
(if (and
(-> obj data s2-0)
(= (-> obj data s2-0 type) arg1)
(or (name= arg0 (-> obj data s2-0 name)) (string-charp= arg0 (&-> (-> obj data s2-0 name) data s3-0)))
)
(if (and (-> obj data s2-0) ;; entry is populated
(= (-> obj data s2-0 type) arg1) ;; type is right
(or (name= arg0 (-> obj data s2-0 name)) ;; name is right.
(string-charp= arg0 (&-> (-> obj data s2-0 name) data s3-0)) ;; also seek past ag name, and try again.
)
)
(return (the-as joint (-> obj data s2-0)))
)
)
@@ -356,6 +372,7 @@
(the-as art-element #f)
)
(else
;; no type (also no weird after ag name check)
(dotimes (s4-1 (-> obj length))
(if (and (-> obj data s4-1) (name= arg0 (-> obj data s4-1 name)))
(return (the-as joint (-> obj data s4-1)))
@@ -368,6 +385,8 @@
)
(defmethod dummy-11 art-group ((obj art-group) (arg0 string) (arg1 type))
"Get the index of the art with the given name and type. Set type to false if you don't care.
Will return #f if the art is not found."
(cond
(arg1
(let ((s3-0 (+ (length (-> obj name)) 1)))
@@ -395,6 +414,7 @@
)
(defmethod login art-group ((obj art-group))
"Log in all the arts in a group."
(dotimes (s5-0 (-> obj length))
(if (-> obj data s5-0)
(set! (-> obj data s5-0) (login (-> obj data s5-0)))
@@ -423,6 +443,7 @@
)
(defmethod relocate art-group ((obj art-group) (arg0 kheap) (arg1 (pointer uint8)))
"Handle a loaded art-group."
(let ((s4-0 (clear *temp-string*)))
(string<-charp s4-0 arg1)
(set! obj (cond
@@ -440,10 +461,10 @@
(else
(let ((s5-1 (-> *level* loading-level)))
(if (or (not s5-1) (= (-> s5-1 name) 'default))
(login obj)
(login obj) ;; not part of level load, just normal login.
)
(if s5-1
(set-loaded-art (-> s5-1 art-group) obj)
(set-loaded-art (-> s5-1 art-group) obj) ;; part of level load, add to level's ag, but don't log in yet.
)
)
obj
@@ -545,7 +566,12 @@
obj
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Joint Control!
;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun joint-control-channel-eval ((arg0 joint-control-channel))
"Run the joint control num-func callback, remember the current time"
(let ((f0-2 ((-> arg0 num-func) arg0 (-> arg0 param 0) (-> arg0 param 1))))
(set! (-> arg0 eval-time) (the-as uint (-> *display* base-frame-counter)))
f0-2
@@ -553,6 +579,7 @@
)
(defun joint-control-channel-eval! ((arg0 joint-control-channel) (arg1 (function joint-control-channel float float float)))
"Set the joint control num-func, and evaluate it."
(set! (-> arg0 num-func) arg1)
(let ((f0-2 (arg1 arg0 (-> arg0 param 0) (-> arg0 param 1))))
(set! (-> arg0 eval-time) (the-as uint (-> *display* base-frame-counter)))
@@ -561,6 +588,7 @@
)
(defun joint-control-channel-group-eval! ((arg0 joint-control-channel) (arg1 art-joint-anim) (arg2 (function joint-control-channel float float float)))
"Set the joint control num-func, maybe update the anim, and maybe evaluate it."
(set! (-> arg0 num-func) arg2)
(cond
((= (-> arg0 command) 'stack)
@@ -577,6 +605,7 @@
)
(defun joint-control-channel-group! ((arg0 joint-control-channel) (arg1 art-joint-anim) (arg2 (function joint-control-channel float float float)))
"Set the joint control num-func and maybe update the anim."
(set! (-> arg0 num-func) arg2)
(cond
((= (-> arg0 command) 'stack)
@@ -589,22 +618,28 @@
)
(defun joint-control-copy! ((arg0 joint-control) (arg1 joint-control))
"Copy one joint control to another."
;; set fields
(set! (-> arg0 blend-index) (-> arg1 blend-index))
(set! (-> arg0 active-channels) (-> arg1 active-channels))
;; figure out which slot the source is, and remember that we're a copy.
(set! (-> arg0 root-channel)
(the-as
(inline-array joint-control-channel)
(-> arg0
channel
(/ (&- (the-as pointer (-> arg1 root-channel)) (the-as uint (the-as pointer (-> arg1 channel)))) 48)
)
)
(the-as (inline-array joint-control-channel)
(-> arg0
channel
(/ (&- (the-as pointer (-> arg1 root-channel)) (the-as uint (the-as pointer (-> arg1 channel)))) 48)
)
)
)
;; copy channels
(mem-copy!
(the-as pointer (-> arg0 channel))
(the-as pointer (-> arg1 channel))
(* 48 (-> arg0 allocated-length))
)
;; set parents of channels to point to the dest.
(dotimes (v1-7 (-> arg0 allocated-length))
(set! (-> arg0 channel v1-7 parent) arg0)
)
@@ -669,6 +704,8 @@
)
(defun flatten-joint-control-to-spr ((arg0 joint-control))
"Take the current state of the given joint-control and upload it to the scratchpad
in the format that will be understood by the joint animation decompressor."
(rlet ((vf1 :class vf)
(vf10 :class vf)
(vf11 :class vf)
@@ -685,14 +722,19 @@
(vf9 :class vf)
)
(let ((nb-channels (-> arg0 active-channels)))
(let ((f0-0 1.0)
(v1-0 0)
(a1-0 (-> (scratchpad-object terrain-context) work foreground joint-work flattened))
(let ((f0-0 1.0) ;; one
(v1-0 0) ;; offset in spad
(a1-0 (-> (scratchpad-object terrain-context) work foreground joint-work flattened)) ;; start of data.
)
;; loop over active channels.
;;
(dotimes (a0-1 nb-channels)
(let ((a2-3 (-> arg0 channel a0-1)))
(case (-> a2-3 command)
(('push)
;; this adds a weight of 1 for this channel always.
;; note that the quads store 1 - weight, so we store 0's here.
(let ((a2-4 (&+ (the-as pointer a1-0) v1-0)))
(set! (-> a1-0 0 quad) (the-as uint128 0))
(set! (-> a1-0 1 quad) (the-as uint128 0))
@@ -700,8 +742,10 @@
(set! (-> a1-0 3 quad) (the-as uint128 0))
(set! (-> a1-0 4 quad) (the-as uint128 0))
(set! (-> a1-0 5 quad) (the-as uint128 0))
;; and this thing stores the normal weight.
(set! (-> (the-as (pointer float) a2-4)) f0-0)
)
;; advance.
(set! a1-0 (the-as (inline-array vector) (-> a1-0 6)))
)
(('blend 'push1)
+45 -13
View File
@@ -5,19 +5,35 @@
;; name in dgo: mspace-h
;; dgos: GAME, ENGINE
;; mspace is the skeleton-based animation system.
;; There's three main types:
;; - The cspace-array. This contains references to the bones and the joints. (called node-list)
;; - The skeleton: This contains the bones. (called skeleton)
;; - The joint-control: this has the logic for running joint animations. (called skel)
;; There's three system's involved with animation:
;; - joint control - this figures out which animations to play.
;; the big list of playing animations in *stats-target* are all the joint control channels.
;; - joint decompression. The compressed joint animations store compressed joint data that must
;; be streamed and decompressed.
;; - bones. This is figuring out the location of each "bone" in the world.
;; First, the joint. This type just describes how the skeleton is connected.
(deftype joint (basic)
((name basic :offset-assert 4)
(number int32 :offset-assert 8)
(parent joint :offset-assert 12)
(bind-pose matrix :inline :offset-assert 16)
((name basic :offset-assert 4) ;; the joint's name (neckA, neckB, Rtoes, etc)
(number int32 :offset-assert 8) ;; the joint's number in the cspace-array
(parent joint :offset-assert 12) ;; the parent joint (ex, Lshould has parent of chest)
(bind-pose matrix :inline :offset-assert 16) ;; the bind pose, as a matrix. Unknown if used.
)
:method-count-assert 9
:size-assert #x50
:flag-assert #x900000050
)
;; I believe this stores offsets, in bytes, of where there are stored
;; (possibly in the scratchpad)
(deftype bone-cache (structure)
((bone-matrix uint32 :offset-assert 0)
(parent-matrix uint32 :offset-assert 4)
@@ -29,6 +45,8 @@
:flag-assert #x900000010
)
;; The "bone" stores the final positions of the bodies.
;; This is a world space transform.
(deftype bone (structure)
((transform matrix :inline :offset-assert 0)
(position vector :inline :offset 48) ;; overlays the matrix
@@ -40,6 +58,7 @@
:flag-assert #x900000060
)
;; Like a real skeleton, this is a collection of bones for a single character.
(deftype skeleton (inline-array-class)
((bones bone :inline :dynamic))
:method-count-assert 9
@@ -48,15 +67,27 @@
)
(set! (-> skeleton heap-base) 96)
;; The "cspace" seems to be a system for linking bones and joints.
;; The tree structure matches the tree of joints.
;; For example: (-> *target* node-list data 14 parent joint) is the same as
;; (-> *target* node-list data 14 joint parent)
;; But, we appear to use bone indices here.
;; So the joint index is always 1 less than the node index.
;; By convention, node 0 is not a joint.
;; node 1 is an "align" joint. It has parent #f, and is joint 0.
;; node 2 is a "prejoint". It also has parent #f, and is joint 1.
;; node 3 is "main". It has parent prejoint, and is joint 2.
;; node 4 is the first real joint (for jak, it's upper body).
(deftype cspace (structure)
((parent cspace :offset-assert 0)
(joint joint :offset-assert 4)
(joint-num int16 :offset-assert 8)
(geo basic :offset-assert 12)
(bone bone :offset-assert 16)
(param0 function :offset-assert 20)
(param1 basic :offset-assert 24)
(param2 basic :offset-assert 28)
((parent cspace :offset-assert 0) ;; the parent body
(joint joint :offset-assert 4) ;; the joint which moves us
(joint-num int16 :offset-assert 8) ;; seems to be 0 always??
(geo basic :offset-assert 12) ;; seems to be #f always
(bone bone :offset-assert 16) ;; points to our bone.
(param0 function :offset-assert 20) ;; ??
(param1 basic :offset-assert 24) ;; ??
(param2 basic :offset-assert 28) ;; ??
)
:method-count-assert 10
:size-assert #x20
@@ -68,6 +99,7 @@
)
)
;; All the cspaces for a character.
(deftype cspace-array (inline-array-class)
((data cspace :inline :dynamic :offset-assert 16))
:method-count-assert 9
@@ -32,7 +32,7 @@
:flag-assert #xb00000144
(:methods
(dummy-9 (_type_) symbol 9)
(dummy-10 (_type_) symbol 10)
(debug-draw (_type_) symbol 10)
)
)
@@ -83,7 +83,7 @@
:flag-assert #xb00000810
(:methods
(debug-draw (_type_) object 9)
(dummy-10 (_type_ collide-edge-hold-item) none 10)
(add-to-list! (_type_ collide-edge-hold-item) none 10)
)
)
@@ -121,17 +121,17 @@
:size-assert #x2690
:flag-assert #x1400002690
(:methods
(dummy-9 (_type_ collide-edge-hold-list) symbol 9)
(search-for-edges (_type_ collide-edge-hold-list) symbol 9)
(debug-draw-edges (_type_) object 10)
(dummy-11 (_type_) none 11)
(debug-draw-tris (_type_) none 11)
(debug-draw-sphere (_type_) symbol 12)
(dummy-13 (_type_ collide-edge-hold-item vector) none 13)
(compute-center-point! (_type_ collide-edge-edge vector) float 13)
(dummy-14 (_type_ vector vector int) float 14)
(dummy-15 (_type_) none 15)
(find-grabbable-edges! (_type_) none 15)
(find-grabbable-tris! (_type_) none 16)
(dummy-17 (_type_) none 17)
(dummy-18 (_type_ collide-edge-hold-list edge-grab-info) none 18)
(dummy-19 (_type_ collide-edge-hold-item edge-grab-info) symbol 19)
(should-add-to-list? (_type_ collide-edge-hold-item collide-edge-edge) symbol 17)
(find-best-grab! (_type_ collide-edge-hold-list edge-grab-info) symbol 18)
(check-grab-for-collisions (_type_ collide-edge-hold-item edge-grab-info) symbol 19)
)
)
+729 -4
View File
@@ -5,6 +5,731 @@
;; name in dgo: collide-edge-grab
;; dgos: GAME, ENGINE
(defmethod find-edge-grabs! target ((obj target) (arg0 collide-cache))
"Main edge grabbing method.
Will populate *edge-grab-info* and send *target* an 'edge-grab event if successful."
(rlet ((vf1 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
)
(let ((gp-0 *collide-edge-work*))
;; reset the edge work...
(set! (-> gp-0 num-verts) (the-as uint 0))
(set! (-> gp-0 num-edges) (the-as uint 0))
(set! (-> gp-0 num-tris) (the-as uint 0))
(let ((v1-0 (-> obj control)))
(set! (-> gp-0 ccache) arg0)
(.lvf vf1 (&-> gp-0 local-cache-fill-box min quad))
(.lvf vf2 (&-> gp-0 local-cache-fill-box max quad))
(set! (-> gp-0 cshape) v1-0)
(.lvf vf3 (&-> v1-0 trans quad))
)
;; translate the cache filling box
(.add.vf vf1 vf1 vf3 :mask #b111)
(.add.vf vf2 vf2 vf3 :mask #b111)
(.svf (&-> gp-0 cache-fill-box min quad) vf1)
(.svf (&-> gp-0 cache-fill-box max quad) vf2)
;; translate the reach box
(.lvf vf4 (&-> gp-0 local-within-reach-box min quad))
(.lvf vf5 (&-> gp-0 local-within-reach-box max quad))
(.add.vf vf4 vf4 vf3 :mask #b111)
(.add.vf vf5 vf5 vf3 :mask #b111)
;; and also provide an integer version of the box.
(.ftoi.vf vf6 vf4)
(.ftoi.vf vf7 vf5)
(.svf (&-> gp-0 within-reach-box min quad) vf4)
(.svf (&-> gp-0 within-reach-box max quad) vf5)
(.svf (&-> gp-0 within-reach-box4w min quad) vf6)
(.svf (&-> gp-0 within-reach-box4w max quad) vf7)
;; Fill the collide cache!
(fill-using-bounding-box
arg0
(-> gp-0 cache-fill-box)
(-> obj control root-prim collide-with)
obj
(new 'static 'pat-surface :skip #x1 :noentity #x1)
)
;; Filter out tris that can't be grabbed
(find-grabbable-tris! gp-0)
(when (nonzero? (-> gp-0 num-tris))
;; Find edges that we might be able to grab
(find-grabbable-edges! gp-0)
(when (nonzero? (-> gp-0 num-edges))
;;
(set! (-> gp-0 search-pt quad) (-> *target* control unknown-vector90 quad))
;; for the search, we either use the direction of the stick, or the heading of target.
(when (!= (-> *cpad-list* cpads (-> *target* control unknown-cpad-info00 number) stick0-speed) 0.0)
;; use stick
(set! (-> gp-0 search-dir-vec quad) (-> *target* control unknown-vector20 quad))
(search-for-edges gp-0 (-> gp-0 hold-list))
(when (find-best-grab! gp-0 (-> gp-0 hold-list) *edge-grab-info*)
(send-event *target* 'edge-grab)
(return (the-as object #f))
)
)
;; use target's heading
(vector-z-quaternion! (-> gp-0 search-dir-vec) (-> *target* control unknown-quaternion00))
(search-for-edges gp-0 (-> gp-0 hold-list))
(if (find-best-grab! gp-0 (-> gp-0 hold-list) *edge-grab-info*)
(send-event *target* 'edge-grab)
)
0
)
)
)
0
)
)
(defmethod search-for-edges collide-edge-work ((obj collide-edge-work) (arg0 collide-edge-hold-list))
"Iterate through edges, adding them to the collide-edge-hold-list, if they are good"
;; reset edge list.
(set! (-> arg0 num-allocs) (the-as uint 0))
(set! (-> arg0 num-attempts) (the-as uint 0))
(set! (-> arg0 head) #f)
(let ((s4-0 (the-as collide-edge-hold-item (-> arg0 items)))
(s3-0 (the-as collide-edge-edge (-> obj edges)))
)
;; loop over edges
(countdown (s2-0 (-> obj num-edges))
(when (not (-> s3-0 ignore))
;; find the grab point
(compute-center-point! obj s3-0 (-> s4-0 center-pt))
;; add if needed.
(when (should-add-to-list? obj s4-0 s3-0)
(add-to-list! arg0 s4-0)
(+! (-> arg0 num-allocs) 1)
(when (= (-> arg0 num-allocs) 32)
(format 0 "ERROR: Reached limit of edge grab hold items!~%")
(return #f)
)
(&+! s4-0 48)
)
)
(&+! s3-0 48)
)
)
#f
)
;; add to list.
(defmethod-mips2c "(method 10 collide-edge-hold-list)" 10 collide-edge-hold-list)
(deftype pbhp-stack-vars (structure)
((edge collide-edge-edge :offset-assert 0)
(allocated basic :offset-assert 4)
(neg-hold-pt vector :inline :offset-assert 16)
(split-vec vector :inline :offset-assert 32)
)
:method-count-assert 9
:size-assert #x30
:flag-assert #x900000030
)
(defmethod-mips2c "(method 18 collide-edge-work)" 18 collide-edge-work)
(defmethod check-grab-for-collisions collide-edge-work ((obj collide-edge-work) (arg0 collide-edge-hold-item) (arg1 edge-grab-info))
(local-vars (sv-144 (function vector vector vector float vector)) (sv-160 vector) (sv-176 vector))
(let* ((s3-0 (-> arg0 edge))
(s1-0 (-> s3-0 etri ctri))
(s4-0 (-> s1-0 prim-index))
)
(let ((s0-0 (new 'stack-no-clear 'vector)))
(vector+*! s0-0 (-> arg0 center-pt) (-> s3-0 edge-vec-norm) 1105.92)
(let ((f0-0 (dummy-14 obj (-> arg1 right-hand-hold) s0-0 (the-as int s4-0))))
(if (< 491.52 f0-0)
(return #f)
)
)
(set! sv-144 vector+*!)
(set! sv-160 s0-0)
(set! sv-176 (-> arg0 center-pt))
(let ((a2-3 (vector-negate! (new 'stack-no-clear 'vector) (-> s3-0 edge-vec-norm)))
(a3-2 1105.92)
)
(sv-144 sv-160 sv-176 a2-3 a3-2)
)
(let ((f0-1 (dummy-14 obj (-> arg1 left-hand-hold) s0-0 (the-as int s4-0))))
(if (< 491.52 f0-1)
(return #f)
)
)
)
(set! (-> arg1 tri-vertex 0 quad) (-> s1-0 vertex 0 quad))
(set! (-> arg1 world-vertex 4 quad) (-> s1-0 vertex 1 quad))
(set! (-> arg1 world-vertex 5 quad) (-> s1-0 vertex 2 quad))
(set! (-> arg1 edge-tri-pat) (the-as uint (-> s1-0 pat)))
(set! (-> arg1 center-hold quad) (-> arg0 center-pt quad))
(set! (-> arg1 world-vertex 0 quad) (-> s3-0 vertex-ptr 0 0 quad))
(set! (-> arg1 world-vertex 1 quad) (-> s3-0 vertex-ptr 1 0 quad))
(set! (-> arg1 hanging-matrix vector 1 quad) (-> *target* control dynam gravity-normal quad))
(vector-normalize!
(vector-! (-> arg1 hanging-matrix vector 2) (-> arg1 world-vertex 1) (the-as vector (-> arg1 world-vertex)))
1.0
)
(vector-normalize!
(vector-cross!
(the-as vector (-> arg1 hanging-matrix))
(-> arg1 hanging-matrix vector 2)
(-> arg1 hanging-matrix vector 1)
)
1.0
)
(vector-cross!
(-> arg1 hanging-matrix vector 2)
(the-as vector (-> arg1 hanging-matrix))
(-> arg1 hanging-matrix vector 1)
)
(set! (-> arg1 hanging-matrix vector 3 quad) (-> arg1 center-hold quad))
(transform-vectors! (-> arg1 hanging-matrix) (-> obj world-player-spheres) (-> obj local-player-spheres) 12)
(let ((a1-13 (new 'stack-no-clear 'collide-using-spheres-params)))
(set! (-> a1-13 spheres) (the-as (pointer sphere) (-> obj world-player-spheres)))
(set! (-> a1-13 num-spheres) (the-as uint 12))
(set! (-> a1-13 collide-with) (-> obj cshape root-prim collide-with))
(set! (-> a1-13 proc) #f)
(set! (-> a1-13 ignore-pat) (the-as uint 1))
(set! (-> a1-13 solid-only) #t)
(if (probe-using-spheres (-> obj ccache) a1-13)
(return #f)
)
)
(let* ((v1-36 (the-as object (-> obj ccache prims s4-0 prim)))
(a0-35 (-> (the-as collide-shape-prim v1-36) cshape))
)
(cond
(a0-35
(set! (-> arg1 actor-cshape-prim-offset) (- (the-as int v1-36) (the-as int (-> a0-35 process))))
(set! (-> arg1 actor-handle) (process->handle (-> a0-35 process)))
(let ((a1-19
(-> a0-35 process node-list data (-> (the-as collide-shape-prim v1-36) transform-index) bone transform)
)
(s5-1 (new 'stack-no-clear 'matrix))
)
(matrix-4x4-inverse! s5-1 a1-19)
(dotimes (s4-1 6)
(vector-matrix*! (-> arg1 local-vertex s4-1) (-> arg1 world-vertex s4-1) s5-1)
)
)
)
(else
(set! (-> arg1 actor-cshape-prim-offset) 0)
(set! (-> arg1 actor-handle) (the-as handle #f))
)
)
)
)
#t
)
(defmethod dummy-9 edge-grab-info ((obj edge-grab-info))
(local-vars (v0-0 symbol) (v1-14 int))
(rlet ((acc :class vf)
(Q :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
)
(init-vf0-vector)
(let ((s5-0 (the-as object #f)))
(set! (-> obj center-hold-old quad) (-> obj center-hold quad))
(let ((v1-1 (-> obj actor-cshape-prim-offset)))
(when (nonzero? v1-1)
(let ((a0-5 (handle->process (-> obj actor-handle))))
(if (not (the-as process a0-5))
(return #f)
)
(set! s5-0 (+ (the-as int a0-5) v1-1))
(if (zero? (-> (the-as collide-shape-prim s5-0) prim-core collide-as))
(return #f)
)
(let ((s4-0
(-> (the-as process-drawable a0-5)
node-list
data
(-> (the-as collide-shape-prim s5-0) transform-index)
bone
transform
)
)
)
(dotimes (s3-0 6)
(vector-matrix*! (-> obj world-vertex s3-0) (-> obj local-vertex s3-0) s4-0)
)
)
)
(.lvf vf1 (&-> obj world-vertex 3 quad))
(.lvf vf2 (&-> obj world-vertex 4 quad))
(.lvf vf3 (&-> obj world-vertex 5 quad))
(.sub.vf vf4 vf2 vf1)
(.sub.vf vf5 vf3 vf1)
(.outer.product.a.vf acc vf4 vf5)
(.outer.product.b.vf vf6 vf5 vf4 acc)
(.mul.vf vf7 vf6 vf6)
(.mul.x.vf acc vf0 vf7 :mask #b1000)
(.add.mul.y.vf acc vf0 vf7 acc :mask #b1000)
(.add.mul.z.vf vf7 vf0 vf7 acc :mask #b1000)
(.isqrt.vf Q vf0 vf7 :fsf #b11 :ftf #b11)
(let ((f1-0 0.707))
(.wait.vf)
(nop!)
(.mul.vf vf6 vf6 Q :mask #b111)
(.mov v1-14 vf6)
(b! (>= (the-as float (sar (the-as int v1-14) 32)) f1-0) cfg-17)
)
(set! v0-0 #f)
(b! #t cfg-27 :delay (nop!))
(label cfg-17)
(set! (-> obj hanging-matrix vector 1 quad) (-> *target* control dynam gravity-normal quad))
(vector-normalize!
(vector-! (-> obj hanging-matrix vector 2) (-> obj world-vertex 1) (the-as vector (-> obj world-vertex)))
1.0
)
(vector-normalize!
(vector-cross!
(the-as vector (-> obj hanging-matrix))
(-> obj hanging-matrix vector 2)
(-> obj hanging-matrix vector 1)
)
1.0
)
(vector-cross!
(-> obj hanging-matrix vector 2)
(the-as vector (-> obj hanging-matrix))
(-> obj hanging-matrix vector 1)
)
(set! (-> obj hanging-matrix vector 3 quad) (-> obj center-hold quad))
(let ((v1-21 *collide-edge-work*))
(transform-vectors!
(-> obj hanging-matrix)
(-> v1-21 world-player-spheres)
(-> v1-21 local-player-spheres)
12
)
)
)
)
(let ((v1-22 *collide-edge-work*)
(a1-14 (new 'stack-no-clear 'collide-using-spheres-params))
)
(let ((a0-24 'target-edge-grab-jump))
(b! (!= (-> *target* next-state name) a0-24) cfg-20 :delay (nop!))
)
(set! (-> a1-14 spheres) (the-as (pointer sphere) (-> v1-22 world-player-leap-up-spheres)))
(set! (-> a1-14 num-spheres) (the-as uint 6))
(set! (-> a1-14 collide-with) (-> v1-22 cshape root-prim collide-with))
(set! (-> a1-14 proc) #f)
(set! (-> a1-14 ignore-pat) (the-as uint 1))
(set! (-> a1-14 solid-only) #t)
(b! #t cfg-21 :delay (nop!))
(label cfg-20)
(set! (-> a1-14 spheres) (the-as (pointer sphere) (-> v1-22 world-player-spheres)))
(set! (-> a1-14 num-spheres) (the-as uint 6))
(set! (-> a1-14 collide-with) (-> v1-22 cshape root-prim collide-with))
(set! (-> a1-14 proc) #f)
(set! (-> a1-14 ignore-pat) (the-as uint 1))
(set! (-> a1-14 solid-only) #t)
(label cfg-21)
(b! (not (fill-and-probe-using-spheres *collide-cache* a1-14)) cfg-24)
)
(set! v0-0 #f)
(b! #t cfg-27 :delay (nop!))
(the-as none 0)
(label cfg-24)
(b! (not (the-as int s5-0)) cfg-26)
(let ((v1-40 (-> (the-as collide-shape-prim s5-0) cshape)))
(send-event (-> v1-40 process) 'edge-grabbed obj)
)
)
(label cfg-26)
(set! v0-0 #t)
(label cfg-27)
v0-0
)
)
(defmethod-mips2c "(method 16 collide-edge-work)" 16 collide-edge-work)
(defmethod-mips2c "(method 15 collide-edge-work)" 15 collide-edge-work)
(defmethod dummy-14 collide-edge-work ((obj collide-edge-work) (arg0 vector) (arg1 vector) (arg2 int))
(let ((f30-0 -1.0))
(let ((s2-0 (new 'stack-no-clear 'vector)))
(dotimes (s1-0 (the-as int (-> obj num-edges)))
(let ((v1-3 (-> obj edges s1-0)))
(when (not (-> v1-3 ignore))
(when (= (-> v1-3 etri ctri prim-index) arg2)
(let ((f0-0 (vector-segment-distance-point! arg1 (-> v1-3 vertex-ptr 0 0) (-> v1-3 vertex-ptr 1 0) s2-0)))
(when (or (< f30-0 0.0) (< f0-0 f30-0))
(set! f30-0 f0-0)
(set! (-> arg0 quad) (-> s2-0 quad))
)
)
)
)
)
)
)
f30-0
)
)
;; 17 cew
(defmethod should-add-to-list? collide-edge-work ((obj collide-edge-work) (arg0 collide-edge-hold-item) (arg1 collide-edge-edge))
(local-vars
(r0-0 uint128)
(v1-1 uint128)
(v1-2 uint128)
(v1-4 float)
(v1-5 float)
(v1-6 float)
(a3-1 uint128)
(t0-0 uint128)
(t1-1 uint128)
)
(rlet ((Q :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf10 :class vf)
(vf11 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
(vf8 :class vf)
(vf9 :class vf)
)
(init-vf0-vector)
(nop!)
(nop!)
(.lvf vf1 (&-> arg0 center-pt quad))
(nop!)
(let ((a3-0 (-> obj within-reach-box4w min quad)))
(nop!)
(let ((t1-0 (-> obj within-reach-box4w max quad)))
(.ftoi.vf vf2 vf1)
(let ((v1-0 (-> obj cshape)))
(.mov t0-0 vf2)
(.lvf vf3 (&-> arg1 outward quad))
(.pcgtw t1-1 t0-0 t1-0)
(.lvf vf4 (&-> obj outward-offset quad))
(.pcgtw a3-1 a3-0 t0-0)
(.lvf vf5 (&-> v1-0 trans quad))
)
)
)
(.por v1-1 t1-1 a3-1)
(let ((f0-0 (-> obj max-dist-sqrd-to-outward-pt)))
(.ppach v1-2 r0-0 v1-1)
(let ((f1-0 (-> obj max-dir-cosa-delta)))
(b! (nonzero? (shl (the-as int v1-2) 16)) cfg-4 :delay (.lvf vf6 (&-> obj search-dir-vec quad)))
(.mul.x.vf vf10 vf3 vf4)
(.lvf vf11 (&-> obj search-pt quad))
(.add.vf vf10 vf10 vf1)
(.sub.vf vf7 vf5 vf10)
(.mul.vf vf7 vf7 vf7)
(.add.z.vf vf7 vf7 vf7 :mask #b1)
(.mov v1-4 vf7)
(b! (< f0-0 v1-4) cfg-4)
(.sub.vf vf8 vf1 vf5)
(.mul.vf vf7 vf8 vf8)
(.add.z.vf vf7 vf7 vf7 :mask #b1)
(.isqrt.vf Q vf0 vf7 :fsf #b11 :ftf #b0)
(nop!)
(.wait.vf)
(nop!)
(.mul.vf vf8 vf8 Q :mask #b101)
(.mul.vf vf9 vf8 vf6)
(.add.z.vf vf9 vf9 vf9 :mask #b1)
(.mov v1-5 vf9)
(b! (< v1-5 f1-0) cfg-4)
)
)
(.sub.vf vf7 vf11 vf1)
(.svf (&-> arg0 center-pt quad) vf1)
(.mul.vf vf7 vf7 vf7)
(set! (-> arg0 split) 0)
(.svf (&-> arg0 outward-pt quad) vf10)
(.add.z.vf vf7 vf7 vf7 :mask #b1)
(set! (-> arg0 edge) arg1)
(.mov v1-6 vf7)
(set! (-> arg0 rating) v1-6)
(let ((v0-0 #t))
(b! #t cfg-6 :delay (nop!))
(label cfg-4)
(set! v0-0 #f)
(b! #t cfg-6 :delay (nop!))
(set! v0-0 (the-as symbol 0))
(label cfg-6)
v0-0
)
)
)
(defmethod compute-center-point! collide-edge-work ((obj collide-edge-work) (arg0 collide-edge-edge) (arg1 vector))
(local-vars (v0-0 float) (v1-1 float) (v1-2 float) (v1-3 float))
(rlet ((Q :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf10 :class vf)
(vf11 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
(vf8 :class vf)
(vf9 :class vf)
)
(init-vf0-vector)
(.mov.vf vf7 vf0)
(.lvf vf1 (&-> obj search-pt quad))
(let ((f0-0 0.0))
(let ((v1-0 (-> arg0 vertex-ptr 0))
(a0-1 (-> arg0 vertex-ptr 1))
)
(.lvf vf2 (&-> v1-0 0 quad))
(.lvf vf3 (&-> a0-1 0 quad))
)
(.sub.vf vf4 vf1 vf2)
(.sub.vf vf5 vf3 vf2)
(.mul.vf vf6 vf5 vf5)
(.add.z.vf vf6 vf6 vf6 :mask #b1)
(.sqrt.vf Q vf6 :ftf #b0)
(nop!)
(.wait.vf)
(nop!)
(.add.vf vf6 vf0 Q :mask #b1)
(.nop.vf)
(.mov v1-1 vf6)
(let ((f1-0 v1-1))
(.div.vf Q vf0 vf6 :fsf #b11 :ftf #b0)
(.wait.vf)
(nop!)
(.add.vf vf8 vf0 Q :mask #b1)
(.mul.x.vf vf9 vf5 vf8)
(.mov v1-2 vf8)
(.mul.vf vf10 vf9 vf4)
(.add.z.vf vf10 vf10 vf10 :mask #b1)
(let ((f2-0 v1-2))
(.mov v1-3 vf10)
(let ((f3-0 v1-3))
(b! (< f3-0 f0-0) cfg-4 :likely-delay (set! f3-0 f0-0))
(b! (< f1-0 f3-0) cfg-4 :likely-delay (set! f3-0 f1-0))
(label cfg-4)
(let ((v1-4 (* f3-0 f2-0)))
(.mov vf11 v1-4)
)
)
)
)
)
(.mul.x.vf vf7 vf5 vf11 :mask #b111)
(.add.vf vf7 vf7 vf2 :mask #b111)
(.svf (&-> arg1 quad) vf7)
(.mov v0-0 vf7)
v0-0
)
)
(defmethod debug-draw edge-grab-info ((obj edge-grab-info))
(add-debug-line
#t
(bucket-id debug-draw1)
(the-as vector (-> obj world-vertex))
(-> obj world-vertex 1)
(new 'static 'rgba :r #xff :a #x60)
#f
(the-as rgba -1)
)
(add-debug-sphere
#t
(bucket-id debug-draw1)
(-> obj center-hold)
204.8
(new 'static 'rgba :r #xff :g #xff :a #x80)
)
(add-debug-sphere
#t
(bucket-id debug-draw1)
(-> obj left-hand-hold)
204.8
(new 'static 'rgba :r #xff :g #xff :a #x60)
)
(add-debug-sphere
#t
(bucket-id debug-draw1)
(-> obj right-hand-hold)
204.8
(new 'static 'rgba :r #xff :g #xff :a #x60)
)
(add-debug-outline-triangle
#t
(bucket-id debug-draw1)
(the-as vector (-> obj tri-vertex))
(-> obj world-vertex 4)
(-> obj world-vertex 5)
(new 'static 'rgba :r #xff :a #x30)
)
(the-as symbol (cond
((nonzero? (-> obj actor-cshape-prim-offset))
(if (handle->process (-> obj actor-handle))
(format *stdcon* "grab: ~A~%" (-> obj actor-handle process 0 name))
(format *stdcon* "grab: invalid handle~%")
)
)
(else
(format *stdcon* "grab: ground~%")
)
)
)
)
(defmethod debug-draw-edges collide-edge-work ((obj collide-edge-work))
(let ((gp-0 0))
(dotimes (s4-0 (the-as int (-> obj num-edges)))
(let* ((s3-0 (-> obj edges s4-0))
(a2-0 (-> s3-0 vertex-ptr 0 0))
(a3-0 (-> s3-0 vertex-ptr 1 0))
(s2-0 (new 'stack-no-clear 'vector))
)
(vector+! s2-0 a2-0 a3-0)
(vector-float*! s2-0 s2-0 0.5)
(cond
((-> s3-0 ignore)
(add-debug-line
#t
(bucket-id debug-draw1)
a2-0
a3-0
(new 'static 'rgba :r #x7f :g #x7f :b #x7f :a #x50)
#f
(the-as rgba -1)
)
(+! gp-0 1)
)
(else
(add-debug-line
#t
(bucket-id debug-draw1)
a2-0
a3-0
(new 'static 'rgba :r #xff :g #xff :b #xff :a #x60)
#f
(the-as rgba -1)
)
(add-debug-vector
#t
(bucket-id debug-draw1)
s2-0
(-> s3-0 outward)
(meters 0.3)
(new 'static 'rgba :r #xff :a #x80)
)
)
)
)
)
(format *stdcon* "found ~D edges (and ~D ignored)~%" (- (-> obj num-edges) (the-as uint gp-0)) gp-0)
)
)
(defmethod debug-draw-sphere collide-edge-work ((obj collide-edge-work))
(dotimes (s5-0 (the-as int (-> obj num-verts)))
(let ((a2-0 (-> obj verts s5-0)))
(add-debug-sphere #t (bucket-id debug-draw1) a2-0 819.2 (new 'static 'rgba :r #xff :g #xff :a #x80))
)
)
#f
)
(defmethod debug-draw collide-edge-hold-list ((obj collide-edge-hold-list))
(let ((s4-0 (-> obj head))
(s5-0 0)
)
(let ((s3-0 (new 'stack-no-clear 'vector))
(s2-0 #t)
)
(set! (-> s3-0 quad) (-> *target* control unknown-vector90 quad))
(while s4-0
(+! s5-0 1)
(set! (-> s3-0 y) (-> s4-0 center-pt y))
(add-debug-sphere #t (bucket-id debug-draw1) s3-0 409.6 (new 'static 'rgba :a #x80))
(cond
(s2-0
(set! s2-0 #f)
(add-debug-sphere
#t
(bucket-id debug-draw1)
(-> s4-0 center-pt)
614.4
(new 'static 'rgba :r #xff :g #xff :a #x80)
)
(add-debug-sphere #t (bucket-id debug-draw1) (-> s4-0 outward-pt) 409.6 (new 'static 'rgba :r #xff :a #x80))
)
(else
(add-debug-sphere
#t
(bucket-id debug-draw1)
(-> s4-0 center-pt)
614.4
(new 'static 'rgba :r #x7f :g #x7f :a #x40)
)
(add-debug-sphere #t (bucket-id debug-draw1) (-> s4-0 outward-pt) 409.6 (new 'static 'rgba :r #x7f :a #x40))
)
)
(set! s4-0 (-> s4-0 next))
)
)
(format *stdcon* "hold list has ~D item(s)~%" s5-0)
)
(dotimes (s5-1 (the-as int (-> obj num-attempts)))
(add-debug-sphere
#t
(bucket-id debug-draw1)
(the-as vector (-> obj attempts s5-1))
409.6
(new 'static 'rgba :a #x40)
)
)
(format *stdcon* "hold list has ~D attempt(s)~%" (-> obj num-attempts))
)
(defmethod debug-draw-tris collide-edge-work ((obj collide-edge-work))
(dotimes (s5-0 (the-as int (-> obj num-tris)))
(let* ((v1-3 (-> obj tris s5-0 ctri))
(t1-0 (copy-and-set-field (-> *pat-mode-info* (-> v1-3 pat mode) color) a 64))
)
(add-debug-outline-triangle
#t
(bucket-id debug-draw1)
(the-as vector (-> v1-3 vertex))
(-> v1-3 vertex 1)
(-> v1-3 vertex 2)
t1-0
)
)
)
(none)
)
;; failed to figure out what this is:
(let
((v1-1
@@ -88,7 +813,7 @@
)
(defmethod find-edge-grabs! target ((obj target) (arg0 collide-cache))
(format *stdcon* "no edge grabs for you!~%")
(the object 0)
)
; (defmethod find-edge-grabs! target ((obj target) (arg0 collide-cache))
; (format *stdcon* "no edge grabs for you!~%")
; (the object 0)
; )
+2
View File
@@ -131,6 +131,8 @@
(login (_type_) _type_ 9)
(dummy-10 (_type_ string type) joint 10)
(dummy-11 (_type_ string type) int 11)
; (lookup-art (_type_ string type) joint 10) ;; can also be art-joint-anim
; (lookup-idx-of-art (_type_ string type) int 11)
(needs-link? (_type_) symbol 12)
)
)
+2 -2
View File
@@ -710,7 +710,7 @@
(ja-post)
(when (logtest? (-> self flags) (anim-tester-flags fanimt4))
(draw-joint-spheres self)
(dummy-10 (-> self skel) (the-as symbol *stdcon*))
(debug-print-channels (-> self skel) (the-as symbol *stdcon*))
)
)
(none)
@@ -2239,7 +2239,7 @@
)
(logclear! (-> self flags) (anim-tester-flags fanimt1))
(when (!= *master-mode* 'menu)
(dummy-10 (-> self skel) (the-as symbol *stdcon*))
(debug-print-channels (-> self skel) (the-as symbol *stdcon*))
(add-debug-x
#t
(bucket-id debug-draw1)
+65 -1
View File
@@ -881,6 +881,70 @@
)
;; ERROR: function was not converted to expressions. Cannot decompile.
(defmethod dummy-19 process-drawable ((obj process-drawable))
(local-vars (s7-0 none) (ra-0 int))
(let ((gp-0 (-> obj skel)))
(label cfg-1)
(let ((s4-0 (-> gp-0 active-channels)))
(b! (logtest? (-> obj draw status) (draw-status drwf01)) cfg-27)
(let ((s3-0 0))
(b! #t cfg-13 :delay (nop!))
(label cfg-3)
(let ((s2-0 (-> gp-0 channel s3-0)))
(let ((v1-7 (-> s2-0 command)))
(b! (!= v1-7 'stack) cfg-6 :delay (nop!))
(joint-control-channel-eval s2-0)
(b! (!= s4-0 (-> gp-0 active-channels)) cfg-1 :delay (nop!))
(b! #t cfg-12 :delay (nop!))
(label cfg-6)
(b! (!= v1-7 'stack1) cfg-9 :delay (nop!))
)
(joint-control-channel-eval s2-0)
(b! (!= s4-0 (-> gp-0 active-channels)) cfg-1 :delay (nop!))
(set! (-> gp-0 channel (+ s3-0 -1) frame-interp) (-> s2-0 frame-interp))
(b! #t cfg-12 :delay (nop!))
(label cfg-9)
(let ((s1-0 (-> s2-0 frame-group)))
(let ((v1-16 art-joint-anim))
(b! (= (-> s1-0 type) v1-16) cfg-11)
)
(go process-drawable-art-error "joint-anim")
(format 0 "dummy-19 bad~%")
(break!)
(nop!)
0
(label cfg-11)
(set! (-> s2-0 frame-num) (fmax 0.0 (fmin (-> s2-0 frame-num) (the float (+ (-> s1-0 data 0 length) -1)))))
)
)
(label cfg-12)
(+! s3-0 1)
(label cfg-13)
(b! (< s3-0 s4-0) cfg-3)
)
(dotimes (v1-26 s4-0)
(set! (-> gp-0 channel v1-26 frame-interp) (fmax 0.0 (fmin 1.0 (-> gp-0 channel v1-26 frame-interp))))
)
(if (or (zero? s4-0) (not (-> gp-0 root-channel 0 frame-group)))
(logior! (-> obj draw status) (draw-status drwf02))
)
)
; (if (logtest? (-> obj skel status) 72)
; (merc-blend-shape obj)
; )
; (if (logtest? (-> obj skel status) 384)
; (merc-eye-anim obj)
; )
(label cfg-27)
(let ((a0-17 (-> gp-0 effect)))
; (if a0-17
; (TODO-RENAME-9 a0-17)
; )
)
)
0
(none)
)
;; WARN: Expression building failed: Function ja-post has a return type of none, but the expression builder found a return statement.
(defbehavior ja-post process-drawable ()
@@ -888,7 +952,7 @@
(let ((gp-1 (logtest? (-> self draw status) (draw-status drwf04))))
(logclear! (-> self draw status) (draw-status drwf02 drwf04))
(when (nonzero? (-> self skel))
;(dummy-19 self) TODO
(dummy-19 self)
(#when TARGET_STARTUP_HACKS
(when (eq? (-> self type) target)
+7 -1
View File
@@ -1051,7 +1051,7 @@
)
)
(if (nonzero? (-> (the-as process-drawable s5-2) skel))
(dummy-10 (-> (the-as process-drawable s5-2) skel) (the-as symbol *stdcon*))
(debug-print-channels (-> (the-as process-drawable s5-2) skel) (the-as symbol *stdcon*))
)
(if (nonzero? (-> (the-as process-drawable s5-2) nav))
(dummy-9 (-> (the-as process-drawable s5-2) nav))
@@ -1255,6 +1255,9 @@
(define-extern crate type)
(define-extern water-vol type)
(define-extern slide-control type)
(define-extern racer type)
(define-extern launcher type)
(define-extern warp-gate-switch type)
(defmacro heap-size-hack (info entity-type)
`(cond
@@ -1280,6 +1283,9 @@
(type-type? (-> obj etype) ecovalve)
(type-type? (-> obj etype) water-vol)
(type-type? (-> obj etype) slide-control)
(type-type? (-> obj etype) racer)
(type-type? (-> obj etype) launcher)
(type-type? (-> obj etype) warp-gate-switch)
;(type-type? (-> obj etype) crate)
)
+1 -1
View File
@@ -1115,7 +1115,7 @@
(defmethod initialize eco-pill ((obj eco-pill))
(set! *eco-pill-count* (+ *eco-pill-count* 1))
(stack-size-set! (-> obj main-thread) 128)
(stack-size-set! (-> obj main-thread) 256) ;; bumped from 128.
(logior! (-> obj mask) (process-mask actor-pause))
(set! (-> obj actor-pause) #t)
(set! (-> obj notify-parent) #f)
+7 -3
View File
@@ -476,7 +476,7 @@
(-> arg0 control unknown-float81)
(-> arg0 control unknown-float82)
)
(dummy-10 (-> arg0 skel) arg1)
(debug-print-channels (-> arg0 skel) arg1)
)
(draw-history (-> arg0 control))
#f
@@ -1244,7 +1244,7 @@
(send-event self 'end-mode)
)
(if *display-edge-collision-marks*
(dummy-10 s5-0)
(debug-draw s5-0)
)
(set! (-> self control ground-pat) (the-as pat-surface (-> s5-0 edge-tri-pat)))
(vector-normalize!
@@ -1301,7 +1301,7 @@
(send-event self 'end-mode)
)
(if *display-edge-collision-marks*
(dummy-10 gp-0)
(debug-draw gp-0)
)
(vector-normalize!
(vector-! (-> self control unknown-vector100) (the-as vector (-> gp-0 world-vertex)) (-> gp-0 world-vertex 1))
@@ -1529,6 +1529,10 @@
(defbehavior target-real-post target ()
(let ((gp-0 (the int (-> *display* time-ratio))))
;; added - this will display "LAG" on screen when target code is running in the laggy mode.
(when (!= gp-0 1)
(format *stdcon* "~19LLAG: ~D~%~0L" gp-0)
)
(set-time-ratios *display* 1.0)
(countdown (s5-0 gp-0)
(set! (-> self control unknown-int40) s5-0)
+1 -1
View File
@@ -236,7 +236,7 @@
)
(when *display-sidekick-stats*
(format *stdcon* "~%")
(dummy-10 (-> self skel) (the-as symbol *stdcon*))
(debug-print-channels (-> self skel) (the-as symbol *stdcon*))
(add-debug-sphere
*display-sidekick-stats*
(bucket-id debug-draw1)
-2
View File
@@ -245,8 +245,6 @@
)
)
((= v1-0 'rotate-y-angle)
(format 0 "doing roty angle~%")
(break!)
(quaternion-rotate-y!
(-> self control unknown-quaternion00)
(-> self control unknown-quaternion00)
+1 -1
View File
@@ -625,7 +625,7 @@
(cond
((not *progress-process*)
(when (progress-allowed?)
;;(hide-hud)
(hide-hud)
(make-levels-with-tasks-available-to-progress)
(disable-level-text-file-loading)
(set! (-> *progress-state* starting-state) screen)