mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -04:00
822 lines
31 KiB
Common Lisp
822 lines
31 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: target-carry.gc
|
|
;; name in dgo: target-carry
|
|
;; dgos: ENGINE, GAME
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
(define *carry-walk-mods* (new 'static 'surface
|
|
:name 'run
|
|
:turnv 524288.0
|
|
:turnvv 910222.25
|
|
:tiltv 65536.0
|
|
:tiltvv 262144.0
|
|
:transv-max 24576.0
|
|
:target-speed 24576.0
|
|
:seek0 1.0
|
|
:seek90 1.0
|
|
:seek180 1.0
|
|
:fric 1.0
|
|
:nonlin-fric-dist 1.0
|
|
:slip-factor 1.0
|
|
:slide-factor 1.0
|
|
:slope-up-factor 1.0
|
|
:slope-down-factor 1.0
|
|
:slope-slip-angle 1.0
|
|
:impact-fric 1.0
|
|
:bend-factor 1.0
|
|
:bend-speed 1.0
|
|
:alignv 1.0
|
|
:slope-up-traction 1.0
|
|
:align-speed 1.0
|
|
:turnvf 30.0
|
|
:turnvvf 30.0
|
|
:tiltvf 150.0
|
|
:tiltvvf 15.0
|
|
:flags (surface-flag look-around no-turn-around gun-off)
|
|
)
|
|
)
|
|
|
|
(define *carry-jump-mods* (new 'static 'surface
|
|
:name 'jump
|
|
:turnv 524288.0
|
|
:turnvv 910222.25
|
|
:tiltv 65536.0
|
|
:tiltvv 262144.0
|
|
:transv-max 24576.0
|
|
:target-speed 24576.0
|
|
:seek0 0.3
|
|
:seek90 0.3
|
|
:seek180 0.3
|
|
:fric 0.2
|
|
:nonlin-fric-dist 1.0
|
|
:slip-factor 1.0
|
|
:slide-factor 1.0
|
|
:slope-up-factor 1.0
|
|
:slope-down-factor 1.0
|
|
:slope-slip-angle 1.0
|
|
:impact-fric 1.0
|
|
:bend-factor 1.0
|
|
:bend-speed 1.0
|
|
:alignv 1.0
|
|
:slope-up-traction 1.0
|
|
:align-speed 1.0
|
|
:turnvf 30.0
|
|
:turnvvf 30.0
|
|
:tiltvf 150.0
|
|
:tiltvvf 15.0
|
|
:mode 'air
|
|
:flags (surface-flag air gun-off)
|
|
)
|
|
)
|
|
|
|
;; WARN: Return type mismatch object vs none.
|
|
(defbehavior target-carry-update target ()
|
|
(carry-info-method-9 (-> self carry))
|
|
(when (and (= (-> self control collide-mode) 'carry) (< (-> self control collide-mode-transition) 1.0))
|
|
(let ((gp-0 (new 'stack-no-clear 'collide-query))
|
|
(s5-0 (new 'stack-no-clear 'inline-array 'sphere 1))
|
|
)
|
|
(dotimes (s4-0 1)
|
|
((method-of-type sphere new) (the-as symbol (-> s5-0 s4-0)) sphere)
|
|
)
|
|
(let ((f30-0 (seek (-> self control collide-mode-transition) 1.0 (* 0.1 (-> self clock time-adjust-ratio)))))
|
|
(set! (-> s5-0 0 quad) (-> self control collision-spheres 2 prim-core world-sphere quad))
|
|
(set! (-> s5-0 0 r) (lerp-scale (-> *TARGET-bank* body-radius) 7372.8 f30-0 0.0 1.0))
|
|
(let ((v1-17 gp-0))
|
|
(set! (-> v1-17 best-dist) (the-as float s5-0))
|
|
(set! (-> v1-17 num-spheres) (the-as uint 1))
|
|
(set! (-> v1-17 collide-with) (-> self control root-prim prim-core collide-with))
|
|
(set! (-> v1-17 ignore-process0) #f)
|
|
(set! (-> v1-17 ignore-process1) #f)
|
|
(set! (-> v1-17 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1))
|
|
(set! (-> v1-17 best-my-prim) (the-as collide-shape-prim #t))
|
|
(set! (-> v1-17 action-mask) (collide-action solid))
|
|
)
|
|
(if (not (fill-and-probe-using-spheres *collide-cache* gp-0))
|
|
(target-collide-set! 'carry f30-0)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(send-event (handle->process (-> self carry other)) 'carry (-> self carry))
|
|
(none)
|
|
)
|
|
|
|
;; WARN: Return type mismatch focus-status vs none.
|
|
(defbehavior target-carry-post target ()
|
|
(target-post)
|
|
(target-carry-update)
|
|
(set! (-> self focus-status) (logior (focus-status carry) (-> self focus-status)))
|
|
(none)
|
|
)
|
|
|
|
(defstate target-carry-pickup (target)
|
|
:event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block))
|
|
(case event-type
|
|
(('touched)
|
|
(cond
|
|
(((method-of-type touching-shapes-entry prims-touching?)
|
|
(the-as touching-shapes-entry (-> event param 0))
|
|
(-> self control)
|
|
(the-as uint 1920)
|
|
)
|
|
(let ((a1-2 (new 'stack-no-clear 'event-message-block)))
|
|
(set! (-> a1-2 from) (process->ppointer self))
|
|
(set! (-> a1-2 num-params) 0)
|
|
(set! (-> a1-2 message) 'carry?)
|
|
(let ((a1-3 (send-event-function proc a1-2)))
|
|
(when a1-3
|
|
(let ((f0-0 (distance-from-destination (-> self carry) (the-as carry-info a1-3))))
|
|
(when (and (>= f0-0 0.0) (< f0-0 (-> self carry other-value)))
|
|
(set! (-> self carry other) (process->handle proc))
|
|
(set! (-> self carry other-value) f0-0)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
#f
|
|
)
|
|
(else
|
|
(target-standard-event-handler proc arg1 event-type event)
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
(target-standard-event-handler proc arg1 event-type event)
|
|
)
|
|
)
|
|
)
|
|
:enter (behavior ()
|
|
(set! (-> self control mod-surface) *walk-mods*)
|
|
(set! (-> self state-time) (-> self clock frame-counter))
|
|
(set-forward-vel 0.0)
|
|
(set! (-> self carry other) (the-as handle #f))
|
|
(set! (-> self carry other-value) 100000000000.0)
|
|
(set! (-> self carry max-distance) 12288.0)
|
|
(set! (-> self carry mode) (carry-mode carry))
|
|
(carry-info-method-9 (-> self carry))
|
|
(none)
|
|
)
|
|
:exit (behavior ()
|
|
(when (not (and (-> self next-state) (let ((v1-3 (-> self next-state name)))
|
|
(or (= v1-3 'target-carry-stance)
|
|
(= v1-3 'target-carry-walk)
|
|
(= v1-3 'target-carry-drop)
|
|
(= v1-3 'target-carry-throw)
|
|
(= v1-3 'target-carry-jump)
|
|
(= v1-3 'target-carry-falling)
|
|
(= v1-3 'target-carry-hit-ground)
|
|
(= v1-3 'target-carry-throw)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(logclear! (-> self focus-status) (focus-status carry))
|
|
(send-event (handle->process (-> self carry other)) 'drop (-> self carry) *null-vector*)
|
|
(target-collide-set! 'normal 0.0)
|
|
(target-exit)
|
|
)
|
|
(none)
|
|
)
|
|
:code (behavior ()
|
|
(let ((f30-0 0.0))
|
|
(let ((f28-0 0.0))
|
|
(ja-channel-push! 2 (seconds 0.1))
|
|
(target-danger-set! 'carry? #f)
|
|
(ja :group! (-> self draw art-group data 319) :num! min)
|
|
(let ((a0-3 (-> self skel root-channel 1)))
|
|
(set! (-> a0-3 frame-interp 1) f30-0)
|
|
(set! (-> a0-3 frame-interp 0) f30-0)
|
|
(set! (-> a0-3 frame-group) (the-as art-joint-anim (-> self draw art-group data 318)))
|
|
(set! (-> a0-3 param 0) 0.0)
|
|
(joint-control-channel-group-eval!
|
|
a0-3
|
|
(the-as art-joint-anim (-> self draw art-group data 318))
|
|
num-func-chan
|
|
)
|
|
)
|
|
(suspend)
|
|
(format #t "carry picked ~A~%" (handle->process (-> self carry other)))
|
|
(let ((a1-5 (new 'stack-no-clear 'event-message-block)))
|
|
(set! (-> a1-5 from) (process->ppointer self))
|
|
(set! (-> a1-5 num-params) 0)
|
|
(set! (-> a1-5 message) 'carry-info)
|
|
(let ((gp-1 (the-as carry-info (send-event-function (handle->process (-> self carry other)) a1-5))))
|
|
(when gp-1
|
|
(let* ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> gp-1 point) (-> self control trans)))
|
|
(s4-0 (new-stack-vector0))
|
|
(f26-0 (vector-dot (-> self control local-normal) s5-1))
|
|
)
|
|
0.0
|
|
(vector-! s4-0 s5-1 (vector-float*! s4-0 (-> self control local-normal) f26-0))
|
|
(let* ((f24-0 (vector-length s4-0))
|
|
(f22-0 f24-0)
|
|
)
|
|
(set! f28-0 (lerp-scale 1.0 0.0 f26-0 1638.4 4505.6))
|
|
(vector+!
|
|
s5-1
|
|
(vector-float*! s5-1 (-> self control local-normal) f26-0)
|
|
(vector-float*! s4-0 s4-0 (/ f24-0 f22-0))
|
|
)
|
|
)
|
|
)
|
|
(forward-up-nopitch->quaternion
|
|
(-> self control dir-targ)
|
|
(vector-normalize! (vector-! (new-stack-vector0) (-> gp-1 point) (-> self control trans)) 1.0)
|
|
(vector-y-quaternion! (new-stack-vector0) (-> self control dir-targ))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(target-danger-set! 'harmless #f)
|
|
(ja-no-eval :num! (seek! (ja-aframe 5.0 0)))
|
|
(while (not (ja-done? 0))
|
|
(set! f30-0 (seek f30-0 f28-0 (* 5.0 (-> self clock seconds-per-frame))))
|
|
(let ((v1-45 (-> self skel root-channel 1)))
|
|
(set! (-> v1-45 frame-interp 1) f30-0)
|
|
(set! (-> v1-45 frame-interp 0) f30-0)
|
|
)
|
|
(suspend)
|
|
(ja-eval)
|
|
)
|
|
(when (send-event (handle->process (-> self carry other)) 'pickup (-> self carry))
|
|
(target-collide-set! 'carry 0.0)
|
|
(ja-no-eval :num! (seek!))
|
|
(while (not (ja-done? 0))
|
|
(set! f30-0 (seek f30-0 f28-0 (* 5.0 (-> self clock seconds-per-frame))))
|
|
(let ((v1-70 (-> self skel root-channel 1)))
|
|
(set! (-> v1-70 frame-interp 1) f30-0)
|
|
(set! (-> v1-70 frame-interp 0) f30-0)
|
|
)
|
|
(when (< 22.0 (ja-aframe-num 0))
|
|
(let ((a1-22 (new 'stack-no-clear 'event-message-block)))
|
|
(set! (-> a1-22 from) (process->ppointer self))
|
|
(set! (-> a1-22 num-params) 0)
|
|
(set! (-> a1-22 message) 'carry-info)
|
|
(let ((gp-4 (the-as carry-info (send-event-function (handle->process (-> self carry other)) a1-22))))
|
|
(if gp-4
|
|
(seek! (-> gp-4 grab-trans-blend) 0.0 (* 2.0 (-> self clock seconds-per-frame)))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(suspend)
|
|
(ja-eval)
|
|
)
|
|
(go target-carry-stance)
|
|
)
|
|
)
|
|
(ja-no-eval :num! (seek! 0.0))
|
|
(while (not (ja-done? 0))
|
|
(let ((v1-93 (-> self skel root-channel 1)))
|
|
(set! (-> v1-93 frame-interp 1) f30-0)
|
|
(set! (-> v1-93 frame-interp 0) f30-0)
|
|
)
|
|
(suspend)
|
|
(ja-eval)
|
|
)
|
|
)
|
|
(go target-stance)
|
|
(none)
|
|
)
|
|
:post (behavior ()
|
|
(target-no-stick-post)
|
|
(carry-info-method-9 (-> self carry))
|
|
(target-carry-update)
|
|
(none)
|
|
)
|
|
)
|
|
|
|
(defstate target-carry-drop (target)
|
|
:event target-standard-event-handler
|
|
:enter (behavior ()
|
|
(set! (-> self control mod-surface) *walk-mods*)
|
|
(set! (-> self state-time) (-> self clock frame-counter))
|
|
(set-forward-vel 0.0)
|
|
(none)
|
|
)
|
|
:code (behavior ()
|
|
(let ((f30-0 1.0))
|
|
(let ((a1-0 (new 'stack-no-clear 'event-message-block)))
|
|
(set! (-> a1-0 from) (process->ppointer self))
|
|
(set! (-> a1-0 num-params) 0)
|
|
(set! (-> a1-0 message) 'carry-info)
|
|
(let ((a0-5 (the-as carry-info (send-event-function (handle->process (-> self carry other)) a1-0))))
|
|
(when a0-5
|
|
(let ((gp-0 (new 'stack-no-clear 'vector)))
|
|
(set! (-> gp-0 quad) (-> a0-5 point quad))
|
|
(set! (-> gp-0 y) (- (-> gp-0 y) (-> a0-5 process 0 control root-prim prim-core world-sphere w)))
|
|
(let ((s5-0 (new-stack-vector0))
|
|
(f28-0 (vector-dot (-> self control local-normal) gp-0))
|
|
)
|
|
0.0
|
|
(vector-! s5-0 gp-0 (vector-float*! s5-0 (-> self control local-normal) f28-0))
|
|
(let* ((f26-0 (vector-length s5-0))
|
|
(f24-0 f26-0)
|
|
)
|
|
(set! f30-0 (lerp-scale 1.0 0.0 f28-0 1638.4 4505.6))
|
|
(vector+!
|
|
gp-0
|
|
(vector-float*! gp-0 (-> self control local-normal) f28-0)
|
|
(vector-float*! s5-0 s5-0 (/ f26-0 f24-0))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(ja-channel-push! 2 (seconds 0.1))
|
|
(ja :group! (-> self draw art-group data 319)
|
|
:num! (identity (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 319)) frames num-frames) -1)))
|
|
)
|
|
(let ((a0-16 (-> self skel root-channel 1)))
|
|
(set! (-> a0-16 frame-interp 1) f30-0)
|
|
(set! (-> a0-16 frame-interp 0) f30-0)
|
|
(set! (-> a0-16 frame-group) (the-as art-joint-anim (-> self draw art-group data 318)))
|
|
(set! (-> a0-16 param 0) 0.0)
|
|
(joint-control-channel-group-eval!
|
|
a0-16
|
|
(the-as art-joint-anim (-> self draw art-group data 318))
|
|
num-func-chan
|
|
)
|
|
)
|
|
)
|
|
(suspend)
|
|
(ja-no-eval :num! (seek! (ja-aframe 5.0 0)))
|
|
(while (not (ja-done? 0))
|
|
(let ((a1-9 (new 'stack-no-clear 'event-message-block)))
|
|
(set! (-> a1-9 from) (process->ppointer self))
|
|
(set! (-> a1-9 num-params) 0)
|
|
(set! (-> a1-9 message) 'carry-info)
|
|
(let ((gp-4 (the-as carry-info (send-event-function (handle->process (-> self carry other)) a1-9))))
|
|
(when gp-4
|
|
(if (< 22.0 (ja-aframe-num 0))
|
|
(seek! (-> gp-4 grab-trans-blend) 1.0 (* 2.0 (-> self clock seconds-per-frame)))
|
|
)
|
|
(let ((s4-0 (-> gp-4 process 0 control))
|
|
(gp-5 (new 'stack-no-clear 'collide-query))
|
|
)
|
|
(let ((s5-1 (new 'stack-no-clear 'inline-array 'sphere 1)))
|
|
(dotimes (s3-0 1)
|
|
((method-of-type sphere new) (the-as symbol (-> s5-1 s3-0)) sphere)
|
|
)
|
|
(set! (-> s5-1 0 quad) (-> s4-0 root-prim prim-core world-sphere quad))
|
|
(let ((v1-64 gp-5))
|
|
(set! (-> v1-64 best-dist) (the-as float s5-1))
|
|
(set! (-> v1-64 num-spheres) (the-as uint 1))
|
|
(set! (-> v1-64 collide-with) (-> self control root-prim prim-core collide-with))
|
|
(set! (-> v1-64 ignore-process0) #f)
|
|
(set! (-> v1-64 ignore-process1) #f)
|
|
(set! (-> v1-64 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1))
|
|
(set! (-> v1-64 best-my-prim) (the-as collide-shape-prim #t))
|
|
(set! (-> v1-64 action-mask) (collide-action solid))
|
|
)
|
|
)
|
|
(when (fill-and-probe-using-spheres *collide-cache* gp-5)
|
|
(ja-no-eval :num! (seek!))
|
|
(while (not (ja-done? 0))
|
|
(when (< 22.0 (ja-aframe-num 0))
|
|
(let ((a1-14 (new 'stack-no-clear 'event-message-block)))
|
|
(set! (-> a1-14 from) (process->ppointer self))
|
|
(set! (-> a1-14 num-params) 0)
|
|
(set! (-> a1-14 message) 'carry-info)
|
|
(let ((gp-6 (the-as carry-info (send-event-function (handle->process (-> self carry other)) a1-14))))
|
|
(if gp-6
|
|
(seek! (-> gp-6 grab-trans-blend) 0.0 (* 2.0 (-> self clock seconds-per-frame)))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(suspend)
|
|
(ja-eval)
|
|
)
|
|
(go target-carry-stance)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(suspend)
|
|
(ja-eval)
|
|
)
|
|
(send-event (handle->process (-> self carry other)) 'drop (-> self carry) *null-vector*)
|
|
(target-collide-set! 'normal 0.0)
|
|
(ja-no-eval :num! (seek! 0.0))
|
|
(while (not (ja-done? 0))
|
|
(suspend)
|
|
(ja-eval)
|
|
)
|
|
(go target-stance)
|
|
(none)
|
|
)
|
|
:post (-> target-carry-pickup post)
|
|
)
|
|
|
|
(defstate target-carry-stance (target)
|
|
:event target-standard-event-handler
|
|
:enter (behavior ()
|
|
(set! (-> self control mod-surface) *carry-walk-mods*)
|
|
(set! (-> self state-time) (-> self clock frame-counter))
|
|
(none)
|
|
)
|
|
:exit (behavior ()
|
|
((-> target-carry-pickup exit))
|
|
(set! (-> self control bend-target) 0.0)
|
|
(target-state-hook-exit)
|
|
(none)
|
|
)
|
|
:trans (behavior ()
|
|
((-> self state-hook))
|
|
(when (move-legs?)
|
|
(set! (-> self control bend-target) 0.0)
|
|
(remove-exit)
|
|
(go target-carry-walk)
|
|
)
|
|
(if (cpad-pressed? (-> self control cpad number) r1)
|
|
(go target-carry-drop)
|
|
)
|
|
(when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0)
|
|
(-> *cpad-list* cpads (-> self control cpad number) button0-rel 1)
|
|
)
|
|
(-> *cpad-list* cpads (-> self control cpad number) button0-rel 2)
|
|
)
|
|
(pad-buttons x)
|
|
)
|
|
(can-jump? #f)
|
|
)
|
|
enter-state
|
|
(let ((a0-17 (-> *TARGET-bank* carry-jump-height-min))
|
|
(a1-2 (-> *TARGET-bank* carry-jump-height-max))
|
|
)
|
|
(go target-carry-jump a0-17 a1-2)
|
|
)
|
|
)
|
|
(if (and (cpad-pressed? (-> self control cpad number) square) (can-hands? #t))
|
|
(go target-carry-throw)
|
|
)
|
|
(fall-test (the-as (state symbol target) target-carry-falling) -4096000.0)
|
|
(none)
|
|
)
|
|
:code (behavior ()
|
|
(let ((v1-2 (ja-group)))
|
|
(when (not (and v1-2 (= v1-2 (-> self draw art-group data 316))))
|
|
(ja-channel-push! 1 (seconds 0.1))
|
|
(ja :group! (-> self draw art-group data 316))
|
|
)
|
|
)
|
|
(until #f
|
|
(suspend)
|
|
(ja :num! (loop!))
|
|
)
|
|
#f
|
|
(none)
|
|
)
|
|
:post target-carry-post
|
|
)
|
|
|
|
(defstate target-carry-walk (target)
|
|
:event target-standard-event-handler
|
|
:enter (behavior ()
|
|
(set! (-> self state-time) (-> self clock frame-counter))
|
|
(set! (-> self control mod-surface) *carry-walk-mods*)
|
|
(none)
|
|
)
|
|
:exit (behavior ()
|
|
((-> target-carry-pickup exit))
|
|
(target-effect-exit)
|
|
(target-state-hook-exit)
|
|
(none)
|
|
)
|
|
:trans (behavior ()
|
|
((-> self state-hook))
|
|
(when (not (move-legs?))
|
|
(target-effect-exit)
|
|
(remove-exit)
|
|
(go target-carry-stance)
|
|
)
|
|
(if (cpad-pressed? (-> self control cpad number) r1)
|
|
(go target-carry-drop)
|
|
)
|
|
(when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0)
|
|
(-> *cpad-list* cpads (-> self control cpad number) button0-rel 1)
|
|
)
|
|
(-> *cpad-list* cpads (-> self control cpad number) button0-rel 2)
|
|
)
|
|
(pad-buttons x)
|
|
)
|
|
(can-jump? #f)
|
|
)
|
|
enter-state
|
|
(let ((a0-17 (-> *TARGET-bank* carry-jump-height-min))
|
|
(a1-2 (-> *TARGET-bank* carry-jump-height-max))
|
|
)
|
|
(go target-carry-jump a0-17 a1-2)
|
|
)
|
|
)
|
|
(if (and (cpad-pressed? (-> self control cpad number) square) (can-hands? #t))
|
|
(go target-carry-throw)
|
|
)
|
|
(fall-test (the-as (state symbol target) target-carry-falling) -4096000.0)
|
|
(none)
|
|
)
|
|
:code (behavior ()
|
|
(let ((v1-2 (ja-group)))
|
|
(when (not (and v1-2 (= v1-2 (-> self draw art-group data 317))))
|
|
(ja-channel-push! 1 (seconds 0.1))
|
|
(ja :group! (-> self draw art-group data 317) :dist (-> *TARGET-bank* walk-cycle-dist))
|
|
)
|
|
)
|
|
(until #f
|
|
(suspend)
|
|
(let* ((f0-2 (* (current-cycle-distance (-> self skel)) (-> self control scale x)))
|
|
(f0-4 (/ (-> self control ctrl-xz-vel) (* 1.25 f0-2)))
|
|
)
|
|
(ja :num! (loop! f0-4))
|
|
)
|
|
)
|
|
#f
|
|
(none)
|
|
)
|
|
:post target-carry-post
|
|
)
|
|
|
|
(defstate target-carry-falling (target)
|
|
:event target-jump-event-handler
|
|
:enter (behavior ()
|
|
(set! (-> self control mod-surface) *carry-jump-mods*)
|
|
(set! (-> self state-time) (-> self clock frame-counter))
|
|
(none)
|
|
)
|
|
:trans (behavior ()
|
|
(if (logtest? (-> self control status) (collide-status on-surface))
|
|
(go target-carry-hit-ground #f)
|
|
)
|
|
(let* ((f0-0 (target-move-dist (-> *TARGET-bank* stuck-time)))
|
|
(v1-9 (ja-group))
|
|
(v1-12 (if (and v1-9 (= v1-9 (-> self draw art-group data 322)))
|
|
15
|
|
-1
|
|
)
|
|
)
|
|
)
|
|
(when (if (and (< f0-0 (-> *TARGET-bank* stuck-distance))
|
|
(and (>= v1-12 0)
|
|
(>= (- (-> self clock frame-counter) (-> self state-time)) v1-12)
|
|
(not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2)))
|
|
)
|
|
)
|
|
#t
|
|
)
|
|
(logior! (-> self control status) (collide-status on-surface))
|
|
(go target-carry-hit-ground 'stuck)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
:code (behavior ()
|
|
(let ((v1-2 (ja-group)))
|
|
(cond
|
|
((and v1-2 (= v1-2 (-> self draw art-group data 322)))
|
|
)
|
|
(else
|
|
(ja-channel-push! 1 (seconds 0.33))
|
|
(ja :group! (-> self draw art-group data 322))
|
|
(while (!= (-> self skel root-channel 0) (-> self skel channel))
|
|
(suspend)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(ja-no-eval :group! (-> self draw art-group data 322) :num! (loop!) :frame-num 0.0)
|
|
(until #f
|
|
(suspend)
|
|
(ja :group! (-> self draw art-group data 27) :num! (loop!))
|
|
)
|
|
#f
|
|
(none)
|
|
)
|
|
:post target-carry-post
|
|
)
|
|
|
|
(defstate target-carry-hit-ground (target)
|
|
:event target-walk-event-handler
|
|
:enter (behavior ((arg0 symbol))
|
|
(case arg0
|
|
(('stuck)
|
|
)
|
|
(else
|
|
(target-land-effect)
|
|
)
|
|
)
|
|
(set! (-> self control last-running-attack-end-time) 0)
|
|
(set! (-> self control last-attack-end-time) 0)
|
|
(if (>= (-> self control ground-impact-vel) (-> *TARGET-bank* fall-stumble-threshold))
|
|
(set-forward-vel 0.0)
|
|
)
|
|
(if (!= (-> self control ground-pat material) (pat-material ice))
|
|
(delete-back-vel)
|
|
)
|
|
(set! (-> self control mod-surface) *carry-walk-mods*)
|
|
(start-bobbing!
|
|
(-> self water)
|
|
(lerp-scale 0.0 4096.0 (-> self control ground-impact-vel) 40960.0 102400.0)
|
|
600
|
|
1500
|
|
)
|
|
(none)
|
|
)
|
|
:exit (behavior ()
|
|
(logclear! (-> self state-flags) (state-flags lleg-still rleg-still))
|
|
(none)
|
|
)
|
|
:trans (behavior ()
|
|
(when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0)
|
|
(-> *cpad-list* cpads (-> self control cpad number) button0-rel 1)
|
|
)
|
|
(-> *cpad-list* cpads (-> self control cpad number) button0-rel 2)
|
|
)
|
|
(pad-buttons x)
|
|
)
|
|
(can-jump? #f)
|
|
)
|
|
enter-state
|
|
(let ((a0-16 (-> *TARGET-bank* carry-jump-height-min))
|
|
(a1-2 (-> *TARGET-bank* carry-jump-height-max))
|
|
)
|
|
(go target-carry-jump a0-16 a1-2)
|
|
)
|
|
)
|
|
(if (!= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0)
|
|
(go target-carry-walk)
|
|
)
|
|
(fall-test (the-as (state symbol target) target-carry-falling) -4096000.0)
|
|
(none)
|
|
)
|
|
:code (behavior ((arg0 symbol))
|
|
(target-hit-ground-anim #f (are-still?))
|
|
(go target-carry-stance)
|
|
(none)
|
|
)
|
|
:post target-carry-post
|
|
)
|
|
|
|
(defstate target-carry-jump (target)
|
|
:event target-jump-event-handler
|
|
:enter (behavior ((arg0 float) (arg1 float))
|
|
(set! (-> self state-time) (-> self clock frame-counter))
|
|
(sound-play "jump" :vol 70)
|
|
(init-var-jump arg0 arg1 #t #f (-> self control transv) 2.0)
|
|
(logclear! (-> self control status) (collide-status on-surface on-ground touch-surface))
|
|
(set! (-> self control mod-surface) *carry-jump-mods*)
|
|
(set! (-> self control unknown-float36)
|
|
(fmax 0.0 (fmin 1.0 (* 0.00004359654 (+ -11468.8 (-> self control ctrl-xz-vel)))))
|
|
)
|
|
(set! (-> self control unknown-float35)
|
|
(fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ -10240.0 (-> self control ctrl-xz-vel)))))
|
|
)
|
|
(none)
|
|
)
|
|
:exit (behavior ()
|
|
((-> target-carry-pickup exit))
|
|
(target-exit)
|
|
(none)
|
|
)
|
|
:trans (behavior ()
|
|
(set! (-> self control unknown-float36)
|
|
(fmax
|
|
(-> self control unknown-float36)
|
|
(* 0.003921569 (the float (-> *cpad-list* cpads (-> self control cpad number) abutton 6)))
|
|
)
|
|
)
|
|
((-> target-carry-falling trans))
|
|
(mod-var-jump #t #f (cpad-hold? (-> self control cpad number) x) (-> self control transv))
|
|
(seek!
|
|
(-> self control unknown-float35)
|
|
(fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ -10240.0 (-> self control ctrl-xz-vel)))))
|
|
(-> self clock seconds-per-frame)
|
|
)
|
|
(none)
|
|
)
|
|
:code (behavior ((arg0 float) (arg1 float))
|
|
(ja-channel-push! 1 (seconds 0.05))
|
|
(ja :group! (-> self draw art-group data 321) :num! min)
|
|
(suspend)
|
|
(ja :group! (-> self draw art-group data 321) :num! (+!))
|
|
(suspend)
|
|
(until (ja-done? 0)
|
|
(let ((f30-0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))
|
|
(f0-4 (- 6.0 (ja-aframe-num 0)))
|
|
(gp-1 (-> self skel root-channel 0))
|
|
)
|
|
(set! (-> gp-1 param 0) (the float (+ (-> gp-1 frame-group frames num-frames) -1)))
|
|
(let ((v1-27 (and (< 0.0 f30-0) (< 0.0 f0-4))))
|
|
(set! (-> gp-1 param 1)
|
|
(if v1-27
|
|
(fmin (fmin 3.0 f0-4) (/ (* 5.0 f0-4) (the float (time-to-apex f30-0 -245760.0))))
|
|
1.0
|
|
)
|
|
)
|
|
)
|
|
(joint-control-channel-group-eval! gp-1 (the-as art-joint-anim #f) num-func-seek!)
|
|
)
|
|
(suspend)
|
|
)
|
|
(go target-carry-falling)
|
|
(none)
|
|
)
|
|
:post target-carry-post
|
|
)
|
|
|
|
(defstate target-carry-throw (target)
|
|
:event target-standard-event-handler
|
|
:enter (behavior ()
|
|
(set! (-> self control mod-surface) *walk-mods*)
|
|
(set! (-> self state-time) (-> self clock frame-counter))
|
|
(set-forward-vel 0.0)
|
|
(none)
|
|
)
|
|
:code (behavior ()
|
|
(ja-channel-push! 1 (seconds 0.1))
|
|
(ja-no-eval :group! (-> self draw art-group data 320) :num! (seek! (ja-aframe 19.0 0)) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(let ((a1-3 (new 'stack-no-clear 'event-message-block)))
|
|
(set! (-> a1-3 from) (process->ppointer self))
|
|
(set! (-> a1-3 num-params) 0)
|
|
(set! (-> a1-3 message) 'carry-info)
|
|
(let ((gp-1 (the-as carry-info (send-event-function (handle->process (-> self carry other)) a1-3))))
|
|
(if gp-1
|
|
(seek! (-> gp-1 grab-trans-blend) 1.0 (* 4.0 (-> self clock seconds-per-frame)))
|
|
)
|
|
)
|
|
)
|
|
(suspend)
|
|
(ja :num! (seek! (ja-aframe 19.0 0)))
|
|
)
|
|
(let ((a1-7 (new 'stack-no-clear 'event-message-block)))
|
|
(set! (-> a1-7 from) (process->ppointer self))
|
|
(set! (-> a1-7 num-params) 0)
|
|
(set! (-> a1-7 message) 'carry-info)
|
|
(let ((v1-30 (the-as carry-info (send-event-function (handle->process (-> self carry other)) a1-7))))
|
|
(when v1-30
|
|
(let ((s4-0 (-> v1-30 process 0 control))
|
|
(gp-3 (new 'stack-no-clear 'collide-query))
|
|
)
|
|
(let ((s5-0 (new 'stack-no-clear 'inline-array 'sphere 1)))
|
|
(dotimes (s3-0 1)
|
|
((method-of-type sphere new) (the-as symbol (-> s5-0 s3-0)) sphere)
|
|
)
|
|
(set! (-> s5-0 0 quad) (-> s4-0 root-prim prim-core world-sphere quad))
|
|
(let ((v1-38 gp-3))
|
|
(set! (-> v1-38 best-dist) (the-as float s5-0))
|
|
(set! (-> v1-38 num-spheres) (the-as uint 1))
|
|
(set! (-> v1-38 collide-with) (-> self control root-prim prim-core collide-with))
|
|
(set! (-> v1-38 ignore-process0) #f)
|
|
(set! (-> v1-38 ignore-process1) #f)
|
|
(set! (-> v1-38 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1))
|
|
(set! (-> v1-38 best-my-prim) (the-as collide-shape-prim #t))
|
|
(set! (-> v1-38 action-mask) (collide-action solid))
|
|
)
|
|
)
|
|
(when (fill-and-probe-using-spheres *collide-cache* gp-3)
|
|
(ja-no-eval :num! (seek! 0.0))
|
|
(while (not (ja-done? 0))
|
|
(let ((a1-11 (new 'stack-no-clear 'event-message-block)))
|
|
(set! (-> a1-11 from) (process->ppointer self))
|
|
(set! (-> a1-11 num-params) 0)
|
|
(set! (-> a1-11 message) 'carry-info)
|
|
(let ((gp-4 (the-as carry-info (send-event-function (handle->process (-> self carry other)) a1-11))))
|
|
(if gp-4
|
|
(seek! (-> gp-4 grab-trans-blend) 0.0 (* 4.0 (-> self clock seconds-per-frame)))
|
|
)
|
|
)
|
|
)
|
|
(suspend)
|
|
(ja-eval)
|
|
)
|
|
(go target-carry-stance)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(let ((v1-58 (vector-float*! (new 'stack-no-clear 'vector) (-> self control local-normal) 79764.13)))
|
|
(vector+float*! v1-58 v1-58 (-> self control c-R-w vector 2) 32768.0)
|
|
(send-event (handle->process (-> self carry other)) 'drop (-> self carry) v1-58)
|
|
)
|
|
(target-collide-set! 'normal 0.0)
|
|
(ja-no-eval :num! (seek!))
|
|
(while (not (ja-done? 0))
|
|
(suspend)
|
|
(ja-eval)
|
|
)
|
|
(go target-stance)
|
|
(none)
|
|
)
|
|
:post (-> target-carry-pickup post)
|
|
)
|