mirror of
https://github.com/open-goal/jak-project
synced 2026-07-09 23:01:56 -04:00
48cb9bb787
Add support for `as-type` macro, and detecting inline font methods. This works in all three games but I've only updated jak 3's goal_src for now. Eventually I will go back and work through the others, but I want to get more decompiler features in first.  --------- Co-authored-by: water111 <awaterford1111445@gmail.com>
352 lines
10 KiB
Common Lisp
Vendored
Generated
352 lines
10 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition of type plat
|
|
(deftype plat (base-plat)
|
|
((path-pos float)
|
|
(sound-id sound-id)
|
|
(sync sync-eased :inline)
|
|
)
|
|
(:state-methods
|
|
plat-idle
|
|
plat-path-active
|
|
)
|
|
(:methods
|
|
(go-initial-state (_type_) object)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type plat
|
|
(defmethod inspect ((this plat))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(let ((t9-0 (method-of-type base-plat inspect)))
|
|
(t9-0 this)
|
|
)
|
|
(format #t "~2Tpath-pos: ~f~%" (-> this path-pos))
|
|
(format #t "~2Tsound-id: ~D~%" (-> this sound-id))
|
|
(format #t "~2Tsync: #<sync-eased @ #x~X>~%" (-> this sync))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defskelgroup skel-plat 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)
|
|
)
|
|
|
|
;; definition for method 31 of type plat
|
|
(defmethod get-art-group ((this plat))
|
|
(art-group-get-by-name *level* "skel-plat" (the-as (pointer level) #f))
|
|
)
|
|
|
|
;; definition for method 32 of type plat
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod init-collision! ((this plat))
|
|
(let ((s5-0 (new 'process 'collide-shape this (collide-list-enum hit-by-player))))
|
|
(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-spec pusher))
|
|
(set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list))
|
|
(set! (-> s4-0 prim-core action) (collide-action solid rideable))
|
|
(set! (-> s4-0 transform-index) 0)
|
|
(set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 13107.2)
|
|
(set! (-> s5-0 total-prims) (the-as uint 1))
|
|
(set! (-> s5-0 root-prim) s4-0)
|
|
)
|
|
(pusher-init s5-0)
|
|
(set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
|
|
(let ((v1-11 (-> s5-0 root-prim)))
|
|
(set! (-> s5-0 backup-collide-as) (-> v1-11 prim-core collide-as))
|
|
(set! (-> s5-0 backup-collide-with) (-> v1-11 prim-core collide-with))
|
|
)
|
|
(set! (-> this root) s5-0)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 34 of type plat
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod base-plat-method-34 ((this plat))
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 33 of type plat
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod base-plat-method-33 ((this plat))
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 37 of type plat
|
|
(defmethod go-initial-state ((this plat))
|
|
(cond
|
|
((logtest? (-> this path flags) (path-control-flag not-found))
|
|
(go (method-of-object this plat-idle))
|
|
)
|
|
((> (-> this sync period) 0)
|
|
(go (method-of-object this plat-path-active))
|
|
)
|
|
(else
|
|
(go (method-of-object this plat-idle))
|
|
)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate plat-idle (plat)
|
|
:virtual #t
|
|
:event plat-event
|
|
:trans (behavior ()
|
|
(update-part-and-sfx! self)
|
|
)
|
|
:code (behavior ()
|
|
(plat-trans)
|
|
(rider-post)
|
|
(suspend)
|
|
(until #f
|
|
(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)
|
|
)
|
|
)
|
|
#f
|
|
)
|
|
)
|
|
|
|
;; 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) (get-norm! (-> self sync) 0))
|
|
(get-point-at-percent-along-path! (-> self path) (-> self basetrans) (-> self path-pos) 'interp)
|
|
(if (< (vector-vector-distance (-> self root trans) (ear-trans 0)) 81920.0)
|
|
(sound-play "eco-plat-hover" :id (-> self sound-id) :position (-> self root trans))
|
|
)
|
|
(plat-trans)
|
|
)
|
|
:code (behavior ()
|
|
(until #f
|
|
(ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
)
|
|
#f
|
|
)
|
|
:post plat-post
|
|
)
|
|
|
|
;; definition for method 11 of type plat
|
|
(defmethod init-from-entity! ((this plat) (arg0 entity-actor))
|
|
"Set up a newly created process from the entity that created it."
|
|
(logior! (-> this mask) (process-mask platform))
|
|
(init-collision! this)
|
|
(process-drawable-from-entity! this arg0)
|
|
(initialize-skeleton this (the-as skeleton-group (get-art-group this)) (the-as pair 0))
|
|
(update-transforms (-> this root))
|
|
(init-bounce-params! this)
|
|
(base-plat-method-33 this)
|
|
(set! (-> this fact)
|
|
(new 'process 'fact-info this (pickup-type eco-pill-random) (-> *FACT-bank* default-eco-pill-green-inc))
|
|
)
|
|
(let ((a1-4 (new 'stack-no-clear 'sync-info-params)))
|
|
(let ((v1-15 0))
|
|
(if (not (logtest? (-> this fact options) (actor-option loop)))
|
|
(set! v1-15 (logior v1-15 1))
|
|
)
|
|
(set! (-> a1-4 sync-type) 'sync-eased)
|
|
(set! (-> a1-4 sync-flags) (the-as sync-flags v1-15))
|
|
)
|
|
(set! (-> a1-4 period) (the-as uint 1200))
|
|
(set! (-> a1-4 entity) arg0)
|
|
(set! (-> a1-4 percent) 0.0)
|
|
(set! (-> a1-4 ease-in) 0.15)
|
|
(set! (-> a1-4 ease-out) 0.15)
|
|
(set! (-> a1-4 pause-in) 0.0)
|
|
(set! (-> a1-4 pause-out) 0.0)
|
|
(initialize! (-> this sync) a1-4)
|
|
)
|
|
(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)
|
|
(base-plat-method-34 this)
|
|
(go-initial-state this)
|
|
)
|
|
((> (-> this sync period) 0)
|
|
(set! (-> this path-pos) (get-norm! (-> this sync) 0))
|
|
(get-point-at-percent-along-path! (-> this path) (-> this root trans) (-> this path-pos) 'interp)
|
|
(base-plat-method-34 this)
|
|
(go-initial-state this)
|
|
)
|
|
(else
|
|
(set! (-> this path-pos) 0.0)
|
|
(get-point-at-percent-along-path! (-> this path) (-> this root trans) (-> this path-pos) 'interp)
|
|
(base-plat-method-34 this)
|
|
(go-initial-state this)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition of type drop-plat
|
|
(deftype drop-plat (base-plat)
|
|
((art-name string)
|
|
(anim spool-anim)
|
|
(break-anim-name string)
|
|
(safe-time time-frame)
|
|
(hit-point vector :inline)
|
|
)
|
|
(:state-methods
|
|
idle
|
|
(fall symbol)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type drop-plat
|
|
(defmethod inspect ((this drop-plat))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(let ((t9-0 (method-of-type base-plat inspect)))
|
|
(t9-0 this)
|
|
)
|
|
(format #t "~2Tart-name: ~A~%" (-> this art-name))
|
|
(format #t "~2Tanim: ~A~%" (-> this anim))
|
|
(format #t "~2Tbreak-anim-name: ~A~%" (-> this break-anim-name))
|
|
(format #t "~2Tsafe-time: ~D~%" (-> this safe-time))
|
|
(format #t "~2Thit-point: ~`vector`P~%" (-> this hit-point))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition for method 7 of type drop-plat
|
|
;; WARN: Return type mismatch base-plat vs drop-plat.
|
|
(defmethod relocate ((this drop-plat) (offset int))
|
|
(if (nonzero? (-> this break-anim-name))
|
|
(&+! (-> this break-anim-name) offset)
|
|
)
|
|
(let ((v1-5 (-> this anim anim-name)))
|
|
(if (and (>= (the-as int v1-5) (-> *kernel-context* relocating-min))
|
|
(< (the-as int v1-5) (-> *kernel-context* relocating-max))
|
|
)
|
|
(&+! (-> this anim anim-name) offset)
|
|
)
|
|
)
|
|
(the-as drop-plat ((method-of-type base-plat relocate) this offset))
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate idle (drop-plat)
|
|
:virtual #t
|
|
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
|
(case message
|
|
(('touch 'attack 'bonk)
|
|
(let ((a0-5 (as-type proc process-focusable)))
|
|
(cond
|
|
((and a0-5 (focus-test? (the-as process-focusable a0-5) edge-grab))
|
|
(set! (-> self safe-time) (+ (current-time) (seconds 0.2)))
|
|
(return (the-as object #f))
|
|
)
|
|
((not (time-elapsed? (-> self safe-time) (seconds 0.05)))
|
|
(return (the-as object #f))
|
|
)
|
|
)
|
|
)
|
|
(vector-copy! (-> self hit-point) (-> self root trans))
|
|
(let ((a0-13 (as-type proc process-focusable)))
|
|
(vector-copy! (-> self hit-point) (get-trans (the-as process-focusable a0-13) 0))
|
|
)
|
|
(if (zero? (-> self bounce-time))
|
|
(start-bounce! self)
|
|
)
|
|
#f
|
|
)
|
|
)
|
|
)
|
|
:trans plat-trans
|
|
:code (behavior ()
|
|
(add-process *gui-control* self (gui-channel art-load) (gui-action queue) (-> self anim name) -99.0 0)
|
|
(until #f
|
|
(when (not (-> self bouncing))
|
|
(logior! (-> self mask) (process-mask sleep-code))
|
|
(suspend)
|
|
0
|
|
)
|
|
(while (-> self bouncing)
|
|
(suspend)
|
|
)
|
|
(go-virtual fall #f)
|
|
)
|
|
#f
|
|
)
|
|
:post plat-post
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate fall (drop-plat)
|
|
:virtual #t
|
|
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
|
(case message
|
|
(('edge-grabbed)
|
|
(if (time-elapsed? (-> self state-time) (seconds 0.5))
|
|
(send-event proc 'end-mode 'edge-grab)
|
|
)
|
|
)
|
|
(('die)
|
|
(go-virtual fall #t)
|
|
)
|
|
)
|
|
)
|
|
:enter (behavior ((arg0 symbol))
|
|
(set-time! (-> self state-time))
|
|
)
|
|
:exit (behavior ()
|
|
(ja-abort-spooled-anim (-> self anim) (the-as art-joint-anim #f) -1)
|
|
)
|
|
:trans rider-trans
|
|
:code (behavior ((arg0 symbol))
|
|
(process-entity-status! self (entity-perm-status subtask-complete) #t)
|
|
(let ((v1-1 (-> self root root-prim)))
|
|
(set! (-> v1-1 prim-core collide-as) (collide-spec))
|
|
(set! (-> v1-1 prim-core collide-with) (collide-spec))
|
|
)
|
|
0
|
|
(if (not arg0)
|
|
(ja-play-spooled-anim
|
|
(-> self anim)
|
|
(ja-group)
|
|
(the-as art-joint-anim #f)
|
|
(the-as (function process-drawable symbol) false-func)
|
|
(spooler-flags)
|
|
)
|
|
)
|
|
(ja-channel-set! 0)
|
|
(suspend)
|
|
(logior! (-> self mask) (process-mask sleep))
|
|
(suspend)
|
|
0
|
|
)
|
|
:post rider-post
|
|
)
|