From 75f7609baaf7bd6f7bbd9b436c434c12715dd20e Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Sun, 1 Aug 2021 17:42:40 -0400 Subject: [PATCH] decomp: `ocean-transition` (#616) * some work on `ocean-transition` * decomp: finished non-blocked `ocean-transition` functions * decompiler: Support <0 unsigned comparison * decompiler/goalc: Support half-word and byte parallel extend ops * attempt to add support for byte stack spills, assertion errors `Assertion failed: idx < n_src, file ..\..\..\decompiler\Disasm\Instruction.cpp, line 353` * decomp: fix byte stack spills, only 1 issue remains in `draw-ocean-transition` * almost there... * closer, but unknowns about `dma-buffer` blocking * dealing with dma-buffer issues * some more fixes, only an obscure xmm issue remains * add two problematic functions to blacklists, avoid goal_src additions for now * fix building/compilation but TypeConsistency hits an assertion error the `ocean-mid-masks`'s `data` field is none of the types * decomp: finalize `ocean-transition` * address feedback - 1 issue remains * decomp: finalize `ocean-transition` --- decompiler/IR2/FormExpressionAnalysis.cpp | 18 +- decompiler/analysis/stack_spill.cpp | 4 +- decompiler/config/all-types.gc | 55 +- .../jak1_ntsc_black_label/label_types.jsonc | 2 +- .../stack_structures.jsonc | 31 +- .../jak1_ntsc_black_label/type_casts.jsonc | 37 + goal_src/engine/gfx/hw/display-h.gc | 2 +- goal_src/engine/gfx/ocean/ocean-h.gc | 14 +- goal_src/engine/gfx/ocean/ocean-mid.gc | 7 + .../engine/gfx/ocean/ocean-trans-tables.gc | 2184 +++++++++-------- goal_src/engine/gfx/ocean/ocean-transition.gc | 1239 ++++++++++ goal_src/engine/gfx/ocean/ocean.gc | 2 + .../reference/engine/gfx/hw/display-h_REF.gc | 2 +- .../reference/engine/gfx/ocean/ocean-h_REF.gc | 8 +- .../gfx/ocean/ocean-trans-tables_REF.gc | 234 +- .../engine/gfx/ocean/ocean-transition_REF.gc | 1246 ++++++++++ 16 files changed, 3837 insertions(+), 1248 deletions(-) create mode 100644 test/decompiler/reference/engine/gfx/ocean/ocean-transition_REF.gc diff --git a/decompiler/IR2/FormExpressionAnalysis.cpp b/decompiler/IR2/FormExpressionAnalysis.cpp index ac5b4aaf48..4f43d06777 100644 --- a/decompiler/IR2/FormExpressionAnalysis.cpp +++ b/decompiler/IR2/FormExpressionAnalysis.cpp @@ -3636,15 +3636,6 @@ FormElement* ConditionElement::make_generic(const Env& env, return make_less_than_zero_signed_check_generic(env, pool, source_forms, types); } - case IR2_Condition::Kind::LEQ_ZERO_SIGNED: { - auto casted = make_casts_if_needed(source_forms, types, TypeSpec("int"), pool, env); - auto zero = pool.alloc_single_element_form( - nullptr, SimpleAtom::make_int_constant(0)); - casted.push_back(zero); - return pool.alloc_element(GenericOperator::make_fixed(FixedOperatorKind::LEQ), - casted); - } - case IR2_Condition::Kind::LESS_THAN_ZERO_UNSIGNED: { auto casted = make_casts_if_needed(source_forms, types, TypeSpec("uint"), pool, env); auto zero = pool.alloc_single_element_form( @@ -3654,6 +3645,15 @@ FormElement* ConditionElement::make_generic(const Env& env, casted); } + case IR2_Condition::Kind::LEQ_ZERO_SIGNED: { + auto casted = make_casts_if_needed(source_forms, types, TypeSpec("int"), pool, env); + auto zero = pool.alloc_single_element_form( + nullptr, SimpleAtom::make_int_constant(0)); + casted.push_back(zero); + return pool.alloc_element(GenericOperator::make_fixed(FixedOperatorKind::LEQ), + casted); + } + case IR2_Condition::Kind::GEQ_ZERO_SIGNED: { return make_geq_zero_signed_check_generic(env, pool, source_forms, types); } diff --git a/decompiler/analysis/stack_spill.cpp b/decompiler/analysis/stack_spill.cpp index f366e09171..49d14d08d2 100644 --- a/decompiler/analysis/stack_spill.cpp +++ b/decompiler/analysis/stack_spill.cpp @@ -84,7 +84,9 @@ constexpr StackInstrInfo stack_instrs[] = {{InstructionKind::SQ, false, 16, fals //{InstructionKind::LWU, true, 4, false} {InstructionKind::SD, false, 8, false}, {InstructionKind::SWC1, false, 4, false}, - {InstructionKind::LWC1, true, 4, false}}; + {InstructionKind::LWC1, true, 4, false}, + {InstructionKind::SB, false, 1, false}, + {InstructionKind::LBU, true, 1, false}}; } // namespace StackSpillMap build_spill_map(const std::vector& instructions, Range range) { diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index a7eb6c2103..2867761063 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -4284,9 +4284,7 @@ (debug-buf dma-buffer :offset 36) (global-buf dma-buffer :offset 40) (bucket-group dma-bucket :offset 44) - (buffer uint32 11 :offset 4) ;; for debugging? - - + (buffer dma-buffer 11 :offset 4) (profile-bar profile-bar 2 :offset 48) (run-time uint64 :offset 56) ) @@ -6615,7 +6613,7 @@ ) (deftype ocean-mid-mask (structure) - ((mask uint8 8 :offset-assert 0 :do-not-decompile) ;; avoid huge arrays. + ((mask uint8 8 :offset-assert 0) ;; avoid huge arrays. (this causes an ocean-transition function to not decompile!) (dword uint64 :offset 0) ) :pack-me @@ -6642,7 +6640,7 @@ ) (deftype ocean-trans-mask (structure) - ((mask uint16 4 :offset-assert 0) + ((mask uint8 4 :offset-assert 0) (word uint64 :offset 0) ) :pack-me @@ -6751,9 +6749,9 @@ (corner-array ocean-corner 25 :inline :offset-assert 80) (corner-count int32 :offset-assert 2080) (temp-vecs vector 4 :inline :offset-assert 2096) - (mid-mask-ptrs pointer 36 :offset-assert 2160) + (mid-mask-ptrs (pointer int32) 36 :offset-assert 2160) (mid-camera-masks uint64 36 :offset-assert 2304) - (trans-mask-ptrs pointer 64 :offset-assert 2592) + (trans-mask-ptrs (pointer int32) 64 :offset-assert 2592) (trans-camera-masks ocean-trans-mask 16 :inline :offset-assert 2848) (trans-temp-masks ocean-trans-mask 16 :inline :offset-assert 2976) (near-mask-indices uint16 16 :offset-assert 3104) @@ -6992,9 +6990,9 @@ (define-extern *ocean-trans-down-right-table* (pointer float)) (define-extern *ocean-trans-up-right-table* (pointer float)) (define-extern *ocean-trans-up-left-table* (pointer float)) -(define-extern *ocean-trans-corner-table* (pointer float)) -(define-extern *ocean-trans-strip-array* (pointer float)) -(define-extern *ocean-trans-st-table* (pointer float)) +(define-extern *ocean-trans-corner-table* (inline-array vector4w-2)) +(define-extern *ocean-trans-strip-array* (pointer float)) ;; TODO this should probably be a ocean-trans-strip-array ? +(define-extern *ocean-trans-st-table* (inline-array vector)) ;; ---------------------- @@ -20901,10 +20899,10 @@ (define-extern ocean-interp-wave function) (define-extern ocean-generate-verts function) (define-extern draw-ocean-texture function) -(define-extern ocean-init-buffer function) -(define-extern draw-ocean-far function) -(define-extern draw-ocean-mid function) -(define-extern ocean-end-buffer function) +(define-extern ocean-init-buffer (function dma-buffer none)) ; not confirmed +(define-extern draw-ocean-far (function dma-buffer none)) ; not confirmed +(define-extern draw-ocean-mid (function dma-buffer none)) ; not confirmed +(define-extern ocean-end-buffer (function dma-buffer none)) ; not confirmed (define-extern draw-ocean-near function) (define-extern init-ocean-far-regs function) (define-extern render-ocean-far function) @@ -20913,9 +20911,12 @@ (define-extern draw-ocean (function none)) (define-extern update-ocean (function none)) +;; - Symbols + +(define-extern *ocean-map* ocean-map) + ;; - Unknowns -(define-extern *ocean-map* ocean-map) ;; unknown type ;;(define-extern *swamp-low-ocean-marker* object) ;; unknown type @@ -20963,7 +20964,7 @@ ;; - Functions (define-extern ocean-mid-add-constants function) -(define-extern ocean-mid-add-call function) +(define-extern ocean-mid-add-call (function dma-buffer int none)) (define-extern ocean-mid-add-upload function) (define-extern ocean-mid-add-call-flush (function dma-buffer uint none)) (define-extern draw-ocean-transition (function dma-buffer none)) @@ -20976,7 +20977,7 @@ (define-extern ocean-mid-mask-ptrs-bit? (function uint uint)) (define-extern ocean-mid-add-upload-table function) (define-extern ocean-mid-camera-masks-set! function) -(define-extern ocean-mid-add-matrices function) +(define-extern ocean-mid-add-matrices (function dma-buffer none)) ;; not verified (define-extern ocean-mid-check function) (define-extern ocean-matrix*! function) (define-extern ocean-mid-setup-constants function) @@ -20995,16 +20996,16 @@ ;; - Functions -(define-extern ocean-make-trans-camera-masks (function uint uint uint uint none)) -(define-extern ocean-trans-add-upload-strip (function dma-buffer uint uint uint uint none)) -(define-extern ocean-trans-add-constants (function dma-buffer none)) -(define-extern draw-ocean-transition-seams (function dma-buffer none)) -(define-extern ocean-trans-camera-masks-bit? function) -(define-extern ocean-trans-add-upload function) -(define-extern ocean-trans-mask-ptrs-bit? function) -(define-extern ocean-trans-add-upload-table function) -(define-extern ocean-transition-check function) -(define-extern ocean-trans-mask-ptrs-set! function) +(define-extern ocean-make-trans-camera-masks (function uint uint uint uint symbol)) +(define-extern ocean-trans-add-upload-strip (function dma-buffer uint uint uint uint uint none)) +(define-extern ocean-trans-add-constants (function dma-buffer pointer)) +(define-extern draw-ocean-transition-seams (function dma-buffer symbol)) +(define-extern ocean-trans-camera-masks-bit? (function uint uint symbol)) +(define-extern ocean-trans-add-upload (function dma-buffer int int none)) +(define-extern ocean-trans-mask-ptrs-bit? (function int int symbol)) +(define-extern ocean-trans-add-upload-table (function dma-buffer int int (pointer float) int symbol none)) +(define-extern ocean-transition-check (function ocean-trans-mask int int vector symbol)) +(define-extern ocean-trans-mask-ptrs-set! (function int int symbol)) ;; ---------------------- diff --git a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc index 63707830cc..538426c8c4 100644 --- a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc @@ -121,7 +121,7 @@ "ocean-h": [["L2", "ocean-work", true]], "ocean-trans-tables": [ - ["L1", "(pointer float)", true, 16], + ["L1", "(inline-array vector)", true, 4], ["L2", "(pointer float)", true, 160], ["L3", "(pointer float)", true, 100], ["L4", "(pointer float)", true, 72], diff --git a/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc b/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc index 2c45a9a08a..7789fb60ad 100644 --- a/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc @@ -216,8 +216,6 @@ [32, "vector"] ], - "make-light-kit": [[16, "matrix"]], - "(method 23 trsqv)": [[16, "vector"]], "(method 24 trsqv)": [[16, "vector"]], @@ -391,9 +389,19 @@ [32, "matrix"] ], - "draw-ocean-transition": [[16, "sphere"]], + "(method 18 tracking-spline)": [ + [16, "tracking-spline-sampler"], + [32, "tracking-spline-sampler"] + ], + + "draw-ocean-transition": [ + [16, "sphere"] + ], "dm-cam-mode-func": [[16, "event-message-block"]], + "ocean-trans-add-upload-table": [ + [16, "vector"] + ], "dm-cam-settings-func": [[16, "event-message-block"]], @@ -719,6 +727,11 @@ [32, "quaternion"], [48, "vector"] ], + + "ocean-make-trans-camera-masks": [ + [16, "vector"], + [32, "vector"] + ], "(anon-function 28 task-control)": [[16, "event-message-block"]], @@ -796,5 +809,17 @@ [96, "vector"] ], + "ocean-transition-check": [ + [16, "vector"] + ], + + "ocean-trans-add-upload-strip": [ + [16, "vector"] + ], + + "draw-ocean-transition-seams": [ + [16, "sphere"] + ], + "placeholder-do-not-add-below!": [] } diff --git a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc index 06e660a2a7..8acafbb977 100644 --- a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc @@ -1745,5 +1745,42 @@ [110, "s5", "vector"] ], + "ocean-trans-add-upload-table": [ + [44, "a0", "dma-packet"], + [46, "a0", "dma-packet"], + [51, "a0", "dma-packet"], + [[55, 59], "v1", "vector4w"], // TODO - very likely wrong, but it's something that has 4 int32's, + [[87, 228], "v1", "(inline-array vector)"], + [241, "a0", "dma-packet"], + [243, "a0", "dma-packet"], + [248, "a0", "dma-packet"] + ], + + "ocean-trans-add-upload-strip": [ + [39, "a0", "dma-packet"], + [41, "a0", "dma-packet"], + [46, "a0", "dma-packet"], + [[57, 61], "v1", "vector4w"], // TODO - very likely wrong, but it's something that has 4 int32's, + [[64, 147], "v1", "(inline-array vector)"], // TODO - very likely wrong, but it's something that has 4 int32's, + [166, "a0", "dma-packet"], + [168, "a0", "dma-packet"], + [173, "a0", "dma-packet"] + ], + + "ocean-trans-add-constants": [ + [7, "a1", "dma-packet"], + [9, "a1", "dma-packet"], + [14, "a1", "dma-packet"], + [[17, 46], "v1", "matrix"] + ], + + "draw-ocean-transition": [ + [255, "v1", "ocean-mid-mask"] + ], + + // "ocean-trans-mask-ptrs-bit?": [ + // [[32, 41], "a0", "(pointer ocean-trans-mask)"] + // ], + "placeholder-do-not-add-below": [] } diff --git a/goal_src/engine/gfx/hw/display-h.gc b/goal_src/engine/gfx/hw/display-h.gc index abb860572a..4f4af7c473 100644 --- a/goal_src/engine/gfx/hw/display-h.gc +++ b/goal_src/engine/gfx/hw/display-h.gc @@ -75,7 +75,7 @@ (debug-buf dma-buffer :offset 36) (global-buf dma-buffer :offset 40) (bucket-group dma-bucket :offset 44) - (buffer uint32 11 :offset 4) ;; for debugging? + (buffer dma-buffer 11 :offset 4) (profile-bar profile-bar 2 :offset 48) (run-time uint64 :offset 56) ) diff --git a/goal_src/engine/gfx/ocean/ocean-h.gc b/goal_src/engine/gfx/ocean/ocean-h.gc index 1cf35c4f0f..c97482b486 100644 --- a/goal_src/engine/gfx/ocean/ocean-h.gc +++ b/goal_src/engine/gfx/ocean/ocean-h.gc @@ -80,7 +80,7 @@ ) (deftype ocean-mid-masks (basic) - ((data (inline-array ocean-mid-mask) :offset-assert 4) + ((data (inline-array ocean-mid-mask) :offset-assert 4) ) :pack-me :method-count-assert 9 @@ -89,7 +89,7 @@ ) (deftype ocean-trans-mask (structure) - ((mask uint16 4 :offset-assert 0) + ((mask uint8 4 :offset-assert 0) (word uint64 :offset 0) ) :pack-me @@ -124,7 +124,6 @@ :flag-assert #x900000020 ) - (deftype ocean-near-indices (basic) ((data (inline-array ocean-near-index) :offset-assert 4) ) @@ -175,7 +174,6 @@ :flag-assert #x900000280 ) - (deftype ocean-wave-data (structure) ((data uint8 1024 :offset-assert 0) ) @@ -184,7 +182,6 @@ :flag-assert #x900000400 ) -;; the size of this type overflows. (deftype ocean-wave-frames (structure) ((frame ocean-wave-data 64 :inline :offset-assert 0) ) @@ -201,9 +198,9 @@ (corner-array ocean-corner 25 :inline :offset-assert 80) (corner-count int32 :offset-assert 2080) (temp-vecs vector 4 :inline :offset-assert 2096) - (mid-mask-ptrs pointer 36 :offset-assert 2160) - (mid-camera-masks uint64 36 :offset-assert 2304) - (trans-mask-ptrs pointer 64 :offset-assert 2592) + (mid-mask-ptrs (pointer int32) 36 :offset-assert 2160) + (mid-camera-masks uint64 36 :offset-assert 2304) + (trans-mask-ptrs (pointer int32) 64 :offset-assert 2592) (trans-camera-masks ocean-trans-mask 16 :inline :offset-assert 2848) (trans-temp-masks ocean-trans-mask 16 :inline :offset-assert 2976) (near-mask-indices uint16 16 :offset-assert 3104) @@ -416,3 +413,4 @@ :flag-assert #x900000110 ) +(define-extern *ocean-trans-corner-table* (inline-array vector4w-2)) diff --git a/goal_src/engine/gfx/ocean/ocean-mid.gc b/goal_src/engine/gfx/ocean/ocean-mid.gc index 00515f12e1..2bc25ba13b 100644 --- a/goal_src/engine/gfx/ocean/ocean-mid.gc +++ b/goal_src/engine/gfx/ocean/ocean-mid.gc @@ -5,3 +5,10 @@ ;; name in dgo: ocean-mid ;; dgos: GAME, ENGINE +;; TODO - for ocean-transition +(define-extern ocean-mid-add-matrices (function dma-buffer none)) ;; not verified +(define-extern ocean-mid-add-call-flush (function dma-buffer uint none)) +(define-extern draw-ocean-transition (function dma-buffer none)) +(define-extern ocean-mid-add-call (function dma-buffer int none)) +(define-extern ocean-mid-camera-masks-bit? (function uint uint)) +(define-extern ocean-mid-mask-ptrs-bit? (function uint uint)) diff --git a/goal_src/engine/gfx/ocean/ocean-trans-tables.gc b/goal_src/engine/gfx/ocean/ocean-trans-tables.gc index cfc2ce3f14..b5e395133c 100644 --- a/goal_src/engine/gfx/ocean/ocean-trans-tables.gc +++ b/goal_src/engine/gfx/ocean/ocean-trans-tables.gc @@ -5,1091 +5,1137 @@ ;; name in dgo: ocean-trans-tables ;; dgos: GAME, ENGINE -(define *ocean-left-table* - (new 'static 'array float 28 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.25 - 0.0 - 0.75 - 0.0 - 0.5 - 0.0 - 0.5 - 0.0 - 0.75 - 0.0 - 0.25 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - ) +;; definition for symbol *ocean-left-table*, type (pointer float) +(define + *ocean-left-table* + (new 'static 'array float 28 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + ) ) -(define *ocean-right-table* - (new 'static 'array float 28 - 0.0 - 0.0 - 1.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - 0.75 - 0.0 - 0.25 - 0.0 - 0.5 - 0.0 - 0.5 - 0.0 - 0.25 - 0.0 - 0.75 - 0.0 - 0.0 - 0.0 - 1.0 - ) + +;; definition for symbol *ocean-right-table*, type (pointer float) +(define + *ocean-right-table* + (new 'static 'array float 28 + 0.0 + 0.0 + 1.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.0 + 0.0 + 1.0 + ) ) -(define *ocean-up-table* - (new 'static 'array float 28 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - 0.0 - 1.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.25 - 0.75 - 0.0 - 0.0 - 0.5 - 0.5 - 0.0 - 0.0 - 0.75 - 0.25 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - ) + +;; definition for symbol *ocean-up-table*, type (pointer float) +(define + *ocean-up-table* + (new 'static 'array float 28 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + ) ) -(define *ocean-down-table* - (new 'static 'array float 28 - 0.0 - 1.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - 0.75 - 0.25 - 0.0 - 0.0 - 0.5 - 0.5 - 0.0 - 0.0 - 0.25 - 0.75 - 0.0 - 0.0 - 0.0 - 1.0 - ) + +;; definition for symbol *ocean-down-table*, type (pointer float) +(define + *ocean-down-table* + (new 'static 'array float 28 + 0.0 + 1.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.0 + 0.0 + 1.0 + ) ) -(define *ocean-down-left-table* - (new 'static 'array float 4 - 0.0 - 1.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - 0.75 - 0.0 - 0.25 - 0.0 - 0.5 - 0.0 - 0.5 - 0.0 - 0.25 - 0.0 - 0.75 - 0.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - 0.75 - 0.25 - 0.0 - 0.0 - 0.5 - 0.5 - 0.0 - 0.0 - 0.25 - 0.75 - 0.0 - 0.0 - 0.0 - 1.0 - ) + +;; definition for symbol *ocean-down-left-table*, type (pointer float) +(define + *ocean-down-left-table* + (new 'static 'array float 40 + 0.0 + 1.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.0 + 0.0 + 1.0 + ) ) -(define *ocean-down-right-table* - (new 'static 'array float 4 - 1.0 - 0.0 - 0.0 - 0.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - 0.0 - 0.75 - 0.25 - 0.0 - 0.75 - 0.0 - 0.25 - 0.0 - 0.0 - 0.5 - 0.5 - 0.0 - 0.5 - 0.0 - 0.5 - 0.0 - 0.0 - 0.25 - 0.75 - 0.0 - 0.25 - 0.0 - 0.75 - 0.0 - 0.0 - 0.0 - 1.0 - ) + +;; definition for symbol *ocean-down-right-table*, type (pointer float) +(define + *ocean-down-right-table* + (new 'static 'array float 40 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 0.75 + 0.25 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.0 + 0.0 + 1.0 + ) ) -(define *ocean-up-right-table* - (new 'static 'array float 4 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.25 - 0.0 - 0.75 - 0.0 - 0.5 - 0.0 - 0.5 - 0.0 - 0.75 - 0.0 - 0.25 - 0.0 - 1.0 - 0.0 - 0.0 - 0.25 - 0.75 - 0.0 - 0.0 - 0.5 - 0.5 - 0.0 - 0.0 - 0.75 - 0.25 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - ) + +;; definition for symbol *ocean-up-right-table*, type (pointer float) +(define + *ocean-up-right-table* + (new 'static 'array float 40 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 1.0 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + ) ) -(define *ocean-up-left-table* - (new 'static 'array float 4 - 0.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.25 - 0.0 - 0.75 - 0.0 - 0.25 - 0.75 - 0.0 - 0.0 - 0.5 - 0.0 - 0.5 - 0.0 - 0.5 - 0.5 - 0.0 - 0.0 - 0.75 - 0.0 - 0.25 - 0.0 - 0.75 - 0.25 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - ) + +;; definition for symbol *ocean-up-left-table*, type (pointer float) +(define + *ocean-up-left-table* + (new 'static 'array float 40 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.25 + 0.75 + 0.0 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.5 + 0.5 + 0.0 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + ) ) -(define *ocean-trans-left-table* - (new 'static 'array float 44 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.125 - 0.0 - 0.875 - 0.0 - 0.25 - 0.0 - 0.75 - 0.0 - 0.375 - 0.0 - 0.625 - 0.0 - 0.5 - 0.0 - 0.5 - 0.0 - 0.625 - 0.0 - 0.375 - 0.0 - 0.75 - 0.0 - 0.25 - 0.0 - 0.875 - 0.0 - 0.125 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - ) + +;; definition for symbol *ocean-trans-left-table*, type (pointer float) +(define + *ocean-trans-left-table* + (new 'static 'array float 44 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.125 + 0.0 + 0.875 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.375 + 0.0 + 0.625 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.625 + 0.0 + 0.375 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.875 + 0.0 + 0.125 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + ) ) -(define *ocean-trans-right-table* - (new 'static 'array float 44 - 0.0 - 0.0 - 1.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - 0.875 - 0.0 - 0.125 - 0.0 - 0.75 - 0.0 - 0.25 - 0.0 - 0.625 - 0.0 - 0.375 - 0.0 - 0.5 - 0.0 - 0.5 - 0.0 - 0.375 - 0.0 - 0.625 - 0.0 - 0.25 - 0.0 - 0.75 - 0.0 - 0.125 - 0.0 - 0.875 - 0.0 - 0.0 - 0.0 - 1.0 - ) + +;; definition for symbol *ocean-trans-right-table*, type (pointer float) +(define + *ocean-trans-right-table* + (new 'static 'array float 44 + 0.0 + 0.0 + 1.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.875 + 0.0 + 0.125 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.625 + 0.0 + 0.375 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.375 + 0.0 + 0.625 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.125 + 0.0 + 0.875 + 0.0 + 0.0 + 0.0 + 1.0 + ) ) -(define *ocean-trans-up-table* - (new 'static 'array float 44 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - 0.0 - 1.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.125 - 0.875 - 0.0 - 0.0 - 0.25 - 0.75 - 0.0 - 0.0 - 0.375 - 0.625 - 0.0 - 0.0 - 0.5 - 0.5 - 0.0 - 0.0 - 0.625 - 0.375 - 0.0 - 0.0 - 0.75 - 0.25 - 0.0 - 0.0 - 0.875 - 0.125 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - ) + +;; definition for symbol *ocean-trans-up-table*, type (pointer float) +(define + *ocean-trans-up-table* + (new 'static 'array float 44 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.125 + 0.875 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.0 + 0.375 + 0.625 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0 + 0.0 + 0.625 + 0.375 + 0.0 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 0.875 + 0.125 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + ) ) -(define *ocean-trans-down-table* - (new 'static 'array float 44 - 0.0 - 1.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - 0.875 - 0.125 - 0.0 - 0.0 - 0.75 - 0.25 - 0.0 - 0.0 - 0.625 - 0.375 - 0.0 - 0.0 - 0.5 - 0.5 - 0.0 - 0.0 - 0.375 - 0.625 - 0.0 - 0.0 - 0.25 - 0.75 - 0.0 - 0.0 - 0.125 - 0.875 - 0.0 - 0.0 - 0.0 - 1.0 - ) + +;; definition for symbol *ocean-trans-down-table*, type (pointer float) +(define + *ocean-trans-down-table* + (new 'static 'array float 44 + 0.0 + 1.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.875 + 0.125 + 0.0 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 0.625 + 0.375 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0 + 0.0 + 0.375 + 0.625 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.0 + 0.125 + 0.875 + 0.0 + 0.0 + 0.0 + 1.0 + ) ) -(define *ocean-trans-down-left-table* - (new 'static 'array float 72 - 0.0 - 1.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - 0.875 - 0.0 - 0.125 - 0.0 - 0.75 - 0.0 - 0.25 - 0.0 - 0.625 - 0.0 - 0.375 - 0.0 - 0.5 - 0.0 - 0.5 - 0.0 - 0.375 - 0.0 - 0.625 - 0.0 - 0.25 - 0.0 - 0.75 - 0.0 - 0.125 - 0.0 - 0.875 - 0.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - 0.875 - 0.125 - 0.0 - 0.0 - 0.75 - 0.25 - 0.0 - 0.0 - 0.625 - 0.375 - 0.0 - 0.0 - 0.5 - 0.5 - 0.0 - 0.0 - 0.375 - 0.625 - 0.0 - 0.0 - 0.25 - 0.75 - 0.0 - 0.0 - 0.125 - 0.875 - 0.0 - 0.0 - 0.0 - 1.0 - ) + +;; definition for symbol *ocean-trans-down-left-table*, type (pointer float) +(define + *ocean-trans-down-left-table* + (new 'static 'array float 72 + 0.0 + 1.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.875 + 0.0 + 0.125 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.625 + 0.0 + 0.375 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.375 + 0.0 + 0.625 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.125 + 0.0 + 0.875 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.875 + 0.125 + 0.0 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 0.625 + 0.375 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0 + 0.0 + 0.375 + 0.625 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.0 + 0.125 + 0.875 + 0.0 + 0.0 + 0.0 + 1.0 + ) ) -(define *ocean-trans-down-right-table* - (new 'static 'array float 72 - 1.0 - 0.0 - 0.0 - 0.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - 0.0 - 0.875 - 0.125 - 0.0 - 0.875 - 0.0 - 0.125 - 0.0 - 0.0 - 0.75 - 0.25 - 0.0 - 0.75 - 0.0 - 0.25 - 0.0 - 0.0 - 0.625 - 0.375 - 0.0 - 0.625 - 0.0 - 0.375 - 0.0 - 0.0 - 0.5 - 0.5 - 0.0 - 0.5 - 0.0 - 0.5 - 0.0 - 0.0 - 0.375 - 0.625 - 0.0 - 0.375 - 0.0 - 0.625 - 0.0 - 0.0 - 0.25 - 0.75 - 0.0 - 0.25 - 0.0 - 0.75 - 0.0 - 0.0 - 0.125 - 0.875 - 0.0 - 0.125 - 0.0 - 0.875 - 0.0 - 0.0 - 0.0 - 1.0 - ) + +;; definition for symbol *ocean-trans-down-right-table*, type (pointer float) +(define + *ocean-trans-down-right-table* + (new 'static 'array float 72 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 0.875 + 0.125 + 0.0 + 0.875 + 0.0 + 0.125 + 0.0 + 0.0 + 0.75 + 0.25 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.0 + 0.625 + 0.375 + 0.0 + 0.625 + 0.0 + 0.375 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.0 + 0.375 + 0.625 + 0.0 + 0.375 + 0.0 + 0.625 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.0 + 0.125 + 0.875 + 0.0 + 0.125 + 0.0 + 0.875 + 0.0 + 0.0 + 0.0 + 1.0 + ) ) -(define *ocean-trans-up-right-table* - (new 'static 'array float 72 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.125 - 0.0 - 0.875 - 0.0 - 0.25 - 0.0 - 0.75 - 0.0 - 0.375 - 0.0 - 0.625 - 0.0 - 0.5 - 0.0 - 0.5 - 0.0 - 0.625 - 0.0 - 0.375 - 0.0 - 0.75 - 0.0 - 0.25 - 0.0 - 0.875 - 0.0 - 0.125 - 0.0 - 1.0 - 0.0 - 0.0 - 0.125 - 0.875 - 0.0 - 0.0 - 0.25 - 0.75 - 0.0 - 0.0 - 0.375 - 0.625 - 0.0 - 0.0 - 0.5 - 0.5 - 0.0 - 0.0 - 0.625 - 0.375 - 0.0 - 0.0 - 0.75 - 0.25 - 0.0 - 0.0 - 0.875 - 0.125 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - ) + +;; definition for symbol *ocean-trans-up-right-table*, type (pointer float) +(define + *ocean-trans-up-right-table* + (new 'static 'array float 72 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.125 + 0.0 + 0.875 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.375 + 0.0 + 0.625 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.625 + 0.0 + 0.375 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.875 + 0.0 + 0.125 + 0.0 + 1.0 + 0.0 + 0.0 + 0.125 + 0.875 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.0 + 0.375 + 0.625 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0 + 0.0 + 0.625 + 0.375 + 0.0 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 0.875 + 0.125 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + ) ) -(define *ocean-trans-up-left-table* - (new 'static 'array float 72 - 0.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.125 - 0.0 - 0.875 - 0.0 - 0.125 - 0.875 - 0.0 - 0.0 - 0.25 - 0.0 - 0.75 - 0.0 - 0.25 - 0.75 - 0.0 - 0.0 - 0.375 - 0.0 - 0.625 - 0.0 - 0.375 - 0.625 - 0.0 - 0.0 - 0.5 - 0.0 - 0.5 - 0.0 - 0.5 - 0.5 - 0.0 - 0.0 - 0.625 - 0.0 - 0.375 - 0.0 - 0.625 - 0.375 - 0.0 - 0.0 - 0.75 - 0.0 - 0.25 - 0.0 - 0.75 - 0.25 - 0.0 - 0.0 - 0.875 - 0.0 - 0.125 - 0.0 - 0.875 - 0.125 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - ) + +;; definition for symbol *ocean-trans-up-left-table*, type (pointer float) +(define + *ocean-trans-up-left-table* + (new 'static 'array float 72 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.125 + 0.0 + 0.875 + 0.0 + 0.125 + 0.875 + 0.0 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.25 + 0.75 + 0.0 + 0.0 + 0.375 + 0.0 + 0.625 + 0.0 + 0.375 + 0.625 + 0.0 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.5 + 0.5 + 0.0 + 0.0 + 0.625 + 0.0 + 0.375 + 0.0 + 0.625 + 0.375 + 0.0 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 0.875 + 0.0 + 0.125 + 0.0 + 0.875 + 0.125 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + ) ) -(define *ocean-trans-corner-table* - (new 'static 'array float 1 - 1.0 - 0.0 - 0.0 - 0.0 - 0.75 - 0.25 - 0.0 - 0.0 - 0.5 - 0.5 - 0.0 - 0.0 - 0.25 - 0.75 - 0.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.75 - 0.0 - 0.25 - 0.0 - 0.5625 - 0.1875 - 0.1875 - 0.0625 - 0.375 - 0.375 - 0.125 - 0.125 - 0.1875 - 0.5625 - 0.0625 - 0.1875 - 0.0 - 0.75 - 0.0 - 0.25 - 0.5 - 0.0 - 0.5 - 0.0 - 0.375 - 0.125 - 0.375 - 0.125 - 0.25 - 0.25 - 0.25 - 0.25 - 0.125 - 0.375 - 0.125 - 0.375 - 0.0 - 0.5 - 0.0 - 0.5 - 0.25 - 0.0 - 0.75 - 0.0 - 0.1875 - 0.0625 - 0.5625 - 0.1875 - 0.125 - 0.125 - 0.375 - 0.375 - 0.0625 - 0.1875 - 0.1875 - 0.5625 - 0.0 - 0.25 - 0.0 - 0.75 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - 0.75 - 0.25 - 0.0 - 0.0 - 0.5 - 0.5 - 0.0 - 0.0 - 0.25 - 0.75 - 0.0 - 0.0 - 0.0 - 1.0 - ) + +;; definition for symbol *ocean-trans-corner-table*, type (inline-array vector4w-2) +(define + *ocean-trans-corner-table* + (the-as (inline-array vector4w-2) + (new 'static 'array float 100 + 1.0 + 0.0 + 0.0 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.5625 + 0.1875 + 0.1875 + 0.0625 + 0.375 + 0.375 + 0.125 + 0.125 + 0.1875 + 0.5625 + 0.0625 + 0.1875 + 0.0 + 0.75 + 0.0 + 0.25 + 0.5 + 0.0 + 0.5 + 0.0 + 0.375 + 0.125 + 0.375 + 0.125 + 0.25 + 0.25 + 0.25 + 0.25 + 0.125 + 0.375 + 0.125 + 0.375 + 0.0 + 0.5 + 0.0 + 0.5 + 0.25 + 0.0 + 0.75 + 0.0 + 0.1875 + 0.0625 + 0.5625 + 0.1875 + 0.125 + 0.125 + 0.375 + 0.375 + 0.0625 + 0.1875 + 0.1875 + 0.5625 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.0 + 0.0 + 1.0 + ) + ) ) -(define *ocean-trans-strip-array* - (new 'static 'array float 16 - 1.0 - 0.0 - 0.0 - 0.0 - 0.75 - 0.0 - 0.25 - 0.0 - 0.75 - 0.25 - 0.0 - 0.0 - 0.5625 - 0.1875 - 0.1875 - 0.0625 - 0.5 - 0.5 - 0.0 - 0.0 - 0.375 - 0.375 - 0.125 - 0.125 - 0.25 - 0.75 - 0.0 - 0.0 - 0.1875 - 0.5625 - 0.0625 - 0.1875 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - 0.75 - 0.0 - 0.25 - 0.75 - 0.0 - 0.25 - 0.0 - 0.5 - 0.0 - 0.5 - 0.0 - 0.5625 - 0.1875 - 0.1875 - 0.0625 - 0.375 - 0.125 - 0.375 - 0.125 - 0.375 - 0.375 - 0.125 - 0.125 - 0.25 - 0.25 - 0.25 - 0.25 - 0.1875 - 0.5625 - 0.0625 - 0.1875 - 0.125 - 0.375 - 0.125 - 0.375 - 0.0 - 0.75 - 0.0 - 0.25 - 0.0 - 0.5 - 0.0 - 0.5 - 0.5 - 0.0 - 0.5 - 0.0 - 0.25 - 0.0 - 0.75 - 0.0 - 0.375 - 0.125 - 0.375 - 0.125 - 0.1875 - 0.0625 - 0.5625 - 0.1875 - 0.25 - 0.25 - 0.25 - 0.25 - 0.125 - 0.125 - 0.375 - 0.375 - 0.125 - 0.375 - 0.125 - 0.375 - 0.0625 - 0.1875 - 0.1875 - 0.5625 - 0.0 - 0.5 - 0.0 - 0.5 - 0.0 - 0.25 - 0.0 - 0.75 - 0.25 - 0.0 - 0.75 - 0.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.1875 - 0.0625 - 0.5625 - 0.1875 - 0.0 - 0.0 - 0.75 - 0.25 - 0.125 - 0.125 - 0.375 - 0.375 - 0.0 - 0.0 - 0.5 - 0.5 - 0.0625 - 0.1875 - 0.1875 - 0.5625 - 0.0 - 0.0 - 0.25 - 0.75 - 0.0 - 0.25 - 0.0 - 0.75 - 0.0 - 0.0 - 0.0 - 1.0 - ) + +;; definition for symbol *ocean-trans-strip-array*, type (pointer float) +(define + *ocean-trans-strip-array* + (new 'static 'array float 160 + 1.0 + 0.0 + 0.0 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 0.5625 + 0.1875 + 0.1875 + 0.0625 + 0.5 + 0.5 + 0.0 + 0.0 + 0.375 + 0.375 + 0.125 + 0.125 + 0.25 + 0.75 + 0.0 + 0.0 + 0.1875 + 0.5625 + 0.0625 + 0.1875 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.75 + 0.0 + 0.25 + 0.75 + 0.0 + 0.25 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.5625 + 0.1875 + 0.1875 + 0.0625 + 0.375 + 0.125 + 0.375 + 0.125 + 0.375 + 0.375 + 0.125 + 0.125 + 0.25 + 0.25 + 0.25 + 0.25 + 0.1875 + 0.5625 + 0.0625 + 0.1875 + 0.125 + 0.375 + 0.125 + 0.375 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.5 + 0.0 + 0.5 + 0.5 + 0.0 + 0.5 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.375 + 0.125 + 0.375 + 0.125 + 0.1875 + 0.0625 + 0.5625 + 0.1875 + 0.25 + 0.25 + 0.25 + 0.25 + 0.125 + 0.125 + 0.375 + 0.375 + 0.125 + 0.375 + 0.125 + 0.375 + 0.0625 + 0.1875 + 0.1875 + 0.5625 + 0.0 + 0.5 + 0.0 + 0.5 + 0.0 + 0.25 + 0.0 + 0.75 + 0.25 + 0.0 + 0.75 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.1875 + 0.0625 + 0.5625 + 0.1875 + 0.0 + 0.0 + 0.75 + 0.25 + 0.125 + 0.125 + 0.375 + 0.375 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0625 + 0.1875 + 0.1875 + 0.5625 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.0 + 0.0 + 1.0 + ) ) -(define *ocean-trans-st-table* - (new 'static 'array float 16 - 0.0 - 0.0 - 1.0 - 0.0 - 1.0 - 0.0 - 1.0 - 0.0 - 0.0 - 1.0 - 1.0 - 0.0 - 1.0 - 1.0 - 1.0 - 0.0 - ) + +;; definition for symbol *ocean-trans-st-table*, type (inline-array vector) +(define + *ocean-trans-st-table* + (new 'static 'inline-array vector 4 + (new 'static 'vector :z 1.0) + (new 'static 'vector :x 1.0 :z 1.0) + (new 'static 'vector :y 1.0 :z 1.0) + (new 'static 'vector :x 1.0 :y 1.0 :z 1.0) + ) ) diff --git a/goal_src/engine/gfx/ocean/ocean-transition.gc b/goal_src/engine/gfx/ocean/ocean-transition.gc index 7a5249cedc..d70352bff5 100644 --- a/goal_src/engine/gfx/ocean/ocean-transition.gc +++ b/goal_src/engine/gfx/ocean/ocean-transition.gc @@ -5,3 +5,1242 @@ ;; name in dgo: ocean-transition ;; dgos: GAME, ENGINE +;; definition for function ocean-trans-camera-masks-bit? +(defun ocean-trans-camera-masks-bit? ((arg0 uint) (arg1 uint)) + (let ((v1-3 (- arg0 (* (-> *ocean-work* mid-minz) 4))) + (a0-4 (- arg1 (* (-> *ocean-work* mid-minx) 4))) + ) + (cond + ((or + (< v1-3 0) + (>= v1-3 (the-as uint 16)) + (< a0-4 0) + (>= a0-4 (the-as uint 16)) + ) + #f + ) + (else + (let* ((a3-0 (shr v1-3 2)) + (a2-3 (shr a0-4 2)) + (a1-2 (logand v1-3 3)) + (v1-4 (logand a0-4 3)) + (a0-6 (+ (* a3-0 4) a2-3)) + ) + (nonzero? + (logand + (-> *ocean-work* trans-camera-masks 0 mask (+ a1-2 (* a0-6 8))) + (ash 1 v1-4) + ) + ) + ) + ) + ) + ) + ) + +;; definition for function ocean-trans-mask-ptrs-bit? +(defun ocean-trans-mask-ptrs-bit? ((arg0 int) (arg1 int)) + (let ((v1-3 (- arg0 (the-as int (* (-> *ocean-work* mid-minz) 4)))) + (a0-4 (- arg1 (the-as int (* (-> *ocean-work* mid-minx) 4)))) + ) + (cond + ((or + (< (the-as uint v1-3) 0) + (>= (the-as uint v1-3) (the-as uint 16)) + (< (the-as uint a0-4) 0) + (>= (the-as uint a0-4) (the-as uint 16)) + ) + #f + ) + (else + (let* ((a3-0 (shr v1-3 2)) + (a2-3 (shr a0-4 2)) + (a1-2 (logand v1-3 3)) + (v1-4 (logand a0-4 3)) + (a0-11 + (-> + *ocean-work* + trans-mask-ptrs + (+ (* (+ (* a3-0 4) a2-3) 4) a1-2) + ) + ) + ) + (if a0-11 + (nonzero? (logand (-> a0-11 1) (ash 1 v1-4))) + #f + ) + ) + ) + ) + ) + ) + +;; definition for function ocean-trans-mask-ptrs-set! +(defun ocean-trans-mask-ptrs-set! ((arg0 int) (arg1 int)) + (let ((v1-3 (- arg0 (the-as int (* (-> *ocean-work* mid-minz) 4)))) + (a0-4 (- arg1 (the-as int (* (-> *ocean-work* mid-minx) 4)))) + ) + (cond + ((or + (< (the-as uint v1-3) 0) + (>= (the-as uint v1-3) (the-as uint 16)) + (< (the-as uint a0-4) 0) + (>= (the-as uint a0-4) (the-as uint 16)) + ) + #f + ) + (else + (let* ((a2-3 (shr v1-3 2)) + (a1-2 (shr a0-4 2)) + (v1-4 (logand v1-3 3)) + (a0-5 (logand a0-4 3)) + (a3-6 + (-> + *ocean-work* + trans-mask-ptrs + (+ (* (+ (* a2-3 4) a1-2) 4) v1-4) + ) + ) + ) + (cond + (a3-6 + (cond + ((logtest? (-> a3-6 1) (ash 1 a0-5)) + #f + ) + (else + (let ((a1-6 (-> *ocean-work* trans-temp-masks (+ (* a2-3 4) a1-2)))) + (logior! (-> a1-6 mask v1-4) (ash 1 a0-5)) + ) + #t + ) + ) + ) + (else + #f + ) + ) + ) + ) + ) + ) + ) + +;; definition for function ocean-trans-add-upload-table +;; WARN: Function may read a register that is not set: f31 +;; Used lq/sq +(defun + ocean-trans-add-upload-table + ((arg0 dma-buffer) + (arg1 int) + (arg2 int) + (arg3 (pointer float)) + (arg4 int) + (arg5 symbol) + ) + (local-vars + (r0-0 uint128) + (r0-1 uint128) + (r0-2 uint128) + (r0-3 uint128) + (r0-4 uint128) + (r0-5 uint128) + (v1-12 (inline-array vector)) + (v1-14 float) + (a0-23 uint128) + (a0-24 uint128) + (a1-15 uint128) + (a1-16 uint128) + (a1-17 uint128) + (a2-15 uint128) + (a2-16 uint128) + (a3-10 uint128) + (f31-0 none) + ) + (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! arg1 arg2) + (let ((a1-2 (new-stack-vector0))) + (let ((v1-1 (-> *ocean-map* start-corner))) + (set! (-> a1-2 x) (+ (-> v1-1 x) (* 98304.0 (the float arg2)))) + (set! (-> a1-2 y) (-> v1-1 y)) + (set! (-> a1-2 z) (+ (-> v1-1 z) (* 98304.0 (the float arg1)))) + ) + (set! (-> a1-2 w) 1.0) + ) + (ocean-mid-add-matrices arg0) + (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* ((a0-5 (logand arg1 3)) + (v1-7 (logand arg2 3)) + (v1-8 (+ (* 5 a0-5) v1-7)) + ) + (.lvf vf5 (&-> (&-> *ocean-trans-corner-table* 0 quad v1-8) 0)) + (.lvf vf6 (&-> (&-> *ocean-trans-corner-table* 0 quad (+ v1-8 1)) 0)) + (.lvf vf7 (&-> (&-> *ocean-trans-corner-table* 0 quad (+ v1-8 5)) 0)) + (.lvf vf8 (&-> (&-> *ocean-trans-corner-table* 0 quad (+ v1-8 6)) 0)) + ) + (.mov v1-12 vf8) + (let ((v1-13 (the-as (inline-array vector) (-> arg0 base)))) + (let ((a0-16 (/ arg1 4)) + (a1-11 (/ 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-13 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-13 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-13 2 quad) vf11) + (nop!) + (.svf (&-> v1-13 3 quad) vf12) + (let + ((a2-14 + (the-as + uint128 + (-> *ocean-map* ocean-colors colors (+ (* 52 a0-16) a1-11)) + ) + ) + (a3-9 + (the-as + uint128 + (-> *ocean-map* ocean-colors colors (+ (+ a1-11 1) (* 52 a0-16))) + ) + ) + (t0-10 + (the-as + uint128 + (-> *ocean-map* ocean-colors colors (+ (* 52 (+ a0-16 1)) a1-11)) + ) + ) + (a0-22 + (the-as + uint128 + (-> + *ocean-map* + ocean-colors + colors + (+ (+ a1-11 1) (* 52 (+ a0-16 1))) + ) + ) + ) + ) + (.pextlb a1-15 r0-0 a2-14) + (.mov r0-1 f31-0) + (.pextlb a2-15 r0-1 a3-9) + (.mov r0-2 f31-0) + (.pextlb a3-10 r0-2 t0-10) + (.mov r0-3 f31-0) + (.pextlb a0-23 r0-3 a0-22) + ) + ) + (.mov r0-4 f31-0) + (.pextlh a1-16 r0-4 a1-15) + (.mov r0-5 f31-0) + (.pextlh a2-16 r0-5 a2-15) + (.mov vf1 a1-16) + (.pextlh a1-17 r0-5 a3-10) + (.mov vf2 a2-16) + (.pextlh a0-24 r0-5 a0-23) + (.mov vf3 a1-17) + (nop!) + (.mov vf4 a0-24) + (.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-13 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-13 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-13 6 quad) vf11) + (nop!) + (.svf (&-> v1-13 7 quad) vf12) + ) + (.mov v1-14 vf12) + (&+! (-> arg0 base) 128) + (let* ((v1-17 arg0) + (a0-25 (the-as object (-> v1-17 base))) + ) + (set! + (-> (the-as dma-packet a0-25) dma) + (new 'static 'dma-tag + :id (dma-tag-id ref) + :addr (the-as int arg3) + :qwc arg4 + ) + ) + (set! + (-> (the-as dma-packet a0-25) vif0) + (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + ) + (set! + (-> (the-as dma-packet a0-25) vif1) + (new 'static 'vif-tag :imm #x8011 :cmd (vif-cmd unpack-v4-32) :num arg4) + ) + (set! (-> v1-17 base) (&+ (the-as pointer a0-25) 16)) + ) + (if arg5 + (ocean-mid-add-call arg0 275) + (ocean-mid-add-call arg0 107) + ) + ) + (none) + ) + ) + +;; definition for function ocean-trans-add-upload-strip +;; WARN: Function may read a register that is not set: f31 +;; Used lq/sq +(defun + ocean-trans-add-upload-strip + ((arg0 dma-buffer) + (arg1 uint) + (arg2 uint) + (arg3 uint) + (arg4 uint) + (arg5 uint) + ) + (local-vars + (r0-0 uint128) + (r0-1 uint128) + (r0-2 uint128) + (r0-3 uint128) + (r0-4 uint128) + (r0-5 uint128) + (v1-8 float) + (a0-23 uint128) + (a0-24 uint128) + (a0-25 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) + ) + (let ((a1-1 (new-stack-vector0))) + (let ((v1-1 (-> *ocean-map* start-corner))) + (set! (-> a1-1 x) (+ (-> v1-1 x) (* 393216.0 (the float arg2)))) + (set! (-> a1-1 y) (-> v1-1 y)) + (set! (-> a1-1 z) (+ (-> v1-1 z) (* 393216.0 (the float arg1)))) + ) + (set! (-> a1-1 w) 1.0) + ) + (ocean-mid-add-matrices arg0) + (let* ((a1-2 9) + (v1-3 arg0) + (a0-2 (the-as object (-> v1-3 base))) + ) + (set! + (-> (the-as dma-packet a0-2) dma) + (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a1-2) + ) + (set! + (-> (the-as dma-packet a0-2) vif0) + (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + ) + (set! + (-> (the-as dma-packet a0-2) vif1) + (new 'static 'vif-tag :imm #x8008 :cmd (vif-cmd unpack-v4-32) :num a1-2) + ) + (set! (-> v1-3 base) (&+ (the-as pointer a0-2) 16)) + ) + (let ((v1-4 (the-as object (-> arg0 base)))) + (set! + (-> *ocean-work* trans-mask-ptrs (+ (* arg4 4) arg5)) + (the-as (pointer int32) v1-4) + ) + (set! (-> (the-as vector4w v1-4) x) 10) + (set! (-> (the-as vector4w v1-4) y) (the-as int arg3)) + (set! (-> (the-as vector4w v1-4) z) 0) + (set! (-> (the-as vector4w v1-4) w) 0) + ) + (&+! (-> arg0 base) 16) + (let ((v1-7 (the-as (inline-array vector) (-> arg0 base)))) + (set! (-> v1-7 0 quad) (-> *ocean-trans-st-table* 0 quad)) + (set! (-> v1-7 1 quad) (-> *ocean-trans-st-table* 1 quad)) + (set! (-> v1-7 2 quad) (-> *ocean-trans-st-table* 2 quad)) + (set! (-> v1-7 3 quad) (-> *ocean-trans-st-table* 3 quad)) + (let + ((a0-22 + (the-as + uint128 + (-> + *ocean-map* + ocean-colors + colors + (+ (* 52 (the-as int arg1)) (the-as int arg2)) + ) + ) + ) + (a1-13 + (the-as + uint128 + (-> + *ocean-map* + ocean-colors + colors + (+ (+ arg2 1) (the-as uint (* 52 (the-as int arg1)))) + ) + ) + ) + (a2-14 + (the-as + uint128 + (-> + *ocean-map* + ocean-colors + colors + (+ (* 52 (the-as int (+ arg1 1))) (the-as int arg2)) + ) + ) + ) + (a3-10 + (the-as + uint128 + (-> + *ocean-map* + ocean-colors + colors + (+ (+ arg2 1) (the-as uint (* 52 (the-as int (+ arg1 1))))) + ) + ) + ) + ) + (.pextlb a0-23 r0-0 a0-22) + (.mov r0-1 f31-0) + (.pextlb a1-14 r0-1 a1-13) + (.mov r0-2 f31-0) + (.pextlb a2-15 r0-2 a2-14) + (.mov r0-3 f31-0) + (.pextlb a3-11 r0-3 a3-10) + ) + (.mov r0-4 f31-0) + (.pextlh a0-24 r0-4 a0-23) + (.mov r0-5 f31-0) + (.pextlh a1-15 r0-5 a1-14) + (.mov vf1 a0-24) + (.pextlh a0-25 r0-5 a2-15) + (.mov vf2 a1-15) + (.pextlh a1-16 r0-5 a3-11) + (.mov vf3 a0-25) + (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 quad) vf1) + (nop!) + (.svf (&-> v1-7 5 quad) vf2) + (nop!) + (.svf (&-> v1-7 6 quad) vf3) + (nop!) + (.svf (&-> v1-7 7 quad) vf4) + ) + (.mov v1-8 vf4) + (&+! (-> arg0 base) 128) + (let* ((a1-17 10) + (v1-11 arg0) + (a0-26 (the-as object (-> v1-11 base))) + ) + (set! + (-> (the-as dma-packet a0-26) dma) + (new 'static 'dma-tag + :id (dma-tag-id ref) + :addr (the-as int (+ (+ (* 160 (the-as int arg5)) 0) (the-as int *ocean-trans-strip-array*))) + :qwc a1-17 + ) + ) + (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 a1-17) + ) + (set! (-> v1-11 base) (&+ (the-as pointer a0-26) 16)) + ) + (ocean-mid-add-call arg0 107) + (none) + ) + ) + +;; definition for function ocean-transition-check +;; Used lq/sq +(defun + ocean-transition-check + ((arg0 ocean-trans-mask) (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) (* 98304.0 (the float arg1)))) + (set! (-> v1-0 y) (-> arg3 y)) + (set! (-> v1-0 z) (+ (-> arg3 z) (* 98304.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 19327350000.0) + (logior! (-> arg0 mask arg2) (ash 1 arg1)) + (return #f) + ) + (set! (-> v1-0 x) (+ 98304.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 19327350000.0) + (logior! (-> arg0 mask arg2) (ash 1 arg1)) + (return #f) + ) + (set! (-> v1-0 z) (+ 98304.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 19327350000.0) + (logior! (-> arg0 mask arg2) (ash 1 arg1)) + (return #f) + ) + (set! (-> v1-0 x) (+ -98304.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 19327350000.0) + (logior! (-> arg0 mask arg2) (ash 1 arg1)) + (return #f) + v0-0 + ) + ) + ) + +;; definition for function ocean-make-trans-camera-masks +;; Used lq/sq +(defun + ocean-make-trans-camera-masks + ((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 (-> *ocean-work* 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) + (+ (-> *ocean-map* start-corner x) (* 393216.0 (the float arg1))) + ) + (set! (-> sv-56 y) (-> *ocean-map* start-corner y)) + (set! + (-> sv-56 z) + (+ (-> *ocean-map* start-corner z) (* 393216.0 (the float arg0))) + ) + (set! (-> sv-56 w) 1.0) + (dotimes (gp-0 4) + (dotimes (s5-0 4) + (set! + (-> sv-60 x) + (- (+ (-> sv-56 x) (* 98304.0 (the float s5-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 gp-0))) (-> sv-52 z)) + ) + (ocean-transition-check sv-48 s5-0 gp-0 sv-56) + ) + ) + #f + ) + +;; definition for function ocean-trans-add-upload +(defun ocean-trans-add-upload ((arg0 dma-buffer) (arg1 int) (arg2 int)) + (when (not (ocean-trans-mask-ptrs-bit? arg1 arg2)) + (let + ((s1-0 + (ocean-trans-camera-masks-bit? + (the-as uint (+ arg1 -1)) + (the-as uint arg2) + ) + ) + (s2-0 + (ocean-trans-camera-masks-bit? + (the-as uint (+ arg1 1)) + (the-as uint arg2) + ) + ) + (s3-0 + (ocean-trans-camera-masks-bit? + (the-as uint arg1) + (the-as uint (+ arg2 -1)) + ) + ) + (a0-6 + (ocean-trans-camera-masks-bit? + (the-as uint arg1) + (the-as uint (+ arg2 1)) + ) + ) + (v1-0 0) + ) + (if s1-0 + (+! v1-0 1) + ) + (if s2-0 + (+! v1-0 2) + ) + (if s3-0 + (+! v1-0 4) + ) + (if a0-6 + (+! v1-0 8) + ) + (cond + ((= v1-0 1) + (if (not (ocean-trans-mask-ptrs-bit? (+ arg1 -1) arg2)) + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-up-table* + 11 + #t + ) + ) + ) + ((= v1-0 2) + (if (not (ocean-trans-mask-ptrs-bit? (+ arg1 1) arg2)) + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-down-table* + 11 + #t + ) + ) + ) + ((= v1-0 4) + (if (not (ocean-trans-mask-ptrs-bit? arg1 (+ arg2 -1))) + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-left-table* + 11 + #t + ) + ) + ) + ((= v1-0 5) + (let ((s3-1 (ocean-trans-mask-ptrs-bit? (+ arg1 -1) arg2)) + (v1-1 (ocean-trans-mask-ptrs-bit? arg1 (+ arg2 -1))) + ) + (cond + ((and s3-1 v1-1) + ) + (s3-1 + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-left-table* + 11 + #t + ) + ) + (v1-1 + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-up-table* + 11 + #t + ) + ) + (else + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-up-left-table* + 18 + #f + ) + ) + ) + ) + ) + ((= v1-0 6) + (let ((s3-2 (ocean-trans-mask-ptrs-bit? (+ arg1 1) arg2)) + (v1-2 (ocean-trans-mask-ptrs-bit? arg1 (+ arg2 -1))) + ) + (cond + ((and s3-2 v1-2) + ) + (s3-2 + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-left-table* + 11 + #t + ) + ) + (v1-2 + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-down-table* + 11 + #t + ) + ) + (else + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-down-left-table* + 18 + #t + ) + ) + ) + ) + ) + ((= v1-0 8) + (if (not (ocean-trans-mask-ptrs-bit? arg1 (+ arg2 1))) + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-right-table* + 11 + #t + ) + ) + ) + ((= v1-0 9) + (let ((s3-3 (ocean-trans-mask-ptrs-bit? (+ arg1 -1) arg2)) + (v1-3 (ocean-trans-mask-ptrs-bit? arg1 (+ arg2 1))) + ) + (cond + ((and s3-3 v1-3) + ) + (s3-3 + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-right-table* + 11 + #t + ) + ) + (v1-3 + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-up-table* + 11 + #t + ) + ) + (else + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-up-right-table* + 18 + #t + ) + ) + ) + ) + ) + ((= v1-0 10) + (let ((s3-4 (ocean-trans-mask-ptrs-bit? (+ arg1 1) arg2)) + (v1-4 (ocean-trans-mask-ptrs-bit? arg1 (+ arg2 1))) + ) + (cond + ((and s3-4 v1-4) + ) + (s3-4 + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-right-table* + 11 + #t + ) + ) + (v1-4 + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-down-table* + 11 + #t + ) + ) + (else + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-down-right-table* + 18 + #f + ) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for function draw-ocean-transition-seams +(defun draw-ocean-transition-seams ((arg0 dma-buffer)) + (local-vars + (sv-32 uint) + (sv-33 uint) + (sv-34 uint) + (sv-35 uint) + (sv-36 sphere) + ) + (set! sv-32 (-> *ocean-work* near-minx)) + (set! sv-33 (-> *ocean-work* near-maxx)) + (set! sv-34 (-> *ocean-work* near-minz)) + (set! sv-35 (-> *ocean-work* near-maxz)) + (set! sv-36 (new 'stack 'sphere)) + (set! (-> sv-36 y) (-> *ocean-map* start-corner y)) + (set! (-> sv-36 w) 69511.42) + (when (and (< sv-32 sv-33) (< sv-34 sv-35)) + (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) + (+ + (+ 49152.0 (* 98304.0 (the float s3-0))) + (-> *ocean-map* start-corner x) + ) + ) + (set! + (-> sv-36 z) + (+ + (+ 49152.0 (* 98304.0 (the float s5-0))) + (-> *ocean-map* start-corner z) + ) + ) + (when (sphere-cull sv-36) + (if (not (ocean-trans-camera-masks-bit? s5-0 s3-0)) + (ocean-trans-add-upload arg0 (the-as int s5-0) (the-as int s3-0)) + ) + ) + (+! s3-0 1) + ) + ) + (+! s5-0 1) + ) + ) + ) + (dotimes (v1-27 16) + (when (nonzero? (-> *ocean-work* trans-camera-masks v1-27 word)) + (dotimes (a0-12 4) + (let ((a1-8 (-> *ocean-work* trans-mask-ptrs (+ (* v1-27 4) a0-12)))) + (if a1-8 + (logior! + (-> a1-8 1) + (-> *ocean-work* trans-temp-masks 0 mask (+ a0-12 (* v1-27 8))) + ) + ) + ) + ) + ) + ) + #f + ) + +;; definition for function ocean-trans-add-constants +(defun ocean-trans-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 (the-as matrix (-> arg0 base)))) + (set-vector! (-> v1-1 vector 0) 0.0 0.0 0.0 1.0) + (set-vector! (-> v1-1 vector 1) 98304.0 0.0 0.0 1.0) + (set-vector! (-> v1-1 vector 2) 0.0 0.0 98304.0 1.0) + (set-vector! (-> v1-1 vector 3) 98304.0 0.0 98304.0 1.0) + ) + (let ((v0-0 (&+ (-> arg0 base) 64))) + (set! (-> arg0 base) v0-0) + v0-0 + ) + ) + +;; definition for function draw-ocean-transition +;; INFO: Return type mismatch int vs none. +(defun draw-ocean-transition ((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) + ) + (dotimes (v1-0 16) + (set! (-> *ocean-work* trans-camera-masks v1-0 word) (the-as uint 0)) + (set! (-> *ocean-work* near-mask-indices v1-0) (the-as uint -1)) + ) + (dotimes (v1-3 64) + (set! (-> *ocean-work* trans-mask-ptrs v1-3) (the-as (pointer int32) #f)) + ) + (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) + (when (not (ocean-mid-mask-ptrs-bit? s5-0)) + (when (ocean-mid-camera-masks-bit? s5-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) + ) + ) + (if (sphere-cull sv-36) + (ocean-make-trans-camera-masks s5-0 s3-0 (- s5-0 sv-34) (- s3-0 sv-32)) + ) + ) + ) + (+! s3-0 1) + ) + ) + (+! s5-0 1) + ) + ) + (let ((a2-2 192) + (a1-8 0) + (a0-11 192) + (v1-32 0) + ) + (let ((a3-1 sv-34) + (t0-0 sv-35) + ) + (while (>= t0-0 a3-1) + (let ((t1-0 sv-32) + (t2-0 sv-33) + ) + (while (>= t2-0 t1-0) + (set! + sv-40 + (-> + *ocean-work* + trans-camera-masks + (+ (* (- a3-1 sv-34) 4) (- t1-0 sv-32)) + ) + ) + (when (nonzero? (-> sv-40 word)) + (dotimes (t3-10 4) + (let ((t4-5 (-> sv-40 mask t3-10))) + (when (nonzero? t4-5) + (let ((t5-2 (+ (* a3-1 4) (the-as uint t3-10)))) + (if (< t5-2 (the-as uint a0-11)) + (set! a0-11 (the-as int t5-2)) + ) + (if (< (the-as uint v1-32) t5-2) + (set! v1-32 (the-as int t5-2)) + ) + ) + (dotimes (t5-3 4) + (when (logtest? t4-5 (ash 1 t5-3)) + (let ((t6-9 (+ (* t1-0 4) (the-as uint t5-3)))) + (if (< t6-9 (the-as uint a2-2)) + (set! a2-2 (the-as int t6-9)) + ) + (if (< (the-as uint a1-8) t6-9) + (set! a1-8 (the-as int t6-9)) + ) + ) + ) + ) + ) + ) + ) + ) + (+! t1-0 1) + ) + ) + (+! a3-1 1) + ) + ) + (set! (-> *ocean-work* near-minx) (the-as uint (+ a2-2 -1))) + (set! (-> *ocean-work* near-maxx) (the-as uint (+ a1-8 1))) + (set! (-> *ocean-work* near-minz) (the-as uint (+ a0-11 -1))) + (set! (-> *ocean-work* near-maxz) (the-as uint (+ v1-32 1))) + ) + (dotimes (v1-34 16) + (set! + (-> *ocean-work* trans-temp-masks v1-34 word) + (-> *ocean-work* trans-camera-masks v1-34 word) + ) + ) + (let ((s5-1 sv-34) + (s4-1 sv-35) + ) + (while (>= s4-1 s5-1) + (let ((s3-1 sv-32) + (s2-1 sv-33) + ) + (while (>= s2-1 s3-1) + (when (not (ocean-mid-mask-ptrs-bit? s5-1)) + (when (ocean-mid-camera-masks-bit? s5-1) + (let + ((v1-43 + (-> + *ocean-map* + ocean-trans-indices + data + (+ (* (the-as uint 48) s5-1) (the-as int s3-1)) + ) + ) + ) + (when (>= (-> v1-43 parent) 0) + (set! sv-44 (+ (* (- s5-1 sv-34) 4) (- s3-1 sv-32))) + (set! + (-> *ocean-work* near-mask-indices sv-44) + (the-as uint (-> v1-43 child)) + ) + (let ((s1-0 (-> *ocean-map* ocean-mid-masks data (-> v1-43 parent)))) + (dotimes (s0-0 4) + (let + ((a3-5 + (-> (the-as ocean-mid-mask (+ s0-0 (the-as int s1-0))) mask 0) + ) + ) + (if (!= a3-5 255) + (ocean-trans-add-upload-strip + arg0 + s5-1 + s3-1 + a3-5 + sv-44 + (the-as uint s0-0) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (+! s3-1 1) + ) + ) + (+! s5-1 1) + ) + ) + (ocean-mid-add-call-flush arg0 (the-as uint 41)) + (ocean-trans-add-constants arg0) + (draw-ocean-transition-seams arg0) + (ocean-mid-add-call-flush arg0 (the-as uint 41)) + 0 + (none) + ) diff --git a/goal_src/engine/gfx/ocean/ocean.gc b/goal_src/engine/gfx/ocean/ocean.gc index cf4dd7adce..a7aca41e6d 100644 --- a/goal_src/engine/gfx/ocean/ocean.gc +++ b/goal_src/engine/gfx/ocean/ocean.gc @@ -5,3 +5,5 @@ ;; name in dgo: ocean ;; dgos: GAME, ENGINE +;; TODO - for ocean-transition +(define-extern *ocean-map* ocean-map) diff --git a/test/decompiler/reference/engine/gfx/hw/display-h_REF.gc b/test/decompiler/reference/engine/gfx/hw/display-h_REF.gc index d819fa94a2..24cb1c85e1 100644 --- a/test/decompiler/reference/engine/gfx/hw/display-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/hw/display-h_REF.gc @@ -90,7 +90,7 @@ (debug-buf dma-buffer :offset 36) (global-buf dma-buffer :offset 40) (bucket-group dma-bucket :offset 44) - (buffer uint32 11 :offset 4) + (buffer dma-buffer 11 :offset 4) (profile-bar profile-bar 2 :offset 48) (run-time uint64 :offset 56) ) diff --git a/test/decompiler/reference/engine/gfx/ocean/ocean-h_REF.gc b/test/decompiler/reference/engine/gfx/ocean/ocean-h_REF.gc index ac1514b302..de6c204e19 100644 --- a/test/decompiler/reference/engine/gfx/ocean/ocean-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/ocean/ocean-h_REF.gc @@ -121,7 +121,7 @@ ;; definition for method 3 of type ocean-mid-mask (defmethod inspect ocean-mid-mask ((obj ocean-mid-mask)) (format #t "[~8x] ~A~%" obj 'ocean-mid-mask) - (format #t "~Tmask[8] @ #x~X~%" (&-> obj dword)) + (format #t "~Tmask[8] @ #x~X~%" (-> obj mask)) (format #t "~Tdword: #x~X~%" (-> obj dword)) obj ) @@ -161,7 +161,7 @@ ;; definition of type ocean-trans-mask (deftype ocean-trans-mask (structure) - ((mask uint16 4 :offset-assert 0) + ((mask uint8 4 :offset-assert 0) (word uint64 :offset 0) ) :pack-me @@ -374,9 +374,9 @@ (corner-array ocean-corner 25 :inline :offset-assert 80) (corner-count int32 :offset-assert 2080) (temp-vecs vector 4 :inline :offset-assert 2096) - (mid-mask-ptrs pointer 36 :offset-assert 2160) + (mid-mask-ptrs (pointer int32) 36 :offset-assert 2160) (mid-camera-masks uint64 36 :offset-assert 2304) - (trans-mask-ptrs pointer 64 :offset-assert 2592) + (trans-mask-ptrs (pointer int32) 64 :offset-assert 2592) (trans-camera-masks ocean-trans-mask 16 :inline :offset-assert 2848) (trans-temp-masks ocean-trans-mask 16 :inline :offset-assert 2976) (near-mask-indices uint16 16 :offset-assert 3104) diff --git a/test/decompiler/reference/engine/gfx/ocean/ocean-trans-tables_REF.gc b/test/decompiler/reference/engine/gfx/ocean/ocean-trans-tables_REF.gc index f6173e19bc..1497f175c6 100644 --- a/test/decompiler/reference/engine/gfx/ocean/ocean-trans-tables_REF.gc +++ b/test/decompiler/reference/engine/gfx/ocean/ocean-trans-tables_REF.gc @@ -849,110 +849,112 @@ ) ) -;; definition for symbol *ocean-trans-corner-table*, type (pointer float) +;; definition for symbol *ocean-trans-corner-table*, type (inline-array vector4w-2) (define *ocean-trans-corner-table* - (new 'static 'array float 100 - 1.0 - 0.0 - 0.0 - 0.0 - 0.75 - 0.25 - 0.0 - 0.0 - 0.5 - 0.5 - 0.0 - 0.0 - 0.25 - 0.75 - 0.0 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.75 - 0.0 - 0.25 - 0.0 - 0.5625 - 0.1875 - 0.1875 - 0.0625 - 0.375 - 0.375 - 0.125 - 0.125 - 0.1875 - 0.5625 - 0.0625 - 0.1875 - 0.0 - 0.75 - 0.0 - 0.25 - 0.5 - 0.0 - 0.5 - 0.0 - 0.375 - 0.125 - 0.375 - 0.125 - 0.25 - 0.25 - 0.25 - 0.25 - 0.125 - 0.375 - 0.125 - 0.375 - 0.0 - 0.5 - 0.0 - 0.5 - 0.25 - 0.0 - 0.75 - 0.0 - 0.1875 - 0.0625 - 0.5625 - 0.1875 - 0.125 - 0.125 - 0.375 - 0.375 - 0.0625 - 0.1875 - 0.1875 - 0.5625 - 0.0 - 0.25 - 0.0 - 0.75 - 0.0 - 0.0 - 1.0 - 0.0 - 0.0 - 0.0 - 0.75 - 0.25 - 0.0 - 0.0 - 0.5 - 0.5 - 0.0 - 0.0 - 0.25 - 0.75 - 0.0 - 0.0 - 0.0 - 1.0 + (the-as (inline-array vector4w-2) + (new 'static 'array float 100 + 1.0 + 0.0 + 0.0 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.75 + 0.0 + 0.25 + 0.0 + 0.5625 + 0.1875 + 0.1875 + 0.0625 + 0.375 + 0.375 + 0.125 + 0.125 + 0.1875 + 0.5625 + 0.0625 + 0.1875 + 0.0 + 0.75 + 0.0 + 0.25 + 0.5 + 0.0 + 0.5 + 0.0 + 0.375 + 0.125 + 0.375 + 0.125 + 0.25 + 0.25 + 0.25 + 0.25 + 0.125 + 0.375 + 0.125 + 0.375 + 0.0 + 0.5 + 0.0 + 0.5 + 0.25 + 0.0 + 0.75 + 0.0 + 0.1875 + 0.0625 + 0.5625 + 0.1875 + 0.125 + 0.125 + 0.375 + 0.375 + 0.0625 + 0.1875 + 0.1875 + 0.5625 + 0.0 + 0.25 + 0.0 + 0.75 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + 0.75 + 0.25 + 0.0 + 0.0 + 0.5 + 0.5 + 0.0 + 0.0 + 0.25 + 0.75 + 0.0 + 0.0 + 0.0 + 1.0 + ) ) ) @@ -1123,29 +1125,13 @@ ) ) -;; definition for symbol *ocean-trans-st-table*, type (pointer float) +;; definition for symbol *ocean-trans-st-table*, type (inline-array vector) (define *ocean-trans-st-table* - (new 'static 'array float 16 - 0.0 - 0.0 - 1.0 - 0.0 - 1.0 - 0.0 - 1.0 - 0.0 - 0.0 - 1.0 - 1.0 - 0.0 - 1.0 - 1.0 - 1.0 - 0.0 + (new 'static 'inline-array vector 4 + (new 'static 'vector :z 1.0) + (new 'static 'vector :x 1.0 :z 1.0) + (new 'static 'vector :y 1.0 :z 1.0) + (new 'static 'vector :x 1.0 :y 1.0 :z 1.0) ) ) - - - - diff --git a/test/decompiler/reference/engine/gfx/ocean/ocean-transition_REF.gc b/test/decompiler/reference/engine/gfx/ocean/ocean-transition_REF.gc new file mode 100644 index 0000000000..043ef0f79b --- /dev/null +++ b/test/decompiler/reference/engine/gfx/ocean/ocean-transition_REF.gc @@ -0,0 +1,1246 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for function ocean-trans-camera-masks-bit? +(defun ocean-trans-camera-masks-bit? ((arg0 uint) (arg1 uint)) + (let ((v1-3 (- arg0 (* (-> *ocean-work* mid-minz) 4))) + (a0-4 (- arg1 (* (-> *ocean-work* mid-minx) 4))) + ) + (cond + ((or + (< v1-3 0) + (>= v1-3 (the-as uint 16)) + (< a0-4 0) + (>= a0-4 (the-as uint 16)) + ) + #f + ) + (else + (let* ((a3-0 (shr v1-3 2)) + (a2-3 (shr a0-4 2)) + (a1-2 (logand v1-3 3)) + (v1-4 (logand a0-4 3)) + (a0-6 (+ (* a3-0 4) a2-3)) + ) + (nonzero? + (logand + (-> *ocean-work* trans-camera-masks 0 mask (+ a1-2 (* a0-6 8))) + (ash 1 v1-4) + ) + ) + ) + ) + ) + ) + ) + +;; definition for function ocean-trans-mask-ptrs-bit? +(defun ocean-trans-mask-ptrs-bit? ((arg0 int) (arg1 int)) + (let ((v1-3 (- arg0 (the-as int (* (-> *ocean-work* mid-minz) 4)))) + (a0-4 (- arg1 (the-as int (* (-> *ocean-work* mid-minx) 4)))) + ) + (cond + ((or + (< (the-as uint v1-3) 0) + (>= (the-as uint v1-3) (the-as uint 16)) + (< (the-as uint a0-4) 0) + (>= (the-as uint a0-4) (the-as uint 16)) + ) + #f + ) + (else + (let* ((a3-0 (shr v1-3 2)) + (a2-3 (shr a0-4 2)) + (a1-2 (logand v1-3 3)) + (v1-4 (logand a0-4 3)) + (a0-11 + (-> + *ocean-work* + trans-mask-ptrs + (+ (* (+ (* a3-0 4) a2-3) 4) a1-2) + ) + ) + ) + (if a0-11 + (nonzero? (logand (-> a0-11 1) (ash 1 v1-4))) + #f + ) + ) + ) + ) + ) + ) + +;; definition for function ocean-trans-mask-ptrs-set! +(defun ocean-trans-mask-ptrs-set! ((arg0 int) (arg1 int)) + (let ((v1-3 (- arg0 (the-as int (* (-> *ocean-work* mid-minz) 4)))) + (a0-4 (- arg1 (the-as int (* (-> *ocean-work* mid-minx) 4)))) + ) + (cond + ((or + (< (the-as uint v1-3) 0) + (>= (the-as uint v1-3) (the-as uint 16)) + (< (the-as uint a0-4) 0) + (>= (the-as uint a0-4) (the-as uint 16)) + ) + #f + ) + (else + (let* ((a2-3 (shr v1-3 2)) + (a1-2 (shr a0-4 2)) + (v1-4 (logand v1-3 3)) + (a0-5 (logand a0-4 3)) + (a3-6 + (-> + *ocean-work* + trans-mask-ptrs + (+ (* (+ (* a2-3 4) a1-2) 4) v1-4) + ) + ) + ) + (cond + (a3-6 + (cond + ((logtest? (-> a3-6 1) (ash 1 a0-5)) + #f + ) + (else + (let ((a1-6 (-> *ocean-work* trans-temp-masks (+ (* a2-3 4) a1-2)))) + (logior! (-> a1-6 mask v1-4) (ash 1 a0-5)) + ) + #t + ) + ) + ) + (else + #f + ) + ) + ) + ) + ) + ) + ) + +;; definition for function ocean-trans-add-upload-table +;; WARN: Function may read a register that is not set: f31 +;; Used lq/sq +(defun + ocean-trans-add-upload-table + ((arg0 dma-buffer) + (arg1 int) + (arg2 int) + (arg3 (pointer float)) + (arg4 int) + (arg5 symbol) + ) + (local-vars + (r0-0 uint128) + (r0-1 uint128) + (r0-2 uint128) + (r0-3 uint128) + (r0-4 uint128) + (r0-5 uint128) + (v1-12 (inline-array vector)) + (v1-14 float) + (a0-23 uint128) + (a0-24 uint128) + (a1-15 uint128) + (a1-16 uint128) + (a1-17 uint128) + (a2-15 uint128) + (a2-16 uint128) + (a3-10 uint128) + (f31-0 none) + ) + (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! arg1 arg2) + (let ((a1-2 (new-stack-vector0))) + (let ((v1-1 (-> *ocean-map* start-corner))) + (set! (-> a1-2 x) (+ (-> v1-1 x) (* 98304.0 (the float arg2)))) + (set! (-> a1-2 y) (-> v1-1 y)) + (set! (-> a1-2 z) (+ (-> v1-1 z) (* 98304.0 (the float arg1)))) + ) + (set! (-> a1-2 w) 1.0) + ) + (ocean-mid-add-matrices arg0) + (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* ((a0-5 (logand arg1 3)) + (v1-7 (logand arg2 3)) + (v1-8 (+ (* 5 a0-5) v1-7)) + ) + (.lvf vf5 (&-> (&-> *ocean-trans-corner-table* 0 quad v1-8) 0)) + (.lvf vf6 (&-> (&-> *ocean-trans-corner-table* 0 quad (+ v1-8 1)) 0)) + (.lvf vf7 (&-> (&-> *ocean-trans-corner-table* 0 quad (+ v1-8 5)) 0)) + (.lvf vf8 (&-> (&-> *ocean-trans-corner-table* 0 quad (+ v1-8 6)) 0)) + ) + (.mov v1-12 vf8) + (let ((v1-13 (the-as (inline-array vector) (-> arg0 base)))) + (let ((a0-16 (/ arg1 4)) + (a1-11 (/ 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-13 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-13 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-13 2 quad) vf11) + (nop!) + (.svf (&-> v1-13 3 quad) vf12) + (let + ((a2-14 + (the-as + uint128 + (-> *ocean-map* ocean-colors colors (+ (* 52 a0-16) a1-11)) + ) + ) + (a3-9 + (the-as + uint128 + (-> *ocean-map* ocean-colors colors (+ (+ a1-11 1) (* 52 a0-16))) + ) + ) + (t0-10 + (the-as + uint128 + (-> *ocean-map* ocean-colors colors (+ (* 52 (+ a0-16 1)) a1-11)) + ) + ) + (a0-22 + (the-as + uint128 + (-> + *ocean-map* + ocean-colors + colors + (+ (+ a1-11 1) (* 52 (+ a0-16 1))) + ) + ) + ) + ) + (.pextlb a1-15 r0-0 a2-14) + (.mov r0-1 f31-0) + (.pextlb a2-15 r0-1 a3-9) + (.mov r0-2 f31-0) + (.pextlb a3-10 r0-2 t0-10) + (.mov r0-3 f31-0) + (.pextlb a0-23 r0-3 a0-22) + ) + ) + (.mov r0-4 f31-0) + (.pextlh a1-16 r0-4 a1-15) + (.mov r0-5 f31-0) + (.pextlh a2-16 r0-5 a2-15) + (.mov vf1 a1-16) + (.pextlh a1-17 r0-5 a3-10) + (.mov vf2 a2-16) + (.pextlh a0-24 r0-5 a0-23) + (.mov vf3 a1-17) + (nop!) + (.mov vf4 a0-24) + (.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-13 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-13 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-13 6 quad) vf11) + (nop!) + (.svf (&-> v1-13 7 quad) vf12) + ) + (.mov v1-14 vf12) + (&+! (-> arg0 base) 128) + (let* ((v1-17 arg0) + (a0-25 (the-as object (-> v1-17 base))) + ) + (set! + (-> (the-as dma-packet a0-25) dma) + (new 'static 'dma-tag + :id (dma-tag-id ref) + :addr (the-as int arg3) + :qwc arg4 + ) + ) + (set! + (-> (the-as dma-packet a0-25) vif0) + (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + ) + (set! + (-> (the-as dma-packet a0-25) vif1) + (new 'static 'vif-tag :imm #x8011 :cmd (vif-cmd unpack-v4-32) :num arg4) + ) + (set! (-> v1-17 base) (&+ (the-as pointer a0-25) 16)) + ) + (if arg5 + (ocean-mid-add-call arg0 275) + (ocean-mid-add-call arg0 107) + ) + ) + (none) + ) + ) + +;; definition for function ocean-trans-add-upload-strip +;; WARN: Function may read a register that is not set: f31 +;; Used lq/sq +(defun + ocean-trans-add-upload-strip + ((arg0 dma-buffer) + (arg1 uint) + (arg2 uint) + (arg3 uint) + (arg4 uint) + (arg5 uint) + ) + (local-vars + (r0-0 uint128) + (r0-1 uint128) + (r0-2 uint128) + (r0-3 uint128) + (r0-4 uint128) + (r0-5 uint128) + (v1-8 float) + (a0-23 uint128) + (a0-24 uint128) + (a0-25 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) + ) + (let ((a1-1 (new-stack-vector0))) + (let ((v1-1 (-> *ocean-map* start-corner))) + (set! (-> a1-1 x) (+ (-> v1-1 x) (* 393216.0 (the float arg2)))) + (set! (-> a1-1 y) (-> v1-1 y)) + (set! (-> a1-1 z) (+ (-> v1-1 z) (* 393216.0 (the float arg1)))) + ) + (set! (-> a1-1 w) 1.0) + ) + (ocean-mid-add-matrices arg0) + (let* ((a1-2 9) + (v1-3 arg0) + (a0-2 (the-as object (-> v1-3 base))) + ) + (set! + (-> (the-as dma-packet a0-2) dma) + (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a1-2) + ) + (set! + (-> (the-as dma-packet a0-2) vif0) + (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)) + ) + (set! + (-> (the-as dma-packet a0-2) vif1) + (new 'static 'vif-tag :imm #x8008 :cmd (vif-cmd unpack-v4-32) :num a1-2) + ) + (set! (-> v1-3 base) (&+ (the-as pointer a0-2) 16)) + ) + (let ((v1-4 (the-as object (-> arg0 base)))) + (set! + (-> *ocean-work* trans-mask-ptrs (+ (* arg4 4) arg5)) + (the-as (pointer int32) v1-4) + ) + (set! (-> (the-as vector4w v1-4) x) 10) + (set! (-> (the-as vector4w v1-4) y) (the-as int arg3)) + (set! (-> (the-as vector4w v1-4) z) 0) + (set! (-> (the-as vector4w v1-4) w) 0) + ) + (&+! (-> arg0 base) 16) + (let ((v1-7 (the-as (inline-array vector) (-> arg0 base)))) + (set! (-> v1-7 0 quad) (-> *ocean-trans-st-table* 0 quad)) + (set! (-> v1-7 1 quad) (-> *ocean-trans-st-table* 1 quad)) + (set! (-> v1-7 2 quad) (-> *ocean-trans-st-table* 2 quad)) + (set! (-> v1-7 3 quad) (-> *ocean-trans-st-table* 3 quad)) + (let + ((a0-22 + (the-as + uint128 + (-> + *ocean-map* + ocean-colors + colors + (+ (* 52 (the-as int arg1)) (the-as int arg2)) + ) + ) + ) + (a1-13 + (the-as + uint128 + (-> + *ocean-map* + ocean-colors + colors + (+ (+ arg2 1) (the-as uint (* 52 (the-as int arg1)))) + ) + ) + ) + (a2-14 + (the-as + uint128 + (-> + *ocean-map* + ocean-colors + colors + (+ (* 52 (the-as int (+ arg1 1))) (the-as int arg2)) + ) + ) + ) + (a3-10 + (the-as + uint128 + (-> + *ocean-map* + ocean-colors + colors + (+ (+ arg2 1) (the-as uint (* 52 (the-as int (+ arg1 1))))) + ) + ) + ) + ) + (.pextlb a0-23 r0-0 a0-22) + (.mov r0-1 f31-0) + (.pextlb a1-14 r0-1 a1-13) + (.mov r0-2 f31-0) + (.pextlb a2-15 r0-2 a2-14) + (.mov r0-3 f31-0) + (.pextlb a3-11 r0-3 a3-10) + ) + (.mov r0-4 f31-0) + (.pextlh a0-24 r0-4 a0-23) + (.mov r0-5 f31-0) + (.pextlh a1-15 r0-5 a1-14) + (.mov vf1 a0-24) + (.pextlh a0-25 r0-5 a2-15) + (.mov vf2 a1-15) + (.pextlh a1-16 r0-5 a3-11) + (.mov vf3 a0-25) + (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 quad) vf1) + (nop!) + (.svf (&-> v1-7 5 quad) vf2) + (nop!) + (.svf (&-> v1-7 6 quad) vf3) + (nop!) + (.svf (&-> v1-7 7 quad) vf4) + ) + (.mov v1-8 vf4) + (&+! (-> arg0 base) 128) + (let* ((a1-17 10) + (v1-11 arg0) + (a0-26 (the-as object (-> v1-11 base))) + ) + (set! + (-> (the-as dma-packet a0-26) dma) + (new 'static 'dma-tag + :id (dma-tag-id ref) + :addr (the-as int (+ (+ (* 160 (the-as int arg5)) 0) (the-as int *ocean-trans-strip-array*))) + :qwc a1-17 + ) + ) + (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 a1-17) + ) + (set! (-> v1-11 base) (&+ (the-as pointer a0-26) 16)) + ) + (ocean-mid-add-call arg0 107) + (none) + ) + ) + +;; definition for function ocean-transition-check +;; Used lq/sq +(defun + ocean-transition-check + ((arg0 ocean-trans-mask) (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) (* 98304.0 (the float arg1)))) + (set! (-> v1-0 y) (-> arg3 y)) + (set! (-> v1-0 z) (+ (-> arg3 z) (* 98304.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 19327350000.0) + (logior! (-> arg0 mask arg2) (ash 1 arg1)) + (return #f) + ) + (set! (-> v1-0 x) (+ 98304.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 19327350000.0) + (logior! (-> arg0 mask arg2) (ash 1 arg1)) + (return #f) + ) + (set! (-> v1-0 z) (+ 98304.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 19327350000.0) + (logior! (-> arg0 mask arg2) (ash 1 arg1)) + (return #f) + ) + (set! (-> v1-0 x) (+ -98304.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 19327350000.0) + (logior! (-> arg0 mask arg2) (ash 1 arg1)) + (return #f) + v0-0 + ) + ) + ) + +;; definition for function ocean-make-trans-camera-masks +;; Used lq/sq +(defun + ocean-make-trans-camera-masks + ((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 (-> *ocean-work* 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) + (+ (-> *ocean-map* start-corner x) (* 393216.0 (the float arg1))) + ) + (set! (-> sv-56 y) (-> *ocean-map* start-corner y)) + (set! + (-> sv-56 z) + (+ (-> *ocean-map* start-corner z) (* 393216.0 (the float arg0))) + ) + (set! (-> sv-56 w) 1.0) + (dotimes (gp-0 4) + (dotimes (s5-0 4) + (set! + (-> sv-60 x) + (- (+ (-> sv-56 x) (* 98304.0 (the float s5-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 gp-0))) (-> sv-52 z)) + ) + (ocean-transition-check sv-48 s5-0 gp-0 sv-56) + ) + ) + #f + ) + +;; definition for function ocean-trans-add-upload +(defun ocean-trans-add-upload ((arg0 dma-buffer) (arg1 int) (arg2 int)) + (when (not (ocean-trans-mask-ptrs-bit? arg1 arg2)) + (let + ((s1-0 + (ocean-trans-camera-masks-bit? + (the-as uint (+ arg1 -1)) + (the-as uint arg2) + ) + ) + (s2-0 + (ocean-trans-camera-masks-bit? + (the-as uint (+ arg1 1)) + (the-as uint arg2) + ) + ) + (s3-0 + (ocean-trans-camera-masks-bit? + (the-as uint arg1) + (the-as uint (+ arg2 -1)) + ) + ) + (a0-6 + (ocean-trans-camera-masks-bit? + (the-as uint arg1) + (the-as uint (+ arg2 1)) + ) + ) + (v1-0 0) + ) + (if s1-0 + (+! v1-0 1) + ) + (if s2-0 + (+! v1-0 2) + ) + (if s3-0 + (+! v1-0 4) + ) + (if a0-6 + (+! v1-0 8) + ) + (cond + ((= v1-0 1) + (if (not (ocean-trans-mask-ptrs-bit? (+ arg1 -1) arg2)) + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-up-table* + 11 + #t + ) + ) + ) + ((= v1-0 2) + (if (not (ocean-trans-mask-ptrs-bit? (+ arg1 1) arg2)) + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-down-table* + 11 + #t + ) + ) + ) + ((= v1-0 4) + (if (not (ocean-trans-mask-ptrs-bit? arg1 (+ arg2 -1))) + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-left-table* + 11 + #t + ) + ) + ) + ((= v1-0 5) + (let ((s3-1 (ocean-trans-mask-ptrs-bit? (+ arg1 -1) arg2)) + (v1-1 (ocean-trans-mask-ptrs-bit? arg1 (+ arg2 -1))) + ) + (cond + ((and s3-1 v1-1) + ) + (s3-1 + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-left-table* + 11 + #t + ) + ) + (v1-1 + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-up-table* + 11 + #t + ) + ) + (else + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-up-left-table* + 18 + #f + ) + ) + ) + ) + ) + ((= v1-0 6) + (let ((s3-2 (ocean-trans-mask-ptrs-bit? (+ arg1 1) arg2)) + (v1-2 (ocean-trans-mask-ptrs-bit? arg1 (+ arg2 -1))) + ) + (cond + ((and s3-2 v1-2) + ) + (s3-2 + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-left-table* + 11 + #t + ) + ) + (v1-2 + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-down-table* + 11 + #t + ) + ) + (else + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-down-left-table* + 18 + #t + ) + ) + ) + ) + ) + ((= v1-0 8) + (if (not (ocean-trans-mask-ptrs-bit? arg1 (+ arg2 1))) + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-right-table* + 11 + #t + ) + ) + ) + ((= v1-0 9) + (let ((s3-3 (ocean-trans-mask-ptrs-bit? (+ arg1 -1) arg2)) + (v1-3 (ocean-trans-mask-ptrs-bit? arg1 (+ arg2 1))) + ) + (cond + ((and s3-3 v1-3) + ) + (s3-3 + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-right-table* + 11 + #t + ) + ) + (v1-3 + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-up-table* + 11 + #t + ) + ) + (else + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-up-right-table* + 18 + #t + ) + ) + ) + ) + ) + ((= v1-0 10) + (let ((s3-4 (ocean-trans-mask-ptrs-bit? (+ arg1 1) arg2)) + (v1-4 (ocean-trans-mask-ptrs-bit? arg1 (+ arg2 1))) + ) + (cond + ((and s3-4 v1-4) + ) + (s3-4 + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-right-table* + 11 + #t + ) + ) + (v1-4 + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-down-table* + 11 + #t + ) + ) + (else + (ocean-trans-add-upload-table + arg0 + arg1 + arg2 + *ocean-trans-down-right-table* + 18 + #f + ) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for function draw-ocean-transition-seams +(defun draw-ocean-transition-seams ((arg0 dma-buffer)) + (local-vars + (sv-32 uint) + (sv-33 uint) + (sv-34 uint) + (sv-35 uint) + (sv-36 sphere) + ) + (set! sv-32 (-> *ocean-work* near-minx)) + (set! sv-33 (-> *ocean-work* near-maxx)) + (set! sv-34 (-> *ocean-work* near-minz)) + (set! sv-35 (-> *ocean-work* near-maxz)) + (set! sv-36 (new 'stack 'sphere)) + (set! (-> sv-36 y) (-> *ocean-map* start-corner y)) + (set! (-> sv-36 w) 69511.42) + (when (and (< sv-32 sv-33) (< sv-34 sv-35)) + (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) + (+ + (+ 49152.0 (* 98304.0 (the float s3-0))) + (-> *ocean-map* start-corner x) + ) + ) + (set! + (-> sv-36 z) + (+ + (+ 49152.0 (* 98304.0 (the float s5-0))) + (-> *ocean-map* start-corner z) + ) + ) + (when (sphere-cull sv-36) + (if (not (ocean-trans-camera-masks-bit? s5-0 s3-0)) + (ocean-trans-add-upload arg0 (the-as int s5-0) (the-as int s3-0)) + ) + ) + (+! s3-0 1) + ) + ) + (+! s5-0 1) + ) + ) + ) + (dotimes (v1-27 16) + (when (nonzero? (-> *ocean-work* trans-camera-masks v1-27 word)) + (dotimes (a0-12 4) + (let ((a1-8 (-> *ocean-work* trans-mask-ptrs (+ (* v1-27 4) a0-12)))) + (if a1-8 + (logior! + (-> a1-8 1) + (-> *ocean-work* trans-temp-masks 0 mask (+ a0-12 (* v1-27 8))) + ) + ) + ) + ) + ) + ) + #f + ) + +;; definition for function ocean-trans-add-constants +(defun ocean-trans-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 (the-as matrix (-> arg0 base)))) + (set-vector! (-> v1-1 vector 0) 0.0 0.0 0.0 1.0) + (set-vector! (-> v1-1 vector 1) 98304.0 0.0 0.0 1.0) + (set-vector! (-> v1-1 vector 2) 0.0 0.0 98304.0 1.0) + (set-vector! (-> v1-1 vector 3) 98304.0 0.0 98304.0 1.0) + ) + (let ((v0-0 (&+ (-> arg0 base) 64))) + (set! (-> arg0 base) v0-0) + v0-0 + ) + ) + +;; definition for function draw-ocean-transition +;; INFO: Return type mismatch int vs none. +(defun draw-ocean-transition ((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) + ) + (dotimes (v1-0 16) + (set! (-> *ocean-work* trans-camera-masks v1-0 word) (the-as uint 0)) + (set! (-> *ocean-work* near-mask-indices v1-0) (the-as uint -1)) + ) + (dotimes (v1-3 64) + (set! (-> *ocean-work* trans-mask-ptrs v1-3) (the-as (pointer int32) #f)) + ) + (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) + (when (not (ocean-mid-mask-ptrs-bit? s5-0)) + (when (ocean-mid-camera-masks-bit? s5-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) + ) + ) + (if (sphere-cull sv-36) + (ocean-make-trans-camera-masks s5-0 s3-0 (- s5-0 sv-34) (- s3-0 sv-32)) + ) + ) + ) + (+! s3-0 1) + ) + ) + (+! s5-0 1) + ) + ) + (let ((a2-2 192) + (a1-8 0) + (a0-11 192) + (v1-32 0) + ) + (let ((a3-1 sv-34) + (t0-0 sv-35) + ) + (while (>= t0-0 a3-1) + (let ((t1-0 sv-32) + (t2-0 sv-33) + ) + (while (>= t2-0 t1-0) + (set! + sv-40 + (-> + *ocean-work* + trans-camera-masks + (+ (* (- a3-1 sv-34) 4) (- t1-0 sv-32)) + ) + ) + (when (nonzero? (-> sv-40 word)) + (dotimes (t3-10 4) + (let ((t4-5 (-> sv-40 mask t3-10))) + (when (nonzero? t4-5) + (let ((t5-2 (+ (* a3-1 4) (the-as uint t3-10)))) + (if (< t5-2 (the-as uint a0-11)) + (set! a0-11 (the-as int t5-2)) + ) + (if (< (the-as uint v1-32) t5-2) + (set! v1-32 (the-as int t5-2)) + ) + ) + (dotimes (t5-3 4) + (when (logtest? t4-5 (ash 1 t5-3)) + (let ((t6-9 (+ (* t1-0 4) (the-as uint t5-3)))) + (if (< t6-9 (the-as uint a2-2)) + (set! a2-2 (the-as int t6-9)) + ) + (if (< (the-as uint a1-8) t6-9) + (set! a1-8 (the-as int t6-9)) + ) + ) + ) + ) + ) + ) + ) + ) + (+! t1-0 1) + ) + ) + (+! a3-1 1) + ) + ) + (set! (-> *ocean-work* near-minx) (the-as uint (+ a2-2 -1))) + (set! (-> *ocean-work* near-maxx) (the-as uint (+ a1-8 1))) + (set! (-> *ocean-work* near-minz) (the-as uint (+ a0-11 -1))) + (set! (-> *ocean-work* near-maxz) (the-as uint (+ v1-32 1))) + ) + (dotimes (v1-34 16) + (set! + (-> *ocean-work* trans-temp-masks v1-34 word) + (-> *ocean-work* trans-camera-masks v1-34 word) + ) + ) + (let ((s5-1 sv-34) + (s4-1 sv-35) + ) + (while (>= s4-1 s5-1) + (let ((s3-1 sv-32) + (s2-1 sv-33) + ) + (while (>= s2-1 s3-1) + (when (not (ocean-mid-mask-ptrs-bit? s5-1)) + (when (ocean-mid-camera-masks-bit? s5-1) + (let + ((v1-43 + (-> + *ocean-map* + ocean-trans-indices + data + (+ (* (the-as uint 48) s5-1) (the-as int s3-1)) + ) + ) + ) + (when (>= (-> v1-43 parent) 0) + (set! sv-44 (+ (* (- s5-1 sv-34) 4) (- s3-1 sv-32))) + (set! + (-> *ocean-work* near-mask-indices sv-44) + (the-as uint (-> v1-43 child)) + ) + (let ((s1-0 (-> *ocean-map* ocean-mid-masks data (-> v1-43 parent)))) + (dotimes (s0-0 4) + (let + ((a3-5 + (-> (the-as ocean-mid-mask (+ s0-0 (the-as int s1-0))) mask 0) + ) + ) + (if (!= a3-5 255) + (ocean-trans-add-upload-strip + arg0 + s5-1 + s3-1 + a3-5 + sv-44 + (the-as uint s0-0) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (+! s3-1 1) + ) + ) + (+! s5-1 1) + ) + ) + (ocean-mid-add-call-flush arg0 (the-as uint 41)) + (ocean-trans-add-constants arg0) + (draw-ocean-transition-seams arg0) + (ocean-mid-add-call-flush arg0 (the-as uint 41)) + 0 + (none) + ) + + + +