2020-10-26 21:08:24 -04:00
|
|
|
;;-*-Lisp-*-
|
2020-09-04 14:44:23 -04:00
|
|
|
(in-package goal)
|
|
|
|
|
|
|
|
;; name: sunken-water.gc
|
|
|
|
;; name in dgo: sunken-water
|
|
|
|
;; dgos: L1, SUN, SUNKEN
|
|
|
|
|
2021-09-28 20:42:00 -04:00
|
|
|
;; DECOMP BEGINS
|
|
|
|
|
|
|
|
(deftype sunken-water (water-anim)
|
2023-10-29 23:20:02 -04:00
|
|
|
((use-sync? symbol)
|
|
|
|
(playing-deadly-sound? symbol)
|
|
|
|
(deadly-time float)
|
|
|
|
(deadly-fade float)
|
|
|
|
(sync sync-info :inline)
|
|
|
|
(safe-color-mult vector :inline)
|
|
|
|
(safe-color-emissive vector :inline)
|
|
|
|
(deadly-color-mult vector :inline)
|
|
|
|
(deadly-color-emissive vector :inline)
|
2021-09-28 20:42:00 -04:00
|
|
|
)
|
|
|
|
(:methods
|
2023-10-29 23:20:02 -04:00
|
|
|
(draw-ripple (_type_) symbol)
|
2021-09-28 20:42:00 -04:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2021-12-28 23:16:42 -05:00
|
|
|
(define ripple-for-sunken-water (new 'static 'ripple-wave-set
|
|
|
|
:count 3
|
|
|
|
:converted #f
|
|
|
|
:normal-scale 1.0
|
2022-06-09 21:18:08 -04:00
|
|
|
:wave (new 'static 'inline-array ripple-wave 4
|
2021-12-28 23:16:42 -05:00
|
|
|
(new 'static 'ripple-wave :scale 40.0 :xdiv 1 :speed 1.5)
|
|
|
|
(new 'static 'ripple-wave :scale 40.0 :xdiv -1 :zdiv 1 :speed 1.5)
|
|
|
|
(new 'static 'ripple-wave :scale 20.0 :xdiv 5 :zdiv 3 :speed 0.75)
|
|
|
|
(new 'static 'ripple-wave)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2021-09-28 20:42:00 -04:00
|
|
|
|
2022-01-15 20:01:38 -05:00
|
|
|
(defpartgroup group-sunken-water-deadly-water
|
|
|
|
:id 446
|
|
|
|
:flags (use-local-clock)
|
|
|
|
:bounds (static-bspherem 0 0 0 8)
|
2022-06-09 21:18:08 -04:00
|
|
|
:parts ((sp-item 1736 :fade-after (meters 50)))
|
2022-01-15 20:01:38 -05:00
|
|
|
)
|
2021-09-28 20:42:00 -04:00
|
|
|
|
2022-01-15 20:01:38 -05:00
|
|
|
(defpart 1736
|
2023-04-29 11:01:47 -04:00
|
|
|
:init-specs ((:texture (new 'static 'texture-id :index #xf :page #x2))
|
|
|
|
(:num 1.0)
|
|
|
|
(:y (meters 0))
|
|
|
|
(:scale-x (meters 1) (meters 4))
|
|
|
|
(:scale-y (meters 0.25))
|
|
|
|
(:r 255.0)
|
|
|
|
(:g 255.0)
|
|
|
|
(:b 255.0)
|
|
|
|
(:a 96.0 32.0)
|
|
|
|
(:scalevel-x (meters 0.1875))
|
|
|
|
(:scalevel-y (meters -0.001875))
|
|
|
|
(:fade-a -3.2)
|
|
|
|
(:timer (seconds 0.27))
|
|
|
|
(:flags (bit2 bit3 bit14))
|
|
|
|
(:next-time (seconds 0.05))
|
|
|
|
(:next-launcher 2022)
|
2022-01-15 20:01:38 -05:00
|
|
|
)
|
|
|
|
)
|
2021-09-28 20:42:00 -04:00
|
|
|
|
2022-01-15 20:01:38 -05:00
|
|
|
(defpart 2022
|
2023-04-29 11:01:47 -04:00
|
|
|
:init-specs ((:r 255.0) (:g 128.0 128.0) (:b 0.0) (:fade-a -1.28))
|
2022-01-15 20:01:38 -05:00
|
|
|
)
|
2021-09-28 20:42:00 -04:00
|
|
|
|
2023-10-29 23:20:02 -04:00
|
|
|
(defmethod draw-ripple ((this sunken-water))
|
2023-09-26 10:17:00 -04:00
|
|
|
(set! (-> this draw ripple send-query) #t)
|
|
|
|
(let ((gp-0 (-> this draw ripple query)))
|
|
|
|
(let ((a0-1 (current-time)))
|
2021-12-28 23:16:42 -05:00
|
|
|
(set! (-> gp-0 start-vertex) (logand (* 13 (logand a0-1 127)) 127))
|
|
|
|
)
|
|
|
|
(set! (-> gp-0 vertex-skip) 128)
|
|
|
|
(dotimes (s5-0 (-> gp-0 vertex-count))
|
2022-06-19 17:01:51 -04:00
|
|
|
(launch-particles (-> *part-id-table* 1736) (-> gp-0 data s5-0))
|
2021-12-28 23:16:42 -05:00
|
|
|
)
|
2021-09-28 20:42:00 -04:00
|
|
|
)
|
|
|
|
#f
|
|
|
|
)
|
|
|
|
|
|
|
|
(defstate water-vol-idle (sunken-water)
|
|
|
|
:virtual #t
|
2023-09-22 05:54:49 -04:00
|
|
|
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
|
|
|
(case message
|
2021-12-28 23:16:42 -05:00
|
|
|
(('notify)
|
2023-09-22 05:54:49 -04:00
|
|
|
(if (= (-> block param 0) 'attack)
|
2022-06-13 18:39:22 -04:00
|
|
|
(sound-play "get-shocked")
|
2021-12-28 23:16:42 -05:00
|
|
|
)
|
2021-09-28 20:42:00 -04:00
|
|
|
)
|
2021-12-28 23:16:42 -05:00
|
|
|
(else
|
2023-09-22 05:54:49 -04:00
|
|
|
((-> (method-of-type water-anim water-vol-idle) event) proc argc message block)
|
2021-12-28 23:16:42 -05:00
|
|
|
)
|
2021-09-28 20:42:00 -04:00
|
|
|
)
|
|
|
|
)
|
2022-06-09 21:18:08 -04:00
|
|
|
:trans (behavior ()
|
2021-12-28 23:16:42 -05:00
|
|
|
(let ((t9-0 (-> (method-of-type water-anim water-vol-idle) trans)))
|
|
|
|
(if t9-0
|
|
|
|
(t9-0)
|
2021-09-28 20:42:00 -04:00
|
|
|
)
|
2021-12-28 23:16:42 -05:00
|
|
|
)
|
|
|
|
(cond
|
|
|
|
((-> self use-sync?)
|
|
|
|
(cond
|
|
|
|
((< (get-current-phase (-> self sync)) (-> self deadly-time))
|
|
|
|
(when (!= (-> self deadly-fade) 1.0)
|
2023-09-26 10:17:00 -04:00
|
|
|
(seek! (-> self deadly-fade) 1.0 (* 8.0 (seconds-per-frame)))
|
2021-12-28 23:16:42 -05:00
|
|
|
(let ((f30-0 (-> self deadly-fade)))
|
|
|
|
(vector-lerp! (-> self draw color-mult) (-> self safe-color-mult) (-> self deadly-color-mult) f30-0)
|
|
|
|
(vector-lerp!
|
|
|
|
(-> self draw color-emissive)
|
|
|
|
(-> self safe-color-emissive)
|
|
|
|
(-> self deadly-color-emissive)
|
|
|
|
f30-0
|
|
|
|
)
|
|
|
|
(set! (-> self draw color-mult w) 0.5)
|
|
|
|
(if (= f30-0 1.0)
|
2023-07-08 02:34:38 -04:00
|
|
|
(logior! (-> self flags) (water-flags wt19))
|
2021-12-28 23:16:42 -05:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(draw-ripple self)
|
|
|
|
(when (not (-> self playing-deadly-sound?))
|
|
|
|
(set! (-> self playing-deadly-sound?) #t)
|
2022-06-13 18:39:22 -04:00
|
|
|
(sound-play "water-on")
|
2021-12-28 23:16:42 -05:00
|
|
|
)
|
|
|
|
(update! (-> self sound))
|
2021-09-28 20:42:00 -04:00
|
|
|
)
|
2021-12-28 23:16:42 -05:00
|
|
|
(else
|
2022-05-02 18:35:17 -04:00
|
|
|
(logclear! (-> self flags) (water-flags wt19))
|
2021-12-28 23:16:42 -05:00
|
|
|
(when (!= (-> self deadly-fade) 0.0)
|
2023-09-26 10:17:00 -04:00
|
|
|
(seek! (-> self deadly-fade) 0.0 (* 8.0 (seconds-per-frame)))
|
2021-12-28 23:16:42 -05:00
|
|
|
(let ((f30-1 (-> self deadly-fade)))
|
|
|
|
(vector-lerp! (-> self draw color-mult) (-> self safe-color-mult) (-> self deadly-color-mult) f30-1)
|
|
|
|
(vector-lerp!
|
|
|
|
(-> self draw color-emissive)
|
|
|
|
(-> self safe-color-emissive)
|
|
|
|
(-> self deadly-color-emissive)
|
|
|
|
f30-1
|
|
|
|
)
|
|
|
|
(set! (-> self draw color-mult w) 0.5)
|
|
|
|
(if (= f30-1 0.0)
|
2022-05-02 18:35:17 -04:00
|
|
|
(logclear! (-> self flags) (water-flags wt19))
|
2021-12-28 23:16:42 -05:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(when (-> self playing-deadly-sound?)
|
|
|
|
(set! (-> self playing-deadly-sound?) #f)
|
|
|
|
(stop! (-> self sound))
|
2022-06-13 18:39:22 -04:00
|
|
|
(sound-play "water-off")
|
2021-12-28 23:16:42 -05:00
|
|
|
)
|
|
|
|
)
|
2021-09-28 20:42:00 -04:00
|
|
|
)
|
2021-12-28 23:16:42 -05:00
|
|
|
(set-fade!
|
|
|
|
*palette-fade-controls*
|
|
|
|
3
|
|
|
|
(-> self deadly-fade)
|
|
|
|
(vector-vector-distance (-> self root trans) (camera-pos))
|
|
|
|
(the-as vector #f)
|
2021-09-28 20:42:00 -04:00
|
|
|
)
|
|
|
|
)
|
|
|
|
(else
|
2022-05-02 18:35:17 -04:00
|
|
|
(when (logtest? (water-flags wt19) (-> self flags))
|
2021-12-28 23:16:42 -05:00
|
|
|
(draw-ripple self)
|
|
|
|
(update! (-> self sound))
|
|
|
|
(set! (-> self playing-deadly-sound?) #t)
|
2021-09-28 20:42:00 -04:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2023-09-23 09:53:50 -04:00
|
|
|
:post ja-post
|
2021-09-28 20:42:00 -04:00
|
|
|
)
|
|
|
|
|
2023-10-29 23:20:02 -04:00
|
|
|
(defmethod water-vol-method-25 ((this sunken-water))
|
2023-04-05 18:41:05 -04:00
|
|
|
(let ((t9-0 (method-of-type water-anim water-vol-method-25)))
|
2023-09-26 10:17:00 -04:00
|
|
|
(t9-0 this)
|
2021-12-28 23:16:42 -05:00
|
|
|
)
|
2023-09-26 10:17:00 -04:00
|
|
|
(set! (-> this playing-deadly-sound?) #f)
|
|
|
|
(set-vector! (-> this safe-color-mult) 0.125 0.225 0.22 0.5)
|
|
|
|
(set-vector! (-> this safe-color-emissive) 0.0 0.0 0.0 1.0)
|
|
|
|
(set-vector! (-> this deadly-color-mult) 0.125 0.225 0.22 0.5)
|
|
|
|
(set-vector! (-> this deadly-color-emissive) 0.33 0.6 0.0 1.0)
|
|
|
|
(let ((s5-0 (load-params! (-> this sync) this (the-as uint 1500) 0.0 0.15 0.15)))
|
|
|
|
(let ((f0-16 (res-lump-float (-> this entity) 'percent :default -1.0)))
|
2021-12-28 23:16:42 -05:00
|
|
|
(if (or (< f0-16 0.0) (< 1.0 f0-16))
|
|
|
|
(set! f0-16 (cond
|
|
|
|
(s5-0
|
|
|
|
0.5
|
|
|
|
)
|
2023-09-26 10:17:00 -04:00
|
|
|
((logtest? (water-flags wt19) (-> this flags))
|
2021-12-28 23:16:42 -05:00
|
|
|
1.0
|
|
|
|
)
|
|
|
|
(else
|
|
|
|
0.0
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(when (and s5-0 (or (= f0-16 0.0) (= f0-16 1.0)))
|
|
|
|
(set! s5-0 #f)
|
|
|
|
(if (= f0-16 0.0)
|
2023-09-26 10:17:00 -04:00
|
|
|
(logior! (-> this flags) (water-flags wt19))
|
|
|
|
(logclear! (-> this flags) (water-flags wt19))
|
2021-12-28 23:16:42 -05:00
|
|
|
)
|
|
|
|
)
|
2023-09-26 10:17:00 -04:00
|
|
|
(set! (-> this use-sync?) s5-0)
|
|
|
|
(set! (-> this deadly-time) f0-16)
|
2021-09-28 20:42:00 -04:00
|
|
|
)
|
2022-05-02 18:35:17 -04:00
|
|
|
(when s5-0
|
2023-09-26 10:17:00 -04:00
|
|
|
(if (< (get-current-phase (-> this sync)) (-> this deadly-time))
|
|
|
|
(set! (-> this flags) (the-as water-flags (logior (water-flags wt19) (-> this flags))))
|
|
|
|
(set! (-> this flags) (the-as water-flags (logclear (-> this flags) (water-flags wt19))))
|
2022-05-02 18:35:17 -04:00
|
|
|
)
|
|
|
|
)
|
2021-09-28 20:42:00 -04:00
|
|
|
)
|
2022-05-02 18:35:17 -04:00
|
|
|
(none)
|
2021-09-28 20:42:00 -04:00
|
|
|
)
|
|
|
|
|
2023-10-29 23:20:02 -04:00
|
|
|
(defmethod water-vol-method-22 ((this sunken-water))
|
2023-04-05 18:41:05 -04:00
|
|
|
(let ((t9-0 (method-of-type water-anim water-vol-method-22)))
|
2023-09-26 10:17:00 -04:00
|
|
|
(t9-0 this)
|
2021-12-28 23:16:42 -05:00
|
|
|
)
|
2023-09-26 10:17:00 -04:00
|
|
|
(set! (-> this play-ambient-sound?) #f)
|
2021-09-28 20:42:00 -04:00
|
|
|
(cond
|
2023-09-26 10:17:00 -04:00
|
|
|
((logtest? (water-flags wt19) (-> this flags))
|
|
|
|
(set! (-> this draw color-mult quad) (-> this deadly-color-mult quad))
|
|
|
|
(set! (-> this draw color-emissive quad) (-> this deadly-color-emissive quad))
|
|
|
|
(set! (-> this deadly-fade) 1.0)
|
2021-12-28 23:16:42 -05:00
|
|
|
)
|
|
|
|
(else
|
2023-09-26 10:17:00 -04:00
|
|
|
(set! (-> this draw color-mult quad) (-> this safe-color-mult quad))
|
|
|
|
(set! (-> this draw color-emissive quad) (-> this safe-color-emissive quad))
|
|
|
|
(set! (-> this deadly-fade) 0.0)
|
2021-12-28 23:16:42 -05:00
|
|
|
)
|
2021-09-28 20:42:00 -04:00
|
|
|
)
|
|
|
|
(let ((s5-0 (new 'process 'ripple-control)))
|
2023-09-26 10:17:00 -04:00
|
|
|
(set! (-> this draw ripple) s5-0)
|
2021-12-28 23:16:42 -05:00
|
|
|
(set! (-> s5-0 global-scale) 3072.0)
|
|
|
|
(set! (-> s5-0 close-fade-dist) 163840.0)
|
|
|
|
(set! (-> s5-0 far-fade-dist) 245760.0)
|
|
|
|
(set! (-> s5-0 waveform) ripple-for-sunken-water)
|
|
|
|
(set! (-> s5-0 query) (new 'process 'ripple-merc-query 100))
|
2021-09-28 20:42:00 -04:00
|
|
|
)
|
2021-12-28 23:16:42 -05:00
|
|
|
(none)
|
2021-09-28 20:42:00 -04:00
|
|
|
)
|