mirror of
https://github.com/open-goal/jak-project
synced 2026-08-10 19:17:55 -04:00
122de4ecf5
After spending the last month staring at and comparing Jak 3 and Jak 1 versions of a bunch of `target` code for my jetboard mod, I figured this would be a good opportunity to revive this ancient PR #1714 along with some other small misc fixes/improvements. Instead of directly replacing the old fields, I decided to opt for using overlay fields to maintain backwards compatibility with existing manual patches, files without ref tests and mods that might use these fields.
313 lines
11 KiB
Common Lisp
Vendored
Generated
313 lines
11 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate target-ice-stance (target)
|
|
:event target-standard-event-handler
|
|
:enter (behavior ()
|
|
(set! (-> self control mod-surface) *walk-mods*)
|
|
)
|
|
:exit target-state-hook-exit
|
|
:trans (behavior ()
|
|
((-> self state-hook))
|
|
(if (!= (-> self control ground-pat material) (pat-material ice))
|
|
(go target-stance)
|
|
)
|
|
(when (move-legs?)
|
|
(remove-exit)
|
|
(go target-ice-walk)
|
|
)
|
|
(when (and (cpad-hold? (-> self control cpad number) l1 r1) (can-duck?))
|
|
(remove-exit)
|
|
(go target-duck-stance)
|
|
)
|
|
(if (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)
|
|
)
|
|
(go target-jump (-> *TARGET-bank* jump-height-min) (-> *TARGET-bank* jump-height-max) (the-as surface #f))
|
|
)
|
|
(if (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 circle)
|
|
)
|
|
(can-feet?)
|
|
)
|
|
(go target-attack)
|
|
)
|
|
(if (can-hands? #t)
|
|
(go target-running-attack)
|
|
)
|
|
(slide-down-test)
|
|
(fall-test)
|
|
)
|
|
:code (behavior ()
|
|
(let ((gp-0 60))
|
|
(let ((v1-2 (ja-group)))
|
|
(cond
|
|
((or (= v1-2 eichar-jump-ja) (= v1-2 eichar-jump-loop-ja))
|
|
(set! gp-0 21)
|
|
)
|
|
((ja-group? eichar-wheel-flip-ja)
|
|
(ja-no-eval :group! eichar-wheel-flip-land-ja :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
)
|
|
((ja-group? eichar-attack-from-stance-ja)
|
|
(cond
|
|
((rand-vu-percent? 0.3)
|
|
(ja-no-eval :group! eichar-attack-from-stance-alt-end-ja :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
)
|
|
(else
|
|
(ja-no-eval :group! eichar-attack-from-stance-end-ja :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
((ja-group? eichar-smack-surface-ja)
|
|
(ja-no-eval :group! eichar-smack-surface-end-ja :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
)
|
|
((ja-group? eichar-yellow-running-blast-ja)
|
|
(ja-no-eval :group! eichar-yellow-running-blast-end-ja :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
(set! gp-0 0)
|
|
)
|
|
((ja-group? eichar-attack-punch-ja)
|
|
(set! (-> self control bend-target) (-> self control bend-amount))
|
|
(set! (-> self control mod-surface) *walk-no-turn-mods*)
|
|
(ja-no-eval :group! (if (rand-vu-percent? 0.3)
|
|
eichar-attack-punch-alt-end-ja
|
|
eichar-attack-punch-end-ja
|
|
)
|
|
:num! (seek!)
|
|
:frame-num 0.0
|
|
)
|
|
(until (ja-done? 0)
|
|
(seek! (-> self control bend-target) 0.0 (seconds-per-frame))
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
(set! (-> self control mod-surface) *walk-mods*)
|
|
(set! (-> self control bend-target) 0.0)
|
|
(rot->dir-targ! (-> self control))
|
|
)
|
|
((let ((v1-188 (ja-group)))
|
|
(or (= v1-188 eichar-duck-stance-ja) (= v1-188 eichar-duck-walk-ja))
|
|
)
|
|
(ja-channel-push! 1 (seconds 0.04))
|
|
(ja-no-eval :group! eichar-stance-to-duck-ja :num! (seek! 0.0 1.2) :frame-num max)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek! 0.0 1.2))
|
|
)
|
|
(set! gp-0 60)
|
|
)
|
|
)
|
|
)
|
|
(while (< 16384.0 (-> self control ctrl-xz-vel))
|
|
(cond
|
|
((ja-group? eichar-ice-slide-ja)
|
|
)
|
|
(else
|
|
(ja-channel-push! 1 (the-as time-frame gp-0))
|
|
(set! gp-0 150)
|
|
(ja :group! eichar-ice-slide-ja)
|
|
)
|
|
)
|
|
(suspend)
|
|
(ja :num! (loop!))
|
|
)
|
|
(when (not (ja-group? eichar-ice-stance-ja))
|
|
(ja-channel-push! 1 (the-as time-frame gp-0))
|
|
(ja :group! eichar-ice-stance-ja)
|
|
)
|
|
)
|
|
(loop
|
|
(suspend)
|
|
(ja :num! (loop!))
|
|
)
|
|
)
|
|
:post target-post
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate target-ice-walk (target)
|
|
:event target-standard-event-handler
|
|
:enter (behavior ()
|
|
(set-time! (-> self state-time))
|
|
(set! (-> self control mod-surface) *walk-mods*)
|
|
)
|
|
:exit (behavior ()
|
|
(target-effect-exit)
|
|
(target-state-hook-exit)
|
|
)
|
|
:trans (behavior ()
|
|
((-> self state-hook))
|
|
(when (!= (-> self control ground-pat material) (pat-material ice))
|
|
(remove-exit)
|
|
(go target-walk)
|
|
)
|
|
(if (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 l1 r1)
|
|
)
|
|
(and (time-elapsed? (-> *TARGET-bank* wheel-timeout) (-> self control unknown-dword30))
|
|
(and (!= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0) (can-wheel?))
|
|
)
|
|
)
|
|
(go target-wheel)
|
|
)
|
|
(when (and (cpad-hold? (-> self control cpad number) l1 r1) (can-duck?))
|
|
(target-effect-exit)
|
|
(remove-exit)
|
|
(go target-duck-stance)
|
|
)
|
|
(when (and (not (move-legs?)) (let ((gp-0 (ja-group))
|
|
(f0-1 (ja-aframe-num 0))
|
|
)
|
|
(if (and (= gp-0 eichar-ice-skate-ja) (>= f0-1 30.0) (>= 35.0 f0-1))
|
|
#t
|
|
)
|
|
)
|
|
)
|
|
(target-effect-exit)
|
|
(remove-exit)
|
|
(go target-ice-stance)
|
|
)
|
|
(if (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)
|
|
)
|
|
(go target-jump (-> *TARGET-bank* jump-height-min) (-> *TARGET-bank* jump-height-max) (the-as surface #f))
|
|
)
|
|
(if (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 circle)
|
|
)
|
|
(can-feet?)
|
|
)
|
|
(go target-attack)
|
|
)
|
|
(if (can-hands? #t)
|
|
(go target-running-attack)
|
|
)
|
|
(slide-down-test)
|
|
(fall-test)
|
|
)
|
|
:code (behavior ()
|
|
(cond
|
|
((ja-group? eichar-walk-ja)
|
|
(let ((f30-0 (ja-aframe-num 0)))
|
|
(ja-channel-push! 1 (seconds 0.1))
|
|
(ja :group! eichar-ice-skate-ja :num! (identity f30-0))
|
|
)
|
|
)
|
|
((ja-group? eichar-ice-skate-ja)
|
|
)
|
|
(else
|
|
(let ((v1-18 (ja-group)))
|
|
(cond
|
|
((or (= v1-18 eichar-attack-punch-end-ja) (= v1-18 eichar-attack-punch-alt-end-ja))
|
|
(set! (-> self control bend-target) (-> self control bend-amount))
|
|
(set! (-> self control mod-surface) *walk-no-turn-mods*)
|
|
(while (< (ja-aframe-num 0) 42.0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
(set! (-> self control mod-surface) *walk-mods*)
|
|
(set! (-> self control bend-target) 0.0)
|
|
(ja-channel-push! 1 (seconds 0.1))
|
|
(ja :group! eichar-ice-skate-ja :num! (identity (ja-aframe 34.0 0)))
|
|
(while (!= (-> self skel root-channel 0) (-> self skel channel))
|
|
(suspend)
|
|
)
|
|
)
|
|
((ja-group? eichar-attack-punch-ja)
|
|
(set! (-> self control bend-target) (-> self control bend-amount))
|
|
(set! (-> self control mod-surface) *walk-no-turn-mods*)
|
|
(ja-no-eval :group! eichar-attack-punch-end-ja :num! (seek! (ja-aframe 42.0 0)) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek! (ja-aframe 42.0 0)))
|
|
)
|
|
(set! (-> self control mod-surface) *walk-mods*)
|
|
(set! (-> self control bend-target) 0.0)
|
|
(ja-channel-push! 1 (seconds 0.1))
|
|
(ja :group! eichar-ice-skate-ja :num! (identity (ja-aframe 34.0 0)))
|
|
(while (!= (-> self skel root-channel 0) (-> self skel channel))
|
|
(suspend)
|
|
)
|
|
)
|
|
(else
|
|
(ja-channel-push! 1 (seconds 0.05))
|
|
(ja :group! eichar-ice-skate-ja)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(loop
|
|
(suspend)
|
|
(let* ((s5-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> self control target-transv) 1.0))
|
|
(gp-6 (vector-float*!
|
|
(new 'stack-no-clear 'vector)
|
|
(-> self control transv-ctrl)
|
|
(/ 1.0 (vector-length (-> self control target-transv)))
|
|
)
|
|
)
|
|
(f0-18 (fmax -1.0 (fmin 1.0 (vector-dot s5-0 gp-6))))
|
|
)
|
|
(ja :num! (loop! (cond
|
|
((< f0-18 0.0)
|
|
(lerp-scale 2.0 1.0 f0-18 -1.0 0.5)
|
|
)
|
|
((< 0.5 f0-18)
|
|
(lerp-scale 1.0 0.75 f0-18 0.5 1.0)
|
|
)
|
|
(else
|
|
(lerp-scale 1.33 1.0 f0-18 0.0 0.5)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
:post target-post
|
|
)
|