mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -04:00
cd68cb671e
Major change to how `deftype` shows up in our code: - the decompiler will no longer emit the `offset-assert`, `method-count-assert`, `size-assert` and `flag-assert` parameters. There are extremely few cases where having this in the decompiled code is helpful, as the types there come from `all-types` which already has those parameters. This also doesn't break type consistency because: - the asserts aren't compared. - the first step of the test uses `all-types`, which has the asserts, which will throw an error if they're bad. - the decompiler won't emit the `heap-base` parameter unless necessary now. - the decompiler will try its hardest to turn a fixed-offset field into an `overlay-at` field. It falls back to the old offset if all else fails. - `overlay-at` now supports field "dereferencing" to specify the offset that's within a field that's a structure, e.g.: ```lisp (deftype foobar (structure) ((vec vector :inline) (flags int32 :overlay-at (-> vec w)) ) ) ``` in this structure, the offset of `flags` will be 12 because that is the final offset of `vec`'s `w` field within this structure. - **removed ID from all method declarations.** IDs are only ever automatically assigned now. Fixes #3068. - added an `:overlay` parameter to method declarations, in order to declare a new method that goes on top of a previously-defined method. Syntax is `:overlay <method-name>`. Please do not ever use this. - added `state-methods` list parameter. This lets you quickly specify a list of states to be put in the method table. Same syntax as the `states` list parameter. The decompiler will try to put as many states in this as it can without messing with the method ID order. Also changes `defmethod` to make the first type definition (before the arguments) optional. The type can now be inferred from the first argument. Fixes #3093. --------- Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
1194 lines
41 KiB
Common Lisp
1194 lines
41 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: ocean-mid.gc
|
|
;; name in dgo: ocean-mid
|
|
;; dgos: ENGINE, GAME
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
(define ocean-mid-block (new 'static 'vu-function))
|
|
|
|
(defmethod ocean-mid-setup-constants ((this ocean) (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.25 -0.5 0.0 393216.0)
|
|
(let* ((s4-0 (-> (matrix-local->world #f #f) vector 2))
|
|
(f0-12 (- 1.5 (* 0.000015258789 (atan (-> s4-0 x) (-> s4-0 z)))))
|
|
(f1-1 (+ 0.5 (* -0.5 (-> s4-0 y))))
|
|
)
|
|
(set-vector! (-> arg0 constants2) f0-12 f1-1 1.0 0.0)
|
|
)
|
|
(case *subdivide-ocean-draw-mode*
|
|
(((subdivide-setting textured))
|
|
(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
|
|
)
|
|
)
|
|
(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
|
|
)
|
|
)
|
|
(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
|
|
)
|
|
)
|
|
(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
|
|
)
|
|
)
|
|
(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
|
|
)
|
|
)
|
|
)
|
|
(((subdivide-setting outline))
|
|
(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
|
|
)
|
|
)
|
|
(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
|
|
)
|
|
)
|
|
(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
|
|
)
|
|
)
|
|
(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
|
|
)
|
|
)
|
|
(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
|
|
)
|
|
)
|
|
)
|
|
(((subdivide-setting gouraud))
|
|
(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 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 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-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 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
|
|
)
|
|
)
|
|
)
|
|
(((subdivide-setting hack))
|
|
(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
|
|
)
|
|
)
|
|
(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
|
|
)
|
|
)
|
|
(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
|
|
)
|
|
)
|
|
(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
|
|
)
|
|
)
|
|
(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
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(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))
|
|
)
|
|
(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-strip-0 regs)
|
|
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
|
)
|
|
(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-strip 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)))
|
|
(set! (-> arg0 drw-texture tex0)
|
|
(new 'static 'gs-tex0 :tbp0 #x2a0 :tbw #x2 :tcc #x1 :th (log2 128) :tw (log2 128))
|
|
)
|
|
(set! (-> arg0 drw-texture prims 1) (gs-reg64 tex0-1))
|
|
(set! (-> arg0 drw-texture tex1) (-> this tex1))
|
|
(set! (-> arg0 drw-texture prims 3) (gs-reg64 tex1-1))
|
|
(set! (-> arg0 drw-texture miptbp1) (new 'static 'gs-miptbp :tbp1 #x6a0 :tbw1 #x1 :tbp2 #x7a0 :tbp3 #x7e0))
|
|
(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 #x8400082000800))
|
|
(set! (-> arg0 drw-texture prims 9) (gs-reg64 miptbp2-1))
|
|
(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)))
|
|
(cond
|
|
((-> *time-of-day-context* sky)
|
|
(set! (-> arg0 env-texture tex0) (new 'static 'gs-tex0
|
|
:tbw #x1
|
|
:tcc #x1
|
|
:th (log2 64)
|
|
:tw (log2 64)
|
|
:tbp0 (-> *ocean-envmap-texture-base* vram-block)
|
|
)
|
|
)
|
|
(set! (-> arg0 env-texture prims 1) (gs-reg64 tex0-1))
|
|
(set! (-> arg0 env-texture tex1) (new 'static 'gs-tex1 :mmag #x1 :mmin #x5 :l #x1 :k #xeed))
|
|
(set! (-> arg0 env-texture prims 3) (gs-reg64 tex1-1))
|
|
(set! (-> arg0 env-texture miptbp1) (new 'static 'gs-miptbp))
|
|
(set! (-> arg0 env-texture prims 5) (gs-reg64 miptbp1-1))
|
|
(set! (-> arg0 env-texture clamp) (new 'static 'gs-clamp))
|
|
(set! (-> arg0 env-texture clamp-reg) (gs-reg64 clamp-1))
|
|
(set! (-> arg0 env-texture alpha) (new 'static 'gs-alpha :b #x2 :c #x1 :d #x1))
|
|
(set! (-> arg0 env-texture prims 9) (gs-reg64 alpha-1))
|
|
)
|
|
(else
|
|
(let ((s4-3 (-> arg0 env-texture)))
|
|
(adgif-shader<-texture-simple! s4-3 (lookup-texture-by-id (new 'static 'texture-id :page #x1f)))
|
|
)
|
|
(set! (-> arg0 env-texture clamp) (new 'static 'gs-clamp))
|
|
(set! (-> arg0 env-texture alpha) (new 'static 'gs-alpha :b #x2 :c #x1 :d #x1))
|
|
)
|
|
)
|
|
(let ((f0-16 (* 128.0 (-> *time-of-day-context* ocean-alpha))))
|
|
(if (-> *time-of-day-context* sky)
|
|
(set-vector! (-> arg0 env-color) f0-16 f0-16 f0-16 f0-16)
|
|
(set-vector! (-> arg0 env-color) f0-16 f0-16 (* 0.5 f0-16) f0-16)
|
|
)
|
|
)
|
|
(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)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod ocean-mid-add-constants ((this ocean) (arg0 dma-buffer))
|
|
(let* ((a2-0 36)
|
|
(v1-0 arg0)
|
|
(a1-1 (the-as object (-> v1-0 base)))
|
|
)
|
|
(set! (-> (the-as dma-packet a1-1) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a2-0))
|
|
(set! (-> (the-as dma-packet a1-1) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
|
(set! (-> (the-as dma-packet a1-1) vif1)
|
|
(new 'static 'vif-tag :imm #x2dd :cmd (vif-cmd unpack-v4-32) :num a2-0)
|
|
)
|
|
(set! (-> v1-0 base) (&+ (the-as pointer a1-1) 16))
|
|
)
|
|
(ocean-mid-setup-constants this (the-as ocean-mid-constants (-> arg0 base)))
|
|
(&+! (-> arg0 base) 576)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod ocean-matrix*! ((this ocean) (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 quad 0))
|
|
(.lvf vf5 (&-> arg2 quad 0))
|
|
(.lvf vf6 (&-> arg2 quad 1))
|
|
(.lvf vf7 (&-> arg2 quad 2))
|
|
(.lvf vf8 (&-> arg2 trans quad))
|
|
(.lvf vf2 (&-> arg1 quad 1))
|
|
(.lvf vf3 (&-> arg1 quad 2))
|
|
(.lvf vf4 (&-> arg1 trans 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 quad 0) vf9)
|
|
(.svf (&-> arg0 quad 1) vf10)
|
|
(.svf (&-> arg0 quad 2) vf11)
|
|
(.svf (&-> arg0 trans quad) vf12)
|
|
arg0
|
|
)
|
|
)
|
|
|
|
(defmethod ocean-vector-matrix*! ((this ocean) (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 quad 0))
|
|
(.lvf vf2 (&-> arg2 quad 1))
|
|
(.lvf vf3 (&-> arg2 quad 2))
|
|
(.lvf vf4 (&-> arg2 trans 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
|
|
)
|
|
)
|
|
|
|
(defmethod ocean-mid-add-matrices ((this ocean) (arg0 dma-buffer) (arg1 vector))
|
|
(let ((s4-0 (new-stack-vector0))
|
|
(v1-3 (if (-> *time-of-day-context* use-camera-other)
|
|
(-> *math-camera* camera-rot-other)
|
|
(-> *math-camera* camera-rot)
|
|
)
|
|
)
|
|
)
|
|
(let* ((a3-0 8)
|
|
(a0-1 arg0)
|
|
(a1-1 (the-as object (-> a0-1 base)))
|
|
)
|
|
(set! (-> (the-as dma-packet a1-1) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a3-0))
|
|
(set! (-> (the-as dma-packet a1-1) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
|
(set! (-> (the-as dma-packet a1-1) vif1)
|
|
(new 'static 'vif-tag :imm #x8000 :cmd (vif-cmd unpack-v4-32) :num a3-0)
|
|
)
|
|
(set! (-> a0-1 base) (&+ (the-as pointer a1-1) 16))
|
|
)
|
|
(let ((s3-0 (the-as object (-> arg0 base))))
|
|
(let* ((t0-4 (the-as matrix s3-0))
|
|
(t1-2 v1-3)
|
|
(a0-2 (-> t1-2 quad 0))
|
|
(a1-3 (-> t1-2 quad 1))
|
|
(a3-4 (-> t1-2 quad 2))
|
|
(t1-3 (-> t1-2 trans quad))
|
|
)
|
|
(set! (-> t0-4 quad 0) a0-2)
|
|
(set! (-> t0-4 quad 1) a1-3)
|
|
(set! (-> t0-4 quad 2) a3-4)
|
|
(set! (-> t0-4 trans quad) t1-3)
|
|
)
|
|
(let ((s2-0 (the-as object (&+ (the-as pointer s3-0) 48))))
|
|
(vector-matrix*! s4-0 arg1 v1-3)
|
|
(set! (-> (the-as vector s2-0) x) (-> s4-0 x))
|
|
(set! (-> (the-as vector s2-0) y) (-> s4-0 y))
|
|
(set! (-> (the-as vector s2-0) z) (-> s4-0 z))
|
|
)
|
|
(let ((a1-5 (&+ (-> arg0 base) 64)))
|
|
(ocean-matrix*! this (the-as matrix a1-5) (the-as matrix s3-0) (-> *math-camera* perspective))
|
|
)
|
|
)
|
|
)
|
|
(&+! (-> arg0 base) 128)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod ocean-mid-check ((this ocean) (arg0 pointer) (arg1 int) (arg2 int) (arg3 vector))
|
|
(local-vars (v0-0 symbol) (v1-10 float) (t0-3 float) (t0-8 float) (t0-13 float))
|
|
(rlet ((vf1 :class vf)
|
|
(vf2 :class vf)
|
|
(vf3 :class vf)
|
|
)
|
|
(let ((v1-0 (new-stack-vector0))
|
|
(a0-2 (-> *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 ((t0-2 v1-0)
|
|
(t1-2 a0-2)
|
|
)
|
|
(.lvf vf2 (&-> t0-2 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 t0-3 vf1)
|
|
(when (< t0-3 309237600000.0)
|
|
(logior! (-> (the-as (pointer uint8) (+ arg2 (the-as int arg0)))) (ash 1 arg1))
|
|
(return #f)
|
|
)
|
|
(+! (-> v1-0 x) 393216.0)
|
|
(let ((t0-7 v1-0)
|
|
(t1-3 a0-2)
|
|
)
|
|
(.lvf vf2 (&-> t0-7 quad))
|
|
(.lvf vf3 (&-> t1-3 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 t0-8 vf1)
|
|
(when (< t0-8 309237600000.0)
|
|
(logior! (-> (the-as (pointer uint8) (+ arg2 (the-as int arg0)))) (ash 1 arg1))
|
|
(return #f)
|
|
)
|
|
(+! (-> v1-0 z) 393216.0)
|
|
(let ((t0-12 v1-0)
|
|
(t1-4 a0-2)
|
|
)
|
|
(.lvf vf2 (&-> t0-12 quad))
|
|
(.lvf vf3 (&-> t1-4 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 t0-13 vf1)
|
|
(when (< t0-13 309237600000.0)
|
|
(logior! (-> (the-as (pointer uint8) (+ arg2 (the-as int arg0)))) (ash 1 arg1))
|
|
(return #f)
|
|
)
|
|
(+! (-> v1-0 x) -393216.0)
|
|
(.lvf vf2 (&-> v1-0 quad))
|
|
(.lvf vf3 (&-> a0-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 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
|
|
)
|
|
)
|
|
)
|
|
|
|
(defmethod ocean-mid-add-call ((this ocean) (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))
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod ocean-mid-add-call-flush ((this ocean) (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))
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; WARN: Return type mismatch symbol vs none.
|
|
(defmethod ocean-mid-add-upload ((this ocean) (arg0 dma-buffer) (arg1 int) (arg2 int) (arg3 int) (arg4 int) (arg5 float))
|
|
(local-vars (sv-32 int))
|
|
(set! sv-32 arg1)
|
|
(let ((s0-0 arg2)
|
|
(s1-0 arg3)
|
|
(s4-0 arg4)
|
|
(s2-0 arg5)
|
|
(s5-0 (new-stack-vector0))
|
|
)
|
|
(let ((v1-0 (-> this start-corner)))
|
|
(set! (-> s5-0 x) (+ (-> v1-0 x) (* 3145728.0 (the float s0-0))))
|
|
(set! (-> s5-0 y) (-> v1-0 y))
|
|
(set! (-> s5-0 z) (+ (-> v1-0 z) (* 3145728.0 (the float sv-32))))
|
|
)
|
|
(set! (-> s5-0 w) 1.0)
|
|
(ocean-mid-add-matrices this arg0 s5-0)
|
|
(let ((v1-6 (+ (the-as uint (-> this ocean-colors)) (* (+ (* 416 sv-32) (* s0-0 8)) 4))))
|
|
(dotimes (a0-7 9)
|
|
(let* ((a1-4 arg0)
|
|
(a2-2 (the-as object (-> a1-4 base)))
|
|
)
|
|
(set! (-> (the-as dma-packet a2-2) dma) (new 'static 'dma-tag :qwc #x3 :id (dma-tag-id ref) :addr v1-6))
|
|
(set! (-> (the-as dma-packet a2-2) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
|
(set! (-> (the-as dma-packet a2-2) vif1) (new 'static 'vif-tag
|
|
:num #xc
|
|
:cmd (vif-cmd unpack-v4-8)
|
|
:imm (logior (shr (shl (+ (* 12 a0-7) 8) 54) 54) #xc000)
|
|
)
|
|
)
|
|
(set! (-> a1-4 base) (&+ (the-as pointer a2-2) 16))
|
|
)
|
|
(+! v1-6 208)
|
|
)
|
|
)
|
|
(let* ((a2-4 1)
|
|
(v1-9 arg0)
|
|
(a0-8 (the-as object (-> v1-9 base)))
|
|
)
|
|
(set! (-> (the-as dma-packet a0-8) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a2-4))
|
|
(set! (-> (the-as dma-packet a0-8) vif0) (new 'static 'vif-tag :imm #x204 :cmd (vif-cmd stcycl)))
|
|
(set! (-> (the-as dma-packet a0-8) vif1)
|
|
(new 'static 'vif-tag :imm #xc074 :num #x2 :cmd (vif-cmd unpack-v4-8))
|
|
)
|
|
(set! (-> v1-9 base) (&+ (the-as pointer a0-8) 16))
|
|
)
|
|
(let ((v1-10 (-> arg0 base)))
|
|
(let ((a0-12 (-> this ocean-mid-masks data s1-0)))
|
|
(set! (-> this mid-mask-ptrs s4-0) v1-10)
|
|
(set! (-> (the-as (pointer uint64) v1-10)) (-> a0-12 dword))
|
|
)
|
|
(set! (-> (the-as (pointer uint64) v1-10) 1) (the-as uint 0))
|
|
)
|
|
(&+! (-> arg0 base) 16)
|
|
(when (< s2-0 556091.4)
|
|
(let* ((v1-15 (-> *math-camera* trans))
|
|
(s4-1 (&-> this mid-camera-masks s4-0))
|
|
(s3-1 (+ (the int (* 0.0000025431316 (- (-> v1-15 x) (-> s5-0 x)))) -1))
|
|
(s2-1 (+ (the int (* 0.0000025431316 (- (-> v1-15 z) (-> s5-0 z)))) -1))
|
|
)
|
|
(dotimes (s1-1 3)
|
|
(dotimes (s0-1 3)
|
|
(let ((a2-7 (+ s0-1 s3-1))
|
|
(a3-6 (+ s1-1 s2-1))
|
|
)
|
|
(if (and (>= a2-7 0) (>= a3-6 0) (< a2-7 8) (< a3-6 8))
|
|
(ocean-mid-check this s4-1 a2-7 a3-6 s5-0)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
(defmethod ocean-mid-camera-masks-bit? ((this ocean) (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* ((t0-0 (/ (the-as int arg0) 8))
|
|
(a3-3 (/ (the-as int arg1) 8))
|
|
(a1-1 (logand arg0 7))
|
|
(v1-1 (logand arg1 7))
|
|
(a2-3 (+ (* 6 (the-as int t0-0)) a3-3))
|
|
)
|
|
(logtest? (-> (the-as (pointer uint8) (+ (+ a1-1 (* a2-3 8)) (the-as uint this))) 2384) (ash 1 v1-1))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
(defmethod ocean-mid-mask-ptrs-bit? ((this ocean) (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* ((t0-0 (/ (the-as int arg0) 8))
|
|
(a3-3 (/ (the-as int arg1) 8))
|
|
(a1-1 (logand arg0 7))
|
|
(v1-1 (logand arg1 7))
|
|
(a2-3 (+ (* 6 (the-as int t0-0)) a3-3))
|
|
)
|
|
(if (-> this mid-mask-ptrs a2-3)
|
|
(logtest? (-> (the-as (pointer uint8) (+ a1-1 (the-as uint (-> this mid-mask-ptrs a2-3))))) (ash 1 v1-1))
|
|
#t
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
(defmethod ocean-mid-camera-masks-set! ((this ocean) (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* ((t0-0 (/ (the-as int arg0) 8))
|
|
(a3-3 (/ (the-as int arg1) 8))
|
|
(v1-1 (logand arg0 7))
|
|
(a1-1 (logand arg1 7))
|
|
(a3-4 (+ (* 6 (the-as int t0-0)) a3-3))
|
|
(a2-5 (&-> this mid-camera-masks a3-4))
|
|
)
|
|
(cond
|
|
(a2-5
|
|
(cond
|
|
((logtest? (-> (the-as (pointer uint8) (+ v1-1 (the-as uint (-> this mid-mask-ptrs a3-4))))) (ash 1 a1-1))
|
|
#f
|
|
)
|
|
(else
|
|
(logior! (-> (the-as (pointer uint8) (+ v1-1 (the-as uint a2-5))) 0) (ash 1 a1-1))
|
|
#t
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
#f
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
(defmethod ocean-mid-add-upload-table ((this ocean) (arg0 dma-buffer) (arg1 uint) (arg2 uint) (arg3 (pointer float)) (arg4 int) (arg5 symbol))
|
|
(local-vars
|
|
(v1-13 float)
|
|
(a0-20 uint128)
|
|
(a0-21 uint128)
|
|
(a0-22 uint128)
|
|
(a1-13 uint128)
|
|
(a1-14 uint128)
|
|
(a1-15 uint128)
|
|
(a2-16 uint128)
|
|
(a3-10 uint128)
|
|
)
|
|
(rlet ((vf1 :class vf)
|
|
(vf2 :class vf)
|
|
(vf3 :class vf)
|
|
(vf4 :class vf)
|
|
)
|
|
(when (ocean-mid-camera-masks-set! this arg1 arg2)
|
|
(let ((a2-2 (new-stack-vector0)))
|
|
(let ((v1-3 (-> this start-corner)))
|
|
(set! (-> a2-2 x) (+ (-> v1-3 x) (* 393216.0 (the float arg2))))
|
|
(set! (-> a2-2 y) (-> v1-3 y))
|
|
(set! (-> a2-2 z) (+ (-> v1-3 z) (* 393216.0 (the float arg1))))
|
|
)
|
|
(set! (-> a2-2 w) 1.0)
|
|
(ocean-mid-add-matrices this arg0 a2-2)
|
|
)
|
|
(let* ((a1-3 9)
|
|
(v1-8 arg0)
|
|
(a0-4 (the-as object (-> v1-8 base)))
|
|
)
|
|
(set! (-> (the-as dma-packet a0-4) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a1-3))
|
|
(set! (-> (the-as dma-packet a0-4) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
|
(set! (-> (the-as dma-packet a0-4) vif1)
|
|
(new 'static 'vif-tag :imm #x8008 :cmd (vif-cmd unpack-v4-32) :num a1-3)
|
|
)
|
|
(set! (-> v1-8 base) (&+ (the-as pointer a0-4) 16))
|
|
)
|
|
(set-vector! (the-as vector4w (-> arg0 base)) arg4 0 0 0)
|
|
(&+! (-> arg0 base) 16)
|
|
(let ((v1-12 (the-as (inline-array vector4w) (-> arg0 base))))
|
|
(set! (-> v1-12 0 quad) (-> *ocean-trans-st-table* 0 quad))
|
|
(set! (-> v1-12 1 quad) (-> *ocean-trans-st-table* 1 quad))
|
|
(set! (-> v1-12 2 quad) (-> *ocean-trans-st-table* 2 quad))
|
|
(set! (-> v1-12 3 quad) (-> *ocean-trans-st-table* 3 quad))
|
|
(let ((a0-19 (the-as uint128 (-> this ocean-colors colors (+ (* 52 (the-as int arg1)) arg2))))
|
|
(a1-12 (the-as uint128 (-> this ocean-colors colors (+ arg2 1 (* 52 (the-as int arg1))))))
|
|
(a2-15 (the-as uint128 (-> this ocean-colors colors (+ (* 52 (the-as int (+ arg1 1))) arg2))))
|
|
(a3-9 (the-as uint128 (-> this ocean-colors colors (+ arg2 1 (* 52 (the-as int (+ arg1 1)))))))
|
|
)
|
|
(.pextlb a0-20 0 a0-19)
|
|
(nop!)
|
|
(.pextlb a1-13 0 a1-12)
|
|
(nop!)
|
|
(.pextlb a2-16 0 a2-15)
|
|
(nop!)
|
|
(.pextlb a3-10 0 a3-9)
|
|
)
|
|
(nop!)
|
|
(.pextlh a0-21 0 a0-20)
|
|
(nop!)
|
|
(.pextlh a1-14 0 a1-13)
|
|
(.mov vf1 a0-21)
|
|
(.pextlh a0-22 0 a2-16)
|
|
(.mov vf2 a1-14)
|
|
(.pextlh a1-15 0 a3-10)
|
|
(.mov vf3 a0-22)
|
|
(nop!)
|
|
(.mov vf4 a1-15)
|
|
(.itof.vf vf1 vf1)
|
|
(nop!)
|
|
(.itof.vf vf2 vf2)
|
|
(nop!)
|
|
(.itof.vf vf3 vf3)
|
|
(nop!)
|
|
(.itof.vf vf4 vf4)
|
|
(nop!)
|
|
(nop!)
|
|
(.svf (&-> v1-12 4 quad) vf1)
|
|
(nop!)
|
|
(.svf (&-> v1-12 5 quad) vf2)
|
|
(nop!)
|
|
(.svf (&-> v1-12 6 quad) vf3)
|
|
(nop!)
|
|
(.svf (&-> v1-12 7 quad) vf4)
|
|
)
|
|
(.mov v1-13 vf4)
|
|
(&+! (-> arg0 base) 128)
|
|
(let* ((v1-16 arg0)
|
|
(a0-23 (the-as object (-> v1-16 base)))
|
|
)
|
|
(set! (-> (the-as dma-packet a0-23) dma)
|
|
(new 'static 'dma-tag :id (dma-tag-id ref) :addr (the-as int arg3) :qwc arg4)
|
|
)
|
|
(set! (-> (the-as dma-packet a0-23) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
|
(set! (-> (the-as dma-packet a0-23) vif1)
|
|
(new 'static 'vif-tag :imm #x8011 :cmd (vif-cmd unpack-v4-32) :num arg4)
|
|
)
|
|
(set! (-> v1-16 base) (&+ (the-as pointer a0-23) 16))
|
|
)
|
|
(if arg5
|
|
(ocean-mid-add-call this arg0 275)
|
|
(ocean-mid-add-call this arg0 107)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
)
|
|
|
|
(defmethod ocean-mid-add-upload-top ((this ocean) (arg0 dma-buffer) (arg1 uint) (arg2 uint))
|
|
(let ((s0-0 (-> this mid-minx))
|
|
(s2-0 (-> this mid-maxx))
|
|
(s1-0 (ocean-mid-camera-masks-bit? this arg1 arg2))
|
|
)
|
|
(cond
|
|
((ocean-mid-mask-ptrs-bit? this arg1 arg2)
|
|
)
|
|
((= arg2 s0-0)
|
|
(cond
|
|
(s1-0
|
|
(ocean-mid-add-upload-table this arg0 (+ arg1 -1) arg2 *ocean-down-table* 7 #t)
|
|
(ocean-mid-add-upload-table this arg0 arg1 (+ arg2 -1) *ocean-right-table* 7 #t)
|
|
)
|
|
(else
|
|
(let ((s2-1 (ocean-mid-mask-ptrs-bit? this (+ arg1 1) arg2))
|
|
(v1-12 (ocean-mid-mask-ptrs-bit? this arg1 (+ arg2 1)))
|
|
)
|
|
(cond
|
|
((and s2-1 v1-12)
|
|
)
|
|
(s2-1
|
|
(ocean-mid-add-upload-table this arg0 arg1 arg2 *ocean-right-table* 7 #t)
|
|
)
|
|
(v1-12
|
|
(ocean-mid-add-upload-table this arg0 arg1 arg2 *ocean-down-table* 7 #t)
|
|
)
|
|
(else
|
|
(ocean-mid-add-upload-table this arg0 arg1 arg2 *ocean-down-right-table* 10 #f)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
((= arg2 s2-0)
|
|
(cond
|
|
(s1-0
|
|
(ocean-mid-add-upload-table this arg0 (+ arg1 -1) arg2 *ocean-down-table* 7 #t)
|
|
(ocean-mid-add-upload-table this arg0 arg1 (+ arg2 1) *ocean-left-table* 7 #t)
|
|
)
|
|
(else
|
|
(let ((s2-2 (ocean-mid-mask-ptrs-bit? this (+ arg1 1) arg2))
|
|
(v1-27 (ocean-mid-mask-ptrs-bit? this arg1 (+ arg2 -1)))
|
|
)
|
|
(cond
|
|
((and s2-2 v1-27)
|
|
)
|
|
(s2-2
|
|
(ocean-mid-add-upload-table this arg0 arg1 arg2 *ocean-left-table* 7 #t)
|
|
)
|
|
(v1-27
|
|
(ocean-mid-add-upload-table this arg0 arg1 arg2 *ocean-down-table* 7 #t)
|
|
)
|
|
(else
|
|
(ocean-mid-add-upload-table this arg0 arg1 arg2 *ocean-down-left-table* 10 #t)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(s1-0
|
|
(ocean-mid-add-upload-table this arg0 (+ arg1 -1) arg2 *ocean-down-table* 7 #t)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod ocean-mid-add-upload-middle ((this ocean) (arg0 dma-buffer) (arg1 uint) (arg2 uint))
|
|
(let ((s0-0 (-> this mid-minx))
|
|
(s2-0 (-> this mid-maxx))
|
|
(s1-0 (ocean-mid-camera-masks-bit? this arg1 arg2))
|
|
)
|
|
(cond
|
|
((ocean-mid-mask-ptrs-bit? this arg1 arg2)
|
|
)
|
|
((= arg2 s0-0)
|
|
(cond
|
|
(s1-0
|
|
(ocean-mid-add-upload-table this arg0 arg1 (+ arg2 -1) *ocean-right-table* 7 #t)
|
|
)
|
|
((ocean-mid-mask-ptrs-bit? this arg1 (+ arg2 1))
|
|
)
|
|
(else
|
|
(ocean-mid-add-upload-table this arg0 arg1 arg2 *ocean-right-table* 7 #t)
|
|
)
|
|
)
|
|
)
|
|
((= arg2 s2-0)
|
|
(cond
|
|
(s1-0
|
|
(ocean-mid-add-upload-table this arg0 arg1 (+ arg2 1) *ocean-left-table* 7 #t)
|
|
)
|
|
((ocean-mid-mask-ptrs-bit? this arg1 (+ arg2 -1))
|
|
)
|
|
(else
|
|
(ocean-mid-add-upload-table this arg0 arg1 arg2 *ocean-left-table* 7 #t)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod ocean-mid-add-upload-bottom ((this ocean) (arg0 dma-buffer) (arg1 uint) (arg2 uint))
|
|
(let ((s0-0 (-> this mid-minx))
|
|
(s2-0 (-> this mid-maxx))
|
|
(s1-0 (ocean-mid-camera-masks-bit? this arg1 arg2))
|
|
)
|
|
(cond
|
|
((ocean-mid-mask-ptrs-bit? this arg1 arg2)
|
|
)
|
|
((= arg2 s0-0)
|
|
(cond
|
|
(s1-0
|
|
(ocean-mid-add-upload-table this arg0 (+ arg1 1) arg2 *ocean-up-table* 7 #t)
|
|
(ocean-mid-add-upload-table this arg0 arg1 (+ arg2 -1) *ocean-right-table* 7 #t)
|
|
)
|
|
(else
|
|
(let ((s2-1 (ocean-mid-mask-ptrs-bit? this (+ arg1 -1) arg2))
|
|
(v1-12 (ocean-mid-mask-ptrs-bit? this arg1 (+ arg2 1)))
|
|
)
|
|
(cond
|
|
((and s2-1 v1-12)
|
|
)
|
|
(s2-1
|
|
(ocean-mid-add-upload-table this arg0 arg1 arg2 *ocean-right-table* 7 #t)
|
|
)
|
|
(v1-12
|
|
(ocean-mid-add-upload-table this arg0 arg1 arg2 *ocean-up-table* 7 #t)
|
|
)
|
|
(else
|
|
(ocean-mid-add-upload-table this arg0 arg1 arg2 *ocean-up-right-table* 10 #t)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
((= arg2 s2-0)
|
|
(cond
|
|
(s1-0
|
|
(ocean-mid-add-upload-table this arg0 (+ arg1 1) arg2 *ocean-up-table* 7 #t)
|
|
(ocean-mid-add-upload-table this arg0 arg1 (+ arg2 1) *ocean-left-table* 7 #t)
|
|
)
|
|
(else
|
|
(let ((s2-2 (ocean-mid-mask-ptrs-bit? this (+ arg1 -1) arg2))
|
|
(v1-27 (ocean-mid-mask-ptrs-bit? this arg1 (+ arg2 -1)))
|
|
)
|
|
(cond
|
|
((and s2-2 v1-27)
|
|
)
|
|
(s2-2
|
|
(ocean-mid-add-upload-table this arg0 arg1 arg2 *ocean-left-table* 7 #t)
|
|
)
|
|
(v1-27
|
|
(ocean-mid-add-upload-table this arg0 arg1 arg2 *ocean-up-table* 7 #t)
|
|
)
|
|
(else
|
|
(ocean-mid-add-upload-table this arg0 arg1 arg2 *ocean-up-left-table* 10 #f)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(s1-0
|
|
(ocean-mid-add-upload-table this arg0 (+ arg1 1) arg2 *ocean-up-table* 7 #t)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod ocean-seams-add-constants ((this ocean) (arg0 dma-buffer))
|
|
(let* ((a2-0 4)
|
|
(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 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 #x2fd :cmd (vif-cmd unpack-v4-32) :num a2-0)
|
|
)
|
|
(set! (-> v1-0 base) (&+ (the-as pointer a0-1) 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)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod draw-ocean-mid-seams ((this ocean) (arg0 dma-buffer))
|
|
(local-vars (sv-32 uint) (sv-33 uint) (sv-34 uint) (sv-35 uint) (sv-36 sphere))
|
|
(ocean-seams-add-constants this arg0)
|
|
(set! sv-32 (-> this mid-minx))
|
|
(set! sv-33 (-> this mid-maxx))
|
|
(set! sv-34 (-> this mid-minz))
|
|
(set! sv-35 (-> this mid-maxz))
|
|
(set! sv-36 (new 'stack 'sphere))
|
|
(set! (-> sv-36 y) (-> this start-corner y))
|
|
(set! (-> sv-36 r) 278045.7)
|
|
(let ((s4-0 sv-34)
|
|
(s3-0 sv-35)
|
|
)
|
|
(while (>= s3-0 s4-0)
|
|
(let ((s2-0 sv-32)
|
|
(s1-0 sv-33)
|
|
)
|
|
(while (>= s1-0 s2-0)
|
|
(set! (-> sv-36 x) (+ 196608.0 (* 393216.0 (the float s2-0)) (-> this start-corner x)))
|
|
(set! (-> sv-36 z) (+ 196608.0 (* 393216.0 (the float s4-0)) (-> this start-corner z)))
|
|
(when (sphere-cull-for-ocean sv-36) ;; modified
|
|
(cond
|
|
((= s4-0 sv-34)
|
|
(ocean-mid-add-upload-top this arg0 s4-0 s2-0)
|
|
)
|
|
((= s4-0 sv-35)
|
|
(ocean-mid-add-upload-bottom this arg0 s4-0 s2-0)
|
|
)
|
|
(else
|
|
(ocean-mid-add-upload-middle this arg0 s4-0 s2-0)
|
|
)
|
|
)
|
|
)
|
|
(+! s2-0 1)
|
|
)
|
|
)
|
|
(+! s4-0 1)
|
|
)
|
|
)
|
|
(dotimes (v1-29 36)
|
|
(if (and (-> this mid-mask-ptrs v1-29) (nonzero? (-> this mid-camera-masks v1-29)))
|
|
(logior! (-> (the-as (pointer uint64) (-> this mid-mask-ptrs v1-29))) (-> this mid-camera-masks v1-29))
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod draw-ocean-mid ((this ocean) (arg0 dma-buffer))
|
|
(local-vars (v1-8 float) (v1-9 float) (sv-32 int))
|
|
(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! (-> this mid-mask-ptrs v1-0) (the-as pointer #f))
|
|
(set! (-> this 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 this arg0)
|
|
(ocean-mid-add-call this arg0 0)
|
|
(let ((v1-7 *math-camera*))
|
|
(cond
|
|
((-> *time-of-day-context* use-camera-other)
|
|
(.lvf vf16 (&-> v1-7 plane-other 0 quad))
|
|
(.lvf vf17 (&-> v1-7 plane-other 1 quad))
|
|
(.lvf vf18 (&-> v1-7 plane-other 2 quad))
|
|
(.lvf vf19 (&-> v1-7 plane-other 3 quad))
|
|
(.lvf vf20 (&-> v1-7 guard-plane-other 0 quad))
|
|
(.lvf vf21 (&-> v1-7 guard-plane-other 1 quad))
|
|
(.lvf vf22 (&-> v1-7 guard-plane-other 2 quad))
|
|
(.lvf vf23 (&-> v1-7 guard-plane-other 3 quad))
|
|
(.mov v1-8 vf23)
|
|
)
|
|
(else
|
|
(.lvf vf16 (&-> v1-7 plane 0 quad))
|
|
(.lvf vf17 (&-> v1-7 plane 1 quad))
|
|
(.lvf vf18 (&-> v1-7 plane 2 quad))
|
|
(.lvf vf19 (&-> v1-7 plane 3 quad))
|
|
(.lvf vf20 (&-> v1-7 guard-plane 0 quad))
|
|
(.lvf vf21 (&-> v1-7 guard-plane 1 quad))
|
|
(.lvf vf22 (&-> v1-7 guard-plane 2 quad))
|
|
(.lvf vf23 (&-> v1-7 guard-plane 3 quad))
|
|
(.mov v1-9 vf23)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0))
|
|
(let ((s4-0 (-> *math-camera* trans)))
|
|
(dotimes (s3-0 6)
|
|
(dotimes (s2-0 6)
|
|
(let* ((s1-0 (+ (* 6 s3-0) s2-0))
|
|
(s0-0 (-> this ocean-spheres spheres s1-0))
|
|
)
|
|
(set! sv-32 (-> (the-as (pointer int16) (+ (* s1-0 2) (the-as int (-> this ocean-mid-indices))))))
|
|
(when (sphere-cull-for-ocean s0-0) ;; modified
|
|
(cond
|
|
((< sv-32 0)
|
|
)
|
|
((let ((f30-0 (- (vector-vector-distance s0-0 s4-0) (-> s0-0 r))))
|
|
(let ((a0-16 this)
|
|
(t9-5 (method-of-type ocean ocean-mid-add-upload))
|
|
(a1-8 arg0)
|
|
(a2-2 s3-0)
|
|
(a3-0 s2-0)
|
|
(t2-0 f30-0)
|
|
)
|
|
(t9-5 a0-16 a1-8 a2-2 a3-0 sv-32 s1-0 t2-0)
|
|
)
|
|
(< f30-0 786432.0)
|
|
)
|
|
(ocean-mid-add-call this 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 this arg0 46)
|
|
(+! (-> *terrain-stats* ocean-mid fragments) 1)
|
|
(+! (-> *terrain-stats* ocean-mid tris) 128)
|
|
(+! (-> *terrain-stats* ocean-mid dverts) 144)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(when (not (or (-> this near-off) (< 196608.0 (fabs (- (-> this start-corner y) (-> *math-camera* trans y))))))
|
|
(let ((a1-11 48)
|
|
(a2-5 0)
|
|
(v1-53 48)
|
|
(a0-25 0)
|
|
)
|
|
(dotimes (a3-1 6)
|
|
(dotimes (t0-1 6)
|
|
(let ((t1-6 (&-> this 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-53)
|
|
(set! v1-53 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-5 t5-9)
|
|
(set! a2-5 t5-9)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> this mid-minx) (the-as uint a1-11))
|
|
(set! (-> this mid-maxx) (the-as uint a2-5))
|
|
(set! (-> this mid-minz) (the-as uint v1-53))
|
|
(set! (-> this mid-maxz) (the-as uint a0-25))
|
|
(when (and (< a1-11 a2-5) (< v1-53 a0-25))
|
|
(ocean-mid-add-call-flush this arg0 (the-as uint 41))
|
|
(ocean-mid-add-call-flush this arg0 (the-as uint 43))
|
|
(draw-ocean-transition this arg0)
|
|
(draw-ocean-mid-seams this arg0)
|
|
)
|
|
)
|
|
)
|
|
(ocean-mid-add-call-flush this arg0 (the-as uint 41))
|
|
0
|
|
(none)
|
|
)
|
|
)
|