jak-project/goal_src/jak2/engine/gfx/mood/time-of-day.gc
ManDude d46f790973
[jak2] un-hardcode level-related code a bit (#2330)
Makes it less of a headache to change level amounts.
2023-03-19 05:33:04 +00:00

700 lines
25 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: time-of-day.gc
;; name in dgo: time-of-day
;; dgos: ENGINE, GAME
(define-extern time-of-day-effect (function none))
;; DECOMP BEGINS
;; definition for method 5 of type time-of-day-palette
;; WARN: Return type mismatch uint vs int.
(defmethod asize-of time-of-day-palette ((obj time-of-day-palette))
(the-as int (+ (-> obj type size) (* (* (-> obj height) (-> obj width)) 4)))
)
;; definition for method 10 of type time-of-day-proc
(defmethod deactivate time-of-day-proc ((obj time-of-day-proc))
(if (nonzero? (-> obj sun))
(kill-and-free-particles (-> obj sun))
)
(if (nonzero? (-> obj green-sun))
(kill-and-free-particles (-> obj green-sun))
)
(if (nonzero? (-> obj moon))
(kill-and-free-particles (-> obj moon))
)
((method-of-type process deactivate) obj)
(none)
)
;; failed to figure out what this is:
(if (zero? time-of-day-effect)
(set! time-of-day-effect nothing)
)
;; definition for function time-of-day-update
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defbehavior time-of-day-update time-of-day-proc ()
(time-of-day-effect)
(let ((gp-0 #t))
(dotimes (v1-0 (-> *level* length))
(let ((a0-3 (-> *level* level v1-0)))
(when (= (-> a0-3 status) 'active)
(if (-> a0-3 info use-camera-other)
(set! gp-0 #f)
)
)
)
)
(when (and (-> *setting-control* user-current weather) gp-0)
(let ((s5-0 (new 'stack-no-clear 'vector))
(s4-0 (new 'stack-no-clear 'vector))
)
(let ((v1-8 (-> *math-camera* inv-camera-rot vector 2)))
(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-8)))
(vector+float*! s5-0 s5-0 v1-8 (* 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
((and (>= (-> self time-of-day) 6.25)
(and (< (-> self time-of-day) 18.75) (-> *time-of-day-context* sky) gp-0)
)
(when (and *dproc* (zero? (-> self sun-count)))
(spawn (-> self sun) (math-camera-pos))
(+! (-> self sun-count) 1)
)
)
((> (-> self sun-count) 0)
(kill-and-free-particles (-> self sun))
(set! (-> self sun-count) 0)
0
)
)
(cond
((and (or (>= (-> self time-of-day) 21.75) (>= 10.25 (-> self time-of-day)))
(-> *time-of-day-context* sky)
gp-0
)
(when (and *dproc* (zero? (-> self green-sun-count)))
(spawn (-> self green-sun) (math-camera-pos))
(+! (-> self green-sun-count) 1)
)
)
((> (-> self green-sun-count) 0)
(kill-and-free-particles (-> self green-sun))
(set! (-> self green-sun-count) 0)
0
)
)
(set! gp-0 (and (or (>= 7.0 (-> self time-of-day)) (>= (-> self time-of-day) 17.0))
(and (-> *time-of-day-context* sky) gp-0)
)
)
(cond
(gp-0
(when (and *dproc* (zero? (-> self moon-count)))
(spawn (-> self moon) (math-camera-pos))
(+! (-> self moon-count) 1)
)
)
((> (-> self moon-count) 0)
(kill-and-free-particles (-> self moon))
(set! (-> self moon-count) 0)
0
)
)
)
(update-time-and-speed *sky-work* (-> self time-of-day) (-> self time-ratio))
0
(none)
)
;; definition for function update-counters
(defbehavior update-counters time-of-day-proc ()
(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) (arg1 int) (event-type symbol) (event event-message-block))
(the-as
object
(case event-type
(('change)
(case (-> event param 0)
(('ratio)
(let ((a0-5 (-> *display* bg-clock))
(f0-0 (the-as float (-> event param 1)))
)
(set! (-> self time-ratio) f0-0)
(set! (-> self dest-time-ratio) f0-0)
(update-rates! a0-5 f0-0)
)
)
(('hour)
(update-counters)
(let ((v1-7 (-> *display* bg-clock frame-counter))
(a0-7 #x69780)
(a1-5 (/ (the int (* 1080000.0 (the float (-> event param 1)))) 60))
)
(set! (-> *display* bg-clock frame-counter) (+ (- v1-7 (the-as time-frame (mod v1-7 a0-7))) a0-7 a1-5))
)
(update-counters)
(-> self hours)
(kill-and-free-particles (-> self sun))
(spawn (-> self sun) (math-camera-pos))
(set! (-> self sun-count) 1)
(kill-and-free-particles (-> self green-sun))
(spawn (-> self green-sun) (math-camera-pos))
(set! (-> self green-sun-count) 1)
(kill-and-free-particles (-> self moon))
(spawn (-> self moon) (math-camera-pos))
(let ((v0-0 (the-as number 1)))
(set! (-> self moon-count) (the-as int v0-0))
v0-0
)
)
)
)
(('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 (-> event param 0)))
(let ((f0-12 (-> self time-ratio))
(f1-5 (-> self dest-time-ratio))
(f2-1 (/ 300.0 (the float (-> event param 1))))
)
(set! (-> self dest-time-delta) (* (fabs (- f0-12 f1-5)) 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
(none)
)
:post time-of-day-update
)
;; definition for function init-time-of-day
(defbehavior init-time-of-day time-of-day-proc ()
(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 event-hook) (-> time-of-day-tick event))
(go time-of-day-tick)
)
;; definition for function start-time-of-day
;; WARN: Return type mismatch (pointer time-of-day-proc) vs (pointer process).
(defun start-time-of-day ()
(kill-by-name "time-of-day-proc" *active-pool*)
(set! *time-of-day* (process-spawn time-of-day-proc :init init-time-of-day :to *bg-pool*))
(the-as (pointer process) *time-of-day*)
)
;; definition for function time-of-day-setup
(defun time-of-day-setup ((arg0 symbol))
(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)
)
;; definition for function time-of-day-interp-colors
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for function time-of-day-interp-colors-scratch
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for function init-time-of-day-context
(defun init-time-of-day-context ((arg0 time-of-day-context))
(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 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-8 8)
(set! (-> *overide-mood-color-table* data v1-8 lgt-color w) 1.0)
(set! (-> *overide-mood-color-table* data v1-8 amb-color w) 1.0)
(set! (-> *overide-mood-fog-table* data v1-8 fog-color w) 1.0)
(set! (-> *overide-mood-fog-table* data v1-8 fog-dists x)
(* 0.00024414062 (-> *overide-mood-fog-table* data v1-8 fog-dists x))
)
(set! (-> *overide-mood-fog-table* data v1-8 fog-dists y)
(* 0.00024414062 (-> *overide-mood-fog-table* data v1-8 fog-dists y))
)
(set-vector! (-> *time-of-day-context* times v1-8) 1.0 1.0 1.0 1.0)
)
#f
)
)
;; definition for function set-filter-color!
;; WARN: Return type mismatch int vs none.
(defun set-filter-color! ((arg0 float) (arg1 float) (arg2 float))
(set-vector! (-> *time-of-day-context* filter-color) arg0 arg1 arg2 1.0)
0
(none)
)
;; definition for function tod-madd!
(defun tod-madd! ((arg0 vector) (arg1 vector) (arg2 vector))
(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
)
)
;; definition for function update-environment-colors
(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
)
)
)
;; definition for function update-time-of-day
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(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* default-level mood-context)))
(clear-mood-times s5-0)
(update-mood-exterior s5-0 *overide-table* (-> arg0 time) 6)
(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* default-level mood-context)))
(clear-mood-times s4-0)
(update-mood-exterior s4-0 s5-1 (-> arg0 time) 6)
(update-mood-itimes s4-0)
)
)
)
)
(vector-float*! (-> arg0 filter) (-> arg0 filter-color) (-> arg0 filter-color w))
(set! (-> arg0 sky) #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-50 (-> *level* level v1-19)))
(when (= (-> a0-50 status) 'active)
(if (-> a0-50 info sky)
(set! (-> arg0 sky) #t)
)
(if (-> a0-50 info use-camera-other)
(set! (-> arg0 use-camera-other) (the-as basic #t))
)
(set! f0-16 (fmin f0-16 (-> a0-50 info fog-height)))
)
)
)
(set-fog-height! f0-16)
)
(if (-> arg0 sky)
(set! (-> (&-> *level* default-level texture-anim-array 9) 0) *sky-texture-anim-array*)
(set! (-> (&-> *level* default-level texture-anim-array 9) 0) #f)
)
(let ((s5-2 (level-get-target-inside *level*)))
(dotimes (s4-1 LEVEL_MAX)
(let ((s3-0 (-> *level* level s4-1)))
(case (-> s3-0 status)
(('active 'loaded)
(when (not (paused?))
(cond
((= 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))
(clear-mood-times (-> s3-0 mood-context))
((-> s3-0 mood-func) (-> s3-0 mood-context) (-> arg0 time) s4-1)
(when (-> arg0 overide-enable)
(let ((s1-0 (new 'stack-no-clear 'vector)))
(dotimes (s0-0 8)
(let ((a1-48 (-> 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-48) (the-as vector4 a1-48) (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-27 0.0))
(dotimes (v1-79 6)
(+! f0-27 (-> arg0 interp v1-79))
)
(when (!= f0-27 0.0)
(dotimes (v1-83 6)
(set! (-> arg0 interp v1-83) (/ (-> arg0 interp v1-83) f0-27))
)
(let ((v1-86 (-> arg0 current-fog)))
(dotimes (a0-76 103)
(set! (-> (the-as (pointer int128) (+ (* a0-76 16) (the-as int v1-86)))) (the int128 0))
)
)
(let ((s5-3 (-> arg0 current-fog))
(s4-2 (-> *mood-control* range))
)
(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 (s3-1 6)
(let ((f30-0 (-> arg0 interp s3-1))
(s2-1 *level*)
)
(when (!= f30-0 0.0)
(let ((a2-20 (+ (the-as uint (-> s2-1 level0 mood-context)) (* 5232 s3-1))))
(vector4-array-madd!
(the-as (inline-array vector4) s5-3)
(the-as (inline-array vector4) s5-3)
(the-as (inline-array vector4) a2-20)
f30-0
103
)
)
(let ((a2-21 (-> s2-1 level s3-1 info mood-range)))
(vector4-madd! (the-as vector4 s4-2) (the-as vector4 s4-2) (the-as vector4 a2-21) f30-0)
)
(+! (-> arg0 max-rain) (* (-> s2-1 level s3-1 info max-rain) f30-0))
(+! (-> arg0 fog-mult) (* (-> s2-1 level s3-1 info fog-mult) f30-0))
(+! (-> arg0 ocean-alpha) (* (-> s2-1 level s3-1 info ocean-alpha) f30-0))
)
)
)
)
(dotimes (s5-4 8)
(dotimes (s4-3 3)
(let ((v1-119 (+ (+ (* 48 s4-3) 140 (* 192 s5-4)) (the-as int arg0))))
(vector-normalize! (the-as vector (+ v1-119 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
)
)
(update-environment-colors arg0)
(let ((v1-134 (-> arg0 current-fog)))
(let ((a0-87 (-> v1-134 fog-color)))
(set! *fog-color*
(new 'static 'rgba :r (the int (-> a0-87 x)) :g (the int (-> a0-87 y)) :b (the int (-> a0-87 z)))
)
(set! (-> *fog-texture-work* color)
(the-as
uint
(logior (logior (logior (shr (shl (the int (-> a0-87 z)) 56) 40) (shr (shl (the int (-> a0-87 y)) 56) 48))
(shr (shl (the int (-> a0-87 x)) 56) 56)
)
(shr (shl (the int (-> a0-87 x)) 56) 56)
)
)
)
)
(let ((a0-92 (-> v1-134 erase-color)))
(set! (-> arg0 erase-color)
(new 'static 'rgba :a #x80 :b (the int (-> a0-92 z)) :g (the int (-> a0-92 y)) :r (the int (-> a0-92 x)))
)
)
(let ((f0-58 (-> v1-134 fog-dists x))
(f1-18 (-> v1-134 fog-dists y))
)
(let ((f3-0 (-> v1-134 fog-dists z))
(f2-2 (-> v1-134 fog-dists w))
)
(set! (-> *math-camera* fog-start) f0-58)
(set! (-> *math-camera* fog-end) f1-18)
(set! (-> *math-camera* fog-max) f3-0)
(set! (-> *math-camera* fog-min) f2-2)
(set! (-> *fog-texture-work* alpha-near) (* 0.003921569 (the float (- 255 (the int f3-0)))))
(set! (-> *fog-texture-work* alpha-far) (* 0.003921569 (the float (- 255 (the int f2-2)))))
)
(set! (-> *fog-texture-work* alpha-delta)
(- (-> *fog-texture-work* alpha-far) (-> *fog-texture-work* alpha-near))
)
(set! (-> *fog-texture-work* fog-near) f0-58)
(set! (-> *fog-texture-work* fog-far) f1-18)
(set! (-> *fog-texture-work* fog-delta) (- f1-18 f0-58))
)
)
(set-cloud-minmax! (-> arg0 current-clouds cloud-min) (-> arg0 current-clouds cloud-max))
(reset! *palette-fade-controls*)
0
(none)
)
)
;; definition for function calc-fade-from-fog
(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)))
)
)
;; definition for method 10 of type palette-fade-controls
;; INFO: Used lq/sq
(defmethod set-fade! palette-fade-controls ((obj palette-fade-controls) (arg0 int) (arg1 float) (arg2 float) (arg3 vector))
(cond
((and (>= arg0 0) (< arg0 8))
(let ((v1-3 (-> obj 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!~%")
)
)
)
;; definition for method 9 of type palette-fade-controls
;; WARN: Return type mismatch int vs none.
(defmethod reset! palette-fade-controls ((obj palette-fade-controls))
(countdown (v1-0 8)
(let ((a1-2 (-> obj control v1-0)))
(set! (-> a1-2 fade) 0.0)
(set! (-> a1-2 actor-dist) 4096000000.0)
)
)
0
(none)
)
;; failed to figure out what this is:
(start-time-of-day)