mirror of
https://github.com/open-goal/jak-project
synced 2026-08-07 18:23:13 -04:00
637990314b
Closes #736 --------- Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
1530 lines
52 KiB
Common Lisp
1530 lines
52 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: centurion.gc
|
|
;; name in dgo: centurion
|
|
;; dgos: DMI, MTN
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
(define *centurion-shield-glow-spt-scale-x* #x9000)
|
|
|
|
(define *centurion-shield-glow-spt-scale-y* #x7000)
|
|
|
|
(define *centurion-shield-center-spt-scale-x* 8192)
|
|
|
|
(define *centurion-shield-center-spt-scale-y* #x4666)
|
|
|
|
(define *centurion-shield-spt-scale-x* #x3666)
|
|
|
|
(define *centurion-shield-spt-scale-y* #x5666)
|
|
|
|
(define *centurion-shield-2-spt-scale-x* #x3800)
|
|
|
|
(define *centurion-shield-2-spt-scale-y* #x5800)
|
|
|
|
(defun centurion-shield-big ()
|
|
(set! *centurion-shield-glow-spt-scale-x* #x9000)
|
|
(set! *centurion-shield-glow-spt-scale-y* #x7000)
|
|
(set! *centurion-shield-center-spt-scale-x* 8192)
|
|
(set! *centurion-shield-center-spt-scale-y* #x4666)
|
|
(set! *centurion-shield-spt-scale-x* #x3666)
|
|
(set! *centurion-shield-spt-scale-y* #x5666)
|
|
(set! *centurion-shield-2-spt-scale-x* #x3800)
|
|
(set! *centurion-shield-2-spt-scale-y* #x5800)
|
|
(none)
|
|
)
|
|
|
|
(defun centurion-shield-little ()
|
|
(set! *centurion-shield-glow-spt-scale-x* #x4000)
|
|
(set! *centurion-shield-glow-spt-scale-y* #x3000)
|
|
(set! *centurion-shield-center-spt-scale-x* 5734)
|
|
(set! *centurion-shield-center-spt-scale-y* #x3000)
|
|
(set! *centurion-shield-spt-scale-x* #x2800)
|
|
(set! *centurion-shield-spt-scale-y* #x3800)
|
|
(set! *centurion-shield-2-spt-scale-x* #x2999)
|
|
(set! *centurion-shield-2-spt-scale-y* #x3999)
|
|
(none)
|
|
)
|
|
|
|
(defpartgroup group-centurion-shield
|
|
:id 474
|
|
:duration (seconds 0.5)
|
|
:flags (use-local-clock)
|
|
:bounds (static-bspherem 0 0 0 2)
|
|
:parts ((sp-item 2101 :flags (is-3d bit6 bit7))
|
|
(sp-item 2102 :flags (is-3d bit6 bit7))
|
|
(sp-item 2103 :flags (is-3d bit6 bit7))
|
|
(sp-item 2104 :flags (bit6))
|
|
)
|
|
)
|
|
|
|
(defpart 2104
|
|
:init-specs ((:texture (glow effects))
|
|
(:num 1.0)
|
|
(:scale-x (meters 9) (meters 0.5))
|
|
(:rot-x (degrees 2.25))
|
|
(:scale-y (meters 7) (meters 0.5))
|
|
(:r 64.0 64.0)
|
|
(:g 0.0)
|
|
(:b 128.0)
|
|
(:a 40.0)
|
|
(:timer (seconds 0.017))
|
|
(:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow))
|
|
(:userdata 2048.0)
|
|
)
|
|
)
|
|
|
|
(defpart 2103
|
|
:init-specs ((:texture (starflash effects))
|
|
(:num 1.0)
|
|
(:x (meters 0.1))
|
|
(:y (meters 0))
|
|
(:z (meters 0))
|
|
(:scale-x (meters 2) (meters 1))
|
|
(:rot-x (degrees 0))
|
|
(:rot-y (degrees 0))
|
|
(:rot-z (degrees 90))
|
|
(:scale-y (meters 4.4) (meters 1))
|
|
(:r 255.0)
|
|
(:g 128.0 128.0)
|
|
(:b 255.0)
|
|
(:a 80.0 20.0)
|
|
(:accel-y (meters -0.00033333333) (meters -0.001))
|
|
(:timer (seconds 0.017))
|
|
(:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14))
|
|
(:rotate-y (degrees 0))
|
|
)
|
|
)
|
|
|
|
(defpart 2102
|
|
:init-specs ((:texture (harddot effects))
|
|
(:num 1.0)
|
|
(:x (meters 0.1))
|
|
(:y (meters 0))
|
|
(:z (meters 0))
|
|
(:scale-x (meters 3.4))
|
|
(:rot-x (degrees 0))
|
|
(:rot-y (degrees 0))
|
|
(:rot-z (degrees 90))
|
|
(:scale-y (meters 5.4))
|
|
(:r 128.0 128.0)
|
|
(:g 0.0)
|
|
(:b 255.0)
|
|
(:a 10.0 10.0)
|
|
(:accel-y (meters -0.00033333333) (meters -0.001))
|
|
(:timer (seconds 0.017))
|
|
(:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14))
|
|
(:rotate-y (degrees 0))
|
|
)
|
|
)
|
|
|
|
(defpart 2101
|
|
:init-specs ((:texture (water-ring effects))
|
|
(:num 1.0)
|
|
(:x (meters 0.1))
|
|
(:y (meters 0))
|
|
(:z (meters 0))
|
|
(:scale-x (meters 3.5))
|
|
(:rot-x (degrees 0))
|
|
(:rot-y (degrees 0))
|
|
(:rot-z (degrees 90))
|
|
(:scale-y (meters 5.5))
|
|
(:r 128.0 128.0)
|
|
(:g 0.0 64.0)
|
|
(:b 255.0)
|
|
(:a 128.0 128.0)
|
|
(:accel-y (meters -0.00033333333) (meters -0.001))
|
|
(:timer (seconds 0.017))
|
|
(:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14))
|
|
(:rotate-y (degrees 0))
|
|
)
|
|
)
|
|
|
|
(deftype centurion-shot (metalhead-shot)
|
|
()
|
|
)
|
|
|
|
|
|
(defmethod play-impact-sound ((this centurion-shot) (arg0 projectile-options))
|
|
(let ((v1-0 arg0))
|
|
(cond
|
|
((zero? v1-0)
|
|
(sound-play "cent-shot-fire")
|
|
)
|
|
((= v1-0 (projectile-options lose-altitude))
|
|
(sound-play "cent-shot-hit")
|
|
)
|
|
((= v1-0 (projectile-options lose-altitude proj-options-2))
|
|
(call-parent-method this arg0)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod init-proj-settings! ((this centurion-shot))
|
|
"Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc"
|
|
(call-parent-method this)
|
|
(set! (-> this max-speed) 327680.0)
|
|
(set! (-> this timeout) (seconds 1.25))
|
|
(none)
|
|
)
|
|
|
|
(deftype centurion (nav-enemy)
|
|
((los los-control :inline)
|
|
(target-pos vector :inline)
|
|
(can-shoot? basic)
|
|
(incoming-attack-id uint32)
|
|
(can-take-damage? symbol)
|
|
(first-shoot? symbol)
|
|
(shoot-dir vector :inline)
|
|
(tar-pos vector :inline)
|
|
(joint joint-mod)
|
|
(joint-enable symbol)
|
|
(victory-sound sound-id)
|
|
(shield-shot uint32)
|
|
)
|
|
(:state-methods
|
|
attack
|
|
fire
|
|
)
|
|
(:methods
|
|
(centurion-method-180 (_type_) none)
|
|
(centurion-method-181 (_type_ vector) int)
|
|
(centurion-method-182 (_type_ vector) symbol)
|
|
)
|
|
)
|
|
|
|
|
|
(defskelgroup skel-centurion centurion centurion-lod0-jg centurion-idle-ja
|
|
((centurion-lod0-mg (meters 20)) (centurion-lod1-mg (meters 999999)))
|
|
:bounds (static-spherem 0 2.25 -0.7 6.5)
|
|
:shadow centurion-shadow-mg
|
|
)
|
|
|
|
(deftype centurion-anim-info (structure)
|
|
((anim-index int32)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype centurion-global-info (basic)
|
|
((prev-yellow-hit int8)
|
|
(prev-blue-hit int8)
|
|
(yellow-hit-anim int32 1)
|
|
(blue-hit-anim int32 3)
|
|
)
|
|
:pack-me
|
|
)
|
|
|
|
|
|
(define *centurion-global-info* (new 'static 'centurion-global-info
|
|
:yellow-hit-anim (new 'static 'array int32 1 21)
|
|
:blue-hit-anim (new 'static 'array int32 3 18 20 19)
|
|
)
|
|
)
|
|
|
|
(define *centurion-nav-enemy-info*
|
|
(new 'static 'nav-enemy-info
|
|
:use-die-falling #t
|
|
:use-victory #f
|
|
:use-jump-blocked #f
|
|
:debug-draw-neck #f
|
|
:jump-debug-draw #f
|
|
:move-to-ground #t
|
|
:hover-if-no-ground #f
|
|
:idle-anim-script (new 'static 'array idle-control-frame 4
|
|
(new 'static 'idle-control-frame :command (ic-cmd play) :anim #x6 :param0 #x1 :param1 #x1)
|
|
(new 'static 'idle-control-frame)
|
|
(new 'static 'idle-control-frame)
|
|
(new 'static 'idle-control-frame)
|
|
)
|
|
:idle-anim 6
|
|
:notice-anim 8
|
|
:hostile-anim 13
|
|
:hit-anim 16
|
|
:knocked-anim 21
|
|
:knocked-land-anim 22
|
|
:die-anim 34
|
|
:die-falling-anim 23
|
|
:victory-anim 4
|
|
:jump-wind-up-anim -1
|
|
:jump-in-air-anim -1
|
|
:jump-land-anim -1
|
|
:neck-joint 8
|
|
:look-at-joint 8
|
|
:bullseye-joint 5
|
|
:sound-hit (static-sound-name "centurion-hit")
|
|
:sound-die (static-sound-name "centurion-die")
|
|
:notice-distance (meters 100)
|
|
:notice-distance-delta (meters 10)
|
|
:proximity-notice-distance (meters 100)
|
|
:default-hit-points 3
|
|
:gnd-collide-with (collide-spec backgnd)
|
|
:overlaps-others-collide-with-filter (collide-spec jak bot player-list)
|
|
:penetrate-knocked (penetrate
|
|
touch
|
|
generic-attack
|
|
lunge
|
|
flop
|
|
punch
|
|
spin
|
|
roll
|
|
uppercut
|
|
bonk
|
|
tube
|
|
vehicle
|
|
flut-attack
|
|
board
|
|
mech
|
|
mech-punch
|
|
mech-bonk
|
|
dark-skin
|
|
dark-punch
|
|
dark-bomb
|
|
dark-giant
|
|
shield
|
|
explode
|
|
jak-yellow-shot
|
|
jak-red-shot
|
|
jak-blue-shot
|
|
jak-dark-shot
|
|
enemy-yellow-shot
|
|
enemy-dark-shot
|
|
eco-yellow
|
|
eco-red
|
|
eco-blue
|
|
eco-green
|
|
knocked
|
|
penetrate-33
|
|
penetrate-34
|
|
penetrate-35
|
|
penetrate-36
|
|
penetrate-37
|
|
penetrate-38
|
|
penetrate-39
|
|
penetrate-40
|
|
penetrate-41
|
|
penetrate-42
|
|
penetrate-43
|
|
penetrate-44
|
|
penetrate-45
|
|
penetrate-46
|
|
penetrate-47
|
|
penetrate-48
|
|
penetrate-49
|
|
penetrate-50
|
|
penetrate-51
|
|
penetrate-52
|
|
penetrate-53
|
|
penetrate-54
|
|
penetrate-55
|
|
penetrate-56
|
|
penetrate-57
|
|
penetrate-58
|
|
penetrate-59
|
|
penetrate-60
|
|
penetrate-61
|
|
penetrate-62
|
|
penetrate-63
|
|
)
|
|
:movement-gravity (meters -100)
|
|
:friction 0.1
|
|
:attack-shove-back (meters 3)
|
|
:attack-shove-up (meters 2)
|
|
:attack-mode 'generic
|
|
:attack-damage 2
|
|
:recover-gnd-collide-with (collide-spec backgnd crate obstacle hit-by-others-list pusher)
|
|
:jump-height-min (meters 3)
|
|
:jump-height-factor 0.5
|
|
:knocked-seek-ry-clamp 6371.5557
|
|
:knocked-soft-vxz-lo 32768.0
|
|
:knocked-soft-vxz-hi 65536.0
|
|
:knocked-soft-vy-lo 32768.0
|
|
:knocked-soft-vy-hi 49152.0
|
|
:knocked-medium-vxz-lo 147456.0
|
|
:knocked-medium-vxz-hi 196608.0
|
|
:knocked-medium-vy-lo 135168.0
|
|
:knocked-medium-vy-hi 151552.0
|
|
:knocked-hard-vxz-lo 78643.2
|
|
:knocked-hard-vxz-hi 117964.8
|
|
:knocked-hard-vy-lo 183500.8
|
|
:knocked-hard-vy-hi 209715.2
|
|
:knocked-huge-vxz-lo 164659.2
|
|
:knocked-huge-vxz-hi 249036.8
|
|
:knocked-huge-vy-lo 183500.8
|
|
:knocked-huge-vy-hi 217907.2
|
|
:knocked-yellow-vxz-lo 16384.0
|
|
:knocked-yellow-vxz-hi 32768.0
|
|
:knocked-yellow-vy-lo 57344.0
|
|
:knocked-yellow-vy-hi 81920.0
|
|
:knocked-red-vxz-lo 24576.0
|
|
:knocked-red-vxz-hi 196608.0
|
|
:knocked-red-vy-lo 94208.0
|
|
:knocked-red-vy-hi 151552.0
|
|
:knocked-blue-vxz-lo 40960.0
|
|
:knocked-blue-vxz-hi 49152.0
|
|
:knocked-blue-vy-lo 20480.0
|
|
:knocked-blue-vy-hi 40960.0
|
|
:shadow-size (meters 1)
|
|
:shadow-max-y (meters 1)
|
|
:shadow-min-y (meters -1)
|
|
:shadow-locus-dist (meters 150)
|
|
:gem-joint 8
|
|
:gem-seg #x2
|
|
:gem-no-seg #x4
|
|
:gem-offset (new 'static 'sphere :y 1843.2 :z 1146.88 :r 163840.0)
|
|
:callback-info #f
|
|
:use-momentum #f
|
|
:use-frustration #t
|
|
:use-stop-chase #f
|
|
:use-circling #f
|
|
:use-pacing #f
|
|
:walk-anim 9
|
|
:turn-anim -1
|
|
:run-anim -1
|
|
:taunt-anim -1
|
|
:run-travel-speed (meters 6)
|
|
:run-acceleration (meters 1)
|
|
:run-turning-acceleration (meters 2)
|
|
:walk-travel-speed (meters 1.8)
|
|
:walk-acceleration (meters 1)
|
|
:walk-turning-acceleration (meters 16)
|
|
:maximum-rotation-rate (degrees 720)
|
|
:notice-nav-radius (meters 100)
|
|
:frustration-distance (meters 8)
|
|
:frustration-time (seconds 4)
|
|
:blocked-time (seconds 0.3)
|
|
:circle-dist-lo 20480.0
|
|
:circle-dist-hi 61440.0
|
|
:nav-mesh #f
|
|
)
|
|
)
|
|
|
|
(set! (-> *centurion-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*)
|
|
|
|
(defmethod general-event-handler ((this centurion) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
|
"Handles various events for the enemy
|
|
@TODO - unsure if there is a pattern for the events and this should have a more specific name"
|
|
(case arg2
|
|
(('jump)
|
|
#f
|
|
)
|
|
(('touch)
|
|
(cond
|
|
((and (-> this next-state) (= (-> this next-state name) 'attack))
|
|
(let ((s4-1 (-> arg3 param 0)))
|
|
(let ((s3-1 arg0))
|
|
(if (type? s3-1 process-focusable)
|
|
(empty)
|
|
)
|
|
)
|
|
(send-event
|
|
arg0
|
|
'attack-or-shove
|
|
s4-1
|
|
(static-attack-info ((id (new-attack-id))
|
|
(shove-back (* 2.0 (-> this enemy-info attack-shove-back)))
|
|
(shove-up (* 2.0 (-> this enemy-info attack-shove-up)))
|
|
(mode 'deadly)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
((method-of-type nav-enemy general-event-handler) this arg0 arg1 arg2 arg3)
|
|
)
|
|
)
|
|
)
|
|
(('attack)
|
|
(let ((v1-12 (the-as object (-> arg3 param 1))))
|
|
(cond
|
|
((!= (-> (the-as attack-info v1-12) id) (-> this incoming-attack-id))
|
|
(set! (-> this incoming-attack-id) (-> (the-as attack-info v1-12) id))
|
|
(cond
|
|
((or (-> this can-take-damage?)
|
|
(logtest? (penetrate dark-skin dark-punch dark-bomb) (-> (the-as attack-info v1-12) penetrate-using))
|
|
)
|
|
(cond
|
|
((and (-> this next-state) (= (-> this next-state name) 'fire))
|
|
(centurion-method-180 this)
|
|
((method-of-type nav-enemy general-event-handler) this arg0 arg1 arg2 arg3)
|
|
)
|
|
(else
|
|
((method-of-type nav-enemy general-event-handler) this arg0 arg1 arg2 arg3)
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
(+! (-> this shield-shot) 1)
|
|
(if (= (-> this shield-shot) 4)
|
|
(talker-spawn-func (-> *talker-speech* 58) *entity-pool* (target-pos 0) (the-as region #f))
|
|
)
|
|
(set! (-> *part-id-table* 2102 init-specs 13 initial-valuef) 255.0)
|
|
(set-time! (-> this state-time))
|
|
'back
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
#f
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(('victory)
|
|
(if (and (not (and (-> this next-state) (= (-> this next-state name) 'victory)))
|
|
(and (> (-> this hit-points) 0)
|
|
(zero? (-> this fated-time))
|
|
(not (logtest? (-> this focus-status) (focus-status grabbed)))
|
|
)
|
|
)
|
|
(go (method-of-object this victory))
|
|
)
|
|
)
|
|
(('notify)
|
|
(let ((v1-47 (handle->process (-> this focus handle))))
|
|
(when (and (= (-> arg3 param 0) 'attack)
|
|
(= (-> arg3 param 1) v1-47)
|
|
(-> this next-state)
|
|
(let ((v1-52 (-> this next-state name)))
|
|
(or (= v1-52 'hostile) (= v1-52 'fire))
|
|
)
|
|
)
|
|
(let ((a1-13 (new 'stack-no-clear 'event-message-block)))
|
|
(set! (-> a1-13 from) (process->ppointer arg0))
|
|
(set! (-> a1-13 num-params) arg1)
|
|
(set! (-> a1-13 message) 'victory)
|
|
(set! (-> a1-13 param 0) (-> arg3 param 0))
|
|
(set! (-> a1-13 param 1) (-> arg3 param 1))
|
|
(set! (-> a1-13 param 2) (-> arg3 param 2))
|
|
(set! (-> a1-13 param 3) (-> arg3 param 3))
|
|
(set! (-> a1-13 param 4) (-> arg3 param 4))
|
|
(set! (-> a1-13 param 5) (-> arg3 param 5))
|
|
(send-event-function this a1-13)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
((method-of-type nav-enemy general-event-handler) this arg0 arg1 arg2 arg3)
|
|
)
|
|
)
|
|
)
|
|
|
|
(defmethod centurion-method-181 ((this centurion) (arg0 vector))
|
|
(if (not (-> this joint-enable))
|
|
(return (the-as int #f))
|
|
)
|
|
(let ((s5-0 (new 'stack-no-clear 'vector)))
|
|
(set! (-> s5-0 quad) (-> arg0 quad))
|
|
(let* ((v0-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data 4)))
|
|
(s1-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) s5-0 v0-1) 1.0))
|
|
(s3-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
(new 'stack-no-clear 'vector)
|
|
(let ((s5-1 (new 'stack-no-clear 'quaternion)))
|
|
(vector-z-quaternion!
|
|
(new 'stack-no-clear 'vector)
|
|
(quaternion*! (new 'stack-no-clear 'quaternion) (-> this joint quat) (-> this root quat))
|
|
)
|
|
(let ((s4-1 (new 'stack-no-clear 'vector)))
|
|
(vector-z-quaternion! s3-0 (-> this root quat))
|
|
(let ((f30-0 (deg-diff (vector-y-angle s3-0) (vector-y-angle s1-0))))
|
|
0.0
|
|
(new 'stack-no-clear 'vector)
|
|
(new 'stack-no-clear 'vector)
|
|
(let ((s2-2 (new 'stack-no-clear 'vector)))
|
|
(vector-rotate-around-y! s4-1 s1-0 (- (vector-y-angle s1-0)))
|
|
(vector-rotate-around-y! s2-2 s3-0 (- (vector-y-angle s3-0)))
|
|
(let ((f0-9 (deg-diff (atan (-> s4-1 y) (-> s4-1 z)) (atan (-> s2-2 y) (-> s2-2 z)))))
|
|
(set-vector! s4-1 f0-9 f30-0 0.0 1.0)
|
|
)
|
|
)
|
|
)
|
|
(quaternion-zxy! s5-1 s4-1)
|
|
)
|
|
(quaternion-pseudo-seek (-> this joint quat) (-> this joint quat) s5-1 (seconds-per-frame))
|
|
)
|
|
)
|
|
)
|
|
(vector-z-quaternion!
|
|
(-> this shoot-dir)
|
|
(quaternion*! (new 'stack-no-clear 'quaternion) (-> this joint quat) (-> this root quat))
|
|
)
|
|
0
|
|
)
|
|
|
|
(defstate victory (centurion)
|
|
:virtual #t
|
|
:enter (behavior ()
|
|
(let ((t9-0 (-> (method-of-type nav-enemy victory) enter)))
|
|
(if t9-0
|
|
(t9-0)
|
|
)
|
|
)
|
|
(set! (-> self root root-prim specific 0) (+ (-> self root root-prim specific 1) -1))
|
|
(set! (-> self can-take-damage?) #t)
|
|
(centurion-shield-little)
|
|
(set! (-> self victory-sound) (new 'static 'sound-id))
|
|
0
|
|
)
|
|
:exit (behavior ()
|
|
(if (nonzero? (-> self victory-sound))
|
|
(sound-stop (-> self victory-sound))
|
|
)
|
|
(let ((t9-1 (-> (method-of-type nav-enemy victory) exit)))
|
|
(if t9-1
|
|
(t9-1)
|
|
)
|
|
)
|
|
(set! (-> self root root-prim specific 0) (-> self root root-prim specific 1))
|
|
(set! (-> self can-take-damage?) #f)
|
|
(centurion-shield-big)
|
|
)
|
|
:code (behavior ()
|
|
(ja-channel-push! 1 (seconds 0.075))
|
|
(let ((f30-0 (rnd-float-range self 0.8 1.2)))
|
|
(ja-no-eval :group! (-> self draw art-group data (-> self enemy-info victory-anim))
|
|
:num! (seek! max f30-0)
|
|
:frame-num 0.0
|
|
)
|
|
(until (ja-done? 0)
|
|
(if (and (zero? (-> self victory-sound)) (>= (ja-frame-num 0) 4.0))
|
|
(set! (-> self victory-sound) (sound-play "cent-celebrate"))
|
|
)
|
|
(suspend)
|
|
(ja :num! (seek! max f30-0))
|
|
)
|
|
)
|
|
(react-to-focus self)
|
|
(set! (-> self victory-sound) (new 'static 'sound-id))
|
|
0
|
|
)
|
|
)
|
|
|
|
(defmethod go-stare ((this centurion))
|
|
(if (not (and (-> this next-state) (= (-> this next-state name) 'hostile)))
|
|
(go (method-of-object this hostile))
|
|
)
|
|
)
|
|
|
|
(defstate active (centurion)
|
|
:virtual #t
|
|
:enter (behavior ()
|
|
(let ((t9-0 (-> (method-of-type enemy active) enter)))
|
|
(if t9-0
|
|
(t9-0)
|
|
)
|
|
)
|
|
)
|
|
:code (behavior ()
|
|
(ja-channel-push! 1 (seconds 0.2))
|
|
(let ((f30-0 (rnd-float-range self 0.9 1.1)))
|
|
(until #f
|
|
(ja-no-eval :group! centurion-idle-ja :num! (seek! max f30-0) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek! max f30-0))
|
|
)
|
|
)
|
|
)
|
|
#f
|
|
)
|
|
:post nav-enemy-simple-post
|
|
)
|
|
|
|
(defmethod centurion-method-180 ((this centurion))
|
|
(rlet ((acc :class vf)
|
|
(vf0 :class vf)
|
|
(vf4 :class vf)
|
|
(vf5 :class vf)
|
|
(vf6 :class vf)
|
|
(vf7 :class vf)
|
|
)
|
|
(init-vf0-vector)
|
|
(when (-> this can-shoot?)
|
|
(let ((s5-0 (new 'stack-no-clear 'projectile-init-by-other-params)))
|
|
(let* ((a1-0 (-> this node-list data 29))
|
|
(s3-0 (vector<-cspace! (new 'stack-no-clear 'vector) a1-0))
|
|
(s4-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
(cond
|
|
((-> this first-shoot?)
|
|
(let ((s0-0 (handle->process (-> this focus handle)))
|
|
(s2-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
(when s0-0
|
|
(set! (-> s2-0 quad) (-> (get-trans (the-as process-focusable s0-0) 3) quad))
|
|
(let ((s1-2 (vector-! (new 'stack-no-clear 'vector) (-> this root trans) s2-0)))
|
|
(let* ((f0-0 (vector-length s1-2))
|
|
(f0-1 (/ f0-0 (meters 80)))
|
|
(a0-7 s2-0)
|
|
)
|
|
(let ((v1-17 s2-0))
|
|
(let ((a1-4 (-> (the-as process-focusable s0-0) root transv)))
|
|
(let ((a2-0 f0-1))
|
|
(.mov vf7 a2-0)
|
|
)
|
|
(.lvf vf5 (&-> a1-4 quad))
|
|
)
|
|
(.lvf vf4 (&-> v1-17 quad))
|
|
)
|
|
(.add.x.vf.w vf6 vf0 vf0)
|
|
(.mul.x.vf.xyz acc vf5 vf7)
|
|
(.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
|
|
(.svf (&-> a0-7 quad) vf6)
|
|
)
|
|
(set! (-> s1-2 y) 0.0)
|
|
(vector-rotate90-around-y! s1-2 s1-2)
|
|
(vector-normalize! s1-2 12288.0)
|
|
(vector-! s4-0 s2-0 s3-0)
|
|
(vector+! s4-0 s4-0 s1-2)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
(vector-! s4-0 (-> this target-pos) s3-0)
|
|
)
|
|
)
|
|
(vector-normalize! s4-0 327680.0)
|
|
(set! (-> s5-0 ent) (-> this entity))
|
|
(set! (-> s5-0 charge) 1.0)
|
|
(set! (-> s5-0 options) (projectile-options))
|
|
(set! (-> s5-0 pos quad) (-> s3-0 quad))
|
|
(set! (-> s5-0 vel quad) (-> s4-0 quad))
|
|
)
|
|
(set! (-> s5-0 notify-handle) (process->handle this))
|
|
(set! (-> s5-0 owner-handle) (the-as handle #f))
|
|
(set! (-> s5-0 ignore-handle) (process->handle this))
|
|
(let* ((v1-32 *game-info*)
|
|
(a0-26 (+ (-> v1-32 attack-id) 1))
|
|
)
|
|
(set! (-> v1-32 attack-id) a0-26)
|
|
(set! (-> s5-0 attack-id) a0-26)
|
|
)
|
|
(set! (-> s5-0 timeout) (seconds 4))
|
|
(spawn-projectile centurion-shot s5-0 this *default-dead-pool*)
|
|
)
|
|
(set! (-> this can-shoot?) #f)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
)
|
|
|
|
(defstate fire (centurion)
|
|
:virtual #t
|
|
:event enemy-event-handler
|
|
:enter (behavior ()
|
|
(set! (-> self can-shoot?) (the-as basic #t))
|
|
(if (and (-> self first-shoot?) (logtest? (-> self draw status) (draw-control-status on-screen)))
|
|
(set! (-> self first-shoot?) #f)
|
|
)
|
|
(centurion-shield-little)
|
|
(logior! (-> self focus-status) (focus-status dangerous))
|
|
(let* ((v1-8 *game-info*)
|
|
(v0-1 (+ (-> v1-8 attack-id) 1))
|
|
)
|
|
(set! (-> v1-8 attack-id) v0-1)
|
|
(set! (-> self attack-id) v0-1)
|
|
)
|
|
)
|
|
:exit (behavior ()
|
|
(set! (-> self first-shoot?) #f)
|
|
(set! (-> self can-take-damage?) #f)
|
|
(set! (-> self root root-prim specific 0) (-> self root root-prim specific 1))
|
|
(centurion-shield-big)
|
|
(if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup))
|
|
(logior! (-> self focus-status) (focus-status dangerous))
|
|
(logclear! (-> self focus-status) (focus-status dangerous))
|
|
)
|
|
)
|
|
:code (behavior ()
|
|
(let ((f30-0 1.0))
|
|
(when (logtest? (-> self fact enemy-options) (enemy-option user0))
|
|
(set! f30-0 0.75)
|
|
(let ((a0-1 (handle->process (-> self focus handle))))
|
|
(if a0-1
|
|
(set! (-> self target-pos quad) (-> (get-trans (the-as process-focusable a0-1) 3) quad))
|
|
)
|
|
)
|
|
)
|
|
(ja-channel-push! 1 (seconds 0.2))
|
|
(ja-no-eval :group! centurion-shoot-start-ja :num! (seek! max f30-0) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(let ((gp-2 (handle->process (-> self focus handle))))
|
|
(when gp-2
|
|
(seek-toward-heading-vec!
|
|
(-> self root)
|
|
(vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable gp-2) 0) (-> self root trans))
|
|
32768.0
|
|
(seconds 0.05)
|
|
)
|
|
(if (< (vector-vector-distance (-> self root trans) (get-trans (the-as process-focusable gp-2) 0)) 24576.0)
|
|
(go-virtual attack)
|
|
)
|
|
)
|
|
)
|
|
(suspend)
|
|
(ja :num! (seek! max f30-0))
|
|
)
|
|
(set! (-> self root root-prim specific 0) (+ (-> self root root-prim specific 1) -1))
|
|
(set! (-> self can-take-damage?) #t)
|
|
(when (not (logtest? (-> self fact enemy-options) (enemy-option user0)))
|
|
(let ((a0-20 (handle->process (-> self focus handle))))
|
|
(if a0-20
|
|
(set! (-> self target-pos quad) (-> (get-trans (the-as process-focusable a0-20) 3) quad))
|
|
)
|
|
)
|
|
)
|
|
(centurion-method-180 self)
|
|
(ja-no-eval :group! centurion-shoot-loop-ja :num! (seek! 2.0) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek! 2.0))
|
|
)
|
|
(set! (-> self can-shoot?) (the-as basic #t))
|
|
(when (handle->process (-> self focus handle))
|
|
)
|
|
(centurion-method-180 self)
|
|
(ja-no-eval :group! centurion-shoot-loop-ja :num! (seek! 2.0) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek! 2.0))
|
|
)
|
|
(set! (-> self can-shoot?) (the-as basic #t))
|
|
(when (handle->process (-> self focus handle))
|
|
)
|
|
(centurion-method-180 self)
|
|
(ja-no-eval :group! centurion-shoot-loop-ja :num! (seek! max 0.4) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek! max 0.4))
|
|
)
|
|
(set! (-> self can-take-damage?) #f)
|
|
(set! (-> self root root-prim specific 0) (-> self root root-prim specific 1))
|
|
(ja-channel-push! 1 (seconds 0.2))
|
|
(ja-no-eval :group! centurion-shoot-end-ja :num! (seek! max f30-0) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek! max f30-0))
|
|
)
|
|
)
|
|
(go-virtual hostile)
|
|
)
|
|
:post enemy-simple-post
|
|
)
|
|
|
|
(defstate attack (centurion)
|
|
:virtual #t
|
|
:event enemy-event-handler
|
|
:enter (behavior ()
|
|
(set! (-> (the-as collide-shape-prim-group (-> self root root-prim)) child 3 prim-core action)
|
|
(collide-action solid deadly)
|
|
)
|
|
(set! (-> (the-as collide-shape-prim-group (-> self root root-prim)) child 3 local-sphere w) 10240.0)
|
|
(logior! (-> self focus-status) (focus-status dangerous))
|
|
(let* ((v1-7 *game-info*)
|
|
(v0-0 (+ (-> v1-7 attack-id) 1))
|
|
)
|
|
(set! (-> v1-7 attack-id) v0-0)
|
|
(set! (-> self attack-id) v0-0)
|
|
)
|
|
)
|
|
:exit (behavior ()
|
|
(set! (-> (the-as collide-shape-prim-group (-> self root root-prim)) child 3 prim-core action)
|
|
(collide-action solid)
|
|
)
|
|
(set! (-> (the-as collide-shape-prim-group (-> self root root-prim)) child 3 local-sphere w) 5120.0)
|
|
(if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup))
|
|
(logior! (-> self focus-status) (focus-status dangerous))
|
|
(logclear! (-> self focus-status) (focus-status dangerous))
|
|
)
|
|
)
|
|
:code (behavior ()
|
|
(ja-channel-push! 1 (seconds 0.2))
|
|
(ja-no-eval :group! centurion-hit-away-ja :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
(go-virtual hostile)
|
|
)
|
|
:post enemy-simple-post
|
|
)
|
|
|
|
(defmethod dying ((this centurion))
|
|
"Cleans-up the enemy and any associated resources. Potentially spawns skull gems"
|
|
(play-communicator-speech! (-> *talker-speech* 58))
|
|
(call-parent-method this)
|
|
(none)
|
|
)
|
|
|
|
(defmethod common-post ((this centurion))
|
|
"Does a lot of various things relating to interacting with the target
|
|
- tracks when the enemy was last drawn
|
|
- looks at the target and handles attacking
|
|
@TODO Not extremely well understood yet"
|
|
(rlet ((acc :class vf)
|
|
(vf0 :class vf)
|
|
(vf4 :class vf)
|
|
(vf5 :class vf)
|
|
(vf6 :class vf)
|
|
(vf7 :class vf)
|
|
)
|
|
(init-vf0-vector)
|
|
(let ((f30-0 (* 4.0 (seconds-per-frame))))
|
|
(set! (-> *part-id-table* 2104 init-specs 2 initial-valuef)
|
|
(lerp
|
|
(-> *part-id-table* 2104 init-specs 2 initial-valuef)
|
|
(the float *centurion-shield-glow-spt-scale-x*)
|
|
f30-0
|
|
)
|
|
)
|
|
(set! (-> *part-id-table* 2104 init-specs 4 initial-valuef)
|
|
(lerp
|
|
(-> *part-id-table* 2104 init-specs 4 initial-valuef)
|
|
(the float *centurion-shield-glow-spt-scale-y*)
|
|
f30-0
|
|
)
|
|
)
|
|
(set! (-> *part-id-table* 2103 init-specs 5 initial-valuef)
|
|
(lerp
|
|
(-> *part-id-table* 2103 init-specs 5 initial-valuef)
|
|
(the float *centurion-shield-center-spt-scale-x*)
|
|
f30-0
|
|
)
|
|
)
|
|
(set! (-> *part-id-table* 2103 init-specs 9 initial-valuef)
|
|
(lerp
|
|
(-> *part-id-table* 2103 init-specs 9 initial-valuef)
|
|
(the float *centurion-shield-center-spt-scale-y*)
|
|
f30-0
|
|
)
|
|
)
|
|
(set! (-> *part-id-table* 2102 init-specs 5 initial-valuef)
|
|
(lerp (-> *part-id-table* 2102 init-specs 5 initial-valuef) (the float *centurion-shield-spt-scale-x*) f30-0)
|
|
)
|
|
(set! (-> *part-id-table* 2102 init-specs 9 initial-valuef)
|
|
(lerp (-> *part-id-table* 2102 init-specs 9 initial-valuef) (the float *centurion-shield-spt-scale-y*) f30-0)
|
|
)
|
|
(set! (-> *part-id-table* 2101 init-specs 5 initial-valuef)
|
|
(lerp
|
|
(-> *part-id-table* 2101 init-specs 5 initial-valuef)
|
|
(the float *centurion-shield-2-spt-scale-x*)
|
|
f30-0
|
|
)
|
|
)
|
|
(set! (-> *part-id-table* 2101 init-specs 9 initial-valuef)
|
|
(lerp
|
|
(-> *part-id-table* 2101 init-specs 9 initial-valuef)
|
|
(the float *centurion-shield-2-spt-scale-y*)
|
|
f30-0
|
|
)
|
|
)
|
|
(cond
|
|
((logtest? (-> this fact enemy-options) (enemy-option user0))
|
|
(set! (-> *part-id-table* 2101 init-specs 10 initial-valuef) 0.0)
|
|
(set! (-> *part-id-table* 2101 init-specs 10 random-rangef) 0.0)
|
|
(set! (-> *part-id-table* 2102 init-specs 10 initial-valuef) 0.0)
|
|
(set! (-> *part-id-table* 2102 init-specs 10 random-rangef) 0.0)
|
|
(set! (-> *part-id-table* 2104 init-specs 5 initial-valuef) 0.0)
|
|
(set! (-> *part-id-table* 2104 init-specs 5 random-rangef) 0.0)
|
|
)
|
|
(else
|
|
(set! (-> *part-id-table* 2101 init-specs 10 initial-valuef) 128.0)
|
|
(set! (-> *part-id-table* 2101 init-specs 10 random-rangef) 128.0)
|
|
(set! (-> *part-id-table* 2102 init-specs 10 initial-valuef) 128.0)
|
|
(set! (-> *part-id-table* 2102 init-specs 10 random-rangef) 128.0)
|
|
(set! (-> *part-id-table* 2104 init-specs 5 initial-valuef) 64.0)
|
|
(set! (-> *part-id-table* 2104 init-specs 5 random-rangef) 64.0)
|
|
)
|
|
)
|
|
(set! (-> *part-id-table* 2102 init-specs 13 initial-valuef)
|
|
(lerp (-> *part-id-table* 2102 init-specs 13 initial-valuef) 10.0 f30-0)
|
|
)
|
|
)
|
|
(let ((a0-11 (handle->process (-> this focus handle))))
|
|
(if a0-11
|
|
(centurion-method-181 this (get-trans (the-as process-focusable a0-11) 3))
|
|
)
|
|
)
|
|
(logior! (-> this skel status) (joint-control-status sync-math))
|
|
(los-control-method-9 (-> this los) (the-as process-focusable #f) (the-as vector #f) 2048.0)
|
|
(let ((t9-12 (method-of-type nav-enemy common-post)))
|
|
(t9-12 this)
|
|
)
|
|
(when (not (logtest? (-> this draw status) (draw-control-status no-draw)))
|
|
(let ((s5-1 (new 'stack-no-clear 'matrix)))
|
|
(let* ((a2-10 (-> this node-list data 12 bone transform))
|
|
(v1-131 (-> a2-10 quad 0))
|
|
(a0-18 (-> a2-10 quad 1))
|
|
(a1-13 (-> a2-10 quad 2))
|
|
(a2-11 (-> a2-10 trans quad))
|
|
)
|
|
(set! (-> s5-1 quad 0) v1-131)
|
|
(set! (-> s5-1 quad 1) a0-18)
|
|
(set! (-> s5-1 quad 2) a1-13)
|
|
(set! (-> s5-1 trans quad) a2-11)
|
|
)
|
|
(let ((s4-1 (new 'stack-no-clear 'matrix)))
|
|
(if (logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags))
|
|
(vector-negate-in-place! (-> s5-1 vector 0))
|
|
)
|
|
(matrix-rotate-y! s4-1 (if (logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags))
|
|
2548.6223
|
|
-2548.6223
|
|
)
|
|
)
|
|
(matrix*! s5-1 s4-1 s5-1)
|
|
(matrix-rotate-z! s4-1 (if (logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags))
|
|
691.76886
|
|
-691.76886
|
|
)
|
|
)
|
|
(matrix*! s5-1 s4-1 s5-1)
|
|
)
|
|
(let ((a1-20 (-> s5-1 trans)))
|
|
(let ((v1-143 (-> s5-1 trans)))
|
|
(let ((a0-25 (-> s5-1 vector)))
|
|
(let ((a2-18 (the-as float (if (logtest? (enemy-flag drawn-mirrored) (-> this enemy-flags))
|
|
-997237719
|
|
#x43a3d70a
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(.mov vf7 a2-18)
|
|
)
|
|
(.lvf vf5 (&-> a0-25 0 quad))
|
|
)
|
|
(.lvf vf4 (&-> v1-143 quad))
|
|
)
|
|
(.add.x.vf.w vf6 vf0 vf0)
|
|
(.mul.x.vf.xyz acc vf5 vf7)
|
|
(.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
|
|
(.svf (&-> a1-20 quad) vf6)
|
|
)
|
|
(spawn-with-matrix (-> this part) s5-1)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
)
|
|
|
|
(defmethod nav-enemy-method-142 ((this centurion) (arg0 nav-control))
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod centurion-method-182 ((this centurion) (arg0 vector))
|
|
(when (nonzero? (-> this path))
|
|
(let ((s5-0 (-> this path))
|
|
(s4-0 (new 'stack-no-clear 'vector))
|
|
(s3-0 (new 'stack-no-clear 'vector))
|
|
(s2-0 (new 'stack-no-clear 'vector))
|
|
(s1-0 (new 'stack-no-clear 'vector))
|
|
(s0-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
(set! (-> s0-0 quad) (-> arg0 quad))
|
|
(let ((sv-96 0)
|
|
(gp-0 0)
|
|
)
|
|
(set! (-> s0-0 y) 0.0)
|
|
(let ((sv-112 0))
|
|
(while (< sv-112 4)
|
|
(get-point-in-path! s5-0 s3-0 (the float sv-112) 'interp)
|
|
(get-point-in-path! s5-0 s2-0 (the float (+ sv-112 1)) 'interp)
|
|
(vector-! s1-0 s0-0 s3-0)
|
|
(vector-! s4-0 s2-0 s3-0)
|
|
(set! (-> s4-0 y) 0.0)
|
|
(vector-rotate90-around-y! s4-0 s4-0)
|
|
(cond
|
|
((>= (vector-dot s1-0 s4-0) 0.0)
|
|
(+! gp-0 1)
|
|
)
|
|
(else
|
|
(+! sv-96 1)
|
|
sv-96
|
|
)
|
|
)
|
|
(+! sv-112 1)
|
|
)
|
|
)
|
|
(if (or (= sv-96 4) (= gp-0 4))
|
|
(return #t)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
#f
|
|
)
|
|
|
|
(defstate hostile (centurion)
|
|
:virtual #t
|
|
:enter (behavior ()
|
|
(let ((t9-0 (-> (method-of-type nav-enemy hostile) enter)))
|
|
(if t9-0
|
|
(t9-0)
|
|
)
|
|
)
|
|
(set-time! (-> self state-time))
|
|
(nav-enemy-method-165 self)
|
|
(set! (-> self joint-enable) #t)
|
|
(set! (-> self can-shoot?) (the-as basic #t))
|
|
)
|
|
:exit (behavior ()
|
|
(let ((t9-0 (-> (method-of-type nav-enemy hostile) exit)))
|
|
(if t9-0
|
|
(t9-0)
|
|
)
|
|
)
|
|
)
|
|
:trans (behavior ()
|
|
(rlet ((acc :class vf)
|
|
(vf0 :class vf)
|
|
(vf4 :class vf)
|
|
(vf5 :class vf)
|
|
(vf6 :class vf)
|
|
(vf7 :class vf)
|
|
)
|
|
(init-vf0-vector)
|
|
(let ((t9-0 (-> (method-of-type nav-enemy hostile) trans)))
|
|
(if t9-0
|
|
(t9-0)
|
|
)
|
|
)
|
|
(let ((s5-0 (handle->process (-> self focus handle)))
|
|
(gp-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
(when s5-0
|
|
(set! (-> gp-0 quad) (-> (get-trans (the-as process-focusable s5-0) 0) quad))
|
|
(let ((a0-4 gp-0))
|
|
(let ((v1-11 gp-0))
|
|
(let ((a1-3 (-> (the-as process-focusable s5-0) root transv)))
|
|
(let ((a2-1 0.1))
|
|
(.mov vf7 a2-1)
|
|
)
|
|
(.lvf vf5 (&-> a1-3 quad))
|
|
)
|
|
(.lvf vf4 (&-> v1-11 quad))
|
|
)
|
|
(.add.x.vf.w vf6 vf0 vf0)
|
|
(.mul.x.vf.xyz acc vf5 vf7)
|
|
(.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
|
|
(.svf (&-> a0-4 quad) vf6)
|
|
)
|
|
(let ((f30-0 (vector-vector-xz-distance gp-0 (-> self root trans))))
|
|
(cond
|
|
((< f30-0 24576.0)
|
|
(go-virtual attack)
|
|
)
|
|
(else
|
|
(when (-> self can-shoot?)
|
|
(if (and (get-enemy-target self)
|
|
(time-elapsed? (-> self state-time) (the int (+ 60.0 (* 0.0036621094 f30-0))))
|
|
(check-los? (-> self los) 0)
|
|
)
|
|
(go-virtual fire)
|
|
)
|
|
)
|
|
(if (skip-check-los? (-> self los) 0)
|
|
(set-time! (-> self state-time))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
:code (behavior ()
|
|
(rnd-float-range self 0.9 1.1)
|
|
-1
|
|
0.0
|
|
1.0
|
|
0
|
|
(until #f
|
|
(until #f
|
|
(let ((s5-0 (new 'stack-no-clear 'vector))
|
|
(gp-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
(let ((f30-0 24576.0))
|
|
(until #f
|
|
(set-vector! s5-0 (rnd-float-range self -1.0 1.0) 0.0 (rnd-float-range self -1.0 1.0) 1.0)
|
|
(vector-normalize! s5-0 f30-0)
|
|
(vector+! gp-0 (-> self root trans) s5-0)
|
|
(if (centurion-method-182 self gp-0)
|
|
(goto cfg-9)
|
|
)
|
|
(set! f30-0 (+ -1024.0 f30-0))
|
|
(if (< f30-0 0.0)
|
|
(goto cfg-9)
|
|
)
|
|
)
|
|
)
|
|
#f
|
|
(label cfg-9)
|
|
(set! (-> self tar-pos quad) (-> gp-0 quad))
|
|
)
|
|
(let ((gp-1 (new 'stack-no-clear 'vector)))
|
|
(let ((a0-9 (handle->process (-> self focus handle))))
|
|
(if a0-9
|
|
(set! (-> gp-1 quad) (-> (get-trans (the-as process-focusable a0-9) 0) quad))
|
|
(vector+! gp-1 (-> self root trans) *z-vector*)
|
|
)
|
|
)
|
|
(let* ((a0-15 (vector-! (new 'stack-no-clear 'vector) gp-1 (-> self root trans)))
|
|
(gp-3 (vector-! (new 'stack-no-clear 'vector) (-> self tar-pos) (-> self root trans)))
|
|
(f28-0 (deg-diff (vector-y-angle a0-15) (vector-y-angle gp-3)))
|
|
(f30-1 0.0)
|
|
)
|
|
(ja-channel-push! 1 (seconds 0.1))
|
|
(cond
|
|
((< f28-0 -24576.0)
|
|
(ja :group! centurion-walk-forward-ja)
|
|
(set! f30-1 -1.0)
|
|
)
|
|
((< f28-0 -8192.0)
|
|
(ja :group! centurion-side-stepR-ja)
|
|
(set! f30-1 -1.0)
|
|
)
|
|
((< f28-0 8192.0)
|
|
(ja :group! centurion-walk-forward-ja)
|
|
(set! f30-1 1.0)
|
|
)
|
|
((< f28-0 24576.0)
|
|
(ja :group! centurion-side-stepR-ja)
|
|
(set! f30-1 1.0)
|
|
)
|
|
((< f28-0 40960.0)
|
|
(ja :group! centurion-walk-forward-ja)
|
|
(set! f30-1 -1.0)
|
|
)
|
|
)
|
|
(let ((a0-34 (-> self nav state))
|
|
(v1-73 (-> self tar-pos))
|
|
)
|
|
(logclear! (-> a0-34 flags) (nav-state-flag directional-mode))
|
|
(logior! (-> a0-34 flags) (nav-state-flag target-poly-dirty))
|
|
(set! (-> a0-34 target-post quad) (-> v1-73 quad))
|
|
)
|
|
0
|
|
(let ((f28-1 (if (< f30-1 0.0)
|
|
20.0
|
|
0.0
|
|
)
|
|
)
|
|
)
|
|
(dotimes (gp-4 2)
|
|
(until #f
|
|
(ja :num-func num-func-identity :frame-num f28-1)
|
|
(suspend)
|
|
(+! f28-1 (* f30-1 (* (ja-speed 0) (-> self clock time-adjust-ratio))))
|
|
(when (< 20.0 f28-1)
|
|
(set! f28-1 (+ -20.0 f28-1))
|
|
(goto cfg-38)
|
|
)
|
|
(when (< f28-1 0.0)
|
|
(set! f28-1 (+ 20.0 f28-1))
|
|
(goto cfg-38)
|
|
)
|
|
)
|
|
#f
|
|
(label cfg-38)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(+ (current-time) (seconds 3))
|
|
)
|
|
#f
|
|
)
|
|
#f
|
|
)
|
|
:post nav-enemy-travel-post
|
|
)
|
|
|
|
(defmethod enemy-method-77 ((this centurion) (arg0 enemy-knocked-info))
|
|
(cond
|
|
((zero? (-> this hit-points))
|
|
(ja-channel-push! 1 (seconds 0.17))
|
|
(let ((a0-2 (-> this skel root-channel 0)))
|
|
(set! (-> a0-2 frame-group) (the-as art-joint-anim (-> this draw art-group data 5)))
|
|
(set! (-> a0-2 param 0)
|
|
(the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 5)) frames num-frames) -1))
|
|
)
|
|
(set! (-> a0-2 param 1) (-> arg0 anim-speed))
|
|
(set! (-> a0-2 frame-num) 0.0)
|
|
(joint-control-channel-group! a0-2 (the-as art-joint-anim (-> this draw art-group data 5)) num-func-seek!)
|
|
)
|
|
#t
|
|
)
|
|
(else
|
|
(case (-> this incoming knocked-type)
|
|
(((knocked-type knocked-type-4))
|
|
(ja-channel-push! 1 (seconds 0.1))
|
|
(let* ((a2-1 (ash 1 (-> *centurion-global-info* prev-yellow-hit)))
|
|
(v1-18 (rnd-bit this 1 a2-1))
|
|
(a1-8 (-> this draw art-group data (-> *centurion-global-info* yellow-hit-anim v1-18)))
|
|
)
|
|
(set! (-> *centurion-global-info* prev-yellow-hit) v1-18)
|
|
(let ((a0-15 (-> this skel root-channel 0)))
|
|
(set! (-> a0-15 frame-group) (the-as art-joint-anim a1-8))
|
|
(set! (-> a0-15 param 0) (the float (+ (-> (the-as art-joint-anim a1-8) frames num-frames) -1)))
|
|
(set! (-> a0-15 param 1) (-> arg0 anim-speed))
|
|
(set! (-> a0-15 frame-num) 0.0)
|
|
(joint-control-channel-group! a0-15 (the-as art-joint-anim a1-8) num-func-seek!)
|
|
)
|
|
)
|
|
)
|
|
(((knocked-type knocked-type-6))
|
|
(let* ((a2-3 (ash 1 (-> *centurion-global-info* prev-blue-hit)))
|
|
(v1-27 (rnd-bit this 3 a2-3))
|
|
(a1-13 (-> this draw art-group data (-> *centurion-global-info* blue-hit-anim v1-27)))
|
|
)
|
|
(set! (-> *centurion-global-info* prev-blue-hit) v1-27)
|
|
(let ((a0-27 (-> this skel root-channel 0)))
|
|
(set! (-> a0-27 frame-group) (the-as art-joint-anim a1-13))
|
|
(set! (-> a0-27 param 0) (the float (+ (-> (the-as art-joint-anim a1-13) frames num-frames) -1)))
|
|
(set! (-> a0-27 param 1) 1.0)
|
|
(set! (-> a0-27 frame-num) 0.0)
|
|
(joint-control-channel-group! a0-27 (the-as art-joint-anim a1-13) num-func-seek!)
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
(let ((s4-0 (if (= (-> this incoming knocked-type) (knocked-type knocked-type-2))
|
|
(-> this draw art-group data 21)
|
|
(-> this draw art-group data 21)
|
|
)
|
|
)
|
|
)
|
|
(ja-channel-push! 1 (seconds 0.17))
|
|
(let ((a0-30 (-> this skel root-channel 0)))
|
|
(set! (-> a0-30 frame-group) (the-as art-joint-anim s4-0))
|
|
(set! (-> a0-30 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1)))
|
|
(set! (-> a0-30 param 1) (-> arg0 anim-speed))
|
|
(set! (-> a0-30 frame-num) 0.0)
|
|
(joint-control-channel-group! a0-30 (the-as art-joint-anim s4-0) num-func-seek!)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
#t
|
|
)
|
|
)
|
|
)
|
|
|
|
(defmethod enemy-method-78 ((this centurion) (arg0 enemy-knocked-info))
|
|
(cond
|
|
((zero? (-> this hit-points))
|
|
(ja-channel-push! 1 (seconds 0.17))
|
|
(let ((a0-2 (-> this skel root-channel 0)))
|
|
(set! (-> a0-2 frame-group) (the-as art-joint-anim (-> this draw art-group data 33)))
|
|
(set! (-> a0-2 param 0)
|
|
(the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 33)) frames num-frames) -1))
|
|
)
|
|
(set! (-> a0-2 param 1) (-> arg0 anim-speed))
|
|
(set! (-> a0-2 frame-num) 0.0)
|
|
(joint-control-channel-group! a0-2 (the-as art-joint-anim (-> this draw art-group data 33)) num-func-seek!)
|
|
)
|
|
#t
|
|
)
|
|
(else
|
|
(cond
|
|
((= (-> this incoming knocked-type) (knocked-type knocked-type-6))
|
|
(when (>= (-> this incoming blue-juggle-count) (the-as uint 2))
|
|
(let ((s4-0 (-> this draw art-group data 8)))
|
|
(ja-channel-push! 1 (seconds 0.1))
|
|
(let ((a0-5 (-> this skel root-channel 0)))
|
|
(set! (-> a0-5 frame-group) (the-as art-joint-anim s4-0))
|
|
(set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1)))
|
|
(set! (-> a0-5 param 1) (-> arg0 anim-speed))
|
|
(joint-control-channel-group! a0-5 (the-as art-joint-anim s4-0) num-func-seek!)
|
|
)
|
|
)
|
|
#t
|
|
)
|
|
)
|
|
(else
|
|
(ja-channel-push! 1 (seconds 0.1))
|
|
(let ((a0-7 (-> this skel root-channel 0)))
|
|
(set! (-> a0-7 frame-group) (the-as art-joint-anim (-> this draw art-group data 22)))
|
|
(set! (-> a0-7 param 0)
|
|
(the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 22)) frames num-frames) -1))
|
|
)
|
|
(set! (-> a0-7 param 1) (-> arg0 anim-speed))
|
|
(joint-control-channel-group! a0-7 (the-as art-joint-anim (-> this draw art-group data 22)) num-func-seek!)
|
|
)
|
|
#t
|
|
)
|
|
)
|
|
#t
|
|
)
|
|
)
|
|
)
|
|
|
|
(defmethod coin-flip? ((this centurion))
|
|
"@returns The result of a 50/50 RNG roll"
|
|
#f
|
|
)
|
|
|
|
;; WARN: Return type mismatch none vs symbol.
|
|
(defmethod enemy-method-63 ((this centurion) (arg0 process-focusable) (arg1 enemy-aware))
|
|
(let ((t9-0 (method-of-type nav-enemy enemy-method-63)))
|
|
(the-as symbol (if (t9-0 this arg0 arg1)
|
|
(set-dst-proc! (-> this los) (-> this focus handle))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
(defmethod init-enemy-collision! ((this centurion))
|
|
"Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly"
|
|
(let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player))))
|
|
(set! (-> s5-0 dynam) (copy *standard-dynamics* 'process))
|
|
(set! (-> s5-0 reaction) cshape-reaction-default)
|
|
(set! (-> s5-0 no-reaction)
|
|
(the-as (function collide-shape-moving collide-query vector vector object) nothing)
|
|
)
|
|
(set! (-> s5-0 penetrated-by) (penetrate dark-skin dark-punch dark-bomb))
|
|
(let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 7) 0)))
|
|
(set! (-> s5-0 total-prims) (the-as uint 8))
|
|
(set! (-> s4-0 prim-core collide-as) (collide-spec enemy))
|
|
(set! (-> s4-0 prim-core collide-with)
|
|
(collide-spec backgnd jak bot crate obstacle hit-by-others-list player-list)
|
|
)
|
|
(set! (-> s4-0 prim-core action) (collide-action solid semi-solid deadly no-standon))
|
|
(set-vector! (-> s4-0 local-sphere) 0.0 11550.72 0.0 35840.0)
|
|
(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 enemy))
|
|
(set! (-> v1-13 prim-core collide-with) (collide-spec backgnd jak bot crate hit-by-others-list player-list))
|
|
(set! (-> v1-13 prim-core action) (collide-action solid no-standon))
|
|
(set-vector! (-> v1-13 local-sphere) 0.0 6144.0 0.0 6144.0)
|
|
)
|
|
(let ((v1-15 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
|
|
(set! (-> v1-15 prim-core collide-as) (collide-spec enemy))
|
|
(set! (-> v1-15 prim-core collide-with) (collide-spec jak bot player-list))
|
|
(set! (-> v1-15 prim-core action) (collide-action solid no-standon))
|
|
(set-vector! (-> v1-15 local-sphere) 0.0 12288.0 0.0 6144.0)
|
|
)
|
|
(let ((v1-17 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
|
|
(set! (-> v1-17 prim-core collide-as) (collide-spec enemy))
|
|
(set! (-> v1-17 prim-core collide-with) (collide-spec jak bot player-list))
|
|
(set! (-> v1-17 prim-core action) (collide-action solid no-standon))
|
|
(set-vector! (-> v1-17 local-sphere) 0.0 18432.0 0.0 6144.0)
|
|
)
|
|
(let ((v1-19 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 2))))
|
|
(set! (-> v1-19 prim-core collide-as) (collide-spec enemy))
|
|
(set! (-> v1-19 prim-core collide-with) (collide-spec jak bot))
|
|
(set! (-> v1-19 prim-core action) (collide-action solid))
|
|
(set! (-> v1-19 transform-index) 12)
|
|
(set-vector! (-> v1-19 local-sphere) 0.0 0.0 0.0 12288.0)
|
|
)
|
|
(let ((v1-21 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
|
|
(set! (-> v1-21 prim-core collide-as) (collide-spec enemy))
|
|
(set! (-> v1-21 prim-core collide-with) (collide-spec jak bot player-list))
|
|
(set! (-> v1-21 prim-core action) (collide-action deadly))
|
|
(set! (-> v1-21 transform-index) 6)
|
|
(set-vector! (-> v1-21 local-sphere) 0.0 0.0 0.0 5120.0)
|
|
)
|
|
(let ((v1-23 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
|
|
(set! (-> v1-23 prim-core collide-as) (collide-spec enemy))
|
|
(set! (-> v1-23 prim-core collide-with) (collide-spec jak bot))
|
|
(set! (-> v1-23 prim-core action) (collide-action deadly))
|
|
(set! (-> v1-23 transform-index) 29)
|
|
(set-vector! (-> v1-23 local-sphere) 0.0 0.0 0.0 3891.2)
|
|
)
|
|
(let ((v1-25 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 1))))
|
|
(set! (-> v1-25 prim-core collide-as) (collide-spec enemy))
|
|
(set! (-> v1-25 prim-core collide-with) (collide-spec jak bot player-list))
|
|
(set! (-> v1-25 prim-core action) (collide-action solid no-standon))
|
|
(set-vector! (-> v1-25 local-sphere) 0.0 12800.0 0.0 12800.0)
|
|
)
|
|
(set! (-> s5-0 nav-radius) 2457.6)
|
|
(let ((v1-27 (-> s5-0 root-prim)))
|
|
(set! (-> s5-0 backup-collide-as) (-> v1-27 prim-core collide-as))
|
|
(set! (-> s5-0 backup-collide-with) (-> v1-27 prim-core collide-with))
|
|
)
|
|
(set! (-> s5-0 max-iteration-count) (the-as uint 3))
|
|
(set! (-> this root) s5-0)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod relocate ((this centurion) (offset int))
|
|
(if (nonzero? (-> this joint))
|
|
(&+! (-> this joint) offset)
|
|
)
|
|
(call-parent-method this offset)
|
|
)
|
|
|
|
(defmethod init-enemy! ((this centurion))
|
|
"Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods"
|
|
(stack-size-set! (-> this main-thread) 256)
|
|
(initialize-skeleton
|
|
this
|
|
(the-as skeleton-group (art-group-get-by-name *level* "skel-centurion" (the-as (pointer uint32) #f)))
|
|
(the-as pair 0)
|
|
)
|
|
(set! (-> this skel generate-frame-function) create-interpolated2-joint-animation-frame)
|
|
(init-enemy-behaviour-and-stats! this *centurion-nav-enemy-info*)
|
|
(set! (-> this shield-shot) (the-as uint 0))
|
|
(set! (-> this part) (create-launch-control group-centurion-shield this))
|
|
(let ((v1-11 (-> this neck)))
|
|
(set! (-> v1-11 up) (the-as uint 1))
|
|
(set! (-> v1-11 nose) (the-as uint 2))
|
|
(set! (-> v1-11 ear) (the-as uint 3))
|
|
(set-vector! (-> v1-11 twist-max) 10922.667 12743.111 0.0 1.0)
|
|
(set! (-> v1-11 ignore-angle) 18204.445)
|
|
)
|
|
(new-source! (-> this los) this (seconds 0.2) (collide-spec backgnd obstacle))
|
|
(set! (-> this can-take-damage?) #f)
|
|
(let ((v1-15 (-> this nav)))
|
|
(set! (-> v1-15 speed-scale) 1.0)
|
|
)
|
|
0
|
|
(set-gravity-length (-> this root dynam) 327680.0)
|
|
(set! (-> this joint-enable) #f)
|
|
(set! (-> this joint) (new 'process 'joint-mod (joint-mod-mode joint-set*) this 4))
|
|
(add-connection
|
|
*part-engine*
|
|
this
|
|
8
|
|
this
|
|
318
|
|
(new 'static 'vector :x 942.08 :y -163.84 :z 1392.64 :w 163840.0)
|
|
)
|
|
(add-connection
|
|
*part-engine*
|
|
this
|
|
8
|
|
this
|
|
318
|
|
(new 'static 'vector :x -942.08 :y -163.84 :z 1392.64 :w 163840.0)
|
|
)
|
|
(if (logtest? (-> this fact enemy-options) (enemy-option user0))
|
|
(set! (-> this hit-points) 1)
|
|
)
|
|
(logclear! (-> this nav flags) (nav-control-flag update-heading-from-facing))
|
|
(set! (-> this enemy-flags) (the-as enemy-flag (logclear (-> this enemy-flags) (enemy-flag enemy-flag43))))
|
|
(let ((s5-1 (-> this nav state))
|
|
(v1-36 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)))
|
|
)
|
|
(set! (-> s5-1 heading quad) (-> v1-36 quad))
|
|
)
|
|
0
|
|
(set! (-> this first-shoot?) #t)
|
|
0
|
|
(none)
|
|
)
|