Files
jak-project/test/decompiler/reference/jakx/engine/collide/collide-probe_REF.gc
T
Tyler Wilding 9c86c86c74 d/jx: More files (#4360)
Breaks the 300 file milestone, also includes the majority of mips2c
functions carried forward. Some functions need some fixes in the c++
code to mips2c properly, and a small handful of the mips2c functions
require manual patching -- all spots were marked with `TODO - fix` that
had to be commented out to get things compiling.
2026-09-04 09:27:06 -04:00

478 lines
13 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; definition for function creates-new-method?
(defun creates-new-method? ((arg0 type) (arg1 int))
(let ((v1-1 (-> arg0 parent allocated-length)))
(-> arg0 allocated-length)
(>= arg1 (the-as int v1-1))
)
)
;; definition for function overrides-parent-method?
(defun overrides-parent-method? ((arg0 type) (arg1 int))
(!= (-> arg0 method-table arg1) (-> arg0 parent method-table arg1))
)
;; definition for function describe-methods
(defun describe-methods ((arg0 type))
(let ((s5-0 (-> arg0 allocated-length)))
(dotimes (s4-0 (the-as int s5-0))
(let ((s3-0 arg0))
(format #t "~3d:~%" s4-0)
(while (!= s3-0 basic)
(cond
((creates-new-method? s3-0 s4-0)
(format #t " created by ~s.~%" (symbol->string (-> s3-0 symbol)))
(set! s3-0 basic)
)
((overrides-parent-method? s3-0 s4-0)
(format #t " overridden by ~s.~%" (symbol->string (-> s3-0 symbol)))
(set! s3-0 (-> s3-0 parent))
)
(else
(set! s3-0 (-> s3-0 parent))
)
)
)
)
)
)
#f
)
;; definition for function indent-to
;; WARN: Return type mismatch symbol vs none.
(defun indent-to ((arg0 int))
(dotimes (s5-0 arg0)
(format #t " ")
)
(none)
)
;; definition for function probe-traverse-draw-node
;; WARN: Return type mismatch int vs none.
(defun probe-traverse-draw-node ((arg0 draw-node) (arg1 int))
(indent-to arg1)
(format
#t
"[~08x] child-count: ~d, flags: ~d, dist: ~f, child: ~a~%"
arg0
(-> arg0 child-count)
(-> arg0 flags)
(-> arg0 distance)
(-> arg0 child)
)
(cond
((nonzero? (-> arg0 flags))
(let ((s4-0 (-> arg0 child)))
(dotimes (s3-0 (the-as int (-> arg0 child-count)))
(probe-traverse-draw-node (the-as draw-node (+ (the-as uint s4-0) (* s3-0 32))) (+ arg1 1))
)
)
)
(else
)
)
0
(none)
)
;; definition for function probe-traverse-inline-array-node
;; WARN: Return type mismatch symbol vs none.
(defun probe-traverse-inline-array-node ((arg0 drawable-inline-array-node) (arg1 int))
(indent-to arg1)
(format #t "[~08x] drawable-inline-array-node: length = ~d~%" arg0 (-> arg0 length))
(let ((s4-0 (-> arg0 length)))
(dotimes (s3-0 s4-0)
(indent-to arg1)
(format #t "(~3d) ~a~%" s3-0 (-> arg0 data s3-0))
(if (= (-> arg0 data s3-0 type) draw-node)
(probe-traverse-draw-node (-> arg0 data s3-0) (+ arg1 1))
)
)
)
(none)
)
;; definition for function probe-traverse-collide-fragment
;; WARN: Return type mismatch symbol vs none.
(defun probe-traverse-collide-fragment ((arg0 drawable-tree-collide-fragment) (arg1 int))
(indent-to arg1)
(format #t "[~08x] drawable-tree-collide-fragment: length = ~d~%" arg0 (-> arg0 length))
(let ((s4-0 (-> arg0 length)))
(dotimes (s3-0 (+ s4-0 -1))
(indent-to arg1)
(if (= (-> arg0 data s3-0 type) drawable-inline-array-node)
(probe-traverse-inline-array-node (the-as drawable-inline-array-node (-> arg0 data s3-0)) (+ arg1 1))
(format #t "unknown: ~a~%" (-> arg0 data s3-0))
)
)
)
(none)
)
;; definition of type collide-probe-stack-elem
(deftype collide-probe-stack-elem (structure)
((child uint32)
(count uint32)
)
)
;; definition for method 3 of type collide-probe-stack-elem
(defmethod inspect ((this collide-probe-stack-elem))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this 'collide-probe-stack-elem)
(format #t "~1Tchild: #x~X~%" (-> this child))
(format #t "~1Tcount: ~D~%" (-> this count))
(label cfg-4)
this
)
;; definition of type collide-probe-stack
(deftype collide-probe-stack (structure)
((data collide-probe-stack-elem 1024 :inline)
)
)
;; definition for method 3 of type collide-probe-stack
(defmethod inspect ((this collide-probe-stack))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this 'collide-probe-stack)
(format #t "~1Tdata[1024] @ #x~X~%" (-> this data))
(label cfg-4)
this
)
;; definition for symbol *collide-probe-stack*, type collide-probe-stack
(define *collide-probe-stack* (the-as collide-probe-stack (+ 4192 #x70000000)))
;; definition for symbol collide-vu0-block, type vu-function
(define collide-vu0-block (new 'static 'vu-function :length 90 :qlength 45))
;; definition for function collide-probe-node
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for function print-out
(defun print-out ((arg0 int))
(format *stdcon* "~d~%" arg0)
)
;; definition for function collide-probe-instance-tie-collide-frags
;; WARN: Return type mismatch int vs none.
(defun collide-probe-instance-tie-collide-frags ()
0
(none)
)
;; definition for function collide-probe-instance-tie
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for function collide-probe-collide-fragment-tree-make-list
;; ERROR: failed type prop at 6: Could not figure out load: (set! v1 (l.h (+ v1 2)))
;; ERROR: Function may read a register that is not set: a2
(defun collide-probe-collide-fragment-tree-make-list ((a0-0 drawable-tree-collide-fragment) (a1-0 collide-list))
(local-vars
(v0-0 none)
(v0-1 none)
(v1-0 int)
(v1-1 drawable)
(v1-2 none)
(a0-1 drawable)
(a3-0 int)
(t9-0 (function (inline-array draw-node) int collide-list int))
)
(cond
((begin (set! v1-0 1) (set! a3-0 (-> a0-0 length)) (<.si v1-0 a3-0))
(set! v1-1 (-> a0-0 data 0))
(set! t9-0 collide-probe-node)
(set! a0-1 (+ v1-1 32))
(set! v1-2 (the-as none (l.h (+ v1-1 2))))
(set! t0-0 (the-as none a1-0))
(set! a3-1 (the-as none a2-0))
(set! a1-1 (the-as none v1-2))
(set! a2-1 (the-as none t0-0))
(call!)
(set! v1-3 (the-as none v0-0))
)
(else
)
)
(set! v0-1 (the-as none 0))
(ret-none)
)
;; definition for function collide-probe-instance-tie-tree-make-list
;; ERROR: failed type prop at 6: Could not figure out load: (set! v1 (l.h (+ v1 2)))
;; WARN: Return type mismatch none vs int.
;; ERROR: Function may read a register that is not set: a2
(defun collide-probe-instance-tie-tree-make-list ((a0-0 drawable-tree-instance-tie) (a1-0 collide-list))
(local-vars
(v0-0 none)
(v0-1 none)
(v0-2 none)
(v1-0 int)
(v1-2 drawable)
(v1-3 none)
(v1-5 none)
(v1-7 none)
(v1-8 none)
(a0-1 drawable)
(a0-2 none)
(a3-0 int)
(a3-1 none)
(a3-2 none)
(a3-3 none)
(t9-0 (function object int collide-list int int))
(t9-1 none)
)
(cond
((begin (set! v1-0 1) (set! a3-0 (-> a0-0 length)) (<.si v1-0 a3-0))
(set! v1-2 (-> a0-0 data 0))
(set! t9-0 collide-probe-instance-tie)
(set! a0-1 (+ v1-2 32))
(set! v1-3 (the-as none (l.h (+ v1-2 2))))
(set! t1-0 (the-as none a1-0))
(set! a3-1 (the-as none 1))
(set! t0-0 (the-as none a2-0))
(set! a1-1 (the-as none v1-3))
(set! a2-1 (the-as none t1-0))
(call!)
(set! v1-4 (the-as none v0-0))
)
((begin (set! v1-5 (the-as none 1)) (set! a3-2 (the-as none (-> a0-0 length))) (= a3-2 v1-5))
(set! v1-7 (the-as none (l.wu (+ a0-0 28))))
(set! t9-1 (the-as none collide-probe-instance-tie))
(set! a0-2 (the-as none (+ v1-7 32)))
(set! v1-8 (the-as none (l.h (+ v1-7 2))))
(set! t1-1 (the-as none a1-0))
(set! a3-3 (the-as none 0))
(set! t0-1 (the-as none a2-0))
(set! a1-2 (the-as none v1-8))
(set! a2-2 (the-as none t1-1))
(call!)
(set! v1-9 (the-as none v0-1))
)
)
(set! v0-2 (the-as none 0))
(ret-value v0-2)
)
;; definition for function collide-upload-vu0
;; WARN: Return type mismatch int vs none.
;; ERROR: Failed store: (s.d! (+ a0-5 8) 0) at op 17
(defun collide-upload-vu0 ()
(let ((gp-0 *vu0-dma-list*))
(let ((v1-0 gp-0))
(set! (-> v1-0 base) (-> v1-0 data))
(set! (-> v1-0 end) (the-as pointer (+ (+ (-> v1-0 allocated-length) 28) (the-as int v1-0))))
)
(dma-buffer-add-vu-function gp-0 collide-vu0-block 0)
(let* ((v1-1 gp-0)
(a0-5 (-> v1-1 base))
)
(set! (-> (the-as (pointer int64) a0-5)) #x70000000)
(s.d! (+ a0-5 8) 0)
(set! (-> v1-1 base) (&+ a0-5 16))
)
(.sync.l)
(dma-buffer-send-chain (the-as dma-bank-source #x10008000) gp-0)
)
0
(none)
)
;; definition for function collide-probe-make-list
;; ERROR: failed type prop at 23: Could not figure out load: (set! a1 (l.h (+ v1 2)))
;; WARN: Return type mismatch symbol vs none.
;; ERROR: Function may read a register that is not set: a2
(defun collide-probe-make-list ((a0-0 level) (a1-0 collide-list))
(local-vars
(v0-0 none)
(v0-1 none)
(v0-2 none)
(v0-3 none)
(v1-0 int)
(v1-1 int)
(v1-2 int)
(v1-3 drawable-tree)
(v1-4 drawable)
(v1-6 none)
(v1-8 none)
(v1-9 none)
(v1-12 none)
(v1-14 int)
(a0-1 type)
(a0-2 int)
(a0-4 drawable)
(a0-5 none)
(a0-7 none)
(a0-8 none)
(a0-9 none)
(a0-10 none)
(a1-1 type)
(a1-2 int)
(a1-3 none)
(a1-4 none)
(a1-5 none)
(a1-6 none)
(a1-7 none)
(a1-8 none)
(a2-0 none)
(a3-0 none)
(a3-1 none)
(s3-0 int)
(s4-0 bsp-header)
(s4-1 drawable-tree-array)
(t9-0 (function none))
(t9-1 (function object int collide-list int int))
(t9-2 none)
(t9-3 none)
)
(set! s4-0 (-> a0-0 bsp))
(set! v1-0 0)
(set! t9-0 collide-upload-vu0)
(call!)
(set! s4-1 (-> s4-0 drawable-trees))
(set! s3-0 0)
(while (begin (set! v1-14 (-> s4-1 length)) (<.si s3-0 v1-14))
(cond
((begin
(set! v1-1 (sll s3-0 2))
(set! v1-2 (+ v1-1 s4-1))
(set! v1-3 (dynamic-array-field-access v1-2 trees PLACEHOLDER))
(set! a0-1 drawable-tree-instance-tie)
(set! a1-1 (-> v1-3 type))
(= a1-1 a0-1)
)
(cond
((begin (set! a2-1 a1-0) (set! t0-0 a2-0) (set! a0-2 1) (set! a1-2 (-> v1-3 length)) (<.si a0-2 a1-2))
(set! v1-4 (-> v1-3 data 0))
(set! t9-1 collide-probe-instance-tie)
(set! a0-4 (+ v1-4 32))
(set! a1-3 (the-as none (l.h (+ v1-4 2))))
(set! a3-0 (the-as none 1))
(call!)
(set! v1-5 (the-as none v0-1))
)
((begin (set! a0-5 (the-as none 1)) (set! a1-4 (the-as none (-> v1-3 length))) (= a1-4 a0-5))
(set! v1-6 (the-as none (l.wu (+ v1-3 28))))
(set! t9-2 (the-as none collide-probe-instance-tie))
(set! a0-7 (the-as none (+ v1-6 32)))
(set! a1-5 (the-as none (l.h (+ v1-6 2))))
(set! a3-1 (the-as none 0))
(call!)
(set! v1-7 (the-as none v0-2))
)
)
(set! v1-8 (the-as none 0))
)
(else
(cond
((begin
(set! a0-8 (the-as none drawable-tree-collide-fragment))
(set! a1-6 (the-as none (-> v1-3 type)))
(= a1-6 a0-8)
)
(cond
((begin
(set! a2-2 (the-as none a1-0))
(set! a3-2 (the-as none a2-0))
(set! a0-9 (the-as none 1))
(set! a1-7 (the-as none (l.h (+ v1-3 2))))
(<.si a0-9 a1-7)
)
(set! v1-9 (the-as none (l.wu (+ v1-3 28))))
(set! t9-3 (the-as none collide-probe-node))
(set! a0-10 (the-as none (+ v1-9 32)))
(set! a1-8 (the-as none (l.h (+ v1-9 2))))
(call!)
(set! v1-10 (the-as none v0-3))
)
(else
)
)
(set! v1-12 (the-as none 0))
)
(else
)
)
)
)
(set! s3-0 (the-as int (+ s3-0 1)))
)
(ret-none)
)
;; definition for function distc
(defun distc ((arg0 vector) (arg1 vector))
(sqrtf (+ (square (- (-> arg0 x) (-> arg1 x))) (square (- (-> arg0 z) (-> arg1 z)))))
)
;; definition for function interpolate
(defun interpolate ((arg0 float) (arg1 float) (arg2 float) (arg3 float) (arg4 float))
(let ((f0-1 (- arg3 arg1))
(f1-2 (- arg4 arg2))
(f3-1 (- arg0 arg1))
)
(+ arg2 (/ (* f3-1 f1-2) f0-1))
)
)
;; definition for function misty-ambush-height
(defun misty-ambush-height ((arg0 vector))
(let* ((a1-0 (new 'static 'vector :data (new 'static 'array float 4 -808960.0 111656.96 3924992.0 0.0)))
(f0-0 (distc arg0 a1-0))
)
(cond
((< f0-0 52019.2)
111656.96
)
((>= 58982.4 f0-0)
(interpolate f0-0 52019.2 111656.96 58982.4 116776.96)
)
((>= 124436.48 f0-0)
(interpolate f0-0 58982.4 116776.96 124436.48 114688.0)
)
((>= 219217.92 f0-0)
(interpolate f0-0 124436.48 114688.0 219217.92 113254.4)
)
(else
113254.4
)
)
)
)
;; definition for function misty-ambush-height-probe
(defun misty-ambush-height-probe ((arg0 vector) (arg1 float))
(let ((f0-0 (misty-ambush-height arg0)))
(cond
((< f0-0 (-> arg0 y))
(/ (- (-> arg0 y) f0-0) arg1)
)
(else
(format 0 "WARNING: ~%height = ~f, pos.y = ~f" (/ f0-0 METER_LENGTH) (/ (-> arg0 y) METER_LENGTH))
-1.0
)
)
)
)
;; definition for function pke-collide-test
;; WARN: Return type mismatch int vs none.
(defun pke-collide-test ()
0
(none)
)