mirror of
https://github.com/open-goal/jak-project
synced 2026-07-11 07:25:37 -04:00
1315 lines
46 KiB
Common Lisp
1315 lines
46 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: grenadier.gc
|
|
;; name in dgo: grenadier
|
|
;; dgos: DG1, D3A, UNB, RUI
|
|
|
|
(defenum grenadier-flags
|
|
:bitfield #t
|
|
(grflags-0)
|
|
(grflags-1)
|
|
(grflags-2)
|
|
(grflags-3)
|
|
(grflags-4)
|
|
(grflags-5)
|
|
(grflags-6)
|
|
(grflags-7)
|
|
)
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
(defpartgroup group-grenadier-drip
|
|
:id 1150
|
|
:duration (seconds 0.5)
|
|
:flags (use-local-clock)
|
|
:bounds (static-bspherem 0 0 0 2)
|
|
:parts ((sp-item 4985 :fade-after (meters 140) :falloff-to (meters 140)))
|
|
)
|
|
|
|
(defpart 1309
|
|
:init-specs ((:texture (grenadier-grenade-part ruins-sprite))
|
|
(:num 1.0 1.0)
|
|
(:scale-x (meters 0.6) (meters 0.2))
|
|
(:scale-y (meters 0.4) (meters 0.1))
|
|
(:r 255.0)
|
|
(:g 255.0)
|
|
(:b 255.0)
|
|
(:a 64.0 32.0)
|
|
(:scalevel-x (meters -0.0026666666) (meters -0.0026666666))
|
|
(:scalevel-y :copy scalevel-x)
|
|
(:fade-r -0.73333335)
|
|
(:fade-g -3.4)
|
|
(:fade-b -0.73333335)
|
|
(:accel-y (meters -0.00033333333) (meters -0.001))
|
|
(:timer (seconds 1))
|
|
(:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-14))
|
|
(:next-time (seconds 0.25))
|
|
(:next-launcher 640)
|
|
(:conerot-x (degrees 0) (degrees 360))
|
|
(:conerot-y (degrees 0) (degrees 360))
|
|
(:conerot-radius (meters 0) (meters 0.35))
|
|
)
|
|
)
|
|
|
|
(defskelgroup skel-grenadier grenadier grenadier-lod0-jg -1
|
|
((grenadier-lod0-mg (meters 20)) (grenadier-lod1-mg (meters 40)) (grenadier-lod2-mg (meters 999999)))
|
|
:bounds (static-spherem 0 0 0 5)
|
|
:shadow grenadier-shadow-mg
|
|
:origin-joint-index 4
|
|
)
|
|
|
|
(deftype bank-info (structure)
|
|
((circle sphere :inline)
|
|
(tangent-pos vector :inline)
|
|
(final-pos vector :inline)
|
|
(final-dir vector :inline)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype grenadier (nav-enemy)
|
|
((shot-trajectory trajectory :inline)
|
|
(hostile-path path-control)
|
|
(bank bank-info :inline)
|
|
(joint joint-mod-blend-world)
|
|
(heading symbol)
|
|
(move-pos vector :inline)
|
|
(move-angle float)
|
|
(status-flags grenadier-flags)
|
|
(suppress-knockaside-timer time-frame)
|
|
)
|
|
(:state-methods
|
|
attack
|
|
backup
|
|
spin-kick
|
|
)
|
|
(:methods
|
|
(grenadier-method-181 (_type_) none)
|
|
(grenadier-method-182 (_type_ vector) none)
|
|
(grenadier-method-183 (_type_) none)
|
|
)
|
|
)
|
|
|
|
|
|
(define *grenadier-nav-enemy-info*
|
|
(new 'static 'nav-enemy-info
|
|
:use-die-falling #t
|
|
:use-victory #t
|
|
:use-jump-blocked #t
|
|
: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 20
|
|
(new 'static 'idle-control-frame :command (ic-cmd push) :param0 #x27)
|
|
(new 'static 'idle-control-frame :command (ic-cmd play) :anim #x5 :param0 #x4 :param1 #x6)
|
|
(new 'static 'idle-control-frame :command (ic-cmd push) :param0 #x27)
|
|
(new 'static 'idle-control-frame :command (ic-cmd play) :anim #x7 :param0 #x1 :param1 #x1)
|
|
(new 'static 'idle-control-frame :command (ic-cmd play) :anim #x6 :param0 #x1 :param1 #x1)
|
|
(new 'static 'idle-control-frame :command (ic-cmd push) :param0 #x27)
|
|
(new 'static 'idle-control-frame :command (ic-cmd play) :anim #x5 :param0 #x4 :param1 #x6)
|
|
(new 'static 'idle-control-frame :command (ic-cmd play) :anim #x8 :param0 #x1 :param1 #x1)
|
|
(new 'static 'idle-control-frame :command (ic-cmd play) :anim #x7 :param0 #x1 :param1 #x1)
|
|
(new 'static 'idle-control-frame :command (ic-cmd play) :anim #x6 :param0 #x1 :param1 #x1)
|
|
(new 'static 'idle-control-frame :command (ic-cmd push) :param0 #x27)
|
|
(new 'static 'idle-control-frame :command (ic-cmd play) :anim #x5 :param0 #x4 :param1 #x8)
|
|
(new 'static 'idle-control-frame :command (ic-cmd push) :param0 #x27)
|
|
(new 'static 'idle-control-frame :command (ic-cmd play) :anim #x8 :param0 #x1 :param1 #x1)
|
|
(new 'static 'idle-control-frame :command (ic-cmd push) :param0 #x27)
|
|
(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)
|
|
(new 'static 'idle-control-frame)
|
|
)
|
|
:idle-anim 5
|
|
:notice-anim 11
|
|
:hostile-anim 13
|
|
:hit-anim 23
|
|
:knocked-anim 31
|
|
:knocked-land-anim 32
|
|
:die-anim 33
|
|
:die-falling-anim 34
|
|
:victory-anim 22
|
|
:jump-wind-up-anim -1
|
|
:jump-in-air-anim -1
|
|
:jump-land-anim -1
|
|
:neck-joint 24
|
|
:look-at-joint 24
|
|
:bullseye-joint 18
|
|
:sound-hit (static-sound-name "grenadier-hit")
|
|
:sound-die (static-sound-name "grenadier-die")
|
|
:notice-distance (meters 50)
|
|
:notice-distance-delta (meters 10)
|
|
:proximity-notice-distance (meters 12.5)
|
|
:default-hit-points 14
|
|
: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.8
|
|
: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 0.18204445
|
|
:knocked-soft-vxz-lo 72089.6
|
|
:knocked-soft-vxz-hi 108134.4
|
|
:knocked-soft-vy-lo 81920.0
|
|
:knocked-soft-vy-hi 122880.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 40960.0
|
|
:knocked-yellow-vxz-hi 49152.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 24576.0
|
|
:knocked-blue-vy-hi 81920.0
|
|
:shadow-size (meters 2)
|
|
:shadow-max-y (meters 1)
|
|
:shadow-min-y (meters -1)
|
|
:shadow-locus-dist (meters 150)
|
|
:gem-joint 24
|
|
:gem-seg #x2
|
|
:gem-no-seg #x4
|
|
:gem-offset (new 'static 'sphere :y 1802.24 :z 286.72 :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 13
|
|
:taunt-anim -1
|
|
:run-travel-speed (meters 12)
|
|
:run-acceleration (meters 1)
|
|
:run-turning-acceleration (meters 50)
|
|
:walk-travel-speed (meters 2)
|
|
:walk-acceleration (meters 1)
|
|
:walk-turning-acceleration (meters 3)
|
|
:maximum-rotation-rate (degrees 360)
|
|
:notice-nav-radius (meters 50)
|
|
: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! (-> *grenadier-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*)
|
|
|
|
(defmethod general-event-handler ((this grenadier) (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
|
|
(('hit-knocked)
|
|
(when (= (-> this incoming knocked-type) (knocked-type knocked-type-4))
|
|
(if (and (not (time-elapsed? (-> this suppress-knockaside-timer) (seconds 0.6)))
|
|
(and (-> this next-state) (= (-> this next-state name) 'attack))
|
|
(nonzero? (-> this hit-points))
|
|
)
|
|
(return #t)
|
|
)
|
|
(logior! (-> this status-flags) (grenadier-flags grflags-0))
|
|
(set-time! (-> this suppress-knockaside-timer))
|
|
)
|
|
((method-of-type nav-enemy general-event-handler) this arg0 arg1 arg2 arg3)
|
|
)
|
|
(('notify)
|
|
(cond
|
|
((and (= (-> arg3 param 0) 'attack) (= (-> arg3 param 1) *target*))
|
|
(let ((v1-23 (new 'stack-no-clear 'event-message-block)))
|
|
(set! (-> v1-23 from) (process->ppointer arg0))
|
|
(set! (-> v1-23 num-params) arg1)
|
|
(set! (-> v1-23 message) 'victory)
|
|
(set! (-> v1-23 param 0) (-> arg3 param 0))
|
|
(set! (-> v1-23 param 1) (-> arg3 param 1))
|
|
(set! (-> v1-23 param 2) (-> arg3 param 2))
|
|
(set! (-> v1-23 param 3) (-> arg3 param 3))
|
|
(set! (-> v1-23 param 4) (-> arg3 param 4))
|
|
(set! (-> v1-23 param 5) (-> arg3 param 5))
|
|
(send-event-function this v1-23)
|
|
)
|
|
)
|
|
(else
|
|
((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)
|
|
)
|
|
)
|
|
)
|
|
|
|
(defun pos-rotate-y<-vector+vector ((arg0 vector) (arg1 vector))
|
|
(let ((f0-0 (rotate-y<-vector+vector arg0 arg1)))
|
|
(if (< f0-0 0.0)
|
|
(+ 65536.0 f0-0)
|
|
f0-0
|
|
)
|
|
)
|
|
)
|
|
|
|
;; WARN: Return type mismatch vector vs none.
|
|
(defmethod grenadier-method-182 ((this grenadier) (arg0 vector))
|
|
(cloest-point-on-mesh (-> this nav) arg0 arg0 (the-as nav-poly #f))
|
|
(set! (-> this bank final-pos quad) (-> arg0 quad))
|
|
(set! (-> this bank tangent-pos quad) (-> arg0 quad))
|
|
(set! (-> this move-pos quad) (-> this bank tangent-pos quad))
|
|
(none)
|
|
)
|
|
|
|
(defmethod grenadier-method-181 ((this grenadier))
|
|
(let ((s5-0 (handle->process (-> this focus handle))))
|
|
(when s5-0
|
|
(cond
|
|
((-> this hostile-path)
|
|
(let* ((s4-0 (-> this hostile-path))
|
|
(f30-0 (get-path-percentage-at-furthest-point s4-0 (get-trans (the-as process-focusable s5-0) 0)))
|
|
(s3-1 (new 'stack-no-clear 'vector))
|
|
)
|
|
(set! (-> this heading) (not (-> this heading)))
|
|
(let* ((f0-0 (rand-vu-float-range 0.2 0.45))
|
|
(f0-1 (if (-> this heading)
|
|
(+ f30-0 f0-0)
|
|
(- f30-0 f0-0)
|
|
)
|
|
)
|
|
)
|
|
(if (< f0-1 0.0)
|
|
(set! f0-1 (+ 1.0 f0-1))
|
|
)
|
|
(if (< 1.0 f0-1)
|
|
(set! f0-1 (+ -1.0 f0-1))
|
|
)
|
|
(get-point-at-percent-along-path! s4-0 s3-1 f0-1 'interp)
|
|
)
|
|
(grenadier-method-182 this s3-1)
|
|
)
|
|
)
|
|
(else
|
|
(let* ((s4-1 (-> this root))
|
|
(a0-10 (get-trans (the-as process-focusable s5-0) 0))
|
|
(v1-27 (vector-! (new 'stack-no-clear 'vector) a0-10 (-> s4-1 trans)))
|
|
)
|
|
(vector-length v1-27)
|
|
(let ((s3-2 (new 'stack-no-clear 'vector))
|
|
(s2-1 (new 'stack-no-clear 'vector))
|
|
)
|
|
(set! (-> this heading) (not (-> this heading)))
|
|
(if (-> this heading)
|
|
(set-vector! s3-2 (-> v1-27 z) (-> v1-27 y) (- (-> v1-27 x)) 1.0)
|
|
(set-vector! s3-2 (- (-> v1-27 z)) (-> v1-27 y) (-> v1-27 x) 1.0)
|
|
)
|
|
(vector-normalize! s3-2 (* 4096.0 (rand-vu-float-range 14.0 18.0)))
|
|
(grenadier-method-182 this (vector+! s2-1 (-> s4-1 trans) s3-2))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defstate active (grenadier)
|
|
:virtual #t
|
|
:code (behavior ()
|
|
(ja-channel-push! 1 (seconds 0.2))
|
|
(let* ((f30-0 (rnd-float-range self 0.9 1.1))
|
|
(a0-2 '((grenadier-patrol-ja) (grenadier-patrol1-ja)))
|
|
(gp-0 ((method-of-type (rtype-of a0-2) length) a0-2))
|
|
(s5-0 (new 'static 'array int64 2 9 10))
|
|
(s4-0 (-> (the-as (pointer int32) (+ (* (rnd-int-count self gp-0) 8) (the-as int s5-0)))))
|
|
)
|
|
(until #f
|
|
(ja-no-eval :group! (-> self draw art-group data s4-0) :num! (seek! max f30-0) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek! max f30-0))
|
|
)
|
|
(when (rnd-go-idle? self 0.2)
|
|
(ja-no-eval :num! (loop!))
|
|
(ja-channel-push! 1 (seconds 0.6))
|
|
(let ((v1-38 self))
|
|
(set! (-> v1-38 enemy-flags) (the-as enemy-flag (logclear (-> v1-38 enemy-flags) (enemy-flag enemy-flag36))))
|
|
(set! (-> v1-38 nav callback-info) *nav-enemy-null-callback-info*)
|
|
)
|
|
0
|
|
(ja-no-eval :group! (-> self draw art-group data (-> self enemy-info idle-anim))
|
|
:num! (seek! max f30-0)
|
|
:frame-num 0.0
|
|
)
|
|
(until (ja-done? 0)
|
|
(ja-blend-eval)
|
|
(suspend)
|
|
(ja :num! (seek! max f30-0))
|
|
)
|
|
(until (not (rnd-go-idle? self 0.2))
|
|
(ja-no-eval :group! (-> self draw art-group data (-> self enemy-info idle-anim))
|
|
:num! (seek! max f30-0)
|
|
:frame-num 0.0
|
|
)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek! max f30-0))
|
|
)
|
|
)
|
|
(let ((v1-100 self))
|
|
(if (not (logtest? (enemy-flag enemy-flag36) (-> v1-100 enemy-flags)))
|
|
(set! (-> v1-100 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-100 enemy-flags))))
|
|
)
|
|
(set! (-> v1-100 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag36) (-> v1-100 enemy-flags))))
|
|
(set! (-> v1-100 nav callback-info) (-> v1-100 enemy-info callback-info))
|
|
)
|
|
0
|
|
(ja-no-eval :num! (loop!))
|
|
(set! s4-0 (-> (the-as (pointer int32) (+ (* (rnd-int-count self gp-0) 8) (the-as int s5-0)))))
|
|
(ja-channel-push! 1 (seconds 0.6))
|
|
(ja-no-eval :group! (-> self draw art-group data s4-0) :num! (seek! max f30-0) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(ja-blend-eval)
|
|
(suspend)
|
|
(ja :num! (seek! max f30-0))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
#f
|
|
)
|
|
)
|
|
|
|
(defstate notice (grenadier)
|
|
:virtual #t
|
|
:enter (behavior ()
|
|
(let ((t9-0 (-> (method-of-type nav-enemy notice) enter)))
|
|
(if t9-0
|
|
(t9-0)
|
|
)
|
|
)
|
|
(vector-reset! (-> self root transv))
|
|
)
|
|
)
|
|
|
|
(defstate hostile (grenadier)
|
|
:virtual #t
|
|
:enter (behavior ()
|
|
(let ((t9-0 (-> (method-of-type nav-enemy hostile) enter)))
|
|
(if t9-0
|
|
(t9-0)
|
|
)
|
|
)
|
|
(grenadier-method-181 self)
|
|
(look-at-target! self (enemy-flag look-at-move-dest))
|
|
(logclear! (-> self status-flags) (grenadier-flags grflags-0))
|
|
)
|
|
:trans (behavior ()
|
|
(let ((t9-0 (-> (method-of-type nav-enemy hostile) trans)))
|
|
(if t9-0
|
|
(t9-0)
|
|
)
|
|
)
|
|
(let ((a0-1 (handle->process (-> self focus handle))))
|
|
(when a0-1
|
|
(let* ((s5-0 (get-trans (the-as process-focusable a0-1) 0))
|
|
(gp-0 (-> self root trans))
|
|
(f30-0 (vector-vector-distance gp-0 s5-0))
|
|
)
|
|
(cond
|
|
((and (< f30-0 12288.0) (get-enemy-target self))
|
|
(go-virtual spin-kick)
|
|
)
|
|
((< f30-0 40960.0)
|
|
(let ((s3-1 (vector-! (new 'stack-no-clear 'vector) gp-0 s5-0))
|
|
(s4-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
(set! (-> s4-0 quad) (-> self root trans quad))
|
|
(new 'stack-no-clear 'vector)
|
|
(vector-normalize! s3-1 49152.0)
|
|
(cloest-point-on-mesh (-> self nav) s4-0 (vector+! s4-0 s5-0 s3-1) (the-as nav-poly #f))
|
|
(when (< 32768.0 (vector-vector-distance gp-0 s4-0))
|
|
(set! (-> self move-pos quad) (-> s4-0 quad))
|
|
(let ((a0-11 (-> self nav state))
|
|
(v1-32 (-> self move-pos))
|
|
)
|
|
(logclear! (-> a0-11 flags) (nav-state-flag directional-mode))
|
|
(logior! (-> a0-11 flags) (nav-state-flag target-poly-dirty))
|
|
(set! (-> a0-11 target-post quad) (-> v1-32 quad))
|
|
)
|
|
0
|
|
(go-virtual backup)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(when (or (time-elapsed? (-> self state-time) (rand-vu-int-range (seconds 3) (seconds 9)))
|
|
(>= 8192.0 (vector-vector-xz-distance (-> self root trans) (-> self bank final-pos)))
|
|
)
|
|
(if (and (handle->process (-> self focus handle))
|
|
(not (logtest? (-> (the-as process-focusable (handle->process (-> self focus handle))) focus-status)
|
|
(focus-status disable dead ignore grabbed)
|
|
)
|
|
)
|
|
)
|
|
(go-virtual attack)
|
|
(go-stare self)
|
|
)
|
|
)
|
|
)
|
|
:code (behavior ()
|
|
(ja-channel-push! 1 (seconds 0.1))
|
|
(let* ((a0-1 '((grenadier-run-ja) (grenadier-run1-ja)))
|
|
(a1-3 ((method-of-type (rtype-of a0-1) length) a0-1))
|
|
(gp-0 (new 'static 'array int64 2 13 14))
|
|
(gp-1 (-> self
|
|
draw
|
|
art-group
|
|
data
|
|
(-> (the-as (pointer int32) (+ (* (rnd-int-count self a1-3) 8) (the-as int gp-0))))
|
|
)
|
|
)
|
|
(f30-0 (rnd-float-range self 0.9 1.1))
|
|
)
|
|
(until #f
|
|
(ja-no-eval :group! gp-1 :num! (seek! max f30-0) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek! max f30-0))
|
|
)
|
|
)
|
|
)
|
|
#f
|
|
)
|
|
:post (behavior ()
|
|
(let ((gp-0 (-> self bank)))
|
|
(if (< (vector-vector-xz-distance (-> self root trans) (-> gp-0 tangent-pos)) 9830.4)
|
|
(set! (-> self move-pos quad) (-> gp-0 final-pos quad))
|
|
)
|
|
)
|
|
(let ((a0-3 (-> self nav state))
|
|
(v1-5 (-> self move-pos))
|
|
)
|
|
(logclear! (-> a0-3 flags) (nav-state-flag directional-mode))
|
|
(logior! (-> a0-3 flags) (nav-state-flag target-poly-dirty))
|
|
(set! (-> a0-3 target-post quad) (-> v1-5 quad))
|
|
)
|
|
0
|
|
(nav-enemy-travel-post)
|
|
)
|
|
)
|
|
|
|
(defstate backup (grenadier)
|
|
:virtual #t
|
|
:event enemy-event-handler
|
|
:enter (behavior ()
|
|
(set-time! (-> self state-time))
|
|
(let ((v1-2 self))
|
|
(if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags)))
|
|
(set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags))))
|
|
)
|
|
(set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))))
|
|
(set! (-> v1-2 nav callback-info) (-> v1-2 enemy-info callback-info))
|
|
)
|
|
0
|
|
)
|
|
:trans (behavior ()
|
|
(let ((f0-0 (vector-vector-xz-distance (-> self root trans) (-> self move-pos))))
|
|
(if (or (>= 12288.0 f0-0) (time-elapsed? (-> self state-time) (seconds 6)))
|
|
(go-hostile self)
|
|
)
|
|
)
|
|
)
|
|
:code (behavior ()
|
|
(until #f
|
|
(ja-no-eval :group! grenadier-run-ja :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
)
|
|
#f
|
|
)
|
|
:post (behavior ()
|
|
(let ((a0-0 (-> self nav state))
|
|
(v1-1 (-> self move-pos))
|
|
)
|
|
(logclear! (-> a0-0 flags) (nav-state-flag directional-mode))
|
|
(logior! (-> a0-0 flags) (nav-state-flag target-poly-dirty))
|
|
(set! (-> a0-0 target-post quad) (-> v1-1 quad))
|
|
)
|
|
0
|
|
(nav-enemy-travel-post)
|
|
)
|
|
)
|
|
|
|
(defstate spin-kick (grenadier)
|
|
:virtual #t
|
|
:event enemy-event-handler
|
|
:enter (behavior ()
|
|
(set-time! (-> self state-time))
|
|
(let ((v1-2 self))
|
|
(set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36))))
|
|
(set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*)
|
|
)
|
|
0
|
|
(let ((v1-5 self))
|
|
(set! (-> v1-5 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-5 enemy-flags))))
|
|
)
|
|
0
|
|
(logior! (-> self focus-status) (focus-status dangerous))
|
|
(let* ((v1-9 *game-info*)
|
|
(a0-7 (+ (-> v1-9 attack-id) 1))
|
|
)
|
|
(set! (-> v1-9 attack-id) a0-7)
|
|
(set! (-> self attack-id) a0-7)
|
|
)
|
|
(let ((v1-13 (-> (the-as collide-shape-prim-group (-> self root root-prim)) child 1)))
|
|
(set! (-> v1-13 prim-core action) (collide-action deadly))
|
|
(set! (-> v1-13 local-sphere w) 7372.8)
|
|
)
|
|
)
|
|
:exit (behavior ()
|
|
(let ((v1-3 (-> (the-as collide-shape-prim-group (-> self root root-prim)) child 1)))
|
|
(set! (-> v1-3 prim-core action) (collide-action))
|
|
(set! (-> v1-3 local-sphere w) 4096.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.135))
|
|
(ja-no-eval :group! grenadier-spin-kick-ja :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
(go-hostile self)
|
|
)
|
|
:post (behavior ()
|
|
(let ((a0-0 self))
|
|
(when (logtest? (enemy-flag enemy-flag37) (-> a0-0 enemy-flags))
|
|
(let ((a0-4 (handle->process (-> self focus handle))))
|
|
(if a0-4
|
|
(seek-to-point-toward-point!
|
|
(-> self root)
|
|
(get-trans (the-as process-focusable a0-4) 0)
|
|
(-> self nav max-rotation-rate)
|
|
(seconds 0.02)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(nav-enemy-simple-post)
|
|
)
|
|
)
|
|
|
|
;; ERROR: function was not converted to expressions. Cannot decompile.
|
|
|
|
(defmethod enemy-method-78 ((this grenadier) (arg0 enemy-knocked-info))
|
|
(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 30)))
|
|
(ja-channel-push! 1 (seconds 0.067))
|
|
(let ((a0-3 (-> this skel root-channel 0)))
|
|
(set! (-> a0-3 frame-group) (the-as art-joint-anim s4-0))
|
|
(set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1)))
|
|
(set! (-> a0-3 param 1) (-> arg0 anim-speed))
|
|
(set! (-> a0-3 frame-num) 0.0)
|
|
(joint-control-channel-group! a0-3 (the-as art-joint-anim s4-0) num-func-seek!)
|
|
)
|
|
)
|
|
)
|
|
#t
|
|
)
|
|
((or (= (-> this incoming knocked-type) (knocked-type knocked-type-4)) (zero? (-> this incoming knocked-type)))
|
|
#f
|
|
)
|
|
((> (-> this hit-points) 0)
|
|
(ja-channel-push! 1 (seconds 0.067))
|
|
(let ((a1-4 (-> this draw art-group data (-> this enemy-info knocked-land-anim)))
|
|
(a0-9 (-> this skel root-channel 0))
|
|
)
|
|
(set! (-> a0-9 frame-group) (the-as art-joint-anim a1-4))
|
|
(set! (-> a0-9 param 0) (the float (+ (-> (the-as art-joint-anim a1-4) frames num-frames) -1)))
|
|
(set! (-> a0-9 param 1) (-> arg0 anim-speed))
|
|
(set! (-> a0-9 frame-num) 0.0)
|
|
(joint-control-channel-group! a0-9 (the-as art-joint-anim a1-4) num-func-seek!)
|
|
)
|
|
#t
|
|
)
|
|
(else
|
|
(ja-channel-push! 1 (seconds 0.067))
|
|
(let ((a0-11 (-> this skel root-channel 0)))
|
|
(set! (-> a0-11 frame-group) (the-as art-joint-anim (-> this draw art-group data 33)))
|
|
(set! (-> a0-11 param 0)
|
|
(the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 33)) frames num-frames) -1))
|
|
)
|
|
(set! (-> a0-11 param 1) (-> arg0 anim-speed))
|
|
(set! (-> a0-11 frame-num) 0.0)
|
|
(joint-control-channel-group! a0-11 (the-as art-joint-anim (-> this draw art-group data 33)) num-func-seek!)
|
|
)
|
|
#t
|
|
)
|
|
)
|
|
)
|
|
|
|
(defstate attack (grenadier)
|
|
:virtual #t
|
|
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
|
(case message
|
|
(('event-attack)
|
|
(let ((s4-0 (handle->process (-> self focus handle))))
|
|
(when s4-0
|
|
(let ((gp-0 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node grenadier-lod0-jg bomb))))
|
|
(let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable s4-0) 0) gp-0)))
|
|
(let ((s4-1 (new 'stack-no-clear 'vector)))
|
|
(let ((f0-0 (vector-length s5-1)))
|
|
0.0
|
|
(let ((f0-1 (fmin 245760.0 f0-0)))
|
|
(vector-normalize! s5-1 f0-1)
|
|
)
|
|
)
|
|
(vector+! s4-1 gp-0 s5-1)
|
|
(let ((f0-2 122880.0))
|
|
(setup-from-to-xz-vel! (-> self shot-trajectory) gp-0 s4-1 f0-2 -102400.0)
|
|
)
|
|
)
|
|
(set! (-> s5-1 quad) (-> self shot-trajectory initial-velocity quad))
|
|
(vector-normalize! s5-1 1638.4)
|
|
(vector+! gp-0 gp-0 s5-1)
|
|
)
|
|
(let ((a1-9 (new 'stack-no-clear 'projectile-init-by-other-params)))
|
|
(set! (-> a1-9 ent) (-> self entity))
|
|
(set! (-> a1-9 charge) 1.0)
|
|
(set! (-> a1-9 options) (projectile-options))
|
|
(set! (-> a1-9 pos quad) (-> gp-0 quad))
|
|
(set! (-> a1-9 vel quad) (-> self shot-trajectory initial-velocity quad))
|
|
(set! (-> a1-9 notify-handle) (process->handle self))
|
|
(set! (-> a1-9 owner-handle) (the-as handle #f))
|
|
(set! (-> a1-9 ignore-handle) (process->handle self))
|
|
(let* ((v1-27 *game-info*)
|
|
(a0-27 (+ (-> v1-27 attack-id) 1))
|
|
)
|
|
(set! (-> v1-27 attack-id) a0-27)
|
|
(set! (-> a1-9 attack-id) a0-27)
|
|
)
|
|
(set! (-> a1-9 timeout) (seconds 4))
|
|
(spawn-projectile metalhead-grenade-shot a1-9 self *default-dead-pool*)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
(enemy-event-handler proc argc message block)
|
|
)
|
|
)
|
|
)
|
|
:enter (behavior ()
|
|
(let ((v1-1 (-> self nav state))
|
|
(a0-1 (-> self root trans))
|
|
)
|
|
(logclear! (-> v1-1 flags) (nav-state-flag directional-mode))
|
|
(logior! (-> v1-1 flags) (nav-state-flag target-poly-dirty))
|
|
(set! (-> v1-1 target-post quad) (-> a0-1 quad))
|
|
)
|
|
0
|
|
(let ((v1-4 self))
|
|
(if (not (logtest? (enemy-flag enemy-flag36) (-> v1-4 enemy-flags)))
|
|
(set! (-> v1-4 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-4 enemy-flags))))
|
|
)
|
|
(set! (-> v1-4 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag36) (-> v1-4 enemy-flags))))
|
|
(set! (-> v1-4 nav callback-info) (-> v1-4 enemy-info callback-info))
|
|
)
|
|
0
|
|
(let ((v1-7 self))
|
|
(set! (-> v1-7 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-7 enemy-flags))))
|
|
)
|
|
0
|
|
(logior! (-> self focus-status) (focus-status dangerous))
|
|
(let* ((v1-11 *game-info*)
|
|
(a0-19 (+ (-> v1-11 attack-id) 1))
|
|
)
|
|
(set! (-> v1-11 attack-id) a0-19)
|
|
(set! (-> self attack-id) a0-19)
|
|
)
|
|
(look-at-target! self (enemy-flag look-at-focus))
|
|
)
|
|
:exit (behavior ()
|
|
(if (logtest? (enemy-flag enemy-flag43) (-> self enemy-flags))
|
|
(logior! (-> self nav flags) (nav-control-flag update-heading-from-facing))
|
|
(logclear! (-> self nav flags) (nav-control-flag update-heading-from-facing))
|
|
)
|
|
(logclear! (-> self status-flags) (grenadier-flags grflags-1))
|
|
(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 (rnd-float-range self 0.9 1.1)))
|
|
(let ((f28-0 (vector-length (-> self root transv))))
|
|
(ja-channel-push! 1 (seconds 0.2))
|
|
(when (< 4096.0 f28-0)
|
|
(let* ((v1-8 (vector-float*! (new 'stack-no-clear 'vector) (-> self root transv) 0.3))
|
|
(a2-2 (vector+! (new 'stack-no-clear 'vector) (-> self root trans) v1-8))
|
|
)
|
|
(set! (-> self move-pos quad) (-> self root trans quad))
|
|
(cloest-point-on-mesh (-> self nav) (-> self move-pos) a2-2 (the-as nav-poly #f))
|
|
)
|
|
(let ((a0-10 (-> self nav state))
|
|
(v1-13 (-> self move-pos))
|
|
)
|
|
(logclear! (-> a0-10 flags) (nav-state-flag directional-mode))
|
|
(logior! (-> a0-10 flags) (nav-state-flag target-poly-dirty))
|
|
(set! (-> a0-10 target-post quad) (-> v1-13 quad))
|
|
)
|
|
0
|
|
(logclear! (-> self nav flags) (nav-control-flag update-heading-from-facing))
|
|
(logior! (-> self status-flags) (grenadier-flags grflags-1))
|
|
(ja-no-eval :group! grenadier-run-to-throw-ja :num! (seek! max f30-0) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek! max f30-0))
|
|
)
|
|
(ja-channel-push! 1 (seconds 0.067))
|
|
(logclear! (-> self status-flags) (grenadier-flags grflags-1))
|
|
(if (logtest? (enemy-flag enemy-flag43) (-> self enemy-flags))
|
|
(logior! (-> self nav flags) (nav-control-flag update-heading-from-facing))
|
|
(logclear! (-> self nav flags) (nav-control-flag update-heading-from-facing))
|
|
)
|
|
)
|
|
)
|
|
(let ((v1-52 self))
|
|
(set! (-> v1-52 enemy-flags) (the-as enemy-flag (logclear (-> v1-52 enemy-flags) (enemy-flag enemy-flag36))))
|
|
(set! (-> v1-52 nav callback-info) *nav-enemy-null-callback-info*)
|
|
)
|
|
0
|
|
(cond
|
|
((logtest? (-> self status-flags) (grenadier-flags grflags-0))
|
|
(ja-channel-push! 1 (seconds 0.135))
|
|
(ja-no-eval :group! grenadier-throw-quick-ja :num! (seek! max f30-0) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek! max f30-0))
|
|
)
|
|
(logclear! (-> self status-flags) (grenadier-flags grflags-0))
|
|
)
|
|
(else
|
|
(when (not (enemy-method-96 self 1820.4445 #t))
|
|
(let ((v1-84 self))
|
|
(set! (-> v1-84 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-84 enemy-flags))))
|
|
)
|
|
0
|
|
(ja-channel-push! 1 (seconds 0.2))
|
|
(ja :group! grenadier-throw-turn-in-place-ja)
|
|
(ja :num-func num-func-identity :frame-num 0.0)
|
|
(until (enemy-method-96 self 910.2222 #t)
|
|
(ja-blend-eval)
|
|
(suspend)
|
|
(ja :num! (loop! 0.75))
|
|
)
|
|
(let ((v1-100 self))
|
|
(set! (-> v1-100 enemy-flags)
|
|
(the-as enemy-flag (logclear (-> v1-100 enemy-flags) (enemy-flag enemy-flag37)))
|
|
)
|
|
)
|
|
0
|
|
)
|
|
(let ((v1-102 self))
|
|
(set! (-> v1-102 enemy-flags)
|
|
(the-as enemy-flag (logclear (-> v1-102 enemy-flags) (enemy-flag enemy-flag37)))
|
|
)
|
|
)
|
|
0
|
|
(ja-channel-push! 1 (seconds 0.067))
|
|
(let ((a0-50 (handle->process (-> self focus handle))))
|
|
(when a0-50
|
|
(let ((f0-14 (vector-vector-distance (-> self root trans) (get-trans (the-as process-focusable a0-50) 0))))
|
|
(cond
|
|
((< 102400.0 f0-14)
|
|
(ja-no-eval :group! grenadier-throw-ja :num! (seek! max f30-0) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek! max f30-0))
|
|
)
|
|
)
|
|
(else
|
|
(ja-no-eval :group! grenadier-throw1-ja :num! (seek! max f30-0) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek! max f30-0))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(go-hostile self)
|
|
)
|
|
:post (behavior ()
|
|
(let ((a0-0 self))
|
|
(when (logtest? (enemy-flag enemy-flag37) (-> a0-0 enemy-flags))
|
|
(let ((a0-4 (handle->process (-> self focus handle))))
|
|
(if a0-4
|
|
(seek-to-point-toward-point!
|
|
(-> self root)
|
|
(get-trans (the-as process-focusable a0-4) 0)
|
|
(-> self nav max-rotation-rate)
|
|
(seconds 0.02)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(nav-enemy-travel-post)
|
|
)
|
|
)
|
|
|
|
(defstate hit (grenadier)
|
|
:virtual #t
|
|
:code (behavior ()
|
|
(local-vars (v1-10 int) (v1-44 enemy-flag) (v1-52 enemy-flag))
|
|
(let ((gp-0 (enemy-method-50 self (new 'stack-no-clear 'vector))))
|
|
0
|
|
(add-debug-vector
|
|
#t
|
|
(bucket-id debug-no-zbuf1)
|
|
(-> self root trans)
|
|
gp-0
|
|
(meters 6)
|
|
(new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80)
|
|
)
|
|
(add-debug-quaternion #t (bucket-id debug-no-zbuf1) (-> self root trans) (-> self root quat))
|
|
(let ((f0-0 (quaternion-vector-y-angle (-> self root quat) gp-0)))
|
|
(cond
|
|
((and (< -8192.0 f0-0) (>= 8192.0 f0-0))
|
|
(set! v1-10 26)
|
|
)
|
|
((and (< 8192.0 f0-0) (>= 24576.0 f0-0))
|
|
(set! v1-10 24)
|
|
)
|
|
((and (< -24576.0 f0-0) (>= -8192.0 f0-0))
|
|
(set! v1-10 25)
|
|
)
|
|
(else
|
|
(set! v1-10 23)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(let ((gp-1 (-> self draw art-group data v1-10)))
|
|
(ja-channel-push! 1 (seconds 0.1))
|
|
(ja-no-eval :group! gp-1 :num! (seek!) :frame-num 0.0)
|
|
)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
(if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup))
|
|
(logior! (-> self focus-status) (focus-status dangerous))
|
|
(logclear! (-> self focus-status) (focus-status dangerous))
|
|
)
|
|
(let ((v1-43 (-> self enemy-flags)))
|
|
(if (logtest? v1-43 (enemy-flag vulnerable-backup))
|
|
(set! v1-44 (logior v1-43 (enemy-flag vulnerable)))
|
|
(set! v1-44 (logclear v1-43 (enemy-flag vulnerable)))
|
|
)
|
|
)
|
|
(set! (-> self enemy-flags) v1-44)
|
|
(if (logtest? (-> self enemy-flags) (enemy-flag attackable-backup))
|
|
(logior! (-> self mask) (process-mask collectable))
|
|
(logclear! (-> self mask) (process-mask collectable))
|
|
)
|
|
(let ((v1-51 (-> self enemy-flags)))
|
|
(if (logtest? (enemy-flag trackable-backup) v1-51)
|
|
(set! v1-52 (logior (enemy-flag trackable) v1-51))
|
|
(set! v1-52 (logclear v1-51 (enemy-flag trackable)))
|
|
)
|
|
)
|
|
(set! (-> self enemy-flags) v1-52)
|
|
(logclear! (-> self enemy-flags) (enemy-flag lock-focus))
|
|
(logclear! (-> self focus-status) (focus-status hit))
|
|
(cond
|
|
((= (-> self focus aware) (enemy-aware enemy-aware-3))
|
|
(if (and (handle->process (-> self focus handle))
|
|
(not (logtest? (-> (the-as process-focusable (handle->process (-> self focus handle))) focus-status)
|
|
(focus-status disable dead ignore grabbed)
|
|
)
|
|
)
|
|
)
|
|
(go-virtual attack)
|
|
)
|
|
(go-hostile self)
|
|
)
|
|
(else
|
|
(go-stare self)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
(defmethod go-hostile ((this grenadier))
|
|
(if (and (and (-> this next-state) (= (-> this next-state name) 'knocked))
|
|
(and (logtest? (-> this status-flags) (grenadier-flags grflags-0))
|
|
(handle->process (-> this focus handle))
|
|
(not (logtest? (-> (the-as process-focusable (handle->process (-> this focus handle))) focus-status)
|
|
(focus-status disable dead ignore grabbed)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(go (method-of-object this attack))
|
|
)
|
|
((method-of-type nav-enemy go-hostile) this)
|
|
)
|
|
|
|
(defstate victory (grenadier)
|
|
:virtual #t
|
|
:code (behavior ()
|
|
(ja-channel-push! 1 (seconds 0.1))
|
|
(let ((f30-0 (rnd-float-range self 0.8 1.2)))
|
|
(cond
|
|
((zero? (rand-vu-int-range 0 1))
|
|
(ja-no-eval :group! grenadier-victory-ja :num! (seek! max f30-0) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek! max f30-0))
|
|
)
|
|
)
|
|
(else
|
|
(ja-no-eval :group! grenadier-notice-ja :num! (seek! max f30-0) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek! max f30-0))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(react-to-focus self)
|
|
)
|
|
)
|
|
|
|
(defmethod nav-enemy-method-142 ((this grenadier) (arg0 nav-control))
|
|
(local-vars (a0-4 int) (a0-6 int))
|
|
(b! (logtest? (-> this status-flags) (grenadier-flags grflags-1)) cfg-6 :delay (empty-form))
|
|
(let ((v1-3 (new 'stack-no-clear 'vector))
|
|
(a2-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
(vector-reset! a2-0)
|
|
(set! (-> a2-0 y) 1.0)
|
|
(let ((t0-0 (-> arg0 state)))
|
|
(set! (-> v1-3 quad) (-> t0-0 heading quad))
|
|
)
|
|
(let* ((a1-3 (-> *perf-stats* data 33))
|
|
(a3-3 (-> a1-3 ctrl))
|
|
)
|
|
(+! (-> a1-3 count) 1)
|
|
(b! (zero? a3-3) cfg-3 :delay (nop!))
|
|
(.mtc0 Perf 0)
|
|
(.sync.l)
|
|
(.sync.p)
|
|
(.mtpc pcr0 0)
|
|
(.mtpc pcr1 0)
|
|
(.sync.l)
|
|
(.sync.p)
|
|
(.mtc0 Perf a3-3)
|
|
)
|
|
(.sync.l)
|
|
(.sync.p)
|
|
(label cfg-3)
|
|
0
|
|
(forward-up-nopitch->quaternion (-> this root quat) v1-3 a2-0)
|
|
)
|
|
(let ((v1-5 (-> *perf-stats* data 33)))
|
|
(b! (zero? (-> v1-5 ctrl)) cfg-5 :delay (nop!))
|
|
(.mtc0 Perf 0)
|
|
(.sync.l)
|
|
(.sync.p)
|
|
(.mfpc a0-4 pcr0)
|
|
(+! (-> v1-5 accum0) a0-4)
|
|
(.mfpc a0-6 pcr1)
|
|
(+! (-> v1-5 accum1) a0-6)
|
|
)
|
|
(label cfg-5)
|
|
0
|
|
(label cfg-6)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod common-post ((this grenadier))
|
|
"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"
|
|
(let ((t9-0 (method-of-type nav-enemy common-post)))
|
|
(t9-0 this)
|
|
)
|
|
(let ((a1-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data 34))))
|
|
(spawn (-> this part) a1-1)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
(defmethod init-enemy-collision! ((this grenadier))
|
|
"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
|
|
generic-attack
|
|
lunge
|
|
flop
|
|
punch
|
|
spin
|
|
roll
|
|
uppercut
|
|
bonk
|
|
tube
|
|
vehicle
|
|
flut-attack
|
|
board
|
|
mech-punch
|
|
dark-punch
|
|
dark-giant
|
|
)
|
|
)
|
|
(let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 6) 0)))
|
|
(set! (-> s5-0 total-prims) (the-as uint 7))
|
|
(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 no-standon))
|
|
(set-vector! (-> s4-0 local-sphere) 0.0 12288.0 0.0 22528.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 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 6553.6 0.0 6553.6)
|
|
)
|
|
(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))
|
|
(set! (-> v1-15 transform-index) 31)
|
|
(set-vector! (-> v1-15 local-sphere) 0.0 0.0 0.0 4096.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 deadly))
|
|
(set! (-> v1-17 transform-index) 34)
|
|
(set-vector! (-> v1-17 local-sphere) 0.0 0.0 0.0 4096.0)
|
|
)
|
|
(let ((v1-19 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
|
|
(set! (-> v1-19 prim-core collide-as) (collide-spec enemy))
|
|
(set! (-> v1-19 prim-core collide-with) (collide-spec jak bot player-list))
|
|
(set! (-> v1-19 prim-core action) (collide-action deadly))
|
|
(set! (-> v1-19 transform-index) 23)
|
|
(set-vector! (-> v1-19 local-sphere) 0.0 0.0 0.0 4096.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) 16)
|
|
(set-vector! (-> v1-21 local-sphere) 0.0 0.0 0.0 4096.0)
|
|
)
|
|
(let ((v1-23 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
|
|
(set! (-> v1-23 prim-core collide-with) (collide-spec backgnd obstacle hit-by-others-list))
|
|
(set! (-> v1-23 prim-core action) (collide-action solid))
|
|
(set-vector! (-> v1-23 local-sphere) 0.0 12288.0 0.0 12288.0)
|
|
)
|
|
(set! (-> s5-0 nav-radius) 8192.0)
|
|
(let ((v1-25 (-> s5-0 root-prim)))
|
|
(set! (-> s5-0 backup-collide-as) (-> v1-25 prim-core collide-as))
|
|
(set! (-> s5-0 backup-collide-with) (-> v1-25 prim-core collide-with))
|
|
)
|
|
(set! (-> s5-0 max-iteration-count) (the-as uint 3))
|
|
(set! (-> this root) s5-0)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod relocate ((this grenadier) (offset int))
|
|
(if (nonzero? (-> this joint))
|
|
(&+! (-> this joint) offset)
|
|
)
|
|
(when (-> this hostile-path)
|
|
(if (nonzero? (-> this hostile-path))
|
|
(&+! (-> this hostile-path) offset)
|
|
)
|
|
)
|
|
(call-parent-method this offset)
|
|
)
|
|
|
|
(defmethod init-enemy! ((this grenadier))
|
|
"Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods"
|
|
(initialize-skeleton
|
|
this
|
|
(the-as skeleton-group (art-group-get-by-name *level* "skel-grenadier" (the-as (pointer uint32) #f)))
|
|
(the-as pair 0)
|
|
)
|
|
(init-enemy-behaviour-and-stats! this *grenadier-nav-enemy-info*)
|
|
(let ((v1-5 (-> this neck)))
|
|
(when v1-5
|
|
(set! (-> v1-5 up) (the-as uint 1))
|
|
(set! (-> v1-5 nose) (the-as uint 2))
|
|
(set! (-> v1-5 ear) (the-as uint 0))
|
|
(set-vector! (-> v1-5 twist-max) 11832.889 11832.889 0.0 1.0)
|
|
(set! (-> v1-5 ignore-angle) 30947.555)
|
|
)
|
|
)
|
|
(let ((v1-6 (-> this nav)))
|
|
(set! (-> v1-6 speed-scale) 1.0)
|
|
)
|
|
0
|
|
(set-gravity-length (-> this root dynam) 573440.0)
|
|
(set! (-> this heading) (if (rand-vu-percent? 0.5)
|
|
#t
|
|
#f
|
|
)
|
|
)
|
|
(set! (-> this move-angle) 5461.3335)
|
|
(set! (-> this status-flags) (grenadier-flags))
|
|
(set! (-> this suppress-knockaside-timer) 0)
|
|
(set-vector! (-> this root scale) 1.5 1.5 1.5 1.0)
|
|
(set! (-> this joint) (new 'process 'joint-mod-blend-world this 17 #f 0.0))
|
|
(logior! (-> this joint blend-flags) (joint-mod-blend-flags rotation))
|
|
(set! (-> this part) (create-launch-control group-grenadier-drip this))
|
|
(set! (-> this hostile-path) (new 'process 'path-control this 'hostile 0.0 (-> this entity) #t))
|
|
(if (zero? (-> this hostile-path))
|
|
(set! (-> this hostile-path) #f)
|
|
)
|
|
(if (-> this hostile-path)
|
|
(logior! (-> this hostile-path flags) (path-control-flag display draw-line draw-point draw-text))
|
|
)
|
|
(add-connection
|
|
*part-engine*
|
|
this
|
|
24
|
|
this
|
|
318
|
|
(new 'static 'vector :x 532.48 :y -81.92 :z 1515.52 :w 163840.0)
|
|
)
|
|
(add-connection
|
|
*part-engine*
|
|
this
|
|
24
|
|
this
|
|
318
|
|
(new 'static 'vector :x -532.48 :y -81.92 :z 1515.52 :w 163840.0)
|
|
)
|
|
0
|
|
(none)
|
|
)
|