From 318c76775c27f1d42f234fa012048a7df2ac23d8 Mon Sep 17 00:00:00 2001 From: Hat Kid <6624576+Hat-Kid@users.noreply.github.com> Date: Sat, 1 Apr 2023 00:17:47 +0200 Subject: [PATCH] decomp: `shuttle` (#2444) --- decompiler/config/jak2/all-types.gc | 81 +- .../ntsc_v1/anonymous_function_types.jsonc | 16 + decompiler/config/jak2/ntsc_v1/inputs.jsonc | 1 + .../config/jak2/ntsc_v1/label_types.jsonc | 6 +- .../jak2/ntsc_v1/stack_structures.jsonc | 6 + .../config/jak2/ntsc_v1/type_casts.jsonc | 62 +- .../underground_fighters/shuttle.gc | 1820 ++++++++++++++++ .../underground_fighters/shuttle_REF.gc | 1909 +++++++++++++++++ test/offline/config/jak2/config.jsonc | 1 + 9 files changed, 3854 insertions(+), 48 deletions(-) create mode 100644 test/decompiler/reference/jak2/characters/underground_fighters/shuttle_REF.gc diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index 29d65877b0..26ba6525f7 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -41734,47 +41734,6 @@ ;; ctyindb-obs ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; shuttle ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; (declare-type citizen nav-enemy) -;; (declare-type citizen-norm citizen) -;; (deftype citizen-rebel (citizen-norm) -;; ((nav-mesh-aid uint32 :offset-assert 1056) -;; (done? basic :offset-assert 1060) -;; (task-node uint16 :offset-assert 1064) -;; (end-pos vector :inline :offset-assert 1068) -;; (index uint32 :offset-assert 1084) -;; (gui-id uint32 :offset-assert 1088) -;; ) -;; :method-count-assert 219 -;; :size-assert #x448 -;; :flag-assert #xdb03d00448 -;; (:methods -;; ) -;; ) - -;; (deftype city-shuttle-info (structure) -;; ((pos vector :inline :offset-assert 0) -;; (level basic :offset-assert 16) -;; (nav-mesh-id uint32 :offset-assert 20) -;; (time time-frame :offset-assert 24) -;; ) -;; :method-count-assert 9 -;; :size-assert #x20 -;; :flag-assert #x900000020 -;; ) - -;; (define-extern *citizen-rebel-global-info* civilian-global-info) -;; (define-extern *citizen-rebel-nav-enemy-info* nav-enemy-info) -;; ;; (define-extern shuttle-init function) -;; ;; (define-extern shuttle-cleanup function) -;; ;; (define-extern shuttle-update function) -;; ;; (define-extern *city-shuttle-info* array) -;; ;; (define-extern *city-burning-bush-shuttle-1-info* array) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; fordumpa-texture ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -51426,6 +51385,46 @@ ) ) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; shuttle ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; this block was moved + +(deftype citizen-rebel (citizen-norm) + ((nav-mesh-aid actor-id :offset-assert 1060) + (done? symbol :offset-assert 1064) + (task-node uint16 :offset-assert 1068) + (end-pos vector :inline :offset-assert 1072) + (index uint32 :offset-assert 1088) + (gui-id uint32 :offset-assert 1092) + ) + :method-count-assert 219 + :size-assert #x448 + :flag-assert #xdb03d00448 + (:methods + ) + ) + +(deftype city-shuttle-info (structure) + ((pos vector :inline :offset-assert 0) + (level symbol :offset-assert 16) + (nav-mesh-id uint32 :offset-assert 20) + (time time-frame :offset-assert 24) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) + +(define-extern *citizen-rebel-global-info* civilian-global-info) +(define-extern *citizen-rebel-nav-enemy-info* nav-enemy-info) +(define-extern shuttle-init (function task-manager (array city-shuttle-info) none)) +(define-extern shuttle-cleanup (function task-manager none)) +(define-extern shuttle-update (function task-manager (array city-shuttle-info) uint none)) +(define-extern *city-shuttle-info* (array city-shuttle-info)) +(define-extern *city-burning-bush-shuttle-1-info* (array city-shuttle-info)) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; metalhead-predator ;; diff --git a/decompiler/config/jak2/ntsc_v1/anonymous_function_types.jsonc b/decompiler/config/jak2/ntsc_v1/anonymous_function_types.jsonc index e552428294..bc3523a7ef 100644 --- a/decompiler/config/jak2/ntsc_v1/anonymous_function_types.jsonc +++ b/decompiler/config/jak2/ntsc_v1/anonymous_function_types.jsonc @@ -1790,5 +1790,21 @@ [97, "(function grim-sewer none)"], [98, "(function grim-sewer none)"], [99, "(function object grim-sewer symbol)"] + ], + "shuttle": [ + [0, "(function none :behavior task-manager)"], + [1, "(function none :behavior task-manager)"], + [2, "(function none :behavior task-manager)"], + [3, "(function symbol :behavior task-manager)"], + [4, "(function none :behavior task-manager)"], + [5, "(function none :behavior task-manager)"], + [6, "(function citizen-rebel object symbol none :behavior task-manager)"], + [7, "(function none :behavior task-manager)"], + [8, "(function none :behavior task-manager)"], + [9, "(function none :behavior task-manager)"], + [10, "(function none :behavior task-manager)"], + [11, "(function none :behavior task-manager)"], + [12, "(function none :behavior task-manager)"], + [13, "(function citizen-rebel object symbol none :behavior task-manager)"] ] } diff --git a/decompiler/config/jak2/ntsc_v1/inputs.jsonc b/decompiler/config/jak2/ntsc_v1/inputs.jsonc index dac9dc1617..e518c577fa 100644 --- a/decompiler/config/jak2/ntsc_v1/inputs.jsonc +++ b/decompiler/config/jak2/ntsc_v1/inputs.jsonc @@ -512,6 +512,7 @@ "LRACELIT.DGO", "LSACK.DGO", "LSAMERGD.DGO", + "LSHUTTLE.DGO", "LSMYSBRT.DGO", "LTENTOB.DGO", "LTENTOUT.DGO", diff --git a/decompiler/config/jak2/ntsc_v1/label_types.jsonc b/decompiler/config/jak2/ntsc_v1/label_types.jsonc index fa7e1433f8..bb10569827 100644 --- a/decompiler/config/jak2/ntsc_v1/label_types.jsonc +++ b/decompiler/config/jak2/ntsc_v1/label_types.jsonc @@ -1895,5 +1895,9 @@ "mog2-course": [["L295", "uint64", true]], "jinx2-course": [["L306", "uint64", true]], "grim2-course": [["L283", "uint64", true]], - "vortex": [["L29", "vector"]] + "vortex": [["L29", "vector"]], + "shuttle": [ + ["L348", "vector"], + ["L337", "vector"] + ] } diff --git a/decompiler/config/jak2/ntsc_v1/stack_structures.jsonc b/decompiler/config/jak2/ntsc_v1/stack_structures.jsonc index 01a8a50276..1c1f4f556e 100644 --- a/decompiler/config/jak2/ntsc_v1/stack_structures.jsonc +++ b/decompiler/config/jak2/ntsc_v1/stack_structures.jsonc @@ -2233,5 +2233,11 @@ "rift-rider-travel-post": [ [160, "vector"], [176, "vector"] + ], + "(code exit-vehicle citizen-rebel)": [ + [96, "vector"], + [112, "vector"], + [128, "quaternion"], + [48, "quaternion"] ] } diff --git a/decompiler/config/jak2/ntsc_v1/type_casts.jsonc b/decompiler/config/jak2/ntsc_v1/type_casts.jsonc index a089686a16..4a5dfd609a 100644 --- a/decompiler/config/jak2/ntsc_v1/type_casts.jsonc +++ b/decompiler/config/jak2/ntsc_v1/type_casts.jsonc @@ -11016,9 +11016,7 @@ [[79, 86], "a0", "(pointer uint32)"], [[87, 94], "a0", "(pointer vif-tag)"] ], - "init-vortex-polys": [ - [[34, 40], "t0", "(pointer float)"] - ], + "init-vortex-polys": [[[34, 40], "t0", "(pointer float)"]], "draw-vortex": [ [[31, 38], "a0", "dma-packet"], [[40, 47], "a0", "gs-gif-tag"], @@ -11063,8 +11061,60 @@ [352, "a0", "(array object)"], [384, "a0", "(array object)"], [386, "a0", "(array object)"] - - - + ], + "(code wait citizen-rebel)": [ + [101, "v1", "art-joint-anim"], + [150, "v1", "art-joint-anim"] + ], + "(code wait-for-ride citizen-rebel)": [ + [101, "v1", "art-joint-anim"], + [150, "v1", "art-joint-anim"] + ], + "(trans wait-for-ride citizen-rebel)": [[13, "v1", "vehicle"]], + "(code exit-vehicle citizen-rebel)": [ + [11, "a0", "vehicle"], + [14, "a0", "vehicle"], + [143, "s3", "vehicle"], + [146, "s3", "vehicle"], + [229, "s4", "vehicle"], + [232, "s4", "vehicle"], + [249, "s4", "vehicle"], + [253, "a0", "vehicle"], + [271, "v1", "vehicle"], + [325, "a0", "vehicle"], + [329, "a0", "vehicle"], + [39, "s4", "vehicle"], + [42, "s4", "vehicle"], + [47, "s4", "vehicle"], + [70, "a0", "vehicle"], + [74, "a0", "vehicle"], + [151, "s3", "vehicle"], + [251, "s4", "vehicle"] + ], + "(code get-up-back citizen-rebel)": [[20, "v1", "art-joint-anim"]], + "(code get-up-front citizen-rebel)": [[20, "v1", "art-joint-anim"]], + "shuttle-update": [ + [604, "s2", "citizen-rebel"], + [614, "s2", "citizen-rebel"], + [642, "s2", "citizen-rebel"], + [648, "s2", "citizen-rebel"], + [682, "s2", "citizen-rebel"], + [686, "s2", "citizen-rebel"], + [741, "s4", "vehicle"], + [744, "s4", "vehicle"], + [746, "s2", "citizen-rebel"], + [753, "s4", "vehicle"], + [773, "s4", "vehicle"], + [775, "s2", "citizen-rebel"], + [834, "s2", "citizen-rebel"], + [802, "s2", "citizen-rebel"], + [958, "v0", "citizen-rebel"], + [966, "v0", "citizen-rebel"], + [[980, 1001], "v0", "citizen-rebel"], + [1046, "s4", "process-drawable"], + [1074, "s4", "process-focusable"], + [1081, "s2", "process-drawable"], + [1094, "s2", "process-drawable"], + [1126, "s4", "citizen-rebel"] ] } diff --git a/goal_src/jak2/characters/underground_fighters/shuttle.gc b/goal_src/jak2/characters/underground_fighters/shuttle.gc index a353657187..3fed939bcd 100644 --- a/goal_src/jak2/characters/underground_fighters/shuttle.gc +++ b/goal_src/jak2/characters/underground_fighters/shuttle.gc @@ -7,3 +7,1823 @@ ;; DECOMP BEGINS +(defmethod draw hud-citizen ((obj hud-citizen)) + (set-hud-piece-position! + (the-as hud-sprite (-> obj sprites)) + (the int (+ 452.0 (* 130.0 (-> obj offset)))) + 195 + ) + (format (clear (-> obj strings 0 text)) "~D" (-> obj values 0 current)) + (set-as-offset-from! (the-as hud-sprite (-> obj strings 0 pos)) (the-as vector4w (-> obj sprites)) -15 47) + ((method-of-type hud draw) obj) + 0 + (none) + ) + +(defmethod update-values hud-citizen ((obj hud-citizen)) + (set! (-> obj values 0 target) (the int (-> *game-info* counter))) + ((method-of-type hud update-values) obj) + 0 + (none) + ) + +(defmethod init-callback hud-citizen ((obj hud-citizen)) + (set! (-> obj level) (level-get *level* 'ctywide)) + (set! (-> obj gui-id) + (add-process *gui-control* obj (gui-channel hud-middle-right) (gui-action hidden) (-> obj name) 81920.0 0) + ) + (logior! (-> obj flags) (hud-flags show)) + (set! (-> obj sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x4 :page #x679))) + (set! (-> obj sprites 0 flags) (the-as uint 4)) + (set! (-> obj sprites 0 scale-x) 0.9) + (set! (-> obj sprites 0 scale-y) 0.9) + (alloc-string-if-needed obj 0) + (set! (-> obj strings 0 scale) 0.6) + (set! (-> obj strings 0 flags) (font-flags kerning middle large)) + 0 + (none) + ) + +(defskelgroup skel-citizen-rebel citizen-rebel citizen-rebel-lod0-jg -1 + ((citizen-rebel-lod0-mg (meters 999999))) + :bounds (static-spherem 0 2 0 3) + :shadow citizen-rebel-shadow-mg + ) + +(define *citizen-rebel-global-info* + (new 'static 'civilian-global-info + :knocked (new 'static 'array int32 2 21 23) + :knocked-land (new 'static 'array int32 2 22 24) + :yellow-hit-anim (new 'static 'inline-array civilian-anim-info 1 + (new 'static 'civilian-anim-info :anim-index (new 'static 'array int32 2 21 23)) + ) + :blue-hit-anim (new 'static 'inline-array civilian-anim-info 3 + (new 'static 'civilian-anim-info :anim-index (new 'static 'array int32 2 27 27)) + (new 'static 'civilian-anim-info :anim-index (new 'static 'array int32 2 27 27)) + (new 'static 'civilian-anim-info :anim-index (new 'static 'array int32 2 27 27)) + ) + :anim-cover-head-start 29 + :anim-cover-head-loop 30 + :anim-cover-head-end 31 + :car-stance-anim 34 + :bike-stance-anim 33 + :get-in-car-anim 35 + :seat-flag #x2 + ) + ) + +(define *citizen-rebel-nav-enemy-info* + (new 'static 'nav-enemy-info + :use-die-falling #t + :use-victory #f + :use-jump-blocked #f + :debug-draw-neck #f + :jump-debug-draw #f + :move-to-ground #t + :hover-if-no-ground #f + :idle-anim-script (new 'static 'array idle-control-frame 4 + (new 'static 'idle-control-frame :command (ic-cmd play) :anim #x3 :param0 #x1 :param1 #x1) + (new 'static 'idle-control-frame) + (new 'static 'idle-control-frame) + (new 'static 'idle-control-frame) + ) + :idle-anim 3 + :notice-anim 3 + :hostile-anim -1 + :hit-anim 3 + :knocked-anim 21 + :knocked-land-anim 22 + :die-anim 3 + :die-falling-anim 3 + :victory-anim 3 + :jump-wind-up-anim 11 + :jump-in-air-anim 11 + :jump-land-anim 11 + :neck-joint 5 + :look-at-joint 5 + :bullseye-joint 4 + :notice-distance (meters 10) + :notice-distance-delta (meters 0.1) + :default-hit-points 1 + :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 2730.6667 + :knocked-soft-vxz-lo 32768.0 + :knocked-soft-vxz-hi 49152.0 + :knocked-soft-vy-lo 36864.0 + :knocked-soft-vy-hi 73728.0 + :knocked-medium-vxz-lo 81920.0 + :knocked-medium-vxz-hi 143360.0 + :knocked-medium-vy-lo 49152.0 + :knocked-medium-vy-hi 102400.0 + :knocked-hard-vxz-lo 102400.0 + :knocked-hard-vxz-hi 122880.0 + :knocked-hard-vy-lo 81920.0 + :knocked-hard-vy-hi 102400.0 + :knocked-huge-vxz-lo 164659.2 + :knocked-huge-vxz-hi 249036.8 + :knocked-huge-vy-lo 183500.8 + :knocked-huge-vy-hi 217907.2 + :knocked-yellow-vxz-lo 16384.0 + :knocked-yellow-vxz-hi 32768.0 + :knocked-yellow-vy-lo 24576.0 + :knocked-yellow-vy-hi 49152.0 + :knocked-red-vxz-lo 40960.0 + :knocked-red-vxz-hi 61440.0 + :knocked-red-vy-lo 36864.0 + :knocked-red-vy-hi 73728.0 + :knocked-blue-vxz-lo 32768.0 + :knocked-blue-vxz-hi 65536.0 + :knocked-blue-vy-lo 32768.0 + :knocked-blue-vy-hi 49152.0 + :shadow-size (meters 2) + :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 #t + :use-frustration #t + :use-stop-chase #f + :use-circling #f + :use-pacing #f + :walk-anim 11 + :turn-anim 11 + :run-anim 14 + :taunt-anim -1 + :run-travel-speed (meters 12) + :run-acceleration (meters 2) + :run-turning-acceleration (meters 30) + :walk-travel-speed (meters 3) + :walk-acceleration (meters 2) + :walk-turning-acceleration (meters 8) + :maximum-rotation-rate (degrees 720.0) + :notice-nav-radius (meters 10) + :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! (-> *citizen-rebel-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) + +(deftype citizen-rebel (citizen-norm) + ((nav-mesh-aid actor-id :offset-assert 1060) + (done? symbol :offset-assert 1064) + (task-node uint16 :offset-assert 1068) + (end-pos vector :inline :offset-assert 1072) + (index uint32 :offset-assert 1088) + (gui-id uint32 :offset-assert 1092) + ) + :heap-base #x3d0 + :method-count-assert 219 + :size-assert #x448 + :flag-assert #xdb03d00448 + ) + + +(defmethod cleanup-for-death citizen-rebel ((obj citizen-rebel)) + (with-pp + (when (and (zero? (-> obj hit-points)) (not (-> obj done?))) + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) (process->ppointer pp)) + (set! (-> a1-0 num-params) 0) + (set! (-> a1-0 message) 'fail) + (let ((t9-0 send-event-function) + (v1-9 (-> *game-info* sub-task-list (-> obj task-node))) + ) + (t9-0 + (handle->process (if (-> v1-9 info) + (-> v1-9 info manager) + (the-as handle #f) + ) + ) + a1-0 + ) + ) + ) + ) + ((method-of-type citizen-norm cleanup-for-death) obj) + (none) + ) + ) + +(defstate get-up-front (citizen-rebel) + :virtual #t + :code (behavior () + (ja-channel-push! 1 (seconds 0.2)) + (ja-no-eval :group! (-> self draw art-group data (-> self anim-get-up-front)) + :num! (seek! + (the float + (+ (-> (the-as art-joint-anim (-> self draw art-group data (-> self anim-get-up-front))) frames num-frames) + -1 + ) + ) + (-> self speed-scale) + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max (-> self speed-scale))) + ) + (if (-> self done?) + (go-virtual active) + (go-virtual wait-for-ride) + ) + (none) + ) + ) + +(defstate get-up-back (citizen-rebel) + :virtual #t + :code (behavior () + (ja-channel-push! 1 (seconds 0.2)) + (ja-no-eval :group! (-> self draw art-group data (-> self anim-get-up-back)) + :num! (seek! + (the float + (+ (-> (the-as art-joint-anim (-> self draw art-group data (-> self anim-get-up-back))) frames num-frames) -1) + ) + (-> self speed-scale) + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max (-> self speed-scale))) + ) + (if (-> self done?) + (go-virtual active) + (go-virtual wait-for-ride) + ) + (none) + ) + ) + +(defstate knocked (citizen-rebel) + :virtual #t + :enter (behavior () + (let ((gp-0 (find-nearest-nav-mesh (-> self root-override2 trans) (the-as float #x7f800000)))) + (change-to gp-0 self) + (if (not (-> self nav)) + (go-inactive self) + ) + (set! (-> self nav-mesh-aid) (the-as actor-id (-> gp-0 entity aid))) + ) + (let ((v1-10 (-> self nav state))) + (set! (-> v1-10 current-poly) (the-as nav-poly #f)) + ) + 0 + (do-navigation-to-destination (-> self nav state) (-> self root-override2 trans)) + (set! (-> self gnd-height) (-> self root-override2 gspot-pos y)) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (gp-1 (new 'stack-no-clear 'quaternion)) + ) + (vector-y-quaternion! s5-0 (-> self root-override2 quat)) + (vector-normalize! s5-0 1.0) + (quaternion-from-two-vectors! gp-1 s5-0 *up-vector*) + (quaternion*! (-> self root-override2 quat) gp-1 (-> self root-override2 quat)) + ) + (let ((t9-8 (-> (method-of-type civilian knocked) enter))) + (if t9-8 + (t9-8) + ) + ) + (none) + ) + ) + +(defstate exit-vehicle (citizen-rebel) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior citizen-rebel) enemy-event-handler) + :enter (behavior ((arg0 object) (arg1 object) (arg2 int) (arg3 symbol) (arg4 event-message-block)) + (let ((a0-2 (find-nearest-nav-mesh (-> self root-override2 trans) (the-as float #x7f800000)))) + (if a0-2 + (set! (-> self nav-mesh-aid) (the-as actor-id (-> a0-2 entity aid))) + ) + (change-to a0-2 self) + ) + (when (not (-> self nav)) + (format #t "nav mesh not found~%") + (go-inactive self) + ) + (let ((v1-11 (-> self nav state))) + (set! (-> v1-11 current-poly) (the-as nav-poly #f)) + ) + 0 + (citizen-method-195 + self + (vector-negate-in-place! (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root-override2 quat))) + ) + (let ((a0-9 (-> self nav state)) + (v1-17 (-> self controller turn-exit-point)) + ) + (logclear! (-> a0-9 flags) (nav-state-flag directional-mode)) + (logior! (-> a0-9 flags) (nav-state-flag target-poly-dirty)) + (set! (-> a0-9 target-post quad) (-> v1-17 quad)) + ) + 0 + (citizen-nav-init! self) + (set! (-> self gnd-height) (-> self root-override2 gspot-pos y)) + (logior! (-> self flags) (citizen-flag persistent)) + (set! (-> self focus-status) (logior (focus-status pilot-riding pilot) (-> self focus-status))) + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-31 (-> self root-override2 root-prim))) + (set! (-> v1-31 prim-core collide-as) (collide-spec)) + (set! (-> v1-31 prim-core collide-with) (collide-spec)) + ) + 0 + (let ((v1-33 self)) + (set! (-> v1-33 enemy-flags) (the-as enemy-flag (logclear (-> v1-33 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-33 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (let ((v1-36 self)) + (set! (-> v1-36 enemy-flags) (the-as enemy-flag (logclear (-> v1-36 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (none) + ) + :exit (behavior () + (let ((t9-0 (-> (method-of-type civilian exit-vehicle) exit))) + (if t9-0 + (t9-0) + ) + ) + (none) + ) + :code (behavior ((arg0 object) (arg1 object) (arg2 int) (arg3 symbol) (arg4 event-message-block)) + (local-vars (sv-176 float) (sv-192 float) (sv-208 float)) + (remove-rider (the-as vehicle (handle->process (-> self vehicle))) self) + (logclear! (-> self focus-status) (focus-status pilot-riding pilot)) + (let ((gp-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'quaternion)) + ) + (set! (-> self state-time) (-> self clock frame-counter)) + (while (not (civilian-method-217 self gp-0)) + (let ((s4-0 (handle->process (-> self vehicle))) + (s3-0 (new 'stack-no-clear 'quaternion)) + ) + (quaternion-copy! s3-0 (-> (the-as vehicle s4-0) root-override-2 quat)) + (compute-seat-position (the-as vehicle s4-0) (-> self root-override2 trans) (-> self seat)) + (quaternion-copy! (-> self root-override2 quat) s3-0) + ) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (put-rider-in-seat (the-as vehicle (handle->process (-> self vehicle))) (-> self seat) self) + (go-virtual ride) + ) + (suspend) + ) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data (-> self info get-in-car-anim)) + :num! (seek! (ja-aframe 5.0 0) 0.5) + :frame-num (ja-aframe 12.0 0) + ) + (until (ja-done? 0) + (let ((s3-1 (handle->process (-> self vehicle))) + (s4-2 (new 'stack-no-clear 'quaternion)) + ) + (quaternion-copy! s4-2 (-> (the-as vehicle s3-1) root-override-2 quat)) + (compute-seat-position (the-as vehicle s3-1) (-> self root-override2 trans) (-> self seat)) + (let ((s3-2 lerp-scale) + (s2-0 0.0) + (s1-0 1.0) + (s0-0 (ja-aframe-num 0)) + ) + (set! sv-176 (ja-aframe 10.0 0)) + (let* ((t0-1 (ja-aframe 7.0 0)) + (f0-4 (s3-2 s2-0 s1-0 s0-0 sv-176 t0-1)) + ) + (quaternion-rotate-local-y! (-> self root-override2 quat) s4-2 (* f0-4 (if (zero? (-> self seat)) + -16384.0 + 16384.0 + ) + ) + ) + ) + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 5.0 0) 0.5)) + ) + (let ((s4-4 (handle->process (-> self vehicle)))) + (let ((s3-3 (new 'stack-no-clear 'quaternion))) + (quaternion-copy! s3-3 (-> (the-as vehicle s4-4) root-override-2 quat)) + (compute-seat-position (the-as vehicle s4-4) (-> self root-override2 trans) (-> self seat)) + (quaternion-rotate-local-y! (-> self root-override2 quat) s3-3 (if (zero? (-> self seat)) + -16384.0 + 16384.0 + ) + ) + ) + (remove-rider (the-as vehicle s4-4) self) + ) + (logclear! (-> self focus-status) (focus-status pilot-riding pilot)) + (let ((v1-65 (handle->process (-> self vehicle)))) + (quaternion-copy! s5-0 (-> (the-as vehicle v1-65) root-override-2 quat)) + ) + (ja-no-eval :group! (-> self draw art-group data (-> self info get-in-car-anim)) + :num! (seek! (ja-aframe 1.0 0) 0.5) + :frame-num (ja-aframe 5.0 0) + ) + (until (ja-done? 0) + (let ((a0-60 (handle->process (-> self vehicle))) + (s2-1 (new 'stack-no-clear 'vector)) + (s4-6 (new 'stack-no-clear 'vector)) + (s3-4 (new 'stack-no-clear 'quaternion)) + ) + (compute-seat-position (the-as vehicle a0-60) s2-1 (-> self seat)) + (vector-! s4-6 s2-1 gp-0) + (let ((s2-2 lerp-scale) + (s1-1 0.0) + (s0-1 1.0) + ) + (set! sv-192 (ja-aframe-num 0)) + (set! sv-208 (ja-aframe 5.0 0)) + (let* ((t0-2 (ja-aframe 1.0 0)) + (f0-13 (s2-2 s1-1 s0-1 sv-192 sv-208 t0-2)) + (f30-0 (- 1.0 f0-13)) + ) + (quaternion-rotate-local-y! s3-4 s5-0 (if (zero? (-> self seat)) + -16384.0 + 16384.0 + ) + ) + (let ((a1-40 (vector-y-quaternion! (new 'stack-no-clear 'vector) s3-4)) + (s2-3 (new 'stack-no-clear 'quaternion)) + ) + (quaternion-from-two-vectors! s2-3 a1-40 *up-vector*) + (quaternion*! s3-4 s2-3 s3-4) + ) + (quaternion-copy! (-> self root-override2 quat) s3-4) + (vector+float*! (-> self root-override2 trans) gp-0 s4-6 f30-0) + ) + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 1.0 0) 0.5)) + ) + ) + (let ((v1-96 (-> self root-override2 root-prim))) + (set! (-> v1-96 prim-core collide-as) (-> self root-override2 backup-collide-as)) + (set! (-> v1-96 prim-core collide-with) (-> self root-override2 backup-collide-with)) + ) + (go-virtual wait-for-ride) + (none) + ) + ) + +(defstate wait-for-ride (citizen-rebel) + :virtual #t + :trans (behavior () + (when (-> self vehicle) + (case (-> (the-as vehicle (handle->process (-> self vehicle))) info-override object-type) + ((14 15 16) + (go-virtual move-to-vehicle) + ) + ) + ) + (when (< (vector-vector-xz-distance (-> self root-override2 trans) (-> self end-pos)) 122880.0) + (when (not (-> self done?)) + (set! (-> self done?) #t) + (let ((a1-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-4 from) (process->ppointer self)) + (set! (-> a1-4 num-params) 0) + (set! (-> a1-4 message) 'task-done) + (let ((t9-2 send-event-function) + (v1-22 (-> *game-info* sub-task-list (-> self task-node))) + ) + (t9-2 + (handle->process (if (-> v1-22 info) + (-> v1-22 info manager) + (the-as handle #f) + ) + ) + a1-4 + ) + ) + ) + ) + (go-virtual active) + ) + (none) + ) + :code (behavior () + (until #f + (let ((f30-1 (/ 1.0 (rand-vu-float-range 10.0 13.0))) + (gp-0 (rand-vu-int-range 1 5)) + (s5-0 (rand-vu-int-count 2)) + ) + (ja-channel-push! 1 (seconds 0.2)) + (if (zero? s5-0) + (ja-no-eval :group! (-> self draw art-group data 4) :num! min) + (ja-no-eval :group! (-> self draw art-group data 6) :num! min) + ) + (let ((f28-0 0.0)) + (while (< f28-0 1.0) + (ja :num-func num-func-identity + :frame-num (lerp-scale 0.0 2.0 (+ (* -2.0 f28-0 f28-0 f28-0) (* 3.0 f28-0 f28-0)) 0.0 1.0) + ) + (suspend) + (+! f28-0 (-> self clock seconds-per-frame)) + ) + ) + (ja-channel-push! 1 (seconds 0.1)) + (while (> gp-0 0) + (+! gp-0 -1) + (cond + ((zero? s5-0) + (ja-no-eval :group! (-> self draw art-group data 5) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 5)) frames num-frames) -1)) + f30-1 + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max f30-1)) + ) + ) + (else + (ja-no-eval :group! (-> self draw art-group data 7) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 7)) frames num-frames) -1)) + f30-1 + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max f30-1)) + ) + ) + ) + ) + ) + ) + #f + (none) + ) + ) + +(defstate in-ditch (citizen-rebel) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type civilian in-ditch) enter))) + (if t9-0 + (t9-0) + ) + ) + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) (process->ppointer self)) + (set! (-> a1-0 num-params) 0) + (set! (-> a1-0 message) 'fail) + (let ((t9-1 send-event-function) + (v1-9 (-> *game-info* sub-task-list (-> self task-node))) + ) + (t9-1 + (handle->process (if (-> v1-9 info) + (-> v1-9 info manager) + (the-as handle #f) + ) + ) + a1-0 + ) + ) + ) + (none) + ) + ) + +;; WARN: disable def twice: 51. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +(defmethod general-event-handler citizen-rebel ((obj citizen-rebel) (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 'hit-flinch 'hit-knocked) + (when (nonzero? (-> obj gui-id)) + (set-action! + *gui-control* + (gui-action stop) + (the-as sound-id (-> obj gui-id)) + (gui-channel none) + (gui-action none) + (the-as string #f) + (the-as (function gui-connection symbol) #f) + (the-as process #f) + ) + (set! (-> obj gui-id) (the-as uint 0)) + 0 + ) + ((method-of-type civilian general-event-handler) obj arg0 arg1 arg2 arg3) + ) + (('play-speech) + (let ((s5-1 (-> arg3 param 0))) + (when (= (get-status *gui-control* (the-as sound-id (-> obj gui-id))) (gui-status unknown)) + (let ((v0-1 (the-as + object + (add-process *gui-control* obj (gui-channel citizen) (gui-action play) (the-as string s5-1) -99.0 0) + ) + ) + ) + (set! (-> obj gui-id) (the-as uint v0-1)) + v0-1 + ) + ) + ) + ) + (('nav-mesh-kill) + (format 0 "nav-mesh-kill event recieved by ~s~%" (-> obj name)) + (set! (-> obj nav-mesh-aid) (the-as actor-id (-> obj nav state mesh entity aid))) + (change-to *default-nav-mesh* obj) + #t + ) + (else + ((method-of-type citizen general-event-handler) obj arg0 arg1 arg2 arg3) + ) + ) + ) + +(defmethod enemy-method-58 citizen-rebel ((obj citizen-rebel) (arg0 process) (arg1 event-message-block)) + (let* ((t9-0 (method-of-type nav-enemy enemy-method-58)) + (v0-0 (t9-0 obj arg0 arg1)) + ) + (if (logtest? #x4000000 (-> obj incoming penetrate-using)) + (set! v0-0 #f) + ) + v0-0 + ) + ) + +(defmethod get-penetrate-info citizen-rebel ((obj citizen-rebel)) + "@returns the allowed way(s) this enemy can take damage +@see [[penetrate]] and [[penetrated-by-all&hit-points->penetrated-by]]" + (let ((v1-1 ((method-of-type nav-enemy get-penetrate-info) obj))) + (logior (penetrate enemy-yellow-shot) v1-1) + ) + ) + +(defstate wait (citizen-rebel) + :virtual #t + :trans (behavior () + '() + (none) + ) + :code (behavior () + (until #f + (let ((f30-1 (/ 1.0 (rand-vu-float-range 10.0 13.0))) + (gp-0 (rand-vu-int-range 1 5)) + (s5-0 (rand-vu-int-count 2)) + ) + (ja-channel-push! 1 (seconds 0.2)) + (if (zero? s5-0) + (ja-no-eval :group! (-> self draw art-group data 4) :num! min) + (ja-no-eval :group! (-> self draw art-group data 6) :num! min) + ) + (let ((f28-0 0.0)) + (while (< f28-0 1.0) + (ja :num-func num-func-identity + :frame-num (lerp-scale 0.0 2.0 (+ (* -2.0 f28-0 f28-0 f28-0) (* 3.0 f28-0 f28-0)) 0.0 1.0) + ) + (suspend) + (+! f28-0 (-> self clock seconds-per-frame)) + ) + ) + (ja-channel-push! 1 (seconds 0.1)) + (while (> gp-0 0) + (+! gp-0 -1) + (cond + ((zero? s5-0) + (ja-no-eval :group! (-> self draw art-group data 5) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 5)) frames num-frames) -1)) + f30-1 + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max f30-1)) + ) + ) + (else + (ja-no-eval :group! (-> self draw art-group data 7) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 7)) frames num-frames) -1)) + f30-1 + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max f30-1)) + ) + ) + ) + ) + ) + (if (-> self wait-return-state) + (go (-> self wait-return-state)) + ) + ) + #f + (none) + ) + ) + +(defmethod init-enemy! citizen-rebel ((obj citizen-rebel)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-citizen-rebel" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (init-enemy-behaviour-and-stats! obj *citizen-rebel-nav-enemy-info*) + (let ((v1-5 (-> obj nav))) + (set! (-> v1-5 speed-scale) 1.0) + ) + 0 + (set! (-> obj draw lod-set lod 0 dist) 491520.0) + (try-update-focus (-> obj focus) *target* obj) + (-> obj neck) + (set! (-> obj info) *citizen-rebel-global-info*) + (set! (-> obj anim-shuffle) 10) + (let ((v1-16 (get-rand-int obj 3))) + (cond + ((zero? v1-16) + (set! (-> obj anim-walk) 11) + (set! (-> obj dist-walk-anim) 8736.768) + (set! (-> obj speed-walk) 10240.0) + ) + ((= v1-16 1) + (set! (-> obj anim-walk) 12) + (set! (-> obj dist-walk-anim) 13107.2) + (set! (-> obj speed-walk) 12288.0) + ) + ((= v1-16 2) + (set! (-> obj anim-walk) 13) + (set! (-> obj dist-walk-anim) 4370.432) + (set! (-> obj speed-walk) 4096.0) + ) + ) + ) + (let ((v1-31 (get-rand-int obj 3))) + (cond + ((zero? v1-31) + (set! (-> obj anim-panic-run) 17) + ) + ((= v1-31 1) + (set! (-> obj anim-panic-run) 18) + ) + ((= v1-31 2) + (set! (-> obj anim-panic-run) 14) + ) + ) + ) + (set! (-> obj dist-run-anim) 28672.0) + (let ((v1-38 (get-rand-int obj 3))) + (cond + ((zero? v1-38) + (set! (-> obj anim-run) 14) + ) + ((= v1-38 1) + (set! (-> obj anim-run) 15) + ) + ((= v1-38 2) + (set! (-> obj anim-run) 16) + ) + ) + ) + (set! (-> obj speed-run) 49152.0) + (set! (-> obj anim-on-ground) 20) + (set! (-> obj anim-dive) 19) + (set! (-> obj anim-get-up-front) 25) + (set! (-> obj anim-get-up-back) 26) + (let ((f30-0 (get-rand-float-range obj 1.0 1.25)) + (f0-10 (get-rand-float-range obj 1.0 1.25)) + ) + (set-vector! (-> obj root-override2 scale) f0-10 f30-0 f0-10 1.0) + ) + (let ((f0-12 (get-rand-float-range obj 0.9 1.0))) + (set-vector! (-> obj draw color-mult) f0-12 f0-12 f0-12 1.0) + ) + (set! (-> obj water-anim) 32) + (set! (-> obj water) (new 'process 'water-control obj 5 0.0 8192.0 2048.0)) + (set! (-> obj water flags) (water-flags active part-splash part-rings part-water)) + (set! (-> obj water height) (res-lump-float (-> obj entity) 'water-height)) + (set! (-> obj water ripple-size) 12288.0) + 0 + (none) + ) + +(defmethod init-enemy-collision! citizen-rebel ((obj citizen-rebel)) + "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 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 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec civilian)) + (set! (-> s4-0 prim-core collide-with) + (collide-spec backgnd jak civilian enemy 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 8192.0 0.0 12288.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 civilian)) + (set! (-> v1-13 prim-core collide-with) + (collide-spec backgnd jak civilian enemy hit-by-others-list player-list) + ) + (set! (-> v1-13 prim-core action) (collide-action solid)) + (set-vector! (-> v1-13 local-sphere) 0.0 4096.0 0.0 4096.0) + ) + (let ((v1-15 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-15 prim-core collide-as) (collide-spec civilian)) + (set! (-> v1-15 prim-core collide-with) + (collide-spec backgnd jak civilian enemy hit-by-others-list player-list) + ) + (set! (-> v1-15 prim-core action) (collide-action solid no-standon)) + (set-vector! (-> v1-15 local-sphere) 0.0 9830.4 0.0 4096.0) + ) + (set! (-> s5-0 nav-radius) 7372.8) + (let ((v1-17 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-17 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-17 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 3)) + (set! (-> obj root-override2) s5-0) + ) + 0 + (none) + ) + +(defmethod citizen-init! citizen-rebel ((obj citizen-rebel)) + "Initialize [[citizen]] defaults." + (let ((t9-0 (method-of-type civilian citizen-init!))) + (t9-0 obj) + ) + (set! (-> obj dive-reaction) (+ 0.09 (* 0.15 (rand-vu)))) + (logclear! (-> obj mask) (process-mask enemy)) + (setup-masks (-> obj draw) 0 -1) + (setup-masks (-> obj draw) 4 0) + (setup-masks (-> obj draw) 16 0) + (setup-masks (-> obj draw) 64 0) + (let ((v1-14 (get-rand-int obj 3))) + (cond + ((zero? v1-14) + (setup-masks (-> obj draw) 2 0) + ) + ((= v1-14 1) + (setup-masks (-> obj draw) 8 0) + ) + ((= v1-14 2) + (setup-masks (-> obj draw) 128 0) + ) + ) + ) + (let ((v1-23 (get-rand-int obj 2))) + (cond + ((zero? v1-23) + (setup-masks (-> obj draw) 32 0) + ) + ((= v1-23 1) + (setup-masks (-> obj draw) 256 0) + ) + ) + ) + (let ((v1-29 (-> obj nav))) + (set! (-> v1-29 sphere-mask) (the-as uint #x800fe)) + ) + 0 + 0 + (none) + ) + +(deftype city-shuttle-info (structure) + ((pos vector :inline :offset-assert 0) + (level symbol :offset-assert 16) + (nav-mesh-id uint32 :offset-assert 20) + (time time-frame :offset-assert 24) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) + + +;; WARN: Return type mismatch float vs none. +(defun shuttle-init ((arg0 task-manager) (arg1 (array city-shuttle-info))) + (set-setting! 'minimap 'clear 0 32) + (let ((s3-0 *traffic-manager*) + (s4-0 (new 'stack 'traffic-object-spawn-params)) + ) + (set! (-> s4-0 position quad) (-> arg0 begin-pos quad)) + (quaternion-axis-angle! (-> s4-0 rotation) 0.0 1.0 0.0 0.0) + (set! (-> s4-0 object-type) (traffic-type cara)) + (set! (-> s4-0 behavior) (the-as uint 0)) + (set! (-> s4-0 id) (the-as uint 0)) + (set! (-> s4-0 proc) #f) + (send-event s3-0 'spawn-object s4-0) + (if (not (-> s4-0 proc)) + (format #t "traffic object spawn failed~%") + ) + (if (-> s4-0 proc) + (set! (-> arg0 slave 12) (process->handle (-> s4-0 proc))) + ) + ) + (let ((s4-1 (new 'stack-no-clear 'task-arrow-params))) + (set! (-> s4-1 pos quad) (-> arg1 0 pos quad)) + (quaternion-identity! (-> s4-1 quat)) + (set! (-> s4-1 flags) (task-arrow-flags)) + (set! (-> s4-1 map-icon) (the-as uint 15)) + (set! (-> arg0 arrow) (process->handle (task-arrow-spawn s4-1 (the-as task-arrow arg0)))) + ) + (set-parking-spot-prob *traffic-engine* 11 0.08) + (set-parking-spot-prob *traffic-engine* 12 0.08) + (set-parking-spot-prob *traffic-engine* 13 0.08) + (set-parking-spot-prob *traffic-engine* 14 0.35) + (set-parking-spot-prob *traffic-engine* 15 0.35) + (set-parking-spot-prob *traffic-engine* 16 0.08) + (set! (-> arg0 start-time) 0) + (set! (-> arg0 sub-state) (the-as uint 0)) + (set! (-> arg0 count) (-> arg1 length)) + (dotimes (v1-35 (-> arg0 count)) + (set! (-> arg0 data-int32 v1-35) 0) + ) + (set! (-> arg0 data-int32 8) 0) + (set! (-> arg0 data-int32 9) 0) + (set! (-> arg0 data-int32 10) 0) + (set! (-> *game-info* counter) (the float (/ (-> arg0 count) 2))) + (none) + ) + +;; WARN: Return type mismatch symbol vs none. +(defun shuttle-cleanup ((arg0 task-manager)) + (send-event *traffic-manager* 'restore-default-settings) + (dotimes (s5-0 (-> arg0 count)) + (let ((a0-4 (handle->process (-> arg0 slave s5-0)))) + (if a0-4 + (deactivate a0-4) + ) + ) + ) + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defun shuttle-update ((arg0 task-manager) (arg1 (array city-shuttle-info)) (arg2 uint)) + (local-vars (v1-263 float) (v1-377 float) (sv-336 quaternion)) + (with-pp + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (cond + ((nonzero? (-> arg0 data-int32 9)) + (check-time arg0) + ) + (else + (set! (-> arg0 start-time) (-> pp clock frame-counter)) + (when (< (vector-vector-xz-distance (target-pos 0) (-> arg0 begin-pos)) 102400.0) + (set-setting! 'airlock #f 0 0) + (set! (-> arg0 data-int32 9) 1) + ) + ) + ) + (when (= (-> arg0 data-int32 10) (+ (-> arg0 sub-state) -1)) + (let ((s3-1 (handle->process (-> arg0 slave (logand -2 (-> arg0 data-int32 10)))))) + (when s3-1 + (let ((v1-20 (-> arg0 data-int32 10))) + (cond + ((zero? v1-20) + (let ((v0-4 (rand-vu-int-count 3))) + (cond + ((zero? v0-4) + (send-event s3-1 'play-speech "agnt038") + ) + ((= v0-4 1) + (send-event s3-1 'play-speech "agnt039") + ) + ((= v0-4 2) + (send-event s3-1 'play-speech "agnt040") + ) + ) + ) + ) + ((= v1-20 1) + (let ((v0-8 (rand-vu-int-count 4))) + (cond + ((zero? v0-8) + (send-event s3-1 'play-speech "agnt045") + ) + ((= v0-8 1) + (send-event s3-1 'play-speech "agnt046") + ) + ((= v0-8 2) + (send-event s3-1 'play-speech "agnt047") + ) + ((= v0-8 3) + (send-event s3-1 'play-speech "agnt048") + ) + ) + ) + ) + ((= v1-20 2) + (let ((v0-13 (rand-vu-int-count 4))) + (cond + ((zero? v0-13) + (send-event s3-1 'play-speech "agnt092") + ) + ((= v0-13 1) + (send-event s3-1 'play-speech "agnt093") + ) + ((= v0-13 2) + (send-event s3-1 'play-speech "agnt094") + ) + ((= v0-13 3) + (send-event s3-1 'play-speech "agnt095") + ) + ) + ) + ) + ((= v1-20 3) + (let ((v0-18 (rand-vu-int-count 3))) + (cond + ((zero? v0-18) + (send-event s3-1 'play-speech "agnt100") + ) + ((= v0-18 1) + (send-event s3-1 'play-speech "agnt101") + ) + ((= v0-18 2) + (send-event s3-1 'play-speech "agnt102") + ) + ) + ) + ) + ((= v1-20 4) + (let ((v0-22 (rand-vu-int-count 3))) + (cond + ((zero? v0-22) + (send-event s3-1 'play-speech "agnt115") + ) + ((= v0-22 1) + (send-event s3-1 'play-speech "agnt121") + ) + ((= v0-22 2) + (send-event s3-1 'play-speech "agnt122") + ) + ) + ) + ) + ((= v1-20 5) + (let ((v0-26 (rand-vu-int-count 3))) + (cond + ((zero? v0-26) + (send-event s3-1 'play-speech "agnt119") + ) + ((= v0-26 1) + (send-event s3-1 'play-speech "agnt120") + ) + ((= v0-26 2) + (send-event s3-1 'play-speech "agnt125") + ) + ) + ) + ) + ((= v1-20 6) + (let ((v0-30 (rand-vu-int-count 5))) + (cond + ((zero? v0-30) + (send-event s3-1 'play-speech "agnt131") + ) + ((= v0-30 1) + (send-event s3-1 'play-speech "agnt132") + ) + ((= v0-30 2) + (send-event s3-1 'play-speech "agnt133") + ) + ((= v0-30 3) + (send-event s3-1 'play-speech "agnt126") + ) + ((= v0-30 4) + (send-event s3-1 'play-speech "agnt127") + ) + ) + ) + ) + ((= v1-20 7) + (let ((v0-36 (rand-vu-int-count 2))) + (cond + ((zero? v0-36) + (send-event s3-1 'play-speech "agnt135") + ) + ((= v0-36 1) + (send-event s3-1 'play-speech "agnt130") + ) + ) + ) + ) + ) + ) + (+! (-> arg0 data-int32 10) 1) + ) + ) + ) + (let ((s3-2 (-> arg0 sub-state))) + (cond + ((>= s3-2 (the-as uint (-> arg0 count))) + (go (method-of-object arg0 complete)) + ) + ((not (logtest? s3-2 1)) + (let ((s2-0 (handle->process (-> arg0 slave s3-2)))) + (cond + (s2-0 + (let* ((s1-0 (entity-nav-mesh-by-aid (-> (the-as citizen-rebel s2-0) nav-mesh-aid))) + (s4-1 (if (type? s1-0 entity-nav-mesh) + s1-0 + ) + ) + ) + (cond + (s4-1 + (when (focus-test? (the-as citizen-rebel s2-0) inactive) + (let ((s1-1 (new 'stack 'traffic-object-spawn-params))) + (set! (-> s1-1 object-type) (traffic-type tt5)) + (set! (-> s1-1 behavior) (the-as uint 7)) + (set! (-> s1-1 id) (the-as uint 0)) + (set! (-> s1-1 nav-mesh) #f) + (set! (-> s1-1 nav-branch) #f) + (set! (-> s1-1 proc) #f) + (set! (-> s1-1 handle) (-> arg0 slave s3-2)) + (set! (-> s1-1 user-data) (the-as uint 0)) + (set! (-> s1-1 flags) (traffic-spawn-flags)) + (set! (-> s1-1 guard-type) (the-as uint 7)) + (vector-reset! (-> s1-1 velocity)) + (set! (-> s1-1 position quad) (-> (the-as citizen-rebel s2-0) root-override2 trans quad)) + (quaternion-copy! (-> s1-1 rotation) (-> (the-as citizen-rebel s2-0) root-override2 quat)) + (set! (-> s1-1 nav-mesh) (-> s4-1 nav-mesh)) + (activate-by-handle *traffic-engine* s1-1) + ) + ) + (let ((v1-230 *target*)) + (when (and v1-230 (focus-test? v1-230 pilot)) + (let ((s4-2 (handle->process (-> v1-230 pilot vehicle)))) + (when s4-2 + (cond + ((and (focus-test? (the-as citizen-rebel s2-0) pilot) + (handle->process (-> (the-as citizen-rebel s2-0) vehicle)) + ) + (send-event (handle->process (-> arg0 arrow)) 'set-position (-> arg1 (+ s3-2 1) pos)) + (+! (-> arg0 sub-state) 1) + (set! (-> arg0 time-limit) (+ (-> arg1 s3-2 time) (-> arg1 (+ s3-2 1) time))) + ) + (else + (let ((v1-260 (get-best-seat-for-vehicle + (the-as vehicle s4-2) + (-> (the-as vehicle s4-2) root-override-2 trans) + (the-as int (-> (the-as citizen-rebel s2-0) info seat-flag)) + 1 + ) + ) + ) + (when (!= v1-260 -1) + (.lvf vf1 (&-> (-> (the-as vehicle s4-2) root-override-2 transv) quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.mov v1-263 vf1) + (let ((f0-1 v1-263) + (f1-1 32768.0) + ) + (if (and (< f0-1 (* f1-1 f1-1)) (let ((f0-2 (vector-vector-distance-squared + (-> (the-as vehicle s4-2) root-override-2 trans) + (-> (the-as citizen-rebel s2-0) root-override2 trans) + ) + ) + (f1-4 65536.0) + ) + (< f0-2 (* f1-4 f1-4)) + ) + ) + (send-event s2-0 'board-vehicle s4-2) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (else + (if (not (focus-test? (the-as citizen-rebel s2-0) inactive)) + (send-event s2-0 'traffic-off-force) + ) + ) + ) + ) + (if (and (-> s2-0 next-state) (= (-> s2-0 next-state name) 'wait-for-ride)) + (send-event + (handle->process (-> arg0 arrow)) + 'set-position + (-> (the-as citizen-rebel s2-0) root-override2 trans) + ) + ) + ) + (else + (when (zero? (-> arg0 data-int32 s3-2)) + (send-event (handle->process (-> arg0 arrow)) 'set-position (-> arg1 s3-2 pos)) + (set! (-> arg0 time-limit) (-> arg1 s3-2 time)) + (set! (-> arg0 start-time) (-> pp clock frame-counter)) + (set! (-> arg0 data-int32 s3-2) 1) + ) + (let ((s1-2 (find-nearest-nav-mesh (-> arg1 s3-2 pos) (the-as float #x7f800000)))) + (when (and s1-2 (nonzero? s1-2)) + (let ((s2-1 (new 'stack 'traffic-object-spawn-params))) + (set! (-> s2-1 object-type) (traffic-type tt5)) + (set! (-> s2-1 behavior) (the-as uint 7)) + (set! (-> s2-1 id) (the-as uint 0)) + (set! (-> s2-1 nav-mesh) #f) + (set! (-> s2-1 nav-branch) #f) + (set! (-> s2-1 proc) #f) + (set! (-> s2-1 handle) (the-as handle #f)) + (set! (-> s2-1 user-data) (the-as uint 0)) + (set! (-> s2-1 flags) (traffic-spawn-flags)) + (set! (-> s2-1 guard-type) (the-as uint 7)) + (vector-reset! (-> s2-1 velocity)) + (set! (-> s2-1 position quad) (-> arg1 s3-2 pos quad)) + (let ((s0-0 quaternion-copy!)) + (set! sv-336 (-> s2-1 rotation)) + (let ((a1-50 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) *up-vector* 0.0))) + (s0-0 sv-336 a1-50) + ) + ) + (logior! (-> s2-1 flags) (traffic-spawn-flags trsflags-00)) + (set! (-> s2-1 id) (the-as uint 122)) + (set! (-> s2-1 proc) #f) + (let ((v0-58 (citizen-spawn arg0 citizen-rebel s2-1))) + (cond + (v0-58 + (set! (-> (the-as citizen-rebel v0-58) end-pos quad) (-> arg1 (+ s3-2 1) pos quad)) + (set! (-> arg0 slave s3-2) (process->handle (the-as citizen-rebel v0-58))) + (logior! (-> (the-as citizen-rebel v0-58) flags) (citizen-flag persistent)) + (set! (-> (the-as citizen-rebel v0-58) task-node) arg2) + (set! (-> (the-as citizen-rebel v0-58) nav-mesh-aid) (the-as actor-id (-> s1-2 entity aid))) + (set! (-> (the-as citizen-rebel v0-58) done?) #f) + (set! (-> (the-as citizen-rebel v0-58) index) s3-2) + (send-event *traffic-manager* 'add-object (-> s2-1 object-type) (the-as citizen-rebel v0-58)) + ) + (else + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (else + (let ((s4-3 (handle->process (-> arg0 slave (+ s3-2 -1))))) + (if (not s4-3) + (go (method-of-object arg0 fail)) + ) + (if (or (not *target*) (not (logtest? (focus-status pilot) (-> *target* focus-status)))) + (send-event s4-3 'exit-vehicle (-> (the-as process-drawable s4-3) root trans)) + ) + (when (-> *target* pilot) + (let ((s5-1 (-> arg1 s3-2 pos)) + (s2-2 (handle->process (-> *target* pilot vehicle))) + ) + (cond + ((focus-test? (the-as process-focusable s4-3) pilot) + (if (and s2-2 + (let ((f0-3 (vector-vector-distance-squared s5-1 (-> (the-as process-drawable s2-2) root trans))) + (f1-7 65536.0) + ) + (< f0-3 (* f1-7 f1-7)) + ) + (begin + (.lvf vf1 (&-> (-> (the-as process-drawable s2-2) root transv) quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.mov v1-377 vf1) + (let ((f0-4 v1-377) + (f1-10 12288.0) + ) + (< f0-4 (* f1-10 f1-10)) + ) + ) + ) + (send-event s4-3 'exit-vehicle s5-1) + ) + ) + ((not (-> (the-as citizen-rebel s4-3) done?)) + (set! (-> arg0 data-int32 s3-2) 0) + (+! (-> arg0 sub-state) -1) + ) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + ) + ) + +(define *city-shuttle-info* (new 'static 'boxed-array :type city-shuttle-info + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 4288512.0 :y 37969.92 :z 237568.0 :w 1.0) + :level 'ctysluma + :nav-mesh-id #x2578 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 4419584.0 :y 33341.44 :z 1449984.0 :w 1.0) + :level 'ctysluma + :nav-mesh-id #x2578 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 3519856.8 :y 33341.44 :z 1196646.4 :w 1.0) + :level 'ctysluma + :nav-mesh-id #x2578 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 2766438.5 :y 32727.04 :z -1390428.1 :w 1.0) + :level 'ctyslumb + :nav-mesh-id #x2644 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 1641594.9 :y 32727.04 :z -1032192.0 :w 1.0) + :level 'ctyslumb + :nav-mesh-id #x2644 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 1734901.8 :y 32563.2 :z -239656.95 :w 1.0) + :level 'ctyslumb + :nav-mesh-id #x2644 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 2341396.5 :y 32727.04 :z -63037.44 :w 1.0) + :level 'ctyslumb + :nav-mesh-id #x2644 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 2429870.0 :y 32563.2 :z -2287288.2 :w 1.0) + :level 'ctyslumc + :nav-mesh-id #x2644 + :time (seconds 60) + ) + ) + ) + +(set-subtask-hook! + *game-info* + 95 + 6 + (the-as (function object) (lambda :behavior task-manager + ((arg0 citizen-rebel) (arg1 object) (arg2 symbol)) + (case arg2 + (('task-done) + (format #t "task-done~%") + (set! (-> self sub-state) (+ (-> arg0 index) 2)) + (set! (-> *game-info* counter) (+ -1.0 (-> *game-info* counter))) + ) + ) + (none) + ) + ) + ) + +(set-subtask-hook! + *game-info* + 95 + 0 + (the-as + (function object) + (lambda :behavior task-manager + () + (set-setting! 'exclusive-task #f 0 (-> self node-info task)) + (set! (-> self begin-pos quad) (-> (new 'static 'vector :x 4698112.0 :y 40960.0 :z 81920.0 :w 1.0) quad)) + (let ((v1-4 (entity-by-name "parking-spot-8"))) + (if v1-4 + (logior! (-> v1-4 extra perm status) (entity-perm-status bit-9)) + ) + ) + (shuttle-init self *city-shuttle-info*) + (none) + ) + ) + ) + +(set-subtask-hook! + *game-info* + 95 + 1 + (the-as (function object) (lambda :behavior task-manager + () + (let ((t9-0 shuttle-cleanup) + (a0-0 self) + ) + *city-shuttle-info* + (t9-0 a0-0) + ) + (send-event *traffic-manager* 'restore-default-settings) + (none) + ) + ) + ) + +(set-subtask-hook! + *game-info* + 95 + 2 + (the-as + (function object) + (lambda :behavior task-manager () (shuttle-update self *city-shuttle-info* (the-as uint 95)) (none)) + ) + ) + +(set-subtask-hook! + *game-info* + 95 + 3 + (the-as + (function object) + (lambda :behavior task-manager + () + (set! (-> self hud-counter) (ppointer->handle (process-spawn hud-citizen :init hud-init-by-other :to self))) + (send-event *traffic-manager* 'set-target-level #x3f400000) + (send-event *traffic-manager* 'set-guard-target-count-range 4 0 1) + (send-event *traffic-manager* 'set-guard-target-count-range 5 0 1) + (send-event *traffic-manager* 'set-guard-target-count-range 0 0 2) + (send-event *traffic-manager* 'set-guard-target-count-range 1 0 3) + (while (zero? (-> self sub-state)) + (suspend) + ) + (set! (-> self state-time) (-> self clock frame-counter)) + (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (suspend) + ) + (send-event *traffic-manager* 'set-alert-level 2) + (send-event *traffic-manager* 'set-alert-duration #xa4cb80) + (none) + ) + ) + ) + +(set-subtask-hook! + *game-info* + 95 + 5 + (the-as + (function object) + (lambda :behavior task-manager () (send-event (handle->process (-> self arrow)) 'die) (none)) + ) + ) + +(set-subtask-hook! + *game-info* + 95 + 4 + (the-as + (function object) + (lambda :behavior task-manager + () + (set! (-> self state-time) (-> self clock frame-counter)) + (talker-spawn-func (-> *talker-speech* 97) *entity-pool* (target-pos 0) (the-as region #f)) + (let ((gp-1 (-> self clock frame-counter))) + (until #f + (let ((v1-4 0)) + (dotimes (a0-2 4) + (let ((a1-5 (handle->process (-> self slave (* a0-2 2))))) + (if (or (not a1-5) (and (-> a1-5 next-state) (= (-> a1-5 next-state name) 'inactive))) + (+! v1-4 1) + ) + ) + ) + (if (or (>= v1-4 4) (>= (- (-> self clock frame-counter) gp-1) (seconds 10))) + (goto cfg-23) + ) + ) + (suspend) + 0 + ) + ) + #f + (label cfg-23) + (task-node-close! (game-task-node city-shuttle-resolution)) + (none) + ) + ) + ) + +(define *city-burning-bush-shuttle-1-info* + (new 'static 'boxed-array :type city-shuttle-info + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x -1519902.8 :y 32727.04 :z 2502369.2 :w 1.0) + :level 'ctysluma + :nav-mesh-id #x2578 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 715612.2 :y 81879.04 :z 2993889.2 :w 1.0) + :level 'ctysluma + :nav-mesh-id #x2578 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 1588920.4 :y 65536.0 :z 2774384.8 :w 1.0) + :level 'ctysluma + :nav-mesh-id #x2578 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x -218152.95 :y 31621.12 :z 5460336.5 :w 1.0) + :level 'ctyslumb + :nav-mesh-id #x2644 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 767180.8 :y 70778.88 :z 7193682.0 :w 1.0) + :level 'ctyslumb + :nav-mesh-id #x2644 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 4055408.8 :y 32727.04 :z 4727562.0 :w 1.0) + :level 'ctyslumb + :nav-mesh-id #x2644 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 4694958.0 :y 32727.04 :z 3358392.2 :w 1.0) + :level 'ctyslumb + :nav-mesh-id #x2644 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 4653957.0 :y 33341.44 :z 638730.25 :w 1.0) + :level 'ctyslumc + :nav-mesh-id #x2644 + :time (seconds 60) + ) + ) + ) + +(set-subtask-hook! + *game-info* + 279 + 6 + (the-as (function object) (lambda :behavior task-manager + ((arg0 citizen-rebel) (arg1 object) (arg2 symbol)) + (case arg2 + (('task-done) + (format #t "task-done~%") + (set! (-> self sub-state) (+ (-> arg0 index) 2)) + (set! (-> *game-info* counter) (+ -1.0 (-> *game-info* counter))) + ) + ) + (none) + ) + ) + ) + +(set-subtask-hook! + *game-info* + 279 + 0 + (the-as + (function object) + (lambda :behavior task-manager + () + (set-setting! 'airlock #f 0 0) + (set-setting! 'exclusive-task #f 0 (-> self node-info task)) + (set! (-> self begin-pos quad) (-> (new 'static 'vector :x -687390.75 :y 40960.0 :z 3479224.2 :w 1.0) quad)) + (shuttle-init self *city-burning-bush-shuttle-1-info*) + (none) + ) + ) + ) + +(set-subtask-hook! + *game-info* + 279 + 1 + (the-as (function object) (lambda :behavior task-manager + () + (let ((t9-0 shuttle-cleanup) + (a0-0 self) + ) + *city-burning-bush-shuttle-1-info* + (t9-0 a0-0) + ) + (send-event *traffic-manager* 'restore-default-settings) + (none) + ) + ) + ) + +(set-subtask-hook! + *game-info* + 279 + 2 + (lambda :behavior task-manager + () + (the-as symbol (shuttle-update self *city-burning-bush-shuttle-1-info* (the-as uint 279))) + ) + ) + +(set-subtask-hook! + *game-info* + 279 + 3 + (the-as + (function object) + (lambda :behavior task-manager + () + (set! (-> self hud-counter) (ppointer->handle (process-spawn hud-citizen :init hud-init-by-other :to self))) + (send-event *traffic-manager* 'set-target-level #x3f400000) + (send-event *traffic-manager* 'set-guard-target-count-range 4 0 1) + (send-event *traffic-manager* 'set-guard-target-count-range 5 0 1) + (send-event *traffic-manager* 'set-guard-target-count-range 0 0 2) + (send-event *traffic-manager* 'set-guard-target-count-range 1 0 3) + (while (zero? (-> self sub-state)) + (suspend) + ) + (set! (-> self state-time) (-> self clock frame-counter)) + (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (suspend) + ) + (send-event *traffic-manager* 'set-alert-level 2) + (send-event *traffic-manager* 'set-alert-duration #xa4cb80) + (none) + ) + ) + ) + +(set-subtask-hook! + *game-info* + 279 + 5 + (the-as + (function object) + (lambda :behavior task-manager () (send-event (handle->process (-> self arrow)) 'die) (none)) + ) + ) + +(set-subtask-hook! + *game-info* + 279 + 4 + (the-as + (function object) + (lambda :behavior task-manager + () + (set! (-> self state-time) (-> self clock frame-counter)) + (until #f + (let ((v1-2 0)) + (dotimes (a0-0 4) + (let ((a1-4 (handle->process (-> self slave (* a0-0 2))))) + (if (and a1-4 (-> a1-4 next-state) (= (-> a1-4 next-state name) 'inactive)) + (+! v1-2 1) + ) + ) + ) + (if (= v1-2 4) + (goto cfg-20) + ) + ) + (suspend) + 0 + ) + #f + (label cfg-20) + (task-node-close! (game-task-node city-burning-bush-shuttle-1-resolution)) + (none) + ) + ) + ) diff --git a/test/decompiler/reference/jak2/characters/underground_fighters/shuttle_REF.gc b/test/decompiler/reference/jak2/characters/underground_fighters/shuttle_REF.gc new file mode 100644 index 0000000000..2db1c7d83b --- /dev/null +++ b/test/decompiler/reference/jak2/characters/underground_fighters/shuttle_REF.gc @@ -0,0 +1,1909 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 15 of type hud-citizen +;; WARN: Return type mismatch int vs none. +(defmethod draw hud-citizen ((obj hud-citizen)) + (set-hud-piece-position! + (the-as hud-sprite (-> obj sprites)) + (the int (+ 452.0 (* 130.0 (-> obj offset)))) + 195 + ) + (format (clear (-> obj strings 0 text)) "~D" (-> obj values 0 current)) + (set-as-offset-from! (the-as hud-sprite (-> obj strings 0 pos)) (the-as vector4w (-> obj sprites)) -15 47) + ((method-of-type hud draw) obj) + 0 + (none) + ) + +;; definition for method 16 of type hud-citizen +;; WARN: Return type mismatch int vs none. +(defmethod update-values hud-citizen ((obj hud-citizen)) + (set! (-> obj values 0 target) (the int (-> *game-info* counter))) + ((method-of-type hud update-values) obj) + 0 + (none) + ) + +;; definition for method 17 of type hud-citizen +;; WARN: Return type mismatch int vs none. +(defmethod init-callback hud-citizen ((obj hud-citizen)) + (set! (-> obj level) (level-get *level* 'ctywide)) + (set! (-> obj gui-id) + (add-process *gui-control* obj (gui-channel hud-middle-right) (gui-action hidden) (-> obj name) 81920.0 0) + ) + (logior! (-> obj flags) (hud-flags show)) + (set! (-> obj sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x4 :page #x679))) + (set! (-> obj sprites 0 flags) (the-as uint 4)) + (set! (-> obj sprites 0 scale-x) 0.9) + (set! (-> obj sprites 0 scale-y) 0.9) + (alloc-string-if-needed obj 0) + (set! (-> obj strings 0 scale) 0.6) + (set! (-> obj strings 0 flags) (font-flags kerning middle large)) + 0 + (none) + ) + +;; failed to figure out what this is: +(defskelgroup skel-citizen-rebel citizen-rebel citizen-rebel-lod0-jg -1 + ((citizen-rebel-lod0-mg (meters 999999))) + :bounds (static-spherem 0 2 0 3) + :shadow citizen-rebel-shadow-mg + ) + +;; definition for symbol *citizen-rebel-global-info*, type civilian-global-info +(define *citizen-rebel-global-info* + (new 'static 'civilian-global-info + :knocked (new 'static 'array int32 2 21 23) + :knocked-land (new 'static 'array int32 2 22 24) + :yellow-hit-anim (new 'static 'inline-array civilian-anim-info 1 + (new 'static 'civilian-anim-info :anim-index (new 'static 'array int32 2 21 23)) + ) + :blue-hit-anim (new 'static 'inline-array civilian-anim-info 3 + (new 'static 'civilian-anim-info :anim-index (new 'static 'array int32 2 27 27)) + (new 'static 'civilian-anim-info :anim-index (new 'static 'array int32 2 27 27)) + (new 'static 'civilian-anim-info :anim-index (new 'static 'array int32 2 27 27)) + ) + :anim-cover-head-start 29 + :anim-cover-head-loop 30 + :anim-cover-head-end 31 + :car-stance-anim 34 + :bike-stance-anim 33 + :get-in-car-anim 35 + :seat-flag #x2 + ) + ) + +;; definition for symbol *citizen-rebel-nav-enemy-info*, type nav-enemy-info +(define *citizen-rebel-nav-enemy-info* + (new 'static 'nav-enemy-info + :use-die-falling #t + :use-victory #f + :use-jump-blocked #f + :debug-draw-neck #f + :jump-debug-draw #f + :move-to-ground #t + :hover-if-no-ground #f + :idle-anim-script (new 'static 'array idle-control-frame 4 + (new 'static 'idle-control-frame :command (ic-cmd play) :anim #x3 :param0 #x1 :param1 #x1) + (new 'static 'idle-control-frame) + (new 'static 'idle-control-frame) + (new 'static 'idle-control-frame) + ) + :idle-anim 3 + :notice-anim 3 + :hostile-anim -1 + :hit-anim 3 + :knocked-anim 21 + :knocked-land-anim 22 + :die-anim 3 + :die-falling-anim 3 + :victory-anim 3 + :jump-wind-up-anim 11 + :jump-in-air-anim 11 + :jump-land-anim 11 + :neck-joint 5 + :look-at-joint 5 + :bullseye-joint 4 + :notice-distance (meters 10) + :notice-distance-delta (meters 0.1) + :default-hit-points 1 + :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 2730.6667 + :knocked-soft-vxz-lo 32768.0 + :knocked-soft-vxz-hi 49152.0 + :knocked-soft-vy-lo 36864.0 + :knocked-soft-vy-hi 73728.0 + :knocked-medium-vxz-lo 81920.0 + :knocked-medium-vxz-hi 143360.0 + :knocked-medium-vy-lo 49152.0 + :knocked-medium-vy-hi 102400.0 + :knocked-hard-vxz-lo 102400.0 + :knocked-hard-vxz-hi 122880.0 + :knocked-hard-vy-lo 81920.0 + :knocked-hard-vy-hi 102400.0 + :knocked-huge-vxz-lo 164659.2 + :knocked-huge-vxz-hi 249036.8 + :knocked-huge-vy-lo 183500.8 + :knocked-huge-vy-hi 217907.2 + :knocked-yellow-vxz-lo 16384.0 + :knocked-yellow-vxz-hi 32768.0 + :knocked-yellow-vy-lo 24576.0 + :knocked-yellow-vy-hi 49152.0 + :knocked-red-vxz-lo 40960.0 + :knocked-red-vxz-hi 61440.0 + :knocked-red-vy-lo 36864.0 + :knocked-red-vy-hi 73728.0 + :knocked-blue-vxz-lo 32768.0 + :knocked-blue-vxz-hi 65536.0 + :knocked-blue-vy-lo 32768.0 + :knocked-blue-vy-hi 49152.0 + :shadow-size (meters 2) + :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 #t + :use-frustration #t + :use-stop-chase #f + :use-circling #f + :use-pacing #f + :walk-anim 11 + :turn-anim 11 + :run-anim 14 + :taunt-anim -1 + :run-travel-speed (meters 12) + :run-acceleration (meters 2) + :run-turning-acceleration (meters 30) + :walk-travel-speed (meters 3) + :walk-acceleration (meters 2) + :walk-turning-acceleration (meters 8) + :maximum-rotation-rate (degrees 720.0) + :notice-nav-radius (meters 10) + :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! (-> *citizen-rebel-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) + +;; definition of type citizen-rebel +(deftype citizen-rebel (citizen-norm) + ((nav-mesh-aid actor-id :offset-assert 1060) + (done? symbol :offset-assert 1064) + (task-node uint16 :offset-assert 1068) + (end-pos vector :inline :offset-assert 1072) + (index uint32 :offset-assert 1088) + (gui-id uint32 :offset-assert 1092) + ) + :heap-base #x3d0 + :method-count-assert 219 + :size-assert #x448 + :flag-assert #xdb03d00448 + ) + +;; definition for method 3 of type citizen-rebel +(defmethod inspect citizen-rebel ((obj citizen-rebel)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type citizen-norm inspect))) + (t9-0 obj) + ) + (format #t "~2Tnav-mesh-aid: ~D~%" (-> obj nav-mesh-aid)) + (format #t "~2Tdone?: ~A~%" (-> obj done?)) + (format #t "~2Ttask-node: ~D~%" (-> obj task-node)) + (format #t "~2Tend-pos: #~%" (-> obj end-pos)) + (format #t "~2Tindex: ~D~%" (-> obj index)) + (format #t "~2Tgui-id: ~D~%" (-> obj gui-id)) + (label cfg-4) + obj + ) + +;; definition for method 17 of type citizen-rebel +(defmethod cleanup-for-death citizen-rebel ((obj citizen-rebel)) + (with-pp + (when (and (zero? (-> obj hit-points)) (not (-> obj done?))) + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) (process->ppointer pp)) + (set! (-> a1-0 num-params) 0) + (set! (-> a1-0 message) 'fail) + (let ((t9-0 send-event-function) + (v1-9 (-> *game-info* sub-task-list (-> obj task-node))) + ) + (t9-0 + (handle->process (if (-> v1-9 info) + (-> v1-9 info manager) + (the-as handle #f) + ) + ) + a1-0 + ) + ) + ) + ) + ((method-of-type citizen-norm cleanup-for-death) obj) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate get-up-front (citizen-rebel) + :virtual #t + :code (behavior () + (ja-channel-push! 1 (seconds 0.2)) + (ja-no-eval :group! (-> self draw art-group data (-> self anim-get-up-front)) + :num! (seek! + (the float + (+ (-> (the-as art-joint-anim (-> self draw art-group data (-> self anim-get-up-front))) frames num-frames) + -1 + ) + ) + (-> self speed-scale) + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max (-> self speed-scale))) + ) + (if (-> self done?) + (go-virtual active) + (go-virtual wait-for-ride) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate get-up-back (citizen-rebel) + :virtual #t + :code (behavior () + (ja-channel-push! 1 (seconds 0.2)) + (ja-no-eval :group! (-> self draw art-group data (-> self anim-get-up-back)) + :num! (seek! + (the float + (+ (-> (the-as art-joint-anim (-> self draw art-group data (-> self anim-get-up-back))) frames num-frames) -1) + ) + (-> self speed-scale) + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max (-> self speed-scale))) + ) + (if (-> self done?) + (go-virtual active) + (go-virtual wait-for-ride) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate knocked (citizen-rebel) + :virtual #t + :enter (behavior () + (let ((gp-0 (find-nearest-nav-mesh (-> self root-override2 trans) (the-as float #x7f800000)))) + (change-to gp-0 self) + (if (not (-> self nav)) + (go-inactive self) + ) + (set! (-> self nav-mesh-aid) (the-as actor-id (-> gp-0 entity aid))) + ) + (let ((v1-10 (-> self nav state))) + (set! (-> v1-10 current-poly) (the-as nav-poly #f)) + ) + 0 + (do-navigation-to-destination (-> self nav state) (-> self root-override2 trans)) + (set! (-> self gnd-height) (-> self root-override2 gspot-pos y)) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (gp-1 (new 'stack-no-clear 'quaternion)) + ) + (vector-y-quaternion! s5-0 (-> self root-override2 quat)) + (vector-normalize! s5-0 1.0) + (quaternion-from-two-vectors! gp-1 s5-0 *up-vector*) + (quaternion*! (-> self root-override2 quat) gp-1 (-> self root-override2 quat)) + ) + (let ((t9-8 (-> (method-of-type civilian knocked) enter))) + (if t9-8 + (t9-8) + ) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate exit-vehicle (citizen-rebel) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior citizen-rebel) enemy-event-handler) + :enter (behavior ((arg0 object) (arg1 object) (arg2 int) (arg3 symbol) (arg4 event-message-block)) + (let ((a0-2 (find-nearest-nav-mesh (-> self root-override2 trans) (the-as float #x7f800000)))) + (if a0-2 + (set! (-> self nav-mesh-aid) (the-as actor-id (-> a0-2 entity aid))) + ) + (change-to a0-2 self) + ) + (when (not (-> self nav)) + (format #t "nav mesh not found~%") + (go-inactive self) + ) + (let ((v1-11 (-> self nav state))) + (set! (-> v1-11 current-poly) (the-as nav-poly #f)) + ) + 0 + (citizen-method-195 + self + (vector-negate-in-place! (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root-override2 quat))) + ) + (let ((a0-9 (-> self nav state)) + (v1-17 (-> self controller turn-exit-point)) + ) + (logclear! (-> a0-9 flags) (nav-state-flag directional-mode)) + (logior! (-> a0-9 flags) (nav-state-flag target-poly-dirty)) + (set! (-> a0-9 target-post quad) (-> v1-17 quad)) + ) + 0 + (citizen-nav-init! self) + (set! (-> self gnd-height) (-> self root-override2 gspot-pos y)) + (logior! (-> self flags) (citizen-flag persistent)) + (set! (-> self focus-status) (logior (focus-status pilot-riding pilot) (-> self focus-status))) + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-31 (-> self root-override2 root-prim))) + (set! (-> v1-31 prim-core collide-as) (collide-spec)) + (set! (-> v1-31 prim-core collide-with) (collide-spec)) + ) + 0 + (let ((v1-33 self)) + (set! (-> v1-33 enemy-flags) (the-as enemy-flag (logclear (-> v1-33 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-33 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (let ((v1-36 self)) + (set! (-> v1-36 enemy-flags) (the-as enemy-flag (logclear (-> v1-36 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (none) + ) + :exit (behavior () + (let ((t9-0 (-> (method-of-type civilian exit-vehicle) exit))) + (if t9-0 + (t9-0) + ) + ) + (none) + ) + :code (behavior ((arg0 object) (arg1 object) (arg2 int) (arg3 symbol) (arg4 event-message-block)) + (local-vars (sv-176 float) (sv-192 float) (sv-208 float)) + (remove-rider (the-as vehicle (handle->process (-> self vehicle))) self) + (logclear! (-> self focus-status) (focus-status pilot-riding pilot)) + (let ((gp-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'quaternion)) + ) + (set! (-> self state-time) (-> self clock frame-counter)) + (while (not (civilian-method-217 self gp-0)) + (let ((s4-0 (handle->process (-> self vehicle))) + (s3-0 (new 'stack-no-clear 'quaternion)) + ) + (quaternion-copy! s3-0 (-> (the-as vehicle s4-0) root-override-2 quat)) + (compute-seat-position (the-as vehicle s4-0) (-> self root-override2 trans) (-> self seat)) + (quaternion-copy! (-> self root-override2 quat) s3-0) + ) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (put-rider-in-seat (the-as vehicle (handle->process (-> self vehicle))) (-> self seat) self) + (go-virtual ride) + ) + (suspend) + ) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data (-> self info get-in-car-anim)) + :num! (seek! (ja-aframe 5.0 0) 0.5) + :frame-num (ja-aframe 12.0 0) + ) + (until (ja-done? 0) + (let ((s3-1 (handle->process (-> self vehicle))) + (s4-2 (new 'stack-no-clear 'quaternion)) + ) + (quaternion-copy! s4-2 (-> (the-as vehicle s3-1) root-override-2 quat)) + (compute-seat-position (the-as vehicle s3-1) (-> self root-override2 trans) (-> self seat)) + (let ((s3-2 lerp-scale) + (s2-0 0.0) + (s1-0 1.0) + (s0-0 (ja-aframe-num 0)) + ) + (set! sv-176 (ja-aframe 10.0 0)) + (let* ((t0-1 (ja-aframe 7.0 0)) + (f0-4 (s3-2 s2-0 s1-0 s0-0 sv-176 t0-1)) + ) + (quaternion-rotate-local-y! (-> self root-override2 quat) s4-2 (* f0-4 (if (zero? (-> self seat)) + -16384.0 + 16384.0 + ) + ) + ) + ) + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 5.0 0) 0.5)) + ) + (let ((s4-4 (handle->process (-> self vehicle)))) + (let ((s3-3 (new 'stack-no-clear 'quaternion))) + (quaternion-copy! s3-3 (-> (the-as vehicle s4-4) root-override-2 quat)) + (compute-seat-position (the-as vehicle s4-4) (-> self root-override2 trans) (-> self seat)) + (quaternion-rotate-local-y! (-> self root-override2 quat) s3-3 (if (zero? (-> self seat)) + -16384.0 + 16384.0 + ) + ) + ) + (remove-rider (the-as vehicle s4-4) self) + ) + (logclear! (-> self focus-status) (focus-status pilot-riding pilot)) + (let ((v1-65 (handle->process (-> self vehicle)))) + (quaternion-copy! s5-0 (-> (the-as vehicle v1-65) root-override-2 quat)) + ) + (ja-no-eval :group! (-> self draw art-group data (-> self info get-in-car-anim)) + :num! (seek! (ja-aframe 1.0 0) 0.5) + :frame-num (ja-aframe 5.0 0) + ) + (until (ja-done? 0) + (let ((a0-60 (handle->process (-> self vehicle))) + (s2-1 (new 'stack-no-clear 'vector)) + (s4-6 (new 'stack-no-clear 'vector)) + (s3-4 (new 'stack-no-clear 'quaternion)) + ) + (compute-seat-position (the-as vehicle a0-60) s2-1 (-> self seat)) + (vector-! s4-6 s2-1 gp-0) + (let ((s2-2 lerp-scale) + (s1-1 0.0) + (s0-1 1.0) + ) + (set! sv-192 (ja-aframe-num 0)) + (set! sv-208 (ja-aframe 5.0 0)) + (let* ((t0-2 (ja-aframe 1.0 0)) + (f0-13 (s2-2 s1-1 s0-1 sv-192 sv-208 t0-2)) + (f30-0 (- 1.0 f0-13)) + ) + (quaternion-rotate-local-y! s3-4 s5-0 (if (zero? (-> self seat)) + -16384.0 + 16384.0 + ) + ) + (let ((a1-40 (vector-y-quaternion! (new 'stack-no-clear 'vector) s3-4)) + (s2-3 (new 'stack-no-clear 'quaternion)) + ) + (quaternion-from-two-vectors! s2-3 a1-40 *up-vector*) + (quaternion*! s3-4 s2-3 s3-4) + ) + (quaternion-copy! (-> self root-override2 quat) s3-4) + (vector+float*! (-> self root-override2 trans) gp-0 s4-6 f30-0) + ) + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 1.0 0) 0.5)) + ) + ) + (let ((v1-96 (-> self root-override2 root-prim))) + (set! (-> v1-96 prim-core collide-as) (-> self root-override2 backup-collide-as)) + (set! (-> v1-96 prim-core collide-with) (-> self root-override2 backup-collide-with)) + ) + (go-virtual wait-for-ride) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate wait-for-ride (citizen-rebel) + :virtual #t + :trans (behavior () + (when (-> self vehicle) + (case (-> (the-as vehicle (handle->process (-> self vehicle))) info-override object-type) + ((14 15 16) + (go-virtual move-to-vehicle) + ) + ) + ) + (when (< (vector-vector-xz-distance (-> self root-override2 trans) (-> self end-pos)) 122880.0) + (when (not (-> self done?)) + (set! (-> self done?) #t) + (let ((a1-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-4 from) (process->ppointer self)) + (set! (-> a1-4 num-params) 0) + (set! (-> a1-4 message) 'task-done) + (let ((t9-2 send-event-function) + (v1-22 (-> *game-info* sub-task-list (-> self task-node))) + ) + (t9-2 + (handle->process (if (-> v1-22 info) + (-> v1-22 info manager) + (the-as handle #f) + ) + ) + a1-4 + ) + ) + ) + ) + (go-virtual active) + ) + (none) + ) + :code (behavior () + (until #f + (let ((f30-1 (/ 1.0 (rand-vu-float-range 10.0 13.0))) + (gp-0 (rand-vu-int-range 1 5)) + (s5-0 (rand-vu-int-count 2)) + ) + (ja-channel-push! 1 (seconds 0.2)) + (if (zero? s5-0) + (ja-no-eval :group! (-> self draw art-group data 4) :num! min) + (ja-no-eval :group! (-> self draw art-group data 6) :num! min) + ) + (let ((f28-0 0.0)) + (while (< f28-0 1.0) + (ja :num-func num-func-identity + :frame-num (lerp-scale 0.0 2.0 (+ (* -2.0 f28-0 f28-0 f28-0) (* 3.0 f28-0 f28-0)) 0.0 1.0) + ) + (suspend) + (+! f28-0 (-> self clock seconds-per-frame)) + ) + ) + (ja-channel-push! 1 (seconds 0.1)) + (while (> gp-0 0) + (+! gp-0 -1) + (cond + ((zero? s5-0) + (ja-no-eval :group! (-> self draw art-group data 5) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 5)) frames num-frames) -1)) + f30-1 + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max f30-1)) + ) + ) + (else + (ja-no-eval :group! (-> self draw art-group data 7) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 7)) frames num-frames) -1)) + f30-1 + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max f30-1)) + ) + ) + ) + ) + ) + ) + #f + (none) + ) + ) + +;; failed to figure out what this is: +(defstate in-ditch (citizen-rebel) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type civilian in-ditch) enter))) + (if t9-0 + (t9-0) + ) + ) + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) (process->ppointer self)) + (set! (-> a1-0 num-params) 0) + (set! (-> a1-0 message) 'fail) + (let ((t9-1 send-event-function) + (v1-9 (-> *game-info* sub-task-list (-> self task-node))) + ) + (t9-1 + (handle->process (if (-> v1-9 info) + (-> v1-9 info manager) + (the-as handle #f) + ) + ) + a1-0 + ) + ) + ) + (none) + ) + ) + +;; definition for method 74 of type citizen-rebel +;; WARN: disable def twice: 51. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +(defmethod general-event-handler citizen-rebel ((obj citizen-rebel) (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 'hit-flinch 'hit-knocked) + (when (nonzero? (-> obj gui-id)) + (set-action! + *gui-control* + (gui-action stop) + (the-as sound-id (-> obj gui-id)) + (gui-channel none) + (gui-action none) + (the-as string #f) + (the-as (function gui-connection symbol) #f) + (the-as process #f) + ) + (set! (-> obj gui-id) (the-as uint 0)) + 0 + ) + ((method-of-type civilian general-event-handler) obj arg0 arg1 arg2 arg3) + ) + (('play-speech) + (let ((s5-1 (-> arg3 param 0))) + (when (= (get-status *gui-control* (the-as sound-id (-> obj gui-id))) (gui-status unknown)) + (let ((v0-1 (the-as + object + (add-process *gui-control* obj (gui-channel citizen) (gui-action play) (the-as string s5-1) -99.0 0) + ) + ) + ) + (set! (-> obj gui-id) (the-as uint v0-1)) + v0-1 + ) + ) + ) + ) + (('nav-mesh-kill) + (format 0 "nav-mesh-kill event recieved by ~s~%" (-> obj name)) + (set! (-> obj nav-mesh-aid) (the-as actor-id (-> obj nav state mesh entity aid))) + (change-to *default-nav-mesh* obj) + #t + ) + (else + ((method-of-type citizen general-event-handler) obj arg0 arg1 arg2 arg3) + ) + ) + ) + +;; definition for method 58 of type citizen-rebel +(defmethod enemy-method-58 citizen-rebel ((obj citizen-rebel) (arg0 process) (arg1 event-message-block)) + (let* ((t9-0 (method-of-type nav-enemy enemy-method-58)) + (v0-0 (t9-0 obj arg0 arg1)) + ) + (if (logtest? #x4000000 (-> obj incoming penetrate-using)) + (set! v0-0 #f) + ) + v0-0 + ) + ) + +;; definition for method 59 of type citizen-rebel +(defmethod get-penetrate-info citizen-rebel ((obj citizen-rebel)) + "@returns the allowed way(s) this enemy can take damage +@see [[penetrate]] and [[penetrated-by-all&hit-points->penetrated-by]]" + (let ((v1-1 ((method-of-type nav-enemy get-penetrate-info) obj))) + (logior (penetrate enemy-yellow-shot) v1-1) + ) + ) + +;; failed to figure out what this is: +(defstate wait (citizen-rebel) + :virtual #t + :trans (behavior () + '() + (none) + ) + :code (behavior () + (until #f + (let ((f30-1 (/ 1.0 (rand-vu-float-range 10.0 13.0))) + (gp-0 (rand-vu-int-range 1 5)) + (s5-0 (rand-vu-int-count 2)) + ) + (ja-channel-push! 1 (seconds 0.2)) + (if (zero? s5-0) + (ja-no-eval :group! (-> self draw art-group data 4) :num! min) + (ja-no-eval :group! (-> self draw art-group data 6) :num! min) + ) + (let ((f28-0 0.0)) + (while (< f28-0 1.0) + (ja :num-func num-func-identity + :frame-num (lerp-scale 0.0 2.0 (+ (* -2.0 f28-0 f28-0 f28-0) (* 3.0 f28-0 f28-0)) 0.0 1.0) + ) + (suspend) + (+! f28-0 (-> self clock seconds-per-frame)) + ) + ) + (ja-channel-push! 1 (seconds 0.1)) + (while (> gp-0 0) + (+! gp-0 -1) + (cond + ((zero? s5-0) + (ja-no-eval :group! (-> self draw art-group data 5) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 5)) frames num-frames) -1)) + f30-1 + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max f30-1)) + ) + ) + (else + (ja-no-eval :group! (-> self draw art-group data 7) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 7)) frames num-frames) -1)) + f30-1 + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max f30-1)) + ) + ) + ) + ) + ) + (if (-> self wait-return-state) + (go (-> self wait-return-state)) + ) + ) + #f + (none) + ) + ) + +;; definition for method 115 of type citizen-rebel +;; WARN: Return type mismatch int vs none. +(defmethod init-enemy! citizen-rebel ((obj citizen-rebel)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-citizen-rebel" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (init-enemy-behaviour-and-stats! obj *citizen-rebel-nav-enemy-info*) + (let ((v1-5 (-> obj nav))) + (set! (-> v1-5 speed-scale) 1.0) + ) + 0 + (set! (-> obj draw lod-set lod 0 dist) 491520.0) + (try-update-focus (-> obj focus) *target* obj) + (-> obj neck) + (set! (-> obj info) *citizen-rebel-global-info*) + (set! (-> obj anim-shuffle) 10) + (let ((v1-16 (get-rand-int obj 3))) + (cond + ((zero? v1-16) + (set! (-> obj anim-walk) 11) + (set! (-> obj dist-walk-anim) 8736.768) + (set! (-> obj speed-walk) 10240.0) + ) + ((= v1-16 1) + (set! (-> obj anim-walk) 12) + (set! (-> obj dist-walk-anim) 13107.2) + (set! (-> obj speed-walk) 12288.0) + ) + ((= v1-16 2) + (set! (-> obj anim-walk) 13) + (set! (-> obj dist-walk-anim) 4370.432) + (set! (-> obj speed-walk) 4096.0) + ) + ) + ) + (let ((v1-31 (get-rand-int obj 3))) + (cond + ((zero? v1-31) + (set! (-> obj anim-panic-run) 17) + ) + ((= v1-31 1) + (set! (-> obj anim-panic-run) 18) + ) + ((= v1-31 2) + (set! (-> obj anim-panic-run) 14) + ) + ) + ) + (set! (-> obj dist-run-anim) 28672.0) + (let ((v1-38 (get-rand-int obj 3))) + (cond + ((zero? v1-38) + (set! (-> obj anim-run) 14) + ) + ((= v1-38 1) + (set! (-> obj anim-run) 15) + ) + ((= v1-38 2) + (set! (-> obj anim-run) 16) + ) + ) + ) + (set! (-> obj speed-run) 49152.0) + (set! (-> obj anim-on-ground) 20) + (set! (-> obj anim-dive) 19) + (set! (-> obj anim-get-up-front) 25) + (set! (-> obj anim-get-up-back) 26) + (let ((f30-0 (get-rand-float-range obj 1.0 1.25)) + (f0-10 (get-rand-float-range obj 1.0 1.25)) + ) + (set-vector! (-> obj root-override2 scale) f0-10 f30-0 f0-10 1.0) + ) + (let ((f0-12 (get-rand-float-range obj 0.9 1.0))) + (set-vector! (-> obj draw color-mult) f0-12 f0-12 f0-12 1.0) + ) + (set! (-> obj water-anim) 32) + (set! (-> obj water) (new 'process 'water-control obj 5 0.0 8192.0 2048.0)) + (set! (-> obj water flags) (water-flags active part-splash part-rings part-water)) + (set! (-> obj water height) (res-lump-float (-> obj entity) 'water-height)) + (set! (-> obj water ripple-size) 12288.0) + 0 + (none) + ) + +;; definition for method 114 of type citizen-rebel +;; WARN: Return type mismatch int vs none. +(defmethod init-enemy-collision! citizen-rebel ((obj citizen-rebel)) + "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 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 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec civilian)) + (set! (-> s4-0 prim-core collide-with) + (collide-spec backgnd jak civilian enemy 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 8192.0 0.0 12288.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 civilian)) + (set! (-> v1-13 prim-core collide-with) + (collide-spec backgnd jak civilian enemy hit-by-others-list player-list) + ) + (set! (-> v1-13 prim-core action) (collide-action solid)) + (set-vector! (-> v1-13 local-sphere) 0.0 4096.0 0.0 4096.0) + ) + (let ((v1-15 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-15 prim-core collide-as) (collide-spec civilian)) + (set! (-> v1-15 prim-core collide-with) + (collide-spec backgnd jak civilian enemy hit-by-others-list player-list) + ) + (set! (-> v1-15 prim-core action) (collide-action solid no-standon)) + (set-vector! (-> v1-15 local-sphere) 0.0 9830.4 0.0 4096.0) + ) + (set! (-> s5-0 nav-radius) 7372.8) + (let ((v1-17 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-17 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-17 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 3)) + (set! (-> obj root-override2) s5-0) + ) + 0 + (none) + ) + +;; definition for method 181 of type citizen-rebel +;; WARN: Return type mismatch int vs none. +(defmethod citizen-init! citizen-rebel ((obj citizen-rebel)) + "Initialize [[citizen]] defaults." + (let ((t9-0 (method-of-type civilian citizen-init!))) + (t9-0 obj) + ) + (set! (-> obj dive-reaction) (+ 0.09 (* 0.15 (rand-vu)))) + (logclear! (-> obj mask) (process-mask enemy)) + (setup-masks (-> obj draw) 0 -1) + (setup-masks (-> obj draw) 4 0) + (setup-masks (-> obj draw) 16 0) + (setup-masks (-> obj draw) 64 0) + (let ((v1-14 (get-rand-int obj 3))) + (cond + ((zero? v1-14) + (setup-masks (-> obj draw) 2 0) + ) + ((= v1-14 1) + (setup-masks (-> obj draw) 8 0) + ) + ((= v1-14 2) + (setup-masks (-> obj draw) 128 0) + ) + ) + ) + (let ((v1-23 (get-rand-int obj 2))) + (cond + ((zero? v1-23) + (setup-masks (-> obj draw) 32 0) + ) + ((= v1-23 1) + (setup-masks (-> obj draw) 256 0) + ) + ) + ) + (let ((v1-29 (-> obj nav))) + (set! (-> v1-29 sphere-mask) (the-as uint #x800fe)) + ) + 0 + 0 + (none) + ) + +;; definition of type city-shuttle-info +(deftype city-shuttle-info (structure) + ((pos vector :inline :offset-assert 0) + (level symbol :offset-assert 16) + (nav-mesh-id uint32 :offset-assert 20) + (time time-frame :offset-assert 24) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) + +;; definition for method 3 of type city-shuttle-info +(defmethod inspect city-shuttle-info ((obj city-shuttle-info)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'city-shuttle-info) + (format #t "~1Tpos: #~%" (-> obj pos)) + (format #t "~1Tlevel: ~A~%" (-> obj level)) + (format #t "~1Tnav-mesh-id: ~D~%" (-> obj nav-mesh-id)) + (format #t "~1Ttime: ~D~%" (-> obj time)) + (label cfg-4) + obj + ) + +;; definition for function shuttle-init +;; INFO: Used lq/sq +;; WARN: Return type mismatch float vs none. +(defun shuttle-init ((arg0 task-manager) (arg1 (array city-shuttle-info))) + (set-setting! 'minimap 'clear 0 32) + (let ((s3-0 *traffic-manager*) + (s4-0 (new 'stack 'traffic-object-spawn-params)) + ) + (set! (-> s4-0 position quad) (-> arg0 begin-pos quad)) + (quaternion-axis-angle! (-> s4-0 rotation) 0.0 1.0 0.0 0.0) + (set! (-> s4-0 object-type) (traffic-type cara)) + (set! (-> s4-0 behavior) (the-as uint 0)) + (set! (-> s4-0 id) (the-as uint 0)) + (set! (-> s4-0 proc) #f) + (send-event s3-0 'spawn-object s4-0) + (if (not (-> s4-0 proc)) + (format #t "traffic object spawn failed~%") + ) + (if (-> s4-0 proc) + (set! (-> arg0 slave 12) (process->handle (-> s4-0 proc))) + ) + ) + (let ((s4-1 (new 'stack-no-clear 'task-arrow-params))) + (set! (-> s4-1 pos quad) (-> arg1 0 pos quad)) + (quaternion-identity! (-> s4-1 quat)) + (set! (-> s4-1 flags) (task-arrow-flags)) + (set! (-> s4-1 map-icon) (the-as uint 15)) + (set! (-> arg0 arrow) (process->handle (task-arrow-spawn s4-1 (the-as task-arrow arg0)))) + ) + (set-parking-spot-prob *traffic-engine* 11 0.08) + (set-parking-spot-prob *traffic-engine* 12 0.08) + (set-parking-spot-prob *traffic-engine* 13 0.08) + (set-parking-spot-prob *traffic-engine* 14 0.35) + (set-parking-spot-prob *traffic-engine* 15 0.35) + (set-parking-spot-prob *traffic-engine* 16 0.08) + (set! (-> arg0 start-time) 0) + (set! (-> arg0 sub-state) (the-as uint 0)) + (set! (-> arg0 count) (-> arg1 length)) + (dotimes (v1-35 (-> arg0 count)) + (set! (-> arg0 data-int32 v1-35) 0) + ) + (set! (-> arg0 data-int32 8) 0) + (set! (-> arg0 data-int32 9) 0) + (set! (-> arg0 data-int32 10) 0) + (set! (-> *game-info* counter) (the float (/ (-> arg0 count) 2))) + (none) + ) + +;; definition for function shuttle-cleanup +;; WARN: Return type mismatch symbol vs none. +(defun shuttle-cleanup ((arg0 task-manager)) + (send-event *traffic-manager* 'restore-default-settings) + (dotimes (s5-0 (-> arg0 count)) + (let ((a0-4 (handle->process (-> arg0 slave s5-0)))) + (if a0-4 + (deactivate a0-4) + ) + ) + ) + (none) + ) + +;; definition for function shuttle-update +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defun shuttle-update ((arg0 task-manager) (arg1 (array city-shuttle-info)) (arg2 uint)) + (local-vars (v1-263 float) (v1-377 float) (sv-336 quaternion)) + (with-pp + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (cond + ((nonzero? (-> arg0 data-int32 9)) + (check-time arg0) + ) + (else + (set! (-> arg0 start-time) (-> pp clock frame-counter)) + (when (< (vector-vector-xz-distance (target-pos 0) (-> arg0 begin-pos)) 102400.0) + (set-setting! 'airlock #f 0 0) + (set! (-> arg0 data-int32 9) 1) + ) + ) + ) + (when (= (-> arg0 data-int32 10) (+ (-> arg0 sub-state) -1)) + (let ((s3-1 (handle->process (-> arg0 slave (logand -2 (-> arg0 data-int32 10)))))) + (when s3-1 + (let ((v1-20 (-> arg0 data-int32 10))) + (cond + ((zero? v1-20) + (let ((v0-4 (rand-vu-int-count 3))) + (cond + ((zero? v0-4) + (send-event s3-1 'play-speech "agnt038") + ) + ((= v0-4 1) + (send-event s3-1 'play-speech "agnt039") + ) + ((= v0-4 2) + (send-event s3-1 'play-speech "agnt040") + ) + ) + ) + ) + ((= v1-20 1) + (let ((v0-8 (rand-vu-int-count 4))) + (cond + ((zero? v0-8) + (send-event s3-1 'play-speech "agnt045") + ) + ((= v0-8 1) + (send-event s3-1 'play-speech "agnt046") + ) + ((= v0-8 2) + (send-event s3-1 'play-speech "agnt047") + ) + ((= v0-8 3) + (send-event s3-1 'play-speech "agnt048") + ) + ) + ) + ) + ((= v1-20 2) + (let ((v0-13 (rand-vu-int-count 4))) + (cond + ((zero? v0-13) + (send-event s3-1 'play-speech "agnt092") + ) + ((= v0-13 1) + (send-event s3-1 'play-speech "agnt093") + ) + ((= v0-13 2) + (send-event s3-1 'play-speech "agnt094") + ) + ((= v0-13 3) + (send-event s3-1 'play-speech "agnt095") + ) + ) + ) + ) + ((= v1-20 3) + (let ((v0-18 (rand-vu-int-count 3))) + (cond + ((zero? v0-18) + (send-event s3-1 'play-speech "agnt100") + ) + ((= v0-18 1) + (send-event s3-1 'play-speech "agnt101") + ) + ((= v0-18 2) + (send-event s3-1 'play-speech "agnt102") + ) + ) + ) + ) + ((= v1-20 4) + (let ((v0-22 (rand-vu-int-count 3))) + (cond + ((zero? v0-22) + (send-event s3-1 'play-speech "agnt115") + ) + ((= v0-22 1) + (send-event s3-1 'play-speech "agnt121") + ) + ((= v0-22 2) + (send-event s3-1 'play-speech "agnt122") + ) + ) + ) + ) + ((= v1-20 5) + (let ((v0-26 (rand-vu-int-count 3))) + (cond + ((zero? v0-26) + (send-event s3-1 'play-speech "agnt119") + ) + ((= v0-26 1) + (send-event s3-1 'play-speech "agnt120") + ) + ((= v0-26 2) + (send-event s3-1 'play-speech "agnt125") + ) + ) + ) + ) + ((= v1-20 6) + (let ((v0-30 (rand-vu-int-count 5))) + (cond + ((zero? v0-30) + (send-event s3-1 'play-speech "agnt131") + ) + ((= v0-30 1) + (send-event s3-1 'play-speech "agnt132") + ) + ((= v0-30 2) + (send-event s3-1 'play-speech "agnt133") + ) + ((= v0-30 3) + (send-event s3-1 'play-speech "agnt126") + ) + ((= v0-30 4) + (send-event s3-1 'play-speech "agnt127") + ) + ) + ) + ) + ((= v1-20 7) + (let ((v0-36 (rand-vu-int-count 2))) + (cond + ((zero? v0-36) + (send-event s3-1 'play-speech "agnt135") + ) + ((= v0-36 1) + (send-event s3-1 'play-speech "agnt130") + ) + ) + ) + ) + ) + ) + (+! (-> arg0 data-int32 10) 1) + ) + ) + ) + (let ((s3-2 (-> arg0 sub-state))) + (cond + ((>= s3-2 (the-as uint (-> arg0 count))) + (go (method-of-object arg0 complete)) + ) + ((not (logtest? s3-2 1)) + (let ((s2-0 (handle->process (-> arg0 slave s3-2)))) + (cond + (s2-0 + (let* ((s1-0 (entity-nav-mesh-by-aid (-> (the-as citizen-rebel s2-0) nav-mesh-aid))) + (s4-1 (if (type? s1-0 entity-nav-mesh) + s1-0 + ) + ) + ) + (cond + (s4-1 + (when (focus-test? (the-as citizen-rebel s2-0) inactive) + (let ((s1-1 (new 'stack 'traffic-object-spawn-params))) + (set! (-> s1-1 object-type) (traffic-type tt5)) + (set! (-> s1-1 behavior) (the-as uint 7)) + (set! (-> s1-1 id) (the-as uint 0)) + (set! (-> s1-1 nav-mesh) #f) + (set! (-> s1-1 nav-branch) #f) + (set! (-> s1-1 proc) #f) + (set! (-> s1-1 handle) (-> arg0 slave s3-2)) + (set! (-> s1-1 user-data) (the-as uint 0)) + (set! (-> s1-1 flags) (traffic-spawn-flags)) + (set! (-> s1-1 guard-type) (the-as uint 7)) + (vector-reset! (-> s1-1 velocity)) + (set! (-> s1-1 position quad) (-> (the-as citizen-rebel s2-0) root-override2 trans quad)) + (quaternion-copy! (-> s1-1 rotation) (-> (the-as citizen-rebel s2-0) root-override2 quat)) + (set! (-> s1-1 nav-mesh) (-> s4-1 nav-mesh)) + (activate-by-handle *traffic-engine* s1-1) + ) + ) + (let ((v1-230 *target*)) + (when (and v1-230 (focus-test? v1-230 pilot)) + (let ((s4-2 (handle->process (-> v1-230 pilot vehicle)))) + (when s4-2 + (cond + ((and (focus-test? (the-as citizen-rebel s2-0) pilot) + (handle->process (-> (the-as citizen-rebel s2-0) vehicle)) + ) + (send-event (handle->process (-> arg0 arrow)) 'set-position (-> arg1 (+ s3-2 1) pos)) + (+! (-> arg0 sub-state) 1) + (set! (-> arg0 time-limit) (+ (-> arg1 s3-2 time) (-> arg1 (+ s3-2 1) time))) + ) + (else + (let ((v1-260 (get-best-seat-for-vehicle + (the-as vehicle s4-2) + (-> (the-as vehicle s4-2) root-override-2 trans) + (the-as int (-> (the-as citizen-rebel s2-0) info seat-flag)) + 1 + ) + ) + ) + (when (!= v1-260 -1) + (.lvf vf1 (&-> (-> (the-as vehicle s4-2) root-override-2 transv) quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.mov v1-263 vf1) + (let ((f0-1 v1-263) + (f1-1 32768.0) + ) + (if (and (< f0-1 (* f1-1 f1-1)) (let ((f0-2 (vector-vector-distance-squared + (-> (the-as vehicle s4-2) root-override-2 trans) + (-> (the-as citizen-rebel s2-0) root-override2 trans) + ) + ) + (f1-4 65536.0) + ) + (< f0-2 (* f1-4 f1-4)) + ) + ) + (send-event s2-0 'board-vehicle s4-2) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (else + (if (not (focus-test? (the-as citizen-rebel s2-0) inactive)) + (send-event s2-0 'traffic-off-force) + ) + ) + ) + ) + (if (and (-> s2-0 next-state) (= (-> s2-0 next-state name) 'wait-for-ride)) + (send-event + (handle->process (-> arg0 arrow)) + 'set-position + (-> (the-as citizen-rebel s2-0) root-override2 trans) + ) + ) + ) + (else + (when (zero? (-> arg0 data-int32 s3-2)) + (send-event (handle->process (-> arg0 arrow)) 'set-position (-> arg1 s3-2 pos)) + (set! (-> arg0 time-limit) (-> arg1 s3-2 time)) + (set! (-> arg0 start-time) (-> pp clock frame-counter)) + (set! (-> arg0 data-int32 s3-2) 1) + ) + (let ((s1-2 (find-nearest-nav-mesh (-> arg1 s3-2 pos) (the-as float #x7f800000)))) + (when (and s1-2 (nonzero? s1-2)) + (let ((s2-1 (new 'stack 'traffic-object-spawn-params))) + (set! (-> s2-1 object-type) (traffic-type tt5)) + (set! (-> s2-1 behavior) (the-as uint 7)) + (set! (-> s2-1 id) (the-as uint 0)) + (set! (-> s2-1 nav-mesh) #f) + (set! (-> s2-1 nav-branch) #f) + (set! (-> s2-1 proc) #f) + (set! (-> s2-1 handle) (the-as handle #f)) + (set! (-> s2-1 user-data) (the-as uint 0)) + (set! (-> s2-1 flags) (traffic-spawn-flags)) + (set! (-> s2-1 guard-type) (the-as uint 7)) + (vector-reset! (-> s2-1 velocity)) + (set! (-> s2-1 position quad) (-> arg1 s3-2 pos quad)) + (let ((s0-0 quaternion-copy!)) + (set! sv-336 (-> s2-1 rotation)) + (let ((a1-50 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) *up-vector* 0.0))) + (s0-0 sv-336 a1-50) + ) + ) + (logior! (-> s2-1 flags) (traffic-spawn-flags trsflags-00)) + (set! (-> s2-1 id) (the-as uint 122)) + (set! (-> s2-1 proc) #f) + (let ((v0-58 (citizen-spawn arg0 citizen-rebel s2-1))) + (cond + (v0-58 + (set! (-> (the-as citizen-rebel v0-58) end-pos quad) (-> arg1 (+ s3-2 1) pos quad)) + (set! (-> arg0 slave s3-2) (process->handle (the-as citizen-rebel v0-58))) + (logior! (-> (the-as citizen-rebel v0-58) flags) (citizen-flag persistent)) + (set! (-> (the-as citizen-rebel v0-58) task-node) arg2) + (set! (-> (the-as citizen-rebel v0-58) nav-mesh-aid) (the-as actor-id (-> s1-2 entity aid))) + (set! (-> (the-as citizen-rebel v0-58) done?) #f) + (set! (-> (the-as citizen-rebel v0-58) index) s3-2) + (send-event *traffic-manager* 'add-object (-> s2-1 object-type) (the-as citizen-rebel v0-58)) + ) + (else + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (else + (let ((s4-3 (handle->process (-> arg0 slave (+ s3-2 -1))))) + (if (not s4-3) + (go (method-of-object arg0 fail)) + ) + (if (or (not *target*) (not (logtest? (focus-status pilot) (-> *target* focus-status)))) + (send-event s4-3 'exit-vehicle (-> (the-as process-drawable s4-3) root trans)) + ) + (when (-> *target* pilot) + (let ((s5-1 (-> arg1 s3-2 pos)) + (s2-2 (handle->process (-> *target* pilot vehicle))) + ) + (cond + ((focus-test? (the-as process-focusable s4-3) pilot) + (if (and s2-2 + (let ((f0-3 (vector-vector-distance-squared s5-1 (-> (the-as process-drawable s2-2) root trans))) + (f1-7 65536.0) + ) + (< f0-3 (* f1-7 f1-7)) + ) + (begin + (.lvf vf1 (&-> (-> (the-as process-drawable s2-2) root transv) quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.mov v1-377 vf1) + (let ((f0-4 v1-377) + (f1-10 12288.0) + ) + (< f0-4 (* f1-10 f1-10)) + ) + ) + ) + (send-event s4-3 'exit-vehicle s5-1) + ) + ) + ((not (-> (the-as citizen-rebel s4-3) done?)) + (set! (-> arg0 data-int32 s3-2) 0) + (+! (-> arg0 sub-state) -1) + ) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + ) + ) + +;; definition for symbol *city-shuttle-info*, type (array city-shuttle-info) +(define *city-shuttle-info* (new 'static 'boxed-array :type city-shuttle-info + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 4288512.0 :y 37969.92 :z 237568.0 :w 1.0) + :level 'ctysluma + :nav-mesh-id #x2578 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 4419584.0 :y 33341.44 :z 1449984.0 :w 1.0) + :level 'ctysluma + :nav-mesh-id #x2578 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 3519856.8 :y 33341.44 :z 1196646.4 :w 1.0) + :level 'ctysluma + :nav-mesh-id #x2578 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 2766438.5 :y 32727.04 :z -1390428.1 :w 1.0) + :level 'ctyslumb + :nav-mesh-id #x2644 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 1641594.9 :y 32727.04 :z -1032192.0 :w 1.0) + :level 'ctyslumb + :nav-mesh-id #x2644 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 1734901.8 :y 32563.2 :z -239656.95 :w 1.0) + :level 'ctyslumb + :nav-mesh-id #x2644 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 2341396.5 :y 32727.04 :z -63037.44 :w 1.0) + :level 'ctyslumb + :nav-mesh-id #x2644 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 2429870.0 :y 32563.2 :z -2287288.2 :w 1.0) + :level 'ctyslumc + :nav-mesh-id #x2644 + :time (seconds 60) + ) + ) + ) + +;; failed to figure out what this is: +(set-subtask-hook! + *game-info* + 95 + 6 + (the-as (function object) (lambda :behavior task-manager + ((arg0 citizen-rebel) (arg1 object) (arg2 symbol)) + (case arg2 + (('task-done) + (format #t "task-done~%") + (set! (-> self sub-state) (+ (-> arg0 index) 2)) + (set! (-> *game-info* counter) (+ -1.0 (-> *game-info* counter))) + ) + ) + (none) + ) + ) + ) + +;; failed to figure out what this is: +(set-subtask-hook! + *game-info* + 95 + 0 + (the-as + (function object) + (lambda :behavior task-manager + () + (set-setting! 'exclusive-task #f 0 (-> self node-info task)) + (set! (-> self begin-pos quad) (-> (new 'static 'vector :x 4698112.0 :y 40960.0 :z 81920.0 :w 1.0) quad)) + (let ((v1-4 (entity-by-name "parking-spot-8"))) + (if v1-4 + (logior! (-> v1-4 extra perm status) (entity-perm-status bit-9)) + ) + ) + (shuttle-init self *city-shuttle-info*) + (none) + ) + ) + ) + +;; failed to figure out what this is: +(set-subtask-hook! + *game-info* + 95 + 1 + (the-as (function object) (lambda :behavior task-manager + () + (let ((t9-0 shuttle-cleanup) + (a0-0 self) + ) + *city-shuttle-info* + (t9-0 a0-0) + ) + (send-event *traffic-manager* 'restore-default-settings) + (none) + ) + ) + ) + +;; failed to figure out what this is: +(set-subtask-hook! + *game-info* + 95 + 2 + (the-as + (function object) + (lambda :behavior task-manager () (shuttle-update self *city-shuttle-info* (the-as uint 95)) (none)) + ) + ) + +;; failed to figure out what this is: +(set-subtask-hook! + *game-info* + 95 + 3 + (the-as + (function object) + (lambda :behavior task-manager + () + (set! (-> self hud-counter) (ppointer->handle (process-spawn hud-citizen :init hud-init-by-other :to self))) + (send-event *traffic-manager* 'set-target-level #x3f400000) + (send-event *traffic-manager* 'set-guard-target-count-range 4 0 1) + (send-event *traffic-manager* 'set-guard-target-count-range 5 0 1) + (send-event *traffic-manager* 'set-guard-target-count-range 0 0 2) + (send-event *traffic-manager* 'set-guard-target-count-range 1 0 3) + (while (zero? (-> self sub-state)) + (suspend) + ) + (set! (-> self state-time) (-> self clock frame-counter)) + (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (suspend) + ) + (send-event *traffic-manager* 'set-alert-level 2) + (send-event *traffic-manager* 'set-alert-duration #xa4cb80) + (none) + ) + ) + ) + +;; failed to figure out what this is: +(set-subtask-hook! + *game-info* + 95 + 5 + (the-as + (function object) + (lambda :behavior task-manager () (send-event (handle->process (-> self arrow)) 'die) (none)) + ) + ) + +;; failed to figure out what this is: +(set-subtask-hook! + *game-info* + 95 + 4 + (the-as + (function object) + (lambda :behavior task-manager + () + (set! (-> self state-time) (-> self clock frame-counter)) + (talker-spawn-func (-> *talker-speech* 97) *entity-pool* (target-pos 0) (the-as region #f)) + (let ((gp-1 (-> self clock frame-counter))) + (until #f + (let ((v1-4 0)) + (dotimes (a0-2 4) + (let ((a1-5 (handle->process (-> self slave (* a0-2 2))))) + (if (or (not a1-5) (and (-> a1-5 next-state) (= (-> a1-5 next-state name) 'inactive))) + (+! v1-4 1) + ) + ) + ) + (if (or (>= v1-4 4) (>= (- (-> self clock frame-counter) gp-1) (seconds 10))) + (goto cfg-23) + ) + ) + (suspend) + 0 + ) + ) + #f + (label cfg-23) + (task-node-close! (game-task-node city-shuttle-resolution)) + (none) + ) + ) + ) + +;; definition for symbol *city-burning-bush-shuttle-1-info*, type (array city-shuttle-info) +(define *city-burning-bush-shuttle-1-info* + (new 'static 'boxed-array :type city-shuttle-info + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x -1519902.8 :y 32727.04 :z 2502369.2 :w 1.0) + :level 'ctysluma + :nav-mesh-id #x2578 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 715612.2 :y 81879.04 :z 2993889.2 :w 1.0) + :level 'ctysluma + :nav-mesh-id #x2578 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 1588920.4 :y 65536.0 :z 2774384.8 :w 1.0) + :level 'ctysluma + :nav-mesh-id #x2578 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x -218152.95 :y 31621.12 :z 5460336.5 :w 1.0) + :level 'ctyslumb + :nav-mesh-id #x2644 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 767180.8 :y 70778.88 :z 7193682.0 :w 1.0) + :level 'ctyslumb + :nav-mesh-id #x2644 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 4055408.8 :y 32727.04 :z 4727562.0 :w 1.0) + :level 'ctyslumb + :nav-mesh-id #x2644 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 4694958.0 :y 32727.04 :z 3358392.2 :w 1.0) + :level 'ctyslumb + :nav-mesh-id #x2644 + :time (seconds 60) + ) + (new 'static 'city-shuttle-info + :pos (new 'static 'vector :x 4653957.0 :y 33341.44 :z 638730.25 :w 1.0) + :level 'ctyslumc + :nav-mesh-id #x2644 + :time (seconds 60) + ) + ) + ) + +;; failed to figure out what this is: +(set-subtask-hook! + *game-info* + 279 + 6 + (the-as (function object) (lambda :behavior task-manager + ((arg0 citizen-rebel) (arg1 object) (arg2 symbol)) + (case arg2 + (('task-done) + (format #t "task-done~%") + (set! (-> self sub-state) (+ (-> arg0 index) 2)) + (set! (-> *game-info* counter) (+ -1.0 (-> *game-info* counter))) + ) + ) + (none) + ) + ) + ) + +;; failed to figure out what this is: +(set-subtask-hook! + *game-info* + 279 + 0 + (the-as + (function object) + (lambda :behavior task-manager + () + (set-setting! 'airlock #f 0 0) + (set-setting! 'exclusive-task #f 0 (-> self node-info task)) + (set! (-> self begin-pos quad) (-> (new 'static 'vector :x -687390.75 :y 40960.0 :z 3479224.2 :w 1.0) quad)) + (shuttle-init self *city-burning-bush-shuttle-1-info*) + (none) + ) + ) + ) + +;; failed to figure out what this is: +(set-subtask-hook! + *game-info* + 279 + 1 + (the-as (function object) (lambda :behavior task-manager + () + (let ((t9-0 shuttle-cleanup) + (a0-0 self) + ) + *city-burning-bush-shuttle-1-info* + (t9-0 a0-0) + ) + (send-event *traffic-manager* 'restore-default-settings) + (none) + ) + ) + ) + +;; failed to figure out what this is: +(set-subtask-hook! + *game-info* + 279 + 2 + (lambda :behavior task-manager + () + (the-as symbol (shuttle-update self *city-burning-bush-shuttle-1-info* (the-as uint 279))) + ) + ) + +;; failed to figure out what this is: +(set-subtask-hook! + *game-info* + 279 + 3 + (the-as + (function object) + (lambda :behavior task-manager + () + (set! (-> self hud-counter) (ppointer->handle (process-spawn hud-citizen :init hud-init-by-other :to self))) + (send-event *traffic-manager* 'set-target-level #x3f400000) + (send-event *traffic-manager* 'set-guard-target-count-range 4 0 1) + (send-event *traffic-manager* 'set-guard-target-count-range 5 0 1) + (send-event *traffic-manager* 'set-guard-target-count-range 0 0 2) + (send-event *traffic-manager* 'set-guard-target-count-range 1 0 3) + (while (zero? (-> self sub-state)) + (suspend) + ) + (set! (-> self state-time) (-> self clock frame-counter)) + (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 5)) + (suspend) + ) + (send-event *traffic-manager* 'set-alert-level 2) + (send-event *traffic-manager* 'set-alert-duration #xa4cb80) + (none) + ) + ) + ) + +;; failed to figure out what this is: +(set-subtask-hook! + *game-info* + 279 + 5 + (the-as + (function object) + (lambda :behavior task-manager () (send-event (handle->process (-> self arrow)) 'die) (none)) + ) + ) + +;; failed to figure out what this is: +(set-subtask-hook! + *game-info* + 279 + 4 + (the-as + (function object) + (lambda :behavior task-manager + () + (set! (-> self state-time) (-> self clock frame-counter)) + (until #f + (let ((v1-2 0)) + (dotimes (a0-0 4) + (let ((a1-4 (handle->process (-> self slave (* a0-0 2))))) + (if (and a1-4 (-> a1-4 next-state) (= (-> a1-4 next-state name) 'inactive)) + (+! v1-2 1) + ) + ) + ) + (if (= v1-2 4) + (goto cfg-20) + ) + ) + (suspend) + 0 + ) + #f + (label cfg-20) + (task-node-close! (game-task-node city-burning-bush-shuttle-1-resolution)) + (none) + ) + ) + ) + + + + diff --git a/test/offline/config/jak2/config.jsonc b/test/offline/config/jak2/config.jsonc index aac3723e66..ba3d49b7cc 100644 --- a/test/offline/config/jak2/config.jsonc +++ b/test/offline/config/jak2/config.jsonc @@ -50,6 +50,7 @@ "DGO/LMEETBRT.DGO", "DGO/LPORTRUN.DGO", "DGO/LSACK.DGO", + "DGO/LSHUTTLE.DGO", "DGO/MCN.DGO", "DGO/MTN.DGO", "DGO/NEB.DGO",