mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -04:00
d317497c64
* decomp/goal-lib: Implement all fixed point macros * decompiler/goalc: Support half-word and byte parallel extend ops * decompiler/goalc: Support all parallel compare instructions * decompiler/goalc: Wire up PPACH and parallel bitwise operations * goalc: Add emitter tests * decomp: finalize `main-collide` * codacy lint
232 lines
5.1 KiB
Common Lisp
232 lines
5.1 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: main-collide.gc
|
|
;; name in dgo: main-collide
|
|
;; dgos: GAME, ENGINE
|
|
|
|
;; definition for function drawable-sphere-box-intersect?
|
|
;; WARN: Function may read a register that is not set: f31
|
|
;; Used lq/sq
|
|
(defun drawable-sphere-box-intersect? ((arg0 drawable) (arg1 bounding-box4w))
|
|
(local-vars
|
|
(r0-0 int)
|
|
(r0-1 int)
|
|
(r0-2 uint128)
|
|
(r0-3 int)
|
|
(v1-1 uint128)
|
|
(v1-2 uint128)
|
|
(v1-3 uint128)
|
|
(a0-1 uint128)
|
|
(a1-2 uint128)
|
|
(a2-0 uint128)
|
|
(f31-0 none)
|
|
)
|
|
(rlet ((vf1 :class vf)
|
|
(vf2 :class vf)
|
|
(vf3 :class vf)
|
|
(vf4 :class vf)
|
|
)
|
|
(nop!)
|
|
(nop!)
|
|
(.lvf vf1 (&-> arg0 bsphere quad))
|
|
(.add.w.vf vf2 vf1 vf1 :mask #b111)
|
|
(let ((v1-0 (-> arg1 min quad)))
|
|
(.sub.w.vf vf1 vf1 vf1 :mask #b111)
|
|
(let ((a1-1 (-> arg1 max quad)))
|
|
(.ftoi.vf vf4 vf2)
|
|
(nop!)
|
|
(.ftoi.vf vf3 vf1)
|
|
(nop!)
|
|
(.mov a0-1 vf4)
|
|
(nop!)
|
|
(.mov a2-0 vf3)
|
|
(nop!)
|
|
(.pcgtw a1-2 a2-0 a1-1)
|
|
)
|
|
(.mov r0-0 f31-0)
|
|
(.pcgtw v1-1 v1-0 a0-1)
|
|
)
|
|
(.mov r0-1 f31-0)
|
|
(.por v1-2 a1-2 v1-1)
|
|
(.mov r0-2 f31-0)
|
|
(.ppach v1-3 r0-2 v1-2)
|
|
(.mov r0-3 f31-0)
|
|
(let ((v1-4 (shl (the-as int v1-3) 16)))
|
|
(nop!)
|
|
(zero? v1-4)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for function instance-sphere-box-intersect?
|
|
;; WARN: Function may read a register that is not set: f31
|
|
;; Used lq/sq
|
|
(defun
|
|
instance-sphere-box-intersect?
|
|
((arg0 drawable) (arg1 instance-tie) (arg2 bounding-box4w))
|
|
(local-vars
|
|
(r0-0 uint128)
|
|
(r0-1 int)
|
|
(r0-2 uint128)
|
|
(r0-3 int)
|
|
(r0-4 int)
|
|
(r0-5 uint128)
|
|
(r0-6 int)
|
|
(v1-3 uint128)
|
|
(v1-4 uint128)
|
|
(v1-5 uint128)
|
|
(a0-2 uint128)
|
|
(a1-2 uint128)
|
|
(a2-1 uint128)
|
|
(a3-1 uint128)
|
|
(a3-3 uint128)
|
|
(a3-4 uint128)
|
|
(t0-1 uint128)
|
|
(t0-2 uint128)
|
|
(t1-0 uint128)
|
|
(t2-1 uint128)
|
|
(t2-2 uint128)
|
|
(f31-0 none)
|
|
)
|
|
(rlet ((acc :class vf)
|
|
(vf0 :class vf)
|
|
(vf1 :class vf)
|
|
(vf10 :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 ((v1-0 (-> arg1 max-scale)))
|
|
(nop!)
|
|
(let ((a3-0 (the-as uint128 (-> arg1 origin vector4h 3 long))))
|
|
(nop!)
|
|
(let ((t2-0 (the-as uint128 (-> arg1 origin vector4h 0 long))))
|
|
(.pextlh a3-1 a3-0 r0-0)
|
|
(let ((t0-0 (the-as uint128 (-> arg1 origin vector4h 1 long))))
|
|
(.pw.sra t1-0 a3-1 10)
|
|
(let ((a3-2 (the-as uint128 (-> arg1 origin vector4h 2 long))))
|
|
(.pextlh t2-1 t2-0 r0-0)
|
|
(.mov r0-1 f31-0)
|
|
(.pw.sra t2-2 t2-1 16)
|
|
(.mov r0-2 f31-0)
|
|
(.pextlh t0-1 t0-0 r0-2)
|
|
(.mov vf8 t1-0)
|
|
(.pw.sra t0-2 t0-1 16)
|
|
(.mov vf5 t2-2)
|
|
(.pextlh a3-3 a3-2 r0-2)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(.mov vf6 t0-2)
|
|
(.pw.sra a3-4 a3-3 16)
|
|
(.lvf vf9 (&-> arg1 bsphere quad))
|
|
(nop!)
|
|
(.mov vf7 a3-4)
|
|
(nop!)
|
|
(.mov vf10 v1-0)
|
|
)
|
|
(.itof.vf vf8 vf8)
|
|
(nop!)
|
|
(vitof12.xyzw vf5 vf5)
|
|
(nop!)
|
|
(vitof12.xyzw vf6 vf6)
|
|
(nop!)
|
|
(vitof12.xyzw vf7 vf7)
|
|
(nop!)
|
|
(.add.vf vf8 vf8 vf9 :mask #b111)
|
|
(nop!)
|
|
(nop!)
|
|
(.lvf vf9 (&-> arg0 bsphere quad))
|
|
(vitof12.xyzw vf10 vf10)
|
|
(nop!)
|
|
(.mul.w.vf vf10 vf10 vf9 :mask #b1)
|
|
(nop!)
|
|
(.mul.x.vf acc vf5 vf9)
|
|
(nop!)
|
|
(.add.mul.y.vf acc vf6 vf9 acc)
|
|
(let ((v1-2 (-> arg2 min quad)))
|
|
(.add.mul.z.vf acc vf7 vf9 acc)
|
|
(let ((a1-1 (-> arg2 max quad)))
|
|
(.add.mul.w.vf vf1 vf8 vf0 acc)
|
|
(nop!)
|
|
(.add.x.vf vf2 vf1 vf10 :mask #b111)
|
|
(nop!)
|
|
(.sub.x.vf vf1 vf1 vf10 :mask #b111)
|
|
(nop!)
|
|
(.ftoi.vf vf4 vf2)
|
|
(nop!)
|
|
(.ftoi.vf vf3 vf1)
|
|
(nop!)
|
|
(.mov a0-2 vf4)
|
|
(nop!)
|
|
(.mov a2-1 vf3)
|
|
(nop!)
|
|
(.pcgtw a1-2 a2-1 a1-1)
|
|
)
|
|
(.mov r0-3 f31-0)
|
|
(.pcgtw v1-3 v1-2 a0-2)
|
|
)
|
|
(.mov r0-4 f31-0)
|
|
(.por v1-4 a1-2 v1-3)
|
|
(.mov r0-5 f31-0)
|
|
(.ppach v1-5 r0-5 v1-4)
|
|
(.mov r0-6 f31-0)
|
|
(let ((v1-6 (shl (the-as int v1-5) 16)))
|
|
(nop!)
|
|
(zero? v1-6)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for function instance-tfragment-add-debug-sphere
|
|
;; Used lq/sq
|
|
(defun instance-tfragment-add-debug-sphere ((arg0 drawable) (arg1 instance-tie))
|
|
(local-vars (r0-0 uint128) (v1-1 uint128) (v1-2 uint128) (a3-0 float))
|
|
(rlet ((vf0 :class vf)
|
|
(vf10 :class vf)
|
|
(vf11 :class vf)
|
|
(vf12 :class vf)
|
|
(vf9 :class vf)
|
|
)
|
|
(init-vf0-vector)
|
|
(nop!)
|
|
(let ((v1-0 (the-as uint128 (-> arg1 origin vector4h 3 long))))
|
|
(.pextlh v1-1 v1-0 r0-0)
|
|
)
|
|
(.lvf vf9 (&-> arg0 bsphere quad))
|
|
(.pw.sra v1-2 v1-1 10)
|
|
(.lvf vf10 (&-> arg1 bsphere quad))
|
|
(nop!)
|
|
(.mov vf12 v1-2)
|
|
(.itof.vf vf12 vf12)
|
|
(nop!)
|
|
(.add.vf vf10 vf10 vf12 :mask #b111)
|
|
(nop!)
|
|
(.add.vf vf9 vf9 vf10 :mask #b111)
|
|
(nop!)
|
|
(.add.w.vf vf11 vf0 vf9 :mask #b1)
|
|
(nop!)
|
|
(.mov a3-0 vf11)
|
|
(nop!)
|
|
(let ((a2-0 (new-stack-vector0)))
|
|
(.svf (&-> a2-0 quad) vf9)
|
|
(add-debug-sphere
|
|
#t
|
|
(bucket-id debug-draw0)
|
|
a2-0
|
|
a3-0
|
|
(new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80)
|
|
)
|
|
)
|
|
)
|
|
)
|