From 23aeda166407a724108dc649c21d4c8a44be40a3 Mon Sep 17 00:00:00 2001 From: Hat Kid <6624576+Hat-Kid@users.noreply.github.com> Date: Sat, 6 Apr 2024 20:27:36 +0200 Subject: [PATCH] decomp3: add background data to pc renderers, get mood and time of day stuff running (#3450) --- decompiler/config/jak3/all-types.gc | 204 +- decompiler/config/jak3/ntsc_v1/hacks.jsonc | 4 +- .../config/jak3/ntsc_v1/label_types.jsonc | 24 + .../jak3/ntsc_v1/stack_structures.jsonc | 4 +- .../config/jak3/ntsc_v1/type_casts.jsonc | 61 +- .../opengl_renderer/OpenGLRenderer.cpp | 9 +- .../opengl_renderer/background/Shrub.cpp | 2 +- game/mips2c/jak3_functions/font.cpp | 16 +- goal_src/jak3/engine/draw/drawable.gc | 22 +- goal_src/jak3/engine/game/main.gc | 4 +- .../jak3/engine/gfx/background/background.gc | 130 +- .../jak3/engine/gfx/foreground/foreground.gc | 2 +- goal_src/jak3/engine/gfx/mood/mood-funcs.gc | 519 +++++ goal_src/jak3/engine/gfx/mood/mood-h.gc | 347 +-- goal_src/jak3/engine/gfx/mood/mood-tables2.gc | 436 ++++ goal_src/jak3/engine/gfx/mood/mood.gc | 1617 +++++++++++++- goal_src/jak3/engine/gfx/mood/time-of-day.gc | 795 ++++++- goal_src/jak3/engine/gfx/mood/weather-part.gc | 909 +++++++- goal_src/jak3/engine/gfx/sky/sky-data.gc | 1097 ++++++++++ goal_src/jak3/engine/gfx/sky/sky-h.gc | 6 +- goal_src/jak3/engine/gfx/sky/sky-tng.gc | 56 + .../engine/gfx/texture/texture-anim-tables.gc | 8 + goal_src/jak3/engine/level/bsp-h.gc | 1 + goal_src/jak3/engine/physics/cloth.gc | 7 + .../jak3/engine/target/gun/gun-red-shot.gc | 3 +- goal_src/jak3/engine/target/logic-target.gc | 2 +- goal_src/jak3/engine/ui/hud-classes.gc | 4 +- goal_src/jak3/engine/ui/progress/progress.gc | 4 +- goal_src/jak3/kernel/gstate.gc | 5 +- .../engine/gfx/foreground/foreground_REF.gc | 168 +- .../jak3/engine/gfx/mood/mood-h_REF.gc | 40 +- .../jak3/engine/gfx/mood/mood_REF.gc | 1941 +++++++++++++++++ .../jak3/engine/gfx/sky/sky-h_REF.gc | 6 +- .../reference/jak3/engine/level/bsp-h_REF.gc | 1 + test/offline/config/jak3/config.jsonc | 4 +- 35 files changed, 8143 insertions(+), 315 deletions(-) create mode 100644 test/decompiler/reference/jak3/engine/gfx/mood/mood_REF.gc diff --git a/decompiler/config/jak3/all-types.gc b/decompiler/config/jak3/all-types.gc index 0b2d100b10..2272adb34a 100644 --- a/decompiler/config/jak3/all-types.gc +++ b/decompiler/config/jak3/all-types.gc @@ -7003,7 +7003,7 @@ (deftype mood-channel (structure) ((data float 24 :offset-assert 0) ;; guessed by decompiler - (vecs vector4 6 :offset 0) ;; guessed by decompiler + (vecs vector4 6 :inline :offset 0) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x60 @@ -7034,6 +7034,7 @@ (deftype mood-fog-table (structure) ((data mood-fog 8 :inline :offset-assert 0) ;; guessed by decompiler + (_data uint128 24 :offset 0 :score -1) ) :method-count-assert 9 :size-assert #x180 @@ -7059,6 +7060,7 @@ (deftype mood-color-table (structure) ((data mood-color 8 :inline :offset-assert 0) ;; guessed by decompiler + (_data uint128 16 :offset 0 :score -1) ) :method-count-assert 9 :size-assert #x100 @@ -7144,6 +7146,7 @@ ((time float :offset-assert 0) (fade float :offset-assert 4) ) + :pack-me :method-count-assert 9 :size-assert #x8 :flag-assert #x900000008 @@ -7153,6 +7156,7 @@ ((flicker-off uint8 :offset-assert 0) (flicker-on uint8 :offset-assert 1) ) + :allow-misaligned :method-count-assert 9 :size-assert #x2 :flag-assert #x900000002 @@ -7202,6 +7206,7 @@ (length uint8 :offset-assert 5) (height uint8 :offset-assert 6) ) + :pack-me :method-count-assert 9 :size-assert #x7 :flag-assert #x900000007 @@ -7238,6 +7243,7 @@ (deftype mood-context (mood-context-core3) ((itimes vector4w 4 :inline :offset-assert 1776) ;; guessed by decompiler (state uint32 32 :offset-assert 1840) ;; guessed by decompiler + (data uint128 123 :offset 0 :score -1) ) :method-count-assert 9 :size-assert #x7b0 @@ -7299,10 +7305,10 @@ :size-assert #x118 :flag-assert #x1900000118 (:methods - (mood-control-method-9 () none) ;; 9 ;; (init-weather! (_type_) none) - (mood-control-method-10 () none) ;; 10 ;; (update-mood-weather! (_type_ float float float float) none) - (mood-control-method-11 () none) ;; 11 ;; (update-mood-range! (_type_ float float float float) none) - (mood-control-method-12 () none) ;; 12 ;; (set-time-for-random-weather! (_type_ float float) none) + (init-weather! (_type_) none) ;; 9 + (set-cloud-and-fog-interp! (_type_ float float float float) none) ;; 10 ;; (update-mood-weather! (_type_ float float float float) none) + (update-mood-range! (_type_ float float float float) none) ;; 11 + (set-time-for-random-weather! (_type_ float float) none) ;; 12 (set-special-interps! "Sets the `*-special-interp` values with the given values @param! this The [[mood-control]] @@ -7310,20 +7316,20 @@ @param rate-interp Value to set [[this::rate-special-interp]] @param set-current-interp? Uses `target-interp` to set [[this::current-special-interp] @returns [[none]]" - (_type_ float float symbol) none) ;; 13 ;; (apply-mood-clouds-and-fog (_type_ mood-control-work) none) + (_type_ float float symbol) none) ;; 13 (weather-event-concluded? ;; TODO - guess at name "@returns [[#t]] if [[this::override-weather-flag]] is set, we aren't in a cutscene and [[this::current-special-interp]] is equal to `0.0`" (_type_) symbol) ;; 14 ;; (apply-mood-color (_type_ mood-control-work) none) - (mood-control-method-15 () none) ;; 15 ;; (apply-mood-channels (_type_ mood-control-work) none) - (mood-control-method-16 () none) ;; 16 ;; (adjust-num-clouds! (_type_ mood-control-work) none) - (mood-control-method-17 () none) ;; 17 ;; (gen-lightning-and-thunder! (_type_) number) - (mood-control-method-18 () none) ;; 18 ;; (play-or-stop-lightning! (_type_ sound-spec vector) sound-id) - (mood-control-method-19 () none) ;; 19 - (mood-control-method-20 () none) ;; 20 - (mood-control-method-21 () none) ;; 21 - (mood-control-method-22 () none) ;; 22 - (mood-control-method-23 () none) ;; 23 - (mood-control-method-24 () none) ;; 24 + (set-lightning-time! (_type_ int int float) none) ;; 15 ;; (apply-mood-channels (_type_ mood-control-work) none) + (apply-mood-clouds-and-fog (_type_ mood-control-work) none) ;; 16 ;; (adjust-num-clouds! (_type_ mood-control-work) none) + (apply-mood-fog (_type_ mood-control-work mood-color-table mood-color-table mood-color-table float) none) ;; 17 + (apply-fog-height (_type_ mood-control-work float float float float) none) ;; 18 + (apply-mood-colors (_type_ mood-control-work) none) ;; 19 + (mood-control-method-20 (_type_ mood-control-work mood-color-table mood-color-table mood-color-table float) none) ;; 20 + (apply-mood-channels (_type_ mood-control-work) none) ;; 21 + (adjust-num-clouds (_type_ mood-control-work) none) ;; 22 + (gen-lightning-and-thunder! (_type_ int) none) ;; 23 + (play-or-stop-lightning-sfx! (_type_ sound-spec vector) none) ;; 24 ) ) @@ -11257,9 +11263,9 @@ :size-assert #x2814 :flag-assert #x2700002814 (:methods - (sky-work-method-9 () none) ;; 9 ;; (init-sun-data! (_type_ int float float float) none) - (sky-work-method-10 () none) ;; 10 ;; (init-orbit-settings! (_type_ int float float float float float float) none) - (sky-work-method-11 () none) ;; 11 ;; (update-colors-for-time (_type_ float) none) + (init-sun-data! (_type_ int float float float) none) ;; 9 + (init-orbit-settings! (_type_ int float float float float float float) none) ;; 10 + (update-colors-for-time (_type_ float) none) ;; 11 (update-time-and-speed (_type_ float float) none) ;; 12 (sky-work-method-13 () none) ;; 13 (draw (_type_) none) ;; 14 ;; (update-matrix (_type_ matrix) none) @@ -23288,7 +23294,7 @@ (cam-outside-bsp uint8 :offset 152) (cam-using-back uint8 :offset-assert 153) (cam-box-idx uint16 :offset-assert 154) - ; (ambients symbol :offset-assert 156) ;; now just #t? + (ambients symbol :offset-assert 156) ;; now just #t? (subdivide-close float :offset 160) (subdivide-far float :offset-assert 164) (race-meshes (array entity-race-mesh) :offset-assert 168) @@ -31464,14 +31470,14 @@ (define-extern palette-select-special (function mood-context-core3 symbol)) (define-extern clear-mood-times (function mood-context symbol)) ;; (define-extern update-mood-itimes (function mood-context none)) -;; (define-extern update-mood-direction function) ;; (function mood-context-core3 mood-table float float) +(define-extern update-mood-direction (function mood-context-core3 mood-table float float)) (define-extern update-mood-exterior (function mood-context-core3 mood-table float int object)) -;; (define-extern copy-mood-exterior function) ;; (function mood-context symbol) -;; (define-extern copy-mood-exterior-ambi function) ;; (function mood-context symbol none) +(define-extern copy-mood-exterior (function mood-context symbol)) +(define-extern copy-mood-exterior-ambi (function mood-context symbol none)) (define-extern clear-mood-context (function mood-context symbol)) -;; (define-extern update-mood-interior function) ;; (function mood-context float) -;; (define-extern update-mood-interior-ambient function) -;; (define-extern update-mood-flames function) ;; (function mood-context int int int float float float float :behavior time-of-day-proc) +(define-extern update-mood-interior (function mood-context symbol float)) +(define-extern update-mood-interior-ambient (function mood-context symbol float vector)) +(define-extern update-mood-flames (function mood-context int int int float float float float :behavior time-of-day-proc)) (define-extern *flash0* (array float)) (define-extern *flash1* (array float)) (define-extern *flash2* (array float)) @@ -31480,22 +31486,21 @@ (define-extern *flash5* (array float)) (define-extern *flash6* (array float)) (define-extern *flash7* (array float)) -;; (define-extern update-mood-light function) ;; (function mood-context int int float float float float float float) -;; (define-extern update-mood-lava function) ;; (function mood-context int int float float float float float float) -;; (define-extern update-mood-flicker function) ;; (function mood-context int int none) -;; (define-extern update-mood-florescent function) ;; (function mood-context int int float) -;; (define-extern update-mood-electricity function) ;; (function mood-context int int float float none) -;; (define-extern update-mood-pulse function) ;; (function mood-context int int float float float float none) -;; (define-extern update-mood-strobe function) ;; (function mood-context int int int float float) -;; (define-extern update-mood-caustics function) ;; (function mood-context int float float float float float) -;; (define-extern overide-mood-fog function) -;; (define-extern overide-mood-color function) +(define-extern update-mood-light (function mood-context int int float float float float float float)) +(define-extern update-mood-lava (function mood-context int int float float float float float float)) +(define-extern update-mood-flicker (function mood-context int int none)) +(define-extern update-mood-florescent (function mood-context int int float)) +(define-extern update-mood-electricity (function mood-context int int float float none)) +(define-extern update-mood-pulse (function mood-context int int float float float float none)) +(define-extern update-mood-strobe (function mood-context int int int float float)) +(define-extern update-mood-caustics (function mood-context int float float float float float)) +(define-extern overide-mood-fog (function mood-context float int float none)) +(define-extern overide-mood-color (function mood-context float int float none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; mood-funcs ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype ctywide-states (structure) ((light light-state :inline :offset-assert 0) (flame flames-state :inline :offset-assert 8) @@ -31504,9 +31509,7 @@ :size-assert #xf :flag-assert #x90000000f ) -|# -#| (deftype ctysluma-states (structure) ((light light-state :inline :offset-assert 0) (flame flames-state :inline :offset-assert 8) @@ -31518,9 +31521,7 @@ :size-assert #x1c :flag-assert #x90000001c ) -|# -#| (deftype ctyslumb-states (structure) ((light light-state :inline :offset-assert 0) (spec-0 sp-field-init-spec :offset-assert 8) @@ -31531,9 +31532,7 @@ :size-assert #x14 :flag-assert #x900000014 ) -|# -#| (deftype ctyslumc-states (structure) ((light light-state :inline :offset-assert 0) (spec-0 sp-field-init-spec :offset-assert 8) @@ -31544,9 +31543,7 @@ :size-assert #x14 :flag-assert #x900000014 ) -|# -#| (deftype ctygenb-states (structure) ((light light-state :inline :offset-assert 0) (flame flames-state :inline :offset-assert 8) @@ -31561,9 +31558,7 @@ :size-assert #x28 :flag-assert #x900000028 ) -|# -#| (deftype mhcitya-states (structure) ((pulse pulse-state :inline :offset-assert 0) ) @@ -31571,9 +31566,7 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype mhcityb-states (structure) ((pulse pulse-state :inline :offset-assert 0) ) @@ -31581,9 +31574,7 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype ctyport-states (structure) ((light light-state :inline :offset-assert 0) (spec-0 sp-field-init-spec :offset-assert 8) @@ -31593,9 +31584,7 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype ctymarka-states (structure) ((light light-state :inline :offset-assert 0) (blink float :offset-assert 8) @@ -31604,9 +31593,7 @@ :size-assert #xc :flag-assert #x90000000c ) -|# -#| (deftype mountain-states (structure) ((light0 light-state :inline :offset-assert 0) (light1 light-state :inline :offset-assert 8) @@ -31622,9 +31609,7 @@ :size-assert #x2c :flag-assert #x90000002c ) -|# -#| (deftype ctyinda-states (structure) ((light light-state :inline :offset-assert 0) ) @@ -31632,9 +31617,7 @@ :size-assert #x8 :flag-assert #x900000008 ) -|# -#| (deftype ctyindb-states (structure) ((light light-state :inline :offset-assert 0) (flicker float :offset-assert 8) @@ -31643,9 +31626,7 @@ :size-assert #xc :flag-assert #x90000000c ) -|# -#| (deftype atoll-states (structure) ((light light-state :inline :offset-assert 0) (explosion float :offset-assert 8) @@ -31654,43 +31635,42 @@ :size-assert #xc :flag-assert #x90000000c ) -|# (define-extern update-mood-default (function mood-context float int none :behavior time-of-day-proc)) -;; (define-extern update-mood-copy-parent function) -;; (define-extern get-sphere-interp function) ;; (function sphere vector float float float) -;; (define-extern update-mood-ctywide function) ;; (function mood-context float int none :behavior time-of-day-proc) -;; (define-extern update-mood-copy-ctywide function) ;; (function mood-context float int none :behavior time-of-day-proc) -;; (define-extern init-mood-ctysluma function) ;; (function mood-context float) -;; (define-extern update-mood-ctysluma function) ;; (function mood-context float int none :behavior time-of-day-proc) -;; (define-extern init-mood-ctyslumb function) ;; (function mood-context uint) -;; (define-extern update-mood-ctyslumb function) ;; (function mood-context float int none :behavior time-of-day-proc) -;; (define-extern init-mood-ctyslumc function) ;; (function mood-context none) -;; (define-extern update-mood-ctyslumc function) ;; (function mood-context float int none :behavior time-of-day-proc) -;; (define-extern init-mood-ctygenb function) -;; (define-extern update-mood-ctygenb function) -;; (define-extern *mhcity-mood-fog-table* object) -;; (define-extern overide-mhcity-fog function) -;; (define-extern init-mood-mhcitya function) -;; (define-extern update-mood-mhcitya function) -;; (define-extern init-mood-mhcityb function) -;; (define-extern update-mood-mhcityb function) -;; (define-extern calc-lmhcity-palettes function) -;; (define-extern update-mood-lmhcitya function) -;; (define-extern update-mood-lmhcityb function) -;; (define-extern *ctyport-level* object) -;; (define-extern update-mood-ctyport function) ;; (function mood-context float int none :behavior time-of-day-proc) -;; (define-extern reset-marquee-color! function) -;; (define-extern add-marquee-color! function) -;; (define-extern update-mood-ctymarka function) ;; (function mood-context float int none :behavior time-of-day-proc) -;; (define-extern init-mood-mountain function) ;; (function mood-context uint) -;; (define-extern update-mood-mountain function) ;; (function mood-context float int none :behavior time-of-day-proc) -;; (define-extern update-mood-ctyinda function) -;; (define-extern update-mood-ctyindb function) -;; (define-extern init-mood-atoll function) ;; (function mood-context float) -;; (define-extern update-mood-atoll function) ;; (function mood-context float int none :behavior time-of-day-proc) -;; (define-extern set-atoll-explosion! function) ;; (function float float) -;; (define-extern update-mood-atollext function) ;; (function mood-context float int none :behavior time-of-day-proc) +(define-extern update-mood-copy-parent (function mood-context object int none)) +(define-extern get-sphere-interp (function sphere vector float float float)) +(define-extern update-mood-ctywide (function mood-context float int none :behavior time-of-day-proc)) +(define-extern update-mood-copy-ctywide (function mood-context float int none :behavior time-of-day-proc)) +(define-extern init-mood-ctysluma (function mood-context float)) +(define-extern update-mood-ctysluma (function mood-context float int none :behavior time-of-day-proc)) +(define-extern init-mood-ctyslumb (function mood-context uint)) +(define-extern update-mood-ctyslumb (function mood-context float int none :behavior time-of-day-proc)) +(define-extern init-mood-ctyslumc (function mood-context none)) +(define-extern update-mood-ctyslumc (function mood-context float int none :behavior time-of-day-proc)) +(define-extern init-mood-ctygenb (function mood-context object)) +(define-extern update-mood-ctygenb (function mood-context float int none :behavior time-of-day-proc)) +(define-extern *mhcity-mood-fog-table* mood-fog-table) +(define-extern overide-mhcity-fog function) +(define-extern init-mood-mhcitya (function mood-context object)) +(define-extern update-mood-mhcitya (function mood-context float int none :behavior time-of-day-proc)) +(define-extern init-mood-mhcityb (function mood-context object)) +(define-extern update-mood-mhcityb (function mood-context float int none :behavior time-of-day-proc)) +(define-extern calc-lmhcity-palettes function) +(define-extern update-mood-lmhcitya (function mood-context float int none :behavior time-of-day-proc)) +(define-extern update-mood-lmhcityb (function mood-context float int none :behavior time-of-day-proc)) +(define-extern *ctyport-level* level-group) +(define-extern update-mood-ctyport (function mood-context float int none :behavior time-of-day-proc)) +(define-extern reset-marquee-color! function) +(define-extern add-marquee-color! function) +(define-extern update-mood-ctymarka (function mood-context float int none :behavior time-of-day-proc)) +(define-extern init-mood-mountain (function mood-context uint)) +(define-extern update-mood-mountain (function mood-context float int none :behavior time-of-day-proc)) +(define-extern update-mood-ctyinda (function mood-context float int none :behavior time-of-day-proc)) +(define-extern update-mood-ctyindb (function mood-context float int none :behavior time-of-day-proc)) +(define-extern init-mood-atoll (function mood-context float)) +(define-extern update-mood-atoll (function mood-context float int none :behavior time-of-day-proc)) +(define-extern set-atoll-explosion! (function float float)) +(define-extern update-mood-atollext (function mood-context float int none :behavior time-of-day-proc)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; mood-funcs2 ;; @@ -31831,14 +31811,14 @@ (define-extern group-rain-screend-drop sparticle-launch-group) (define-extern update-snow (function float vector vector none)) -;; (define-extern birth-func-omega-normal-orient function) ;; (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d sparticle-launcher sparticle-launch-state none) -;; (define-extern birth-func-rain function) ;; (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d sparticle-launcher sparticle-launch-state none) -;; (define-extern check-drop-level-rain function) ;; (function sparticle-system sparticle-cpuinfo vector none) -;; (define-extern check-drop-level-rain2 function) ;; (function sparticle-system sparticle-cpuinfo vector none) -;; (define-extern check-drop-level-splash function) ;; (function sparticle-system sparticle-cpuinfo vector none) +(define-extern birth-func-omega-normal-orient (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d sparticle-launcher sparticle-launch-state none)) +(define-extern birth-func-rain (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d sparticle-launcher sparticle-launch-state none)) +(define-extern check-drop-level-rain (function sparticle-system sparticle-cpuinfo vector none)) +(define-extern check-drop-level-rain2 (function sparticle-system sparticle-cpuinfo vector none)) +(define-extern check-drop-level-splash (function sparticle-system sparticle-cpuinfo vector none)) (define-extern update-rain (function float vector vector none)) (define-extern cam-master-effect (function none :behavior camera-master)) -;; (define-extern sparticle-track-sun function) ;; (function int sparticle-cpuinfo matrix none) +(define-extern sparticle-track-sun (function int sparticle-cpuinfo matrix none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; time-of-day ;; @@ -31865,16 +31845,16 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-extern *sky-work* sky-work) -;; (define-extern sky-base-polygons object) ;; (inline-array sky-vertex) -;; (define-extern sky-roof-polygons object) ;; (inline-array sky-vertex) -;; (define-extern *cloud-vert-array* object) ;; cloud-vert-array -;; (define-extern *cloud-poly* object) ;; (inline-array sky-vertex) -;; (define-extern init-cloud-vert-array function) ;; (function symbol) -;; (define-extern *haze-vert-array* object) ;; haze-vert-array -;; (define-extern *haze-poly* object) ;; (inline-array sky-vertex) -;; (define-extern init-haze-vert-array function) ;; (function symbol) -;; (define-extern sky-make-sun-data function) ;; (function sky-work int float none) -;; (define-extern sky-make-moon-data function) ;; (function sky-work float none) +(define-extern sky-base-polygons (inline-array sky-vertex)) +(define-extern sky-roof-polygons (inline-array sky-vertex)) +(define-extern *cloud-vert-array* cloud-vert-array) +(define-extern *cloud-poly* (inline-array sky-vertex)) +(define-extern init-cloud-vert-array (function symbol)) +(define-extern *haze-vert-array* haze-vert-array) +(define-extern *haze-poly* (inline-array sky-vertex)) +(define-extern init-haze-vert-array (function symbol)) +(define-extern sky-make-sun-data (function sky-work int float none)) +(define-extern sky-make-moon-data (function sky-work float none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; sky-tng ;; diff --git a/decompiler/config/jak3/ntsc_v1/hacks.jsonc b/decompiler/config/jak3/ntsc_v1/hacks.jsonc index 26ca003934..d28c2719f4 100644 --- a/decompiler/config/jak3/ntsc_v1/hacks.jsonc +++ b/decompiler/config/jak3/ntsc_v1/hacks.jsonc @@ -112,7 +112,6 @@ "(method 33 rub-tower)", "(method 261 crimson-guard)", "(anon-function 25 volcanox-obs)", - "foreground-draw-hud", "memcpy" ], @@ -385,7 +384,8 @@ ], "(method 16 sparticle-launch-control)": [25, 35, 36, 48, 62, 65, 100, 102], "(anon-function 17 target-ladder)": [0, 1], - "command-get-process": [46] + "command-get-process": [46], + "foreground-draw-hud": [0, 7, 8, 9, 16, 22] }, // Sometimes the game might use format strings that are fetched dynamically, diff --git a/decompiler/config/jak3/ntsc_v1/label_types.jsonc b/decompiler/config/jak3/ntsc_v1/label_types.jsonc index d44b7ba18d..a7bf7328a1 100644 --- a/decompiler/config/jak3/ntsc_v1/label_types.jsonc +++ b/decompiler/config/jak3/ntsc_v1/label_types.jsonc @@ -560,5 +560,29 @@ ["L2329", "attack-info"], ["L2328", "attack-info"], ["L2578", "vector"] + ], + "mood": [ + ["L267", "vector"], + ["L265", "vector"], + ["L263", "vector"], + ["L261", "vector"], + ["L259", "vector"], + ["L257", "vector"] + ], + "sky-data": [ + ["L26", "(inline-array sky-vertex)", 12], + ["L25", "(inline-array sky-vertex)", 12], + ["L23", "(inline-array sky-vertex)", 648], + ["L21", "(inline-array sky-vertex)", 144] + ], + "mood-funcs": [ + ["L198", "uint64", true], + ["L197", "uint64", true], + ["L202", "uint64", true], + ["L199", "uint64", true], + ["L196", "uint64", true], + ["L200", "uint64", true], + ["L203", "uint64", true], + ["L201", "uint64", true] ] } diff --git a/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc b/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc index b9fd47a1d6..4c0c0f2ca8 100644 --- a/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc +++ b/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc @@ -716,5 +716,7 @@ "(anon-function 49 script)": [ [128, "part-tracker-subsampler-init-params"], [176, "part-tracker-init-params"] - ] + ], + "(method 9 mood-control)": [[16, "mood-control-work"]], + "check-drop-level-rain": [[16, "vector"]] } diff --git a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc index 7b88a97a97..8057e75647 100644 --- a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc +++ b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc @@ -3485,7 +3485,10 @@ [44, "s5", "process-focusable"], [51, "s5", "process-focusable"] ], - "(event time-of-day-tick)": [[9, "v1", "float"]], + "(event time-of-day-tick)": [ + [9, "v1", "float"], + [203, "v1", "float"] + ], "load-game-text-info": [ [34, "v1", "game-text-info"], [41, "v1", "game-text-info"] @@ -4629,5 +4632,61 @@ [[47, 88], "v1", "connection"], [[120, 124], "a0", "basic"], [[127, 130], "a0", "basic"] + ], + "(method 9 mood-control)": [[695, "v0", "sound-rpc-set-param"]], + "update-mood-pulse": [[[5, 45], "gp", "pulse-state"]], + "update-mood-electricity": [[[3, 19], "gp", "electricity-state"]], + "update-mood-florescent": [[[1, 48], "gp", "florescent-state"]], + "update-mood-flicker": [[[1, 58], "gp", "flicker-state"]], + "update-mood-light": [[[7, 175], "gp", "light-state"]], + "update-mood-flames": [[[5, 102], "gp", "flames-state"]], + "(method 23 mood-control)": [ + [121, "a1", "vector"], + [125, "a1", "vector"], + [129, "a1", "vector"], + [133, "a1", "vector"], + [137, "v1", "vector"], + [122, "a0", "vector"], + [126, "a0", "vector"], + [130, "a0", "vector"], + [134, "a0", "vector"], + [138, "a0", "vector"] + ], + "copy-mood-exterior": [ + [[16, 20], "a1", "mood-context"], + [30, "a0", "(inline-array vector)"], + [33, "a0", "(inline-array vector)"], + [31, "v1", "(inline-array vector)"], + [32, "v1", "(inline-array vector)"], + [[17, 19], "v1", "(inline-array vector)"] + ], + "copy-mood-exterior-ambi": [ + [[12, 17], "a2", "mood-context"], + [[13, 16], "v1", "mood-context"] + ], + "overide-mood-color": [ + [40, "a2", "(inline-array vector)"], + [44, "a0", "(inline-array vector)"], + [107, "a0", "mood-context"], + [[91, 107], "s3", "mood-context"] + ], + "(method 11 sky-work)": [[[7, 63], "s3", "mood-context"]], + "sky-make-sun-data": [[[7, 58], "s3", "sky-sun-data"]], + "update-mood-ctysluma": [[[23, 72], "s5", "ctysluma-states"]], + "sparticle-track-sun": [[148, "s4", "vector"]], + "foreground-draw-hud": [ + [26, "t2", "foreground-work"], + [36, "a1", "foreground-work"], + [79, "t2", "foreground-work"], + [[85, 102], "t2", "(pointer uint128)"], + [166, "a1", "int"], + [172, "a0", "foreground-work"], + [12, "t0", "foreground-work"], + [31, "t1", "foreground-work"], + [103, "t1", "vu-lights"], + [164, "a0", "(pointer uint128)"], + [90, "t1", "vu-lights"], + [[93, 99], "t1", "(pointer uint128)"], + [101, "t1", "(pointer uint128)"] ] } diff --git a/game/graphics/opengl_renderer/OpenGLRenderer.cpp b/game/graphics/opengl_renderer/OpenGLRenderer.cpp index e54bba8ae4..0d6d6cc0a6 100644 --- a/game/graphics/opengl_renderer/OpenGLRenderer.cpp +++ b/game/graphics/opengl_renderer/OpenGLRenderer.cpp @@ -135,6 +135,7 @@ void OpenGLRenderer::init_bucket_renderers_jak3() { m_blit_displays = init_bucket_renderer("blit", BucketCategory::OTHER, BucketId::BLIT_START); + init_bucket_renderer("vis", BucketCategory::OTHER, BucketId::BUCKET_2); // 4 init_bucket_renderer("tex-lcom-sky-pre", BucketCategory::TEX, @@ -286,8 +287,12 @@ void OpenGLRenderer::init_bucket_renderers_jak3() { init_bucket_renderer("tex-hud-hud-alpha", BucketCategory::TEX, BucketId::TEX_HUD_HUD_ALPHA, texture_animator); - // init_bucket_renderer("tex-hud-hud-alpha", BucketCategory::TEX, - // BucketId::TEX_HUD_HUD_ALPHA, texture_animator); + init_bucket_renderer("tex-hud-hud-alpha", BucketCategory::TEX, + BucketId::TEX_HUD_HUD_ALPHA, texture_animator); + init_bucket_renderer("tex-hud-pris2", BucketCategory::TEX, + BucketId::TEX_HUD_PRIS2, texture_animator); + init_bucket_renderer("hud-draw-hud-alpha", BucketCategory::OTHER, + BucketId::HUD_DRAW_HUD_ALPHA, 0x1000); // 583 init_bucket_renderer("debug", BucketCategory::OTHER, BucketId::DEBUG, 0x8000); diff --git a/game/graphics/opengl_renderer/background/Shrub.cpp b/game/graphics/opengl_renderer/background/Shrub.cpp index 623d5bb4f0..6747719347 100644 --- a/game/graphics/opengl_renderer/background/Shrub.cpp +++ b/game/graphics/opengl_renderer/background/Shrub.cpp @@ -45,7 +45,7 @@ void Shrub::render(DmaFollower& dma, SharedRenderState* render_state, ScopedProf memcpy(&m_pc_port_data, pc_port_data.data, sizeof(TfragPcPortData)); m_pc_port_data.level_name[11] = '\0'; - if (render_state->version == GameVersion::Jak2) { + if (render_state->version >= GameVersion::Jak2) { // jak 2 proto visibility auto proto_mask_data = dma.read_and_advance(); m_proto_vis_data = proto_mask_data.data; diff --git a/game/mips2c/jak3_functions/font.cpp b/game/mips2c/jak3_functions/font.cpp index 2c12af7fd8..c4a3e4506f 100644 --- a/game/mips2c/jak3_functions/font.cpp +++ b/game/mips2c/jak3_functions/font.cpp @@ -1361,7 +1361,7 @@ u64 execute(void* ctxt) { // nop // sll r0, r0, 0 // nop // sll r0, r0, 0 // nop // sll r0, r0, 0 - c->vftoi4(DEST::xyzw, vf1, vf1); // vftoi4.xyzw vf1, vf1 + c->vftoi4_sat(DEST::xyzw, vf1, vf1); // vftoi4.xyzw vf1, vf1 // nop // sll r0, r0, 0 c->vmulq(DEST::xyz, vf2, vf2); // vmulq.xyz vf2, vf2, Q // nop // sll r0, r0, 0 @@ -1383,7 +1383,7 @@ u64 execute(void* ctxt) { // nop // sll r0, r0, 0 // nop // sll r0, r0, 0 // nop // sll r0, r0, 0 - c->vftoi4(DEST::xyzw, vf2, vf2); // vftoi4.xyzw vf2, vf2 + c->vftoi4_sat(DEST::xyzw, vf2, vf2); // vftoi4.xyzw vf2, vf2 // nop // sll r0, r0, 0 c->vmulq(DEST::xyz, vf3, vf3); // vmulq.xyz vf3, vf3, Q // nop // sll r0, r0, 0 @@ -1405,7 +1405,7 @@ u64 execute(void* ctxt) { // nop // sll r0, r0, 0 // nop // sll r0, r0, 0 // nop // sll r0, r0, 0 - c->vftoi4(DEST::xyzw, vf3, vf3); // vftoi4.xyzw vf3, vf3 + c->vftoi4_sat(DEST::xyzw, vf3, vf3); // vftoi4.xyzw vf3, vf3 // nop // sll r0, r0, 0 c->vmulq(DEST::xyz, vf4, vf4); // vmulq.xyz vf4, vf4, Q // nop // sll r0, r0, 0 @@ -1435,7 +1435,7 @@ u64 execute(void* ctxt) { c->vadd_bc(DEST::x, BC::w, vf23, vf23, vf14); // vaddw.x vf23, vf23, vf14 block_153: - c->vftoi4(DEST::xyzw, vf4, vf4); // vftoi4.xyzw vf4, vf4 + c->vftoi4_sat(DEST::xyzw, vf4, vf4); // vftoi4.xyzw vf4, vf4 // nop // sll r0, r0, 0 // nop // sll r0, r0, 0 // nop // sll r0, r0, 0 @@ -2187,7 +2187,7 @@ u64 execute(void* ctxt) { // nop // sll r0, r0, 0 c->lqc2(vf11, 704, v1); // lqc2 vf11, 704(v1) // nop // sll r0, r0, 0 - c->vftoi4(DEST::xyzw, vf1, vf1); // vftoi4.xyzw vf1, vf1 + c->vftoi4_sat(DEST::xyzw, vf1, vf1); // vftoi4.xyzw vf1, vf1 // nop // sll r0, r0, 0 c->vmulq(DEST::xyz, vf2, vf2); // vmulq.xyz vf2, vf2, Q // nop // sll r0, r0, 0 @@ -2209,7 +2209,7 @@ u64 execute(void* ctxt) { // nop // sll r0, r0, 0 // nop // sll r0, r0, 0 // nop // sll r0, r0, 0 - c->vftoi4(DEST::xyzw, vf2, vf2); // vftoi4.xyzw vf2, vf2 + c->vftoi4_sat(DEST::xyzw, vf2, vf2); // vftoi4.xyzw vf2, vf2 // nop // sll r0, r0, 0 c->vmulq(DEST::xyz, vf3, vf3); // vmulq.xyz vf3, vf3, Q // nop // sll r0, r0, 0 @@ -2231,7 +2231,7 @@ u64 execute(void* ctxt) { // nop // sll r0, r0, 0 // nop // sll r0, r0, 0 // nop // sll r0, r0, 0 - c->vftoi4(DEST::xyzw, vf3, vf3); // vftoi4.xyzw vf3, vf3 + c->vftoi4_sat(DEST::xyzw, vf3, vf3); // vftoi4.xyzw vf3, vf3 // nop // sll r0, r0, 0 c->vmulq(DEST::xyz, vf4, vf4); // vmulq.xyz vf4, vf4, Q // nop // sll r0, r0, 0 @@ -2261,7 +2261,7 @@ u64 execute(void* ctxt) { c->vadd_bc(DEST::x, BC::w, vf23, vf23, vf14); // vaddw.x vf23, vf23, vf14 block_231: - c->vftoi4(DEST::xyzw, vf4, vf4); // vftoi4.xyzw vf4, vf4 + c->vftoi4_sat(DEST::xyzw, vf4, vf4); // vftoi4.xyzw vf4, vf4 // nop // sll r0, r0, 0 // nop // sll r0, r0, 0 // nop // sll r0, r0, 0 diff --git a/goal_src/jak3/engine/draw/drawable.gc b/goal_src/jak3/engine/draw/drawable.gc index 09e38b57aa..dfe68875c1 100644 --- a/goal_src/jak3/engine/draw/drawable.gc +++ b/goal_src/jak3/engine/draw/drawable.gc @@ -1501,17 +1501,17 @@ (reset! *prim-work*) ; ;; update wind/time of day prior to drawing. - ; (let ((gp-2 (-> pp clock))) - ; (if (= (-> *time-of-day-context* mode) (time-of-day-palette-id unk3)) - ; (set! (-> pp clock) (-> *display* bg-clock)) - ; (set! (-> pp clock) (-> *display* real-clock)) - ; ) - ; (if (not (paused?)) - ; (update-wind *wind-work* *wind-scales*) - ; ) - ; (update-time-of-day *time-of-day-context*) - ; (set! (-> pp clock) gp-2) - ; ) + (let ((gp-2 (-> pp clock))) + (if (= (-> *time-of-day-context* mode) (time-of-day-palette-id unk3)) + (set! (-> pp clock) (-> *display* bg-clock)) + (set! (-> pp clock) (-> *display* real-clock)) + ) + ; (if (not (paused?)) + ; (update-wind *wind-work* *wind-scales*) + ; ) + (update-time-of-day *time-of-day-context*) + (set! (-> pp clock) gp-2) + ) ; ;; draw sky ; (with-profiler 'sky *profile-sky-color* diff --git a/goal_src/jak3/engine/game/main.gc b/goal_src/jak3/engine/game/main.gc index 76e805b888..9e5bdac1cc 100644 --- a/goal_src/jak3/engine/game/main.gc +++ b/goal_src/jak3/engine/game/main.gc @@ -1434,7 +1434,7 @@ ) ; ;; cloth simulation update - ; (execute-cloth-engine) + (execute-cloth-engine) (with-profiler 'debug *profile-debug-color* ;; run debug callbacks @@ -1633,7 +1633,7 @@ ;; initial setup (set! *teleport* #t) (update *setting-control*) ;; dies on camera stuff, which looks for entities. - ;; (init-time-of-day-context *time-of-day-context*) + (init-time-of-day-context *time-of-day-context*) (display-sync gp-1) (display-frame-finish gp-1) (display-sync gp-1) diff --git a/goal_src/jak3/engine/gfx/background/background.gc b/goal_src/jak3/engine/gfx/background/background.gc index ba5fa103bc..0172bb5671 100644 --- a/goal_src/jak3/engine/gfx/background/background.gc +++ b/goal_src/jak3/engine/gfx/background/background.gc @@ -60,13 +60,6 @@ (set! (-> data-ptr 5) (-> lev mood-context itimes 1 quad)) (set! (-> data-ptr 6) (-> lev mood-context itimes 2 quad)) (set! (-> data-ptr 7) (-> lev mood-context itimes 3 quad)) - ;; HACK: - (let ((vec (new 'static 'vector4w :x #x70707070 :y #x70707070 :z #x70707070 :w #x70707070))) - (set! (-> data-ptr 4) (-> vec quad)) - (set! (-> data-ptr 5) (-> vec quad)) - (set! (-> data-ptr 6) (-> vec quad)) - (set! (-> data-ptr 7) (-> vec quad)) - ) (set! (-> data-ptr 8) (-> *math-camera* camera-temp vector 0 quad)) (set! (-> data-ptr 9) (-> *math-camera* camera-temp vector 1 quad)) (set! (-> data-ptr 10) (-> *math-camera* camera-temp vector 2 quad)) @@ -229,9 +222,132 @@ (none) ) +(defun add-pc-camera-data ((dma-buf dma-buffer)) + "Add PC-port specific camera data. used as fallback for collide mesh renderer. + Same as add-pc-trag3-data but level-specific data is left undefined." + (let ((packet (the-as dma-packet (-> dma-buf base)))) + (set! (-> packet dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc 24)) + (set! (-> packet vif0) (new 'static 'vif-tag)) + (set! (-> packet vif1) (new 'static 'vif-tag :cmd (vif-cmd pc-port))) + (set! (-> dma-buf base) (the pointer (&+ packet 16))) + ) + + ;; first 4 quadwords are planes, then itimes + (let ((data-ptr (the-as (pointer uint128) (-> dma-buf base)))) + ;; the "use-camera-other" flag is set to "move" entire levels, + ;; like the rotating city below in the throne room. + (set! (-> data-ptr 0) (-> *math-camera* plane 0 quad)) + (set! (-> data-ptr 1) (-> *math-camera* plane 1 quad)) + (set! (-> data-ptr 2) (-> *math-camera* plane 2 quad)) + (set! (-> data-ptr 3) (-> *math-camera* plane 3 quad)) + ;; (set! (-> data-ptr 4) (-> lev mood-context itimes 0 quad)) + ;; (set! (-> data-ptr 5) (-> lev mood-context itimes 1 quad)) + ;; (set! (-> data-ptr 6) (-> lev mood-context itimes 2 quad)) + ;; (set! (-> data-ptr 7) (-> lev mood-context itimes 3 quad)) + (set! (-> data-ptr 8) (-> *math-camera* camera-temp vector 0 quad)) + (set! (-> data-ptr 9) (-> *math-camera* camera-temp vector 1 quad)) + (set! (-> data-ptr 10) (-> *math-camera* camera-temp vector 2 quad)) + (set! (-> data-ptr 11) (-> *math-camera* camera-temp vector 3 quad)) + (set! (-> data-ptr 12) (-> *math-camera* hvdf-off quad)) + (let ((vec (-> (the (inline-array vector) data-ptr) 13))) + (set! (-> vec x) (-> *math-camera* pfog0)) + (set! (-> vec y) (-> *math-camera* fog-min)) + (set! (-> vec z) (-> *math-camera* fog-max)) + ) + (set! (-> data-ptr 14) (-> *math-camera* trans quad)) + + (set! (-> data-ptr 15) (-> *math-camera* camera-rot vector 0 quad)) + (set! (-> data-ptr 16) (-> *math-camera* camera-rot vector 1 quad)) + (set! (-> data-ptr 17) (-> *math-camera* camera-rot vector 2 quad)) + (set! (-> data-ptr 18) (-> *math-camera* camera-rot vector 3 quad)) + + (set! (-> data-ptr 19) (-> *math-camera* perspective vector 0 quad)) + (set! (-> data-ptr 20) (-> *math-camera* perspective vector 1 quad)) + (set! (-> data-ptr 21) (-> *math-camera* perspective vector 2 quad)) + (set! (-> data-ptr 22) (-> *math-camera* perspective vector 3 quad)) + + (charp<-string (the (pointer uint8) (&-> data-ptr 23)) (symbol->string #f)) + ) + (&+! (-> dma-buf base) (* 16 24)) + ) + +(defun add-pc-port-background-data ((dma-buf dma-buffer)) + "PC Port added" + ;; loop over levels + (dotimes (lev-idx (-> *level* length)) + (let ((lev (-> *level* draw-level lev-idx)) + (dma-start (-> dma-buf base))) + (cond + ((and lev (= (-> lev status) 'active)) + ;; the level is active. + (let ((packet (the-as dma-packet (-> dma-buf base)))) + (set! (-> packet dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc 128)) + (set! (-> packet vif0) (the-as vif-tag *fog-color*)) + (set! (-> packet vif1) (new 'static 'vif-tag :cmd (vif-cmd pc-port))) + (set! (-> dma-buf base) (the pointer (&+ packet 16))) + ) + (quad-copy! (-> dma-buf base) (-> lev vis-bits) 128) + (&+! (-> dma-buf base) (* 16 128)) + ) + (else + (let ((packet (the-as dma-packet (-> dma-buf base)))) + (set! (-> packet dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc 1)) + (set! (-> packet vif0) (the-as vif-tag *fog-color*)) + (set! (-> packet vif1) (new 'static 'vif-tag :cmd (vif-cmd pc-port))) + (set! (-> dma-buf base) (the pointer (&+ packet 16))) + ) + (set! (-> (the (pointer uint128) (-> dma-buf base))) (the uint128 0)) + (&+! (-> dma-buf base) (* 16 1)) + ) + ) + + + (let ((a3-3 (-> dma-buf base))) + (let ((v1-38 (the-as object (-> dma-buf base)))) + (set! (-> (the-as dma-packet v1-38) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-38) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-38) vif1) (new 'static 'vif-tag)) + (set! (-> dma-buf base) (&+ (the-as pointer v1-38) 16)) + ) + (dma-bucket-insert-tag (-> *display* frames (-> *display* on-screen) bucket-group) + (bucket-id bucket2) + dma-start + (the-as (pointer dma-tag) a3-3) + ) + ) + ) + ) + (let* ((dma-buff (-> *display* frames (-> *display* on-screen) global-buf)) + (dma-start (-> dma-buff base))) + (add-pc-camera-data dma-buff) + (let ((a3-22 (-> dma-buff base))) + (let ((v1-57 (the-as object (-> dma-buff base)))) + (set! (-> (the-as dma-packet v1-57) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-57) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-57) vif1) (new 'static 'vif-tag)) + (set! (-> dma-buff base) (&+ (the-as pointer v1-57) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) bucket-group) + (bucket-id bucket2) + dma-start + (the-as (pointer dma-tag) a3-22) + ) + ) + ) + (the-as pointer 0) + ) + ;; WARN: Function finish-background has a return type of none, but the expression builder found a return statement. (defun finish-background () "Run all renderers for background data added." + + (#when PC_PORT + (add-pc-port-background-data + (-> *display* frames (-> *display* on-screen) global-buf) + ) + ) + (if (get-menu-mode *blit-displays-work*) (return #f) ) diff --git a/goal_src/jak3/engine/gfx/foreground/foreground.gc b/goal_src/jak3/engine/gfx/foreground/foreground.gc index eaad9d82c8..f2d64d5a70 100644 --- a/goal_src/jak3/engine/gfx/foreground/foreground.gc +++ b/goal_src/jak3/engine/gfx/foreground/foreground.gc @@ -21,7 +21,7 @@ ;; DECOMP BEGINS -(define foreground-vu0-block (new 'static 'vu-function :length 9 :qlength 5)) +(define foreground-vu0-block (new 'static 'vu-function #|:length 9 :qlength 5|#)) (define *bucket-map* (new 'static 'array bucket-id-16 462 (bucket-id-16 merc-l0-tfrag) diff --git a/goal_src/jak3/engine/gfx/mood/mood-funcs.gc b/goal_src/jak3/engine/gfx/mood/mood-funcs.gc index 9afac91696..6349200f6e 100644 --- a/goal_src/jak3/engine/gfx/mood/mood-funcs.gc +++ b/goal_src/jak3/engine/gfx/mood/mood-funcs.gc @@ -7,3 +7,522 @@ ;; DECOMP BEGINS +(defbehavior update-mood-default time-of-day-proc ((arg0 mood-context) (arg1 float) (arg2 int)) + (copy-mood-exterior arg0) + 0 + (none) + ) + +(defun update-mood-copy-parent ((arg0 mood-context) (arg1 object) (arg2 int)) + (let* ((v1-3 (-> *level* level arg2)) + (a1-3 (-> v1-3 info memory-mode)) + ) + (when (or (or (= a1-3 (level-memory-mode borrow)) + (= a1-3 (level-memory-mode borrow0)) + (= a1-3 (level-memory-mode borrow1)) + (= a1-3 (level-memory-mode borrow2)) + (= a1-3 (level-memory-mode borrow3)) + (= a1-3 (level-memory-mode borrow4)) + (= a1-3 (level-memory-mode micro)) + (= a1-3 (level-memory-mode borrow-city-small)) + ) + (-> v1-3 borrow-from-level) + ) + (let ((v1-4 (-> v1-3 borrow-from-level))) + (if (and v1-4 (= (-> v1-4 status) 'active)) + (mem-copy! (the-as pointer arg0) (the-as pointer (-> v1-4 mood-context)) 1968) + ) + ) + ) + ) + 0 + (none) + ) + +(defun get-sphere-interp ((arg0 sphere) (arg1 vector) (arg2 float) (arg3 float)) + (let ((v1-0 (new 'stack-no-clear 'vector))) + 0.0 + (set! (-> v1-0 quad) (-> arg0 quad)) + (vector-! v1-0 arg1 v1-0) + (let ((f1-0 (vector-length v1-0))) + (/ (fmax 0.0 (fmin (- f1-0 arg2) arg3)) arg3) + ) + ) + ) + +(deftype ctywide-states (structure) + ((light light-state :inline) + (flame flames-state :inline) + ) + ) + + +(defbehavior update-mood-ctywide time-of-day-proc ((arg0 mood-context) (arg1 float) (arg2 int)) + (copy-mood-exterior arg0) + (when (and (= (-> *level* level arg2 status) 'active) + (< (the-as uint (-> *time-of-day-context* mode)) (the-as uint 9)) + ) + (-> arg0 state) + (update-mood-light arg0 5 0 1.0 0.0 arg1 0.0 2.0) + (update-mood-flames arg0 6 1 8 1.0 0.000390625 1.5) + ) + 0 + (none) + ) + +(defbehavior update-mood-copy-ctywide time-of-day-proc ((arg0 mood-context) (arg1 float) (arg2 int)) + (let ((v1-1 (level-get *level* 'ctywide))) + (cond + ((and v1-1 (= (-> v1-1 status) 'active)) + (mem-copy! (the-as pointer arg0) (the-as pointer (-> v1-1 mood-context)) 1968) + ) + (else + (update-mood-ctywide arg0 arg1 arg2) + (if (or (>= arg1 18.0) (>= 6.0 arg1)) + (set! (-> arg0 times 5 w) 1.0) + ) + ) + ) + ) + 0 + (none) + ) + +(deftype ctysluma-states (structure) + ((light light-state :inline) + (flame flames-state :inline) + (spec-0 sp-field-init-spec) + (spec-1 sp-field-init-spec) + (flicker float) + ) + ) + + +;; WARN: Return type mismatch sp-field-init-spec vs float. +(defun init-mood-ctysluma ((arg0 mood-context)) + (let ((gp-0 (-> arg0 state))) + (let ((a0-1 (-> *part-id-table* 2))) + (set! (-> gp-0 4) (the-as uint 0)) + (if (nonzero? a0-1) + (set! (-> gp-0 4) (the-as uint (get-field-spec-by-id a0-1 (sp-field-id spt-a)))) + ) + ) + (let ((a0-2 (-> *part-id-table* 3))) + (set! (-> gp-0 5) (the-as uint 0)) + (the-as float (when (nonzero? a0-2) + (let ((v0-1 (get-field-spec-by-id a0-2 (sp-field-id spt-a)))) + (set! (-> gp-0 5) (the-as uint v0-1)) + v0-1 + ) + ) + ) + ) + ) + ) + +(defbehavior update-mood-ctysluma time-of-day-proc ((arg0 mood-context) (arg1 float) (arg2 int)) + (copy-mood-exterior arg0) + (when (and (!= arg2 -1) + (= (-> *level* level arg2 status) 'active) + (< (the-as uint (-> *time-of-day-context* mode)) (the-as uint 9)) + ) + (let ((s5-1 (the-as ctysluma-states (-> arg0 state)))) + (update-mood-flames arg0 6 1 8 1.0 0.000390625 1.5) + (update-mood-light arg0 5 0 1.0 0.0 arg1 0.0 2.0) + (if (nonzero? (-> s5-1 spec-0)) + (set! (-> s5-1 spec-0 initial-valuef) (* 32.0 (-> s5-1 light fade))) + ) + (if (nonzero? (-> s5-1 spec-1)) + (set! (-> s5-1 spec-1 initial-valuef) (* 8.0 (-> s5-1 light fade))) + ) + (set! (-> arg0 times 7 w) (-> s5-1 flicker)) + (if (not (paused?)) + (set! (-> s5-1 flicker) (rand-vu-float-range 0.8 1.0)) + ) + ) + ) + 0 + (none) + ) + +(deftype ctyslumb-states (structure) + ((light light-state :inline) + (spec-0 sp-field-init-spec) + (spec-1 sp-field-init-spec) + (flicker float) + ) + ) + + +;; WARN: Return type mismatch sp-field-init-spec vs uint. +(defun init-mood-ctyslumb ((arg0 mood-context)) + (let ((gp-0 (-> arg0 state))) + (let ((a0-1 (-> *part-id-table* 4))) + (set! (-> gp-0 2) (the-as uint 0)) + (if (nonzero? a0-1) + (set! (-> gp-0 2) (the-as uint (get-field-spec-by-id a0-1 (sp-field-id spt-a)))) + ) + ) + (let ((a0-2 (-> *part-id-table* 5))) + (set! (-> gp-0 3) (the-as uint 0)) + (the-as uint (when (nonzero? a0-2) + (let ((v0-1 (get-field-spec-by-id a0-2 (sp-field-id spt-a)))) + (set! (-> gp-0 3) (the-as uint v0-1)) + v0-1 + ) + ) + ) + ) + ) + ) + +(deftype ctyslumc-states (structure) + ((light light-state :inline) + (spec-0 sp-field-init-spec) + (spec-1 sp-field-init-spec) + (flicker float) + ) + ) + + +;; WARN: Return type mismatch sp-field-init-spec vs none. +(defun init-mood-ctyslumc ((arg0 mood-context)) + (let ((gp-0 (-> arg0 state))) + (let ((a0-1 (-> *part-id-table* 6))) + (set! (-> gp-0 2) (the-as uint 0)) + (if (nonzero? a0-1) + (set! (-> gp-0 2) (the-as uint (get-field-spec-by-id a0-1 (sp-field-id spt-a)))) + ) + ) + (let ((a0-2 (-> *part-id-table* 7))) + (set! (-> gp-0 3) (the-as uint 0)) + (if (nonzero? a0-2) + (set! (-> gp-0 3) (the-as uint (get-field-spec-by-id a0-2 (sp-field-id spt-a)))) + ) + ) + ) + (none) + ) + +(deftype ctygenb-states (structure) + ((light light-state :inline) + (flame flames-state :inline) + (flicker flicker-state :inline) + (spec-0 sp-field-init-spec) + (spec-1 sp-field-init-spec) + (spec-2 sp-field-init-spec) + (spec-3 sp-field-init-spec) + (next-flicker float) + ) + ) + + +;; WARN: Return type mismatch sp-field-init-spec vs object. +(defun init-mood-ctygenb ((arg0 mood-context)) + (let ((gp-0 (-> arg0 state))) + (let ((a0-1 (-> *part-id-table* 8))) + (set! (-> gp-0 5) (the-as uint 0)) + (if (nonzero? a0-1) + (set! (-> gp-0 5) (the-as uint (get-field-spec-by-id a0-1 (sp-field-id spt-a)))) + ) + ) + (let ((a0-2 (-> *part-id-table* 9))) + (set! (-> gp-0 6) (the-as uint 0)) + (if (nonzero? a0-2) + (set! (-> gp-0 6) (the-as uint (get-field-spec-by-id a0-2 (sp-field-id spt-a)))) + ) + ) + (let ((a0-3 (-> *part-id-table* 10))) + (set! (-> gp-0 7) (the-as uint 0)) + (if (nonzero? a0-3) + (set! (-> gp-0 7) (the-as uint (get-field-spec-by-id a0-3 (sp-field-id spt-a)))) + ) + ) + (let ((a0-4 (-> *part-id-table* 11))) + (set! (-> gp-0 8) (the-as uint 0)) + (when (nonzero? a0-4) + (let ((v0-3 (get-field-spec-by-id a0-4 (sp-field-id spt-a)))) + (set! (-> gp-0 8) (the-as uint v0-3)) + v0-3 + ) + ) + ) + ) + ) + +(define *mhcity-mood-fog-table* + (new 'static 'mood-fog-table :data (new 'static 'inline-array mood-fog 8 + (new 'static 'mood-fog + :fog-color (new 'static 'vector :x 171.4687 :y 155.0 :z 58.125 :w 128.0) + :fog-dists (new 'static 'vector :y 819200.0 :z 240.0 :w 130.0) + :erase-color (new 'static 'vector :w 128.0) + ) + (new 'static 'mood-fog + :fog-color (new 'static 'vector :x 171.4687 :y 155.0 :z 58.125 :w 128.0) + :fog-dists (new 'static 'vector :y 819200.0 :z 240.0 :w 130.0) + :erase-color (new 'static 'vector :w 128.0) + ) + (new 'static 'mood-fog + :fog-color (new 'static 'vector :x 171.4687 :y 155.0 :z 58.125 :w 128.0) + :fog-dists (new 'static 'vector :y 819200.0 :z 240.0 :w 130.0) + :erase-color (new 'static 'vector :w 128.0) + ) + (new 'static 'mood-fog + :fog-color (new 'static 'vector :x 171.4687 :y 155.0 :z 58.125 :w 128.0) + :fog-dists (new 'static 'vector :y 819200.0 :z 240.0 :w 130.0) + :erase-color (new 'static 'vector :w 128.0) + ) + (new 'static 'mood-fog + :fog-color (new 'static 'vector :x 171.4687 :y 155.0 :z 58.125 :w 128.0) + :fog-dists (new 'static 'vector :y 819200.0 :z 240.0 :w 130.0) + :erase-color (new 'static 'vector :w 128.0) + ) + (new 'static 'mood-fog + :fog-color (new 'static 'vector :x 180.0 :y 179.0 :z 40.0 :w 128.0) + :fog-dists (new 'static 'vector :x 40960.0 :y 819200.0 :z 240.0 :w 165.5) + :erase-color (new 'static 'vector :w 128.0) + ) + (new 'static 'mood-fog + :fog-color (new 'static 'vector :x 180.0 :y 159.0 :z 50.0 :w 128.0) + :fog-dists (new 'static 'vector :x 40960.0 :y 819200.0 :z 240.0 :w 175.5) + :erase-color (new 'static 'vector :w 128.0) + ) + (new 'static 'mood-fog + :fog-color (new 'static 'vector :x 180.0 :y 179.0 :z 40.0 :w 128.0) + :fog-dists (new 'static 'vector :x 40960.0 :y 819200.0 :z 230.0 :w 165.5) + :erase-color (new 'static 'vector :w 128.0) + ) + ) + ) + ) + +;; ERROR: function has no type analysis. Cannot decompile. + +(deftype mhcitya-states (structure) + ((pulse pulse-state :inline) + ) + ) + + +;; WARN: Return type mismatch float vs object. +(defun init-mood-mhcitya ((arg0 mood-context)) + (let ((v1-0 (-> arg0 state))) + (set! (-> v1-0 2) (the-as uint 1.0)) + (let ((f0-1 1.0)) + (set! (-> v1-0 1) (the-as uint f0-1)) + f0-1 + ) + ) + ) + +(deftype mhcityb-states (structure) + ((pulse pulse-state :inline) + ) + ) + + +;; WARN: Return type mismatch float vs object. +(defun init-mood-mhcityb ((arg0 mood-context)) + (let ((v1-0 (-> arg0 state))) + (set! (-> v1-0 2) (the-as uint 1.0)) + (let ((f0-1 1.0)) + (set! (-> v1-0 1) (the-as uint f0-1)) + f0-1 + ) + ) + ) + +(deftype ctyport-states (structure) + ((light light-state :inline) + (spec-0 sp-field-init-spec) + (neon-min-bright float) + ) + ) + + +(define *ctyport-level* (the-as level-group #f)) + +(deftype ctymarka-states (structure) + ((light light-state :inline) + (blink float) + ) + ) + + +(defbehavior update-mood-ctymarka time-of-day-proc ((arg0 mood-context) (arg1 float) (arg2 int)) + (copy-mood-exterior arg0) + (when (and (= (-> *level* level arg2 status) 'active) + (< (the-as uint (-> *time-of-day-context* mode)) (the-as uint 9)) + ) + (let ((gp-1 (-> arg0 state))) + (update-mood-light arg0 5 0 1.0 0.0 arg1 0.0 2.0) + (set! (-> arg0 times 6 w) (the-as float (-> gp-1 2))) + (set! (-> arg0 times 7 w) 0.75) + (when (not (paused?)) + (let ((v1-11 (-> *display* part-clock frame-counter))) + (if (< (* 0.2 (the float (mod v1-11 600))) 60.0) + (set! (-> gp-1 2) (the-as uint 0.0)) + (set! (-> gp-1 2) (the-as uint 1.0)) + ) + ) + ) + ) + ) + 0 + (none) + ) + +(deftype mountain-states (structure) + ((light0 light-state :inline) + (light1 light-state :inline) + (spec-0 sp-field-init-spec) + (spec-1 sp-field-init-spec) + (spec-2 sp-field-init-spec) + (spec-3 sp-field-init-spec) + (spec-4 sp-field-init-spec) + (spec-5 sp-field-init-spec) + (spec-6 sp-field-init-spec) + ) + ) + + +;; WARN: Return type mismatch sp-field-init-spec vs uint. +(defun init-mood-mountain ((arg0 mood-context)) + (let ((gp-0 (-> arg0 state))) + (let ((a0-1 (-> *part-id-table* 12))) + (set! (-> gp-0 4) (the-as uint 0)) + (if (nonzero? a0-1) + (set! (-> gp-0 4) (the-as uint (get-field-spec-by-id a0-1 (sp-field-id spt-a)))) + ) + ) + (let ((a0-2 (-> *part-id-table* 13))) + (set! (-> gp-0 5) (the-as uint 0)) + (if (nonzero? a0-2) + (set! (-> gp-0 5) (the-as uint (get-field-spec-by-id a0-2 (sp-field-id spt-a)))) + ) + ) + (let ((a0-3 (-> *part-id-table* 14))) + (set! (-> gp-0 6) (the-as uint 0)) + (if (nonzero? a0-3) + (set! (-> gp-0 6) (the-as uint (get-field-spec-by-id a0-3 (sp-field-id spt-a)))) + ) + ) + (let ((a0-4 (-> *part-id-table* 15))) + (set! (-> gp-0 7) (the-as uint 0)) + (if (nonzero? a0-4) + (set! (-> gp-0 7) (the-as uint (get-field-spec-by-id a0-4 (sp-field-id spt-a)))) + ) + ) + (let ((a0-5 (-> *part-id-table* 16))) + (set! (-> gp-0 8) (the-as uint 0)) + (if (nonzero? a0-5) + (set! (-> gp-0 8) (the-as uint (get-field-spec-by-id a0-5 (sp-field-id spt-a)))) + ) + ) + (let ((a0-6 (-> *part-id-table* 17))) + (set! (-> gp-0 9) (the-as uint 0)) + (if (nonzero? a0-6) + (set! (-> gp-0 9) (the-as uint (get-field-spec-by-id a0-6 (sp-field-id spt-a)))) + ) + ) + (let ((a0-7 (-> *part-id-table* 18))) + (set! (-> gp-0 10) (the-as uint 0)) + (the-as uint (when (nonzero? a0-7) + (let ((v0-6 (get-field-spec-by-id a0-7 (sp-field-id spt-a)))) + (set! (-> gp-0 10) (the-as uint v0-6)) + v0-6 + ) + ) + ) + ) + ) + ) + +(deftype ctyinda-states (structure) + ((light light-state :inline) + ) + ) + + +(defbehavior update-mood-ctyinda time-of-day-proc ((arg0 mood-context) (arg1 float) (arg2 int)) + (copy-mood-exterior arg0) + (when (and (= (-> *level* level arg2 status) 'active) + (< (the-as uint (-> *time-of-day-context* mode)) (the-as uint 9)) + ) + (set! (-> arg0 times 6 w) 1.0) + (let ((f0-1 0.5)) + (let ((f1-0 1.0)) + (cond + ((or (>= 6.0 arg1) (>= arg1 18.0)) + (set! f0-1 f1-0) + ) + ((and (< 6.0 arg1) (< arg1 7.0)) + (+! f0-1 (* (- f1-0 f0-1) (- 7.0 arg1))) + ) + ((and (< 17.0 arg1) (< arg1 18.0)) + (+! f0-1 (* (- f1-0 f0-1) (+ -17.0 arg1))) + ) + ) + ) + (set! (-> arg0 times 7 w) f0-1) + ) + (-> arg0 state) + (update-mood-light arg0 5 0 1.0 0.0 arg1 0.0 2.0) + ) + 0 + (none) + ) + +(deftype ctyindb-states (structure) + ((light light-state :inline) + (flicker float) + ) + ) + + +(defbehavior update-mood-ctyindb time-of-day-proc ((arg0 mood-context) (arg1 float) (arg2 int)) + (copy-mood-exterior arg0) + (when (and (= (-> *level* level arg2 status) 'active) + (< (the-as uint (-> *time-of-day-context* mode)) (the-as uint 9)) + ) + (let ((s4-1 (-> arg0 state))) + (set! (-> arg0 times 6 w) 1.0) + (update-mood-light arg0 5 0 1.0 0.0 arg1 0.0 2.0) + (set! (-> arg0 times 7 w) (the-as float (-> s4-1 2))) + (if (not (paused?)) + (set! (-> s4-1 2) (the-as uint (rand-vu-float-range 0.8 1.0))) + ) + ) + ) + 0 + (none) + ) +(defun set-atoll-explosion! ((arg0 float)) + (let ((v1-1 (level-get *level* 'atoll))) + (when v1-1 + (let ((v1-2 (-> v1-1 mood-context state)) + (f0-0 arg0) + ) + (set! (-> v1-2 2) (the-as uint f0-0)) + f0-0 + ) + ) + ) + ) + +(defbehavior update-mood-atollext time-of-day-proc ((arg0 mood-context) (arg1 float) (arg2 int)) + (copy-mood-exterior-ambi arg0 #t) + (when (and (= (-> *level* level arg2 status) 'active) + (< (the-as uint (-> *time-of-day-context* mode)) (the-as uint 9)) + ) + (set-vector! (-> arg0 times 1) 1.0 1.0 1.0 1.0) + (set! (-> arg0 times 2 w) 0.0) + (set! (-> arg0 times 3 w) 0.0) + (set! (-> arg0 times 4 w) 0.0) + (set! (-> arg0 times 5 w) 0.0) + (set! (-> arg0 times 6 w) 0.0) + (set! (-> arg0 times 7 w) 0.0) + ) + 0 + (none) + ) diff --git a/goal_src/jak3/engine/gfx/mood/mood-h.gc b/goal_src/jak3/engine/gfx/mood/mood-h.gc index f9d04fc895..dc82cf2ced 100644 --- a/goal_src/jak3/engine/gfx/mood/mood-h.gc +++ b/goal_src/jak3/engine/gfx/mood/mood-h.gc @@ -15,184 +15,272 @@ ;; DECOMP BEGINS (deftype mood-channel (structure) - ((data float 24) - (vecs vector4 6 :overlay-at (-> data 0)))) + ((data float 24) + (vecs vector4 6 :inline :overlay-at (-> data 0)) + ) + ) + (deftype mood-channel-group (structure) - ((data mood-channel 4 :inline))) + ((data mood-channel 4 :inline) + ) + ) + (deftype mood-fog (structure) - ((fog-color vector :inline) - (fog-dists vector :inline) - (fog-start meters :overlay-at (-> fog-dists data 0)) - (fog-end meters :overlay-at (-> fog-dists data 1)) - (fog-max float :overlay-at (-> fog-dists data 2)) - (fog-min float :overlay-at (-> fog-dists data 3)) - (erase-color vector :inline))) + ((fog-color vector :inline) + (fog-dists vector :inline) + (fog-start meters :overlay-at (-> fog-dists data 0)) + (fog-end meters :overlay-at (-> fog-dists data 1)) + (fog-max float :overlay-at (-> fog-dists data 2)) + (fog-min float :overlay-at (-> fog-dists data 3)) + (erase-color vector :inline) + ) + ) + (deftype mood-fog-table (structure) - ((data mood-fog 8 :inline))) + ((data mood-fog 8 :inline) + (_data uint128 24 :overlay-at data) + ) + ) + (deftype mood-color (structure) - ((lgt-color vector :inline) - (amb-color vector :inline))) + ((lgt-color vector :inline) + (amb-color vector :inline) + ) + ) + (deftype mood-direction-table (structure) - ((data vector 4 :inline))) + ((data vector 4 :inline) + ) + ) + (deftype mood-color-table (structure) - ((data mood-color 8 :inline))) + ((data mood-color 8 :inline) + (_data uint128 16 :overlay-at data) + ) + ) + (deftype mood-sky-table (structure) - ((data vector 8 :inline))) + ((data vector 8 :inline) + ) + ) + (deftype mood-clouds (structure) - ((cloud-min float) - (cloud-max float))) + ((cloud-min float) + (cloud-max float) + ) + ) + (deftype mood-weather (structure) - ((data float 2) - (cloud float :overlay-at (-> data 0)) - (fog float :overlay-at (-> data 1))) + ((data float 2) + (cloud float :overlay-at (-> data 0)) + (fog float :overlay-at (-> data 1)) + ) :pack-me - :allow-misaligned) + :allow-misaligned + ) + (deftype mood-iweather (structure) - ((data int32 2) - (cloud int32 :overlay-at (-> data 0)) - (fog int32 :overlay-at (-> data 1))) - :allow-misaligned) + ((data int32 2) + (cloud int32 :overlay-at (-> data 0)) + (fog int32 :overlay-at (-> data 1)) + ) + :allow-misaligned + ) + (deftype mood-range (structure) - ((data float 4) - (min-cloud float :overlay-at (-> data 0)) - (max-cloud float :overlay-at (-> data 1)) - (min-fog float :overlay-at (-> data 2)) - (max-fog float :overlay-at (-> data 3)) - (quad uint128 :overlay-at (-> data 0)))) + ((data float 4) + (min-cloud float :overlay-at (-> data 0)) + (max-cloud float :overlay-at (-> data 1)) + (min-fog float :overlay-at (-> data 2)) + (max-fog float :overlay-at (-> data 3)) + (quad uint128 :overlay-at (-> data 0)) + ) + ) + (deftype mood-filters-table (structure) - ((data vector 8 :inline))) + ((data vector 8 :inline) + ) + ) + (deftype mood-table (basic) - ((mood-fog-table mood-fog-table) - (mood-color-table mood-color-table) - (mood-channel-group mood-channel-group) - (mood-direction-table mood-direction-table) - (mood-sky-table mood-sky-table) - (mood-interp-table sky-color-day))) + ((mood-fog-table mood-fog-table) + (mood-color-table mood-color-table) + (mood-channel-group mood-channel-group) + (mood-direction-table mood-direction-table) + (mood-sky-table mood-sky-table) + (mood-interp-table sky-color-day) + ) + ) + (deftype light-state (structure) - ((time float) - (fade float))) + ((time float) + (fade float) + ) + :pack-me + ) + (deftype flicker-state (structure) - ((flicker-off uint8) - (flicker-on uint8))) + ((flicker-off uint8) + (flicker-on uint8) + ) + :allow-misaligned + ) + (deftype florescent-state (structure) - ((value float) - (delay int8) - (delay2 int8))) + ((value float) + (delay int8) + (delay2 int8) + ) + ) + (deftype electricity-state (structure) - ((value float) - (scale float))) + ((value float) + (scale float) + ) + ) + (deftype pulse-state (structure) - ((pulse float) - (brightness float) - (target-brightness float) - (speed float))) + ((pulse float) + (brightness float) + (target-brightness float) + (speed float) + ) + ) + (deftype strobe-state (structure) - ((time float))) + ((time float) + ) + ) + (deftype flames-state (structure) - ((time float) - (index uint8) - (length uint8) - (height uint8))) + ((time float) + (index uint8) + (length uint8) + (height uint8) + ) + :pack-me + ) + (deftype mood-context-core (structure) - ((current-fog mood-fog :inline) - (current-sky-color vector :inline) - (current-env-color vector :inline) - (current-prt-color vector :inline) - (current-shadow-color vector :inline))) + ((current-fog mood-fog :inline) + (current-sky-color vector :inline) + (current-env-color vector :inline) + (current-prt-color vector :inline) + (current-shadow-color vector :inline) + ) + ) + (deftype mood-context-core2 (mood-context-core) - ((light-group light-group 8 :inline))) + ((light-group light-group 8 :inline) + ) + ) + (deftype mood-context-core3 (mood-context-core2) - ((times vector 8 :inline))) + ((times vector 8 :inline) + ) + ) + (deftype mood-context (mood-context-core3) - ((itimes vector4w 4 :inline) - (state uint32 32))) + ((itimes vector4w 4 :inline) + (state uint32 32) + (data uint128 123 :overlay-at (-> current-fog fog-color data 0)) + ) + ) + (deftype mood-control-work (structure) - ((color vector4w :inline) - (weather mood-weather :inline) - (iweather mood-iweather :inline) - (interp mood-weather :inline) - (index int32 4) - (color-interp float) - (color-index int32 2) - (channel-interp float) - (channel-index int32 2) - (cloud-interp float) - (cloud-index int32 2))) + ((color vector4w :inline) + (weather mood-weather :inline) + (iweather mood-iweather :inline) + (interp mood-weather :inline) + (index int32 4) + (color-interp float) + (color-index int32 2) + (channel-interp float) + (channel-index int32 2) + (cloud-interp float) + (cloud-index int32 2) + ) + ) + (deftype mood-control (mood-table) - ((mood-clouds mood-clouds) - (current-interp mood-weather :inline) - (target-interp mood-weather :inline) - (speed-interp mood-weather :inline) - (range mood-range :inline) - (time-until-random mood-weather :inline) - (time-until-random-min mood-weather :inline) - (time-until-random-max mood-weather :inline) - (current-special-interp float) - (target-special-interp float) - (rate-special-interp float) - (display-flag symbol) - (overide-weather-flag symbol) - (pad int32) - (overide mood-weather :inline) - (lightning-index int32) - (lightning-val int32) - (lightning-time int32) - (lightning-time2 float) - (lightning-time3 float) - (lightning-flash float) - (lightning-id sound-id) - (lightning-count0 uint32) - (lightning-count1 uint32) - (lightning-count2 uint32) - (rain-id sound-id) - (sound-pitch float) - (fogs mood-fog-table 9) - (colors mood-color-table 3) - (channels mood-channel-group 3) - (clouds mood-clouds 9)) + ((mood-clouds mood-clouds) + (current-interp mood-weather :inline) + (target-interp mood-weather :inline) + (speed-interp mood-weather :inline) + (range mood-range :inline) + (time-until-random mood-weather :inline) + (time-until-random-min mood-weather :inline) + (time-until-random-max mood-weather :inline) + (current-special-interp float) + (target-special-interp float) + (rate-special-interp float) + (display-flag symbol) + (overide-weather-flag symbol) + (pad int32) + (overide mood-weather :inline) + (lightning-index int32) + (lightning-val int32) + (lightning-time int32) + (lightning-time2 float) + (lightning-time3 float) + (lightning-flash float) + (lightning-id sound-id) + (lightning-count0 uint32) + (lightning-count1 uint32) + (lightning-count2 uint32) + (rain-id sound-id) + (sound-pitch float) + (fogs mood-fog-table 9) + (colors mood-color-table 3) + (channels mood-channel-group 3) + (clouds mood-clouds 9) + ) (:methods - (mood-control-method-9 () none) - (mood-control-method-10 () none) - (mood-control-method-11 () none) - (mood-control-method-12 () none) - (set-special-interps! (_type_ float float symbol) none) - (weather-event-concluded? (_type_) symbol) - (mood-control-method-15 () none) - (mood-control-method-16 () none) - (mood-control-method-17 () none) - (mood-control-method-18 () none) - (mood-control-method-19 () none) - (mood-control-method-20 () none) - (mood-control-method-21 () none) - (mood-control-method-22 () none) - (mood-control-method-23 () none) - (mood-control-method-24 () none))) + (init-weather! (_type_) none) + (set-cloud-and-fog-interp! (_type_ float float float float) none) + (update-mood-range! (_type_ float float float float) none) + (set-time-for-random-weather! (_type_ float float) none) + (set-special-interps! (_type_ float float symbol) none) + (weather-event-concluded? (_type_) symbol) + (set-lightning-time! (_type_ int int float) none) + (apply-mood-clouds-and-fog (_type_ mood-control-work) none) + (apply-mood-fog (_type_ mood-control-work mood-color-table mood-color-table mood-color-table float) none) + (apply-fog-height (_type_ mood-control-work float float float float) none) + (apply-mood-colors (_type_ mood-control-work) none) + (mood-control-method-20 (_type_ mood-control-work mood-color-table mood-color-table mood-color-table float) none) + (apply-mood-channels (_type_ mood-control-work) none) + (adjust-num-clouds (_type_ mood-control-work) none) + (gen-lightning-and-thunder! (_type_ int) none) + (play-or-stop-lightning-sfx! (_type_ sound-spec vector) none) + ) + ) + (defmethod set-special-interps! ((this mood-control) (target-interp float) (rate-interp float) (set-current-interp? symbol)) "Sets the `*-special-interp` values with the given values @@ -204,10 +292,15 @@ (let ((clamped-interp (fmax 0.0 (fmin 1.0 target-interp)))) (set! (-> this target-special-interp) clamped-interp) (set! (-> this rate-special-interp) rate-interp) - (if set-current-interp? (set! (-> this current-special-interp) clamped-interp))) + (if set-current-interp? + (set! (-> this current-special-interp) clamped-interp) + ) + ) 0 - (none)) + (none) + ) (defmethod weather-event-concluded? ((this mood-control)) "@returns [[#t]] if [[this::override-weather-flag]] is set, we aren't in a cutscene and [[this::current-special-interp]] is equal to `0.0`" - (and (-> this overide-weather-flag) (not (movie?)) (= (-> this current-special-interp) 0.0))) + (and (-> this overide-weather-flag) (not (movie?)) (= (-> this current-special-interp) 0.0)) + ) diff --git a/goal_src/jak3/engine/gfx/mood/mood-tables2.gc b/goal_src/jak3/engine/gfx/mood/mood-tables2.gc index 54a2201e61..e0bbc974e7 100644 --- a/goal_src/jak3/engine/gfx/mood/mood-tables2.gc +++ b/goal_src/jak3/engine/gfx/mood/mood-tables2.gc @@ -7,3 +7,439 @@ ;; DECOMP BEGINS +;; this file is debug only +(declare-file (debug)) + +(define *overide-mood-color-table* + (new 'static 'mood-color-table :data (new 'static 'inline-array mood-color 8 + (new 'static 'mood-color + :lgt-color (new 'static 'vector :x 1.375 :y 1.157) + :amb-color (new 'static 'vector :x 0.625 :y 0.553 :z 0.725 :w 1.0) + ) + (new 'static 'mood-color + :lgt-color (new 'static 'vector :x 1.473 :y 1.337 :z 1.0) + :amb-color (new 'static 'vector :x 0.527 :y 0.652 :z 0.75 :w 1.0) + ) + (new 'static 'mood-color + :lgt-color (new 'static 'vector :x 1.473 :y 1.348 :z 1.15) + :amb-color (new 'static 'vector :x 0.527 :y 0.652 :z 0.75 :w 1.0) + ) + (new 'static 'mood-color + :lgt-color (new 'static 'vector :x 1.473 :y 1.337 :z 1.0) + :amb-color (new 'static 'vector :x 0.527 :y 0.652 :z 0.75 :w 1.0) + ) + (new 'static 'mood-color + :lgt-color (new 'static 'vector :x 1.5 :y 1.148) + :amb-color (new 'static 'vector :x 0.5 :y 0.562 :z 0.75 :w 1.0) + ) + (new 'static 'mood-color + :lgt-color (new 'static 'vector :x 0.05 :y 0.149 :z 0.375) + :amb-color (new 'static 'vector :x 0.35 :y 0.451 :z 0.625 :w 1.0) + ) + (new 'static 'mood-color + :lgt-color (new 'static 'vector :x 0.1 :y 0.35 :z 0.5) + :amb-color (new 'static 'vector :x 0.3 :y 0.35 :z 0.5 :w 1.0) + ) + (new 'static 'mood-color + :lgt-color (new 'static 'vector :x 0.1 :y 0.575 :z 0.4) + :amb-color (new 'static 'vector :x 0.3 :y 0.425 :z 0.5 :w 1.0) + ) + ) + ) + ) + +(define *overide-mood-fog-table* + (new 'static 'mood-fog-table :data (new 'static 'inline-array mood-fog 8 + (new 'static 'mood-fog + :fog-color (new 'static 'vector :x 160.0 :y 150.0 :z 200.0 :w 128.0) + :fog-dists (new 'static 'vector :x 262144.0 :y 3690496.0 :z 255.0 :w 64.0) + :erase-color (new 'static 'vector :w 128.0) + ) + (new 'static 'mood-fog + :fog-color (new 'static 'vector :x 150.0 :y 165.0 :z 220.0 :w 128.0) + :fog-dists (new 'static 'vector :x 262144.0 :y 3690496.0 :z 255.0 :w 64.0) + :erase-color (new 'static 'vector :w 128.0) + ) + (new 'static 'mood-fog + :fog-color (new 'static 'vector :x 128.0 :y 180.0 :z 243.0 :w 128.0) + :fog-dists (new 'static 'vector :x 262144.0 :y 3690496.0 :z 255.0 :w 64.0) + :erase-color (new 'static 'vector :w 128.0) + ) + (new 'static 'mood-fog + :fog-color (new 'static 'vector :x 150.0 :y 165.0 :z 220.0 :w 128.0) + :fog-dists (new 'static 'vector :x 262144.0 :y 3690496.0 :z 255.0 :w 64.0) + :erase-color (new 'static 'vector :w 128.0) + ) + (new 'static 'mood-fog + :fog-color (new 'static 'vector :x 160.0 :y 150.0 :z 200.0 :w 128.0) + :fog-dists (new 'static 'vector :x 262144.0 :y 3690496.0 :z 255.0 :w 64.0) + :erase-color (new 'static 'vector :w 128.0) + ) + (new 'static 'mood-fog + :fog-color (new 'static 'vector :x 16.0 :y 32.0 :z 100.0 :w 128.0) + :fog-dists (new 'static 'vector :x 262144.0 :y 3690496.0 :z 255.0 :w 64.0) + :erase-color (new 'static 'vector :w 128.0) + ) + (new 'static 'mood-fog + :fog-color (new 'static 'vector :y 24.0 :z 64.0 :w 128.0) + :fog-dists (new 'static 'vector :x 262144.0 :y 3690496.0 :z 255.0 :w 64.0) + :erase-color (new 'static 'vector :w 128.0) + ) + (new 'static 'mood-fog + :fog-color (new 'static 'vector :y 56.0 :z 72.0 :w 128.0) + :fog-dists (new 'static 'vector :x 262144.0 :y 3690496.0 :z 255.0 :w 64.0) + :erase-color (new 'static 'vector :w 128.0) + ) + ) + ) + ) + +;; WARN: Return type mismatch pointer vs none. +(defun init-overide-table ((table mood-table)) + "Similar to the beginning of [[init-mood-control]], does the bare minimum to setup the given [[mood-table]] + @param! table The table to initialize + @returns [[none]]" + (set! (-> table mood-fog-table) (new 'debug 'mood-fog-table)) + (set! (-> table mood-color-table) (new 'debug 'mood-color-table)) + (set! (-> table mood-channel-group) *no-cloud-mood-channel-group*) + (set! (-> table mood-direction-table) *mood-direction-table*) + (set! (-> table mood-sky-table) *mood-sky-table*) + (set! (-> table mood-interp-table) *mood-interp-table*) + (mem-copy! (the-as pointer (-> table mood-fog-table)) (the-as pointer *no-cloud-clear-mood-fog-table*) 384) + (mem-copy! (the-as pointer (-> table mood-color-table)) (the-as pointer *no-cloud-mood-color-table*) 256) + (none) + ) + +(define *overide-table* (new 'static 'mood-table)) + +(init-overide-table *overide-table*) + +;; WARN: Return type mismatch object vs none. +(defun print-mood-tables () + "Generates the GOAL code for defining the current state of [[*overide-table*]]" + (mem-copy! (the-as pointer (-> *overide-table* mood-fog-table)) (the-as pointer *overide-mood-fog-table*) 384) + (mem-copy! + (the-as pointer (-> *overide-table* mood-color-table)) + (the-as pointer *overide-mood-color-table*) + 256 + ) + (dotimes (data-idx 8) + (vector-float*! + (the-as vector (-> *overide-table* mood-fog-table data data-idx)) + (the-as vector (-> *overide-table* mood-fog-table data data-idx)) + (-> *overide-table* mood-fog-table data data-idx fog-color w) + ) + (vector-float*! + (the-as vector (-> *overide-table* mood-color-table data data-idx)) + (the-as vector (-> *overide-table* mood-color-table data data-idx)) + (-> *overide-table* mood-color-table data data-idx lgt-color w) + ) + (vector-float*! + (the-as vector (+ (the-as uint (-> *overide-table* mood-color-table data 0 amb-color)) (* data-idx 32))) + (the-as vector (+ (the-as uint (-> *overide-table* mood-color-table data 0 amb-color)) (* data-idx 32))) + (-> *overide-table* mood-color-table data data-idx amb-color w) + ) + (set! (-> *overide-table* mood-fog-table data data-idx fog-color w) 128.0) + (set! (-> *overide-table* mood-color-table data data-idx lgt-color w) 0.0) + (set! (-> *overide-table* mood-color-table data data-idx amb-color w) 1.0) + ) + (format 0 "(define *overide-mood-color-table*~%") + (format 0 " (new 'static 'mood-color-table~%") + (format 0 " :data (new 'static 'inline-array 'mood-color 0~%") + (dotimes (_color-idx 8) + (format 0 " (new 'static 'mood-color") + (let ((color-idx _color-idx)) + (cond + ((zero? color-idx) + (format 0 " ; sun rise~%") + ) + ((= color-idx 1) + (format 0 " ; morning~%") + ) + ((= color-idx 2) + (format 0 " ; noon~%") + ) + ((= color-idx 3) + (format 0 " ; afternoon~%") + ) + ((= color-idx 4) + (format 0 " ; sunset~%") + ) + ((= color-idx 5) + (format 0 " ; twilight~%") + ) + ((= color-idx 6) + (format 0 " ; evening~%") + ) + ((= color-idx 7) + (format 0 " ; green sun~%") + ) + ) + ) + (format + 0 + " :lgt-color (new 'static 'vector :x ~f :y ~f :z ~f :w ~f)~%" + (-> *overide-table* mood-color-table data _color-idx lgt-color x) + (-> *overide-table* mood-color-table data _color-idx lgt-color y) + (-> *overide-table* mood-color-table data _color-idx lgt-color z) + (-> *overide-table* mood-color-table data _color-idx lgt-color w) + ) + (format + 0 + " :amb-color (new 'static 'vector :x ~f :y ~f :z ~f :w ~f)~%" + (-> *overide-table* mood-color-table data _color-idx amb-color x) + (-> *overide-table* mood-color-table data _color-idx amb-color y) + (-> *overide-table* mood-color-table data _color-idx amb-color z) + (-> *overide-table* mood-color-table data _color-idx amb-color w) + ) + (format 0 " )~%") + ) + (format 0 " )~%") + (format 0 " )~%") + (format 0 " )~%") + (format 0 "(define *overide-mood-fog-table*~%") + (format 0 " (new 'static 'mood-fog-table~%") + (format 0 " :data (new 'static 'inline-array 'mood-fog 0~%") + (dotimes (_fog-idx 8) + (format 0 " (new 'static 'mood-fog") + (let ((fog-idx _fog-idx)) + (cond + ((zero? fog-idx) + (format 0 " ; sun rise~%") + ) + ((= fog-idx 1) + (format 0 " ; morning~%") + ) + ((= fog-idx 2) + (format 0 " ; noon~%") + ) + ((= fog-idx 3) + (format 0 " ; afternoon~%") + ) + ((= fog-idx 4) + (format 0 " ; sunset~%") + ) + ((= fog-idx 5) + (format 0 " ; twilight~%") + ) + ((= fog-idx 6) + (format 0 " ; evening~%") + ) + ((= fog-idx 7) + (format 0 " ; green sun~%") + ) + ) + ) + (format + 0 + " :fog-color (new 'static 'vector :x ~f :y ~f :z ~f :w ~f)~%" + (-> *overide-table* mood-fog-table data _fog-idx fog-color x) + (-> *overide-table* mood-fog-table data _fog-idx fog-color y) + (-> *overide-table* mood-fog-table data _fog-idx fog-color z) + (-> *overide-table* mood-fog-table data _fog-idx fog-color w) + ) + (format + 0 + " :fog-start (meters ~f) :fog-end (meters ~f) :fog-min ~f :fog-max ~f ~%" + (-> *overide-table* mood-fog-table data _fog-idx fog-dists x) + (-> *overide-table* mood-fog-table data _fog-idx fog-dists y) + (-> *overide-table* mood-fog-table data _fog-idx fog-dists w) + (-> *overide-table* mood-fog-table data _fog-idx fog-dists z) + ) + (format 0 " :erase-color (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 128.0)~%") + (format 0 " )~%") + ) + (format 0 " )~%") + (format 0 " )~%") + (format 0 " )~%") + (format 0 "(define *overide-table* (new 'static 'mood-table))~%") + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defun desaturate-mood-colors ((arg0 float) (arg1 float) (arg2 float)) + "Unused - Generate GOAL code for a new [[*overide-mood-color-table*]] definition that desaturates the color + Apply said overrides to the [[*overide-table*]]" + (mem-copy! + (the-as pointer (-> *overide-table* mood-color-table)) + (the-as pointer *no-cloud-mood-color-table*) + 256 + ) + (dotimes (data-idx 8) + (let ((color-data (-> *overide-table* mood-color-table data data-idx)) + (mood-colors + (the-as + (inline-array mood-color) + (-> (the-as (inline-array mood-color) (-> *overide-table* mood-color-table data 0 amb-color)) data-idx) + ) + ) + ) + (let ((max-light-color + (fmax (fmax (-> color-data lgt-color x) (-> color-data lgt-color y)) (-> color-data lgt-color z)) + ) + (max-0th-light-color + (fmax (fmax (-> mood-colors 0 lgt-color x) (-> mood-colors 0 lgt-color y)) (-> mood-colors 0 lgt-color z)) + ) + ) + (set! (-> color-data lgt-color x) + (* (+ (-> color-data lgt-color x) (* (- max-light-color (-> color-data lgt-color x)) arg0)) arg1) + ) + (set! (-> color-data lgt-color y) + (* (+ (-> color-data lgt-color y) (* (- max-light-color (-> color-data lgt-color y)) arg0)) arg1) + ) + (set! (-> color-data lgt-color z) + (* (+ (-> color-data lgt-color z) (* (- max-light-color (-> color-data lgt-color z)) arg0)) arg1) + ) + (set! (-> color-data lgt-color w) 0.0) + (set! (-> mood-colors 0 lgt-color x) + (* (+ (-> mood-colors 0 lgt-color x) (* (- max-0th-light-color (-> mood-colors 0 lgt-color x)) arg0)) arg2) + ) + (set! (-> mood-colors 0 lgt-color y) + (* (+ (-> mood-colors 0 lgt-color y) (* (- max-0th-light-color (-> mood-colors 0 lgt-color x)) arg0)) arg2) + ) + (set! (-> mood-colors 0 lgt-color z) + (* (+ (-> mood-colors 0 lgt-color z) (* (- max-0th-light-color (-> mood-colors 0 lgt-color x)) arg0)) arg2) + ) + ) + (set! (-> mood-colors 0 lgt-color w) 1.0) + ) + ) + (format 0 "(define *overide-mood-color-table*~%") + (format 0 " (new 'static 'mood-color-table~%") + (format 0 " :data (new 'static 'inline-array 'mood-color 0~%") + (dotimes (_color-idx 8) + (format 0 " (new 'static 'mood-color") + (let ((color-idx _color-idx)) + (cond + ((zero? color-idx) + (format 0 " ; sun rise~%") + ) + ((= color-idx 1) + (format 0 " ; morning~%") + ) + ((= color-idx 2) + (format 0 " ; noon~%") + ) + ((= color-idx 3) + (format 0 " ; afternoon~%") + ) + ((= color-idx 4) + (format 0 " ; sunset~%") + ) + ((= color-idx 5) + (format 0 " ; twilight~%") + ) + ((= color-idx 6) + (format 0 " ; evening~%") + ) + ((= color-idx 7) + (format 0 " ; green sun~%") + ) + ) + ) + (format + 0 + " :lgt-color (new 'static 'vector :x ~f :y ~f :z ~f :w ~f)~%" + (-> *overide-table* mood-color-table data _color-idx lgt-color x) + (-> *overide-table* mood-color-table data _color-idx lgt-color y) + (-> *overide-table* mood-color-table data _color-idx lgt-color z) + (-> *overide-table* mood-color-table data _color-idx lgt-color w) + ) + (format + 0 + " :amb-color (new 'static 'vector :x ~f :y ~f :z ~f :w ~f)~%" + (-> *overide-table* mood-color-table data _color-idx amb-color x) + (-> *overide-table* mood-color-table data _color-idx amb-color y) + (-> *overide-table* mood-color-table data _color-idx amb-color z) + (-> *overide-table* mood-color-table data _color-idx amb-color w) + ) + (format 0 " )~%") + ) + (format 0 " )~%") + (format 0 " )~%") + (format 0 " )~%") + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defun desaturate-mood-fog ((arg0 (pointer mood-fog-table)) (arg1 float) (arg2 float)) + "Unused - Generate GOAL code for a new [[*overide-mood-fog-table*]] definition that desaturates the fog color + Apply said overrides to the [[*overide-table*]]" + (mem-copy! (the-as pointer (-> *overide-table* mood-fog-table)) arg0 384) + (dotimes (data-idx 8) + (let ((fog-data (-> *overide-table* mood-fog-table data data-idx))) + (let ((max-fog-val (fmax (fmax (-> fog-data fog-color x) (-> fog-data fog-color y)) (-> fog-data fog-color z)))) + (set! (-> fog-data fog-color x) + (* (+ (-> fog-data fog-color x) (* (- max-fog-val (-> fog-data fog-color x)) arg1)) arg2) + ) + (set! (-> fog-data fog-color y) + (* (+ (-> fog-data fog-color y) (* (- max-fog-val (-> fog-data fog-color y)) arg1)) arg2) + ) + (set! (-> fog-data fog-color z) + (* (+ (-> fog-data fog-color z) (* (- max-fog-val (-> fog-data fog-color z)) arg1)) arg2) + ) + ) + (set! (-> fog-data fog-color w) 1.0) + ) + ) + (format 0 "(define *overide-mood-fog-table*~%") + (format 0 " (new 'static 'mood-fog-table~%") + (format 0 " :data (new 'static 'inline-array 'mood-fog 0~%") + (dotimes (_fog-idx 8) + (format 0 " (new 'static 'mood-fog") + (let ((fog-idx _fog-idx)) + (cond + ((zero? fog-idx) + (format 0 " ; sun rise~%") + ) + ((= fog-idx 1) + (format 0 " ; morning~%") + ) + ((= fog-idx 2) + (format 0 " ; noon~%") + ) + ((= fog-idx 3) + (format 0 " ; afternoon~%") + ) + ((= fog-idx 4) + (format 0 " ; sunset~%") + ) + ((= fog-idx 5) + (format 0 " ; twilight~%") + ) + ((= fog-idx 6) + (format 0 " ; evening~%") + ) + ((= fog-idx 7) + (format 0 " ; green sun~%") + ) + ) + ) + (format + 0 + " :fog-color (new 'static 'vector :x ~f :y ~f :z ~f :w ~f)~%" + (-> *overide-table* mood-fog-table data _fog-idx fog-color x) + (-> *overide-table* mood-fog-table data _fog-idx fog-color y) + (-> *overide-table* mood-fog-table data _fog-idx fog-color z) + (-> *overide-table* mood-fog-table data _fog-idx fog-color w) + ) + (format + 0 + " :fog-start (meters ~f) :fog-end (meters ~f) :fog-min ~f :fog-max ~f ~%" + (* 0.00024414062 (-> *overide-table* mood-fog-table data _fog-idx fog-dists x)) + (* 0.00024414062 (-> *overide-table* mood-fog-table data _fog-idx fog-dists y)) + (-> *overide-table* mood-fog-table data _fog-idx fog-dists w) + (-> *overide-table* mood-fog-table data _fog-idx fog-dists z) + ) + (format 0 " :erase-color (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 128.0)~%") + (format 0 " )~%") + ) + (format 0 " )~%") + (format 0 " )~%") + (format 0 " )~%") + (none) + ) + +(define *debug-mood-color-table* (-> *mood-control* mood-color-table)) + +(define *debug-mood-fog-table* (-> *mood-control* mood-fog-table)) diff --git a/goal_src/jak3/engine/gfx/mood/mood.gc b/goal_src/jak3/engine/gfx/mood/mood.gc index 80a8c82a73..f8634103d5 100644 --- a/goal_src/jak3/engine/gfx/mood/mood.gc +++ b/goal_src/jak3/engine/gfx/mood/mood.gc @@ -8,8 +8,1619 @@ ;; DECOMP BEGINS -;; TODO: remove these stubs +(defun palette-select-special ((arg0 mood-context-core3)) + (dotimes (v1-0 8) + (cond + ((logtest? (-> *time-of-day-context* mode) (ash 16 v1-0)) + (if (-> *time-of-day-context* overide-enable) + (set! (-> arg0 times v1-0 quad) (-> *time-of-day-context* times v1-0 quad)) + (set! (-> arg0 times v1-0 w) 1.0) + ) + ) + (else + (set! (-> arg0 times v1-0 w) 0.0) + ) + ) + ) + #f + ) + +(defun clear-mood-times ((mood-ctx mood-context)) + (dotimes (idx 8) + (set! (-> mood-ctx times idx w) 0.0) + ) + #f + ) + +(defun update-mood-itimes ((arg0 mood-context)) + (local-vars + (v1-0 uint128) + (v1-1 uint128) + (v1-2 uint128) + (v1-3 uint128) + (a1-0 uint128) + (a1-1 uint128) + (a1-2 uint128) + (a1-3 uint128) + (a2-0 uint128) + (a2-1 uint128) + (a3-0 uint128) + (a3-1 uint128) + (t0-0 uint128) + (t0-1 uint128) + (t1-0 uint128) + (t1-1 uint128) + (t2-0 uint128) + (t2-1 uint128) + (t3-0 uint128) + (t3-1 uint128) + ) + (rlet ((vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + (vf8 :class vf) + ) + (nop!) + (nop!) + (.lvf vf1 (&-> arg0 times 0 quad)) + (nop!) + (.lvf vf2 (&-> arg0 times 1 quad)) + (.mul.w.vf vf1 vf1 vf1 :mask #b111) + (.lvf vf3 (&-> arg0 times 2 quad)) + (.mul.w.vf vf2 vf2 vf2 :mask #b111) + (.lvf vf4 (&-> arg0 times 3 quad)) + (.mul.w.vf vf3 vf3 vf3 :mask #b111) + (.lvf vf5 (&-> arg0 times 4 quad)) + (.mul.w.vf vf4 vf4 vf4 :mask #b111) + (.lvf vf6 (&-> arg0 times 5 quad)) + (.mul.w.vf vf5 vf5 vf5 :mask #b111) + (.lvf vf7 (&-> arg0 times 6 quad)) + (.mul.w.vf vf6 vf6 vf6 :mask #b111) + (.lvf vf8 (&-> arg0 times 7 quad)) + (.mul.w.vf vf7 vf7 vf7 :mask #b111) + (nop!) + (.mul.w.vf vf8 vf8 vf8 :mask #b111) + (nop!) + (vftoi12.xyzw vf1 vf1) + (nop!) + (vftoi12.xyzw vf2 vf2) + (nop!) + (vftoi12.xyzw vf3 vf3) + (nop!) + (vftoi12.xyzw vf4 vf4) + (nop!) + (vftoi12.xyzw vf5 vf5) + (nop!) + (vftoi12.xyzw vf6 vf6) + (nop!) + (vftoi12.xyzw vf7 vf7) + (nop!) + (vftoi12.xyzw vf8 vf8) + (nop!) + (.mov v1-0 vf1) + (nop!) + (.mov a1-0 vf2) + (nop!) + (.mov a2-0 vf3) + (.pw.sra v1-1 v1-0 6) + (.mov a3-0 vf4) + (.pw.sra a1-1 a1-0 6) + (.mov t0-0 vf5) + (.pw.sra a2-1 a2-0 6) + (.mov t1-0 vf6) + (.pw.sra a3-1 a3-0 6) + (.mov t2-0 vf7) + (.pw.sra t0-1 t0-0 6) + (.mov t3-0 vf8) + (.pw.sra t1-1 t1-0 6) + (.pw.sra t2-1 t2-0 6) + (nop!) + (.pw.sra t3-1 t3-0 6) + (nop!) + (.ppach v1-2 a1-1 v1-1) + (nop!) + (.ppach a1-2 a3-1 a2-1) + (set! (-> arg0 itimes 0 quad) v1-2) + (.ppach v1-3 t1-1 t0-1) + (set! (-> arg0 itimes 1 quad) a1-2) + (.ppach a1-3 t3-1 t2-1) + (set! (-> arg0 itimes 2 quad) v1-3) + (nop!) + (set! (-> arg0 itimes 3 quad) a1-3) + 0 + (none) + ) + ) + +(defun update-mood-direction ((arg0 mood-context-core3) (arg1 mood-table) (arg2 float)) + (local-vars (sv-16 light-group)) + (let* ((v1-0 (-> arg1 mood-channel-group)) + (a2-1 (-> arg1 mood-direction-table)) + (a3-0 (the int arg2)) + (t0-1 (mod (+ a3-0 1) 24)) + (f0-3 (- arg2 (the float a3-0))) + (f1-3 (- 1.0 f0-3)) + (t1-0 0) + (a1-3 (-> arg0 light-group)) + ) + (set! sv-16 (-> arg0 light-group 1)) + (set! (-> a1-3 0 ambi extra x) 1.0) + (set! (-> a1-3 0 dir0 extra x) 0.0) + (set! (-> a1-3 0 dir1 extra x) 0.0) + (set! (-> a1-3 0 dir2 extra x) 0.0) + (dotimes (t2-2 4) + (let ((f2-6 (+ (* f1-3 (-> (the-as (pointer float) (+ (+ (* a3-0 4) (* 96 t2-2)) (the-as int v1-0))))) + (* f0-3 (-> (the-as (pointer float) (+ (+ (* t0-1 4) (* 96 t2-2)) (the-as int v1-0))))) + ) + ) + ) + (when (!= f2-6 0.0) + (set! (-> a1-3 0 lights t1-0 extra x) f2-6) + (set! (-> a1-3 0 lights t1-0 mask) (the-as uint (ash 2 t2-2))) + (set! (-> a1-3 0 lights t1-0 palette-index) (+ t2-2 1)) + (set! (-> a1-3 0 lights t1-0 direction quad) (-> a2-1 data t2-2 quad)) + (set! (-> (the-as (pointer uint128) (+ (the-as uint (-> a1-3 0 dir0 color)) (* 48 t1-0)))) + (-> arg0 times (+ t2-2 1) quad) + ) + (set! (-> arg0 times (+ t2-2 1) w) f2-6) + (+! t1-0 1) + ) + ) + ) + (set! (-> a1-3 0 ambi mask) (the-as uint 1)) + (set! (-> a1-3 0 ambi palette-index) 0) + (mem-copy! (the-as pointer sv-16) (the-as pointer a1-3) 192) + ) + (let ((f0-4 1.0)) + (let ((f1-4 1.1)) + (cond + ((or (>= 6.0 arg2) (>= arg2 18.0)) + (set! f0-4 f1-4) + ) + ((and (< 6.0 arg2) (< arg2 7.0)) + (+! f0-4 (* (- f1-4 f0-4) (- 7.0 arg2))) + ) + ((and (< 17.0 arg2) (< arg2 18.0)) + (+! f0-4 (* (- f1-4 f0-4) (+ -17.0 arg2))) + ) + ) + ) + (set! (-> sv-16 dir0 extra x) (* (-> sv-16 dir0 extra x) f0-4)) + (set! (-> sv-16 dir1 extra x) (* (-> sv-16 dir1 extra x) f0-4)) + (set! (-> sv-16 dir2 extra x) (* (-> sv-16 dir2 extra x) f0-4)) + ) + ) + +(defun update-mood-exterior ((arg0 mood-context-core3) (arg1 mood-table) (arg2 float) (arg3 int)) + (local-vars (v0-1 object) (sv-32 mood-color) (sv-48 mood-color) (sv-64 vector)) + (cond + ((< (the-as uint 8) (the-as uint (-> *time-of-day-context* mode))) + (palette-select-special arg0) + ) + (else + 0 + 0 + 0.0 + (let* ((v1-3 (the int arg2)) + (f0-4 (- arg2 (the float v1-3))) + (f1-3 (- 1.0 f0-4)) + (a0-6 (/ v1-3 24)) + (v1-7 (-> arg1 mood-interp-table hour (- v1-3 (* 24 a0-6)))) + (s3-0 (-> v1-7 snapshot1)) + (s2-0 (-> v1-7 snapshot2)) + (f30-0 (+ (* f1-3 (-> v1-7 morph-start)) (* f0-4 (-> v1-7 morph-end)))) + ) + (set! v0-1 + (cond + ((and (-> *level* level arg3 bsp) + (nonzero? (-> *level* level arg3 bsp)) + (not (-> *level* level arg3 bsp ambients)) + ) + (set! v0-1 (-> arg0 times)) + (set! (-> (the-as (inline-array vector) v0-1) 0 x) 1.0) + (set! (-> (the-as (inline-array vector) v0-1) 0 y) 1.0) + (set! (-> (the-as (inline-array vector) v0-1) 0 z) 1.0) + (set! (-> (the-as (inline-array vector) v0-1) 0 w) 1.0) + v0-1 + ) + ((= s3-0 s2-0) + (let ((a2-1 (-> arg1 mood-color-table data s3-0)) + (v1-26 (-> arg0 times)) + (a1-2 (-> arg0 times 1)) + (a0-16 (-> arg0 light-group)) + ) + (set! (-> v1-26 0 quad) (-> a2-1 amb-color quad)) + (set! (-> a1-2 quad) (-> a2-1 lgt-color quad)) + (set! (-> arg0 times 2 quad) (-> a1-2 quad)) + (set! (-> arg0 times 3 quad) (-> a1-2 quad)) + (set! (-> arg0 times 4 quad) (-> a1-2 quad)) + (set! (-> a0-16 0 ambi color quad) (-> v1-26 0 quad)) + ) + (set! (-> arg0 current-sky-color quad) (-> arg1 mood-sky-table data s3-0 quad)) + (mem-copy! (the-as pointer (-> arg0 current-fog)) (the-as pointer (-> arg1 mood-fog-table data s3-0)) 48) + ) + (else + (set! sv-32 (-> arg1 mood-color-table data s3-0)) + (set! sv-48 (-> arg1 mood-color-table data s2-0)) + (let ((s1-0 (-> arg0 times))) + (set! sv-64 (-> arg0 times 1)) + (let ((s0-0 (-> arg0 light-group))) + (vector4-lerp! (the-as vector s1-0) (-> sv-32 amb-color) (-> sv-48 amb-color) f30-0) + (vector4-lerp! sv-64 (-> sv-32 lgt-color) (-> sv-48 lgt-color) f30-0) + (set! (-> arg0 times 2 quad) (-> sv-64 quad)) + (set! (-> arg0 times 3 quad) (-> sv-64 quad)) + (set! (-> arg0 times 4 quad) (-> sv-64 quad)) + (set! (-> s0-0 0 ambi color quad) (-> s1-0 0 quad)) + ) + ) + (vector4-lerp! + (-> arg0 current-sky-color) + (-> arg1 mood-sky-table data s3-0) + (-> arg1 mood-sky-table data s2-0) + f30-0 + ) + (vector4-array-lerp! + (the-as (inline-array vector4) (-> arg0 current-fog)) + (the-as (inline-array vector4) (-> arg1 mood-fog-table data s3-0)) + (the-as (inline-array vector4) (-> arg1 mood-fog-table data s2-0)) + f30-0 + 3 + ) + ) + ) + ) + ) + (set-vector! (-> arg0 current-prt-color) 0.0 0.0 0.0 0.0) + (set-vector! (-> arg0 current-env-color) 0.0 0.0 0.0 0.0) + (let ((f0-18 (-> *mood-control* lightning-flash)) + (a0-36 (-> *mood-control* lightning-index)) + ) + (when (and (!= f0-18 0.0) (< a0-36 4)) + (let ((v1-64 (new 'stack-no-clear 'vector)) + (a0-40 (-> arg0 times (+ a0-36 1))) + ) + (set-vector! v1-64 f0-18 f0-18 f0-18 0.0) + (vector+! a0-40 a0-40 v1-64) + ) + ) + ) + (update-mood-direction arg0 arg1 arg2) + ) + ) + ) + +(defun copy-mood-exterior ((arg0 mood-context)) + (set! (-> *time-of-day-context* exterior-level) (the-as basic #t)) + (cond + ((< (the-as uint 8) (the-as uint (-> *time-of-day-context* mode))) + (palette-select-special arg0) + ) + (else + (let ((v1-2 (the-as object arg0)) + (a1-4 (the-as structure (-> *level* level-default mood-context))) + ) + (dotimes (a2-1 31) + (set! (-> (the-as (inline-array vector) v1-2) 0 quad) + (-> (the-as mood-context a1-4) current-fog fog-color quad) + ) + (set! v1-2 (-> (the-as (inline-array vector) v1-2) 1)) + (set! a1-4 (-> (the-as mood-context a1-4) current-fog fog-dists)) + ) + ) + (let ((v1-5 (the-as object (-> arg0 times))) + (a0-2 (the-as object (-> *level* level-default mood-context times))) + ) + (dotimes (a1-6 5) + (set! (-> (the-as (inline-array vector) v1-5) 0 quad) (-> (the-as (inline-array vector) a0-2) 0 quad)) + (set! v1-5 (-> (the-as (inline-array vector) v1-5) 1)) + (set! a0-2 (-> (the-as (inline-array vector) a0-2) 1)) + ) + ) + #f + ) + ) + ) + +;; WARN: Return type mismatch object vs none. +(defun copy-mood-exterior-ambi ((arg0 mood-context) (arg1 symbol)) + (cond + ((< (the-as uint 8) (the-as uint (-> *time-of-day-context* mode))) + (palette-select-special arg0) + ) + (else + (let ((v1-1 (the-as structure arg0)) + (a2-3 (the-as structure (-> *level* level-default mood-context))) + ) + (dotimes (a3-1 31) + (set! (-> (the-as mood-context v1-1) current-fog fog-color quad) + (-> (the-as mood-context a2-3) current-fog fog-color quad) + ) + (set! v1-1 (-> (the-as mood-context v1-1) current-fog fog-dists)) + (set! a2-3 (-> (the-as mood-context a2-3) current-fog fog-dists)) + ) + ) + (set! (-> arg0 times 0 quad) (-> *level* level-default mood-context times 0 quad)) + (vector+! + (the-as vector (-> arg0 times)) + (the-as vector (-> arg0 times)) + (-> *level* level-default mood-context times 1) + ) + (when arg1 + (set! (-> arg0 times 1 quad) (-> *level* level-default mood-context times 1 quad)) + (set! (-> arg0 times 1 w) 1.0) + ) + ) + ) + (none) + ) + (defun clear-mood-context ((arg0 mood-context)) - (format 0 "no clear-mood-context~%") + (let ((v1-0 arg0)) + (dotimes (a1-0 123) + (set! (-> v1-0 data a1-0) (the-as uint128 0)) + ) + ) + (dotimes (v1-3 8) + (set-vector! (-> arg0 times v1-3) 1.0 1.0 1.0 0.0) + ) #f - ) \ No newline at end of file + ) + +(defun update-mood-interior ((arg0 mood-context) (arg1 symbol)) + (let ((v1-0 (-> arg0 light-group))) + (cond + (arg1 + (set! (-> arg0 current-fog fog-color quad) (-> *level* level-default mood-context current-fog fog-color quad)) + (set-vector! (-> arg0 current-fog fog-dists) 98304.0 3072000.0 255.0 150.0) + (set-vector! (-> arg0 current-fog erase-color) 0.0 0.0 0.0 128.0) + ) + (else + (let ((a1-4 (-> arg0 current-fog))) + (set! (-> a1-4 fog-color x) 150.0) + (set! (-> a1-4 fog-color y) 165.0) + (set! (-> a1-4 fog-color z) 220.0) + (set! (-> a1-4 fog-color w) 128.0) + ) + (set-vector! (-> arg0 current-fog fog-dists) 2048000.0 12288000.0 255.0 150.0) + (set-vector! (-> arg0 current-fog erase-color) 0.0 0.0 0.0 128.0) + ) + ) + (set-vector! (-> arg0 current-prt-color) 0.0 0.0 0.0 0.0) + (set-vector! (-> arg0 current-env-color) 96.0 96.0 96.0 128.0) + (set-vector! (-> arg0 current-sky-color) 0.0 0.0 0.0 1.0) + (let ((a0-2 (-> v1-0 0))) + (set! (-> a0-2 dir0 direction x) 0.0) + (set! (-> a0-2 dir0 direction y) 1.0) + (set! (-> a0-2 dir0 direction z) 0.0) + (set! (-> a0-2 dir0 direction w) 0.0) + ) + (set-vector! (-> v1-0 0 dir0 color) 0.667 0.667 0.667 1.0) + (set-vector! (-> v1-0 0 ambi color) 0.333 0.333 0.333 1.0) + (set! (-> v1-0 0 dir0 extra x) 1.0) + (set! (-> v1-0 0 dir1 extra x) 0.0) + (set! (-> v1-0 0 dir2 extra x) 0.0) + (set! (-> v1-0 0 ambi extra x) 1.0) + ) + ) + +(defun update-mood-interior-ambient ((arg0 mood-context) (arg1 symbol) (arg2 float)) + (update-mood-interior arg0 arg1) + (set! (-> arg0 times 0 quad) (-> *level* level-default mood-context times 0 quad)) + (vector+float*! + (the-as vector (-> arg0 times)) + (the-as vector (-> arg0 times)) + (-> *level* level-default mood-context times 1) + arg2 + ) + ) + +(defbehavior update-mood-flames time-of-day-proc ((arg0 mood-context) (arg1 int) (arg2 int) (arg3 int) (arg4 float) (arg5 float) (arg6 float)) + (let* ((gp-0 (the-as flames-state (+ (+ arg3 1840) (the-as int arg0)))) + (s4-0 (+ (-> gp-0 index) arg1)) + (f0-0 (-> gp-0 time)) + (v1-2 (-> gp-0 length)) + (s0-0 (-> gp-0 height)) + ) + (dotimes (a0-1 arg2) + (set! (-> arg0 times (+ arg1 a0-1) w) arg4) + ) + (cond + ((>= f0-0 (the float v1-2)) + (set! (-> gp-0 index) (the-as uint (the int (rand-vu-float-range 0.0 (+ -0.01 (the float arg2)))))) + (set! (-> gp-0 time) 0.0) + (set! (-> gp-0 length) (the-as uint (the int (* (rand-vu-float-range 7.0 15.0) arg6)))) + (set! (-> gp-0 height) (the-as uint (the int (rand-vu-float-range 0.0 255.0)))) + (set! (-> arg0 times s4-0 w) arg4) + ) + (else + (let ((f0-14 (sin (* 32768.0 (/ f0-0 (the float v1-2)))))) + (set! (-> arg0 times s4-0 w) (+ (* (the float s0-0) f0-14 arg5) arg4)) + ) + (if (not (paused?)) + (set! (-> gp-0 time) (+ (-> gp-0 time) (if (= (-> *display* bg-clock clock-ratio) 0.0) + 1.0 + (-> self clock time-adjust-ratio) + ) + ) + ) + ) + ) + ) + ) + ) + +(define *flash0* + (new 'static 'boxed-array :type float 1.0 0.0 0.5 1.0 0.5 0.0 0.5 0.35 0.4 0.35 0.25 0.1 0.04) + ) + +(define *flash1* (new 'static 'boxed-array :type float 1.0 0.8 0.0 1.0 0.5 1.0 0.4 0.2 0.1)) + +(define *flash2* (new 'static 'boxed-array :type float 1.0 0.9 0.8 0.7 0.0 0.0 1.0 0.0 1.0 0.5)) + +(define *flash3* (new 'static 'boxed-array :type float 0.5 0.0 1.0 0.9 1.0 0.8 0.3 0.0 0.0 0.5 0.1 0.5 0.35)) + +(define *flash4* + (new 'static 'boxed-array :type float 1.0 0.0 1.0 0.0 1.0 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.5 0.4 0.3 0.2 0.1) + ) + +(define *flash5* (new 'static 'boxed-array :type float + 1.0 + 0.0 + 1.0 + 0.0 + 1.0 + 0.95 + 0.9 + 0.85 + 0.8 + 0.75 + 0.7 + 0.65 + 0.6 + 0.55 + 0.5 + 0.45 + 0.4 + 0.35 + 0.3 + 0.25 + 0.2 + 0.5 + 0.45 + 0.4 + 0.35 + 0.3 + 0.25 + 0.2 + 0.15 + 0.1 + 0.05 + ) + ) + +(define *flash6* + (new 'static 'boxed-array :type float 1.0 0.0 1.0 0.0 0.5 0.0 0.5 0.35 0.0 0.0 1.0 0.0 0.2 0.1) + ) + +(define *flash7* + (new 'static 'boxed-array :type float 1.0 0.8 0.3 0.0 0.6 0.5 0.4 0.3 0.2 0.5 0.4 0.3 0.2 0.1) + ) + +(defun update-mood-light ((arg0 mood-context) (arg1 int) (arg2 int) (arg3 float) (arg4 float) (arg5 float) (arg6 float) (arg7 float)) + (with-pp + (let* ((gp-0 (the-as light-state (+ (+ arg2 1840) (the-as int arg0)))) + (f0-0 512.0) + (f1-1 (+ (-> gp-0 time) arg6)) + (f26-0 (* f0-0 (- f1-1 (* (the float (the int (/ f1-1 256.0))) 256.0)))) + (f30-1 (+ (fabs arg3) (* (cos f26-0) arg4))) + (f28-0 (-> gp-0 fade)) + ) + (cond + ((or (>= arg5 18.0) (>= 6.0 arg5)) + (set! f28-0 (cond + ((< arg3 0.0) + (if (not (paused?)) + (set! f28-0 (seek f28-0 1.0 (* 2.0 (seconds-per-frame)))) + ) + f28-0 + ) + (else + 1.0 + ) + ) + ) + (set! (-> gp-0 fade) f28-0) + (set! (-> arg0 times arg1 w) (* f30-1 f28-0)) + (when (not (paused?)) + (let ((f0-10 (-> gp-0 time))) + (set! arg7 (cond + ((= (-> *display* bg-clock clock-ratio) 0.0) + (empty) + arg7 + ) + (else + (* arg7 (-> pp clock time-adjust-ratio)) + ) + ) + ) + (set! (-> gp-0 time) (+ f0-10 arg7)) + ) + ) + ) + ((= f28-0 1.0) + (cond + ((< f26-0 3640.889) + (set! (-> arg0 times arg1 w) f30-1) + (set! (-> gp-0 fade) 0.99) + ) + (else + (set! (-> arg0 times arg1 w) f30-1) + ) + ) + (if (not (paused?)) + (set! (-> gp-0 time) (+ (-> gp-0 time) (if (= (-> *display* bg-clock clock-ratio) 0.0) + arg7 + (* arg7 (-> pp clock time-adjust-ratio)) + ) + ) + ) + ) + ) + ((and (< f28-0 1.0) (< 0.0 f28-0)) + (set! (-> arg0 times arg1 w) f28-0) + (when (not (paused?)) + (if (< 0.75 f28-0) + (set! (-> gp-0 fade) (- (-> gp-0 fade) (* 0.04 (-> pp clock time-adjust-ratio)))) + (set! (-> gp-0 fade) (- (-> gp-0 fade) (* 0.02 (-> pp clock time-adjust-ratio)))) + ) + ) + ) + (else + (set! (-> gp-0 fade) 0.0) + (set! (-> gp-0 time) 0.0) + ) + ) + ) + ) + ) + +(deftype lava-state (structure) + ((lava float) + ) + ) + + +(defun update-mood-lava ((arg0 mood-context) (arg1 int) (arg2 int) (arg3 float) (arg4 float) (arg5 float) (arg6 float) (arg7 float)) + (let ((gp-0 (+ (+ arg2 1840) (the-as int arg0)))) + (let ((f0-1 (cos (-> (the-as (pointer float) gp-0))))) + (set! (-> arg0 times arg1 w) (+ arg3 (* f0-1 arg4))) + (set! (-> arg0 times (+ arg1 1) w) (+ arg3 (* (- f0-1) arg4))) + ) + (if (not (paused?)) + (set! (-> (the-as (pointer float) gp-0)) (+ (-> (the-as (pointer float) gp-0)) arg5)) + ) + ) + ) + +(defun update-mood-flicker ((arg0 mood-context) (arg1 int) (arg2 int)) + (let ((gp-0 (the-as flicker-state (+ (+ arg2 1840) (the-as int arg0))))) + (cond + ((nonzero? (-> gp-0 flicker-on)) + (set! (-> arg0 times arg1 w) 1.0) + (if (not (paused?)) + (+! (-> gp-0 flicker-on) -1) + ) + ) + ((nonzero? (-> gp-0 flicker-off)) + (if (not (paused?)) + (+! (-> gp-0 flicker-off) -1) + ) + ) + (else + (set! (-> gp-0 flicker-on) (the-as uint (the int (rand-vu-float-range 2.0 20.0)))) + (if (zero? (the int (rand-vu-float-range 0.0 3.0))) + (set! (-> gp-0 flicker-off) (the-as uint (the int (rand-vu-float-range 2.0 120.0)))) + (set! (-> gp-0 flicker-off) (the-as uint (the int (rand-vu-float-range 2.0 20.0)))) + ) + ) + ) + ) + (none) + ) + +(defun update-mood-florescent ((arg0 mood-context) (arg1 int) (arg2 int)) + (let ((gp-0 (the-as florescent-state (+ (+ arg2 1840) (the-as int arg0))))) + (set! (-> arg0 times arg1 w) (-> gp-0 value)) + (when (not (paused?)) + (cond + ((zero? (-> gp-0 delay)) + (set! (-> gp-0 delay2) (the int (rand-vu-float-range 10.0 60.0))) + (set! (-> gp-0 delay) (the int (rand-vu-float-range 60.0 120.0))) + ) + (else + (+! (-> gp-0 delay) -1) + ) + ) + (cond + ((>= (-> gp-0 delay2) (-> gp-0 delay)) + (set! (-> gp-0 value) (rand-vu-float-range 1.0 1.5)) + ) + ((< (-> gp-0 delay2) (-> gp-0 delay)) + (set! (-> gp-0 value) 1.5) + ) + ) + ) + ) + ) + +;; WARN: Return type mismatch float vs none. +(defun update-mood-electricity ((arg0 mood-context) (arg1 int) (arg2 int) (arg3 float) (arg4 float)) + (let ((gp-0 (the-as electricity-state (+ (+ arg2 1840) (the-as int arg0))))) + (set! (-> arg0 times arg1 w) (* (-> gp-0 value) (-> gp-0 scale))) + (if (not (paused?)) + (set! (-> gp-0 value) (rand-vu-float-range arg3 arg4)) + ) + ) + (none) + ) + +;; WARN: Return type mismatch float vs none. +(defun update-mood-pulse ((arg0 mood-context) (arg1 int) (arg2 int) (arg3 float) (arg4 float) (arg5 float) (arg6 float)) + (let ((gp-0 (the-as pulse-state (+ (+ arg2 1840) (the-as int arg0))))) + (set! (-> arg0 times arg1 w) + (fmin 1.9921875 (* (+ arg3 (* (cos (+ (-> gp-0 pulse) arg6)) arg4)) (-> gp-0 brightness))) + ) + (when (not (paused?)) + (+! (-> gp-0 pulse) arg5) + (seek! (-> gp-0 brightness) (-> gp-0 target-brightness) (* (-> gp-0 speed) (seconds-per-frame))) + ) + ) + (none) + ) + +(defun update-mood-strobe ((arg0 mood-context) (arg1 int) (arg2 int) (arg3 int) (arg4 float)) + (let ((gp-0 (+ (+ arg2 1840) (the-as int arg0)))) + (let ((a2-1 (the int (-> (the-as (pointer float) gp-0))))) + (if (logtest? arg3 (ash 1 a2-1)) + (set! (-> arg0 times arg1 w) 1.0) + (set! (-> arg0 times arg1 w) 0.3) + ) + ) + (when (not (paused?)) + (let ((f0-5 (+ (-> (the-as (pointer float) gp-0)) arg4))) + (set! (-> (the-as (pointer float) gp-0)) (- f0-5 (* (the float (the int (/ f0-5 32.0))) 32.0))) + ) + ) + ) + ) + +(defun update-mood-caustics ((arg0 mood-context) (arg1 int) (arg2 float) (arg3 float) (arg4 float) (arg5 float)) + (let ((f0-2 (sin (+ arg2 arg3)))) + (set! (-> arg0 times arg1 w) (+ arg4 (* f0-2 arg5))) + ) + ) + +;; WARN: Return type mismatch symbol vs none. +(defun overide-mood-fog ((arg0 mood-context) (arg1 float) (arg2 int) (arg3 float)) + 0 + 0 + 0.0 + (let* ((v1-3 (-> *mood-control* mood-interp-table)) + (a0-1 (the int arg1)) + (f0-4 (- arg1 (the float a0-1))) + (f1-3 (- 1.0 f0-4)) + (a1-3 (/ a0-1 24)) + (a0-5 (-> v1-3 hour (- a0-1 (* 24 a1-3)))) + (a1-5 (-> a0-5 snapshot1)) + (v1-4 (-> a0-5 snapshot2)) + (f0-6 (+ (* f1-3 (-> a0-5 morph-start)) (* f0-4 (-> a0-5 morph-end)))) + ) + (if (= a1-5 v1-4) + (mem-copy! (the-as pointer (-> arg0 current-fog)) (the-as pointer (+ (* 48 a1-5) 0 arg2)) 48) + (vector4-array-lerp! + (the-as (inline-array vector4) (-> arg0 current-fog)) + (the-as (inline-array vector4) (+ (* 48 a1-5) 0 arg2)) + (the-as (inline-array vector4) (+ (* 48 v1-4) 0 arg2)) + f0-6 + 3 + ) + ) + ) + (if (!= arg3 0.0) + (vector4-array-lerp! + (the-as (inline-array vector4) (-> arg0 current-fog)) + (the-as (inline-array vector4) (-> arg0 current-fog)) + (the-as (inline-array vector4) (-> *level* level-default mood-context)) + arg3 + 3 + ) + ) + (none) + ) + +;; WARN: Return type mismatch rgbaf vs none. +(defun overide-mood-color ((arg0 mood-context) (arg1 float) (arg2 int) (arg3 float)) + 0 + 0 + 0.0 + (let* ((v1-3 (-> *mood-control* mood-interp-table)) + (a0-1 (the int arg1)) + (f0-4 (- arg1 (the float a0-1))) + (f1-3 (- 1.0 f0-4)) + (a1-3 (/ a0-1 24)) + (a1-5 (-> v1-3 hour (- a0-1 (* 24 a1-3)))) + (a0-5 (-> a1-5 snapshot1)) + (v1-4 (-> a1-5 snapshot2)) + (f30-0 (+ (* f1-3 (-> a1-5 morph-start)) (* f0-4 (-> a1-5 morph-end)))) + ) + (cond + ((= a0-5 v1-4) + (let ((a0-6 (+ (* a0-5 32) 0 arg2)) + (a1-7 (-> arg0 times)) + (v1-7 (-> arg0 times 1)) + ) + (set! (-> a1-7 0 quad) (-> (the-as (inline-array vector) (+ a0-6 16)) 0 quad)) + (set! (-> v1-7 quad) (-> (the-as (inline-array vector) (+ a0-6 0)) 0 quad)) + (set! (-> arg0 times 2 quad) (-> v1-7 quad)) + (set! (-> arg0 times 3 quad) (-> v1-7 quad)) + (set! (-> arg0 times 4 quad) (-> v1-7 quad)) + ) + ) + (else + (let ((s3-0 (+ (* a0-5 32) 0 arg2)) + (s2-0 (+ (* v1-4 32) 0 arg2)) + (a0-14 (-> arg0 times)) + (s4-0 (-> arg0 times 1)) + ) + (vector4-lerp! (the-as vector a0-14) (the-as vector (+ s3-0 16)) (the-as vector (+ s2-0 16)) f30-0) + (vector4-lerp! s4-0 (the-as vector (+ s3-0 0)) (the-as vector (+ s2-0 0)) f30-0) + (set! (-> arg0 times 2 quad) (-> s4-0 quad)) + (set! (-> arg0 times 3 quad) (-> s4-0 quad)) + (set! (-> arg0 times 4 quad) (-> s4-0 quad)) + ) + ) + ) + ) + (let ((s4-1 (-> arg0 light-group))) + (let ((s3-1 (-> *level* level-default mood-context))) + (if (!= arg3 0.0) + (vector4-array-lerp! + (the-as (inline-array vector4) (-> arg0 times)) + (the-as (inline-array vector4) (-> arg0 times)) + (the-as (inline-array vector4) (-> s3-1 times)) + arg3 + 5 + ) + ) + (dotimes (v1-17 5) + (set! (-> arg0 times v1-17 w) (-> (the-as mood-context (+ (the-as uint s3-1) (* v1-17 16))) times 0 w)) + ) + ) + (set! (-> s4-1 0 ambi color quad) (-> arg0 times 0 quad)) + (set! (-> s4-1 0 dir0 color quad) (-> arg0 times 1 quad)) + (set! (-> s4-1 0 dir1 color quad) (-> arg0 times 2 quad)) + (set! (-> s4-1 0 dir2 color quad) (-> arg0 times 3 quad)) + ) + (none) + ) + +(defmethod apply-mood-clouds-and-fog ((this mood-control) (arg0 mood-control-work)) + (let ((v1-0 (-> this mood-fog-table))) + (dotimes (a0-1 24) + (set! (-> v1-0 _data a0-1) (the-as uint128 0)) + ) + ) + (let ((s4-0 (-> this mood-fog-table))) + (let ((f30-0 (- 1.0 (-> arg0 interp cloud)))) + (when (!= f30-0 0.0) + (let ((f0-4 (* (- 1.0 (-> arg0 interp fog)) f30-0)) + (a2-0 (-> this fogs (-> arg0 index 0))) + ) + (if (!= f0-4 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) a2-0) + f0-4 + 24 + ) + ) + ) + (let ((f0-6 (* (-> arg0 interp fog) f30-0)) + (a2-1 (-> this fogs (-> arg0 index 1))) + ) + (if (!= f0-6 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) a2-1) + f0-6 + 24 + ) + ) + ) + ) + ) + (let ((f30-1 (-> arg0 interp cloud))) + (when (!= f30-1 0.0) + (let ((f0-10 (* (- 1.0 (-> arg0 interp fog)) f30-1)) + (a2-2 (-> this fogs (-> arg0 index 2))) + ) + (if (!= f0-10 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) a2-2) + f0-10 + 24 + ) + ) + ) + (let ((f0-12 (* (-> arg0 interp fog) f30-1)) + (a2-3 (-> this fogs (-> arg0 index 3))) + ) + (if (!= f0-12 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) a2-3) + f0-12 + 24 + ) + ) + ) + ) + ) + ) + (let ((f0-13 (-> *time-of-day-context* fog-mult)) + (v1-29 (-> this mood-fog-table)) + ) + (dotimes (a0-6 8) + (set! (-> v1-29 data a0-6 fog-dists y) (* (-> v1-29 data a0-6 fog-dists y) f0-13)) + ) + ) + 0 + (none) + ) + +(defmethod apply-mood-fog ((this mood-control) + (arg0 mood-control-work) + (arg1 mood-color-table) + (arg2 mood-color-table) + (arg3 mood-color-table) + (arg4 float) + ) + (let ((v1-0 (-> this mood-fog-table))) + (dotimes (a1-1 24) + (set! (-> v1-0 _data a1-1) (the-as uint128 0)) + ) + ) + (let ((s4-0 (-> this mood-fog-table)) + (f0-1 (fmax 0.0 (fmin 1.0 (* 5.0 (- 0.2 arg4))))) + (f30-0 (if (>= 0.2 arg4) + (fmax 0.0 (fmin 1.0 (* 5.0 arg4))) + (- 1.0 (fmax 0.0 (fmin 1.0 (* 1.25 (+ -0.2 arg4))))) + ) + ) + (f28-0 (fmax 0.0 (fmin 1.0 (* 1.25 (+ -0.2 arg4))))) + ) + (if (!= f0-1 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) arg1) + f0-1 + 24 + ) + ) + (if (!= f30-0 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) arg2) + f30-0 + 24 + ) + ) + (if (!= f28-0 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) arg3) + f28-0 + 24 + ) + ) + ) + 0 + (none) + ) + +(defmethod apply-fog-height ((this mood-control) (arg0 mood-control-work) (arg1 float) (arg2 float) (arg3 float) (arg4 float)) + (cond + ((= arg4 0.2) + (set-fog-height! arg2) + ) + ((< arg4 0.2) + (set-fog-height! (lerp arg1 arg2 (* 5.0 arg4))) + ) + (else + (set-fog-height! (lerp arg2 arg3 (* 1.25 (+ -0.2 arg4)))) + ) + ) + 0 + (none) + ) + +(defmethod apply-mood-colors ((this mood-control) (arg0 mood-control-work)) + (let ((v1-0 (-> this mood-color-table))) + (dotimes (a0-1 16) + (set! (-> v1-0 _data a0-1) (the-as uint128 0)) + ) + ) + (let ((s4-0 (-> this mood-color-table))) + (let ((f0-1 (- 1.0 (-> arg0 color-interp))) + (a2-0 (-> this colors (-> arg0 color-index 0))) + ) + (if (!= f0-1 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) a2-0) + f0-1 + 16 + ) + ) + ) + (let ((f0-2 (-> arg0 color-interp)) + (a2-1 (-> this colors (-> arg0 color-index 1))) + ) + (if (!= f0-2 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) a2-1) + f0-2 + 16 + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod mood-control-method-20 ((this mood-control) + (arg0 mood-control-work) + (arg1 mood-color-table) + (arg2 mood-color-table) + (arg3 mood-color-table) + (arg4 float) + ) + (let ((v1-0 (-> this mood-color-table))) + (dotimes (a1-1 16) + (set! (-> v1-0 _data a1-1) (the-as uint128 0)) + ) + ) + (let ((s4-0 (-> this mood-color-table)) + (f0-1 (fmax 0.0 (fmin 1.0 (* 5.0 (- 0.2 arg4))))) + (f30-0 (if (>= 0.2 arg4) + (fmax 0.0 (fmin 1.0 (* 5.0 arg4))) + (- 1.0 (fmax 0.0 (fmin 1.0 (* 1.25 (+ -0.2 arg4))))) + ) + ) + (f28-0 (fmax 0.0 (fmin 1.0 (* 1.25 (+ -0.2 arg4))))) + ) + (if (!= f0-1 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) arg1) + f0-1 + 16 + ) + ) + (if (!= f30-0 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) arg2) + f30-0 + 16 + ) + ) + (if (!= f28-0 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) arg3) + f28-0 + 16 + ) + ) + ) + 0 + (none) + ) + +(defmethod apply-mood-channels ((this mood-control) (arg0 mood-control-work)) + (let ((v1-0 (-> this mood-channel-group))) + (dotimes (a0-1 24) + (set! (-> v1-0 data 0 vecs a0-1 quad) (the-as uint128 0)) + ) + ) + (let ((s4-0 (-> this mood-channel-group))) + (let ((f0-1 (- 1.0 (-> arg0 channel-interp))) + (a2-0 (-> this channels (-> arg0 channel-index 0))) + ) + (if (!= f0-1 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) a2-0) + f0-1 + 24 + ) + ) + ) + (let ((f0-2 (-> arg0 channel-interp)) + (a2-1 (-> this channels (-> arg0 channel-index 1))) + ) + (if (!= f0-2 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) a2-1) + f0-2 + 24 + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod adjust-num-clouds ((this mood-control) (arg0 mood-control-work)) + (let ((v1-0 (-> this mood-clouds))) + (set! (-> v1-0 cloud-min) 0.0) + (set! (-> v1-0 cloud-max) 0.0) + (let ((f0-3 (- 1.0 (-> arg0 cloud-interp))) + (a2-4 (-> this clouds (-> arg0 cloud-index 0))) + ) + (when (!= f0-3 0.0) + (set! (-> v1-0 cloud-min) (* (-> a2-4 cloud-min) f0-3)) + (set! (-> v1-0 cloud-max) (* (-> a2-4 cloud-max) f0-3)) + ) + ) + (let ((f0-5 (-> arg0 cloud-interp)) + (a0-2 (-> this clouds (-> arg0 cloud-index 1))) + ) + (when (!= f0-5 0.0) + (+! (-> v1-0 cloud-min) (* (-> a0-2 cloud-min) f0-5)) + (+! (-> v1-0 cloud-max) (* (-> a0-2 cloud-max) f0-5)) + ) + ) + ) + 0 + (none) + ) + +(defmethod play-or-stop-lightning-sfx! ((this mood-control) (arg0 sound-spec) (arg1 vector)) + (vector+! (new 'stack-no-clear 'vector) arg1 (math-camera-pos)) + (cond + ((or (load-in-progress? *level*) (movie?)) + (when (nonzero? (-> this lightning-id)) + (sound-stop (-> this lightning-id)) + (set! (-> this lightning-id) (new 'static 'sound-id)) + 0 + ) + ) + (else + (when (nonzero? (-> this lightning-id)) + (sound-stop (-> this lightning-id)) + (set! (-> this lightning-id) (new 'static 'sound-id)) + 0 + ) + (set! (-> this lightning-id) (sound-play-by-spec arg0 (new-sound-id) arg1)) + ) + ) + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod gen-lightning-and-thunder! ((this mood-control) (arg0 int)) + (local-vars (a1-2 (array float))) + (let ((v1-3 (-> this mood-channel-group data (-> this lightning-index))) + (a1-1 (-> this lightning-val)) + (a0-4 (/ (-> this lightning-time) 2)) + (f0-0 (-> this lightning-time2)) + ) + (set! (-> this lightning-flash) 0.0) + (cond + ((>= 0.0 f0-0) + (cond + ((zero? a1-1) + (set! a1-2 *flash0*) + ) + ((= a1-1 1) + (set! a1-2 *flash1*) + ) + ((= a1-1 2) + (set! a1-2 *flash2*) + ) + ((= a1-1 3) + (set! a1-2 *flash3*) + ) + ((= a1-1 4) + (set! a1-2 *flash4*) + ) + ((= a1-1 5) + (set! a1-2 *flash5*) + ) + ((= a1-1 6) + (set! a1-2 *flash6*) + ) + (else + (set! a1-2 *flash7*) + ) + ) + (cond + ((< a0-4 (-> a1-2 length)) + (let ((f30-0 (-> a1-2 a0-4)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (cond + ((= (-> this lightning-index) 4) + (set! (-> this lightning-flash) f30-0) + ) + ((= (-> this lightning-index) 5) + (set! (-> this lightning-flash) f30-0) + (dotimes (s4-0 8) + (set-vector! s5-0 255.0 255.0 255.0 128.0) + (vector4-lerp! + (the-as vector (-> this mood-fog-table data s4-0)) + (the-as vector (-> this mood-fog-table data s4-0)) + s5-0 + f30-0 + ) + ) + ) + (else + (set! (-> this lightning-flash) (* 1.9921875 f30-0)) + (let ((a0-17 (-> v1-3 data))) + (set! (-> a0-17 0) 1.0) + (set! (-> a0-17 1) 1.0) + (set! (-> a0-17 2) 1.0) + (set! (-> a0-17 3) 1.0) + ) + (set! (-> (the-as vector (&-> v1-3 data 4)) quad) (-> (the-as vector (-> v1-3 data)) quad)) + (set! (-> (the-as vector (&-> v1-3 data 8)) quad) (-> (the-as vector (-> v1-3 data)) quad)) + (set! (-> (the-as vector (&-> v1-3 data 12)) quad) (-> (the-as vector (-> v1-3 data)) quad)) + (set! (-> (the-as vector (&-> v1-3 data 16)) quad) (-> (the-as vector (-> v1-3 data)) quad)) + (set! (-> (the-as vector (&-> v1-3 data 20)) quad) (-> (the-as vector (-> v1-3 data)) quad)) + ) + ) + ) + (if (not (paused?)) + (+! (-> this lightning-time) 1) + ) + ) + (else + (level-get-target-inside *level*) + (cond + ((!= (-> this lightning-time3) 0.0) + (set! (-> this lightning-time2) (-> this lightning-time3)) + (set! (-> this lightning-time3) 0.0) + ) + (else + (set! (-> this lightning-time2) (rand-vu-float-range 5.0 10.0)) + ) + ) + ) + ) + ) + (else + (when (not (paused?)) + (set! (-> this lightning-time2) (- (-> this lightning-time2) (seconds-per-frame))) + (when (>= 0.0 (-> this lightning-time2)) + (when (= (-> this lightning-time3) 0.0) + (set! (-> this lightning-index) (mod (the-as int (rand-uint31-gen *random-generator*)) 6)) + (set! (-> this lightning-val) (the-as int (logand (rand-uint31-gen *random-generator*) 7))) + ) + (set! (-> this lightning-time) 0) + (cond + ((zero? (-> this lightning-index)) + (play-or-stop-lightning-sfx! + this + (static-sound-spec "thunder-b" :group 1) + (new 'static 'vector :x 37109760.0 :y 16261120.0 :z 5857280.0) + ) + ) + ((= (-> this lightning-index) 1) + (play-or-stop-lightning-sfx! + this + (static-sound-spec "thunder-b" :group 1) + (new 'static 'vector :x 20480000.0 :y 33341440.0 :z 12124160.0) + ) + ) + ((= (-> this lightning-index) 2) + (play-or-stop-lightning-sfx! + this + (static-sound-spec "thunder-b" :group 1) + (new 'static 'vector :x -20480000.0 :y 33341440.0 :z 12124160.0) + ) + ) + ((= (-> this lightning-index) 3) + (play-or-stop-lightning-sfx! + this + (static-sound-spec "thunder-b" :group 1) + (new 'static 'vector :x -37109760.0 :y 16261120.0 :z 5857280.0) + ) + ) + ((= (-> this lightning-index) 4) + (play-or-stop-lightning-sfx! + this + (static-sound-spec "thunder-c" :group 1) + (new 'static 'vector :y 40960000.0) + ) + ) + ((= (-> this lightning-index) 5) + (play-or-stop-lightning-sfx! + this + (static-sound-spec "thunder-a" :group 1) + (new 'static 'vector :y 40960000.0) + ) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + +(defmethod set-lightning-time! ((this mood-control) (arg0 int) (arg1 int) (arg2 float)) + (set! (-> this lightning-index) arg0) + (set! (-> this lightning-val) arg1) + (set! (-> this lightning-time2) (seconds-per-frame)) + (set! (-> this lightning-time3) arg2) + 0 + (none) + ) + +(defmethod init-weather! ((this mood-control)) + (local-vars (v1-32 int) (a1-12 object)) + (let ((s5-0 (level-get-target-inside *level*))) + (when s5-0 + (set! (-> this mood-direction-table) *mood-direction-table*) + (let ((s4-0 (new 'stack-no-clear 'mood-control-work))) + (let ((s3-0 this)) + (cond + ((and (-> s3-0 overide-weather-flag) (not (movie?)) (= (-> s3-0 current-special-interp) 0.0)) + (set! (-> s4-0 weather cloud) (* 2.0 (fmax 0.0 (fmin 1.0 (-> this overide cloud))))) + (set! (-> s4-0 weather fog) (* 2.0 (-> this overide fog))) + ) + (else + (set! (-> s4-0 weather cloud) (* 2.0 (fmax 0.0 (fmin 1.0 (-> this current-interp cloud))))) + (set! (-> s4-0 weather fog) (* 2.0 (fmax 0.0 (fmin 1.0 (-> this current-interp fog))))) + ) + ) + ) + (set! (-> s4-0 iweather cloud) (the int (-> s4-0 weather cloud))) + (let ((f0-12 (- (-> s4-0 weather cloud) (the float (-> s4-0 iweather cloud))))) + (cond + ((zero? (-> s4-0 iweather cloud)) + (if (< f0-12 0.5) + (set! (-> s4-0 interp cloud) 0.0) + (set! (-> s4-0 interp cloud) (* 2.0 (+ -0.5 f0-12))) + ) + ) + (else + (set! (-> s4-0 interp cloud) f0-12) + ) + ) + ) + (set! (-> s4-0 iweather fog) (the int (-> s4-0 weather fog))) + (set! (-> s4-0 interp fog) (- (-> s4-0 weather fog) (the float (-> s4-0 iweather fog)))) + (let ((a0-2 (-> s4-0 iweather fog)) + (v1-23 (-> s4-0 iweather cloud)) + ) + (set! (-> s4-0 index 0) (+ (* 3 v1-23) a0-2)) + (set! (-> s4-0 index 1) (+ a0-2 1 (* 3 v1-23))) + (set! (-> s4-0 index 2) (+ (* 3 (+ v1-23 1)) a0-2)) + (set! (-> s4-0 index 3) (+ a0-2 1 (* 3 (+ v1-23 1)))) + ) + (let ((v1-27 (-> s4-0 iweather cloud))) + (set! (-> s4-0 color-interp) (-> s4-0 interp cloud)) + (set! (-> s4-0 color-index 0) v1-27) + (set! (-> s4-0 color-index 1) (+ v1-27 1)) + ) + 0 + (let ((f0-22 (- (-> s4-0 weather cloud) (the float (-> s4-0 iweather cloud))))) + (cond + ((zero? (-> s4-0 iweather cloud)) + (set! (-> s4-0 channel-interp) 0.0) + (set! v1-32 0) + ) + ((= (-> s4-0 iweather cloud) 2) + (set! (-> s4-0 channel-interp) 0.0) + (set! v1-32 2) + ) + ((< f0-22 0.5) + (set! (-> s4-0 channel-interp) (* 2.0 f0-22)) + (set! v1-32 0) + ) + (else + (set! (-> s4-0 channel-interp) (* 2.0 (+ -0.5 f0-22))) + (set! v1-32 1) + ) + ) + ) + (set! (-> s4-0 channel-index 0) v1-32) + (set! (-> s4-0 channel-index 1) (+ v1-32 1)) + (let* ((s3-1 this) + (f0-33 (if (and (-> s3-1 overide-weather-flag) (and (not (movie?)) (= (-> s3-1 current-special-interp) 0.0))) + (* 8.0 (-> this overide cloud)) + (* 8.0 (fmax 0.0 (fmin 1.0 (-> this current-interp cloud)))) + ) + ) + (v1-45 (the int f0-33)) + ) + (set! (-> s4-0 cloud-interp) (- f0-33 (the float v1-45))) + (set! (-> s4-0 cloud-index 0) v1-45) + (set! (-> s4-0 cloud-index 1) (+ v1-45 1)) + ) + (cond + ((= (-> *time-of-day-context* special-mood) 'desert) + (apply-mood-fog + this + s4-0 + (the-as mood-color-table *desert-mood-fog-table*) + (the-as mood-color-table *sandstorm-start-mood-fog-table*) + (the-as mood-color-table *sandstorm-end-mood-fog-table*) + (-> this current-special-interp) + ) + (mood-control-method-20 + this + s4-0 + *desert-mood-color-table* + *sandstorm-start-mood-color-table* + *sandstorm-end-mood-color-table* + (-> this current-special-interp) + ) + (apply-fog-height this s4-0 327680.0 614400.0 4096000.0 (-> this current-special-interp)) + (set! a1-12 s4-0) + (adjust-num-clouds this (the-as mood-control-work a1-12)) + ) + (else + (apply-mood-clouds-and-fog this s4-0) + (apply-mood-colors this s4-0) + (apply-mood-channels this s4-0) + (set! a1-12 s4-0) + (adjust-num-clouds this (the-as mood-control-work a1-12)) + ) + ) + ) + (when (not (or (paused?) (let ((s4-1 this)) + (and (-> s4-1 overide-weather-flag) (not (movie?)) (= (-> s4-1 current-special-interp) 0.0)) + ) + ) + ) + (when (!= (-> this time-until-random cloud) -99.0) + (set! (-> this target-interp cloud) + (fmax (fmin (-> this target-interp cloud) (-> this range max-cloud)) (-> this range min-cloud)) + ) + (let ((t9-13 seek) + (a0-19 (-> this current-interp cloud)) + ) + (set! a1-12 (-> this target-interp cloud)) + (set! (-> this current-interp cloud) + (t9-13 a0-19 (the-as float a1-12) (* (/ 1.0 (-> this speed-interp cloud)) (seconds-per-frame))) + ) + ) + ) + (when (!= (-> this time-until-random fog) -99.0) + (set! (-> this target-interp fog) + (fmax (fmin (-> this target-interp fog) (-> this range max-fog)) (-> this range min-fog)) + ) + (let ((t9-14 seek) + (a0-20 (-> this current-interp fog)) + ) + (set! a1-12 (-> this target-interp fog)) + (set! (-> this current-interp fog) + (t9-14 a0-20 (the-as float a1-12) (* (/ 1.0 (-> this speed-interp fog)) (seconds-per-frame))) + ) + ) + ) + (when (!= (-> this time-until-random cloud) -99.0) + (set! (-> this time-until-random cloud) (- (-> this time-until-random cloud) (* 300.0 (seconds-per-frame)))) + (when (< (-> this time-until-random cloud) 0.0) + (set! (-> this time-until-random cloud) + (rand-vu-float-range (-> this time-until-random-min cloud) (-> this time-until-random-max cloud)) + ) + (let ((f30-0 (rand-vu-float-range (-> this range min-cloud) (-> this range max-cloud))) + (f28-0 (rand-vu-float-range (-> this range min-cloud) (-> this range max-cloud))) + (f26-0 (rand-vu-float-range (-> this range min-cloud) (-> this range max-cloud))) + (f24-0 (rand-vu-float-range (-> this range min-cloud) (-> this range max-cloud))) + (f2-11 (rand-vu-float-range (-> this range min-cloud) (-> this range max-cloud))) + ) + (set! (-> this target-interp cloud) (fmax 0.0 (+ -0.25 (* 0.25 (+ f30-0 f28-0 f26-0 f24-0 f2-11))))) + ) + (let ((t9-21 rand-vu-float-range) + (a0-27 30.0) + ) + (set! a1-12 120.0) + (set! (-> this speed-interp cloud) (t9-21 a0-27 (the-as float a1-12))) + ) + (when (and (< 0.0 (-> *setting-control* user-current rain)) + (< (-> this target-interp cloud) 0.5) + (< 0.25 (-> this target-interp cloud)) + (or (< (-> this target-interp fog) 0.25) (< 0.75 (-> this target-interp fog))) + ) + (set! (-> this speed-interp fog) (fabs (/ (* 1.25 (-> this current-interp fog) (-> this speed-interp cloud)) + (+ -0.75 (-> this current-interp cloud)) + ) + ) + ) + (set! (-> this target-interp fog) 0.5) + (set! (-> this time-until-random fog) (-> this time-until-random cloud)) + ) + ) + ) + (when (!= (-> this time-until-random fog) -99.0) + (set! (-> this time-until-random fog) (- (-> this time-until-random fog) (* 300.0 (seconds-per-frame)))) + (when (< (-> this time-until-random fog) 0.0) + (set! (-> this time-until-random fog) + (rand-vu-float-range (-> this time-until-random-min fog) (-> this time-until-random-max fog)) + ) + (let ((f30-1 (rand-vu-float-range (-> this range min-fog) (-> this range max-fog))) + (f28-1 (rand-vu-float-range (-> this range min-fog) (-> this range max-fog))) + (f26-1 (rand-vu-float-range (-> this range min-fog) (-> this range max-fog))) + (f24-1 (rand-vu-float-range (-> this range min-fog) (-> this range max-fog))) + (f0-108 (rand-vu-float-range (-> this range min-fog) (-> this range max-fog))) + ) + (set! (-> this target-interp fog) (* 0.2 (+ f30-1 f28-1 f26-1 f24-1 f0-108))) + ) + (let ((t9-28 rand-vu-float-range) + (a0-34 30.0) + ) + (set! a1-12 120.0) + (set! (-> this speed-interp fog) (t9-28 a0-34 (the-as float a1-12))) + ) + ) + ) + ) + (when (logtest? (game-secrets bad-weather) (-> *game-info* secrets)) + (set! (-> this current-interp cloud) 1.0) + (set! (-> this current-interp fog) 1.0) + ) + (let* ((s4-2 this) + (f30-2 (if (and (-> s4-2 overide-weather-flag) (and (not (movie?)) (= (-> s4-2 current-special-interp) 0.0))) + (-> this overide cloud) + (-> this current-interp cloud) + ) + ) + (s4-3 this) + (f26-2 (if (and (-> s4-3 overide-weather-flag) (and (not (movie?)) (= (-> s4-3 current-special-interp) 0.0))) + (-> this overide fog) + (-> this current-interp fog) + ) + ) + (f28-2 (fmin (-> s5-0 info max-rain) (-> *time-of-day-context* max-rain))) + ) + (set! (-> this sound-pitch) (* 1.442695 (logf (-> *display* bg-clock clock-ratio)))) + (let* ((f0-125 (fmax 0.0 (fmin (* 4.0 (fmax 0.0 (+ -0.5 f26-2)) (fmax 0.0 (+ -0.5 f30-2))) f28-2))) + (f30-3 (fmin 0.75 f0-125)) + ) + (set! (-> *setting-control* user-default rain) f30-3) + (level-get-target-inside *level*) + (cond + ((and (< 0.0 (-> *setting-control* user-current rain)) (!= *master-mode* 'progress)) + (gen-lightning-and-thunder! this (the-as int a1-12)) + (cond + ((zero? (-> this rain-id)) + (set! (-> this rain-id) (sound-play-by-name + (static-sound-name "rain-hiss") + (new-sound-id) + (the int (* 1024.0 f30-3)) + (the int (* 1524.0 (-> this sound-pitch))) + 0 + (sound-group) + #t + ) + ) + ) + (else + (when *sound-player-enable* + (let ((v1-146 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-146 command) (sound-command set-param)) + (set! (-> v1-146 id) (-> this rain-id)) + (set! (-> v1-146 params volume) (the int (* 1024.0 f30-3))) + (set! (-> v1-146 params pitch-mod) (the int (* 1524.0 (-> this sound-pitch)))) + (set! (-> v1-146 params mask) (the-as uint 3)) + (-> v1-146 id) + ) + ) + ) + ) + ) + (else + (set! (-> this lightning-flash) 0.0) + (when (nonzero? (-> this rain-id)) + (sound-stop (-> this rain-id)) + (set! (-> this rain-id) (new 'static 'sound-id)) + 0 + ) + ) + ) + ) + ) + (if (and (not (paused?)) (not (-> *game-info* dust-storm))) + (seek! + (-> this current-special-interp) + (-> this target-special-interp) + (* (-> this rate-special-interp) (seconds-per-frame)) + ) + ) + (when (-> this display-flag) + (let ((s5-2 this)) + (cond + ((and (-> s5-2 overide-weather-flag) (not (movie?)) (= (-> s5-2 current-special-interp) 0.0)) + (format *stdcon* "overide cloud ~f~%" (-> this overide cloud)) + (format *stdcon* "overide fog ~f~%" (-> this overide fog)) + ) + (else + (format *stdcon* "time until random cloud ~f~%" (* 0.0033333334 (-> this time-until-random cloud))) + (format *stdcon* "current cloud ~f~%" (-> this current-interp cloud)) + (format *stdcon* "target cloud ~f~%" (-> this target-interp cloud)) + (format *stdcon* "speed cloud ~f~%" (* (/ 1.0 (-> this speed-interp cloud)) (seconds-per-frame))) + (format *stdcon* "time until random fog ~f~%" (* 0.0033333334 (-> this time-until-random fog))) + (format *stdcon* "current fog ~f~%" (-> this current-interp fog)) + (format *stdcon* "target fog ~f~%" (-> this target-interp fog)) + (format *stdcon* "speed fog ~f~%" (* (/ 1.0 (-> this speed-interp fog)) (seconds-per-frame))) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod set-cloud-and-fog-interp! ((this mood-control) (arg0 float) (arg1 float) (arg2 float) (arg3 float)) + (set! (-> this target-interp cloud) arg0) + (set! (-> this target-interp fog) arg1) + (set! (-> this speed-interp cloud) arg2) + (set! (-> this speed-interp fog) arg3) + (if (= arg2 0.0) + (set! (-> this current-interp cloud) arg0) + ) + (if (= arg3 0.0) + (set! (-> this current-interp fog) arg1) + ) + 0 + (none) + ) + +(defmethod update-mood-range! ((this mood-control) (arg0 float) (arg1 float) (arg2 float) (arg3 float)) + (set! (-> this range min-cloud) arg0) + (set! (-> this range max-cloud) arg1) + (set! (-> this range min-fog) arg2) + (set! (-> this range max-fog) arg3) + 0 + (none) + ) + +(defmethod set-time-for-random-weather! ((this mood-control) (arg0 float) (arg1 float)) + (set! (-> this time-until-random cloud) arg0) + (set! (-> this time-until-random fog) arg1) + 0 + (none) + ) diff --git a/goal_src/jak3/engine/gfx/mood/time-of-day.gc b/goal_src/jak3/engine/gfx/mood/time-of-day.gc index 39b886fe7b..b0d19b69cf 100644 --- a/goal_src/jak3/engine/gfx/mood/time-of-day.gc +++ b/goal_src/jak3/engine/gfx/mood/time-of-day.gc @@ -11,6 +11,797 @@ ;; DECOMP BEGINS +;; WARN: Return type mismatch uint vs int. +(defmethod asize-of ((this time-of-day-palette)) + (the-as int (+ (-> this type size) (* (* (-> this height) (-> this width)) 4))) + ) + +(defmethod deactivate ((this time-of-day-proc)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." + (if (nonzero? (-> this sun)) + (kill-particles (-> this sun)) + ) + (if (nonzero? (-> this green-sun)) + (kill-particles (-> this green-sun)) + ) + (if (nonzero? (-> this moon)) + (kill-particles (-> this moon)) + ) + (if (nonzero? (-> this day-star)) + (kill-particles (-> this day-star)) + ) + ((method-of-type process deactivate) this) + (none) + ) + +(if (zero? time-of-day-effect) + (set! time-of-day-effect nothing) + ) + +(defbehavior time-of-day-update time-of-day-proc () + "Update particles, sky, and effect for time-of-day." + (time-of-day-effect) + (let ((v1-3 (if (-> *time-of-day-context* use-camera-other) + (-> *math-camera* inv-camera-rot-other) + (-> *math-camera* inv-camera-rot) + ) + ) + (gp-0 (if (-> *time-of-day-context* use-camera-other) + (-> *math-camera* trans-other) + (-> *math-camera* trans) + ) + ) + ) + (when (-> *setting-control* user-current weather) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + ) + (let ((v1-5 (-> v1-3 fvec))) + (set! (-> s5-0 quad) (-> *math-camera* trans quad)) + (vector-! s4-0 s5-0 (-> *math-camera* prev-trans)) + (let ((f0-1 (vector-dot s4-0 v1-5))) + (vector+float*! s5-0 s5-0 v1-5 (* 25.0 f0-1)) + ) + ) + (set! (-> s5-0 y) (-> *math-camera* trans y)) + (if (< 0.0 (-> *setting-control* user-current rain)) + (update-rain (-> *setting-control* user-current rain) s5-0 s4-0) + ) + (if (< 0.0 (-> *setting-control* user-current snow)) + (update-snow (-> *setting-control* user-current snow) s5-0 s4-0) + ) + ) + ) + (cond + (*dproc* + (cond + ((< (-> self start-timer) 4) + (+! (-> self start-timer) 1) + ) + (else + (let ((s5-1 (-> *time-of-day-context* sky)) + (s4-1 (= (-> *setting-control* user-current sky-type) 'star-field)) + ) + (cond + ((or (and (>= (-> self time-of-day) 6.25) (and (< (-> self time-of-day) 18.75) s5-1)) s4-1) + (if (zero? (-> self sun-count)) + (spawn (-> self sun) gp-0) + ) + ) + ((> (-> self sun-count) 0) + (kill-particles (-> self sun)) + ) + ) + (cond + ((or (and (or (>= (-> self time-of-day) 21.75) (>= 10.25 (-> self time-of-day))) s5-1) s4-1) + (if (zero? (-> self green-sun-count)) + (spawn (-> self green-sun) gp-0) + ) + ) + ((> (-> self green-sun-count) 0) + (kill-particles (-> self green-sun)) + ) + ) + (cond + ((or (and (or (>= 7.0 (-> self time-of-day)) (>= (-> self time-of-day) 17.0)) s5-1) s4-1) + (if (zero? (-> self moon-count)) + (spawn (-> self moon) gp-0) + ) + ) + ((> (-> self moon-count) 0) + (kill-particles (-> self moon)) + ) + ) + (cond + ((and (-> self day-star-enable) s5-1 (not s4-1)) + (if (zero? (-> self day-star-count)) + (spawn (-> self day-star) gp-0) + ) + ) + ((> (-> self day-star-count) 0) + (kill-particles (-> self day-star)) + ) + ) + ) + ) + ) + ) + (else + (set! (-> self start-timer) 0) + 0 + ) + ) + ) + (set! (-> self sun-count) 0) + (set! (-> self green-sun-count) 0) + (set! (-> self moon-count) 0) + (set! (-> self day-star-count) 0) + (update-time-and-speed *sky-work* (-> self time-of-day) (-> self time-ratio)) + 0 + (none) + ) + +(defbehavior update-counters time-of-day-proc () + "Set hours, minutes, senonds based on current frame." + (let ((v1-2 (-> *display* bg-clock frame-counter))) + 0 + (let ((v1-3 (* 60 v1-2))) + (set! (-> self old-frame) (-> self current-frame)) + (set! (-> self current-frame) (the-as uint v1-3)) + (set! (-> self frames) (the-as uint v1-3)) + (set! (-> self hours) (/ v1-3 #x107ac0)) + (let ((v1-4 (- v1-3 (* #x107ac0 (-> self hours))))) + (set! (-> self minutes) (/ v1-4 #x4650)) + (let ((v1-5 (- v1-4 (* #x4650 (-> self minutes))))) + (set! (-> self seconds) (/ v1-5 300)) + (- v1-5 (* 300 (-> self seconds))) + ) + ) + ) + ) + (let ((f0-1 (* 0.0000009259259 (the float (mod (the-as int (-> self frames)) #x18b8200))))) + (set! (-> self time-of-day) f0-1) + (set! (-> *time-of-day-context* time) f0-1) + f0-1 + ) + ) + +(defstate time-of-day-tick (time-of-day-proc) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('change) + (case (-> block param 0) + (('ratio) + (let ((a0-5 (-> *display* bg-clock)) + (f0-0 (the-as float (-> block param 1))) + ) + (set! (-> self time-ratio) f0-0) + (set! (-> self dest-time-ratio) f0-0) + (update-rates! a0-5 f0-0) + ) + ) + (('hour) + (let ((f28-0 (the float (-> block param 1))) + (f30-0 (if (>= argc 3) + (the float (-> block param 2)) + 0.0 + ) + ) + ) + (update-counters) + (let ((v1-10 (-> *display* bg-clock frame-counter)) + (a0-7 #x69780) + (a1-5 (/ (+ (the int (* 1080000.0 f28-0)) (the int (* 18000.0 f30-0))) 60)) + ) + (set! (-> *display* bg-clock frame-counter) (+ (- v1-10 (the-as time-frame (mod v1-10 a0-7))) a0-7 a1-5)) + ) + ) + (update-counters) + (kill-particles (-> self sun)) + (kill-particles (-> self green-sun)) + (kill-particles (-> self moon)) + (kill-particles (-> self day-star)) + (set! (-> self sun-count) 0) + (set! (-> self green-sun-count) 0) + (set! (-> self moon-count) 0) + (set! (-> self day-star-count) 0) + (-> self hours) + ) + ) + ) + (('save) + (set! (-> self old-frame-save) (-> self old-frame)) + (set! (-> self current-frame-save) (-> self current-frame)) + (set! (-> self frames-save) (-> self frames)) + (set! (-> self time-of-day-save) (-> self time-of-day)) + ) + (('restore) + (set! (-> self old-frame) (-> self old-frame-save)) + (set! (-> self current-frame) (-> self current-frame-save)) + (set! (-> self frames) (-> self frames-save)) + (set! (-> self time-of-day) (-> self time-of-day-save)) + (let ((v1-30 (-> *display* bg-clock frame-counter)) + (a0-18 #x69780) + (a1-8 (/ (the int (* 1080000.0 (-> self time-of-day))) 60)) + ) + (set! (-> *display* bg-clock frame-counter) (+ (- v1-30 (the-as time-frame (mod v1-30 a0-18))) a0-18 a1-8)) + ) + (update-counters) + (kill-particles (-> self sun)) + (kill-particles (-> self green-sun)) + (kill-particles (-> self moon)) + (kill-particles (-> self day-star)) + (set! (-> self sun-count) 0) + (set! (-> self green-sun-count) 0) + (set! (-> self moon-count) 0) + (set! (-> self day-star-count) 0) + (-> self hours) + ) + (('ratio) + (-> self time-ratio) + ) + (('day-length) + (if (= (-> self time-ratio) 0.0) + 0 + (/ 25920000.0 (-> self time-ratio)) + ) + ) + (('time-frame) + (-> self frames) + ) + (('time-of-day) + (-> self time-of-day) + ) + (('time-of-day-norm) + (* 0.041666668 (-> self time-of-day)) + ) + (('hour) + (-> self hours) + ) + (('minute) + (-> self minutes) + ) + (('second) + (-> self seconds) + ) + (('dest-clock-ratio-set) + (set! (-> self dest-time-ratio) (the-as float (-> block param 0))) + (let ((f0-23 (-> self time-ratio)) + (f1-4 (-> self dest-time-ratio)) + (f2-1 (/ 300.0 (the float (-> block param 1)))) + ) + (set! (-> self dest-time-delta) (* (fabs (- f0-23 f1-4)) f2-1 (-> *display* real-clock seconds-per-frame))) + ) + (-> self dest-time-ratio) + ) + ) + ) + :code (behavior () + (until #f + (if (!= (-> self time-ratio) 0.0) + (set! (-> *time-of-day-context* mode) (time-of-day-palette-id unk3)) + ) + (when (!= (-> self time-ratio) (-> self dest-time-ratio)) + (seek! (-> self time-ratio) (-> self dest-time-ratio) (-> self dest-time-delta)) + (update-rates! (-> *display* bg-clock) (-> self time-ratio)) + ) + (update-counters) + (suspend) + ) + #f + ) + :post time-of-day-update + ) + +(defbehavior init-time-of-day time-of-day-proc () + "Initialize the time-of-day process" + (stack-size-set! (-> self main-thread) 128) + (set! (-> self hours) 0) + (set! (-> self minutes) 0) + (set! (-> self seconds) 0) + (set! (-> self frames) (the-as uint 0)) + (set! (-> self time-of-day) 0.0) + (cond + (*time-of-day-fast* + (set! (-> self time-ratio) 60.0) + (set! (-> self dest-time-ratio) 60.0) + ) + (else + (set! (-> self time-ratio) 1.0) + (set! (-> self dest-time-ratio) 1.0) + ) + ) + (update-rates! (-> *display* bg-clock) (-> self time-ratio)) + (set! (-> self sun) (create-launch-control (-> *part-group-id-table* 3) self)) + (set! (-> self green-sun) (create-launch-control (-> *part-group-id-table* 4) self)) + (set! (-> self moon) (create-launch-control (-> *part-group-id-table* 5) self)) + (set! (-> self day-star) (create-launch-control (-> *part-group-id-table* 6) self)) + (set! (-> self event-hook) (-> time-of-day-tick event)) + (go time-of-day-tick) + ) + +(defun start-time-of-day () + "Start a new time of day process, killing old one if needed." + (kill-by-name "time-of-day-proc" *active-pool*) + (set! *time-of-day* + (process-spawn time-of-day-proc :init init-time-of-day :name "time-of-day-proc" :to *bg-pool*) + ) + *time-of-day* + ) + (defun time-of-day-setup ((arg0 symbol)) - #f - ) \ No newline at end of file + "Check if the time of day ratio is set up or not. If arg0 = #t, then set it if needed." + (when arg0 + (when (= (-> *time-of-day* 0 time-ratio) 0.0) + (send-event (ppointer->process *time-of-day*) 'change 'ratio (if *time-of-day-fast* + #x42700000 + #x3f800000 + ) + ) + (set! (-> *time-of-day-context* mode) (time-of-day-palette-id unk3)) + ) + ) + (!= (-> *time-of-day* 0 time-ratio) 0.0) + ) + +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; ERROR: function was not converted to expressions. Cannot decompile. + +(defun init-time-of-day-context ((arg0 time-of-day-context)) + "Set up lighting data to defaults" + (set-vector! (-> arg0 title-light-group dir0 color) 0.82 0.82 0.82 1.0) + (set-vector! (-> arg0 title-light-group dir1 color) 2.0 2.0 2.0 1.0) + (set-vector! (-> arg0 title-light-group ambi color) 0.4 0.4 0.4 1.0) + (set! (-> arg0 title-light-group dir0 extra x) 1.0) + (set! (-> arg0 title-light-group dir1 extra x) 1.0) + (set! (-> arg0 title-light-group ambi extra x) 1.0) + (set-vector! (-> arg0 rim-light-group dir0 color) 0.0 1.9 2.0 1.0) + (set-vector! (-> arg0 rim-light-group dir1 color) 0.0 1.9 2.0 1.0) + (set-vector! (-> arg0 rim-light-group dir2 color) 0.0 1.9 2.0 1.0) + (set-vector! (-> arg0 rim-light-group ambi color) 0.0 0.0 0.3 1.0) + (set! (-> arg0 rim-light-group dir0 extra x) 1.0) + (set! (-> arg0 rim-light-group dir1 extra x) 1.0) + (set! (-> arg0 rim-light-group dir2 extra x) 1.0) + (set! (-> arg0 rim-light-group ambi extra x) 1.0) + (set-vector! (-> arg0 rim-light-group2 dir0 color) 3.0 3.0 3.0 1.0) + (set-vector! (-> arg0 rim-light-group2 dir1 color) 3.0 3.0 3.0 1.0) + (set-vector! (-> arg0 rim-light-group2 dir2 color) 3.0 3.0 3.0 1.0) + (set-vector! (-> arg0 rim-light-group2 ambi color) 0.0 0.0 0.0 1.0) + (set! (-> arg0 rim-light-group2 dir0 extra x) 1.0) + (set! (-> arg0 rim-light-group2 dir1 extra x) 1.0) + (set! (-> arg0 rim-light-group2 dir2 extra x) 1.0) + (set! (-> arg0 rim-light-group2 ambi extra x) 1.0) + (set-vector! (-> arg0 rim-light-group3 dir0 color) 1.0 0.0 0.0 1.0) + (set-vector! (-> arg0 rim-light-group3 dir1 color) 1.0 0.0 0.0 1.0) + (set-vector! (-> arg0 rim-light-group3 dir2 color) 1.0 0.0 0.0 1.0) + (set-vector! (-> arg0 rim-light-group3 ambi color) 0.0 0.0 0.0 1.0) + (set! (-> arg0 rim-light-group3 dir0 extra x) 1.0) + (set! (-> arg0 rim-light-group3 dir1 extra x) 1.0) + (set! (-> arg0 rim-light-group3 dir2 extra x) 1.0) + (set! (-> arg0 rim-light-group3 ambi extra x) 1.0) + (set-vector! (-> arg0 filter-color) 1.0 1.0 1.0 1.0) + (set! (-> arg0 overide-enable) #f) + (when *debug-segment* + (mem-copy! (the-as pointer *overide-mood-color-table*) (the-as pointer *no-cloud-mood-color-table*) 256) + (mem-copy! (the-as pointer *overide-mood-fog-table*) (the-as pointer *no-cloud-clear-mood-fog-table*) 384) + (dotimes (v1-32 8) + (set! (-> *overide-mood-color-table* data v1-32 lgt-color w) 1.0) + (set! (-> *overide-mood-color-table* data v1-32 amb-color w) 1.0) + (set! (-> *overide-mood-fog-table* data v1-32 fog-color w) 1.0) + (set! (-> *overide-mood-fog-table* data v1-32 fog-dists x) + (* 0.00024414062 (-> *overide-mood-fog-table* data v1-32 fog-dists x)) + ) + (set! (-> *overide-mood-fog-table* data v1-32 fog-dists y) + (* 0.00024414062 (-> *overide-mood-fog-table* data v1-32 fog-dists y)) + ) + (set-vector! (-> *time-of-day-context* times v1-32) 1.0 1.0 1.0 1.0) + ) + #f + ) + ) + +(defun set-filter-color! ((arg0 float) (arg1 float) (arg2 float)) + "Set RGB of filter." + (set-vector! (-> *time-of-day-context* filter-color) arg0 arg1 arg2 1.0) + 0 + (none) + ) + +(defun tod-madd! ((arg0 vector) (arg1 vector) (arg2 vector)) + "Multiply-add" + (local-vars (v0-0 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (.mov vf6 arg2) + (.lvf vf4 (&-> arg0 quad)) + (.lvf vf5 (&-> arg1 quad)) + (.mul.w.vf acc vf4 vf0) + (.add.mul.x.vf vf4 vf5 vf6 acc) + (.svf (&-> arg0 quad) vf4) + (.mov v0-0 vf4) + v0-0 + ) + ) + +(defun update-environment-colors ((arg0 time-of-day-context)) + (let* ((v1-0 (-> arg0 light-group)) + (s4-0 (-> v1-0 0 ambi color)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (let ((s2-0 (-> arg0 current-prt-color)) + (s3-0 (-> arg0 current-env-color)) + ) + (vector4-lerp! s5-0 (-> v1-0 0 dir0 color) (-> v1-0 0 dir1 color) (-> v1-0 0 dir1 extra x)) + (when (and (= (-> s2-0 x) 0.0) (= (-> s2-0 y) 0.0) (= (-> s2-0 z) 0.0)) + (set! (-> s2-0 x) (* 0.5 (+ (-> s4-0 x) (* 0.5 (+ (-> s4-0 x) (-> s5-0 x)))))) + (set! (-> s2-0 y) (* 0.5 (+ (-> s4-0 y) (* 0.5 (+ (-> s4-0 y) (-> s5-0 y)))))) + (set! (-> s2-0 z) (* 0.5 (+ (-> s4-0 z) (* 0.5 (+ (-> s4-0 z) (-> s5-0 z)))))) + (set! (-> s2-0 w) 1.0) + ) + (when (and (= (-> s3-0 x) 0.0) (= (-> s3-0 y) 0.0) (= (-> s3-0 z) 0.0)) + (set! (-> s3-0 x) (* 48.0 (+ (-> s5-0 x) (* 0.5 (+ (-> s4-0 x) (-> s5-0 x)))))) + (set! (-> s3-0 y) (* 48.0 (+ (-> s5-0 y) (* 0.5 (+ (-> s4-0 y) (-> s5-0 y)))))) + (set! (-> s3-0 z) (* 48.0 (+ (-> s5-0 z) (* 0.5 (+ (-> s4-0 z) (-> s5-0 z)))))) + (set! (-> s3-0 w) 128.0) + ) + ) + (let* ((f0-23 (fmax (fmax (-> s4-0 x) (-> s4-0 y)) (-> s4-0 z))) + (f2-14 (fmax (fmax (-> s5-0 x) (-> s5-0 y)) (-> s5-0 z))) + (f0-27 (fmin 0.85 (- 1.0 (/ (* 0.5 f2-14) (+ f0-23 f2-14))))) + (v0-1 (-> arg0 current-shadow-color)) + ) + (set! (-> v0-1 x) f0-27) + (set! (-> v0-1 y) f0-27) + (set! (-> v0-1 z) f0-27) + (set! (-> v0-1 w) 1.0) + v0-1 + ) + ) + ) + +(defun update-time-of-day ((arg0 time-of-day-context)) + (with-pp + (set! (-> arg0 exterior-level) #f) + (init-weather! *mood-control*) + (update-colors-for-time *sky-work* (-> arg0 time)) + (cond + ((-> arg0 overide-enable) + (mem-copy! (the-as pointer (-> *overide-table* mood-fog-table)) (the-as pointer *overide-mood-fog-table*) 384) + (mem-copy! + (the-as pointer (-> *overide-table* mood-color-table)) + (the-as pointer *overide-mood-color-table*) + 256 + ) + (dotimes (v1-7 8) + (vector-float*! + (the-as vector (-> *overide-table* mood-fog-table data v1-7)) + (the-as vector (-> *overide-table* mood-fog-table data v1-7)) + (-> *overide-table* mood-fog-table data v1-7 fog-color w) + ) + (vector-float*! + (the-as vector (-> *overide-table* mood-color-table data v1-7)) + (the-as vector (-> *overide-table* mood-color-table data v1-7)) + (-> *overide-table* mood-color-table data v1-7 lgt-color w) + ) + (vector-float*! + (the-as vector (+ (the-as uint (-> *overide-table* mood-color-table data 0 amb-color)) (* v1-7 32))) + (the-as vector (+ (the-as uint (-> *overide-table* mood-color-table data 0 amb-color)) (* v1-7 32))) + (-> *overide-table* mood-color-table data v1-7 amb-color w) + ) + (set! (-> *overide-table* mood-fog-table data v1-7 fog-color w) 128.0) + (set! (-> *overide-table* mood-color-table data v1-7 lgt-color w) 0.0) + (set! (-> *overide-table* mood-fog-table data v1-7 fog-dists x) + (* 4096.0 (-> *overide-table* mood-fog-table data v1-7 fog-dists x)) + ) + (set! (-> *overide-table* mood-fog-table data v1-7 fog-dists y) + (* 4096.0 (-> *overide-table* mood-fog-table data v1-7 fog-dists y)) + ) + ) + (let ((s5-0 (-> *level* level-default mood-context))) + (clear-mood-times s5-0) + (update-mood-exterior s5-0 *overide-table* (-> arg0 time) 10) + (update-mood-itimes s5-0) + ) + ) + (else + (let ((s5-1 *mood-control*)) + (set! (-> arg0 current-clouds cloud-min) (-> s5-1 mood-clouds cloud-min)) + (set! (-> arg0 current-clouds cloud-max) (-> s5-1 mood-clouds cloud-max)) + (let ((s4-0 (-> *level* level-default mood-context))) + (clear-mood-times s4-0) + (update-mood-exterior s4-0 s5-1 (-> arg0 time) 10) + (update-mood-itimes s4-0) + ) + ) + ) + ) + (vector-float*! (-> arg0 filter) (-> arg0 filter-color) (-> arg0 filter-color w)) + (set! (-> arg0 sky) #f) + (set! (-> arg0 special-mood) #f) + (set! (-> arg0 use-camera-other) #f) + (set! (-> arg0 target-interp) 0.0) + (let ((f0-16 4096000.0)) + (dotimes (v1-19 (-> *level* length)) + (let ((a0-52 (-> *level* level v1-19))) + (when (= (-> a0-52 status) 'active) + (if (logtest? (-> a0-52 info level-flags) (level-flags lf9)) + (set! (-> arg0 sky) #t) + ) + (if (and (= (-> a0-52 display?) 'display) (-> a0-52 info special-mood)) + (set! (-> arg0 special-mood) (the-as basic (-> a0-52 info special-mood))) + ) + (if (logtest? (-> a0-52 info level-flags) (level-flags use-camera-other)) + (set! (-> arg0 use-camera-other) (the-as basic #t)) + ) + (set! f0-16 (fmin f0-16 (-> a0-52 info fog-height))) + ) + ) + ) + (if (!= (-> *time-of-day-context* special-mood) 'desert) + (set-fog-height! f0-16) + ) + ) + (if (-> arg0 sky) + (set! (-> (&-> *level* level-default texture-anim-array 9) 0) *sky-texture-anim-array*) + (set! (-> (&-> *level* level-default texture-anim-array 9) 0) #f) + ) + (let ((s5-2 (level-get-target-inside *level*))) + (dotimes (s4-1 10) + (let ((s3-0 (-> *level* level s4-1))) + (case (-> s3-0 status) + (('active 'loaded 'shutdown 'special) + (when (not (paused?)) + (cond + ((not s5-2) + (set! (-> arg0 interp s4-1) 1.0) + ) + ((= s3-0 s5-2) + (if *teleport* + (set! (-> arg0 interp s4-1) 1.0) + (set! (-> arg0 interp s4-1) (fmin 1.0 (+ 0.0166 (-> arg0 interp s4-1)))) + ) + ) + (*teleport* + (set! (-> arg0 interp s4-1) 0.0) + ) + (else + (set! (-> arg0 interp s4-1) (fmax 0.0 (+ -0.0166 (-> arg0 interp s4-1)))) + ) + ) + ) + (let ((s2-0 (-> pp clock))) + (set! (-> pp clock) (-> *display* real-clock)) + (set! (-> s3-0 mood-func) (the-as (function mood-context float int none) (-> s3-0 info mood-func value))) + (clear-mood-times (-> s3-0 mood-context)) + (if (nonzero? (-> s3-0 mood-func)) + ((-> s3-0 mood-func) (-> s3-0 mood-context) (-> arg0 time) s4-1) + (update-mood-default (-> s3-0 mood-context) (-> arg0 time) s4-1) + ) + (when (-> arg0 overide-enable) + (let ((s1-0 (new 'stack-no-clear 'structure))) + (dotimes (s0-0 8) + (let ((a1-59 (-> s3-0 mood-context times s0-0))) + (vector-float*! (the-as vector s1-0) (-> arg0 times s0-0) (-> arg0 times s0-0 w)) + (vector4-mul! (the-as vector4 a1-59) (the-as vector4 a1-59) (the-as vector4 s1-0)) + ) + ) + ) + ) + (update-mood-itimes (-> s3-0 mood-context)) + (set! (-> pp clock) s2-0) + ) + ) + (else + (set! (-> arg0 interp s4-1) 0.0) + ) + ) + ) + ) + ) + (if (and (-> arg0 exterior-level) (!= (-> *mood-control* lightning-flash) 0.0)) + (set! (-> *display* force-sync) (the-as uint 2)) + ) + (let ((f0-29 0.0)) + (dotimes (v1-91 10) + (+! f0-29 (-> arg0 interp v1-91)) + ) + (when (!= f0-29 0.0) + (dotimes (v1-95 10) + (set! (-> arg0 interp v1-95) (/ (-> arg0 interp v1-95) f0-29)) + ) + (let ((v1-98 (-> arg0 current-fog))) + (dotimes (a0-83 103) + ;; og:preserve-this + (set! (-> (the-as (pointer int128) (+ (* a0-83 16) (the-as int v1-98)))) (the int128 0)) + ) + ) + (let* ((s5-3 (-> arg0 current-fog)) + (s4-2 (-> *mood-control* range)) + (v1-103 (level-get-target-inside *level*)) + (s3-1 (if v1-103 + (-> v1-103 index) + 0 + ) + ) + ) + (set! (-> s4-2 quad) (the-as uint128 0)) + (set! (-> arg0 max-rain) 0.0) + (set! (-> arg0 fog-mult) 0.0) + (set! (-> arg0 ocean-alpha) 0.0) + (dotimes (s2-1 10) + (let ((f30-0 (-> arg0 interp s2-1)) + (s1-1 (-> *level* level s2-1)) + ) + (when (!= f30-0 0.0) + (let ((a2-23 (-> s1-1 mood-context))) + (vector4-array-madd! + (the-as (inline-array vector4) s5-3) + (the-as (inline-array vector4) s5-3) + (the-as (inline-array vector4) a2-23) + f30-0 + 7 + ) + ) + (dotimes (s0-1 8) + (let ((a2-24 (-> s1-1 mood-context light-group s0-1)) + (a1-63 (-> arg0 light-group s0-1)) + ) + (light-group-madd! a1-63 (the-as (pointer light-group) a1-63) a2-24 f30-0) + ) + ) + (let ((a2-25 (-> s1-1 info mood-range))) + (vector4-madd! (the-as vector4 s4-2) (the-as vector4 s4-2) (the-as vector4 a2-25) f30-0) + ) + (+! (-> arg0 max-rain) (* (-> s1-1 info max-rain) f30-0)) + (+! (-> arg0 fog-mult) (* (-> s1-1 info fog-mult) f30-0)) + (+! (-> arg0 ocean-alpha) (* (-> s1-1 info ocean-alpha) f30-0)) + (when (= s2-1 s3-1) + (dotimes (v1-126 8) + (let ((a0-92 (-> s1-1 mood-context light-group v1-126)) + (a1-68 (-> arg0 light-group v1-126)) + ) + (dotimes (a2-26 4) + (set! (-> a1-68 lights a2-26 extra y) (-> a0-92 lights a2-26 extra y)) + ) + ) + ) + ) + ) + ) + ) + ) + (dotimes (s5-4 8) + (dotimes (s4-3 3) + (let ((v1-135 (+ (+ (* 48 s4-3) 156 (* 192 s5-4)) (the-as int arg0)))) + (vector-normalize! (the-as vector (+ v1-135 0)) 1.0) + ) + ) + ) + ) + ) + (if (and (-> arg0 overide-enable) (!= (-> *time-of-day-context* mode) 8)) + (mem-copy! + (the-as pointer (-> arg0 current-fog)) + (the-as + pointer + (-> *overide-table* + mood-fog-table + data + (the-as uint (logand (-> *time-of-day-context* mode) (time-of-day-palette-id unk0 unk1 unk2))) + ) + ) + 48 + ) + ) + (let ((f30-1 (-> *blit-displays-work* slow-time)) + (a1-76 (new 'stack-no-clear 'vector)) + (s5-5 (-> arg0 current-fog)) + ) + (let ((f28-0 f30-1)) + (dotimes (v1-151 4) + (set! f28-0 (* f28-0 f30-1)) + ) + (set-vector! a1-76 0.0 48.0 128.0 128.0) + (vector4-lerp! (-> s5-5 fog-color) a1-76 (-> s5-5 fog-color) f30-1) + (set! (-> s5-5 fog-dists x) (lerp 131072.0 (-> s5-5 fog-dists x) f30-1)) + (set! (-> s5-5 fog-dists y) (lerp 819200.0 (-> s5-5 fog-dists y) f28-0)) + ) + (set! (-> s5-5 fog-dists z) (lerp 199.0 (-> s5-5 fog-dists z) f30-1)) + (set! (-> s5-5 fog-dists w) (lerp 64.0 (-> s5-5 fog-dists w) f30-1)) + ) + (update-environment-colors arg0) + (let ((a0-109 (-> arg0 current-fog)) + (v1-156 *fog-texture-work*) + ) + (let ((a1-81 (-> a0-109 fog-color))) + (set! *fog-color* + (new 'static 'rgba :r (the int (-> a1-81 x)) :g (the int (-> a1-81 y)) :b (the int (-> a1-81 z))) + ) + (set! (-> v1-156 color) (new 'static 'rgba + :r (the int (-> a1-81 x)) + :r (the int (-> a1-81 x)) + :g (the int (-> a1-81 y)) + :b (the int (-> a1-81 z)) + ) + ) + ) + (let ((a1-86 (-> a0-109 erase-color))) + (set! (-> arg0 erase-color) + (new 'static 'rgba :a #x80 :b (the int (-> a1-86 z)) :g (the int (-> a1-86 y)) :r (the int (-> a1-86 x))) + ) + ) + (let ((f0-73 (-> a0-109 fog-dists x)) + (f1-18 (-> a0-109 fog-dists y)) + ) + (let ((f3-0 (-> a0-109 fog-dists z)) + (f2-2 (-> a0-109 fog-dists w)) + ) + (set! (-> *math-camera* fog-start) f0-73) + (set! (-> *math-camera* fog-end) f1-18) + (set! (-> *math-camera* fog-max) f3-0) + (set! (-> *math-camera* fog-min) f2-2) + (set! (-> v1-156 alpha-near) (* 0.003921569 (the float (- 255 (the int f3-0))))) + (set! (-> v1-156 alpha-far) (* 0.003921569 (the float (- 255 (the int f2-2))))) + ) + (set! (-> v1-156 alpha-delta) (- (-> v1-156 alpha-far) (-> v1-156 alpha-near))) + (set! (-> v1-156 fog-near) f0-73) + (set! (-> v1-156 fog-far) f1-18) + (set! (-> v1-156 fog-delta) (- f1-18 f0-73)) + ) + ) + (set-cloud-minmax! (-> arg0 current-clouds cloud-min) (-> arg0 current-clouds cloud-max)) + (reset! *palette-fade-controls*) + 0 + (none) + ) + ) + +(defun calc-fade-from-fog ((arg0 vector)) + (let* ((f0-0 (vector-vector-distance (math-camera-pos) arg0)) + (v1-1 (-> *time-of-day-context* current-fog)) + (f1-0 (-> v1-1 fog-dists x)) + (f2-0 (-> v1-1 fog-dists y)) + (f3-1 (* 0.003921569 (-> v1-1 fog-dists w))) + (f4-2 (* 0.003921569 (-> v1-1 fog-dists z))) + ) + (+ f4-2 (* (fmax 0.0 (fmin 1.0 (/ (- f0-0 f1-0) (- f2-0 f1-0)))) (- f3-1 f4-2))) + ) + ) + +(defmethod set-fade! ((this palette-fade-controls) (arg0 int) (arg1 float) (arg2 float) (arg3 vector)) + (cond + ((and (>= arg0 0) (< arg0 8)) + (let ((v1-3 (-> this control arg0))) + (when (< arg2 (-> v1-3 actor-dist)) + (if arg3 + (set! (-> v1-3 trans quad) (-> arg3 quad)) + ) + (set! (-> v1-3 fade) (fmax 0.0 (fmin 1.993 arg1))) + (set! (-> v1-3 actor-dist) arg2) + ) + ) + ) + (else + (format 0 "ERROR: Bogus palette-fade-control index!~%") + ) + ) + ) + +(defmethod reset! ((this palette-fade-controls)) + (countdown (v1-0 8) + (let ((a1-2 (-> this control v1-0))) + (set! (-> a1-2 fade) 0.0) + (set! (-> a1-2 actor-dist) 4096000000.0) + ) + ) + 0 + (none) + ) + +(start-time-of-day) diff --git a/goal_src/jak3/engine/gfx/mood/weather-part.gc b/goal_src/jak3/engine/gfx/mood/weather-part.gc index 3ea80fb100..a376fdb05d 100644 --- a/goal_src/jak3/engine/gfx/mood/weather-part.gc +++ b/goal_src/jak3/engine/gfx/mood/weather-part.gc @@ -5,15 +5,916 @@ ;; name in dgo: weather-part ;; dgos: GAME -;; stubs -(defun update-rain ((a0 float) (a1 vector) (a2 vector)) +;; DECOMP BEGINS + +(defpartgroup group-rain-screend-drop-real + :id 1 + :flags (sp2) + :bounds (static-bspherem 0 0 0 16) + :parts ((sp-item 23 :binding 19) + (sp-item 19 :flags (sp2 sp3) :binding 20) + (sp-item 19 :flags (sp2 sp3) :binding 20) + (sp-item 19 :flags (sp2 sp3) :binding 20) + (sp-item 19 :flags (sp2 sp3) :binding 20) + (sp-item 19 :flags (sp2 sp3) :binding 20) + (sp-item 19 :flags (sp2 sp3) :binding 20) + (sp-item 19 :flags (sp2 sp3) :binding 20) + (sp-item 19 :flags (sp2 sp3) :binding 20) + (sp-item 19 :flags (sp2 sp3) :binding 20) + (sp-item 19 :flags (sp2 sp3) :binding 20) + (sp-item 19 :flags (sp2 sp3) :binding 20) + (sp-item 19 :flags (sp2 sp3) :binding 20) + (sp-item 19 :flags (sp2 sp3) :binding 20) + (sp-item 19 :flags (sp2 sp3) :binding 20) + (sp-item 19 :flags (sp2 sp3) :binding 20) + (sp-item 19 :flags (sp2 sp3) :binding 20) + (sp-item 20 :flags (sp2 sp3)) + (sp-item 20 :flags (sp2 sp3)) + (sp-item 20 :flags (sp2 sp3)) + (sp-item 20 :flags (sp2 sp3)) + (sp-item 20 :flags (sp2 sp3)) + (sp-item 20 :flags (sp2 sp3)) + (sp-item 20 :flags (sp2 sp3)) + (sp-item 20 :flags (sp2 sp3)) + (sp-item 20 :flags (sp2 sp3)) + (sp-item 20 :flags (sp2 sp3)) + (sp-item 20 :flags (sp2 sp3)) + (sp-item 20 :flags (sp2 sp3)) + (sp-item 20 :flags (sp2 sp3)) + (sp-item 20 :flags (sp2 sp3)) + (sp-item 20 :flags (sp2 sp3)) + (sp-item 20 :flags (sp2 sp3)) + (sp-item 24 :binding 21) + (sp-item 21 :flags (sp2 sp3) :binding 22) + (sp-item 21 :flags (sp2 sp3) :binding 22) + (sp-item 21 :flags (sp2 sp3) :binding 22) + (sp-item 21 :flags (sp2 sp3) :binding 22) + (sp-item 21 :flags (sp2 sp3) :binding 22) + (sp-item 21 :flags (sp2 sp3) :binding 22) + (sp-item 21 :flags (sp2 sp3) :binding 22) + (sp-item 21 :flags (sp2 sp3) :binding 22) + (sp-item 21 :flags (sp2 sp3) :binding 22) + (sp-item 21 :flags (sp2 sp3) :binding 22) + (sp-item 21 :flags (sp2 sp3) :binding 22) + (sp-item 21 :flags (sp2 sp3) :binding 22) + (sp-item 21 :flags (sp2 sp3) :binding 22) + (sp-item 21 :flags (sp2 sp3) :binding 22) + (sp-item 21 :flags (sp2 sp3) :binding 22) + (sp-item 21 :flags (sp2 sp3) :binding 22) + (sp-item 22 :flags (sp2 sp3)) + (sp-item 22 :flags (sp2 sp3)) + (sp-item 22 :flags (sp2 sp3)) + (sp-item 22 :flags (sp2 sp3)) + (sp-item 22 :flags (sp2 sp3)) + (sp-item 22 :flags (sp2 sp3)) + (sp-item 22 :flags (sp2 sp3)) + (sp-item 22 :flags (sp2 sp3)) + (sp-item 22 :flags (sp2 sp3)) + (sp-item 22 :flags (sp2 sp3)) + (sp-item 22 :flags (sp2 sp3)) + (sp-item 22 :flags (sp2 sp3)) + (sp-item 22 :flags (sp2 sp3)) + (sp-item 22 :flags (sp2 sp3)) + (sp-item 22 :flags (sp2 sp3)) + (sp-item 22 :flags (sp2 sp3)) + ) + ) + +(define group-rain-screend-drop (-> *part-group-id-table* 1)) + +(defpart 24 + :init-specs ((:texture (starflash level-default-sprite)) + (:num 0.1) + (:x (meters -4.5) (meters 9)) + (:y (meters -3) (meters 6)) + (:scale-x (meters 2.5)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 128.0) + (:b 128.0) + (:a 12.0) + (:scalevel-x (meters 0.16666667)) + (:scalevel-y :copy scalevel-x) + (:fade-a -0.8) + (:timer (seconds 0.035)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14)) + ) + ) + +(defpart 21 + :init-specs ((:texture (lakedrop level-default-sprite)) + (:num 1.0) + (:scale-x (meters 1.5)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 128.0) + (:b 255.0) + (:a 20.0) + (:scalevel-x (meters 0.033333335)) + (:scalevel-y :copy scalevel-x) + (:fade-a -0.8) + (:accel-y (meters -0.00066666666)) + (:timer (seconds 0.9)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14)) + (:next-time (seconds 0.05)) + (:next-launcher 25) + ) + ) + +(defpart 25 + :init-specs ((:scalevel-x (meters 0.004166667)) (:scalevel-y :copy scalevel-x) (:fade-a -0.06666667)) + ) + +(defpart 22 + :init-specs ((:num 1.0) + (:rot-x 12) + (:r 4096.0) + (:g 3276.8) + (:b 3276.8) + (:fade-r 6.068148) + (:fade-g 68.26667) + (:fade-b 3.034074) + (:accel-y (meters -0.00066666666)) + (:timer (seconds 0.9)) + (:flags (distort)) + (:next-time (seconds 0.1)) + (:next-launcher 26) + ) + ) + +(defpart 26 + :init-specs ((:fade-g -5.1200004)) + ) + +(defpart 23 + :init-specs ((:texture (starflash level-default-sprite)) + (:num 0.1) + (:x (meters -4.5) (meters 9)) + (:y (meters -3) (meters 6)) + (:scale-x (meters 4)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 128.0) + (:b 128.0) + (:a 12.0) + (:scalevel-x (meters 0.26666668)) + (:scalevel-y :copy scalevel-x) + (:fade-a -0.8) + (:timer (seconds 0.035)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14)) + ) + ) + +(defpart 19 + :init-specs ((:texture (lakedrop level-default-sprite)) + (:num 1.0) + (:scale-x (meters 2.6)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 128.0) + (:b 255.0) + (:a 20.0) + (:scalevel-x (meters 0.06666667)) + (:scalevel-y :copy scalevel-x) + (:fade-a -0.8) + (:accel-y (meters -0.00066666666)) + (:timer (seconds 0.9)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14)) + (:next-time (seconds 0.05)) + (:next-launcher 27) + ) + ) + +(defpart 27 + :init-specs ((:scalevel-x (meters 0.008333334)) (:scalevel-y :copy scalevel-x) (:fade-a -0.06666667)) + ) + +(defpart 20 + :init-specs ((:num 1.0) + (:rot-x 24) + (:r 12288.0) + (:g 6553.6) + (:b 6553.6) + (:fade-r 12.136296) + (:fade-g 136.53334) + (:fade-b 6.068148) + (:accel-y (meters -0.00066666666)) + (:timer (seconds 0.9)) + (:flags (distort)) + (:next-time (seconds 0.1)) + (:next-launcher 28) + ) + ) + +(defpart 28 + :init-specs ((:fade-g -10.240001)) + ) + +(defpartgroup group-stars + :id 2 + :flags (sp1) + :bounds (static-bspherem 0 0 0 8) + :parts ((sp-item 29 :flags (sp6)) (sp-item 30 :flags (sp6)) (sp-item 31 :flags (sp6))) + ) + +(defpart 29 + :init-specs ((:texture (hotdot level-default-sprite)) + (:num 1.0) + (:scale-x (meters 30) (meters 20)) + (:scale-y :copy scale-x) + (:r 256.0) + (:g 256.0) + (:b 256.0) + (:a 0.0) + (:fade-a 0.42666668) + (:timer (seconds -0.005)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14)) + (:next-time (seconds 0.2) (seconds 0.797)) + (:next-launcher 32) + (:conerot-x (degrees -89) (degrees 178)) + (:conerot-y (degrees 0) (degrees 1440)) + (:rotate-y (degrees 0) (degrees 3600)) + (:conerot-radius (meters 5000)) + ) + ) + +(defpart 32 + :init-specs ((:fade-a 0.0) (:next-time (seconds 99999)) (:next-launcher 33)) + ) + +(defpart 33 + :init-specs ((:fade-a -0.42666668)) + ) + +(defpart 30 + :init-specs ((:texture (hotdot level-default-sprite)) + (:num 1.0) + (:scale-x (meters 30) (meters 20)) + (:scale-y :copy scale-x) + (:r 256.0) + (:g 256.0) + (:b 256.0) + (:a 0.0) + (:fade-a 0.42666668) + (:timer (seconds -0.005)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14)) + (:next-time (seconds 0.2) (seconds 0.797)) + (:next-launcher 32) + (:conerot-x (degrees 30) (degrees 59)) + (:conerot-y (degrees 0) (degrees 2880)) + (:rotate-y (degrees 0) (degrees 3600)) + (:conerot-radius (meters 5000)) + ) + ) + +(defpart 31 + :init-specs ((:texture (hotdot level-default-sprite)) + (:num 1.0) + (:scale-x (meters 30) (meters 20)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 128.0) + (:b 128.0) + (:a 0.0) + (:fade-a 0.42666668) + (:timer (seconds -0.005)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14)) + (:next-time (seconds 0.2) (seconds 0.797)) + (:next-launcher 32) + (:conerot-x (degrees 60) (degrees 29)) + (:conerot-y (degrees 0) (degrees 5760)) + (:rotate-y (degrees 0) (degrees 3600)) + (:conerot-radius (meters 5000)) + ) + ) + +(defpart 34 + :init-specs ((:texture (hotdot level-default-sprite)) + (:num 4.0) + (:x (meters 10) (meters 10)) + (:y (meters 2) (meters 14)) + (:scale-x (meters 0.2) (meters 0.1)) + (:rot-x 4) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 255.0) + (:b 255.0) + (:a 0.0) + (:vel-y (meters -0.01) (meters -0.0033333334)) + (:rotvel-z (degrees -1.2) (degrees 2.4)) + (:fade-a 0.85333335) + (:timer (seconds 5)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-13 sp-cpuinfo-flag-14)) + (:next-time (seconds 0.25) (seconds 0.247)) + (:next-launcher 35) + (:rotate-y (degrees 0) (degrees 180)) + ) + ) + +(defpart 36 + :init-specs ((:texture (hotdot level-default-sprite)) + (:num 0.0) + (:x (meters 0) (meters 20)) + (:y (meters 16)) + (:scale-x (meters 0.2) (meters 0.1)) + (:rot-x 4) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 255.0) + (:b 255.0) + (:a 0.0) + (:vel-y (meters -0.01) (meters -0.0033333334)) + (:rotvel-z (degrees -1.2) (degrees 2.4)) + (:fade-a 0.85333335) + (:timer (seconds 5)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-13 sp-cpuinfo-flag-14)) + (:next-time (seconds 0.25) (seconds 0.247)) + (:next-launcher 35) + (:rotate-y (degrees 0) (degrees 360)) + ) + ) + +(defpart 35 + :init-specs ((:fade-a 0.0) (:next-time (seconds 4)) (:next-launcher 37)) + ) + +(defpart 37 + :init-specs ((:fade-a -0.85333335)) + ) + +(defun update-snow ((arg0 float) (arg1 vector) (arg2 vector)) + (let ((f0-0 (lerp-scale 0.0 1.0 (vector-length arg2) 2048.0 40960.0))) + (set! (-> *part-id-table* 36 init-specs 1 initial-valuef) (- 1.0 f0-0)) + (set! (-> *part-id-table* 34 init-specs 1 initial-valuef) (* 4.0 f0-0)) + ) + (set! (-> *part-id-table* 34 init-specs 19 initial-valuef) (+ 32768.0 (vector-y-angle arg2))) + (launch-particles (-> *part-id-table* 36) arg1) + (launch-particles (-> *part-id-table* 34) arg1) + 0 (none) ) -(defun update-snow ((a0 float) (a1 vector) (a2 vector)) +(defpart 38 + :init-specs ((:texture (lakedrop level-default-sprite)) + (:birth-func 'birth-func-rain) + (:num 1.0) + (:x (meters -20) (meters 40)) + (:y (meters 30)) + (:scale-x (meters 0.03) (meters 0.03)) + (:scale-y (meters 0.5) (meters 0.5)) + (:r 32.0 32.0) + (:g :copy r) + (:b 64.0 32.0) + (:a 32.0 64.0) + (:vel-y (meters -0.1) (meters -0.2)) + (:timer (seconds 3)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14)) + (:userdata 0.0) + (:func 'check-drop-level-rain) + (:rotate-y (degrees 0) (degrees 3600)) + ) + ) + +(defpart 39 + :init-specs ((:texture (lakedrop level-default-sprite)) + (:birth-func 'birth-func-rain) + (:num 4.0) + (:x (meters -20) (meters 40)) + (:y (meters 30)) + (:scale-x (meters 0.03) (meters 0.03)) + (:scale-y (meters 0.5) (meters 0.5)) + (:r 32.0 32.0) + (:g :copy r) + (:b 64.0 32.0) + (:a 32.0 64.0) + (:vel-y (meters -0.06666667) (meters -0.033333335)) + (:timer (seconds 3)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14)) + (:userdata 0.0) + (:func 'check-drop-level-rain2) + (:rotate-y (degrees 0) (degrees 3600)) + ) + ) + +(defpart 40 + :init-specs ((:texture (lakedrop level-default-sprite)) + (:num 1.0 3.0) + (:scale-x (meters 0.08) (meters 0.03)) + (:rot-x 4) + (:scale-y :copy scale-x) + (:r 32.0 32.0) + (:g :copy r) + (:b 64.0 32.0) + (:a 64.0 64.0) + (:omega (degrees 0.01575) (degrees 0.009)) + (:vel-y (meters 0.033333335) (meters 0.06666667)) + (:fade-a -0.21333334 -0.21333334) + (:accel-y (meters -0.005) (meters -0.00066666666)) + (:friction 0.98) + (:timer (seconds 1)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 launch-along-z)) + (:userdata 0.0) + (:func 'check-drop-level-splash) + (:next-time (seconds 0) (seconds 0.33)) + (:next-launcher 41) + (:conerot-x (degrees 0) (degrees 50.000004)) + (:conerot-y (degrees 0) (degrees 3600)) + (:rotate-x (degrees 0)) + (:rotate-y (degrees 0)) + ) + ) + +(defpart 42 + :init-specs ((:texture (hotdot level-default-sprite)) + (:birth-func 'birth-func-omega-normal-orient) + (:num 1.0) + (:y (meters 0.2)) + (:scale-x (meters 0.5) (meters 0.25)) + (:scale-y :copy scale-x) + (:r 32.0 32.0) + (:g :copy r) + (:b 64.0 32.0) + (:a 64.0 32.0) + (:omega (degrees 0)) + (:scalevel-x (meters 0.006666667) (meters 0.006666667)) + (:scalevel-y :copy scalevel-x) + (:fade-a -1.2) + (:timer (seconds 1)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14)) + (:userdata :data (new 'static 'boxed-array :type int32 10 0 0 #x401800 #x403d00 #x400700 #x408200)) + (:func 'sparticle-texture-animate) + ) + ) + +(defpart 43 + :init-specs ((:texture (motion-blur-part level-default-sprite)) + (:num 2.0 4.0) + (:scale-x (meters 2.5)) + (:rot-x 4) + (:scale-y (meters 0.06) (meters 0.03)) + (:r 255.0) + (:g 128.0 128.0) + (:b 0.0 128.0) + (:a 128.0) + (:omega (degrees 0.018) (degrees 0.01125)) + (:vel-y (meters 0.1) (meters 0.06666667)) + (:fade-g -2.55 -2.55) + (:fade-b -8.0) + (:fade-a -0.32 -0.64) + (:friction 0.8 0.02) + (:timer (seconds 0.335) (seconds 0.33)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:func 'sparticle-motion-blur) + (:conerot-x (degrees 0) (degrees 80)) + (:conerot-y (degrees 0) (degrees 3600)) + ) + ) + +(defpart 44 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:scale-x (meters 0.25)) + (:rot-x (degrees 0.225)) + (:rot-z (degrees 0) (degrees 3600)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 196.0 128.0) + (:b 128.0 64.0) + (:a 96.0 16.0) + (:omega (degrees 3608.9998)) + (:scalevel-x (meters 0.08)) + (:scalevel-y :copy scalevel-x) + (:fade-g -6.375) + (:fade-b -13.066667) + (:fade-a -2.8) + (:timer (seconds 0.05) (seconds 0.03)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)) + (:userdata 2048.0) + ) + ) + +(defun birth-func-omega-normal-orient ((arg0 sparticle-system) + (arg1 sparticle-cpuinfo) + (arg2 sprite-vec-data-3d) + (arg3 sparticle-launcher) + (arg4 sparticle-launch-state) + ) + (local-vars (v1-6 float) (v1-7 float)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'quaternion)) + ) + (set! (-> s4-0 x) (* 0.007874016 (the float (-> arg1 datab 2)))) + (set! (-> s4-0 y) 0.0) + (set! (-> s4-0 z) (* -0.007874016 (the float (-> arg1 datab 0)))) + (vector-normalize! s4-0 1.0) + (quaternion-vector-angle! gp-0 s4-0 (acos (* 0.007874016 (the float (-> arg1 datab 1))))) + (cond + ((< (-> gp-0 w) 0.0) + (.lvf vf1 (&-> arg2 qx-qy-qz-sy quad)) + (.lvf vf2 (&-> gp-0 quad)) + (.sub.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> arg2 qx-qy-qz-sy quad) vf1) + (.mov v1-6 vf1) + ) + (else + (.lvf vf1 (&-> arg2 qx-qy-qz-sy quad)) + (.lvf vf2 (&-> gp-0 quad)) + (.add.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> arg2 qx-qy-qz-sy quad) vf1) + (.mov v1-7 vf1) + ) + ) + ) + 0 + (none) + ) + ) + +(defun birth-func-rain ((arg0 sparticle-system) + (arg1 sparticle-cpuinfo) + (arg2 sprite-vec-data-3d) + (arg3 sparticle-launcher) + (arg4 sparticle-launch-state) + ) + (let ((s4-0 (new 'stack-no-clear 'collide-query))) + (set! (-> s4-0 start-pos quad) (-> arg2 x-y-z-sx quad)) + (set-vector! (-> s4-0 move-dist) 0.0 -163840.0 0.0 1.0) + (let ((v1-2 s4-0)) + (set! (-> v1-2 radius) 40.96) + (set! (-> v1-2 collide-with) (collide-spec backgnd)) + (set! (-> v1-2 ignore-process0) #f) + (set! (-> v1-2 ignore-process1) #f) + (set! (-> v1-2 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-2 action-mask) (collide-action solid)) + ) + (fill-using-line-sphere *collide-cache* s4-0) + (cond + ((>= (probe-using-line-sphere *collide-cache* s4-0) 0.0) + (set! (-> arg1 user-float) (-> s4-0 best-other-tri intersect y)) + (let ((f0-8 (+ 65536.0 (-> *math-camera* trans y)))) + (if (< (-> arg1 user-float) f0-8) + (set! (-> arg2 x-y-z-sx y) f0-8) + ) + ) + (set! (-> arg1 datab 0) (the int (* 127.0 (-> s4-0 best-other-tri normal x)))) + (set! (-> arg1 datab 1) (the int (* 127.0 (-> s4-0 best-other-tri normal y)))) + (set! (-> arg1 datab 2) (the int (* 127.0 (-> s4-0 best-other-tri normal z)))) + (set! (-> arg1 datab 3) (the-as int (-> s4-0 best-other-tri pat event))) + ) + (else + (set! (-> arg1 omega) 65280.0) + (set! (-> arg1 user-float) (+ -204800.0 (-> arg2 x-y-z-sx y))) + ) + ) + ) + (let ((f0-21 (get-height *ocean* (-> arg2 x-y-z-sx) #f))) + (when (!= f0-21 4095996000.0) + (when (< (-> arg1 user-float) f0-21) + (set! (-> arg1 user-float) f0-21) + (set! (-> arg1 datab 0) 0) + (set! (-> arg1 datab 1) 127) + (set! (-> arg1 datab 2) 0) + (set! (-> arg1 datab 3) 0) + 0 + ) + ) + ) + 0 + (none) + ) + +(defun check-drop-level-rain ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (when (< (-> arg2 y) (-> arg1 user-float)) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'matrix)) + ) + (let ((f30-0 (-> arg1 user-float))) + (sp-kill-particle arg0 arg1) + (set-vector! s4-0 (-> arg2 x) (-> arg1 user-float) (-> arg2 z) 1.0) + (-> arg1 omega) + (set-vector! + (-> gp-0 uvec) + (* 0.007874016 (the float (-> arg1 datab 0))) + (* 0.007874016 (the float (-> arg1 datab 1))) + (* 0.007874016 (the float (-> arg1 datab 2))) + 0.0 + ) + (set-vector! (-> gp-0 fvec) 0.0 0.0 1.0 0.0) + (vector-cross! (-> gp-0 rvec) (-> gp-0 uvec) (-> gp-0 fvec)) + (set! (-> gp-0 trans quad) (-> s4-0 quad)) + (set! (-> *part-id-table* 40 init-specs 23 initial-valuef) (vector-y-angle (-> gp-0 uvec))) + (set! (-> *part-id-table* 40 init-specs 22 initial-valuef) (- 16384.0 (vector-x-angle (-> gp-0 uvec)))) + (set! (-> *part-id-table* 40 init-specs 16 initial-valuef) f30-0) + ) + (launch-particles (-> *part-id-table* 40) gp-0 :origin-is-matrix #t) + (case (-> arg1 datab 3) + ((11 10) + (sound-play "sizzle-drips") + (launch-particles (-> *part-id-table* 44) gp-0 :origin-is-matrix #t) + (launch-particles (-> *part-id-table* 43) gp-0 :origin-is-matrix #t) + ) + (else + (sound-play "dry-drips") + (set! (-> *part-id-table* 42 init-specs 10 initial-valuef) (-> arg1 omega)) + (launch-particles :system *sp-particle-system-3d* (-> *part-id-table* 42) gp-0 :origin-is-matrix #t) + ) + ) + ) + ) (none) ) +;; WARN: Return type mismatch symbol vs none. +(defun check-drop-level-rain2 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (if (< (-> arg2 y) (-> arg1 user-float)) + (sp-kill-particle arg0 arg1) + ) + (none) + ) -;; DECOMP BEGINS +;; WARN: Return type mismatch symbol vs none. +(defun check-drop-level-splash ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (sparticle-motion-blur arg0 arg1 arg2) + (if (< (-> arg2 y) (-> arg1 user-float)) + (sp-kill-particle arg0 arg1) + ) + (none) + ) + +(defun update-rain ((arg0 float) (arg1 vector) (arg2 vector)) + (let ((v1-0 (new 'stack-no-clear 'vector))) + (set! (-> v1-0 x) (-> arg2 x)) + (set! (-> v1-0 y) 0.0) + (set! (-> v1-0 z) (-> arg2 z)) + (set! (-> v1-0 w) 1.0) + (let ((gp-1 (vector+float*! (new 'stack-no-clear 'vector) arg1 v1-0 0.0))) + (let* ((s4-0 (matrix-local->world #f #f)) + (f28-0 (lerp-scale 122.88 245.76 (fabs (-> s4-0 fvec y)) 0.0 0.7)) + (f30-0 (lerp-scale 2048.0 245.76 (fabs (-> s4-0 fvec y)) 0.0 0.7)) + ) + (let ((f26-0 (lerp-scale 0.0 0.1 (-> s4-0 fvec y) 0.3 0.7)) + (f0-11 (lerp-scale 1.0 0.1 (-> s4-0 fvec y) 0.3 0.7)) + ) + (if (< 0.0 f26-0) + (send-event *camera* 'part-water-drip f26-0 f0-11) + ) + ) + (set! (-> *part-id-table* 38 init-specs 5 initial-valuef) f28-0) + (set! (-> *part-id-table* 38 init-specs 5 random-rangef) f28-0) + (set! (-> *part-id-table* 39 init-specs 5 initial-valuef) f28-0) + (set! (-> *part-id-table* 39 init-specs 5 random-rangef) f28-0) + (set! (-> *part-id-table* 38 init-specs 6 initial-valuef) f30-0) + (set! (-> *part-id-table* 38 init-specs 6 random-rangef) f30-0) + (set! (-> *part-id-table* 39 init-specs 6 initial-valuef) f30-0) + (set! (-> *part-id-table* 39 init-specs 6 random-rangef) f30-0) + ) + (set! (-> *part-id-table* 38 init-specs 2 initial-valuef) arg0) + (set! (-> *part-id-table* 39 init-specs 2 initial-valuef) (* 4.0 arg0)) + (launch-particles (-> *part-id-table* 38) gp-1) + (launch-particles (-> *part-id-table* 39) gp-1) + ) + ) + 0 + (none) + ) + +(defbehavior cam-master-effect camera-master () + (when (not (or (movie?) (>= (+ (current-time) (seconds -10)) (-> self water-drip-time)))) + (set! (-> *part-id-table* 24 init-specs 1 initial-valuef) (-> self water-drip-mult)) + (set! (-> *part-id-table* 23 init-specs 1 initial-valuef) (* 0.9 (-> self water-drip-mult))) + (set! (-> *part-id-table* 21 init-specs 11 initial-valuef) (* -2.7306666 (-> self water-drip-speed))) + (set! (-> *part-id-table* 22 init-specs 8 initial-valuef) (* -2.7306666 (-> self water-drip-speed))) + (set! (-> *part-id-table* 19 init-specs 11 initial-valuef) (* -2.7306666 (-> self water-drip-speed))) + (set! (-> *part-id-table* 20 init-specs 8 initial-valuef) (* -2.7306666 (-> self water-drip-speed))) + (spawn (-> self water-drip) *zero-vector*) + ) + 0 + (none) + ) +(defun sparticle-track-sun ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 matrix)) + (-> arg1 key) + (let* ((s2-0 (the int (-> arg1 user-float))) + (s5-0 (math-camera-pos)) + (s4-0 (the-as object (+ (the-as uint (-> *sky-work* upload-data)) (* (/ s2-0 4) 64)))) + ) + (let ((s3-0 *time-of-day*) + (v1-4 (-> *math-camera* inv-camera-rot)) + ) + (cond + ((= s2-0 1) + (set! (-> arg2 uvec z) (+ 8192.0 (* 0.5 (vector-y-angle (-> v1-4 fvec))))) + (set! (-> s3-0 0 sun-count) 1) + ) + ((= s2-0 4) + (set! (-> arg2 uvec z) (+ -8192.0 (* 0.5 (vector-y-angle (-> v1-4 fvec))))) + (+! (-> s3-0 0 green-sun-count) 1) + ) + ((= s2-0 8) + (set! (-> arg2 uvec z) (+ -8192.0 (* 0.5 (vector-y-angle (-> v1-4 fvec))))) + (+! (-> s3-0 0 moon-count) 1) + ) + ((= s2-0 12) + (set! (-> arg2 uvec z) (+ -8192.0 (* 0.5 (vector-y-angle (-> v1-4 fvec))))) + (+! (-> s3-0 0 day-star-count) 1) + (let ((f0-15 (* 6144000.0 (fmax 0.3 (fmin 1.0 (* 0.01 (-> *game-info* percent-complete))))))) + (set! (-> arg2 rvec w) f0-15) + (set! (-> arg2 uvec w) f0-15) + ) + ) + ((= s2-0 13) + (set! (-> arg2 uvec z) (+ -8192.0 (* 0.5 (vector-y-angle (-> v1-4 fvec))))) + (+! (-> s3-0 0 day-star-count) 1) + (let ((f0-20 (* 12288000.0 (fmax 0.3 (fmin 1.0 (* 0.01 (-> *game-info* percent-complete))))))) + (set! (-> arg2 rvec w) f0-20) + (set! (-> arg2 uvec w) f0-20) + ) + ) + ) + ) + (let ((s3-1 (new 'stack-no-clear 'vector))) + (set! (-> s3-1 quad) (-> (the-as vector s4-0) quad)) + (if (-> *time-of-day-context* use-camera-other) + (vector-matrix*! s3-1 s3-1 (-> *math-camera* camera-rot-other-sky)) + ) + (vector+float*! s3-1 s5-0 s3-1 4096.0) + (set! (-> arg2 rvec x) (-> s3-1 x)) + (set! (-> arg2 rvec y) (-> s3-1 y)) + (set! (-> arg2 rvec z) (-> s3-1 z)) + ) + ) + 0 + (none) + ) + +(defpartgroup group-sun + :id 3 + :flags (sp1) + :bounds (static-bspherem 0 0 0 70) + :parts ((sp-item 45 :flags (sp3 sp6)) (sp-item 46 :flags (sp3 sp6))) + ) + +(defpart 45 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:scale-x (meters 2550)) + (:rot-x (degrees 1687.5)) + (:rot-z (degrees 30)) + (:scale-y (meters 2550)) + (:r 64.0) + (:g 64.0) + (:b 16.0) + (:a 70.0) + (:omega (degrees 0)) + (:timer (seconds -0.005)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow)) + (:userdata 1.0) + (:func 'sparticle-track-sun) + ) + ) + +(defpart 46 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:scale-x (meters 12000)) + (:rot-x (degrees 1687.5)) + (:rot-z (degrees 30)) + (:scale-y (meters 12000)) + (:r 64.0) + (:g 32.0) + (:b 0.0) + (:a 80.0) + (:omega (degrees 0)) + (:timer (seconds -0.005)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow)) + (:userdata 1.0) + (:func 'sparticle-track-sun) + ) + ) + +(defpartgroup group-green-sun + :id 4 + :flags (sp1) + :bounds (static-bspherem 0 0 0 70) + :parts ((sp-item 47 :flags (sp3 sp6)) (sp-item 48 :flags (sp3 sp6))) + ) + +(defpart 47 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:scale-x (meters 1500)) + (:rot-x (degrees 1125)) + (:rot-z (degrees 30)) + (:scale-y (meters 1500)) + (:r 16.0) + (:g 64.0) + (:b 32.0) + (:a 64.0) + (:omega (degrees 0)) + (:timer (seconds -0.005)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow)) + (:userdata 4.0) + (:func 'sparticle-track-sun) + ) + ) + +(defpart 48 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:scale-x (meters 3000)) + (:rot-x (degrees 1125)) + (:rot-z (degrees 30)) + (:scale-y (meters 3000)) + (:r 0.0) + (:g 43.0) + (:b 8.0) + (:a 64.0) + (:omega (degrees 0)) + (:timer (seconds -0.005)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow)) + (:userdata 4.0) + (:func 'sparticle-track-sun) + ) + ) + +(defpartgroup group-moon + :id 5 + :flags (sp1) + :bounds (static-bspherem 0 0 0 70) + :parts ((sp-item 49 :flags (sp3 sp6))) + ) + +(defpart 49 + :init-specs ((:texture (glow-soft level-default-sprite)) + (:num 1.0) + (:scale-x (meters 6000)) + (:rot-x (degrees 2992.5)) + (:rot-z (degrees 30)) + (:scale-y (meters 6000)) + (:r 16.0) + (:g 32.0) + (:b 64.0) + (:a 64.0) + (:omega (degrees 0)) + (:timer (seconds -0.005)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow)) + (:userdata 8.0) + (:func 'sparticle-track-sun) + ) + ) + +(defpartgroup group-day-star + :id 6 + :flags (sp1) + :bounds (static-bspherem 0 0 0 70) + :parts ((sp-item 50 :flags (sp3 sp6)) (sp-item 51 :flags (sp3 sp6))) + ) + +(defpart 50 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:scale-x (meters 2000)) + (:rot-x (degrees 1125)) + (:rot-z (degrees 30)) + (:scale-y (meters 2000)) + (:r 128.0) + (:g 128.0) + (:b 128.0) + (:a 64.0) + (:omega (degrees 0)) + (:timer (seconds -0.005)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow)) + (:userdata 12.0) + (:func 'sparticle-track-sun) + ) + ) + +(defpart 51 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:scale-x (meters 5000)) + (:rot-x (degrees 1125)) + (:rot-z (degrees 30)) + (:scale-y (meters 5000)) + (:r 32.0) + (:g 0.0) + (:b 128.0) + (:a 64.0) + (:omega (degrees 0)) + (:timer (seconds -0.005)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow)) + (:userdata 13.0) + (:func 'sparticle-track-sun) + ) + ) diff --git a/goal_src/jak3/engine/gfx/sky/sky-data.gc b/goal_src/jak3/engine/gfx/sky/sky-data.gc index 328ae3b49e..f12e8ba570 100644 --- a/goal_src/jak3/engine/gfx/sky/sky-data.gc +++ b/goal_src/jak3/engine/gfx/sky/sky-data.gc @@ -7,3 +7,1100 @@ ;; DECOMP BEGINS +(define *sky-work* + (new 'static 'sky-work + :adgif-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x1000000000008005 #xe) + ) + :draw-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x502b400000008001 #x42421) + ) + :draw-tmpl2 (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x50ab400000008001 #x43431) + ) + :fog-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #xa :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x902a400000008001 #x424242421) + ) + :blend-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x50ab400000008001 #x43431) + ) + :sprite-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x3 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x3 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x2003400000008001 #x55) + ) + :sprite-tmpl2 (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x21 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x21 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x2003400000008010 #x55) + ) + :sun-coords (new 'static 'inline-array vector 2 + (new 'static 'vector :x -267.0 :y -267.0 :w 1.0) + (new 'static 'vector :x 267.0 :y 267.0) + ) + :green-coords (new 'static 'inline-array vector 2 + (new 'static 'vector :x -126.0 :y -126.0 :w 1.0) + (new 'static 'vector :x 126.0 :y 126.0) + ) + :moon0-coords (new 'static 'inline-array vector 2 + (new 'static 'vector :x -357.0 :y -357.0) + (new 'static 'vector :x 357.0 :y 357.0) + ) + :moon1-coords (new 'static 'inline-array vector 2 + (new 'static 'vector :x -1207.0 :y -1207.0 :w 1.0) + (new 'static 'vector :x 1207.0 :y 1207.0) + ) + :moon2-coords (new 'static 'inline-array vector 2 + (new 'static 'vector :x -232.0 :y -232.0) + (new 'static 'vector :x 232.0 :y 232.0) + ) + :day-star-coords (new 'static 'inline-array vector 2 + (new 'static 'vector :x -126.0 :y -126.0 :w 1.0) + (new 'static 'vector :x 126.0 :y 126.0) + ) + :star-coords (new 'static 'inline-array vector 2 (new 'static 'vector :x -1.5 :y -1.5) (new 'static 'vector :x 1.5 :y 1.5)) + :sun-colors (new 'static 'inline-array vector4w 2 + (new 'static 'vector4w :x #xff :y 64 :w 64) + (new 'static 'vector4w :x #xff :y #xff :z #x80 :w 64) + ) + :green-colors (new 'static 'inline-array vector4w 2 + (new 'static 'vector4w :y #xc4 :w #x80) + (new 'static 'vector4w :x #xc4 :y #xff :z #xff :w #x80) + ) + :moon-colors (new 'static 'inline-array vector4w 3 + (new 'static 'vector4w :x 16 :y 32 :z 64 :w 96) + (new 'static 'vector4w :x 16 :y 32 :z 64 :w 64) + (new 'static 'vector4w :x 80 :y 80 :z 80 :w #x80) + ) + :day-star-colors (new 'static 'inline-array vector4w 3 + (new 'static 'vector4w :z #xc4 :w #x80) + (new 'static 'vector4w :x #xc4 :y #xff :z #xff :w #x80) + (new 'static 'vector4w) + ) + :st-coords (new 'static 'inline-array vector 2 (new 'static 'vector :z 1.0) (new 'static 'vector :x 1.0 :y 1.0 :z 1.0)) + :random (new 'static 'inline-array vector4w 8 + (new 'static 'vector4w :x #x181920 :y #x141516 :z #x101112 :w #x234567) + (new 'static 'vector4w :x #x878237 :y #x48778 :z #x489197 :w #x893830) + (new 'static 'vector4w :x #x24762 :y #x289278 :z #x724781 :w #x712983) + (new 'static 'vector4w :x #x176128 :y #x387487 :z #x780983 :w #x723176) + (new 'static 'vector4w :x #x987239 :y #x699872 :z #x987165 :w #x982397) + (new 'static 'vector4w :x #x723897 :y #x238723 :z #x987293 :w #x102981) + (new 'static 'vector4w :x #x387528 :y #x723099 :z #x140983 :w #x874310) + (new 'static 'vector4w :x #x2387 :y #x129818 :z #x219810 :w #x623790) + ) + :giftag-base (new 'static 'dma-gif :gif (new 'static 'array uint64 2 #x3002c00000008001 #x412)) + :giftag-haze (new 'static 'dma-gif :gif (new 'static 'array uint64 2 #x3026c00000008001 #x412)) + :giftag-roof (new 'static 'dma-gif :gif (new 'static 'array uint64 2 #x302ec00000008001 #x412)) + :giftag-ocean (new 'static 'dma-gif :gif (new 'static 'array uint64 2 #x301ec00000008001 #x412)) + :draw-vortex #f + :day-star-scale 1.0 + :disable-day-star #f + ) + ) + +(define sky-base-polygons (new 'static 'inline-array sky-vertex 12 + (new 'static 'sky-vertex :pos (new 'static 'vector :z -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :x 40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :y -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :x 40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :z 40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :y -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :z 40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :x -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :y -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :x -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :z -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :y -40960000.0)) + ) + ) + +(define sky-roof-polygons (new 'static 'inline-array sky-vertex 12 + (new 'static 'sky-vertex :pos (new 'static 'vector :z -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :x 40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :y 10240000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :x 40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :z 40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :y 10240000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :z 40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :x -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :y 10240000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :x -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :z -40960000.0)) + (new 'static 'sky-vertex :pos (new 'static 'vector :y 10240000.0)) + ) + ) + +(define *cloud-vert-array* (new 'static 'cloud-vert-array)) + +(define *cloud-poly* (new 'static 'inline-array sky-vertex 648 + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + ) + ) + +(defun init-cloud-vert-array () + (let ((gp-0 *cloud-vert-array*)) + (dotimes (s5-0 10) + (dotimes (s4-0 10) + (let ((s3-0 (-> gp-0 data (+ (* 10 s5-0) s4-0)))) + (set! (-> s3-0 pos x) (* 2.0 (+ -4.5 (the float s4-0)))) + (set! (-> s3-0 pos z) (* 2.0 (+ -4.5 (the float s5-0)))) + (set! (-> s3-0 pos y) + (fmin (cos (* 182.04445 (* 10.0 (-> s3-0 pos x)))) (cos (* 182.04445 (* 10.0 (-> s3-0 pos z))))) + ) + (set-vector! (-> s3-0 stq) (* 0.25 (the float (+ s4-0 -4))) (* 0.25 (the float (+ s5-0 -4))) 1.0 1.0) + (set! (-> s3-0 nrm quad) (-> s3-0 pos quad)) + (+! (-> s3-0 nrm y) 1.0) + (vector-normalize! (-> s3-0 nrm) 1.0) + (vector-negate! (-> s3-0 nrm2) (-> s3-0 nrm)) + (cond + ((or (zero? s5-0) (= s5-0 9) (zero? s4-0) (= s4-0 9)) + (set! (-> s3-0 col w) 0.0) + (set! (-> s3-0 col2 w) 0.0) + ) + ((or (= s5-0 1) (= s5-0 8) (= s4-0 1) (= s4-0 8)) + (set! (-> s3-0 col w) 48.0) + (set! (-> s3-0 col2 w) 48.0) + ) + (else + (set! (-> s3-0 col w) 128.0) + (set! (-> s3-0 col2 w) 128.0) + ) + ) + ) + ) + ) + ) + #f + ) + +(init-cloud-vert-array) + +(define *haze-vert-array* (new 'static 'haze-vert-array)) + +(define *haze-poly* (new 'static 'inline-array sky-vertex 144 + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + ) + ) + +(defun init-haze-vert-array () + (let ((gp-0 *haze-vert-array*)) + (dotimes (s5-0 36) + (let ((s4-0 (-> gp-0 data s5-0))) + (set! (-> s4-0 pos x) (* 9.0 (sin (* 182.04445 (* 10.0 (the float s5-0)))))) + (set! (-> s4-0 pos z) (* 9.0 (cos (* 182.04445 (* 10.0 (the float s5-0)))))) + (set! (-> s4-0 pos y) 0.0) + (set! (-> s4-0 nrm quad) (-> s4-0 pos quad)) + (+! (-> s4-0 nrm y) 1.0) + (vector-normalize! (-> s4-0 nrm) 1.0) + ) + ) + ) + #f + ) + +(init-haze-vert-array) + +(defmethod init-sun-data! ((this sky-work) (arg0 int) (arg1 float) (arg2 float) (arg3 float)) + (let ((v1-0 (logand arg0 1))) + (set! (-> this upload-data sun v1-0 r-sun) arg1) + (set! (-> this upload-data sun v1-0 r-halo) arg2) + (set! (-> this upload-data sun v1-0 r-aurora) arg3) + ) + 0 + (none) + ) + +(defmethod init-orbit-settings! ((this sky-work) (arg0 int) (arg1 float) (arg2 float) (arg3 float) (arg4 float) (arg5 float) (arg6 float)) + (set! (-> this orbit arg0 high-noon) arg1) + (set! (-> this orbit arg0 tilt) (* 0.017453292 arg2)) + (set! (-> this orbit arg0 rise) (* 0.017453292 arg3)) + (set! (-> this orbit arg0 dist) arg4) + (set! (-> this orbit arg0 min-halo) arg5) + (set! (-> this orbit arg0 max-halo) arg6) + 0 + (none) + ) + +(defun sky-make-sun-data ((arg0 sky-work) (arg1 int) (arg2 float)) + (let* ((s4-0 (-> arg0 orbit arg1)) + (s3-0 (the-as sky-sun-data (+ (the-as uint (-> arg0 upload-data)) (* arg1 64)))) + (f0-1 (- arg2 (-> s4-0 high-noon))) + (f30-0 (* 2730.6667 f0-1)) + (f28-0 (* (sin f30-0) (-> s4-0 dist))) + (f30-1 (cos f30-0)) + ) + (let* ((f24-0 (* f30-1 (-> s4-0 dist))) + (f26-0 (* f24-0 (cos-rad (-> s4-0 tilt)))) + (f24-1 (* f24-0 (sin-rad (-> s4-0 tilt)))) + (f22-0 (sin-rad (-> s4-0 rise))) + (f0-10 (cos-rad (-> s4-0 rise))) + ) + (set! (-> s3-0 pos z) (- (+ (* f28-0 f0-10) (* f24-1 f22-0)))) + (set! (-> s3-0 pos y) f26-0) + (set! (-> s3-0 pos x) (- (* f24-1 f0-10) (* f28-0 f22-0))) + ) + (let ((f0-14 (if (< f30-1 0.0) + 0.0 + f30-1 + ) + ) + ) + (set! (-> arg0 upload-data sun arg1 r-aurora) + (+ (* (-> s4-0 min-halo) (- 1.0 f0-14)) (* (-> s4-0 max-halo) f0-14)) + ) + ) + ) + 0 + (none) + ) + +(defun sky-make-moon-data ((arg0 sky-work) (arg1 float)) + (let* ((s5-0 (-> arg0 orbit 2)) + (gp-0 (-> arg0 upload-data moon)) + (f0-1 (- arg1 (-> s5-0 high-noon))) + (f28-0 (* 2730.6667 f0-1)) + (f30-0 (* (sin f28-0) (-> s5-0 dist))) + (f26-0 (* (cos f28-0) (-> s5-0 dist))) + (f28-1 (* f26-0 (cos-rad (-> s5-0 tilt)))) + (f26-1 (* f26-0 (sin-rad (-> s5-0 tilt)))) + (f24-0 (sin-rad (-> s5-0 rise))) + (f0-10 (cos-rad (-> s5-0 rise))) + ) + (set! (-> gp-0 pos z) (- (+ (* f30-0 f0-10) (* f26-1 f24-0)))) + (set! (-> gp-0 pos y) f28-1) + (set! (-> gp-0 pos x) (- (* f26-1 f0-10) (* f30-0 f24-0))) + ) + 0 + (none) + ) + +(init-sun-data! *sky-work* 0 60.0 200.0 300.0) + +(init-sun-data! *sky-work* 1 15.0 20.0 300.0) + +(init-orbit-settings! *sky-work* 0 12.5 -20.0 90.0 9950.0 300.0 300.0) + +(init-orbit-settings! *sky-work* 1 4.0 0.0 90.0 9950.0 300.0 300.0) + +(init-orbit-settings! *sky-work* 2 0.5 -40.0 90.0 9950.0 300.0 300.0) + +(let ((v0-9 (-> *sky-work* upload-data day-star))) + (set! (-> v0-9 pos x) 0.0) + (set! (-> v0-9 pos y) 2000.0) + (set! (-> v0-9 pos z) -9000.0) + (set! (-> v0-9 pos w) 1.0) + ) diff --git a/goal_src/jak3/engine/gfx/sky/sky-h.gc b/goal_src/jak3/engine/gfx/sky/sky-h.gc index cdb846fc7a..417817391c 100644 --- a/goal_src/jak3/engine/gfx/sky/sky-h.gc +++ b/goal_src/jak3/engine/gfx/sky/sky-h.gc @@ -194,9 +194,9 @@ (disable-day-star basic) ) (:methods - (sky-work-method-9 () none) - (sky-work-method-10 () none) - (sky-work-method-11 () none) + (init-sun-data! (_type_ int float float float) none) + (init-orbit-settings! (_type_ int float float float float float float) none) + (update-colors-for-time (_type_ float) none) (update-time-and-speed (_type_ float float) none) (sky-work-method-13 () none) (draw (_type_) none) diff --git a/goal_src/jak3/engine/gfx/sky/sky-tng.gc b/goal_src/jak3/engine/gfx/sky/sky-tng.gc index e46894d876..dcc7eb0aef 100644 --- a/goal_src/jak3/engine/gfx/sky/sky-tng.gc +++ b/goal_src/jak3/engine/gfx/sky/sky-tng.gc @@ -7,3 +7,59 @@ ;; DECOMP BEGINS +(defmethod update-time-and-speed ((this sky-work) (arg0 float) (arg1 float)) + (if (and (level-get-target-inside *level*) (= (-> (level-get-target-inside *level*) info taskname) 'nest)) + (set! arg1 (* 10.0 arg1)) + ) + (sky-make-sun-data this 0 arg0) + (sky-make-sun-data this 1 arg0) + (sky-make-moon-data this arg0) + (+! (-> this off-s) (the int (* -8.0 arg1))) + (+! (-> this off-t) (the int (* 2.0 arg1))) + (set! (-> this time) arg0) + 0 + (none) + ) + +(defmethod update-colors-for-time ((this sky-work) (arg0 float)) + 0 + 0 + 0.0 + (let ((s5-0 *no-cloud-mood-color-table*)) + (let ((s3-0 (-> *level* level-default mood-context)) + (s4-0 (new 'stack-no-clear 'vector)) + ) + (let* ((v1-3 (the int arg0)) + (f0-4 (- arg0 (the float v1-3))) + (f1-3 (- 1.0 f0-4)) + (a0-4 (/ v1-3 24)) + (a1-2 (-> *mood-interp-table* hour (- v1-3 (* 24 a0-4)))) + (a0-7 (-> a1-2 snapshot1)) + (v1-7 (-> a1-2 snapshot2)) + (f0-6 (+ (* f1-3 (-> a1-2 morph-start)) (* f0-4 (-> a1-2 morph-end)))) + ) + (cond + ((= a0-7 v1-7) + (set! (-> this sun0-color quad) (-> s5-0 data a0-7 lgt-color quad)) + ) + (else + (let ((a1-5 (-> s5-0 data a0-7)) + (v1-11 (-> s5-0 data v1-7)) + ) + (vector4-lerp! (-> this sun0-color) (-> a1-5 lgt-color) (-> v1-11 lgt-color) f0-6) + ) + ) + ) + ) + (set! (-> this sun0-color-lower quad) (-> s3-0 times 1 quad)) + (set! (-> this ambi-color-lower quad) (-> s3-0 times 0 quad)) + (set-vector! s4-0 1.9921875 1.9921875 1.9921875 1.0) + (vector4-lerp! (-> this ambi-color) (-> this ambi-color-lower) s4-0 (-> *mood-control* lightning-flash)) + ) + (set! (-> this sun0-color quad) (-> this sun0-color quad)) + (set! (-> this sun1-color quad) (-> s5-0 data 7 lgt-color quad)) + (set! (-> this moon-color quad) (-> s5-0 data 6 lgt-color quad)) + ) + 0 + (none) + ) diff --git a/goal_src/jak3/engine/gfx/texture/texture-anim-tables.gc b/goal_src/jak3/engine/gfx/texture/texture-anim-tables.gc index 6d8f060098..90ddd50802 100644 --- a/goal_src/jak3/engine/gfx/texture/texture-anim-tables.gc +++ b/goal_src/jak3/engine/gfx/texture/texture-anim-tables.gc @@ -16,5 +16,13 @@ ;; DECOMP BEGINS (defun set-darkjak-texture-morph! ((arg0 float)) + (none) + ) + +(defun set-fog-height! ((arg0 float)) + (none) + ) + +(defun set-cloud-minmax! ((arg0 float) (arg1 float)) (none) ) \ No newline at end of file diff --git a/goal_src/jak3/engine/level/bsp-h.gc b/goal_src/jak3/engine/level/bsp-h.gc index e36f313879..50db2ad152 100644 --- a/goal_src/jak3/engine/level/bsp-h.gc +++ b/goal_src/jak3/engine/level/bsp-h.gc @@ -66,6 +66,7 @@ This probably started as a very simple structure, but now it is extremely compli (cam-outside-bsp uint8 :offset 152) (cam-using-back uint8) (cam-box-idx uint16) + (ambients symbol) (subdivide-close float :offset 160) (subdivide-far float) (race-meshes (array entity-race-mesh)) diff --git a/goal_src/jak3/engine/physics/cloth.gc b/goal_src/jak3/engine/physics/cloth.gc index 82b703bac2..c826529d78 100644 --- a/goal_src/jak3/engine/physics/cloth.gc +++ b/goal_src/jak3/engine/physics/cloth.gc @@ -7,3 +7,10 @@ ;; DECOMP BEGINS +(defmethod cloth-base-method-10 ((this cloth-base) (a cloth-params) (b handle)) + (format 0 "unimplemented cloth-base-method-10~%") + 0) + +(defmethod init! ((this cloth-base)) + ;; this looks more like run! than init to me. + 0) \ No newline at end of file diff --git a/goal_src/jak3/engine/target/gun/gun-red-shot.gc b/goal_src/jak3/engine/target/gun/gun-red-shot.gc index db30608193..87569238b8 100644 --- a/goal_src/jak3/engine/target/gun/gun-red-shot.gc +++ b/goal_src/jak3/engine/target/gun/gun-red-shot.gc @@ -107,7 +107,8 @@ ) (defmethod projectile-method-40 ((this gun-red-3-grenade)) - 256 + ;; og:preserve-this increased stack size from 256 + 512 ) (defmethod init-proj-settings! ((this gun-red-3-grenade)) diff --git a/goal_src/jak3/engine/target/logic-target.gc b/goal_src/jak3/engine/target/logic-target.gc index f88f12766e..5074108f82 100644 --- a/goal_src/jak3/engine/target/logic-target.gc +++ b/goal_src/jak3/engine/target/logic-target.gc @@ -3231,7 +3231,7 @@ (if (and *debug-segment* (!= (-> this tobot?) 'tobot)) (add-connection *debug-engine* this target-print-stats this *stdcon0* #f) ) - ;; (activate-hud this) + (activate-hud this) (set! (-> this fp-hud) (the-as handle #f)) (set! (-> this burn-proc) (the-as handle #f)) (set! (-> this water) (new 'process 'water-control this 10 0.0 8192.0 2048.0)) diff --git a/goal_src/jak3/engine/ui/hud-classes.gc b/goal_src/jak3/engine/ui/hud-classes.gc index 877fae6072..af430ad166 100644 --- a/goal_src/jak3/engine/ui/hud-classes.gc +++ b/goal_src/jak3/engine/ui/hud-classes.gc @@ -71,7 +71,7 @@ (defmethod update-values! ((this hud-map)) (cond - ((update! *minimap*) + ((and (nonzero? *minimap*) (update! *minimap*)) (logior! (-> this flags) (hud-flags show)) (let ((t9-1 (method-of-type hud update-values!))) (t9-1 this) @@ -110,7 +110,7 @@ (set! (-> this sprites 1 flags) (hud-sprite-flags hsf2)) (set! (-> this sprites 1 pos z) #xffff00) (set! (-> this values 0 current) 0) - (update! *minimap*) + (if (nonzero? *minimap*) (update! *minimap*)) 0 (none) ) diff --git a/goal_src/jak3/engine/ui/progress/progress.gc b/goal_src/jak3/engine/ui/progress/progress.gc index 3d1f019c02..c87194a928 100644 --- a/goal_src/jak3/engine/ui/progress/progress.gc +++ b/goal_src/jak3/engine/ui/progress/progress.gc @@ -453,7 +453,9 @@ (process-spawn hud-ring-cell 11 (* -1.0 f30-0) 9 :name "hud-ring-cell" :to self) ) (clear *stdcon1*) - (enable-drawing *bigmap*) + (if (nonzero? *bigmap*) + (enable-drawing *bigmap*) + ) (set-setting! 'scanlines 'abs 0.0 0) (go-virtual come-in) ) diff --git a/goal_src/jak3/kernel/gstate.gc b/goal_src/jak3/kernel/gstate.gc index 5a4331ccae..9d41f23351 100644 --- a/goal_src/jak3/kernel/gstate.gc +++ b/goal_src/jak3/kernel/gstate.gc @@ -193,7 +193,10 @@ ) ) (virtual - `(define-virtual-state-hook ,state-name ,defstate-type ,new-state ,(eq? virtual 'override) :event ,event :enter ,enter :trans ,trans :exit ,exit :code ,code :post ,post) + `(begin + (set! (-> ,new-state parent) #f) + (define-virtual-state-hook ,state-name ,defstate-type ,new-state ,(eq? virtual 'override) :event ,event :enter ,enter :trans ,trans :exit ,exit :code ,code :post ,post) + ) ) (parent `(begin diff --git a/test/decompiler/reference/jak3/engine/gfx/foreground/foreground_REF.gc b/test/decompiler/reference/jak3/engine/gfx/foreground/foreground_REF.gc index 5bd4403f01..23be954864 100644 --- a/test/decompiler/reference/jak3/engine/gfx/foreground/foreground_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/foreground/foreground_REF.gc @@ -1513,7 +1513,173 @@ ) ;; definition for function foreground-draw-hud -;; ERROR: function was not converted to expressions. Cannot decompile. +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +;; ERROR: Unsupported inline assembly instruction kind - [lui at, 28672] +(defun foreground-draw-hud ((arg0 draw-control) (arg1 dma-buffer) (arg2 float)) + (local-vars (at-0 int) (a0-2 (pointer uint128)) (t2-8 object) (t3-3 uint) (t3-4 uint) (t3-5 uint) (t3-6 uint)) + (.lui at-0 28672) + (let* ((a2-1 (-> arg1 base)) + (v1-0 (the-as object (&+ a2-1 64))) + ) + (let ((a3-0 (logand (the-as int v1-0) 48))) + (b! (zero? a3-0) cfg-2 :delay (nop!)) + (set! v1-0 (&- (&+ (the-as pointer v1-0) 64) (the-as uint a3-0))) + ) + (label cfg-2) + (let* ((t1-0 (+ (-> arg0 mgeo length) 3)) + (a3-3 (* t1-0 128)) + ) + (let ((t0-1 (-> (the-as foreground-work #x70000000) regs))) + (set! (-> t0-1 joint-ptr) (the-as (inline-array joint) (-> arg0 jgeo data 0))) + (set! (-> t0-1 bone-ptr) (-> arg0 skeleton bones)) + (set! (-> t0-1 num-bones) (the-as uint t1-0)) + (set! (-> t0-1 dist) 0.0) + (set! (-> t0-1 dma-buf) arg1) + (set! (-> t0-1 level-buckets) + (-> (the-as foreground-work #x70000000) + grid + level-buckets + (-> (the-as foreground-work #x70000000) draw-index-map (-> arg0 level-index)) + ) + ) + ) + (let ((t1-5 v1-0) + (t2-5 2) + (t5-0 (-> (the-as foreground-work #x70000000) regs)) + (a1-6 *bone-calculation-list*) + (t0-2 a2-1) + ) + (let ((t3-0 (-> t5-0 joint-ptr)) + (t4-0 (-> t5-0 bone-ptr)) + (t5-1 (-> t5-0 num-bones)) + (t6-0 t0-2) + ) + (set! (-> (the-as (pointer int16) t6-0)) t2-5) + (s.h! (+ t6-0 2) t5-1) + (s.w! (+ t6-0 4) t1-5) + (s.w! (+ t6-0 8) t3-0) + (s.w! (+ t6-0 12) t4-0) + (s.w! (+ t6-0 32) 0) + ) + (if (nonzero? (-> a1-6 next)) + (set! (-> a1-6 next next) (the-as bone-calculation t0-2)) + ) + (if (zero? (-> a1-6 first)) + (set! (-> a1-6 first) (the-as bone-calculation t0-2)) + ) + (set! (-> a1-6 next) (the-as bone-calculation t0-2)) + ) + (&+ a2-1 48) + (let ((a1-8 (the-as object (+ (the-as uint v1-0) a3-3)))) + (s.w! (+ at-0 36) v1-0) + (let ((v1-3 (-> *foreground* merc-bucket-info))) + (when (= (-> arg0 data-format) (draw-control-data-format merc)) + (let ((a2-4 (-> arg0 lod-set lod 0 geo)) + (a3-5 0) + ) + (b! #t cfg-22 :delay (nop!)) + (label cfg-8) + (b! (not (logtest? (-> a2-4 effect a3-5 effect-usage) 1)) cfg-17 :delay (nop!)) + (let* ((t1-13 (-> v1-3 light)) + (t2-7 (-> (the-as foreground-work #x70000000) lights)) + (t0-9 7) + (t1-14 (the-as object t1-13)) + ) + (b! (< (+ t0-9 -4) 0) cfg-11 :delay (set! t2-8 t2-7)) + (nop!) + (let ((t6-1 (-> (the-as (pointer uint128) t2-8) 0))) + (nop!) + (let ((t3-2 (-> (the-as (pointer uint128) t2-8) 1))) + (+! t0-9 -4) + (let ((t4-1 (-> (the-as (pointer uint128) t2-8) 2))) + (set! t1-14 (-> (the-as vu-lights t1-14) color 1)) + (let ((t5-2 (-> (the-as (pointer uint128) t2-8) 3))) + (set! t2-8 (&-> (the-as (pointer uint128) t2-8) 4)) + (set! (-> (the-as (pointer uint128) t1-14) -4) t6-1) + (let ((t6-2 (+ t0-9 -4))) + (set! (-> (the-as (pointer uint128) t1-14) -3) t3-2) + (nop!) + (set! (-> (the-as (pointer uint128) t1-14) -2) t4-1) + (b! (>= t6-2 0) cfg-10 :delay (set! (-> (the-as (pointer uint128) t1-14) -1) t5-2)) + ) + ) + ) + ) + ) + (label cfg-11) + (b! (zero? t0-9) cfg-16 :delay (set! t3-3 (the-as uint (-> (the-as (pointer uint128) t2-8) 0)))) + (let ((t2-9 (&-> (the-as (pointer uint128) t2-8) 1)) + (t1-15 (the-as object (&-> (the-as (pointer uint128) t1-14) 1))) + (t0-10 (+ t0-9 -1)) + ) + (s.q! (+ (the-as vu-lights t1-15) -16) t3-3) + (b! (zero? t0-10) cfg-16 :delay (set! t3-4 (the-as uint (-> t2-9 0)))) + (let ((t2-10 (&-> t2-9 1)) + (t1-16 (&-> (the-as (pointer uint128) t1-15) 1)) + (t0-11 (+ t0-10 -1)) + ) + (set! (-> t1-16 -1) (the-as uint128 t3-4)) + (b! (zero? t0-11) cfg-16 :delay (set! t3-5 (the-as uint (-> t2-10 0)))) + (let ((t2-11 (&-> t2-10 1)) + (t1-17 (&-> t1-16 1)) + (t0-12 (+ t0-11 -1)) + ) + (set! (-> t1-17 -1) (the-as uint128 t3-5)) + (b! (zero? t0-12) cfg-16 :delay (set! t3-6 (the-as uint (-> t2-11 0)))) + (&-> t2-11 1) + (let ((t1-18 (&-> t1-17 1))) + (+ t0-12 -1) + (set! (-> t1-18 -1) (the-as uint128 t3-6)) + ) + ) + ) + ) + ) + (label cfg-16) + 0 + (set! (-> v1-3 effect a3-5 color-fade) (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80)) + (set! (-> v1-3 effect a3-5 merc-path) (the-as uint 2)) + (b! #t cfg-18 :delay (nop!)) + (label cfg-17) + (set! (-> v1-3 effect a3-5 merc-path) (the-as uint 2)) + (label cfg-18) + (set! (-> v1-3 effect a3-5 disable-draw) (the-as uint 0)) + (set! (-> v1-3 effect a3-5 ignore-alpha) + (the-as uint (if (logtest? (-> a2-4 effect a3-5 effect-bits) (effect-bits ignore-alpha)) + 1 + 0 + ) + ) + ) + (+! a3-5 1) + (label cfg-22) + (b! (< a3-5 (the-as int (-> a2-4 header effect-count))) cfg-8) + ) + (if (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask generic)) + (set! a1-8 (foreground-generic-merc arg0 (the-as pointer a1-8) 1)) + ) + ) + ) + (let ((v1-11 (logand (the-as int a1-8) 48))) + 0 + (b! (zero? v1-11) cfg-27 :delay (set! a0-2 (the-as (pointer uint128) #x20000000))) + (s.q! a1-8 a0-2) + (let ((a0-3 a1-8)) + (set! a1-8 (+ (- (the-as int a1-8) (the-as uint v1-11)) 64)) + (s.w! (+ a0-3 4) (the-as int a1-8)) + ) + ) + (label cfg-27) + (set! (-> (the-as foreground-work #x70000000) regs dma-buf base) + (the-as pointer (logand a1-8 (the-as uint #xfffffff))) + ) + ) + ) + ) + 0 + (none) + ) ;; failed to figure out what this is: (kmemopen global "foreground-engine") diff --git a/test/decompiler/reference/jak3/engine/gfx/mood/mood-h_REF.gc b/test/decompiler/reference/jak3/engine/gfx/mood/mood-h_REF.gc index 92f8058c00..fc37b52184 100644 --- a/test/decompiler/reference/jak3/engine/gfx/mood/mood-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/mood/mood-h_REF.gc @@ -4,7 +4,7 @@ ;; definition of type mood-channel (deftype mood-channel (structure) ((data float 24) - (vecs vector4 6 :overlay-at (-> data 0)) + (vecs vector4 6 :inline :overlay-at (-> data 0)) ) ) @@ -71,7 +71,8 @@ ;; definition of type mood-fog-table (deftype mood-fog-table (structure) - ((data mood-fog 8 :inline) + ((data mood-fog 8 :inline) + (_data uint128 24 :overlay-at data) ) ) @@ -127,7 +128,8 @@ ;; definition of type mood-color-table (deftype mood-color-table (structure) - ((data mood-color 8 :inline) + ((data mood-color 8 :inline) + (_data uint128 16 :overlay-at data) ) ) @@ -308,6 +310,7 @@ ((time float) (fade float) ) + :pack-me ) ;; definition for method 3 of type light-state @@ -328,6 +331,7 @@ ((flicker-off uint8) (flicker-on uint8) ) + :allow-misaligned ) ;; definition for method 3 of type flicker-state @@ -434,6 +438,7 @@ (length uint8) (height uint8) ) + :pack-me ) ;; definition for method 3 of type flames-state @@ -528,6 +533,7 @@ (deftype mood-context (mood-context-core3) ((itimes vector4w 4 :inline) (state uint32 32) + (data uint128 123 :overlay-at (-> current-fog fog-color data 0)) ) ) @@ -624,22 +630,22 @@ (clouds mood-clouds 9) ) (:methods - (mood-control-method-9 () none) - (mood-control-method-10 () none) - (mood-control-method-11 () none) - (mood-control-method-12 () none) + (init-weather! (_type_) none) + (set-cloud-and-fog-interp! (_type_ float float float float) none) + (update-mood-range! (_type_ float float float float) none) + (set-time-for-random-weather! (_type_ float float) none) (set-special-interps! (_type_ float float symbol) none) (weather-event-concluded? (_type_) symbol) - (mood-control-method-15 () none) - (mood-control-method-16 () none) - (mood-control-method-17 () none) - (mood-control-method-18 () none) - (mood-control-method-19 () none) - (mood-control-method-20 () none) - (mood-control-method-21 () none) - (mood-control-method-22 () none) - (mood-control-method-23 () none) - (mood-control-method-24 () none) + (set-lightning-time! (_type_ int int float) none) + (apply-mood-clouds-and-fog (_type_ mood-control-work) none) + (apply-mood-fog (_type_ mood-control-work mood-color-table mood-color-table mood-color-table float) none) + (apply-fog-height (_type_ mood-control-work float float float float) none) + (apply-mood-colors (_type_ mood-control-work) none) + (mood-control-method-20 (_type_ mood-control-work mood-color-table mood-color-table mood-color-table float) none) + (apply-mood-channels (_type_ mood-control-work) none) + (adjust-num-clouds (_type_ mood-control-work) none) + (gen-lightning-and-thunder! (_type_ int) none) + (play-or-stop-lightning-sfx! (_type_ sound-spec vector) none) ) ) diff --git a/test/decompiler/reference/jak3/engine/gfx/mood/mood_REF.gc b/test/decompiler/reference/jak3/engine/gfx/mood/mood_REF.gc new file mode 100644 index 0000000000..cedee3bf59 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/gfx/mood/mood_REF.gc @@ -0,0 +1,1941 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for function palette-select-special +;; INFO: Used lq/sq +(defun palette-select-special ((arg0 mood-context-core3)) + (dotimes (v1-0 8) + (cond + ((logtest? (-> *time-of-day-context* mode) (ash 16 v1-0)) + (if (-> *time-of-day-context* overide-enable) + (set! (-> arg0 times v1-0 quad) (-> *time-of-day-context* times v1-0 quad)) + (set! (-> arg0 times v1-0 w) 1.0) + ) + ) + (else + (set! (-> arg0 times v1-0 w) 0.0) + ) + ) + ) + #f + ) + +;; definition for function clear-mood-times +(defun clear-mood-times ((mood-ctx mood-context)) + (dotimes (idx 8) + (set! (-> mood-ctx times idx w) 0.0) + ) + #f + ) + +;; definition for function update-mood-itimes +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defun update-mood-itimes ((arg0 mood-context)) + (local-vars + (v1-0 uint128) + (v1-1 uint128) + (v1-2 uint128) + (v1-3 uint128) + (a1-0 uint128) + (a1-1 uint128) + (a1-2 uint128) + (a1-3 uint128) + (a2-0 uint128) + (a2-1 uint128) + (a3-0 uint128) + (a3-1 uint128) + (t0-0 uint128) + (t0-1 uint128) + (t1-0 uint128) + (t1-1 uint128) + (t2-0 uint128) + (t2-1 uint128) + (t3-0 uint128) + (t3-1 uint128) + ) + (rlet ((vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + (vf8 :class vf) + ) + (nop!) + (nop!) + (.lvf vf1 (&-> arg0 times 0 quad)) + (nop!) + (.lvf vf2 (&-> arg0 times 1 quad)) + (.mul.w.vf vf1 vf1 vf1 :mask #b111) + (.lvf vf3 (&-> arg0 times 2 quad)) + (.mul.w.vf vf2 vf2 vf2 :mask #b111) + (.lvf vf4 (&-> arg0 times 3 quad)) + (.mul.w.vf vf3 vf3 vf3 :mask #b111) + (.lvf vf5 (&-> arg0 times 4 quad)) + (.mul.w.vf vf4 vf4 vf4 :mask #b111) + (.lvf vf6 (&-> arg0 times 5 quad)) + (.mul.w.vf vf5 vf5 vf5 :mask #b111) + (.lvf vf7 (&-> arg0 times 6 quad)) + (.mul.w.vf vf6 vf6 vf6 :mask #b111) + (.lvf vf8 (&-> arg0 times 7 quad)) + (.mul.w.vf vf7 vf7 vf7 :mask #b111) + (nop!) + (.mul.w.vf vf8 vf8 vf8 :mask #b111) + (nop!) + (vftoi12.xyzw vf1 vf1) + (nop!) + (vftoi12.xyzw vf2 vf2) + (nop!) + (vftoi12.xyzw vf3 vf3) + (nop!) + (vftoi12.xyzw vf4 vf4) + (nop!) + (vftoi12.xyzw vf5 vf5) + (nop!) + (vftoi12.xyzw vf6 vf6) + (nop!) + (vftoi12.xyzw vf7 vf7) + (nop!) + (vftoi12.xyzw vf8 vf8) + (nop!) + (.mov v1-0 vf1) + (nop!) + (.mov a1-0 vf2) + (nop!) + (.mov a2-0 vf3) + (.pw.sra v1-1 v1-0 6) + (.mov a3-0 vf4) + (.pw.sra a1-1 a1-0 6) + (.mov t0-0 vf5) + (.pw.sra a2-1 a2-0 6) + (.mov t1-0 vf6) + (.pw.sra a3-1 a3-0 6) + (.mov t2-0 vf7) + (.pw.sra t0-1 t0-0 6) + (.mov t3-0 vf8) + (.pw.sra t1-1 t1-0 6) + (.pw.sra t2-1 t2-0 6) + (nop!) + (.pw.sra t3-1 t3-0 6) + (nop!) + (.ppach v1-2 a1-1 v1-1) + (nop!) + (.ppach a1-2 a3-1 a2-1) + (set! (-> arg0 itimes 0 quad) v1-2) + (.ppach v1-3 t1-1 t0-1) + (set! (-> arg0 itimes 1 quad) a1-2) + (.ppach a1-3 t3-1 t2-1) + (set! (-> arg0 itimes 2 quad) v1-3) + (nop!) + (set! (-> arg0 itimes 3 quad) a1-3) + 0 + (none) + ) + ) + +;; definition for function update-mood-direction +;; INFO: Used lq/sq +;; ERROR: Expression building failed: In update-mood-direction: Failed to match non-power of two case: t3-14 +(defun update-mood-direction ((arg0 mood-context-core3) (arg1 mood-table) (arg2 float)) + (local-vars + (v0-0 pointer) + (v0-1 float) + (v1-0 mood-channel-group) + (v1-3 int) + (v1-4 float) + (v1-5 float) + (v1-6 float) + (v1-7 symbol) + (v1-8 symbol) + (v1-9 float) + (v1-12 float) + (v1-13 symbol) + (v1-14 symbol) + (v1-15 float) + (v1-17 float) + (v1-19 float) + (v1-20 symbol) + (v1-21 symbol) + (v1-22 float) + (v1-24 float) + (v1-26 light-group) + (v1-27 light-group) + (v1-28 light-group) + (v1-29 light-group) + (v1-30 light-group) + (v1-31 light-group) + (a0-1 light-group) + (a1-1 int) + (a1-2 float) + (a1-3 (inline-array light-group)) + (a2-1 mood-direction-table) + (a2-2 int) + (a3-0 int) + (t0-0 int) + (t0-1 int) + (t1-0 int) + (t2-0 light-group) + (t2-1 float) + (t2-2 int) + (t3-7 int) + (t3-8 int) + (t3-9 light) + (t3-10 int) + (t3-11 int) + (t3-12 int) + (t3-13 light-group) + (t3-14 int) + (t3-15 rgbaf) + (t3-16 int) + (t3-17 int) + (t3-18 int) + (t3-19 int) + (t4-5 int) + (t4-6 int) + (t4-7 light) + (t4-8 int) + (t4-9 int) + (t4-10 light) + (t4-11 int) + (t4-12 int) + (t4-13 int) + (t4-14 int) + (t4-15 vector) + (t4-16 uint128) + (t4-17 int) + (t4-18 int) + (t4-19 int) + (t4-20 int) + (t4-21 int) + (t4-22 vector) + (t4-23 uint128) + (t9-0 (function pointer pointer int pointer)) + (f0-0 float) + (f0-1 int) + (f0-2 float) + (f0-3 float) + (f0-4 float) + (f0-5 float) + (f1-0 int) + (f1-1 float) + (f1-2 float) + (f1-3 float) + (f1-4 float) + (f1-5 float) + (f1-6 float) + (f1-7 float) + (f1-8 float) + (f1-9 float) + (f1-10 float) + (f1-11 float) + (f1-12 float) + (f1-13 float) + (f2-0 float) + (f2-1 float) + (f2-2 float) + (f2-3 float) + (f2-6 float) + (f2-7 float) + (f2-8 float) + (f2-9 float) + (f2-10 float) + (f2-11 float) + (f2-12 float) + (f2-13 float) + (f2-14 float) + (f2-15 float) + (f2-16 float) + (f3-3 float) + (f3-4 float) + (f3-5 float) + (f3-6 float) + (f3-7 float) + (f3-8 float) + (f3-9 float) + (f3-10 float) + (sv-16 light-group) + ) + (cond + ((begin + (set! v1-0 (-> arg1 mood-channel-group)) + (set! a2-1 (-> arg1 mood-direction-table)) + (set! f0-0 arg2) + (set! f0-1 (the int arg2)) + (set! a3-0 (the int arg2)) + (set! a1-1 (+ a3-0 1)) + (set! t0-0 24) + (set! t0-1 (mod (+ a3-0 1) 24)) + (set! f0-2 arg2) + (set! f1-0 (gpr->fpr a3-0)) + (set! f1-1 (the float a3-0)) + (set! f0-3 (- arg2 (the float a3-0))) + (set! a1-2 1.0) + (set! f1-2 1.0) + (set! f1-3 (- 1.0 f0-3)) + (set! t1-0 0) + (set! a1-3 (-> arg0 light-group)) + (set! t2-0 (-> arg0 light-group 1)) + (set! sv-16 t2-0) + (set! t2-1 1.0) + (set! f2-0 1.0) + (set! (-> a1-3 0 ambi extra x) f2-0) + (set! f2-1 0.0) + (set! (-> a1-3 0 dir0 extra x) f2-1) + (set! f2-2 0.0) + (set! (-> a1-3 0 dir1 extra x) f2-2) + (set! f2-3 0.0) + (set! (-> a1-3 0 dir2 extra x) f2-3) + (set! t2-2 0) + (while (<.si t2-2 4) + (when (!= f2-6 0.0) + (set! t3-7 48) + (set! t3-8 (* 48 t1-0)) + (set! t3-9 (-> a1-3 0 lights t1-0)) + (set! (-> a1-3 0 lights t1-0 extra x) f2-6) + (set! t3-10 2) + (set! t3-11 (ash 2 t2-2)) + (set! t4-5 48) + (set! t4-6 (* 48 t1-0)) + (set! t4-7 (-> a1-3 0 lights t1-0)) + (set! (-> a1-3 0 lights t1-0 mask) (the-as uint t3-11)) + (set! t3-12 (+ t2-2 1)) + (set! t4-8 48) + (set! t4-9 (* 48 t1-0)) + (set! t4-10 (-> a1-3 0 lights t1-0)) + (set! (-> a1-3 0 lights t1-0 palette-index) t3-12) + (set! t3-13 (-> a1-3 0)) + (set! t4-11 48) + (set! t4-12 (* 48 t1-0)) + (set! t3-14 (+ (the-as uint (-> a1-3 0)) (* 48 t1-0))) + (set! t4-13 (* t2-2 16)) + (set! t4-14 (+ (* t2-2 16) 0)) + (set! t4-15 (-> a2-1 data t2-2)) + (set! t4-16 (-> a2-1 data t2-2 quad)) + (set! (dynamic-array-field-access t3-14 lights PLACEHOLDER direction quad) t4-16) + (set! t3-15 (-> a1-3 0 dir0 color)) + (set! t4-17 48) + (set! t4-18 (*.si t4-17 t1-0)) + (set! t3-16 (+ t3-15 t4-18)) + (set! t4-19 (+ t2-2 1)) + (set! t4-20 (sll t4-19 4)) + (set! t4-21 (+ t4-20 1648)) + (set! t4-22 (+ t4-21 arg0)) + (set! t4-23 (-> t4-22 quad)) + (set! (the-as (pointer uint128) (-> (the-as (pointer uint128) t3-16))) t4-23) + (set! t3-17 (+ t2-2 1)) + (set! t3-18 (sll t3-17 4)) + (set! t3-19 (+ arg0 t3-18)) + (set! (dynamic-array-field-access t3-19 times PLACEHOLDER w) f2-6) + (set! t1-0 (+ t1-0 1)) + (set! t3-20 t1-0) + ) + (set! t2-2 (+ t2-2 1)) + ) + (set! v1-3 1) + (set! (-> a1-3 0 ambi mask) (the-as uint v1-3)) + (set! (-> a1-3 0 ambi palette-index) 0) + (set! t9-0 mem-copy!) + (set! a0-1 sv-16) + (set! a2-2 192) + (call! a0-1 a1-3 a2-2) + (set! v1-4 1.0) + (set! f0-4 (gpr->fpr v1-4)) + (set! v1-5 1.1) + (set! f1-4 (gpr->fpr v1-5)) + (set! v1-6 6.0) + (set! f2-7 (gpr->fpr v1-6)) + (set! f3-3 (gpr->fpr arg2)) + (set! v1-7 (>=.s f2-7 f3-3)) + (or v1-7 + (begin (set! f2-8 (gpr->fpr arg2)) (set! v1-9 18.0) (set! f3-4 (gpr->fpr v1-9)) (set! v1-8 (>=.s f2-8 f3-4))) + ) + v1-8 + ) + (set! f0-4 f1-4) + (set! v1-11 (fpr->gpr f0-4)) + ) + ((begin + (and (begin + (set! v1-12 6.0) + (set! f2-9 (gpr->fpr v1-12)) + (set! f3-5 (gpr->fpr arg2)) + (set! v1-13 (<.s f2-9 f3-5)) + v1-13 + ) + (begin + (set! f2-10 (gpr->fpr arg2)) + (set! v1-15 7.0) + (set! f3-6 (gpr->fpr v1-15)) + (set! v1-14 (<.s f2-10 f3-6)) + ) + ) + v1-14 + ) + (set! f1-5 (-.s f1-4 f0-4)) + (set! v1-17 7.0) + (set! f2-11 (gpr->fpr v1-17)) + (set! f3-7 (gpr->fpr arg2)) + (set! f2-12 (-.s f2-11 f3-7)) + (set! f1-6 (*.s f1-5 f2-12)) + (set! f0-4 (+.s f0-4 f1-6)) + (set! v1-18 (fpr->gpr f0-4)) + ) + ((begin + (and (begin + (set! v1-19 17.0) + (set! f2-13 (gpr->fpr v1-19)) + (set! f3-8 (gpr->fpr arg2)) + (set! v1-20 (<.s f2-13 f3-8)) + v1-20 + ) + (begin + (set! f2-14 (gpr->fpr arg2)) + (set! v1-22 18.0) + (set! f3-9 (gpr->fpr v1-22)) + (set! v1-21 (<.s f2-14 f3-9)) + ) + ) + v1-21 + ) + (set! f1-7 (-.s f1-4 f0-4)) + (set! v1-24 -17.0) + (set! f2-15 (gpr->fpr v1-24)) + (set! f3-10 (gpr->fpr arg2)) + (set! f2-16 (+.s f2-15 f3-10)) + (set! f1-8 (*.s f1-7 f2-16)) + (set! f0-4 (+.s f0-4 f1-8)) + (set! v1-25 (fpr->gpr f0-4)) + ) + ) + (set! v1-26 sv-16) + (set! f1-9 (-> v1-26 dir0 extra x)) + (set! f1-10 (*.s f1-9 f0-4)) + (set! v1-27 sv-16) + (set! (-> v1-27 dir0 extra x) f1-10) + (set! v1-28 sv-16) + (set! f1-11 (-> v1-28 dir1 extra x)) + (set! f1-12 (*.s f1-11 f0-4)) + (set! v1-29 sv-16) + (set! (-> v1-29 dir1 extra x) f1-12) + (set! v1-30 sv-16) + (set! f1-13 (-> v1-30 dir2 extra x)) + (set! f0-5 (*.s f1-13 f0-4)) + (set! v1-31 sv-16) + (set! (-> v1-31 dir2 extra x) f0-5) + (set! v0-1 (fpr->gpr f0-5)) + (ret-value v0-1) + ) + +;; definition for function update-mood-exterior +;; INFO: Used lq/sq +(defun update-mood-exterior ((arg0 mood-context-core3) (arg1 mood-table) (arg2 float) (arg3 int)) + (local-vars (v0-1 object) (sv-32 mood-color) (sv-48 mood-color) (sv-64 vector)) + (cond + ((< (the-as uint 8) (the-as uint (-> *time-of-day-context* mode))) + (palette-select-special arg0) + ) + (else + 0 + 0 + 0.0 + (let* ((v1-3 (the int arg2)) + (f0-4 (- arg2 (the float v1-3))) + (f1-3 (- 1.0 f0-4)) + (a0-6 (/ v1-3 24)) + (v1-7 (-> arg1 mood-interp-table hour (- v1-3 (* 24 a0-6)))) + (s3-0 (-> v1-7 snapshot1)) + (s2-0 (-> v1-7 snapshot2)) + (f30-0 (+ (* f1-3 (-> v1-7 morph-start)) (* f0-4 (-> v1-7 morph-end)))) + ) + (set! v0-1 + (cond + ((and (-> *level* level arg3 bsp) + (nonzero? (-> *level* level arg3 bsp)) + (not (-> *level* level arg3 bsp ambients)) + ) + (set! v0-1 (-> arg0 times)) + (set! (-> (the-as (inline-array vector) v0-1) 0 x) 1.0) + (set! (-> (the-as (inline-array vector) v0-1) 0 y) 1.0) + (set! (-> (the-as (inline-array vector) v0-1) 0 z) 1.0) + (set! (-> (the-as (inline-array vector) v0-1) 0 w) 1.0) + v0-1 + ) + ((= s3-0 s2-0) + (let ((a2-1 (-> arg1 mood-color-table data s3-0)) + (v1-26 (-> arg0 times)) + (a1-2 (-> arg0 times 1)) + (a0-16 (-> arg0 light-group)) + ) + (set! (-> v1-26 0 quad) (-> a2-1 amb-color quad)) + (set! (-> a1-2 quad) (-> a2-1 lgt-color quad)) + (set! (-> arg0 times 2 quad) (-> a1-2 quad)) + (set! (-> arg0 times 3 quad) (-> a1-2 quad)) + (set! (-> arg0 times 4 quad) (-> a1-2 quad)) + (set! (-> a0-16 0 ambi color quad) (-> v1-26 0 quad)) + ) + (set! (-> arg0 current-sky-color quad) (-> arg1 mood-sky-table data s3-0 quad)) + (mem-copy! (the-as pointer (-> arg0 current-fog)) (the-as pointer (-> arg1 mood-fog-table data s3-0)) 48) + ) + (else + (set! sv-32 (-> arg1 mood-color-table data s3-0)) + (set! sv-48 (-> arg1 mood-color-table data s2-0)) + (let ((s1-0 (-> arg0 times))) + (set! sv-64 (-> arg0 times 1)) + (let ((s0-0 (-> arg0 light-group))) + (vector4-lerp! (the-as vector s1-0) (-> sv-32 amb-color) (-> sv-48 amb-color) f30-0) + (vector4-lerp! sv-64 (-> sv-32 lgt-color) (-> sv-48 lgt-color) f30-0) + (set! (-> arg0 times 2 quad) (-> sv-64 quad)) + (set! (-> arg0 times 3 quad) (-> sv-64 quad)) + (set! (-> arg0 times 4 quad) (-> sv-64 quad)) + (set! (-> s0-0 0 ambi color quad) (-> s1-0 0 quad)) + ) + ) + (vector4-lerp! + (-> arg0 current-sky-color) + (-> arg1 mood-sky-table data s3-0) + (-> arg1 mood-sky-table data s2-0) + f30-0 + ) + (vector4-array-lerp! + (the-as (inline-array vector4) (-> arg0 current-fog)) + (the-as (inline-array vector4) (-> arg1 mood-fog-table data s3-0)) + (the-as (inline-array vector4) (-> arg1 mood-fog-table data s2-0)) + f30-0 + 3 + ) + ) + ) + ) + ) + (set-vector! (-> arg0 current-prt-color) 0.0 0.0 0.0 0.0) + (set-vector! (-> arg0 current-env-color) 0.0 0.0 0.0 0.0) + (let ((f0-18 (-> *mood-control* lightning-flash)) + (a0-36 (-> *mood-control* lightning-index)) + ) + (when (and (!= f0-18 0.0) (< a0-36 4)) + (let ((v1-64 (new 'stack-no-clear 'vector)) + (a0-40 (-> arg0 times (+ a0-36 1))) + ) + (set-vector! v1-64 f0-18 f0-18 f0-18 0.0) + (vector+! a0-40 a0-40 v1-64) + ) + ) + ) + (update-mood-direction arg0 arg1 arg2) + ) + ) + ) + +;; definition for function copy-mood-exterior +;; INFO: Used lq/sq +(defun copy-mood-exterior ((arg0 mood-context)) + (set! (-> *time-of-day-context* exterior-level) (the-as basic #t)) + (cond + ((< (the-as uint 8) (the-as uint (-> *time-of-day-context* mode))) + (palette-select-special arg0) + ) + (else + (let ((v1-2 (the-as object arg0)) + (a1-4 (the-as structure (-> *level* level-default mood-context))) + ) + (dotimes (a2-1 31) + (set! (-> (the-as (inline-array vector) v1-2) 0 quad) + (-> (the-as mood-context a1-4) current-fog fog-color quad) + ) + (set! v1-2 (-> (the-as (inline-array vector) v1-2) 1)) + (set! a1-4 (-> (the-as mood-context a1-4) current-fog fog-dists)) + ) + ) + (let ((v1-5 (the-as object (-> arg0 times))) + (a0-2 (the-as object (-> *level* level-default mood-context times))) + ) + (dotimes (a1-6 5) + (set! (-> (the-as (inline-array vector) v1-5) 0 quad) (-> (the-as (inline-array vector) a0-2) 0 quad)) + (set! v1-5 (-> (the-as (inline-array vector) v1-5) 1)) + (set! a0-2 (-> (the-as (inline-array vector) a0-2) 1)) + ) + ) + #f + ) + ) + ) + +;; definition for function copy-mood-exterior-ambi +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defun copy-mood-exterior-ambi ((arg0 mood-context) (arg1 symbol)) + (cond + ((< (the-as uint 8) (the-as uint (-> *time-of-day-context* mode))) + (palette-select-special arg0) + ) + (else + (let ((v1-1 (the-as structure arg0)) + (a2-3 (the-as structure (-> *level* level-default mood-context))) + ) + (dotimes (a3-1 31) + (set! (-> (the-as mood-context v1-1) current-fog fog-color quad) + (-> (the-as mood-context a2-3) current-fog fog-color quad) + ) + (set! v1-1 (-> (the-as mood-context v1-1) current-fog fog-dists)) + (set! a2-3 (-> (the-as mood-context a2-3) current-fog fog-dists)) + ) + ) + (set! (-> arg0 times 0 quad) (-> *level* level-default mood-context times 0 quad)) + (vector+! + (the-as vector (-> arg0 times)) + (the-as vector (-> arg0 times)) + (-> *level* level-default mood-context times 1) + ) + (when arg1 + (set! (-> arg0 times 1 quad) (-> *level* level-default mood-context times 1 quad)) + (set! (-> arg0 times 1 w) 1.0) + ) + ) + ) + (none) + ) + +;; definition for function clear-mood-context +;; INFO: Used lq/sq +(defun clear-mood-context ((arg0 mood-context)) + (let ((v1-0 arg0)) + (dotimes (a1-0 123) + (set! (-> v1-0 data a1-0) (the-as uint128 0)) + ) + ) + (dotimes (v1-3 8) + (set-vector! (-> arg0 times v1-3) 1.0 1.0 1.0 0.0) + ) + #f + ) + +;; definition for function update-mood-interior +;; INFO: Used lq/sq +(defun update-mood-interior ((arg0 mood-context) (arg1 symbol)) + (let ((v1-0 (-> arg0 light-group))) + (cond + (arg1 + (set! (-> arg0 current-fog fog-color quad) (-> *level* level-default mood-context current-fog fog-color quad)) + (set-vector! (-> arg0 current-fog fog-dists) 98304.0 3072000.0 255.0 150.0) + (set-vector! (-> arg0 current-fog erase-color) 0.0 0.0 0.0 128.0) + ) + (else + (let ((a1-4 (-> arg0 current-fog))) + (set! (-> a1-4 fog-color x) 150.0) + (set! (-> a1-4 fog-color y) 165.0) + (set! (-> a1-4 fog-color z) 220.0) + (set! (-> a1-4 fog-color w) 128.0) + ) + (set-vector! (-> arg0 current-fog fog-dists) 2048000.0 12288000.0 255.0 150.0) + (set-vector! (-> arg0 current-fog erase-color) 0.0 0.0 0.0 128.0) + ) + ) + (set-vector! (-> arg0 current-prt-color) 0.0 0.0 0.0 0.0) + (set-vector! (-> arg0 current-env-color) 96.0 96.0 96.0 128.0) + (set-vector! (-> arg0 current-sky-color) 0.0 0.0 0.0 1.0) + (let ((a0-2 (-> v1-0 0))) + (set! (-> a0-2 dir0 direction x) 0.0) + (set! (-> a0-2 dir0 direction y) 1.0) + (set! (-> a0-2 dir0 direction z) 0.0) + (set! (-> a0-2 dir0 direction w) 0.0) + ) + (set-vector! (-> v1-0 0 dir0 color) 0.667 0.667 0.667 1.0) + (set-vector! (-> v1-0 0 ambi color) 0.333 0.333 0.333 1.0) + (set! (-> v1-0 0 dir0 extra x) 1.0) + (set! (-> v1-0 0 dir1 extra x) 0.0) + (set! (-> v1-0 0 dir2 extra x) 0.0) + (set! (-> v1-0 0 ambi extra x) 1.0) + ) + ) + +;; definition for function update-mood-interior-ambient +;; INFO: Used lq/sq +(defun update-mood-interior-ambient ((arg0 mood-context) (arg1 symbol) (arg2 float)) + (update-mood-interior arg0 arg1) + (set! (-> arg0 times 0 quad) (-> *level* level-default mood-context times 0 quad)) + (vector+float*! + (the-as vector (-> arg0 times)) + (the-as vector (-> arg0 times)) + (-> *level* level-default mood-context times 1) + arg2 + ) + ) + +;; definition for function update-mood-flames +(defbehavior update-mood-flames time-of-day-proc ((arg0 mood-context) (arg1 int) (arg2 int) (arg3 int) (arg4 float) (arg5 float) (arg6 float)) + (let* ((gp-0 (the-as flames-state (+ (+ arg3 1840) (the-as int arg0)))) + (s4-0 (+ (-> gp-0 index) arg1)) + (f0-0 (-> gp-0 time)) + (v1-2 (-> gp-0 length)) + (s0-0 (-> gp-0 height)) + ) + (dotimes (a0-1 arg2) + (set! (-> arg0 times (+ arg1 a0-1) w) arg4) + ) + (cond + ((>= f0-0 (the float v1-2)) + (set! (-> gp-0 index) (the-as uint (the int (rand-vu-float-range 0.0 (+ -0.01 (the float arg2)))))) + (set! (-> gp-0 time) 0.0) + (set! (-> gp-0 length) (the-as uint (the int (* (rand-vu-float-range 7.0 15.0) arg6)))) + (set! (-> gp-0 height) (the-as uint (the int (rand-vu-float-range 0.0 255.0)))) + (set! (-> arg0 times s4-0 w) arg4) + ) + (else + (let ((f0-14 (sin (* 32768.0 (/ f0-0 (the float v1-2)))))) + (set! (-> arg0 times s4-0 w) (+ (* (the float s0-0) f0-14 arg5) arg4)) + ) + (if (not (paused?)) + (set! (-> gp-0 time) (+ (-> gp-0 time) (if (= (-> *display* bg-clock clock-ratio) 0.0) + 1.0 + (-> self clock time-adjust-ratio) + ) + ) + ) + ) + ) + ) + ) + ) + +;; definition for symbol *flash0*, type (array float) +(define *flash0* + (new 'static 'boxed-array :type float 1.0 0.0 0.5 1.0 0.5 0.0 0.5 0.35 0.4 0.35 0.25 0.1 0.04) + ) + +;; definition for symbol *flash1*, type (array float) +(define *flash1* (new 'static 'boxed-array :type float 1.0 0.8 0.0 1.0 0.5 1.0 0.4 0.2 0.1)) + +;; definition for symbol *flash2*, type (array float) +(define *flash2* (new 'static 'boxed-array :type float 1.0 0.9 0.8 0.7 0.0 0.0 1.0 0.0 1.0 0.5)) + +;; definition for symbol *flash3*, type (array float) +(define *flash3* (new 'static 'boxed-array :type float 0.5 0.0 1.0 0.9 1.0 0.8 0.3 0.0 0.0 0.5 0.1 0.5 0.35)) + +;; definition for symbol *flash4*, type (array float) +(define *flash4* + (new 'static 'boxed-array :type float 1.0 0.0 1.0 0.0 1.0 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.5 0.4 0.3 0.2 0.1) + ) + +;; definition for symbol *flash5*, type (array float) +(define *flash5* (new 'static 'boxed-array :type float + 1.0 + 0.0 + 1.0 + 0.0 + 1.0 + 0.95 + 0.9 + 0.85 + 0.8 + 0.75 + 0.7 + 0.65 + 0.6 + 0.55 + 0.5 + 0.45 + 0.4 + 0.35 + 0.3 + 0.25 + 0.2 + 0.5 + 0.45 + 0.4 + 0.35 + 0.3 + 0.25 + 0.2 + 0.15 + 0.1 + 0.05 + ) + ) + +;; definition for symbol *flash6*, type (array float) +(define *flash6* + (new 'static 'boxed-array :type float 1.0 0.0 1.0 0.0 0.5 0.0 0.5 0.35 0.0 0.0 1.0 0.0 0.2 0.1) + ) + +;; definition for symbol *flash7*, type (array float) +(define *flash7* + (new 'static 'boxed-array :type float 1.0 0.8 0.3 0.0 0.6 0.5 0.4 0.3 0.2 0.5 0.4 0.3 0.2 0.1) + ) + +;; definition for function update-mood-light +(defun update-mood-light ((arg0 mood-context) (arg1 int) (arg2 int) (arg3 float) (arg4 float) (arg5 float) (arg6 float) (arg7 float)) + (with-pp + (let* ((gp-0 (the-as light-state (+ (+ arg2 1840) (the-as int arg0)))) + (f0-0 512.0) + (f1-1 (+ (-> gp-0 time) arg6)) + (f26-0 (* f0-0 (- f1-1 (* (the float (the int (/ f1-1 256.0))) 256.0)))) + (f30-1 (+ (fabs arg3) (* (cos f26-0) arg4))) + (f28-0 (-> gp-0 fade)) + ) + (cond + ((or (>= arg5 18.0) (>= 6.0 arg5)) + (set! f28-0 (cond + ((< arg3 0.0) + (if (not (paused?)) + (set! f28-0 (seek f28-0 1.0 (* 2.0 (seconds-per-frame)))) + ) + f28-0 + ) + (else + 1.0 + ) + ) + ) + (set! (-> gp-0 fade) f28-0) + (set! (-> arg0 times arg1 w) (* f30-1 f28-0)) + (when (not (paused?)) + (let ((f0-10 (-> gp-0 time))) + (set! arg7 (cond + ((= (-> *display* bg-clock clock-ratio) 0.0) + (empty) + arg7 + ) + (else + (* arg7 (-> pp clock time-adjust-ratio)) + ) + ) + ) + (set! (-> gp-0 time) (+ f0-10 arg7)) + ) + ) + ) + ((= f28-0 1.0) + (cond + ((< f26-0 3640.889) + (set! (-> arg0 times arg1 w) f30-1) + (set! (-> gp-0 fade) 0.99) + ) + (else + (set! (-> arg0 times arg1 w) f30-1) + ) + ) + (if (not (paused?)) + (set! (-> gp-0 time) (+ (-> gp-0 time) (if (= (-> *display* bg-clock clock-ratio) 0.0) + arg7 + (* arg7 (-> pp clock time-adjust-ratio)) + ) + ) + ) + ) + ) + ((and (< f28-0 1.0) (< 0.0 f28-0)) + (set! (-> arg0 times arg1 w) f28-0) + (when (not (paused?)) + (if (< 0.75 f28-0) + (set! (-> gp-0 fade) (- (-> gp-0 fade) (* 0.04 (-> pp clock time-adjust-ratio)))) + (set! (-> gp-0 fade) (- (-> gp-0 fade) (* 0.02 (-> pp clock time-adjust-ratio)))) + ) + ) + ) + (else + (set! (-> gp-0 fade) 0.0) + (set! (-> gp-0 time) 0.0) + ) + ) + ) + ) + ) + +;; definition of type lava-state +(deftype lava-state (structure) + ((lava float) + ) + ) + +;; definition for method 3 of type lava-state +(defmethod inspect ((this lava-state)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'lava-state) + (format #t "~1Tlava: ~f~%" (-> this lava)) + (label cfg-4) + this + ) + +;; definition for function update-mood-lava +(defun update-mood-lava ((arg0 mood-context) (arg1 int) (arg2 int) (arg3 float) (arg4 float) (arg5 float) (arg6 float) (arg7 float)) + (let ((gp-0 (+ (+ arg2 1840) (the-as int arg0)))) + (let ((f0-1 (cos (-> (the-as (pointer float) gp-0))))) + (set! (-> arg0 times arg1 w) (+ arg3 (* f0-1 arg4))) + (set! (-> arg0 times (+ arg1 1) w) (+ arg3 (* (- f0-1) arg4))) + ) + (if (not (paused?)) + (set! (-> (the-as (pointer float) gp-0)) (+ (-> (the-as (pointer float) gp-0)) arg5)) + ) + ) + ) + +;; definition for function update-mood-flicker +;; WARN: Return type mismatch int vs none. +(defun update-mood-flicker ((arg0 mood-context) (arg1 int) (arg2 int)) + (let ((gp-0 (the-as flicker-state (+ (+ arg2 1840) (the-as int arg0))))) + (cond + ((nonzero? (-> gp-0 flicker-on)) + (set! (-> arg0 times arg1 w) 1.0) + (if (not (paused?)) + (+! (-> gp-0 flicker-on) -1) + ) + ) + ((nonzero? (-> gp-0 flicker-off)) + (if (not (paused?)) + (+! (-> gp-0 flicker-off) -1) + ) + ) + (else + (set! (-> gp-0 flicker-on) (the-as uint (the int (rand-vu-float-range 2.0 20.0)))) + (if (zero? (the int (rand-vu-float-range 0.0 3.0))) + (set! (-> gp-0 flicker-off) (the-as uint (the int (rand-vu-float-range 2.0 120.0)))) + (set! (-> gp-0 flicker-off) (the-as uint (the int (rand-vu-float-range 2.0 20.0)))) + ) + ) + ) + ) + (none) + ) + +;; definition for function update-mood-florescent +(defun update-mood-florescent ((arg0 mood-context) (arg1 int) (arg2 int)) + (let ((gp-0 (the-as florescent-state (+ (+ arg2 1840) (the-as int arg0))))) + (set! (-> arg0 times arg1 w) (-> gp-0 value)) + (when (not (paused?)) + (cond + ((zero? (-> gp-0 delay)) + (set! (-> gp-0 delay2) (the int (rand-vu-float-range 10.0 60.0))) + (set! (-> gp-0 delay) (the int (rand-vu-float-range 60.0 120.0))) + ) + (else + (+! (-> gp-0 delay) -1) + ) + ) + (cond + ((>= (-> gp-0 delay2) (-> gp-0 delay)) + (set! (-> gp-0 value) (rand-vu-float-range 1.0 1.5)) + ) + ((< (-> gp-0 delay2) (-> gp-0 delay)) + (set! (-> gp-0 value) 1.5) + ) + ) + ) + ) + ) + +;; definition for function update-mood-electricity +;; WARN: Return type mismatch float vs none. +(defun update-mood-electricity ((arg0 mood-context) (arg1 int) (arg2 int) (arg3 float) (arg4 float)) + (let ((gp-0 (the-as electricity-state (+ (+ arg2 1840) (the-as int arg0))))) + (set! (-> arg0 times arg1 w) (* (-> gp-0 value) (-> gp-0 scale))) + (if (not (paused?)) + (set! (-> gp-0 value) (rand-vu-float-range arg3 arg4)) + ) + ) + (none) + ) + +;; definition for function update-mood-pulse +;; WARN: Return type mismatch float vs none. +(defun update-mood-pulse ((arg0 mood-context) (arg1 int) (arg2 int) (arg3 float) (arg4 float) (arg5 float) (arg6 float)) + (let ((gp-0 (the-as pulse-state (+ (+ arg2 1840) (the-as int arg0))))) + (set! (-> arg0 times arg1 w) + (fmin 1.9921875 (* (+ arg3 (* (cos (+ (-> gp-0 pulse) arg6)) arg4)) (-> gp-0 brightness))) + ) + (when (not (paused?)) + (+! (-> gp-0 pulse) arg5) + (seek! (-> gp-0 brightness) (-> gp-0 target-brightness) (* (-> gp-0 speed) (seconds-per-frame))) + ) + ) + (none) + ) + +;; definition for function update-mood-strobe +(defun update-mood-strobe ((arg0 mood-context) (arg1 int) (arg2 int) (arg3 int) (arg4 float)) + (let ((gp-0 (+ (+ arg2 1840) (the-as int arg0)))) + (let ((a2-1 (the int (-> (the-as (pointer float) gp-0))))) + (if (logtest? arg3 (ash 1 a2-1)) + (set! (-> arg0 times arg1 w) 1.0) + (set! (-> arg0 times arg1 w) 0.3) + ) + ) + (when (not (paused?)) + (let ((f0-5 (+ (-> (the-as (pointer float) gp-0)) arg4))) + (set! (-> (the-as (pointer float) gp-0)) (- f0-5 (* (the float (the int (/ f0-5 32.0))) 32.0))) + ) + ) + ) + ) + +;; definition for function update-mood-caustics +(defun update-mood-caustics ((arg0 mood-context) (arg1 int) (arg2 float) (arg3 float) (arg4 float) (arg5 float)) + (let ((f0-2 (sin (+ arg2 arg3)))) + (set! (-> arg0 times arg1 w) (+ arg4 (* f0-2 arg5))) + ) + ) + +;; definition for function overide-mood-fog +;; WARN: Return type mismatch symbol vs none. +(defun overide-mood-fog ((arg0 mood-context) (arg1 float) (arg2 int) (arg3 float)) + 0 + 0 + 0.0 + (let* ((v1-3 (-> *mood-control* mood-interp-table)) + (a0-1 (the int arg1)) + (f0-4 (- arg1 (the float a0-1))) + (f1-3 (- 1.0 f0-4)) + (a1-3 (/ a0-1 24)) + (a0-5 (-> v1-3 hour (- a0-1 (* 24 a1-3)))) + (a1-5 (-> a0-5 snapshot1)) + (v1-4 (-> a0-5 snapshot2)) + (f0-6 (+ (* f1-3 (-> a0-5 morph-start)) (* f0-4 (-> a0-5 morph-end)))) + ) + (if (= a1-5 v1-4) + (mem-copy! (the-as pointer (-> arg0 current-fog)) (the-as pointer (+ (* 48 a1-5) 0 arg2)) 48) + (vector4-array-lerp! + (the-as (inline-array vector4) (-> arg0 current-fog)) + (the-as (inline-array vector4) (+ (* 48 a1-5) 0 arg2)) + (the-as (inline-array vector4) (+ (* 48 v1-4) 0 arg2)) + f0-6 + 3 + ) + ) + ) + (if (!= arg3 0.0) + (vector4-array-lerp! + (the-as (inline-array vector4) (-> arg0 current-fog)) + (the-as (inline-array vector4) (-> arg0 current-fog)) + (the-as (inline-array vector4) (-> *level* level-default mood-context)) + arg3 + 3 + ) + ) + (none) + ) + +;; definition for function overide-mood-color +;; INFO: Used lq/sq +;; WARN: Return type mismatch rgbaf vs none. +(defun overide-mood-color ((arg0 mood-context) (arg1 float) (arg2 int) (arg3 float)) + 0 + 0 + 0.0 + (let* ((v1-3 (-> *mood-control* mood-interp-table)) + (a0-1 (the int arg1)) + (f0-4 (- arg1 (the float a0-1))) + (f1-3 (- 1.0 f0-4)) + (a1-3 (/ a0-1 24)) + (a1-5 (-> v1-3 hour (- a0-1 (* 24 a1-3)))) + (a0-5 (-> a1-5 snapshot1)) + (v1-4 (-> a1-5 snapshot2)) + (f30-0 (+ (* f1-3 (-> a1-5 morph-start)) (* f0-4 (-> a1-5 morph-end)))) + ) + (cond + ((= a0-5 v1-4) + (let ((a0-6 (+ (* a0-5 32) 0 arg2)) + (a1-7 (-> arg0 times)) + (v1-7 (-> arg0 times 1)) + ) + (set! (-> a1-7 0 quad) (-> (the-as (inline-array vector) (+ a0-6 16)) 0 quad)) + (set! (-> v1-7 quad) (-> (the-as (inline-array vector) (+ a0-6 0)) 0 quad)) + (set! (-> arg0 times 2 quad) (-> v1-7 quad)) + (set! (-> arg0 times 3 quad) (-> v1-7 quad)) + (set! (-> arg0 times 4 quad) (-> v1-7 quad)) + ) + ) + (else + (let ((s3-0 (+ (* a0-5 32) 0 arg2)) + (s2-0 (+ (* v1-4 32) 0 arg2)) + (a0-14 (-> arg0 times)) + (s4-0 (-> arg0 times 1)) + ) + (vector4-lerp! (the-as vector a0-14) (the-as vector (+ s3-0 16)) (the-as vector (+ s2-0 16)) f30-0) + (vector4-lerp! s4-0 (the-as vector (+ s3-0 0)) (the-as vector (+ s2-0 0)) f30-0) + (set! (-> arg0 times 2 quad) (-> s4-0 quad)) + (set! (-> arg0 times 3 quad) (-> s4-0 quad)) + (set! (-> arg0 times 4 quad) (-> s4-0 quad)) + ) + ) + ) + ) + (let ((s4-1 (-> arg0 light-group))) + (let ((s3-1 (-> *level* level-default mood-context))) + (if (!= arg3 0.0) + (vector4-array-lerp! + (the-as (inline-array vector4) (-> arg0 times)) + (the-as (inline-array vector4) (-> arg0 times)) + (the-as (inline-array vector4) (-> s3-1 times)) + arg3 + 5 + ) + ) + (dotimes (v1-17 5) + (set! (-> arg0 times v1-17 w) (-> (the-as mood-context (+ (the-as uint s3-1) (* v1-17 16))) times 0 w)) + ) + ) + (set! (-> s4-1 0 ambi color quad) (-> arg0 times 0 quad)) + (set! (-> s4-1 0 dir0 color quad) (-> arg0 times 1 quad)) + (set! (-> s4-1 0 dir1 color quad) (-> arg0 times 2 quad)) + (set! (-> s4-1 0 dir2 color quad) (-> arg0 times 3 quad)) + ) + (none) + ) + +;; definition for method 16 of type mood-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod apply-mood-clouds-and-fog ((this mood-control) (arg0 mood-control-work)) + (let ((v1-0 (-> this mood-fog-table))) + (dotimes (a0-1 24) + (set! (-> v1-0 _data a0-1) (the-as uint128 0)) + ) + ) + (let ((s4-0 (-> this mood-fog-table))) + (let ((f30-0 (- 1.0 (-> arg0 interp cloud)))) + (when (!= f30-0 0.0) + (let ((f0-4 (* (- 1.0 (-> arg0 interp fog)) f30-0)) + (a2-0 (-> this fogs (-> arg0 index 0))) + ) + (if (!= f0-4 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) a2-0) + f0-4 + 24 + ) + ) + ) + (let ((f0-6 (* (-> arg0 interp fog) f30-0)) + (a2-1 (-> this fogs (-> arg0 index 1))) + ) + (if (!= f0-6 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) a2-1) + f0-6 + 24 + ) + ) + ) + ) + ) + (let ((f30-1 (-> arg0 interp cloud))) + (when (!= f30-1 0.0) + (let ((f0-10 (* (- 1.0 (-> arg0 interp fog)) f30-1)) + (a2-2 (-> this fogs (-> arg0 index 2))) + ) + (if (!= f0-10 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) a2-2) + f0-10 + 24 + ) + ) + ) + (let ((f0-12 (* (-> arg0 interp fog) f30-1)) + (a2-3 (-> this fogs (-> arg0 index 3))) + ) + (if (!= f0-12 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) a2-3) + f0-12 + 24 + ) + ) + ) + ) + ) + ) + (let ((f0-13 (-> *time-of-day-context* fog-mult)) + (v1-29 (-> this mood-fog-table)) + ) + (dotimes (a0-6 8) + (set! (-> v1-29 data a0-6 fog-dists y) (* (-> v1-29 data a0-6 fog-dists y) f0-13)) + ) + ) + 0 + (none) + ) + +;; definition for method 17 of type mood-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod apply-mood-fog ((this mood-control) + (arg0 mood-control-work) + (arg1 mood-color-table) + (arg2 mood-color-table) + (arg3 mood-color-table) + (arg4 float) + ) + (let ((v1-0 (-> this mood-fog-table))) + (dotimes (a1-1 24) + (set! (-> v1-0 _data a1-1) (the-as uint128 0)) + ) + ) + (let ((s4-0 (-> this mood-fog-table)) + (f0-1 (fmax 0.0 (fmin 1.0 (* 5.0 (- 0.2 arg4))))) + (f30-0 (if (>= 0.2 arg4) + (fmax 0.0 (fmin 1.0 (* 5.0 arg4))) + (- 1.0 (fmax 0.0 (fmin 1.0 (* 1.25 (+ -0.2 arg4))))) + ) + ) + (f28-0 (fmax 0.0 (fmin 1.0 (* 1.25 (+ -0.2 arg4))))) + ) + (if (!= f0-1 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) arg1) + f0-1 + 24 + ) + ) + (if (!= f30-0 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) arg2) + f30-0 + 24 + ) + ) + (if (!= f28-0 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) arg3) + f28-0 + 24 + ) + ) + ) + 0 + (none) + ) + +;; definition for method 18 of type mood-control +;; WARN: Return type mismatch int vs none. +(defmethod apply-fog-height ((this mood-control) (arg0 mood-control-work) (arg1 float) (arg2 float) (arg3 float) (arg4 float)) + (cond + ((= arg4 0.2) + (set-fog-height! arg2) + ) + ((< arg4 0.2) + (set-fog-height! (lerp arg1 arg2 (* 5.0 arg4))) + ) + (else + (set-fog-height! (lerp arg2 arg3 (* 1.25 (+ -0.2 arg4)))) + ) + ) + 0 + (none) + ) + +;; definition for method 19 of type mood-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod apply-mood-colors ((this mood-control) (arg0 mood-control-work)) + (let ((v1-0 (-> this mood-color-table))) + (dotimes (a0-1 16) + (set! (-> v1-0 _data a0-1) (the-as uint128 0)) + ) + ) + (let ((s4-0 (-> this mood-color-table))) + (let ((f0-1 (- 1.0 (-> arg0 color-interp))) + (a2-0 (-> this colors (-> arg0 color-index 0))) + ) + (if (!= f0-1 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) a2-0) + f0-1 + 16 + ) + ) + ) + (let ((f0-2 (-> arg0 color-interp)) + (a2-1 (-> this colors (-> arg0 color-index 1))) + ) + (if (!= f0-2 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) a2-1) + f0-2 + 16 + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 20 of type mood-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod mood-control-method-20 ((this mood-control) + (arg0 mood-control-work) + (arg1 mood-color-table) + (arg2 mood-color-table) + (arg3 mood-color-table) + (arg4 float) + ) + (let ((v1-0 (-> this mood-color-table))) + (dotimes (a1-1 16) + (set! (-> v1-0 _data a1-1) (the-as uint128 0)) + ) + ) + (let ((s4-0 (-> this mood-color-table)) + (f0-1 (fmax 0.0 (fmin 1.0 (* 5.0 (- 0.2 arg4))))) + (f30-0 (if (>= 0.2 arg4) + (fmax 0.0 (fmin 1.0 (* 5.0 arg4))) + (- 1.0 (fmax 0.0 (fmin 1.0 (* 1.25 (+ -0.2 arg4))))) + ) + ) + (f28-0 (fmax 0.0 (fmin 1.0 (* 1.25 (+ -0.2 arg4))))) + ) + (if (!= f0-1 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) arg1) + f0-1 + 16 + ) + ) + (if (!= f30-0 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) arg2) + f30-0 + 16 + ) + ) + (if (!= f28-0 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) arg3) + f28-0 + 16 + ) + ) + ) + 0 + (none) + ) + +;; definition for method 21 of type mood-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod apply-mood-channels ((this mood-control) (arg0 mood-control-work)) + (let ((v1-0 (-> this mood-channel-group))) + (dotimes (a0-1 24) + (set! (-> v1-0 data 0 vecs a0-1 quad) (the-as uint128 0)) + ) + ) + (let ((s4-0 (-> this mood-channel-group))) + (let ((f0-1 (- 1.0 (-> arg0 channel-interp))) + (a2-0 (-> this channels (-> arg0 channel-index 0))) + ) + (if (!= f0-1 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) a2-0) + f0-1 + 24 + ) + ) + ) + (let ((f0-2 (-> arg0 channel-interp)) + (a2-1 (-> this channels (-> arg0 channel-index 1))) + ) + (if (!= f0-2 0.0) + (vector4-array-madd! + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) s4-0) + (the-as (inline-array vector4) a2-1) + f0-2 + 24 + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 22 of type mood-control +;; WARN: Return type mismatch int vs none. +(defmethod adjust-num-clouds ((this mood-control) (arg0 mood-control-work)) + (let ((v1-0 (-> this mood-clouds))) + (set! (-> v1-0 cloud-min) 0.0) + (set! (-> v1-0 cloud-max) 0.0) + (let ((f0-3 (- 1.0 (-> arg0 cloud-interp))) + (a2-4 (-> this clouds (-> arg0 cloud-index 0))) + ) + (when (!= f0-3 0.0) + (set! (-> v1-0 cloud-min) (* (-> a2-4 cloud-min) f0-3)) + (set! (-> v1-0 cloud-max) (* (-> a2-4 cloud-max) f0-3)) + ) + ) + (let ((f0-5 (-> arg0 cloud-interp)) + (a0-2 (-> this clouds (-> arg0 cloud-index 1))) + ) + (when (!= f0-5 0.0) + (+! (-> v1-0 cloud-min) (* (-> a0-2 cloud-min) f0-5)) + (+! (-> v1-0 cloud-max) (* (-> a0-2 cloud-max) f0-5)) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 24 of type mood-control +;; WARN: Return type mismatch int vs none. +(defmethod play-or-stop-lightning-sfx! ((this mood-control) (arg0 sound-spec) (arg1 vector)) + (vector+! (new 'stack-no-clear 'vector) arg1 (math-camera-pos)) + (cond + ((or (load-in-progress? *level*) (movie?)) + (when (nonzero? (-> this lightning-id)) + (sound-stop (-> this lightning-id)) + (set! (-> this lightning-id) (new 'static 'sound-id)) + 0 + ) + ) + (else + (when (nonzero? (-> this lightning-id)) + (sound-stop (-> this lightning-id)) + (set! (-> this lightning-id) (new 'static 'sound-id)) + 0 + ) + (set! (-> this lightning-id) (sound-play-by-spec arg0 (new-sound-id) arg1)) + ) + ) + (none) + ) + +;; definition for method 23 of type mood-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defmethod gen-lightning-and-thunder! ((this mood-control) (arg0 int)) + (local-vars (a1-2 (array float))) + (let ((v1-3 (-> this mood-channel-group data (-> this lightning-index))) + (a1-1 (-> this lightning-val)) + (a0-4 (/ (-> this lightning-time) 2)) + (f0-0 (-> this lightning-time2)) + ) + (set! (-> this lightning-flash) 0.0) + (cond + ((>= 0.0 f0-0) + (cond + ((zero? a1-1) + (set! a1-2 *flash0*) + ) + ((= a1-1 1) + (set! a1-2 *flash1*) + ) + ((= a1-1 2) + (set! a1-2 *flash2*) + ) + ((= a1-1 3) + (set! a1-2 *flash3*) + ) + ((= a1-1 4) + (set! a1-2 *flash4*) + ) + ((= a1-1 5) + (set! a1-2 *flash5*) + ) + ((= a1-1 6) + (set! a1-2 *flash6*) + ) + (else + (set! a1-2 *flash7*) + ) + ) + (cond + ((< a0-4 (-> a1-2 length)) + (let ((f30-0 (-> a1-2 a0-4)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (cond + ((= (-> this lightning-index) 4) + (set! (-> this lightning-flash) f30-0) + ) + ((= (-> this lightning-index) 5) + (set! (-> this lightning-flash) f30-0) + (dotimes (s4-0 8) + (set-vector! s5-0 255.0 255.0 255.0 128.0) + (vector4-lerp! + (the-as vector (-> this mood-fog-table data s4-0)) + (the-as vector (-> this mood-fog-table data s4-0)) + s5-0 + f30-0 + ) + ) + ) + (else + (set! (-> this lightning-flash) (* 1.9921875 f30-0)) + (let ((a0-17 (-> v1-3 data))) + (set! (-> a0-17 0) 1.0) + (set! (-> a0-17 1) 1.0) + (set! (-> a0-17 2) 1.0) + (set! (-> a0-17 3) 1.0) + ) + (set! (-> (the-as vector (&-> v1-3 data 4)) quad) (-> (the-as vector (-> v1-3 data)) quad)) + (set! (-> (the-as vector (&-> v1-3 data 8)) quad) (-> (the-as vector (-> v1-3 data)) quad)) + (set! (-> (the-as vector (&-> v1-3 data 12)) quad) (-> (the-as vector (-> v1-3 data)) quad)) + (set! (-> (the-as vector (&-> v1-3 data 16)) quad) (-> (the-as vector (-> v1-3 data)) quad)) + (set! (-> (the-as vector (&-> v1-3 data 20)) quad) (-> (the-as vector (-> v1-3 data)) quad)) + ) + ) + ) + (if (not (paused?)) + (+! (-> this lightning-time) 1) + ) + ) + (else + (level-get-target-inside *level*) + (cond + ((!= (-> this lightning-time3) 0.0) + (set! (-> this lightning-time2) (-> this lightning-time3)) + (set! (-> this lightning-time3) 0.0) + ) + (else + (set! (-> this lightning-time2) (rand-vu-float-range 5.0 10.0)) + ) + ) + ) + ) + ) + (else + (when (not (paused?)) + (set! (-> this lightning-time2) (- (-> this lightning-time2) (seconds-per-frame))) + (when (>= 0.0 (-> this lightning-time2)) + (when (= (-> this lightning-time3) 0.0) + (set! (-> this lightning-index) (mod (the-as int (rand-uint31-gen *random-generator*)) 6)) + (set! (-> this lightning-val) (the-as int (logand (rand-uint31-gen *random-generator*) 7))) + ) + (set! (-> this lightning-time) 0) + (cond + ((zero? (-> this lightning-index)) + (play-or-stop-lightning-sfx! + this + (static-sound-spec "thunder-b" :group 1) + (new 'static 'vector :x 37109760.0 :y 16261120.0 :z 5857280.0) + ) + ) + ((= (-> this lightning-index) 1) + (play-or-stop-lightning-sfx! + this + (static-sound-spec "thunder-b" :group 1) + (new 'static 'vector :x 20480000.0 :y 33341440.0 :z 12124160.0) + ) + ) + ((= (-> this lightning-index) 2) + (play-or-stop-lightning-sfx! + this + (static-sound-spec "thunder-b" :group 1) + (new 'static 'vector :x -20480000.0 :y 33341440.0 :z 12124160.0) + ) + ) + ((= (-> this lightning-index) 3) + (play-or-stop-lightning-sfx! + this + (static-sound-spec "thunder-b" :group 1) + (new 'static 'vector :x -37109760.0 :y 16261120.0 :z 5857280.0) + ) + ) + ((= (-> this lightning-index) 4) + (play-or-stop-lightning-sfx! + this + (static-sound-spec "thunder-c" :group 1) + (new 'static 'vector :y 40960000.0) + ) + ) + ((= (-> this lightning-index) 5) + (play-or-stop-lightning-sfx! + this + (static-sound-spec "thunder-a" :group 1) + (new 'static 'vector :y 40960000.0) + ) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for method 15 of type mood-control +;; WARN: Return type mismatch int vs none. +(defmethod set-lightning-time! ((this mood-control) (arg0 int) (arg1 int) (arg2 float)) + (set! (-> this lightning-index) arg0) + (set! (-> this lightning-val) arg1) + (set! (-> this lightning-time2) (seconds-per-frame)) + (set! (-> this lightning-time3) arg2) + 0 + (none) + ) + +;; definition for method 9 of type mood-control +;; WARN: Return type mismatch int vs none. +(defmethod init-weather! ((this mood-control)) + (local-vars (v1-32 int) (a1-12 object)) + (let ((s5-0 (level-get-target-inside *level*))) + (when s5-0 + (set! (-> this mood-direction-table) *mood-direction-table*) + (let ((s4-0 (new 'stack-no-clear 'mood-control-work))) + (let ((s3-0 this)) + (cond + ((and (-> s3-0 overide-weather-flag) (not (movie?)) (= (-> s3-0 current-special-interp) 0.0)) + (set! (-> s4-0 weather cloud) (* 2.0 (fmax 0.0 (fmin 1.0 (-> this overide cloud))))) + (set! (-> s4-0 weather fog) (* 2.0 (-> this overide fog))) + ) + (else + (set! (-> s4-0 weather cloud) (* 2.0 (fmax 0.0 (fmin 1.0 (-> this current-interp cloud))))) + (set! (-> s4-0 weather fog) (* 2.0 (fmax 0.0 (fmin 1.0 (-> this current-interp fog))))) + ) + ) + ) + (set! (-> s4-0 iweather cloud) (the int (-> s4-0 weather cloud))) + (let ((f0-12 (- (-> s4-0 weather cloud) (the float (-> s4-0 iweather cloud))))) + (cond + ((zero? (-> s4-0 iweather cloud)) + (if (< f0-12 0.5) + (set! (-> s4-0 interp cloud) 0.0) + (set! (-> s4-0 interp cloud) (* 2.0 (+ -0.5 f0-12))) + ) + ) + (else + (set! (-> s4-0 interp cloud) f0-12) + ) + ) + ) + (set! (-> s4-0 iweather fog) (the int (-> s4-0 weather fog))) + (set! (-> s4-0 interp fog) (- (-> s4-0 weather fog) (the float (-> s4-0 iweather fog)))) + (let ((a0-2 (-> s4-0 iweather fog)) + (v1-23 (-> s4-0 iweather cloud)) + ) + (set! (-> s4-0 index 0) (+ (* 3 v1-23) a0-2)) + (set! (-> s4-0 index 1) (+ a0-2 1 (* 3 v1-23))) + (set! (-> s4-0 index 2) (+ (* 3 (+ v1-23 1)) a0-2)) + (set! (-> s4-0 index 3) (+ a0-2 1 (* 3 (+ v1-23 1)))) + ) + (let ((v1-27 (-> s4-0 iweather cloud))) + (set! (-> s4-0 color-interp) (-> s4-0 interp cloud)) + (set! (-> s4-0 color-index 0) v1-27) + (set! (-> s4-0 color-index 1) (+ v1-27 1)) + ) + 0 + (let ((f0-22 (- (-> s4-0 weather cloud) (the float (-> s4-0 iweather cloud))))) + (cond + ((zero? (-> s4-0 iweather cloud)) + (set! (-> s4-0 channel-interp) 0.0) + (set! v1-32 0) + ) + ((= (-> s4-0 iweather cloud) 2) + (set! (-> s4-0 channel-interp) 0.0) + (set! v1-32 2) + ) + ((< f0-22 0.5) + (set! (-> s4-0 channel-interp) (* 2.0 f0-22)) + (set! v1-32 0) + ) + (else + (set! (-> s4-0 channel-interp) (* 2.0 (+ -0.5 f0-22))) + (set! v1-32 1) + ) + ) + ) + (set! (-> s4-0 channel-index 0) v1-32) + (set! (-> s4-0 channel-index 1) (+ v1-32 1)) + (let* ((s3-1 this) + (f0-33 (if (and (-> s3-1 overide-weather-flag) (and (not (movie?)) (= (-> s3-1 current-special-interp) 0.0))) + (* 8.0 (-> this overide cloud)) + (* 8.0 (fmax 0.0 (fmin 1.0 (-> this current-interp cloud)))) + ) + ) + (v1-45 (the int f0-33)) + ) + (set! (-> s4-0 cloud-interp) (- f0-33 (the float v1-45))) + (set! (-> s4-0 cloud-index 0) v1-45) + (set! (-> s4-0 cloud-index 1) (+ v1-45 1)) + ) + (cond + ((= (-> *time-of-day-context* special-mood) 'desert) + (apply-mood-fog + this + s4-0 + (the-as mood-color-table *desert-mood-fog-table*) + (the-as mood-color-table *sandstorm-start-mood-fog-table*) + (the-as mood-color-table *sandstorm-end-mood-fog-table*) + (-> this current-special-interp) + ) + (mood-control-method-20 + this + s4-0 + *desert-mood-color-table* + *sandstorm-start-mood-color-table* + *sandstorm-end-mood-color-table* + (-> this current-special-interp) + ) + (apply-fog-height this s4-0 327680.0 614400.0 4096000.0 (-> this current-special-interp)) + (set! a1-12 s4-0) + (adjust-num-clouds this (the-as mood-control-work a1-12)) + ) + (else + (apply-mood-clouds-and-fog this s4-0) + (apply-mood-colors this s4-0) + (apply-mood-channels this s4-0) + (set! a1-12 s4-0) + (adjust-num-clouds this (the-as mood-control-work a1-12)) + ) + ) + ) + (when (not (or (paused?) (let ((s4-1 this)) + (and (-> s4-1 overide-weather-flag) (not (movie?)) (= (-> s4-1 current-special-interp) 0.0)) + ) + ) + ) + (when (!= (-> this time-until-random cloud) -99.0) + (set! (-> this target-interp cloud) + (fmax (fmin (-> this target-interp cloud) (-> this range max-cloud)) (-> this range min-cloud)) + ) + (let ((t9-13 seek) + (a0-19 (-> this current-interp cloud)) + ) + (set! a1-12 (-> this target-interp cloud)) + (set! (-> this current-interp cloud) + (t9-13 a0-19 (the-as float a1-12) (* (/ 1.0 (-> this speed-interp cloud)) (seconds-per-frame))) + ) + ) + ) + (when (!= (-> this time-until-random fog) -99.0) + (set! (-> this target-interp fog) + (fmax (fmin (-> this target-interp fog) (-> this range max-fog)) (-> this range min-fog)) + ) + (let ((t9-14 seek) + (a0-20 (-> this current-interp fog)) + ) + (set! a1-12 (-> this target-interp fog)) + (set! (-> this current-interp fog) + (t9-14 a0-20 (the-as float a1-12) (* (/ 1.0 (-> this speed-interp fog)) (seconds-per-frame))) + ) + ) + ) + (when (!= (-> this time-until-random cloud) -99.0) + (set! (-> this time-until-random cloud) (- (-> this time-until-random cloud) (* 300.0 (seconds-per-frame)))) + (when (< (-> this time-until-random cloud) 0.0) + (set! (-> this time-until-random cloud) + (rand-vu-float-range (-> this time-until-random-min cloud) (-> this time-until-random-max cloud)) + ) + (let ((f30-0 (rand-vu-float-range (-> this range min-cloud) (-> this range max-cloud))) + (f28-0 (rand-vu-float-range (-> this range min-cloud) (-> this range max-cloud))) + (f26-0 (rand-vu-float-range (-> this range min-cloud) (-> this range max-cloud))) + (f24-0 (rand-vu-float-range (-> this range min-cloud) (-> this range max-cloud))) + (f2-11 (rand-vu-float-range (-> this range min-cloud) (-> this range max-cloud))) + ) + (set! (-> this target-interp cloud) (fmax 0.0 (+ -0.25 (* 0.25 (+ f30-0 f28-0 f26-0 f24-0 f2-11))))) + ) + (let ((t9-21 rand-vu-float-range) + (a0-27 30.0) + ) + (set! a1-12 120.0) + (set! (-> this speed-interp cloud) (t9-21 a0-27 (the-as float a1-12))) + ) + (when (and (< 0.0 (-> *setting-control* user-current rain)) + (< (-> this target-interp cloud) 0.5) + (< 0.25 (-> this target-interp cloud)) + (or (< (-> this target-interp fog) 0.25) (< 0.75 (-> this target-interp fog))) + ) + (set! (-> this speed-interp fog) (fabs (/ (* 1.25 (-> this current-interp fog) (-> this speed-interp cloud)) + (+ -0.75 (-> this current-interp cloud)) + ) + ) + ) + (set! (-> this target-interp fog) 0.5) + (set! (-> this time-until-random fog) (-> this time-until-random cloud)) + ) + ) + ) + (when (!= (-> this time-until-random fog) -99.0) + (set! (-> this time-until-random fog) (- (-> this time-until-random fog) (* 300.0 (seconds-per-frame)))) + (when (< (-> this time-until-random fog) 0.0) + (set! (-> this time-until-random fog) + (rand-vu-float-range (-> this time-until-random-min fog) (-> this time-until-random-max fog)) + ) + (let ((f30-1 (rand-vu-float-range (-> this range min-fog) (-> this range max-fog))) + (f28-1 (rand-vu-float-range (-> this range min-fog) (-> this range max-fog))) + (f26-1 (rand-vu-float-range (-> this range min-fog) (-> this range max-fog))) + (f24-1 (rand-vu-float-range (-> this range min-fog) (-> this range max-fog))) + (f0-108 (rand-vu-float-range (-> this range min-fog) (-> this range max-fog))) + ) + (set! (-> this target-interp fog) (* 0.2 (+ f30-1 f28-1 f26-1 f24-1 f0-108))) + ) + (let ((t9-28 rand-vu-float-range) + (a0-34 30.0) + ) + (set! a1-12 120.0) + (set! (-> this speed-interp fog) (t9-28 a0-34 (the-as float a1-12))) + ) + ) + ) + ) + (when (logtest? (game-secrets bad-weather) (-> *game-info* secrets)) + (set! (-> this current-interp cloud) 1.0) + (set! (-> this current-interp fog) 1.0) + ) + (let* ((s4-2 this) + (f30-2 (if (and (-> s4-2 overide-weather-flag) (and (not (movie?)) (= (-> s4-2 current-special-interp) 0.0))) + (-> this overide cloud) + (-> this current-interp cloud) + ) + ) + (s4-3 this) + (f26-2 (if (and (-> s4-3 overide-weather-flag) (and (not (movie?)) (= (-> s4-3 current-special-interp) 0.0))) + (-> this overide fog) + (-> this current-interp fog) + ) + ) + (f28-2 (fmin (-> s5-0 info max-rain) (-> *time-of-day-context* max-rain))) + ) + (set! (-> this sound-pitch) (* 1.442695 (logf (-> *display* bg-clock clock-ratio)))) + (let* ((f0-125 (fmax 0.0 (fmin (* 4.0 (fmax 0.0 (+ -0.5 f26-2)) (fmax 0.0 (+ -0.5 f30-2))) f28-2))) + (f30-3 (fmin 0.75 f0-125)) + ) + (set! (-> *setting-control* user-default rain) f30-3) + (level-get-target-inside *level*) + (cond + ((and (< 0.0 (-> *setting-control* user-current rain)) (!= *master-mode* 'progress)) + (gen-lightning-and-thunder! this (the-as int a1-12)) + (cond + ((zero? (-> this rain-id)) + (set! (-> this rain-id) (sound-play-by-name + (static-sound-name "rain-hiss") + (new-sound-id) + (the int (* 1024.0 f30-3)) + (the int (* 1524.0 (-> this sound-pitch))) + 0 + (sound-group) + #t + ) + ) + ) + (else + (when *sound-player-enable* + (let ((v1-146 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-146 command) (sound-command set-param)) + (set! (-> v1-146 id) (-> this rain-id)) + (set! (-> v1-146 params volume) (the int (* 1024.0 f30-3))) + (set! (-> v1-146 params pitch-mod) (the int (* 1524.0 (-> this sound-pitch)))) + (set! (-> v1-146 params mask) (the-as uint 3)) + (-> v1-146 id) + ) + ) + ) + ) + ) + (else + (set! (-> this lightning-flash) 0.0) + (when (nonzero? (-> this rain-id)) + (sound-stop (-> this rain-id)) + (set! (-> this rain-id) (new 'static 'sound-id)) + 0 + ) + ) + ) + ) + ) + (if (and (not (paused?)) (not (-> *game-info* dust-storm))) + (seek! + (-> this current-special-interp) + (-> this target-special-interp) + (* (-> this rate-special-interp) (seconds-per-frame)) + ) + ) + (when (-> this display-flag) + (let ((s5-2 this)) + (cond + ((and (-> s5-2 overide-weather-flag) (not (movie?)) (= (-> s5-2 current-special-interp) 0.0)) + (format *stdcon* "overide cloud ~f~%" (-> this overide cloud)) + (format *stdcon* "overide fog ~f~%" (-> this overide fog)) + ) + (else + (format *stdcon* "time until random cloud ~f~%" (* 0.0033333334 (-> this time-until-random cloud))) + (format *stdcon* "current cloud ~f~%" (-> this current-interp cloud)) + (format *stdcon* "target cloud ~f~%" (-> this target-interp cloud)) + (format *stdcon* "speed cloud ~f~%" (* (/ 1.0 (-> this speed-interp cloud)) (seconds-per-frame))) + (format *stdcon* "time until random fog ~f~%" (* 0.0033333334 (-> this time-until-random fog))) + (format *stdcon* "current fog ~f~%" (-> this current-interp fog)) + (format *stdcon* "target fog ~f~%" (-> this target-interp fog)) + (format *stdcon* "speed fog ~f~%" (* (/ 1.0 (-> this speed-interp fog)) (seconds-per-frame))) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 10 of type mood-control +;; WARN: Return type mismatch int vs none. +(defmethod set-cloud-and-fog-interp! ((this mood-control) (arg0 float) (arg1 float) (arg2 float) (arg3 float)) + (set! (-> this target-interp cloud) arg0) + (set! (-> this target-interp fog) arg1) + (set! (-> this speed-interp cloud) arg2) + (set! (-> this speed-interp fog) arg3) + (if (= arg2 0.0) + (set! (-> this current-interp cloud) arg0) + ) + (if (= arg3 0.0) + (set! (-> this current-interp fog) arg1) + ) + 0 + (none) + ) + +;; definition for method 11 of type mood-control +;; WARN: Return type mismatch int vs none. +(defmethod update-mood-range! ((this mood-control) (arg0 float) (arg1 float) (arg2 float) (arg3 float)) + (set! (-> this range min-cloud) arg0) + (set! (-> this range max-cloud) arg1) + (set! (-> this range min-fog) arg2) + (set! (-> this range max-fog) arg3) + 0 + (none) + ) + +;; definition for method 12 of type mood-control +;; WARN: Return type mismatch int vs none. +(defmethod set-time-for-random-weather! ((this mood-control) (arg0 float) (arg1 float)) + (set! (-> this time-until-random cloud) arg0) + (set! (-> this time-until-random fog) arg1) + 0 + (none) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/gfx/sky/sky-h_REF.gc b/test/decompiler/reference/jak3/engine/gfx/sky/sky-h_REF.gc index c566c87a36..f797ae02d5 100644 --- a/test/decompiler/reference/jak3/engine/gfx/sky/sky-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/sky/sky-h_REF.gc @@ -406,9 +406,9 @@ (disable-day-star basic) ) (:methods - (sky-work-method-9 () none) - (sky-work-method-10 () none) - (sky-work-method-11 () none) + (init-sun-data! (_type_ int float float float) none) + (init-orbit-settings! (_type_ int float float float float float float) none) + (update-colors-for-time (_type_ float) none) (update-time-and-speed (_type_ float float) none) (sky-work-method-13 () none) (draw (_type_) none) diff --git a/test/decompiler/reference/jak3/engine/level/bsp-h_REF.gc b/test/decompiler/reference/jak3/engine/level/bsp-h_REF.gc index b57f201dbb..412df690ea 100644 --- a/test/decompiler/reference/jak3/engine/level/bsp-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/level/bsp-h_REF.gc @@ -60,6 +60,7 @@ This probably started as a very simple structure, but now it is extremely compli (cam-outside-bsp uint8 :offset 152) (cam-using-back uint8) (cam-box-idx uint16) + (ambients symbol) (subdivide-close float :offset 160) (subdivide-far float) (race-meshes (array entity-race-mesh)) diff --git a/test/offline/config/jak3/config.jsonc b/test/offline/config/jak3/config.jsonc index 4672219120..925519dad9 100644 --- a/test/offline/config/jak3/config.jsonc +++ b/test/offline/config/jak3/config.jsonc @@ -172,7 +172,9 @@ "sparticle-motion-blur", // clipping "birth-func-texture-group", // script - "command-get-process" + "command-get-process", + // mood + "update-mood-direction" ], "skip_compile_states": {}