mirror of
https://github.com/open-goal/jak-project
synced 2026-06-29 03:31:21 -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>
308 lines
9.5 KiB
Common Lisp
Vendored
Generated
308 lines
9.5 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; failed to figure out what this is:
|
|
(defpartgroup group-standard-plat
|
|
:id 107
|
|
:bounds (static-bspherem 0 -12 0 14)
|
|
:parts ((sp-item 363 :fade-after (meters 60) :falloff-to (meters 60))
|
|
(sp-item 364 :fade-after (meters 160) :falloff-to (meters 160))
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defpart 363
|
|
:init-specs ((:num 1.5)
|
|
(:y (meters 1))
|
|
(:rot-x 5)
|
|
(:r 5324.8)
|
|
(:g 4096.0)
|
|
(:b 3686.4)
|
|
(:vel-y (meters 0.0033333334))
|
|
(:fade-b -16.383999)
|
|
(:timer (seconds 0.085))
|
|
(:flags (aux-list))
|
|
(:conerot-x (degrees 140) (degrees 40))
|
|
(:conerot-y (degrees 0) (degrees 360))
|
|
(:conerot-radius (meters 3))
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defpart 364
|
|
:init-specs ((:texture (new 'static 'texture-id :index #xf :page #x2))
|
|
(:num 2.0)
|
|
(:y (meters 1.5))
|
|
(:scale-x (meters 2) (meters 1))
|
|
(:scale-y :copy scale-x)
|
|
(:g 0.0 64.0)
|
|
(:b 128.0 128.0)
|
|
(:a 16.0 32.0)
|
|
(:vel-y (meters 0.01))
|
|
(:fade-g -0.42666668)
|
|
(:fade-a -0.32)
|
|
(:accel-y (meters -0.000033333334))
|
|
(:friction 0.96)
|
|
(:timer (seconds 0.5))
|
|
(:flags (bit2 bit3))
|
|
(:conerot-x (degrees 130) (degrees 100.00001))
|
|
(:conerot-y (degrees 0) (degrees 360))
|
|
(:conerot-radius (meters 3))
|
|
)
|
|
)
|
|
|
|
;; definition of type plat
|
|
(deftype plat (baseplat)
|
|
((path-pos float)
|
|
(sync sync-info-eased :inline)
|
|
(sound-id sound-id)
|
|
)
|
|
(:methods
|
|
(get-lit-skel (_type_) skeleton-group)
|
|
(plat-method-28 () none)
|
|
(wad () _type_ :state)
|
|
(plat-startup (plat) _type_ :state)
|
|
(plat-idle () _type_ :state)
|
|
(plat-path-active (plat) _type_ :state)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type plat
|
|
(defmethod inspect ((this plat))
|
|
(let ((t9-0 (method-of-type baseplat inspect)))
|
|
(t9-0 this)
|
|
)
|
|
(format #t "~T~Tpath-pos: ~f~%" (-> this path-pos))
|
|
(format #t "~T~Tsync: #<sync-info-eased @ #x~X>~%" (-> this sync))
|
|
(format #t "~T~Tsound-id: ~D~%" (-> this sound-id))
|
|
this
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defskelgroup *plat-sg* plat plat-lod0-jg plat-idle-ja
|
|
((plat-lod0-mg (meters 20)) (plat-lod1-mg (meters 40)) (plat-lod2-mg (meters 999999)))
|
|
:bounds (static-spherem 0 -0.5 0 3)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defskelgroup *plat-jungleb-sg* plat-jungleb plat-jungleb-lod0-jg plat-jungleb-idle-ja
|
|
((plat-jungleb-lod0-mg (meters 999999)))
|
|
:bounds (static-spherem 0 -0.5 0 3)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defskelgroup *plat-sunken-sg* plat-sunken plat-sunken-lod0-jg plat-sunken-idle-ja
|
|
((plat-sunken-lod0-mg (meters 999999)))
|
|
:bounds (static-spherem 0 -0.5 0 3.2)
|
|
)
|
|
|
|
;; definition for method 23 of type plat
|
|
(defmethod get-unlit-skel ((this plat))
|
|
(cond
|
|
((= (-> (if (-> this entity)
|
|
(-> this entity extra level)
|
|
(-> *level* level-default)
|
|
)
|
|
name
|
|
)
|
|
'jungleb
|
|
)
|
|
*plat-jungleb-sg*
|
|
)
|
|
((or (= (-> (if (-> this entity)
|
|
(-> this entity extra level)
|
|
(-> *level* level-default)
|
|
)
|
|
name
|
|
)
|
|
'sunken
|
|
)
|
|
(= (-> (if (-> this entity)
|
|
(-> this entity extra level)
|
|
(-> *level* level-default)
|
|
)
|
|
name
|
|
)
|
|
'sunkenb
|
|
)
|
|
)
|
|
*plat-sunken-sg*
|
|
)
|
|
(else
|
|
*plat-sg*
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for method 24 of type plat
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defmethod baseplat-method-24 ((this plat))
|
|
(let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player))))
|
|
(set! (-> s5-0 dynam) (copy *standard-dynamics* 'process))
|
|
(set! (-> s5-0 reaction) default-collision-reaction)
|
|
(set! (-> s5-0 no-reaction)
|
|
(the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
|
|
)
|
|
(alloc-riders s5-0 1)
|
|
(let ((s4-0 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0))))
|
|
(set! (-> s4-0 prim-core collide-as) (collide-kind ground-object))
|
|
(set! (-> s4-0 collide-with) (collide-kind target))
|
|
(set! (-> s4-0 prim-core action) (collide-action solid rider-plat-sticky))
|
|
(set! (-> s4-0 prim-core offense) (collide-offense indestructible))
|
|
(set! (-> s4-0 transform-index) 0)
|
|
(set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 13107.2)
|
|
(set-root-prim! s5-0 s4-0)
|
|
)
|
|
(set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
|
|
(backup-collide-with-as s5-0)
|
|
(set! (-> this root) s5-0)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 26 of type plat
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defmethod baseplat-method-26 ((this plat))
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 25 of type plat
|
|
;; INFO: Return type mismatch sparticle-launch-control vs sparticle-launch-group.
|
|
(defmethod baseplat-method-25 ((this plat))
|
|
(the-as sparticle-launch-group (when (!= (-> (if (-> this entity)
|
|
(-> this entity extra level)
|
|
(-> *level* level-default)
|
|
)
|
|
name
|
|
)
|
|
'maincave
|
|
)
|
|
(let ((v0-0 (create-launch-control (-> *part-group-id-table* 107) this)))
|
|
(set! (-> this part) v0-0)
|
|
v0-0
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate plat-startup (plat)
|
|
:virtual #t
|
|
:code (behavior ((arg0 plat))
|
|
(cond
|
|
((logtest? (-> self path flags) (path-control-flag not-found))
|
|
(go-virtual plat-idle)
|
|
)
|
|
((> (-> self sync period) 0)
|
|
(go-virtual plat-path-active arg0)
|
|
)
|
|
(else
|
|
(go-virtual plat-idle)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate plat-idle (plat)
|
|
:virtual #t
|
|
:event plat-event
|
|
:trans (behavior ()
|
|
(baseplat-method-20 self)
|
|
)
|
|
:code (behavior ()
|
|
(plat-trans)
|
|
(rider-post)
|
|
(suspend)
|
|
(loop
|
|
(when (not (-> self bouncing))
|
|
(plat-trans)
|
|
(rider-post)
|
|
(logior! (-> self mask) (process-mask sleep-code))
|
|
(suspend)
|
|
0
|
|
)
|
|
(while (-> self bouncing)
|
|
(plat-trans)
|
|
(rider-post)
|
|
(suspend)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate plat-path-active (plat)
|
|
:virtual #t
|
|
:event plat-event
|
|
:exit (behavior ()
|
|
(sound-stop (-> self sound-id))
|
|
)
|
|
:trans (behavior ()
|
|
(set! (-> self path-pos) (if (logtest? (-> self fact options) (fact-options wrap-phase))
|
|
(get-current-phase (-> self sync))
|
|
(get-current-phase-with-mirror (-> self sync))
|
|
)
|
|
)
|
|
(eval-path-curve! (-> self path) (-> self basetrans) (-> self path-pos) 'interp)
|
|
(if (< (vector-vector-distance (-> self root trans) (ear-trans)) 81920.0)
|
|
(sound-play "eco-plat-hover" :id (-> self sound-id) :position (the-as symbol (-> self root trans)))
|
|
)
|
|
(plat-trans)
|
|
)
|
|
:code (the-as (function plat object) anim-loop)
|
|
:post plat-post
|
|
)
|
|
|
|
;; definition for method 11 of type plat
|
|
;; INFO: Return type mismatch object vs none.
|
|
(defmethod init-from-entity! ((this plat) (arg0 entity-actor))
|
|
(logior! (-> this mask) (process-mask platform))
|
|
(baseplat-method-24 this)
|
|
(process-drawable-from-entity! this arg0)
|
|
(initialize-skeleton this (get-unlit-skel this) '())
|
|
(logior! (-> this skel status) (janim-status inited))
|
|
(update-transforms! (-> this root))
|
|
(baseplat-method-21 this)
|
|
(baseplat-method-25 this)
|
|
(load-params! (-> this sync) this (the-as uint 0) 0.0 0.15 0.15)
|
|
(set! (-> this fact)
|
|
(new 'process 'fact-info this (pickup-type eco-pill-random) (-> *FACT-bank* default-pill-inc))
|
|
)
|
|
(set! (-> this path) (new 'process 'curve-control this 'path -1000000000.0))
|
|
(logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text))
|
|
(set! (-> this sound-id) (new-sound-id))
|
|
(cond
|
|
((logtest? (-> this path flags) (path-control-flag not-found))
|
|
(set! (-> this path-pos) 0.0)
|
|
(let ((a0-14 this))
|
|
(baseplat-method-26 a0-14)
|
|
(go (method-of-object this plat-startup) a0-14)
|
|
)
|
|
)
|
|
((> (-> this sync period) 0)
|
|
(set! (-> this path-pos) (if (logtest? (-> this fact options) (fact-options wrap-phase))
|
|
(get-current-phase (-> this sync))
|
|
(get-current-phase-with-mirror (-> this sync))
|
|
)
|
|
)
|
|
(eval-path-curve! (-> this path) (-> this root trans) (-> this path-pos) 'interp)
|
|
(let ((a0-18 this))
|
|
(baseplat-method-26 a0-18)
|
|
(go (method-of-object this plat-startup) a0-18)
|
|
)
|
|
)
|
|
(else
|
|
(set! (-> this path-pos) 0.0)
|
|
(eval-path-curve! (-> this path) (-> this root trans) (-> this path-pos) 'interp)
|
|
(let ((a0-20 this))
|
|
(baseplat-method-26 a0-20)
|
|
(go (method-of-object this plat-startup) a0-20)
|
|
)
|
|
)
|
|
)
|
|
(none)
|
|
)
|