;;-*-Lisp-*- (in-package goal) ;; definition for symbol *hal-nav-enemy-info*, type nav-enemy-info (define *hal-nav-enemy-info* (new 'static 'nav-enemy-info :use-die-falling #t :use-victory #f :use-jump-blocked #f :debug-draw-neck #f :jump-debug-draw #f :move-to-ground #f :hover-if-no-ground #f :idle-anim-script #f :idle-anim -1 :notice-anim -1 :hostile-anim -1 :hit-anim -1 :knocked-anim -1 :knocked-land-anim -1 :die-anim -1 :die-falling-anim -1 :victory-anim -1 :jump-wind-up-anim -1 :jump-in-air-anim -1 :jump-land-anim -1 :neck-joint -1 :notice-distance (meters 30) :notice-distance-delta (meters 10) :default-hit-points 1 :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 #t :use-stop-chase #f :use-circling #f :use-pacing #f :walk-anim -1 :turn-anim -1 :run-anim -1 :taunt-anim -1 :run-travel-speed (meters 6) :run-acceleration (meters 1) :run-turning-acceleration (meters 2) :walk-travel-speed (meters 3) :walk-acceleration (meters 1) :walk-turning-acceleration (meters 1) :maximum-rotation-rate (degrees 720.0) :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 ) ) ;; failed to figure out what this is: (set! (-> *hal-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) ;; definition for function hal-simple-check-too-far (defun hal-simple-check-too-far ((arg0 hal)) (let ((s5-0 (-> *target* control trans)) (f30-0 40960000.0) ) (countdown (s4-0 3) (let ((v1-6 (handle->process (-> arg0 slave-handle s4-0)))) (when v1-6 (let ((f0-0 (vector-vector-xz-distance s5-0 (-> (the-as process-drawable v1-6) root trans)))) (if (< f0-0 f30-0) (set! f30-0 f0-0) ) ) ) ) ) (let ((v0-1 0)) (let ((f0-1 (-> arg0 too-far-warn-dist))) (when (>= f30-0 f0-1) (if (>= (- f30-0 f0-1) (-> arg0 too-far-fail-dist-delta)) (set! v0-1 2) (set! v0-1 1) ) ) ) v0-1 ) ) ) ;; definition for method 220 of type hal (defmethod stop-speech hal ((obj hal) (arg0 uint) (arg1 symbol)) (cond ((zero? arg0) (let ((t9-0 (method-of-type bot stop-speech))) (t9-0 obj (-> obj channel) arg1) ) (countdown (s4-0 3) (let ((v1-4 (handle->process (-> obj slave-handle s4-0)))) (when v1-4 (let ((t9-1 (method-of-type bot stop-speech))) (t9-1 (the-as bot v1-4) (-> v1-4 stack 580) arg1) ) ) ) ) ) (else ((method-of-type bot stop-speech) obj arg0 arg1) ) ) (none) ) ;; definition for method 206 of type hal ;; WARN: Return type mismatch gui-connection vs none. (defmethod play-speech hal ((obj hal) (arg0 int)) (let ((v1-2 (-> obj course speeches arg0))) (logior! (-> v1-2 flags) (speech-flags playing)) (let ((a1-4 (-> v1-2 slave-id)) (t2-0 (-> v1-2 hold-time)) (gp-0 (-> obj course speech-tunings (-> v1-2 tuning-id))) ) (cond ((>= a1-4 0) (let* ((a2-2 (handle->process (-> obj slave-handle a1-4))) (a1-11 (add-process *gui-control* a2-2 (the-as gui-channel (-> a2-2 stack 580)) (gui-action play) (-> v1-2 name) -99.0 (the-as time-frame t2-0) ) ) ) (set-falloff! *gui-control* a1-11 (-> gp-0 trans?) (-> gp-0 fo-min) (-> gp-0 fo-max) (-> gp-0 fo-curve)) ) ) (else (let ((a1-14 (add-process *gui-control* obj (the-as gui-channel (-> obj channel)) (gui-action play) (-> v1-2 name) -99.0 (the-as time-frame t2-0) ) ) ) (set-falloff! *gui-control* a1-14 (-> gp-0 trans?) (-> gp-0 fo-min) (-> gp-0 fo-max) (-> gp-0 fo-curve)) ) ) ) ) ) (none) ) ;; definition for method 209 of type hal (defmethod channel-active? hal ((obj hal) (arg0 uint)) "Is the given [[gui-channel]] active?" (cond ((zero? arg0) (let ((t9-0 (method-of-type bot channel-active?))) (if (t9-0 obj (-> obj channel)) (return #t) ) ) (countdown (s5-0 3) (let ((v1-7 (handle->process (-> obj slave-handle s5-0)))) (when v1-7 (let ((t9-1 (method-of-type bot channel-active?))) (if (t9-1 (the-as bot v1-7) (-> v1-7 stack 580)) (return #t) ) ) ) ) ) #f ) (else ((method-of-type bot channel-active?) obj arg0) ) ) ) ;; definition for method 226 of type hal (defmethod hal-method-226 hal ((obj hal)) (countdown (s5-0 3) (let ((a0-2 (handle->process (-> obj slave-handle s5-0)))) (when a0-2 (if (not (send-event a0-2 'request 'slave-id s5-0)) (return #f) ) ) ) ) #t ) ;; definition for method 225 of type hal (defmethod hal-method-225 hal ((obj hal)) (countdown (v1-0 3) (if (handle->process (-> obj slave-handle v1-0)) (return #f) ) ) #t ) ;; definition for method 196 of type hal ;; WARN: Return type mismatch symbol vs none. (defmethod bot-method-196 hal ((obj hal)) (when (not (logtest? (-> obj bot-flags) (bot-flags too-far-fail))) (let ((t9-0 (method-of-type bot bot-method-196))) (t9-0 obj) ) (countdown (s5-0 3) (let ((a0-3 (handle->process (-> obj slave-handle s5-0)))) (if a0-3 (bot-method-196 (the-as bot a0-3)) ) ) ) ) (none) ) ;; definition for method 114 of type hal ;; WARN: Return type mismatch int vs none. (defmethod init-enemy-collision! hal ((obj hal)) "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum 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) (the-as penetrate -1)) (let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) (set-vector! (-> v1-7 local-sphere) 0.0 0.0 0.0 40.96) (set! (-> s5-0 total-prims) (the-as uint 1)) (set! (-> s5-0 root-prim) v1-7) ) (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) (let ((v1-10 (-> s5-0 root-prim))) (set! (-> s5-0 backup-collide-as) (-> v1-10 prim-core collide-as)) (set! (-> s5-0 backup-collide-with) (-> v1-10 prim-core collide-with)) ) (set! (-> obj root-override2) s5-0) ) 0 (none) ) ;; definition for method 210 of type hal ;; WARN: Return type mismatch int vs none. (defmethod init! hal ((obj hal)) "Set defaults for various fields." (let ((t9-0 (method-of-type bot init!))) (t9-0 obj) ) (set! (-> obj handle-failed-slave-id) -1) (countdown (v1-2 3) (set! (-> obj slave-handle v1-2) (the-as handle #f)) (nop!) ) 0 (none) ) ;; definition for method 115 of type hal ;; WARN: Return type mismatch int vs none. (defmethod init-enemy! hal ((obj hal)) "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" (init! obj) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-scenecamera" (the-as (pointer uint32) #f))) (the-as pair 0) ) (init-enemy-behaviour-and-stats! obj *hal-nav-enemy-info*) (let ((t9-4 (method-of-type bot init-enemy!))) (t9-4 obj) ) (set! (-> obj channel) (the-as uint 28)) (set! (-> obj spot-color) (the-as uint #x5000ffff)) (set! (-> obj notice-enemy-dist) 0.0) (logior! (-> obj focus-status) (focus-status disable)) (let ((v1-13 (-> obj root-override2 root-prim))) (set! (-> v1-13 prim-core collide-as) (collide-spec)) (set! (-> v1-13 prim-core collide-with) (collide-spec)) ) (set! (-> obj root-override2 backup-collide-as) (collide-spec)) (set! (-> obj root-override2 backup-collide-with) (collide-spec)) 0 (logior! (-> obj draw status) (draw-control-status no-draw)) (remove-process-drawable (-> obj nav state mesh) obj) (set! (-> obj nav) #f) (set! (-> obj nav-mesh-index) -1) 0 (none) ) ;; definition for method 205 of type hal (defmethod scene-play hal ((obj hal) (arg0 string) (arg1 symbol)) "Spawn a [[scene-player]] process for the given scene." (when (and (process-grab? obj #t) (or arg1 (process-grab? *target* #t))) (countdown (s3-0 3) (let ((a0-4 (handle->process (-> obj slave-handle s3-0)))) (if (and a0-4 (not (process-grab? a0-4 #t))) (return #f) ) ) ) (process-grab? obj #f) (if (not arg1) (process-grab? *target* #f) ) (countdown (s4-1 3) (let ((a0-10 (handle->process (-> obj slave-handle s4-1)))) (if a0-10 (process-grab? a0-10 #f) ) ) ) (set! (-> obj scene-player-handle) (ppointer->handle (process-spawn scene-player :init scene-player-init arg0 #t #f)) ) #t ) ) ;; definition for method 188 of type hal (defmethod scene-release? hal ((obj hal)) (when (not (handle->process (-> obj scene-player-handle))) (process-release? obj) (countdown (s5-0 3) (let ((a0-7 (handle->process (-> obj slave-handle s5-0)))) (if a0-7 (process-release? a0-7) ) ) ) #t ) ) ;; definition for method 74 of type hal ;; INFO: Used lq/sq ;; WARN: Return type mismatch none vs object. (defmethod general-event-handler hal ((obj hal) (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" (the-as object (case arg2 (('notify) (case (-> arg3 param 0) (('hit-by) (let* ((s4-0 arg0) (v1-2 (if (type? s4-0 bot) s4-0 ) ) ) (when v1-2 (when (= (-> (the-as process (-> arg3 param 1)) type) target) (logior! (-> obj bot-flags) (ash 1 (+ (-> (the-as bot v1-2) slave-id) 19))) (the-as object (stop-speech obj (the-as uint 0) #t)) ) ) ) ) (('mission-failed) (let* ((s4-1 arg0) (s5-1 (if (type? s4-1 bot) s4-1 ) ) ) (when s5-1 (when (not (logtest? (-> obj bot-flags) (bot-flags too-far-fail))) (when (not (logtest? (-> obj bot-flags) (bot-flags bf09))) (logior! (-> obj bot-flags) (bot-flags bf09)) (let ((a1-7 (new 'stack-no-clear 'fail-mission-params))) (set! (-> a1-7 flags) (fail-mission-flags famflags-5)) (set! (-> a1-7 message) (fail-mission-message fammsg-0)) (set! (-> a1-7 retry-continue) #f) (set! (-> a1-7 fail-continue) #f) (set! (-> a1-7 reset-delay) (the-as uint 1500)) (set! (-> a1-7 task) (game-task none)) (set! (-> a1-7 fail-message) (game-text-id null)) (if (start! *fail-mission-control* a1-7) (set! (-> obj handle-failed-slave-id) (-> (the-as bot s5-1) slave-id)) ) ) (set! (-> obj delay-too-far-check) -1) (stop-speech obj (the-as uint 0) #f) (countdown (s4-2 3) (send-event (handle->process (-> obj slave-handle s4-2)) 'notify 'mission-failed) ) ) (= (-> obj handle-failed-slave-id) (-> (the-as bot s5-1) slave-id)) ) ) ) ) (('follow-dir) (set! (-> obj follow-dir quad) (-> (the-as vector (-> arg3 param 1)) quad)) #t ) ) ) (('set-task) (let ((a1-10 (/ (the-as int (-> arg3 param 0)) 8))) (logior! (-> obj bot-task-bits) (ash 1 a1-10)) ) #t ) (('clear-task) (let ((a1-12 (/ (the-as int (-> arg3 param 0)) 8))) (logclear! (-> obj bot-task-bits) (ash 1 a1-12)) ) #t ) (('change-mode) (when (= (-> arg3 param 0) 'grab) (let ((v0-1 (the-as object (alive? obj)))) (if (and (the-as symbol v0-1) (-> arg3 param 1)) (logior! (-> obj focus-status) (focus-status grabbed)) ) v0-1 ) ) ) (('end-mode) (when (logtest? (-> obj focus-status) (focus-status grabbed)) (logclear! (-> obj focus-status) (focus-status grabbed)) #t ) ) (('skip) (the-as object (skip-waypoint obj)) ) (('move-trans) (move-to-point! (-> obj root-override2) (the-as vector (-> arg3 param 0))) #t ) (('die-fast) (cleanup-for-death obj) (go (method-of-object obj die-fast)) ) (('nav-mesh-kill) (remove-process-drawable (-> obj nav state mesh) obj) (set! (-> obj nav) #f) (set! (-> obj nav-mesh-index) -1) #t ) ) ) ) ;; definition for function hal-post (defbehavior hal-post hal () (when (not (logtest? (-> self bot-flags) (bot-flags bf09))) (let ((t9-0 (-> self waypoint on-update))) (if t9-0 (t9-0 self) ) ) ) (when (and (not (logtest? (-> self bot-flags) (bot-flags too-far-fail bf09))) (bot-check-too-far self)) (let ((gp-0 0)) (countdown (s5-0 3) (let ((s4-0 (enemy-method-120 self 3 gp-0))) (let ((a0-4 (handle->process (-> self slave-handle s4-0)))) (if (send-event a0-4 'request 'too-far-fail) (goto cfg-24) ) ) (set! gp-0 (logior gp-0 (ash 1 s4-0))) ) ) ) ) (label cfg-24) (if (not (logtest? (-> self bot-flags) (bot-flags bf09))) (ai-task-control-method-10 (-> self ai-ctrl) self) ) (if (logtest? *display-bot-marks* (bot-marks-controls bmc08)) (bot-debug-draw-spot-id self) ) (none) ) ;; definition for function hal-event-handler (defbehavior hal-event-handler hal ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) (general-event-handler self arg0 arg1 arg2 arg3) ) ;; failed to figure out what this is: (defstate idle (hal) :virtual #t :event hal-event-handler :enter (the-as (function none :behavior hal) nothing) :exit (the-as (function none :behavior hal) nothing) :trans (the-as (function none :behavior hal) nothing) :code (the-as (function none :behavior hal) sleep-code) :post hal-post )