mirror of
https://github.com/open-goal/jak-project
synced 2026-05-23 23:05:43 -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>
534 lines
21 KiB
Common Lisp
Vendored
Generated
534 lines
21 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition for method 7 of type process-taskable
|
|
;; WARN: Return type mismatch process-focusable vs process-taskable.
|
|
(defmethod relocate ((this process-taskable) (offset int))
|
|
(if (nonzero? (-> this task))
|
|
(&+! (-> this task) offset)
|
|
)
|
|
(the-as process-taskable ((method-of-type process-focusable relocate) this offset))
|
|
)
|
|
|
|
;; definition for function process-taskable-anim-loop
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defbehavior process-taskable-anim-loop process-taskable ((arg0 (function process-taskable object)))
|
|
(while (arg0 self)
|
|
(let ((s5-0 (get-art-element self)))
|
|
(when (!= (ja-group) s5-0)
|
|
(ja-channel-push! 1 0)
|
|
(set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim s5-0))
|
|
)
|
|
)
|
|
(suspend)
|
|
(if (ja-group)
|
|
(ja :num! (loop!))
|
|
)
|
|
(process-taskable-method-38 self)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 36 of type process-taskable
|
|
(defmethod process-taskable-method-36 ((this process-taskable))
|
|
#t
|
|
)
|
|
|
|
;; definition for method 37 of type process-taskable
|
|
;; WARN: Return type mismatch art-joint-anim vs art-element.
|
|
(defmethod get-art-element ((this process-taskable))
|
|
(the-as art-element (if (> (-> this skel active-channels) 0)
|
|
(-> this skel root-channel 0 frame-group)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for method 38 of type process-taskable
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod process-taskable-method-38 ((this process-taskable))
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 39 of type process-taskable
|
|
;; WARN: Return type mismatch object vs none.
|
|
(defmethod update-cloth-and-shadow ((this process-taskable))
|
|
(if (logtest? (-> this draw status) (draw-control-status no-draw))
|
|
(process-drawable-show-all-cloth this #f)
|
|
(process-drawable-show-all-cloth this #t)
|
|
)
|
|
(let ((a0-3 (-> this draw shadow-ctrl)))
|
|
(cond
|
|
((and (-> this draw shadow)
|
|
(and (zero? (-> this draw cur-lod)) (logtest? (-> this draw status) (draw-control-status on-screen)))
|
|
)
|
|
(probe-line-for-shadow a0-3 (-> this draw origin) -4096.0 4096.0 32768.0)
|
|
)
|
|
(else
|
|
(let ((v1-14 a0-3))
|
|
(logior! (-> v1-14 settings flags) (shadow-flags disable-draw))
|
|
)
|
|
0
|
|
)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate hide (process-taskable)
|
|
:virtual #t
|
|
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
|
(case message
|
|
(('say)
|
|
(let ((v0-0 (current-time)))
|
|
(set! (-> self want-to-say) v0-0)
|
|
v0-0
|
|
)
|
|
)
|
|
)
|
|
)
|
|
:enter (behavior ()
|
|
(set-time! (-> self state-time))
|
|
(logior! (-> self draw status) (draw-control-status no-draw-bounds))
|
|
(let ((v1-6 (-> self root root-prim)))
|
|
(set! (-> v1-6 prim-core collide-as) (collide-spec))
|
|
(set! (-> v1-6 prim-core collide-with) (collide-spec))
|
|
)
|
|
0
|
|
)
|
|
:exit (behavior ()
|
|
(logclear! (-> self draw status) (draw-control-status no-draw-bounds))
|
|
(let ((v1-3 (-> self root root-prim)))
|
|
(set! (-> v1-3 prim-core collide-as) (-> self root backup-collide-as))
|
|
(set! (-> v1-3 prim-core collide-with) (-> self root backup-collide-with))
|
|
)
|
|
(process-drawable-show-all-cloth self #t)
|
|
)
|
|
:trans (behavior ()
|
|
(let ((v1-1 (get-current-task-event (-> self task))))
|
|
(if (and (nonzero? (-> v1-1 action)) (or (not (logtest? (-> self draw status) (draw-control-status on-screen)))
|
|
(logtest? (-> v1-1 flags) (game-task-flags gatflag-01))
|
|
(not (time-elapsed? (-> self birth-time) (seconds 0.1)))
|
|
)
|
|
)
|
|
(go-virtual idle)
|
|
)
|
|
)
|
|
)
|
|
:code sleep-code
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate idle (process-taskable)
|
|
:virtual #t
|
|
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
|
(case message
|
|
(('attack)
|
|
(cond
|
|
((logtest? (-> self flags) (process-taskable-flags ptf4))
|
|
(go-virtual die)
|
|
)
|
|
((logtest? (-> self flags) (process-taskable-flags ptf0))
|
|
(send-event proc 'shove #f (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id))
|
|
(damage 2.0)
|
|
(vehicle-damage-factor 1.0)
|
|
(vehicle-impulse-factor 1.0)
|
|
(shove-back (meters 3))
|
|
(shove-up (meters 1))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(('touch)
|
|
(send-shoves (-> self root) proc (the-as touching-shapes-entry (-> block param 0)) 0.7 6144.0 16384.0)
|
|
)
|
|
(('say)
|
|
(let ((v0-0 (the-as object (current-time))))
|
|
(set! (-> self want-to-say) (the-as time-frame v0-0))
|
|
v0-0
|
|
)
|
|
)
|
|
)
|
|
)
|
|
:enter (behavior ()
|
|
(set-time! (-> self state-time))
|
|
)
|
|
:exit (behavior ()
|
|
(logclear! (-> self draw status) (draw-control-status no-draw))
|
|
)
|
|
:trans (behavior ()
|
|
(if (< (vector-vector-distance (-> self draw origin) (math-camera-pos)) (-> self draw origin w))
|
|
(logclear! (-> self draw status) (draw-control-status force-vu1))
|
|
(logior! (-> self draw status) (draw-control-status force-vu1))
|
|
)
|
|
(let ((gp-1 (get-current-task-event (-> self task))))
|
|
(cond
|
|
((= (-> gp-1 action) (game-task-action hide))
|
|
(if (or (not (logtest? (-> self draw status) (draw-control-status on-screen)))
|
|
(logtest? (-> gp-1 flags) (game-task-flags gatflag-01))
|
|
)
|
|
(go-virtual hide)
|
|
)
|
|
)
|
|
((or (not *target*) *scene-player*)
|
|
)
|
|
((not (logtest? (-> self flags) (process-taskable-flags ptf1)))
|
|
(if (>= (- (-> *display* game-clock frame-counter) (-> self last-talk)) (seconds 5))
|
|
(logior! (-> self flags) (process-taskable-flags ptf1))
|
|
)
|
|
)
|
|
((and (-> gp-1 scene)
|
|
(begin
|
|
(when (not (or (= (-> gp-1 action) (game-task-action play))
|
|
(-> *setting-control* user-current movie-name)
|
|
(name= (-> gp-1 scene) (-> *setting-control* user-current movie-name))
|
|
)
|
|
)
|
|
(let ((v1-42 (scene-lookup (-> gp-1 scene))))
|
|
(gui-control-method-12
|
|
*gui-control*
|
|
self
|
|
(gui-channel art-load)
|
|
(gui-action queue)
|
|
(if v1-42
|
|
(-> v1-42 anim)
|
|
(-> gp-1 scene)
|
|
)
|
|
0
|
|
-99.0
|
|
(new 'static 'sound-id)
|
|
)
|
|
)
|
|
)
|
|
(and (not (logtest? (focus-status dead in-air in-head pole tube mech) (-> *target* focus-status)))
|
|
(and (or (and (< (-> (target-pos 0) y) (+ (-> self root root-prim prim-core world-sphere y) (-> self talk-height)))
|
|
(let ((s5-1 (get-trans self 2))
|
|
(f30-0 (if (= (-> gp-1 distance) 0.0)
|
|
(-> self talk-distance)
|
|
(-> gp-1 distance)
|
|
)
|
|
)
|
|
)
|
|
(< (vector-vector-distance (target-pos 0) s5-1) f30-0)
|
|
)
|
|
)
|
|
(not (time-elapsed? (-> self want-to-say) (seconds 4)))
|
|
)
|
|
(or (not (load-in-progress? *level*)) (= (-> gp-1 action) (game-task-action say)))
|
|
(and (not (movie?))
|
|
(or (not (logtest? (-> self flags) (process-taskable-flags ptf6))) (not (talker-displayed?)))
|
|
(none-reserved? *art-control*)
|
|
(not *progress-process*)
|
|
(not (-> *setting-control* user-current movie))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(when (and (or (= (-> gp-1 action) (game-task-action say))
|
|
(= (-> gp-1 action) (game-task-action talk))
|
|
(= (-> gp-1 action) (game-task-action trade))
|
|
(= (-> gp-1 action) (game-task-action play))
|
|
)
|
|
(process-taskable-method-36 self)
|
|
)
|
|
(when (or (= (-> gp-1 action) (game-task-action say)) (not (time-elapsed? (-> self want-to-say) (seconds 4))))
|
|
(case (-> gp-1 action)
|
|
(((game-task-action play))
|
|
(go-virtual play-game gp-1)
|
|
)
|
|
(else
|
|
(go-virtual active gp-1)
|
|
)
|
|
)
|
|
)
|
|
(kill-current-talker '() '(daxter voicebox ambient) 'exit)
|
|
(talker-surpress!)
|
|
(when (can-display-query? self "process-taskable" -99.0)
|
|
(let ((s5-2
|
|
(new 'stack 'font-context *font-default-matrix* 32 280 0.0 (font-color default) (font-flags shadow kerning))
|
|
)
|
|
)
|
|
(set-width! s5-2 340)
|
|
(set-height! s5-2 80)
|
|
(let ((v1-98 s5-2)
|
|
(a0-39 (-> *setting-control* user-default language))
|
|
)
|
|
(set! (-> v1-98 scale) (if (or (= a0-39 (language-enum korean)) (= a0-39 (language-enum russian)))
|
|
0.9
|
|
0.7
|
|
)
|
|
)
|
|
)
|
|
(set! (-> s5-2 flags) (font-flags shadow kerning middle-vert large))
|
|
(print-game-text
|
|
(lookup-text! *common-text* (-> self talk-message) #f)
|
|
s5-2
|
|
#f
|
|
44
|
|
(bucket-id hud-draw-hud-alpha)
|
|
)
|
|
)
|
|
(when (cpad-pressed? 0 triangle)
|
|
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle))
|
|
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle))
|
|
(case (-> gp-1 action)
|
|
(((game-task-action play))
|
|
(go-virtual play-game gp-1)
|
|
)
|
|
(else
|
|
(go-virtual active gp-1)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(update-cloth-and-shadow self)
|
|
)
|
|
:code (behavior ()
|
|
(process-taskable-anim-loop (the-as (function process-taskable object) true-func))
|
|
)
|
|
:post (behavior ()
|
|
(if (and (logtest? (-> self flags) (process-taskable-flags ptf3)) (movie?))
|
|
(logior! (-> self draw status) (draw-control-status no-draw))
|
|
(logclear! (-> self draw status) (draw-control-status no-draw))
|
|
)
|
|
(when (logtest? (-> self flags) (process-taskable-flags ptf2))
|
|
(if *target*
|
|
(look-at! (-> *target* neck) (get-trans self 2) 'nothing-special self)
|
|
)
|
|
)
|
|
(transform-post)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate active (process-taskable)
|
|
:virtual #t
|
|
:event (-> (method-of-type process-taskable hide) event)
|
|
:enter (behavior ((arg0 game-task-event))
|
|
(set! (-> self want-to-say) 0)
|
|
(process-entity-status! self (entity-perm-status no-kill) #t)
|
|
(logclear! (-> self mask) (process-mask actor-pause))
|
|
)
|
|
:exit (behavior ()
|
|
(set! (-> self last-talk) (-> *display* game-clock frame-counter))
|
|
(if (not (time-elapsed? (-> self want-to-say) (seconds 4)))
|
|
(logior! (-> self flags) (process-taskable-flags ptf1))
|
|
(logclear! (-> self flags) (process-taskable-flags ptf1))
|
|
)
|
|
(process-entity-status! self (entity-perm-status no-kill) #f)
|
|
(logior! (-> self mask) (process-mask actor-pause))
|
|
(logclear! (-> self draw status) (draw-control-status no-draw))
|
|
(let ((v1-15 (-> self root root-prim)))
|
|
(set! (-> v1-15 prim-core collide-as) (-> self root backup-collide-as))
|
|
(set! (-> v1-15 prim-core collide-with) (-> self root backup-collide-with))
|
|
)
|
|
)
|
|
:code (behavior ((arg0 game-task-event))
|
|
(when (-> arg0 scene)
|
|
(let ((gp-1 (ppointer->handle
|
|
(process-spawn scene-player :init scene-player-init (-> arg0 scene) #t #f :name "scene-player")
|
|
)
|
|
)
|
|
)
|
|
(while (and (handle->process (the-as handle gp-1)) (not (movie?)))
|
|
(suspend)
|
|
)
|
|
(process-drawable-show-all-cloth self #f)
|
|
(logior! (-> self draw status) (draw-control-status no-draw))
|
|
(let ((v1-15 (-> self root root-prim)))
|
|
(set! (-> v1-15 prim-core collide-as) (collide-spec))
|
|
(set! (-> v1-15 prim-core collide-with) (collide-spec))
|
|
)
|
|
0
|
|
(while (handle->process (the-as handle gp-1))
|
|
(suspend)
|
|
)
|
|
)
|
|
)
|
|
(go-virtual hide)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate die (process-taskable)
|
|
:virtual #t
|
|
:enter (behavior ()
|
|
(set! (-> self want-to-say) 0)
|
|
(process-entity-status! self (entity-perm-status no-kill) #t)
|
|
(logclear! (-> self mask) (process-mask actor-pause))
|
|
)
|
|
:exit (behavior ()
|
|
(process-entity-status! self (entity-perm-status no-kill) #f)
|
|
(logior! (-> self mask) (process-mask actor-pause))
|
|
(logclear! (-> self draw status) (draw-control-status no-draw))
|
|
(let ((v1-5 (-> self root root-prim)))
|
|
(set! (-> v1-5 prim-core collide-as) (-> self root backup-collide-as))
|
|
(set! (-> v1-5 prim-core collide-with) (-> self root backup-collide-with))
|
|
)
|
|
)
|
|
:code (behavior ()
|
|
(if (-> self skel effect)
|
|
(do-effect (-> self skel effect) "death-default" 0.0 -1)
|
|
)
|
|
(suspend-for (seconds 1)
|
|
)
|
|
(if (logtest? (-> self flags) (process-taskable-flags ptf5))
|
|
(restart-mission)
|
|
)
|
|
(cleanup-for-death self)
|
|
)
|
|
:post (-> (method-of-type process-taskable idle) post)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate play-game (process-taskable)
|
|
:virtual #t
|
|
:enter (-> (method-of-type process-taskable active) enter)
|
|
:exit (-> (method-of-type process-taskable active) exit)
|
|
:code (behavior ((arg0 game-task-event))
|
|
(suspend-for (seconds 0.5)
|
|
)
|
|
(go-virtual hide)
|
|
)
|
|
:post (-> (method-of-type process-taskable idle) post)
|
|
)
|
|
|
|
;; definition for method 33 of type process-taskable
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod init-collision! ((this process-taskable))
|
|
(let ((s5-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player))))
|
|
(let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 3) 0)))
|
|
(set! (-> s5-0 total-prims) (the-as uint 4))
|
|
(set! (-> s4-0 prim-core collide-as) (collide-spec civilian))
|
|
(set! (-> s4-0 prim-core action) (collide-action solid no-standon))
|
|
(set! (-> s4-0 transform-index) 0)
|
|
(set-vector! (-> s4-0 local-sphere) 0.0 -1024.0 0.0 7372.8)
|
|
(set! (-> s5-0 root-prim) s4-0)
|
|
)
|
|
(let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
|
|
(set! (-> v1-7 prim-core collide-as) (collide-spec civilian))
|
|
(set! (-> v1-7 prim-core action) (collide-action solid))
|
|
(set! (-> v1-7 transform-index) 0)
|
|
(set-vector! (-> v1-7 local-sphere) 0.0 -4096.0 0.0 4096.0)
|
|
)
|
|
(let ((v1-9 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
|
|
(set! (-> v1-9 prim-core collide-as) (collide-spec civilian))
|
|
(set! (-> v1-9 prim-core action) (collide-action solid))
|
|
(set! (-> v1-9 transform-index) 0)
|
|
(set-vector! (-> v1-9 local-sphere) 0.0 -1024.0 0.0 4096.0)
|
|
)
|
|
(let ((v1-11 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
|
|
(set! (-> v1-11 prim-core collide-as) (collide-spec civilian))
|
|
(set! (-> v1-11 prim-core action) (collide-action solid no-standon))
|
|
(set! (-> v1-11 transform-index) 0)
|
|
(set-vector! (-> v1-11 local-sphere) 0.0 2048.0 0.0 4096.0)
|
|
)
|
|
(set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
|
|
(let ((v1-14 (-> s5-0 root-prim)))
|
|
(set! (-> s5-0 backup-collide-as) (-> v1-14 prim-core collide-as))
|
|
(set! (-> s5-0 backup-collide-with) (-> v1-14 prim-core collide-with))
|
|
)
|
|
(set! (-> this root) s5-0)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 34 of type process-taskable
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod init-defaults! ((this process-taskable))
|
|
(logior! (-> this skel status) (joint-control-status eye-anim))
|
|
(set! (-> this talk-message) (text-id press-triangle-to-talk))
|
|
(set! (-> this flags) (process-taskable-flags ptf0 ptf1 ptf2 ptf3 ptf5))
|
|
(set! (-> this neck-joint-index) -1)
|
|
(set! (-> this talk-distance) (res-lump-float (-> this entity) 'distance :default 32768.0))
|
|
(set! (-> this talk-height) (res-lump-float (-> this entity) 'height :default 8192.0))
|
|
(set! (-> this slave) (the-as handle #f))
|
|
(set! (-> this draw shadow-ctrl) (new
|
|
'process
|
|
'shadow-control
|
|
0.0
|
|
0.0
|
|
614400.0
|
|
(the-as vector #f)
|
|
(shadow-flags shdf02 shdf03 shdf04 disable-draw)
|
|
245760.0
|
|
)
|
|
)
|
|
(let ((s5-0 0))
|
|
(let ((v1-12 (the-as joint (get-art-by-name-method (-> this draw jgeo) "main" (the-as type #f)))))
|
|
(if v1-12
|
|
(set! s5-0 (+ (-> v1-12 number) 1))
|
|
)
|
|
)
|
|
(let ((v1-16 (-> this root root-prim)))
|
|
(set! (-> v1-16 transform-index) s5-0)
|
|
(dotimes (a0-7 (the-as int (-> v1-16 specific 0)))
|
|
(set! (-> (the-as collide-shape-prim-group v1-16) child a0-7 transform-index) s5-0)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 35 of type process-taskable
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod init-skeleton! ((this process-taskable))
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 11 of type process-taskable
|
|
(defmethod init-from-entity! ((this process-taskable) (entity entity-actor))
|
|
"Set up a newly created process from the entity that created it."
|
|
(stack-size-set! (-> this main-thread) 512)
|
|
(init-collision! this)
|
|
(process-drawable-from-entity! this entity)
|
|
(set! (-> this task)
|
|
(new 'process 'game-task-control (res-lump-value entity 'task-actor game-task-actor :time -1000000000.0))
|
|
)
|
|
(init-skeleton! this)
|
|
(init-defaults! this)
|
|
(logior! (-> this skel status) (joint-control-status blend-shape eye-anim))
|
|
(when (logtest? #x1000000 (res-lump-value entity 'options uint128 :time -1000000000.0))
|
|
(let* ((s5-1 *level*)
|
|
(s4-2 (method-of-object s5-1 art-group-get-by-name))
|
|
)
|
|
(format (clear *temp-string*) "skel-~S" (-> this draw art-group name))
|
|
(let ((s4-3 (s4-2 s5-1 *temp-string* (the-as (pointer level) #f))))
|
|
(when s4-3
|
|
(let ((s5-2 (process-spawn
|
|
manipy
|
|
:init manipy-init
|
|
(-> this root trans)
|
|
(-> this entity)
|
|
s4-3
|
|
#f
|
|
0
|
|
:name "manipy"
|
|
:to this
|
|
:stack-size #x20000
|
|
)
|
|
)
|
|
)
|
|
(send-event (ppointer->process s5-2) 'anim-mode 'mirror)
|
|
(send-event (ppointer->process s5-2) 'mirror #t)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> this event-hook) (-> (method-of-object this idle) event))
|
|
(go (method-of-object this hide))
|
|
)
|