mirror of
https://github.com/open-goal/jak-project
synced 2026-08-20 14:24:45 -04:00
1165 lines
40 KiB
Common Lisp
Vendored
Generated
1165 lines
40 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition for symbol ocean-mid-block, type vu-function
|
|
(define ocean-mid-block (new 'static 'vu-function :length #x497 :qlength #x24c))
|
|
|
|
;; definition for function ocean-mid-setup-constants
|
|
;; INFO: Return type mismatch vector vs none.
|
|
;; Used lq/sq
|
|
(defun ocean-mid-setup-constants ((arg0 ocean-mid-constants))
|
|
(let ((v1-0 *math-camera*))
|
|
(set! (-> arg0 hmge-scale quad) (-> v1-0 hmge-scale quad))
|
|
(set! (-> arg0 inv-hmge-scale quad) (-> v1-0 inv-hmge-scale quad))
|
|
(set! (-> arg0 hvdf-offset quad) (-> v1-0 hvdf-off quad))
|
|
(set-vector! (-> arg0 fog) (-> v1-0 pfog0) (-> v1-0 fog-min) (-> v1-0 fog-max) 3072.0)
|
|
)
|
|
(set-vector! (-> arg0 constants) 0.5 0.5 0.0 393216.0)
|
|
(set-vector! (-> arg0 constants2) 0.5 0.5 1.0 0.0)
|
|
(let ((v1-3 *ocean-subdivide-draw-mode*))
|
|
(cond
|
|
((zero? v1-3)
|
|
(set! (-> arg0 drw-fan tag)
|
|
(new 'static 'gif-tag64
|
|
:nloop #x4
|
|
:eop #x1
|
|
:pre #x1
|
|
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :fge #x1)
|
|
:nreg #x3
|
|
)
|
|
)
|
|
)
|
|
((= v1-3 1)
|
|
(set! (-> arg0 drw-fan tag)
|
|
(new 'static 'gif-tag64
|
|
:nloop #x4
|
|
:eop #x1
|
|
:pre #x1
|
|
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1)
|
|
:nreg #x3
|
|
)
|
|
)
|
|
)
|
|
((= v1-3 2)
|
|
(set! (-> arg0 drw-fan tag)
|
|
(new 'static 'gif-tag64
|
|
:nloop #x4
|
|
:eop #x1
|
|
:pre #x1
|
|
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :fge #x1)
|
|
:nreg #x3
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> arg0 drw-fan regs)
|
|
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
|
)
|
|
(let ((v1-12 *ocean-subdivide-draw-mode*))
|
|
(cond
|
|
((zero? v1-12)
|
|
(set! (-> arg0 env-fan tag)
|
|
(new 'static 'gif-tag64
|
|
:nloop #x4
|
|
:eop #x1
|
|
:pre #x1
|
|
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :abe #x1)
|
|
:nreg #x3
|
|
)
|
|
)
|
|
)
|
|
((= v1-12 1)
|
|
(set! (-> arg0 env-fan tag)
|
|
(new 'static 'gif-tag64
|
|
:nloop #x4
|
|
:eop #x1
|
|
:pre #x1
|
|
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :abe #x1)
|
|
:nreg #x3
|
|
)
|
|
)
|
|
)
|
|
((= v1-12 2)
|
|
(set! (-> arg0 env-fan tag)
|
|
(new 'static 'gif-tag64
|
|
:nloop #x4
|
|
:eop #x1
|
|
:pre #x1
|
|
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :abe #x1)
|
|
:nreg #x3
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> arg0 env-fan regs)
|
|
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
|
)
|
|
(set! (-> arg0 drw-adgif tag) (new 'static 'gif-tag64 :nloop #x5 :nreg #x1))
|
|
(set! (-> arg0 drw-adgif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d)))
|
|
(let* ((a0-13 *ocean-base-page*)
|
|
(v1-23 *ocean-base-block*)
|
|
(s4-0 (* (+ a0-13 8) 32))
|
|
(s5-0 (* (+ a0-13 10) 32))
|
|
)
|
|
(set! (-> arg0 drw-texture tex0)
|
|
(new 'static 'gs-tex0 :tbw #x2 :tcc #x1 :th (log2 128) :tw (log2 128) :tbp0 v1-23)
|
|
)
|
|
(set! (-> arg0 drw-texture prims 1) (gs-reg64 tex0-1))
|
|
(set! (-> arg0 drw-texture tex1) (new 'static 'gs-tex1 :mxl #x6 :mmag #x1 :mmin #x5 :l #x1 :k #xeed))
|
|
(set! (-> arg0 drw-texture prims 3) (gs-reg64 tex1-1))
|
|
(set! (-> arg0 drw-texture miptbp1)
|
|
(new 'static 'gs-miptbp :tbw1 #x1 :tbw2 #x1 :tbw3 #x1 :tbp3 (+ s5-0 16) :tbp2 s5-0 :tbp1 s4-0)
|
|
)
|
|
(set! (-> arg0 drw-texture prims 5) (gs-reg64 miptbp1-1))
|
|
(set! (-> arg0 drw-texture clamp) (new 'static 'gs-clamp))
|
|
(set! (-> arg0 drw-texture clamp-reg) (gs-reg64 clamp-1))
|
|
(set! (-> arg0 drw-texture alpha)
|
|
(the-as
|
|
gs-alpha
|
|
(logior (logior (logior (the-as uint #x40000400004000) (shr (shl (+ s5-0 20) 50) 50)) (shr (shl (+ s5-0 21) 50) 30))
|
|
(shr (shl (+ s5-0 22) 50) 10)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> arg0 drw-texture prims 9) (gs-reg64 miptbp2-1))
|
|
(let ((v1-45 *ocean-subdivide-draw-mode*))
|
|
(cond
|
|
((zero? v1-45)
|
|
(set! (-> arg0 drw-strip-0 tag)
|
|
(new 'static 'gif-tag64
|
|
:nloop #x12
|
|
:pre #x1
|
|
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :fge #x1)
|
|
:nreg #x3
|
|
)
|
|
)
|
|
)
|
|
((= v1-45 1)
|
|
(set! (-> arg0 drw-strip-0 tag)
|
|
(new 'static 'gif-tag64
|
|
:nloop #x12
|
|
:pre #x1
|
|
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1)
|
|
:nreg #x3
|
|
)
|
|
)
|
|
)
|
|
((= v1-45 2)
|
|
(set! (-> arg0 drw-strip-0 tag)
|
|
(new 'static 'gif-tag64
|
|
:nloop #x12
|
|
:pre #x1
|
|
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :fge #x1)
|
|
:nreg #x3
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> arg0 drw-strip-0 regs)
|
|
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
|
)
|
|
(let ((v1-54 *ocean-subdivide-draw-mode*))
|
|
(cond
|
|
((zero? v1-54)
|
|
(set! (-> arg0 drw-strip-1 tag)
|
|
(new 'static 'gif-tag64
|
|
:nloop #x12
|
|
:eop #x1
|
|
:pre #x1
|
|
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :fge #x1)
|
|
:nreg #x3
|
|
)
|
|
)
|
|
)
|
|
((= v1-54 1)
|
|
(set! (-> arg0 drw-strip-1 tag)
|
|
(new 'static 'gif-tag64
|
|
:nloop #x12
|
|
:eop #x1
|
|
:pre #x1
|
|
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1)
|
|
:nreg #x3
|
|
)
|
|
)
|
|
)
|
|
((= v1-54 2)
|
|
(set! (-> arg0 drw-strip-1 tag)
|
|
(new 'static 'gif-tag64
|
|
:nloop #x12
|
|
:eop #x1
|
|
:pre #x1
|
|
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :fge #x1)
|
|
:nreg #x3
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> arg0 drw-strip-1 regs)
|
|
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
|
)
|
|
(set! (-> arg0 env-adgif tag) (new 'static 'gif-tag64 :nloop #x5 :nreg #x1))
|
|
(set! (-> arg0 env-adgif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d)))
|
|
(let ((s5-1 (-> arg0 env-texture)))
|
|
(adgif-shader<-texture-simple! s5-1 (lookup-texture-by-id (new 'static 'texture-id :index #x3 :page #x100)))
|
|
(set! (-> s5-1 alpha) (new 'static 'gs-alpha :b #x2 :c #x1 :d #x1))
|
|
)
|
|
(let ((v1-66 *ocean-subdivide-draw-mode*))
|
|
(cond
|
|
((zero? v1-66)
|
|
(set! (-> arg0 env-strip tag)
|
|
(new 'static 'gif-tag64
|
|
:nloop #x12
|
|
:eop #x1
|
|
:pre #x1
|
|
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :abe #x1)
|
|
:nreg #x3
|
|
)
|
|
)
|
|
)
|
|
((= v1-66 1)
|
|
(set! (-> arg0 env-strip tag)
|
|
(new 'static 'gif-tag64
|
|
:nloop #x12
|
|
:eop #x1
|
|
:pre #x1
|
|
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :abe #x1)
|
|
:nreg #x3
|
|
)
|
|
)
|
|
)
|
|
((= v1-66 2)
|
|
(set! (-> arg0 env-strip tag)
|
|
(new 'static 'gif-tag64
|
|
:nloop #x12
|
|
:eop #x1
|
|
:pre #x1
|
|
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1)
|
|
:nreg #x3
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> arg0 env-strip regs)
|
|
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
|
)
|
|
(set! (-> arg0 env-color quad) (-> *time-of-day-context* current-sun env-color quad))
|
|
(set-vector! (-> arg0 index-table 0) 63 84 66 0)
|
|
(set-vector! (-> arg0 index-table 1) 54 72 57 0)
|
|
(set-vector! (-> arg0 index-table 2) 45 60 48 0)
|
|
(set-vector! (-> arg0 index-table 3) 36 48 39 0)
|
|
(set-vector! (-> arg0 index-table 4) 27 36 30 0)
|
|
(set-vector! (-> arg0 index-table 5) 18 24 21 0)
|
|
(set-vector! (-> arg0 index-table 6) 9 12 12 0)
|
|
(set-vector! (-> arg0 index-table 7) 0 0 3 0)
|
|
(set-vector! (-> arg0 pos0) 0.0 0.0 0.0 1.0)
|
|
(set-vector! (-> arg0 pos1) 393216.0 0.0 0.0 1.0)
|
|
(set-vector! (-> arg0 pos2) 0.0 0.0 393216.0 1.0)
|
|
(set-vector! (-> arg0 pos3) 393216.0 0.0 393216.0 1.0)
|
|
(none)
|
|
)
|
|
|
|
;; definition for function ocean-mid-add-constants
|
|
;; INFO: Return type mismatch pointer vs none.
|
|
(defun ocean-mid-add-constants ((arg0 dma-buffer))
|
|
(let* ((a1-0 36)
|
|
(v1-0 arg0)
|
|
(a0-1 (the-as object (-> v1-0 base)))
|
|
)
|
|
(set! (-> (the-as dma-packet a0-1) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a1-0))
|
|
(set! (-> (the-as dma-packet a0-1) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
|
(set! (-> (the-as dma-packet a0-1) vif1)
|
|
(new 'static 'vif-tag :imm #x2dd :cmd (vif-cmd unpack-v4-32) :num a1-0)
|
|
)
|
|
(set! (-> v1-0 base) (&+ (the-as pointer a0-1) 16))
|
|
)
|
|
(ocean-mid-setup-constants (the-as ocean-mid-constants (-> arg0 base)))
|
|
(&+! (-> arg0 base) 576)
|
|
(none)
|
|
)
|
|
|
|
;; definition for function ocean-matrix*!
|
|
(defun ocean-matrix*! ((arg0 matrix) (arg1 matrix) (arg2 matrix))
|
|
(rlet ((acc :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)
|
|
)
|
|
(.lvf vf1 (&-> arg1 vector 0 quad))
|
|
(.lvf vf5 (&-> arg2 vector 0 quad))
|
|
(.lvf vf6 (&-> arg2 vector 1 quad))
|
|
(.lvf vf7 (&-> arg2 vector 2 quad))
|
|
(.lvf vf8 (&-> arg2 vector 3 quad))
|
|
(.lvf vf2 (&-> arg1 vector 1 quad))
|
|
(.lvf vf3 (&-> arg1 vector 2 quad))
|
|
(.lvf vf4 (&-> arg1 vector 3 quad))
|
|
(.mul.x.vf acc vf5 vf1)
|
|
(.add.mul.y.vf acc vf6 vf1 acc)
|
|
(.add.mul.z.vf acc vf7 vf1 acc)
|
|
(.add.mul.w.vf vf9 vf8 vf1 acc)
|
|
(.mul.x.vf acc vf5 vf2)
|
|
(.add.mul.y.vf acc vf6 vf2 acc)
|
|
(.add.mul.z.vf acc vf7 vf2 acc)
|
|
(.add.mul.w.vf vf10 vf8 vf2 acc)
|
|
(.mul.x.vf acc vf5 vf3)
|
|
(.add.mul.y.vf acc vf6 vf3 acc)
|
|
(.add.mul.z.vf acc vf7 vf3 acc)
|
|
(.add.mul.w.vf vf11 vf8 vf3 acc)
|
|
(.mul.x.vf acc vf5 vf4)
|
|
(.add.mul.y.vf acc vf6 vf4 acc)
|
|
(.add.mul.z.vf acc vf7 vf4 acc)
|
|
(.add.mul.w.vf vf12 vf8 vf4 acc)
|
|
(.svf (&-> arg0 vector 0 quad) vf9)
|
|
(.svf (&-> arg0 vector 1 quad) vf10)
|
|
(.svf (&-> arg0 vector 2 quad) vf11)
|
|
(.svf (&-> arg0 vector 3 quad) vf12)
|
|
arg0
|
|
)
|
|
)
|
|
|
|
;; definition for function ocean-vector-matrix*!
|
|
(defun ocean-vector-matrix*! ((arg0 vector) (arg1 vector) (arg2 matrix))
|
|
(rlet ((acc :class vf)
|
|
(vf0 :class vf)
|
|
(vf1 :class vf)
|
|
(vf2 :class vf)
|
|
(vf3 :class vf)
|
|
(vf4 :class vf)
|
|
(vf5 :class vf)
|
|
)
|
|
(init-vf0-vector)
|
|
(.lvf vf1 (&-> arg2 vector 0 quad))
|
|
(.lvf vf2 (&-> arg2 vector 1 quad))
|
|
(.lvf vf3 (&-> arg2 vector 2 quad))
|
|
(.lvf vf4 (&-> arg2 vector 3 quad))
|
|
(.lvf vf5 (&-> arg1 quad))
|
|
(.mul.x.vf acc vf1 vf5)
|
|
(.add.mul.y.vf acc vf2 vf5 acc)
|
|
(.add.mul.z.vf acc vf3 vf5 acc)
|
|
(.add.mul.w.vf vf5 vf4 vf0 acc)
|
|
(.svf (&-> arg0 quad) vf5)
|
|
arg0
|
|
)
|
|
)
|
|
|
|
;; definition for function ocean-mid-add-matrices
|
|
;; INFO: Return type mismatch pointer vs none.
|
|
;; Used lq/sq
|
|
(defun ocean-mid-add-matrices ((arg0 dma-buffer) (arg1 vector))
|
|
(let ((s5-0 (new-stack-vector0)))
|
|
(-> *math-camera* camera-rot)
|
|
(let* ((a2-0 8)
|
|
(v1-2 arg0)
|
|
(a0-1 (the-as object (-> v1-2 base)))
|
|
)
|
|
(set! (-> (the-as dma-packet a0-1) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a2-0))
|
|
(set! (-> (the-as dma-packet a0-1) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
|
(set! (-> (the-as dma-packet a0-1) vif1)
|
|
(new 'static 'vif-tag :imm #x8000 :cmd (vif-cmd unpack-v4-32) :num a2-0)
|
|
)
|
|
(set! (-> v1-2 base) (&+ (the-as pointer a0-1) 16))
|
|
)
|
|
(let ((s4-0 (-> arg0 base)))
|
|
(let* ((v1-3 (the-as object s4-0))
|
|
(t0-2 (-> *math-camera* camera-rot))
|
|
(a0-4 (-> t0-2 vector 0 quad))
|
|
(a2-4 (-> t0-2 vector 1 quad))
|
|
(a3-4 (-> t0-2 vector 2 quad))
|
|
(t0-3 (-> t0-2 vector 3 quad))
|
|
)
|
|
(set! (-> (the-as matrix v1-3) vector 0 quad) a0-4)
|
|
(set! (-> (the-as matrix v1-3) vector 1 quad) a2-4)
|
|
(set! (-> (the-as matrix v1-3) vector 2 quad) a3-4)
|
|
(set! (-> (the-as matrix v1-3) vector 3 quad) t0-3)
|
|
)
|
|
(let ((s3-0 (the-as object (&+ s4-0 48))))
|
|
(vector-matrix*! s5-0 arg1 (-> *math-camera* camera-rot))
|
|
(set! (-> (the-as vector s3-0) x) (-> s5-0 x))
|
|
(set! (-> (the-as vector s3-0) y) (-> s5-0 y))
|
|
(set! (-> (the-as vector s3-0) z) (-> s5-0 z))
|
|
)
|
|
(let ((a0-6 (&+ (-> arg0 base) 64)))
|
|
(ocean-matrix*! (the-as matrix a0-6) (the-as matrix s4-0) (-> *math-camera* perspective))
|
|
)
|
|
)
|
|
)
|
|
(&+! (-> arg0 base) 128)
|
|
(none)
|
|
)
|
|
|
|
;; definition for function ocean-mid-check
|
|
;; Used lq/sq
|
|
(defun ocean-mid-check ((arg0 pointer) (arg1 int) (arg2 int) (arg3 vector))
|
|
(local-vars (v0-0 symbol) (v1-10 float) (a3-2 float) (a3-6 float) (a3-10 float))
|
|
(rlet ((vf1 :class vf)
|
|
(vf2 :class vf)
|
|
(vf3 :class vf)
|
|
)
|
|
(let ((v1-0 (new-stack-vector0))
|
|
(t0-1 (-> *math-camera* trans))
|
|
)
|
|
1.0
|
|
(set! (-> v1-0 x) (+ (-> arg3 x) (* 393216.0 (the float arg1))))
|
|
(set! (-> v1-0 y) (-> arg3 y))
|
|
(set! (-> v1-0 z) (+ (-> arg3 z) (* 393216.0 (the float arg2))))
|
|
(let ((a3-1 v1-0)
|
|
(t1-0 t0-1)
|
|
)
|
|
(.lvf vf2 (&-> a3-1 quad))
|
|
(.lvf vf3 (&-> t1-0 quad))
|
|
)
|
|
(.sub.vf vf1 vf3 vf2)
|
|
(.mul.vf vf1 vf1 vf1)
|
|
(.add.y.vf vf1 vf1 vf1 :mask #b1)
|
|
(.add.z.vf vf1 vf1 vf1 :mask #b1)
|
|
(.mov a3-2 vf1)
|
|
(when (< a3-2 309237600000.0)
|
|
(logior! (-> (the-as (pointer uint8) (+ arg2 (the-as int arg0)))) (ash 1 arg1))
|
|
(return #f)
|
|
)
|
|
(set! (-> v1-0 x) (+ 393216.0 (-> v1-0 x)))
|
|
(let ((a3-5 v1-0)
|
|
(t1-1 t0-1)
|
|
)
|
|
(.lvf vf2 (&-> a3-5 quad))
|
|
(.lvf vf3 (&-> t1-1 quad))
|
|
)
|
|
(.sub.vf vf1 vf3 vf2)
|
|
(.mul.vf vf1 vf1 vf1)
|
|
(.add.y.vf vf1 vf1 vf1 :mask #b1)
|
|
(.add.z.vf vf1 vf1 vf1 :mask #b1)
|
|
(.mov a3-6 vf1)
|
|
(when (< a3-6 309237600000.0)
|
|
(logior! (-> (the-as (pointer uint8) (+ arg2 (the-as int arg0)))) (ash 1 arg1))
|
|
(return #f)
|
|
)
|
|
(set! (-> v1-0 z) (+ 393216.0 (-> v1-0 z)))
|
|
(let ((a3-9 v1-0)
|
|
(t1-2 t0-1)
|
|
)
|
|
(.lvf vf2 (&-> a3-9 quad))
|
|
(.lvf vf3 (&-> t1-2 quad))
|
|
)
|
|
(.sub.vf vf1 vf3 vf2)
|
|
(.mul.vf vf1 vf1 vf1)
|
|
(.add.y.vf vf1 vf1 vf1 :mask #b1)
|
|
(.add.z.vf vf1 vf1 vf1 :mask #b1)
|
|
(.mov a3-10 vf1)
|
|
(when (< a3-10 309237600000.0)
|
|
(logior! (-> (the-as (pointer uint8) (+ arg2 (the-as int arg0)))) (ash 1 arg1))
|
|
(return #f)
|
|
)
|
|
(set! (-> v1-0 x) (+ -393216.0 (-> v1-0 x)))
|
|
(.lvf vf2 (&-> v1-0 quad))
|
|
(.lvf vf3 (&-> t0-1 quad))
|
|
)
|
|
(.sub.vf vf1 vf3 vf2)
|
|
(.mul.vf vf1 vf1 vf1)
|
|
(.add.y.vf vf1 vf1 vf1 :mask #b1)
|
|
(.add.z.vf vf1 vf1 vf1 :mask #b1)
|
|
(.mov v1-10 vf1)
|
|
(when (< v1-10 309237600000.0)
|
|
(logior! (-> (the-as (pointer uint8) (+ arg2 (the-as int arg0)))) (ash 1 arg1))
|
|
(return #f)
|
|
v0-0
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for function ocean-mid-add-call
|
|
;; INFO: Return type mismatch pointer vs none.
|
|
(defun ocean-mid-add-call ((arg0 dma-buffer) (arg1 int))
|
|
(let* ((v1-0 arg0)
|
|
(a0-1 (the-as object (-> v1-0 base)))
|
|
)
|
|
(set! (-> (the-as dma-packet a0-1) dma) (new 'static 'dma-tag :id (dma-tag-id cnt)))
|
|
(set! (-> (the-as dma-packet a0-1) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
|
(set! (-> (the-as dma-packet a0-1) vif1) (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1 :imm arg1))
|
|
(set! (-> v1-0 base) (&+ (the-as pointer a0-1) 16))
|
|
)
|
|
(none)
|
|
)
|
|
|
|
;; definition for function ocean-mid-add-call-flush
|
|
;; INFO: Return type mismatch pointer vs none.
|
|
(defun ocean-mid-add-call-flush ((arg0 dma-buffer) (arg1 uint))
|
|
(let* ((v1-0 arg0)
|
|
(a0-1 (the-as object (-> v1-0 base)))
|
|
)
|
|
(set! (-> (the-as dma-packet a0-1) dma) (new 'static 'dma-tag :id (dma-tag-id cnt)))
|
|
(set! (-> (the-as dma-packet a0-1) vif0) (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1 :imm arg1))
|
|
(set! (-> (the-as dma-packet a0-1) vif1) (new 'static 'vif-tag :cmd (vif-cmd flusha) :msk #x1))
|
|
(set! (-> v1-0 base) (&+ (the-as pointer a0-1) 16))
|
|
)
|
|
(none)
|
|
)
|
|
|
|
;; definition for function ocean-mid-add-upload
|
|
;; Used lq/sq
|
|
(defun ocean-mid-add-upload ((arg0 dma-buffer) (arg1 int) (arg2 int) (arg3 int) (arg4 int) (arg5 float))
|
|
(let ((gp-0 (new-stack-vector0)))
|
|
(let ((v1-1 (-> *ocean-map* start-corner)))
|
|
(set! (-> gp-0 x) (+ (-> v1-1 x) (* 3145728.0 (the float arg2))))
|
|
(set! (-> gp-0 y) (-> v1-1 y))
|
|
(set! (-> gp-0 z) (+ (-> v1-1 z) (* 3145728.0 (the float arg1))))
|
|
)
|
|
(set! (-> gp-0 w) 1.0)
|
|
(ocean-mid-add-matrices arg0 gp-0)
|
|
(let ((v1-4 (+ (the-as uint (-> *ocean-map* ocean-colors)) (* (+ (* 416 arg1) (* arg2 8)) 4))))
|
|
(dotimes (a0-6 9)
|
|
(let* ((a1-3 arg0)
|
|
(a2-1 (the-as object (-> a1-3 base)))
|
|
)
|
|
(set! (-> (the-as dma-packet a2-1) dma) (new 'static 'dma-tag :qwc #x3 :id (dma-tag-id ref) :addr v1-4))
|
|
(set! (-> (the-as dma-packet a2-1) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
|
(set! (-> (the-as dma-packet a2-1) vif1) (new 'static 'vif-tag
|
|
:num #xc
|
|
:cmd (vif-cmd unpack-v4-8)
|
|
:imm (logior (shr (shl (+ (* 12 a0-6) 8) 54) 54) #xc000)
|
|
)
|
|
)
|
|
(set! (-> a1-3 base) (&+ (the-as pointer a2-1) 16))
|
|
)
|
|
(+! v1-4 208)
|
|
)
|
|
)
|
|
(let* ((a2-3 1)
|
|
(v1-7 arg0)
|
|
(a0-7 (the-as object (-> v1-7 base)))
|
|
)
|
|
(set! (-> (the-as dma-packet a0-7) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a2-3))
|
|
(set! (-> (the-as dma-packet a0-7) vif0) (new 'static 'vif-tag :imm #x204 :cmd (vif-cmd stcycl)))
|
|
(set! (-> (the-as dma-packet a0-7) vif1)
|
|
(new 'static 'vif-tag :imm #xc074 :num #x2 :cmd (vif-cmd unpack-v4-8))
|
|
)
|
|
(set! (-> v1-7 base) (&+ (the-as pointer a0-7) 16))
|
|
)
|
|
(let ((v1-8 (-> arg0 base)))
|
|
(let ((a0-12 (-> *ocean-map* ocean-mid-masks data arg3)))
|
|
(set! (-> *ocean-work* mid-mask-ptrs arg4) (the-as (pointer int64) v1-8))
|
|
(set! (-> (the-as (pointer uint64) v1-8)) (-> a0-12 dword))
|
|
)
|
|
(set! (-> (the-as (pointer uint64) v1-8) 1) (the-as uint 0))
|
|
)
|
|
(&+! (-> arg0 base) 16)
|
|
(when (< arg5 556091.4)
|
|
(let* ((v1-12 (-> *math-camera* trans))
|
|
(s5-1 (&-> *ocean-work* mid-camera-masks arg4))
|
|
(s4-1 (+ (the int (* 0.0000025431316 (- (-> v1-12 x) (-> gp-0 x)))) -1))
|
|
(s3-1 (+ (the int (* 0.0000025431316 (- (-> v1-12 z) (-> gp-0 z)))) -1))
|
|
)
|
|
(dotimes (s2-1 3)
|
|
(dotimes (s1-1 3)
|
|
(let ((a1-12 (+ s1-1 s4-1))
|
|
(a2-7 (+ s2-1 s3-1))
|
|
)
|
|
(if (and (>= a1-12 0) (>= a2-7 0) (< a1-12 8) (< a2-7 8))
|
|
(ocean-mid-check s5-1 a1-12 a2-7 gp-0)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
#f
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for function ocean-mid-camera-masks-bit?
|
|
(defun ocean-mid-camera-masks-bit? ((arg0 uint) (arg1 uint))
|
|
(cond
|
|
((or (< (the-as int arg0) 0) (>= (the-as int arg0) 48) (< (the-as int arg1) 0) (>= (the-as int arg1) 48))
|
|
#t
|
|
)
|
|
(else
|
|
(let* ((a3-0 (/ (the-as int arg0) 8))
|
|
(a2-3 (/ (the-as int arg1) 8))
|
|
(a0-1 (logand arg0 7))
|
|
(v1-1 (logand arg1 7))
|
|
(a1-3 (+ (* 6 a3-0) a2-3))
|
|
)
|
|
(logtest? (-> (the-as (pointer uint8) (+ (+ a0-1 (* a1-3 8)) (the-as uint *ocean-work*))) 2300) (ash 1 v1-1))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for function ocean-mid-mask-ptrs-bit?
|
|
(defun ocean-mid-mask-ptrs-bit? ((arg0 uint) (arg1 uint))
|
|
(cond
|
|
((or (< (the-as int arg0) 0) (>= (the-as int arg0) 48) (< (the-as int arg1) 0) (>= (the-as int arg1) 48))
|
|
#t
|
|
)
|
|
(else
|
|
(let* ((a3-0 (/ (the-as int arg0) 8))
|
|
(a2-3 (/ (the-as int arg1) 8))
|
|
(a0-1 (logand arg0 7))
|
|
(v1-1 (logand arg1 7))
|
|
(a1-3 (+ (* 6 a3-0) a2-3))
|
|
)
|
|
(if (-> *ocean-work* mid-mask-ptrs a1-3)
|
|
(logtest? (-> (the-as (pointer uint8) (+ a0-1 (the-as uint (-> *ocean-work* mid-mask-ptrs a1-3)))) 0)
|
|
(ash 1 v1-1)
|
|
)
|
|
#t
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for function ocean-mid-camera-masks-set!
|
|
(defun ocean-mid-camera-masks-set! ((arg0 uint) (arg1 uint))
|
|
(cond
|
|
((or (< (the-as int arg0) 0) (>= (the-as int arg0) 48) (< (the-as int arg1) 0) (>= (the-as int arg1) 48))
|
|
#f
|
|
)
|
|
(else
|
|
(let* ((a3-0 (/ (the-as int arg0) 8))
|
|
(a2-3 (/ (the-as int arg1) 8))
|
|
(v1-1 (logand arg0 7))
|
|
(a0-1 (logand arg1 7))
|
|
(a2-4 (+ (* 6 a3-0) a2-3))
|
|
(a1-5 (&-> *ocean-work* mid-camera-masks a2-4))
|
|
)
|
|
(cond
|
|
(a1-5
|
|
(cond
|
|
((logtest? (-> (the-as (pointer uint8) (+ v1-1 (the-as uint (-> *ocean-work* mid-mask-ptrs a2-4)))) 0)
|
|
(ash 1 a0-1)
|
|
)
|
|
#f
|
|
)
|
|
(else
|
|
(logior! (-> (the-as (pointer uint8) (+ v1-1 (the-as uint a1-5))) 0) (ash 1 a0-1))
|
|
#t
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
#f
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for function ocean-mid-add-upload-table
|
|
;; WARN: Function may read a register that is not set: f31
|
|
;; Used lq/sq
|
|
(defun ocean-mid-add-upload-table ((arg0 dma-buffer) (arg1 uint) (arg2 uint) (arg3 (pointer float)) (arg4 int) (arg5 symbol))
|
|
(local-vars
|
|
(r0-0 int)
|
|
(r0-1 int)
|
|
(r0-2 int)
|
|
(r0-3 int)
|
|
(r0-4 int)
|
|
(v1-8 float)
|
|
(a0-19 uint128)
|
|
(a0-20 uint128)
|
|
(a0-21 uint128)
|
|
(a1-14 uint128)
|
|
(a1-15 uint128)
|
|
(a1-16 uint128)
|
|
(a2-15 uint128)
|
|
(a3-11 uint128)
|
|
(f31-0 none)
|
|
)
|
|
(rlet ((vf1 :class vf)
|
|
(vf2 :class vf)
|
|
(vf3 :class vf)
|
|
(vf4 :class vf)
|
|
)
|
|
(when (ocean-mid-camera-masks-set! arg1 arg2)
|
|
(let ((a1-2 (new-stack-vector0)))
|
|
(let ((v1-1 (-> *ocean-map* start-corner)))
|
|
(set! (-> a1-2 x) (+ (-> v1-1 x) (* 393216.0 (the float arg2))))
|
|
(set! (-> a1-2 y) (-> v1-1 y))
|
|
(set! (-> a1-2 z) (+ (-> v1-1 z) (* 393216.0 (the float arg1))))
|
|
)
|
|
(set! (-> a1-2 w) 1.0)
|
|
(ocean-mid-add-matrices arg0 a1-2)
|
|
)
|
|
(let* ((a1-3 9)
|
|
(v1-3 arg0)
|
|
(a0-3 (the-as object (-> v1-3 base)))
|
|
)
|
|
(set! (-> (the-as dma-packet a0-3) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a1-3))
|
|
(set! (-> (the-as dma-packet a0-3) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
|
(set! (-> (the-as dma-packet a0-3) vif1)
|
|
(new 'static 'vif-tag :imm #x8008 :cmd (vif-cmd unpack-v4-32) :num a1-3)
|
|
)
|
|
(set! (-> v1-3 base) (&+ (the-as pointer a0-3) 16))
|
|
)
|
|
(set-vector! (the-as vector4w (-> arg0 base)) arg4 0 0 0)
|
|
(&+! (-> arg0 base) 16)
|
|
(let ((v1-7 (the-as (pointer uint128) (-> arg0 base))))
|
|
(set! (-> v1-7 0) (-> *ocean-trans-st-table* 0 quad))
|
|
(set! (-> v1-7 1) (-> *ocean-trans-st-table* 1 quad))
|
|
(set! (-> v1-7 2) (-> *ocean-trans-st-table* 2 quad))
|
|
(set! (-> v1-7 3) (-> *ocean-trans-st-table* 3 quad))
|
|
(let ((a0-18 (the-as uint128 (-> *ocean-map* ocean-colors colors (+ (* 52 (the-as int arg1)) arg2))))
|
|
(a1-13 (the-as uint128 (-> *ocean-map* ocean-colors colors (+ arg2 1 (* 52 (the-as int arg1))))))
|
|
(a2-14 (the-as uint128 (-> *ocean-map* ocean-colors colors (+ (* 52 (the-as int (+ arg1 1))) arg2))))
|
|
(a3-10 (the-as uint128 (-> *ocean-map* ocean-colors colors (+ arg2 1 (* 52 (the-as int (+ arg1 1)))))))
|
|
)
|
|
(.pextlb a0-19 0 a0-18)
|
|
(.mov r0-0 f31-0)
|
|
(.pextlb a1-14 0 a1-13)
|
|
(.mov r0-1 f31-0)
|
|
(.pextlb a2-15 0 a2-14)
|
|
(.mov r0-2 f31-0)
|
|
(.pextlb a3-11 0 a3-10)
|
|
)
|
|
(.mov r0-3 f31-0)
|
|
(.pextlh a0-20 0 a0-19)
|
|
(.mov r0-4 f31-0)
|
|
(.pextlh a1-15 0 a1-14)
|
|
(.mov vf1 a0-20)
|
|
(.pextlh a0-21 0 a2-15)
|
|
(.mov vf2 a1-15)
|
|
(.pextlh a1-16 0 a3-11)
|
|
(.mov vf3 a0-21)
|
|
(nop!)
|
|
(.mov vf4 a1-16)
|
|
(.itof.vf vf1 vf1)
|
|
(nop!)
|
|
(.itof.vf vf2 vf2)
|
|
(nop!)
|
|
(.itof.vf vf3 vf3)
|
|
(nop!)
|
|
(.itof.vf vf4 vf4)
|
|
(nop!)
|
|
(nop!)
|
|
(.svf (&-> v1-7 4) vf1)
|
|
(nop!)
|
|
(.svf (&-> v1-7 5) vf2)
|
|
(nop!)
|
|
(.svf (&-> v1-7 6) vf3)
|
|
(nop!)
|
|
(.svf (&-> v1-7 7) vf4)
|
|
)
|
|
(.mov v1-8 vf4)
|
|
(&+! (-> arg0 base) 128)
|
|
(let* ((v1-11 arg0)
|
|
(a0-22 (the-as object (-> v1-11 base)))
|
|
)
|
|
(set! (-> (the-as dma-packet a0-22) dma)
|
|
(new 'static 'dma-tag :id (dma-tag-id ref) :addr (the-as int arg3) :qwc arg4)
|
|
)
|
|
(set! (-> (the-as dma-packet a0-22) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
|
(set! (-> (the-as dma-packet a0-22) vif1)
|
|
(new 'static 'vif-tag :imm #x8011 :cmd (vif-cmd unpack-v4-32) :num arg4)
|
|
)
|
|
(set! (-> v1-11 base) (&+ (the-as pointer a0-22) 16))
|
|
)
|
|
(if arg5
|
|
(ocean-mid-add-call arg0 275)
|
|
(ocean-mid-add-call arg0 107)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
)
|
|
|
|
;; definition for function ocean-mid-add-upload-top
|
|
(defun ocean-mid-add-upload-top ((arg0 dma-buffer) (arg1 uint) (arg2 uint))
|
|
(let ((s2-0 (-> *ocean-work* mid-minx))
|
|
(s1-0 (-> *ocean-work* mid-maxx))
|
|
(s3-0 (ocean-mid-camera-masks-bit? arg1 arg2))
|
|
)
|
|
(cond
|
|
((ocean-mid-mask-ptrs-bit? arg1 arg2)
|
|
)
|
|
((= arg2 s2-0)
|
|
(cond
|
|
(s3-0
|
|
(ocean-mid-add-upload-table arg0 (+ arg1 -1) arg2 *ocean-down-table* 7 #t)
|
|
(ocean-mid-add-upload-table arg0 arg1 (+ arg2 -1) *ocean-right-table* 7 #t)
|
|
)
|
|
(else
|
|
(let ((s3-1 (ocean-mid-mask-ptrs-bit? (+ arg1 1) arg2))
|
|
(v1-5 (ocean-mid-mask-ptrs-bit? arg1 (+ arg2 1)))
|
|
)
|
|
(cond
|
|
((and s3-1 v1-5)
|
|
)
|
|
(s3-1
|
|
(ocean-mid-add-upload-table arg0 arg1 arg2 *ocean-right-table* 7 #t)
|
|
)
|
|
(v1-5
|
|
(ocean-mid-add-upload-table arg0 arg1 arg2 *ocean-down-table* 7 #t)
|
|
)
|
|
(else
|
|
(ocean-mid-add-upload-table arg0 arg1 arg2 *ocean-down-right-table* 10 #f)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
((= arg2 s1-0)
|
|
(cond
|
|
(s3-0
|
|
(ocean-mid-add-upload-table arg0 (+ arg1 -1) arg2 *ocean-down-table* 7 #t)
|
|
(ocean-mid-add-upload-table arg0 arg1 (+ arg2 1) *ocean-left-table* 7 #t)
|
|
)
|
|
(else
|
|
(let ((s3-2 (ocean-mid-mask-ptrs-bit? (+ arg1 1) arg2))
|
|
(v1-7 (ocean-mid-mask-ptrs-bit? arg1 (+ arg2 -1)))
|
|
)
|
|
(cond
|
|
((and s3-2 v1-7)
|
|
)
|
|
(s3-2
|
|
(ocean-mid-add-upload-table arg0 arg1 arg2 *ocean-left-table* 7 #t)
|
|
)
|
|
(v1-7
|
|
(ocean-mid-add-upload-table arg0 arg1 arg2 *ocean-down-table* 7 #t)
|
|
)
|
|
(else
|
|
(ocean-mid-add-upload-table arg0 arg1 arg2 *ocean-down-left-table* 10 #t)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(s3-0
|
|
(ocean-mid-add-upload-table arg0 (+ arg1 -1) arg2 *ocean-down-table* 7 #t)
|
|
)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
;; definition for function ocean-mid-add-upload-middle
|
|
(defun ocean-mid-add-upload-middle ((arg0 dma-buffer) (arg1 uint) (arg2 uint))
|
|
(let ((s3-0 (-> *ocean-work* mid-minx))
|
|
(s2-0 (-> *ocean-work* mid-maxx))
|
|
(s1-0 (ocean-mid-camera-masks-bit? arg1 arg2))
|
|
)
|
|
(cond
|
|
((ocean-mid-mask-ptrs-bit? arg1 arg2)
|
|
)
|
|
((= arg2 s3-0)
|
|
(cond
|
|
(s1-0
|
|
(ocean-mid-add-upload-table arg0 arg1 (+ arg2 -1) *ocean-right-table* 7 #t)
|
|
)
|
|
((ocean-mid-mask-ptrs-bit? arg1 (+ arg2 1))
|
|
)
|
|
(else
|
|
(ocean-mid-add-upload-table arg0 arg1 arg2 *ocean-right-table* 7 #t)
|
|
)
|
|
)
|
|
)
|
|
((= arg2 s2-0)
|
|
(cond
|
|
(s1-0
|
|
(ocean-mid-add-upload-table arg0 arg1 (+ arg2 1) *ocean-left-table* 7 #t)
|
|
)
|
|
((ocean-mid-mask-ptrs-bit? arg1 (+ arg2 -1))
|
|
)
|
|
(else
|
|
(ocean-mid-add-upload-table arg0 arg1 arg2 *ocean-left-table* 7 #t)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
;; definition for function ocean-mid-add-upload-bottom
|
|
(defun ocean-mid-add-upload-bottom ((arg0 dma-buffer) (arg1 uint) (arg2 uint))
|
|
(let ((s2-0 (-> *ocean-work* mid-minx))
|
|
(s1-0 (-> *ocean-work* mid-maxx))
|
|
(s3-0 (ocean-mid-camera-masks-bit? arg1 arg2))
|
|
)
|
|
(cond
|
|
((ocean-mid-mask-ptrs-bit? arg1 arg2)
|
|
)
|
|
((= arg2 s2-0)
|
|
(cond
|
|
(s3-0
|
|
(ocean-mid-add-upload-table arg0 (+ arg1 1) arg2 *ocean-up-table* 7 #t)
|
|
(ocean-mid-add-upload-table arg0 arg1 (+ arg2 -1) *ocean-right-table* 7 #t)
|
|
)
|
|
(else
|
|
(let ((s3-1 (ocean-mid-mask-ptrs-bit? (+ arg1 -1) arg2))
|
|
(v1-5 (ocean-mid-mask-ptrs-bit? arg1 (+ arg2 1)))
|
|
)
|
|
(cond
|
|
((and s3-1 v1-5)
|
|
)
|
|
(s3-1
|
|
(ocean-mid-add-upload-table arg0 arg1 arg2 *ocean-right-table* 7 #t)
|
|
)
|
|
(v1-5
|
|
(ocean-mid-add-upload-table arg0 arg1 arg2 *ocean-up-table* 7 #t)
|
|
)
|
|
(else
|
|
(ocean-mid-add-upload-table arg0 arg1 arg2 *ocean-up-right-table* 10 #t)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
((= arg2 s1-0)
|
|
(cond
|
|
(s3-0
|
|
(ocean-mid-add-upload-table arg0 (+ arg1 1) arg2 *ocean-up-table* 7 #t)
|
|
(ocean-mid-add-upload-table arg0 arg1 (+ arg2 1) *ocean-left-table* 7 #t)
|
|
)
|
|
(else
|
|
(let ((s3-2 (ocean-mid-mask-ptrs-bit? (+ arg1 -1) arg2))
|
|
(v1-7 (ocean-mid-mask-ptrs-bit? arg1 (+ arg2 -1)))
|
|
)
|
|
(cond
|
|
((and s3-2 v1-7)
|
|
)
|
|
(s3-2
|
|
(ocean-mid-add-upload-table arg0 arg1 arg2 *ocean-left-table* 7 #t)
|
|
)
|
|
(v1-7
|
|
(ocean-mid-add-upload-table arg0 arg1 arg2 *ocean-up-table* 7 #t)
|
|
)
|
|
(else
|
|
(ocean-mid-add-upload-table arg0 arg1 arg2 *ocean-up-left-table* 10 #f)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(s3-0
|
|
(ocean-mid-add-upload-table arg0 (+ arg1 1) arg2 *ocean-up-table* 7 #t)
|
|
)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
;; definition for function ocean-seams-add-constants
|
|
;; INFO: Return type mismatch pointer vs none.
|
|
(defun ocean-seams-add-constants ((arg0 dma-buffer))
|
|
(let* ((a2-0 4)
|
|
(v1-0 arg0)
|
|
(a1-0 (the-as object (-> v1-0 base)))
|
|
)
|
|
(set! (-> (the-as dma-packet a1-0) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a2-0))
|
|
(set! (-> (the-as dma-packet a1-0) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
|
(set! (-> (the-as dma-packet a1-0) vif1)
|
|
(new 'static 'vif-tag :imm #x2fd :cmd (vif-cmd unpack-v4-32) :num a2-0)
|
|
)
|
|
(set! (-> v1-0 base) (&+ (the-as pointer a1-0) 16))
|
|
)
|
|
(let ((v1-1 (-> arg0 base)))
|
|
(set-vector! (the-as vector (&+ v1-1 0)) 0.0 0.0 0.0 1.0)
|
|
(set-vector! (the-as vector (&+ v1-1 16)) 393216.0 0.0 0.0 1.0)
|
|
(set-vector! (the-as vector (&+ v1-1 32)) 0.0 0.0 393216.0 1.0)
|
|
(set-vector! (the-as vector (&+ v1-1 48)) 393216.0 0.0 393216.0 1.0)
|
|
)
|
|
(&+! (-> arg0 base) 64)
|
|
(none)
|
|
)
|
|
|
|
;; definition for function draw-ocean-mid-seams
|
|
;; INFO: Return type mismatch symbol vs none.
|
|
(defun draw-ocean-mid-seams ((arg0 dma-buffer))
|
|
(local-vars (sv-32 uint) (sv-33 uint) (sv-34 uint) (sv-35 uint) (sv-36 sphere))
|
|
(ocean-seams-add-constants arg0)
|
|
(set! sv-32 (-> *ocean-work* mid-minx))
|
|
(set! sv-33 (-> *ocean-work* mid-maxx))
|
|
(set! sv-34 (-> *ocean-work* mid-minz))
|
|
(set! sv-35 (-> *ocean-work* mid-maxz))
|
|
(set! sv-36 (new 'stack 'sphere))
|
|
(set! (-> sv-36 y) (-> *ocean-map* start-corner y))
|
|
(set! (-> sv-36 w) 278045.7)
|
|
(let ((s5-0 sv-34)
|
|
(s4-0 sv-35)
|
|
)
|
|
(while (>= s4-0 s5-0)
|
|
(let ((s3-0 sv-32)
|
|
(s2-0 sv-33)
|
|
)
|
|
(while (>= s2-0 s3-0)
|
|
(set! (-> sv-36 x) (+ 196608.0 (* 393216.0 (the float s3-0)) (-> *ocean-map* start-corner x)))
|
|
(set! (-> sv-36 z) (+ 196608.0 (* 393216.0 (the float s5-0)) (-> *ocean-map* start-corner z)))
|
|
(when (sphere-cull sv-36)
|
|
(cond
|
|
((= s5-0 sv-34)
|
|
(ocean-mid-add-upload-top arg0 s5-0 s3-0)
|
|
)
|
|
((= s5-0 sv-35)
|
|
(ocean-mid-add-upload-bottom arg0 s5-0 s3-0)
|
|
)
|
|
(else
|
|
(ocean-mid-add-upload-middle arg0 s5-0 s3-0)
|
|
)
|
|
)
|
|
)
|
|
(+! s3-0 1)
|
|
)
|
|
)
|
|
(+! s5-0 1)
|
|
)
|
|
)
|
|
(dotimes (v1-26 36)
|
|
(if (and (-> *ocean-work* mid-mask-ptrs v1-26) (nonzero? (-> *ocean-work* mid-camera-masks v1-26)))
|
|
(logior! (-> *ocean-work* mid-mask-ptrs v1-26 0) (-> *ocean-work* mid-camera-masks v1-26))
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
;; definition for function draw-ocean-mid
|
|
;; INFO: Return type mismatch int vs none.
|
|
;; Used lq/sq
|
|
(defun draw-ocean-mid ((arg0 dma-buffer))
|
|
(rlet ((vf16 :class vf)
|
|
(vf17 :class vf)
|
|
(vf18 :class vf)
|
|
(vf19 :class vf)
|
|
(vf20 :class vf)
|
|
(vf21 :class vf)
|
|
(vf22 :class vf)
|
|
(vf23 :class vf)
|
|
)
|
|
(dotimes (v1-0 36)
|
|
(set! (-> *ocean-work* mid-mask-ptrs v1-0) (the-as (pointer int64) #f))
|
|
(set! (-> *ocean-work* mid-camera-masks v1-0) (the-as uint 0))
|
|
)
|
|
(dma-buffer-add-vu-function arg0 ocean-mid-block 1)
|
|
(let* ((v1-3 arg0)
|
|
(a0-6 (the-as object (-> v1-3 base)))
|
|
)
|
|
(set! (-> (the-as dma-packet a0-6) dma) (new 'static 'dma-tag :id (dma-tag-id cnt)))
|
|
(set! (-> (the-as dma-packet a0-6) vif0) (new 'static 'vif-tag :cmd (vif-cmd base)))
|
|
(set! (-> (the-as dma-packet a0-6) vif1) (new 'static 'vif-tag :imm #x76 :cmd (vif-cmd offset)))
|
|
(set! (-> v1-3 base) (&+ (the-as pointer a0-6) 16))
|
|
)
|
|
(ocean-mid-add-constants arg0)
|
|
(ocean-mid-add-call arg0 0)
|
|
(let ((v1-5 *math-camera*))
|
|
(.lvf vf16 (&-> v1-5 plane 0 quad))
|
|
(.lvf vf17 (&-> v1-5 plane 1 quad))
|
|
(.lvf vf18 (&-> v1-5 plane 2 quad))
|
|
(.lvf vf19 (&-> v1-5 plane 3 quad))
|
|
(.lvf vf20 (&-> v1-5 guard-plane 0 quad))
|
|
(.lvf vf21 (&-> v1-5 guard-plane 1 quad))
|
|
(.lvf vf22 (&-> v1-5 guard-plane 2 quad))
|
|
(.lvf vf23 (&-> v1-5 guard-plane 3 quad))
|
|
)
|
|
(set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0))
|
|
(let ((s5-0 (-> *math-camera* trans)))
|
|
(dotimes (s4-0 6)
|
|
(dotimes (s3-0 6)
|
|
(let* ((s2-0 (+ (* 6 s4-0) s3-0))
|
|
(s1-0 (-> *ocean-map* ocean-spheres spheres s2-0))
|
|
(s0-0 (-> (the-as (pointer int16) (+ (* s2-0 2) (the-as int (-> *ocean-map* ocean-mid-indices))))))
|
|
)
|
|
(when (sphere-cull s1-0)
|
|
(cond
|
|
((< s0-0 0)
|
|
)
|
|
((let ((f30-0 (- (vector-vector-distance s1-0 s5-0) (-> s1-0 w))))
|
|
(ocean-mid-add-upload arg0 s4-0 s3-0 s0-0 s2-0 f30-0)
|
|
(< f30-0 786432.0)
|
|
)
|
|
(ocean-mid-add-call arg0 73)
|
|
(+! (-> *terrain-stats* ocean-mid fragments) 1)
|
|
(+! (-> *terrain-stats* ocean-mid tris) 256)
|
|
(+! (-> *terrain-stats* ocean-mid dverts) 288)
|
|
)
|
|
(else
|
|
(ocean-mid-add-call arg0 46)
|
|
(+! (-> *terrain-stats* ocean-mid fragments) 1)
|
|
(+! (-> *terrain-stats* ocean-mid tris) 128)
|
|
(+! (-> *terrain-stats* ocean-mid dverts) 144)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(when (not (or *ocean-near-off* (< 196608.0 (fabs (-> *math-camera* trans y)))))
|
|
(let ((a1-11 48)
|
|
(a2-2 0)
|
|
(v1-42 48)
|
|
(a0-25 0)
|
|
)
|
|
(dotimes (a3-1 6)
|
|
(dotimes (t0-1 6)
|
|
(let ((t1-6 (&-> *ocean-work* mid-camera-masks (+ (* 6 a3-1) t0-1))))
|
|
(when (nonzero? (-> t1-6 0))
|
|
(dotimes (t2-3 8)
|
|
(let ((t3-1 (-> (the-as (pointer uint8) (+ t2-3 (the-as int t1-6))) 0)))
|
|
(when (nonzero? t3-1)
|
|
(let ((t4-2 (+ (* a3-1 8) t2-3)))
|
|
(if (< t4-2 v1-42)
|
|
(set! v1-42 t4-2)
|
|
)
|
|
(if (< a0-25 t4-2)
|
|
(set! a0-25 t4-2)
|
|
)
|
|
)
|
|
(dotimes (t4-3 8)
|
|
(when (logtest? t3-1 (ash 1 t4-3))
|
|
(let ((t5-9 (+ (* t0-1 8) t4-3)))
|
|
(if (< t5-9 a1-11)
|
|
(set! a1-11 t5-9)
|
|
)
|
|
(if (< a2-2 t5-9)
|
|
(set! a2-2 t5-9)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> *ocean-work* mid-minx) (the-as uint a1-11))
|
|
(set! (-> *ocean-work* mid-maxx) (the-as uint a2-2))
|
|
(set! (-> *ocean-work* mid-minz) (the-as uint v1-42))
|
|
(set! (-> *ocean-work* mid-maxz) (the-as uint a0-25))
|
|
(when (and (< a1-11 a2-2) (< v1-42 a0-25))
|
|
(ocean-mid-add-call-flush arg0 (the-as uint 41))
|
|
(ocean-mid-add-call-flush arg0 (the-as uint 43))
|
|
(draw-ocean-transition arg0)
|
|
(draw-ocean-mid-seams arg0)
|
|
)
|
|
)
|
|
)
|
|
(ocean-mid-add-call-flush arg0 (the-as uint 41))
|
|
0
|
|
(none)
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|