jak-project/goal_src/jak2/levels/sewer/sewer-part.gc
Tyler Wilding e5d6ac1c41
d/jak2: second documentation PR and finish forest-scenes and palace-scenes (#2136)
Also fixes #2135

Co-authored-by: water <awaterford111445@gmail.com>
2023-01-21 20:26:51 -05:00

515 lines
17 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: sewer-part.gc
;; name in dgo: sewer-part
;; dgos: SEB, SWB
;; DECOMP BEGINS
(deftype sewer-part (part-spawner)
()
:heap-base #x30
:method-count-assert 16
:size-assert #xb0
:flag-assert #x10003000b0
)
(defpartgroup group-sewer-light
:id 340
:bounds (static-bspherem 0 0 0 6)
:parts ((sp-item 1437 :fade-after (meters 120) :flags (bit6)) (sp-item 1438 :fade-after (meters 120) :flags (bit6)))
)
(defpart 1437
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc))
(sp-flt spt-num 1.0)
(sp-rnd-flt spt-scale-x (meters 4) (meters 0.5) 1.0)
(sp-flt spt-rot-x 614.4)
(sp-copy-from-other spt-scale-y -4)
(sp-flt spt-r 255.0)
(sp-rnd-flt spt-g 192.0 64.0 1.0)
(sp-flt spt-b 128.0)
(sp-flt spt-a 12.0)
(sp-flt spt-omega 494796.8)
(sp-int spt-timer 5)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)
(sp-flt spt-userdata 4096.0)
)
)
(defpart 1438
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xca :page #xc))
(sp-flt spt-num 1.0)
(sp-rnd-flt spt-scale-x (meters 16) (meters 2) 1.0)
(sp-flt spt-rot-x 1228.8)
(sp-copy-from-other spt-scale-y -4)
(sp-flt spt-r 255.0)
(sp-rnd-flt spt-g 192.0 64.0 1.0)
(sp-flt spt-b 128.0)
(sp-flt spt-a 12.0)
(sp-flt spt-omega 495206.4)
(sp-int spt-timer 5)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)
(sp-flt spt-userdata 4096.0)
)
)
(defpartgroup group-sewer-light-switched
:id 341
:bounds (static-bspherem 0 0 0 6)
:parts ((sp-item 39 :fade-after (meters 120) :flags (bit6)) (sp-item 40 :fade-after (meters 120) :flags (bit6)))
)
(defpart 39
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc))
(sp-flt spt-num 1.0)
(sp-rnd-flt spt-scale-x (meters 4) (meters 0.5) 1.0)
(sp-flt spt-rot-x 614.4)
(sp-copy-from-other spt-scale-y -4)
(sp-flt spt-r 255.0)
(sp-rnd-flt spt-g 192.0 64.0 1.0)
(sp-flt spt-b 128.0)
(sp-flt spt-a 12.0)
(sp-flt spt-omega 494796.8)
(sp-int spt-timer 5)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)
(sp-flt spt-userdata 4096.0)
)
)
(defpart 40
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xca :page #xc))
(sp-flt spt-num 1.0)
(sp-rnd-flt spt-scale-x (meters 16) (meters 2) 1.0)
(sp-flt spt-rot-x 1228.8)
(sp-copy-from-other spt-scale-y -4)
(sp-flt spt-r 255.0)
(sp-rnd-flt spt-g 192.0 64.0 1.0)
(sp-flt spt-b 128.0)
(sp-flt spt-a 12.0)
(sp-flt spt-omega 495206.4)
(sp-int spt-timer 5)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)
(sp-flt spt-userdata 4096.0)
)
)
(defpartgroup group-sewer-steamvent
:id 342
:flags (unk-4)
:bounds (static-bspherem 0 0 0 6)
:parts ((sp-item 1439 :fade-after (meters 60) :falloff-to (meters 60) :flags (bit7))
(sp-item 1440 :fade-after (meters 100) :falloff-to (meters 140) :flags (bit7))
)
)
(defpart 1439
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x92 :page #xc))
(sp-flt spt-num 5.0)
(sp-flt spt-scale-x (meters 0.1))
(sp-int spt-rot-x 4)
(sp-copy-from-other spt-scale-y -4)
(sp-flt spt-r 128.0)
(sp-copy-from-other spt-g -1)
(sp-copy-from-other spt-b -1)
(sp-rnd-flt spt-a 64.0 32.0 1.0)
(sp-flt spt-omega 4.096)
(sp-rnd-flt spt-vel-z (meters 0.083333336) (meters 0.033333335) 1.0)
(sp-rnd-flt spt-fade-a -0.64 -0.64 1.0)
(sp-rnd-flt spt-friction 0.93 0.025 1.0)
(sp-int spt-timer 150)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-12)
(sp-func spt-func 'sparticle-motion-blur)
(sp-rnd-flt spt-launchrot-x (degrees -7.5) (degrees 15.0) 1.0)
(sp-rnd-flt spt-launchrot-y (degrees -7.5) (degrees 15.0) 1.0)
(sp-flt spt-rotate-y (degrees 0.0))
)
)
(defpart 1440
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc))
(sp-rnd-flt spt-num 1.0 6.0 1.0)
(sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.25) 1.0)
(sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
(sp-copy-from-other spt-scale-y -4)
(sp-rnd-flt spt-r 64.0 128.0 1.0)
(sp-copy-from-other spt-g -1)
(sp-copy-from-other spt-b -1)
(sp-flt spt-a 0.0)
(sp-rnd-flt spt-vel-z (meters 0.083333336) (meters 0.033333335) 1.0)
(sp-rnd-flt spt-scalevel-x (meters 0.01) (meters 0.016666668) 1.0)
(sp-rnd-flt spt-rotvel-z (degrees -1.2) (degrees 2.4) 1.0)
(sp-copy-from-other spt-scalevel-y -4)
(sp-flt spt-fade-a 0.96)
(sp-rnd-flt spt-friction 0.93 0.025 1.0)
(sp-int spt-timer 150)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-12)
(sp-int-plain-rnd spt-next-time 25 24 1)
(sp-launcher-by-id spt-next-launcher 1441)
(sp-rnd-flt spt-launchrot-x (degrees -5.0) (degrees 10.0) 1.0)
(sp-rnd-flt spt-launchrot-y (degrees -5.0) (degrees 10.0) 1.0)
(sp-flt spt-rotate-y (degrees 0.0))
)
)
(defpart 1441
:init-specs ((sp-rnd-flt spt-fade-a -0.48 -0.48 1.0))
)
(defpart 1442
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xca :page #xc))
(sp-flt spt-num 1.0)
(sp-flt spt-scale-x (meters 3))
(sp-flt spt-rot-x 1228.8)
(sp-copy-from-other spt-scale-y -4)
(sp-flt spt-r 255.0)
(sp-flt spt-g 128.0)
(sp-rnd-flt spt-b 0.0 32.0 1.0)
(sp-flt spt-a 32.0)
(sp-int spt-timer 5)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)
(sp-flt spt-userdata 2048.0)
)
)
(defpartgroup group-sewer-drops
:id 343
:bounds (static-bspherem 0 4 0 8)
:parts ((sp-item 1443 :fade-after (meters 100) :falloff-to (meters 100)))
)
(defun sewer-drop-birth-func ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo))
"Resets the timer to birth a new water drop"
(when (>= (get-height *ocean* (-> arg2 launchrot) #t) (-> arg2 launchrot y))
(set! (-> arg1 timer) 0)
0
)
0
(none)
)
(defun check-drop-level-sewer-drop ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
"Prevent the water drop from going below the ocean, display the splash on the surface or ground, play associated sounds"
(let ((f30-0 (-> arg1 key origin trans y))
(f28-0 (-> arg2 vector 0 y))
(s5-0 #f)
)
(cond
((< f28-0 f30-0)
(set! s5-0 #t)
)
((begin (set! f30-0 (get-height *ocean* (the-as vector (-> arg2 vector)) #t)) (< f28-0 f30-0))
(set! s5-0 'water)
)
)
(when s5-0
(let ((gp-0 (new 'stack-no-clear 'vector)))
(sp-kill-particle arg0 arg1)
(set-vector! gp-0 (-> arg2 vector 0 x) f30-0 (-> arg2 vector 0 z) 1.0)
(when (< (vector-vector-distance (camera-pos) gp-0) 204800.0)
(cond
((= s5-0 'water)
(sound-play "wet-drips" :position gp-0)
)
((= s5-0 #t)
(sound-play "dry-drips" :position gp-0)
)
)
)
(let ((t9-8 sp-launch-particles-var)
(a0-11 *sp-particle-system-2d*)
(a1-6 (-> *part-id-table* 1444))
(a2-4 *launch-matrix*)
)
(set! (-> a2-4 trans quad) (-> gp-0 quad))
(t9-8 a0-11 a1-6 a2-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0)
)
(let ((t9-9 sp-launch-particles-var)
(a0-12 *sp-particle-system-3d*)
(a1-7 (-> *part-id-table* 1445))
(a2-5 *launch-matrix*)
)
(set! (-> a2-5 trans quad) (-> gp-0 quad))
(t9-9 a0-12 a1-7 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0)
)
)
)
)
(none)
)
(defpart 1443
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc))
(sp-func spt-birth-func 'sewer-drop-birth-func)
(sp-flt spt-num 0.1)
(sp-flt spt-y (meters 12.5))
(sp-rnd-flt spt-scale-x (meters 0.15) (meters 0.1) 1.0)
(sp-copy-from-other spt-scale-y -4)
(sp-rnd-flt spt-r 96.0 32.0 1.0)
(sp-rnd-flt spt-g 64.0 32.0 1.0)
(sp-rnd-flt spt-b 32.0 32.0 1.0)
(sp-flt spt-a 0.0)
(sp-flt spt-scalevel-x (meters -0.00013333333))
(sp-flt spt-scalevel-y (meters 0.0013333333))
(sp-int-plain-rnd spt-timer 0 299 1)
(sp-cpuinfo-flags sp-cpuinfo-flag-3 sp-cpuinfo-flag-12)
(sp-func spt-func 'check-drop-level-sewer-drop)
(sp-int-plain-rnd spt-next-time 0 299 1)
(sp-launcher-by-id spt-next-launcher 1446)
)
)
(defpart 1446
:init-specs ((sp-rnd-flt spt-a 32.0 64.0 1.0)
(sp-flt spt-accel-y -2.7306666)
(sp-int spt-timer 2400)
(sp-int-plain-rnd spt-next-time 0 149 1)
(sp-launcher-by-id spt-next-launcher 1447)
)
)
(defpart 1447
:init-specs ((sp-flt spt-r 255.0)
(sp-flt spt-g 255.0)
(sp-flt spt-b 255.0)
(sp-int spt-next-time 5)
(sp-launcher-by-id spt-next-launcher 1448)
)
)
(defpart 1448
:init-specs ((sp-rnd-flt spt-r 96.0 32.0 1.0)
(sp-rnd-flt spt-g 64.0 32.0 1.0)
(sp-rnd-flt spt-b 32.0 32.0 1.0)
(sp-int-plain-rnd spt-next-time 0 149 1)
(sp-launcher-by-id spt-next-launcher 1447)
)
)
(defpart 1444
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc))
(sp-rnd-flt spt-num 1.0 2.0 1.0)
(sp-rnd-flt spt-scale-x (meters 0.15) (meters 0.05) 1.0)
(sp-int spt-rot-x 4)
(sp-copy-from-other spt-scale-y -4)
(sp-rnd-flt spt-r 96.0 32.0 1.0)
(sp-rnd-flt spt-g 64.0 32.0 1.0)
(sp-rnd-flt spt-b 32.0 32.0 1.0)
(sp-rnd-flt spt-a 32.0 64.0 1.0)
(sp-flt spt-omega 10.24)
(sp-rnd-flt spt-vel-y (meters 0.02) (meters 0.026666667) 1.0)
(sp-rnd-flt spt-accel-y -4.096 -0.68266666 1.0)
(sp-flt spt-friction 0.97)
(sp-int spt-timer 150)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-12)
(sp-func spt-func 'sparticle-motion-blur)
(sp-int-plain-rnd spt-next-time 0 149 1)
(sp-launcher-by-id spt-next-launcher 1447)
(sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 60.0) 1.0)
(sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0)
)
)
(defpart 1445
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x2c :page #xc))
(sp-flt spt-num 1.0)
(sp-flt spt-y (meters 0.02))
(sp-flt spt-scale-x (meters 1))
(sp-copy-from-other spt-scale-y -4)
(sp-rnd-flt spt-r 96.0 32.0 1.0)
(sp-rnd-flt spt-g 64.0 32.0 1.0)
(sp-rnd-flt spt-b 32.0 32.0 1.0)
(sp-rnd-flt spt-a 63.0 32.0 1.0)
(sp-rnd-flt spt-scalevel-x (meters 0.02) (meters 0.01) 1.0)
(sp-rnd-flt spt-scalevel-y (meters 0.02) (meters 0.01) 1.0)
(sp-flt spt-fade-a -0.64)
(sp-int spt-timer 100)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-12)
(sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0)
)
)
(defun sewer-drop2-birth-func ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo))
"Resets the timer to birth a new water drop"
(when (>= (get-height *ocean* (-> arg2 launchrot) #t) (-> arg2 launchrot y))
(set! (-> arg1 timer) 0)
0
)
(let ((cquery (new 'stack-no-clear 'collide-query)))
(set! (-> cquery start-pos quad) (-> arg2 launchrot quad))
(set-vector! (-> cquery move-dist) 0.0 -204800.0 0.0 1.0)
(let ((_cquery cquery))
(set! (-> _cquery radius) 40.96)
(set! (-> _cquery collide-with) (collide-spec backgnd))
(set! (-> _cquery ignore-process0) #f)
(set! (-> _cquery ignore-process1) #f)
(set! (-> _cquery ignore-pat)
(new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)
)
(set! (-> _cquery action-mask) (collide-action solid))
)
(if (>= (fill-and-probe-using-line-sphere *collide-cache* cquery) 0.0)
(set! (-> arg1 user-float) (-> cquery best-other-tri intersect y))
(set! (-> arg1 user-float) (+ -204800.0 (-> arg2 launchrot y)))
)
)
0
(none)
)
(defun check-drop2-level-sewer-drop ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
"Prevent the water drop from going below the ocean, display the splash on the surface or ground, play associated sounds"
(-> arg1 key)
(let ((f30-0 (-> arg1 user-float))
(f28-0 (-> arg2 vector 0 y))
(s5-0 #f)
)
(cond
((< f28-0 f30-0)
(set! s5-0 #t)
)
((begin (set! f30-0 (get-height *ocean* (the-as vector (-> arg2 vector)) #t)) (< f28-0 f30-0))
(set! s5-0 'water)
)
)
(when s5-0
(let ((gp-0 (new 'stack-no-clear 'vector)))
(sp-kill-particle arg0 arg1)
(set-vector! gp-0 (-> arg2 vector 0 x) f30-0 (-> arg2 vector 0 z) 1.0)
(when (< (vector-vector-distance (camera-pos) gp-0) 204800.0)
(cond
((= s5-0 'water)
(sound-play "wet-drips" :position gp-0)
)
((= s5-0 #t)
(sound-play "dry-drips" :position gp-0)
)
)
)
(let ((t9-8 sp-launch-particles-var)
(a0-11 *sp-particle-system-2d*)
(a1-6 (-> *part-id-table* 1444))
(a2-4 *launch-matrix*)
)
(set! (-> a2-4 trans quad) (-> gp-0 quad))
(t9-8 a0-11 a1-6 a2-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0)
)
(let ((t9-9 sp-launch-particles-var)
(a0-12 *sp-particle-system-3d*)
(a1-7 (-> *part-id-table* 1445))
(a2-5 *launch-matrix*)
)
(set! (-> a2-5 trans quad) (-> gp-0 quad))
(t9-9 a0-12 a1-7 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0)
)
)
)
)
(none)
)
(defpartgroup group-sewer-checkground-drops
:id 344
:bounds (static-bspherem 0 -16 0 32)
:parts ((sp-item 1449 :fade-after (meters 100) :falloff-to (meters 100)))
)
(defpart 1449
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc))
(sp-func spt-birth-func 'sewer-drop2-birth-func)
(sp-flt spt-num 0.1)
(sp-flt spt-y (meters 0))
(sp-rnd-flt spt-scale-x (meters 0.2) (meters 0.1) 1.0)
(sp-copy-from-other spt-scale-y -4)
(sp-rnd-flt spt-r 96.0 32.0 1.0)
(sp-rnd-flt spt-g 64.0 32.0 1.0)
(sp-rnd-flt spt-b 32.0 32.0 1.0)
(sp-flt spt-a 0.0)
(sp-flt spt-scalevel-x (meters -0.000033333334))
(sp-flt spt-scalevel-y (meters 0.0013333333))
(sp-flt spt-accel-y -2.7306666)
(sp-int-plain-rnd spt-timer 150 149 1)
(sp-cpuinfo-flags sp-cpuinfo-flag-3 sp-cpuinfo-flag-12)
(sp-func spt-func 'check-drop2-level-sewer-drop)
(sp-int-plain-rnd spt-next-time 0 299 1)
(sp-launcher-by-id spt-next-launcher 1450)
)
)
(defpart 1450
:init-specs ((sp-rnd-flt spt-a 32.0 64.0 1.0)
(sp-flt spt-accel-y -2.7306666)
(sp-int spt-timer 2400)
(sp-int-plain-rnd spt-next-time 0 299 1)
(sp-launcher-by-id spt-next-launcher 1451)
)
)
(defpart 1451
:init-specs ((sp-flt spt-r 255.0)
(sp-flt spt-g 255.0)
(sp-flt spt-b 255.0)
(sp-int spt-next-time 5)
(sp-launcher-by-id spt-next-launcher 1452)
)
)
(defpart 1452
:init-specs ((sp-rnd-flt spt-r 96.0 32.0 1.0)
(sp-rnd-flt spt-g 64.0 32.0 1.0)
(sp-rnd-flt spt-b 32.0 32.0 1.0)
(sp-int-plain-rnd spt-next-time 0 449 1)
(sp-launcher-by-id spt-next-launcher 1447)
)
)
(defpartgroup group-sew-mine-light
:id 345
:duration (seconds 0.017)
:flags (use-local-clock)
:bounds (static-bspherem 0 0 0 5)
:parts ((sp-item 1453 :fade-after (meters 120) :period 100 :length 50)
(sp-item 1454 :fade-after (meters 120) :period 100 :length 50)
)
)
(defpart 1453
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc))
(sp-flt spt-num 1.0)
(sp-flt spt-y (meters 1.4))
(sp-rnd-flt spt-scale-x (meters 1.5) (meters 0.2) 1.0)
(sp-flt spt-rot-x 204.8)
(sp-copy-from-other spt-scale-y -4)
(sp-flt spt-r 255.0)
(sp-rnd-flt spt-g 0.0 64.0 1.0)
(sp-flt spt-b 0.0)
(sp-rnd-flt spt-a 32.0 4.0 1.0)
(sp-flt spt-omega 494387.2)
(sp-int spt-timer 5)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)
(sp-flt spt-userdata 1024.0)
(sp-flt spt-rotate-y (degrees 0.0))
)
)
(defpart 1454
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc))
(sp-flt spt-num 1.0)
(sp-flt spt-y (meters 1.4))
(sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.1) 1.0)
(sp-flt spt-rot-x 204.8)
(sp-copy-from-other spt-scale-y -4)
(sp-flt spt-r 255.0)
(sp-flt spt-g 255.0)
(sp-flt spt-b 128.0)
(sp-rnd-flt spt-a 48.0 4.0 1.0)
(sp-flt spt-omega 494387.2)
(sp-int spt-timer 5)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)
(sp-flt spt-userdata 1024.0)
(sp-flt spt-rotate-y (degrees 0.0))
)
)