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>
400 lines
16 KiB
Common Lisp
400 lines
16 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: widow2.gc
|
|
;; name in dgo: widow2
|
|
;; dgos: TOA
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
(defmethod deal-damage! ((this widow-shot) (arg0 process) (arg1 event-message-block))
|
|
"Constructs an [[attack-info]] according to the projectile's `options`"
|
|
(let ((t9-0 (method-of-type projectile deal-damage!)))
|
|
(when (t9-0 this arg0 arg1)
|
|
(set! (-> this hit-actor?) #t)
|
|
(if (= arg0 *target*)
|
|
(send-event (ppointer->process (-> this parent)) 'shot-hit-target)
|
|
)
|
|
#t
|
|
)
|
|
)
|
|
)
|
|
|
|
(defmethod widow-method-44 ((this widow) (arg0 vector) (arg1 vector))
|
|
(let ((gp-0 (new 'stack-no-clear 'collide-query)))
|
|
(set! (-> gp-0 start-pos quad) (-> arg0 quad))
|
|
(vector-normalize-copy! (-> gp-0 move-dist) arg1 81920.0)
|
|
(let ((v1-1 gp-0))
|
|
(set! (-> v1-1 radius) 4096.0)
|
|
(set! (-> v1-1 collide-with) (collide-spec enemy hit-by-others-list))
|
|
(set! (-> v1-1 ignore-process0) this)
|
|
(set! (-> v1-1 ignore-process1) #f)
|
|
(set! (-> v1-1 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1))
|
|
(set! (-> v1-1 action-mask) (collide-action solid deadly))
|
|
)
|
|
(if (>= (fill-and-probe-using-line-sphere *collide-cache* gp-0) 0.0)
|
|
(return #f)
|
|
)
|
|
)
|
|
#t
|
|
)
|
|
|
|
;; WARN: Return type mismatch sound-id vs none.
|
|
(defmethod widow-method-45 ((this widow) (arg0 vector) (arg1 vector) (arg2 vector))
|
|
(let ((s5-0 (new 'stack-no-clear 'projectile-init-by-other-params)))
|
|
(let ((f30-0 (/ 2013265900.0 (vector-length arg2)))
|
|
(s3-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
(set! (-> s5-0 ent) (-> this entity))
|
|
(set! (-> s5-0 charge) 1.0)
|
|
(set! (-> s5-0 options) (projectile-options account-for-target-velocity))
|
|
(set! (-> s5-0 pos quad) (-> arg1 quad))
|
|
(set! (-> s5-0 notify-handle) (process->handle this))
|
|
(set! (-> s5-0 owner-handle) (the-as handle #f))
|
|
(set! (-> s5-0 ignore-handle) (process->handle this))
|
|
(let* ((v1-13 *game-info*)
|
|
(a0-12 (+ (-> v1-13 attack-id) 1))
|
|
)
|
|
(set! (-> v1-13 attack-id) a0-12)
|
|
(set! (-> s5-0 attack-id) a0-12)
|
|
)
|
|
(set! (-> s5-0 timeout) (seconds 4))
|
|
(vector-normalize-copy! (-> s5-0 vel) arg2 491520.0)
|
|
(let ((f30-1 (fmin 16384.0 f30-0)))
|
|
(set-vector! s3-0 (-> arg2 z) (-> arg2 y) (- (-> arg2 x)) 1.0)
|
|
(vector-normalize! s3-0 (rand-vu-float-range (- f30-1) f30-1))
|
|
(vector+! (-> s5-0 vel) (-> s5-0 vel) s3-0)
|
|
(vector-cross! s3-0 s3-0 (-> s5-0 vel))
|
|
(vector-normalize! s3-0 (rand-vu-float-range (- f30-1) f30-1))
|
|
)
|
|
(vector+! (-> s5-0 vel) (-> s5-0 vel) s3-0)
|
|
)
|
|
(spawn-projectile widow-shot s5-0 this *default-dead-pool*)
|
|
)
|
|
(if arg0
|
|
(sound-play "widow-fire")
|
|
)
|
|
(none)
|
|
)
|
|
|
|
(defmethod widow-method-46 ((this widow) (arg0 vector) (arg1 int))
|
|
(let ((s4-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data arg1)))
|
|
(s3-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
(set! (-> s3-0 quad) (-> this node-list data arg1 bone transform vector 1 quad))
|
|
(if (widow-method-44 this s4-0 s3-0)
|
|
(widow-method-45 this arg0 s4-0 s3-0)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod deactivate ((this widow))
|
|
(if (nonzero? (-> this drill-spark-part))
|
|
(kill-and-free-particles (-> this drill-spark-part))
|
|
)
|
|
(if (nonzero? (-> this drill-spark-part-alt))
|
|
(kill-and-free-particles (-> this drill-spark-part-alt))
|
|
)
|
|
(if (nonzero? (-> this extract-stone-part))
|
|
(kill-and-free-particles (-> this extract-stone-part))
|
|
)
|
|
(if (nonzero? (-> this insert-stone-part))
|
|
(kill-and-free-particles (-> this insert-stone-part))
|
|
)
|
|
(if (nonzero? (-> this land-part))
|
|
(kill-and-free-particles (-> this land-part))
|
|
)
|
|
(if (nonzero? (-> this green-charge-part))
|
|
(kill-and-free-particles (-> this green-charge-part))
|
|
)
|
|
(if (nonzero? (-> this green-fire-part))
|
|
(kill-and-free-particles (-> this green-fire-part))
|
|
)
|
|
(if (-> this drill-sound-playing)
|
|
(sound-stop (-> this drill-sound))
|
|
)
|
|
(if (-> this drill-sweeten-sound-playing)
|
|
(sound-stop (-> this drill-sweeten-sound))
|
|
)
|
|
(if (-> this hover-sound-playing)
|
|
(sound-stop (-> this hover-sound))
|
|
)
|
|
(if (-> this shake-sound-playing)
|
|
(sound-stop (-> this shake-sound))
|
|
)
|
|
((method-of-type process-drawable deactivate) this)
|
|
(none)
|
|
)
|
|
|
|
;; WARN: Return type mismatch process-drawable vs widow.
|
|
(defmethod relocate ((this widow) (arg0 int))
|
|
(if (nonzero? (-> this left-cover-jm))
|
|
(&+! (-> this left-cover-jm) arg0)
|
|
)
|
|
(if (nonzero? (-> this right-cover-jm))
|
|
(&+! (-> this right-cover-jm) arg0)
|
|
)
|
|
(if (nonzero? (-> this left-drill-jm))
|
|
(&+! (-> this left-drill-jm) arg0)
|
|
)
|
|
(if (nonzero? (-> this right-drill-jm))
|
|
(&+! (-> this right-drill-jm) arg0)
|
|
)
|
|
(if (nonzero? (-> this drill-spark-part))
|
|
(&+! (-> this drill-spark-part) arg0)
|
|
)
|
|
(if (nonzero? (-> this drill-spark-part-alt))
|
|
(&+! (-> this drill-spark-part-alt) arg0)
|
|
)
|
|
(if (nonzero? (-> this extract-stone-part))
|
|
(&+! (-> this extract-stone-part) arg0)
|
|
)
|
|
(if (nonzero? (-> this insert-stone-part))
|
|
(&+! (-> this insert-stone-part) arg0)
|
|
)
|
|
(if (nonzero? (-> this land-part))
|
|
(&+! (-> this land-part) arg0)
|
|
)
|
|
(if (nonzero? (-> this green-charge-part))
|
|
(&+! (-> this green-charge-part) arg0)
|
|
)
|
|
(if (nonzero? (-> this green-fire-part))
|
|
(&+! (-> this green-fire-part) arg0)
|
|
)
|
|
(dotimes (v1-44 5)
|
|
(if (nonzero? (-> this lightning v1-44))
|
|
(&+! (-> this lightning v1-44) arg0)
|
|
)
|
|
)
|
|
(the-as widow ((method-of-type process-drawable relocate) this arg0))
|
|
)
|
|
|
|
;; WARN: Return type mismatch object vs none.
|
|
(defmethod init-from-entity! ((this widow) (arg0 entity-actor))
|
|
"Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that.
|
|
This commonly includes things such as:
|
|
- stack size
|
|
- collision information
|
|
- loading the skeleton group / bones
|
|
- sounds"
|
|
(let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player))))
|
|
(set! (-> s4-0 dynam) (copy *standard-dynamics* 'process))
|
|
(set! (-> s4-0 reaction) cshape-reaction-default)
|
|
(set! (-> s4-0 no-reaction)
|
|
(the-as (function collide-shape-moving collide-query vector vector object) nothing)
|
|
)
|
|
(set! (-> s4-0 penetrated-by)
|
|
(penetrate
|
|
generic-attack
|
|
lunge
|
|
flop
|
|
punch
|
|
spin
|
|
roll
|
|
uppercut
|
|
bonk
|
|
tube
|
|
vehicle
|
|
flut-attack
|
|
board
|
|
mech-punch
|
|
dark-punch
|
|
dark-giant
|
|
)
|
|
)
|
|
(let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 1) 0)))
|
|
(set! (-> s4-0 total-prims) (the-as uint 2))
|
|
(set! (-> s3-0 prim-core collide-as) (collide-spec enemy))
|
|
(set! (-> s3-0 prim-core collide-with) (collide-spec jak bot player-list))
|
|
(set! (-> s3-0 prim-core action) (collide-action solid))
|
|
(set! (-> s3-0 transform-index) 3)
|
|
(set-vector! (-> s3-0 local-sphere) 0.0 0.0 9216.0 36864.0)
|
|
(set! (-> s4-0 root-prim) s3-0)
|
|
)
|
|
(let ((v1-14 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0))))
|
|
(set! (-> v1-14 prim-core collide-as) (collide-spec enemy))
|
|
(set! (-> v1-14 prim-core collide-with) (collide-spec jak bot player-list))
|
|
(set! (-> v1-14 prim-core action) (collide-action solid))
|
|
(set! (-> v1-14 transform-index) 3)
|
|
(set-vector! (-> v1-14 local-sphere) 0.0 0.0 0.0 32768.0)
|
|
)
|
|
(set! (-> s4-0 nav-radius) 8192.0)
|
|
(let ((v1-16 (-> s4-0 root-prim)))
|
|
(set! (-> s4-0 backup-collide-as) (-> v1-16 prim-core collide-as))
|
|
(set! (-> s4-0 backup-collide-with) (-> v1-16 prim-core collide-with))
|
|
)
|
|
(set! (-> this root) s4-0)
|
|
)
|
|
(process-drawable-from-entity! this arg0)
|
|
(initialize-skeleton
|
|
this
|
|
(the-as skeleton-group (art-group-get-by-name *level* "skel-widow" (the-as (pointer uint32) #f)))
|
|
(the-as pair 0)
|
|
)
|
|
(set! (-> this skel generate-frame-function) create-interpolated2-joint-animation-frame)
|
|
(setup-masks (-> this draw) 0 126)
|
|
(set! (-> this root pause-adjust-distance) 245760.0)
|
|
(dotimes (v1-26 8)
|
|
(set! (-> this catwalk v1-26) (the-as handle #f))
|
|
)
|
|
(let ((s4-2 (-> this entity extra perm)))
|
|
(logior! (-> s4-2 status) (entity-perm-status bit-5))
|
|
0
|
|
(let ((s3-2 (new 'stack-no-clear 'vector)))
|
|
(set! (-> s3-2 quad) (-> arg0 extra trans quad))
|
|
(+! (-> s3-2 y) -32768.0)
|
|
(+! (-> s3-2 z) 42475.52)
|
|
(dotimes (s5-1 8)
|
|
(cond
|
|
((not (logtest? (the-as int (-> s4-2 user-object 1)) (ash 1 s5-1)))
|
|
(set! (-> this catwalk s5-1) (ppointer->handle (process-spawn tomb-boss-catwalk s3-2 s5-1 :to this)))
|
|
(if (not (handle->process (-> this catwalk s5-1)))
|
|
(format 0 "catwalk ~D failed to spawn~%" s5-1)
|
|
)
|
|
)
|
|
(else
|
|
(send-event (handle->process (-> this catwalk 0)) 'catwalk-hit s5-1)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(dotimes (v1-62 8)
|
|
(set! (-> this bomb v1-62) (the-as handle #f))
|
|
)
|
|
(dotimes (v1-65 2)
|
|
(set! (-> this ammos v1-65) (the-as handle #f))
|
|
(set! (-> this ammo-timers v1-65) 0)
|
|
)
|
|
(set! (-> this attack-from-high-deg) #f)
|
|
(set! (-> this which-gun) 0)
|
|
(set! (-> this which-pod) 0)
|
|
(set! (-> this bomb-hits) 0)
|
|
(set! (-> this flying) #f)
|
|
(set! (-> this previous-anim) 0)
|
|
(set! (-> this circle-center quad) (-> this root trans quad))
|
|
(+! (-> this circle-center z) 40960.0)
|
|
(init (-> this theta) 0.0 0.01 91.022224 0.9)
|
|
(init (-> this tilt) 0.0 0.01 91.022224 0.9)
|
|
(set! (-> this left-cover-jm) (new 'process 'joint-mod (joint-mod-mode joint-set*) this 90))
|
|
(set! (-> this right-cover-jm) (new 'process 'joint-mod (joint-mod-mode joint-set*) this 91))
|
|
(widow-float-seeker-method-9 (-> this left-cover-angle) 0.0 0.01 0.1 0.9 0.25)
|
|
(widow-float-seeker-method-9 (-> this right-cover-angle) 0.0 0.01 0.1 0.9 0.25)
|
|
(set! (-> this left-drill-jm) (new 'process 'joint-mod (joint-mod-mode joint-set*) this 11))
|
|
(set! (-> this right-drill-jm) (new 'process 'joint-mod (joint-mod-mode joint-set*) this 44))
|
|
(init (-> this drill-speed) 0.0 0.01 0.1 0.9)
|
|
(let ((s5-2 (new 'stack-no-clear 'vector)))
|
|
(set! (-> s5-2 quad) (-> this root trans quad))
|
|
(set! (-> this baron) (process-spawn
|
|
manipy
|
|
:init manipy-init
|
|
s5-2
|
|
(-> this entity)
|
|
(art-group-get-by-name *level* "skel-baron" (the-as (pointer uint32) #f))
|
|
#f
|
|
0
|
|
:to this
|
|
)
|
|
)
|
|
)
|
|
(logior! (-> this baron 0 draw global-effect) (draw-control-global-effect disable-envmap))
|
|
(send-event (ppointer->process (-> this baron)) 'anim-mode 'clone-anim)
|
|
(set! (-> this baron 0 draw light-index) (mod (-> this draw light-index) (the-as uint 10)))
|
|
(let ((v1-106 (-> this baron)))
|
|
(if v1-106
|
|
(logclear! (-> v1-106 0 mask) (process-mask actor-pause))
|
|
)
|
|
)
|
|
(set! (-> this pod) (ppointer->handle (process-spawn baron-pod (-> this root trans) :to this)))
|
|
(set! (-> this heart) (the-as handle #f))
|
|
(set! (-> this drill-spark-part) (create-launch-control (-> *part-group-id-table* 713) this))
|
|
(set! (-> this drill-spark-part-alt) (create-launch-control (-> *part-group-id-table* 714) this))
|
|
(set! (-> this extract-stone-time) 0)
|
|
(set! (-> this extract-stone-part) (create-launch-control (-> *part-group-id-table* 715) this))
|
|
(set! (-> this insert-stone-time) 0)
|
|
(set! (-> this insert-stone-part) (create-launch-control (-> *part-group-id-table* 716) this))
|
|
(set! (-> this land-part) (create-launch-control (-> *part-group-id-table* 730) this))
|
|
(set! (-> this green-charge-part) (create-launch-control (-> *part-group-id-table* 731) this))
|
|
(set! (-> this green-fire-part) (create-launch-control (-> *part-group-id-table* 732) this))
|
|
(add-connection *part-engine* this 73 this 3251 (new 'static 'vector :w 819200.0))
|
|
(add-connection *part-engine* this 77 this 3251 (new 'static 'vector :w 819200.0))
|
|
(add-connection *part-engine* this 78 this 3251 (new 'static 'vector :w 819200.0))
|
|
(dotimes (s5-4 5)
|
|
(set! (-> this lightning s5-4) (new
|
|
'process
|
|
'lightning-control
|
|
(new 'static 'lightning-spec
|
|
:name #f
|
|
:flags (lightning-spec-flags lsf0)
|
|
:start-color (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80)
|
|
:end-color (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80)
|
|
:fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5)
|
|
:fade-start-factor 0.2
|
|
:fade-time 120.0
|
|
:texture (new 'static 'texture-id :index #x7 :page #x8c7)
|
|
:reduction 0.4
|
|
:num-points 48
|
|
:box-size 57344.0
|
|
:merge-factor 0.5
|
|
:merge-count 2
|
|
:radius 9216.0
|
|
:duration -1.0
|
|
:sound #f
|
|
)
|
|
this
|
|
0.0
|
|
)
|
|
)
|
|
(let ((v1-148 (-> this lightning s5-4))
|
|
(a0-97 0)
|
|
)
|
|
(let ((a1-48 (!= a0-97 (-> v1-148 state mode))))
|
|
(case a0-97
|
|
((3)
|
|
(if a1-48
|
|
(set! (-> v1-148 state counter) 0.0)
|
|
)
|
|
)
|
|
((1)
|
|
(set! (-> v1-148 state start-color) (-> v1-148 spec start-color))
|
|
(set! (-> v1-148 state end-color) (-> v1-148 spec end-color))
|
|
)
|
|
)
|
|
)
|
|
(set! (-> v1-148 state mode) (the-as lightning-mode a0-97))
|
|
)
|
|
)
|
|
(set! (-> this catwalk-sound) (new-sound-id))
|
|
(set! (-> this drill-sound) (new-sound-id))
|
|
(set! (-> this drill-sound-playing) #f)
|
|
(set! (-> this drill-sweeten-sound) (new-sound-id))
|
|
(set! (-> this drill-sweeten-sound-playing) #f)
|
|
(set! (-> this hover-sound) (new-sound-id))
|
|
(set! (-> this hover-sound-playing) #f)
|
|
(set! (-> this shake-sound) (new-sound-id))
|
|
(set! (-> this shake-sound-playing) #f)
|
|
(set! (-> this hud) (the-as handle #f))
|
|
(set! (-> this last-want-stone-talker) 0)
|
|
(set! (-> this last-general-flying-talker) 0)
|
|
(set! (-> this last-launch-droids-talker) 0)
|
|
(set! (-> this last-launch-bombs-talker) 0)
|
|
(set! (-> this last-shoot-gun-talker) 0)
|
|
(set! (-> this last-stone-charge-up-talker) 0)
|
|
(set! (-> this last-after-stone-shot-talker) 0)
|
|
(set! (-> this last-leave-perch-talker) 0)
|
|
(set! (-> this last-damaged-talker) 0)
|
|
(set! (-> this kicked-bombs) 0)
|
|
(set! (-> this launch-stages-completed) 0)
|
|
(set! (-> this current-shoot-stage) 0)
|
|
(set! (-> this last-gun-hit-stage) 0)
|
|
(set! (-> this gun-hits) 0)
|
|
(set! (-> this last-attack-id) (the-as uint 0))
|
|
(if (task-node-closed? (game-task-node tomb-boss-resolution))
|
|
(go (method-of-object this beaten))
|
|
(go (method-of-object this hidden))
|
|
)
|
|
(none)
|
|
)
|