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)
|
|
|
|
((use-sync? symbol :offset-assert 220)
|
|
|
|
(playing-deadly-sound? symbol :offset-assert 224)
|
|
|
|
(deadly-time float :offset-assert 228)
|
|
|
|
(deadly-fade float :offset-assert 232)
|
|
|
|
(sync sync-info :inline :offset-assert 236)
|
|
|
|
(safe-color-mult vector :inline :offset-assert 256)
|
|
|
|
(safe-color-emissive vector :inline :offset-assert 272)
|
|
|
|
(deadly-color-mult vector :inline :offset-assert 288)
|
|
|
|
(deadly-color-emissive vector :inline :offset-assert 304)
|
|
|
|
)
|
|
|
|
:heap-base #xd0
|
|
|
|
:method-count-assert 31
|
|
|
|
:size-assert #x140
|
|
|
|
:flag-assert #x1f00d00140
|
|
|
|
(:methods
|
|
|
|
(draw-ripple (_type_) symbol 30)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
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
|
|
|
|
:wave
|
|
|
|
(new 'static 'inline-array ripple-wave 4
|
|
|
|
(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
|
|
|
|
2021-12-28 23:16:42 -05:00
|
|
|
(set! (-> *part-group-id-table* 446)
|
|
|
|
(new 'static 'sparticle-launch-group
|
|
|
|
:length 1
|
|
|
|
:duration #xbb8
|
|
|
|
:linger-duration #x5dc
|
|
|
|
:flags (sp-group-flag use-local-clock)
|
|
|
|
:name "group-sunken-water-deadly-water"
|
|
|
|
:launcher
|
|
|
|
(new 'static 'inline-array sparticle-group-item 1 (sp-item 1736 :fade-after (meters 50.0)))
|
|
|
|
:bounds (new 'static 'sphere :w 32768.0)
|
|
|
|
)
|
|
|
|
)
|
2021-09-28 20:42:00 -04:00
|
|
|
|
2021-12-28 23:16:42 -05:00
|
|
|
(set! (-> *part-id-table* 1736) (new 'static 'sparticle-launcher
|
|
|
|
:init-specs
|
|
|
|
(new 'static 'inline-array sp-field-init-spec 17
|
|
|
|
(sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2))
|
|
|
|
(sp-flt spt-num 1.0)
|
|
|
|
(sp-flt spt-y (meters 0.0))
|
|
|
|
(sp-rnd-flt spt-scale-x (meters 1.0) (meters 4.0) 1.0)
|
|
|
|
(sp-flt spt-scale-y (meters 0.25))
|
|
|
|
(sp-flt spt-r 255.0)
|
|
|
|
(sp-flt spt-g 255.0)
|
|
|
|
(sp-flt spt-b 255.0)
|
|
|
|
(sp-rnd-flt spt-a 96.0 32.0 1.0)
|
|
|
|
(sp-flt spt-scalevel-x (meters 0.1875))
|
|
|
|
(sp-flt spt-scalevel-y (meters -0.001875))
|
|
|
|
(sp-flt spt-fade-a -3.2)
|
|
|
|
(sp-int spt-timer 81)
|
|
|
|
(sp-cpuinfo-flags bit2 bit3 bit14)
|
|
|
|
(sp-int spt-next-time 15)
|
|
|
|
(sp-launcher-by-id spt-next-launcher 2022)
|
|
|
|
(sp-end)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2021-09-28 20:42:00 -04:00
|
|
|
|
2021-12-28 23:16:42 -05:00
|
|
|
(set! (-> *part-id-table* 2022)
|
|
|
|
(new 'static 'sparticle-launcher :init-specs (new 'static 'inline-array sp-field-init-spec 5
|
|
|
|
(sp-flt spt-r 255.0)
|
|
|
|
(sp-rnd-flt spt-g 128.0 128.0 1.0)
|
|
|
|
(sp-flt spt-b 0.0)
|
|
|
|
(sp-flt spt-fade-a -1.28)
|
|
|
|
(sp-end)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2021-09-28 20:42:00 -04:00
|
|
|
|
|
|
|
(defmethod draw-ripple sunken-water ((obj sunken-water))
|
|
|
|
(set! (-> obj draw ripple send-query) #t)
|
|
|
|
(let ((gp-0 (-> obj draw ripple query)))
|
2021-12-28 23:16:42 -05:00
|
|
|
(let ((a0-1 (-> *display* base-frame-counter)))
|
|
|
|
(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))
|
|
|
|
(sp-launch-particles-var
|
|
|
|
*sp-particle-system-2d*
|
|
|
|
(-> *part-id-table* 1736)
|
|
|
|
(-> gp-0 data s5-0)
|
|
|
|
(the-as sparticle-launch-state #f)
|
|
|
|
(the-as sparticle-launch-control #f)
|
|
|
|
1.0
|
|
|
|
)
|
|
|
|
)
|
2021-09-28 20:42:00 -04:00
|
|
|
)
|
|
|
|
#f
|
|
|
|
)
|
|
|
|
|
|
|
|
(defstate water-vol-idle (sunken-water)
|
|
|
|
:virtual #t
|
|
|
|
:event
|
|
|
|
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
2021-12-28 23:16:42 -05:00
|
|
|
(case arg2
|
|
|
|
(('notify)
|
|
|
|
(if (= (-> arg3 param 0) 'attack)
|
|
|
|
(sound-play-by-name (static-sound-name "get-shocked") (new-sound-id) 1024 0 0 1 #t)
|
|
|
|
)
|
2021-09-28 20:42:00 -04:00
|
|
|
)
|
2021-12-28 23:16:42 -05:00
|
|
|
(else
|
|
|
|
((-> (method-of-type water-anim water-vol-idle) event) arg0 arg1 arg2 arg3)
|
|
|
|
)
|
2021-09-28 20:42:00 -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)
|
|
|
|
(set! (-> self deadly-fade) (seek (-> self deadly-fade) 1.0 (* 8.0 (-> *display* seconds-per-frame))))
|
|
|
|
(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)
|
|
|
|
(set! (-> self flags) (logior #x80000 (-> self flags)))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(draw-ripple self)
|
|
|
|
(when (not (-> self playing-deadly-sound?))
|
|
|
|
(set! (-> self playing-deadly-sound?) #t)
|
|
|
|
(sound-play-by-name (static-sound-name "water-on") (new-sound-id) 1024 0 0 1 #t)
|
|
|
|
)
|
|
|
|
(update! (-> self sound))
|
2021-09-28 20:42:00 -04:00
|
|
|
)
|
2021-12-28 23:16:42 -05:00
|
|
|
(else
|
|
|
|
(set! (-> self flags) (logand -524289 (-> self flags)))
|
|
|
|
(when (!= (-> self deadly-fade) 0.0)
|
|
|
|
(set! (-> self deadly-fade) (seek (-> self deadly-fade) 0.0 (* 8.0 (-> *display* seconds-per-frame))))
|
|
|
|
(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)
|
|
|
|
(set! (-> self flags) (logand -524289 (-> self flags)))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(when (-> self playing-deadly-sound?)
|
|
|
|
(set! (-> self playing-deadly-sound?) #f)
|
|
|
|
(stop! (-> self sound))
|
|
|
|
(sound-play-by-name (static-sound-name "water-off") (new-sound-id) 1024 0 0 1 #t)
|
|
|
|
)
|
|
|
|
)
|
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
|
2021-12-28 23:16:42 -05:00
|
|
|
(when (logtest? #x80000 (-> self flags))
|
|
|
|
(draw-ripple self)
|
|
|
|
(update! (-> self sound))
|
|
|
|
(set! (-> self playing-deadly-sound?) #t)
|
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
|
|
|
)
|
|
|
|
:post
|
|
|
|
(the-as (function none :behavior sunken-water) ja-post)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defmethod TODO-RENAME-25 sunken-water ((obj sunken-water))
|
|
|
|
(local-vars (v0-3 uint))
|
|
|
|
(let ((t9-0 (method-of-type water-anim TODO-RENAME-25)))
|
2021-12-28 23:16:42 -05:00
|
|
|
(t9-0 obj)
|
|
|
|
)
|
2021-09-28 20:42:00 -04:00
|
|
|
(set! (-> obj playing-deadly-sound?) #f)
|
|
|
|
(set-vector! (-> obj safe-color-mult) 0.125 0.225 0.22 0.5)
|
|
|
|
(set-vector! (-> obj safe-color-emissive) 0.0 0.0 0.0 1.0)
|
|
|
|
(set-vector! (-> obj deadly-color-mult) 0.125 0.225 0.22 0.5)
|
|
|
|
(set-vector! (-> obj deadly-color-emissive) 0.33 0.6 0.0 1.0)
|
2021-12-28 23:16:42 -05:00
|
|
|
(let ((s5-0 (load-params! (-> obj sync) obj (the-as uint 1500) 0.0 0.15 0.15)))
|
|
|
|
(let ((f0-16 (res-lump-float (-> obj entity) 'percent :default -1.0)))
|
|
|
|
(if (or (< f0-16 0.0) (< 1.0 f0-16))
|
|
|
|
(set! f0-16 (cond
|
|
|
|
(s5-0
|
|
|
|
0.5
|
|
|
|
)
|
|
|
|
((logtest? #x80000 (-> obj flags))
|
|
|
|
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)
|
|
|
|
(set! (-> obj flags) (logior #x80000 (-> obj flags)))
|
|
|
|
(set! (-> obj flags) (logand -524289 (-> obj flags)))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(set! (-> obj use-sync?) s5-0)
|
|
|
|
(set! (-> obj deadly-time) f0-16)
|
2021-09-28 20:42:00 -04:00
|
|
|
)
|
2021-12-28 23:16:42 -05:00
|
|
|
(the-as object (when s5-0
|
|
|
|
(cond
|
|
|
|
((< (get-current-phase (-> obj sync)) (-> obj deadly-time))
|
|
|
|
(set! v0-3 (logior (the-as uint #x80000) (-> obj flags)))
|
|
|
|
(set! (-> obj flags) v0-3)
|
|
|
|
)
|
|
|
|
(else
|
|
|
|
(set! v0-3 (logand (the-as uint -524289) (-> obj flags)))
|
|
|
|
(set! (-> obj flags) v0-3)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
v0-3
|
2021-09-28 20:42:00 -04:00
|
|
|
)
|
2021-12-28 23:16:42 -05:00
|
|
|
)
|
2021-09-28 20:42:00 -04:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defmethod TODO-RENAME-22 sunken-water ((obj sunken-water))
|
|
|
|
(let ((t9-0 (method-of-type water-anim TODO-RENAME-22)))
|
2021-12-28 23:16:42 -05:00
|
|
|
(t9-0 obj)
|
|
|
|
)
|
2021-09-28 20:42:00 -04:00
|
|
|
(set! (-> obj play-ambient-sound?) #f)
|
|
|
|
(cond
|
2021-12-28 23:16:42 -05:00
|
|
|
((logtest? #x80000 (-> obj flags))
|
|
|
|
(set! (-> obj draw color-mult quad) (-> obj deadly-color-mult quad))
|
|
|
|
(set! (-> obj draw color-emissive quad) (-> obj deadly-color-emissive quad))
|
|
|
|
(set! (-> obj deadly-fade) 1.0)
|
|
|
|
)
|
|
|
|
(else
|
|
|
|
(set! (-> obj draw color-mult quad) (-> obj safe-color-mult quad))
|
|
|
|
(set! (-> obj draw color-emissive quad) (-> obj safe-color-emissive quad))
|
|
|
|
(set! (-> obj deadly-fade) 0.0)
|
|
|
|
)
|
2021-09-28 20:42:00 -04:00
|
|
|
)
|
|
|
|
(let ((s5-0 (new 'process 'ripple-control)))
|
2021-12-28 23:16:42 -05:00
|
|
|
(set! (-> obj draw ripple) s5-0)
|
|
|
|
(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
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|