mirror of
https://github.com/open-goal/jak-project
synced 2026-08-09 10:54:39 -04:00
temp stuff
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
(deftype aphid (nav-enemy)
|
||||
((try int32)))
|
||||
|
||||
|
||||
(defskelgroup *aphid-sg*
|
||||
aphid-lurker
|
||||
aphid-lurker-lod0-jg
|
||||
@@ -17,33 +18,35 @@
|
||||
:shadow aphid-lurker-shadow-mg)
|
||||
|
||||
(defbehavior aphid-invulnerable aphid ()
|
||||
"Make aphid invulnerable."
|
||||
(logclear! (-> self nav-enemy-flags) (nav-enemy-flags navenmf5))
|
||||
(set-collide-offense (-> self collide-info) 2 (collide-offense indestructible))
|
||||
(set-collide-offense (-> self root) 2 (collide-offense indestructible))
|
||||
(none))
|
||||
|
||||
(defbehavior aphid-vulnerable aphid ()
|
||||
"remove invulnerability"
|
||||
(logior! (-> self nav-enemy-flags) (nav-enemy-flags navenmf5))
|
||||
(set-collide-offense (-> self collide-info) 2 (collide-offense touch))
|
||||
(set-collide-offense (-> self root) 2 (collide-offense touch))
|
||||
(none))
|
||||
|
||||
(defmethod attack-handler ((this aphid) (arg0 process) (arg1 event-message-block))
|
||||
(defmethod attack-handler ((this aphid) (proc process) (msg-block event-message-block))
|
||||
(cond
|
||||
((or (logtest? (-> this nav-enemy-flags) (nav-enemy-flags navenmf5)) (= arg0 (ppointer->process (-> this parent))))
|
||||
(send-event arg0 'get-attack-count 1)
|
||||
((or (logtest? (-> this nav-enemy-flags) (nav-enemy-flags navenmf5)) (= proc (ppointer->process (-> this parent))))
|
||||
(send-event proc 'get-attack-count 1)
|
||||
(logclear! (-> this mask) (process-mask actor-pause attackable))
|
||||
(go (method-of-object this nav-enemy-die)))
|
||||
(else (touch-handler this arg0 arg1))))
|
||||
(else (touch-handler this proc msg-block))))
|
||||
|
||||
(defstate nav-enemy-chase (aphid)
|
||||
:virtual #t
|
||||
:exit aphid-vulnerable
|
||||
:code
|
||||
(behavior ()
|
||||
(let ((gp-0 (cond
|
||||
((>= (-> self try) 15) 450)
|
||||
((>= (-> self try) 10) 300)
|
||||
((>= (-> self try) 5) 150)
|
||||
(else 0))))
|
||||
(let ((time-adjust (cond
|
||||
((>= (-> self try) 15) 450)
|
||||
((>= (-> self try) 10) 300)
|
||||
((>= (-> self try) 5) 150)
|
||||
(else 0))))
|
||||
(loop
|
||||
(ja-channel-push! 1 (seconds 0.05))
|
||||
(sound-play "aphid-spike-out")
|
||||
@@ -55,42 +58,42 @@
|
||||
(ja-channel-push! 1 (seconds 0.1))
|
||||
(ja :group! aphid-lurker-walk-deadly-ja)
|
||||
(ja :num-func num-func-identity :frame-num 0.0)
|
||||
(let ((f30-0 (nav-enemy-rnd-float-range 0.9 1.1))
|
||||
(s5-1 (current-time))
|
||||
(s4-1 (- (the int (nav-enemy-rnd-float-range 900.0 1440.0)) gp-0)))
|
||||
(until (time-elapsed? s5-1 s4-1)
|
||||
(let ((speed (nav-enemy-rnd-float-range 0.9 1.1)))
|
||||
(let ((invuln-start-time (current-time))
|
||||
(invuln-duration (- (the int (nav-enemy-rnd-float-range 900.0 1440.0)) time-adjust)))
|
||||
(until (time-elapsed? invuln-start-time invuln-duration)
|
||||
(suspend)
|
||||
(ja :num! (loop! speed))))
|
||||
(aphid-vulnerable)
|
||||
(ja-channel-push! 1 (seconds 0.05))
|
||||
(sound-play "aphid-spike-in")
|
||||
(ja-no-eval :group! aphid-lurker-spike-out-ja :num! (seek! 0.0) :frame-num max)
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (loop! f30-0))))
|
||||
(aphid-vulnerable)
|
||||
(ja-channel-push! 1 (seconds 0.05))
|
||||
(sound-play "aphid-spike-in")
|
||||
(ja-no-eval :group! aphid-lurker-spike-out-ja :num! (seek! 0.0) :frame-num max)
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek! 0.0)))
|
||||
(ja-channel-push! 1 (seconds 0.1))
|
||||
(ja :group! (-> self draw art-group data (-> self nav-info run-anim)))
|
||||
(ja :num-func num-func-identity :frame-num 0.0)
|
||||
(let ((f30-1 (nav-enemy-rnd-float-range 0.9 1.1))
|
||||
(s5-3 (current-time))
|
||||
(s4-3 (+ (the int (nav-enemy-rnd-float-range 660.0 900.0)) gp-0)))
|
||||
(until (time-elapsed? s5-3 s4-3)
|
||||
(suspend)
|
||||
(ja :num! (loop! f30-1))))))))
|
||||
(ja :num! (seek! 0.0)))
|
||||
(ja-channel-push! 1 (seconds 0.1))
|
||||
(ja :group! (-> self draw art-group data (-> self nav-info run-anim)))
|
||||
(ja :num-func num-func-identity :frame-num 0.0)
|
||||
(set! speed (nav-enemy-rnd-float-range 0.9 1.1))
|
||||
(let ((run-start (current-time))
|
||||
(run-duration (+ (the int (nav-enemy-rnd-float-range 660.0 900.0)) time-adjust)))
|
||||
(until (time-elapsed? run-start run-duration)
|
||||
(suspend)
|
||||
(ja :num! (loop! speed)))))))))
|
||||
|
||||
(defstate nav-enemy-stare (aphid)
|
||||
:virtual #t
|
||||
:code
|
||||
(behavior ()
|
||||
(set! (-> self turn-time) (seconds 0.2))
|
||||
(let ((f30-0 (nav-enemy-rnd-float-range 0.8 1.2)))
|
||||
(when (or (logtest? (-> self nav-enemy-flags) (nav-enemy-flags navenmf8))
|
||||
(let ((speed (nav-enemy-rnd-float-range 0.8 1.2)))
|
||||
(when (or (logtest? (-> self nav-enemy-flags) (nav-enemy-flags just-attacked))
|
||||
(and (nav-enemy-player-vulnerable?) (nav-enemy-rnd-percent? 0.5)))
|
||||
(ja-channel-push! 1 (seconds 0.1))
|
||||
(ja-no-eval :group! aphid-lurker-win-ja :num! (seek! max f30-0) :frame-num 0.0)
|
||||
(ja-no-eval :group! aphid-lurker-win-ja :num! (seek! max speed) :frame-num 0.0)
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek! max f30-0))))
|
||||
(ja :num! (seek! max speed))))
|
||||
(loop
|
||||
(when (not (nav-enemy-facing-player? 2730.6667))
|
||||
(logior! (-> self nav-enemy-flags) (nav-enemy-flags enable-travel))
|
||||
@@ -105,10 +108,10 @@
|
||||
(logclear! (-> self nav-enemy-flags) (nav-enemy-flags enable-travel)))
|
||||
(when (nav-enemy-rnd-percent? 0.3)
|
||||
(if (not (ja-group? aphid-lurker-win-ja)) (ja-channel-push! 1 (seconds 0.1)))
|
||||
(ja-no-eval :group! aphid-lurker-win-ja :num! (seek! max f30-0) :frame-num 0.0)
|
||||
(ja-no-eval :group! aphid-lurker-win-ja :num! (seek! max speed) :frame-num 0.0)
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek! max f30-0))))))))
|
||||
(ja :num! (seek! max speed))))))))
|
||||
|
||||
(defstate nav-enemy-give-up (aphid)
|
||||
:virtual #t
|
||||
@@ -117,9 +120,9 @@
|
||||
(set! (-> self rotate-speed) 218453.33)
|
||||
(set! (-> self turn-time) (seconds 0.5))
|
||||
(ja-channel-push! 1 (seconds 0.15))
|
||||
(let ((s4-0 (-> self collide-info))
|
||||
(s5-0 (target-pos 0)))
|
||||
(when (< (fabs (deg-diff (y-angle s4-0) (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s5-0 (-> s4-0 trans)))))
|
||||
(let ((root (-> self root))
|
||||
(tgt-pos (target-pos 0)))
|
||||
(when (< (fabs (deg-diff (y-angle root) (vector-y-angle (vector-! (new 'stack-no-clear 'vector) tgt-pos (-> root trans)))))
|
||||
12743.111)
|
||||
(ja-no-eval :group! aphid-lurker-give-up-ja :num! (seek!) :frame-num 0.0)
|
||||
(until (ja-done? 0)
|
||||
@@ -129,10 +132,7 @@
|
||||
(nav-enemy-get-new-patrol-point)
|
||||
(ja-no-eval :group! aphid-lurker-give-up-hop-ja :num! (seek!) :frame-num 0.0)
|
||||
(until (ja-done? 0)
|
||||
(seek-to-point-toward-point! (-> self collide-info)
|
||||
(-> self nav destination-pos)
|
||||
(-> self rotate-speed)
|
||||
(-> self turn-time))
|
||||
(seek-to-point-toward-point! (-> self root) (-> self nav destination-pos) (-> self rotate-speed) (-> self turn-time))
|
||||
(suspend)
|
||||
(ja :num! (seek!)))
|
||||
(go-virtual nav-enemy-patrol)))
|
||||
@@ -192,25 +192,26 @@
|
||||
:debug-draw-jump #f))
|
||||
|
||||
(defmethod initialize-collision ((this aphid))
|
||||
(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) default-collision-reaction)
|
||||
(set! (-> s5-0 no-reaction) (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing))
|
||||
(let ((s4-0 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 3))))
|
||||
(set! (-> s4-0 prim-core collide-as) (collide-kind enemy))
|
||||
(set! (-> s4-0 collide-with) (collide-kind target))
|
||||
(set! (-> s4-0 prim-core action) (collide-action solid))
|
||||
(set! (-> s4-0 prim-core offense) (collide-offense touch))
|
||||
(set-vector! (-> s4-0 local-sphere) 0.0 4096.0 0.0 4096.0)
|
||||
(set-root-prim! s5-0 s4-0))
|
||||
(set! (-> s5-0 nav-radius) 6144.0)
|
||||
(backup-collide-with-as s5-0)
|
||||
(set! (-> s5-0 max-iteration-count) (the-as uint 2))
|
||||
(set! (-> this collide-info) s5-0))
|
||||
(let ((cshape (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player))))
|
||||
(set! (-> cshape dynam) (copy *standard-dynamics* 'process))
|
||||
(set! (-> cshape reaction) default-collision-reaction)
|
||||
(set! (-> cshape no-reaction)
|
||||
(the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing))
|
||||
(let ((sph (new 'process 'collide-shape-prim-sphere cshape (the-as uint 3))))
|
||||
(set! (-> sph prim-core collide-as) (collide-kind enemy))
|
||||
(set! (-> sph collide-with) (collide-kind target))
|
||||
(set! (-> sph prim-core action) (collide-action solid))
|
||||
(set! (-> sph prim-core offense) (collide-offense touch))
|
||||
(set-vector! (-> sph local-sphere) 0.0 4096.0 0.0 4096.0)
|
||||
(set-root-prim! cshape sph))
|
||||
(set! (-> cshape nav-radius) 6144.0)
|
||||
(backup-collide-with-as cshape)
|
||||
(set! (-> cshape max-iteration-count) (the-as uint 2))
|
||||
(set! (-> this root) cshape))
|
||||
0
|
||||
(none))
|
||||
|
||||
(defmethod nav-enemy-method-48 ((this aphid))
|
||||
(defmethod setup-enemy! ((this aphid))
|
||||
(initialize-skeleton this *aphid-sg* '())
|
||||
(init-defaults! this *aphid-nav-enemy-info*)
|
||||
(set! (-> this neck up) (the-as uint 0))
|
||||
@@ -219,18 +220,19 @@
|
||||
0
|
||||
(none))
|
||||
|
||||
(defbehavior aphid-init-by-other aphid ((arg0 nav-enemy) (arg1 vector) (arg2 vector))
|
||||
(defbehavior aphid-init-by-other aphid ((parent-boss nav-enemy) (pos vector) (dest vector))
|
||||
"Initialize an `aphid` and enter chase state."
|
||||
(initialize-collision self)
|
||||
(logior! (-> self mask) (process-mask actor-pause))
|
||||
(set! (-> self collide-info trans quad) (-> arg1 quad))
|
||||
(set! (-> self event-param-point quad) (-> arg2 quad))
|
||||
(let ((s3-1 (vector-! (new 'stack-no-clear 'vector) arg2 arg1)))
|
||||
(set! (-> s3-1 y) 0.0)
|
||||
(vector-normalize! s3-1 1.0)
|
||||
(forward-up->quaternion (-> self collide-info quat) s3-1 *up-vector*))
|
||||
(vector-identity! (-> self collide-info scale))
|
||||
(set! (-> self entity) (-> arg0 entity))
|
||||
(nav-enemy-method-48 self)
|
||||
(set! (-> self root trans quad) (-> pos quad))
|
||||
(set! (-> self event-param-point quad) (-> dest quad))
|
||||
(let ((to-dest (vector-! (new 'stack-no-clear 'vector) dest pos)))
|
||||
(set! (-> to-dest y) 0.0)
|
||||
(vector-normalize! to-dest 1.0)
|
||||
(forward-up->quaternion (-> self root quat) to-dest *up-vector*))
|
||||
(vector-identity! (-> self root scale))
|
||||
(set! (-> self entity) (-> parent-boss entity))
|
||||
(setup-enemy! self)
|
||||
(logclear! (-> self nav-enemy-flags) (nav-enemy-flags navenmf12))
|
||||
(set! (-> self try) (the-as int (send-event (ppointer->process (-> self parent)) 'try)))
|
||||
(go-virtual nav-enemy-chase)
|
||||
|
||||
Reference in New Issue
Block a user