Files
jak-project/test/decompiler/reference/jak3/engine/collide/collide-mesh_REF.gc
T
Hat Kid 93afb02cf4 decomp3: spawn target, add merc and particle buckets and some temporary hacks (#3445)
This includes all the collision stuff needed to spawn `target`,
decompiles the sparticle code and adds some of the PC hacks needed for
merc to run (it doesn't work quite right and looks bad, likely due to a
combination of code copied from Jak 2 and the time of day hacks).

There are a bunch of temporary hacks (see commits) in place to prevent
the game from crashing quite as much, but it is still extremely prone to
doing so due to lots of missing functions/potentially bad decomp.

---------

Co-authored-by: water <awaterford111445@gmail.com>
2024-04-05 00:07:39 -04:00

660 lines
22 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; definition for method 5 of type collide-mesh
;; WARN: Return type mismatch uint vs int.
(defmethod asize-of ((this collide-mesh))
(the-as int (+ (-> collide-mesh size) (* (+ (-> this num-tris) -1) 8)))
)
;; definition for method 8 of type collide-mesh
;; WARN: Return type mismatch int vs collide-mesh.
(defmethod mem-usage ((this collide-mesh) (usage memory-usage-block) (flags int))
(set! (-> usage length) (max 83 (-> usage length)))
(set! (-> usage data 82 name) "collide-mesh")
(+! (-> usage data 82 count) 1)
(let ((v1-6 (asize-of this)))
(+! (-> usage data 82 used) v1-6)
(+! (-> usage data 82 total) (logand -16 (+ v1-6 15)))
)
(set! (-> usage length) (max 83 (-> usage length)))
(set! (-> usage data 82 name) "collide-mesh")
(+! (-> usage data 82 count) 1)
(let ((v1-16 (* (-> this num-verts) 16)))
(+! (-> usage data 82 used) v1-16)
(+! (-> usage data 82 total) (logand -16 (+ v1-16 15)))
)
(the-as collide-mesh 0)
)
;; definition for method 9 of type collide-mesh
;; WARN: Return type mismatch int vs none.
(defmethod debug-draw-tris ((this collide-mesh) (arg0 process-drawable) (arg1 int))
(rlet ((acc :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 (-> this tris)))
(s4-0 (-> arg0 node-list data arg1 bone transform))
)
(countdown (s3-0 (-> this num-tris))
(let ((a2-1 (new 'stack-no-clear 'vector))
(a3-0 (new 'stack-no-clear 'vector))
(t0-0 (new 'stack-no-clear 'vector))
)
(.lvf vf4 (&-> s4-0 rvec quad))
(.lvf vf5 (&-> s4-0 uvec quad))
(.lvf vf6 (&-> s4-0 fvec quad))
(.lvf vf7 (&-> s4-0 trans quad))
(.lvf vf1 (&-> (-> this vertex-data (-> (the-as collide-mesh-tri s5-0) vertex-index 0)) quad))
(.lvf vf2 (&-> (-> this vertex-data (-> (the-as collide-mesh-tri s5-0) vertex-index 1)) quad))
(.lvf vf3 (&-> (-> this vertex-data (-> (the-as collide-mesh-tri s5-0) vertex-index 2)) quad))
(let ((t1-0 (copy-and-set-field (-> *pat-mode-info* (-> (the-as collide-mesh-tri s5-0) pat mode) color) a 16)))
(.mul.w.vf acc vf7 vf0)
(.add.mul.x.vf acc vf4 vf1 acc)
(.add.mul.y.vf acc vf5 vf1 acc)
(.add.mul.z.vf vf1 vf6 vf1 acc)
(.mul.w.vf acc vf7 vf0)
(.add.mul.x.vf acc vf4 vf2 acc)
(.add.mul.y.vf acc vf5 vf2 acc)
(.add.mul.z.vf vf2 vf6 vf2 acc)
(.mul.w.vf acc vf7 vf0)
(.add.mul.x.vf acc vf4 vf3 acc)
(.add.mul.y.vf acc vf5 vf3 acc)
(.add.mul.z.vf vf3 vf6 vf3 acc)
(.svf (&-> a2-1 quad) vf1)
(.svf (&-> a3-0 quad) vf2)
(.svf (&-> t0-0 quad) vf3)
(add-debug-flat-triangle #t (bucket-id debug-no-zbuf1) a2-1 a3-0 t0-0 t1-0)
)
)
(set! s5-0 (&+ (the-as collide-mesh-tri s5-0) 8))
)
)
0
(none)
)
)
;; definition of type sopt-work
(deftype sopt-work (structure)
((intersect vector :inline)
(sphere-bbox4w bounding-box4w :inline)
)
)
;; definition for method 3 of type sopt-work
(defmethod inspect ((this sopt-work))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this 'sopt-work)
(format #t "~1Tintersect: #<vector @ #x~X>~%" (-> this intersect))
(format #t "~1Tsphere-bbox4w: #<bounding-box4w @ #x~X>~%" (-> this sphere-bbox4w))
(label cfg-4)
this
)
;; definition for method 12 of type collide-mesh
;; INFO: function output is handled by mips2c
(defmethod-mips2c "(method 12 collide-mesh)" 12 collide-mesh)
;; definition of type spat-work
(deftype spat-work (structure)
((intersect vector :inline)
(sphere-bbox4w bounding-box4w :inline)
)
)
;; definition for method 3 of type spat-work
(defmethod inspect ((this spat-work))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this 'spat-work)
(format #t "~1Tintersect: #<vector @ #x~X>~%" (-> this intersect))
(format #t "~1Tsphere-bbox4w: #<bounding-box4w @ #x~X>~%" (-> this sphere-bbox4w))
(label cfg-4)
this
)
;; definition for method 11 of type collide-mesh
;; INFO: Used lq/sq
(defmethod should-push-away-test ((this collide-mesh) (arg0 collide-mesh-cache-tri) (arg1 collide-tri-result) (arg2 vector) (arg3 float))
(local-vars
(v1-0 uint128)
(a0-1 uint128)
(a1-2 uint128)
(a1-3 uint128)
(a1-4 uint128)
(a1-7 pat-surface)
(a2-1 uint128)
(a2-2 uint128)
(a2-4 float)
(a2-5 float)
(a2-7 float)
(f0-0 float)
(f2-1 float)
(f3-0 float)
(f4-0 float)
)
(rlet ((Q :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf10 :class vf)
(vf11 :class vf)
(vf12 :class vf)
(vf13 :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)
(let ((s4-0 (new 'stack-no-clear 'spat-work)))
(nop!)
(let ((s3-0 arg0))
(.lvf vf3 (&-> arg2 quad))
(nop!)
(let ((s2-0 (-> this num-tris)))
(.sub.w.vf vf12 vf3 vf3)
(nop!)
(.add.w.vf vf13 vf3 vf3)
(nop!)
(.ftoi.vf vf12 vf12)
(nop!)
(.ftoi.vf vf13 vf13)
(nop!)
(.mov v1-0 vf12)
(.svf (&-> s4-0 sphere-bbox4w min quad) vf12)
(.mov a0-1 vf13)
(.svf (&-> s4-0 sphere-bbox4w max quad) vf13)
(until (>= a2-7 f4-0)
(until (> f0-0 f2-1)
(until (>= f3-0 f2-1)
(label cfg-1)
(b! (zero? s2-0) cfg-10 :delay (set! a2-1 (-> s3-0 bbox4w min quad)))
(+! s2-0 -1)
(let ((a1-1 (-> s3-0 bbox4w max quad)))
(.pcgtw a2-2 a2-1 a0-1)
(nop!)
(.pcgtw a1-2 v1-0 a1-1)
)
(nop!)
(.por a1-3 a2-2 a1-2)
(nop!)
(.ppach a1-4 (the-as uint128 0) a1-3)
(nop!)
(let ((a1-5 (shl (the-as int a1-4) 16)))
(nop!)
(b! (nonzero? a1-5) cfg-1 :likely-delay (set! s3-0 (+ s3-0 96)))
)
(closest-pt-in-triangle (-> s4-0 intersect) arg2 (the-as matrix (-> s3-0 vertex)) (-> s3-0 normal))
(.lvf vf2 (&-> s4-0 intersect quad))
(.lvf vf3 (&-> arg2 quad))
(.lvf vf1 (&-> s3-0 normal quad))
(set! v1-0 (-> s4-0 sphere-bbox4w min quad))
(set! a0-1 (-> s4-0 sphere-bbox4w max quad))
(.sub.vf vf4 vf3 vf2)
(set! a1-7 (-> s3-0 pat))
(.mul.vf vf5 vf4 vf1)
(.lvf vf7 (&-> s3-0 vertex 0 quad))
(.mul.vf vf6 vf4 vf4)
(.lvf vf8 (&-> s3-0 vertex 1 quad))
(.mov.vf vf1 vf0 :mask #b1000)
(.lvf vf9 (&-> s3-0 vertex 2 quad))
(.add.x.vf vf5 vf5 vf5 :mask #b10)
(&+! s3-0 96)
(.add.y.vf vf6 vf6 vf6 :mask #b1)
(set! f3-0 arg3)
(.add.z.vf vf5 vf5 vf5 :mask #b10)
(.add.z.vf vf6 vf6 vf6 :mask #b1)
(.sqrt.vf Q vf6 :ftf #b0)
(.mov a2-4 vf5)
(set! f0-0 0.0)
(.wait.vf)
(let ((f1-0 (-> arg2 w)))
(.add.vf vf6 vf0 Q :mask #b1)
(.mov.vf vf10 vf6)
(b! (< (the-as int a2-4) 0) cfg-6 :likely-delay (.sub.vf vf10 vf0 vf10))
(label cfg-6)
(.mov a2-5 vf10)
(set! f2-1 (- a2-5 f1-0))
)
(.div.vf Q vf0 vf6 :fsf #b11 :ftf #b0)
)
)
(.wait.vf)
(nop!)
(.mul.vf vf11 vf4 Q)
(set! f4-0 0.707)
(.mul.vf vf5 vf11 vf1)
(.add.y.vf vf5 vf5 vf5 :mask #b1)
(.add.z.vf vf5 vf5 vf5 :mask #b1)
(.mov a2-7 vf5)
)
)
)
)
(set! arg3 f2-1)
(.svf (&-> arg1 vertex 0 quad) vf7)
(.svf (&-> arg1 vertex 1 quad) vf8)
(.svf (&-> arg1 vertex 2 quad) vf9)
(.svf (&-> arg1 intersect quad) vf2)
(.svf (&-> arg1 normal quad) vf1)
(b! #t cfg-1 :delay (set! (-> arg1 pat) a1-7))
(label cfg-10)
arg3
)
)
;; definition for method 14 of type collide-mesh
;; INFO: function output is handled by mips2c
(defmethod-mips2c "(method 14 collide-mesh)" 14 collide-mesh)
;; definition for method 15 of type collide-mesh
;; INFO: function output is handled by mips2c
(defmethod-mips2c "(method 15 collide-mesh)" 15 collide-mesh)
;; definition for method 9 of type collide-mesh-cache
;; INFO: Used lq/sq
;; ERROR: Unsupported inline assembly instruction kind - [pxor v1, v1, a0]
;; ERROR: Unsupported inline assembly instruction kind - [pxor a0, a0, a1]
;; ERROR: Unsupported inline assembly instruction kind - [pxor a0, a0, a1]
;; ERROR: Unsupported inline assembly instruction kind - [pxor a0, a0, a1]
(defmethod populate-for-prim-mesh ((this collide-mesh-cache) (arg0 collide-shape-prim-mesh))
(local-vars
(r0-0 uint128)
(v1-7 uint128)
(v1-8 uint128)
(v1-9 uint128)
(v1-11 uint128)
(a0-6 uint128)
(a0-8 uint128)
(a0-10 uint128)
(a0-11 uint128)
(a0-12 uint128)
)
(let ((s5-0 (-> arg0 cshape process node-list data (-> arg0 transform-index) bone transform))
(s4-0 (-> arg0 mesh-cache-entry))
)
(cond
((= (-> arg0 mesh-cache-id) (-> this id))
(let ((v1-6 (-> s5-0 rvec quad))
(a0-4 (-> s4-0 mat rvec quad))
)
(.pxor v1-7 v1-6 a0-4)
)
(let ((a0-5 (-> s5-0 uvec quad))
(a1-1 (-> s4-0 mat uvec quad))
)
(.pxor a0-6 a0-5 a1-1)
)
(.por v1-8 v1-7 a0-6)
(let ((a0-7 (-> s5-0 fvec quad))
(a1-2 (-> s4-0 mat fvec quad))
)
(.pxor a0-8 a0-7 a1-2)
)
(.por v1-9 v1-8 a0-8)
(let ((a0-9 (-> s5-0 trans quad))
(a1-3 (-> s4-0 mat trans quad))
)
(.pxor a0-10 a0-9 a1-3)
)
(.por a0-11 v1-9 a0-10)
(let ((v1-10 a0-11))
(.pcpyud a0-12 a0-11 r0-0)
(.por v1-11 a0-12 v1-10)
)
(when (nonzero? v1-11)
(set! (-> s4-0 mat rvec quad) (-> s5-0 rvec quad))
(set! (-> s4-0 mat uvec quad) (-> s5-0 uvec quad))
(set! (-> s4-0 mat fvec quad) (-> s5-0 fvec quad))
(set! (-> s4-0 mat trans quad) (-> s5-0 trans quad))
(unpack-mesh-to-cache! (-> arg0 mesh) (-> s4-0 tris) s5-0)
)
)
(else
(let ((v1-19 (-> arg0 mesh)))
(when v1-19
(set! s4-0 (allocate! this (the-as int (+ (* (the-as uint 96) (-> v1-19 num-tris)) 64))))
(set! (-> arg0 mesh-cache-entry) s4-0)
(cond
(s4-0
(set! (-> arg0 mesh-cache-id) (-> this id))
(set! (-> s4-0 mat rvec quad) (-> s5-0 rvec quad))
(set! (-> s4-0 mat uvec quad) (-> s5-0 uvec quad))
(set! (-> s4-0 mat fvec quad) (-> s5-0 fvec quad))
(set! (-> s4-0 mat trans quad) (-> s5-0 trans quad))
(unpack-mesh-to-cache! (-> arg0 mesh) (-> s4-0 tris) s5-0)
)
(else
(set! (-> arg0 mesh-cache-id) (the-as uint 0))
0
)
)
)
)
)
)
s4-0
)
)
;; definition for method 12 of type collide-mesh-cache
;; WARN: Return type mismatch (pointer uint8) vs collide-mesh-cache-entry.
(defmethod allocate! ((this collide-mesh-cache) (arg0 int))
(local-vars (a1-2 int) (a2-2 int))
(let* ((v1-0 (+ arg0 15))
(a1-1 (-> this used-size))
(v1-1 (/ v1-0 16))
(a3-0 (-> this data))
(a2-0 (-> this max-size))
(v1-2 (* v1-1 16))
(a3-1 (&+ a3-0 a1-1))
)
(let ((t1-0 (- a2-0 (the-as uint v1-2)))
(t0-0 (-> this id))
)
(b! (< (the-as int t1-0) 0) cfg-6 :delay (set! a1-2 (the-as int (+ a1-1 v1-2))))
(b! (>= (the-as int (- a2-0 (the-as uint a1-2))) 0) cfg-5 :delay (set! a2-2 (the-as int (+ t0-0 1))))
)
(b! (zero? (the-as uint a2-2)) cfg-4 :likely-delay (set! a2-2 1))
(label cfg-4)
(set! a1-2 v1-2)
(set! a3-1 (-> this data))
(set! (-> this id) (the-as uint a2-2))
(label cfg-5)
(set! (-> this used-size) (the-as uint a1-2))
(let ((v0-0 a3-1))
(b! #t cfg-7 :delay (nop!))
(label cfg-6)
(format 0 "ERROR: Attempted to allocate something bigger than the entire mesh cache!~%")
(set! v0-0 (the-as (pointer uint8) #f))
(label cfg-7)
(the-as collide-mesh-cache-entry v0-0)
)
)
)
;; definition for method 13 of type collide-mesh
;; WARN: Return type mismatch int vs none.
;; ERROR: Failed load: (set! vf6 (l.vf (+ (the-as vector a3-0) 16))) at op 37
(defmethod unpack-mesh-to-cache! ((this collide-mesh) (arg0 (inline-array collide-mesh-cache-tri)) (arg1 matrix))
(local-vars (t0-2 uint))
(rlet ((acc :class vf)
(Q :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf10 :class vf)
(vf11 :class vf)
(vf12 :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!)
(let ((t0-0 #x70000000)
(v1-0 (-> this num-verts))
)
(nop!)
(let ((a3-0 (the-as object (-> this vertex-data))))
(b! (zero? v1-0) cfg-3 :delay (.lvf vf1 (&-> arg1 rvec quad)))
(nop!)
(.lvf vf2 (&-> arg1 uvec quad))
(let ((t0-1 (the-as object (+ t0-0 -64))))
(.lvf vf3 (&-> arg1 fvec quad))
(nop!)
(.lvf vf4 (&-> arg1 trans quad))
(nop!)
(.lvf vf5 (&-> (the-as (inline-array vector) a3-0) 0 quad))
(nop!)
(.lvf vf6 (&-> (the-as (inline-array vector) a3-0) 1 quad))
(nop!)
(.lvf vf7 (&-> (the-as (inline-array vector) a3-0) 2 quad))
(nop!)
(.lvf vf8 (&-> (the-as (inline-array vector) a3-0) 3 quad))
(label cfg-2)
(.mul.w.vf acc vf4 vf0)
(set! a3-0 (-> (the-as (inline-array vector) a3-0) 4))
(.add.mul.x.vf acc vf1 vf5 acc)
(set! t0-1 (-> (the-as (inline-array vector) t0-1) 4))
(.add.mul.y.vf acc vf2 vf5 acc)
(nop!)
(.add.mul.z.vf vf9 vf3 vf5 acc)
(nop!)
(.mul.w.vf acc vf4 vf0)
(.lvf vf5 (&-> (the-as vector a3-0) quad))
(.add.mul.x.vf acc vf1 vf6 acc)
(nop!)
(.add.mul.y.vf acc vf2 vf6 acc)
(nop!)
(.add.mul.z.vf vf10 vf3 vf6 acc)
(nop!)
(.mul.w.vf acc vf4 vf0)
(.lvf vf6 (+ (the-as vector a3-0) 16))
(.add.mul.x.vf acc vf1 vf7 acc)
(nop!)
(.add.mul.y.vf acc vf2 vf7 acc)
(nop!)
(.add.mul.z.vf vf11 vf3 vf7 acc)
(nop!)
(.mul.w.vf acc vf4 vf0)
(.lvf vf7 (+ (the-as vector a3-0) 32))
(.add.mul.x.vf acc vf1 vf8 acc)
(nop!)
(.add.mul.y.vf acc vf2 vf8 acc)
(nop!)
(.add.mul.z.vf vf12 vf3 vf8 acc)
(nop!)
(nop!)
(.lvf vf8 (+ (the-as vector a3-0) 48))
(+! v1-0 -4)
(.svf (&-> (the-as (inline-array vector) t0-1) 0 quad) vf9)
(nop!)
(.svf (&-> (the-as (inline-array vector) t0-1) 1 quad) vf10)
(nop!)
(.svf (&-> (the-as (inline-array vector) t0-1) 2 quad) vf11)
(b! (> (the-as int v1-0) 0) cfg-2 :delay (.svf (&-> (the-as (inline-array vector) t0-1) 3 quad) vf12))
)
)
)
(label cfg-3)
(let ((v1-1 (the-as object (-> this tris))))
(nop!)
(let ((a2-1 #x70000000)
(a0-1 (-> this num-tris))
)
(b! (zero? a0-1) cfg-6 :delay (set! t0-2 (-> (the-as (inline-array collide-mesh-tri) v1-1) 0 vertex-index 0)))
(let* ((a1-1 (-> arg0 -1))
(a3-1 (-> (the-as (inline-array collide-mesh-tri) v1-1) 0 vertex-index 1))
(t0-3 (* t0-2 16))
(t2-0 (-> (the-as (inline-array collide-mesh-tri) v1-1) 0 vertex-index 2))
(t1-0 (* a3-1 16))
(a3-2 (the-as uint (-> (the-as (inline-array collide-mesh-tri) v1-1) 0 pat)))
)
(let* ((t2-1 (* t2-0 16))
(t0-4 (+ t0-3 a2-1))
(t1-1 (+ t1-0 a2-1))
(t2-2 (+ t2-1 a2-1))
)
(label cfg-5)
(+! a0-1 -1)
(.lvf vf1 t0-4)
(set! v1-1 (&+ (the-as collide-mesh-tri v1-1) 8))
(.lvf vf2 t1-1)
(&+! a1-1 96)
(.lvf vf3 t2-2)
(.sub.vf vf4 vf2 vf1)
(.svf (&-> a1-1 vertex 0 quad) vf1)
(.min.vf vf8 vf1 vf2)
(.svf (&-> a1-1 vertex 1 quad) vf2)
(.sub.vf vf5 vf3 vf1)
(.svf (&-> a1-1 vertex 2 quad) vf3)
(.max.vf vf9 vf1 vf2)
(let ((t1-2 (-> (the-as collide-mesh-tri v1-1) vertex-index 0)))
(.outer.product.a.vf acc vf4 vf5)
(let ((t2-3 (-> (the-as collide-mesh-tri v1-1) vertex-index 1)))
(.outer.product.b.vf vf6 vf5 vf4 acc)
(let ((t0-5 (-> (the-as collide-mesh-tri v1-1) vertex-index 2)))
(.mul.vf vf7 vf6 vf6)
(nop!)
(.min.vf vf8 vf8 vf3)
(let ((t1-3 (* t1-2 16)))
(.max.vf vf9 vf9 vf3)
(let ((t2-4 (* t2-3 16)))
(.mul.x.vf acc vf0 vf7 :mask #b1000)
(let ((t3-0 (* t0-5 16)))
(.add.mul.y.vf acc vf0 vf7 acc :mask #b1000)
(set! t0-4 (+ t1-3 a2-1))
(.add.mul.z.vf vf7 vf0 vf7 acc :mask #b1000)
(set! t1-1 (+ t2-4 a2-1))
(.isqrt.vf Q vf0 vf7 :fsf #b11 :ftf #b11)
(set! t2-2 (+ t3-0 a2-1))
)
)
)
)
)
)
)
(.ftoi.vf vf8 vf8)
(nop!)
(.ftoi.vf vf9 vf9)
(nop!)
(nop!)
(.svf (&-> a1-1 bbox4w min quad) vf8)
(.wait.vf)
(.svf (&-> a1-1 bbox4w max quad) vf9)
(.mul.vf vf6 vf6 Q :mask #b111)
(nop!)
(nop!)
(.svf (&-> a1-1 normal quad) vf6)
(nop!)
(set! (-> a1-1 pat) (the-as pat-surface a3-2))
(b! (nonzero? a0-1) cfg-5 :delay (set! a3-2 (the-as uint (-> (the-as collide-mesh-tri v1-1) pat))))
)
)
)
(label cfg-6)
0
(none)
)
)
;; definition of type oot-work
(deftype oot-work (structure)
((intersect vector :inline)
(sphere-bbox4w bounding-box4w :inline)
)
)
;; definition for method 3 of type oot-work
(defmethod inspect ((this oot-work))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this 'oot-work)
(format #t "~1Tintersect: #<vector @ #x~X>~%" (-> this intersect))
(format #t "~1Tsphere-bbox4w: #<bounding-box4w @ #x~X>~%" (-> this sphere-bbox4w))
(label cfg-4)
this
)
;; definition for method 10 of type collide-mesh
;; INFO: Used lq/sq
(defmethod overlap-test ((this collide-mesh) (arg0 collide-mesh-cache-tri) (arg1 vector))
(local-vars
(v1-0 uint128)
(a0-1 uint128)
(a1-2 uint128)
(a1-3 uint128)
(a1-4 uint128)
(a1-7 float)
(a2-1 uint128)
(a2-2 uint128)
)
(rlet ((acc :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
)
(init-vf0-vector)
(let ((s5-0 (new 'stack-no-clear 'oot-work))
(s4-0 arg0)
)
(.lvf vf2 (&-> arg1 quad))
(let ((s3-0 (-> this num-tris)))
(.sub.w.vf vf5 vf2 vf2)
(.add.w.vf vf6 vf2 vf2)
(.ftoi.vf vf5 vf5)
(.ftoi.vf vf6 vf6)
(.mov v1-0 vf5)
(.svf (&-> s5-0 sphere-bbox4w min quad) vf5)
(.mov a0-1 vf6)
(.svf (&-> s5-0 sphere-bbox4w max quad) vf6)
(label cfg-1)
(b! (zero? s3-0) cfg-7 :delay (set! a2-1 (-> s4-0 bbox4w min quad)))
(+! s3-0 -1)
)
(let ((a1-1 (-> s4-0 bbox4w max quad)))
(.pcgtw a2-2 a2-1 a0-1)
(nop!)
(.pcgtw a1-2 v1-0 a1-1)
)
(nop!)
(.por a1-3 a2-2 a1-2)
(nop!)
(.ppach a1-4 (the-as uint128 0) a1-3)
(nop!)
(let ((a1-5 (shl (the-as int a1-4) 16)))
(nop!)
(b! (nonzero? a1-5) cfg-1 :likely-delay (set! s4-0 (+ s4-0 96)))
)
(closest-pt-in-triangle (-> s5-0 intersect) arg1 (the-as matrix (-> s4-0 vertex)) (-> s4-0 normal))
(.lvf vf1 (&-> s5-0 intersect quad))
(.lvf vf2 (&-> arg1 quad))
(set! v1-0 (-> s5-0 sphere-bbox4w min quad))
(set! a0-1 (-> s5-0 sphere-bbox4w max quad))
(.sub.vf vf3 vf2 vf1)
(.mul.w.vf vf4 vf2 vf2 :mask #b1000)
(.mul.vf vf3 vf3 vf3)
(.mul.x.vf acc vf0 vf3 :mask #b1000)
(.add.mul.y.vf acc vf0 vf3 acc :mask #b1000)
(.add.mul.z.vf vf3 vf0 vf3 acc :mask #b1000)
(.sub.w.vf vf3 vf3 vf4 :mask #b1000)
(.add.w.vf vf3 vf0 vf3 :mask #b10)
(.mov a1-7 vf3)
(b! (>= (the-as int a1-7) 0) cfg-1 :delay (set! s4-0 (+ s4-0 96)))
)
(return #t)
(label cfg-7)
#f
)
)