mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -04:00
fc43870d85
This renames the method object in `defmethod`s to `this` and adds detection for the `set-time!` and `time-elapsed?` macros. Definitely my biggest PR yet...
1695 lines
64 KiB
Common Lisp
1695 lines
64 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: mammoth.gc
|
|
;; name in dgo: mammoth
|
|
;; dgos: NESTT, NES
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
(deftype mammoth (nav-enemy)
|
|
((joint-ik joint-mod-ik 4 :offset-assert 604)
|
|
(ik-handle-pos vector 4 :inline :offset-assert 624)
|
|
(ik-handle-y float 4 :offset-assert 688)
|
|
(heel-lerp float 4 :offset-assert 704)
|
|
(foot-flags uint16 :offset-assert 720)
|
|
(old-foot-flags uint16 :offset-assert 722)
|
|
(y-level float :offset-assert 724)
|
|
(foot-pos vector 4 :inline :offset-assert 736)
|
|
(my-up-vector vector :inline :offset-assert 800)
|
|
(my-up-quat quaternion :inline :offset-assert 816)
|
|
(move-pos vector 2 :inline :offset-assert 832)
|
|
(travel-dest vector :inline :offset-assert 864)
|
|
(tilt-quat quaternion :inline :offset-assert 880)
|
|
(path-index int32 :offset-assert 896)
|
|
(path-index-dir int32 :offset-assert 900)
|
|
(path-pos float :offset-assert 904)
|
|
(turn-angle float :offset-assert 908)
|
|
(gspot-timer time-frame :offset-assert 912)
|
|
(gspot-normal vector :inline :offset-assert 928)
|
|
(attack-timer time-frame :offset-assert 944)
|
|
(lightning-timer time-frame :offset-assert 952)
|
|
(lightning-attack-timer time-frame :offset-assert 960)
|
|
(spawn-timer time-frame :offset-assert 968)
|
|
(turn-anim-start int32 :offset-assert 976)
|
|
(turn-anim int32 :offset-assert 980)
|
|
(turn-anim-end int32 :offset-assert 984)
|
|
(turn-move-start float :offset-assert 988)
|
|
(turn-move-end float :offset-assert 992)
|
|
(feet-ik-init-timer time-frame :offset-assert 1000)
|
|
)
|
|
:heap-base #x370
|
|
:method-count-assert 186
|
|
:size-assert #x3f0
|
|
:flag-assert #xba037003f0
|
|
(:methods
|
|
(waiting () _type_ :state 178)
|
|
(wait-to-walk () _type_ :state 179)
|
|
(walking () _type_ :state 180)
|
|
(walking-attack () _type_ :state 181)
|
|
(turning () _type_ :state 182)
|
|
(mammoth-method-183 (_type_) none 183)
|
|
(mammoth-method-184 (_type_) none 184)
|
|
(mammoth-method-185 (_type_ vector int) none 185)
|
|
)
|
|
)
|
|
|
|
|
|
(defskelgroup skel-mammoth mammoth mammoth-lod0-jg mammoth-walk0-ja
|
|
((mammoth-lod0-mg (meters 20)) (mammoth-lod1-mg (meters 999999)))
|
|
:bounds (static-spherem 0 4.5 0 17)
|
|
:shadow mammoth-shadow-mg
|
|
)
|
|
|
|
(define *mammoth-nav-enemy-info*
|
|
(new 'static 'nav-enemy-info
|
|
:use-die-falling #f
|
|
: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 push) :param0 #x1e)
|
|
(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)
|
|
)
|
|
:idle-anim 6
|
|
:notice-anim 6
|
|
:hostile-anim 6
|
|
:hit-anim 6
|
|
:knocked-anim 6
|
|
:knocked-land-anim 6
|
|
:die-anim -1
|
|
:die-falling-anim -1
|
|
:victory-anim 6
|
|
:jump-wind-up-anim -1
|
|
:jump-in-air-anim -1
|
|
:jump-land-anim -1
|
|
:neck-joint 6
|
|
:look-at-joint 7
|
|
:bullseye-joint 7
|
|
:notice-distance (meters 30)
|
|
:notice-distance-delta (meters 10)
|
|
:default-hit-points 80
|
|
:gnd-collide-with (collide-spec backgnd)
|
|
:overlaps-others-collide-with-filter (collide-spec jak bot player-list)
|
|
: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 2730.6667
|
|
: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 1)
|
|
:shadow-max-y (meters 1)
|
|
:shadow-min-y (meters -1)
|
|
:shadow-locus-dist (meters 150)
|
|
:gem-joint -1
|
|
:gem-offset (new 'static 'sphere :r 163840.0)
|
|
:callback-info #f
|
|
:use-momentum #f
|
|
:use-frustration #f
|
|
:use-stop-chase #f
|
|
:use-circling #f
|
|
:use-pacing #f
|
|
:walk-anim 6
|
|
:turn-anim 6
|
|
:run-anim 7
|
|
:taunt-anim 6
|
|
:run-travel-speed (meters 6)
|
|
:run-acceleration (meters 1)
|
|
:run-turning-acceleration (meters 20)
|
|
:walk-travel-speed (meters 4.5)
|
|
:walk-acceleration (meters 10)
|
|
:walk-turning-acceleration (meters 1)
|
|
:maximum-rotation-rate (degrees 31.249998)
|
|
:notice-nav-radius (meters 1)
|
|
: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! (-> *mammoth-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*)
|
|
|
|
(define *mammoth-lightning-joint-tbl* (new 'static 'boxed-array :type int32 50 51 52 53 54 55))
|
|
|
|
(deftype mammoth-ik-setup (structure)
|
|
((elbow-index int32 :offset-assert 0)
|
|
(hand-dist float :offset-assert 4)
|
|
(ground-dist float :offset-assert 8)
|
|
(foot-flag uint16 :offset-assert 12)
|
|
)
|
|
:method-count-assert 9
|
|
:size-assert #xe
|
|
:flag-assert #x90000000e
|
|
)
|
|
|
|
|
|
(define *mammoth-ik-setup*
|
|
(new 'static 'inline-array mammoth-ik-setup 4
|
|
(new 'static 'mammoth-ik-setup :elbow-index 9 :hand-dist 5640.192 :ground-dist 6789.12 :foot-flag #x1)
|
|
(new 'static 'mammoth-ik-setup :elbow-index 12 :hand-dist -5640.192 :ground-dist 6789.12 :foot-flag #x2)
|
|
(new 'static 'mammoth-ik-setup :elbow-index 24 :hand-dist 6574.08 :ground-dist 3913.728 :foot-flag #x8)
|
|
(new 'static 'mammoth-ik-setup :elbow-index 27 :hand-dist -6574.08 :ground-dist 3913.728 :foot-flag #x4)
|
|
)
|
|
)
|
|
|
|
(defbehavior mammoth-walk-post mammoth ()
|
|
(compute-alignment! (-> self align))
|
|
(align-vel-and-quat-only!
|
|
(-> self align)
|
|
(align-opts adjust-xz-vel)
|
|
(vector-normalize! (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)) 65536.0)
|
|
#x3f800000
|
|
1.0
|
|
1.0
|
|
)
|
|
(+! (-> self root transv y) (* (-> self enemy-info movement-gravity) (seconds-per-frame)))
|
|
(let ((a2-1 (new 'stack-no-clear 'move-above-ground-params)))
|
|
(let ((v1-9 (-> self enemy-info)))
|
|
(set! (-> a2-1 gnd-collide-with) (the-as collide-spec (-> self gnd-collide)))
|
|
(set! (-> a2-1 popup) 8192.0)
|
|
(set! (-> a2-1 dont-move-if-overlaps?) #f)
|
|
(set! (-> a2-1 hover-if-no-ground?) #f)
|
|
(set! (-> a2-1 overlaps-params options) (overlaps-others-options oo0 oo2))
|
|
(set! (-> a2-1 overlaps-params collide-with-filter) (-> v1-9 overlaps-others-collide-with-filter))
|
|
)
|
|
(set! (-> a2-1 overlaps-params tlist) *touching-list*)
|
|
(-> a2-1 overlaps-params)
|
|
(enemy-method-128 self (-> self root transv) a2-1)
|
|
)
|
|
(do-push-aways (-> self root))
|
|
(let ((s5-1
|
|
(vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> self travel-dest) (-> self root trans)) 1.0)
|
|
)
|
|
(gp-1 (new 'stack-no-clear 'quaternion))
|
|
)
|
|
(set! (-> s5-1 y) 0.0)
|
|
(vector-normalize! s5-1 1.0)
|
|
(quaternion-set! gp-1 0.0 (-> s5-1 x) 0.0 (+ 1.0 (-> s5-1 z)))
|
|
(quaternion-normalize! gp-1)
|
|
(quaternion-slerp! (-> self root quat) (-> self root quat) gp-1 (* 0.3 (seconds-per-frame)))
|
|
)
|
|
(nav-enemy-simple-post)
|
|
(none)
|
|
)
|
|
|
|
;; WARN: Return type mismatch object vs none.
|
|
(defbehavior mammoth-walk-check-end mammoth ()
|
|
(let ((a1-1 (vector-! (new 'stack-no-clear 'vector) (-> self move-pos 1) (the-as vector (-> self move-pos))))
|
|
(gp-1 (vector-! (new 'stack-no-clear 'vector) (-> self root trans) (the-as vector (-> self move-pos))))
|
|
)
|
|
(if (< (vector-length a1-1) (vector-dot gp-1 (vector-normalize-copy! (new 'stack-no-clear 'vector) a1-1 1.0)))
|
|
(go-virtual turning)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
(defbehavior next-path-index mammoth ()
|
|
(cond
|
|
((= (-> self path-index-dir) 1)
|
|
(if (= (-> self path-index) (the int (get-num-segments (-> self path))))
|
|
(set! (-> self path-index-dir) -1)
|
|
)
|
|
(+! (-> self path-index) (-> self path-index-dir))
|
|
)
|
|
(else
|
|
(if (zero? (-> self path-index))
|
|
(set! (-> self path-index-dir) 1)
|
|
)
|
|
(+! (-> self path-index) (-> self path-index-dir))
|
|
)
|
|
)
|
|
(let ((gp-0
|
|
(get-point-in-path! (-> self path) (new 'stack-no-clear 'vector) (the float (-> self path-index)) 'interp)
|
|
)
|
|
)
|
|
(cloest-point-on-mesh (-> self nav) gp-0 gp-0 (the-as nav-poly #f))
|
|
(set! (-> self move-pos 0 quad) (-> self move-pos 1 quad))
|
|
(set! (-> self move-pos 1 quad) (-> gp-0 quad))
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defbehavior set-nav-destination mammoth ()
|
|
(let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> self move-pos 1) (the-as vector (-> self move-pos))))
|
|
(s4-0 (new 'stack-no-clear 'vector))
|
|
(gp-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
(vector-normalize! s5-1 65536.0)
|
|
(vector-line-distance-point!
|
|
(-> self root trans)
|
|
(the-as vector (-> self move-pos))
|
|
(-> self move-pos 1)
|
|
s4-0
|
|
)
|
|
(vector+! gp-0 s4-0 s5-1)
|
|
(cloest-point-on-mesh (-> self nav) gp-0 gp-0 (the-as nav-poly #f))
|
|
(set! (-> self travel-dest quad) (-> gp-0 quad))
|
|
)
|
|
(let ((a0-5 (-> self nav state))
|
|
(v1-8 (-> self travel-dest))
|
|
)
|
|
(logclear! (-> a0-5 flags) (nav-state-flag directional-mode))
|
|
(logior! (-> a0-5 flags) (nav-state-flag target-poly-dirty))
|
|
(set! (-> a0-5 target-post quad) (-> v1-8 quad))
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defbehavior mammoth-walk-handler mammoth ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
|
(local-vars (v0-0 object))
|
|
(case arg2
|
|
(('event-rl-down)
|
|
(set! v0-0 (logior (-> self foot-flags) 8))
|
|
(set! (-> self foot-flags) (the-as uint v0-0))
|
|
v0-0
|
|
)
|
|
(('event-rr-up)
|
|
(set! v0-0 (logand -5 (-> self foot-flags)))
|
|
(set! (-> self foot-flags) (the-as uint v0-0))
|
|
v0-0
|
|
)
|
|
(('event-fl-down)
|
|
(set! v0-0 (logior (-> self foot-flags) 1))
|
|
(set! (-> self foot-flags) (the-as uint v0-0))
|
|
v0-0
|
|
)
|
|
(('event-fr-up)
|
|
(set! v0-0 (logand -3 (-> self foot-flags)))
|
|
(set! (-> self foot-flags) (the-as uint v0-0))
|
|
v0-0
|
|
)
|
|
(('event-rr-down)
|
|
(set! v0-0 (logior (-> self foot-flags) 4))
|
|
(set! (-> self foot-flags) (the-as uint v0-0))
|
|
v0-0
|
|
)
|
|
(('event-rl-up)
|
|
(set! v0-0 (logand -9 (-> self foot-flags)))
|
|
(set! (-> self foot-flags) (the-as uint v0-0))
|
|
v0-0
|
|
)
|
|
(('event-fr-down)
|
|
(set! v0-0 (logior (-> self foot-flags) 2))
|
|
(set! (-> self foot-flags) (the-as uint v0-0))
|
|
v0-0
|
|
)
|
|
(('event-fl-up)
|
|
(set! v0-0 (logand -2 (-> self foot-flags)))
|
|
(set! (-> self foot-flags) (the-as uint v0-0))
|
|
v0-0
|
|
)
|
|
(else
|
|
(enemy-event-handler arg0 arg1 arg2 arg3)
|
|
)
|
|
)
|
|
)
|
|
|
|
(defstate waiting (mammoth)
|
|
:virtual #t
|
|
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
|
(case message
|
|
(('cue-chase)
|
|
(go-virtual wait-to-walk)
|
|
)
|
|
)
|
|
)
|
|
:enter (behavior ()
|
|
(let ((v1-0 self))
|
|
(set! (-> v1-0 enemy-flags) (the-as enemy-flag (logclear (-> v1-0 enemy-flags) (enemy-flag enemy-flag36))))
|
|
(set! (-> v1-0 nav callback-info) *nav-enemy-null-callback-info*)
|
|
)
|
|
0
|
|
(let ((v1-3 self))
|
|
(set! (-> v1-3 enemy-flags) (the-as enemy-flag (logclear (-> v1-3 enemy-flags) (enemy-flag enemy-flag37))))
|
|
)
|
|
0
|
|
(logior! (-> self foot-flags) 15)
|
|
)
|
|
:code (behavior ()
|
|
(move-to-ground (-> self root) 40960.0 122880.0 #t (collide-spec backgnd))
|
|
(dotimes (v1-2 4)
|
|
(set! (-> self ik-handle-pos v1-2 quad) (-> self root trans quad))
|
|
(set! (-> self ik-handle-y v1-2) (-> self root trans y))
|
|
)
|
|
(ja-channel-push! 1 (seconds 0.1))
|
|
(until #f
|
|
(ja-no-eval :group! mammoth-idle0-ja :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
)
|
|
#f
|
|
)
|
|
:post nav-enemy-simple-post
|
|
)
|
|
|
|
(defstate wait-to-walk (mammoth)
|
|
:virtual #t
|
|
:event mammoth-walk-handler
|
|
:enter (behavior ()
|
|
(nav-enemy-method-165 self)
|
|
(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
|
|
(let ((v1-5 self))
|
|
(set! (-> v1-5 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-5 enemy-flags))))
|
|
)
|
|
0
|
|
)
|
|
:code (behavior ()
|
|
(next-path-index)
|
|
(set-nav-destination)
|
|
(ja-channel-push! 1 (seconds 0.1))
|
|
(ja-no-eval :group! mammoth-idle0-to-walk-ja :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
(go-virtual walking)
|
|
)
|
|
:post mammoth-walk-post
|
|
)
|
|
|
|
(defstate walking (mammoth)
|
|
:virtual #t
|
|
:event mammoth-walk-handler
|
|
:enter (behavior ()
|
|
(nav-enemy-method-165 self)
|
|
(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
|
|
(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 foot-flags) 6)
|
|
)
|
|
:code (behavior ()
|
|
(ja-channel-push! 1 (seconds 0.1))
|
|
(let ((v1-2 (ja-group)))
|
|
(when (not (or (and v1-2 (= v1-2 mammoth-walk0-ja))
|
|
(let ((v1-8 (ja-group)))
|
|
(and v1-8 (= v1-8 mammoth-walk1-ja))
|
|
)
|
|
(let ((v1-13 (ja-group)))
|
|
(and v1-13 (= v1-13 mammoth-idle0-to-walk-ja))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(until #f
|
|
(mammoth-walk-check-end)
|
|
(set-nav-destination)
|
|
(let ((v1-20 (if (rng-hit? self 0.5)
|
|
6
|
|
7
|
|
)
|
|
)
|
|
)
|
|
(ja-no-eval :group! (-> self draw art-group data v1-20) :num! (seek!) :frame-num 0.0)
|
|
)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
(mammoth-walk-check-end)
|
|
(when (time-elapsed? (-> self attack-timer) (seconds 5))
|
|
(set-time! (-> self attack-timer))
|
|
(go-virtual walking-attack)
|
|
)
|
|
)
|
|
#f
|
|
)
|
|
:post mammoth-walk-post
|
|
)
|
|
|
|
(defstate walking-attack (mammoth)
|
|
:virtual #t
|
|
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
|
(case message
|
|
(('event-attack)
|
|
(let ((v0-0 (the-as object (current-time))))
|
|
(set! (-> self lightning-timer) (the-as time-frame v0-0))
|
|
v0-0
|
|
)
|
|
)
|
|
(else
|
|
(mammoth-walk-handler proc argc message block)
|
|
)
|
|
)
|
|
)
|
|
:enter (behavior ()
|
|
(nav-enemy-method-165 self)
|
|
(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
|
|
(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 foot-flags) 6)
|
|
)
|
|
:trans (behavior ()
|
|
(when (and (not (time-elapsed? (-> self lightning-timer) (seconds 3))) (< (-> self spawn-timer) (current-time)))
|
|
(let ((s5-0 *mammoth-lightning-joint-tbl*))
|
|
(mammoth-method-185 self (-> self root trans) (-> s5-0 (get-rand-int self (-> s5-0 length))))
|
|
)
|
|
(set! (-> self spawn-timer) (+ (current-time) (the int (* 300.0 (get-rand-float-range self 0.0 0.1)))))
|
|
)
|
|
)
|
|
:code (behavior ()
|
|
(set-nav-destination)
|
|
(ja-channel-push! 1 (seconds 0.1))
|
|
(ja-no-eval :group! mammoth-walk-fire0-ja :num! (seek! max 0.8) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek! max 0.8))
|
|
)
|
|
(until #f
|
|
(mammoth-walk-check-end)
|
|
(set-nav-destination)
|
|
(ja-no-eval :group! mammoth-walk0-ja :num! (seek! max 0.8) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek! max 0.8))
|
|
)
|
|
(mammoth-walk-check-end)
|
|
(when (time-elapsed? (-> self attack-timer) (seconds 3))
|
|
(set-time! (-> self attack-timer))
|
|
(go-virtual walking)
|
|
)
|
|
)
|
|
#f
|
|
)
|
|
:post mammoth-walk-post
|
|
)
|
|
|
|
(defstate turning (mammoth)
|
|
:virtual #t
|
|
:event mammoth-walk-handler
|
|
:enter (behavior ()
|
|
(next-path-index)
|
|
(let ((gp-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)))
|
|
(s5-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
(set! (-> gp-0 y) 0.0)
|
|
(vector-xz-normalize! gp-0 1.0)
|
|
(vector-! s5-0 (-> self move-pos 1) (-> self root trans))
|
|
(set! (-> s5-0 y) 0.0)
|
|
(vector-xz-normalize! s5-0 1.0)
|
|
(set! (-> self turn-angle) (deg- (vector-y-angle s5-0) (vector-y-angle gp-0)))
|
|
)
|
|
(cond
|
|
((< 23665.777 (-> self turn-angle))
|
|
(set! (-> self turn-anim-start) 14)
|
|
(set! (-> self turn-anim) 15)
|
|
(set! (-> self turn-anim-end) -1)
|
|
(set! (-> self turn-move-start) 20480.0)
|
|
(set! (-> self turn-move-end) 0.0)
|
|
(set! (-> self turn-angle) 27306.666)
|
|
)
|
|
((< 5461.3335 (-> self turn-angle))
|
|
(set! (-> self turn-anim-start) 12)
|
|
(set! (-> self turn-anim) 13)
|
|
(set! (-> self turn-anim-end) -1)
|
|
(set! (-> self turn-move-start) 10240.0)
|
|
(set! (-> self turn-move-end) 0.0)
|
|
(set! (-> self turn-angle) 9102.223)
|
|
)
|
|
((< -5461.3335 (-> self turn-angle))
|
|
(set! (-> self turn-anim-start) -1)
|
|
(set! (-> self turn-anim) -1)
|
|
(set! (-> self turn-anim-end) -1)
|
|
(set! (-> self turn-move-start) 0.0)
|
|
(set! (-> self turn-move-end) 0.0)
|
|
(set! (-> self turn-angle) 0.0)
|
|
)
|
|
((< -23665.777 (-> self turn-angle))
|
|
(set! (-> self turn-anim-start) -1)
|
|
(set! (-> self turn-anim) 16)
|
|
(set! (-> self turn-anim-end) -1)
|
|
(set! (-> self turn-move-start) 0.0)
|
|
(set! (-> self turn-move-end) 0.0)
|
|
(set! (-> self turn-angle) -9102.223)
|
|
)
|
|
(else
|
|
(set! (-> self turn-anim-start) -1)
|
|
(set! (-> self turn-anim) 17)
|
|
(set! (-> self turn-anim-end) 18)
|
|
(set! (-> self turn-move-start) 0.0)
|
|
(set! (-> self turn-move-end) -10240.0)
|
|
(set! (-> self turn-angle) -27306.666)
|
|
)
|
|
)
|
|
(let ((v1-33 self))
|
|
(set! (-> v1-33 enemy-flags) (the-as enemy-flag (logclear (-> v1-33 enemy-flags) (enemy-flag enemy-flag37))))
|
|
)
|
|
0
|
|
)
|
|
:code (behavior ()
|
|
(ja-channel-push! 1 (seconds 0.1))
|
|
(when (!= (-> self turn-anim-start) -1)
|
|
(let ((gp-0 (-> self draw art-group data (-> self turn-anim-start))))
|
|
(let ((v1-7 (vector-z-quaternion! (-> self root transv) (-> self root quat)))
|
|
(a0-6 (-> self root trans))
|
|
)
|
|
(set! (-> (new 'stack-no-clear 'vector) quad) (-> a0-6 quad))
|
|
(vector+float*! (new 'stack-no-clear 'vector) a0-6 v1-7 (-> self turn-move-start))
|
|
)
|
|
(ja-no-eval :group! gp-0 :num! (seek! max 0.6667) :frame-num 0.0)
|
|
)
|
|
(until (ja-done? 0)
|
|
(compute-alignment! (-> self align))
|
|
(align! (-> self align) (align-opts adjust-xz-vel adjust-quat) 1.0 1.0 1.0)
|
|
(suspend)
|
|
(ja :num! (seek! max 0.6667))
|
|
)
|
|
)
|
|
(when (!= (-> self turn-anim) -1)
|
|
(ja-no-eval :group! (-> self draw art-group data (-> self turn-anim)) :num! (seek! max 0.6667) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(compute-alignment! (-> self align))
|
|
(align! (-> self align) (align-opts adjust-xz-vel adjust-quat) 1.0 1.0 1.0)
|
|
(suspend)
|
|
(ja :num! (seek! max 0.6667))
|
|
)
|
|
)
|
|
(when (!= (-> self turn-anim-end) -1)
|
|
(let ((gp-1 (-> self draw art-group data (-> self turn-anim-end))))
|
|
(let ((v1-68 (vector-z-quaternion! (-> self root transv) (-> self root quat)))
|
|
(a0-23 (-> self root trans))
|
|
)
|
|
(set! (-> (new 'stack-no-clear 'vector) quad) (-> a0-23 quad))
|
|
(vector+float*! (new 'stack-no-clear 'vector) a0-23 v1-68 (-> self turn-move-end))
|
|
)
|
|
(ja-no-eval :group! gp-1 :num! (seek! max 0.6667) :frame-num 0.0)
|
|
)
|
|
(until (ja-done? 0)
|
|
(compute-alignment! (-> self align))
|
|
(align! (-> self align) (align-opts adjust-xz-vel adjust-quat) 1.0 1.0 1.0)
|
|
(suspend)
|
|
(ja :num! (seek! max 0.6667))
|
|
)
|
|
)
|
|
(go-virtual walking)
|
|
)
|
|
:post (behavior ()
|
|
(nav-enemy-simple-post)
|
|
)
|
|
)
|
|
|
|
(defstate die (mammoth)
|
|
:virtual #t
|
|
:code (behavior ()
|
|
(set-nav-destination)
|
|
(ja-no-eval :group! mammoth-death-right-ja :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
(ja-no-eval :group! mammoth-death-right-fall-ja :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
(ja-no-eval :group! mammoth-death-right-fall-end-ja :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
(send-event self 'death-end)
|
|
(while (-> self child)
|
|
(suspend)
|
|
)
|
|
(cleanup-for-death self)
|
|
)
|
|
:post mammoth-walk-post
|
|
)
|
|
|
|
(defmethod general-event-handler mammoth ((this mammoth) (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)
|
|
(logclear! (-> this mask) (process-mask actor-pause))
|
|
(logclear! (-> this focus-status) (focus-status dangerous))
|
|
(logclear! (-> this enemy-flags) (enemy-flag enable-on-notice))
|
|
(logior! (-> this enemy-flags) (enemy-flag chase-startup))
|
|
(logior! (-> this focus-status) (focus-status hit))
|
|
(if (zero? (-> this hit-points))
|
|
(logior! (-> this focus-status) (focus-status dead))
|
|
)
|
|
(logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup))
|
|
(enemy-method-62 this)
|
|
(logior! (-> this enemy-flags) (enemy-flag actor-pause-backup))
|
|
(process-contact-action arg0)
|
|
(send-event arg0 'get-attack-count 1)
|
|
)
|
|
(else
|
|
((method-of-type nav-enemy general-event-handler) this arg0 arg1 arg2 arg3)
|
|
)
|
|
)
|
|
)
|
|
|
|
(defmethod mammoth-method-185 mammoth ((this mammoth) (arg0 vector) (arg1 int))
|
|
(rlet ((acc :class vf)
|
|
(vf0 :class vf)
|
|
(vf4 :class vf)
|
|
(vf5 :class vf)
|
|
(vf6 :class vf)
|
|
(vf7 :class vf)
|
|
)
|
|
(init-vf0-vector)
|
|
(let ((s1-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data arg1)))
|
|
(s2-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
(let ((s4-1 (vector-normalize! (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)) 16384.0)))
|
|
(vector-! s2-0 s1-0 arg0)
|
|
(set! (-> s2-0 y) 0.0)
|
|
(vector-xz-normalize! s2-0 49152.0)
|
|
(+! (-> s2-0 y) -81920.0)
|
|
(vector+! s2-0 s2-0 s4-1)
|
|
)
|
|
(let ((s3-1 (new 'stack-no-clear 'collide-query))
|
|
(s4-2 (new 'stack-no-clear 'matrix))
|
|
)
|
|
(matrix->trans (-> this node-list data arg1 bone transform) (-> s3-1 start-pos))
|
|
(set! (-> s3-1 move-dist quad) (-> s2-0 quad))
|
|
(let ((v1-11 s3-1))
|
|
(set! (-> v1-11 radius) 4.096)
|
|
(set! (-> v1-11 collide-with) (collide-spec backgnd obstacle))
|
|
(set! (-> v1-11 ignore-process0) #f)
|
|
(set! (-> v1-11 ignore-process1) #f)
|
|
(set! (-> v1-11 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1))
|
|
(set! (-> v1-11 action-mask) (collide-action solid))
|
|
)
|
|
(fill-using-line-sphere *collide-cache* s3-1)
|
|
(let ((f0-4 (probe-using-line-sphere *collide-cache* s3-1)))
|
|
(when (>= f0-4 0.0)
|
|
(let ((a0-16 s4-2))
|
|
(let ((v1-17 (-> s3-1 start-pos)))
|
|
(let ((a1-9 (-> s3-1 move-dist)))
|
|
(let ((a2-1 f0-4))
|
|
(.mov vf7 a2-1)
|
|
)
|
|
(.lvf vf5 (&-> a1-9 quad))
|
|
)
|
|
(.lvf vf4 (&-> v1-17 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-16 quad 0) vf6)
|
|
)
|
|
(process-spawn
|
|
lightning-tracker
|
|
:init lightning-tracker-init
|
|
(-> *lightning-spec-id-table* 1)
|
|
600
|
|
#f
|
|
this
|
|
arg1
|
|
s4-2
|
|
:to *entity-pool*
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
)
|
|
|
|
(defmethod go-stare mammoth ((this mammoth))
|
|
(go (method-of-object this walking))
|
|
)
|
|
|
|
(defmethod go-hostile mammoth ((this mammoth))
|
|
(go (method-of-object this walking))
|
|
)
|
|
|
|
;; WARN: Return type mismatch object vs none.
|
|
(defmethod go-idle mammoth ((this mammoth))
|
|
(go (method-of-object this waiting))
|
|
(none)
|
|
)
|
|
|
|
;; WARN: Return type mismatch symbol vs pat-surface.
|
|
(defmethod enemy-method-125 mammoth ((this mammoth) (arg0 collide-query) (arg1 collide-spec) (arg2 float) (arg3 float) (arg4 float))
|
|
(the-as
|
|
pat-surface
|
|
(when (find-ground (-> this root) arg0 arg1 arg2 arg3 arg4)
|
|
(set! (-> this root ground-pat) (-> arg0 best-other-tri pat))
|
|
(let ((s3-0 (new 'stack-no-clear 'collide-query)))
|
|
(let ((s2-1 (vector-! (new 'stack-no-clear 'vector) (-> this root gspot-pos) (-> this root trans))))
|
|
(vector-normalize! s2-1 1.0)
|
|
(vector+float*! (-> s3-0 start-pos) (-> this root gspot-pos) s2-1 -4096.0)
|
|
(vector-float*! (-> s3-0 move-dist) s2-1 8192.0)
|
|
)
|
|
(let ((v1-9 s3-0))
|
|
(set! (-> v1-9 radius) 8192.0)
|
|
(set! (-> v1-9 collide-with) arg1)
|
|
(set! (-> v1-9 ignore-process0) this)
|
|
(set! (-> v1-9 ignore-process1) #f)
|
|
(set! (-> v1-9 ignore-pat) (-> this root pat-ignore-mask))
|
|
(set! (-> v1-9 action-mask) (collide-action solid))
|
|
)
|
|
(fill-using-line-sphere *collide-cache* s3-0)
|
|
)
|
|
(let ((s4-1 (new 'stack-no-clear 'vector)))
|
|
(vector-reset! s4-1)
|
|
(dotimes (s3-1 (-> *collide-cache* num-tris))
|
|
(let* ((v1-15 (-> *collide-cache* tris s3-1))
|
|
(s1-1 (vector-! (new 'stack-no-clear 'vector) (-> v1-15 vertex 1) (the-as vector (-> v1-15 vertex))))
|
|
(s0-1 (vector-! (new 'stack-no-clear 'vector) (-> v1-15 vertex 2) (the-as vector (-> v1-15 vertex))))
|
|
(s2-2 (new 'stack-no-clear 'vector))
|
|
)
|
|
(vector-normalize! s1-1 1.0)
|
|
(vector-normalize! s0-1 1.0)
|
|
(vector-cross! s2-2 s1-1 s0-1)
|
|
(if (< (cos 10922.667) (vector-dot s2-2 *y-vector*))
|
|
(vector+! s4-1 s4-1 s2-2)
|
|
)
|
|
)
|
|
)
|
|
(vector-normalize-copy! (-> this gspot-normal) s4-1 1.0)
|
|
)
|
|
(let ((f0-4 (-> this root gspot-pos y)))
|
|
(if (= (-> this y-level) -40959590.0)
|
|
(set! (-> this y-level) f0-4)
|
|
(seek! (-> this y-level) f0-4 (* 8192.0 (seconds-per-frame)))
|
|
)
|
|
)
|
|
(set! (-> this root gspot-pos y) (-> this y-level))
|
|
(set! (-> arg0 best-other-tri intersect y) (-> this y-level))
|
|
#t
|
|
)
|
|
)
|
|
)
|
|
|
|
(defmethod mammoth-method-183 mammoth ((this mammoth))
|
|
(cond
|
|
((= (-> this root gspot-pos y) -40959590.0)
|
|
(quaternion-copy! (-> this tilt-quat) *unity-quaternion*)
|
|
)
|
|
(else
|
|
(let ((s1-0 (-> this root trans))
|
|
(s5-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
(set! (-> s5-0 quad) (-> this gspot-normal quad))
|
|
(let ((s4-0 (new 'stack-no-clear 'vector)))
|
|
(set! (-> s4-0 quad) (-> this gspot-normal quad))
|
|
(let ((s3-0 (new 'stack-no-clear 'vector)))
|
|
(set! (-> s3-0 quad) (-> this gspot-normal quad))
|
|
(let ((s2-0 (new 'stack-no-clear 'vector)))
|
|
(set! (-> s2-0 quad) (-> this gspot-normal quad))
|
|
(let ((s0-0 (lambda ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector))
|
|
(let ((gp-1 (vector-! (new 'stack-no-clear 'vector) arg2 arg1))
|
|
(s4-1 (vector-! (new 'stack-no-clear 'vector) arg3 arg1))
|
|
)
|
|
(vector-normalize! gp-1 1.0)
|
|
(vector-normalize! s4-1 1.0)
|
|
(vector-cross! arg0 s4-1 gp-1)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(if (and (logtest? (-> this foot-flags) 1) (logtest? (-> this foot-flags) 2))
|
|
(s0-0 s5-0 s1-0 (the-as vector (-> this foot-pos)) (-> this foot-pos 1))
|
|
)
|
|
(if (and (logtest? (-> this foot-flags) 2) (logtest? (-> this foot-flags) 4))
|
|
(s0-0 s4-0 s1-0 (-> this foot-pos 1) (-> this foot-pos 2))
|
|
)
|
|
(if (and (logtest? (-> this foot-flags) 4) (logtest? (-> this foot-flags) 8))
|
|
(s0-0 s4-0 s1-0 (-> this foot-pos 2) (-> this foot-pos 3))
|
|
)
|
|
(if (and (logtest? (-> this foot-flags) 8) (logtest? (-> this foot-flags) 1))
|
|
(s0-0 s4-0 s1-0 (-> this foot-pos 3) (the-as vector (-> this foot-pos)))
|
|
)
|
|
)
|
|
(vector+! s5-0 s5-0 s4-0)
|
|
(vector+! s5-0 s5-0 s3-0)
|
|
(vector+! s5-0 s5-0 s2-0)
|
|
)
|
|
)
|
|
)
|
|
(vector-normalize! s5-0 1.0)
|
|
(let ((s4-1 (new 'stack-no-clear 'quaternion)))
|
|
(let ((s0-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))))
|
|
(set! (-> s0-1 y) 0.0)
|
|
(vector-xz-normalize! s0-1 1.0)
|
|
(vector-rotate-y! s5-0 s5-0 (- (vector-y-angle s0-1)))
|
|
)
|
|
(quaternion-from-two-vectors-max-angle! s4-1 *up-vector* s5-0 4551.1113)
|
|
(quaternion-slerp! (-> this tilt-quat) (-> this tilt-quat) s4-1 (* 0.5 (seconds-per-frame)))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defun mammoth-joint-mod-tilt ((arg0 cspace) (arg1 transformq))
|
|
(-> arg0 param1)
|
|
(cspace<-parented-transformq-joint! arg0 arg1)
|
|
(none)
|
|
)
|
|
|
|
;; WARN: Return type mismatch vector vs none.
|
|
(defun mammoth-joint-mod-heel ((arg0 cspace) (arg1 transformq))
|
|
(let* ((s0-0 (-> arg0 param1))
|
|
(f30-0 (-> (the-as mammoth (+ (* (the-as int (-> arg0 param2)) 4) (the-as int s0-0))) heel-lerp 0))
|
|
(s3-0 (new 'stack-no-clear 'quaternion))
|
|
)
|
|
(cspace<-parented-transformq-joint! arg0 arg1)
|
|
(let ((s4-0 (new 'stack-no-clear 'vector))
|
|
(s5-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
(let ((s2-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> (the-as mammoth s0-0) root quat)))
|
|
(s1-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
(set! (-> s1-0 quad) (-> (the-as mammoth s0-0) my-up-vector quad))
|
|
(let ((v1-6 (-> arg0 param2)))
|
|
(cond
|
|
((zero? v1-6)
|
|
(vector-negate! s1-0 s1-0)
|
|
)
|
|
((= v1-6 1)
|
|
(vector-negate! s2-0 s2-0)
|
|
)
|
|
((= v1-6 2)
|
|
(vector-negate! s1-0 s1-0)
|
|
)
|
|
((= v1-6 3)
|
|
(vector-negate! s2-0 s2-0)
|
|
)
|
|
)
|
|
)
|
|
(let ((s2-1 (forward-up->quaternion (new 'stack-no-clear 'quaternion) s2-0 s1-0)))
|
|
(matrix->scale (-> arg0 bone transform) s4-0)
|
|
(set! (-> s5-0 quad) (-> arg0 bone transform trans quad))
|
|
(matrix-with-scale->quaternion s3-0 (-> arg0 bone transform))
|
|
(quaternion-normalize! s3-0)
|
|
(quaternion-slerp! s3-0 s2-1 s3-0 f30-0)
|
|
)
|
|
)
|
|
(quaternion->matrix (-> arg0 bone transform) s3-0)
|
|
(scale-matrix! (-> arg0 bone transform) s4-0 (-> arg0 bone transform))
|
|
(set! (-> arg0 bone transform trans quad) (-> s5-0 quad))
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
;; WARN: Return type mismatch none vs object.
|
|
(defun mammoth-leg-ik-callback ((arg0 joint-mod-ik) (arg1 matrix) (arg2 matrix) (arg3 vector))
|
|
(rlet ((acc :class vf)
|
|
(vf0 :class vf)
|
|
(vf4 :class vf)
|
|
(vf5 :class vf)
|
|
(vf6 :class vf)
|
|
(vf7 :class vf)
|
|
)
|
|
(init-vf0-vector)
|
|
(let ((s5-0 (new 'stack-no-clear 'vector)))
|
|
(set! (-> s5-0 quad) (-> arg3 quad))
|
|
(let ((f30-0 (- (-> arg3 y) (-> arg0 process root trans y))))
|
|
(if (< 6144.0 f30-0)
|
|
(set! f30-0 6144.0)
|
|
)
|
|
(if (< f30-0 -6144.0)
|
|
(set! f30-0 -6144.0)
|
|
)
|
|
(let ((s2-0 (-> arg0 user-position)))
|
|
(let ((s3-0 (-> arg0 user-position)))
|
|
(let ((v1-14 (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> arg0 process root quat))))
|
|
(let ((a0-2 f30-0))
|
|
(.mov vf7 a0-2)
|
|
)
|
|
(.lvf vf5 (&-> v1-14 quad))
|
|
)
|
|
(.lvf vf4 (&-> s3-0 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 (&-> s2-0 quad) vf6)
|
|
)
|
|
)
|
|
(let ((f0-4 (- (-> arg3 y) (-> arg0 user-position y))))
|
|
(seek! (-> arg0 user-float) f0-4 (* 40960.0 (seconds-per-frame)))
|
|
)
|
|
(let* ((f0-8 (-> arg0 user-float))
|
|
(f30-1 (lerp-scale 1.0 0.0 f0-8 0.0 12288.0))
|
|
(s3-1 (new 'stack-no-clear 'vector))
|
|
)
|
|
(let ((v1-17 s5-0))
|
|
(let ((a0-5 (-> arg0 user-normal)))
|
|
(let ((a1-5 8192.0))
|
|
(.mov vf7 a1-5)
|
|
)
|
|
(.lvf vf5 (&-> a0-5 quad))
|
|
)
|
|
(.lvf vf4 (&-> v1-17 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 (&-> s3-1 quad) vf6)
|
|
(vector-float*! (new 'stack-no-clear 'vector) (-> arg0 user-normal) -16384.0)
|
|
(let ((s4-1 (new 'stack-no-clear 'vector)))
|
|
0.0
|
|
(let ((f0-12 (intersect-ray-plane s3-1 (-> arg0 user-normal) (-> arg0 user-position) *up-vector*))
|
|
(a0-8 s4-1)
|
|
)
|
|
(let ((v1-20 (-> arg0 user-normal)))
|
|
(let ((a1-8 f0-12))
|
|
(.mov vf7 a1-8)
|
|
)
|
|
(.lvf vf5 (&-> v1-20 quad))
|
|
)
|
|
(.lvf vf4 (&-> s3-1 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-8 quad) vf6)
|
|
)
|
|
(let ((a1-9 s4-1))
|
|
(let ((v1-21 s4-1))
|
|
(let ((a0-9 (-> arg0 user-normal)))
|
|
(let ((a2-7
|
|
(- (vector-dot (-> arg0 user-normal) (vector-! (new 'stack-no-clear 'vector) s4-1 (-> arg0 user-position))))
|
|
)
|
|
)
|
|
(.mov vf7 a2-7)
|
|
)
|
|
(.lvf vf5 (&-> a0-9 quad))
|
|
)
|
|
(.lvf vf4 (&-> v1-21 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 (&-> a1-9 quad) vf6)
|
|
)
|
|
(let ((a1-10 s5-0))
|
|
(let ((v1-22 s5-0))
|
|
(let ((a0-11 (vector-! (new 'stack-no-clear 'vector) s4-1 s5-0)))
|
|
(let ((a2-10 (fmin 1.0 (* (-> arg0 user-blend) f30-1))))
|
|
(.mov vf7 a2-10)
|
|
)
|
|
(.lvf vf5 (&-> a0-11 quad))
|
|
)
|
|
(.lvf vf4 (&-> v1-22 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 (&-> a1-10 quad) vf6)
|
|
)
|
|
)
|
|
)
|
|
(handle-copy! arg0 s5-0)
|
|
)
|
|
)
|
|
)
|
|
|
|
(defbehavior mammoth-update-ik mammoth ()
|
|
(local-vars (sv-688 vector))
|
|
(rlet ((acc :class vf)
|
|
(vf0 :class vf)
|
|
(vf4 :class vf)
|
|
(vf5 :class vf)
|
|
(vf6 :class vf)
|
|
(vf7 :class vf)
|
|
)
|
|
(init-vf0-vector)
|
|
(let ((gp-0 (new 'stack-no-clear 'collide-query))
|
|
(s5-0 (-> self root))
|
|
)
|
|
(dotimes (s4-0 4)
|
|
(let ((s3-0 (-> self joint-ik s4-0)))
|
|
#t
|
|
(set! (-> s3-0 callback) mammoth-leg-ik-callback)
|
|
(-> s3-0 shoulder-matrix-no-ik)
|
|
(let ((v1-5 (-> s3-0 elbow-matrix-no-ik))
|
|
(s0-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
(set! sv-688 (new 'stack-no-clear 'vector))
|
|
(let ((a0-2 (-> *y-vector* quad)))
|
|
(set! (-> sv-688 quad) a0-2)
|
|
)
|
|
(let ((s2-0 (new 'stack-no-clear 'vector)))
|
|
(new 'stack-no-clear 'vector)
|
|
(new 'stack-no-clear 'vector)
|
|
(let ((s1-0 (new 'stack-no-clear 'vector)))
|
|
(let ((a1-1 s0-0))
|
|
(let ((a0-5 (-> v1-5 trans)))
|
|
(let ((v1-6 (-> v1-5 vector 1)))
|
|
(let ((a2-0 (-> s3-0 hand-dist)))
|
|
(.mov vf7 a2-0)
|
|
)
|
|
(.lvf vf5 (&-> v1-6 quad))
|
|
)
|
|
(.lvf vf4 (&-> a0-5 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 (&-> a1-1 quad) vf6)
|
|
)
|
|
(let ((a1-2 (-> gp-0 bbox))
|
|
(v1-7 s0-0)
|
|
(a0-6 (new 'stack-no-clear 'vector))
|
|
)
|
|
(set! (-> a0-6 x) 10240.0)
|
|
(set! (-> a0-6 y) 14336.0)
|
|
(set! (-> a0-6 z) 10240.0)
|
|
(set! (-> a0-6 w) 1.0)
|
|
(vector-! (the-as vector a1-2) v1-7 a0-6)
|
|
)
|
|
(let ((a1-4 (-> gp-0 bbox max))
|
|
(v1-8 s0-0)
|
|
(a0-7 (new 'stack-no-clear 'vector))
|
|
)
|
|
(set! (-> a0-7 x) 10240.0)
|
|
(set! (-> a0-7 y) 6144.0)
|
|
(set! (-> a0-7 z) 10240.0)
|
|
(set! (-> a0-7 w) 1.0)
|
|
(vector+! a1-4 v1-8 a0-7)
|
|
)
|
|
(set! (-> gp-0 collide-with) (collide-spec backgnd))
|
|
(set! (-> gp-0 ignore-process0) #f)
|
|
(set! (-> gp-0 ignore-process1) #f)
|
|
(fill-using-bounding-box *collide-cache* gp-0)
|
|
(let ((f0-11 (lerp-scale 1.0 0.0 (- (-> s0-0 y) (-> s5-0 gspot-pos y)) 2048.0 12288.0)))
|
|
(seek! (-> s3-0 user-blend) f0-11 (* 4.0 (seconds-per-frame)))
|
|
)
|
|
(let ((a1-9 (-> gp-0 start-pos)))
|
|
(let ((v1-14 s0-0))
|
|
(let ((a0-11 sv-688))
|
|
(let ((a2-12 12288.0))
|
|
(.mov vf7 a2-12)
|
|
)
|
|
(.lvf vf5 (&-> a0-11 quad))
|
|
)
|
|
(.lvf vf4 (&-> v1-14 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 (&-> a1-9 quad) vf6)
|
|
)
|
|
(let ((v1-15 (-> gp-0 move-dist))
|
|
(f0-16 -40960.0)
|
|
)
|
|
(vector-float*! v1-15 sv-688 f0-16)
|
|
)
|
|
(let ((v1-17 gp-0))
|
|
(set! (-> v1-17 radius) 4.096)
|
|
(set! (-> v1-17 collide-with) (-> gp-0 collide-with))
|
|
(set! (-> v1-17 ignore-process0) #f)
|
|
(set! (-> v1-17 ignore-process1) #f)
|
|
(set! (-> v1-17 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1))
|
|
(set! (-> v1-17 action-mask) (collide-action solid))
|
|
)
|
|
(let ((f0-18 (probe-using-line-sphere *collide-cache* gp-0)))
|
|
(cond
|
|
((>= f0-18 0.0)
|
|
(set! (-> s1-0 quad) (-> gp-0 best-other-tri normal quad))
|
|
(let ((a1-11 s2-0))
|
|
(let ((v1-20 (-> gp-0 start-pos)))
|
|
(let ((a0-21 (-> gp-0 move-dist)))
|
|
(let ((a2-13 f0-18))
|
|
(.mov vf7 a2-13)
|
|
)
|
|
(.lvf vf5 (&-> a0-21 quad))
|
|
)
|
|
(.lvf vf4 (&-> v1-20 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 (&-> a1-11 quad) vf6)
|
|
)
|
|
(set! (-> s3-0 user-position quad) (-> s2-0 quad))
|
|
(set! (-> s3-0 user-normal quad) (-> s1-0 quad))
|
|
)
|
|
(else
|
|
(set! (-> s0-0 y) (-> self root trans y))
|
|
(set! (-> s3-0 user-position quad) (-> s0-0 quad))
|
|
(set! (-> s3-0 user-normal quad) (-> *y-vector* quad))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
)
|
|
|
|
(defmethod mammoth-method-184 mammoth ((this mammoth))
|
|
(rlet ((acc :class vf)
|
|
(vf0 :class vf)
|
|
(vf4 :class vf)
|
|
(vf5 :class vf)
|
|
(vf6 :class vf)
|
|
(vf7 :class vf)
|
|
)
|
|
(init-vf0-vector)
|
|
(dotimes (s5-0 4)
|
|
(-> this joint-ik s5-0 shoulder-matrix-no-ik)
|
|
(let ((a0-1 (-> this joint-ik s5-0 elbow-matrix-no-ik))
|
|
(s3-0 (-> *mammoth-ik-setup* s5-0))
|
|
(v1-8 (new 'stack-no-clear 'vector))
|
|
(s1-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
(set! (-> s1-0 quad) (-> *y-vector* quad))
|
|
(new 'stack-no-clear 'vector)
|
|
(let ((s4-0 (new 'stack-no-clear 'vector)))
|
|
(let ((a2-0 v1-8))
|
|
(let ((a1-4 (-> a0-1 trans)))
|
|
(let ((a0-2 (-> a0-1 vector 1)))
|
|
(let ((a3-0 (-> s3-0 hand-dist)))
|
|
(.mov vf7 a3-0)
|
|
)
|
|
(.lvf vf5 (&-> a0-2 quad))
|
|
)
|
|
(.lvf vf4 (&-> a1-4 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 (&-> a2-0 quad) vf6)
|
|
)
|
|
(set! (-> s4-0 quad) (-> v1-8 quad))
|
|
(let ((s2-0 (new 'stack-no-clear 'collide-query))
|
|
(f30-0 (- (- (-> s4-0 y) (-> s3-0 ground-dist)) (-> this root trans y)))
|
|
)
|
|
(when #t
|
|
(let ((a1-5 (-> s2-0 bbox))
|
|
(v1-13 s4-0)
|
|
(a0-4 (new 'stack-no-clear 'vector))
|
|
)
|
|
(set! (-> a0-4 x) 16384.0)
|
|
(set! (-> a0-4 y) 16384.0)
|
|
(set! (-> a0-4 z) 16384.0)
|
|
(set! (-> a0-4 w) 1.0)
|
|
(vector-! (the-as vector a1-5) v1-13 a0-4)
|
|
)
|
|
(let ((a1-7 (-> s2-0 bbox max))
|
|
(v1-14 s4-0)
|
|
(a0-5 (new 'stack-no-clear 'vector))
|
|
)
|
|
(set! (-> a0-5 x) 16384.0)
|
|
(set! (-> a0-5 y) 16384.0)
|
|
(set! (-> a0-5 z) 16384.0)
|
|
(set! (-> a0-5 w) 1.0)
|
|
(vector+! a1-7 v1-14 a0-5)
|
|
)
|
|
(set! (-> s2-0 collide-with) (collide-spec backgnd))
|
|
(set! (-> s2-0 ignore-process0) #f)
|
|
(set! (-> s2-0 ignore-process1) #f)
|
|
(set! (-> s2-0 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1))
|
|
(fill-using-bounding-box *collide-cache* s2-0)
|
|
(let ((a1-10 (-> s2-0 start-pos)))
|
|
(let ((v1-19 s4-0))
|
|
(let ((a0-7 s1-0))
|
|
(let ((a2-10 24576.0))
|
|
(.mov vf7 a2-10)
|
|
)
|
|
(.lvf vf5 (&-> a0-7 quad))
|
|
)
|
|
(.lvf vf4 (&-> v1-19 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 (&-> a1-10 quad) vf6)
|
|
)
|
|
(vector-float*! (-> s2-0 move-dist) s1-0 -49152.0)
|
|
(let ((v1-22 s2-0))
|
|
(set! (-> v1-22 radius) (-> s3-0 ground-dist))
|
|
(set! (-> v1-22 collide-with) (collide-spec backgnd))
|
|
(set! (-> v1-22 ignore-process0) #f)
|
|
(set! (-> v1-22 ignore-process1) #f)
|
|
(set! (-> v1-22 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1))
|
|
(set! (-> v1-22 action-mask) (collide-action solid))
|
|
)
|
|
(let ((f0-14 (probe-using-line-sphere *collide-cache* s2-0)))
|
|
(when (>= f0-14 0.0)
|
|
(let ((v1-26 (new 'stack-no-clear 'vector)))
|
|
(let ((a0-13 (-> s2-0 start-pos)))
|
|
(let ((a1-12 (-> s2-0 move-dist)))
|
|
(let ((a2-11 f0-14))
|
|
(.mov vf7 a2-11)
|
|
)
|
|
(.lvf vf5 (&-> a1-12 quad))
|
|
)
|
|
(.lvf vf4 (&-> a0-13 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 (&-> v1-26 quad) vf6)
|
|
(seek! (-> this ik-handle-y s5-0) (-> v1-26 y) (* 16384.0 (seconds-per-frame)))
|
|
)
|
|
)
|
|
)
|
|
(set! (-> s4-0 y) (+ (-> this ik-handle-y s5-0) f30-0))
|
|
)
|
|
(set! (-> this heel-lerp s5-0) (lerp-scale 0.0 1.0 f30-0 0.0 3072.0))
|
|
)
|
|
(handle-copy! (-> this joint-ik s5-0) s4-0)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
)
|
|
|
|
(defmethod track-target! mammoth ((this mammoth))
|
|
"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"
|
|
(local-vars (sv-752 lightning-spec) (sv-768 int) (sv-784 symbol) (sv-800 mammoth))
|
|
(let ((t9-0 (method-of-type nav-enemy track-target!)))
|
|
(t9-0 this)
|
|
)
|
|
(mammoth-update-ik)
|
|
(dotimes (s5-0 4)
|
|
(enable-set! (-> this joint-ik s5-0) (zero? (-> this draw cur-lod)))
|
|
)
|
|
(when (!= (-> this old-foot-flags) (-> this foot-flags))
|
|
(let ((s5-1 (new 'static 'array uint32 4 #xa #xd #x1c #x19)))
|
|
(dotimes (s4-0 4)
|
|
(let ((s3-0 (vector<-cspace!
|
|
(new 'stack-no-clear 'vector)
|
|
(-> this node-list data (-> (the-as (pointer int32) (&+ s5-1 (* s4-0 4)))))
|
|
)
|
|
)
|
|
(s2-0 (new 'stack-no-clear 'collide-query))
|
|
)
|
|
(when (logtest? (ash 1 s4-0) (-> this foot-flags))
|
|
(when (not (logtest? (ash 1 s4-0) (-> this old-foot-flags)))
|
|
(set! (-> s2-0 start-pos quad) (-> s3-0 quad))
|
|
(vector-reset! (-> s2-0 move-dist))
|
|
(+! (-> s2-0 start-pos y) 8192.0)
|
|
(set! (-> s2-0 move-dist y) -40960.0)
|
|
(let ((v1-27 s2-0))
|
|
(set! (-> v1-27 radius) 2048.0)
|
|
(set! (-> v1-27 collide-with) (-> this enemy-info gnd-collide-with))
|
|
(set! (-> v1-27 ignore-process0) this)
|
|
(set! (-> v1-27 ignore-process1) #f)
|
|
(set! (-> v1-27 ignore-pat) (-> this root pat-ignore-mask))
|
|
(set! (-> v1-27 action-mask) (collide-action solid))
|
|
)
|
|
(if (>= (fill-and-probe-using-line-sphere *collide-cache* s2-0) 0.0)
|
|
(set! (-> s3-0 y) (-> s2-0 best-other-tri intersect y))
|
|
)
|
|
(set! (-> this foot-pos s4-0 quad) (-> s3-0 quad))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> this old-foot-flags) (-> this foot-flags))
|
|
)
|
|
(dotimes (v1-37 4)
|
|
(when (logtest? (ash 1 v1-37) (-> this foot-flags))
|
|
)
|
|
)
|
|
(when (and (not (time-elapsed? (-> this lightning-timer) (seconds 3)))
|
|
(< (-> this lightning-attack-timer) (current-time))
|
|
)
|
|
(let ((s5-2 *target*))
|
|
(when s5-2
|
|
(let* ((v1-47 (get-trans s5-2 0))
|
|
(s0-1 (vector-! (new 'stack-no-clear 'vector) v1-47 (-> this root trans)))
|
|
)
|
|
(when (< (vector-length s0-1) 57344.0)
|
|
(send-event
|
|
s5-2
|
|
'attack
|
|
#f
|
|
(static-attack-info
|
|
((id (new-attack-id))
|
|
(vector (vector-normalize! (vector-! (new 'stack-no-clear 'vector) v1-47 (-> this root trans)) 1.0))
|
|
(shove-back (meters 6))
|
|
(shove-up (meters 3))
|
|
(control (if (focus-test? s5-2 board)
|
|
1.0
|
|
0.0
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(let ((s2-1 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)))
|
|
(s1-0 *mammoth-lightning-joint-tbl*)
|
|
(s4-2 (new 'stack-no-clear 'array 'uint32 4))
|
|
(s3-2 0)
|
|
)
|
|
(let ((f30-0 (vector-dot s0-1 s2-1)))
|
|
(dotimes (s0-2 (-> s1-0 length))
|
|
(let* ((v0-9 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data (-> s1-0 s0-2))))
|
|
(f0-12 (vector-dot (vector-! (new 'stack-no-clear 'vector) v0-9 (-> this root trans)) s2-1))
|
|
)
|
|
(when (or (and (< 0.0 f0-12) (< 0.0 f30-0)) (and (< f0-12 0.0) (< f30-0 0.0)))
|
|
(set! (-> s4-2 s3-2) (the-as uint (-> s1-0 s0-2)))
|
|
(+! s3-2 1)
|
|
(if (>= s3-2 3)
|
|
(goto cfg-60)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(label cfg-60)
|
|
(let ((s2-2 (get-process *default-dead-pool* lightning-tracker #x4000)))
|
|
(when s2-2
|
|
(let ((t9-11 (method-of-type lightning-tracker activate)))
|
|
(t9-11
|
|
(the-as lightning-tracker s2-2)
|
|
s5-2
|
|
(symbol->string (-> lightning-tracker symbol))
|
|
(the-as pointer #x70004000)
|
|
)
|
|
)
|
|
(let ((s5-3 run-function-in-process)
|
|
(s1-1 s2-2)
|
|
(s0-3 lightning-tracker-init)
|
|
)
|
|
(set! sv-752 (-> *lightning-spec-id-table* 1))
|
|
(set! sv-768 600)
|
|
(set! sv-784 (the-as symbol #f))
|
|
(set! sv-800 this)
|
|
(let ((t2-0 (-> (the-as (pointer int32) (&+ s4-2 (* (get-rand-int this s3-2) 4)))))
|
|
(t3-0 6)
|
|
)
|
|
((the-as (function object object object object object object object object none) s5-3)
|
|
s1-1
|
|
s0-3
|
|
sv-752
|
|
sv-768
|
|
sv-784
|
|
sv-800
|
|
t2-0
|
|
t3-0
|
|
)
|
|
)
|
|
)
|
|
(-> s2-2 ppointer)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> this lightning-attack-timer)
|
|
(+ (current-time) (the int (* 300.0 (get-rand-float-range this 0.067 0.1))))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(mammoth-method-183 this)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod coin-flip? mammoth ((this mammoth))
|
|
"@returns The result of a 50/50 RNG roll"
|
|
#f
|
|
)
|
|
|
|
;; WARN: Return type mismatch process-focusable vs mammoth.
|
|
(defmethod relocate mammoth ((this mammoth) (arg0 int))
|
|
(dotimes (v1-0 4)
|
|
(if (nonzero? (-> this joint-ik v1-0))
|
|
(&+! (-> this joint-ik v1-0) arg0)
|
|
)
|
|
)
|
|
(the-as
|
|
mammoth
|
|
((the-as (function process-focusable int process-focusable) (find-parent-method mammoth 7)) this arg0)
|
|
)
|
|
)
|
|
|
|
(defmethod init-enemy-collision! mammoth ((this mammoth))
|
|
"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))
|
|
(let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 11) 0)))
|
|
(set! (-> s5-0 total-prims) (the-as uint 12))
|
|
(set! (-> s4-0 prim-core collide-as) (collide-spec enemy camera-blocker pusher))
|
|
(set! (-> s4-0 prim-core collide-with) (collide-spec jak bot enemy player-list))
|
|
(set! (-> s4-0 prim-core action) (collide-action solid can-ride deadly no-standon))
|
|
(set-vector! (-> s4-0 local-sphere) 0.0 24576.0 0.0 57344.0)
|
|
(set! (-> s5-0 root-prim) s4-0)
|
|
)
|
|
(pusher-init s5-0)
|
|
(let ((v1-14 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
|
|
(set! (-> v1-14 prim-core collide-as) (collide-spec enemy camera-blocker pusher))
|
|
(set! (-> v1-14 prim-core collide-with) (collide-spec jak bot enemy player-list))
|
|
(set! (-> v1-14 prim-core action) (collide-action solid can-ride deadly no-standon))
|
|
(set-vector! (-> v1-14 local-sphere) 0.0 24576.0 0.0 24576.0)
|
|
)
|
|
(let ((v1-16 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
|
|
(set! (-> v1-16 prim-core collide-as) (collide-spec enemy camera-blocker))
|
|
(set! (-> v1-16 prim-core action) (collide-action solid can-ride deadly no-standon))
|
|
(set! (-> v1-16 transform-index) 3)
|
|
(set-vector! (-> v1-16 local-sphere) 0.0 4096.0 16384.0 16384.0)
|
|
)
|
|
(let ((v1-18 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
|
|
(set! (-> v1-18 prim-core collide-as) (collide-spec enemy camera-blocker))
|
|
(set! (-> v1-18 prim-core action) (collide-action solid can-ride deadly no-standon))
|
|
(set! (-> v1-18 transform-index) 3)
|
|
(set-vector! (-> v1-18 local-sphere) 0.0 3072.0 -6144.0 16384.0)
|
|
)
|
|
(let ((v1-20 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
|
|
(set! (-> v1-20 prim-core collide-as) (collide-spec enemy camera-blocker))
|
|
(set! (-> v1-20 prim-core action) (collide-action solid can-ride deadly no-standon))
|
|
(set! (-> v1-20 transform-index) 3)
|
|
(set-vector! (-> v1-20 local-sphere) 0.0 16384.0 12288.0 12288.0)
|
|
)
|
|
(let ((v1-22 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
|
|
(set! (-> v1-22 prim-core collide-as) (collide-spec enemy camera-blocker))
|
|
(set! (-> v1-22 prim-core action) (collide-action solid can-ride deadly no-standon))
|
|
(set! (-> v1-22 transform-index) 7)
|
|
(set-vector! (-> v1-22 local-sphere) 0.0 0.0 0.0 8192.0)
|
|
)
|
|
(let ((v1-24 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
|
|
(set! (-> v1-24 prim-core collide-as) (collide-spec enemy camera-blocker))
|
|
(set! (-> v1-24 prim-core action) (collide-action solid can-ride deadly no-standon))
|
|
(set! (-> v1-24 transform-index) 30)
|
|
(set-vector! (-> v1-24 local-sphere) 0.0 0.0 0.0 7168.0)
|
|
)
|
|
(let ((v1-26 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
|
|
(set! (-> v1-26 prim-core collide-as) (collide-spec enemy camera-blocker))
|
|
(set! (-> v1-26 prim-core action) (collide-action solid can-ride deadly no-standon))
|
|
(set! (-> v1-26 transform-index) 31)
|
|
(set-vector! (-> v1-26 local-sphere) 0.0 0.0 0.0 5120.0)
|
|
)
|
|
(let ((v1-28 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
|
|
(set! (-> v1-28 prim-core collide-as) (collide-spec enemy camera-blocker))
|
|
(set! (-> v1-28 prim-core action) (collide-action solid can-ride deadly no-standon))
|
|
(set! (-> v1-28 transform-index) 24)
|
|
(set-vector! (-> v1-28 local-sphere) 0.0 4096.0 0.0 6144.0)
|
|
)
|
|
(let ((v1-30 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
|
|
(set! (-> v1-30 prim-core collide-as) (collide-spec enemy camera-blocker))
|
|
(set! (-> v1-30 prim-core action) (collide-action solid can-ride deadly no-standon))
|
|
(set! (-> v1-30 transform-index) 27)
|
|
(set-vector! (-> v1-30 local-sphere) 0.0 -4096.0 0.0 6144.0)
|
|
)
|
|
(let ((v1-32 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
|
|
(set! (-> v1-32 prim-core collide-as) (collide-spec enemy camera-blocker))
|
|
(set! (-> v1-32 prim-core action) (collide-action solid can-ride deadly no-standon))
|
|
(set! (-> v1-32 transform-index) 9)
|
|
(set-vector! (-> v1-32 local-sphere) 0.0 4096.0 0.0 5734.4)
|
|
)
|
|
(let ((v1-34 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
|
|
(set! (-> v1-34 prim-core collide-as) (collide-spec enemy camera-blocker))
|
|
(set! (-> v1-34 prim-core action) (collide-action solid can-ride deadly no-standon))
|
|
(set! (-> v1-34 transform-index) 12)
|
|
(set-vector! (-> v1-34 local-sphere) 0.0 -4096.0 0.0 5734.4)
|
|
)
|
|
(set! (-> s5-0 nav-radius) 24576.0)
|
|
(let ((v1-36 (-> s5-0 root-prim)))
|
|
(set! (-> s5-0 backup-collide-as) (-> v1-36 prim-core collide-as))
|
|
(set! (-> s5-0 backup-collide-with) (-> v1-36 prim-core collide-with))
|
|
)
|
|
(set! (-> this root) s5-0)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod init-enemy! mammoth ((this mammoth))
|
|
"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-mammoth" (the-as (pointer uint32) #f)))
|
|
(the-as pair 0)
|
|
)
|
|
(init-enemy-behaviour-and-stats! this *mammoth-nav-enemy-info*)
|
|
(logclear! (-> this mask) (process-mask actor-pause))
|
|
(set-vector! (-> this root scale) 1.5 1.5 1.5 1.0)
|
|
(set! (-> this y-level) -40959590.0)
|
|
(set! (-> this foot-flags) (the-as uint 0))
|
|
(set! (-> this old-foot-flags) (the-as uint 0))
|
|
(set-time! (-> this attack-timer))
|
|
(set! (-> this spawn-timer) 0)
|
|
(set! (-> this my-up-vector quad) (-> *y-vector* quad))
|
|
(quaternion-copy! (-> this my-up-quat) *unity-quaternion*)
|
|
(set! (-> this gspot-timer) 0)
|
|
(set! (-> this gspot-normal quad) (-> *y-vector* quad))
|
|
(set! (-> this align) (new 'process 'align-control this))
|
|
(dotimes (s5-1 4)
|
|
(set! (-> this joint-ik s5-1) (new
|
|
'process
|
|
'joint-mod-ik
|
|
this
|
|
(-> *mammoth-ik-setup* s5-1 elbow-index)
|
|
(-> *mammoth-ik-setup* s5-1 hand-dist)
|
|
)
|
|
)
|
|
(set! (-> this joint-ik s5-1 elbow-pole-vector-axis) (the-as uint 2))
|
|
(set! (-> this joint-ik s5-1 elbow-rotation-axis) (the-as uint 0))
|
|
(set! (-> this joint-ik 0 callback) mammoth-leg-ik-callback)
|
|
)
|
|
(logior! (-> this joint-ik 1 flags) (joint-mod-ik-flags elbow-trans-neg))
|
|
(logior! (-> this joint-ik 2 flags) (joint-mod-ik-flags elbow-trans-neg))
|
|
(logior! (-> this joint-ik 0 flags) (joint-mod-ik-flags elbow-rot-neg))
|
|
(logior! (-> this joint-ik 1 flags) (joint-mod-ik-flags elbow-rot-neg))
|
|
(set! (-> this path) (new 'process 'path-control this 'path 0.0 (-> this entity) #f))
|
|
(set! (-> this path-pos) 0.0)
|
|
(set! (-> this path-index) 0)
|
|
(set! (-> this path-index-dir) 1)
|
|
(logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text))
|
|
(get-point-in-path! (-> this path) (-> this root trans) 0.0 'interp)
|
|
(set! (-> this move-pos 0 quad) (-> this root trans quad))
|
|
(set! (-> this move-pos 1 quad) (-> this root trans quad))
|
|
(forward-up-nopitch->quaternion
|
|
(-> this root quat)
|
|
(vector-!
|
|
(new 'stack-no-clear 'vector)
|
|
(get-point-in-path!
|
|
(-> this path)
|
|
(new 'stack-no-clear 'vector)
|
|
(the float (+ (-> this path-index) 1))
|
|
'interp
|
|
)
|
|
(-> this root trans)
|
|
)
|
|
*up-vector*
|
|
)
|
|
(quaternion-copy! (-> this tilt-quat) *unity-quaternion*)
|
|
(let ((a0-38 (-> this node-list data 4)))
|
|
(set! (-> a0-38 param0) mammoth-joint-mod-tilt)
|
|
(set! (-> a0-38 param1) this)
|
|
)
|
|
(let ((a0-39 (-> this node-list data 10)))
|
|
(set! (-> a0-39 param0) mammoth-joint-mod-heel)
|
|
(set! (-> a0-39 param1) this)
|
|
(set! (-> a0-39 param2) (the-as basic 0))
|
|
)
|
|
(let ((v1-61 (-> this node-list data 13)))
|
|
(set! (-> v1-61 param0) mammoth-joint-mod-heel)
|
|
(set! (-> v1-61 param1) this)
|
|
(set! (-> v1-61 param2) (the-as basic 1))
|
|
)
|
|
(let ((v1-63 (-> this node-list data 25)))
|
|
(set! (-> v1-63 param0) mammoth-joint-mod-heel)
|
|
(set! (-> v1-63 param1) this)
|
|
(set! (-> v1-63 param2) (the-as basic 2))
|
|
)
|
|
(let ((v1-65 (-> this node-list data 28)))
|
|
(set! (-> v1-65 param0) mammoth-joint-mod-heel)
|
|
(set! (-> v1-65 param1) this)
|
|
(set! (-> v1-65 param2) (the-as basic 3))
|
|
)
|
|
(dotimes (v1-66 4)
|
|
(set! (-> this heel-lerp v1-66) 0.0)
|
|
)
|
|
(set! (-> this lightning-timer) 0)
|
|
(set! (-> this lightning-attack-timer) 0)
|
|
(set-time! (-> this feet-ik-init-timer))
|
|
(logclear! (-> this enemy-flags) (enemy-flag check-water-backup))
|
|
0
|
|
(none)
|
|
)
|