mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -04:00
889fdcd79c
Say goodbye to half of the laser needle shots spinning around doing nothing. This is toggleable with `fix-projectile-focus` in the pc settings.
2709 lines
101 KiB
Common Lisp
2709 lines
101 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: gun-blue-shot.gc
|
|
;; name in dgo: gun-blue-shot
|
|
;; dgos: GAME
|
|
|
|
(declare-type gun-blue-shot projectile)
|
|
(declare-type gun-blue-shot-2 gun-blue-shot)
|
|
(declare-type gun-blue-2-target-info structure)
|
|
(define-extern *blue-shot-trail* light-trail-composition)
|
|
(define-extern *gun-blue-2-targets* (inline-array gun-blue-2-target-info))
|
|
(define-extern *uv-loop-curve* curve2d-piecewise)
|
|
(define-extern *blue-light-test* lightning-appearance)
|
|
(define-extern *blue-light-test-end* lightning-appearance)
|
|
(define-extern *blue-light-test-big* lightning-appearance)
|
|
(define-extern *blue-light-test-big-intense* lightning-appearance)
|
|
(define-extern *blue-light-test-small-fade* lightning-appearance)
|
|
|
|
;; +++gun-blue-lightning-cmd-msg
|
|
(defenum gun-blue-lightning-cmd-msg
|
|
:type uint64
|
|
(active 0)
|
|
(inactive 1)
|
|
)
|
|
;; ---gun-blue-lightning-cmd-msg
|
|
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
(defun sparticle-fade-alpha-dist ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
|
|
(let ((a0-1 (math-camera-pos))
|
|
(v1-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
0.0
|
|
(set! (-> v1-0 x) (- (-> arg2 rvec x) (-> a0-1 x)))
|
|
(set! (-> v1-0 y) (- (-> arg2 rvec y) (-> a0-1 y)))
|
|
(set! (-> v1-0 z) (- (-> arg2 rvec z) (-> a0-1 z)))
|
|
(let ((f1-3 (vector-length v1-0)))
|
|
(set! (-> arg2 fvec w) (* 128.0 (- 1.0 (* 0.0000024414062 f1-3))))
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(set! (-> *lightning-spec-id-table* 12) (new 'static 'lightning-spec
|
|
:name "lightning-blue-shot-attack-explode"
|
|
:flags (lightning-spec-flags lsf0)
|
|
:start-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)
|
|
:end-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)
|
|
:fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5)
|
|
:fade-start-factor 1.0
|
|
:fade-time 30.0
|
|
:texture (new 'static 'texture-id :index #x8f :page #x4)
|
|
:reduction 0.42
|
|
:num-points 16
|
|
:box-size 8192.0
|
|
:merge-factor 0.6
|
|
:merge-count 2
|
|
:radius 3276.8
|
|
:duration 45.0
|
|
:duration-rand 60.0
|
|
:sound #f
|
|
)
|
|
)
|
|
|
|
(set! (-> *lightning-spec-id-table* 13) (new 'static 'lightning-spec
|
|
:name "lightning-blue-shot-terminal"
|
|
:flags (lightning-spec-flags lsf0)
|
|
:start-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x10)
|
|
:end-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x10)
|
|
:fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5)
|
|
:fade-start-factor 1.0
|
|
:fade-time 30.0
|
|
:texture (new 'static 'texture-id :index #x8f :page #x4)
|
|
:reduction 0.42
|
|
:num-points 16
|
|
:box-size 8192.0
|
|
:merge-factor 0.6
|
|
:merge-count 2
|
|
:radius 3276.8
|
|
:duration 75.0
|
|
:sound #f
|
|
)
|
|
)
|
|
|
|
;; WARN: Return type mismatch (pointer process) vs object.
|
|
(defbehavior gun-fire-blue-1 target ()
|
|
(let ((gp-0 (-> self gun))
|
|
(s4-0 (-> self gun laser-dir))
|
|
(s5-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
(let ((s3-0 (new 'stack-no-clear 'quaternion)))
|
|
(quaternion-vector-angle! s3-0 s4-0 (* 182.04445 (rand-vu-float-range 0.0 360.0)))
|
|
(vector-rotate-y! s5-0 s4-0 (* 182.04445 (rand-vu-float-range 0.0 1.1)))
|
|
(vector-orient-by-quat! s5-0 s5-0 s3-0)
|
|
)
|
|
(let ((s4-1 (new 'stack-no-clear 'projectile-init-by-other-params)))
|
|
(set! (-> s4-1 ent) (-> self entity))
|
|
(set! (-> s4-1 charge) 1.0)
|
|
(set! (-> s4-1 options) (projectile-options po17))
|
|
(logclear! (-> s4-1 options) (projectile-options po14 po15 po16))
|
|
(set! (-> s4-1 pos quad) (-> gp-0 fire-point quad))
|
|
(set! (-> s4-1 vel quad) (-> s5-0 quad))
|
|
(set! (-> s4-1 notify-handle) (the-as handle #f))
|
|
(set! (-> s4-1 owner-handle) (the-as handle #f))
|
|
(set! (-> s4-1 target-handle) (the-as handle #f))
|
|
(set! (-> s4-1 target-pos quad) (the-as uint128 0))
|
|
(set! (-> s4-1 ignore-handle) (process->handle (send-event self 'get-vehicle)))
|
|
(let* ((v1-16 *game-info*)
|
|
(a0-16 (+ (-> v1-16 attack-id) 1))
|
|
)
|
|
(set! (-> v1-16 attack-id) a0-16)
|
|
(set! (-> s4-1 attack-id) a0-16)
|
|
)
|
|
(set! (-> s4-1 timeout) (seconds 4))
|
|
(spawn-projectile gun-blue-shot s4-1 (ppointer->process (-> gp-0 gun)) *default-dead-pool*)
|
|
)
|
|
)
|
|
)
|
|
|
|
(defun fmod-2 ((arg0 float) (arg1 float))
|
|
(- arg0 (* (the float (the int (/ arg0 arg1))) arg1))
|
|
)
|
|
|
|
(deftype gun-blue-shot-3 (projectile)
|
|
((hit-actor? symbol)
|
|
(start-pos vector :inline)
|
|
(track-mode uint64)
|
|
(random-travel-distance float)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype dist-dot-val (structure)
|
|
((dot float)
|
|
(dist float)
|
|
(current-dir-vec vector :inline)
|
|
(vec-to-target vector :inline)
|
|
)
|
|
)
|
|
|
|
|
|
;; WARN: Return type mismatch float vs object.
|
|
(defun get-dist-and-dot ((arg0 gun-blue-shot) (arg1 dist-dot-val))
|
|
(let ((s4-0 (new 'stack-no-clear 'vector)))
|
|
(set! (-> s4-0 quad) (-> arg0 desired-target-pos quad))
|
|
(let ((s5-0 (vector-normalize-copy! (-> arg1 current-dir-vec) (-> arg0 root transv) 1.0)))
|
|
(let ((a0-2 (-> arg1 vec-to-target)))
|
|
(vector-! a0-2 s4-0 (-> arg0 root trans))
|
|
(set! (-> arg1 dist) (vector-normalize-ret-len! a0-2 1.0))
|
|
)
|
|
(set! (-> arg1 dot) (vector-dot s5-0 (-> arg1 vec-to-target)))
|
|
)
|
|
)
|
|
)
|
|
|
|
(defun gun-blue-shot-3-move ((arg0 gun-blue-shot-3))
|
|
(with-pp
|
|
(let ((v1-0 (-> arg0 track-mode)))
|
|
(cond
|
|
((or (= v1-0 1) (zero? v1-0))
|
|
(let ((s5-0 #f)
|
|
(a0-4 (the-as process #f))
|
|
)
|
|
(when (handle->process (-> arg0 desired-target))
|
|
(let ((s4-0 (handle->process (-> arg0 desired-target))))
|
|
(set! a0-4 (if (type? s4-0 process-focusable)
|
|
s4-0
|
|
)
|
|
)
|
|
)
|
|
(if a0-4
|
|
(set! s5-0 #t)
|
|
)
|
|
)
|
|
(cond
|
|
(s5-0
|
|
(let ((a0-9 (get-trans (the-as process-focusable a0-4) 3)))
|
|
(set! (-> arg0 desired-target-pos quad) (-> a0-9 quad))
|
|
)
|
|
)
|
|
((= (-> arg0 track-mode) 1)
|
|
(set! (-> arg0 track-mode) (the-as uint 2))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
((= v1-0 2)
|
|
(if (< (vector-vector-distance-squared (-> arg0 root trans) (-> arg0 desired-target-pos)) 1073741800.0)
|
|
(set! (-> arg0 track-mode) (the-as uint 3))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(when (zero? (-> arg0 track-mode))
|
|
(let ((f0-1 (vector-vector-distance (-> arg0 start-pos) (-> arg0 root trans))))
|
|
(cond
|
|
((< (-> arg0 random-travel-distance) f0-1)
|
|
(set! (-> arg0 track-mode) (the-as uint 1))
|
|
(set-time! (-> arg0 state-time))
|
|
)
|
|
(else
|
|
(when (< (vector-vector-distance (-> arg0 root trans) (-> arg0 desired-target-pos)) 40960.0)
|
|
(set! (-> arg0 track-mode) (the-as uint 1))
|
|
(set-time! (-> arg0 state-time))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(if (logtest? (-> arg0 root status) (collide-status touch-surface))
|
|
(go (method-of-object arg0 impact))
|
|
)
|
|
(let ((v1-40 (-> arg0 track-mode)))
|
|
(cond
|
|
((zero? v1-40)
|
|
(let ((s5-1 (new 'stack-no-clear 'dist-dot-val)))
|
|
(get-dist-and-dot (the-as gun-blue-shot arg0) s5-1)
|
|
(let* ((f0-4 (* 0.5 (+ 1.0 (-> s5-1 dot))))
|
|
(f0-5 (* f0-4 f0-4))
|
|
)
|
|
(vector-normalize! (-> arg0 root transv) (lerp 122880.0 409600.0 f0-5))
|
|
)
|
|
)
|
|
(let ((s5-3 (-> arg0 child)))
|
|
(while s5-3
|
|
(send-event (ppointer->process s5-3) 'notice 'add-crumb)
|
|
(set! s5-3 (-> s5-3 0 brother))
|
|
)
|
|
)
|
|
)
|
|
((or (= v1-40 1) (= v1-40 2))
|
|
(let ((s5-4 (new 'stack-no-clear 'vector)))
|
|
(set! (-> s5-4 quad) (-> arg0 root trans quad))
|
|
(let ((f30-0 2.0)
|
|
(f24-0 65536.0)
|
|
)
|
|
327680.0
|
|
0.0
|
|
(let* ((f28-0 (/ (the float (- (current-time) (-> pp clock old-frame-counter))) f30-0))
|
|
(f26-0 f28-0)
|
|
)
|
|
(dotimes (s4-2 (the int f30-0))
|
|
(let ((s3-0 (new 'stack-no-clear 'dist-dot-val)))
|
|
(get-dist-and-dot (the-as gun-blue-shot arg0) s3-0)
|
|
(when (< (-> s3-0 dist) 49152.0)
|
|
(let ((f0-12 (* 0.000020345053 (-> s3-0 dist)))
|
|
(f24-1 (* 0.5 (+ 1.0 (-> s3-0 dot))))
|
|
)
|
|
(set! f24-0 (* (lerp 65536.0 131072.0 f0-12) (- 2.0 f24-1)))
|
|
)
|
|
(when (and (= (-> arg0 track-mode) 1) (time-elapsed? (-> arg0 state-time) (seconds 1)))
|
|
(let ((f0-15 (* 1.3333334 (+ -0.75 (* 0.0033333334 (the float (- (current-time) (-> arg0 state-time))))))))
|
|
(set! f24-0 (* f24-0 (lerp 1.0 2.0 f0-15)))
|
|
)
|
|
)
|
|
)
|
|
(cond
|
|
((< 0.99 (-> s3-0 dot))
|
|
(set! (-> s3-0 current-dir-vec quad) (-> s3-0 vec-to-target quad))
|
|
)
|
|
(else
|
|
(let* ((s2-0 (new 'stack-no-clear 'vector))
|
|
(f22-0 0.0)
|
|
(f0-19 (acos (-> s3-0 dot)))
|
|
(f22-1 (deg-seek f22-0 f0-19 (/ (* f24-0 (seconds-per-frame)) f30-0)))
|
|
)
|
|
(vector-cross! s2-0 (-> s3-0 vec-to-target) (-> s3-0 current-dir-vec))
|
|
(vector-normalize! s2-0 1.0)
|
|
(vector-rotate-around-axis!
|
|
(-> s3-0 current-dir-vec)
|
|
(the-as quaternion (-> s3-0 current-dir-vec))
|
|
(* -1.0 f22-1)
|
|
s2-0
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> arg0 root transv quad) (-> s3-0 current-dir-vec quad))
|
|
(let* ((f0-26 (* 0.5 (+ 1.0 (-> s3-0 dot))))
|
|
(f0-27 (* f0-26 f0-26))
|
|
(f0-28 (lerp 122880.0 409600.0 f0-27))
|
|
)
|
|
(vector-normalize! (-> arg0 root transv) f0-28)
|
|
)
|
|
)
|
|
(let ((a1-27 (vector-float*! (new 'stack-no-clear 'vector) (-> arg0 root transv) (/ 1.0 f30-0))))
|
|
(vector-v++! (-> arg0 root trans) a1-27)
|
|
)
|
|
(let ((s3-1 (-> arg0 child)))
|
|
(while s3-1
|
|
(send-event (ppointer->process s3-1) 'notice 'add-crumb-elapsed f26-0)
|
|
(set! s3-1 (-> s3-1 0 brother))
|
|
)
|
|
)
|
|
(when (< (vector-vector-distance (-> arg0 root trans) (-> arg0 desired-target-pos)) 8192.0)
|
|
0
|
|
(goto cfg-70)
|
|
)
|
|
(+! f26-0 f28-0)
|
|
)
|
|
)
|
|
)
|
|
(label cfg-70)
|
|
(vector-! (-> arg0 root transv) (-> arg0 root trans) s5-4)
|
|
(set! (-> arg0 root trans quad) (-> s5-4 quad))
|
|
)
|
|
(vector-float*! (-> arg0 root transv) (-> arg0 root transv) (/ 1.0 (seconds-per-frame)))
|
|
)
|
|
)
|
|
)
|
|
(projectile-move-fill-line-sphere arg0)
|
|
(none)
|
|
)
|
|
)
|
|
|
|
(deftype light-trail-tracker-blue-3 (light-trail-tracker-projectile)
|
|
()
|
|
)
|
|
|
|
|
|
(defmethod light-trail-tracker-method-17 ((this light-trail-tracker-blue-3) (arg0 process-focusable))
|
|
#f
|
|
)
|
|
|
|
(if (or (zero? *blue-shot-trail*) (!= loading-level global))
|
|
(set! *blue-shot-trail* (new 'loading-level 'light-trail-composition))
|
|
)
|
|
|
|
(set! (-> *blue-shot-trail* color-mode) (the-as uint 0))
|
|
|
|
(set! (-> *blue-shot-trail* color-repeat-dist) 40960.0)
|
|
|
|
(set! (-> *blue-shot-trail* alpha-1-mode) (the-as uint 0))
|
|
|
|
(set! (-> *blue-shot-trail* alpha-2-mode) (the-as uint 6))
|
|
|
|
(set! (-> *blue-shot-trail* base-alpha) 1.0)
|
|
|
|
(set! (-> *blue-shot-trail* alpha-repeat-dist) 94208.0)
|
|
|
|
(set! (-> *blue-shot-trail* width-mode) (the-as uint 2))
|
|
|
|
(set! (-> *blue-shot-trail* base-width) 2048.0)
|
|
|
|
(set! (-> *blue-shot-trail* width-repeat-dist) 12288.0)
|
|
|
|
(set! (-> *blue-shot-trail* uv-mode) (the-as uint 0))
|
|
|
|
(set! (-> *blue-shot-trail* uv-repeat-dist) 163840.0)
|
|
|
|
(set! (-> *blue-shot-trail* lie-mode) (the-as uint 0))
|
|
|
|
(set! (-> *blue-shot-trail* max-age) (seconds 0.5))
|
|
|
|
(if #f
|
|
(set! (-> *blue-shot-trail* tex-id)
|
|
(the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f)))
|
|
)
|
|
(set! (-> *blue-shot-trail* tex-id) (the-as uint #x500f00))
|
|
)
|
|
|
|
(set! (-> *blue-shot-trail* width-curve) (the-as curve2d-piecewise *curve-linear-up*))
|
|
|
|
(set! (-> *blue-shot-trail* color-curve) (the-as curve-color-piecewise *trail-color-curve-white*))
|
|
|
|
(set! (-> *blue-shot-trail* alpha-curve-1) (the-as curve2d-piecewise *curve-linear-down*))
|
|
|
|
(set! (-> *blue-shot-trail* alpha-curve-2) #f)
|
|
|
|
(set! (-> *blue-shot-trail* zbuffer?) #f)
|
|
|
|
(set! (-> *blue-shot-trail* lie-vector quad) (-> *up-vector* quad))
|
|
|
|
(set! (-> *blue-shot-trail* use-tape-mode?) #f)
|
|
|
|
(set! (-> *blue-shot-trail* blend-mode) (the-as uint 1))
|
|
|
|
(set! (-> *blue-shot-trail* frame-stagger) (the-as uint 1))
|
|
|
|
(defmethod init-proj-settings! ((this gun-blue-shot-3))
|
|
(+! (-> *game-info* shots-fired 2) 1.0)
|
|
(set! (-> this attack-mode) 'eco-blue)
|
|
(set! (-> this max-speed) 327680.0)
|
|
(set! (-> this move) gun-blue-shot-3-move)
|
|
(set! (-> this timeout) (seconds 3))
|
|
(set! (-> this sound-id) (new-sound-id))
|
|
(set! (-> this damage) 1.0)
|
|
(set! (-> this vehicle-damage-factor) 2.0)
|
|
(set! (-> this vehicle-impulse-factor) 2.0)
|
|
(logior! (-> this options) (projectile-options po13))
|
|
(set! (-> this track-mode) (the-as uint 0))
|
|
(set! (-> this start-pos quad) (-> this root trans quad))
|
|
(let* ((f30-0 12288.0)
|
|
(f28-0 28672.0)
|
|
(v1-16 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
|
|
(v1-17 (the-as number (logior #x3f800000 v1-16)))
|
|
)
|
|
(set! (-> this random-travel-distance) (+ f30-0 (* f28-0 (+ -1.0 (the-as float v1-17)))))
|
|
)
|
|
(let ((s5-0 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
|
|
(set! (-> s5-0 tracked-obj) (process->handle this))
|
|
(set! (-> s5-0 appearance) *blue-shot-trail*)
|
|
(set! (-> s5-0 max-num-crumbs) (the int (* 0.2 (the float (-> s5-0 appearance max-age)))))
|
|
(set! (-> s5-0 track-immediately?) #t)
|
|
(let* ((v1-30 (estimate-light-trail-mem-usage
|
|
(the-as uint (-> s5-0 max-num-crumbs))
|
|
(the-as uint (= (-> s5-0 appearance lie-mode) 3))
|
|
)
|
|
)
|
|
(s4-0 (get-process *default-dead-pool* light-trail-tracker-blue-3 (+ v1-30 8192) 1))
|
|
)
|
|
(when s4-0
|
|
(let ((t9-4 (method-of-type process activate)))
|
|
(t9-4 s4-0 this "light-trail" (the-as pointer #x70004000))
|
|
)
|
|
(run-now-in-process s4-0 light-trail-tracker-init-by-other s5-0)
|
|
(-> s4-0 ppointer)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod projectile-method-32 ((this gun-blue-shot-3))
|
|
(if (not (do-fire-backcheck (-> this root trans) (-> this root transv)))
|
|
(go (method-of-object this impact))
|
|
(call-parent-method this)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; WARN: Return type mismatch sound-id vs none.
|
|
(defmethod play-impact-sound ((this gun-blue-shot-3) (arg0 projectile-options))
|
|
(case arg0
|
|
(((projectile-options po0))
|
|
(sound-play "blue-gun3-ricco" :position (-> this root trans))
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
(defmethod projectile-method-25 ((this gun-blue-shot-3))
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(deftype target-quality-info (structure)
|
|
((targ handle)
|
|
(value float)
|
|
)
|
|
)
|
|
|
|
|
|
;; WARN: Return type mismatch (pointer process) vs object.
|
|
(defbehavior gun-fire-blue-3 target ()
|
|
(local-vars
|
|
(sv-144 gun-info)
|
|
(sv-148 projectile-init-by-other-params)
|
|
(sv-1280 vector)
|
|
(sv-1284 (inline-array target-quality-info))
|
|
(sv-1288 int)
|
|
(sv-1296 float)
|
|
(sv-1300 object)
|
|
)
|
|
(set! sv-144 (-> self gun))
|
|
(set! sv-148 (new 'stack-no-clear 'projectile-init-by-other-params))
|
|
(draw-beam (-> *part-id-table* 364) (-> sv-144 fire-point) (-> sv-144 fire-dir-out) #f)
|
|
(set! sv-1280 (new 'stack-no-clear 'vector))
|
|
(set! sv-1284 (new 'stack-no-clear 'inline-array 'target-quality-info 384))
|
|
(set! sv-1288 0)
|
|
(set! sv-1296 (the-as float 0.0))
|
|
(set! sv-1300 (send-event *target* 'get-vehicle))
|
|
(set! (-> sv-1280 quad) (-> sv-144 fire-point quad))
|
|
(set! (-> sv-1280 w) 163840.0)
|
|
(let ((gp-0 (new 'stack-no-clear 'array 'collide-shape 384)))
|
|
(countdown (s5-0 (fill-actor-list-for-box *actor-hash* sv-1280 gp-0 384))
|
|
(let* ((s4-0 (-> gp-0 s5-0))
|
|
(v1-16 (if (type? s4-0 collide-shape)
|
|
s4-0
|
|
)
|
|
)
|
|
)
|
|
(when v1-16
|
|
(let* ((s3-0 (-> v1-16 process))
|
|
(s4-1 (if (type? s3-0 process-focusable)
|
|
s3-0
|
|
)
|
|
)
|
|
)
|
|
(when s4-1
|
|
(when (and (!= *target* s4-1)
|
|
(!= sv-1300 s4-1)
|
|
(not (focus-test? (the-as process-focusable s4-1) disable dead inactive gun-no-target))
|
|
(pc-check-focus-fix (the-as process-focusable s4-1)) ;; og:preserve-this
|
|
(or (logtest? (process-mask crate enemy vehicle civilian) (-> s4-1 mask))
|
|
(and (logtest? (process-mask guard) (-> s4-1 mask)) (-> *setting-control* user-current gun-target-guards?))
|
|
)
|
|
)
|
|
(let ((s3-1 (new 'stack-no-clear 'collide-query)))
|
|
(vector+float*! (-> s3-1 start-pos) (-> sv-144 fire-point) (-> sv-144 fire-dir-out) 40960.0)
|
|
(+! (-> s3-1 start-pos y) 24576.0)
|
|
(vector-! (-> s3-1 move-dist) (get-trans (the-as process-focusable s4-1) 3) (-> sv-144 fire-point))
|
|
(let ((v1-32 s3-1))
|
|
(set! (-> v1-32 radius) 40.96)
|
|
(set! (-> v1-32 collide-with) (collide-spec backgnd))
|
|
(set! (-> v1-32 ignore-process0) #f)
|
|
(set! (-> v1-32 ignore-process1) #f)
|
|
(set! (-> v1-32 ignore-pat)
|
|
(new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1)
|
|
)
|
|
(set! (-> v1-32 action-mask) (collide-action solid))
|
|
)
|
|
(when (< (fill-and-probe-using-line-sphere *collide-cache* s3-1) 0.0)
|
|
(let ((s3-3
|
|
(vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable s4-1) 3) (-> self control trans))
|
|
)
|
|
)
|
|
(vector-normalize! s3-3 1.0)
|
|
(when (< (-> s3-3 y) 0.5)
|
|
(set! (-> sv-1284 sv-1288 targ) (process->handle s4-1))
|
|
(let ((f30-0 1.0))
|
|
(if (and (nonzero? (-> s4-1 draw)) (logtest? (-> s4-1 draw status) (draw-control-status on-screen)))
|
|
(set! f30-0 (+ 2.0 f30-0))
|
|
)
|
|
(if (< (vector-vector-xz-distance-squared (-> sv-144 fire-point) (get-trans (the-as process-focusable s4-1) 3))
|
|
2415919000.0
|
|
)
|
|
(set! f30-0 (+ 4.0 f30-0))
|
|
)
|
|
(if (logtest? (process-mask enemy guard) (-> s4-1 mask))
|
|
(set! f30-0 (+ 28.0 f30-0))
|
|
)
|
|
(if (logtest? (process-mask vehicle civilian) (-> s4-1 mask))
|
|
(set! f30-0 (* 0.25 f30-0))
|
|
)
|
|
(set! (-> sv-1284 sv-1288 value) f30-0)
|
|
(set! sv-1296 (+ sv-1296 f30-0))
|
|
)
|
|
(set! sv-1288 (+ sv-1288 1))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
;; og:preserve-this *snip* there was dead code here!
|
|
(let* ((v1-132 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
|
|
(v1-133 (the-as number (logior #x3f800000 v1-132)))
|
|
(f0-32 (* (+ -1.0 (the-as float v1-133)) sv-1296))
|
|
(s5-7 (the-as process #f))
|
|
)
|
|
(let ((f1-11 0.0)
|
|
(gp-2 (new 'stack-no-clear 'vector))
|
|
)
|
|
(dotimes (v1-136 sv-1288)
|
|
(+! f1-11 (-> sv-1284 v1-136 value))
|
|
(when (< f0-32 f1-11)
|
|
(set! s5-7 (handle->process (-> sv-1284 v1-136 targ)))
|
|
0
|
|
(goto cfg-91)
|
|
)
|
|
)
|
|
(label cfg-91)
|
|
(let ((s4-5 (new 'stack-no-clear 'vector)))
|
|
(let ((s3-5 s4-5))
|
|
(let* ((f30-2 -1.0)
|
|
(f28-0 2.0)
|
|
(v1-148 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
|
|
(v1-149 (the-as number (logior #x3f800000 v1-148)))
|
|
)
|
|
(set! (-> s3-5 x) (+ f30-2 (* f28-0 (+ -1.0 (the-as float v1-149)))))
|
|
)
|
|
(let* ((f30-3 -0.2)
|
|
(f28-1 0.7)
|
|
(v1-154 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
|
|
(v1-155 (the-as number (logior #x3f800000 v1-154)))
|
|
)
|
|
(set! (-> s3-5 y) (+ f30-3 (* f28-1 (+ -1.0 (the-as float v1-155)))))
|
|
)
|
|
(let* ((f30-4 -1.0)
|
|
(f28-2 2.0)
|
|
(v1-160 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
|
|
(v1-161 (the-as number (logior #x3f800000 v1-160)))
|
|
)
|
|
(set! (-> s3-5 z) (+ f30-4 (* f28-2 (+ -1.0 (the-as float v1-161)))))
|
|
)
|
|
(set! (-> s3-5 w) 1.0)
|
|
)
|
|
(vector-normalize! s4-5 163840.0)
|
|
(vector+! gp-2 (-> sv-144 fire-point) s4-5)
|
|
)
|
|
(let ((s4-6 (new 'stack-no-clear 'vector)))
|
|
(set! (-> s4-6 quad) (-> gp-2 quad))
|
|
(when s5-7
|
|
(let ((s3-6 s4-6)
|
|
(s2-3 s5-7)
|
|
)
|
|
(set! (-> s3-6 quad) (-> (get-trans
|
|
(the-as process-focusable (if (type? s2-3 process-focusable)
|
|
(the-as process-focusable s2-3)
|
|
)
|
|
)
|
|
3
|
|
)
|
|
quad
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(let ((s3-7 (vector-rotate-y! (new 'stack-no-clear 'vector) (-> sv-144 fire-dir-out) 2730.6667))
|
|
(v1-174 (vector-rotate-y! (new 'stack-no-clear 'vector) (-> sv-144 fire-dir-out) -2730.6667))
|
|
(a0-114 (vector-! (new 'stack-no-clear 'vector) s4-6 (-> sv-144 fire-point)))
|
|
(s4-7 (new 'stack-no-clear 'vector))
|
|
)
|
|
(if (< (vector-dot s3-7 a0-114) (vector-dot v1-174 a0-114))
|
|
(set! (-> s4-7 quad) (-> s3-7 quad))
|
|
(set! (-> s4-7 quad) (-> v1-174 quad))
|
|
)
|
|
(vector-normalize! a0-114 1.0)
|
|
(let* ((s3-8 vector-rotate-y!)
|
|
(s2-4 s4-7)
|
|
(s1-0 s4-7)
|
|
(f30-5 -2730.6667)
|
|
(f28-3 5461.3335)
|
|
(v1-180 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
|
|
(v1-181 (the-as number (logior #x3f800000 v1-180)))
|
|
)
|
|
(s3-8 s2-4 s1-0 (+ f30-5 (* f28-3 (+ -1.0 (the-as float v1-181)))))
|
|
)
|
|
(let* ((f30-6 -0.1)
|
|
(f28-4 0.5)
|
|
(v1-186 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
|
|
(v1-187 (the-as number (logior #x3f800000 v1-186)))
|
|
)
|
|
(set! (-> s4-7 y) (+ f30-6 (* f28-4 (+ -1.0 (the-as float v1-187))) (-> s4-7 y)))
|
|
)
|
|
(vector-normalize! s4-7 1.0)
|
|
(set! (-> sv-148 ent) (-> self entity))
|
|
(set! (-> sv-148 charge) 1.0)
|
|
(set! (-> sv-148 options) (projectile-options))
|
|
(logclear! (-> sv-148 options) (projectile-options po14 po15 po16))
|
|
(set! (-> sv-148 pos quad) (-> sv-144 fire-point quad))
|
|
(set! (-> sv-148 notify-handle) (the-as handle #f))
|
|
(set! (-> sv-148 owner-handle) (the-as handle #f))
|
|
(set! (-> sv-148 target-handle) (process->handle s5-7))
|
|
(set! (-> sv-148 target-pos quad) (-> gp-2 quad))
|
|
(set! (-> sv-148 ignore-handle) (process->handle (send-event self 'get-vehicle)))
|
|
(let* ((v1-209 *game-info*)
|
|
(a0-143 (+ (-> v1-209 attack-id) 1))
|
|
)
|
|
(set! (-> v1-209 attack-id) a0-143)
|
|
(set! (-> sv-148 attack-id) a0-143)
|
|
)
|
|
(set! (-> sv-148 timeout) (seconds 4))
|
|
(vector-float*! (-> sv-148 vel) s4-7 327680.0)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(spawn-projectile gun-blue-shot-3 sv-148 (ppointer->process (-> sv-144 gun)) *default-dead-pool*)
|
|
)
|
|
|
|
;; WARN: Return type mismatch symbol vs none.
|
|
(defun draw-beam-segment ()
|
|
#f
|
|
)
|
|
|
|
(define *found-objects* (the-as (pointer handle) (malloc 'global 112)))
|
|
|
|
(define *gun-blue-2-last-attack-id* (the-as uint 0))
|
|
|
|
(deftype timeframe-wrapper (structure)
|
|
((time time-frame)
|
|
)
|
|
)
|
|
|
|
|
|
(define *gun-blue-2-last-attack-id-time* (new 'static 'timeframe-wrapper))
|
|
|
|
;; WARN: Return type mismatch (pointer process) vs (pointer gun-blue-shot-2).
|
|
(defun fire-projectile-if-necessary ((arg0 vector) (arg1 vector) (arg2 handle))
|
|
(let ((s5-0 (new 'stack-no-clear 'collide-query))
|
|
(s3-0 #f)
|
|
)
|
|
(vector-! (-> s5-0 move-dist) arg1 arg0)
|
|
(set! (-> s5-0 start-pos quad) (-> arg0 quad))
|
|
(vector-float*! (-> s5-0 move-dist) (-> s5-0 move-dist) 2.0)
|
|
(let ((v1-5 s5-0))
|
|
(set! (-> v1-5 radius) 12288.0)
|
|
(set! (-> v1-5 collide-with) (collide-spec crate civilian enemy obstacle vehicle-sphere hit-by-others-list))
|
|
(set! (-> v1-5 ignore-process0) (handle->process arg2))
|
|
(set! (-> v1-5 ignore-process1) #f)
|
|
(set! (-> v1-5 ignore-pat)
|
|
(new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1)
|
|
)
|
|
(set! (-> v1-5 action-mask) (collide-action solid))
|
|
)
|
|
(let ((f0-2 (fill-and-probe-using-line-sphere *collide-cache* s5-0)))
|
|
(if (and (< f0-2 1.0) (!= f0-2 -100000000.0))
|
|
(set! s3-0 #t)
|
|
)
|
|
)
|
|
(the-as
|
|
(pointer gun-blue-shot-2)
|
|
(when s3-0
|
|
(when (>= (- (-> *display* game-clock frame-counter) (-> *gun-blue-2-last-attack-id-time* time)) (seconds 0.4))
|
|
(let* ((v1-19 *game-info*)
|
|
(a0-16 (+ (-> v1-19 attack-id) 1))
|
|
)
|
|
(set! (-> v1-19 attack-id) a0-16)
|
|
(set! *gun-blue-2-last-attack-id* a0-16)
|
|
)
|
|
(set! (-> *gun-blue-2-last-attack-id-time* time) (-> *display* game-clock frame-counter))
|
|
)
|
|
(let ((a1-8 (new 'stack-no-clear 'projectile-init-by-other-params)))
|
|
(set! (-> a1-8 ent) (-> *target* entity))
|
|
(set! (-> a1-8 charge) 1.0)
|
|
(set! (-> a1-8 options) (projectile-options))
|
|
(logclear! (-> a1-8 options) (projectile-options po14 po15 po16))
|
|
(set! (-> a1-8 pos quad) (-> arg0 quad))
|
|
(set! (-> a1-8 vel quad)
|
|
(-> (vector-float*! (new 'stack-no-clear 'vector) (-> s5-0 move-dist) (/ 2.0 (seconds-per-frame))) quad)
|
|
)
|
|
(set! (-> a1-8 notify-handle) (the-as handle #f))
|
|
(set! (-> a1-8 owner-handle) (process->handle *target*))
|
|
(set! (-> a1-8 target-handle) (the-as handle #f))
|
|
(set! (-> a1-8 target-pos quad) (the-as uint128 0))
|
|
(set! (-> a1-8 ignore-handle) (ppointer->handle (-> arg2 process)))
|
|
(set! (-> a1-8 attack-id) *gun-blue-2-last-attack-id*)
|
|
(set! (-> a1-8 timeout) (seconds 4))
|
|
(spawn-projectile gun-blue-shot-2 a1-8 (ppointer->process (-> *target* gun gun)) *default-dead-pool*)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
(deftype gun-blue-2-lightning-info (structure)
|
|
((pts vector 32 :inline)
|
|
(num-pts int8)
|
|
(should-draw-terminal-sparks? symbol)
|
|
(terminal-spark-pos vector :inline)
|
|
(should-draw-extension? symbol)
|
|
(extension-end-point vector :inline)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype gun-blue-lightning-command (structure)
|
|
((msg gun-blue-lightning-cmd-msg)
|
|
(lightning-info gun-blue-2-lightning-info :inline)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype gun-blue-2-lightning-tracker (process-drawable)
|
|
((lt-array (array lightning-bolt))
|
|
(should-draw-this-frame? symbol)
|
|
(last-spark-time time-frame :offset 216)
|
|
(spark-time-interval time-frame)
|
|
(last-deduct-ammo-time time-frame)
|
|
(snd-lightning sound-id)
|
|
(active-enter-time time-frame)
|
|
(revolve-angle float)
|
|
(sway-angle float)
|
|
(snd-spin sound-id)
|
|
(spin-intensity float)
|
|
(prev-targ-pos vector :inline)
|
|
(last-probe-index int16)
|
|
)
|
|
(:state-methods
|
|
active
|
|
inactive
|
|
die
|
|
test
|
|
)
|
|
(:methods
|
|
(setup-draw! (_type_ gun-blue-2-lightning-info) none)
|
|
(gun-blue-2-lightning-tracker-method-25 (_type_) object)
|
|
(gun-blue-2-lightning-tracker-method-26 (_type_ vector vector gun-blue-lightning-command) symbol)
|
|
)
|
|
)
|
|
|
|
|
|
(defmethod deactivate ((this gun-blue-2-lightning-tracker))
|
|
"Make a process dead, clean it up, remove it from the active pool, and return to dead pool."
|
|
(sound-stop (-> this snd-spin))
|
|
(sound-stop (-> this snd-lightning))
|
|
(call-parent-method this)
|
|
(none)
|
|
)
|
|
|
|
(deftype gun-blue-2-target-info (structure)
|
|
((target handle)
|
|
(start-time time-frame)
|
|
)
|
|
)
|
|
|
|
|
|
(if (zero? *gun-blue-2-targets*)
|
|
(set! *gun-blue-2-targets* (the-as (inline-array gun-blue-2-target-info) (malloc 'global 192)))
|
|
)
|
|
|
|
(deftype constraint-knot (structure)
|
|
((pt vector :inline)
|
|
(dir vector :inline)
|
|
(length float)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype rope-constraint (structure)
|
|
((constraints constraint-knot 12 :inline)
|
|
(num-knots uint8)
|
|
)
|
|
(:methods
|
|
(rope-constraint-method-9 (_type_ int) symbol)
|
|
)
|
|
)
|
|
|
|
|
|
(defmethod rope-constraint-method-9 ((this rope-constraint) (arg0 int))
|
|
(local-vars (sv-64 vector) (sv-80 vector) (sv-96 vector))
|
|
(rlet ((acc :class vf)
|
|
(vf0 :class vf)
|
|
(vf1 :class vf)
|
|
(vf2 :class vf)
|
|
(vf3 :class vf)
|
|
(vf4 :class vf)
|
|
(vf5 :class vf)
|
|
(vf6 :class vf)
|
|
)
|
|
(init-vf0-vector)
|
|
(let ((s4-0 arg0)
|
|
(s3-0 (+ (-> this num-knots) -2))
|
|
)
|
|
(while (>= (the-as int s3-0) s4-0)
|
|
(dotimes (s2-0 1)
|
|
(set! sv-64 (the-as vector (+ (the-as uint (-> this constraints 0 dir)) (* 48 s4-0))))
|
|
(let ((s1-0 (-> this constraints s4-0))
|
|
(s0-0 (-> this constraints (+ s4-0 1)))
|
|
)
|
|
(set! sv-96 (new 'stack-no-clear 'vector))
|
|
(let ((v1-6 s0-0)
|
|
(a0-7 s1-0)
|
|
)
|
|
(.lvf vf4 (&-> v1-6 pt quad))
|
|
(.lvf vf5 (&-> a0-7 pt quad))
|
|
)
|
|
(.mov.vf vf6 vf0 :mask #b1000)
|
|
(.sub.vf vf6 vf4 vf5 :mask #b111)
|
|
(.svf (&-> sv-96 quad) vf6)
|
|
0.0
|
|
(let ((f30-0 (vector-normalize-ret-len! sv-96 1.0)))
|
|
(vector-normalize! sv-64 1.0)
|
|
(let ((f0-2 (vector-dot sv-96 sv-64)))
|
|
(when (< f0-2 0.9999)
|
|
(set! sv-80 (new 'stack-no-clear 'vector))
|
|
0.0
|
|
(let* ((f28-0 (acos f0-2))
|
|
(f0-4 (* 0.000030517578 f28-0))
|
|
)
|
|
0.0
|
|
0.0
|
|
(- 32768.0 f28-0)
|
|
(let* ((f0-6 (fmax 0.0 (fmin 1.0 f0-4)))
|
|
(f0-7 (* f0-6 f0-6))
|
|
(f28-1
|
|
(fmin (fmin f28-0 (* (lerp 5461.3335 2184533.2 f0-7) (seconds-per-frame))) (* 131072.0 (seconds-per-frame)))
|
|
)
|
|
)
|
|
(let ((v1-20 sv-80))
|
|
(.lvf vf1 (&-> sv-96 quad))
|
|
(.lvf vf2 (&-> sv-64 quad))
|
|
(.outer.product.a.vf acc vf1 vf2)
|
|
(.outer.product.b.vf vf3 vf2 vf1 acc)
|
|
(.svf (&-> v1-20 quad) vf3)
|
|
)
|
|
(vector-normalize! sv-80 1.0)
|
|
(vector-rotate-around-axis! sv-96 (the-as quaternion sv-96) f28-1 sv-80)
|
|
)
|
|
)
|
|
(vector-normalize! sv-96 1.0)
|
|
(set! (-> (the-as (pointer uint128) (+ (the-as uint (-> this constraints 0 dir)) (* 48 (+ s4-0 1)))))
|
|
(-> sv-96 quad)
|
|
)
|
|
(vector+float*! (the-as vector s0-0) (the-as vector s1-0) sv-96 f30-0)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(+! s4-0 1)
|
|
)
|
|
)
|
|
(let ((s4-1 (+ (-> this num-knots) -2)))
|
|
(while (>= (the-as int s4-1) arg0)
|
|
(+ (the-as uint (-> this constraints 0 dir)) (* 48 arg0))
|
|
(let* ((s3-1 (-> this constraints arg0))
|
|
(s2-1 (-> this constraints (+ arg0 1)))
|
|
(s1-2 (vector-! (new 'stack-no-clear 'vector) (the-as vector s2-1) (the-as vector s3-1)))
|
|
)
|
|
0.0
|
|
(vector-normalize-ret-len! s1-2 1.0)
|
|
(vector+float*! (the-as vector s2-1) (the-as vector s3-1) s1-2 (-> this constraints arg0 length))
|
|
)
|
|
(+! arg0 1)
|
|
)
|
|
)
|
|
#f
|
|
)
|
|
)
|
|
|
|
(define *blue-2-lightning-shape* (new 'static 'rope-constraint))
|
|
|
|
(defstate die (gun-blue-2-lightning-tracker)
|
|
:virtual #t
|
|
:code (behavior ()
|
|
'()
|
|
)
|
|
)
|
|
|
|
(defstate inactive (gun-blue-2-lightning-tracker)
|
|
:virtual #t
|
|
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
|
(case message
|
|
(('gun-blue-lightning)
|
|
(when (= (-> (the-as gun-blue-lightning-command (-> block param 0)) msg) (gun-blue-lightning-cmd-msg active))
|
|
(if (= (-> *target* gun using-gun-type) (pickup-type gun-blue-2))
|
|
(go-virtual active)
|
|
)
|
|
)
|
|
)
|
|
(('notice)
|
|
(case (-> block param 0)
|
|
(('die)
|
|
(go-virtual die)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
:enter (behavior ()
|
|
(set-time! (-> self state-time))
|
|
)
|
|
:exit (behavior ()
|
|
(if (not (and (-> self next-state) (= (-> self next-state name) 'active)))
|
|
(sound-stop (-> self snd-spin))
|
|
)
|
|
)
|
|
:trans (behavior ()
|
|
(if (not (time-elapsed? (-> self state-time) (seconds 0.2)))
|
|
(sound-play-by-name
|
|
(static-sound-name "blue-gun2-loop")
|
|
(-> self snd-lightning)
|
|
768
|
|
(the int (* 1524.0 (lerp 0.0 -0.5 (* 0.016666668 (the float (- (current-time) (-> self state-time)))))))
|
|
0
|
|
(sound-group)
|
|
#t
|
|
)
|
|
(sound-stop (-> self snd-lightning))
|
|
)
|
|
(let ((f0-6 (lerp-scale-clamp 0.0 1.0 (-> *target* gun fire-spinv) 0.0 218453.33)))
|
|
0.0
|
|
(seek! (-> self spin-intensity) f0-6 (* 2.0 (seconds-per-frame)))
|
|
)
|
|
(if (< 0.001 (-> self spin-intensity))
|
|
(sound-play-by-name
|
|
(static-sound-name "blue-gun2-spin")
|
|
(-> self snd-spin)
|
|
(the int (* 1024.0 (lerp 0.3 1.0 (-> self spin-intensity))))
|
|
(the int (* 1524.0 (lerp -0.5 0.0 (-> self spin-intensity))))
|
|
0
|
|
(sound-group)
|
|
#t
|
|
)
|
|
(sound-stop (-> self snd-spin))
|
|
)
|
|
(if (!= (lightning-bolt-method-14 (-> self lt-array 0)) 3)
|
|
(gun-blue-2-lightning-tracker-method-25 self)
|
|
)
|
|
(dotimes (gp-3 (-> self lt-array length))
|
|
(let ((s5-2 (-> self lt-array gp-3)))
|
|
(lightning-bolt-method-11 s5-2)
|
|
(lightning-bolt-method-12 s5-2)
|
|
)
|
|
)
|
|
(if (time-elapsed? (-> self state-time) (seconds 8))
|
|
(go-virtual die)
|
|
)
|
|
)
|
|
:code sleep-code
|
|
)
|
|
|
|
(when (or (zero? *uv-loop-curve*) (!= loading-level global))
|
|
(set! *uv-loop-curve* (new 'loading-level 'curve2d-piecewise))
|
|
(curve2d-piecewise-method-10 *uv-loop-curve* 2 'loading-level (the-as int #t))
|
|
)
|
|
|
|
(set! (-> *uv-loop-curve* pts data 0 first) 0.0)
|
|
|
|
(set! (-> *uv-loop-curve* pts data 0 second) 0.0)
|
|
|
|
(set! (-> *uv-loop-curve* pts data 1 first) 1.0)
|
|
|
|
(set! (-> *uv-loop-curve* pts data 1 second) 1.0)
|
|
|
|
(if (or (zero? *blue-light-test*) (!= loading-level global))
|
|
(set! *blue-light-test* (new 'loading-level 'lightning-appearance))
|
|
)
|
|
|
|
(set! (-> *blue-light-test* base-alpha) 1.0)
|
|
|
|
(set! (-> *blue-light-test* tex-id) (the-as uint #x408f00))
|
|
|
|
(set! (-> *blue-light-test* blend-mode) (the-as uint 1))
|
|
|
|
(set! (-> *blue-light-test* alpha-1-curve) *curve-linear-down*)
|
|
|
|
(set! (-> *blue-light-test* alpha-1-mode) (the-as uint 0))
|
|
|
|
(set! (-> *blue-light-test* alpha-1-repeat-dist) 262144.0)
|
|
|
|
(set! (-> *blue-light-test* alpha-2-curve) #f)
|
|
|
|
(set! (-> *blue-light-test* alpha-2-mode) (the-as uint 3))
|
|
|
|
(set! (-> *blue-light-test* alpha-2-repeat-dist) 4096.0)
|
|
|
|
(set! (-> *blue-light-test* width-curve) *curve-linear-down*)
|
|
|
|
(set! (-> *blue-light-test* width-mode) (the-as uint 3))
|
|
|
|
(set! (-> *blue-light-test* width-repeat-dist) 4096.0)
|
|
|
|
(set! (-> *blue-light-test* uv-repeat-dist) 28672.0)
|
|
|
|
(set! (-> *blue-light-test* regenerate-time-start) (seconds 0.167))
|
|
|
|
(set! (-> *blue-light-test* regenerate-time-end) (seconds 0.25))
|
|
|
|
(set! (-> *blue-light-test* width-range-start) 1228.8)
|
|
|
|
(set! (-> *blue-light-test* width-range-end) 2048.0)
|
|
|
|
(set! (-> *blue-light-test* fade-time) (seconds 0.3))
|
|
|
|
(set! (-> *blue-light-test* uv-shift?) #t)
|
|
|
|
(set! (-> *blue-light-test* uv-shift-speed) (seconds -0.5))
|
|
|
|
(set! (-> *blue-light-test* use-sprite-bucket?) #t)
|
|
|
|
(set! (-> *blue-light-test* use-accurate-interp?) #t)
|
|
|
|
(if (or (zero? *blue-light-test-end*) (!= loading-level global))
|
|
(set! *blue-light-test-end* (new 'loading-level 'lightning-appearance))
|
|
)
|
|
|
|
(set! (-> *blue-light-test-end* base-alpha) 1.0)
|
|
|
|
(set! (-> *blue-light-test-end* tex-id) (the-as uint #x408f00))
|
|
|
|
(set! (-> *blue-light-test-end* blend-mode) (the-as uint 1))
|
|
|
|
(set! (-> *blue-light-test-end* alpha-1-curve) *curve-linear-down*)
|
|
|
|
(set! (-> *blue-light-test-end* alpha-1-mode) (the-as uint 3))
|
|
|
|
(set! (-> *blue-light-test-end* alpha-1-repeat-dist) 4096.0)
|
|
|
|
(set! (-> *blue-light-test-end* alpha-2-curve) #f)
|
|
|
|
(set! (-> *blue-light-test-end* alpha-2-mode) (the-as uint 3))
|
|
|
|
(set! (-> *blue-light-test-end* alpha-2-repeat-dist) 4096.0)
|
|
|
|
(set! (-> *blue-light-test-end* width-curve) *curve-linear-down*)
|
|
|
|
(set! (-> *blue-light-test-end* width-mode) (the-as uint 3))
|
|
|
|
(set! (-> *blue-light-test-end* width-repeat-dist) 4096.0)
|
|
|
|
(set! (-> *blue-light-test-end* uv-repeat-dist) 28672.0)
|
|
|
|
(set! (-> *blue-light-test-end* regenerate-time-start) (seconds 0.085))
|
|
|
|
(set! (-> *blue-light-test-end* regenerate-time-end) (seconds 0.117))
|
|
|
|
(set! (-> *blue-light-test-end* width-range-start) 5324.8)
|
|
|
|
(set! (-> *blue-light-test-end* width-range-end) 6144.0)
|
|
|
|
(set! (-> *blue-light-test-end* fade-time) (seconds 0.3))
|
|
|
|
(set! (-> *blue-light-test-end* uv-shift?) #t)
|
|
|
|
(set! (-> *blue-light-test-end* uv-shift-speed) (seconds -0.5))
|
|
|
|
(set! (-> *blue-light-test-end* use-sprite-bucket?) #t)
|
|
|
|
(set! (-> *blue-light-test-end* use-accurate-interp?) #t)
|
|
|
|
(if (or (zero? *blue-light-test-big*) (!= loading-level global))
|
|
(set! *blue-light-test-big* (new 'loading-level 'lightning-appearance))
|
|
)
|
|
|
|
(set! (-> *blue-light-test-big* base-alpha) 1.0)
|
|
|
|
(set! (-> *blue-light-test-big* tex-id) (the-as uint #x403f00))
|
|
|
|
(set! (-> *blue-light-test-big* blend-mode) (the-as uint 1))
|
|
|
|
(set! (-> *blue-light-test-big* alpha-1-curve) *curve-linear-down*)
|
|
|
|
(set! (-> *blue-light-test-big* alpha-1-mode) (the-as uint 0))
|
|
|
|
(set! (-> *blue-light-test-big* alpha-1-repeat-dist) 262144.0)
|
|
|
|
(set! (-> *blue-light-test-big* alpha-2-curve) #f)
|
|
|
|
(set! (-> *blue-light-test-big* alpha-2-mode) (the-as uint 3))
|
|
|
|
(set! (-> *blue-light-test-big* alpha-2-repeat-dist) 4096.0)
|
|
|
|
(set! (-> *blue-light-test-big* width-curve) *curve-linear-down*)
|
|
|
|
(set! (-> *blue-light-test-big* width-mode) (the-as uint 3))
|
|
|
|
(set! (-> *blue-light-test-big* width-repeat-dist) 4096.0)
|
|
|
|
(set! (-> *blue-light-test-big* uv-repeat-dist) 28672.0)
|
|
|
|
(set! (-> *blue-light-test-big* regenerate-time-start) (seconds 0.035))
|
|
|
|
(set! (-> *blue-light-test-big* regenerate-time-end) (seconds 0.067))
|
|
|
|
(set! (-> *blue-light-test-big* width-range-start) 8192.0)
|
|
|
|
(set! (-> *blue-light-test-big* width-range-end) 8192.0)
|
|
|
|
(set! (-> *blue-light-test-big* fade-time) (seconds 0.3))
|
|
|
|
(set! (-> *blue-light-test-big* uv-shift?) #t)
|
|
|
|
(set! (-> *blue-light-test-big* uv-shift-speed) (seconds -0.5))
|
|
|
|
(set! (-> *blue-light-test-big* use-sprite-bucket?) #t)
|
|
|
|
(set! (-> *blue-light-test-big* use-accurate-interp?) #t)
|
|
|
|
(if (or (zero? *blue-light-test-big-intense*) (!= loading-level global))
|
|
(set! *blue-light-test-big-intense* (new 'loading-level 'lightning-appearance))
|
|
)
|
|
|
|
(set! (-> *blue-light-test-big-intense* base-alpha) 0.7)
|
|
|
|
(set! (-> *blue-light-test-big-intense* tex-id) (the-as uint #x403f00))
|
|
|
|
(set! (-> *blue-light-test-big-intense* blend-mode) (the-as uint 1))
|
|
|
|
(set! (-> *blue-light-test-big-intense* alpha-1-curve) *curve-linear-down*)
|
|
|
|
(set! (-> *blue-light-test-big-intense* alpha-1-mode) (the-as uint 0))
|
|
|
|
(set! (-> *blue-light-test-big-intense* alpha-1-repeat-dist) 409600.0)
|
|
|
|
(set! (-> *blue-light-test-big-intense* alpha-2-curve) #f)
|
|
|
|
(set! (-> *blue-light-test-big-intense* alpha-2-mode) (the-as uint 3))
|
|
|
|
(set! (-> *blue-light-test-big-intense* alpha-2-repeat-dist) 4096.0)
|
|
|
|
(set! (-> *blue-light-test-big-intense* width-curve) *curve-linear-down*)
|
|
|
|
(set! (-> *blue-light-test-big-intense* width-mode) (the-as uint 3))
|
|
|
|
(set! (-> *blue-light-test-big-intense* width-repeat-dist) 4096.0)
|
|
|
|
(set! (-> *blue-light-test-big-intense* uv-repeat-dist) 28672.0)
|
|
|
|
(set! (-> *blue-light-test-big-intense* regenerate-time-start) (seconds 0.035))
|
|
|
|
(set! (-> *blue-light-test-big-intense* regenerate-time-end) (seconds 0.067))
|
|
|
|
(set! (-> *blue-light-test-big-intense* width-range-start) 28672.0)
|
|
|
|
(set! (-> *blue-light-test-big-intense* width-range-end) 28672.0)
|
|
|
|
(set! (-> *blue-light-test-big-intense* fade-time) (seconds 0.3))
|
|
|
|
(set! (-> *blue-light-test-big-intense* uv-shift?) #t)
|
|
|
|
(set! (-> *blue-light-test-big-intense* uv-shift-speed) (seconds -0.5))
|
|
|
|
(set! (-> *blue-light-test-big-intense* use-sprite-bucket?) #t)
|
|
|
|
(set! (-> *blue-light-test-big-intense* use-accurate-interp?) #t)
|
|
|
|
(if (or (zero? *blue-light-test-small-fade*) (!= loading-level global))
|
|
(set! *blue-light-test-small-fade* (new 'loading-level 'lightning-appearance))
|
|
)
|
|
|
|
(set! (-> *blue-light-test-small-fade* base-alpha) 1.0)
|
|
|
|
(set! (-> *blue-light-test-small-fade* tex-id) (the-as uint #x408f00))
|
|
|
|
(set! (-> *blue-light-test-small-fade* blend-mode) (the-as uint 1))
|
|
|
|
(set! (-> *blue-light-test-small-fade* alpha-1-curve) *curve-linear-down*)
|
|
|
|
(set! (-> *blue-light-test-small-fade* alpha-1-mode) (the-as uint 0))
|
|
|
|
(set! (-> *blue-light-test-small-fade* alpha-1-repeat-dist) 409600.0)
|
|
|
|
(set! (-> *blue-light-test-small-fade* alpha-2-curve) #f)
|
|
|
|
(set! (-> *blue-light-test-small-fade* alpha-2-mode) (the-as uint 3))
|
|
|
|
(set! (-> *blue-light-test-small-fade* alpha-2-repeat-dist) 4096.0)
|
|
|
|
(set! (-> *blue-light-test-small-fade* width-curve) *curve-linear-down*)
|
|
|
|
(set! (-> *blue-light-test-small-fade* width-mode) (the-as uint 3))
|
|
|
|
(set! (-> *blue-light-test-small-fade* width-repeat-dist) 4096.0)
|
|
|
|
(set! (-> *blue-light-test-small-fade* uv-repeat-dist) 28672.0)
|
|
|
|
(set! (-> *blue-light-test-small-fade* regenerate-time-start) (seconds 0.167))
|
|
|
|
(set! (-> *blue-light-test-small-fade* regenerate-time-end) (seconds 0.25))
|
|
|
|
(set! (-> *blue-light-test-small-fade* width-range-start) 32768.0)
|
|
|
|
(set! (-> *blue-light-test-small-fade* width-range-end) 32768.0)
|
|
|
|
(set! (-> *blue-light-test-small-fade* fade-time) (seconds 0.3))
|
|
|
|
(set! (-> *blue-light-test-small-fade* uv-shift?) #t)
|
|
|
|
(set! (-> *blue-light-test-small-fade* uv-shift-speed) (seconds -0.5))
|
|
|
|
(set! (-> *blue-light-test-small-fade* use-sprite-bucket?) #t)
|
|
|
|
(set! (-> *blue-light-test-small-fade* use-accurate-interp?) #t)
|
|
|
|
(defmethod setup-draw! ((this gun-blue-2-lightning-tracker) (arg0 gun-blue-2-lightning-info))
|
|
(cond
|
|
((-> arg0 should-draw-extension?)
|
|
(set! (-> *blue-light-test-big* alpha-1-repeat-dist) 262144.0)
|
|
(set! (-> *blue-light-test* alpha-1-repeat-dist) 262144.0)
|
|
)
|
|
((> (-> arg0 num-pts) 0)
|
|
(let* ((f0-2 (vector-vector-distance (the-as vector (-> arg0 pts)) (-> arg0 pts (+ (-> arg0 num-pts) -1))))
|
|
(f0-3 (+ 16384.0 f0-2))
|
|
)
|
|
(set! (-> *blue-light-test-big* alpha-1-repeat-dist) (fmin 262144.0 f0-3))
|
|
(set! (-> *blue-light-test* alpha-1-repeat-dist) (fmin 262144.0 f0-3))
|
|
)
|
|
)
|
|
)
|
|
(dotimes (s4-0 4)
|
|
(let ((s3-0 (-> this lt-array s4-0)))
|
|
(set! (-> s3-0 inner-point-travel-time) (seconds 0.5))
|
|
(set! (-> s3-0 snap-inner-points?) #t)
|
|
(set! (-> s3-0 appearance) *blue-light-test*)
|
|
(set! (-> s3-0 fractal-reduction) (/ (* 0.4 (logf 9.0)) (logf 12.0)))
|
|
(set! (-> s3-0 generate-mode) (the-as uint 1))
|
|
(when (< 1 (-> arg0 num-pts))
|
|
)
|
|
(set! (-> s3-0 num-active-spans) (+ (-> arg0 num-pts) -1))
|
|
(dotimes (v1-31 (-> s3-0 num-active-spans))
|
|
(let ((a0-8 (-> s3-0 spans data v1-31)))
|
|
(let ((a1-5 (-> s3-0 spans-internal data v1-31)))
|
|
(set! (-> s3-0 span-pts-start data v1-31 quad) (-> arg0 pts v1-31 quad))
|
|
(set! (-> a0-8 random-offset-size-start) 0.0)
|
|
(if (> v1-31 0)
|
|
(set! (-> a0-8 random-offset-size-start) 8192.0)
|
|
)
|
|
(set! (-> a1-5 num-inner-points) 4)
|
|
)
|
|
(set! (-> a0-8 inner-random-offset-size) 8192.0)
|
|
)
|
|
)
|
|
(let ((v1-37 (-> s3-0 spans data (-> s3-0 num-active-spans))))
|
|
(set! (-> s3-0 span-pts-start data (-> s3-0 num-active-spans) quad)
|
|
(-> arg0 pts (-> s3-0 num-active-spans) quad)
|
|
)
|
|
(set! (-> v1-37 random-offset-size-start) 0.0)
|
|
)
|
|
(lightning-bolt-method-11 s3-0)
|
|
(lightning-bolt-method-12 s3-0)
|
|
)
|
|
)
|
|
(dotimes (s4-1 2)
|
|
(let ((s3-1 (-> this lt-array (+ s4-1 4))))
|
|
(set! (-> s3-1 inner-point-travel-time) (seconds 0.085))
|
|
(set! (-> s3-1 snap-inner-points?) #t)
|
|
(set! (-> s3-1 appearance) *blue-light-test-big*)
|
|
(set! (-> s3-1 fractal-reduction) (/ (* 0.4 (logf 9.0)) (logf 12.0)))
|
|
(set! (-> s3-1 generate-mode) (the-as uint 1))
|
|
(when (< 1 (-> arg0 num-pts))
|
|
)
|
|
(set! (-> s3-1 num-active-spans) (+ (-> arg0 num-pts) -1))
|
|
(dotimes (v1-58 (-> s3-1 num-active-spans))
|
|
(let ((a0-24 (-> s3-1 spans data v1-58)))
|
|
(let ((a1-16 (-> s3-1 spans-internal data v1-58)))
|
|
(set! (-> s3-1 span-pts-start data v1-58 quad) (-> arg0 pts v1-58 quad))
|
|
(set! (-> a0-24 random-offset-size-start) 0.0)
|
|
(if (> v1-58 0)
|
|
(set! (-> a0-24 random-offset-size-start) 4096.0)
|
|
)
|
|
(set! (-> a1-16 num-inner-points) 3)
|
|
)
|
|
(set! (-> a0-24 inner-random-offset-size) 4096.0)
|
|
)
|
|
)
|
|
(let ((v1-64 (-> s3-1 spans data (-> s3-1 num-active-spans))))
|
|
(set! (-> s3-1 span-pts-start data (-> s3-1 num-active-spans) quad)
|
|
(-> arg0 pts (-> s3-1 num-active-spans) quad)
|
|
)
|
|
(set! (-> v1-64 random-offset-size-start) 0.0)
|
|
)
|
|
(lightning-bolt-method-11 s3-1)
|
|
(lightning-bolt-method-12 s3-1)
|
|
)
|
|
)
|
|
(set! (-> this root trans quad) (-> arg0 pts (+ (-> arg0 num-pts) -1) quad))
|
|
(when (-> arg0 should-draw-terminal-sparks?)
|
|
(when (time-elapsed? (-> this last-spark-time) (-> this spark-time-interval))
|
|
(set-time! (-> this last-spark-time))
|
|
(set! (-> this spark-time-interval)
|
|
(the-as
|
|
time-frame
|
|
(the int (* 5.0000005 (the float (+ (mod (the-as int (rand-uint31-gen *random-generator*)) 3) 3))))
|
|
)
|
|
)
|
|
(let ((s4-2 (+ (mod (the-as int (rand-uint31-gen *random-generator*)) 3) 3)))
|
|
(let ((v1-90 (-> this lt-array 5)))
|
|
(-> v1-90 spans data (-> v1-90 num-active-spans))
|
|
(set! (-> arg0 terminal-spark-pos quad) (-> v1-90 span-pts-start data (-> v1-90 num-active-spans) quad))
|
|
)
|
|
(set! (-> this root trans quad) (-> arg0 terminal-spark-pos quad))
|
|
(dotimes (s5-1 s4-2)
|
|
(process-drawable-shock-effect-replace
|
|
this
|
|
(-> *lightning-spec-id-table* 13)
|
|
lightning-probe-callback
|
|
256
|
|
0
|
|
40960.0
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defstate active (gun-blue-2-lightning-tracker)
|
|
:virtual #t
|
|
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
|
(case message
|
|
(('notice)
|
|
(case (-> block param 0)
|
|
(('die)
|
|
(go-virtual die)
|
|
)
|
|
)
|
|
)
|
|
(('gun-blue-lightning)
|
|
(case (-> (the-as gun-blue-lightning-command (-> block param 0)) msg)
|
|
(((gun-blue-lightning-cmd-msg inactive))
|
|
(go-virtual inactive)
|
|
)
|
|
)
|
|
#t
|
|
)
|
|
)
|
|
)
|
|
:enter (behavior ()
|
|
(set! (-> self prev-targ-pos quad) (-> (target-pos 0) quad))
|
|
(set-time! (-> self state-time))
|
|
(set-time! (-> self active-enter-time))
|
|
(set-time! (-> self last-deduct-ammo-time))
|
|
(dotimes (gp-1 (-> self lt-array length))
|
|
(lightning-bolt-method-13 (-> self lt-array gp-1) 0)
|
|
)
|
|
(set! (-> *blue-2-lightning-shape* num-knots) (the-as uint 12))
|
|
(let ((v1-17 (new 'stack-no-clear 'vector)))
|
|
(set! (-> v1-17 quad) (-> *target* gun fire-point quad))
|
|
(let ((a0-9 (vector-float*! (new 'stack-no-clear 'vector) (-> *target* gun laser-dir) 24576.0)))
|
|
(dotimes (a1-4 (the-as int (-> *blue-2-lightning-shape* num-knots)))
|
|
(set! (-> *blue-2-lightning-shape* constraints a1-4 pt quad) (-> v1-17 quad))
|
|
(set! (-> (the-as (pointer uint128) (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 a1-4))))
|
|
(-> *target* gun laser-dir quad)
|
|
)
|
|
(vector+! v1-17 v1-17 a0-9)
|
|
(set! (-> *blue-2-lightning-shape* constraints a1-4 length) 24576.0)
|
|
)
|
|
)
|
|
)
|
|
(adjust-player-ammo -1.0 (pickup-type ammo-blue))
|
|
(dotimes (v1-20 12)
|
|
(set! (-> *gun-blue-2-targets* v1-20 target) (the-as handle #f))
|
|
(set! (-> *gun-blue-2-targets* v1-20 start-time) 0)
|
|
)
|
|
(when (or (>= (- (-> *display* game-clock frame-counter) (-> *gun-blue-2-last-attack-id-time* time)) (seconds 0.4))
|
|
(< (-> *display* game-clock frame-counter) (-> *gun-blue-2-last-attack-id-time* time))
|
|
)
|
|
(let* ((v1-31 *game-info*)
|
|
(a0-21 (+ (-> v1-31 attack-id) 1))
|
|
)
|
|
(set! (-> v1-31 attack-id) a0-21)
|
|
(set! *gun-blue-2-last-attack-id* a0-21)
|
|
)
|
|
(set! (-> *gun-blue-2-last-attack-id-time* time) (-> *display* game-clock frame-counter))
|
|
)
|
|
)
|
|
:exit (behavior ()
|
|
(kill-particles (-> self part))
|
|
(dotimes (gp-0 (-> self lt-array length))
|
|
(let ((s5-0 (-> self lt-array gp-0)))
|
|
(when (zero? (lightning-bolt-method-14 s5-0))
|
|
(lightning-bolt-method-13 s5-0 2)
|
|
(lightning-bolt-method-11 s5-0)
|
|
(lightning-bolt-method-12 s5-0)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
:trans (behavior ()
|
|
(cpad-set-buzz! (-> *cpad-list* cpads 0) 1 76 (seconds 0.5))
|
|
(if (not (time-elapsed? (-> self active-enter-time) (seconds 0.2)))
|
|
(sound-play-by-name
|
|
(static-sound-name "blue-gun2-loop")
|
|
(-> self snd-lightning)
|
|
768
|
|
(the int (* 1524.0 (lerp -0.5 0.0 (* 0.016666668 (the float (- (current-time) (-> self state-time)))))))
|
|
0
|
|
(sound-group)
|
|
#t
|
|
)
|
|
(sound-play "blue-gun2-loop" :id (-> self snd-lightning) :vol 75)
|
|
)
|
|
(let ((f0-6 (lerp-scale-clamp 0.0 1.0 (-> *target* gun fire-spinv) 0.0 109226.664)))
|
|
0.0
|
|
(let ((f0-9 (- 1.0 (* (- 1.0 f0-6) (- 1.0 f0-6)))))
|
|
(seek! (-> self spin-intensity) f0-9 (* 2.0 (seconds-per-frame)))
|
|
)
|
|
)
|
|
(if (< 0.1 (-> self spin-intensity))
|
|
(sound-play-by-name
|
|
(static-sound-name "blue-gun2-spin")
|
|
(-> self snd-spin)
|
|
(the int (* 1024.0 (lerp 0.75 1.0 (-> self spin-intensity))))
|
|
(the int (* 1524.0 (lerp -0.5 0.0 (-> self spin-intensity))))
|
|
0
|
|
(sound-group)
|
|
(-> self root trans)
|
|
)
|
|
)
|
|
(+! (-> self revolve-angle) (* 65536.0 (seconds-per-frame)))
|
|
(+! (-> self sway-angle) (* 65536.0 (seconds-per-frame)))
|
|
(gun-blue-2-lightning-tracker-method-25 self)
|
|
(when (time-elapsed? (-> self last-deduct-ammo-time) (seconds 0.1))
|
|
(adjust-player-ammo-over-time
|
|
(the-as int (- (current-time) (-> self last-deduct-ammo-time)))
|
|
7.5
|
|
(pickup-type ammo-blue)
|
|
10000.0
|
|
)
|
|
(set-time! (-> self last-deduct-ammo-time))
|
|
)
|
|
(spawn (-> self part) (-> *target* gun fire-point))
|
|
(if (or (not (cpad-hold? 0 r1))
|
|
(or (>= 0.0 (get-remaining-player-ammo (pickup-type ammo-blue)))
|
|
(!= (-> *target* gun using-gun-type) 33)
|
|
(not (-> *target* gun active?))
|
|
(and (-> *target* next-state) (= (-> *target* next-state name) 'target-attack-air))
|
|
)
|
|
)
|
|
(go-virtual inactive)
|
|
)
|
|
)
|
|
:code sleep-code
|
|
:post (behavior ()
|
|
'()
|
|
)
|
|
)
|
|
|
|
(defmethod relocate ((this gun-blue-2-lightning-tracker) (offset int))
|
|
(dotimes (v1-0 (-> this lt-array length))
|
|
(if (nonzero? (-> this lt-array v1-0))
|
|
(&+! (-> this lt-array v1-0) offset)
|
|
)
|
|
)
|
|
(if (nonzero? (-> this lt-array))
|
|
(&+! (-> this lt-array) offset)
|
|
)
|
|
(call-parent-method this offset)
|
|
)
|
|
|
|
(deftype gun-blue-2-lightning-init-params (structure)
|
|
((num-beams int8)
|
|
)
|
|
)
|
|
|
|
|
|
(defskelgroup skel-gun-blue-2-tracker scenecamera scenecamera-lod0-jg -1
|
|
((scenecamera-lod0-mg (meters 999999)))
|
|
:bounds (static-spherem 0 0 0 4)
|
|
:texture-level 10
|
|
)
|
|
|
|
(defstate test (gun-blue-2-lightning-tracker)
|
|
:virtual #t
|
|
:code sleep-code
|
|
)
|
|
|
|
(defbehavior gun-blue-2-lightning-init-by-other gun-blue-2-lightning-tracker ((arg0 gun-blue-2-lightning-init-params))
|
|
(set! (-> self root) (new 'process 'trsqv))
|
|
(initialize-skeleton
|
|
self
|
|
(the-as skeleton-group (art-group-get-by-name *level* "skel-gun-blue-2-tracker" (the-as (pointer level) #f)))
|
|
(the-as pair 0)
|
|
)
|
|
(set! (-> self lt-array) (new 'process 'boxed-array lightning-bolt (-> arg0 num-beams)))
|
|
(dotimes (v1-5 6)
|
|
(set! (-> self lt-array v1-5) (the-as lightning-bolt 0))
|
|
)
|
|
(dotimes (gp-1 4)
|
|
(set! (-> self lt-array gp-1) (new 'process 'lightning-bolt))
|
|
(init! (-> self lt-array gp-1) 12 6 *blue-light-test*)
|
|
)
|
|
(set! (-> self lt-array 4) (new 'process 'lightning-bolt))
|
|
(init! (-> self lt-array 4) 12 5 *blue-light-test-big*)
|
|
(set! (-> self lt-array 5) (new 'process 'lightning-bolt))
|
|
(init! (-> self lt-array 5) 12 5 *blue-light-test-big*)
|
|
(set! (-> self revolve-angle) 0.0)
|
|
(set! (-> self sway-angle) 0.0)
|
|
(set! (-> self part) (create-launch-control (-> *part-group-id-table* 107) self))
|
|
(set! (-> self last-spark-time) 0)
|
|
(set! (-> self spark-time-interval) 0)
|
|
(set! (-> self snd-lightning) (new-sound-id))
|
|
(set! (-> self snd-spin) (new-sound-id))
|
|
(set! (-> self should-draw-this-frame?) #f)
|
|
(go-virtual active)
|
|
)
|
|
|
|
;; WARN: Return type mismatch int vs handle.
|
|
(defbehavior create-lightning-tracker-if-necessary target ()
|
|
(the-as
|
|
handle
|
|
(when (or (not (handle->process (-> self gun gun 0 extra)))
|
|
(!= (-> (handle->process (-> self gun gun 0 extra)) type) gun-blue-2-lightning-tracker)
|
|
)
|
|
(let ((gp-0 (new 'stack-no-clear 'gun-blue-2-lightning-init-params)))
|
|
(set! (-> gp-0 num-beams) 6)
|
|
(let ((v0-0 (ppointer->handle (process-spawn
|
|
gun-blue-2-lightning-tracker
|
|
:init gun-blue-2-lightning-init-by-other
|
|
gp-0
|
|
:name "gun-blue-2-lightning-tracker"
|
|
:to self
|
|
:stack-size #x29400
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> self gun gun 0 extra) (the-as handle v0-0))
|
|
v0-0
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
(defun is-valid-blue-2-target ((arg0 process-focusable) (arg1 int))
|
|
(local-vars (v0-1 symbol))
|
|
(with-pp
|
|
(when (and (!= *target* arg0)
|
|
(let ((a1-1 (new 'stack-no-clear 'event-message-block)))
|
|
(set! (-> a1-1 from) (process->ppointer pp))
|
|
(set! (-> a1-1 num-params) 0)
|
|
(set! (-> a1-1 message) 'get-vehicle)
|
|
(and (!= (send-event-function *target* a1-1) arg0)
|
|
(not (focus-test? arg0 disable dead inactive gun-no-target))
|
|
(pc-check-focus-fix arg0) ;; og:preserve-this
|
|
(or (logtest? (process-mask enemy vehicle civilian) (-> arg0 mask))
|
|
(and (logtest? (process-mask guard) (-> arg0 mask)) (-> *setting-control* user-current gun-target-guards?))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(let ((v1-16 (process->handle arg0)))
|
|
(dotimes (a0-11 arg1)
|
|
(if (= (-> *found-objects* a0-11) v1-16)
|
|
(return #f)
|
|
)
|
|
)
|
|
)
|
|
(return #t)
|
|
)
|
|
(return #f)
|
|
v0-1
|
|
)
|
|
)
|
|
|
|
(defun find-gun-blue-2-target ((arg0 vector) (arg1 int))
|
|
(local-vars (sv-32 process-drawable) (sv-36 number) (sv-40 vector))
|
|
(set! sv-32 (the-as process-drawable #f))
|
|
(set! sv-36 4096000.0)
|
|
(let ((v1-1 (new 'stack-no-clear 'vector)))
|
|
(set! (-> v1-1 quad) (-> arg0 quad))
|
|
(set! sv-40 v1-1)
|
|
)
|
|
(set! (-> sv-40 w) 0.0)
|
|
(let ((s4-0 (new 'stack-no-clear 'array 'collide-shape 384)))
|
|
(countdown (s3-0 (fill-actor-list-for-box *actor-hash* arg0 s4-0 384))
|
|
(let* ((s2-0 (-> s4-0 s3-0))
|
|
(a0-5 (if (type? s2-0 collide-shape)
|
|
s2-0
|
|
)
|
|
)
|
|
)
|
|
(when a0-5
|
|
(let* ((s1-0 (-> a0-5 process))
|
|
(s2-1 (if (type? s1-0 process-focusable)
|
|
s1-0
|
|
)
|
|
)
|
|
)
|
|
(when s2-1
|
|
(when (is-valid-blue-2-target (the-as process-focusable s2-1) arg1)
|
|
(let* ((s1-2 (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable s2-1) 3) sv-40))
|
|
(f0-2 (vector-normalize-ret-len! s1-2 1.0))
|
|
)
|
|
(when (< f0-2 (the-as float sv-36))
|
|
(set! sv-32 s2-1)
|
|
(set! sv-36 f0-2)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(let* ((s3-1 *target*)
|
|
(s4-1 (if (type? s3-1 process-focusable)
|
|
s3-1
|
|
)
|
|
)
|
|
)
|
|
(when (and s4-1 (< (vector-vector-distance (get-trans s4-1 0) arg0) (-> arg0 w)))
|
|
(when (is-valid-blue-2-target s4-1 arg1)
|
|
(let* ((gp-2 (vector-! (new 'stack-no-clear 'vector) (get-trans s4-1 3) sv-40))
|
|
(f0-4 (vector-normalize-ret-len! gp-2 1.0))
|
|
)
|
|
(when (< f0-4 (the-as float sv-36))
|
|
(set! sv-32 s4-1)
|
|
(set! sv-36 f0-4)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
sv-32
|
|
)
|
|
|
|
(defun find-gun-blue-2-target-old ((arg0 vector) (arg1 int) (arg2 vector))
|
|
(local-vars (sv-32 process-drawable) (sv-36 number) (sv-40 vector))
|
|
(set! sv-32 (the-as process-drawable #f))
|
|
(set! sv-36 16384.0)
|
|
(let ((v1-1 (new 'stack-no-clear 'vector)))
|
|
(set! (-> v1-1 quad) (-> arg0 quad))
|
|
(set! sv-40 v1-1)
|
|
)
|
|
(set! (-> arg0 w) 16384.0)
|
|
(set! (-> sv-40 w) 1.0)
|
|
(let ((s3-0 (new 'stack-no-clear 'array 'collide-shape 384)))
|
|
(countdown (s2-0 (fill-actor-list-for-box *actor-hash* arg0 s3-0 384))
|
|
(let* ((s1-0 (-> s3-0 s2-0))
|
|
(a0-5 (if (type? s1-0 collide-shape)
|
|
s1-0
|
|
)
|
|
)
|
|
)
|
|
(when a0-5
|
|
(let* ((s0-0 (-> a0-5 process))
|
|
(s1-1 (if (type? s0-0 process-focusable)
|
|
s0-0
|
|
)
|
|
)
|
|
)
|
|
(when s1-1
|
|
(when (is-valid-blue-2-target (the-as process-focusable s1-1) arg1)
|
|
(let* ((s0-2 (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable s1-1) 3) sv-40))
|
|
(f0-3 (vector-normalize-ret-len! s0-2 1.0))
|
|
(f1-1 (vector-dot s0-2 arg2))
|
|
)
|
|
(when (< f0-3 (the-as float sv-36))
|
|
(when (< 0.6 f1-1)
|
|
(set! sv-32 s1-1)
|
|
(set! sv-36 f0-3)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(let* ((s2-1 *target*)
|
|
(s3-1 (if (type? s2-1 process-focusable)
|
|
s2-1
|
|
)
|
|
)
|
|
)
|
|
(when (and s3-1 (< (vector-vector-distance (get-trans s3-1 0) arg0) (-> arg0 w)))
|
|
(when (is-valid-blue-2-target s3-1 arg1)
|
|
(let* ((s5-2 (vector-! (new 'stack-no-clear 'vector) (get-trans s3-1 3) sv-40))
|
|
(f0-5 (vector-normalize-ret-len! s5-2 1.0))
|
|
(f1-4 (vector-dot s5-2 arg2))
|
|
)
|
|
(when (< f0-5 (the-as float sv-36))
|
|
(when (< 0.6 f1-4)
|
|
(set! sv-32 s3-1)
|
|
(set! sv-36 f0-5)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
sv-32
|
|
)
|
|
|
|
(define *lightning-pts-cache* (new 'static 'inline-array vector 20
|
|
(new 'static 'vector)
|
|
(new 'static 'vector)
|
|
(new 'static 'vector)
|
|
(new 'static 'vector)
|
|
(new 'static 'vector)
|
|
(new 'static 'vector)
|
|
(new 'static 'vector)
|
|
(new 'static 'vector)
|
|
(new 'static 'vector)
|
|
(new 'static 'vector)
|
|
(new 'static 'vector)
|
|
(new 'static 'vector)
|
|
(new 'static 'vector)
|
|
(new 'static 'vector)
|
|
(new 'static 'vector)
|
|
(new 'static 'vector)
|
|
(new 'static 'vector)
|
|
(new 'static 'vector)
|
|
(new 'static 'vector)
|
|
(new 'static 'vector)
|
|
)
|
|
)
|
|
|
|
(defmethod gun-blue-2-lightning-tracker-method-26 ((this gun-blue-2-lightning-tracker) (arg0 vector) (arg1 vector) (arg2 gun-blue-lightning-command))
|
|
(let ((s3-0 (new 'stack-no-clear 'collide-query))
|
|
(s4-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
(vector+float*!
|
|
(-> s3-0 start-pos)
|
|
arg1
|
|
(vector-normalize-copy! (new 'stack-no-clear 'vector) arg0 1.0)
|
|
-7372.8
|
|
)
|
|
(vector-! (-> s3-0 move-dist) arg1 (-> s3-0 start-pos))
|
|
(vector-float*! (-> s3-0 move-dist) (-> s3-0 move-dist) 1.2)
|
|
(let ((s2-1 s3-0))
|
|
(set! (-> s2-1 radius) 409.6)
|
|
(set! (-> s2-1 collide-with)
|
|
(collide-spec backgnd obstacle vehicle-sphere hit-by-others-list pusher impenetrable-obj)
|
|
)
|
|
(set! (-> s2-1 ignore-process0) (the-as process-tree (send-event *target* 'get-vehicle)))
|
|
(set! (-> s2-1 ignore-process1) #f)
|
|
(set! (-> s2-1 ignore-pat)
|
|
(new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1)
|
|
)
|
|
(set! (-> s2-1 action-mask) (collide-action solid))
|
|
)
|
|
(vector+! s4-0 (-> s3-0 start-pos) (-> s3-0 move-dist))
|
|
(let ((f0-3 (fill-and-probe-using-line-sphere *collide-cache* s3-0)))
|
|
(when (>= f0-3 0.0)
|
|
(vector-float*! (-> s3-0 move-dist) (-> s3-0 move-dist) f0-3)
|
|
(vector+! s4-0 (-> s3-0 start-pos) (-> s3-0 move-dist))
|
|
(set! (-> arg2 lightning-info terminal-spark-pos quad) (-> s4-0 quad))
|
|
(set! (-> arg2 lightning-info num-pts) 1)
|
|
(set! (-> arg2 lightning-info pts 0 quad) (-> s4-0 quad))
|
|
(set! (-> arg2 lightning-info should-draw-terminal-sparks?) #t)
|
|
(set! (-> arg2 lightning-info should-draw-extension?) #f)
|
|
(setup-draw! this (-> arg2 lightning-info))
|
|
(return #f)
|
|
)
|
|
)
|
|
(let ((s5-1 fire-projectile-if-necessary)
|
|
(s3-1 (-> s3-0 start-pos))
|
|
)
|
|
(s5-1 s3-1 s4-0 (process->handle (send-event this 'get-vehicle)))
|
|
)
|
|
)
|
|
#t
|
|
)
|
|
|
|
(defmethod gun-blue-2-lightning-tracker-method-25 ((this gun-blue-2-lightning-tracker))
|
|
(local-vars
|
|
(sv-624 gun-info)
|
|
(sv-628 vector)
|
|
(sv-632 gun-blue-lightning-command)
|
|
(sv-640 int)
|
|
(sv-648 int)
|
|
(sv-656 (pointer int32))
|
|
(sv-1440 symbol)
|
|
(sv-1456 collide-query)
|
|
(sv-1472 collide-query)
|
|
)
|
|
(let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (target-pos 0) (-> this prev-targ-pos))))
|
|
(set! (-> s5-1 y) 0.0)
|
|
(dotimes (v1-1 12)
|
|
(vector+!
|
|
(the-as vector (-> *blue-2-lightning-shape* constraints v1-1))
|
|
(the-as vector (-> *blue-2-lightning-shape* constraints v1-1))
|
|
s5-1
|
|
)
|
|
)
|
|
)
|
|
(set! (-> this prev-targ-pos quad) (-> (target-pos 0) quad))
|
|
(set! sv-624 (-> *target* gun))
|
|
(set! sv-628 (-> *target* gun laser-dir))
|
|
(set! sv-632 (new 'stack-no-clear 'gun-blue-lightning-command))
|
|
(set! sv-640 0)
|
|
(set! sv-648 -1)
|
|
(set! sv-656 (new 'static 'array int32 12 0 0 0 0 0 0 0 0 0 0 0 0))
|
|
(vector-normalize! sv-628 1.0)
|
|
(set! (-> *blue-2-lightning-shape* constraints 0 pt quad) (-> sv-624 fire-point quad))
|
|
(set! (-> *blue-2-lightning-shape* constraints 0 dir quad) (-> sv-628 quad))
|
|
(rope-constraint-method-9 *blue-2-lightning-shape* 0)
|
|
(if (zero? (-> this last-probe-index))
|
|
(+! (-> this last-probe-index) 1)
|
|
)
|
|
(dotimes (v1-22 12)
|
|
(set! (-> *lightning-pts-cache* v1-22 quad) (-> *blue-2-lightning-shape* constraints v1-22 pt quad))
|
|
)
|
|
(if (not (gun-blue-2-lightning-tracker-method-26 this sv-628 (-> sv-624 fire-point) sv-632))
|
|
(return 0)
|
|
)
|
|
(set! (-> sv-632 msg) (gun-blue-lightning-cmd-msg active))
|
|
(set! (-> sv-632 lightning-info num-pts) 1)
|
|
(set! (-> sv-632 lightning-info should-draw-terminal-sparks?) #f)
|
|
(set! (-> sv-632 lightning-info should-draw-extension?) #f)
|
|
(let ((s5-3 1)
|
|
(s4-0 (+ (-> *blue-2-lightning-shape* num-knots) -1))
|
|
)
|
|
(while (>= (the-as int s4-0) s5-3)
|
|
(let ((s3-0 (new 'stack-no-clear 'vector)))
|
|
(set! (-> s3-0 quad) (-> *lightning-pts-cache* s5-3 quad))
|
|
(let ((s2-0 (the-as process-drawable #f)))
|
|
(let ((a0-19 (new 'stack-no-clear 'vector)))
|
|
(new 'stack-no-clear 'vector)
|
|
(set! (-> a0-19 quad) (-> s3-0 quad))
|
|
(set! (-> a0-19 w) 12288.0)
|
|
(if (not (the-as symbol s2-0))
|
|
(set! s2-0 (find-gun-blue-2-target-old
|
|
a0-19
|
|
sv-640
|
|
(the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-3)))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(cond
|
|
(s2-0
|
|
(set! (-> *found-objects* sv-640) (process->handle s2-0))
|
|
(set! (-> *gun-blue-2-targets* s5-3 target) (process->handle s2-0))
|
|
(set! (-> sv-656 s5-3) 1)
|
|
(set! sv-640 (+ sv-640 1))
|
|
(set! sv-648 s5-3)
|
|
(set! (-> s3-0 quad) (-> (get-trans (the-as process-focusable s2-0) 3) quad))
|
|
(set! (-> *lightning-pts-cache* s5-3 quad) (-> s3-0 quad))
|
|
(vector-!
|
|
(the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-3)))
|
|
(-> *lightning-pts-cache* s5-3)
|
|
(the-as vector (-> *blue-2-lightning-shape* constraints (+ s5-3 -1)))
|
|
)
|
|
(vector-normalize!
|
|
(the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-3)))
|
|
1.0
|
|
)
|
|
(dotimes (v1-65 1)
|
|
)
|
|
)
|
|
(else
|
|
(set! (-> sv-656 s5-3) 0)
|
|
0
|
|
)
|
|
)
|
|
(let ((s0-0 s3-0)
|
|
(s1-1 (new 'stack-no-clear 'vector))
|
|
)
|
|
(set! (-> s1-1 quad) (-> *lightning-pts-cache* (+ s5-3 -1) quad))
|
|
(set! sv-1440 (the-as symbol #f))
|
|
(set! sv-1456 (new 'stack-no-clear 'collide-query))
|
|
(set! (-> sv-1456 start-pos quad) (-> s1-1 quad))
|
|
(vector-! (-> sv-1456 move-dist) s0-0 s1-1)
|
|
(set! sv-1472 sv-1456)
|
|
(set! (-> sv-1472 radius) 860.16)
|
|
(set! (-> sv-1472 collide-with)
|
|
(collide-spec backgnd obstacle vehicle-sphere hit-by-others-list pusher impenetrable-obj)
|
|
)
|
|
(set! (-> sv-1472 ignore-process0) (the-as process-tree (send-event *target* 'get-vehicle)))
|
|
(set! (-> sv-1472 ignore-process1) #f)
|
|
(set! (-> sv-1472 ignore-pat)
|
|
(new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1)
|
|
)
|
|
(set! (-> sv-1472 action-mask) (collide-action solid))
|
|
(let ((f0-3 (fill-and-probe-using-line-sphere *collide-cache* sv-1456)))
|
|
(when (>= f0-3 0.0)
|
|
(vector-float*! (-> sv-1456 move-dist) (-> sv-1456 move-dist) f0-3)
|
|
(vector+! s0-0 s1-1 (-> sv-1456 move-dist))
|
|
(set! sv-1440 #t)
|
|
(set! (-> this last-probe-index) s5-3)
|
|
(cond
|
|
((> s5-3 0)
|
|
(let ((v0-11 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> sv-1456 move-dist) 1.0)))
|
|
(vector+float*! (-> sv-632 lightning-info terminal-spark-pos) s0-0 v0-11 -6144.0)
|
|
)
|
|
)
|
|
(else
|
|
(set! (-> sv-632 lightning-info terminal-spark-pos quad) (-> s0-0 quad))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(when (not s2-0)
|
|
)
|
|
(set! (-> *lightning-pts-cache* s5-3 quad) (-> s3-0 quad))
|
|
(+! (-> sv-632 lightning-info num-pts) 1)
|
|
(let ((s3-1 fire-projectile-if-necessary)
|
|
(a2-13 (if (< 1 sv-640)
|
|
(the-as int (-> *found-objects* (+ sv-640 -2)))
|
|
(process->handle (send-event this 'get-vehicle))
|
|
)
|
|
)
|
|
)
|
|
(s3-1 s1-1 s0-0 (the-as handle a2-13))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(when sv-1440
|
|
(set! (-> sv-632 lightning-info should-draw-terminal-sparks?) #t)
|
|
(set! (-> sv-632 lightning-info should-draw-extension?) #f)
|
|
0
|
|
(goto cfg-54)
|
|
)
|
|
(+! s5-3 1)
|
|
)
|
|
)
|
|
(label cfg-54)
|
|
(if (and (= sv-648 (+ (-> sv-632 lightning-info num-pts) -2))
|
|
(not (-> sv-632 lightning-info should-draw-extension?))
|
|
)
|
|
(set! (-> sv-632 lightning-info should-draw-terminal-sparks?) #f)
|
|
)
|
|
(dotimes (s5-4 (-> sv-632 lightning-info num-pts))
|
|
(set! (-> sv-632 lightning-info pts s5-4 quad) (-> *lightning-pts-cache* s5-4 quad))
|
|
(when (and (> s5-4 0) (zero? (-> sv-656 s5-4)))
|
|
(let ((s4-1
|
|
(matrix-f-u-compose
|
|
(new 'stack-no-clear 'matrix)
|
|
(the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-4)))
|
|
*up-vector*
|
|
)
|
|
)
|
|
(f0-9 (the float (sar (shl (the int (+ (-> this revolve-angle) (* 6144.0 (the float s5-4)))) 48) 48)))
|
|
(s3-2 (-> sv-632 lightning-info pts s5-4))
|
|
)
|
|
(the float (sar (shl (the int (+ (-> this sway-angle) (* 5461.3335 (the float s5-4)))) 48) 48))
|
|
(vector-rotate-around-axis!
|
|
(-> s4-1 uvec)
|
|
(the-as quaternion (-> s4-1 uvec))
|
|
f0-9
|
|
(the-as vector (+ (the-as uint (-> *blue-2-lightning-shape* constraints 0 dir)) (* 48 s5-4)))
|
|
)
|
|
(vector-normalize! (-> s4-1 uvec) 1.0)
|
|
(vector+float*! s3-2 s3-2 (-> s4-1 uvec) 2048.0)
|
|
)
|
|
)
|
|
)
|
|
(setup-draw! this (-> sv-632 lightning-info))
|
|
)
|
|
|
|
;; WARN: Return type mismatch int vs object.
|
|
(defbehavior gun-fire-blue-2 target ()
|
|
(if (and (-> *target* next-state) (= (-> *target* next-state name) 'target-attack-air))
|
|
(return (the-as object 0))
|
|
)
|
|
(create-lightning-tracker-if-necessary)
|
|
(let ((v1-8 (new 'stack-no-clear 'gun-blue-lightning-command)))
|
|
(set! (-> v1-8 msg) (gun-blue-lightning-cmd-msg active))
|
|
(send-event (handle->process (-> self gun gun 0 extra)) 'gun-blue-lightning v1-8)
|
|
)
|
|
0
|
|
)
|
|
|
|
(defbehavior gun-fire-blue-2-old target ()
|
|
(local-vars
|
|
(sv-608 gun-info)
|
|
(sv-612 vector)
|
|
(sv-616 gun-blue-lightning-command)
|
|
(sv-768 vector)
|
|
(sv-772 vector)
|
|
(sv-776 vector)
|
|
(sv-784 int)
|
|
(sv-792 int)
|
|
(sv-800 vector)
|
|
(sv-848 vector)
|
|
(sv-852 vector)
|
|
)
|
|
(create-lightning-tracker-if-necessary)
|
|
(set! sv-608 (-> self gun))
|
|
(set! sv-612 (-> self gun fire-dir-out))
|
|
(set! sv-616 (new 'stack-no-clear 'gun-blue-lightning-command))
|
|
(cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 (seconds 0.1))
|
|
(set! (-> sv-616 msg) (gun-blue-lightning-cmd-msg active))
|
|
(set! (-> sv-616 lightning-info num-pts) 0)
|
|
(set! (-> sv-616 lightning-info should-draw-terminal-sparks?) #f)
|
|
(set! (-> sv-616 lightning-info should-draw-extension?) #t)
|
|
(vector-normalize! sv-612 1.0)
|
|
(when (not (do-fire-backcheck (-> sv-608 fire-point) sv-612))
|
|
(let ((a0-5 (handle->process (-> sv-608 gun 0 extra))))
|
|
(send-event a0-5 'gun-blue-lightning sv-616)
|
|
)
|
|
(return 0)
|
|
)
|
|
(let ((v1-23 (new 'stack-no-clear 'vector)))
|
|
(set! (-> v1-23 quad) (-> sv-608 fire-point quad))
|
|
(set! sv-768 v1-23)
|
|
)
|
|
(set! sv-772 (vector+float*! (new 'stack-no-clear 'vector) (-> sv-608 fire-point) sv-612 409600.0))
|
|
(let ((v1-26 (new 'stack-no-clear 'vector)))
|
|
(set! (-> v1-26 quad) (-> sv-612 quad))
|
|
(set! sv-776 v1-26)
|
|
)
|
|
(set! sv-784 0)
|
|
(set! sv-792 -1)
|
|
(set! sv-800 (new 'stack-no-clear 'vector))
|
|
(set! (-> sv-616 lightning-info pts (-> sv-616 lightning-info num-pts) quad) (-> sv-768 quad))
|
|
(+! (-> sv-616 lightning-info num-pts) 1)
|
|
(vector-! sv-800 sv-772 sv-768)
|
|
(dotimes (gp-0 8)
|
|
(let ((f30-0 32768.0))
|
|
(set! sv-848 (new 'stack-no-clear 'vector))
|
|
(set! sv-852 (vector+float*! (new 'stack-no-clear 'vector) sv-768 sv-612 f30-0))
|
|
(set! (-> sv-848 quad) (-> sv-852 quad))
|
|
(set! (-> sv-848 w) 20480.0)
|
|
(let ((s5-0 (the-as process #f)))
|
|
(let ((s4-0 #f))
|
|
(when (< gp-0 7)
|
|
(when (and (handle->process (-> *gun-blue-2-targets* gp-0 target))
|
|
(not (time-elapsed? (-> *gun-blue-2-targets* gp-0 start-time) (seconds 0.5)))
|
|
)
|
|
(let* ((s2-0 (handle->process (-> *gun-blue-2-targets* gp-0 target)))
|
|
(s3-0 (if (type? s2-0 process-focusable)
|
|
s2-0
|
|
)
|
|
)
|
|
)
|
|
(when (is-valid-blue-2-target (the-as process-focusable s3-0) sv-784)
|
|
(let ((s2-2 (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable s3-0) 3) sv-852)))
|
|
(vector-normalize-ret-len! s2-2 1.0)
|
|
(let ((f0-5 (vector-dot s2-2 sv-776)))
|
|
(when (< 0.87 f0-5)
|
|
(set! s4-0 #t)
|
|
(set! s5-0 s3-0)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(when (not s4-0)
|
|
(set! (-> *gun-blue-2-targets* gp-0 target) (the-as handle #f))
|
|
(set-time! (-> *gun-blue-2-targets* gp-0 start-time))
|
|
)
|
|
(if (not s5-0)
|
|
(set! s5-0 (find-gun-blue-2-target-old sv-848 sv-784 sv-776))
|
|
)
|
|
)
|
|
)
|
|
(cond
|
|
(s5-0
|
|
(set! (-> *found-objects* sv-784) (process->handle s5-0))
|
|
(set! (-> *gun-blue-2-targets* gp-0 target) (process->handle s5-0))
|
|
(set! sv-784 (+ sv-784 1))
|
|
(set! sv-792 gp-0)
|
|
(vector-! sv-800 (get-trans (the-as process-focusable s5-0) 3) sv-768)
|
|
(vector-normalize! sv-800 1.0)
|
|
)
|
|
(else
|
|
(vector-normalize! sv-800 1.0)
|
|
(let ((f0-7 (vector-dot sv-800 sv-776)))
|
|
(when (< f0-7 0.866)
|
|
(let ((s5-1 (new 'stack-no-clear 'vector))
|
|
(f28-0 0.0)
|
|
)
|
|
(acos f0-7)
|
|
5461.3335
|
|
(vector-cross! s5-1 sv-800 sv-776)
|
|
(vector-normalize! s5-1 1.0)
|
|
(vector-rotate-around-axis! sv-800 (the-as quaternion sv-776) f28-0 s5-1)
|
|
)
|
|
)
|
|
)
|
|
(vector-normalize! sv-800 1.0)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> sv-776 quad) (-> sv-800 quad))
|
|
(let ((s5-3 (vector+float*! (new 'stack-no-clear 'vector) sv-768 sv-800 f30-0)))
|
|
(let ((s4-3 #f))
|
|
(let ((s3-1 (new 'stack-no-clear 'collide-query)))
|
|
(set! (-> s3-1 start-pos quad) (-> sv-768 quad))
|
|
(vector-! (-> s3-1 move-dist) s5-3 sv-768)
|
|
(let ((v1-99 s3-1))
|
|
(set! (-> v1-99 radius) 40.96)
|
|
(set! (-> v1-99 collide-with)
|
|
(collide-spec backgnd vehicle-sphere hit-by-others-list pusher impenetrable-obj)
|
|
)
|
|
(set! (-> v1-99 ignore-process0) #f)
|
|
(set! (-> v1-99 ignore-process1) #f)
|
|
(set! (-> v1-99 ignore-pat)
|
|
(new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1)
|
|
)
|
|
(set! (-> v1-99 action-mask) (collide-action solid))
|
|
)
|
|
(let ((f0-11 (fill-and-probe-using-line-sphere *collide-cache* s3-1)))
|
|
(when (>= f0-11 0.0)
|
|
(vector-float*! (-> s3-1 move-dist) (-> s3-1 move-dist) f0-11)
|
|
(vector+! s5-3 sv-768 (-> s3-1 move-dist))
|
|
(set! s4-3 #t)
|
|
(cond
|
|
((> gp-0 0)
|
|
(let ((a0-80 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s3-1 move-dist) 1.0)))
|
|
(vector+float*! (-> sv-616 lightning-info terminal-spark-pos) s5-3 a0-80 -12288.0)
|
|
)
|
|
)
|
|
(else
|
|
(set! (-> sv-616 lightning-info terminal-spark-pos quad) (-> s5-3 quad))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> sv-616 lightning-info pts (-> sv-616 lightning-info num-pts) quad) (-> s5-3 quad))
|
|
(+! (-> sv-616 lightning-info num-pts) 1)
|
|
(let ((s3-2 fire-projectile-if-necessary)
|
|
(s2-3 sv-768)
|
|
(s1-0 s5-3)
|
|
(a2-7 (if (< 1 sv-784)
|
|
(the-as int (-> *found-objects* (+ sv-784 -2)))
|
|
(process->handle (send-event self 'get-vehicle))
|
|
)
|
|
)
|
|
)
|
|
(s3-2 s2-3 s1-0 (the-as handle a2-7))
|
|
)
|
|
(set! (-> sv-768 quad) (-> s5-3 quad))
|
|
(when s4-3
|
|
(set! (-> sv-616 lightning-info should-draw-terminal-sparks?) #t)
|
|
(set! (-> sv-616 lightning-info should-draw-extension?) #f)
|
|
0
|
|
(goto cfg-70)
|
|
)
|
|
)
|
|
(set! (-> sv-616 lightning-info terminal-spark-pos quad) (-> s5-3 quad))
|
|
)
|
|
)
|
|
)
|
|
(label cfg-70)
|
|
(if (and (= sv-792 (+ (-> sv-616 lightning-info num-pts) -2))
|
|
(not (-> sv-616 lightning-info should-draw-extension?))
|
|
)
|
|
(set! (-> sv-616 lightning-info should-draw-terminal-sparks?) #f)
|
|
)
|
|
(let ((s5-4 (-> sv-616 lightning-info pts (+ (-> sv-616 lightning-info num-pts) -1))))
|
|
(when (-> sv-616 lightning-info should-draw-extension?)
|
|
(let ((gp-2 (vector+float*! (new 'stack-no-clear 'vector) s5-4 sv-800 409600.0))
|
|
(s4-4 (new 'stack-no-clear 'collide-query))
|
|
)
|
|
(set! (-> s4-4 start-pos quad) (-> s5-4 quad))
|
|
(vector-! (-> s4-4 move-dist) gp-2 s5-4)
|
|
(let ((v1-154 s4-4))
|
|
(set! (-> v1-154 radius) 40.96)
|
|
(set! (-> v1-154 collide-with)
|
|
(collide-spec backgnd vehicle-sphere hit-by-others-list pusher impenetrable-obj)
|
|
)
|
|
(set! (-> v1-154 ignore-process0) #f)
|
|
(set! (-> v1-154 ignore-process1) #f)
|
|
(set! (-> v1-154 ignore-pat)
|
|
(new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1)
|
|
)
|
|
(set! (-> v1-154 action-mask) (collide-action solid))
|
|
)
|
|
(let ((f0-15 (fill-and-probe-using-line-sphere *collide-cache* s4-4)))
|
|
(when (>= f0-15 0.0)
|
|
(vector-float*! (-> s4-4 move-dist) (-> s4-4 move-dist) f0-15)
|
|
(vector+! gp-2 s5-4 (-> s4-4 move-dist))
|
|
)
|
|
)
|
|
(set! (-> sv-616 lightning-info extension-end-point quad) (-> gp-2 quad))
|
|
(set! (-> sv-616 lightning-info should-draw-terminal-sparks?) #t)
|
|
(let ((a0-122 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s4-4 move-dist) 1.0)))
|
|
(vector+float*! (-> sv-616 lightning-info terminal-spark-pos) gp-2 a0-122 -12288.0)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(let ((a0-124 (handle->process (-> sv-608 gun 0 extra))))
|
|
(send-event a0-124 'gun-blue-lightning sv-616)
|
|
)
|
|
)
|
|
|
|
(defbehavior target-gun-can-fire-blue? target ((arg0 pickup-type))
|
|
#t
|
|
)
|
|
|
|
(define *last-fire-blue-time* (the-as time-frame 0))
|
|
|
|
;; WARN: Return type mismatch object vs (pointer process).
|
|
(defbehavior target-gun-fire-blue target ((arg0 pickup-type))
|
|
(the-as (pointer process) (case arg0
|
|
(((pickup-type gun-blue-1))
|
|
(gun-fire-blue-1)
|
|
)
|
|
(((pickup-type gun-blue-2))
|
|
(gun-fire-blue-2)
|
|
)
|
|
(((pickup-type gun-blue-3))
|
|
(let ((f0-0 -2.0))
|
|
(if (logtest? (game-secrets gun-upgrade-blue-3) (-> *game-info* secrets))
|
|
(set! f0-0 -1.5)
|
|
)
|
|
(adjust-player-ammo f0-0 (pickup-type ammo-blue))
|
|
)
|
|
(when (time-elapsed? *last-fire-blue-time* (seconds 0.1))
|
|
(sound-play "blue-gun3-shot")
|
|
(set! *last-fire-blue-time* (current-time))
|
|
)
|
|
(sound-play "blue-gun3-trace")
|
|
(cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.1))
|
|
(dotimes (s5-2 3)
|
|
(gun-fire-blue-3)
|
|
)
|
|
#f
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
(deftype gun-blue-shot (projectile)
|
|
((init-pos vector :inline)
|
|
(init-dir vector :inline)
|
|
(collide-normal vector :inline)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype gun-blue-shot-2 (gun-blue-shot)
|
|
()
|
|
)
|
|
|
|
|
|
(set! (-> *lightning-spec-id-table* 14) (new 'static 'lightning-spec
|
|
:name "lightning-blue-2-impact-shot-attack-thick"
|
|
:flags (lightning-spec-flags lsf0)
|
|
:start-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)
|
|
:end-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)
|
|
:fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5)
|
|
:fade-start-factor 1.0
|
|
:fade-time 30.0
|
|
:texture (new 'static 'texture-id :index #x3f :page #x4)
|
|
:reduction 0.42
|
|
:num-points 16
|
|
:box-size 8192.0
|
|
:merge-factor 0.6
|
|
:merge-count 2
|
|
:radius 3276.8
|
|
:duration 60.0
|
|
:sound (static-sound-spec "stretched-zap" :group 0)
|
|
)
|
|
)
|
|
|
|
(defmethod deal-damage! ((this gun-blue-shot-2) (arg0 process) (arg1 event-message-block))
|
|
(if (and (logtest? (process-mask guard) (-> arg0 mask))
|
|
(not (-> *setting-control* user-current gun-target-guards?))
|
|
)
|
|
(set! (-> this damage) 0.0)
|
|
)
|
|
(when (logtest? (game-secrets gun-upgrade-blue-2) (-> *game-info* secrets))
|
|
(if (logtest? (process-mask kg-robot) (-> arg0 mask))
|
|
(set! (-> this damage) (* 2.0 (-> this damage)))
|
|
)
|
|
)
|
|
(if (< (mod (the-as int (rand-uint31-gen *random-generator*)) 11) 2)
|
|
(process-drawable-shock-effect
|
|
(the-as process-drawable arg0)
|
|
(-> *lightning-spec-id-table* 12)
|
|
lightning-probe-callback
|
|
(-> *part-id-table* 664)
|
|
0
|
|
0
|
|
40960.0
|
|
)
|
|
)
|
|
(call-parent-method this arg0 arg1)
|
|
)
|
|
|
|
(defmethod projectile-method-24 ((this gun-blue-shot))
|
|
(with-pp
|
|
(let* ((s4-0 (-> *part-id-table* 236))
|
|
(s3-0 (get-field-spec-by-id s4-0 (sp-field-id spt-omega)))
|
|
(a1-1 (new 'stack-no-clear 'event-message-block))
|
|
)
|
|
(set! (-> a1-1 from) (process->ppointer pp))
|
|
(set! (-> a1-1 num-params) 1)
|
|
(set! (-> a1-1 message) 'eject-point)
|
|
(set! (-> a1-1 param 0) (the-as uint (new 'stack-no-clear 'vector)))
|
|
(let ((s5-0 (the-as vector (send-event-function (ppointer->process (-> this parent)) a1-1))))
|
|
(when s5-0
|
|
(when s3-0
|
|
(let ((s1-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> this starting-dir) 1.0))
|
|
(s2-0 (new 'stack-no-clear 'collide-query))
|
|
)
|
|
(vector-rotate-y! s1-0 s1-0 16384.0)
|
|
(vector+float*! s1-0 s5-0 s1-0 -8806.4)
|
|
(set! (-> s2-0 start-pos quad) (-> s1-0 quad))
|
|
(vector-float*! (-> s2-0 move-dist) (-> this root dynam gravity-normal) -81920.0)
|
|
(let ((v1-15 s2-0))
|
|
(set! (-> v1-15 radius) 1228.8)
|
|
(set! (-> v1-15 collide-with) (collide-spec backgnd obstacle hit-by-player-list hit-by-others-list))
|
|
(set! (-> v1-15 ignore-process0) this)
|
|
(set! (-> v1-15 ignore-process1) (ppointer->process (-> this parent)))
|
|
(set! (-> v1-15 ignore-pat)
|
|
(new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1)
|
|
)
|
|
(set! (-> v1-15 action-mask) (collide-action solid))
|
|
)
|
|
(if (>= (fill-and-probe-using-line-sphere *collide-cache* s2-0) 0.0)
|
|
(set! (-> s3-0 initial-valuef)
|
|
(fmin (+ 1638.4 (-> s2-0 best-other-tri intersect y)) (+ -1228.8 (-> this starting-pos y)))
|
|
)
|
|
(set! (-> s3-0 initial-valuef) (+ -81920.0 (-> this starting-pos y)))
|
|
)
|
|
)
|
|
)
|
|
(let ((s4-1 (get-field-spec-by-id s4-0 (sp-field-id spt-rotate-y))))
|
|
(if s4-1
|
|
(set! (-> s4-1 initial-valuef) (y-angle (-> this root)))
|
|
)
|
|
)
|
|
(launch-particles (-> *part-id-table* 236) s5-0)
|
|
(let ((s4-2 (get-field-spec-by-id (-> *part-id-table* 235) (sp-field-id spt-rotate-y))))
|
|
(if s4-2
|
|
(set! (-> s4-2 initial-valuef) (y-angle (-> this root)))
|
|
)
|
|
)
|
|
(launch-particles (-> *part-id-table* 235) s5-0)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
)
|
|
|
|
(defmethod projectile-method-26 ((this gun-blue-shot))
|
|
(rlet ((vf0 :class vf)
|
|
(vf4 :class vf)
|
|
(vf5 :class vf)
|
|
(vf6 :class vf)
|
|
)
|
|
(init-vf0-vector)
|
|
(let ((s3-1 (vector-! (new 'stack-no-clear 'vector) (-> this root trans) (-> this init-pos))))
|
|
(draw-beam (-> *part-id-table* 231) (-> this init-pos) s3-1 #t)
|
|
(draw-beam (-> *part-id-table* 234) (-> this init-pos) (-> this starting-dir) #f)
|
|
(let ((s5-0 (-> *part-id-table* 246))
|
|
(s4-0 (-> *part-id-table* 245))
|
|
)
|
|
(new 'stack-no-clear 'vector)
|
|
(let ((s2-0 (vector-reflect! (new 'stack-no-clear 'vector) s3-1 (-> this collide-normal))))
|
|
(vector-normalize! s2-0 1.0)
|
|
(get-field-spec-by-id s5-0 (sp-field-id spt-conerot-x))
|
|
(get-field-spec-by-id s5-0 (sp-field-id spt-conerot-y))
|
|
(get-field-spec-by-id s5-0 (sp-field-id spt-conerot-z))
|
|
(let ((a1-7 (new 'stack-no-clear 'matrix))
|
|
(s1-0 (new 'stack-no-clear 'vector))
|
|
(s3-2 (new 'stack-no-clear 'vector))
|
|
)
|
|
(vector-cross! (-> a1-7 rvec) *y-vector* s2-0)
|
|
(vector-cross! (-> a1-7 uvec) s2-0 (-> a1-7 rvec))
|
|
(set! (-> a1-7 fvec quad) (-> s2-0 quad))
|
|
(matrix->eul (the-as euler-angles s1-0) a1-7 21)
|
|
(vector-negate! s3-2 s1-0)
|
|
(let ((a0-14 s3-2))
|
|
(let ((v1-16 s3-2))
|
|
(let ((a1-10 -3640.889))
|
|
(.mov vf6 a1-10)
|
|
)
|
|
(.lvf vf4 (&-> v1-16 quad))
|
|
)
|
|
(.add.x.vf vf5 vf0 vf0 :mask #b1000)
|
|
(.add.x.vf vf5 vf4 vf6 :mask #b111)
|
|
(.svf (&-> a0-14 quad) vf5)
|
|
)
|
|
(sparticle-set-conerot s5-0 s3-2)
|
|
(sparticle-set-conerot s4-0 s3-2)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(let ((v1-24 (cond
|
|
((logtest? (-> *part-group-id-table* 90 flags) (sp-group-flag sp13))
|
|
(set! (-> *launch-matrix* trans quad) (-> this root trans quad))
|
|
(part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 90))
|
|
)
|
|
(else
|
|
(set! (-> *launch-matrix* trans quad) (-> this root trans quad))
|
|
(part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 90))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(send-event (ppointer->process v1-24) 'clock this)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
)
|
|
|
|
(defmethod deal-damage! ((this gun-blue-shot) (arg0 process) (arg1 event-message-block))
|
|
(if (and (logtest? (process-mask guard) (-> arg0 mask))
|
|
(not (-> *setting-control* user-current gun-target-guards?))
|
|
)
|
|
(set! (-> this damage) 0.0)
|
|
)
|
|
(+! (-> *game-info* shots-hit 2) 1.0)
|
|
(call-parent-method this arg0 arg1)
|
|
)
|
|
|
|
(defmethod projectile-method-27 ((this gun-blue-shot))
|
|
(draw-beam (-> *part-id-table* 231) (-> this init-pos) (-> this init-dir) #f)
|
|
(draw-beam (-> *part-id-table* 234) (-> this init-pos) (-> this starting-dir) #f)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; WARN: Return type mismatch sound-id vs none.
|
|
(defmethod play-impact-sound ((this gun-blue-shot) (arg0 projectile-options))
|
|
(let ((v1-0 arg0))
|
|
(cond
|
|
((zero? v1-0)
|
|
(sound-play "blue-shot-fire")
|
|
)
|
|
((= v1-0 (projectile-options po0))
|
|
(sound-play "blue-shot-hit")
|
|
)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
(defmethod made-impact? ((this gun-blue-shot))
|
|
(let ((v1-0 (-> this root))
|
|
(t1-0 (new 'stack-no-clear 'collide-query))
|
|
)
|
|
(let ((a1-0 t1-0))
|
|
(set! (-> a1-0 radius) (-> v1-0 root-prim prim-core world-sphere w))
|
|
(set! (-> a1-0 collide-with) (-> v1-0 root-prim prim-core collide-with))
|
|
(set! (-> a1-0 ignore-process0) this)
|
|
(set! (-> a1-0 ignore-process1) (ppointer->process (-> this parent)))
|
|
(set! (-> a1-0 ignore-pat)
|
|
(new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1)
|
|
)
|
|
(set! (-> a1-0 action-mask) (collide-action solid))
|
|
)
|
|
(fill-and-try-snap-to-surface v1-0 (-> v1-0 transv) -12288.0 12697.6 -2048.0 t1-0)
|
|
)
|
|
)
|
|
|
|
(defun gun-blue-shot-move ((arg0 gun-blue-shot))
|
|
(projectile-move-fill-line-sphere arg0)
|
|
(when (logtest? (-> arg0 root status) (collide-status touch-actor))
|
|
)
|
|
(if (logtest? (-> arg0 root status) (collide-status touch-surface))
|
|
(go (method-of-object arg0 impact))
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; WARN: Return type mismatch int vs collide-status.
|
|
(defun cshape-reaction-blue-shot ((arg0 control-info) (arg1 collide-query) (arg2 vector) (arg3 vector))
|
|
(vector-reset! arg2)
|
|
(let ((a1-1 (new 'stack-no-clear 'vector)))
|
|
(vector-float*! a1-1 (-> arg1 move-dist) (-> arg1 best-dist))
|
|
(move-by-vector! arg0 a1-1)
|
|
)
|
|
(set! (-> (the-as gun-blue-shot (-> arg0 process)) collide-normal quad) (-> arg1 best-other-tri normal quad))
|
|
(let ((v0-1 4))
|
|
(logior! (-> arg0 status) v0-1)
|
|
(the-as collide-status v0-1)
|
|
)
|
|
)
|
|
|
|
(defmethod setup-collision! ((this gun-blue-shot))
|
|
(let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player))))
|
|
(set! (-> s5-0 dynam) (copy *standard-dynamics* 'process))
|
|
(set! (-> s5-0 reaction) cshape-reaction-blue-shot)
|
|
(set! (-> s5-0 no-reaction)
|
|
(the-as (function collide-shape-moving collide-query vector vector object) nothing)
|
|
)
|
|
(set! (-> s5-0 penetrate-using) (penetrate jak-blue-shot))
|
|
(let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0)))
|
|
(set! (-> s5-0 total-prims) (the-as uint 3))
|
|
(set! (-> s4-0 prim-core collide-as) (collide-spec projectile))
|
|
(set! (-> s4-0 prim-core collide-with)
|
|
(collide-spec backgnd bot crate civilian enemy obstacle vehicle-sphere hit-by-others-list pusher shield)
|
|
)
|
|
(set! (-> s4-0 prim-core action) (collide-action solid))
|
|
(set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 1228.8)
|
|
(set! (-> s5-0 root-prim) s4-0)
|
|
)
|
|
(let ((v1-13 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
|
|
(set! (-> v1-13 prim-core collide-as) (collide-spec projectile))
|
|
(set! (-> v1-13 prim-core collide-with) (collide-spec backgnd obstacle pusher shield))
|
|
(set! (-> v1-13 prim-core action) (collide-action solid))
|
|
(set-vector! (-> v1-13 local-sphere) 0.0 0.0 0.0 819.2)
|
|
)
|
|
(let ((v1-15 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
|
|
(set! (-> v1-15 prim-core collide-as) (collide-spec projectile))
|
|
(set! (-> v1-15 prim-core collide-with)
|
|
(collide-spec bot crate civilian enemy vehicle-sphere hit-by-others-list player-list)
|
|
)
|
|
(set! (-> v1-15 prim-core action) (collide-action solid))
|
|
(set-vector! (-> v1-15 local-sphere) 0.0 0.0 0.0 4096.0)
|
|
)
|
|
(set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
|
|
(let ((v1-18 (-> s5-0 root-prim)))
|
|
(set! (-> s5-0 backup-collide-as) (-> v1-18 prim-core collide-as))
|
|
(set! (-> s5-0 backup-collide-with) (-> v1-18 prim-core collide-with))
|
|
)
|
|
(set! (-> s5-0 max-iteration-count) (the-as uint 1))
|
|
(set! (-> s5-0 event-self) 'touched)
|
|
(set! (-> this root) s5-0)
|
|
)
|
|
(set! (-> this root pat-ignore-mask)
|
|
(new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1 :board #x1)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod init-proj-settings! ((this gun-blue-shot))
|
|
(with-pp
|
|
(+! (-> *game-info* shots-fired 2) 1.0)
|
|
(cpad-set-buzz! (-> *cpad-list* cpads 0) 1 204 (seconds 0.1))
|
|
(set! (-> this init-pos quad) (-> this root trans quad))
|
|
(set! (-> this init-dir quad) (-> this starting-dir quad))
|
|
(vector-normalize-copy! (-> this root transv) (-> this init-dir) (* 327680.0 (-> pp clock frames-per-second)))
|
|
(set! (-> this attack-mode) 'eco-blue)
|
|
(set! (-> this max-speed) (* 327680.0 (-> pp clock frames-per-second)))
|
|
(set! (-> this timeout) 1)
|
|
(set! (-> this move) gun-blue-shot-move)
|
|
(vector-reset! (-> this collide-normal))
|
|
(set! (-> this damage) 2.0)
|
|
(if (logtest? (game-secrets gun-upgrade-blue-1) (-> *game-info* secrets))
|
|
(set! (-> this damage) 2.5)
|
|
)
|
|
(logior! (-> this options) (projectile-options po13))
|
|
0
|
|
(none)
|
|
)
|
|
)
|
|
|
|
(defmethod init-proj-settings! ((this gun-blue-shot-2))
|
|
(with-pp
|
|
(set! (-> this init-pos quad) (-> this root trans quad))
|
|
(set! (-> this init-dir quad) (-> this starting-dir quad))
|
|
(vector-normalize-copy! (-> this root transv) (-> this init-dir) (* 327680.0 (-> pp clock frames-per-second)))
|
|
(set! (-> this attack-mode) 'eco-blue)
|
|
(set! (-> this max-speed) (* 327680.0 (-> pp clock frames-per-second)))
|
|
(set! (-> this timeout) 1)
|
|
(set! (-> this move) gun-blue-shot-move)
|
|
(vector-reset! (-> this collide-normal))
|
|
(set! (-> this damage) 2.5)
|
|
(set! (-> this vehicle-damage-factor) 2.0)
|
|
(set! (-> this vehicle-impulse-factor) 0.5)
|
|
(logior! (-> this options) (projectile-options po13))
|
|
(set! (-> this sound-id) (new-sound-id))
|
|
0
|
|
(none)
|
|
)
|
|
)
|
|
|
|
(defmethod projectile-method-24 ((this gun-blue-shot-2))
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod projectile-method-27 ((this gun-blue-shot-2))
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod projectile-method-25 ((this gun-blue-shot-2))
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod projectile-method-26 ((this gun-blue-shot-3))
|
|
(let ((s5-0 sphere-in-view-frustum?)
|
|
(a0-2 (new 'stack 'sphere))
|
|
)
|
|
(set! (-> a0-2 quad) (-> this root trans quad))
|
|
(set! (-> a0-2 r) 4096.0)
|
|
(when (s5-0 a0-2)
|
|
(let ((v1-11
|
|
(cond
|
|
((logtest? (-> *part-group-id-table* 108 flags) (sp-group-flag sp13))
|
|
(set! (-> *launch-matrix* trans quad) (-> this root trans quad))
|
|
(part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 108))
|
|
)
|
|
(else
|
|
(set! (-> *launch-matrix* trans quad) (-> this root trans quad))
|
|
(part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 108))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(send-event (ppointer->process v1-11) 'clock this)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defstate dissipate (gun-blue-shot-3)
|
|
:virtual #t
|
|
:code (behavior ()
|
|
(let ((gp-0 (current-time)))
|
|
(until (time-elapsed? gp-0 (seconds 0.5))
|
|
(suspend)
|
|
)
|
|
)
|
|
(go-virtual die)
|
|
)
|
|
)
|
|
|
|
(defstate impact (gun-blue-shot-3)
|
|
:virtual #t
|
|
:code (behavior ()
|
|
(let ((gp-0 (current-time)))
|
|
(until (time-elapsed? gp-0 (seconds 0.5))
|
|
(suspend)
|
|
)
|
|
)
|
|
(go-virtual die)
|
|
)
|
|
)
|
|
|
|
(defmethod deal-damage! ((this gun-blue-shot-3) (arg0 process) (arg1 event-message-block))
|
|
(+! (-> *game-info* shots-hit 2) 1.0)
|
|
(if (and (logtest? (process-mask guard) (-> arg0 mask))
|
|
(not (-> *setting-control* user-current gun-target-guards?))
|
|
)
|
|
(set! (-> this damage) 0.0)
|
|
)
|
|
(call-parent-method this arg0 arg1)
|
|
)
|
|
|
|
(defmethod projectile-method-26 ((this gun-blue-shot-2))
|
|
0
|
|
(none)
|
|
)
|