Files
Hat Kid e2e5289788 decomp3: font widescreen and shadow hacks, generic renderer, misc files (#3483)
- `pecker-ingame`
- `des-bbush-tasks`
- `des-burning-bush`
- `des-bush-part`
- `des-bush`
- `mh-centipede`
- `mh-centipede-part`
- `mh-wasp`
- `mh-wasp-part`
- `needle-fish`
- `des-bush-time-chase`
- `timer-path`
- `mission-squad-control-h`
- `mh-bat`
- `hover-nav-factoryd`
- `hover-nav-factoryc`
- `conveyor`
- `fac-part`
- `factory-part`
- `factoryc-mood`
- `factoryc-obs`
- `factoryc-obs2`
- `lfaccar-init`
- `factory-boss-part`
- `factory-boss-scenes`
- `factory-boss-setup`
- `factory-boss-states`
- `factory-mood`
- `factoryc-manager`
- `lfacrm1-mood`
- `lfacrm2-mood`
- `missile-bot`
- `sew-laser-turret`
- `ai-task-h`
- `ash-h`
- `ash-shot`
- `ash-states`
- `ash-task`
- `ash`
- `bot-h`
- `bot-states`
- `bot`
- `ash-oasis-course`
- `oasis-defense`
- `comb-field`
- `comb-mood`
- `comb-obs`
- `comb-part`
- `comb-scenes`
- `comb-sentry`
- `comb-travel`
- `comba-init`
- `combx-scenes`
- `h-sled`
- `destroy-dark-eco`
- `fac-gunturret`
- `fac-robotank-turret`
- `fac-robotank`
- `fac-tower`
- `factory-h`
- `factory-hud`
- `factory-manager`
- `factorya-init`
- `ffight-projectile`
- `ftank-projectile`
- `fturret-projectile`
- `h-warf`
- `warf-projectile`
2024-04-28 08:59:46 -04:00

1025 lines
39 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: fac-tower.gc
;; name in dgo: fac-tower
;; dgos: LFACTORY
;; DECOMP BEGINS
(define *fac-tower-impact-pos* (new 'static 'vector :w 1.0))
(defskelgroup skel-fac-gun-tower-base fac-gun-tower-base fac-gun-tower-base-lod0-jg fac-gun-tower-base-idle-ja
((fac-gun-tower-base-lod0-mg (meters 999999)))
:bounds (static-spherem 0 0 0 60)
)
(defskelgroup skel-fac-gun-tower-base-broken-north fac-gun-tower-base fac-gun-tower-base-broken-north-lod0-jg fac-gun-tower-base-broken-north-idle-ja
((fac-gun-tower-base-broken-north-lod0-mg (meters 999999)))
:bounds (static-spherem 0 0 0 60)
)
(defskelgroup skel-fac-gun-tower-base-broken-south fac-gun-tower-base fac-gun-tower-base-broken-south-lod0-jg fac-gun-tower-base-broken-south-idle-ja
((fac-gun-tower-base-broken-south-lod0-mg (meters 999999)))
:bounds (static-spherem 0 0 0 60)
)
(defskelgroup skel-fac-gun-tower-base-broken-east fac-gun-tower-base fac-gun-tower-base-broken-east-lod0-jg fac-gun-tower-base-broken-east-idle-ja
((fac-gun-tower-base-broken-east-lod0-mg (meters 999999)))
:bounds (static-spherem 0 0 0 60)
)
(defskelgroup skel-fac-gun-tower-base-broken-west fac-gun-tower-base fac-gun-tower-base-broken-west-lod0-jg fac-gun-tower-base-broken-west-idle-ja
((fac-gun-tower-base-broken-west-lod0-mg (meters 999999)))
:bounds (static-spherem 0 0 0 60)
)
(defskelgroup skel-fac-gun-tower fac-gun-tower fac-gun-tower-lod0-jg fac-gun-tower-idle-ja
((fac-gun-tower-lod0-mg (meters 20)) (fac-gun-tower-lod1-mg (meters 999999)))
:bounds (static-spherem 0 25 0 75)
)
(defskelgroup skel-fac-gun-tower-break fac-gun-tower fac-gun-tower-break-lod0-jg fac-gun-tower-break-idle-ja
((fac-gun-tower-break-lod0-mg (meters 999999)))
:bounds (static-spherem 0 0 0 1000)
)
(define *fac-gun-tower-break-anim-idx* 0)
(defbehavior fac-gun-tower-base-broken-init-by-other fac-gun-tower-base-broken ((arg0 vector) (arg1 quaternion))
(let ((s4-0 (new 'process 'collide-shape self (collide-list-enum usually-hit-by-player))))
(set! (-> s4-0 penetrated-by) (penetrate))
(let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 2) 0)))
(set! (-> s4-0 total-prims) (the-as uint 3))
(set! (-> s3-0 prim-core collide-as) (collide-spec enemy obstacle))
(set! (-> s3-0 prim-core action) (collide-action solid))
(set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 409600.0)
(set! (-> s4-0 root-prim) s3-0)
)
(let ((v1-7 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0))))
(set! (-> v1-7 prim-core collide-as) (collide-spec obstacle))
(set! (-> v1-7 prim-core collide-with) (collide-spec jak bot player-list))
(set! (-> v1-7 prim-core action) (collide-action solid))
(set! (-> v1-7 transform-index) 3)
(set-vector! (-> v1-7 local-sphere) 0.0 0.0 0.0 409600.0)
)
(let ((v1-10 (new
'process
'collide-shape-prim-mesh
s4-0
(the-as uint (if (zero? *fac-gun-tower-break-anim-idx*)
0
1
)
)
(the-as uint 0)
)
)
)
(set! (-> v1-10 prim-core collide-as) (collide-spec obstacle))
(set! (-> v1-10 prim-core collide-with) (collide-spec jak bot player-list))
(set! (-> v1-10 prim-core action) (collide-action solid))
(set! (-> v1-10 transform-index) 3)
(set-vector! (-> v1-10 local-sphere) 0.0 0.0 0.0 409600.0)
)
(set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w)))
(let ((v1-13 (-> s4-0 root-prim)))
(set! (-> s4-0 backup-collide-as) (-> v1-13 prim-core collide-as))
(set! (-> s4-0 backup-collide-with) (-> v1-13 prim-core collide-with))
)
(set! (-> self root) s4-0)
)
(set! (-> self level) (level-get *level* 'factoryb))
(cond
((zero? *fac-gun-tower-break-anim-idx*)
(art-group-get-by-name *level* "skel-fac-gun-tower-base-broken-north" (the-as (pointer level) #f))
(initialize-skeleton
self
(the-as
skeleton-group
(art-group-get-by-name *level* "skel-fac-gun-tower-base-broken-north" (the-as (pointer level) #f))
)
(the-as pair 0)
)
)
((= *fac-gun-tower-break-anim-idx* 1)
(art-group-get-by-name *level* "skel-fac-gun-tower-base-broken-south" (the-as (pointer level) #f))
(initialize-skeleton
self
(the-as
skeleton-group
(art-group-get-by-name *level* "skel-fac-gun-tower-base-broken-south" (the-as (pointer level) #f))
)
(the-as pair 0)
)
)
((= *fac-gun-tower-break-anim-idx* 2)
(art-group-get-by-name *level* "skel-fac-gun-tower-base-broken-east" (the-as (pointer level) #f))
(initialize-skeleton
self
(the-as
skeleton-group
(art-group-get-by-name *level* "skel-fac-gun-tower-base-broken-east" (the-as (pointer level) #f))
)
(the-as pair 0)
)
)
(else
(art-group-get-by-name *level* "skel-fac-gun-tower-base-broken-west" (the-as (pointer level) #f))
(initialize-skeleton
self
(the-as
skeleton-group
(art-group-get-by-name *level* "skel-fac-gun-tower-base-broken-west" (the-as (pointer level) #f))
)
(the-as pair 0)
)
)
)
(set! (-> self root trans quad) (-> arg0 quad))
(quaternion-copy! (-> self root quat) arg1)
(vector-identity! (-> self root scale))
(go-virtual idle)
)
(defstate idle (fac-gun-tower-base-broken)
:virtual #t
:code (behavior ()
(until #f
(suspend)
)
#f
)
:post ja-post
)
(defbehavior fac-gun-tower-break-init-by-other fac-gun-tower-break ((arg0 int) (arg1 vector) (arg2 quaternion))
(let ((s3-1 (max 0 (+ (* *fac-gun-tower-break-anim-idx* 2) -1))))
(cond
((or (= arg0 3) (= arg0 1) (= arg0 2))
(let ((s4-0 (new 'process 'collide-shape self (collide-list-enum usually-hit-by-player))))
(set! (-> s4-0 penetrated-by) (penetrate))
(let ((s3-2 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 1) 0)))
(set! (-> s4-0 total-prims) (the-as uint 2))
(set! (-> s3-2 prim-core collide-as) (collide-spec enemy obstacle))
(set! (-> s3-2 prim-core action) (collide-action solid))
(set-vector! (-> s3-2 local-sphere) 0.0 0.0 0.0 0.0)
(set! (-> s4-0 root-prim) s3-2)
)
(let ((v1-13 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0))))
(set! (-> v1-13 prim-core collide-as) (collide-spec obstacle))
(set! (-> v1-13 prim-core collide-with) (collide-spec jak player-list))
(set! (-> v1-13 prim-core action) (collide-action solid))
(set-vector! (-> v1-13 local-sphere) 0.0 0.0 0.0 0.0)
)
(set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w)))
(let ((v1-16 (-> s4-0 root-prim)))
(set! (-> s4-0 backup-collide-as) (-> v1-16 prim-core collide-as))
(set! (-> s4-0 backup-collide-with) (-> v1-16 prim-core collide-with))
)
(set! (-> self root) s4-0)
)
)
(else
(let ((s4-1 (new 'process 'collide-shape self (collide-list-enum usually-hit-by-player))))
(set! (-> s4-1 penetrated-by) (penetrate))
(let ((s2-0 (new 'process 'collide-shape-prim-group s4-1 (the-as uint 2) 0)))
(set! (-> s4-1 total-prims) (the-as uint 3))
(set! (-> s2-0 prim-core collide-as) (collide-spec enemy obstacle))
(set! (-> s2-0 prim-core action) (collide-action solid))
(set-vector! (-> s2-0 local-sphere) 0.0 0.0 0.0 409600.0)
(set! (-> s4-1 root-prim) s2-0)
)
(let ((v1-25 (new 'process 'collide-shape-prim-mesh s4-1 (the-as uint s3-1) (the-as uint 0))))
(set! (-> v1-25 prim-core collide-as) (collide-spec obstacle))
(set! (-> v1-25 prim-core collide-with) (collide-spec jak bot player-list))
(set! (-> v1-25 prim-core action) (collide-action solid))
(set! (-> v1-25 transform-index) 0)
(set-vector! (-> v1-25 local-sphere) 0.0 0.0 0.0 409600.0)
)
(let ((v1-27 (new
'process
'collide-shape-prim-mesh
s4-1
(the-as uint (if (zero? s3-1)
0
(+ s3-1 1)
)
)
(the-as uint 0)
)
)
)
(set! (-> v1-27 prim-core collide-as) (collide-spec obstacle))
(set! (-> v1-27 prim-core collide-with) (collide-spec jak bot player-list))
(set! (-> v1-27 prim-core action) (collide-action solid))
(set! (-> v1-27 transform-index) 0)
(set-vector! (-> v1-27 local-sphere) 0.0 0.0 0.0 409600.0)
)
(set! (-> s4-1 nav-radius) (* 0.75 (-> s4-1 root-prim local-sphere w)))
(let ((v1-30 (-> s4-1 root-prim)))
(set! (-> s4-1 backup-collide-as) (-> v1-30 prim-core collide-as))
(set! (-> s4-1 backup-collide-with) (-> v1-30 prim-core collide-with))
)
(set! (-> self root) s4-1)
)
)
)
)
(set! (-> self level) (level-get *level* 'factoryb))
(let ((s4-2 (art-group-get-by-name *level* "skel-fac-gun-tower-break" (the-as (pointer level) #f))))
(initialize-skeleton
self
(the-as skeleton-group (art-group-get-by-name *level* "skel-fac-gun-tower-break" (the-as (pointer level) #f)))
(the-as pair 0)
)
(set! (-> self root trans quad) (-> arg1 quad))
(quaternion-copy! (-> self root quat) arg2)
(vector-identity! (-> self root scale))
(if s4-2
(ja :group! (-> self draw art-group data 7) :num! min)
)
)
(go-virtual idle-stick)
)
(defstate idle (fac-gun-tower-break)
:virtual #t
:code (behavior ()
(ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
:post ja-post
)
(defstate idle-stick (fac-gun-tower-break)
:virtual #t
:code (behavior ()
(ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
(let ((gp-0 (current-time)))
(until (time-elapsed? gp-0 (seconds 2))
(suspend)
)
)
)
:post ja-post
)
(defun start-destroyed-fac-gun-tower-base ((arg0 vector) (arg1 quaternion) (arg2 process))
(let ((s3-0 0))
(if (< 819200.0 (-> arg0 x))
(+! s3-0 1)
)
(if (< 819200.0 (-> arg0 z))
(+! s3-0 2)
)
(format
#t
"destroyed xz pos ~M ~M - currently (task-node-close! (game-task-node factory-sky-battle-tower~d))~%"
(-> arg0 x)
(-> arg0 z)
(+ s3-0 1)
)
(cond
((zero? s3-0)
(task-node-close! (game-task-node factory-sky-battle-tower1) 'event)
)
((= s3-0 1)
(task-node-close! (game-task-node factory-sky-battle-tower2) 'event)
)
((= s3-0 2)
(task-node-close! (game-task-node factory-sky-battle-tower4) 'event)
)
((= s3-0 3)
(task-node-close! (game-task-node factory-sky-battle-tower3) 'event)
)
)
)
(process-spawn fac-gun-tower-base-broken arg0 arg1 :name "fac-gun-tower-base-broken" :to arg2)
(let ((v0-8 (logand (+ *fac-gun-tower-break-anim-idx* 1) 3)))
(set! *fac-gun-tower-break-anim-idx* v0-8)
v0-8
)
)
;; WARN: Return type mismatch (pointer process) vs (pointer fac-gun-tower-break).
(defun start-destroyed-fac-gun-tower ((arg0 vector) (arg1 quaternion) (arg2 process))
(process-spawn fac-gun-tower-break 3 arg0 arg1 :name "fac-gun-tower-break" :to arg2)
)
(deftype fac-gun-tower-base (process-focusable)
()
(:state-methods
idle
explode
)
)
(defmethod init-from-entity! ((this fac-gun-tower-base) (arg0 entity-actor))
(let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player))))
(set! (-> s4-0 penetrated-by) (penetrate))
(let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 2) 0)))
(set! (-> s4-0 total-prims) (the-as uint 3))
(set! (-> s3-0 prim-core collide-as) (collide-spec enemy obstacle))
(set! (-> s3-0 prim-core action) (collide-action solid))
(set-vector! (-> s3-0 local-sphere) 0.0 102400.0 0.0 286720.0)
(set! (-> s4-0 root-prim) s3-0)
)
(let ((v1-7 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0))))
(set! (-> v1-7 prim-core collide-as) (collide-spec obstacle))
(set! (-> v1-7 prim-core collide-with) (collide-spec jak player-list))
(set! (-> v1-7 prim-core action) (collide-action solid))
(set-vector! (-> v1-7 local-sphere) 0.0 0.0 0.0 163840.0)
)
(let ((v1-9 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0))))
(set! (-> v1-9 prim-core collide-as) (collide-spec obstacle))
(set! (-> v1-9 prim-core collide-with) (collide-spec jak player-list))
(set! (-> v1-9 prim-core action) (collide-action solid))
(set! (-> v1-9 transform-index) 0)
(set-vector! (-> v1-9 local-sphere) 0.0 0.0 0.0 184320.0)
)
(set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w)))
(let ((v1-12 (-> s4-0 root-prim)))
(set! (-> s4-0 backup-collide-as) (-> v1-12 prim-core collide-as))
(set! (-> s4-0 backup-collide-with) (-> v1-12 prim-core collide-with))
)
(set! (-> this root) s4-0)
)
(process-drawable-from-entity! this arg0)
(initialize-skeleton
this
(the-as skeleton-group (art-group-get-by-name *level* "skel-fac-gun-tower-base" (the-as (pointer level) #f)))
(the-as pair 0)
)
(set! (-> this draw lod-set lod 0 dist) 14336000.0)
(set! (-> this draw lod-set lod 1 dist) 14336000.0)
(set! (-> this draw lod-set lod 2 dist) 14336000.0)
(logior! (-> this draw status) (draw-control-status no-draw))
(quaternion-copy! (-> this root quat) (-> arg0 quat))
(set! (-> this root trans quad) (-> arg0 extra trans quad))
(go (method-of-object this idle))
)
(defstate explode (fac-gun-tower-base)
:virtual #t
:enter (behavior ()
'()
)
:code sleep-code
)
(defstate idle (fac-gun-tower-base)
:virtual #t
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(case message
(('attack)
(when (and (type? proc projectile) (not (type? proc warf-projectile)))
(let ((s4-0 (the-as projectile proc)))
(when (not (vector= *fac-tower-impact-pos* (-> s4-0 root trans)))
(set! (-> *fac-tower-impact-pos* quad) (-> s4-0 root trans quad))
(cond
((logtest? (-> *part-group-id-table* 776 flags) (sp-group-flag sp13))
(set! (-> *launch-matrix* trans quad) (-> s4-0 root trans quad))
(let ((s4-1 (the-as projectile (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))))
(when s4-1
(let ((t9-4 (method-of-type part-tracker-subsampler activate)))
(t9-4
(the-as part-tracker-subsampler s4-1)
*entity-pool*
"part-tracker-subsampler"
(the-as pointer #x70004000)
)
)
(let ((t9-5 run-function-in-process)
(a0-13 s4-1)
(a1-6 part-tracker-subsampler-init)
)
(set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 776))
(set! (-> *part-tracker-subsampler-params-default* duration) 0)
(set! (-> *part-tracker-subsampler-params-default* callback) #f)
(set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f))
(set! (-> *part-tracker-subsampler-params-default* target) #f)
(set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*)
(set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0)
((the-as (function object object object none) t9-5) a0-13 a1-6 *part-tracker-subsampler-params-default*)
)
(-> s4-1 ppointer)
)
)
)
(else
(set! (-> *launch-matrix* trans quad) (-> s4-0 root trans quad))
(part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 776))
)
)
)
)
)
(-> block param 1)
(when (and (not (and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status subtask-complete)))
)
(and proc (= (-> proc type) fac-gun-tower))
)
(start-destroyed-fac-gun-tower-base (-> self root trans) (-> self root quat) (the-as process *entity-pool*))
(process-entity-status! self (entity-perm-status subtask-complete) #t)
(let ((v1-47 (-> self root root-prim)))
(set! (-> v1-47 prim-core collide-as) (collide-spec))
(set! (-> v1-47 prim-core collide-with) (collide-spec))
)
0
(let ((v0-0 (logior (-> self draw status) (draw-control-status no-draw))))
(set! (-> self draw status) v0-0)
v0-0
)
)
)
)
)
:code (behavior ()
(until #f
(ja-no-eval :group! fac-gun-tower-base-idle-ja :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
(suspend)
)
#f
)
:post ja-post
)
(deftype gun-tower-base (fac-gun-tower-base)
()
)
(defmethod init-from-entity! ((this fac-gun-tower) (arg0 entity-actor))
(let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player))))
(set! (-> s4-0 penetrated-by) (penetrate))
(let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 3) 0)))
(set! (-> s4-0 total-prims) (the-as uint 4))
(set! (-> s3-0 prim-core collide-as) (collide-spec enemy obstacle))
(set! (-> s3-0 prim-core action) (collide-action solid))
(set-vector! (-> s3-0 local-sphere) 0.0 102400.0 0.0 245760.0)
(set! (-> s4-0 root-prim) s3-0)
)
(let ((v1-7 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 1))))
(set! (-> v1-7 prim-core collide-as) (collide-spec enemy obstacle))
(set! (-> v1-7 prim-core action) (collide-action solid))
(set! (-> v1-7 transform-index) 10)
(set-vector! (-> v1-7 local-sphere) 0.0 0.0 12288.0 16384.0)
)
(let ((v1-9 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 1) (the-as uint 0))))
(set! (-> v1-9 prim-core collide-as) (collide-spec obstacle))
(set! (-> v1-9 prim-core collide-with) (collide-spec jak bot player-list))
(set! (-> v1-9 prim-core action) (collide-action solid))
(set! (-> v1-9 transform-index) 3)
(set-vector! (-> v1-9 local-sphere) 0.0 0.0 0.0 245760.0)
)
(let ((v1-11 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0))))
(set! (-> v1-11 prim-core collide-as) (collide-spec obstacle))
(set! (-> v1-11 prim-core collide-with) (collide-spec jak bot player-list))
(set! (-> v1-11 prim-core action) (collide-action solid))
(set! (-> v1-11 transform-index) 8)
(set-vector! (-> v1-11 local-sphere) 0.0 0.0 0.0 40960.0)
)
(set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w)))
(let ((v1-14 (-> s4-0 root-prim)))
(set! (-> s4-0 backup-collide-as) (-> v1-14 prim-core collide-as))
(set! (-> s4-0 backup-collide-with) (-> v1-14 prim-core collide-with))
)
(set! (-> this root) s4-0)
)
(process-drawable-from-entity! this arg0)
(logclear! (-> this mask) (process-mask actor-pause))
(process-entity-status! this (entity-perm-status no-kill) #t)
(initialize-skeleton
this
(the-as skeleton-group (art-group-get-by-name *level* "skel-fac-gun-tower" (the-as (pointer level) #f)))
(the-as pair 0)
)
(set! (-> this draw lod-set lod 0 dist) 14336000.0)
(set! (-> this draw lod-set lod 1 dist) 14336000.0)
(set! (-> this draw lod-set lod 2 dist) 14336000.0)
(set! (-> this yaw) 0.0)
(set! (-> this yawvel) 0.0)
(set! (-> this pitch) 16384.0)
(set! (-> this pitchvel) 0.0)
(set! (-> this dyaw) 0.0)
(set! (-> this dpitch) 0.0)
(set! (-> this invincable) #t)
(set! (-> this hit-points) 64.0)
(set-time! (-> this last-fire))
(set! (-> this gun-idx) 0)
(let* ((v1-32 *game-info*)
(a0-29 (+ (-> v1-32 attack-id) 1))
)
(set! (-> v1-32 attack-id) a0-29)
(set! (-> this attack-id) (the-as int a0-29))
)
(set! (-> this gunrot) 8)
(set! (-> this muzzle) 9)
(set! (-> this blade-sound) (new-sound-id))
(set! (-> this blade-sound-playing) #f)
(set! (-> this rotate-sound) (new-sound-id))
(set! (-> this rotate-sound-playing) #f)
(set-time! (-> this snd-cmd-time))
(set! (-> this gun-tilt-jm) (new 'process 'joint-mod (joint-mod-mode joint-set*) this (-> this gunrot)))
(quaternion-identity! (-> this root quat))
(go (method-of-object this idle))
)
(defmethod deactivate ((this fac-gun-tower))
"Make a process dead, clean it up, remove it from the active pool, and return to dead pool."
(if (-> this rotate-sound-playing)
(sound-stop (-> this rotate-sound))
)
(if (-> this blade-sound-playing)
(sound-stop (-> this blade-sound))
)
((method-of-type process-focusable deactivate) this)
(none)
)
(defmethod relocate ((this fac-gun-tower) (offset int))
(if (nonzero? (-> this gun-tilt-jm))
(&+! (-> this gun-tilt-jm) offset)
)
(call-parent-method this offset)
)
;; WARN: Return type mismatch int vs search-info-flag.
(defmethod process-mask->search-info-flag ((this fac-gun-tower))
(let ((v0-0 0))
(if (and (-> this next-state) (= (-> this next-state name) 'open))
(set! v0-0 (logior v0-0 40))
)
(the-as search-info-flag v0-0)
)
)
(defmethod get-trans ((this fac-gun-tower) (arg0 int))
"Get the `trans` for this process."
(let ((v1-0 (-> this root)))
(cond
((= arg0 3)
(let ((a2-1 (-> this node-list data 10 bone transform))
(gp-0 (new 'stack-no-clear 'vector))
)
(set-vector! gp-0 0.0 0.0 0.0 1.0)
(vector-matrix*! gp-0 gp-0 a2-1)
(set! (-> gp-0 w) 8192.0)
gp-0
)
)
(else
(-> v1-0 trans)
)
)
)
)
(defmethod fire-shot ((this fac-gun-tower))
(with-pp
(rlet ((acc :class vf)
(vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
)
(init-vf0-vector)
(when *target*
(let ((s5-0 (new 'stack-no-clear 'vector))
(s4-0 (new 'stack-no-clear 'vector))
)
(set! (-> s4-0 quad) (-> (get-trans *target* 3) quad))
(let ((s2-0 (-> this node-list data 10 bone transform))
(s3-0 (new 'stack-no-clear 'quaternion))
)
(let ((a2-0 (-> this node-list data (-> this gunrot) bone transform)))
(set-vector! s5-0 0.0 0.0 40960.0 1.0)
(vector-matrix*! s5-0 s5-0 a2-0)
)
(set! (-> s3-0 quad) (-> s2-0 fvec quad))
(set! (-> s3-0 y) 0.0)
(vector-normalize! (the-as vector s3-0) 1.0)
(vector-rotate-around-axis! (the-as vector s3-0) s3-0 (-> this pitch) (-> s2-0 rvec))
(let ((a0-11 s4-0))
(let ((v1-11 s5-0))
(let ((a1-5 409600.0))
(.mov vf7 a1-5)
)
(.lvf vf5 (&-> s3-0 quad))
(.lvf vf4 (&-> v1-11 quad))
)
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> a0-11 quad) vf6)
)
)
(let ((s3-1 (new 'stack-no-clear 'vector))
(a1-6 (new 'stack-no-clear 'event-message-block))
)
(set! (-> a1-6 from) (process->ppointer pp))
(set! (-> a1-6 num-params) 0)
(set! (-> a1-6 message) 'get-vehicle)
(let ((a0-14 (the-as vehicle (send-event-function *target* a1-6))))
(when a0-14
(vector-float*! s3-1 (-> a0-14 rbody lin-velocity) 0.0)
(vector+! s4-0 s4-0 s3-1)
)
)
)
(spawn-fac-gun-tower-projectile this s5-0 s4-0 1638400.0)
)
)
)
)
)
(defmethod send-attack ((this fac-gun-tower) (arg0 process-focusable))
(let* ((a0-2 (get-trans arg0 3))
(v1-2 (vector-! (new 'stack-no-clear 'vector) a0-2 (-> this root trans)))
)
(if (< (vector-length v1-2) 409600.0)
(send-event
arg0
'attack
#f
(static-attack-info :mask (vehicle-impulse-factor) ((id (the-as uint (-> this attack-id)))
(damage 128.0)
(vehicle-damage-factor 1.0)
(vehicle-impulse-factor 1.0)
(mode 'explode)
(attacker-velocity v1-2)
(penetrate-using (penetrate explode enemy-yellow-shot))
)
)
)
)
)
0
(none)
)
(defmethod fac-gun-tower-method-36 ((this fac-gun-tower))
(let ((s5-0 (new 'stack-no-clear 'vector)))
(set! (-> s5-0 quad) (-> this root trans quad))
(set! (-> s5-0 w) 409600.0)
(let ((s4-0 (new 'stack-no-clear 'array 'collide-shape 384)))
(countdown (s3-0 (fill-actor-list-for-box *actor-hash* s5-0 s4-0 384))
(let* ((s2-0 (-> s4-0 s3-0))
(v1-5 (if (type? s2-0 collide-shape)
s2-0
)
)
)
(when v1-5
(let* ((s1-0 (-> v1-5 process))
(s2-1 (if (type? s1-0 process-focusable)
s1-0
)
)
)
(when s2-1
(if (and (!= *target* s2-1)
(!= this s2-1)
(not (focus-test? (the-as process-focusable s2-1) disable dead inactive))
(type? s2-1 fac-gun-tower-base)
)
(send-attack this (the-as process-focusable s2-1))
)
)
)
)
)
)
)
(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) s5-0) (-> s5-0 w)))
(if (and (!= *target* s4-1)
(!= this s4-1)
(not (focus-test? s4-1 disable dead inactive))
(type? s4-1 fac-gun-tower-base)
)
(send-attack this s4-1)
)
)
)
)
0
(none)
)
(defbehavior fac-gun-tower-standard-event-handler fac-gun-tower ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(case arg2
(('attack)
(let ((gp-0 (the-as object (-> arg3 param 1)))
(a2-1 (the-as object (-> arg3 param 0)))
)
0.0
(let ((f30-0 (if (logtest? (attack-mask damage) (-> (the-as attack-info gp-0) mask))
(-> (the-as attack-info gp-0) damage)
0.0
)
)
)
(when (and (the-as touching-shapes-entry a2-1) (not (-> self invincable)))
(let ((a0-3 (-> (the-as touching-shapes-entry a2-1) head)))
(when a0-3
(let ((a0-4 (get-touched-prim a0-3 (-> self root) (the-as touching-shapes-entry a2-1))))
0
(when a0-4
(case (-> a0-4 prim-id)
((1)
(set! (-> self hit-points) (fmax 0.0 (- (-> self hit-points) f30-0)))
(set-time! (-> self last-hit-time))
)
)
)
)
)
)
)
(when (and (>= f30-0 128.0) (not (-> self invincable)))
(let ((s5-0 (new 'stack-no-clear 'vector))
(s4-0 (new 'stack-no-clear 'vector))
(s3-0 (-> self node-list data 10 bone transform))
)
(set-vector! s5-0 0.0 0.0 -32768.0 1.0)
(vector-matrix*! s5-0 s5-0 s3-0)
(vector-! s4-0 (the-as vector (+ (the-as uint gp-0) 0)) s5-0)
(vector-normalize! s4-0 1.0)
(when (or (< 0.0 (vector-dot s4-0 (-> s3-0 fvec)))
(< (vector-vector-distance s5-0 (the-as vector (+ (the-as uint gp-0) 0))) 36864.0)
)
(set! (-> self hit-points) (fmax 0.0 (- (-> self hit-points) f30-0)))
(set-time! (-> self last-hit-time))
)
)
)
)
)
(when (>= 0.0 (-> self hit-points))
(when (-> self minimap)
(logior! (-> self minimap flags) (minimap-flag fade-out))
(set! (-> self minimap) #f)
)
(activate! *camera-smush-control* 3276.8 60 390 0.9 0.9 (-> self clock))
(start-destroyed-fac-gun-tower (-> self root trans) (-> self root quat) (the-as process *entity-pool*))
(cond
((logtest? (-> *part-group-id-table* 731 flags) (sp-group-flag sp13))
(set! (-> *launch-matrix* trans quad) (-> self root trans quad))
(part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 731))
)
(else
(set! (-> *launch-matrix* trans quad) (-> self root trans quad))
(part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 731))
)
)
(fac-gun-tower-method-36 self)
(process-entity-status! self (entity-perm-status subtask-complete) #t)
(let ((v1-78 (-> self root root-prim)))
(set! (-> v1-78 prim-core collide-as) (collide-spec))
(set! (-> v1-78 prim-core collide-with) (collide-spec))
)
0
(sound-play "tower-explode")
(cleanup-for-death self)
(go-virtual die-fast)
)
)
)
)
;; WARN: Return type mismatch time-frame vs none.
(defmethod fac-gun-tower-method-33 ((this fac-gun-tower))
(let ((s5-0 (new 'stack-no-clear 'matrix)))
(+! (-> this yaw) (* (-> this yawvel) (seconds-per-frame)))
(if (< 65536.0 (-> this yaw))
(+! (-> this yaw) -65536.0)
)
(matrix-rotate-y! s5-0 (-> this yaw))
(matrix->quaternion (-> this root quat) s5-0)
)
(quaternion-axis-angle! (-> this gun-tilt-jm quat) 1.0 0.0 0.0 (-> this pitch))
(when (time-elapsed? (-> this snd-cmd-time) (seconds 0.2))
(sound-play-by-name
(static-sound-name "gtower-openloop")
(-> this rotate-sound)
1024
(the int (* 1524.0 (+ 1.0 (* 0.00001 (-> this yawvel)))))
0
(sound-group)
(-> this root trans)
)
(sound-play-by-name
(static-sound-name "gtower-blade")
(-> this blade-sound)
(the int (* 1024.0 (fmax 0.0 (fmin 0.5 (* 0.00001 (-> this yawvel))))))
(the int (* 1524.0 (+ 1.3 (* 0.00001 (-> this yawvel)))))
0
(sound-group)
(-> this root trans)
)
(set-time! (-> this snd-cmd-time))
)
(none)
)
(defun fac-deg-delta ((arg0 float) (arg1 float))
(the float (sar (- (shl (the int arg0) 48) (shl (the int arg1) 48)) 48))
)
;; WARN: Return type mismatch quaternion vs none.
(defmethod fac-gun-tower-method-34 ((this fac-gun-tower))
(when *target*
(let ((s5-0 (new 'stack-no-clear 'matrix))
(s4-0 (new 'stack-no-clear 'vector))
)
0.0
0.0
0.0
0.0
0.0
(let ((s3-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data 8)))
(s2-0 (new 'stack-no-clear 'vector))
)
(set! (-> s2-0 quad) (-> (get-trans *target* 3) quad))
(vector-! s4-0 s3-0 s2-0)
)
(vector-negate! s4-0 s4-0)
(let ((f30-0 (vector-length s4-0)))
(let* ((f0-7 (atan (-> s4-0 x) (-> s4-0 z)))
(f0-9 (fac-deg-delta f0-7 (-> this yaw)))
(f1-1 (- f0-9 (-> this dyaw)))
)
(set! (-> this dyaw) f0-9)
(let ((f1-3 (+ (* 160.0 f1-1) (* 10.0 f0-9))))
(+! (-> this yawvel) (* f1-3 (seconds-per-frame)))
)
)
(let* ((f0-19 (- (atan (-> s4-0 y) (sqrtf (+ (* (-> s4-0 x) (-> s4-0 x)) (* (-> s4-0 z) (-> s4-0 z)))))))
(f0-21 (fac-deg-delta f0-19 (-> this pitch)))
(f1-9 (- f0-21 (-> this dpitch)))
)
(set! (-> this dpitch) f0-21)
(let ((f1-11 (+ (* 160.0 f1-9) (* 10.0 f0-21))))
(+! (-> this pitchvel) (* f1-11 (seconds-per-frame)))
)
)
(matrix-rotate-y! s5-0 (-> this yaw))
(matrix->quaternion (-> this root quat) s5-0)
(when (and (time-elapsed? (-> this last-fire) (seconds 2))
(and (< f30-0 409600.0) (< 204800.0 f30-0))
(not (focus-test? *target* dead))
(not (and (-> this entity) (logtest? (-> this entity extra perm status) (entity-perm-status subtask-complete)))
)
)
(set-time! (-> this last-fire))
(fire-shot this)
)
)
)
)
(+! (-> this yaw) (* (-> this yawvel) (seconds-per-frame)))
(+! (-> this pitch) (* (-> this pitchvel) (seconds-per-frame)))
(set! (-> this pitch) (fmax -10922.667 (fmin 6371.5557 (-> this pitch))))
(quaternion-axis-angle! (-> this gun-tilt-jm quat) 1.0 0.0 0.0 (-> this pitch))
(none)
)
(defstate idle (fac-gun-tower)
:virtual #t
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(case message
(('attack)
(when (and (type? proc projectile) (not (type? proc warf-projectile)))
(when (not (vector= *fac-tower-impact-pos* (-> (the-as projectile proc) root trans)))
(set! (-> *fac-tower-impact-pos* quad) (-> (the-as projectile proc) root trans quad))
(cond
((logtest? (-> *part-group-id-table* 776 flags) (sp-group-flag sp13))
(set! (-> *launch-matrix* trans quad) (-> (the-as projectile proc) root trans quad))
(part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 776))
)
(else
(set! (-> *launch-matrix* trans quad) (-> (the-as projectile proc) root trans quad))
(part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 776))
)
)
)
)
)
(('trigger)
(if (and (not (and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status subtask-complete)))
)
(< (vector-vector-xz-distance (target-pos 0) (-> self root trans)) 1024000.0)
(< 716800.0 (vector-vector-xz-distance (target-pos 0) (-> self root trans)))
)
(go-virtual open)
)
)
)
)
:enter (behavior ()
(ja :group! fac-gun-tower-idle-ja :num! min)
(set-time! (-> self state-time))
(set! (-> self pitch) 16384.0)
(quaternion-axis-angle! (-> self gun-tilt-jm quat) 1.0 0.0 0.0 (-> self pitch))
(transform-post)
)
:trans (behavior ()
(ja :num-func num-func-identity :frame-num 0.0)
)
:code sleep-code
)
(defstate open (fac-gun-tower)
:virtual #t
:event fac-gun-tower-standard-event-handler
:enter (behavior ()
(ja :group! fac-gun-tower-dooropen-ja :num! min)
(set-time! (-> self state-time))
(set! (-> self minimap) (add-icon! *minimap* self (the-as uint 149) (the-as int #f) (the-as vector #t) 0))
(sound-play "gtower-open")
(sound-play "gtower-openloop" :id (-> self rotate-sound) :position (-> self root trans))
(set! (-> self rotate-sound-playing) #t)
(sound-play "gtower-blade" :id (-> self blade-sound) :position (-> self root trans))
(set! (-> self blade-sound-playing) #t)
)
:trans (behavior ()
'()
)
:code (behavior ()
(while (< (-> self yawvel) 131072.0)
(seek! (-> self yawvel) 131072.0 (* 65536.0 (seconds-per-frame)))
(ja :num-func num-func-identity :frame-num 0.0)
(fac-gun-tower-method-33 self)
)
(while (< 3276.8 (-> self yawvel))
(seek! (-> self yawvel) 3276.8 (* 21845.334 (seconds-per-frame)))
(ja :num! (seek!))
(seek! (-> self pitch) 0.0 (* 8192.0 (seconds-per-frame)))
(fac-gun-tower-method-33 self)
(suspend)
)
(set! (-> self invincable) #f)
(when (-> self rotate-sound-playing)
(sound-stop (-> self rotate-sound))
(set! (-> self rotate-sound-playing) #f)
)
(when (-> self blade-sound-playing)
(sound-stop (-> self blade-sound))
(set! (-> self blade-sound-playing) #f)
)
(sound-play "gtower-open-end")
(until #f
(fac-gun-tower-method-34 self)
(ja :num! (seek!))
(suspend)
)
#f
)
:post transform-post
)
(defstate die-fast (fac-gun-tower)
:virtual #t
:code nothing
)
(defstate die (fac-gun-tower)
:virtual #t
:enter (behavior ()
(ja :group! fac-gun-tower-dooropen-ja :num! max)
(set-time! (-> self state-time))
)
:trans (behavior ()
'()
)
:code (behavior ()
(while (< (-> self yawvel) 131072.0)
(seek! (-> self yawvel) 131072.0 (* 65536.0 (seconds-per-frame)))
(ja :num-func num-func-identity :frame-num 0.0)
(fac-gun-tower-method-33 self)
)
)
:post transform-post
)