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>
205 lines
6.4 KiB
Common Lisp
205 lines
6.4 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: launcherdoor.gc
|
|
;; name in dgo: launcherdoor
|
|
;; dgos: JUN, JUNGLE, L1, MAI, MAINCAVE, SUN, SUNKEN
|
|
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
(deftype launcherdoor (process-drawable)
|
|
((root collide-shape :override)
|
|
(notify-player-passed-thru? symbol)
|
|
(thresh-y float)
|
|
(open-speed float)
|
|
(close-speed float)
|
|
(load-mode symbol)
|
|
)
|
|
(:states
|
|
(launcherdoor-closed symbol)
|
|
(launcherdoor-open symbol)
|
|
)
|
|
)
|
|
|
|
|
|
(defskelgroup *launcherdoor-sg* launcherdoor launcherdoor-geo-jg -1
|
|
((launcherdoor-geo-mg (meters 20)) (launcherdoor-lod1-mg (meters 999999)))
|
|
:bounds (static-spherem 0 0 0 4)
|
|
)
|
|
|
|
(defskelgroup *launcherdoor-maincave-sg* launcherdoor-maincave launcherdoor-maincave-geo-jg -1
|
|
((launcherdoor-maincave-geo-mg (meters 20)) (launcherdoor-maincave-lod1-mg (meters 999999)))
|
|
:bounds (static-spherem 0 0 0 4)
|
|
)
|
|
|
|
(defstate launcherdoor-closed (launcherdoor)
|
|
:code (behavior ((arg0 symbol))
|
|
(if (not arg0)
|
|
(sound-play "ldoor-close")
|
|
)
|
|
(when *target*
|
|
(case (-> *target* current-level name)
|
|
(('jungle 'jungleb)
|
|
(send-event *target* 'no-load-wait (seconds 20))
|
|
)
|
|
)
|
|
)
|
|
(restore-collide-with-as (-> self root))
|
|
(ja-no-eval :num! (seek! 0.0))
|
|
(when arg0
|
|
(ja :num-func num-func-identity :frame-num 0.0)
|
|
(set! (-> self draw force-lod) 1)
|
|
)
|
|
(suspend)
|
|
(loop
|
|
(if (and *target*
|
|
(= (-> *target* control unknown-surface00 name) 'launch-jump)
|
|
(< (-> *target* control trans y) (-> self thresh-y))
|
|
)
|
|
(go launcherdoor-open #f)
|
|
)
|
|
(ja :num! (seek! 0.0 (-> self close-speed)))
|
|
(suspend)
|
|
(when (ja-done? 0)
|
|
(set! (-> self draw force-lod) 1)
|
|
(when (-> self notify-player-passed-thru?)
|
|
(set! (-> self notify-player-passed-thru?) #f)
|
|
(let* ((gp-1 (-> self entity))
|
|
(s5-1 (entity-actor-count gp-1 'alt-actor))
|
|
)
|
|
(dotimes (s4-1 s5-1)
|
|
(let ((v1-43 (entity-actor-lookup gp-1 'alt-actor s4-1)))
|
|
(if v1-43
|
|
(send-event
|
|
(if v1-43
|
|
(-> v1-43 extra process)
|
|
)
|
|
'notify
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(case (-> self load-mode)
|
|
(('jungle)
|
|
(load-state-want-levels 'village1 'jungle)
|
|
(load-state-want-display-level 'village1 'display)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
:post ja-post
|
|
)
|
|
|
|
(defstate launcherdoor-open (launcherdoor)
|
|
:code (behavior ((arg0 symbol))
|
|
(if (not arg0)
|
|
(sound-play "ldoor-open")
|
|
)
|
|
(set! (-> self draw force-lod) 0)
|
|
(clear-collide-with-as (-> self root))
|
|
(ja-no-eval :num! (seek!))
|
|
(if arg0
|
|
(ja :num-func num-func-identity :frame-num max)
|
|
)
|
|
(loop
|
|
(when (or (not *target*)
|
|
(!= (-> *target* control unknown-surface00 name) 'launch-jump)
|
|
(< (+ 4096.0 (-> self root trans y)) (-> *target* control trans y))
|
|
)
|
|
(when (and *target* (< (-> self thresh-y) (-> *target* control trans y)))
|
|
(let ((a1-3 (res-lump-struct (-> self entity) 'continue-name structure)))
|
|
(when a1-3
|
|
(let ((v1-36 (set-continue! *game-info* (the-as basic a1-3))))
|
|
(load-commands-set! *level* (-> v1-36 load-commands))
|
|
)
|
|
)
|
|
)
|
|
(set! (-> self notify-player-passed-thru?) #t)
|
|
)
|
|
(go launcherdoor-closed #f)
|
|
)
|
|
(ja :num! (seek! max (-> self open-speed)))
|
|
(suspend)
|
|
)
|
|
)
|
|
:post ja-post
|
|
)
|
|
|
|
(defmethod init-from-entity! ((this launcherdoor) (arg0 entity-actor))
|
|
(set! (-> this notify-player-passed-thru?) #f)
|
|
(set! (-> this open-speed) 4.0)
|
|
(set! (-> this close-speed) 2.0)
|
|
(let ((s4-0 (new 'process 'collide-shape this (collide-list-enum hit-by-player))))
|
|
(let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0))))
|
|
(set! (-> s3-0 prim-core collide-as) (collide-kind enemy))
|
|
(set! (-> s3-0 collide-with) (collide-kind target))
|
|
(set! (-> s3-0 prim-core action) (collide-action solid))
|
|
(set! (-> s3-0 prim-core offense) (collide-offense indestructible))
|
|
(set! (-> s3-0 transform-index) 0)
|
|
(set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 14336.0)
|
|
(set-root-prim! s4-0 s3-0)
|
|
)
|
|
(set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w)))
|
|
(backup-collide-with-as s4-0)
|
|
(set! (-> this root) s4-0)
|
|
)
|
|
(process-drawable-from-entity! this arg0)
|
|
(cond
|
|
((= (-> (if (-> this entity)
|
|
(-> this entity extra level)
|
|
(-> *level* level-default)
|
|
)
|
|
name
|
|
)
|
|
'maincave
|
|
)
|
|
(set! (-> this close-speed) 4.0)
|
|
(initialize-skeleton this *launcherdoor-maincave-sg* '())
|
|
(ja-channel-set! 1)
|
|
(let ((s5-1 (-> this skel root-channel 0)))
|
|
(joint-control-channel-group-eval!
|
|
s5-1
|
|
(the-as art-joint-anim (-> this draw art-group data 3))
|
|
num-func-identity
|
|
)
|
|
(set! (-> s5-1 frame-num) 0.0)
|
|
)
|
|
)
|
|
(else
|
|
(initialize-skeleton this *launcherdoor-sg* '())
|
|
(ja-channel-set! 1)
|
|
(let ((s5-2 (-> this skel root-channel 0)))
|
|
(joint-control-channel-group-eval!
|
|
s5-2
|
|
(the-as art-joint-anim (-> this draw art-group data 3))
|
|
num-func-identity
|
|
)
|
|
(set! (-> s5-2 frame-num) 0.0)
|
|
)
|
|
)
|
|
)
|
|
(transform-post)
|
|
(case (-> this entity extra level name)
|
|
(('jungle)
|
|
(set! (-> this draw shadow-mask) (the-as uint 28))
|
|
)
|
|
)
|
|
(set! (-> this load-mode) (-> (if (-> this entity)
|
|
(-> this entity extra level)
|
|
(-> *level* level-default)
|
|
)
|
|
name
|
|
)
|
|
)
|
|
(set! (-> this thresh-y) (+ -81920.0 (-> this root trans y)))
|
|
(if (and *target* (= (-> *target* control unknown-surface00 name) 'launch-jump))
|
|
(go launcherdoor-open #t)
|
|
(go launcherdoor-closed #t)
|
|
)
|
|
(none)
|
|
)
|