Files
water111 48cb9bb787 [decompiler] as-type and font method support (#3855)
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.


![image](https://github.com/user-attachments/assets/5c31bf85-97b4-437c-bc4b-dc054e60551e)

---------

Co-authored-by: water111 <awaterford1111445@gmail.com>
2025-02-01 21:23:11 -05:00

1290 lines
43 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; definition for method 52 of type process-taskable
;; INFO: Return type mismatch int vs none.
(defmethod process-taskable-method-52 ((this process-taskable))
(let ((v1-1 (-> this draw shadow-ctrl)))
(when v1-1
(let ((a0-1 v1-1))
(set! (-> a0-1 settings bot-plane w) (- -12288.0))
)
0
(set! (-> v1-1 settings top-plane w) (- 4096.0))
0
)
)
(none)
)
;; definition for method 9 of type gui-query
;; INFO: Return type mismatch int vs none.
(defmethod init! ((this gui-query) (arg0 string) (arg1 int) (arg2 int) (arg3 int) (arg4 symbol) (arg5 string))
(set! (-> this x-position) arg1)
(set! (-> this y-position) arg2)
(set! (-> this message-space) arg3)
(set! (-> this only-allow-cancel) arg4)
(set! (-> this message) arg0)
(set! (-> this decision) 'undecided)
(set! (-> this no-msg) arg5)
0
(none)
)
;; definition for method 10 of type gui-query
(defmethod get-response ((this gui-query))
(kill-current-level-hint '() '(sidekick voicebox stinger) 'exit)
(level-hint-surpress!)
(hide-hud)
(when (hud-hidden?)
(when (-> this message)
(let ((a1-2 (new
'stack
'font-context
*font-default-matrix*
(-> this x-position)
(-> this y-position)
0.0
(font-color default)
(font-flags shadow kerning)
)
)
)
(set-width! a1-2 (- 512 (-> this x-position)))
(set-height! a1-2 40)
(set-scale! a1-2 0.9)
(set! (-> a1-2 flags) (font-flags shadow kerning middle-vert large))
(print-game-text (-> this message) a1-2 #f 128 22)
)
)
(cond
((-> this only-allow-cancel)
(when (-> this no-msg)
(clear *temp-string*)
(format *temp-string* "; = ~S" (-> this no-msg))
(let* ((s4-0 (-> *display* frames (-> *display* on-screen) frame global-buf))
(s5-0 (-> s4-0 base))
)
(draw-string-xy
*temp-string*
s4-0
(-> this x-position)
(+ (-> this y-position) 5 (-> this message-space))
(font-color default)
(font-flags shadow kerning large)
)
(let ((a3-4 (-> s4-0 base)))
(let ((v1-17 (the-as object (-> s4-0 base))))
(set! (-> (the-as dma-packet v1-17) dma) (new 'static 'dma-tag :id (dma-tag-id next)))
(set! (-> (the-as dma-packet v1-17) vif0) (new 'static 'vif-tag))
(set! (-> (the-as dma-packet v1-17) vif1) (new 'static 'vif-tag))
(set! (-> s4-0 base) (&+ (the-as pointer v1-17) 16))
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug)
s5-0
(the-as (pointer dma-tag) a3-4)
)
)
)
)
)
(else
(let* ((s4-1 (-> *display* frames (-> *display* on-screen) frame global-buf))
(s5-1 (-> s4-1 base))
)
(draw-string-xy
(lookup-text! *common-text* (text-id confirm) #f)
s4-1
(-> this x-position)
(+ (-> this y-position) 5 (-> this message-space))
(font-color default)
(font-flags shadow kerning large)
)
(let ((a3-7 (-> s4-1 base)))
(let ((v1-29 (the-as object (-> s4-1 base))))
(set! (-> (the-as dma-packet v1-29) dma) (new 'static 'dma-tag :id (dma-tag-id next)))
(set! (-> (the-as dma-packet v1-29) vif0) (new 'static 'vif-tag))
(set! (-> (the-as dma-packet v1-29) vif1) (new 'static 'vif-tag))
(set! (-> s4-1 base) (&+ (the-as pointer v1-29) 16))
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug)
s5-1
(the-as (pointer dma-tag) a3-7)
)
)
)
)
)
(cond
((!= (-> this decision) 'undecided)
)
((and (cpad-pressed? 0 x) (not (-> this only-allow-cancel)))
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons x))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons x))
(set! (-> this decision) 'yes)
)
((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))
(set! (-> this decision) 'no)
)
)
)
(-> this decision)
)
;; definition for method 7 of type process-taskable
;; INFO: Return type mismatch process-drawable vs process-taskable.
(defmethod relocate ((this process-taskable) (offset int))
(the-as process-taskable ((method-of-type process-drawable relocate) this offset))
)
;; definition for method 46 of type process-taskable
;; INFO: Return type mismatch int vs none.
(defmethod process-taskable-method-46 ((this process-taskable))
(when (nonzero? (-> this sound-flava))
(let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (target-pos 0) (-> this root root-prim prim-core world-sphere)))
)
(set! (-> s5-1 y) (* 4.0 (-> s5-1 y)))
(cond
((< (vector-length s5-1) 102400.0)
(when (not (-> this have-flava))
(set! (-> this have-flava) #t)
(set-setting! 'sound-flava #f 20.0 (-> this sound-flava))
)
)
((-> this have-flava)
(remove-setting! 'sound-flava)
(set! (-> this have-flava) #f)
)
)
)
)
(when (-> this music)
(let ((s5-3 (vector-! (new 'stack-no-clear 'vector) (target-pos 0) (-> this root root-prim prim-core world-sphere)))
)
(set! (-> s5-3 y) (* 4.0 (-> s5-3 y)))
(cond
((< (vector-length s5-3) 102400.0)
(when (not (-> this have-music))
(set! (-> this have-music) #t)
(set-setting! 'music (-> this music) 0.0 0)
)
)
((-> this have-music)
(remove-setting! 'music)
(set! (-> this have-music) #f)
)
)
)
)
0
(none)
)
;; definition for method 31 of type process-taskable
;; INFO: Return type mismatch art-joint-anim vs art-element.
(defmethod get-art-elem ((this process-taskable))
(the-as art-element (if (> (-> this skel active-channels) 0)
(-> this skel root-channel 0 frame-group)
)
)
)
;; definition for method 32 of type process-taskable
;; INFO: Return type mismatch symbol vs basic.
(defmethod play-anim! ((this process-taskable) (arg0 symbol))
(the-as basic #f)
)
;; definition for method 33 of type process-taskable
;; INFO: Return type mismatch int vs none.
(defmethod process-taskable-method-33 ((this process-taskable))
(let ((s5-0 (play-anim! this #f)))
(if (type-type? (-> s5-0 type) spool-anim)
(spool-push *art-control* (-> (the-as spool-anim s5-0) name) 0 this -99.0)
)
)
0
(none)
)
;; definition for method 51 of type process-taskable
(defmethod close-anim-file! ((this process-taskable))
(let* ((gp-0 (play-anim! this #f))
(v1-2 (if (and (nonzero? gp-0) (type-type? (-> gp-0 type) spool-anim))
gp-0
)
)
)
(if v1-2
(file-status *art-control* (-> (the-as spool-anim v1-2) name) 0)
)
)
)
;; definition for method 34 of type process-taskable
;; INFO: Return type mismatch symbol vs spool-anim.
(defmethod get-accept-anim ((this process-taskable) (arg0 symbol))
(the-as spool-anim #f)
)
;; definition for method 35 of type process-taskable
;; INFO: Return type mismatch int vs none.
(defmethod push-accept-anim ((this process-taskable))
(let ((s5-0 (get-accept-anim this #f)))
(if (type-type? (-> s5-0 type) spool-anim)
(spool-push *art-control* (-> s5-0 name) 0 this -99.0)
)
)
0
(none)
)
;; definition for method 36 of type process-taskable
;; INFO: Return type mismatch symbol vs spool-anim.
(defmethod get-reject-anim ((this process-taskable) (arg0 symbol))
(the-as spool-anim #f)
)
;; definition for method 37 of type process-taskable
;; INFO: Return type mismatch int vs none.
(defmethod push-reject-anim ((this process-taskable))
(let ((s5-0 (get-reject-anim this #f)))
(if (type-type? (-> s5-0 type) spool-anim)
(spool-push *art-control* (-> s5-0 name) 0 this -99.0)
)
)
0
(none)
)
;; definition for method 38 of type process-taskable
;; INFO: Return type mismatch object vs none.
(defmethod process-taskable-method-38 ((this process-taskable))
(if (nonzero? (-> this cell-for-task))
(go (method-of-object this give-cell))
)
(go (method-of-object this release))
(none)
)
;; definition for function process-taskable-anim-loop
(defbehavior process-taskable-anim-loop process-taskable ()
(when (!= (ja-group) (get-art-elem self))
(ja-channel-push! 1 (seconds 0.2))
(ja :group! (get-art-elem self))
)
(loop
(suspend)
(ja :num! (loop!))
(if (= (-> self next-state name) 'idle)
(process-taskable-method-43 self)
)
)
(the-as none 0)
(none)
)
;; failed to figure out what this is:
(defstate release (process-taskable)
:virtual #t
:trans (behavior ()
(when (process-release? *target*)
(send-event *target* 'trans 'restore (-> self old-target-pos))
(if (should-display? self)
(go-virtual idle)
(go-virtual hidden)
)
)
(process-taskable-method-33 self)
((-> self cur-trans-hook))
)
:code process-taskable-anim-loop
:post ja-post
)
;; failed to figure out what this is:
(defstate give-cell (process-taskable)
:virtual #t
:trans (behavior ()
(cond
((nonzero? (-> self cell-for-task))
(let ((gp-0 (handle->process (-> self cell-x))))
(when gp-0
(send-event *target* 'trans 'reset)
(send-event gp-0 'pickup (target-pos 0))
(go-virtual idle)
)
)
(format #t "ERROR<GMJ>: ~S no cell spawned~%" (-> self name))
(send-event *target* 'get-pickup 6 (the float (-> self cell-for-task)))
)
(else
(format
#t
"ERROR<GMJ>: ~S got into give-cell with give-cell == #f task = ~S~%"
(-> self name)
(game-task->string (current-task (-> self tasks)))
)
)
)
(go-virtual release)
(process-taskable-method-33 self)
((-> self cur-trans-hook))
)
:code process-taskable-anim-loop
:post ja-post
)
;; failed to figure out what this is:
(defstate lose (process-taskable)
:virtual #t
:enter (behavior ()
(set-time! (-> self state-time))
)
:trans (behavior ()
(if (and (time-elapsed? (-> self state-time) (seconds 5))
(or (not *target*) (< 20480.0 (vector-vector-distance (-> self root trans) (-> *target* control trans))))
)
(go-virtual idle)
)
((-> self cur-trans-hook))
)
:code process-taskable-anim-loop
:post ja-post
)
;; failed to figure out what this is:
(defstate enter-playing (process-taskable)
:virtual #t
:code process-taskable-anim-loop
:post ja-post
)
;; definition for function process-taskable-play-anim-enter
(defbehavior process-taskable-play-anim-enter process-taskable ()
(init! (-> self query) (the-as string #f) 40 150 25 #t (the-as string #f))
(logior! (-> self skel status) (janim-status blerc))
(set! (-> self camera)
(ppointer->handle (process-spawn othercam self (-> self cam-joint-index) #f #t :to self))
)
(set! (-> self cell-for-task) (game-task none))
(set! (-> self skippable) #f)
(set! (-> self blend-on-exit) #f)
(set! (-> self will-talk) #f)
#f
)
;; definition for function process-taskable-play-anim-exit
(defbehavior process-taskable-play-anim-exit process-taskable ()
(logclear! (-> self skel status) (janim-status blerc))
(let ((a0-4 (handle->process (-> self camera))))
(if a0-4
(deactivate a0-4)
)
)
(set! (-> self last-talk) (-> *display* game-frame-counter))
(process-taskable-method-52 self)
(none)
)
;; definition for function process-taskable-play-anim-trans
(defbehavior process-taskable-play-anim-trans process-taskable ()
(if (nonzero? *camera-look-through-other*)
(set! *camera-look-through-other* 2)
)
(set-letterbox-frames (seconds 0.017))
(draw-npc-shadow self)
(none)
)
;; definition for function process-taskable-play-anim-code
(defbehavior process-taskable-play-anim-code process-taskable ((arg0 art-joint-anim) (arg1 basic))
(when (nonzero? (-> self cell-for-task))
(if (name= (-> self state name) "play-anim")
(set! (-> self cell-x) (ppointer->handle (process-spawn
fuel-cell
:init fuel-cell-init-as-clone
(process->handle self)
(-> self cell-for-task)
:to self
)
)
)
(format #t "ERROR<GMJ>: ~S ~S trying to give cell on release~%" (-> self name) (-> self state name))
)
)
(cond
((and arg1 (type-type? (-> arg1 type) spool-anim))
(when *target*
(while (not (send-event *target* 'clone-anim self))
(spool-push *art-control* (-> (the-as spool-anim arg1) name) 0 self -99.0)
(format #t "WARNING: ~A stall on not cloning.~%" (-> self name))
(suspend)
)
(send-event (ppointer->process (-> *target* sidekick)) 'matrix 'play-anim)
(send-event *target* 'blend-shape #t)
)
(add-setting! 'music-volume 'rel (-> *setting-control* current music-volume-movie) 0)
(add-setting! 'sfx-volume 'rel (-> *setting-control* current sfx-volume-movie) 0)
(add-setting! 'ambient-volume 'rel (-> *setting-control* current ambient-volume-movie) 0)
(if (-> self blend-on-exit)
(set! (-> self blend-on-exit) arg0)
)
(if (and *debug-segment* *cheat-mode*)
(ja-play-spooled-anim
(the-as spool-anim arg1)
arg0
(-> self blend-on-exit)
(lambda ((arg0 process-taskable)) (= (get-response (-> arg0 query)) 'no))
)
(ja-play-spooled-anim
(the-as spool-anim arg1)
arg0
(-> self blend-on-exit)
(the-as (function process-drawable symbol) false-func)
)
)
(remove-setting! 'music-volume)
(remove-setting! 'sfx-volume)
(remove-setting! 'ambient-volume)
(send-event *target* 'blend-shape #f)
)
(else
(when (not arg1)
(format #t "ERROR<GMJ>: ~S ~S got #f from anim picker~%" (-> self name) (-> self state name))
(set! arg1 (ja-group))
)
(when (not (type-type? (-> arg1 type) art-joint-anim))
(format
0
"ERROR<GMJ>: ~S ~S anim picker didn't return spool-anim or joint-art-anim (probably need to override it)~%"
(-> self name)
(-> self state name)
)
(set! arg1 (ja-group))
)
(format #t "~S ~S anim ~S~%" (-> self name) (-> self state name) (-> (the-as art-joint-anim arg1) name))
(ja-channel-push! 1 (seconds 0.2))
(set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim arg1))
(when (< (ja-num-frames 0) 3)
(suspend)
(suspend)
0
)
(ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(if (and *debug-segment* (= (get-response (-> self query)) 'no))
(ja :num-func num-func-identity :frame-num max)
)
(suspend)
(ja :num! (seek!))
)
#f
)
)
)
;; failed to figure out what this is:
(defstate play-accept (process-taskable)
:virtual #t
:enter process-taskable-play-anim-enter
:exit process-taskable-play-anim-exit
:trans (behavior ()
(process-taskable-play-anim-trans)
((-> self cur-trans-hook))
)
:code (behavior ()
(process-taskable-play-anim-code (the-as art-joint-anim (get-art-elem self)) (get-accept-anim self #t))
(while (not (process-release? *target*))
(suspend)
)
(go-virtual enter-playing)
)
:post ja-post
)
;; failed to figure out what this is:
(defstate play-reject (process-taskable)
:virtual #t
:enter process-taskable-play-anim-enter
:exit process-taskable-play-anim-exit
:trans (behavior ()
(process-taskable-play-anim-trans)
((-> self cur-trans-hook))
)
:code (behavior ()
(process-taskable-play-anim-code (the-as art-joint-anim (get-art-elem self)) (get-reject-anim self #t))
(go-virtual release)
)
:post ja-post
)
;; failed to figure out what this is:
(defstate query (process-taskable)
:virtual #t
:enter (behavior ()
(init!
(-> self query)
(lookup-text! *common-text* (text-id confirm-play) #f)
40
150
25
#f
(lookup-text! *common-text* (text-id quit) #f)
)
)
:exit process-taskable-play-anim-exit
:trans (behavior ()
(case (current-status (-> self tasks))
(((task-status need-reminder-a))
(case (get-response (-> self query))
(('yes)
(go-virtual play-accept)
)
(('no)
(go-virtual play-reject)
)
)
(push-accept-anim self)
)
(else
(let ((gp-0 (get-response (-> self query))))
(cond
((and (= gp-0 'yes) (process-release? *target*))
(go-virtual enter-playing)
)
((= gp-0 'no)
(go-virtual play-reject)
)
)
)
)
)
(push-reject-anim self)
(set! *camera-look-through-other* 2)
((-> self cur-trans-hook))
)
:code process-taskable-anim-loop
:post ja-post
)
;; failed to figure out what this is:
(defstate play-anim (process-taskable)
:virtual #t
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(case message
(('shadow)
(cond
((-> block param 0)
(let ((v0-0 (the-as object (-> self shadow-backup))))
(set! (-> self draw shadow) (the-as shadow-geo v0-0))
v0-0
)
)
(else
(set! (-> self draw shadow) #f)
#f
)
)
)
(('shadow-min-max)
(let ((v1-5 (-> self draw shadow-ctrl)))
(let ((a0-4 v1-5))
(set! (-> a0-4 settings bot-plane w) (- (the-as float (-> block param 0))))
)
0
(set! (-> v1-5 settings top-plane w) (- (the-as float (-> block param 1))))
)
0
)
)
)
:enter process-taskable-play-anim-enter
:exit process-taskable-play-anim-exit
:trans (behavior ()
(process-taskable-play-anim-trans)
(let ((a3-0 (handle->process (-> self cell-x))))
(if a3-0
(spool-push *art-control* (-> self fuel-cell-anim name) 0 a3-0 -99.0)
)
)
((-> self cur-trans-hook))
)
:code (behavior ()
(process-taskable-play-anim-code (the-as art-joint-anim (get-art-elem self)) (play-anim! self #t))
(process-taskable-method-38 self)
)
:post ja-post
)
;; definition for function process-taskable-clean-up-after-talking
(defbehavior process-taskable-clean-up-after-talking process-taskable ()
(logclear! (-> self draw status) (draw-status hidden))
(logclear! (-> self skel status) (janim-status inited))
(remove-setting! 'border-mode)
(remove-setting! 'talking)
(none)
)
;; definition for method 39 of type process-taskable
(defmethod should-display? ((this process-taskable))
#t
)
;; definition for function process-taskable-hide-handler
(defbehavior process-taskable-hide-handler process-taskable ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(case arg2
(('clone)
(go-virtual be-clone (the-as handle (-> arg3 param 0)))
)
(('play-anim)
(logclear! (-> self mask) (process-mask actor-pause))
(set! (-> self been-kicked) #t)
(go-virtual idle)
)
(('hidden-other)
(go-virtual hidden-other)
)
)
)
;; definition for function process-taskable-hide-enter
;; INFO: Return type mismatch none vs int.
(defbehavior process-taskable-hide-enter process-taskable ()
(set-time! (-> self state-time))
(let ((v1-3 (-> self draw shadow-ctrl)))
(logior! (-> v1-3 settings flags) (shadow-flags disable-draw))
)
0
(process-taskable-clean-up-after-talking)
(clear-collide-with-as (-> self root))
(ja-channel-set! 0)
(the-as int (ja-post))
)
;; definition for function process-taskable-hide-exit
;; INFO: Return type mismatch int vs none.
(defbehavior process-taskable-hide-exit process-taskable ((arg0 symbol))
(cond
(arg0
(process-entity-status! self (entity-perm-status bit-3) #f)
)
(else
(ja-channel-set! 1)
(ja :group! (get-art-elem self))
(restore-collide-with-as (-> self root))
(process-entity-status! self (entity-perm-status bit-3) #t)
(let ((v1-7 (-> self draw shadow-ctrl)))
(logclear! (-> v1-7 settings flags) (shadow-flags disable-draw))
)
0
)
)
(none)
)
;; failed to figure out what this is:
(defstate hidden (process-taskable)
:virtual #t
:event process-taskable-hide-handler
:enter process-taskable-hide-enter
:exit (behavior ()
(process-taskable-hide-exit (= (-> self next-state name) 'hidden))
)
:trans (behavior ()
(if (time-elapsed? (-> self state-time) (seconds 1))
(process-entity-status! self (entity-perm-status bit-3) #f)
)
(if (or (-> self been-kicked) (should-display? self))
(go-virtual idle)
)
)
:code anim-loop
)
;; definition for method 50 of type process-taskable
;; WARN: disable def twice: 4. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare.
(defmethod process-taskable-method-50 ((this process-taskable))
(if *target*
(or (not *target*) (< 245760.0 (vector-vector-distance (-> this root trans) (-> *target* control trans))))
(< 60397978000.0
(vector-vector-distance-squared (-> this root root-prim prim-core world-sphere) (camera-pos))
)
)
)
;; failed to figure out what this is:
(defstate hidden-other (process-taskable)
:virtual #t
:event process-taskable-hide-handler
:enter process-taskable-hide-enter
:exit (behavior ()
(process-taskable-hide-exit (= (-> self next-state name) 'hidden-other))
)
:trans (behavior ()
(if (time-elapsed? (-> self state-time) (seconds 1))
(process-entity-status! self (entity-perm-status bit-3) #f)
)
(cond
((-> self been-kicked)
(go-virtual idle)
)
((process-taskable-method-50 self)
(if (should-display? self)
(go-virtual idle)
(go-virtual hidden)
)
)
)
)
:code anim-loop
)
;; failed to figure out what this is:
(defstate be-clone (process-taskable)
:virtual #t
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(the-as shadow-geo (case message
(('shadow)
(the-as shadow-geo (cond
((-> block param 0)
(let ((v0-0 (-> self shadow-backup)))
(set! (-> self draw shadow) v0-0)
v0-0
)
)
(else
(set! (-> self draw shadow) #f)
(the-as shadow-geo #f)
)
)
)
)
(('shadow-min-max)
(let ((v1-5 (-> self draw shadow-ctrl)))
(let ((a0-5 v1-5))
(set! (-> a0-5 settings bot-plane w) (- (the-as float (-> block param 0))))
)
0
(set! (-> v1-5 settings top-plane w) (- (the-as float (-> block param 1))))
)
(the-as shadow-geo 0)
)
(('end-mode)
(the-as shadow-geo (if (should-display? self)
(the-as shadow-geo (go-virtual idle))
(the-as shadow-geo (go-virtual hidden))
)
)
)
)
)
)
:enter (behavior ((arg0 handle))
(logior! (-> self skel status) (janim-status blerc))
(logclear! (-> self mask) (process-mask actor-pause))
(set-vector! (-> self draw bounds) 0.0 (-> self draw-bounds-y-offset) 0.0 (-> self draw bounds w))
)
:exit (behavior ()
(logclear! (-> self skel status) (janim-status blerc spool))
(logior! (-> self mask) (process-mask actor-pause))
(let ((v1-6 (-> self entity extra trans)))
(if v1-6
(set! (-> self root trans quad) (-> v1-6 quad))
)
)
(ja-channel-set! 0)
)
:trans (behavior ()
(draw-npc-shadow self)
((-> self cur-trans-hook))
)
:code (behavior ((arg0 handle))
(clone-anim arg0 (-> self center-joint-index) #t "")
(format #t "ERROR<GMJ>: handle invalid while ~S is cloning~%" (-> self name))
(go-virtual hidden)
)
)
;; definition for method 47 of type process-taskable
(defmethod target-above-threshold? ((this process-taskable))
#t
)
;; 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))
(the-as
symbol
(case message
(('attack)
(the-as
symbol
(if (-> self bounce-away)
(the-as
symbol
(send-event proc 'shove #f (static-attack-info ((shove-back (meters 3)) (shove-up (meters 1)))))
)
)
)
)
(('touch)
(the-as
symbol
(send-shove-back (-> self root) proc (the-as touching-shapes-entry (-> block param 0)) 0.7 6144.0 16384.0)
)
)
(('clone)
(the-as symbol (go-virtual be-clone (the-as handle (-> block param 0))))
)
(('play-anim)
(logclear! (-> self mask) (process-mask actor-pause))
(let ((v0-0 #t))
(set! (-> self been-kicked) v0-0)
v0-0
)
)
(('hidden-other)
(the-as symbol (go-virtual hidden-other))
)
)
)
)
:enter (behavior ()
(set-time! (-> self state-time))
(process-taskable-clean-up-after-talking)
)
:exit (behavior ()
(cond
((or (= (-> self next-state name) 'dead-state) (= (-> self next-state name) 'idle))
(process-entity-status! self (entity-perm-status bit-3) #f)
)
(else
(kill-current-level-hint '() '() 'exit)
(logior! (-> self skel status) (janim-status inited))
(logclear! (-> self mask) (process-mask actor-pause))
(process-entity-status! self (entity-perm-status bit-3) #t)
(set-setting! 'border-mode #f 0.0 0)
(set-setting! 'talking (process->ppointer self) 0.0 0)
(apply-settings *setting-control*)
)
)
)
:trans (behavior ()
(when (time-elapsed? (-> self state-time) (seconds 0.2))
(logior! (-> self mask) (process-mask actor-pause))
(process-entity-status! self (entity-perm-status bit-3) #f)
)
(cond
((not *target*)
)
((not (-> self will-talk))
(if (>= (- (-> *display* game-frame-counter) (-> self last-talk)) (seconds 10))
(set! (-> self will-talk) #t)
)
)
((begin
(process-taskable-method-46 self)
(and (not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags jump))
(not (logtest? (-> *target* control status) (cshape-moving-flags onsurf)))
)
)
(< (-> (target-pos 0) y) (+ 8192.0 (-> self root root-prim prim-core world-sphere y)))
(< (vector-vector-distance (target-pos 0) (-> self root root-prim prim-core world-sphere)) 32768.0)
(= (-> *level* loading-level) (-> *level* level-default))
(not (movie?))
(not (level-hint-displayed?))
(none-reserved? *art-control*)
(not *progress-process*)
(and (not (handle->process (-> *game-info* other-camera-handle))) (close-anim-file! self))
)
)
(first-any (-> self tasks) #t)
(when (target-above-threshold? self)
(case (current-status (-> self tasks))
(((task-status need-hint)
(task-status need-introduction)
(task-status need-reminder)
(task-status need-reminder-a)
(task-status need-reward-speech)
)
(kill-current-level-hint '() '(sidekick voicebox ambient) 'exit)
(level-hint-surpress!)
(hide-hud)
(when (and (hud-hidden?) (can-grab-display? self))
(let ((gp-1
(new 'stack 'font-context *font-default-matrix* 32 140 0.0 (font-color default) (font-flags shadow kerning))
)
)
(set-width! gp-1 440)
(set-height! gp-1 60)
(set-scale! gp-1 0.9)
(set! (-> gp-1 flags) (font-flags shadow kerning middle-vert large))
(print-game-text (lookup-text! *common-text* (-> self talk-message) #f) gp-1 #f 128 22)
)
(when (and (cpad-pressed? 0 circle) (process-grab? *target*))
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons circle))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons circle))
(send-event *target* 'trans 'save (-> self old-target-pos))
(go-virtual play-anim)
)
)
)
)
)
)
)
(if (= (-> *level* loading-level) (-> *level* level-default))
(process-taskable-method-33 self)
)
(draw-npc-shadow self)
(when (and (-> self been-kicked) (and (not *progress-process*)
(process-grab? *target*)
(not (handle->process (-> *game-info* other-camera-handle)))
)
)
(set! (-> self been-kicked) #f)
(send-event *target* 'trans 'save (-> self old-target-pos))
(go-virtual play-anim)
)
((-> self cur-trans-hook))
)
:code process-taskable-anim-loop
:post (behavior ()
(when *target*
(when (!= (-> self neck-joint-index) -1)
(let ((gp-0 (new 'stack-no-clear 'vector)))
(vector<-cspace! gp-0 (-> self node-list data (-> self neck-joint-index)))
(if *target*
(look-at-enemy! (-> *target* neck) gp-0 'nothing self)
)
)
)
)
(transform-post)
)
)
;; definition for method 41 of type process-taskable
;; INFO: Return type mismatch int vs none.
(defmethod initialize-collision ((this process-taskable) (arg0 int) (arg1 vector))
(let ((s5-0 (new 'process 'collide-shape this (collide-list-enum hit-by-player))))
(let ((s4-0 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
(set! (-> s4-0 prim-core collide-as) (collide-kind enemy))
(set! (-> s4-0 collide-with) (collide-kind target))
(set! (-> s4-0 prim-core action) (collide-action solid))
(set! (-> s4-0 prim-core offense) (collide-offense indestructible))
(set! (-> s4-0 transform-index) arg0)
(set-vector! (-> s4-0 local-sphere) (-> arg1 x) (-> arg1 y) (-> arg1 z) (-> arg1 w))
(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 40 of type process-taskable
;; INFO: Return type mismatch int vs none.
(defmethod process-taskable-method-40 ((this process-taskable) (arg0 object) (arg1 skeleton-group) (arg2 int) (arg3 int) (arg4 vector) (arg5 int))
(stack-size-set! (-> this main-thread) 512)
(initialize-collision this arg2 arg4)
(process-drawable-from-entity! this (the-as entity-actor arg0))
(initialize-skeleton this arg1 '())
(set! (-> this shadow-backup) (-> this draw shadow))
(logior! (-> this skel status) (janim-status eye))
(set! (-> this root pause-adjust-distance) -122880.0)
(set! (-> this fuel-cell-anim) (fuel-cell-pick-anim this))
(set! (-> this draw origin-joint-index) (the-as uint arg2))
(set! (-> this draw shadow-joint-index) (the-as uint arg2))
(set! (-> this center-joint-index) arg2)
(set! (-> this draw-bounds-y-offset) (-> this draw bounds y))
(set! (-> this have-flava) #f)
(set! (-> this music) #f)
(set! (-> this have-music) #f)
(set! (-> this cam-joint-index) arg3)
(set! (-> this cell-x) (the-as handle #f))
(set! (-> this cell-for-task) (game-task none))
(set! (-> this camera) (the-as handle #f))
(set! (-> this will-talk) #t)
(set! (-> this talk-message) (text-id press-to-talk))
(set! (-> this last-talk) 0)
(set! (-> this bounce-away) #t)
(set! (-> this been-kicked) #f)
(set! (-> this neck-joint-index) arg5)
(set! (-> this cur-trans-hook) nothing)
(ambient-control-method-9 (-> this ambient))
(set! (-> this event-hook) (-> (method-of-object this idle) event))
(set! (-> this draw shadow-ctrl) (new 'process 'shadow-control 0.0 0.0 614400.0 (the-as float 60) 245760.0))
(process-taskable-method-52 this)
0
(none)
)
;; definition for method 42 of type process-taskable
;; INFO: Return type mismatch object vs none.
(defmethod process-taskable-method-42 ((this process-taskable))
(cond
((not (should-display? this))
(go (method-of-object this hidden))
)
((= (current-status (-> this tasks)) (task-status need-resolution))
(go (method-of-object this give-cell))
)
(else
(go (method-of-object this idle))
)
)
(none)
)
;; definition for method 43 of type process-taskable
;; INFO: Return type mismatch int vs symbol.
(defmethod process-taskable-method-43 ((this process-taskable))
(the-as symbol 0)
)
;; definition for method 9 of type ambient-control
;; INFO: Return type mismatch int vs none.
(defmethod ambient-control-method-9 ((this ambient-control))
(set! (-> this last-ambient-time) (-> *display* game-frame-counter))
0
(none)
)
;; definition for method 10 of type ambient-control
(defmethod ambient-control-method-10 ((this ambient-control) (arg0 vector) (arg1 time-frame) (arg2 float) (arg3 process-drawable))
(when (< (- (-> *display* game-frame-counter) (-> this last-ambient-time)) arg1)
(set! arg0 (the-as vector #f))
(goto cfg-6)
)
(vector-for-ambient arg3 arg0)
(when (< arg2 (vector-length arg0))
(set! arg0 (the-as vector #f))
(goto cfg-6)
)
(label cfg-6)
arg0
)
;; definition for method 11 of type ambient-control
(defmethod play-ambient ((this ambient-control) (arg0 string) (arg1 symbol) (arg2 vector))
(when (and (not (string= arg0 (-> this last-ambient)))
(or arg1 (can-hint-be-played? (text-id one) (the-as entity #f) (the-as string #f)))
(= (-> *level* loading-level) (-> *level* level-default))
(ambient-hint-spawn arg0 arg2 *entity-pool* 'ambient)
)
(set! (-> this last-ambient-time) (-> *display* game-frame-counter))
(set! (-> this last-ambient) arg0)
(return #t)
)
#f
)
;; definition for function vector-for-ambient
(defun vector-for-ambient ((arg0 process-drawable) (arg1 vector))
(if *target*
(vector-! arg1 (target-pos 0) (-> arg0 root trans))
(vector-! arg1 (camera-pos) (-> arg0 root trans))
)
arg1
)
;; definition for function othercam-calc
;; INFO: Return type mismatch float vs none.
(defun othercam-calc ((arg0 float))
(set! (-> *camera-other-fov* data) (* 2.0 (atan (/ 14.941477 (* 20.3 arg0)) 1.0)))
(none)
)
;; failed to figure out what this is:
(defstate othercam-running (othercam)
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(local-vars (v0-0 object))
(case message
(('die)
(set! v0-0 #t)
(set! (-> self die?) (the-as symbol v0-0))
v0-0
)
(('joint)
(let ((t9-0 type-type?)
(v1-1 (-> block param 0))
)
(cond
((t9-0 (rtype-of v1-1) string)
(let ((v1-8 (lookup-art
(-> (the-as process-taskable (-> self hand process 0)) draw jgeo)
(the-as string (-> block param 0))
(the-as type #f)
)
)
)
(when v1-8
(set! v0-0 (+ (-> v1-8 number) 1))
(set! (-> self cam-joint-index) (the-as int v0-0))
v0-0
)
)
)
((not (logtest? (-> block param 0) 7))
(set! v0-0 (-> block param 0))
(set! (-> self cam-joint-index) (the-as int v0-0))
v0-0
)
)
)
)
(('mask)
(set! v0-0 (-> block param 0))
(set! (-> self mask-to-clear) (the-as process-mask v0-0))
v0-0
)
)
)
:enter (behavior ()
(hide-hud-quick)
(case (-> self spooling?)
(('logo)
)
(else
(add-setting! 'process-mask 'set 0.0 (-> self mask-to-clear))
(add-setting! 'movie (process->ppointer self) 0.0 0)
(if (not (-> self border-value))
(add-setting! 'border-mode (-> self border-value) 0.0 0)
)
)
)
(set! (-> self had-valid-frame) #f)
(let ((gp-0 (-> self hand process 0)))
(vector<-cspace!
(-> self old-pos)
(-> (the-as process-taskable gp-0) node-list data (-> self cam-joint-index))
)
(let ((v1-19 (-> (the-as process-taskable gp-0) node-list data (-> self cam-joint-index) bone transform)))
(vector-normalize-copy! (-> self old-mat-z) (-> v1-19 vector 2) -1.0)
)
)
(apply-settings *setting-control*)
)
:exit (behavior ()
(remove-setting! 'process-mask)
(apply-settings *setting-control*)
)
:code (behavior ()
(loop
(let ((s2-0 (-> self hand process 0)))
(when (not s2-0)
(format #t "ERROR<GMJ>: othercam parent invalid~%")
(deactivate self)
)
(set! (-> *camera-other-root* quad) (-> (the-as process-taskable s2-0) root trans quad))
(let ((s4-0 (-> (the-as process-taskable s2-0) node-list data (-> self cam-joint-index) bone transform))
(s3-0 (-> (the-as process-taskable s2-0) node-list data (-> self cam-joint-index) bone scale))
(gp-0 (new 'stack-no-clear 'vector))
(s5-0 (new 'stack-no-clear 'vector))
(s1-0 (or (!= (-> self spooling?) #t)
(logtest? (-> (the-as process-taskable s2-0) skel status) (janim-status spool))
)
)
)
(vector<-cspace! s5-0 (-> (the-as process-taskable s2-0) node-list data (-> self cam-joint-index)))
(vector-normalize-copy! gp-0 (-> s4-0 vector 2) -1.0)
(when s1-0
(when (not (-> self had-valid-frame))
(set! (-> self had-valid-frame) #t)
(set! (-> self old-pos quad) (-> s5-0 quad))
(set! (-> self old-mat-z quad) (-> gp-0 quad))
)
(when #t
(set! (-> *camera-other-trans* quad) (-> s5-0 quad))
(vector-normalize-copy! (-> *camera-other-matrix* vector 0) (-> s4-0 vector 0) -1.0)
(set! (-> *camera-other-matrix* vector 0 w) 0.0)
(vector-normalize-copy! (-> *camera-other-matrix* vector 1) (-> s4-0 vector 1) 1.0)
(set! (-> *camera-other-matrix* vector 1 w) 0.0)
(vector-normalize-copy! (-> *camera-other-matrix* vector 2) (-> s4-0 vector 2) -1.0)
(set! (-> *camera-other-matrix* vector 2 w) 0.0)
(vector-reset! (-> *camera-other-matrix* vector 3))
(othercam-calc (-> s3-0 x))
)
(set! *camera-look-through-other* 2)
(set! (-> self old-pos quad) (-> s5-0 quad))
(set! (-> self old-mat-z quad) (-> gp-0 quad))
)
)
)
(suspend)
(let ((a0-25 (-> self hand process 0)))
(when (or (-> self die?) (and (not (-> self survive-anim-end?)) (ja-anim-done? a0-25)))
(let ((gp-1 (current-time)))
(while (and (not (time-elapsed? gp-1 (seconds 60)))
(or (and (-> self entity) (not (is-object-visible? (-> self entity extra level) (-> self entity extra vis-id))))
(< 81920.0 (vector-vector-distance (camera-pos) (-> *math-camera* trans)))
)
)
(suspend)
)
)
(deactivate self)
)
)
)
)
)
;; definition for function othercam-init-by-other
;; INFO: Return type mismatch int vs none.
(defbehavior othercam-init-by-other othercam ((arg0 process-taskable) (arg1 symbol) (arg2 symbol) (arg3 symbol))
(set! (-> self spooling?) arg3)
(case (-> self spooling?)
(('logo)
)
(else
(set! (-> *game-info* other-camera-handle) (process->handle self))
)
)
(set! (-> self hand) (process->handle arg0))
(set! (-> self cam-joint-index) (the-as int arg1))
(logclear! (-> self mask) (process-mask pause menu actor-pause))
(set! (-> self border-value) #f)
(set! (-> self die?) #f)
(set! (-> self survive-anim-end?) arg2)
(set! (-> self mask-to-clear) (process-mask movie enemy platform projectile))
(set! (-> self event-hook) (-> othercam-running event))
(go othercam-running)
0
(none)
)
;; definition for method 48 of type process-taskable
;; INFO: Return type mismatch object vs none.
(defmethod draw-npc-shadow ((this process-taskable))
(let ((gp-0 (-> this draw shadow-ctrl)))
(cond
((and (-> this draw shadow)
(zero? (-> this draw cur-lod))
(logtest? (-> this draw status) (draw-status was-drawn))
)
(collide-to-find-planes gp-0 (-> this draw origin) -4096.0 4096.0 32768.0)
(update-direction-from-time-of-day gp-0)
)
(else
(let ((v1-10 gp-0))
(logior! (-> v1-10 settings flags) (shadow-flags disable-draw))
)
0
)
)
)
(none)
)