jak-project/goal_src/jak2/engine/target/gun/gun-util.gc

986 lines
36 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: gun-util.gc
;; name in dgo: gun-util
;; dgos: ENGINE, GAME
;; DECOMP BEGINS
(deftype gun-eject (projectile-bounce)
()
)
(defmethod init-proj-settings! ((this gun-eject))
"Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc"
(initialize-skeleton
this
(the-as skeleton-group (art-group-get-by-name *level* "skel-gun" (the-as (pointer uint32) #f)))
(the-as pair 0)
)
(ja-channel-set! 1)
(let ((v1-5 (-> this skel root-channel 0)))
(set! (-> v1-5 frame-group) (-> (the-as gun (-> this parent 0)) skel channel 0 frame-group))
)
(let ((t9-3 (method-of-type projectile-bounce init-proj-settings!)))
(t9-3 this)
)
(quaternion-copy! (-> this root quat) (-> (the-as gun (-> this parent 0)) root quat))
(set! (-> this timeout) (seconds 4))
(set! (-> (the-as collide-shape (-> this root)) root-prim local-sphere w) 3276.8)
(logclear! (-> this mask) (process-mask projectile))
0
(none)
)
(deftype gun-mag-yellow (projectile-bounce)
()
)
(defmethod init-proj-settings! ((this gun-mag-yellow))
"Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc"
(initialize-skeleton
this
(the-as skeleton-group (art-group-get-by-name *level* "skel-ammo-yellow" (the-as (pointer uint32) #f)))
(the-as pair 0)
)
(let ((t9-2 (method-of-type projectile-bounce init-proj-settings!)))
(t9-2 this)
)
(set! (-> this timeout) (seconds 4))
(sound-play "dark-shot-fire")
0
(none)
)
(deftype gun-mag-red (projectile-bounce)
()
)
(defmethod init-proj-settings! ((this gun-mag-red))
"Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc"
(initialize-skeleton
this
(the-as skeleton-group (art-group-get-by-name *level* "skel-ammo-red" (the-as (pointer uint32) #f)))
(the-as pair 0)
)
(let ((t9-2 (method-of-type projectile-bounce init-proj-settings!)))
(t9-2 this)
)
(set! (-> this timeout) (seconds 4))
(sound-play "dark-shot-fire")
0
(none)
)
(deftype gun-mag-blue (projectile-bounce)
()
)
(defmethod init-proj-settings! ((this gun-mag-blue))
"Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc"
(initialize-skeleton
this
(the-as skeleton-group (art-group-get-by-name *level* "skel-ammo-blue" (the-as (pointer uint32) #f)))
(the-as pair 0)
)
(let ((t9-2 (method-of-type projectile-bounce init-proj-settings!)))
(t9-2 this)
)
(set! (-> this timeout) (seconds 4))
(sound-play "dark-shot-fire")
0
(none)
)
(deftype gun-mag-dark (projectile-bounce)
()
)
(defmethod init-proj-settings! ((this gun-mag-dark))
"Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc"
(initialize-skeleton
this
(the-as skeleton-group (art-group-get-by-name *level* "skel-ammo-dark" (the-as (pointer uint32) #f)))
(the-as pair 0)
)
(let ((t9-2 (method-of-type projectile-bounce init-proj-settings!)))
(t9-2 this)
)
(set! (-> this timeout) (seconds 4))
(sound-play "dark-shot-fire")
0
(none)
)
(deftype beam-info (structure)
((y-scale float)
)
)
(define *beam-info* (new 'static 'beam-info))
(defun birth-func-setup-beam ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo))
(local-vars (a0-2 float) (a0-3 float))
(rlet ((vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
)
(init-vf0-vector)
(let ((a0-1 arg2)
(v1-0 *particle-quat*)
)
(cond
((< (-> v1-0 w) 0.0)
(.lvf vf1 (&-> a0-1 conerot quad))
(.lvf vf2 (&-> v1-0 quad))
(.sub.vf vf1 vf0 vf2 :mask #b111)
(.svf (&-> a0-1 conerot quad) vf1)
(.mov a0-2 vf1)
)
(else
(.lvf vf1 (&-> a0-1 conerot quad))
(.lvf vf2 (&-> v1-0 quad))
(.add.vf vf1 vf0 vf2 :mask #b111)
(.svf (&-> a0-1 conerot quad) vf1)
(.mov a0-3 vf1)
)
)
)
(set! (-> arg2 conerot w) (-> *beam-info* y-scale))
0
(none)
)
)
(defun birth-func-laser-pointer ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo))
(local-vars (a0-2 float) (a0-3 float))
(rlet ((vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
)
(init-vf0-vector)
(let ((a0-1 arg2)
(v1-0 *particle-quat*)
)
(cond
((< (-> v1-0 w) 0.0)
(.lvf vf1 (&-> a0-1 conerot quad))
(.lvf vf2 (&-> v1-0 quad))
(.sub.vf vf1 vf0 vf2 :mask #b111)
(.svf (&-> a0-1 conerot quad) vf1)
(.mov a0-2 vf1)
)
(else
(.lvf vf1 (&-> a0-1 conerot quad))
(.lvf vf2 (&-> v1-0 quad))
(.add.vf vf1 vf0 vf2 :mask #b111)
(.svf (&-> a0-1 conerot quad) vf1)
(.mov a0-3 vf1)
)
)
)
(set! (-> arg2 conerot w) (-> *beam-info* y-scale))
(set! (-> arg1 user1-int16) (the-as uint (logand (/ (-> *display* base-clock frame-counter) 10) 31)))
0
(none)
)
)
(defun draw-beam ((arg0 sparticle-launcher) (arg1 vector) (arg2 vector) (arg3 symbol) (arg4 symbol))
(let ((a1-2 (vector+! (new 'stack-no-clear 'vector) arg1 arg2))
(s3-0 (new 'stack-no-clear 'vector))
)
(set! (-> s3-0 quad) (-> arg2 quad))
(when (or (not arg4) (line-in-view-frustum? arg1 a1-2))
(let ((s5-0 (new 'stack-no-clear 'vector)))
(let ((v1-6 (get-field-spec-by-id arg0 (sp-field-id spt-scale-y))))
(when v1-6
(let ((f30-0 (-> v1-6 initial-valuef)))
(if arg3
(set! f30-0 (fmin f30-0 (vector-length arg2)))
)
(vector-normalize! s3-0 f30-0)
(set! (-> *beam-info* y-scale) f30-0)
)
)
)
(vector+float*! s5-0 arg1 s3-0 0.5)
(vector-normalize! s3-0 1.0)
(forward-up->quaternion *particle-quat* s3-0 *y-vector*)
(let ((t9-5 sp-launch-particles-var)
(a0-10 *sp-particle-system-3d*)
(a1-8 arg0)
(a2-2 *launch-matrix*)
)
(set! (-> a2-2 trans quad) (-> s5-0 quad))
(t9-5 a0-10 a1-8 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0)
)
(dotimes (s4-1 2)
(quaternion-rotate-local-z! *particle-quat* *particle-quat* 10922.667)
(let ((t9-7 sp-launch-particles-var)
(a0-12 *sp-particle-system-3d*)
(a1-10 arg0)
(a2-4 *launch-matrix*)
)
(set! (-> a2-4 trans quad) (-> s5-0 quad))
(t9-7 a0-12 a1-10 a2-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0)
)
)
)
)
)
0
(none)
)
;; WARN: Return type mismatch process-drawable vs gun.
(defmethod relocate ((this gun) (arg0 int))
(if (nonzero? (-> this barrel))
(&+! (-> this barrel) arg0)
)
(dotimes (v1-4 4)
(if (nonzero? (-> this mag v1-4))
(&+! (-> this mag v1-4) arg0)
)
)
(the-as gun ((method-of-type process-drawable relocate) this arg0))
)
(defbehavior gun-post gun ()
(let ((gp-0 (ppointer->process (-> self parent))))
(let ((s5-0 self))
(set! self (the-as gun gp-0))
(target-gun-compute-pos)
(set! self s5-0)
)
(set! (-> self root trans quad) (-> (the-as target gp-0) gun gun-pos trans quad))
(let ((v1-6 (-> (the-as target gp-0) gun gun-pos quat quad)))
(set! (-> self root quat quad) v1-6)
)
(set! (-> self root scale quad) (-> (the-as target gp-0) gun gun-pos scale quad))
(when (-> self read-scale)
(let ((s5-1 (new 'stack-no-clear 'vector))
(s4-0 (new 'stack-no-clear 'vector))
)
(matrix->scale (-> (the-as target gp-0) node-list data 24 bone transform) s5-1)
(vector-float*! s5-1 s5-1 0.71428573)
(if (< 0.0 (-> (the-as target gp-0) gun gun-daxter))
(matrix->scale (-> (the-as target gp-0) sidekick 0 node-list data 28 bone transform) s4-0)
)
(vector-lerp! (-> self root scale) s5-1 s4-0 (-> (the-as target gp-0) gun gun-daxter))
)
)
(set! (-> self draw light-index) (-> (the-as target gp-0) draw light-index))
(let ((v1-28 (-> (the-as target gp-0) draw color-mult quad)))
(set! (-> self draw color-mult quad) v1-28)
)
(let ((v1-30 (-> (the-as target gp-0) draw color-emissive quad)))
(set! (-> self draw color-emissive quad) v1-30)
)
(set! (-> self draw force-fade) (-> (the-as target gp-0) draw force-fade))
(set! (-> self draw death-vertex-skip) (-> (the-as target (-> self parent 0)) draw death-vertex-skip))
(set! (-> self draw death-effect) (-> (the-as target (-> self parent 0)) draw death-effect))
(set! (-> self draw death-timer) (-> (the-as target (-> self parent 0)) draw death-timer))
(set! (-> self draw death-timer-org) (-> (the-as target (-> self parent 0)) draw death-timer-org))
(set! (-> self draw death-draw-overlap) (-> (the-as target (-> self parent 0)) draw death-draw-overlap))
(let ((v1-55 (-> (the-as target gp-0) draw shadow-ctrl settings shadow-dir quad)))
(set! (-> self draw shadow-ctrl settings shadow-dir quad) v1-55)
)
(twist-set! (-> self barrel) (the-as float #f) (the-as float #f) (-> (the-as target gp-0) gun fire-spin))
(if (or (logtest? (-> (the-as target gp-0) draw status)
(draw-control-status no-draw no-draw-temp no-draw-bounds no-draw-bounds2)
)
(zero? (-> (the-as target gp-0) skel active-channels))
)
(logior! (-> self draw status) (draw-control-status no-draw))
(logclear! (-> self draw status) (draw-control-status no-draw))
)
(if (logtest? (-> (the-as target gp-0) draw status) (draw-control-status force-fade))
(logior! (-> self draw status) (draw-control-status force-fade))
(logclear! (-> self draw status) (draw-control-status force-fade))
)
)
(dotimes (gp-1 4)
(cond
((= (-> (the-as target (-> self parent 0)) game gun-ammo gp-1) 0.0)
(when (!= (-> self mag-scale gp-1) 0.0)
(let ((s5-2 (new 'stack-no-clear 'projectile-init-by-other-params)))
(let ((s3-0 (new 'stack-no-clear 'vector))
(s4-1 (new 'stack-no-clear 'vector))
)
(vector<-cspace! s3-0 (-> self mag gp-1 joint))
(vector-normalize-copy! s4-1 (-> self mag gp-1 joint bone transform vector 1) 40960.0)
(+! (-> s4-1 y) 81920.0)
(set! (-> s5-2 ent) (-> self entity))
(set! (-> s5-2 charge) 1.0)
(set! (-> s5-2 options) (projectile-options))
(set! (-> s5-2 pos quad) (-> s3-0 quad))
(set! (-> s5-2 vel quad) (-> s4-1 quad))
)
(set! (-> s5-2 notify-handle) (the-as handle #f))
(set! (-> s5-2 owner-handle) (the-as handle #f))
(set! (-> s5-2 ignore-handle) (process->handle self))
(let* ((v1-98 *game-info*)
(a0-44 (+ (-> v1-98 attack-id) 1))
)
(set! (-> v1-98 attack-id) a0-44)
(set! (-> s5-2 attack-id) a0-44)
)
(set! (-> s5-2 timeout) (seconds 4))
(let ((t9-7 spawn-projectile)
(v1-100 gp-1)
)
(t9-7
(cond
((zero? v1-100)
gun-mag-yellow
)
((= v1-100 1)
gun-mag-red
)
((= v1-100 2)
gun-mag-blue
)
(else
gun-mag-dark
)
)
s5-2
self
*default-dead-pool*
)
)
)
)
(set! (-> self mag-scale gp-1) 0.0)
(trs-set! (-> self mag gp-1) (the-as vector #f) (the-as quaternion #f) *zero-vector*)
)
(else
(seek! (-> self mag-scale gp-1) 1.0 (* 8.0 (seconds-per-frame)))
(let* ((f30-0 (-> self mag-scale gp-1))
(s5-3 (-> self mag gp-1))
(s4-2 (method-of-object s5-3 trs-set!))
(s3-1 #f)
(s2-0 #f)
(s1-0 (new 'stack-no-clear 'vector))
)
(set! (-> s1-0 x) (lerp-scale 0.1 1.0 f30-0 0.4 1.0))
(set! (-> s1-0 y) (lerp-scale 0.0 1.0 f30-0 0.0 0.4))
(set! (-> s1-0 z) (lerp-scale 0.1 1.0 f30-0 0.4 1.0))
(set! (-> s1-0 w) 1.0)
(s4-2 s5-3 (the-as vector s3-1) (the-as quaternion s2-0) s1-0)
)
)
)
)
(ja-post)
(if *display-sidekick-stats*
(debug-print-channels (-> self skel) (the-as symbol *stdcon*))
)
0
(none)
)
(defstate hidden (gun)
:virtual #t
:trans (behavior ()
(let ((v1-0 (-> self parent)))
(if (not (focus-test?
(the-as target (if v1-0
(the-as target (-> v1-0 0 self))
)
)
in-head
)
)
(go-virtual idle)
)
)
)
:code (behavior ()
(ja-channel-set! 0)
(ja-post)
(logior! (-> self mask) (process-mask sleep-code))
(suspend)
0
)
)
(defstate idle (gun)
:virtual #t
:trans (behavior ()
(set! (-> self gun-type) (-> (the-as target (-> self parent 0)) game gun-type))
(let ((a0-0 (ppointer->process (-> self parent))))
(cond
((focus-test? (the-as target a0-0) in-head)
(go-virtual hidden)
)
((nonzero? (-> (the-as target (-> self parent 0)) gun gun-type))
(go-virtual use (the-as symbol a0-0))
)
)
)
)
:code (behavior ()
(set! (-> self draw shadow) #f)
(ja-channel-set! 1)
(set! (-> self read-scale) #f)
(until #f
(ja-no-eval :group! gun-idle-ja :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
#f
)
:post gun-post
)
(defstate use (gun)
:virtual #t
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(case message
(('die)
(go-virtual die)
)
(('release)
(send-event (ppointer->process (-> self parent)) 'release)
)
)
)
:enter (behavior ((arg0 symbol))
(set-time! (-> self state-time))
(set! (-> self draw shadow) (-> self shadow-backup))
(logior! (-> self skel status) (joint-control-status sync-math))
)
:exit (behavior ()
(logclear! (-> self skel status) (joint-control-status sync-math))
)
:trans (behavior ()
(local-vars (a0-14 object))
(let ((v1-0 (ppointer->process (-> self parent)))
(a0-1 (-> self parent))
)
(cond
((focus-test?
(the-as target (if a0-1
(the-as target (-> a0-1 0 self))
)
)
in-head
)
(go-virtual hidden)
)
((and (= (-> (the-as target (-> self parent 0)) gun gun-type) (pickup-type none))
(or (not (-> (the-as target v1-0) skel top-anim frame-group))
(!= (-> (the-as target v1-0) skel top-anim interp) 1.0)
)
)
(go-virtual idle)
)
((begin
(set! a0-14 (!= (-> (the-as target (-> self parent 0)) game gun-type) (-> self gun-type)))
(and (the-as symbol a0-14) (let ((v1-16 (-> self state-time)))
(set! a0-14 (current-time))
(!= v1-16 (the-as time-frame a0-14))
)
)
)
(go-virtual use (the-as symbol a0-14))
)
)
)
)
:code (behavior ((arg0 symbol))
(ja-channel-push! 1 (seconds 0.05))
(let ((v1-0 (-> self gun-type))
(a0-5 (-> (the-as target (-> self parent 0)) game gun-type))
)
(set! (-> self gun-type) a0-5)
(cond
((and (= v1-0 (pickup-type eco-yellow)) (= a0-5 (pickup-type eco-red)))
(ja-no-eval :group! gun-gun-yellow-red-ja :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
((and (= v1-0 (pickup-type eco-yellow)) (= a0-5 (pickup-type eco-blue)))
(ja-no-eval :group! gun-gun-yellow-blue-ja :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
((and (= v1-0 (pickup-type eco-yellow)) (= a0-5 (pickup-type eco-dark)))
(ja-no-eval :group! gun-gun-dark-yellow-ja :num! (seek! 0.0) :frame-num max)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! 0.0))
)
)
((and (= v1-0 (pickup-type eco-red)) (= a0-5 (pickup-type eco-yellow)))
(ja-no-eval :group! gun-gun-yellow-red-ja :num! (seek! 0.0) :frame-num max)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! 0.0))
)
)
((and (= v1-0 (pickup-type eco-red)) (= a0-5 (pickup-type eco-blue)))
(ja-no-eval :group! gun-gun-blue-red-ja :num! (seek! 0.0) :frame-num max)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! 0.0))
)
)
((and (= v1-0 (pickup-type eco-red)) (= a0-5 (pickup-type eco-dark)))
(ja-no-eval :group! gun-gun-red-dark-ja :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
((and (= v1-0 (pickup-type eco-blue)) (= a0-5 (pickup-type eco-yellow)))
(ja-no-eval :group! gun-gun-yellow-blue-ja :num! (seek! 0.0) :frame-num max)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! 0.0))
)
)
((and (= v1-0 (pickup-type eco-blue)) (= a0-5 (pickup-type eco-red)))
(ja-no-eval :group! gun-gun-blue-red-ja :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
((and (= v1-0 (pickup-type eco-blue)) (= a0-5 (pickup-type eco-dark)))
(ja-no-eval :group! gun-gun-blue-dark-ja :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
((and (= v1-0 (pickup-type eco-dark)) (= a0-5 (pickup-type eco-yellow)))
(ja-no-eval :group! gun-gun-dark-yellow-ja :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
((and (= v1-0 (pickup-type eco-dark)) (= a0-5 (pickup-type eco-red)))
(ja-no-eval :group! gun-gun-red-dark-ja :num! (seek! 0.0) :frame-num max)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! 0.0))
)
)
((and (= v1-0 (pickup-type eco-dark)) (= a0-5 (pickup-type eco-blue)))
(ja-no-eval :group! gun-gun-blue-dark-ja :num! (seek! 0.0) :frame-num max)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! 0.0))
)
)
)
)
(let* ((v1-268 (-> self gun-type))
(gp-0 (cond
((= v1-268 (pickup-type eco-yellow))
gun-idle-yellow-ja
)
((= v1-268 (pickup-type eco-red))
gun-idle-red-ja
)
((= v1-268 (pickup-type eco-blue))
gun-idle-blue-ja
)
(else
gun-idle-dark-ja
)
)
)
(s5-0 '(("jakb-gun-yellow-fire" . "gun-yellow-fire")
("jakb-gun-yellow-fire-low" . "gun-yellow-fire-low")
("jakb-pilot-gun-yellow-fire" . "gun-yellow-fire")
("jakb-gun-red-fire" . "gun-red-fire")
("jakb-pilot-gun-red-fire" . "gun-red-fire")
("jakb-gun-blue-fire" . "gun-blue-fire")
("jakb-pilot-gun-blue-fire" . "gun-blue-fire")
("jakb-gun-dark-fire" . "gun-dark-fire")
("jakb-pilot-gun-dark-fire" . "gun-dark-fire")
)
)
(v1-277 (-> self parent))
(s4-0 (if v1-277
(the-as target (-> v1-277 0 self))
)
)
)
(until #f
(let* ((v1-281 (-> s4-0 skel top-anim frame-group))
(s2-0 (if v1-281
(-> v1-281 name)
)
)
(s1-0 (nassoc s2-0 s5-0))
(a1-60
(if s1-0
(get-art-by-name (-> self draw art-group) (the-as string (-> (the-as pair s1-0) cdr)) art-joint-anim)
)
)
)
(cond
(s1-0
(ja :group! a1-60 :num! (identity (-> s4-0 skel top-anim frame-num)))
(set! (-> self read-scale) #f)
)
((nmember s2-0 '("jakb-gun-attack-butt"
"jakb-gun-attack-butt-end"
"jakb-gun-attack-butt-blue"
"jakb-gun-attack-butt-blue-end"
"jakb-gun-attack-from-stance"
"jakb-gun-attack-from-stance-end"
"jakb-gun-attack-from-stance-blue"
"jakb-gun-attack-from-stance-blue-end"
"jakb-pilot-gun-red-yellow"
)
)
(set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim gp-0))
(set! (-> self read-scale) (the-as basic #t))
)
((and (= (-> s4-0 skel top-anim interp) 1.0)
(begin
(set! s1-0 (nassoc s2-0 '(("jakb-gun-yellow-takeout" . "gun-red-yellow")
("jakb-gun-blue-takeout" . "gun-red-blue")
("jakb-gun-dark-takeout" . "gun-red-dark")
("jakb-gun-red-takeout" . "gun-idle-red")
("jakb-pilot-gun-yellow-takeout" . "gun-red-yellow")
("jakb-pilot-gun-blue-takeout" . "gun-red-blue")
("jakb-pilot-gun-dark-takeout" . "gun-red-dark")
("jakb-pilot-gun-red-takeout" . "gun-idle-red")
)
)
)
s1-0
)
)
(let ((s3-1
(if s1-0
(get-art-by-name (-> self draw art-group) (the-as string (-> (the-as pair s1-0) cdr)) art-joint-anim)
)
)
)
(set! (-> self read-scale) (the-as basic #t))
(let* ((v1-305 (-> s4-0 skel top-anim frame-group))
(f30-0 (+ (* (-> s4-0 skel top-anim frame-num) (-> v1-305 artist-step)) (-> v1-305 artist-base)))
)
(cond
((string= s2-0 "jakb-gun-blue-takeout")
(if (>= f30-0 (-> s3-1 artist-base))
(ja :group! s3-1 :num! (identity (ja-aframe f30-0 0)))
(ja :group! gun-idle-ja)
)
)
((or (string= s2-0 "jakb-gun-dark-takeout") (string= s2-0 "jakb-pilot-gun-dark-takeout"))
(if (>= f30-0 -40.0)
(ja :group! s3-1 :num! (identity (+ 40.0 (ja-aframe f30-0 0))))
(ja :group! s3-1 :num! min)
)
)
((>= f30-0 -40.0)
(ja :group! s3-1 :num! (identity (ja-aframe f30-0 0)))
)
(else
(ja :group! gun-idle-ja)
)
)
)
)
)
(else
(set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim gp-0))
(set! (-> self read-scale) #f)
)
)
)
(suspend)
0
)
)
#f
)
:post (behavior ()
(gun-post)
(let* ((v1-0 (-> (the-as gun self) parent))
(gp-0 (if v1-0
(the-as process-drawable (-> v1-0 0 self))
)
)
)
(let ((s5-0 (and (-> (the-as target gp-0) skel top-anim frame-group)
(or (string= (-> (the-as target gp-0) skel top-anim frame-group name) "jakb-gun-front-walk")
(string= (-> (the-as target gp-0) skel top-anim frame-group name) "jakb-gun-front-run")
)
)
)
)
(vector<-cspace! (-> (the-as target gp-0) gun fire-point) (joint-node gun-lod0-jg muzzle))
(set! (-> (the-as target gp-0) gun fire-dir 1 quad) (-> (the-as target gp-0) gun fire-dir 0 quad))
(cond
((and (handle->process (-> (the-as target gp-0) gun track-target 0 handle))
(logtest? (surface-flag gun-direct) (-> (the-as target gp-0) control current-surface flags))
)
(vector-!
(the-as vector (-> (the-as target gp-0) gun fire-dir))
(-> (the-as target gp-0) gun track-trans)
(-> (the-as target gp-0) gun fire-point)
)
(vector-normalize! (the-as vector (-> (the-as target gp-0) gun fire-dir)) 1.0)
(set! (-> (the-as target gp-0) gun fire-dir-out quad) (-> (the-as target gp-0) gun fire-dir 0 quad))
)
(else
(vector-normalize-copy!
(the-as vector (-> (the-as target gp-0) gun fire-dir))
(-> (the-as gun self) node-list data 13 bone transform vector 2)
1.0
)
(if s5-0
(set! (-> (the-as target gp-0) gun fire-dir-out quad)
(-> (the-as vector (-> (the-as target gp-0) node-list data 4 bone transform vector 2)) quad)
)
)
(vector-rotate-y!
(-> (the-as target gp-0) gun fire-dir-out)
(the-as vector (-> (the-as target gp-0) gun fire-dir))
(-> (the-as target gp-0) gun fire-dir-rot)
)
)
)
(vector<-cspace! (-> (the-as target gp-0) gun laser-point) (joint-node gun-lod0-jg laser))
(set! (-> (the-as target gp-0) gun laser-dir 1 quad) (-> (the-as target gp-0) gun laser-dir 0 quad))
(set! (-> (the-as target gp-0) gun laser-dir 0 quad) (-> (the-as target gp-0) gun fire-dir-out quad))
(if s5-0
(set! (-> (the-as target gp-0) gun laser-dir 0 quad)
(-> (the-as vector (-> (the-as target gp-0) node-list data 4 bone transform vector 2)) quad)
)
)
)
(let ((s5-1 (the-as gun self)))
(set! self (the-as gun gp-0))
(target-gun-check)
(set! self s5-1)
)
)
)
)
(defstate die (gun)
:virtual #t
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(case message
(('reset)
(go-virtual idle)
)
)
)
:code (behavior ()
(let ((gp-0 (new 'stack-no-clear 'projectile-init-by-other-params)))
(let ((s4-0 (new 'stack-no-clear 'vector))
(s5-0 (new 'stack-no-clear 'vector))
)
(set! (-> s4-0 quad) (-> self root trans quad))
(vector-float*!
s5-0
(vector-z-quaternion! (new 'stack-no-clear 'vector) (-> (the-as target (-> self parent 0)) control quat))
-20480.0
)
(+! (-> s5-0 y) 81920.0)
(set! (-> gp-0 ent) (-> self entity))
(set! (-> gp-0 charge) 1.0)
(set! (-> gp-0 options) (projectile-options))
(set! (-> gp-0 pos quad) (-> s4-0 quad))
(set! (-> gp-0 vel quad) (-> s5-0 quad))
)
(set! (-> gp-0 notify-handle) (the-as handle #f))
(set! (-> gp-0 owner-handle) (the-as handle #f))
(set! (-> gp-0 ignore-handle) (process->handle self))
(let* ((v1-13 *game-info*)
(a0-12 (+ (-> v1-13 attack-id) 1))
)
(set! (-> v1-13 attack-id) a0-12)
(set! (-> gp-0 attack-id) a0-12)
)
(set! (-> gp-0 timeout) (seconds 4))
(spawn-projectile gun-eject gp-0 self *default-dead-pool*)
)
(ja-channel-set! 0)
(ja-post)
(while (focus-test? (the-as target (-> self parent 0)) dead)
(suspend)
)
(go-virtual idle)
)
)
;; WARN: Return type mismatch object vs none.
(defbehavior gun-init gun ()
(change-to-last-brother self)
(set! (-> self root) (new 'process 'trsqv))
(initialize-skeleton
self
(the-as skeleton-group (art-group-get-by-name *level* "skel-gun" (the-as (pointer uint32) #f)))
(the-as pair 0)
)
(let ((v1-5 (-> *target-shadow-control* settings shadow-dir quad)))
(set! (-> *gun-shadow-control* settings shadow-dir quad) v1-5)
)
(set! (-> self draw shadow-ctrl) *gun-shadow-control*)
(set! (-> self shadow-backup) (-> self draw shadow))
(set! (-> self barrel) (new 'process 'joint-mod (joint-mod-mode rotate) self 8))
(set! (-> self read-scale) #f)
(set! (-> self mag 0) (new 'process 'joint-mod (joint-mod-mode joint-set*) self 34))
(set! (-> self mag 1) (new 'process 'joint-mod (joint-mod-mode joint-set*) self 32))
(set! (-> self mag 2) (new 'process 'joint-mod (joint-mod-mode joint-set*) self 33))
(set! (-> self mag 3) (new 'process 'joint-mod (joint-mod-mode joint-set*) self 35))
(dotimes (v1-14 4)
(set! (-> self mag-scale v1-14) (if (= (-> (the-as target (-> self parent 0)) game gun-ammo v1-14) 0.0)
0.0
1.0
)
)
)
(go-virtual idle)
(none)
)
(defmethod gun-info-method-9 ((this gun-info))
(when (and (-> this laser-active?)
(-> this active?)
(not (logtest? (-> this gun 0 draw status) (draw-control-status no-draw)))
#t
)
(let ((s5-0 (-> this laser-point))
(s4-0 (new 'stack-no-clear 'collide-query))
(s3-0 (-> this laser-dir))
(f30-0 (rotate-y<-vector+vector (the-as vector (-> this laser-dir)) (-> this laser-dir 1)))
)
(vector+float*! (-> s4-0 start-pos) s5-0 (the-as vector s3-0) -8192.0)
(vector-float*! (-> s4-0 move-dist) (the-as vector s3-0) 163840.0)
(let ((v1-13 s4-0))
(set! (-> v1-13 radius) (-> this track-beam-size))
(set! (-> v1-13 collide-with) (-> this process 0 control root-prim prim-core collide-with))
(set! (-> v1-13 ignore-process0) (ppointer->process (-> this process)))
(set! (-> v1-13 ignore-process1) #f)
(set! (-> v1-13 ignore-pat)
(new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1)
)
(set! (-> v1-13 action-mask) (collide-action solid semi-solid))
)
(let ((f0-3 (fill-and-probe-using-line-sphere *collide-cache* s4-0)))
(cond
((>= f0-3 0.0)
(vector+float*! (-> s4-0 start-pos) (-> s4-0 start-pos) (-> s4-0 move-dist) f0-3)
(vector+float*! (-> s4-0 start-pos) (-> s4-0 start-pos) (the-as vector s3-0) (-> this track-beam-size))
(let* ((s2-0 (-> s4-0 best-other-tri collide-ptr))
(s0-0 (if (type? s2-0 collide-shape-prim)
(the-as collide-shape-prim s2-0)
)
)
(s1-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) s5-0 (-> s4-0 start-pos)) 1638.4))
(s2-1 (new 'stack-no-clear 'vector))
)
(set! (-> s2-1 quad) (-> s4-0 start-pos quad))
(cond
((and s0-0
(or (logtest? (process-mask enemy guard) (-> s0-0 cshape process mask))
(= (handle->process (-> this track-target 0 handle)) (-> s0-0 cshape process))
)
(>= (-> this fire-range) (vector-vector-distance s2-1 s5-0))
)
(vector+! s2-1 s2-1 s1-0)
(launch-particles (-> *part-id-table* 185) s2-1)
(launch-particles (-> *part-id-table* 184) s2-1)
)
(else
(vector+! s2-1 s2-1 s1-0)
(launch-particles (-> *part-id-table* 186) s2-1)
)
)
)
)
(else
(vector+! (-> s4-0 start-pos) (-> s4-0 start-pos) (-> s4-0 move-dist))
)
)
)
(set! (-> this laser-hit-point quad) (-> s4-0 start-pos quad))
(let ((s1-3 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (camera-pos) s5-0) 1.0))
(t9-10 vector-normalize!)
(a0-41 (new 'stack-no-clear 'vector))
)
(set! (-> a0-41 quad) (-> s3-0 0 quad))
(let ((s2-3 (t9-10 a0-41 1.0))
(s3-1 (new 'stack-no-clear 'vector))
)
(set! (-> s3-1 quad) (-> s5-0 quad))
(let ((v1-47 (vector-normalize-copy! (new 'stack-no-clear 'vector) s2-3 327.68))
(f28-1 (vector-dot s1-3 s2-3))
)
(when (< 0.0 f28-1)
(vector+! s3-1 s3-1 v1-47)
(set! (-> *part-id-table* 183 init-specs 13 initial-valuef) f28-1)
(launch-particles (-> *part-id-table* 183) s3-1)
(set! (-> *part-id-table* 182 init-specs 13 initial-valuef) f28-1)
(launch-particles (-> *part-id-table* 182) s3-1)
)
)
)
)
(let* ((s3-2 (-> *part-id-table* 181))
(s2-4 (get-field-spec-by-id s3-2 (sp-field-id spt-timer)))
(s1-5 (vector-! (new 'stack-no-clear 'vector) (-> s4-0 start-pos) s5-0))
(s4-1 (if (< 182.04445 f30-0)
3
1
)
)
(f30-1 (-> s2-4 initial-valuef))
(f28-2 (vector-vector-distance (camera-pos) s5-0))
(s0-2 (get-field-spec-by-id s3-2 (sp-field-id spt-scale-x)))
(f0-13 (cond
((< f28-2 122.88)
0.0
)
((< 65536.0 f28-2)
1.0
)
(else
(* 0.000015287453 (+ -122.88 f28-2))
)
)
)
(f28-3 (-> s0-2 initial-valuef))
(f26-0 (-> s0-2 random-rangef))
)
(set! (-> s0-2 initial-valuef) (* f28-3 f0-13))
(set! (-> s0-2 random-rangef) (* f26-0 f0-13))
(set! (-> s2-4 initial-valuef) (the float s4-1))
(draw-beam s3-2 s5-0 s1-5 #t #t)
(set! (-> s2-4 initial-valuef) f30-1)
(set! (-> s0-2 initial-valuef) f28-3)
(set! (-> s0-2 random-rangef) f26-0)
)
)
)
(-> this laser-dir)
)