jak-project/goal_src/jak3/engine/target/target-tube.gc
Brent Hickey b8f1ee5289
Some checks are pending
Build / 🖥️ Windows (push) Waiting to run
Build / 🐧 Linux (push) Waiting to run
Build / 🍎 MacOS (push) Waiting to run
Inform Pages Repo / Generate Documentation (push) Waiting to run
Lint / 📝 Formatting (push) Waiting to run
Lint / 📝 Required Checks (push) Waiting to run
Lint / 📝 Optional Checks (push) Waiting to run
[high fps] Increase input buffer for jak1 and jak3 (#3578)
Applying https://github.com/open-goal/jak-project/pull/3178 to jak1 and
jak3

This also fixes cloud speed in jak3

---------

Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
2024-07-15 02:56:10 +02:00

1162 lines
41 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: target-tube.gc
;; name in dgo: target-tube
;; dgos: PRECC, VOCA
;; DECOMP BEGINS
(define *tube-mods* (new 'static 'surface
:name 'tube
:turnv 21845.334
:turnvv 524288.0
:tiltv 5461.3335
:tiltvv 131072.0
:transv-max 1.0
:target-speed 32768.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
)
)
(define *tube-jump-mods* (new 'static 'surface
:name 'tube
:turnv 21845.334
:turnvv 262144.0
:tiltv 5461.3335
:tiltvv 131072.0
:transv-max 1.0
:seek0 0.8
:seek90 0.7
:seek180 0.8
: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
:mode 'air
:flags (surface-flag air)
)
)
(define *tube-hit-mods* (new 'static 'surface
:name 'tube
:turnv 21845.334
:turnvv 262144.0
:tiltv 32768.0
:tiltvv 131072.0
:transv-max 1.0
:target-speed 40960.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
:mode 'air
)
)
(let ((v1-3 (new 'static 'surface
:name '*tube-surface*
:turnv 1.0
:turnvv 1.0
:tiltv 1.0
:tiltvv 1.0
:transv-max 94208.0
:target-speed 1.0
:seek0 32768.0
:seek90 94208.0
:seek180 8192.0
:fric 0.98
:nonlin-fric-dist 4091904.0
:slip-factor 0.7
:slope-down-factor 81920.0
:slope-slip-angle 16384.0
:bend-speed 4.0
:alignv 1.0
:slope-up-traction 1.0
:align-speed 1.0
:flags (surface-flag no-turn-around turn-to-vel)
)
)
)
(set! *tube-surface* v1-3)
(set! (-> v1-3 mult-hook) (the-as (function surface surface surface int none) nothing))
(set! (-> v1-3 touch-hook) nothing)
(set! (-> v1-3 active-hook) nothing)
)
(deftype tube-info (basic)
((entity entity)
(tube handle)
(downhill vector :inline)
(centertube vector :inline)
(downtube vector :inline)
(sidetube vector :inline)
(foretube vector :inline)
(old-transv vector :inline)
(mod-x float)
(mod-y float)
(start-time time-frame)
(turn-anim-targ float)
(turn-anim-frame float)
(turn-anim-vel float)
(tube-sound-id sound-id)
(tube-sound-vol float)
(tube-sound-pitch float)
)
)
(deftype tube-bank (basic)
()
)
(define *TUBE-bank* (new 'static 'tube-bank))
(defbehavior tube-sounds target ()
(seek!
(-> self tube tube-sound-vol)
(if (logtest? (-> self control status) (collide-status on-surface))
1.0
0.0
)
(* 2.0 (seconds-per-frame))
)
(seek!
(-> self tube tube-sound-pitch)
(lerp-scale -0.15 0.15 (-> self control ctrl-xz-vel) 0.0 122880.0)
(* 0.5 (seconds-per-frame))
)
(let ((f1-2 (-> self tube tube-sound-vol))
(f0-9 (-> self tube tube-sound-pitch))
)
(sound-play-by-name
(static-sound-name "slide-loop")
(-> self tube tube-sound-id)
(the int (* 1024.0 f1-2))
(the int (* 1524.0 f0-9))
0
(sound-group)
(-> self control trans)
)
)
)
(defbehavior tube-thrust target ((arg0 float) (arg1 float))
(let ((s4-1 (vector-! (new 'stack-no-clear 'vector) (-> self tube foretube) (-> self control trans))))
(vector-flatten! s4-1 s4-1 (-> self tube downtube))
(vector-flatten! s4-1 s4-1 (-> self control local-normal))
(add-debug-vector
*display-target-marks*
(bucket-id debug-no-zbuf1)
(-> self control trans)
s4-1
(meters 0.00024414062)
(new 'static 'rgba :g #xff :a #x80)
)
(vector-matrix*! s4-1 s4-1 (-> self control w-R-c))
(vector-float*! s4-1 s4-1 2.0)
(if (< (-> self control current-surface target-speed) (vector-length s4-1))
(vector-normalize! s4-1 (-> self control current-surface target-speed))
)
(vector-v++! (-> self control transv-ctrl) s4-1)
(when (logtest? (-> self control status) (collide-status touch-wall))
(let ((s3-0 (-> self tube old-transv)))
(-> self control transv-ctrl y)
(vector-reflect! s4-1 s3-0 (-> self control wall-contact-poly-normal))
(let ((f0-5 (vector-dot (-> self tube sidetube) (-> self tube old-transv)))
(v1-28 (new-stack-vector0))
(f1-2 (vector-dot (-> self tube sidetube) s4-1))
)
0.0
(vector-! v1-28 s4-1 (vector-float*! v1-28 (-> self tube sidetube) f1-2))
(let* ((f2-2 (vector-length v1-28))
(f3-0 f2-2)
)
(cond
((< 0.0 f0-5)
(if (< f1-2 (- f0-5))
(set! f1-2 (- f0-5))
)
)
((< f0-5 0.0)
(if (< (- f0-5) f1-2)
(set! f1-2 (- f0-5))
)
)
)
(vector+! s4-1 (vector-float*! s4-1 (-> self tube sidetube) f1-2) (vector-float*! v1-28 v1-28 (/ f2-2 f3-0)))
)
)
(vector-flatten! s4-1 s4-1 (-> self control local-normal))
(let ((v1-30 (new-stack-vector0)))
(let ((f0-8 (vector-dot (-> self tube downtube) s4-1)))
0.0
(vector-! v1-30 s4-1 (vector-float*! v1-30 (-> self tube downtube) f0-8))
)
(let* ((f0-9 (vector-length v1-30))
(f1-4 f0-9)
(f2-4 (fmax (-> self control ctrl-xz-vel) (vector-dot s3-0 (-> self tube downtube))))
)
(vector+! s4-1 (vector-float*! s4-1 (-> self tube downtube) f2-4) (vector-float*! v1-30 v1-30 (/ f0-9 f1-4)))
)
)
)
(vector-matrix*! s4-1 s4-1 (-> self control w-R-c))
(let ((f0-11 (-> self control transv-ctrl y)))
(set! (-> self control transv-ctrl quad) (-> s4-1 quad))
(set! (-> self control transv-ctrl y) f0-11)
)
)
)
(let ((s4-2 (new 'stack-no-clear 'vector)))
(set! (-> s4-2 quad) (-> self tube downtube quad))
(let ((s3-1 (new 'stack-no-clear 'vector)))
(set! (-> s3-1 quad) (-> self tube sidetube quad))
(vector-flatten! s3-1 s3-1 (-> self control local-normal))
(add-debug-vector
*display-target-marks*
(bucket-id debug-no-zbuf1)
(-> self control trans)
s3-1
(meters 2)
(new 'static 'rgba :r #xff :g #xff :a #x80)
)
(vector-matrix*! s3-1 s3-1 (-> self control w-R-c))
(vector-normalize! s3-1 (* arg0 (-> self control current-surface seek90)))
(vector-v++! (-> self control transv-ctrl) s3-1)
)
(vector-flatten! s4-2 s4-2 (-> self control local-normal))
(add-debug-vector
*display-target-marks*
(bucket-id debug-no-zbuf1)
(-> self control trans)
s4-2
(meters 2)
(new 'static 'rgba :r #xff :g #x80 :b #x40 :a #x80)
)
(vector-matrix*! s4-2 s4-2 (-> self control w-R-c))
(vector-normalize!
s4-2
(* (-> self control current-surface slope-down-factor) (fmax 0.2 (-> self control surface-angle)))
)
(vector-v++! (-> self control transv-ctrl) s4-2)
)
(let* ((f1-8 (-> self control current-surface fric))
(f0-17 (- 1.0 (* 60.0 (seconds-per-frame) (- 1.0 f1-8))))
(f0-19 (* 0.5 (+ 1.0 f0-17)))
)
(set! (-> self control transv-ctrl x) (* (-> self control transv-ctrl x) f0-19))
(set! (-> self control transv-ctrl z) (* (-> self control transv-ctrl z) f0-19))
)
(let ((f0-22
(- (-> self control current-surface transv-max) (if (< arg1 0.0)
(* arg1 (-> self control current-surface seek0))
(* arg1 (-> self control current-surface seek180))
)
)
)
(v1-78 (-> self control transv-ctrl))
)
(if (>= (sqrtf (+ (* (-> v1-78 x) (-> v1-78 x)) (* (-> v1-78 z) (-> v1-78 z)))) f0-22)
(vector-xz-normalize! (-> self control transv-ctrl) f0-22)
)
)
(let ((gp-1 (new-stack-vector0)))
(vector-matrix*! gp-1 (-> self control transv-ctrl) (-> self control c-R-w))
(vector-float*! gp-1 gp-1 0.5)
(add-debug-vector
*display-target-marks*
(bucket-id debug-no-zbuf1)
(-> self control trans)
gp-1
(meters 0.00024414062)
(new 'static 'rgba :g #xff :b #xff :a #x80)
)
(vector+! gp-1 gp-1 (-> self control trans))
(add-debug-text-sphere
*display-target-marks*
(bucket-id debug-no-zbuf1)
gp-1
(meters 0.2)
"ltransv"
(new 'static 'rgba :g #xff :b #xff :a #x80)
)
(vector-matrix*! gp-1 (new 'static 'vector :z 40960.0 :w 1.0) (-> self control c-R-w))
(vector-float*! gp-1 gp-1 0.5)
(vector+! gp-1 gp-1 (-> self control trans))
(add-debug-text-sphere
*display-target-marks*
(bucket-id debug-no-zbuf1)
gp-1
(meters 0.2)
"nose"
(new 'static 'rgba :r #xff :g #xff :a #x80)
)
)
(tube-sounds)
0
(none)
)
(defbehavior target-tube-post target ()
(let ((f30-0 (-> self clock clock-ratio)))
(let ((gp-1 (max 1 (the int (-> self clock time-adjust-ratio)))))
(update-rates! (-> self clock) (/ f30-0 (the float gp-1)))
(while (nonzero? gp-1)
(+! gp-1 -1)
(set! (-> self tube old-transv quad) (-> self control transv quad))
(flag-setup)
(build-conversions (-> self control transv))
(if (logtest? (-> self target-flags) (target-flags tinvuln1))
(set! (-> self control current-surface turnv) (* 3.0 (-> self control current-surface turnv)))
)
(forward-up-nopitch->quaternion
(-> self control dir-targ)
(vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self control dir-targ))
(-> self control local-normal)
)
(do-rotations1)
(send-event
(handle->process (-> self tube tube))
'update
(-> self tube centertube)
(-> self tube downtube)
(-> self tube sidetube)
(-> self tube foretube)
)
(vector-flatten!
(-> self tube downhill)
(vector-negate! (new-stack-vector0) (-> self control dynam gravity-normal))
(-> self control local-normal)
)
(vector-normalize! (-> self tube downhill) 1.0)
(set! (-> self control turn-to-magnitude) 1.0)
(let ((f28-0 (analog-input (the-as int (-> self control cpad leftx)) 128.0 32.0 110.0 1.0)))
(set! (-> self tube mod-x) f28-0)
(let ((f0-8 (analog-input (the-as int (-> self control cpad lefty)) 128.0 32.0 110.0 1.0)))
(set! (-> self tube mod-y) f0-8)
(tube-thrust f28-0 f0-8)
)
)
(add-gravity)
(do-rotations2)
(reverse-conversions (-> self control transv))
(set! (-> self control reaction) target-collision-reaction)
(let ((a2-5 (new 'stack-no-clear 'collide-query)))
(let ((v1-52 (-> self control)))
(set! (-> a2-5 collide-with) (-> v1-52 root-prim prim-core collide-with))
(set! (-> a2-5 ignore-process0) self)
(set! (-> a2-5 ignore-process1) #f)
(set! (-> a2-5 ignore-pat) (-> v1-52 pat-ignore-mask))
)
(set! (-> a2-5 action-mask) (collide-action solid))
(fill-cache-integrate-and-collide (-> self control) (-> self control transv) a2-5 (meters 1))
)
(bend-gravity)
(post-flag-setup)
(set! (-> self control surf) *tube-surface*)
)
)
(update-rates! (-> self clock) f30-0)
)
(ja-post)
(joint-points)
(do-target-gspot)
(target-powerup-process)
(none)
)
(defstate target-tube (target)
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(cond
((and (= message 'query) (= (-> block param 0) 'mode))
'tube
)
(else
(let ((v1-3 message))
(cond
((= v1-3 'change-mode)
(case (-> block param 0)
(('grab)
(when (not (focus-test? self dead))
(if (-> block param 1)
(logior! (-> self focus-status) (focus-status grabbed))
)
#t
)
)
)
)
((= v1-3 'end-mode)
(case (-> block param 0)
(('grab)
(when (focus-test? self grabbed)
(logclear! (-> self focus-status) (focus-status grabbed))
#t
)
)
(('tube)
(if (focus-test? self indax)
(go
target-indax-jump
(-> *TARGET-bank* tube-jump-height-min)
(-> *TARGET-bank* tube-jump-height-max)
(the-as surface #f)
)
(go
target-jump
(-> *TARGET-bank* tube-jump-height-min)
(-> *TARGET-bank* tube-jump-height-max)
(the-as surface #f)
)
)
)
)
)
((= v1-3 'touched)
(send-event proc 'attack (-> block param 0) 'tube 0 0)
#f
)
((or (= v1-3 'attack) (= v1-3 'attack-or-shove) (= v1-3 'attack-invinc))
(target-attacked
'attack-or-shove
(the-as attack-info (-> block param 1))
proc
(the-as touching-shapes-entry (-> block param 0))
target-tube-hit
)
)
((-> self major-mode-event-hook)
((-> self major-mode-event-hook) proc argc message block)
)
(else
(target-generic-event-handler proc argc message block)
)
)
)
)
)
)
:exit (behavior ()
(when (not (and (-> self next-state)
(let ((v1-3 (-> self next-state name)))
(or (= v1-3 'target-tube-walk) (= v1-3 'target-tube-jump) (= v1-3 'target-tube-hit))
)
)
)
(logclear! (-> self focus-status) (focus-status tube))
(set! (-> self control mod-surface) *walk-mods*)
(set! (-> self control dynam gravity-max) (-> self control standard-dynamics gravity-max))
(set! (-> self control dynam gravity-length) (-> self control standard-dynamics gravity-length))
(target-collide-set! 'normal 0.0)
(set! (-> self control reaction) target-collision-reaction)
(remove-setting! 'slave-options)
(sound-stop (-> self tube tube-sound-id))
(set! (-> self tube tube-sound-id) (new 'static 'sound-id))
(send-event (handle->process (-> self tube tube)) 'end-mode)
(when (focus-test? self indax)
(remove-setting! 'string-min-length)
(remove-setting! 'string-max-length)
(remove-setting! 'string-min-height)
(remove-setting! 'string-max-height)
(remove-setting! 'fov)
)
(target-exit)
(let ((t9-10 (-> self sub-mode-exit-hook)))
(if t9-10
(t9-10)
)
)
)
(let ((t9-11 (-> self major-mode-exit-hook)))
(if t9-11
(t9-11)
)
)
)
:code nothing
:post (behavior ()
(target-tube-post)
)
)
(defstate target-tube-start (target)
:parent target-tube
:code (behavior ((arg0 handle))
(set-setting! 'slave-options 'set 0.0 (cam-slave-options BIKE_MODE))
(target-exit)
(set! (-> self control surf) *tube-surface*)
(if (zero? (-> self tube))
(set! (-> self tube) (new 'process 'tube-info))
)
(set! (-> self tube tube) arg0)
(set! (-> self tube entity) #f)
(let ((a0-4 (handle->process arg0)))
(if a0-4
(set! (-> self tube entity) (-> a0-4 entity))
)
)
(set-time! (-> self tube start-time))
(set! (-> self tube tube-sound-id) (new-sound-id))
(set! (-> self tube tube-sound-vol) 0.0)
(set! (-> self tube tube-sound-pitch) 0.0)
(target-collide-set! 'tube 0.0)
(set! (-> self control transv quad) (the-as uint128 0))
(set! (-> self control ctrl-xz-vel) 0.0)
(logior! (-> self focus-status) (focus-status tube))
(when (focus-test? self indax)
(set-setting! 'string-min-length 'abs (meters 4) 0)
(set-setting! 'string-max-length 'abs (meters 4) 0)
(set-setting! 'string-min-height 'abs (meters 6) 0)
(set-setting! 'string-max-height 'abs (meters 6) 0)
(set-setting! 'fov 'abs (degrees 95.0) 0)
)
(remove-exit)
(cond
((< (the-as
float
(send-event
(handle->process (-> self tube tube))
'update
(-> self tube centertube)
(-> self tube downtube)
(-> self tube sidetube)
(-> self tube foretube)
)
)
0.5
)
(vector-normalize-copy! (-> self control transv) (-> self tube downtube) 40960.0)
(forward-up-nopitch->quaternion
(-> self control dir-targ)
(vector-normalize-copy! (new 'stack-no-clear 'vector) (-> self control transv) 1.0)
(-> self control dynam gravity-normal)
)
(go target-tube-jump (-> *TARGET-bank* tube-jump-height-min) (-> *TARGET-bank* tube-jump-height-max))
)
(else
(go target-tube-walk)
)
)
)
:post target-post
)
(defbehavior target-tube-turn-anim target ()
(let ((f30-0 (-> self clock clock-ratio)))
(let ((gp-1 (max 1 (the int (-> self clock time-adjust-ratio)))))
(update-rates! (-> self clock) (/ f30-0 (the float gp-1)))
(while (nonzero? gp-1)
(+! gp-1 -1)
(set! (-> self tube turn-anim-targ) (fmax -20.0 (fmin 20.0 (-> self tube turn-anim-targ))))
(or (not (>= (* (-> self tube turn-anim-targ) (-> self tube turn-anim-frame)) 0.0))
(< (fabs (-> self tube turn-anim-frame)) (fabs (-> self tube turn-anim-targ)))
)
(+! (-> self tube turn-anim-vel)
(* (- (-> self tube turn-anim-targ) (-> self tube turn-anim-frame))
(lerp-scale
20.0
(if (< (fabs (-> self tube turn-anim-frame)) (fabs (-> self tube turn-anim-targ)))
30.0
60.0
)
(-> self control ctrl-xz-vel)
0.0
36864.0
)
(seconds-per-frame)
)
)
(set! (-> self tube turn-anim-vel)
(fmax
-100.0
(fmin 100.0 (* (-> self tube turn-anim-vel) (lerp-scale 0.96 0.9 (-> self control ctrl-xz-vel) 0.0 36864.0)))
)
)
(+! (-> self tube turn-anim-frame) (* (-> self tube turn-anim-vel) (seconds-per-frame)))
(set! (-> self tube turn-anim-frame) (fmax -20.0 (fmin 20.0 (-> self tube turn-anim-frame))))
(cond
((and (>= (-> self tube turn-anim-frame) 20.0) (>= (-> self tube turn-anim-vel) 0.0))
(set! (-> self tube turn-anim-vel) 0.0)
)
((and (>= -20.0 (-> self tube turn-anim-frame)) (>= 0.0 (-> self tube turn-anim-vel)))
(set! (-> self tube turn-anim-vel) 0.0)
)
)
)
)
(update-rates! (-> self clock) f30-0)
)
(let ((a1-4 (if (focus-test? self indax)
jakb-lightjak-shield-end-ja
jakb-tube-turn-ja
)
)
)
(ja :group! a1-4
:num! (identity (ja-aframe
(+ (-> self tube turn-anim-frame)
(* 5.0 (sin (* 145.63556 (the float (- (current-time) (-> self state-time))))))
)
0
)
)
)
)
0
(none)
)
(defstate target-tube-walk (target)
:parent target-tube
:enter (behavior ()
(set! (-> self control mod-surface) *tube-mods*)
(set! (-> self control surf) *tube-surface*)
)
:trans (behavior ()
;; og:preserve-this - High FPS Fix
(if (and (recently-pressed? x)
(can-jump? #f)
)
(go target-tube-jump (-> *TARGET-bank* tube-jump-height-min) (-> *TARGET-bank* tube-jump-height-max))
)
(when (and (not (logtest? (-> self control status) (collide-status on-surface)))
(time-elapsed? (-> self control last-time-on-surface) (seconds 0.2))
(and (< 4096.0 (target-height-above-ground)) (!= (-> self control gspot-pat-surfce event) 7))
)
(set! (-> self control unknown-float0000) (+ -24576.0 (-> self tube centertube y)))
(if (focus-test? self indax)
(go target-indax-falling 'tube)
(go target-falling 'tube)
)
)
)
:code (behavior ()
(cond
((and (not (focus-test? self indax))
(let ((v1-5 (ja-group)))
(and v1-5 (or (= v1-5 jakb-jump-forward-ja) (= v1-5 jakb-duck-high-jump-ja) (= v1-5 jakb-jump-loop-ja)))
)
)
(ja-channel-push! 1 (seconds 0.04))
(ja-no-eval :group! jakb-tube-jump-land-ja :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
(set! (-> self tube turn-anim-frame) 0.0)
)
((and (focus-test? self indax)
(let ((v1-39 (ja-group)))
(and v1-39 (or (= v1-39 (-> self draw art-group data 476)) (= v1-39 (-> self draw art-group data 477))))
)
)
(ja-channel-push! 1 (seconds 0.04))
(ja-no-eval :group! jakb-lightjak-dummy21-ja :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
(set! (-> self tube turn-anim-frame) 0.0)
)
(else
(ja-channel-push! 1 (seconds 0.04))
)
)
(until #f
(set! (-> self tube turn-anim-targ) (* 20.0 (-> self tube mod-x)))
(target-tube-turn-anim)
(suspend)
)
#f
)
)
(defstate target-tube-jump (target)
:parent target-tube
:enter (behavior ((arg0 float) (arg1 float))
(set-time! (-> self state-time))
(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) *tube-jump-mods*)
(set! (-> self control unknown-float0000) (+ -24576.0 (-> self tube centertube y)))
)
:trans (behavior ()
(if (logtest? (-> self control status) (collide-status on-surface))
(go target-tube-walk)
)
(mod-var-jump #t #t (cpad-hold? (-> self control cpad number) x) (-> self control transv))
(seek!
(-> self control unknown-float35)
(fmax 0.0 (fmin 1.0 (* 0.00012207031 (+ -2048.0 (-> self control ctrl-xz-vel)))))
(seconds-per-frame)
)
(if (and (< (-> self control trans y) (-> self control unknown-float0000))
(and (< (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) 0.0)
(not (and (= *cheat-mode* 'debug) (cpad-hold? (-> self control cpad number) r2)))
(focus-test? self indax)
)
)
(send-event
self
'attack-invinc
#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)
(mode 'endlessfall)
)
)
)
)
)
:code (behavior ((arg0 float) (arg1 float))
(let ((f28-0 35.0)
(f30-0 1.0)
)
(ja-channel-push! 1 (seconds 0.05))
(set! f28-0 (cond
((focus-test? self indax)
(sound-play "dax-effort")
(ja :group! (-> self draw art-group data 476))
10.0
)
((= (-> self ext-anim) (target-anim default))
(ja :group! jakb-duck-high-jump-ja :num! (identity (ja-aframe 16.0 0)))
f28-0
)
(else
(ja :group! jakb-jump-forward-ja)
10.0
)
)
)
(until (ja-done? 0)
(let* ((f24-0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))
(f26-0 (- f28-0 (ja-aframe-num 0)))
(f0-8 (fmin (fmin 3.0 f26-0) (/ (* 5.0 f26-0) (the float (time-to-apex f24-0 -245760.0)))))
(a0-16 (-> self skel root-channel 0))
)
(set! (-> a0-16 param 0) (the float (+ (-> a0-16 frame-group frames num-frames) -1)))
(let ((v1-35 (and (< 0.0 f24-0) (< 0.0 f26-0))))
(set! (-> a0-16 param 1) (if v1-35
f0-8
f30-0
)
)
)
(joint-control-channel-group-eval! a0-16 (the-as art-joint-anim #f) num-func-seek!)
)
(suspend)
)
)
(if (focus-test? self indax)
(ja-no-eval :group! (-> self draw art-group data 477) :num! (loop!) :frame-num 0.0)
(ja-no-eval :group! jakb-jump-loop-ja :num! (loop!) :frame-num 0.0)
)
(until #f
(suspend)
(ja :num! (loop!))
)
#f
)
)
(defstate target-tube-hit (target)
:parent target-tube
:enter (behavior ((arg0 symbol) (arg1 attack-info))
(send-event
(handle->process (-> self tube tube))
'update
(-> self tube centertube)
(-> self tube downtube)
(-> self tube sidetube)
(-> self tube foretube)
)
)
:exit (behavior ()
(if (not (and (-> self next-state) (= (-> self next-state name) 'target-tube-death)))
(logclear! (-> self focus-status) (focus-status dead hit))
)
(logclear! (-> self focus-status) (focus-status grabbed in-head))
(logclear! (-> self target-flags) (target-flags tf1 tf5))
(let ((v1-12 (-> self prev-state parent)))
(when v1-12
(let ((t9-0 (-> v1-12 exit)))
(if t9-0
(t9-0)
)
)
)
)
)
:code (behavior ((arg0 symbol) (arg1 attack-info))
(let ((gp-0 (-> self attack-info)))
(set-time! (-> self state-time))
(logior! (-> self focus-status) (focus-status hit))
(set-time! (-> self game hit-time))
(when (not (logtest? (-> arg1 mask) (attack-mask vector)))
(vector-!
(-> arg1 vector)
(vector+float*! (new 'stack-no-clear 'vector) (-> self tube foretube) (-> self tube downtube) 20480.0)
(-> self control trans)
)
(let ((v1-11 (new-stack-vector0))
(f0-2 (vector-dot (-> self control wall-contact-poly-normal) (-> arg1 vector)))
)
0.0
(vector-! v1-11 (-> arg1 vector) (vector-float*! v1-11 (-> self control wall-contact-poly-normal) f0-2))
(let* ((f1-2 (vector-length v1-11))
(f2-0 f1-2)
)
(if (< f0-2 0.0)
(set! f0-2 (* 0.5 f0-2))
)
(vector+!
(-> arg1 vector)
(vector-float*! (-> arg1 vector) (-> self control wall-contact-poly-normal) f0-2)
(vector-float*! v1-11 v1-11 (/ f1-2 f2-0))
)
)
)
(logior! (-> arg1 mask) (attack-mask vector))
)
(when (and (logtest? (-> arg1 mask) (attack-mask mode))
(= (-> arg1 mode) 'darkeco)
(not (logtest? (-> arg1 mask) (attack-mask shove-up)))
)
(set! (-> arg1 shove-up) 12288.0)
(logior! (-> arg1 mask) (attack-mask shove-up))
)
(let ((v1-23 gp-0))
(set! (-> v1-23 attacker) (the-as handle #f))
(set! (-> v1-23 mode) 'generic)
(set! (-> v1-23 shove-back) 6144.0)
(set! (-> v1-23 shove-up) 12288.0)
(set! (-> v1-23 angle) #f)
(set! (-> v1-23 trans quad) (-> self control trans quad))
(set! (-> v1-23 control) 0.0)
(set! (-> v1-23 invinc-time) (-> *TARGET-bank* hit-invulnerable-timeout))
(set! (-> v1-23 damage) (-> *FACT-bank* health-default-inc))
)
(combine! gp-0 arg1 self)
(when (= arg0 'attack)
(send-event (handle->process (-> self notify)) 'notify 'hit (-> gp-0 mode))
(logior! (-> self focus-status) (focus-status hit))
(set-time! (-> self game hit-time))
(case (-> gp-0 mode)
(('bot)
(pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f))
(if (= (-> self game mode) 'play)
(go target-death (-> gp-0 mode))
)
)
(('endlessfall)
(when (= (-> self game mode) 'play)
(pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f))
(if (focus-test? self indax)
(go target-indax-death (-> gp-0 mode))
(go target-death (-> gp-0 mode))
)
)
)
(('lava 'melt)
(when (= (-> self game mode) 'play)
(pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f))
(go target-death (-> gp-0 mode))
)
)
(else
(pickup-collectable! (-> self fact) (pickup-type health) (- (-> gp-0 damage)) (the-as handle #f))
)
)
(target-hit-effect gp-0)
)
(set! (-> self control mod-surface) *smack-mods*)
(target-hit-setup-anim gp-0)
(target-hit-move gp-0 (target-hit-orient gp-0 (-> gp-0 vector)) target-falling-anim-trans 1.0)
(let ((v1-69 (new-stack-vector0))
(f0-12 (vector-dot (-> self tube downtube) (-> self control transv)))
)
0.0
(vector-! v1-69 (-> self control transv) (vector-float*! v1-69 (-> self tube downtube) f0-12))
(let ((f1-5 (vector-length v1-69))
(f2-2 (fmax 40960.0 f0-12))
(f0-13 0.0)
)
(vector+!
(-> self control transv)
(vector-float*! (-> self control transv) (-> self tube downtube) f2-2)
(vector-float*! v1-69 v1-69 (/ f0-13 f1-5))
)
)
)
(let ((s5-2 forward-up-nopitch->quaternion)
(s4-1 (-> self control dir-targ))
(t9-14 vector-normalize!)
(a0-71 (new-stack-vector0))
)
(set! (-> a0-71 quad) (-> self control transv quad))
(s5-2 s4-1 (t9-14 a0-71 1.0) (vector-y-quaternion! (new-stack-vector0) (-> self control dir-targ)))
)
(if (and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health)))
(go target-tube-death (-> gp-0 mode))
)
)
(go target-tube-walk)
)
:post target-post
)
(defstate target-tube-death (target)
:parent target-tube
:event (-> target-death event)
:exit (behavior ()
(logclear! (-> self focus-status) (focus-status dead hit))
(target-exit)
(remove-setting! 'process-mask)
(apply-settings *setting-control*)
(let ((v1-7 (-> self prev-state parent)))
(when v1-7
(let ((t9-3 (-> v1-7 exit)))
(if t9-3
(t9-3)
)
)
)
)
)
:code (behavior ((arg0 symbol))
(local-vars (v1-53 symbol))
(set! (-> self neck flex-blend) 0.0)
(target-timed-invulnerable-off self 0)
(add-setting! 'process-mask 'set 0.0 (process-mask enemy platform projectile death))
(apply-settings *setting-control*)
(set! (-> self control transv quad) (the-as uint128 0))
(let ((s5-0 (-> self child)))
(while s5-0
(send-event (ppointer->process s5-0) 'notice 'die)
(set! s5-0 (-> s5-0 0 brother))
)
)
(set! (-> self death-resetter continue) #f)
(set! (-> self death-resetter node) (game-task-node none))
(set! (-> self death-resetter reset-mode) 'life)
(set! (-> self death-resetter execute) #f)
(set! (-> self control mod-surface) *neutral-mods*)
(ja-channel-push! 1 (seconds 0.1))
(ja-no-eval :group! jakb-deatha-ja :num! (seek! (ja-aframe 134.0 0)) :frame-num 0.0)
(until (ja-done? 0)
(compute-alignment! (-> self align))
(let ((gp-2 (new 'stack-no-clear 'vector)))
(when (not (logtest? (-> self align flags) (align-flags disabled)))
(vector-matrix*! gp-2 (the-as vector (-> self align delta)) (-> self control c-R-w))
(vector-float*! (-> self control transv) gp-2 (-> self clock frames-per-second))
)
)
(suspend)
(ja :num! (seek! (ja-aframe 134.0 0)))
)
(set! (-> self control transv quad) (the-as uint128 0))
(initialize! (-> self game) 'life (the-as game-save #f) (the-as string #f) (the-as resetter-spec #f))
(set-time! (-> self state-time))
(until v1-53
(suspend)
(set! v1-53 (and (time-elapsed? (-> self state-time) (seconds 1)) (not (movie?))))
)
(go target-tube-walk)
)
:post target-no-stick-post
)
(deftype slide-control (process-drawable)
((target handle)
(pos float)
(trans vector :inline)
(rot vector :inline)
(side vector :inline)
)
(:state-methods
slide-control-watch
slide-control-ride
)
)
(defun distance-from-tangent ((arg0 path-control) (arg1 float) (arg2 vector) (arg3 vector) (arg4 vector) (arg5 vector))
(get-point-in-path! arg0 arg2 arg1 'interp)
(displacement-between-two-points-normalized! arg0 arg3 arg1)
(set! (-> arg2 y) (-> arg5 y))
(set! (-> arg3 y) 0.0)
(let ((s2-1 (new 'stack-no-clear 'vector)))
(vector-rotate-y! arg4 arg3 -16384.0)
(set! (-> arg4 y) 0.0)
(let* ((a2-5 (vector+! (new 'stack-no-clear 'vector) arg2 arg4))
(f0-3 (vector-line-distance-point! arg5 arg2 a2-5 s2-1))
)
(if (< 0.0 (vector-dot arg3 (vector-! (new 'stack-no-clear 'vector) arg5 s2-1)))
(set! f0-3 (- f0-3))
)
f0-3
)
)
)
(defbehavior find-target-point slide-control ((arg0 vector))
(local-vars (f0-2 float))
(let* ((s4-0 (new 'stack-no-clear 'vector))
(s5-0 (new 'stack-no-clear 'vector))
(gp-0 (new 'stack-no-clear 'vector))
(f28-0 (+ -0.1 (-> self pos)))
(f26-0 (distance-from-tangent (-> self path) f28-0 s4-0 s5-0 gp-0 arg0))
)
0.0
(let ((f30-0 f28-0))
(until (or (and (< f26-0 f0-2) (>= f0-2 0.0)) (< (get-num-segments (-> self path)) f28-0))
(set! f0-2 (distance-from-tangent (-> self path) f28-0 s4-0 s5-0 gp-0 arg0))
(when (or (>= f26-0 f0-2) (< f26-0 0.0))
(set! f26-0 f0-2)
(set! f30-0 f28-0)
)
(set! f28-0 (+ 0.01 f28-0))
)
(distance-from-tangent (-> self path) f30-0 s4-0 s5-0 gp-0 arg0)
(set! (-> self trans quad) (-> s4-0 quad))
(set! (-> self rot quad) (-> s5-0 quad))
(set! (-> self side quad) (-> gp-0 quad))
(set! (-> self pos) f30-0)
)
)
(-> self pos)
)
(defstate slide-control-watch (slide-control)
:virtual #t
:enter (behavior ()
(get-point-in-path! (-> self path) (-> self trans) 0.2 'interp)
(get-point-in-path! (-> self path) (-> self root trans) 0.2 'interp)
(displacement-between-two-points-normalized! (-> self path) (-> self rot) 0.2)
(set! (-> self pos) 0.2)
)
:trans (behavior ()
(if (and (and *target*
(and (>= 81920.0 (vector-vector-distance (-> self root trans) (-> *target* control trans)))
(not (logtest? (focus-status teleporting) (-> *target* focus-status)))
)
)
(< 0.0
(vector-dot
(vector-! (new 'stack-no-clear 'vector) (-> *target* control trans) (-> self trans))
(-> self rot)
)
)
(and (not (focus-test? *target* in-air))
(< (-> *target* control trans y) (+ 12288.0 (-> self root trans y)))
(send-event *target* 'change-mode 'tube self)
)
)
(go-virtual slide-control-ride)
)
)
:code sleep-code
)
(defstate slide-control-ride (slide-control)
:virtual #t
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(case message
(('end-mode)
(go-virtual slide-control-watch)
)
(('update)
(let* ((s4-0 proc)
(gp-0 (if (type? s4-0 process-drawable)
s4-0
)
)
)
(if gp-0
(find-target-point (-> (the-as process-drawable gp-0) root trans))
)
(set! (-> (the-as vector (-> block param 0)) quad) (-> self trans quad))
(set! (-> (the-as vector (-> block param 1)) quad) (-> self rot quad))
(set! (-> (the-as vector (-> block param 2)) quad) (-> self side quad))
(get-point-in-path! (-> self path) (the-as vector (-> block param 3)) (+ 0.2 (-> self pos)) 'interp)
(if (>= (-> self pos) (+ -0.2 (get-num-segments (-> self path))))
(send-event gp-0 'end-mode 'tube)
)
)
(-> self pos)
)
)
)
:enter (behavior ()
(set! (-> self pos) 0.0)
(set! (-> self target) (process->handle *target*))
(process-entity-status! self (entity-perm-status no-kill) #t)
)
:exit (behavior ()
(set! (-> self target) (the-as handle #f))
(process-entity-status! self (entity-perm-status no-kill) #f)
)
:trans (behavior ()
(let ((gp-0 (handle->process (-> self target))))
(cond
((if (type? gp-0 process-drawable)
gp-0
)
)
(else
(go-virtual slide-control-watch)
)
)
)
)
:code sleep-code
)
(defmethod init-from-entity! ((this slide-control) (arg0 entity-actor))
(set! (-> this root) (new 'process 'trsqv))
(process-drawable-from-entity! this arg0)
(logclear! (-> this mask) (process-mask actor-pause))
(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 target) (the-as handle #f))
(go (method-of-object this slide-control-watch))
)