jak-project/goal_src/jak2/characters/ashelin/ash-shot.gc
ManDude 0ce5835818
Create a new format for particle definitions (defpart) (#2572)
Updates the decompiler for the new format and there's new macros. This
new format should be easier to read/parse.

Also rewrote `sp-init-fields!` (both jak 1 and 2) from assembly to GOAL.

Hopefully I did not miss any regressions in Jak 1/2 while updating the
files, it's a lot.
2023-04-29 11:01:47 -04:00

517 lines
17 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: ash-shot.gc
;; name in dgo: ash-shot
;; dgos: ATE, CTYASHA
;; DECOMP BEGINS
(defpart 672
:init-specs ((:texture (new 'static 'texture-id :index #x45 :page #xc))
(:birth-func 'birth-func-set-quat)
(:num 1.0)
(:scale-x (meters 0.75))
(:scale-y (meters 10))
(:r 128.0)
(:g 0.0)
(:b 0.0)
(:a 32.0 64.0)
(:timer (seconds 0.017))
(:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-14 left-multiply-quat))
)
)
(defpart 673
:init-specs ((:texture (new 'static 'texture-id :index #x29 :page #xc))
(:num 1.0)
(:scale-x (meters 1) (meters 3))
(:rot-z (degrees 0) (degrees 360))
(:scale-y :copy scale-x)
(:r 128.0)
(:g 0.0)
(:b 0.0)
(:a 64.0 32.0)
(:timer (seconds 0.017))
(:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14))
)
)
(defpart 674
:init-specs ((:texture (new 'static 'texture-id :index #x34 :page #xc))
(:num 1.5)
(:scale-x (meters 0.5) (meters 0.5))
(:rot-z (degrees 0) (degrees 360))
(:scale-y :copy scale-x)
(:r 255.0)
(:g 128.0)
(:b 128.0)
(:a 16.0 32.0)
(:scalevel-x (meters 0.013333334) (meters 0.006666667))
(:scalevel-y :copy scalevel-x)
(:fade-g -1.28)
(:fade-b -1.28)
(:fade-a -0.48)
(:timer (seconds 0.335))
(:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14))
)
)
(defpart 675
:init-specs ((:texture (new 'static 'texture-id :index #x46 :page #xc))
(:birth-func 'birth-func-set-quat)
(:num 1.0)
(:scale-x (meters 2))
(:scale-y (meters 4.5))
(:r 128.0)
(:g 0.0)
(:b 0.0)
(:a 128.0)
(:fade-a -3.6571429)
(:timer (seconds 0.117))
(:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 left-multiply-quat))
)
)
(defpartgroup group-ashelin-shot-hit
:id 149
:duration (seconds 1)
:flags (use-local-clock)
:bounds (static-bspherem 0 0 0 8)
:parts ((sp-item 676 :period (seconds 2) :length (seconds 0.017))
(sp-item 677 :fade-after (meters 100) :period (seconds 2) :length (seconds 0.017))
(sp-item 678 :period (seconds 2) :length (seconds 0.017))
(sp-item 679 :fade-after (meters 50) :falloff-to (meters 50) :period (seconds 2) :length (seconds 0.667))
(sp-item 680 :fade-after (meters 100) :falloff-to (meters 100) :period (seconds 2) :length (seconds 0.667))
(sp-item 680 :fade-after (meters 100) :falloff-to (meters 100) :period (seconds 2) :length (seconds 0.5))
(sp-item 680 :fade-after (meters 100) :falloff-to (meters 100) :period (seconds 2) :length (seconds 0.417))
(sp-item 680 :fade-after (meters 100) :falloff-to (meters 100) :period (seconds 2) :length (seconds 0.335))
(sp-item 680 :fade-after (meters 100) :falloff-to (meters 100) :period (seconds 2) :length (seconds 0.25))
(sp-item 680 :fade-after (meters 100) :falloff-to (meters 100) :period (seconds 2) :length (seconds 0.217))
(sp-item 680 :fade-after (meters 100) :falloff-to (meters 100) :period (seconds 2) :length (seconds 0.167))
(sp-item 680 :fade-after (meters 100) :falloff-to (meters 100) :period (seconds 2) :length (seconds 0.135))
(sp-item 680 :fade-after (meters 100) :falloff-to (meters 100) :period (seconds 2) :length (seconds 0.085))
)
)
(defpart 679
:init-specs ((:texture (new 'static 'texture-id :index #xc9 :page #xc))
(:num 0.0 0.2)
(:y (meters 0.25))
(:scale-x (meters 0.2) (meters 0.2))
(:rot-x 4)
(:rot-z (degrees 0) (degrees 360))
(:scale-y :copy scale-x)
(:r 255.0)
(:g 32.0 8.0)
(:b 32.0 8.0)
(:a 32.0 64.0)
(:vel-y (meters 0.06666667) (meters 0.013333334))
(:scalevel-x (meters -0.001) (meters -0.00033333333))
(:rotvel-z (degrees -2.4) 1 (degrees 4.8))
(:scalevel-y :copy scalevel-x)
(:fade-g -0.10666667)
(:fade-b -0.10666667)
(:accel-y (meters -0.00033333333) (meters -0.0013333333))
(:friction 0.9)
(:timer (seconds 1))
(:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14))
(:next-time (seconds 0.667))
(:next-launcher 681)
(:conerot-x (degrees 0) (degrees 360))
(:conerot-y (degrees 0) (degrees 360))
)
)
(defpart 680
:init-specs ((:texture (new 'static 'texture-id :index #xc9 :page #xc))
(:num 0.5)
(:scale-x (meters 0.5) (meters 0.3))
(:scale-y :copy scale-x)
(:r 255.0)
(:g 32.0 8.0)
(:b 32.0 8.0)
(:a 96.0)
(:vel-y (meters 0.006666667) (meters 0.013333334))
(:scalevel-x (meters -0.0005) (meters -0.0005))
(:scalevel-y :copy scalevel-x)
(:fade-g -0.10666667)
(:fade-b -0.10666667)
(:accel-y (meters -0.00033333333) (meters -0.0013333333))
(:friction 0.8)
(:timer (seconds 1))
(:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14))
(:next-time (seconds 0.667))
(:next-launcher 681)
(:conerot-x (degrees 0) (degrees 180))
(:conerot-y (degrees 0) (degrees 360))
)
)
(defpart 681
:init-specs ((:fade-a -0.96))
)
(defpart 677
:init-specs ((:texture (new 'static 'texture-id :index #x47 :page #xc))
(:num 1.0)
(:scale-x (meters 5) (meters 0.1))
(:rot-z (degrees 0) (degrees 360))
(:scale-y :copy scale-x)
(:r 255.0)
(:g 32.0 8.0)
(:b 32.0 8.0)
(:a 128.0)
(:rotvel-z (degrees -0.1))
(:fade-a -0.32)
(:timer (seconds 1.335))
(:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14))
(:next-time (seconds 0.035))
(:next-launcher 682)
)
)
(defpart 682
:init-specs ((:scale-x (meters 2) (meters 0.5))
(:scale-y :copy scale-x)
(:r 255.0)
(:g 32.0 8.0)
(:b 32.0 8.0)
(:next-time (seconds 0.017))
(:next-launcher 682)
)
)
(defpart 678
:init-specs ((:texture (new 'static 'texture-id :index #x47 :page #xc))
(:num 2.0)
(:scale-x (meters 1))
(:rot-z (degrees 0) (degrees 360))
(:scale-y :copy scale-x)
(:r 255.0)
(:g 32.0 8.0)
(:b 32.0 8.0)
(:a 48.0)
(:scalevel-x (meters 0.12857144))
(:rotvel-z (degrees -0.3) (degrees 0.6))
(:scalevel-y :copy scalevel-x)
(:fade-g -0.9142857)
(:fade-b -0.9142857)
(:timer (seconds 1.335))
(:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2))
(:next-time (seconds 0.117))
(:next-launcher 683)
)
)
(defpart 683
:init-specs ((:scale-x (meters 4.5))
(:scale-y :copy scale-x)
(:scalevel-x (meters -0.010958904))
(:scalevel-y :copy scalevel-x)
(:fade-g -0.38356164)
(:fade-b 0.0)
(:fade-a -0.13150685)
)
)
(defpart 676
:init-specs ((:texture (new 'static 'texture-id :index #x47 :page #xc))
(:num 1.0)
(:scale-x (meters 1))
(:rot-z (degrees 0) (degrees 360))
(:scale-y :copy scale-x)
(:r 255.0)
(:g 255.0)
(:b 255.0)
(:a 96.0)
(:scalevel-x (meters 0.16666667))
(:rotvel-z (degrees 0.3))
(:scalevel-y :copy scalevel-x)
(:timer (seconds 0.185))
(:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3))
(:next-time (seconds 0.05))
(:next-launcher 684)
)
)
(defpart 684
:init-specs ((:scale-x (meters 3.5))
(:scale-y :copy scale-x)
(:scalevel-x (meters -0.0875))
(:scalevel-y :copy scalevel-x)
(:fade-b -6.4)
)
)
(deftype ashelin-shot (projectile)
((tail-pos vector :inline :offset-assert 480)
(hit-pos vector :inline :offset-assert 496)
)
:heap-base #x180
:method-count-assert 40
:size-assert #x200
:flag-assert #x2801800200
)
(defmethod draw-laser-sight ashelin-shot ((obj ashelin-shot))
"TODO - confirm If applicable, draw the laser sight particles"
(draw-beam (-> *part-id-table* 675) (-> obj tail-pos) (-> obj starting-dir) #f #t)
0
(none)
)
(defmethod spawn-impact-particles ashelin-shot ((obj ashelin-shot))
"Spawns associated particles with the projectile if applicable"
(rlet ((acc :class vf)
(vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
)
(init-vf0-vector)
(let* ((v1-1 (-> obj root-override trans))
(a1-0 (-> obj tail-pos))
(s5-1 (vector-! (new 'stack-no-clear 'vector) v1-1 a1-0))
(gp-0 (new 'stack-no-clear 'vector))
)
(let ((v1-2 a1-0))
(let ((a0-2 s5-1))
(let ((a2-1 0.8))
(.mov vf7 a2-1)
)
(.lvf vf5 (&-> a0-2 quad))
)
(.lvf vf4 (&-> v1-2 quad))
)
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> gp-0 quad) vf6)
(let ((f30-0 (-> *part-id-table* 672 init-specs 4 initial-valuef)))
(set! (-> *part-id-table* 672 init-specs 4 initial-valuef) (fmin f30-0 (vector-length s5-1)))
(draw-beam (-> *part-id-table* 672) a1-0 s5-1 #f #t)
(set! (-> *part-id-table* 672 init-specs 4 initial-valuef) f30-0)
)
(vector-normalize! s5-1 1.0)
(let ((t9-2 sp-launch-particles-var)
(a0-5 *sp-particle-system-2d*)
(a1-2 (-> *part-id-table* 673))
(a2-3 *launch-matrix*)
)
(set! (-> a2-3 trans quad) (-> gp-0 quad))
(t9-2 a0-5 a1-2 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0)
)
(let ((f0-4 (vector-dot s5-1 (-> (camera-matrix) vector 2))))
(when (< 0.0 f0-4)
(let ((f0-5 (* f0-4 f0-4))
(f30-1 (-> *part-id-table* 674 init-specs 8 initial-valuef))
(f28-0 (-> *part-id-table* 674 init-specs 8 random-rangef))
)
(set! (-> *part-id-table* 674 init-specs 8 initial-valuef) (* f30-1 f0-5))
(set! (-> *part-id-table* 674 init-specs 8 random-rangef) (* f28-0 f0-5))
(let ((t9-4 sp-launch-particles-var)
(a0-6 *sp-particle-system-2d*)
(a1-3 (-> *part-id-table* 674))
(a2-4 *launch-matrix*)
)
(set! (-> a2-4 trans quad) (-> gp-0 quad))
(t9-4 a0-6 a1-3 a2-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0)
)
(set! (-> *part-id-table* 674 init-specs 8 initial-valuef) f30-1)
(set! (-> *part-id-table* 674 init-specs 8 random-rangef) f28-0)
)
)
)
)
0
(none)
)
)
(defmethod spawn-shell-particles ashelin-shot ((obj ashelin-shot))
"TODO - confirm"
(let ((gp-0 (get-process *default-dead-pool* part-tracker #x4000)))
(when gp-0
(let ((t9-1 (method-of-type part-tracker activate)))
(t9-1
(the-as part-tracker gp-0)
*entity-pool*
(symbol->string (-> part-tracker symbol))
(the-as pointer #x70004000)
)
)
(let ((t9-2 run-function-in-process)
(a0-3 gp-0)
(a1-2 part-tracker-init)
(a2-4 (-> *part-group-id-table* 149))
(a3-1 0)
(t0-0 #f)
(t1-0 #f)
(t2-0 #f)
(t3-0 *launch-matrix*)
)
(set! (-> t3-0 trans quad) (-> obj root-override trans quad))
((the-as (function object object object object object object object object none) t9-2)
a0-3
a1-2
a2-4
a3-1
t0-0
t1-0
t2-0
t3-0
)
)
(-> gp-0 ppointer)
)
)
0
(none)
)
(defmethod play-impact-sound ashelin-shot ((obj ashelin-shot) (arg0 projectile-options))
(let ((v1-0 arg0))
(cond
((zero? v1-0)
(sound-play "ashelin-fire")
)
((= v1-0 (projectile-options lose-altitude))
(sound-play "ashelin-shot-hi")
)
((= v1-0 (projectile-options lose-altitude proj-options-2))
((the-as (function projectile projectile-options none) (find-parent-method ashelin-shot 28)) obj arg0)
)
)
)
(none)
)
(defmethod made-impact? ashelin-shot ((obj ashelin-shot))
"TODO - queries the collision cache, return true/false"
(let ((v1-0 (-> obj root-override))
(t1-0 (new 'stack-no-clear 'collide-query))
)
(let ((a1-0 t1-0))
(set! (-> a1-0 radius) (-> v1-0 root-prim prim-core world-sphere w))
(set! (-> a1-0 collide-with) (-> v1-0 root-prim prim-core collide-with))
(set! (-> a1-0 ignore-process0) obj)
(set! (-> a1-0 ignore-process1) (ppointer->process (-> obj parent)))
(set! (-> a1-0 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1))
(set! (-> a1-0 action-mask) (collide-action solid))
)
(fill-and-try-snap-to-surface v1-0 (-> v1-0 transv) -10240.0 12697.6 -4096.0 t1-0)
)
)
(defun ashelin-shot-move ((arg0 ashelin-shot))
(projectile-move-fill-line-sphere arg0)
(let ((s5-0 (-> arg0 root-override)))
(let ((s4-0 (new 'stack-no-clear 'vector)))
(vector-! s4-0 (-> arg0 tail-pos) (-> s5-0 trans))
(let ((f0-0 (vector-length s4-0)))
(when (< 40960.0 f0-0)
(vector-normalize! s4-0 40960.0)
(vector+! (-> arg0 tail-pos) (-> s5-0 trans) s4-0)
)
)
)
(when (logtest? (-> s5-0 status) (collide-status touch-surface))
(let ((v1-9 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> arg0 tail-pos) (-> s5-0 trans)) 2048.0))
(a1-5 (-> arg0 hit-pos))
)
(set! (-> a1-5 quad) (-> s5-0 trans quad))
(vector+! a1-5 a1-5 v1-9)
(move-to-point! (-> arg0 root-override) a1-5)
)
(go (the-as (state ashelin) (method-of-object arg0 impact)))
)
)
0
(none)
)
;; WARN: Return type mismatch symbol vs none.
(defmethod init-proj-collision! ashelin-shot ((obj ashelin-shot))
"Init the [[projectile]]'s [[collide-shape]]"
(let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player))))
(set! (-> s5-0 dynam) (copy *standard-dynamics* 'process))
(set! (-> s5-0 reaction)
(the-as (function control-info collide-query vector vector collide-status) cshape-reaction-just-move)
)
(set! (-> s5-0 no-reaction)
(the-as (function collide-shape-moving collide-query vector vector object) nothing)
)
(set! (-> s5-0 penetrate-using) (penetrate enemy-yellow-shot))
(let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0)))
(set! (-> s5-0 total-prims) (the-as uint 3))
(set! (-> s4-0 prim-core collide-as) (collide-spec projectile))
(set! (-> s4-0 prim-core collide-with)
(collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher)
)
(set! (-> s4-0 prim-core action) (collide-action solid))
(set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 4096.0)
(set! (-> s5-0 root-prim) s4-0)
)
(let ((v1-13 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
(set! (-> v1-13 prim-core collide-as) (collide-spec projectile))
(set! (-> v1-13 prim-core collide-with)
(collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher)
)
(set! (-> v1-13 prim-core action) (collide-action solid))
(set-vector! (-> v1-13 local-sphere) 0.0 0.0 0.0 819.2)
)
(let ((v1-15 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
(set! (-> v1-15 prim-core collide-as) (collide-spec projectile))
(set! (-> v1-15 prim-core collide-with)
(collide-spec jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher)
)
(set-vector! (-> v1-15 local-sphere) 0.0 0.0 0.0 4096.0)
)
(set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
(let ((v1-18 (-> s5-0 root-prim)))
(set! (-> s5-0 backup-collide-as) (-> v1-18 prim-core collide-as))
(set! (-> s5-0 backup-collide-with) (-> v1-18 prim-core collide-with))
)
(set! (-> s5-0 max-iteration-count) (the-as uint 1))
(set! (-> s5-0 event-self) 'touched)
(set! (-> obj root-override) s5-0)
)
(set! (-> obj root-override pat-ignore-mask)
(new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1)
)
(let ((v1-23 (-> obj parent)))
(when (not (logtest? (-> (the-as ashelin (if v1-23
(the-as ashelin (-> v1-23 0 self))
)
)
bot-flags
)
(bot-flags attacked)
)
)
(let* ((a0-17 (-> obj root-override))
(v1-27 (-> a0-17 root-prim))
)
(countdown (a0-18 (-> a0-17 total-prims))
(logclear! (-> v1-27 prim-core collide-with) (collide-spec jak))
(&+! v1-27 80)
)
)
)
)
(none)
)
(defmethod init-proj-settings! ashelin-shot ((obj ashelin-shot))
"Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc"
(set! (-> obj tail-pos quad) (-> obj root-override trans quad))
(set! (-> obj attack-mode) 'eco-yellow)
(set! (-> obj max-speed) 307200.0)
(set! (-> obj move) ashelin-shot-move)
(set! (-> obj timeout) (seconds 1.335))
(none)
)