jak-project/goal_src/jak3/engine/gfx/ocean/ocean-transition.gc
Hat Kid 58a5440c8a
decomp3: more misc files (#3466)
Makes a bunch of missions mostly playable, including:
- `arena-training-1`
- `arena-fight-1`
- `wascity-chase`
- `arena-fight-2`
- `arena-fight-3`
- `volcano-darkeco`
- `desert-hover`
- `nest-eggs`
- `temple-climb`
- `temple-oracle`
- `temple-tests`
- `desert-beast-battle`
- `desert-turtle-training`
- `desert-course-race`
- `desert-artifact-race1`
- `wascity-leaper-race`
- `wascity-pre-game`
- `sewer-met-hum`
- `forest-kill-plants`
- `forest-ring-chase`
- `temple-defend`
- `tower-destroy`
- `desert-glide`

---
Files:

- `ripple`
- `waswide-mood`
- `sig-rider`
- `nst-tasks`
- `nst-part`
- `nst-gas`
- `nst-eggs-h`
- `nst-obs`
- `nst-mood`
- `egg-spider`
- `wasdoors-init`
- `wasall-tasks`
- `wvehicle-race`
- `wcar-marauder`
- `wcar-marauder-b`
- `turret-control`
- `was-squad-control`
- `turtle-training`
- `kleever-rider`
- `course-race`
- `artifact-race`
- `desert-hover`
- `desbeast-path-h`
- `des-beast`
- `desertg-obs`
- `desertf-obs`
- `desertd-obs`
- `desert-dust-storm`
- `des-cactus`
- `race-hud`
- `race-info`
- `race-manager`
- `tizard`
- `flyingsaw`
- `hover-training`
- `temple-mood`
- `temple-obs`
- `temple-obs2`
- `temple-part`
- `temple-scenes`
- `templex-mood`
- `templex-obs`
- `templex-part`
- `tomb-baby-spider`
- `target-turret-shot`
- `target-turret`
- `beast-battle-path`
- `des-beast-2`
- `mh-flyer`
- `scorpion-gun`
- `hover-enemy-h`
- `hover-enemy`
- `hover-formation-h`
- `hover-formation`
- `hover-nav-control-h`
- `hover-nav-control`
- `flamer-hover`
- `hover-nav-templea`
- `robo-hover`
- `hover-nav-sewb`
- `hover-nav-sewg`
- `hover-nav-sewj`
- `hover-nav-sewl`
- `hover-nav-sewo`
- `hover-nav-towera`
- `tower-mood`
- `tower-obs`
- `tower-scenes`
- `tower-part`
- `eco-green-collider`
- `forest-bridges`
- `forest-kill-plants`
- `forest-mood`
- `forest-ring-chase`
- `forest-tasks`
- `forest-part`
- `foresta-obs`
- `hover-nav-foresta`
- `mh-plant`
- `dp-bipedal-part`
- `dp-bipedal-shot`
- `dp-bipedal`
- `neo-spawner`
- `for-turret`
- `for-turret-shot`
- `neo-wasp`
- `neo-wasp-part`
- `volcanox-scenes`
- `volcanox-mood`
- `volcano-scenes`
- `volcano-mood`
- `volcano-obs`
- `volcano-obs2`
- `chain-physics`
- `rigid-body-plat`
- `volcano-part`
- `flamer-lava`
- `flitter`
- `spiky-frog`
- `flut-wild`
- `target-indax`
- `target-indax-hang`
- `mantis`
- `volcanox-obs`
- `spyder`
- `wcar-faccar`
- `mhcity-obs2`
- `mhcity-part`
- `mhcity-obs`
- `dm-mine-spider`
- `rapid-gunner`
- `stadium-mood`
- `stadium-scenes`
- `stadiuma-mood`
- `stadiuma-part`
- `kanga-lizard`
- `marauder`
- `arena-scenes`
- `wasstada-mood`
- `wasstada-obs`
- `wasstada-part`
- `wasstadb-obs`
- `wasstadc-obs`
- `dm-flyer`
- `maker-part`
- `maker-projectile`
- `skeet-part`
- `wascity-turret`
- `wasgun-h`
- `wasgun-hud`
- `wasgun-manager`
- `nav-graph-h`
- `traffic-engine-h`
- `waswide-init`
- `cty-borrow-manager-h`
- `cty-borrow-manager`
- `desert-part`
- `height-map-h`
- `height-map`
- `traffic-height-map`
- `vehicle-control`
- `hvehicle-h`
- `hvehicle`
- `hvehicle-effects`
- `hvehicle-physics`
- `hvehicle-util`
- `glider-h`
- `glider-hud`
- `glider-manager`
- `glider-ring`
- `glider-ring-part`
- `h-glider`
- `hanga-init`
- `was-pre-game`
- `was-leaper-race`
- `flut-racer`
- `desert-scenes`
- `desert-lizard-h`
- `desert-lizard-task`
- `desert-lizard`
- `throne-scenes`
- `waspal-mood`
- `waspala-obs`
- `waspala-part`
- `deswalk-obs`
- `deswalk-part`
- `terraformer-drone`
- `terraformer-head`
- `terraformer-part`
- `terraformer-setup`
2024-04-22 18:43:51 +02:00

853 lines
28 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: ocean-transition.gc
;; name in dgo: ocean-transition
;; dgos: GAME
;; DECOMP BEGINS
(defmethod ocean-trans-camera-masks-bit? ((this ocean) (arg0 uint) (arg1 uint))
(let ((v1-2 (- arg0 (* (-> this mid-minz) 4)))
(a1-3 (- arg1 (* (-> this mid-minx) 4)))
)
(cond
((or (< v1-2 0) (>= v1-2 (the-as uint 16)) (< a1-3 0) (>= a1-3 (the-as uint 16)))
#f
)
(else
(let* ((t0-0 (shr v1-2 2))
(a3-3 (shr a1-3 2))
(a2-2 (logand v1-2 3))
(v1-3 (the-as int (logand a1-3 3)))
(a1-5 (+ (* t0-0 4) a3-3))
)
(logtest? (-> (the-as (pointer uint8) (+ (+ a2-2 (* a1-5 4)) (the-as uint this))) 2928) (ash 1 v1-3))
)
)
)
)
)
(defmethod ocean-trans-mask-ptrs-bit? ((this ocean) (arg0 int) (arg1 int))
(let ((v1-2 (- arg0 (the-as int (* (-> this mid-minz) 4))))
(a1-3 (- arg1 (the-as int (* (-> this mid-minx) 4))))
)
(cond
((or (< (the-as uint v1-2) 0)
(>= (the-as uint v1-2) (the-as uint 16))
(< (the-as uint a1-3) 0)
(>= (the-as uint a1-3) (the-as uint 16))
)
#f
)
(else
(let* ((t0-0 (shr v1-2 2))
(a3-3 (shr a1-3 2))
(a2-2 (logand v1-2 3))
(v1-3 (logand a1-3 3))
(a0-2 (-> this trans-mask-ptrs (+ (* (+ (* t0-0 4) a3-3) 4) a2-2)))
)
(if a0-2
(logtest? (-> (the-as (pointer int32) a0-2) 1) (ash 1 v1-3))
#f
)
)
)
)
)
)
(defmethod ocean-trans-mask-ptrs-set! ((this ocean) (arg0 uint) (arg1 uint))
(let ((v1-2 (- arg0 (* (-> this mid-minz) 4)))
(a1-3 (- arg1 (* (-> this mid-minx) 4)))
)
(cond
((or (< v1-2 0) (>= v1-2 (the-as uint 16)) (< a1-3 0) (>= a1-3 (the-as uint 16)))
#f
)
(else
(let* ((a3-3 (shr v1-2 2))
(a2-2 (shr a1-3 2))
(v1-3 (logand v1-2 3))
(a1-4 (the-as int (logand a1-3 3)))
(t0-6 (-> this trans-mask-ptrs (+ (* (+ (* a3-3 4) a2-2) 4) v1-3)))
)
(cond
(t0-6
(cond
((logtest? (-> (the-as (pointer int32) t0-6) 1) (ash 1 a1-4))
#f
)
(else
(let ((a0-1 (&-> this trans-temp-masks (+ (* a3-3 4) a2-2))))
(set! (-> (the-as (pointer int8) (+ v1-3 (the-as uint a0-1))) 0)
(the-as int (logior (-> (the-as (pointer uint8) (+ v1-3 (the-as uint a0-1))) 0) (ash 1 a1-4)))
)
)
#t
)
)
)
(else
#f
)
)
)
)
)
)
)
(defmethod ocean-trans-add-upload-table ((this ocean) (arg0 dma-buffer) (arg1 uint) (arg2 uint) (arg3 int) (arg4 int) (arg5 symbol))
(local-vars
(v1-16 (inline-array vector4w))
(v1-18 float)
(a0-24 uint128)
(a0-25 uint128)
(a1-14 uint128)
(a1-15 uint128)
(a1-16 uint128)
(a2-17 uint128)
(a2-18 uint128)
(a3-9 uint128)
)
(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)
)
(when (ocean-trans-mask-ptrs-set! this arg1 arg2)
(let ((a2-2 (new-stack-vector0)))
(let ((v1-2 (-> this start-corner)))
(set! (-> a2-2 x) (+ (-> v1-2 x) (* 98304.0 (the float arg2))))
(set! (-> a2-2 y) (-> v1-2 y))
(set! (-> a2-2 z) (+ (-> v1-2 z) (* 98304.0 (the float arg1))))
)
(set! (-> a2-2 w) 1.0)
(ocean-mid-add-matrices this arg0 a2-2)
)
(let* ((a1-3 9)
(v1-7 arg0)
(a0-4 (the-as object (-> v1-7 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-7 base) (&+ (the-as pointer a0-4) 16))
)
(set-vector! (the-as vector4w (-> arg0 base)) arg4 0 0 0)
(&+! (-> arg0 base) 16)
(let* ((a0-6 (logand arg1 3))
(v1-11 (logand arg2 3))
(v1-12 (+ (* 5 (the-as int a0-6)) v1-11))
)
(.lvf vf5 (&-> (-> *ocean-trans-corner-table* 0 vector v1-12) quad))
(.lvf vf6 (&-> (-> *ocean-trans-corner-table* 0 vector (+ v1-12 1)) quad))
(.lvf vf7 (&-> (-> *ocean-trans-corner-table* 0 vector (+ v1-12 5)) quad))
(.lvf vf8 (&-> (the-as (inline-array vector4w) (-> *ocean-trans-corner-table* 0 vector (+ v1-12 6))) 0 quad))
)
(.mov v1-16 vf8)
(let ((v1-17 (the-as (inline-array vector4w) (-> arg0 base))))
(let ((a0-17 (/ (the-as int arg1) 4))
(a1-11 (/ (the-as int arg2) 4))
)
(.lvf vf1 (&-> *ocean-trans-st-table* 0 quad))
(.lvf vf2 (&-> *ocean-trans-st-table* 1 quad))
(.lvf vf3 (&-> *ocean-trans-st-table* 2 quad))
(.lvf vf4 (&-> *ocean-trans-st-table* 3 quad))
(.mul.x.vf acc vf1 vf5)
(nop!)
(.add.mul.y.vf acc vf2 vf5 acc)
(nop!)
(.add.mul.z.vf acc vf3 vf5 acc)
(nop!)
(.add.mul.w.vf vf9 vf4 vf5 acc)
(nop!)
(.mul.x.vf acc vf1 vf6)
(nop!)
(.add.mul.y.vf acc vf2 vf6 acc)
(nop!)
(.add.mul.z.vf acc vf3 vf6 acc)
(nop!)
(.add.mul.w.vf vf10 vf4 vf6 acc)
(.svf (&-> v1-17 0 quad) vf9)
(.mul.x.vf acc vf1 vf7)
(nop!)
(.add.mul.y.vf acc vf2 vf7 acc)
(nop!)
(.add.mul.z.vf acc vf3 vf7 acc)
(nop!)
(.add.mul.w.vf vf11 vf4 vf7 acc)
(.svf (&-> v1-17 1 quad) vf10)
(.mul.x.vf acc vf1 vf8)
(nop!)
(.add.mul.y.vf acc vf2 vf8 acc)
(nop!)
(.add.mul.z.vf acc vf3 vf8 acc)
(nop!)
(.add.mul.w.vf vf12 vf4 vf8 acc)
(.svf (&-> v1-17 2 quad) vf11)
(nop!)
(.svf (&-> v1-17 3 quad) vf12)
(let ((a2-16 (the-as uint128 (-> this ocean-colors colors (+ (* 52 (the-as int a0-17)) a1-11))))
(a3-8 (the-as uint128 (-> this ocean-colors colors (+ a1-11 1 (* 52 (the-as int a0-17))))))
(t0-9 (the-as uint128 (-> this ocean-colors colors (+ (* 52 (the-as int (+ a0-17 1))) a1-11))))
(a0-23 (the-as uint128 (-> this ocean-colors colors (+ a1-11 1 (* 52 (the-as int (+ a0-17 1)))))))
)
(.pextlb a1-14 0 a2-16)
(nop!)
(.pextlb a2-17 0 a3-8)
(nop!)
(.pextlb a3-9 0 t0-9)
(nop!)
(.pextlb a0-24 0 a0-23)
)
)
(nop!)
(.pextlh a1-15 0 a1-14)
(nop!)
(.pextlh a2-18 0 a2-17)
(.mov vf1 a1-15)
(.pextlh a1-16 0 a3-9)
(.mov vf2 a2-18)
(.pextlh a0-25 0 a0-24)
(.mov vf3 a1-16)
(nop!)
(.mov vf4 a0-25)
(.itof.vf vf1 vf1)
(nop!)
(.itof.vf vf2 vf2)
(nop!)
(.itof.vf vf3 vf3)
(nop!)
(.itof.vf vf4 vf4)
(nop!)
(.mul.x.vf acc vf1 vf5)
(nop!)
(.add.mul.y.vf acc vf2 vf5 acc)
(nop!)
(.add.mul.z.vf acc vf3 vf5 acc)
(nop!)
(.add.mul.w.vf vf9 vf4 vf5 acc)
(nop!)
(.mul.x.vf acc vf1 vf6)
(nop!)
(.add.mul.y.vf acc vf2 vf6 acc)
(nop!)
(.add.mul.z.vf acc vf3 vf6 acc)
(nop!)
(.add.mul.w.vf vf10 vf4 vf6 acc)
(.svf (&-> v1-17 4 quad) vf9)
(.mul.x.vf acc vf1 vf7)
(nop!)
(.add.mul.y.vf acc vf2 vf7 acc)
(nop!)
(.add.mul.z.vf acc vf3 vf7 acc)
(nop!)
(.add.mul.w.vf vf11 vf4 vf7 acc)
(.svf (&-> v1-17 5 quad) vf10)
(.mul.x.vf acc vf1 vf8)
(nop!)
(.add.mul.y.vf acc vf2 vf8 acc)
(nop!)
(.add.mul.z.vf acc vf3 vf8 acc)
(nop!)
(.add.mul.w.vf vf12 vf4 vf8 acc)
(.svf (&-> v1-17 6 quad) vf11)
(nop!)
(.svf (&-> v1-17 7 quad) vf12)
)
(.mov v1-18 vf12)
(&+! (-> arg0 base) 128)
(let* ((v1-21 arg0)
(a0-26 (the-as object (-> v1-21 base)))
)
(set! (-> (the-as dma-packet a0-26) dma) (new 'static 'dma-tag :id (dma-tag-id ref) :addr arg3 :qwc arg4))
(set! (-> (the-as dma-packet a0-26) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
(set! (-> (the-as dma-packet a0-26) vif1)
(new 'static 'vif-tag :imm #x8011 :cmd (vif-cmd unpack-v4-32) :num arg4)
)
(set! (-> v1-21 base) (&+ (the-as pointer a0-26) 16))
)
(if arg5
(ocean-mid-add-call this arg0 275)
(ocean-mid-add-call this arg0 107)
)
)
(none)
)
)
(defmethod ocean-trans-add-upload-strip ((this ocean) (arg0 dma-buffer) (arg1 uint) (arg2 uint) (arg3 int) (arg4 int) (arg5 int))
(local-vars
(v1-10 float)
(a0-24 uint128)
(a0-25 uint128)
(a0-26 uint128)
(a1-12 uint128)
(a1-13 uint128)
(a1-14 uint128)
(a2-15 uint128)
(a3-10 uint128)
)
(rlet ((vf1 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
)
(let ((a2-1 (new-stack-vector0)))
(let ((v1-0 (-> this start-corner)))
(set! (-> a2-1 x) (+ (-> v1-0 x) (* 393216.0 (the float arg2))))
(set! (-> a2-1 y) (-> v1-0 y))
(set! (-> a2-1 z) (+ (-> v1-0 z) (* 393216.0 (the float arg1))))
)
(set! (-> a2-1 w) 1.0)
(ocean-mid-add-matrices this arg0 a2-1)
)
(let* ((a1-2 9)
(v1-5 arg0)
(a0-3 (the-as object (-> v1-5 base)))
)
(set! (-> (the-as dma-packet a0-3) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a1-2))
(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-2)
)
(set! (-> v1-5 base) (&+ (the-as pointer a0-3) 16))
)
(let ((v1-6 (the-as object (-> arg0 base))))
(set! (-> this trans-mask-ptrs (+ (* arg4 4) arg5)) (the-as pointer v1-6))
(set! (-> (the-as vector4w v1-6) x) 10)
(set! (-> (the-as vector4w v1-6) y) arg3)
(set! (-> (the-as vector4w v1-6) z) 0)
(set! (-> (the-as vector4w v1-6) w) 0)
)
(&+! (-> arg0 base) 16)
(let ((v1-9 (the-as (inline-array vector4w) (-> arg0 base))))
(set! (-> v1-9 0 quad) (-> *ocean-trans-st-table* 0 quad))
(set! (-> v1-9 1 quad) (-> *ocean-trans-st-table* 1 quad))
(set! (-> v1-9 2 quad) (-> *ocean-trans-st-table* 2 quad))
(set! (-> v1-9 3 quad) (-> *ocean-trans-st-table* 3 quad))
(let ((a0-23 (the-as uint128 (-> this ocean-colors colors (+ (* 52 (the-as int arg1)) arg2))))
(a1-11 (the-as uint128 (-> this ocean-colors colors (+ arg2 1 (* 52 (the-as int arg1))))))
(a2-14 (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-24 0 a0-23)
(nop!)
(.pextlb a1-12 0 a1-11)
(nop!)
(.pextlb a2-15 0 a2-14)
(nop!)
(.pextlb a3-10 0 a3-9)
)
(nop!)
(.pextlh a0-25 0 a0-24)
(nop!)
(.pextlh a1-13 0 a1-12)
(.mov vf1 a0-25)
(.pextlh a0-26 0 a2-15)
(.mov vf2 a1-13)
(.pextlh a1-14 0 a3-10)
(.mov vf3 a0-26)
(nop!)
(.mov vf4 a1-14)
(.itof.vf vf1 vf1)
(nop!)
(.itof.vf vf2 vf2)
(nop!)
(.itof.vf vf3 vf3)
(nop!)
(.itof.vf vf4 vf4)
(nop!)
(nop!)
(.svf (&-> v1-9 4 quad) vf1)
(nop!)
(.svf (&-> v1-9 5 quad) vf2)
(nop!)
(.svf (&-> v1-9 6 quad) vf3)
(nop!)
(.svf (&-> v1-9 7 quad) vf4)
)
(.mov v1-10 vf4)
(&+! (-> arg0 base) 128)
(let* ((a1-15 10)
(v1-13 arg0)
(a0-27 (the-as object (-> v1-13 base)))
)
(set! (-> (the-as dma-packet a0-27) dma)
(new 'static 'dma-tag
:id (dma-tag-id ref)
:addr (the-as int (+ (+ (* 160 arg5) 0) (the-as int *ocean-trans-strip-array*)))
:qwc a1-15
)
)
(set! (-> (the-as dma-packet a0-27) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
(set! (-> (the-as dma-packet a0-27) vif1)
(new 'static 'vif-tag :imm #x8011 :cmd (vif-cmd unpack-v4-32) :num a1-15)
)
(set! (-> v1-13 base) (&+ (the-as pointer a0-27) 16))
)
(ocean-mid-add-call this arg0 107)
0
(none)
)
)
(defmethod ocean-transition-check ((this ocean) (arg0 ocean-trans-mask) (arg1 int) (arg2 int) (arg3 vector))
(local-vars (v1-13 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) (* 98304.0 (the float arg1))))
(set! (-> v1-0 y) (-> arg3 y))
(set! (-> v1-0 z) (+ (-> arg3 z) (* 98304.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 19327350000.0)
(logior! (-> arg0 mask arg2) (ash 1 arg1))
(goto cfg-24)
)
(+! (-> v1-0 x) 98304.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 19327350000.0)
(logior! (-> arg0 mask arg2) (ash 1 arg1))
(goto cfg-24)
)
(+! (-> v1-0 z) 98304.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 19327350000.0)
(logior! (-> arg0 mask arg2) (ash 1 arg1))
(goto cfg-24)
)
(+! (-> v1-0 x) -98304.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-13 vf1)
(when (< v1-13 19327350000.0)
(logior! (-> arg0 mask arg2) (ash 1 arg1))
(goto cfg-24)
)
(label cfg-24)
0
(none)
)
)
(defmethod ocean-make-trans-camera-masks ((this ocean) (arg0 uint) (arg1 uint) (arg2 uint) (arg3 uint))
(local-vars (sv-48 ocean-trans-mask) (sv-52 vector) (sv-56 vector) (sv-60 vector))
(set! sv-48 (the-as ocean-trans-mask (&-> this trans-camera-masks (+ (* arg2 4) arg3))))
(set! sv-52 (-> *math-camera* trans))
(set! sv-56 (new-stack-vector0))
(set! sv-60 (new-stack-vector0))
(set! (-> sv-56 x) (+ (-> this start-corner x) (* 393216.0 (the float arg1))))
(set! (-> sv-56 y) (-> this start-corner y))
(set! (-> sv-56 z) (+ (-> this start-corner z) (* 393216.0 (the float arg0))))
(set! (-> sv-56 w) 1.0)
(dotimes (s5-0 4)
(dotimes (s4-0 4)
(set! (-> sv-60 x) (- (+ (-> sv-56 x) (* 98304.0 (the float s4-0))) (-> sv-52 x)))
(set! (-> sv-60 y) (- (-> sv-56 y) (-> sv-52 y)))
(set! (-> sv-60 z) (- (+ (-> sv-56 z) (* 98304.0 (the float s5-0))) (-> sv-52 z)))
(ocean-transition-check this sv-48 s4-0 s5-0 sv-56)
)
)
0
(none)
)
(defmethod ocean-trans-add-upload ((this ocean) (arg0 dma-buffer) (arg1 uint) (arg2 uint))
(when (not (ocean-trans-mask-ptrs-bit? this (the-as int arg1) (the-as int arg2)))
(let ((s0-0 (ocean-trans-camera-masks-bit? this (+ arg1 -1) arg2))
(s1-0 (ocean-trans-camera-masks-bit? this (+ arg1 1) arg2))
(s2-0 (ocean-trans-camera-masks-bit? this arg1 (+ arg2 -1)))
(a0-6 (ocean-trans-camera-masks-bit? this arg1 (+ arg2 1)))
(v1-7 0)
)
(if s0-0
(+! v1-7 1)
)
(if s1-0
(+! v1-7 2)
)
(if s2-0
(+! v1-7 4)
)
(if a0-6
(+! v1-7 8)
)
(cond
((= v1-7 1)
(if (not (ocean-trans-mask-ptrs-bit? this (the-as int (+ arg1 -1)) (the-as int arg2)))
(ocean-trans-add-upload-table this arg0 arg1 arg2 (the-as int *ocean-trans-up-table*) 11 #t)
)
)
((= v1-7 2)
(if (not (ocean-trans-mask-ptrs-bit? this (the-as int (+ arg1 1)) (the-as int arg2)))
(ocean-trans-add-upload-table this arg0 arg1 arg2 (the-as int *ocean-trans-down-table*) 11 #t)
)
)
((= v1-7 4)
(if (not (ocean-trans-mask-ptrs-bit? this (the-as int arg1) (the-as int (+ arg2 -1))))
(ocean-trans-add-upload-table this arg0 arg1 arg2 (the-as int *ocean-trans-left-table*) 11 #t)
)
)
((= v1-7 5)
(let ((s2-1 (ocean-trans-mask-ptrs-bit? this (the-as int (+ arg1 -1)) (the-as int arg2)))
(v1-25 (ocean-trans-mask-ptrs-bit? this (the-as int arg1) (the-as int (+ arg2 -1))))
)
(cond
((and s2-1 v1-25)
)
(s2-1
(ocean-trans-add-upload-table this arg0 arg1 arg2 (the-as int *ocean-trans-left-table*) 11 #t)
)
(v1-25
(ocean-trans-add-upload-table this arg0 arg1 arg2 (the-as int *ocean-trans-up-table*) 11 #t)
)
(else
(ocean-trans-add-upload-table this arg0 arg1 arg2 (the-as int *ocean-trans-up-left-table*) 18 #f)
)
)
)
)
((= v1-7 6)
(let ((s2-2 (ocean-trans-mask-ptrs-bit? this (the-as int (+ arg1 1)) (the-as int arg2)))
(v1-35 (ocean-trans-mask-ptrs-bit? this (the-as int arg1) (the-as int (+ arg2 -1))))
)
(cond
((and s2-2 v1-35)
)
(s2-2
(ocean-trans-add-upload-table this arg0 arg1 arg2 (the-as int *ocean-trans-left-table*) 11 #t)
)
(v1-35
(ocean-trans-add-upload-table this arg0 arg1 arg2 (the-as int *ocean-trans-down-table*) 11 #t)
)
(else
(ocean-trans-add-upload-table this arg0 arg1 arg2 (the-as int *ocean-trans-down-left-table*) 18 #t)
)
)
)
)
((= v1-7 8)
(if (not (ocean-trans-mask-ptrs-bit? this (the-as int arg1) (the-as int (+ arg2 1))))
(ocean-trans-add-upload-table this arg0 arg1 arg2 (the-as int *ocean-trans-right-table*) 11 #t)
)
)
((= v1-7 9)
(let ((s2-3 (ocean-trans-mask-ptrs-bit? this (the-as int (+ arg1 -1)) (the-as int arg2)))
(v1-50 (ocean-trans-mask-ptrs-bit? this (the-as int arg1) (the-as int (+ arg2 1))))
)
(cond
((and s2-3 v1-50)
)
(s2-3
(ocean-trans-add-upload-table this arg0 arg1 arg2 (the-as int *ocean-trans-right-table*) 11 #t)
)
(v1-50
(ocean-trans-add-upload-table this arg0 arg1 arg2 (the-as int *ocean-trans-up-table*) 11 #t)
)
(else
(ocean-trans-add-upload-table this arg0 arg1 arg2 (the-as int *ocean-trans-up-right-table*) 18 #t)
)
)
)
)
((= v1-7 10)
(let ((s2-4 (ocean-trans-mask-ptrs-bit? this (the-as int (+ arg1 1)) (the-as int arg2)))
(v1-61 (ocean-trans-mask-ptrs-bit? this (the-as int arg1) (the-as int (+ arg2 1))))
)
(cond
((and s2-4 v1-61)
)
(s2-4
(ocean-trans-add-upload-table this arg0 arg1 arg2 (the-as int *ocean-trans-right-table*) 11 #t)
)
(v1-61
(ocean-trans-add-upload-table this arg0 arg1 arg2 (the-as int *ocean-trans-down-table*) 11 #t)
)
(else
(ocean-trans-add-upload-table this arg0 arg1 arg2 (the-as int *ocean-trans-down-right-table*) 18 #f)
)
)
)
)
)
)
)
0
(none)
)
(defmethod draw-ocean-transition-seams ((this ocean) (arg0 dma-buffer))
(local-vars (sv-32 uint) (sv-33 uint) (sv-34 uint) (sv-35 uint) (sv-36 sphere))
(set! sv-32 (-> this near-minx))
(set! sv-33 (-> this near-maxx))
(set! sv-34 (-> this near-minz))
(set! sv-35 (-> this near-maxz))
(set! sv-36 (new 'stack 'sphere))
(set! (-> sv-36 y) (-> this start-corner y))
(set! (-> sv-36 r) 69511.42)
(when (and (< sv-32 sv-33) (< sv-34 sv-35))
(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) (+ 49152.0 (* 98304.0 (the float s2-0)) (-> this start-corner x)))
(set! (-> sv-36 z) (+ 49152.0 (* 98304.0 (the float s4-0)) (-> this start-corner z)))
(when (sphere-cull sv-36)
(if (not (ocean-trans-camera-masks-bit? this s4-0 s2-0))
(ocean-trans-add-upload this arg0 s4-0 s2-0)
)
)
(+! s2-0 1)
)
)
(+! s4-0 1)
)
)
)
(dotimes (v1-28 16)
(when (nonzero? (-> this trans-camera-masks v1-28))
(dotimes (a0-12 4)
(let ((a1-8 (-> this trans-mask-ptrs (+ (* v1-28 4) a0-12))))
(if a1-8
(logior!
(-> (the-as (pointer int32) a1-8) 1)
(-> (the-as (pointer uint8) (+ (+ a0-12 (* v1-28 4)) (the-as int this))) 2992)
)
)
)
)
)
)
0
(none)
)
(defmethod ocean-trans-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 (the-as matrix (-> arg0 base))))
(set-vector! (-> v1-1 rvec) 0.0 0.0 0.0 1.0)
(set-vector! (-> v1-1 uvec) 98304.0 0.0 0.0 1.0)
(set-vector! (-> v1-1 fvec) 0.0 0.0 98304.0 1.0)
(set-vector! (-> v1-1 trans) 98304.0 0.0 98304.0 1.0)
)
(&+! (-> arg0 base) 64)
0
(none)
)
(defmethod draw-ocean-transition ((this ocean) (arg0 dma-buffer))
(local-vars
(sv-32 uint)
(sv-33 uint)
(sv-34 uint)
(sv-35 uint)
(sv-36 sphere)
(sv-40 ocean-trans-mask)
(sv-44 uint)
(sv-48 int)
)
(dotimes (v1-0 16)
(set! (-> this trans-camera-masks v1-0) (the-as ocean-trans-mask 0))
(set! (-> this near-mask-indices v1-0) (the-as uint -1))
)
(dotimes (v1-3 64)
(set! (-> this trans-mask-ptrs v1-3) (the-as pointer #f))
)
(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)
(when (not (ocean-mid-mask-ptrs-bit? this s4-0 s2-0))
(when (ocean-mid-camera-masks-bit? this s4-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)))
(if (sphere-cull sv-36)
(ocean-make-trans-camera-masks this s4-0 s2-0 (- s4-0 sv-34) (- s2-0 sv-32))
)
)
)
(+! s2-0 1)
)
)
(+! s4-0 1)
)
)
(let ((a2-3 192)
(a1-7 0)
(a0-11 192)
(v1-33 0)
)
(let ((a3-1 sv-34)
(t0-1 sv-35)
)
(while (>= t0-1 a3-1)
(let ((t1-0 sv-32)
(t2-0 sv-33)
)
(while (>= t2-0 t1-0)
(set! sv-40 (the-as ocean-trans-mask (&-> this trans-camera-masks (+ (* (- a3-1 sv-34) 4) (- t1-0 sv-32)))))
(when (nonzero? (-> sv-40 word))
(dotimes (t3-10 4)
(let ((t4-4 (-> sv-40 mask t3-10)))
(when (nonzero? t4-4)
(let ((t5-2 (+ (* a3-1 4) t3-10)))
(if (< t5-2 (the-as uint a0-11))
(set! a0-11 (the-as int t5-2))
)
(if (< (the-as uint v1-33) t5-2)
(set! v1-33 (the-as int t5-2))
)
)
(dotimes (t5-3 4)
(when (logtest? t4-4 (ash 1 t5-3))
(let ((t6-9 (+ (* t1-0 4) t5-3)))
(if (< t6-9 (the-as uint a2-3))
(set! a2-3 (the-as int t6-9))
)
(if (< (the-as uint a1-7) t6-9)
(set! a1-7 (the-as int t6-9))
)
)
)
)
)
)
)
)
(+! t1-0 1)
)
)
(+! a3-1 1)
)
)
(set! (-> this near-minx) (the-as uint (+ a2-3 -1)))
(set! (-> this near-maxx) (the-as uint (+ a1-7 1)))
(set! (-> this near-minz) (the-as uint (+ a0-11 -1)))
(set! (-> this near-maxz) (the-as uint (+ v1-33 1)))
)
(dotimes (v1-35 16)
(set! (-> this trans-temp-masks v1-35) (the-as uint (-> this trans-camera-masks v1-35)))
)
(let ((s4-1 sv-34)
(s3-1 sv-35)
)
(while (>= s3-1 s4-1)
(let ((s2-1 sv-32)
(s1-1 sv-33)
)
(while (>= s1-1 s2-1)
(when (not (ocean-mid-mask-ptrs-bit? this s4-1 s2-1))
(when (ocean-mid-camera-masks-bit? this s4-1 s2-1)
(let ((v1-46 (-> this ocean-trans-indices data (+ (* (the-as uint 48) s4-1) s2-1))))
(when (>= (-> v1-46 parent) 0)
(set! sv-44 (+ (* (- s4-1 sv-34) 4) (- s2-1 sv-32)))
(set! (-> this near-mask-indices sv-44) (the-as uint (-> v1-46 child)))
(let ((s0-0 (-> this ocean-mid-masks data (-> v1-46 parent))))
(set! sv-48 0)
(while (< sv-48 4)
(let ((t0-2 (-> s0-0 mask sv-48)))
(if (!= t0-2 255)
(ocean-trans-add-upload-strip this arg0 s4-1 s2-1 (the-as int t0-2) (the-as int sv-44) sv-48)
)
)
(set! sv-48 (+ sv-48 1))
)
)
)
)
)
)
(+! s2-1 1)
)
)
(+! s4-1 1)
)
)
(ocean-mid-add-call-flush this arg0 (the-as uint 41))
(ocean-trans-add-constants this arg0)
(draw-ocean-transition-seams this arg0)
(ocean-mid-add-call-flush this arg0 (the-as uint 41))
0
(none)
)