mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -04:00
cd68cb671e
Major change to how `deftype` shows up in our code: - the decompiler will no longer emit the `offset-assert`, `method-count-assert`, `size-assert` and `flag-assert` parameters. There are extremely few cases where having this in the decompiled code is helpful, as the types there come from `all-types` which already has those parameters. This also doesn't break type consistency because: - the asserts aren't compared. - the first step of the test uses `all-types`, which has the asserts, which will throw an error if they're bad. - the decompiler won't emit the `heap-base` parameter unless necessary now. - the decompiler will try its hardest to turn a fixed-offset field into an `overlay-at` field. It falls back to the old offset if all else fails. - `overlay-at` now supports field "dereferencing" to specify the offset that's within a field that's a structure, e.g.: ```lisp (deftype foobar (structure) ((vec vector :inline) (flags int32 :overlay-at (-> vec w)) ) ) ``` in this structure, the offset of `flags` will be 12 because that is the final offset of `vec`'s `w` field within this structure. - **removed ID from all method declarations.** IDs are only ever automatically assigned now. Fixes #3068. - added an `:overlay` parameter to method declarations, in order to declare a new method that goes on top of a previously-defined method. Syntax is `:overlay <method-name>`. Please do not ever use this. - added `state-methods` list parameter. This lets you quickly specify a list of states to be put in the method table. Same syntax as the `states` list parameter. The decompiler will try to put as many states in this as it can without messing with the method ID order. Also changes `defmethod` to make the first type definition (before the arguments) optional. The type can now be inferred from the first argument. Fixes #3093. --------- Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
444 lines
14 KiB
Common Lisp
444 lines
14 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: target-turret-shot.gc
|
|
;; name in dgo: target-turret-shot
|
|
;; dgos: DMI
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
(defpart 915
|
|
:init-specs ((:texture (new 'static 'texture-id :index #x45 :page #xc))
|
|
(:birth-func 'birth-func-set-quat)
|
|
(:num 1.0)
|
|
(:scale-x (meters 0.4))
|
|
(:scale-y (meters 9))
|
|
(:r 128.0)
|
|
(:g 0.0 64.0)
|
|
(:b 0.0)
|
|
(:a 128.0)
|
|
(:scalevel-x (meters 0.0016666667))
|
|
(:fade-a -2.1333334)
|
|
(:timer (seconds 0.135))
|
|
(:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-14 left-multiply-quat))
|
|
)
|
|
)
|
|
|
|
(defpartgroup group-turret-shot-hit
|
|
:id 200
|
|
:duration (seconds 1)
|
|
:flags (use-local-clock)
|
|
:bounds (static-bspherem 0 0 0 8)
|
|
:parts ((sp-item 916 :flags (bit6) :period (seconds 2) :length (seconds 0.017))
|
|
(sp-item 917 :flags (bit6) :period (seconds 2) :length (seconds 0.017))
|
|
(sp-item 918 :flags (bit6) :period (seconds 2) :length (seconds 0.017))
|
|
(sp-item 919 :period (seconds 2) :length (seconds 0.017))
|
|
)
|
|
)
|
|
|
|
(defpart 917
|
|
:init-specs ((:texture (new 'static 'texture-id :index #xbb :page #xc))
|
|
(:num 2.0)
|
|
(:scale-x (meters 1))
|
|
(:rot-x (degrees 2.25))
|
|
(:rot-z (degrees 0) (degrees 360))
|
|
(:scale-y :copy scale-x)
|
|
(:r 255.0)
|
|
(:g 32.0)
|
|
(:b 32.0 8.0)
|
|
(:a 24.0)
|
|
(:scalevel-x (meters 0.12857144))
|
|
(:rotvel-z (degrees -0.3) (degrees 0.6))
|
|
(:scalevel-y :copy scalevel-x)
|
|
(:fade-g -3.6571429)
|
|
(:fade-b -0.9142857)
|
|
(:timer (seconds 0.267))
|
|
(:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 glow))
|
|
(:userdata 4096.0)
|
|
(:next-time (seconds 0.117))
|
|
(:next-launcher 920)
|
|
)
|
|
)
|
|
|
|
(defpart 920
|
|
:init-specs ((:scale-x (meters 4.5))
|
|
(:scale-y :copy scale-x)
|
|
(:scalevel-x (meters -0.08888889))
|
|
(:scalevel-y :copy scalevel-x)
|
|
(:fade-g -3.1111112)
|
|
(:fade-b 0.0)
|
|
(:fade-a -1.0666667)
|
|
)
|
|
)
|
|
|
|
(defpart 916
|
|
:init-specs ((:texture (new 'static 'texture-id :index #xca :page #xc))
|
|
(:num 1.0)
|
|
(:scale-x (meters 0.5))
|
|
(:rot-x (degrees 0.5625))
|
|
(:rot-z (degrees 0) (degrees 360))
|
|
(:scale-y :copy scale-x)
|
|
(:r 255.0)
|
|
(:g 32.0)
|
|
(:b 255.0)
|
|
(:a 64.0)
|
|
(:scalevel-x (meters 0.16666667))
|
|
(:rotvel-z (degrees 0.3))
|
|
(:scalevel-y :copy scalevel-x)
|
|
(:timer (seconds 0.335))
|
|
(:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow))
|
|
(:userdata 4096.0)
|
|
(:next-time (seconds 0.05))
|
|
(:next-launcher 921)
|
|
)
|
|
)
|
|
|
|
(defpart 921
|
|
:init-specs ((:scale-x (meters 3.5))
|
|
(:scale-y :copy scale-x)
|
|
(:scalevel-x (meters -0.025))
|
|
(:scalevel-y :copy scalevel-x)
|
|
(:fade-b -6.375)
|
|
(:next-time (seconds 0.135))
|
|
(:next-launcher 922)
|
|
)
|
|
)
|
|
|
|
(defpart 922
|
|
:init-specs ((:scale-x (meters 2))
|
|
(:scale-y :copy scale-x)
|
|
(:scalevel-x (meters -0.025))
|
|
(:scalevel-y :copy scalevel-x)
|
|
(:fade-r 0.0)
|
|
(:fade-g -1.6)
|
|
(:fade-b 0.0)
|
|
(:fade-a -1.6)
|
|
)
|
|
)
|
|
|
|
(defpart 918
|
|
:init-specs ((:texture (new 'static 'texture-id :index #x33 :page #xc))
|
|
(:num 1.0)
|
|
(:scale-x (meters 3) (meters 0.4))
|
|
(:rot-x (degrees 1.125))
|
|
(:rot-z (degrees 0) (degrees 3600))
|
|
(:scale-y :copy scale-x)
|
|
(:r 255.0)
|
|
(:g 0.0)
|
|
(:b 0.0)
|
|
(:a 64.0)
|
|
(:scalevel-x (meters 0.075))
|
|
(:scalevel-y :copy scalevel-x)
|
|
(:fade-a -1.8285714)
|
|
(:timer (seconds 0.135))
|
|
(:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow))
|
|
(:userdata 4096.0)
|
|
)
|
|
)
|
|
|
|
(defpart 919
|
|
:init-specs ((:texture (new 'static 'texture-id :page #xc))
|
|
(:num 6.0 6.0)
|
|
(:scale-x (meters 1.25) (meters 1))
|
|
(:rot-z (degrees 0) (degrees 3600))
|
|
(:scale-y :copy scale-x)
|
|
(:r 255.0)
|
|
(:g 0.0)
|
|
(:b 0.0)
|
|
(:a 16.0 48.0)
|
|
(:vel-y (meters 0.026666667) (meters 0.026666667))
|
|
(:scalevel-x (meters 0.0016666667) (meters 0.006666667))
|
|
(:rotvel-z (degrees -0.2) (degrees 0.4))
|
|
(:scalevel-y :copy scalevel-x)
|
|
(:fade-r -0.30476192)
|
|
(:fade-g 0.15238096)
|
|
(:fade-b 0.30476192)
|
|
(:fade-a -0.15238096)
|
|
(:accel-y (meters -0.00016666666) (meters -0.00016666666))
|
|
(:friction 0.9)
|
|
(:timer (seconds 1.4))
|
|
(:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3))
|
|
(:conerot-x (degrees 0) (degrees 3600))
|
|
(:conerot-y (degrees 0) (degrees 3600))
|
|
)
|
|
)
|
|
|
|
(defpart 923
|
|
:init-specs ((:texture (new 'static 'texture-id :index #x14 :page #xc))
|
|
(:num 4.0 4.0)
|
|
(:z (meters 0) (meters -3))
|
|
(:scale-x (meters 0.8) (meters 0.4))
|
|
(:scale-y (meters 0.8) (meters 0.4))
|
|
(:r 192.0)
|
|
(:g 64.0 128.0)
|
|
(:b 0.0)
|
|
(:a 64.0)
|
|
(:scalevel-x (meters -0.00234375))
|
|
(:scalevel-y :copy scalevel-x)
|
|
(:fade-g -1.2 -2.4)
|
|
(:fade-a -1.6 -6.4)
|
|
(:accel-y (meters -0.00016666666) (meters -0.00016666666))
|
|
(:timer (seconds 0.8))
|
|
(:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3))
|
|
(:rotate-y (degrees 0))
|
|
)
|
|
)
|
|
|
|
(deftype turret-shot (guard-shot)
|
|
((hit-pos vector :inline)
|
|
)
|
|
)
|
|
|
|
|
|
(defstate impact (turret-shot)
|
|
:virtual #t
|
|
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
|
(case message
|
|
(('touched)
|
|
(let* ((toucher-proc proc)
|
|
(toucher (if (type? toucher-proc process-drawable)
|
|
(the-as process-drawable toucher-proc)
|
|
)
|
|
)
|
|
)
|
|
(when toucher
|
|
(-> toucher root)
|
|
(send-event
|
|
proc
|
|
'attack
|
|
(-> block param 0)
|
|
(static-attack-info ((id (-> self attack-id)) (mode 'explode) (damage (-> self damage))))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
(projectile-event-handler proc argc message block)
|
|
)
|
|
)
|
|
)
|
|
:code (behavior ()
|
|
(let ((root-prim (-> self root root-prim)))
|
|
(set! (-> (the-as collide-shape-prim-group root-prim) child 0 prim-core world-sphere w) 4915.2)
|
|
)
|
|
(let ((overlap-params (new 'stack-no-clear 'overlaps-others-params)))
|
|
(set! (-> overlap-params options) (overlaps-others-options))
|
|
(set! (-> overlap-params collide-with-filter) (the-as collide-spec -1))
|
|
(set! (-> overlap-params tlist) *touching-list*)
|
|
(find-overlapping-shapes (-> self root) overlap-params)
|
|
)
|
|
(suspend)
|
|
(go-virtual die)
|
|
)
|
|
)
|
|
|
|
(defmethod spawn-impact-particles ((this turret-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* ((gp-0 (-> this root trans))
|
|
(a1-0 (-> this tail-pos))
|
|
(s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0))
|
|
(f30-0 (vector-length s5-1))
|
|
)
|
|
(let ((s4-0 (new 'stack-no-clear 'vector)))
|
|
(let ((v1-4 a1-0))
|
|
(let ((a0-2 s5-1))
|
|
(let ((a2-1 0.8))
|
|
(.mov vf7 a2-1)
|
|
)
|
|
(.lvf vf5 (&-> a0-2 quad))
|
|
)
|
|
(.lvf vf4 (&-> v1-4 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 (&-> s4-0 quad) vf6)
|
|
(let ((f28-0 (-> *part-id-table* 915 init-specs 4 initial-valuef)))
|
|
(set! (-> *part-id-table* 915 init-specs 4 initial-valuef) (vector-length s5-1))
|
|
(draw-beam (-> *part-id-table* 915) a1-0 s5-1 #f #t)
|
|
(set! (-> *part-id-table* 915 init-specs 4 initial-valuef) f28-0)
|
|
)
|
|
(vector-normalize! s5-1 1.0)
|
|
(launch-particles (-> *part-id-table* 607) s4-0)
|
|
(launch-particles (-> *part-id-table* 608) s4-0)
|
|
)
|
|
(let ((s4-1 (new 'stack-no-clear 'matrix))
|
|
(f26-0 (* 0.000027126736 f30-0))
|
|
(f30-1 (-> *part-id-table* 923 init-specs 3 initial-valuef))
|
|
(f28-1 (-> *part-id-table* 923 init-specs 4 initial-valuef))
|
|
)
|
|
(forward-up->inv-matrix s4-1 s5-1 *up-vector*)
|
|
(set! (-> s4-1 trans quad) (-> gp-0 quad))
|
|
(set! (-> *part-id-table* 923 init-specs 3 initial-valuef) (* f26-0 f30-1))
|
|
(set! (-> *part-id-table* 923 init-specs 4 initial-valuef) (* f26-0 f28-1))
|
|
(launch-particles (-> *part-id-table* 923) s4-1 :origin-is-matrix #t)
|
|
(set! (-> *part-id-table* 923 init-specs 3 initial-valuef) f30-1)
|
|
(set! (-> *part-id-table* 923 init-specs 4 initial-valuef) f28-1)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
)
|
|
|
|
(defmethod spawn-shell-particles ((this turret-shot))
|
|
"TODO - confirm"
|
|
(let* ((root (-> this root))
|
|
(v1-2 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> this tail-pos) (-> root trans)) 2048.0))
|
|
(gp-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
(set! (-> gp-0 quad) (-> root trans quad))
|
|
(vector+! gp-0 gp-0 v1-2)
|
|
(let ((s5-1 (get-process *default-dead-pool* part-tracker #x4000)))
|
|
(when s5-1
|
|
(let ((t9-2 (method-of-type part-tracker activate)))
|
|
(t9-2
|
|
(the-as part-tracker s5-1)
|
|
*entity-pool*
|
|
(symbol->string (-> part-tracker symbol))
|
|
(the-as pointer #x70004000)
|
|
)
|
|
)
|
|
(let ((t9-3 run-function-in-process)
|
|
(a0-8 s5-1)
|
|
(a1-6 part-tracker-init)
|
|
(a2-4 (-> *part-group-id-table* 200))
|
|
(a3-1 0)
|
|
(t0-0 #f)
|
|
(t1-0 #f)
|
|
(t2-0 #f)
|
|
(t3-0 *launch-matrix*)
|
|
)
|
|
(set! (-> t3-0 trans quad) (-> gp-0 quad))
|
|
((the-as (function object object object object object object object object none) t9-3)
|
|
a0-8
|
|
a1-6
|
|
a2-4
|
|
a3-1
|
|
t0-0
|
|
t1-0
|
|
t2-0
|
|
t3-0
|
|
)
|
|
)
|
|
(-> s5-1 ppointer)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod play-impact-sound ((this turret-shot) (proj-options projectile-options))
|
|
(let ((options proj-options))
|
|
(cond
|
|
((zero? options)
|
|
(sound-play "drl-turret-fire")
|
|
)
|
|
((= options (projectile-options lose-altitude))
|
|
(sound-play "drl-turret-hit")
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; WARN: Return type mismatch projectile-options vs none.
|
|
(defmethod init-proj-settings! ((this turret-shot))
|
|
"Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc"
|
|
(set! (-> this tail-pos quad) (-> this root trans quad))
|
|
(cpad-set-buzz! (-> *cpad-list* cpads 0) 1 204 (seconds 0.1))
|
|
(set! (-> this attack-mode) 'turret)
|
|
(set! (-> this max-speed) 1228800.0)
|
|
(set! (-> this move) guard-shot-move)
|
|
(set! (-> this damage) 1.0)
|
|
(logior! (-> this options) (projectile-options deal-damage))
|
|
(none)
|
|
)
|
|
|
|
(defmethod init-proj-collision! ((this turret-shot))
|
|
"Init the [[projectile]]'s [[collide-shape]]"
|
|
(let ((cshape (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player))))
|
|
(set! (-> cshape dynam) (copy *standard-dynamics* 'process))
|
|
(set! (-> cshape reaction)
|
|
(the-as (function control-info collide-query vector vector collide-status) cshape-reaction-just-move)
|
|
)
|
|
(set! (-> cshape no-reaction)
|
|
(the-as (function collide-shape-moving collide-query vector vector object) nothing)
|
|
)
|
|
(set! (-> cshape penetrate-using) (penetrate enemy-dark-shot))
|
|
(let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 2) 0)))
|
|
(set! (-> cshape total-prims) (the-as uint 3))
|
|
(set! (-> prim-group prim-core collide-as) (collide-spec projectile))
|
|
(set! (-> prim-group prim-core collide-with)
|
|
(collide-spec
|
|
backgnd
|
|
jak
|
|
bot
|
|
crate
|
|
civilian
|
|
enemy
|
|
obstacle
|
|
vehicle-sphere
|
|
hit-by-others-list
|
|
player-list
|
|
obstacle-for-jak
|
|
)
|
|
)
|
|
(set! (-> prim-group prim-core action) (collide-action solid))
|
|
(set-vector! (-> prim-group local-sphere) 0.0 0.0 0.0 4915.2)
|
|
(set! (-> cshape root-prim) prim-group)
|
|
)
|
|
(let ((prim-sphere-1 (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0))))
|
|
(set! (-> prim-sphere-1 prim-core collide-as) (collide-spec projectile))
|
|
(set! (-> prim-sphere-1 prim-core collide-with)
|
|
(collide-spec
|
|
backgnd
|
|
jak
|
|
bot
|
|
crate
|
|
civilian
|
|
enemy
|
|
obstacle
|
|
vehicle-sphere
|
|
hit-by-others-list
|
|
player-list
|
|
obstacle-for-jak
|
|
)
|
|
)
|
|
(set! (-> prim-sphere-1 prim-core action) (collide-action solid deadly))
|
|
(set-vector! (-> prim-sphere-1 local-sphere) 0.0 0.0 0.0 2048.0)
|
|
)
|
|
(let ((prim-sphere-2 (new 'process 'collide-shape-prim-sphere cshape (the-as uint 0))))
|
|
(set! (-> prim-sphere-2 prim-core collide-as) (collide-spec projectile))
|
|
(set! (-> prim-sphere-2 prim-core collide-with)
|
|
(collide-spec jak bot crate civilian enemy vehicle-sphere hit-by-others-list player-list obstacle-for-jak)
|
|
)
|
|
(set! (-> prim-sphere-2 prim-core action) (collide-action deadly))
|
|
(set-vector! (-> prim-sphere-2 local-sphere) 0.0 0.0 0.0 4915.2)
|
|
)
|
|
(set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w)))
|
|
(let ((root-prim (-> cshape root-prim)))
|
|
(set! (-> cshape backup-collide-as) (-> root-prim prim-core collide-as))
|
|
(set! (-> cshape backup-collide-with) (-> root-prim prim-core collide-with))
|
|
)
|
|
(set! (-> cshape max-iteration-count) (the-as uint 1))
|
|
(set! (-> cshape event-self) 'touched)
|
|
(set! (-> this root) cshape)
|
|
)
|
|
(set! (-> this root pat-ignore-mask)
|
|
(new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1)
|
|
)
|
|
0
|
|
(none)
|
|
)
|