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

---
Files:

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

756 lines
25 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: desert-dust-storm.gc
;; name in dgo: desert-dust-storm
;; dgos: TITLE, DST
;; DECOMP BEGINS
(define *duststorm-wind-vec* (new 'static 'vector))
(define *duststorm-wind-vel* 0.0)
(define *duststorm-intensity* 0.0)
(define *duststorm-stationary?* #f)
(define *fog-intensity-scalar* 0.0)
(deftype desert-dust-storm (process)
((intensity float)
(intensity-rate float)
(intensity-target float)
(origin vector :inline)
(current-wind-angle-speed float)
(current-wind-angle float)
(dest-wind-angle float)
(wind-speed float)
(dest-wind-speed float)
(stretch-val float)
(last-hold-time time-frame)
(wind-intensity float)
(new-generate-time time-frame)
(state-time time-frame)
(fog-plane-origin vector :inline)
(fog-plane-dir vector :inline)
(is-intro? symbol)
(wind-sound sound-id)
(enabled-screen-filter? symbol)
(dust-storm-clock-scalar float)
)
(:state-methods
track
hold-pos
die
)
(:methods
(desert-dust-storm-method-17 (_type_) none)
(desert-dust-storm-method-18 (_type_) float)
(desert-dust-storm-method-19 (_type_) none)
(desert-dust-storm-method-20 (_type_) float)
)
)
(defbehavior desert-dust-storm-init-by-other desert-dust-storm ((arg0 level) (arg1 symbol) (arg2 vector))
(stack-size-set! (-> self main-thread) 32)
(logclear! (-> self mask) (process-mask actor-pause))
(set! (-> self level) arg0)
(set! (-> self enabled-screen-filter?) #f)
(set! (-> self origin quad) (-> arg2 quad))
(set-time! (-> self state-time))
(set! (-> self current-wind-angle-speed) 0.0)
(set! (-> self current-wind-angle) 0.0)
(set! (-> self intensity) 0.0)
(set! (-> self wind-sound) (new-sound-id))
(set! (-> self dust-storm-clock-scalar) 1.0)
(set! (-> self is-intro?) #f)
(if (= arg1 'track)
(go-virtual track)
(go-virtual hold-pos)
)
)
(defmethod deactivate ((this desert-dust-storm))
"Make a process dead, clean it up, remove it from the active pool, and return to dead pool."
(let* ((v1-0 *mood-control*)
(f0-0 0.0)
(f1-0 0.3)
(a0-2 #f)
(f0-2 (fmax 0.0 (fmin 1.0 f0-0)))
)
(set! (-> v1-0 target-special-interp) f0-2)
(set! (-> v1-0 rate-special-interp) f1-0)
(if a0-2
(set! (-> v1-0 current-special-interp) f0-2)
)
)
0
(sound-stop (-> this wind-sound))
(if (-> this enabled-screen-filter?)
(disable *screen-filter*)
)
(call-parent-method this)
(none)
)
(defmethod run-logic? ((this desert-dust-storm))
"Should this process be run? Checked by execute-process-tree."
#t
)
(defstate track (desert-dust-storm)
:virtual #t
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(case message
(('clock-scalar)
(set! (-> self dust-storm-clock-scalar) (the-as float (-> block param 0)))
)
(('set-intro)
(let ((v0-0 (the-as object (-> block param 0))))
(set! (-> self is-intro?) (the-as symbol v0-0))
v0-0
)
)
(('set-intensity)
(set! (-> self intensity) (the-as float (-> block param 0)))
(let* ((v1-3 *mood-control*)
(f0-2 (-> self intensity))
(f1-0 0.01)
(a0-8 #t)
(f0-4 (fmax 0.0 (fmin 1.0 f0-2)))
)
(set! (-> v1-3 target-special-interp) f0-4)
(set! (-> v1-3 rate-special-interp) f1-0)
(if a0-8
(set! (-> v1-3 current-special-interp) f0-4)
)
)
0
)
(('get-intensity)
(-> self intensity)
)
(('die)
(go-virtual die)
)
(('hold-pos)
(set! (-> self origin quad) (-> (the-as vector (-> block param 0)) quad))
(set! (-> self dest-wind-angle) (the-as float (-> block param 1)))
(go-virtual hold-pos)
)
)
)
:trans (behavior ()
(desert-dust-storm-method-20 self)
(set! *duststorm-stationary?* #f)
(set! (-> self origin quad) (-> (math-camera-pos) quad))
(desert-dust-storm-method-18 self)
(desert-dust-storm-method-17 self)
)
:code sleep-code
)
(defstate hold-pos (desert-dust-storm)
:virtual #t
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(local-vars (v0-0 object))
(case message
(('set-intro)
(set! v0-0 (-> block param 0))
(set! (-> self is-intro?) (the-as symbol v0-0))
v0-0
)
(('set-intensity)
(set! (-> self intensity) (the-as float (-> block param 0)))
(let* ((v1-2 *mood-control*)
(f0-1 (-> self intensity))
(f1-0 0.01)
(a0-6 #t)
(f0-3 (fmax 0.0 (fmin 1.0 f0-1)))
)
(set! (-> v1-2 target-special-interp) f0-3)
(set! (-> v1-2 rate-special-interp) f1-0)
(if a0-6
(set! (-> v1-2 current-special-interp) f0-3)
)
)
0
)
(('get-intensity)
(-> self intensity)
)
(('hold-pos)
(set! (-> self origin quad) (-> (the-as vector (-> block param 0)) quad))
(set! (-> self dest-wind-angle) (the-as float (-> block param 1)))
(set! v0-0 (current-time))
(set! (-> self last-hold-time) (the-as time-frame v0-0))
v0-0
)
(('die)
(go-virtual die)
)
(('track)
(go-virtual track)
)
)
)
:enter (behavior ()
(set-time! (-> self last-hold-time))
)
:trans (behavior ()
(desert-dust-storm-method-20 self)
(seek! (-> self current-wind-angle) (-> self dest-wind-angle) (* 16384.0 (seconds-per-frame)))
(set! *duststorm-stationary?* #t)
(desert-dust-storm-method-19 self)
(if (time-elapsed? (-> self last-hold-time) (seconds 0.1))
(go-virtual track)
)
)
:code sleep-code
)
(defstate die (desert-dust-storm)
:virtual #t
:enter (behavior ()
'()
)
:code (behavior ()
'()
)
)
(deftype dust-storm-bank (basic)
((spawn-radius meters)
(spawn-rand-xz-min meters)
(spawn-rand-xz-max meters)
(spawn-rand-y-min meters)
(spawn-rand-y-max meters)
)
)
(define *DUST_STORM-bank* (new 'static 'dust-storm-bank
:spawn-radius (meters 20)
:spawn-rand-xz-min (meters 5)
:spawn-rand-xz-max (meters 10)
:spawn-rand-y-min (meters -8)
:spawn-rand-y-max (meters 10)
)
)
(defpart 1421
:init-specs ((:texture (dust-cloud desert-sprite))
(:num 1.0)
(:scale-x (meters 5) (meters 6))
(:scale-y (meters 5) (meters 6))
(:r 148.0)
(:g 130.0)
(:b 80.0)
(:a 0.0)
(:vel-z (meters 0))
(:timer (seconds 0.5))
(:flags (sp-cpuinfo-flag-13))
(:func 'sparticle-duststorm-move)
)
)
(defpart 1422
:init-specs ((:texture (dust-cloud title-sprite))
(:num 1.0)
(:scale-x (meters 5) (meters 6))
(:scale-y (meters 5) (meters 6))
(:r 148.0)
(:g 130.0)
(:b 80.0)
(:a 0.0)
(:vel-z (meters 0))
(:timer (seconds 0.5))
(:flags (sp-cpuinfo-flag-13))
(:func 'sparticle-duststorm-move)
)
)
(defun sparticle-duststorm-birth-func ()
0
(none)
)
(defun sparticle-duststorm-move ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo))
(let ((s5-0 (new 'stack-no-clear 'vector)))
(set! (-> s5-0 x) (-> arg2 launchrot x))
(set! (-> s5-0 y) (-> arg2 launchrot y))
(set! (-> s5-0 z) (-> arg2 launchrot z))
(set! (-> s5-0 w) 1.0)
(let ((s4-0 (new 'stack-no-clear 'vector)))
(let* ((s3-0 s4-0)
(s2-0 *duststorm-wind-vec*)
(f30-0 3.0)
(f28-0 52.0)
(v1-4 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-5 (the-as number (logior #x3f800000 v1-4)))
)
(vector-float*! s3-0 s2-0 (+ f30-0 (* f28-0 (+ -1.0 (the-as float v1-5)))))
)
(set! (-> s4-0 y) 0.0)
(vector-float*! s4-0 s4-0 *duststorm-wind-vel*)
(let ((f0-11 (vector-normalize-ret-len! s4-0 1.0)))
(if (not *duststorm-stationary?*)
(set! f0-11 (fmin 204800.0 f0-11))
)
(vector-float*! s4-0 s4-0 f0-11)
)
(vector-v++! s5-0 s4-0)
)
(let ((f1-2 (vector-vector-distance s5-0 (math-camera-pos))))
0.0
(let ((f2-0 204800.0)
(f0-13 0.0)
)
(when *duststorm-stationary?*
(set! f2-0 1024000.0)
(set! f0-13 20.0)
)
(let* ((f2-1 (/ f1-2 f2-0))
(f1-4 (fmax 0.0 (fmin 1.0 f2-1)))
(f1-5 (* f1-4 f1-4))
(f2-3 *duststorm-intensity*)
)
(set! (-> arg2 coneradius) (lerp (* 48.0 f2-3) (* f2-3 f0-13) f1-5))
)
)
)
(set! (-> arg2 launchrot x) (-> s5-0 x))
(set! (-> arg2 launchrot y) (-> s5-0 y))
(set! (-> arg2 launchrot z) (-> s5-0 z))
)
(-> arg2 launchrot)
)
(defun compute-wind-angle ((arg0 float) (arg1 float) (arg2 float))
(let ((v1-3 (the float (sar (shl (the int arg0) 48) 48)))
(a0-4 (the float (sar (shl (the int arg1) 48) 48)))
(a1-4 (the float (sar (shl (the int arg2) 48) 48)))
(f0-12 8192.0)
)
(cond
((< 8192.0 (fabs (- a0-4 v1-3)))
0.0
)
((and (< a1-4 v1-3) (>= a0-4 v1-3))
(- (- a1-4 a0-4) f0-12)
)
((and (< v1-3 a1-4) (>= v1-3 a0-4))
(+ (- a1-4 a0-4) f0-12)
)
((< a1-4 v1-3)
(- f0-12)
)
(else
f0-12
)
)
)
)
(defmethod desert-dust-storm-method-18 ((this desert-dust-storm))
(set! *duststorm-intensity* (fmax 0.0 (fmin 1.0 (-> this intensity))))
(cond
((>= (/ (the float (- (current-time) (-> this state-time))) (the float (-> this new-generate-time))) 1.0)
(set-time! (-> this state-time))
(let ((s5-0 (new 'stack-no-clear 'vector)))
(set! (-> s5-0 quad) (-> (math-camera-matrix) fvec quad))
0.0
(set! (-> s5-0 y) 0.0)
(vector-normalize! s5-0 1.0)
(let ((f30-0 (vector-y-angle s5-0)))
(let* ((f28-0 -8192.0)
(f26-0 16384.0)
(v1-13 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-14 (the-as number (logior #x3f800000 v1-13)))
)
(+! (-> this dest-wind-angle)
(- (+ f28-0 (* f26-0 (+ -1.0 (the-as float v1-14)))) (-> this current-wind-angle))
)
)
(+! (-> this dest-wind-angle) (compute-wind-angle
f30-0
(+ (-> this dest-wind-angle) (-> this current-wind-angle))
(-> this current-wind-angle)
)
)
)
)
(let* ((v1-17 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-18 (the-as number (logior #x3f800000 v1-17)))
)
(set! (-> this dest-wind-speed) (+ -1.0 (the-as float v1-18)))
)
(let* ((f30-1 300.0)
(f28-2 3.5)
(v1-24 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-25 (the-as number (logior #x3f800000 v1-24)))
)
(set! (-> this new-generate-time)
(the-as time-frame (the int (* f30-1 (+ f28-2 (+ -1.0 (the-as float v1-25))))))
)
)
)
(else
(let ((s5-1 (new 'stack-no-clear 'vector)))
(set! (-> s5-1 quad) (-> (math-camera-matrix) fvec quad))
0.0
(let ((f28-3 1.0))
(set! (-> s5-1 y) 0.0)
(vector-normalize! s5-1 1.0)
(let ((f30-2 (vector-y-angle s5-1)))
(let ((f0-33
(compute-wind-angle
f30-2
(+ (-> this dest-wind-angle) (-> this current-wind-angle))
(-> this current-wind-angle)
)
)
)
(when (< 0.1 (fabs f0-33))
(+! (-> this dest-wind-angle) f0-33)
(set! f28-3 2.0)
)
)
(set! (-> this current-wind-angle) (the float (sar (shl (the int (-> this current-wind-angle)) 48) 48)))
(seek! (-> this wind-speed) (-> this dest-wind-speed) (* 2.0 (seconds-per-frame)))
(let ((f0-44 (-> this dest-wind-angle)))
(if (< 32768.0 f0-44)
(set! f0-44 (+ -65536.0 f0-44))
)
(if (< f0-44 -32768.0)
(set! f0-44 (+ 65536.0 f0-44))
)
(let* ((f0-46 (+ (* 5.0 f0-44) (* 5.0 (- (-> this current-wind-angle-speed)))))
(f1-23 (* 0.2 f0-46 f28-3))
)
(+! (-> this current-wind-angle-speed) (* f1-23 (seconds-per-frame)))
)
)
(set! (-> this current-wind-angle-speed)
(fmax -21845.334 (fmin 21845.334 (-> this current-wind-angle-speed)))
)
(let ((f0-53 (* (-> this current-wind-angle-speed) (seconds-per-frame))))
(+! (-> this current-wind-angle) f0-53)
(set! (-> this dest-wind-angle) (- (-> this dest-wind-angle) f0-53))
)
(set! (-> this stretch-val) (fabs (- (+ 32768.0 f30-2) (+ 32768.0 (-> this current-wind-angle)))))
)
)
)
(if (< 32768.0 (-> this stretch-val))
(set! (-> this stretch-val) (- 65536.0 (-> this stretch-val)))
)
(if (< 16384.0 (-> this stretch-val))
(set! (-> this stretch-val) (- 32768.0 (-> this stretch-val)))
)
)
)
(set! *duststorm-wind-vel* (lerp 8192.0 20480.0 (-> this wind-speed)))
(let ((f1-39 (fmax 0.0 (fmin 1.0 (-> this intensity)))))
(set! *duststorm-wind-vel* (* *duststorm-wind-vel* (- 1.0 (* (- 1.0 f1-39) (- 1.0 f1-39)))))
)
(set! *duststorm-wind-vel* (* *duststorm-wind-vel* (-> this dust-storm-clock-scalar)))
)
;; WARN: Return type mismatch symbol vs none.
(defmethod desert-dust-storm-method-19 ((this desert-dust-storm))
(local-vars (sv-80 vector) (sv-96 vector) (sv-112 vector))
(set! *duststorm-intensity* (fmax 0.0 (fmin 1.0 (-> this intensity))))
(set! *duststorm-wind-vel* (lerp 8192.0 20480.0 (-> this wind-speed)))
(set! *duststorm-wind-vel* (* *duststorm-wind-vel* *duststorm-intensity*))
(let ((v0-1 (vector-rotate-y! (new 'stack-no-clear 'vector) *z-vector* (-> this current-wind-angle))))
(vector-float*! *duststorm-wind-vec* v0-1 1.0)
)
(set! *duststorm-wind-vel* 12288.0)
(let* ((s5-0 (vector-rotate-y! (new 'stack-no-clear 'vector) *z-vector* (-> this current-wind-angle)))
(s4-1 (vector-cross! (new 'stack-no-clear 'vector) s5-0 *up-vector*))
(s3-0 (new 'stack-no-clear 'vector))
)
(dotimes (s2-0 15)
(set! (-> s3-0 quad) (-> this origin quad))
(let ((s1-0 s3-0)
(s0-0 s3-0)
)
(set! sv-80 s5-0)
(let* ((f30-0 4096.0)
(f28-0 1.5)
(f26-0 -6.5)
(v1-11 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-12 (the-as number (logior #x3f800000 v1-11)))
(f0-14 (* f30-0 (+ f28-0 (* f26-0 (+ -1.0 (the-as float v1-12))))))
)
(vector+float*! s1-0 s0-0 sv-80 f0-14)
)
)
(let ((s1-2 s3-0)
(s0-1 s3-0)
)
(set! sv-96 s4-1)
(let* ((f30-1 4096.0)
(f28-1 -8.0)
(f26-1 16.0)
(v1-18 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-19 (the-as number (logior #x3f800000 v1-18)))
(f0-20 (* f30-1 (+ f28-1 (* f26-1 (+ -1.0 (the-as float v1-19))))))
)
(vector+float*! s1-2 s0-1 sv-96 f0-20)
)
)
(let ((s1-4 s3-0)
(s0-2 s3-0)
)
(set! sv-112 *up-vector*)
(let* ((f30-2 4096.0)
(f28-2 -1.0)
(f26-2 61.0)
(v1-26 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-27 (the-as number (logior #x3f800000 v1-26)))
(f0-26 (* f30-2 (+ f28-2 (* f26-2 (+ -1.0 (the-as float v1-27))))))
)
(vector+float*! s1-4 s0-2 sv-112 f0-26)
)
)
(set! (-> *part-id-table* 1421 init-specs 2 initial-valuef) 61440.0)
(set! (-> *part-id-table* 1422 init-specs 2 initial-valuef) 61440.0)
(if (-> this is-intro?)
(launch-particles (-> *part-id-table* 1422) s3-0)
(launch-particles (-> *part-id-table* 1421) s3-0)
)
)
)
(none)
)
;; WARN: Return type mismatch symbol vs none.
(defmethod desert-dust-storm-method-17 ((this desert-dust-storm))
(let ((a0-2 (vector-rotate-y! (new 'stack-no-clear 'vector) *z-vector* (-> this current-wind-angle))))
(vector-float*! *duststorm-wind-vec* a0-2 1.0)
)
(dotimes (s5-0 10)
(let* ((f30-0 -20024.889)
(f28-0 40049.777)
(v1-5 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-6 (the-as number (logior #x3f800000 v1-5)))
(f30-1 (+ f30-0 (* f28-0 (+ -1.0 (the-as float v1-6)))))
(s4-0 (new 'stack-no-clear 'vector))
)
(vector-rotate-y! s4-0 *z-vector* (-> this current-wind-angle))
(vector-float*! s4-0 s4-0 -5.0)
(set! (-> s4-0 y) 0.0)
(vector-rotate-y! s4-0 s4-0 f30-1)
(let* ((s3-0 s4-0)
(s2-0 s4-0)
(f30-2 20480.0)
(v1-12 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-13 (the-as number (logior #x3f800000 v1-12)))
)
(vector-float*! s3-0 s2-0 (* f30-2 (+ -1.0 (the-as float v1-13))))
)
(let* ((f30-3 (-> *DUST_STORM-bank* spawn-rand-y-min))
(v1-17 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-18 (the-as number (logior #x3f800000 v1-17)))
)
(set! (-> s4-0 y)
(+ f30-3 (* (+ -1.0 (the-as float v1-18))
(- (-> *DUST_STORM-bank* spawn-rand-y-max) (-> *DUST_STORM-bank* spawn-rand-y-min))
)
)
)
)
(vector+! s4-0 s4-0 (-> this origin))
(if *target*
(vector+float*! s4-0 s4-0 (get-transv *target*) 0.2)
)
(vector+float*! s4-0 s4-0 (-> (math-camera-matrix) fvec) 20480.0)
(let ((f30-4 (* 0.000061035156 (-> this stretch-val))))
(set! (-> *part-id-table* 1421 init-specs 2 initial-valuef) (lerp 20480.0 61440.0 f30-4))
(set! (-> *part-id-table* 1422 init-specs 2 initial-valuef) (lerp 20480.0 61440.0 f30-4))
)
(if (-> this is-intro?)
(launch-particles (-> *part-id-table* 1422) s4-0)
(launch-particles (-> *part-id-table* 1421) s4-0)
)
)
)
(none)
)
;; WARN: Return type mismatch int vs handle.
(defun create-dust-storm ((arg0 process-tree) (arg1 level))
(let ((s5-0 (get-process *default-dead-pool* desert-dust-storm #x4000 1)))
(the-as
handle
(process->handle
(-> (when s5-0
(let ((t9-1 (method-of-type desert-dust-storm activate)))
(t9-1 (the-as desert-dust-storm s5-0) arg0 "desert-dust-storm" (the-as pointer #x70004000))
)
(run-now-in-process s5-0 desert-dust-storm-init-by-other arg1 'track (target-pos 0))
(-> s5-0 ppointer)
)
0
)
)
)
)
)
(defmethod desert-dust-storm-method-20 ((this desert-dust-storm))
(set! (-> this intensity-target) (-> *setting-control* user-current fog-special-interp-targ))
(set! (-> this intensity-rate) (-> *setting-control* user-current fog-special-interp-rate))
(seek! (-> this intensity) (-> this intensity-target) (* (-> this intensity-rate) (seconds-per-frame)))
(let ((f28-0 (-> this intensity))
(f30-0 (-> this intensity-rate))
(s5-0 #f)
)
(cond
((and (-> this next-state) (= (-> this next-state name) 'hold-pos))
(set! f28-0 (fmin 0.8 (-> this intensity)))
(set! f30-0 0.3)
(set! s5-0 #f)
)
((< (vector-vector-xz-distance (math-camera-pos) (-> this fog-plane-origin)) 81920.0)
(let ((s5-2 (vector-! (new 'stack-no-clear 'vector) (math-camera-pos) (-> this fog-plane-origin))))
0.0
0.0
#t
(let* ((f0-12 (vector-dot s5-2 (-> this fog-plane-dir)))
(f0-13 (fmax 0.0 f0-12))
(f1-5 (* 0.000016276043 f0-13))
(f0-15 (fmax 0.0 (fmin 1.0 f1-5)))
)
(set! f28-0 (lerp (fmin 0.8 (-> this intensity)) (-> this intensity) f0-15))
)
)
(set! f30-0 0.3)
(set! s5-0 #t)
)
)
(let* ((f1-10 (* f28-0 (-> *setting-control* user-current dust-storm-fog-scalar)))
(f1-12 (fmax 0.0 (fmin 1.0 f1-10)))
(v1-24 *mood-control*)
(f0-19 (fmax 0.0 (fmin 1.0 f1-12)))
)
(set! (-> v1-24 target-special-interp) f0-19)
(set! (-> v1-24 rate-special-interp) f30-0)
(if s5-0
(set! (-> v1-24 current-special-interp) f0-19)
)
)
)
0
(when *target*
(let* ((f30-1 (* 10.0 *duststorm-wind-vel*))
(f28-1 0.5)
(f26-0 3.5)
(v1-33 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-34 (the-as number (logior #x3f800000 v1-33)))
(f30-2 (* f30-1 (+ f28-1 (* f26-0 (+ -1.0 (the-as float v1-34))))))
(s5-3 (new 'stack-no-clear 'vector))
)
(set! (-> s5-3 quad) (-> *duststorm-wind-vec* quad))
(let* ((f28-2 -0.3)
(f26-1 0.6)
(v1-41 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-42 (the-as number (logior #x3f800000 v1-41)))
)
(set! (-> s5-3 y) (+ f28-2 (* f26-1 (+ -1.0 (the-as float v1-42))) (-> s5-3 y)))
)
(vector-float*! s5-3 s5-3 f30-2)
(let ((t1-0 (new 'static 'vector)))
(set! (-> t1-0 quad) (-> s5-3 quad))
(set-setting! 'global-wind #f 0.0 t1-0)
)
)
(when (and (-> *setting-control* user-current duststorm-push-player?)
(not (focus-test? *target* pilot-riding))
(not (and (-> this next-state) (= (-> this next-state name) 'hold-pos)))
)
(let ((a0-18 (-> *target* control)))
(if (or (not (and a0-18 (logtest? (-> a0-18 status) (collide-status on-surface))))
(< 8192.0 (vector-length (get-transv *target*)))
)
(send-event
*target*
'push-trans
(vector-float*! (new 'stack-no-clear 'vector) *duststorm-wind-vec* (* 0.02 *duststorm-wind-vel*))
(seconds 0.11)
)
)
)
)
)
(let ((f0-36 (fmax 0.0 (fmin 1.0 (-> this intensity)))))
0.0
1.0
(let* ((f1-24 (- 1.0 (* (- 1.0 f0-36) (- 1.0 f0-36))))
(f30-4 (* (fmax 0.0 (fmin 1.0 f1-24)) (-> *setting-control* user-current dust-storm-sound-scalar)))
(f28-3 (lerp 1.0 0.95 f30-4))
(f1-29 (* (lerp 0.4 1.0 f30-4) (/ 1.0 f28-3)))
(f0-43 (fmax 0.0 (fmin 1.0 f1-29)))
)
(if (= f30-4 0.0)
(sound-stop (-> this wind-sound))
(sound-play-by-name
(static-sound-name "storm-wind")
(-> this wind-sound)
(the int (* 1024.0 f0-43))
0
0
(sound-group)
#t
)
)
)
)
(cond
((< 1.0 (-> this intensity))
(let ((f0-48 (+ -1.0 (-> this intensity))))
0.0
(let ((a2-8 (new 'stack-no-clear 'vector)))
(set! (-> a2-8 quad) (-> *time-of-day-context* current-fog fog-color quad))
(set! (-> a2-8 w) (* 128.0 f0-48))
(set! (-> this enabled-screen-filter?) #t)
(setup *screen-filter* a2-8 a2-8 10000.0 (bucket-id generic-sprite-1) #x20000 #x30003 #t)
)
)
)
(else
(when (-> this enabled-screen-filter?)
(disable *screen-filter*)
(set! (-> this enabled-screen-filter?) #f)
)
)
)
(if (not (paused?))
(set! (-> *mood-control* current-special-interp)
(seek
(-> *mood-control* current-special-interp)
(-> *mood-control* target-special-interp)
(* (-> *mood-control* rate-special-interp) (seconds-per-frame))
)
)
)
)
(defun desert-activate ((arg0 level))
(let ((v0-0 (create-dust-storm *entity-pool* arg0)))
(set! (-> *game-info* dust-storm) v0-0)
v0-0
)
)
;; WARN: Return type mismatch symbol vs none.
(defun desert-deactivate ()
(send-event (handle->process (-> *game-info* dust-storm)) 'die)
(set! (-> *game-info* dust-storm) (the-as handle #f))
(none)
)