diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index 8b4deb137d..9f7f9d4212 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -42196,29 +42196,29 @@ :size-assert #x400 :flag-assert #xf003800400 (:methods - (kid-escort-method-225 () none 225) - (kid-escort-method-226 () none 226) - (kid-escort-method-227 () none 227) - (kid-escort-method-228 () none 228) - (kid-escort-method-229 () none 229) - (kid-escort-method-230 () none 230) - (kid-escort-method-231 () none 231) - (kid-escort-method-232 () none 232) - (kid-escort-method-233 () none 233) - (kid-escort-method-234 () none 234) - (kid-escort-method-235 () none 235) - (kid-escort-method-236 () none 236) - (kid-escort-method-237 () none 237) - (kid-escort-method-238 () none 238) - (kid-escort-method-239 () none 239) + (traveling () _type_ :state 225) + (traveling-blocked () _type_ :state 226) + (waiting-idle () _type_ :state 227) + (waiting-turn () _type_ :state 228) + (move-to-vehicle () _type_ :state 229) + (board-vehicle () _type_ :state 230) + (ride-vehicle () _type_ :state 231) + (exit-vehicle () _type_ :state 232) + (knocked-off-vehicle () _type_ :state 233) + (arrested () _type_ :state 234) + (want-exit-vehicle? (_type_ vector) symbol 235) + (check-arrest (_type_) none 236) + (go-waiting-turn (_type_) none 237) + (check-vehicle-exit (_type_) none 238) + (play-walk-anim (_type_) none 239) ) ) (deftype kidesct-wait-spot (ai-task) - ((check-done basic :offset 32) - (which-spot int8 :offset 36) - (num-spots uint8 :offset 37) - (spot-indexes int8 6 :offset 38) + ((check-done (function kidesct-wait-spot kid-escort symbol) :offset 32) + (which-spot int8 :offset 36) + (num-spots uint8 :offset 37) + (spot-indexes uint8 6 :offset 38) ) :method-count-assert 12 :size-assert #x30 @@ -42242,28 +42242,28 @@ :size-assert #x410 :flag-assert #xef03900410 (:methods - (crocadog-escort-method-225 () none 225) - (crocadog-escort-method-226 () none 226) - (crocadog-escort-method-227 () none 227) - (crocadog-escort-method-228 () none 228) - (crocadog-escort-method-229 () none 229) - (crocadog-escort-method-230 () none 230) - (crocadog-escort-method-231 () none 231) - (crocadog-escort-method-232 () none 232) - (crocadog-escort-method-233 () none 233) - (crocadog-escort-method-234 () none 234) - (crocadog-escort-method-235 () none 235) - (crocadog-escort-method-236 () none 236) - (crocadog-escort-method-237 () none 237) - (crocadog-escort-method-238 () none 238) + (traveling () _type_ :state 225) + (traveling-blocked () _type_ :state 226) + (waiting-idle () _type_ :state 227) + (waiting-turn () _type_ :state 228) + (move-to-vehicle () _type_ :state 229) + (board-vehicle () _type_ :state 230) + (ride-vehicle () _type_ :state 231) + (exit-vehicle () _type_ :state 232) + (knocked-off-vehicle () _type_ :state 233) + (want-exit-vehicle? (_type_ vector) symbol 234) + (go-idle-or-move (_type_) none 235) + (go-waiting-turn (_type_) none 236) + (check-vehicle-exit (_type_) none 237) + (play-walk-anim (_type_) none 238) ) ) (deftype crocesct-wait-spot (ai-task) - ((check-done basic :offset 32) - (which-spot int8 :offset 36) - (num-spots uint8 :offset 37) - (spot-indexes int8 6 :offset 38) + ((check-done (function crocesct-wait-spot crocadog-escort symbol) :offset 32) + (which-spot int8 :offset 36) + (num-spots uint8 :offset 37) + (spot-indexes uint8 6 :offset 38) ) :method-count-assert 12 :size-assert #x30 @@ -42275,49 +42275,45 @@ ;; hal4-course ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype hal4-course (bot-course) - ((defend-speeches basic :offset-assert 48) + ((defend-speeches bot-speech-list-shuffle :offset-assert 48) ) :method-count-assert 9 :size-assert #x34 :flag-assert #x900000034 ;; field default-check-too-far uses ~A with a signed load ) -|# -#| (deftype hal-escort (hal) - ((vehicle-handle uint64 :offset-assert 772) - (arrow-handle uint64 :offset-assert 1028) - (arrestor-handle uint64 :offset-assert 1036) - (arrestor-time time-frame :offset-assert 1044) - (locked-player-time time-frame :offset-assert 1052) - (dont-fail-until uint64 :offset-assert 1060) - (played-defend-time time-frame :offset-assert 1068) - (played-get-in-time time-frame :offset-assert 1076) - (notice-plane plane :inline :offset-assert 1084) + ((hal4-course hal4-course :offset 652 :score 1) + (arrow-handle handle :offset 1032) + (arrestor-handle handle :offset-assert 1040) + (arrestor-time time-frame :offset-assert 1048) + (locked-player-time time-frame :offset-assert 1056) + (dont-fail-until time-frame :offset-assert 1064) + (played-defend-time time-frame :offset-assert 1072) + (played-get-in-time time-frame :offset-assert 1080) + (notice-plane plane :inline :offset-assert 1088) ) :method-count-assert 237 :size-assert #x450 :flag-assert #xed03d00450 (:methods - (hal-escort-method-227 () none 227) - (hal-escort-method-228 () none 228) - (hal-escort-method-229 () none 229) - (hal-escort-method-230 () none 230) - (hal-escort-method-231 () none 231) - (hal-escort-method-232 () none 232) - (hal-escort-method-233 () none 233) - (hal-escort-method-234 () none 234) - (hal-escort-method-235 () none 235) - (hal-escort-method-236 () none 236) + (hal-escort-method-227 (_type_) symbol 227) + (hal-escort-method-228 (_type_) symbol 228) + (try-enter-vehicle "Returns seat index" (_type_) int 229) + (hal-escort-method-230 (_type_) symbol 230) + (init-traffic-params! (_type_ symbol) none 231) + (hal-escort-method-232 (_type_) none 232) + (set-traffic-danger! (_type_) none 233) + (hal-escort-method-234 (_type_ nav-mesh) process 234) + (hal-escort-method-235 (_type_) none 235) + (vehicle-destroyed? (_type_) symbol 236) ) ) -|# -;; (define-extern hal4-walking-too-far function) -;; (define-extern *hal4-course* hal4-course) +(define-extern hal4-walking-too-far (function hal-escort int)) +(define-extern *hal4-course* hal4-course) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; kidesc-task ;; @@ -42328,7 +42324,7 @@ ;; kidesc ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *kid-escort-nav-enemy-info* nav-enemy-info) +(define-extern *kid-escort-nav-enemy-info* nav-enemy-info) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; kidesc-states ;; @@ -42344,7 +42340,7 @@ ;; crocesc ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *crocadog-escort-nav-enemy-info* nav-enemy-info) +(define-extern *crocadog-escort-nav-enemy-info* nav-enemy-info) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; crocesc-states ;; @@ -42355,14 +42351,14 @@ ;; kidesc4-course ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern kid4-update-spot-to-track-crocadog function) -;; (define-extern *kid4-course* bot-course) +(define-extern kid4-update-spot-to-track-crocadog (function kid-escort none)) +(define-extern *kid4-course* bot-course) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; crocesc4-course ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *crocadog4-course* bot-course) +(define-extern *crocadog4-course* bot-course) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; nest-obs ;; @@ -52677,20 +52673,18 @@ ;; ash4-course ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype ashelin-tanker (ashelin) - ((suppress traffic-suppression-params :inline :offset-assert 1036) + ((suppress traffic-suppression-params :inline :offset-assert 1040) ) :method-count-assert 252 :size-assert #x439 :flag-assert #xfc03c00439 (:methods - (ashelin-tanker-method-251 () none 251) + (suppress-traffic (_type_) none 251) ) ) -|# -;; (define-extern *ash4-course* ashelin-course) +(define-extern *ash4-course* ashelin-course) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; hiphog-obs ;; diff --git a/decompiler/config/jak2/anonymous_function_types.jsonc b/decompiler/config/jak2/anonymous_function_types.jsonc index 41e07e66a3..b35737ce15 100644 --- a/decompiler/config/jak2/anonymous_function_types.jsonc +++ b/decompiler/config/jak2/anonymous_function_types.jsonc @@ -1243,5 +1243,152 @@ [11, "(function city-lurker object symbol none :behavior task-manager)"], [12, "(function none :behavior task-manager)"], [13, "(function none :behavior task-manager)"] + ], + "hal4-course": [ + [0, "(function hal-escort none)"], + [1, "(function hal-escort none)"], + [2, "(function symbol)"], + [3, "(function hal-escort none)"], + [4, "(function symbol)"], + [5, "(function hal-escort none)"], + [6, "(function object hal-escort symbol)"], + [7, "(function hal-escort none)"], + [8, "(function hal-escort none)"], + [9, "(function symbol)"], + [10, "(function hal-escort none)"], + [11, "(function hal-escort none)"], + [12, "(function hal-escort none)"], + [13, "(function object hal-escort symbol)"], + [14, "(function hal-escort none)"], + [15, "(function hal-escort none)"], + [16, "(function object hal-escort symbol)"], + [17, "(function hal-escort none)"], + [18, "(function hal-escort none)"], + [19, "(function hal-escort none)"], + [20, "(function object hal-escort symbol)"], + [21, "(function hal-escort none)"], + [22, "(function hal-escort none)"], + [23, "(function object hal-escort symbol)"], + [24, "(function hal-escort none)"], + [25, "(function hal-escort none)"], + [26, "(function object hal-escort symbol)"], + [27, "(function hal-escort none)"], + [28, "(function hal-escort none)"], + [29, "(function hal-escort none)"], + [30, "(function object hal-escort symbol)"], + [31, "(function hal-escort none)"], + [32, "(function hal-escort none)"], + [33, "(function object hal-escort symbol)"], + [34, "(function hal-escort none)"], + [35, "(function hal-escort none)"], + [36, "(function object hal-escort symbol)"], + [37, "(function hal-escort none)"], + [38, "(function object hal-escort symbol)"], + [39, "(function hal-escort none)"], + [40, "(function object hal-escort symbol)"] + ], + "crocesc4-course": [ + [0, "(function crocadog-escort none)"], + [1, "(function crocadog-escort symbol)"], + [2, "(function crocadog-escort none)"], + [3, "(function object crocadog-escort symbol)"], + [4, "(function crocadog-escort none)"], + [5, "(function object crocadog-escort symbol)"], + [6, "(function crocadog-escort none)"], + [7, "(function object crocadog-escort symbol)"], + [8, "(function crocadog-escort none)"], + [9, "(function object crocadog-escort symbol)"], + [10, "(function crocadog-escort none)"], + [11, "(function object crocadog-escort symbol)"], + [12, "(function crocadog-escort none)"], + [13, "(function crocadog-escort none)"], + [14, "(function object crocadog-escort symbol)"], + [15, "(function crocadog-escort none)"], + [16, "(function object crocadog-escort symbol)"], + [17, "(function crocadog-escort none)"], + [18, "(function object crocadog-escort symbol)"], + [19, "(function crocadog-escort none)"], + [20, "(function object crocadog-escort symbol)"], + [21, "(function crocadog-escort none)"], + [22, "(function crocadog-escort none)"], + [23, "(function object crocadog-escort symbol)"], + [24, "(function crocadog-escort none)"], + [25, "(function object crocadog-escort symbol)"], + [26, "(function crocadog-escort none)"], + [27, "(function object crocadog-escort symbol)"], + [28, "(function crocadog-escort none)"], + [29, "(function object crocadog-escort symbol)"], + [30, "(function crocadog-escort none)"], + [31, "(function object crocadog-escort symbol)"], + [32, "(function crocadog-escort none)"], + [33, "(function object crocadog-escort symbol)"], + [34, "(function crocadog-escort none)"], + [35, "(function object crocadog-escort symbol)"], + [36, "(function crocadog-escort none)"], + [37, "(function object crocadog-escort symbol)"], + [38, "(function crocadog-escort none)"], + [39, "(function object crocadog-escort symbol)"], + [40, "(function crocadog-escort none)"], + [41, "(function object crocadog-escort symbol)"], + [42, "(function crocadog-escort none)"], + [43, "(function object crocadog-escort symbol)"], + [44, "(function crocadog-escort none)"], + [45, "(function object crocadog-escort symbol)"], + [46, "(function crocadog-escort none)"], + [47, "(function object crocadog-escort symbol)"], + [48, "(function crocadog-escort none)"], + [49, "(function object crocadog-escort symbol)"] + ], + "kidesc4-course": [ + [0, "(function kid-escort none)"], + [1, "(function object kid-escort symbol)"], + [2, "(function kid-escort none)"], + [3, "(function kid-escort none)"], + [4, "(function object kid-escort symbol)"], + [5, "(function kid-escort none)"], + [6, "(function kid-escort none)"], + [7, "(function object kid-escort symbol)"], + [8, "(function kid-escort none)"], + [9, "(function object kid-escort symbol)"], + [10, "(function kid-escort none)"], + [11, "(function object kid-escort symbol)"], + [12, "(function kid-escort none)"], + [13, "(function object kid-escort symbol)"], + [14, "(function kid-escort none)"], + [15, "(function object kid-escort symbol)"], + [16, "(function kid-escort none)"], + [17, "(function kid-escort none)"], + [18, "(function kid-escort none)"], + [19, "(function object kid-escort symbol)"], + [20, "(function kid-escort none)"], + [21, "(function kid-escort none)"], + [22, "(function object kid-escort symbol)"], + [23, "(function kid-escort none)"], + [24, "(function object kid-escort symbol)"] + ], + "ash4-course": [ + [0, "(function ashelin-tanker none)"], + [1, "(function ashelin-tanker none)"], + [2, "(function object ashelin-tanker none)"], + [3, "(function ashelin-tanker none)"], + [4, "(function ashelin-tanker none)"], + [5, "(function ashelin-tanker symbol)"], + [6, "(function ashelin-tanker none)"], + [7, "(function ashelin-tanker none)"], + [8, "(function object ashelin-tanker symbol)"], + [9, "(function ashelin-tanker none)"], + [10, "(function ashelin-tanker none)"], + [11, "(function object ashelin-tanker symbol)"], + [12, "(function ashelin-tanker none)"], + [13, "(function ashelin-tanker none)"], + [14, "(function object ashelin-tanker symbol)"], + [15, "(function ashelin-tanker none)"], + [16, "(function object ashelin-tanker symbol)"], + [17, "(function ashelin-tanker none)"], + [18, "(function object ashelin-tanker symbol)"], + [19, "(function ashelin-tanker none)"], + [20, "(function object ashelin-tanker symbol)"], + [21, "(function ashelin-tanker none)"], + [22, "(function object ashelin-tanker symbol)"] ] } diff --git a/decompiler/config/jak2/hacks.jsonc b/decompiler/config/jak2/hacks.jsonc index 7da5ae5a02..825b87fe7e 100644 --- a/decompiler/config/jak2/hacks.jsonc +++ b/decompiler/config/jak2/hacks.jsonc @@ -525,7 +525,8 @@ "(anon-function 41 guard)": [9], "(anon-function 10 metalhead-predator)": [24, 25], "(anon-function 10 errol-chal)": [6], - "choose-next-branch-no-exit-level": [0, 6, 8, 12, 13, 16, 18, 26] + "choose-next-branch-no-exit-level": [0, 6, 8, 12, 13, 16, 18, 26], + "(anon-function 39 kidesc-states)": [4, 5] }, // Sometimes the game might use format strings that are fetched dynamically, diff --git a/decompiler/config/jak2/inputs.jsonc b/decompiler/config/jak2/inputs.jsonc index bea8aa755f..f23193438c 100644 --- a/decompiler/config/jak2/inputs.jsonc +++ b/decompiler/config/jak2/inputs.jsonc @@ -252,6 +252,7 @@ "LJAKDAX.DGO", "LJKDXASH.DGO", "LKEIRIFT.DGO", + "LKIDDOGE.DGO", "LMEETBRT.DGO", "LOUTCSTB.DGO", "LPACKAGE.DGO", diff --git a/decompiler/config/jak2/label_types.jsonc b/decompiler/config/jak2/label_types.jsonc index 399f670ed1..c78e3697fa 100644 --- a/decompiler/config/jak2/label_types.jsonc +++ b/decompiler/config/jak2/label_types.jsonc @@ -1671,5 +1671,8 @@ ["L600", "uint64", true], ["L551", "vector"], ["L531", "vector"] - ] + ], + "kidesc": [["L124", "attack-info"]], + "crocesc": [["L81", "attack-info"]], + "ash4-course": [["L128", "vector"]] } diff --git a/decompiler/config/jak2/stack_structures.jsonc b/decompiler/config/jak2/stack_structures.jsonc index 5f4e2af21d..2d67100fae 100644 --- a/decompiler/config/jak2/stack_structures.jsonc +++ b/decompiler/config/jak2/stack_structures.jsonc @@ -2137,5 +2137,20 @@ "(anon-function 13 meet-brutter)": [ [208, "mystery-traffic-object-spawn-params-1"] ], - "choose-next-branch-no-exit-level": [[32, "pw-iter-seg"]] + "choose-next-branch-no-exit-level": [[32, "pw-iter-seg"]], + "(method 235 kid-escort)": [[16, "vector"]], + "(trans move-to-vehicle kid-escort)": [[16, ["inline-array", "matrix", 2]]], + "(code board-vehicle kid-escort)": [[16, "matrix"]], + "(trans move-to-vehicle crocadog-escort)": [ + [16, ["inline-array", "matrix", 2]] + ], + "(code exit-vehicle crocadog-escort)": [[16, ["inline-array", "matrix", 2]]], + "(code board-vehicle crocadog-escort)": [ + [16, "matrix"], + [112, "quaternion"] + ], + "(method 230 hal-escort)": [[16, "matrix"]], + "(method 234 hal-escort)": [[16, "vector"]], + "(anon-function 38 hal4-course)": [[16, "vector"]], + "(code exit-vehicle kid-escort)": [[48, "vector"]] } diff --git a/decompiler/config/jak2/type_casts.jsonc b/decompiler/config/jak2/type_casts.jsonc index ca32009d1a..4a4accf2d3 100644 --- a/decompiler/config/jak2/type_casts.jsonc +++ b/decompiler/config/jak2/type_casts.jsonc @@ -10116,5 +10116,348 @@ "(anon-function 13 meet-brutter)": [ [215, "v0", "city-lurker"], [174, "v0", "paddywagon"] + ], + "(method 238 kid-escort)": [[[19, 79], "s5", "vehicle"]], + "(method 78 kid-escort)": [[17, "a1", "art-joint-anim"]], + "(method 97 kid-escort)": [[78, "s4", "process-focusable"]], + "(method 74 kid-escort)": [ + [87, "s5", "crimson-guard"], + [104, "s5", "crimson-guard"], + [148, "s5", "crimson-guard"] + ], + "(method 235 kid-escort)": [ + [23, "s3", "vehicle"], + [32, "s3", "vehicle"], + [49, "s3", "vehicle"] + ], + "(code waiting-turn kid-escort)": [[14, "v1", "art-joint-anim"]], + "(code waiting-idle kid-escort)": [[56, "v1", "art-joint-anim"]], + "(trans move-to-vehicle kid-escort)": [ + [16, "gp", "vehicle"], + [105, "gp", "vehicle"], + [123, "gp", "vehicle"], + [44, "gp", "vehicle"] + ], + "(enter board-vehicle kid-escort)": [ + [45, "gp", "vehicle"], + [49, "gp", "vehicle"] + ], + "(code board-vehicle kid-escort)": [ + [74, "s5", "vehicle"], + [78, "s5", "vehicle"], + [169, "s4", "vehicle"], + [206, "s4", "vehicle"], + [313, "s5", "vehicle"], + [316, "s5", "vehicle"], + [321, "s5", "vehicle"] + ], + "(exit exit-vehicle kid-escort)": [ + [12, "a0", "vehicle"], + [15, "a0", "vehicle"] + ], + "(code die-falling kid-escort)": [ + [14, "v1", "art-joint-anim"], + [66, "v1", "art-joint-anim"], + [140, "v1", "art-joint-anim"] + ], + "(code arrested kid-escort)": [ + [28, "v1", "crimson-guard"], + [116, "v1", "art-joint-anim"], + [223, "v1", "crimson-guard"], + [180, "v1", "art-joint-anim"], + [285, "v1", "art-joint-anim"], + [46, "v1", "art-joint-anim"], + [30, "v1", "crimson-guard"], + [225, "v1", "crimson-guard"] + ], + "(code knocked-off-vehicle kid-escort)": [ + [76, "v1", "art-joint-anim"], + [128, "v1", "art-joint-anim"], + [16, "v1", "art-joint-anim"] + ], + "(code die-falling crocadog-escort)": [ + [94, "v1", "art-joint-anim"], + [164, "v1", "art-joint-anim"] + ], + "(code waiting-turn crocadog-escort)": [[14, "v1", "art-joint-anim"]], + "(code waiting-idle crocadog-escort)": [ + [89, "v1", "art-joint-anim"], + [202, "v1", "art-joint-anim"], + [317, "v1", "art-joint-anim"], + [434, "v1", "art-joint-anim"] + ], + "(trans move-to-vehicle crocadog-escort)": [ + [19, "gp", "vehicle"], + [80, "gp", "vehicle"], + [98, "gp", "vehicle"] + ], + "(enter board-vehicle crocadog-escort)": [ + [63, "gp", "vehicle"], + [66, "gp", "vehicle"] + ], + "(code ride-vehicle crocadog-escort)": [[10, "v1", "art-joint-anim"]], + "(method 78 crocadog-escort)": [[17, "a1", "art-joint-anim"]], + "(method 237 crocadog-escort)": [[19, "v1", "vehicle"]], + "(method 97 crocadog-escort)": [[102, "s5", "process-focusable"]], + "(method 234 crocadog-escort)": [ + [23, "s3", "vehicle"], + [32, "s3", "vehicle"], + [49, "s3", "vehicle"] + ], + "(trans exit-vehicle crocadog-escort)": [ + [22, "gp", "vehicle"], + [29, "gp", "vehicle"] + ], + "(code exit-vehicle crocadog-escort)": [ + [49, "s5", "vehicle"], + [56, "s5", "vehicle"], + [172, "s5", "vehicle"], + [186, "s5", "vehicle"], + [190, "s5", "vehicle"], + [300, "s5", "vehicle"], + [309, "s5", "vehicle"] + ], + "(trans ride-vehicle crocadog-escort)": [ + [24, "s5", "vehicle"], + [36, "s5", "vehicle"] + ], + "(code board-vehicle crocadog-escort)": [ + [110, "s3", "vehicle"], + [113, "s3", "vehicle"], + [117, "s3", "vehicle"], + [243, "s4", "vehicle"], + [260, "s4", "vehicle"], + [374, "s5", "vehicle"], + [367, "s5", "vehicle"] + ], + "hal4-walking-too-far": [ + [18, "a0", "process-focusable"], + [21, "a0", "process-focusable"] + ], + "(method 74 hal-escort)": [[8, "a1", "process"]], + "(method 235 hal-escort)": [[27, "v1", "process-focusable"]], + "(method 236 hal-escort)": [[14, "v1", "vehicle"]], + "(method 227 hal-escort)": [ + [20, "v1", "process-focusable"], + [37, "a0", "process-focusable"], + [46, "a0", "process-focusable"], + [49, "a0", "process-focusable"] + ], + "(method 204 hal-escort)": [ + [35, "s4", "process-focusable"], + [41, "v1", "process-focusable"], + [56, "s4", "process-focusable"], + [91, "s4", "process-focusable"] + ], + "(method 230 hal-escort)": [ + [36, "a0", "connection"], + [37, "a0", "collide-shape-moving"], + [85, "a0", "connection"], + [86, "a0", "collide-shape-moving"], + [149, "a0", "process-focusable"], + [140, "a0", "process-focusable"], + [152, "a0", "process-focusable"] + ], + "(method 233 hal-escort)": [[29, "v1", "traffic-manager"]], + "(method 232 hal-escort)": [ + [36, "s5", "process-focusable"], + [40, "v1", "process-focusable"], + [109, "s5", "process-focusable"], + [118, "v1", "process-focusable"] + ], + "(method 229 hal-escort)": [ + [26, "gp", "vehicle"], + [27, "gp", "vehicle"], + [33, "gp", "vehicle"], + [40, "gp", "vehicle"], + [53, "gp", "vehicle"], + [55, "s5", "process-focusable"], + [59, "gp", "vehicle"] + ], + "(method 234 hal-escort)": [ + [130, "gp", "process-focusable"], + [49, "gp", "process-focusable"], + [62, "gp", "process-focusable"] + ], + "(method 228 hal-escort)": [ + [25, "a0", "process-focusable"], + [28, "a0", "process-focusable"] + ], + "(anon-function 21 hal4-course)": [ + [42, "s5", "process-focusable"], + [45, "s4", "process-focusable"] + ], + "(anon-function 24 hal4-course)": [ + [31, "v1", "vehicle"], + [35, "v1", "vehicle"], + [121, "a0", "vehicle"], + [124, "a0", "vehicle"] + ], + "(anon-function 26 hal4-course)": [ + [143, "s2", "process-focusable"], + [175, "s2", "process-focusable"], + [185, "s2", "process-focusable"], + [195, "s5", "process-focusable"], + [217, "s5", "process-focusable"], + [246, "s4", "process-focusable"], + [251, "s4", "bot"], + [273, "s4", "process-focusable"], + [278, "s4", "bot"], + [283, "s5", "process-focusable"], + [289, "s5", "bot"] + ], + "(anon-function 38 hal4-course)": [ + [17, "a0", "process-focusable"], + [20, "a0", "process-focusable"] + ], + "(anon-function 1 hal4-course)": [[55, "v1", "halt-wait-spot"]], + "(anon-function 5 hal4-course)": [[49, "v1", "halt-wait-spot"]], + "(anon-function 3 hal4-course)": [[54, "v1", "halt-wait-spot"]], + "(anon-function 8 hal4-course)": [[35, "v1", "halt-wait-spot"]], + "(anon-function 10 hal4-course)": [[14, "v1", "halt-wait-spot"]], + "(anon-function 12 hal4-course)": [[126, "v1", "halt-wait-spot"]], + "(anon-function 15 hal4-course)": [[14, "v1", "halt-wait-spot"]], + "(anon-function 19 hal4-course)": [[141, "v1", "halt-wait-spot"]], + "(anon-function 22 hal4-course)": [[14, "v1", "halt-wait-spot"]], + "(anon-function 25 hal4-course)": [[82, "v1", "halt-wait-spot"]], + "(anon-function 29 hal4-course)": [[27, "v1", "halt-wait-spot"]], + "(anon-function 32 hal4-course)": [[18, "v1", "halt-wait-spot"]], + "(anon-function 35 hal4-course)": [[29, "v1", "halt-wait-spot"]], + "(anon-function 37 hal4-course)": [[47, "v1", "halt-wait-spot"]], + "(anon-function 39 hal4-course)": [[115, "v1", "halt-wait-spot"]], + "(anon-function 2 crocesc4-course)": [[15, "v1", "crocesct-wait-spot"]], + "(anon-function 0 crocesc4-course)": [[19, "v1", "crocesct-wait-spot"]], + "(anon-function 4 crocesc4-course)": [[15, "v1", "crocesct-wait-spot"]], + "(anon-function 5 crocesc4-course)": [ + [32, "a0", "process-focusable"], + [35, "a0", "process-focusable"] + ], + "(anon-function 6 crocesc4-course)": [[52, "v1", "crocesct-wait-spot"]], + "(anon-function 7 crocesc4-course)": [ + [32, "a0", "process-focusable"], + [35, "a0", "process-focusable"] + ], + "(anon-function 8 crocesc4-course)": [[15, "v1", "crocesct-wait-spot"]], + "(anon-function 9 crocesc4-course)": [ + [32, "a0", "process-focusable"], + [35, "a0", "process-focusable"] + ], + "(anon-function 10 crocesc4-course)": [[15, "v1", "crocesct-wait-spot"]], + "(anon-function 11 crocesc4-course)": [ + [32, "a0", "process-focusable"], + [35, "a0", "process-focusable"] + ], + "(anon-function 13 crocesc4-course)": [[52, "v1", "crocesct-wait-spot"]], + "(anon-function 14 crocesc4-course)": [ + [32, "a0", "process-focusable"], + [35, "a0", "process-focusable"] + ], + "(anon-function 15 crocesc4-course)": [[20, "v1", "crocesct-wait-spot"]], + "(anon-function 17 crocesc4-course)": [[15, "v1", "crocesct-wait-spot"]], + "(anon-function 22 crocesc4-course)": [[15, "v1", "crocesct-wait-spot"]], + "(anon-function 24 crocesc4-course)": [[53, "v1", "crocesct-wait-spot"]], + "(anon-function 26 crocesc4-course)": [[15, "v1", "crocesct-wait-spot"]], + "(anon-function 28 crocesc4-course)": [[15, "v1", "crocesct-wait-spot"]], + "(anon-function 30 crocesc4-course)": [[15, "v1", "crocesct-wait-spot"]], + "(anon-function 32 crocesc4-course)": [[15, "v1", "crocesct-wait-spot"]], + "(anon-function 36 crocesc4-course)": [[15, "v1", "crocesct-wait-spot"]], + "(anon-function 38 crocesc4-course)": [[15, "v1", "crocesct-wait-spot"]], + "(anon-function 40 crocesc4-course)": [[53, "v1", "crocesct-wait-spot"]], + "(anon-function 42 crocesc4-course)": [[53, "v1", "crocesct-wait-spot"]], + "(anon-function 44 crocesc4-course)": [[15, "v1", "crocesct-wait-spot"]], + "(anon-function 46 crocesc4-course)": [[61, "v1", "crocesct-wait-spot"]], + "(anon-function 48 crocesc4-course)": [[50, "v1", "crocesct-wait-spot"]], + "(anon-function 19 crocesc4-course)": [ + [7, "a1", "bot"], + [24, "v1", "crocesct-wait-spot"] + ], + "(anon-function 20 crocesc4-course)": [ + [32, "a0", "process-focusable"], + [35, "a0", "process-focusable"] + ], + "(anon-function 23 crocesc4-course)": [ + [32, "a0", "process-focusable"], + [35, "a0", "process-focusable"] + ], + "(anon-function 25 crocesc4-course)": [ + [32, "a0", "process-focusable"], + [35, "a0", "process-focusable"] + ], + "(anon-function 27 crocesc4-course)": [ + [32, "a0", "process-focusable"], + [35, "a0", "process-focusable"] + ], + "(anon-function 29 crocesc4-course)": [ + [32, "a0", "process-focusable"], + [35, "a0", "process-focusable"] + ], + "(anon-function 31 crocesc4-course)": [ + [32, "a0", "process-focusable"], + [35, "a0", "process-focusable"] + ], + "(anon-function 33 crocesc4-course)": [ + [32, "a0", "process-focusable"], + [35, "a0", "process-focusable"] + ], + "(anon-function 34 crocesc4-course)": [[53, "v1", "crocesct-wait-spot"]], + "(anon-function 35 crocesc4-course)": [ + [32, "a0", "process-focusable"], + [35, "a0", "process-focusable"] + ], + "(anon-function 37 crocesc4-course)": [ + [32, "a0", "process-focusable"], + [35, "a0", "process-focusable"] + ], + "(anon-function 39 crocesc4-course)": [ + [32, "a0", "process-focusable"], + [35, "a0", "process-focusable"] + ], + "(anon-function 41 crocesc4-course)": [ + [32, "a0", "process-focusable"], + [35, "a0", "process-focusable"] + ], + "(anon-function 43 crocesc4-course)": [ + [32, "a0", "process-focusable"], + [35, "a0", "process-focusable"] + ], + "(anon-function 45 crocesc4-course)": [ + [32, "a0", "process-focusable"], + [35, "a0", "process-focusable"] + ], + "(anon-function 47 crocesc4-course)": [ + [32, "a0", "process-focusable"], + [35, "a0", "process-focusable"] + ], + "(anon-function 49 crocesc4-course)": [[24, "v1", "hal-escort"]], + "kid4-update-spot-to-track-crocadog": [ + [19, "a0", "process-focusable"], + [22, "a0", "process-focusable"] + ], + "(anon-function 0 kidesc4-course)": [[51, "v1", "kidesct-wait-spot"]], + "(anon-function 6 kidesc4-course)": [[23, "v1", "kidesct-wait-spot"]], + "(anon-function 3 kidesc4-course)": [[15, "v1", "kidesct-wait-spot"]], + "(anon-function 10 kidesc4-course)": [[22, "v1", "kidesct-wait-spot"]], + "(anon-function 12 kidesc4-course)": [[20, "v1", "kidesct-wait-spot"]], + "(anon-function 14 kidesc4-course)": [[15, "v1", "kidesct-wait-spot"]], + "(anon-function 18 kidesc4-course)": [[15, "v1", "kidesct-wait-spot"]], + "(anon-function 21 kidesc4-course)": [[41, "v1", "kidesct-wait-spot"]], + "(anon-function 24 kidesc4-course)": [[24, "v1", "hal-escort"]], + "(anon-function 23 kidesc4-course)": [[50, "v1", "kidesct-wait-spot"]], + "(method 251 ashelin-tanker)": [[22, "v1", "traffic-manager"]], + "(anon-function 1 ash4-course)": [[14, "v1", "asht-wait-spot"]], + "(anon-function 4 ash4-course)": [[31, "v1", "asht-wait-spot"]], + "(anon-function 7 ash4-course)": [[47, "v1", "asht-wait-spot"]], + "(anon-function 10 ash4-course)": [[76, "v1", "asht-wait-spot"]], + "(anon-function 13 ash4-course)": [[90, "v1", "asht-wait-spot"]], + "(anon-function 15 ash4-course)": [[14, "v1", "asht-wait-spot"]], + "(anon-function 17 ash4-course)": [[34, "v1", "asht-wait-spot"]], + "(anon-function 19 ash4-course)": [[33, "v1", "asht-wait-spot"]], + "(anon-function 21 ash4-course)": [[27, "v1", "asht-wait-spot"]], + "(code exit-vehicle kid-escort)": [ + [47, "gp", "vehicle"], + [50, "gp", "vehicle"], + [55, "gp", "vehicle"], + [170, "s4", "vehicle"], + [178, "s4", "vehicle"] ] } diff --git a/decompiler/config/jak2/var_names.jsonc b/decompiler/config/jak2/var_names.jsonc index 7dd98b7353..51f84b6a66 100644 --- a/decompiler/config/jak2/var_names.jsonc +++ b/decompiler/config/jak2/var_names.jsonc @@ -4117,5 +4117,10 @@ "s5-0": ["s5-0", "gs-zbuf"], "gp-0": ["gp-0", "gs-zbuf"] } + }, + "(method 232 hal-escort)": { + "vars": { + "s4-0": "target" + } } } diff --git a/decompiler/util/data_decompile.cpp b/decompiler/util/data_decompile.cpp index 135e74104d..7a0820aeab 100644 --- a/decompiler/util/data_decompile.cpp +++ b/decompiler/util/data_decompile.cpp @@ -746,164 +746,176 @@ const std::unordered_map< 1, ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}}}}}, {GameVersion::Jak2, - {{"ocean-near-indices", - {{"data", ArrayFieldDecompMeta(TypeSpec("ocean-near-index"), 32)}}}, - {"ocean-mid-masks", {{"data", ArrayFieldDecompMeta(TypeSpec("ocean-mid-mask"), 8)}}}, - {"sparticle-launcher", - {{"init-specs", ArrayFieldDecompMeta(TypeSpec("sp-field-init-spec"), 16)}}}, - {"sparticle-launch-group", - {{"launcher", ArrayFieldDecompMeta(TypeSpec("sparticle-group-item"), 32)}}}, - {"nav-network-info", - {{"adjacency", ArrayFieldDecompMeta(TypeSpec("nav-network-adjacency"), 16)}}}, - {"sig-path", {{"samples", ArrayFieldDecompMeta(TypeSpec("sig-path-sample"), 64)}}}, - {"rigid-body-vehicle-constants", - {{"color-option-array", ArrayFieldDecompMeta(TypeSpec("vector"), 16)}, - {"grab-rail-array", ArrayFieldDecompMeta(TypeSpec("vehicle-grab-rail-info"), 48)}}}, - {"city-ambush-info", {{"array", ArrayFieldDecompMeta(TypeSpec("city-ambush-spot"), 32)}}}, - {"bombbot-path", {{"node", ArrayFieldDecompMeta(TypeSpec("bombbot-node"), 32)}}}, - {"fort-robotank-segment", - {{"event-tbl", ArrayFieldDecompMeta(TypeSpec("fort-robotank-segment-event"), 32)}}}, - {"race-info", - {{"turbo-pad-array", ArrayFieldDecompMeta(TypeSpec("race-turbo-pad"), 32)}, - {"racer-array", ArrayFieldDecompMeta(TypeSpec("race-racer-info"), 16)}, - {"decision-point-array", ArrayFieldDecompMeta(TypeSpec("race-decision-point"), 16)}}}, - {"actor-hash-bucket", - {{"data", ArrayFieldDecompMeta(TypeSpec("actor-cshape-ptr"), - 16, - ArrayFieldDecompMeta::Kind::REF_TO_INLINE_ARR)}}}, - {"xz-height-map", - {{"data", ArrayFieldDecompMeta(TypeSpec("int8"), - 1, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}}}, - {"enemy-info", - {{"idle-anim-script", - ArrayFieldDecompMeta(TypeSpec("idle-control-frame"), - 4, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}}}, - {"nav-enemy-info", - {{"idle-anim-script", - ArrayFieldDecompMeta(TypeSpec("idle-control-frame"), - 4, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}}}, - {"tpath-info", - // TODO - should be able to just decompile the `anims` field - {{"anim1", ArrayFieldDecompMeta(TypeSpec("tpath-control-frame"), 16)}, - {"anim2", ArrayFieldDecompMeta(TypeSpec("tpath-control-frame"), 16)}, - {"anim3", ArrayFieldDecompMeta(TypeSpec("tpath-control-frame"), 16)}}}, - // kinda want to add regex support now... - {"bigmap-compressed-layers", - {{"layer0", ArrayFieldDecompMeta(TypeSpec("uint32"), - 4, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, - {"layer1", ArrayFieldDecompMeta(TypeSpec("uint32"), - 4, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, - {"layer2", ArrayFieldDecompMeta(TypeSpec("uint32"), - 4, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, - {"layer3", ArrayFieldDecompMeta(TypeSpec("uint32"), - 4, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, - {"layer4", ArrayFieldDecompMeta(TypeSpec("uint32"), - 4, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, - {"layer5", ArrayFieldDecompMeta(TypeSpec("uint32"), - 4, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, - {"layer6", ArrayFieldDecompMeta(TypeSpec("uint32"), - 4, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, - {"layer7", ArrayFieldDecompMeta(TypeSpec("uint32"), - 4, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, - {"layer8", ArrayFieldDecompMeta(TypeSpec("uint32"), - 4, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, - {"layer9", ArrayFieldDecompMeta(TypeSpec("uint32"), - 4, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, - {"layer10", ArrayFieldDecompMeta(TypeSpec("uint32"), - 4, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, - {"layer11", ArrayFieldDecompMeta(TypeSpec("uint32"), - 4, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, - {"layer12", ArrayFieldDecompMeta(TypeSpec("uint32"), - 4, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, - {"layer13", ArrayFieldDecompMeta(TypeSpec("uint32"), - 4, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, - {"layer14", ArrayFieldDecompMeta(TypeSpec("uint32"), - 4, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, - {"layer15", ArrayFieldDecompMeta(TypeSpec("uint32"), - 4, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, - {"layer16", ArrayFieldDecompMeta(TypeSpec("uint32"), - 4, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, - {"layer17", ArrayFieldDecompMeta(TypeSpec("uint32"), - 4, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, - {"layer18", ArrayFieldDecompMeta(TypeSpec("uint32"), - 4, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, - {"layer19", ArrayFieldDecompMeta(TypeSpec("uint32"), - 4, + { + {"ocean-near-indices", + {{"data", ArrayFieldDecompMeta(TypeSpec("ocean-near-index"), 32)}}}, + {"ocean-mid-masks", {{"data", ArrayFieldDecompMeta(TypeSpec("ocean-mid-mask"), 8)}}}, + {"sparticle-launcher", + {{"init-specs", ArrayFieldDecompMeta(TypeSpec("sp-field-init-spec"), 16)}}}, + {"sparticle-launch-group", + {{"launcher", ArrayFieldDecompMeta(TypeSpec("sparticle-group-item"), 32)}}}, + {"nav-network-info", + {{"adjacency", ArrayFieldDecompMeta(TypeSpec("nav-network-adjacency"), 16)}}}, + {"sig-path", {{"samples", ArrayFieldDecompMeta(TypeSpec("sig-path-sample"), 64)}}}, + {"rigid-body-vehicle-constants", + {{"color-option-array", ArrayFieldDecompMeta(TypeSpec("vector"), 16)}, + {"grab-rail-array", ArrayFieldDecompMeta(TypeSpec("vehicle-grab-rail-info"), 48)}}}, + {"city-ambush-info", + {{"array", ArrayFieldDecompMeta(TypeSpec("city-ambush-spot"), 32)}}}, + {"bombbot-path", {{"node", ArrayFieldDecompMeta(TypeSpec("bombbot-node"), 32)}}}, + {"fort-robotank-segment", + {{"event-tbl", ArrayFieldDecompMeta(TypeSpec("fort-robotank-segment-event"), 32)}}}, + {"race-info", + {{"turbo-pad-array", ArrayFieldDecompMeta(TypeSpec("race-turbo-pad"), 32)}, + {"racer-array", ArrayFieldDecompMeta(TypeSpec("race-racer-info"), 16)}, + {"decision-point-array", + ArrayFieldDecompMeta(TypeSpec("race-decision-point"), 16)}}}, + {"actor-hash-bucket", + {{"data", ArrayFieldDecompMeta(TypeSpec("actor-cshape-ptr"), + 16, + ArrayFieldDecompMeta::Kind::REF_TO_INLINE_ARR)}}}, + {"xz-height-map", + {{"data", ArrayFieldDecompMeta(TypeSpec("int8"), + 1, ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}}}, - {"lightning-probe-vars", {{"probe-dirs", ArrayFieldDecompMeta(TypeSpec("vector"), 16)}}}, - {"nav-mesh", - {{"poly-array", ArrayFieldDecompMeta(TypeSpec("nav-poly"), 64)}, - {"nav-control-array", ArrayFieldDecompMeta(TypeSpec("nav-control"), 288)}}}, - {"trail-conn-hash", - {{"cell", ArrayFieldDecompMeta(TypeSpec("trail-conn-hash-cell"), 4)}, - {"conn-ids", ArrayFieldDecompMeta(TypeSpec("uint16"), - 2, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}}}, - {"trail-graph", - {{"node", ArrayFieldDecompMeta(TypeSpec("trail-node"), 18)}, - {"conn", ArrayFieldDecompMeta(TypeSpec("trail-conn"), 8)}, - {"conn-ids", ArrayFieldDecompMeta(TypeSpec("uint16"), - 2, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, - {"visgroup", ArrayFieldDecompMeta(TypeSpec("trail-conn-hash-cell"), 4)}, - {"visnode-ids", ArrayFieldDecompMeta(TypeSpec("uint16"), + {"enemy-info", + {{"idle-anim-script", + ArrayFieldDecompMeta(TypeSpec("idle-control-frame"), + 4, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}}}, + {"nav-enemy-info", + {{"idle-anim-script", + ArrayFieldDecompMeta(TypeSpec("idle-control-frame"), + 4, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}}}, + {"tpath-info", + // TODO - should be able to just decompile the `anims` field + {{"anim1", ArrayFieldDecompMeta(TypeSpec("tpath-control-frame"), 16)}, + {"anim2", ArrayFieldDecompMeta(TypeSpec("tpath-control-frame"), 16)}, + {"anim3", ArrayFieldDecompMeta(TypeSpec("tpath-control-frame"), 16)}}}, + // kinda want to add regex support now... + {"bigmap-compressed-layers", + {{"layer0", ArrayFieldDecompMeta(TypeSpec("uint32"), + 4, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, + {"layer1", ArrayFieldDecompMeta(TypeSpec("uint32"), + 4, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, + {"layer2", ArrayFieldDecompMeta(TypeSpec("uint32"), + 4, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, + {"layer3", ArrayFieldDecompMeta(TypeSpec("uint32"), + 4, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, + {"layer4", ArrayFieldDecompMeta(TypeSpec("uint32"), + 4, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, + {"layer5", ArrayFieldDecompMeta(TypeSpec("uint32"), + 4, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, + {"layer6", ArrayFieldDecompMeta(TypeSpec("uint32"), + 4, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, + {"layer7", ArrayFieldDecompMeta(TypeSpec("uint32"), + 4, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, + {"layer8", ArrayFieldDecompMeta(TypeSpec("uint32"), + 4, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, + {"layer9", ArrayFieldDecompMeta(TypeSpec("uint32"), + 4, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, + {"layer10", ArrayFieldDecompMeta(TypeSpec("uint32"), + 4, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, + {"layer11", ArrayFieldDecompMeta(TypeSpec("uint32"), + 4, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, + {"layer12", ArrayFieldDecompMeta(TypeSpec("uint32"), + 4, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, + {"layer13", ArrayFieldDecompMeta(TypeSpec("uint32"), + 4, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, + {"layer14", ArrayFieldDecompMeta(TypeSpec("uint32"), + 4, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, + {"layer15", ArrayFieldDecompMeta(TypeSpec("uint32"), + 4, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, + {"layer16", ArrayFieldDecompMeta(TypeSpec("uint32"), + 4, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, + {"layer17", ArrayFieldDecompMeta(TypeSpec("uint32"), + 4, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, + {"layer18", ArrayFieldDecompMeta(TypeSpec("uint32"), + 4, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, + {"layer19", ArrayFieldDecompMeta(TypeSpec("uint32"), + 4, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}}}, + {"lightning-probe-vars", + {{"probe-dirs", ArrayFieldDecompMeta(TypeSpec("vector"), 16)}}}, + {"nav-mesh", + {{"poly-array", ArrayFieldDecompMeta(TypeSpec("nav-poly"), 64)}, + {"nav-control-array", ArrayFieldDecompMeta(TypeSpec("nav-control"), 288)}}}, + {"trail-conn-hash", + {{"cell", ArrayFieldDecompMeta(TypeSpec("trail-conn-hash-cell"), 4)}, + {"conn-ids", ArrayFieldDecompMeta(TypeSpec("uint16"), 2, ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}}}, - {"predator-graph", - {{"node", ArrayFieldDecompMeta(TypeSpec("predator-node"), 48)}, - {"edge", ArrayFieldDecompMeta(TypeSpec("predator-edge"), 4)}}}, - {"sig0-course", - {{"spots", ArrayFieldDecompMeta(TypeSpec("bot-spot"), 32)}, - {"speeches", ArrayFieldDecompMeta(TypeSpec("bot-speech-info"), 16)}, - {"dirs", ArrayFieldDecompMeta(TypeSpec("vector"), 16)}, - {"speech-tunings", ArrayFieldDecompMeta(TypeSpec("bot-speech-tuning"), 16)}}}, - {"ashelin-course", - {{"spots", ArrayFieldDecompMeta(TypeSpec("bot-spot"), 32)}, - {"speeches", ArrayFieldDecompMeta(TypeSpec("bot-speech-info"), 16)}, - {"dirs", ArrayFieldDecompMeta(TypeSpec("vector"), 16)}, - {"speech-tunings", ArrayFieldDecompMeta(TypeSpec("bot-speech-tuning"), 16)}}}, - {"ai-task-pool", - {{"tasks", ArrayFieldDecompMeta(TypeSpec("uint32"), - 4, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}}}, - {"bot-course", {{"spots", ArrayFieldDecompMeta(TypeSpec("bot-spot"), 32)}}}, - {"hal3-course", {{"spots", ArrayFieldDecompMeta(TypeSpec("bot-spot"), 32)}}}, - {"sig5-course", - {{"spots", ArrayFieldDecompMeta(TypeSpec("bot-spot"), 32)}, - {"speeches", ArrayFieldDecompMeta(TypeSpec("bot-speech-info"), 16)}, - {"dirs", ArrayFieldDecompMeta(TypeSpec("vector"), 16)}, - {"speech-tunings", ArrayFieldDecompMeta(TypeSpec("bot-speech-tuning"), 16)}}}, - {"under-block-puzzle", - {{"cells", ArrayFieldDecompMeta(TypeSpec("int32"), - 4, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, - {"pulse-ops", ArrayFieldDecompMeta(TypeSpec("int8"), - 1, - ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}}}, - {"turret-path", - {{"event-tbl", ArrayFieldDecompMeta(TypeSpec("turret-path-event"), 16)}}}}}}; + {"trail-graph", + {{"node", ArrayFieldDecompMeta(TypeSpec("trail-node"), 18)}, + {"conn", ArrayFieldDecompMeta(TypeSpec("trail-conn"), 8)}, + {"conn-ids", ArrayFieldDecompMeta(TypeSpec("uint16"), + 2, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, + {"visgroup", ArrayFieldDecompMeta(TypeSpec("trail-conn-hash-cell"), 4)}, + {"visnode-ids", + ArrayFieldDecompMeta(TypeSpec("uint16"), + 2, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}}}, + {"predator-graph", + {{"node", ArrayFieldDecompMeta(TypeSpec("predator-node"), 48)}, + {"edge", ArrayFieldDecompMeta(TypeSpec("predator-edge"), 4)}}}, + {"sig0-course", + {{"spots", ArrayFieldDecompMeta(TypeSpec("bot-spot"), 32)}, + {"speeches", ArrayFieldDecompMeta(TypeSpec("bot-speech-info"), 16)}, + {"dirs", ArrayFieldDecompMeta(TypeSpec("vector"), 16)}, + {"speech-tunings", ArrayFieldDecompMeta(TypeSpec("bot-speech-tuning"), 16)}}}, + {"ashelin-course", + {{"spots", ArrayFieldDecompMeta(TypeSpec("bot-spot"), 32)}, + {"speeches", ArrayFieldDecompMeta(TypeSpec("bot-speech-info"), 16)}, + {"dirs", ArrayFieldDecompMeta(TypeSpec("vector"), 16)}, + {"speech-tunings", ArrayFieldDecompMeta(TypeSpec("bot-speech-tuning"), 16)}}}, + {"ai-task-pool", + {{"tasks", ArrayFieldDecompMeta(TypeSpec("uint32"), + 4, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}}}, + {"bot-course", {{"spots", ArrayFieldDecompMeta(TypeSpec("bot-spot"), 32)}}}, + {"hal3-course", {{"spots", ArrayFieldDecompMeta(TypeSpec("bot-spot"), 32)}}}, + {"sig5-course", + {{"spots", ArrayFieldDecompMeta(TypeSpec("bot-spot"), 32)}, + {"speeches", ArrayFieldDecompMeta(TypeSpec("bot-speech-info"), 16)}, + {"dirs", ArrayFieldDecompMeta(TypeSpec("vector"), 16)}, + {"speech-tunings", ArrayFieldDecompMeta(TypeSpec("bot-speech-tuning"), 16)}}}, + {"under-block-puzzle", + {{"cells", ArrayFieldDecompMeta(TypeSpec("int32"), + 4, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, + {"pulse-ops", + ArrayFieldDecompMeta(TypeSpec("int8"), + 1, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}}}, + {"turret-path", + {{"event-tbl", ArrayFieldDecompMeta(TypeSpec("turret-path-event"), 16)}}}, + {"hal4-course", + {{"spots", ArrayFieldDecompMeta(TypeSpec("bot-spot"), 32)}, + {"speeches", ArrayFieldDecompMeta(TypeSpec("bot-speech-info"), 16)}, + {"dirs", ArrayFieldDecompMeta(TypeSpec("vector"), 16)}, + {"speech-tunings", ArrayFieldDecompMeta(TypeSpec("bot-speech-tuning"), 16)}}}, + }}}; goos::Object decompile_structure(const TypeSpec& type, const DecompilerLabel& label, diff --git a/goal_src/jak2/levels/city/kid_escort/crocesc-h.gc b/goal_src/jak2/levels/city/kid_escort/crocesc-h.gc index ac3e091d9c..e1bae70dbb 100644 --- a/goal_src/jak2/levels/city/kid_escort/crocesc-h.gc +++ b/goal_src/jak2/levels/city/kid_escort/crocesc-h.gc @@ -20,20 +20,20 @@ :size-assert #x410 :flag-assert #xef03900410 (:methods - (crocadog-escort-method-225 () none 225) - (crocadog-escort-method-226 () none 226) - (crocadog-escort-method-227 () none 227) - (crocadog-escort-method-228 () none 228) - (crocadog-escort-method-229 () none 229) - (crocadog-escort-method-230 () none 230) - (crocadog-escort-method-231 () none 231) - (crocadog-escort-method-232 () none 232) - (crocadog-escort-method-233 () none 233) - (crocadog-escort-method-234 () none 234) - (crocadog-escort-method-235 () none 235) - (crocadog-escort-method-236 () none 236) - (crocadog-escort-method-237 () none 237) - (crocadog-escort-method-238 () none 238) + (traveling () _type_ :state 225) + (traveling-blocked () _type_ :state 226) + (waiting-idle () _type_ :state 227) + (waiting-turn () _type_ :state 228) + (move-to-vehicle () _type_ :state 229) + (board-vehicle () _type_ :state 230) + (ride-vehicle () _type_ :state 231) + (exit-vehicle () _type_ :state 232) + (knocked-off-vehicle () _type_ :state 233) + (want-exit-vehicle? (_type_ vector) symbol 234) + (go-idle-or-move (_type_) none 235) + (go-waiting-turn (_type_) none 236) + (check-vehicle-exit (_type_) none 237) + (play-walk-anim (_type_) none 238) ) ) @@ -46,10 +46,10 @@ ) (deftype crocesct-wait-spot (ai-task) - ((check-done basic :offset 32) - (which-spot int8 :offset 36) - (num-spots uint8 :offset 37) - (spot-indexes int8 6 :offset 38) + ((check-done (function crocesct-wait-spot crocadog-escort symbol) :offset 32) + (which-spot int8 :offset 36) + (num-spots uint8 :offset 37) + (spot-indexes uint8 6 :offset 38) ) :method-count-assert 12 :size-assert #x30 diff --git a/goal_src/jak2/levels/city/kid_escort/crocesc-states.gc b/goal_src/jak2/levels/city/kid_escort/crocesc-states.gc index 8531daa9f5..beedc5a8bd 100644 --- a/goal_src/jak2/levels/city/kid_escort/crocesc-states.gc +++ b/goal_src/jak2/levels/city/kid_escort/crocesc-states.gc @@ -7,3 +7,1065 @@ ;; DECOMP BEGINS +(defstate waiting-idle (crocadog-escort) + :virtual #t + :event (the-as + (function process int symbol event-message-block object :behavior crocadog-escort) + enemy-event-handler + ) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (nav-enemy-method-167 self) + (let ((v1-7 self)) + (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (vector-reset! (-> self root-override2 transv)) + (look-at-target! self (enemy-flag lock-focus)) + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + :trans (behavior () + (bot-method-223 self #f) + (if (and (-> self focus-info fproc) (>= (fabs (-> self focus-info ry-diff)) 9102.223)) + (go-waiting-turn self) + ) + (when (not (logtest? (-> self focus-status) (focus-status grabbed))) + (cond + ((logtest? (-> self bot-flags) (bot-flags bf15)) + (go-virtual move-to-vehicle) + ) + ((not (outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #f)) + (go-virtual traveling) + ) + ) + ) + (none) + ) + :code (behavior () + (let ((gp-0 (get-rand-int self 4))) + (until #f + (let ((a2-0 (ash 1 gp-0))) + (if (= gp-0 3) + (set! a2-0 (logior a2-0 4)) + ) + (set! gp-0 (enemy-method-120 self 4 a2-0)) + ) + (let ((v1-7 gp-0)) + (cond + ((zero? v1-7) + (let ((v1-10 (ja-group))) + (cond + ((and v1-10 (= v1-10 (-> self draw art-group data 3))) + (ja-no-eval :num! (seek! max 0.5)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + ) + (else + (ja-channel-push! 1 (seconds 0.1)) + ) + ) + ) + (let ((s5-0 (get-rand-int-range self 3 7))) + (dotimes (s4-0 s5-0) + (ja-no-eval :group! (-> self draw art-group data 3) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) frames num-frames) -1)) 0.5) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 0.5)) + ) + ) + ) + ) + ((= v1-7 1) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 6) :num! (seek! (ja-aframe 3.0 0) 0.5) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 3.0 0) 0.5)) + ) + (ja-no-eval :group! (-> self draw art-group data 6) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 6)) frames num-frames) -1)) 0.33) + :frame-num (ja-aframe 3.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 0.33)) + ) + ) + ((= v1-7 2) + (let ((v1-90 (ja-group))) + (cond + ((and v1-90 (= v1-90 (-> self draw art-group data 5))) + (ja-no-eval :num! (seek! max 0.5)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + ) + (else + (ja-channel-push! 1 (seconds 0.1)) + ) + ) + ) + (let ((s5-4 (get-rand-int-range self 5 7))) + (dotimes (s4-1 s5-4) + (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)) 0.5) + :frame-num (ja-aframe 2.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 0.5)) + ) + ) + ) + ) + (else + (let ((v1-132 (ja-group))) + (cond + ((and v1-132 (= v1-132 (-> self draw art-group data 4))) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + ) + (else + (ja-channel-push! 1 (seconds 0.1)) + ) + ) + ) + (let ((s5-5 (get-rand-int-range self 3 7))) + (dotimes (s4-2 s5-5) + (ja-no-eval :group! (-> self draw art-group data 4) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 4)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + ) + ) + ) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior crocadog-escort) nav-enemy-simple-post) + ) + +(defstate waiting-turn (crocadog-escort) + :virtual #t + :event (the-as + (function process int symbol event-message-block object :behavior crocadog-escort) + enemy-event-handler + ) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (nav-enemy-method-167 self) + (let ((v1-7 self)) + (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (look-at-target! self (enemy-flag lock-focus)) + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + :trans (behavior () + (bot-method-223 self #f) + (when (not (logtest? (-> self focus-status) (focus-status grabbed))) + (if (and (not (outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #f)) + (zero? (logand (-> self bot-flags) (bot-flags bf15))) + ) + (go-virtual traveling) + ) + ) + (none) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 9) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 9)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (go-idle-or-move self) + (none) + ) + :post (behavior () + (seek-toward-heading-vec! + (-> self root-override2) + (-> self focus-info bullseye-xz-dir) + 49152.0 + (seconds 0.05) + ) + (nav-enemy-simple-post) + (none) + ) + ) + +(defstate traveling (crocadog-escort) + :virtual #t + :event (the-as + (function process int symbol event-message-block object :behavior crocadog-escort) + enemy-event-handler + ) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) + ) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag36) (-> v1-2 enemy-flags)))) + (set! (-> v1-2 nav callback-info) (-> v1-2 enemy-info-override callback-info)) + ) + 0 + (let ((v1-5 self)) + (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-5 enemy-flags)))) + ) + 0 + (stop-looking-at-target! self) + (nav-enemy-method-166 self) + (set! (-> self player-blocking) 0.0) + (none) + ) + :trans (behavior () + (bot-method-223 self #f) + (cond + ((logtest? (-> self bot-flags) (bot-flags bf15)) + (go-virtual move-to-vehicle) + ) + ((outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #t) + (go-idle-or-move self) + ) + ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) + (go-virtual traveling-blocked) + ) + ((and (nav-enemy-method-163 self) + (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + ) + (go-stare2 self) + ) + ) + 0 + (none) + ) + :code (behavior () + (until #f + (play-walk-anim self) + (suspend) + ) + #f + (none) + ) + :post (behavior () + (let ((a0-0 (-> self nav state)) + (v1-1 (-> self spot)) + ) + (logclear! (-> a0-0 flags) (nav-state-flag directional-mode)) + (logior! (-> a0-0 flags) (nav-state-flag target-poly-dirty)) + (set! (-> a0-0 target-post quad) (-> v1-1 center quad)) + ) + 0 + (nav-enemy-travel-post) + (none) + ) + ) + +(defstate move-to-vehicle (crocadog-escort) + :virtual #t + :event (the-as + (function process int symbol event-message-block object :behavior crocadog-escort) + enemy-event-handler + ) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) + ) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag36) (-> v1-2 enemy-flags)))) + (set! (-> v1-2 nav callback-info) (-> v1-2 enemy-info-override callback-info)) + ) + 0 + (let ((v1-5 self)) + (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-5 enemy-flags)))) + ) + 0 + (stop-looking-at-target! self) + (nav-enemy-method-166 self) + (set! (-> self player-blocking) 0.0) + (none) + ) + :trans (behavior () + (bot-method-223 self #f) + (let ((gp-0 (handle->process (-> self vehicle-handle)))) + (cond + ((or (not gp-0) + (logtest? (-> (the-as vehicle gp-0) flags) (rigid-body-object-flag dead)) + (not (logtest? (-> self bot-flags) (bot-flags bf15))) + (< (-> self vehicle-seat-index) 0) + ) + (logclear! (-> self bot-flags) (bot-flags bf15)) + (go-idle-or-move self) + ) + ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) + (go-virtual traveling-blocked) + ) + ((and (nav-enemy-method-163 self) + (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + ) + (go-stare2 self) + ) + ) + (let ((s5-0 (new 'stack-no-clear 'inline-array 'matrix 2))) + (compute-seat-position (the-as vehicle gp-0) (the-as vector (-> s5-0 0)) (-> self vehicle-seat-index)) + (set! (-> s5-0 0 vector 1 quad) (-> self root-override2 trans quad)) + (set! (-> s5-0 0 trans quad) (-> s5-0 0 quad 0)) + (vector-! + (the-as vector (-> s5-0 1)) + (the-as vector (-> s5-0 0)) + (-> (the-as vehicle gp-0) root-override-2 trans) + ) + (vector-z-quaternion! (-> s5-0 0 vector 2) (-> self root-override2 quat)) + (let ((f30-1 (* 0.5 (vector-vector-xz-distance (-> s5-0 0 vector 1) (-> s5-0 0 trans))))) + (vector-normalize! (-> s5-0 0 vector 2) (* 2.0 f30-1)) + (vector-normalize! (the-as vector (-> s5-0 1)) (* 4.0 f30-1)) + ) + (bot-method-181 + self + (-> s5-0 1 vector 1) + (-> s5-0 0 vector 1) + (-> s5-0 0 vector 2) + (-> s5-0 0 trans) + (the-as vector (-> s5-0 1)) + 0.8 + ) + (let ((a0-26 (-> self nav state)) + (v1-47 (-> s5-0 1 vector 1)) + ) + (logclear! (-> a0-26 flags) (nav-state-flag directional-mode)) + (logior! (-> a0-26 flags) (nav-state-flag target-poly-dirty)) + (set! (-> a0-26 target-post quad) (-> v1-47 quad)) + ) + 0 + (if (and (< (vector-vector-xz-distance (the-as vector (-> s5-0 0)) (-> self root-override2 trans)) 17203.2) + (< (fabs (- (-> s5-0 0 vector 0 y) (-> self root-override2 trans y))) 20480.0) + ) + (go-virtual board-vehicle) + ) + ) + ) + (none) + ) + :code (behavior () + (until #f + (play-walk-anim self) + (suspend) + ) + #f + (none) + ) + :post (the-as (function none :behavior crocadog-escort) nav-enemy-travel-post) + ) + +(defstate board-vehicle (crocadog-escort) + :virtual #t + :event (the-as + (function process int symbol event-message-block object :behavior crocadog-escort) + enemy-event-handler + ) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (let ((v1-5 self)) + (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (let ((gp-0 (handle->process (-> self vehicle-handle)))) + (when (or (not (logtest? (-> self bot-flags) (bot-flags bf15))) (< (-> self vehicle-seat-index) 0)) + (logclear! (-> self bot-flags) (bot-flags bf15)) + (go-idle-or-move self) + ) + (let* ((s5-0 (handle->process (-> self kid-handle))) + (a2-0 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (if a2-0 + (put-rider-in-seat (the-as vehicle gp-0) (-> self vehicle-seat-index) (the-as process-focusable a2-0)) + ) + ) + ) + (set! (-> self focus-status) (logior (focus-status pilot) (-> self focus-status))) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logior! (-> self focus-status) (focus-status disable)) + (logclear! (-> self focus-status) (focus-status arrestable)) + (logclear! (-> self bot-flags) (bot-flags bf15)) + (none) + ) + :exit (behavior () + (local-vars (v1-6 enemy-flag)) + (logior! (-> self root-override2 nav-flags) (nav-flags has-root-sphere)) + (logclear! (-> self focus-status) (focus-status disable)) + (let ((v1-5 (-> self enemy-flags))) + (if (logtest? v1-5 (enemy-flag checking-water)) + (set! v1-6 (logior v1-5 (enemy-flag enable-on-active))) + (set! v1-6 (logclear v1-5 (enemy-flag enable-on-active))) + ) + ) + (set! (-> self enemy-flags) v1-6) + (logclear! (-> self bot-flags) (bot-flags bf15)) + (none) + ) + :trans (behavior () + (check-vehicle-exit self) + (none) + ) + :code (behavior () + (local-vars (sv-128 float)) + (ja-channel-push! 1 (seconds 0.1)) + (let ((gp-0 (new 'stack-no-clear 'matrix))) + (ja-no-eval :group! (-> self draw art-group data 10) + :num! (seek! (ja-aframe 1.0 0) 0.5) + :frame-num (ja-aframe 0.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 1.0 0) 0.5)) + ) + (let ((s5-2 (new 'stack-no-clear 'vector))) + (set! (-> s5-2 quad) (-> self root-override2 trans quad)) + (let ((s4-0 (quaternion-copy! (new 'stack-no-clear 'quaternion) (-> self root-override2 quat)))) + (ja-no-eval :group! (-> self draw art-group data 10) + :num! (seek! (ja-aframe 5.0 0) 0.5) + :frame-num (ja-aframe 1.0 0) + ) + (until (ja-done? 0) + (let ((s3-1 (handle->process (-> self vehicle-handle)))) + (quaternion-copy! (the-as quaternion (-> gp-0 vector 2)) (-> (the-as vehicle s3-1) root-override-2 quat)) + (compute-seat-position (the-as vehicle s3-1) (the-as vector (-> gp-0 vector)) (-> self vehicle-seat-index)) + ) + (vector-! (-> gp-0 vector 1) (the-as vector (-> gp-0 vector)) s5-2) + (let ((s3-2 lerp-scale) + (s2-0 0.0) + (s1-0 1.0) + (s0-0 (ja-aframe-num 0)) + ) + (set! sv-128 (ja-aframe 1.0 0)) + (let* ((t0-0 (ja-aframe 4.0 0)) + (f30-0 (s3-2 s2-0 s1-0 s0-0 sv-128 t0-0)) + ) + (quaternion-rotate-local-y! + (the-as quaternion (-> gp-0 vector 2)) + (the-as quaternion (-> gp-0 vector 2)) + (* f30-0 (if (zero? (-> self vehicle-seat-index)) + -16384.0 + 16384.0 + ) + ) + ) + (quaternion-slerp! (-> self root-override2 quat) s4-0 (the-as quaternion (-> gp-0 vector 2)) f30-0) + (vector+float*! (-> self root-override2 trans) s5-2 (-> gp-0 vector 1) f30-0) + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 5.0 0) 0.5)) + ) + ) + ) + (let ((s5-3 (new 'stack-no-clear 'vector))) + (set! (-> s5-3 quad) (-> self root-override2 trans quad)) + (ja-no-eval :group! (-> self draw art-group data 10) + :num! (seek! (ja-aframe 7.0 0) 0.5) + :frame-num (ja-aframe 5.0 0) + ) + (until (ja-done? 0) + (let ((s4-2 (handle->process (-> self vehicle-handle)))) + (quaternion-copy! (-> self root-override2 quat) (-> (the-as vehicle s4-2) root-override-2 quat)) + (quaternion-rotate-local-y! + (-> self root-override2 quat) + (-> self root-override2 quat) + (if (zero? (-> self vehicle-seat-index)) + -16384.0 + 16384.0 + ) + ) + (vector-matrix*! + (the-as vector (-> gp-0 vector)) + (-> self local-seat-pos) + (-> (the-as vehicle s4-2) node-list data 0 bone transform) + ) + ) + (vector-! (-> gp-0 vector 1) (the-as vector (-> gp-0 vector)) s5-3) + (let ((f0-16 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 5.0 0) (ja-aframe 7.0 0)))) + (vector+float*! (-> self root-override2 trans) s5-3 (-> gp-0 vector 1) f0-16) + ) + (suspend) + (ja :num! (seek! (ja-aframe 7.0 0) 0.5)) + ) + ) + (quaternion-copy! (new 'stack-no-clear 'quaternion) (-> self root-override2 quat)) + (ja-no-eval :group! (-> self draw art-group data 10) + :num! (seek! (ja-aframe 12.0 0) 0.5) + :frame-num (ja-aframe 7.0 0) + ) + (until (ja-done? 0) + (let ((s5-5 (handle->process (-> self vehicle-handle)))) + (quaternion-copy! (the-as quaternion (-> gp-0 vector 2)) (-> (the-as vehicle s5-5) root-override-2 quat)) + (vector-matrix*! + (-> self root-override2 trans) + (-> self local-seat-pos) + (-> (the-as vehicle s5-5) node-list data 0 bone transform) + ) + ) + (let ((f0-22 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 7.0 0) (ja-aframe 9.0 0)))) + (quaternion-rotate-local-y! + (-> self root-override2 quat) + (the-as quaternion (-> gp-0 vector 2)) + (* (- 1.0 f0-22) (if (zero? (-> self vehicle-seat-index)) + -16384.0 + 16384.0 + ) + ) + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 12.0 0) 0.5)) + ) + ) + (set! (-> self focus-status) (logior (focus-status pilot-riding pilot) (-> self focus-status))) + (go-virtual ride-vehicle) + (none) + ) + :post (the-as (function none :behavior crocadog-escort) nav-enemy-simple-post) + ) + +(defstate ride-vehicle (crocadog-escort) + :virtual #t + :event (the-as + (function process int symbol event-message-block object :behavior crocadog-escort) + enemy-event-handler + ) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (let ((v1-5 self)) + (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self root-override2 nav-flags) (nav-flags has-root-sphere)) + (let ((v1-11 (-> self nav))) + (logclear! (-> v1-11 shape nav-flags) (nav-flags has-extra-sphere)) + ) + 0 + (set! (-> self focus-status) (logior (focus-status disable pilot-riding pilot) (-> self focus-status))) + (set! (-> self anim-speed) 0.0) + (none) + ) + :exit (behavior () + (local-vars (v1-4 enemy-flag)) + (logior! (-> self root-override2 nav-flags) (nav-flags has-root-sphere)) + (let ((v1-3 (-> self enemy-flags))) + (if (logtest? v1-3 (enemy-flag checking-water)) + (set! v1-4 (logior v1-3 (enemy-flag enable-on-active))) + (set! v1-4 (logclear v1-3 (enemy-flag enable-on-active))) + ) + ) + (set! (-> self enemy-flags) v1-4) + (logclear! (-> self bot-flags) (bot-flags bf15)) + (none) + ) + :trans (behavior () + (check-vehicle-exit self) + 0.0 + (when (logtest? (-> self focus-status) (focus-status pilot-riding)) + (let ((s5-0 (handle->process (-> self vehicle-handle))) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (quaternion-copy! (-> self root-override2 quat) (-> (the-as vehicle s5-0) root-override-2 quat)) + (set! (-> gp-0 quad) (-> self root-override2 trans quad)) + (vector-matrix*! + (-> self root-override2 trans) + (-> self local-seat-pos) + (-> (the-as vehicle s5-0) node-list data 0 bone transform) + ) + (let* ((f0-2 (* (vector-vector-distance (-> self root-override2 trans) gp-0) (-> self clock frames-per-second))) + (f0-3 (lerp-scale 0.3 1.2 f0-2 0.0 81920.0)) + ) + (seek! (-> self anim-speed) f0-3 (* 2.0 (-> self clock seconds-per-frame))) + ) + ) + ) + (if (and (logtest? (bot-flags bf16) (-> self bot-flags)) (want-exit-vehicle? self (-> self exit-vehicle-dest))) + (go-virtual exit-vehicle) + ) + (none) + ) + :code (behavior () + (until #f + (ja-no-eval :group! (-> self draw art-group data 11) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 11)) frames num-frames) -1)) + (-> self anim-speed) + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max (-> self anim-speed))) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior crocadog-escort) nav-enemy-simple-post) + ) + +(defstate exit-vehicle (crocadog-escort) + :virtual #t + :event (the-as + (function process int symbol event-message-block object :behavior crocadog-escort) + enemy-event-handler + ) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (let ((v1-5 self)) + (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logior! (-> self root-override2 nav-flags) (nav-flags has-root-sphere)) + (logior! (-> self focus-status) (focus-status disable)) + (none) + ) + :exit (behavior () + (local-vars (v1-11 enemy-flag)) + (set! (-> self vehicle-seat-index) -1) + (set! (-> self vehicle-handle) (the-as handle #f)) + (logclear! (-> self bot-flags) (bot-flags bf16)) + (logclear! (-> self focus-status) (focus-status pilot-riding pilot)) + (let ((v1-5 (-> self nav))) + (logclear! (-> v1-5 shape nav-flags) (nav-flags has-extra-sphere)) + ) + 0 + (logclear! (-> self focus-status) (focus-status disable)) + (let ((v1-10 (-> self enemy-flags))) + (if (logtest? v1-10 (enemy-flag checking-water)) + (set! v1-11 (logior v1-10 (enemy-flag enable-on-active))) + (set! v1-11 (logclear v1-10 (enemy-flag enable-on-active))) + ) + ) + (set! (-> self enemy-flags) v1-11) + (logclear! (-> self bot-flags) (bot-flags bf15)) + (none) + ) + :trans (behavior () + (check-vehicle-exit self) + (when (logtest? (-> self focus-status) (focus-status pilot-riding)) + (let ((gp-0 (handle->process (-> self vehicle-handle)))) + (quaternion-copy! (-> self root-override2 quat) (-> (the-as vehicle gp-0) root-override-2 quat)) + (vector-matrix*! + (-> self root-override2 trans) + (-> self local-seat-pos) + (-> (the-as vehicle gp-0) node-list data 0 bone transform) + ) + ) + ) + (none) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.1)) + (let ((gp-0 (new 'stack-no-clear 'inline-array 'matrix 2))) + (ja-no-eval :group! (-> self draw art-group data 10) + :num! (seek! (ja-aframe 7.0 0) 0.25) + :frame-num (ja-aframe 12.0 0) + ) + (until (ja-done? 0) + (let ((s5-1 (handle->process (-> self vehicle-handle)))) + (quaternion-copy! (-> self root-override2 quat) (-> (the-as vehicle s5-1) root-override-2 quat)) + (vector-matrix*! + (-> self root-override2 trans) + (-> self local-seat-pos) + (-> (the-as vehicle s5-1) node-list data 0 bone transform) + ) + ) + (let ((f0-3 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 9.0 0) (ja-aframe 7.0 0)))) + (quaternion-rotate-local-y! + (-> self root-override2 quat) + (-> self root-override2 quat) + (* f0-3 (if (zero? (-> self vehicle-seat-index)) + 16384.0 + -16384.0 + ) + ) + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 7.0 0) 0.25)) + ) + (set! (-> gp-0 0 vector 1 quad) (-> self root-override2 trans quad)) + (ja-no-eval :group! (-> self draw art-group data 10) + :num! (seek! (ja-aframe 5.0 0) 0.5) + :frame-num (ja-aframe 7.0 0) + ) + (until (ja-done? 0) + (let ((s5-5 (handle->process (-> self vehicle-handle)))) + (quaternion-copy! (-> self root-override2 quat) (-> (the-as vehicle s5-5) root-override-2 quat)) + (quaternion-rotate-local-y! + (-> self root-override2 quat) + (-> self root-override2 quat) + (if (zero? (-> self vehicle-seat-index)) + 16384.0 + -16384.0 + ) + ) + (compute-seat-position (the-as vehicle s5-5) (the-as vector (-> gp-0 0)) (-> self vehicle-seat-index)) + ) + (vector-! (-> gp-0 0 trans) (the-as vector (-> gp-0 0)) (-> gp-0 0 vector 1)) + (let ((f0-10 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 7.0 0) (ja-aframe 5.0 0)))) + (vector+float*! (-> self root-override2 trans) (-> gp-0 0 vector 1) (-> gp-0 0 trans) f0-10) + ) + (suspend) + (ja :num! (seek! (ja-aframe 5.0 0) 0.5)) + ) + (logclear! (-> self focus-status) (focus-status pilot-riding)) + (set! (-> gp-0 0 quad 0) (-> self root-override2 trans quad)) + (ja-no-eval :group! (-> self draw art-group data 10) + :num! (seek! (ja-aframe 0.0 0)) + :frame-num (ja-aframe 5.0 0) + ) + (until (ja-done? 0) + (let ((s5-9 (handle->process (-> self vehicle-handle)))) + (compute-seat-position (the-as vehicle s5-9) (the-as vector (-> gp-0 0)) (-> self vehicle-seat-index)) + (quaternion-rotate-local-y! + (the-as quaternion (-> gp-0 1)) + (-> (the-as vehicle s5-9) root-override-2 quat) + (if (zero? (-> self vehicle-seat-index)) + -49152.0 + 49152.0 + ) + ) + ) + (let ((s5-10 (-> self root-override2 quat))) + (let ((f30-0 (quaternion-y-angle (the-as quaternion (-> gp-0 1))))) + (quaternion-identity! s5-10) + (quaternion-rotate-y! s5-10 s5-10 f30-0) + ) + (let ((f0-16 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 5.0 0) (ja-aframe 1.0 0)))) + (quaternion-slerp! s5-10 (the-as quaternion (-> gp-0 1)) s5-10 f0-16) + ) + ) + (want-exit-vehicle? self (-> self exit-vehicle-dest)) + (let* ((v1-79 (-> self nav)) + (a1-40 (-> self exit-vehicle-dest)) + (f0-17 (-> v1-79 extra-nav-sphere w)) + ) + (set! (-> v1-79 extra-nav-sphere quad) (-> a1-40 quad)) + (set! (-> v1-79 extra-nav-sphere w) f0-17) + ) + 0 + (let ((v1-82 (-> self nav))) + (set! (-> v1-82 extra-nav-sphere w) (-> self nav-radius-backup)) + ) + 0 + (let ((v1-84 (-> self nav))) + (logior! (-> v1-84 shape nav-flags) (nav-flags has-extra-sphere)) + ) + 0 + (vector-! (-> gp-0 0 trans) (the-as vector (-> gp-0 0)) (-> self exit-vehicle-dest)) + (let ((f0-19 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 1.0 0) (ja-aframe 5.0 0)))) + (vector+float*! (-> self root-override2 trans) (-> self exit-vehicle-dest) (-> gp-0 0 trans) f0-19) + ) + (suspend) + (ja :num! (seek! (ja-aframe 0.0 0))) + ) + ) + (react-to-focus self) + (none) + ) + :post (the-as (function none :behavior crocadog-escort) nav-enemy-simple-post) + ) + +(defstate traveling-blocked (crocadog-escort) + :virtual #t + :event (the-as + (function process int symbol event-message-block object :behavior crocadog-escort) + enemy-event-handler + ) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (nav-enemy-method-167 self) + (let ((v1-7 self)) + (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (vector-reset! (-> self root-override2 transv)) + (look-at-target! self (enemy-flag lock-focus)) + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + :trans (behavior () + (bot-method-223 self #f) + (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) + (go-virtual traveling) + ) + (none) + ) + :code (-> (method-of-type crocadog-escort waiting-idle) code) + :post (the-as (function none :behavior crocadog-escort) nav-enemy-simple-post) + ) + +(defstate stare (crocadog-escort) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type bot stare) enter))) + (if t9-0 + (t9-0) + ) + ) + (let ((v1-4 self)) + (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + :trans (behavior () + (bot-method-223 self #f) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (if (not (nav-enemy-method-163 self)) + (go-virtual traveling) + ) + ) + (none) + ) + :code (-> (method-of-type crocadog-escort waiting-idle) code) + ) + +(defstate hit (crocadog-escort) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type bot hit) enter))) + (if t9-0 + (t9-0) + ) + ) + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + :code (behavior () + (local-vars (v1-7 enemy-flag) (v1-15 enemy-flag)) + (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logior! (-> self focus-status) (focus-status dangerous)) + (logclear! (-> self focus-status) (focus-status dangerous)) + ) + (let ((v1-6 (-> self enemy-flags))) + (if (logtest? v1-6 (enemy-flag checking-water)) + (set! v1-7 (logior v1-6 (enemy-flag enable-on-active))) + (set! v1-7 (logclear v1-6 (enemy-flag enable-on-active))) + ) + ) + (set! (-> self enemy-flags) v1-7) + (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (set! (-> self mask) (logior (process-mask collectable) (-> self mask))) + (logclear! (-> self mask) (process-mask collectable)) + ) + (let ((v1-14 (-> self enemy-flags))) + (if (logtest? (enemy-flag no-initial-move-to-ground) v1-14) + (set! v1-15 (logior (enemy-flag check-water-backup) v1-14)) + (set! v1-15 (logclear v1-14 (enemy-flag check-water-backup))) + ) + ) + (set! (-> self enemy-flags) v1-15) + (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self focus-status) (focus-status hit)) + (react-to-focus self) + (none) + ) + ) + +(defstate knocked (crocadog-escort) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type bot knocked) enter))) + (if t9-0 + (t9-0) + ) + ) + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + ) + +(defstate die-falling (crocadog-escort) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type bot die-falling) enter))) + (if t9-0 + (t9-0) + ) + ) + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + :code (behavior () + 0.0 + (until #f + (if (and (logtest? (-> self bot-flags) (bot-flags failed)) + (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (reset? *fail-mission-control*) + ) + (reset! *fail-mission-control*) + ) + (cond + ((zero? (get-rand-int self 3)) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 6) :num! (seek! (ja-aframe 3.0 0) 0.5) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 3.0 0) 0.5)) + ) + (ja-no-eval :group! (-> self draw art-group data 6) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 6)) frames num-frames) -1)) 0.33) + :frame-num (ja-aframe 3.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 0.33)) + ) + ) + (else + (ja-channel-push! 1 (seconds 0.1)) + (let ((f30-0 (get-rand-float-range self 0.4 0.6))) + (ja-no-eval :group! (-> self draw art-group data 14) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 14)) frames num-frames) -1)) + f30-0 + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max f30-0)) + ) + ) + ) + ) + ) + #f + (none) + ) + ) + +(defstate failed (crocadog-escort) + :virtual #t + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (nav-enemy-method-167 self) + (let ((v1-7 self)) + (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (vector-reset! (-> self root-override2 transv)) + (stop-looking-at-target! self) + (set! (-> self travel-anim-interp) 0.0) + (logior! (-> self bot-flags) (bot-flags bf09)) + (logclear! (-> self bot-flags) (bot-flags bf19)) + (none) + ) + :trans (behavior () + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (not (logtest? (bot-flags bf19) (-> self bot-flags))) + (set! (-> self bot-flags) (logior (bot-flags bf19) (-> self bot-flags))) + (fail-mission! self) + ) + (fail-falling self) + ) + (none) + ) + :code (-> (method-of-type crocadog-escort die-falling) code) + ) + +(defstate knocked-off-vehicle (crocadog-escort) + :virtual #t + :event (the-as + (function process int symbol event-message-block object :behavior crocadog-escort) + enemy-event-handler + ) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (nav-enemy-method-167 self) + (let ((v1-7 self)) + (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (vector-reset! (-> self root-override2 transv)) + (stop-looking-at-target! self) + (logior! (-> self bot-flags) (bot-flags bf09)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> self focus-status) (focus-status dangerous)) + (logclear! (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self mask) (process-mask collectable)) + (logclear! (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> self mask) (process-mask actor-pause)) + (logclear! (-> self enemy-flags) (enemy-flag notice)) + (logclear! (-> self focus-status) (focus-status disable)) + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + :code (-> (method-of-type crocadog-escort waiting-idle) code) + :post (the-as (function none :behavior crocadog-escort) nav-enemy-simple-post) + ) diff --git a/goal_src/jak2/levels/city/kid_escort/crocesc-task.gc b/goal_src/jak2/levels/city/kid_escort/crocesc-task.gc index eaa4c51bf9..0847a2d263 100644 --- a/goal_src/jak2/levels/city/kid_escort/crocesc-task.gc +++ b/goal_src/jak2/levels/city/kid_escort/crocesc-task.gc @@ -7,3 +7,42 @@ ;; DECOMP BEGINS +(defmethod reset-task! crocesct-wait-spot ((obj crocesct-wait-spot)) + (set! (-> obj check-done) #f) + (set! (-> obj which-spot) -1) + (set! (-> obj num-spots) (the-as uint 0)) + 0 + (none) + ) + +;; WARN: Return type mismatch symbol vs none. +(defmethod ai-task-method-11 crocesct-wait-spot ((obj crocesct-wait-spot) (arg0 bot)) + (let ((s4-0 (-> obj which-spot))) + (when (>= s4-0 0) + (let ((s3-0 (-> arg0 course spots (-> obj spot-indexes s4-0)))) + (if (and (not (outside-spot-radius? arg0 s3-0 (the-as vector #f) #f)) (player-blocking-spot? arg0 s3-0)) + (set! s4-0 -1) + ) + ) + ) + (when (< s4-0 0) + (set! s4-0 (choose-spot arg0 (the-as int (-> obj num-spots)) (the-as (pointer uint) (-> obj spot-indexes)))) + (set! (-> obj which-spot) s4-0) + (mem-copy! + (the-as pointer (-> arg0 spot)) + (the-as pointer (-> arg0 course spots (-> obj spot-indexes s4-0))) + 20 + ) + ) + (if (logtest? *display-bot-marks* (bot-marks-controls bmc16)) + (bot-debug-draw-spot-sphere + arg0 + (the-as int (-> obj num-spots)) + (the-as (pointer uint) (-> obj spot-indexes)) + (the-as int (-> obj spot-indexes s4-0)) + ) + ) + ) + ((-> obj check-done) obj (the-as crocadog-escort arg0)) + (none) + ) diff --git a/goal_src/jak2/levels/city/kid_escort/crocesc.gc b/goal_src/jak2/levels/city/kid_escort/crocesc.gc index 75b90a2ce5..d932239c77 100644 --- a/goal_src/jak2/levels/city/kid_escort/crocesc.gc +++ b/goal_src/jak2/levels/city/kid_escort/crocesc.gc @@ -7,3 +7,675 @@ ;; DECOMP BEGINS +(define *crocadog-escort-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 2 + (new 'static 'idle-control-frame :command (ic-cmd play) :anim #x3 :param0 #x1 :param1 #x1) + (new 'static 'idle-control-frame) + ) + :idle-anim 3 + :notice-anim 3 + :hostile-anim -1 + :hit-anim 3 + :knocked-anim 12 + :knocked-land-anim 13 + :die-anim 3 + :die-falling-anim 3 + :victory-anim -1 + :jump-wind-up-anim 3 + :jump-in-air-anim 3 + :jump-land-anim 3 + :neck-joint 6 + :look-at-joint 6 + :bullseye-joint 4 + :notice-distance (meters 6) + :notice-distance-delta (meters 10) + :proximity-notice-distance (meters 6) + :default-hit-points 100 + :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.7 + :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 49152.0 + :knocked-soft-vxz-hi 49152.0 + :knocked-soft-vy-lo 40960.0 + :knocked-soft-vy-hi 40960.0 + :knocked-medium-vxz-lo 49152.0 + :knocked-medium-vxz-hi 49152.0 + :knocked-medium-vy-lo 40960.0 + :knocked-medium-vy-hi 40960.0 + :knocked-hard-vxz-lo 49152.0 + :knocked-hard-vxz-hi 49152.0 + :knocked-hard-vy-lo 40960.0 + :knocked-hard-vy-hi 40960.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 49152.0 + :knocked-yellow-vxz-hi 49152.0 + :knocked-yellow-vy-lo 40960.0 + :knocked-yellow-vy-hi 40960.0 + :knocked-red-vxz-lo 49152.0 + :knocked-red-vxz-hi 49152.0 + :knocked-red-vy-lo 40960.0 + :knocked-red-vy-hi 40960.0 + :knocked-blue-vxz-lo 49152.0 + :knocked-blue-vxz-hi 49152.0 + :knocked-blue-vy-lo 40960.0 + :knocked-blue-vy-hi 40960.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 3 + :turn-anim -1 + :run-anim 3 + :taunt-anim -1 + :run-travel-speed (meters 7) + :run-acceleration (meters 14) + :run-turning-acceleration (meters 6) + :walk-travel-speed (meters 2.2) + :walk-acceleration (meters 8) + :walk-turning-acceleration (meters 6) + :maximum-rotation-rate (degrees 360.0) + :notice-nav-radius (meters 0.65) + :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! (-> *crocadog-escort-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) + +(defmethod general-event-handler crocadog-escort ((obj crocadog-escort) (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 + (('attack) + ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) + #f + ) + (('nav-mesh-kill) + (change-to *default-nav-mesh* obj) + #t + ) + (else + ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) + ) + ) + ) + +(defmethod get-penetrate-info crocadog-escort ((obj crocadog-escort)) + "@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 bot get-penetrate-info) obj))) + (logior (penetrate jak-yellow-shot jak-red-shot jak-blue-shot) v1-1) + ) + ) + +(defmethod bot-method-193 crocadog-escort ((obj crocadog-escort)) + (let* ((t9-0 (method-of-type bot bot-method-193)) + (v0-0 (t9-0 obj)) + ) + (if (and (not v0-0) (logtest? #x1c00000 (-> obj incoming penetrate-using))) + (set! v0-0 #t) + ) + v0-0 + ) + ) + +(defmethod enemy-method-79 crocadog-escort ((obj crocadog-escort) (arg0 int) (arg1 enemy-knocked-info)) + (local-vars (gp-0 symbol)) + (case arg0 + ((3) + (set! gp-0 (ja-done? 0)) + (let ((f30-0 1.0)) + (if (>= (ja-aframe-num 0) 4.0) + (set! f30-0 0.25) + ) + (let ((a0-4 (-> obj skel root-channel 0))) + (set! (-> a0-4 param 0) (the float (+ (-> a0-4 frame-group frames num-frames) -1))) + (set! (-> a0-4 param 1) f30-0) + (joint-control-channel-group-eval! a0-4 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (else + (set! gp-0 ((method-of-type bot enemy-method-79) obj arg0 arg1)) + ) + ) + gp-0 + ) + +(defmethod want-exit-vehicle? crocadog-escort ((obj crocadog-escort) (arg0 vector)) + (let ((s3-0 (handle->process (-> obj vehicle-handle)))) + (if (or (not s3-0) (not (-> obj nav))) + (return #f) + ) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (compute-seat-position (the-as vehicle s3-0) s4-0 (-> obj vehicle-seat-index)) + (vector-! s4-0 s4-0 (-> (the-as vehicle s3-0) root-override-2 trans)) + (set! (-> s4-0 y) 0.0) + (vector-normalize! s4-0 (+ 12288.0 (vector-length s4-0))) + (vector+! s4-0 s4-0 (-> (the-as vehicle s3-0) root-override-2 trans)) + (let ((s3-1 (new 'stack-no-clear 'collide-query))) + (when (enemy-above-ground? obj s3-1 s4-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) + (set! (-> s4-0 y) (-> s3-1 best-other-tri intersect y)) + (let ((s3-2 (new 'stack-no-clear 'vector))) + (do-navigation-to-destination (-> obj nav state) (-> obj root-override2 trans)) + (when (cloest-point-on-mesh (-> obj nav) s3-2 s4-0 (the-as nav-poly #f)) + (let ((f0-4 2048.0)) + (when (>= (* f0-4 f0-4) (vector-vector-xz-distance-squared s3-2 s4-0)) + (set! (-> arg0 quad) (-> s3-2 quad)) + #t + ) + ) + ) + ) + ) + ) + ) + ) + ) + +(defmethod run-logic? crocadog-escort ((obj crocadog-escort)) + (or (not (logtest? (process-mask enemy) (-> *setting-control* user-current process-mask))) + (logtest? (-> obj bot-flags) (bot-flags bf09)) + ) + ) + +(defmethod enemy-method-97 crocadog-escort ((obj crocadog-escort)) + (with-pp + (let* ((s4-0 (handle->process (-> obj attacker-handle))) + (s5-0 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + (when s5-0 + (when (>= (- (-> pp clock frame-counter) (-> obj attacker-time)) (seconds 3)) + (set! s5-0 (the-as process #f)) + (set! (-> obj attacker-handle) (the-as handle #f)) + ) + ) + (handle->process (-> obj kid-handle)) + (cond + (s5-0 + (empty) + ) + ((begin + (let ((s4-1 (handle->process (-> obj poi-handle)))) + (set! s5-0 (if (type? s4-1 process-focusable) + s4-1 + ) + ) + ) + s5-0 + ) + (empty) + ) + (else + (set! s5-0 (select-focus! obj)) + (cond + (s5-0 + (empty) + ) + (else + (let ((s4-2 (handle->process (-> obj kid-handle)))) + (set! s5-0 (if (type? s4-2 process-focusable) + s4-2 + ) + ) + ) + *target* + (let ((f30-0 -1.0) + (f28-0 (vector-vector-distance (target-pos 0) (-> obj root-override2 trans))) + ) + (if s5-0 + (set! f30-0 + (vector-vector-distance (get-trans (the-as process-focusable s5-0) 0) (-> obj root-override2 trans)) + ) + ) + (if (and s5-0 (>= (* 2.0 f28-0) f30-0)) + (empty) + (set! s5-0 *target*) + ) + ) + ) + ) + ) + ) + (cond + (s5-0 + (try-update-focus (-> obj focus) (the-as process-focusable s5-0) obj) + (if (and (logtest? (-> obj bot-flags) (bot-flags attacked)) (!= (-> s5-0 type) target)) + (logclear! (-> obj bot-flags) (bot-flags attacked)) + ) + ) + (else + (clear-focused (-> obj focus)) + (logclear! (-> obj bot-flags) (bot-flags attacked)) + ) + ) + s5-0 + ) + ) + ) + +;; WARN: Return type mismatch object vs symbol. +(defmethod alive? crocadog-escort ((obj crocadog-escort)) + (let ((t9-0 (method-of-type bot alive?))) + (the-as symbol (and (t9-0 obj) (-> obj next-state) (let ((v1-3 (-> obj next-state name))) + (or (= v1-3 'waiting-idle) (= v1-3 'waiting-turn)) + ) + ) + ) + ) + ) + +(defmethod init-from-entity! crocadog-escort ((obj crocadog-escort) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (stack-size-set! (-> obj main-thread) 512) + ((method-of-type bot init-from-entity!) obj arg0) + (none) + ) + +(defmethod init-enemy-collision! crocadog-escort ((obj crocadog-escort)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-others)))) + (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 1) 0))) + (set! (-> s5-0 total-prims) (the-as uint 2)) + (set! (-> s4-0 prim-core collide-as) (collide-spec bot)) + (set! (-> s4-0 prim-core collide-with) + (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set! (-> s4-0 prim-core action) (collide-action solid can-ride no-standon)) + (set-vector! (-> s4-0 local-sphere) 0.0 3276.8 0.0 4505.6) + (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 bot)) + (set! (-> v1-13 prim-core collide-with) + (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set! (-> v1-13 prim-core action) (collide-action solid can-ride no-standon)) + (set-vector! (-> v1-13 local-sphere) 0.0 2867.2 0.0 2867.2) + ) + (set! (-> s5-0 nav-radius) 2662.4) + (let ((v1-15 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-15 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-15 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 3)) + (set! (-> s5-0 event-priority) (the-as uint 1)) + (set! (-> obj root-override2) s5-0) + ) + 0 + (none) + ) + +(defmethod init! crocadog-escort ((obj crocadog-escort)) + "Set defaults for various fields." + (let ((t9-0 (method-of-type bot init!))) + (t9-0 obj) + ) + (set! (-> obj min-speed) 9011.2) + (set! (-> obj max-speed) 28672.0) + (set! (-> obj channel) (the-as uint 31)) + (set! (-> obj notice-enemy-dist) 24576.0) + (set! (-> obj travel-anim-interp) 0.0) + (set! (-> obj focus-info max-los-dist) 0.0) + (set-vector! (-> obj root-override2 scale) 1.2 1.2 1.2 1.0) + (set! (-> obj spot-color) (the-as uint #x5000ff00)) + (set! (-> obj kid-handle) (the-as handle #f)) + (set! (-> obj vehicle-handle) (the-as handle #f)) + (set-vector! (-> obj local-seat-pos) 0.0 819.2 -1638.4 1.0) + 0 + (none) + ) + +(defmethod init-enemy! crocadog-escort ((obj crocadog-escort)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" + (init! obj) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-crocadog-escort" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (init-enemy-behaviour-and-stats! obj *crocadog-escort-nav-enemy-info*) + (let ((v1-7 (-> obj neck))) + (set! (-> v1-7 up) (the-as uint 1)) + (set! (-> v1-7 nose) (the-as uint 2)) + (set! (-> v1-7 ear) (the-as uint 0)) + (set-vector! (-> v1-7 twist-max) 11832.889 11832.889 0.0 1.0) + (set! (-> v1-7 ignore-angle) 30947.555) + ) + (let ((t9-4 (method-of-type bot init-enemy!))) + (t9-4 obj) + ) + (let ((v1-10 (-> obj nav))) + (set! (-> v1-10 sphere-mask) (the-as uint 126)) + ) + 0 + (set! (-> obj my-simple-focus) (process-spawn simple-focus :to obj)) + (set! (-> obj draw light-index) (the-as uint 10)) + 0 + (none) + ) + +(defmethod bot-method-214 crocadog-escort ((obj crocadog-escort)) + #f + ) + +(defmethod check-vehicle-exit crocadog-escort ((obj crocadog-escort)) + (local-vars (v1-22 enemy-flag)) + (with-pp + (when (logtest? (focus-status pilot) (-> obj focus-status)) + (let ((v1-4 (handle->process (-> obj vehicle-handle)))) + (when (or (not v1-4) (logtest? (-> (the-as vehicle v1-4) flags) (rigid-body-object-flag dead))) + (set! (-> obj bot-flags) (logior (bot-flags bf17) (-> obj bot-flags))) + (logclear! (-> obj bot-flags) (bot-flags bf15)) + (logclear! (-> obj focus-status) (focus-status pilot-riding pilot)) + (set! (-> obj vehicle-seat-index) -1) + (set! (-> obj vehicle-handle) (the-as handle #f)) + (logior! (-> obj root-override2 nav-flags) (nav-flags has-root-sphere)) + (let* ((s5-0 (-> obj root-override2 quat)) + (f30-0 (quaternion-y-angle s5-0)) + ) + (quaternion-identity! s5-0) + (quaternion-rotate-y! s5-0 s5-0 f30-0) + ) + (let ((v1-21 (-> obj enemy-flags))) + (if (logtest? v1-21 (enemy-flag checking-water)) + (set! v1-22 (logior v1-21 (enemy-flag enable-on-active))) + (set! v1-22 (logclear v1-21 (enemy-flag enable-on-active))) + ) + ) + (set! (-> obj enemy-flags) v1-22) + (let ((f30-2 (+ 16384.0 (quaternion-y-angle (-> obj root-override2 quat)))) + (s5-1 (new 'stack-no-clear 'vector)) + ) + (set-vector! s5-1 (sin f30-2) 0.0 (cos f30-2) 1.0) + (vector-normalize! s5-1 65536.0) + (let ((a1-3 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-3 from) (process->ppointer pp)) + (set! (-> a1-3 num-params) 2) + (set! (-> a1-3 message) 'attack) + (set! (-> a1-3 param 0) (the-as uint #f)) + (let ((v1-29 (new 'static 'attack-info :mask (attack-info-mask vector id attacker-velocity knock)))) + (let* ((a0-24 *game-info*) + (a2-2 (+ (-> a0-24 attack-id) 1)) + ) + (set! (-> a0-24 attack-id) a2-2) + (set! (-> v1-29 id) a2-2) + ) + (set! (-> v1-29 vector quad) (-> s5-1 quad)) + (set! (-> v1-29 attacker-velocity quad) (-> s5-1 quad)) + (set! (-> v1-29 knock) (the-as uint 8)) + (set! (-> a1-3 param 1) (the-as uint v1-29)) + ) + (send-event-function obj a1-3) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +(defmethod go-hostile crocadog-escort ((obj crocadog-escort)) + (cond + ((logtest? (bot-flags bf17) (-> obj bot-flags)) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> obj focus-status) (focus-status dangerous)) + (logclear! (-> obj enemy-flags) (enemy-flag check-water)) + (logclear! (-> obj mask) (process-mask collectable)) + (logclear! (-> obj enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj enemy-flags) (enemy-flag notice)) + (logior! (-> obj focus-status) (focus-status disable)) + (go (method-of-object obj knocked-off-vehicle)) + ) + (else + (react-to-focus obj) + ) + ) + (none) + ) + +(defmethod react-to-focus crocadog-escort ((obj crocadog-escort)) + "@TODO - flesh out docs" + (go-idle-or-move obj) + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod go-waiting-turn crocadog-escort ((obj crocadog-escort)) + (go (method-of-object obj waiting-turn)) + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod go-idle-or-move crocadog-escort ((obj crocadog-escort)) + (if (logtest? (-> obj bot-flags) (bot-flags bf15)) + (go (method-of-object obj move-to-vehicle)) + (go (method-of-object obj waiting-idle)) + ) + (none) + ) + +(defmethod play-walk-anim crocadog-escort ((obj crocadog-escort)) + (with-pp + (let ((f30-0 (-> obj nav state speed))) + (let ((f0-1 (lerp-scale 0.0 1.0 f30-0 9011.2 28672.0))) + (seek! (-> obj travel-anim-interp) f0-1 (* 4.0 (-> pp clock seconds-per-frame))) + ) + (let ((f28-0 (-> obj travel-anim-interp)) + (v1-7 (if (> (-> obj skel active-channels) 0) + (-> obj skel root-channel 0 frame-group) + ) + ) + ) + (cond + ((and v1-7 (= v1-7 (-> obj draw art-group data 7))) + (let ((v1-12 (-> obj skel root-channel 1))) + (set! (-> v1-12 frame-interp 1) f28-0) + (set! (-> v1-12 frame-interp 0) f28-0) + ) + (let* ((f28-1 (current-cycle-distance (-> obj skel))) + (f0-5 (quaternion-y-angle (-> obj root-override2 quat))) + (f1-2 (deg- f0-5 (-> obj travel-prev-ry))) + (f0-8 (fmin 28672.0 (* 0.15707962 (-> pp clock frames-per-second) (fabs f1-2)))) + (f0-11 (/ (* 7.0 (fmax f30-0 f0-8)) (* 15.0 f28-1))) + (a0-10 (-> obj skel root-channel 0)) + ) + (set! (-> a0-10 param 0) f0-11) + (joint-control-channel-group-eval! a0-10 (the-as art-joint-anim #f) num-func-loop!) + ) + (let ((a0-11 (-> obj skel root-channel 1))) + (set! (-> a0-11 param 0) 0.0) + (joint-control-channel-group-eval! a0-11 (the-as art-joint-anim #f) num-func-chan) + ) + ) + (else + (ja-channel-push! 2 (seconds 0.15)) + (let ((a0-13 (-> obj skel root-channel 0))) + (set! (-> a0-13 dist) 4206.592) + (set! (-> a0-13 frame-group) (the-as art-joint-anim (-> obj draw art-group data 7))) + (set! (-> a0-13 param 0) 1.0) + (joint-control-channel-group! a0-13 (the-as art-joint-anim (-> obj draw art-group data 7)) num-func-loop!) + ) + (let ((a0-14 (-> obj skel root-channel 1))) + (set! (-> a0-14 frame-interp 1) f28-0) + (set! (-> a0-14 frame-interp 0) f28-0) + (set! (-> a0-14 dist) 13393.92) + (set! (-> a0-14 frame-group) (the-as art-joint-anim (-> obj draw art-group data 8))) + (set! (-> a0-14 param 0) 0.0) + (joint-control-channel-group! a0-14 (the-as art-joint-anim (-> obj draw art-group data 8)) num-func-chan) + ) + ) + ) + ) + ) + (none) + ) + ) + +(defmethod damage-amount-from-attack crocadog-escort ((obj crocadog-escort) (arg0 process) (arg1 event-message-block)) + "@returns the amount of damage taken from an attack. This can come straight off the [[attack-info]] or via [[penetrate-using->damage]]" + 0 + ) + +(defmethod bot-method-190 crocadog-escort ((obj crocadog-escort)) + #t + ) + +(defmethod enemy-method-78 crocadog-escort ((obj crocadog-escort) (arg0 (pointer float))) + (ja-channel-push! 1 (seconds 0.1)) + (let ((a1-2 (-> obj draw art-group data (-> obj enemy-info-override knocked-land-anim))) + (a0-4 (-> obj skel root-channel 0)) + ) + (set! (-> a0-4 frame-group) (the-as art-joint-anim a1-2)) + (set! (-> a0-4 param 0) (the float (+ (-> (the-as art-joint-anim a1-2) frames num-frames) -1))) + (set! (-> a0-4 param 1) (-> arg0 0)) + (set! (-> a0-4 frame-num) 0.0) + (joint-control-channel-group! a0-4 (the-as art-joint-anim a1-2) num-func-seek!) + ) + #t + ) + +(defmethod go-idle crocadog-escort ((obj crocadog-escort)) + (cond + ((task-node-closed? (game-task-node city-escort-kid-resolution)) + (cleanup-for-death obj) + (go (method-of-object obj die-fast)) + ) + (else + (go-idle-or-move obj) + ) + ) + (none) + ) diff --git a/goal_src/jak2/levels/city/kid_escort/crocesc4-course.gc b/goal_src/jak2/levels/city/kid_escort/crocesc4-course.gc index 1f0707ce9c..4a92f93975 100644 --- a/goal_src/jak2/levels/city/kid_escort/crocesc4-course.gc +++ b/goal_src/jak2/levels/city/kid_escort/crocesc4-course.gc @@ -7,3 +7,1054 @@ ;; DECOMP BEGINS +(define *crocadog4-course* + (new 'static 'bot-course + :course-id #xc + :spot-count #x17 + :default-check-too-far #f + :waypoints (new 'static 'boxed-array :type bot-waypoint + (new 'static 'bot-waypoint + :waypoint-id 1 + :skip-to -1 + :on-set (lambda ((arg0 crocadog-escort)) + (process-entity-status! arg0 (entity-perm-status no-kill) #t) + (clear-speech-flags! arg0) + (logior! (-> arg0 focus-status) (focus-status disable)) + (set! (-> arg0 notice-enemy-dist) 0.0) + (let ((v1-5 (-> arg0 root-override2 root-prim))) + (set! (-> v1-5 prim-core collide-as) (collide-spec)) + (set! (-> v1-5 prim-core collide-with) (collide-spec)) + ) + 0 + (move-to-point! (-> arg0 root-override2) (the-as vector (-> arg0 course spots 0))) + (logclear! (-> arg0 mask) (process-mask actor-pause)) + (logclear! (-> arg0 enemy-flags) (enemy-flag notice)) + (let ((v1-16 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-16 bytes 5) (the-as uint 1)) + (set! (-> v1-16 bytes 6) (the-as uint 0)) + (set! (-> v1-16 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-16) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (< 1 (-> arg1 waypoint-request)) + (let* ((a0-2 (-> arg1 actor-group 0 data 0 actor)) + (v1-4 (if a0-2 + (-> a0-2 extra process) + ) + ) + ) + (when v1-4 + (set! (-> arg1 master-handle) (process->handle v1-4)) + (set! (-> arg1 kid-handle) (-> (the-as hal-escort v1-4) slave-handle 0)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 2 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 2 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (-> arg0 root-override2 root-prim))) + (set! (-> v1-1 prim-core collide-as) (-> arg0 root-override2 backup-collide-as)) + (set! (-> v1-1 prim-core collide-with) (-> arg0 root-override2 backup-collide-with)) + ) + (vector-! (-> arg0 follow-dir) (the-as vector (-> arg0 course spots 2)) (-> arg0 root-override2 trans)) + (vector-normalize! (-> arg0 follow-dir) 1.0) + (send-event (handle->process (-> arg0 master-handle)) 'notify 'follow-dir (-> arg0 follow-dir)) + (let ((v1-14 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-14 bytes 5) (the-as uint 1)) + (set! (-> v1-14 bytes 6) (the-as uint 1)) + (set! (-> v1-14 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-14) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 4 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 4 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 2)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-1) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 5 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 5 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 crocadog-escort)) + (vector-! (-> arg0 follow-dir) (the-as vector (-> arg0 course spots 3)) (-> arg0 root-override2 trans)) + (vector-normalize! (-> arg0 follow-dir) 1.0) + (send-event (handle->process (-> arg0 master-handle)) 'notify 'follow-dir (-> arg0 follow-dir)) + (let ((v1-12 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-12 bytes 5) (the-as uint 1)) + (set! (-> v1-12 bytes 6) (the-as uint 3)) + (set! (-> v1-12 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-12) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 6 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 6 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 crocadog-escort)) + (vector-! (-> arg0 follow-dir) (the-as vector (-> arg0 course spots 7)) (-> arg0 root-override2 trans)) + (vector-normalize! (-> arg0 follow-dir) 1.0) + (send-event (handle->process (-> arg0 master-handle)) 'notify 'follow-dir (-> arg0 follow-dir)) + (let ((v1-12 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-12 bytes 5) (the-as uint 1)) + (set! (-> v1-12 bytes 6) (the-as uint 4)) + (set! (-> v1-12 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-12) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 7 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 7 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 5)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-1) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 8 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 8 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 6)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-1) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 9 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 9 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 crocadog-escort)) + (vector-! (-> arg0 follow-dir) (the-as vector (-> arg0 course spots 12)) (-> arg0 root-override2 trans)) + (vector-normalize! (-> arg0 follow-dir) 1.0) + (send-event (handle->process (-> arg0 master-handle)) 'notify 'follow-dir (-> arg0 follow-dir)) + (let ((v1-12 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-12 bytes 5) (the-as uint 1)) + (set! (-> v1-12 bytes 6) (the-as uint 7)) + (set! (-> v1-12 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-12) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 10 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 10 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 8)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-1) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 11 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 11 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 9)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-1) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 12 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 12 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 10)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-1) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 13 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 13 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 11)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-1) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 14 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 14 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 crocadog-escort)) + (vector-! (-> arg0 follow-dir) (the-as vector (-> arg0 course spots 14)) (-> arg0 root-override2 trans)) + (vector-normalize! (-> arg0 follow-dir) 1.0) + (send-event (handle->process (-> arg0 master-handle)) 'notify 'follow-dir (-> arg0 follow-dir)) + (let ((v1-12 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-12 bytes 5) (the-as uint 1)) + (set! (-> v1-12 bytes 6) (the-as uint 12)) + (set! (-> v1-12 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-12) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 15 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 15 + :nav-mesh-index -1 + :skip-to #x13 + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 13)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-1) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 16 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (-> arg0 root-override2 root-prim))) + (set! (-> v1-1 prim-core collide-as) (-> arg0 root-override2 backup-collide-as)) + (set! (-> v1-1 prim-core collide-with) (-> arg0 root-override2 backup-collide-with)) + ) + (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) + (send-event arg0 'move-trans (-> arg0 course spots 12)) + (vector-! (-> arg0 follow-dir) (the-as vector (-> arg0 course spots 14)) (-> arg0 root-override2 trans)) + (vector-normalize! (-> arg0 follow-dir) 1.0) + (send-event (handle->process (-> arg0 master-handle)) 'notify 'follow-dir (-> arg0 follow-dir)) + (none) + ) + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 16 + :nav-mesh-index -1 + :skip-to #x13 + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-3 (-> arg0 actor-group 0 data 0 actor))) + (set! (-> arg0 poi-handle) (-> (the-as bot (if v1-3 + (the-as bot (-> v1-3 extra process)) + ) + ) + vehicle-handle + ) + ) + ) + (let ((v1-7 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-7 bytes 5) (the-as uint 1)) + (set! (-> v1-7 bytes 6) (the-as uint 14)) + (set! (-> v1-7 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-7) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 17 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 17 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 15)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-1) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) (when (logtest? (focus-status pilot) (-> arg1 focus-status)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 18 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 18 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 crocadog-escort)) + (clear-poi-and-focus! arg0) + (let ((v1-3 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-3 bytes 5) (the-as uint 1)) + (set! (-> v1-3 bytes 6) (the-as uint 15)) + (set! (-> v1-3 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-3) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (and (not (logtest? (focus-status pilot) (-> arg1 focus-status))) + (zero? (logand (bot-flags bf17) (-> arg1 bot-flags))) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 19 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 19 + :nav-mesh-index 1 + :skip-to -1 + :on-set (lambda ((arg0 crocadog-escort)) + (let ((a1-0 (-> arg0 course spots))) + (vector-! (-> arg0 follow-dir) (the-as vector (-> a1-0 19)) (the-as vector (-> a1-0 17))) + ) + (vector-normalize! (-> arg0 follow-dir) 1.0) + (send-event (handle->process (-> arg0 master-handle)) 'notify 'follow-dir (-> arg0 follow-dir)) + (let ((v1-12 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-12 bytes 5) (the-as uint 1)) + (set! (-> v1-12 bytes 6) (the-as uint 17)) + (set! (-> v1-12 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-12) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 21 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (-> arg0 root-override2 root-prim))) + (set! (-> v1-1 prim-core collide-as) (-> arg0 root-override2 backup-collide-as)) + (set! (-> v1-1 prim-core collide-with) (-> arg0 root-override2 backup-collide-with)) + ) + (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) + (send-event arg0 'move-trans (-> arg0 course spots 16)) + (none) + ) + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 21 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 18)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-1) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 22 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 22 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 19)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-1) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 23 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 23 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 crocadog-escort)) + (let ((a1-0 (-> arg0 course spots))) + (vector-! (-> arg0 follow-dir) (the-as vector (-> a1-0 20)) (the-as vector (-> a1-0 19))) + ) + (vector-normalize! (-> arg0 follow-dir) 1.0) + (send-event (handle->process (-> arg0 master-handle)) 'notify 'follow-dir (-> arg0 follow-dir)) + (let ((v1-12 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-12 bytes 5) (the-as uint 1)) + (set! (-> v1-12 bytes 6) (the-as uint 20)) + (set! (-> v1-12 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-12) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 24 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 24 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 21)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-1) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 25 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 25 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 22)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-1) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) (when (>= (-> arg1 waypoint-request) 26) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 26 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 26 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 crocadog-escort)) + (set! (-> arg0 poi-handle) (-> arg0 kid-handle)) + (set! (-> arg0 focus-mode) 1) + (let ((v1-3 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-3 bytes 5) (the-as uint 1)) + (set! (-> v1-3 bytes 6) (the-as uint 22)) + (set! (-> v1-3 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-3) check-done) + (the-as (function crocesct-wait-spot crocadog-escort symbol) (lambda ((arg0 crocadog-escort)) #f)) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + ) + :spots (new 'static 'inline-array bot-spot 23 + (new 'static 'bot-spot :center (new 'static 'vector :x 4708434.0 :y 33341.44 :z 172400.64 :w 10240.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4712284.0 :y 33341.44 :z 152944.64 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4670955.5 :y 33341.44 :z 107397.12 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4572528.5 :y 33341.44 :z 89006.08 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4531732.5 :y 33341.44 :z 142458.88 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4538245.0 :y 33341.44 :z 256942.08 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4420280.5 :y 33341.44 :z 274104.3 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4404142.0 :y 32358.4 :z 319979.53 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4434084.0 :y 33341.44 :z 381788.16 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4487577.5 :y 33341.44 :z 449167.38 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4472873.0 :y 33341.44 :z 570122.25 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4454113.5 :y 33341.44 :z 694026.25 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4488438.0 :y 33341.44 :z 751697.94 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4579287.0 :y 33341.44 :z 755793.94 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4746608.5 :y 33341.44 :z 711720.94 :w 61440.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4746608.5 :y 33341.44 :z 711720.94 :w 61440.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4101202.0 :y 32768.0 :z 4632617.0 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4164853.8 :y 32727.04 :z 4686848.0 :w 28672.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4245053.5 :y 55951.36 :z 4678983.5 :w 28672.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4424990.5 :y 99409.92 :z 4697743.5 :w 32768.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4433715.0 :y 99328.0 :z 4584571.0 :w 28672.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4429250.5 :y 99328.0 :z 4518748.0 :w 28672.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4501954.5 :y 103874.56 :z 4503347.0 :w 14336.0)) + ) + ) + ) + +(set! (-> *bot-course-table* course 12) *crocadog4-course*) diff --git a/goal_src/jak2/levels/city/kid_escort/hal4-course.gc b/goal_src/jak2/levels/city/kid_escort/hal4-course.gc index bf231b7675..66898ed057 100644 --- a/goal_src/jak2/levels/city/kid_escort/hal4-course.gc +++ b/goal_src/jak2/levels/city/kid_escort/hal4-course.gc @@ -7,3 +7,2018 @@ ;; DECOMP BEGINS +(deftype hal4-course (bot-course) + ((defend-speeches bot-speech-list-shuffle :offset-assert 48) + ) + :method-count-assert 9 + :size-assert #x34 + :flag-assert #x900000034 + ) + + +(deftype hal-escort (hal) + ((hal4-course hal4-course :offset 652) + (arrow-handle handle :offset 1032) + (arrestor-handle handle :offset-assert 1040) + (arrestor-time time-frame :offset-assert 1048) + (locked-player-time time-frame :offset-assert 1056) + (dont-fail-until time-frame :offset-assert 1064) + (played-defend-time time-frame :offset-assert 1072) + (played-get-in-time time-frame :offset-assert 1080) + (notice-plane plane :inline :offset-assert 1088) + ) + :heap-base #x3d0 + :method-count-assert 237 + :size-assert #x450 + :flag-assert #xed03d00450 + (:methods + (hal-escort-method-227 (_type_) symbol 227) + (hal-escort-method-228 (_type_) symbol 228) + (try-enter-vehicle (_type_) int 229) + (hal-escort-method-230 (_type_) symbol 230) + (init-traffic-params! (_type_ symbol) none 231) + (hal-escort-method-232 (_type_) none 232) + (set-traffic-danger! (_type_) none 233) + (hal-escort-method-234 (_type_ nav-mesh) process 234) + (hal-escort-method-235 (_type_) none 235) + (vehicle-destroyed? (_type_) symbol 236) + ) + ) + + +;; WARN: Return type mismatch object vs none. +(defmethod go-idle hal-escort ((obj hal-escort)) + (cond + ((task-node-closed? (game-task-node city-escort-kid-resolution)) + (cleanup-for-death obj) + (go (method-of-object obj die-fast)) + ) + (else + (go (method-of-object obj idle)) + ) + ) + (none) + ) + +(defmethod init! hal-escort ((obj hal-escort)) + "Set defaults for various fields." + (let ((t9-0 (method-of-type hal init!))) + (t9-0 obj) + ) + (set! (-> obj vehicle-handle) (the-as handle #f)) + (set! (-> obj arrestor-handle) (the-as handle #f)) + (set! (-> obj arrow-handle) (the-as handle #f)) + (set! (-> obj too-far-warn-dist-default) 61440.0) + (set! (-> obj too-far-fail-dist-delta-default) 2048000.0) + (set! (-> obj warn-to-fail-timeout) (the-as uint #x1b7740)) + (set! (-> obj warn-min-delay) (the-as uint 1200)) + (set! (-> obj warn-max-delay) (the-as uint 2100)) + 0 + (none) + ) + +(defmethod general-event-handler hal-escort ((obj hal-escort) (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" + (with-pp + (case arg2 + (('notify) + (case (-> arg3 param 0) + (('arrest) + (set! (-> obj arrestor-handle) (process->handle (the-as process (-> arg3 param 1)))) + (let ((v0-0 (the-as object (-> pp clock frame-counter)))) + (set! (-> obj arrestor-time) (the-as time-frame v0-0)) + v0-0 + ) + ) + (else + ((method-of-type hal general-event-handler) obj arg0 arg1 arg2 arg3) + ) + ) + ) + (else + ((method-of-type hal general-event-handler) obj arg0 arg1 arg2 arg3) + ) + ) + ) + ) + +(defmethod init-enemy! hal-escort ((obj hal-escort)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" + (let ((t9-0 (method-of-type hal init-enemy!))) + (t9-0 obj) + ) + (set! (-> obj channel) (the-as uint 20)) + 0 + (none) + ) + +(defmethod hal-escort-method-235 hal-escort ((obj hal-escort)) + (with-pp + (let* ((s5-0 (handle->process (-> obj arrestor-handle))) + (v1-3 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when v1-3 + (cond + ((>= (- (-> pp clock frame-counter) (-> obj arrestor-time)) (seconds 4)) + (set! (-> obj arrestor-handle) (the-as handle #f)) + ) + ((logtest? (-> (the-as process-focusable v1-3) focus-status) (focus-status hit)) + (when (and (>= (- (-> pp clock frame-counter) (-> obj played-defend-time)) (seconds 6)) + (not (channel-active? obj (the-as uint 0))) + ) + (let ((a1-5 (bot-speech-list-method-9 + (-> obj hal4-course defend-speeches) + obj + (-> obj hal4-course speeches) + (speech-flags) + ) + ) + ) + (when (>= a1-5 0) + (play-speech obj a1-5) + (set! (-> obj played-defend-time) (-> pp clock frame-counter)) + ) + ) + ) + (set! (-> obj arrestor-handle) (the-as handle #f)) + ) + ) + ) + ) + (if (and (not (speech-playing? obj 30)) + (nonzero? (-> obj played-defend-time)) + (>= (- (-> pp clock frame-counter) (-> obj played-defend-time)) (seconds 3)) + (not (channel-active? obj (the-as uint 0))) + ) + (play-speech obj 30) + ) + (none) + ) + ) + +(defmethod vehicle-destroyed? hal-escort ((obj hal-escort)) + (let ((v1-1 (handle->process (-> obj vehicle-handle)))) + (or (not v1-1) (logtest? (-> (the-as vehicle v1-1) flags) (rigid-body-object-flag dead))) + ) + ) + +(defmethod hal-escort-method-227 hal-escort ((obj hal-escort)) + (with-pp + (let ((s5-0 *target*)) + (when (logtest? (focus-status pilot-riding pilot) (-> s5-0 focus-status)) + (let* ((a0-2 (-> obj actor-group 0 data 1 actor)) + (v1-5 (when a0-2 + (let ((s4-0 (-> a0-2 extra process))) + (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + ) + ) + (when (logtest? (focus-status pilot-riding pilot) (-> (the-as process-focusable v1-5) focus-status)) + (let* ((v1-12 (-> obj actor-group 0 data 2 actor)) + (a0-5 (when v1-12 + (let ((s4-1 (-> v1-12 extra process))) + (if (type? s4-1 process-focusable) + s4-1 + ) + ) + ) + ) + ) + (when (not (logtest? (focus-status pilot-riding pilot) (-> (the-as process-focusable a0-5) focus-status))) + (let ((f0-0 245760.0)) + (and (< (* f0-0 f0-0) + (vector-vector-xz-distance-squared (get-trans (the-as process-focusable a0-5) 0) (get-trans s5-0 0)) + ) + (>= (-> pp clock frame-counter) (-> obj dont-fail-until)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + +;; WARN: Return type mismatch object vs symbol. +(defmethod hal-escort-method-228 hal-escort ((obj hal-escort)) + (with-pp + (let* ((v1-3 (-> obj actor-group 0 data 1 actor)) + (a0-1 (when v1-3 + (let ((s5-0 (-> v1-3 extra process))) + (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + ) + (s5-1 *target*) + ) + (the-as + symbol + (and a0-1 + (and s5-1 + (let ((f0-0 409600.0)) + (and (< (* f0-0 f0-0) + (vector-vector-xz-distance-squared (get-trans (the-as process-focusable a0-1) 0) (get-trans s5-1 0)) + ) + (>= (-> pp clock frame-counter) (-> obj dont-fail-until)) + ) + ) + ) + ) + ) + ) + ) + ) + +(defmethod hal-escort-method-234 hal-escort ((obj hal-escort) (arg0 nav-mesh)) + (let ((s2-0 (the-as process #f))) + (let* ((v1-3 (-> obj actor-group 0 data 1 actor)) + (gp-0 (when v1-3 + (let ((s5-0 (-> v1-3 extra process))) + (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + ) + (s5-1 (new 'stack-no-clear 'vector)) + ) + (when gp-0 + (let ((f30-0 -1.0)) + (countdown (s2-1 4) + (let ((s0-0 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + ) + (set-vector! s0-0 13312.0 0.0 17408.0 1.0) + (vector-rotate-around-y! s0-0 s0-0 (* 16384.0 (the float s2-1))) + (vector+! s0-0 s0-0 (-> (the-as process-focusable gp-0) root-override trans)) + (nav-mesh-method-10 arg0 s1-0 s0-0 (the-as nav-poly #f)) + (let ((f0-6 (vector-vector-xz-distance s1-0 (-> (the-as process-focusable gp-0) root-override trans)))) + (when (or (< f30-0 0.0) (< f30-0 f0-6)) + (set! f30-0 f0-6) + (set! (-> s5-1 quad) (-> s1-0 quad)) + ) + ) + ) + ) + ) + (let ((s2-2 (new 'stack 'traffic-object-spawn-params))) + (set! (-> s2-2 object-type) (traffic-type crimson-guard-1)) + (set! (-> s2-2 behavior) (the-as uint 5)) + (set! (-> s2-2 id) (the-as uint 0)) + (set! (-> s2-2 nav-mesh) arg0) + (set! (-> s2-2 nav-branch) #f) + (set! (-> s2-2 proc) #f) + (let ((v1-25 (-> obj actor-group 0 data 1 actor))) + (set! (-> s2-2 handle) (process->handle (when v1-25 + (let ((s4-1 (-> v1-25 extra process))) + (if (type? s4-1 process-focusable) + s4-1 + ) + ) + ) + ) + ) + ) + (set! (-> s2-2 user-data) (the-as uint 0)) + (set! (-> s2-2 flags) (the-as uint 0)) + (set! (-> s2-2 guard-type) (the-as uint 7)) + (vector-reset! (-> s2-2 velocity)) + (set! (-> s2-2 position quad) (-> s5-1 quad)) + (let ((a1-9 (new 'stack-no-clear 'vector))) + (vector-! a1-9 (-> (the-as process-focusable gp-0) root-override trans) (-> s2-2 position)) + (forward-up->quaternion (-> s2-2 rotation) a1-9 *up-vector*) + ) + (send-event *traffic-manager* 'activate-object s2-2) + (set! s2-0 (-> s2-2 proc)) + ) + ) + ) + s2-0 + ) + ) + +(defmethod try-enter-vehicle hal-escort ((obj hal-escort)) + "Returns seat index" + (let* ((gp-0 (handle->process (-> obj vehicle-handle))) + (v1-6 (-> obj actor-group 0 data 1 actor)) + (s5-0 (when v1-6 + (let ((s4-0 (-> v1-6 extra process))) + (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + ) + (s4-1 -1) + ) + (when (and gp-0 (not (logtest? (-> (the-as vehicle gp-0) flags) (rigid-body-object-flag dead))) s5-0) + (set! s4-1 (get-seat-count (the-as vehicle gp-0))) + (while (nonzero? s4-1) + (+! s4-1 -1) + (if (= (get-rider-in-seat (the-as vehicle gp-0) s4-1) s5-0) + (goto cfg-20) + ) + ) + (set! s4-1 + (get-best-seat-for-vehicle (the-as vehicle gp-0) (-> (the-as process-focusable s5-0) root-override trans) 2 1) + ) + ) + (label cfg-20) + s4-1 + ) + ) + +(defmethod hal-escort-method-232 hal-escort ((obj hal-escort)) + (with-pp + (let* ((target *target*) + (v1-3 (-> obj actor-group 0 data 1 actor)) + (s5-0 (when v1-3 + (let ((s3-0 (-> v1-3 extra process))) + (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + ) + (a0-2 (-> obj actor-group 0 data 2 actor)) + (v1-8 (when a0-2 + (let ((s3-1 (-> a0-2 extra process))) + (if (type? s3-1 process-focusable) + s3-1 + ) + ) + ) + ) + ) + (when target + (cond + ((not (-> *setting-control* user-current pilot-exit)) + (when (and s5-0 + v1-8 + (not (logtest? (-> (the-as process-focusable s5-0) focus-status) (focus-status pilot-riding))) + (not (logtest? (-> (the-as process-focusable v1-8) focus-status) (focus-status pilot-riding))) + (>= (- (-> pp clock frame-counter) (-> obj locked-player-time)) (seconds 10)) + ) + (remove-setting! 'pilot-exit) + (set-setting! 'pilot #f 0 0) + (apply-settings *setting-control*) + ) + ) + ((logtest? (-> target focus-status) (focus-status pilot-riding)) + (when (and (nonzero? (-> target pilot)) + (and (= (handle->process (-> target pilot vehicle)) (handle->process (-> obj vehicle-handle))) + (or (and s5-0 (logtest? (focus-status pilot) (-> (the-as process-focusable s5-0) focus-status))) + (and v1-8 (logtest? (focus-status pilot) (-> (the-as process-focusable v1-8) focus-status))) + ) + ) + ) + (set-setting! 'pilot-exit #f 0 0) + (apply-settings *setting-control*) + (set! (-> obj locked-player-time) (-> pp clock frame-counter)) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-traffic-params! hal-escort ((obj hal-escort) (arg0 symbol)) + (let ((gp-0 *traffic-manager*)) + (send-event gp-0 'deactivate-all) + (send-event gp-0 'set-guard-multi-focus #t) + (send-event gp-0 'set-max-alert-level 1) + (send-event gp-0 'set-alert-level 1) + (send-event gp-0 'set-guard-target-count-range 4 0 0) + (send-event gp-0 'set-guard-target-count-range 5 0 0) + (send-event gp-0 'set-guard-target-count-range 0 6 6) + (send-event gp-0 'set-alert-duration #xa4cb80) + (send-event gp-0 'set-object-reserve-count 6 #x7d00) + (when arg0 + (send-event gp-0 'set-guard-force-visible #t) + (let ((s4-1 (new 'stack 'traffic-object-spawn-params))) + (let ((v1-51 (nav-mesh-from-res-tag (-> obj entity) 'nav-mesh-actor 0))) + (set! (-> s4-1 object-type) (traffic-type crimson-guard-1)) + (set! (-> s4-1 behavior) (the-as uint 3)) + (set! (-> s4-1 id) (the-as uint 0)) + (set! (-> s4-1 nav-mesh) v1-51) + ) + (set! (-> s4-1 nav-branch) #f) + (set! (-> s4-1 proc) #f) + (set! (-> s4-1 handle) (the-as handle #f)) + (set! (-> s4-1 user-data) (the-as uint 0)) + (set! (-> s4-1 flags) (the-as uint 0)) + (set! (-> s4-1 guard-type) (the-as uint 7)) + (vector-reset! (-> s4-1 velocity)) + (set! (-> s4-1 position quad) (-> obj hal4-course spots 5 center quad)) + (quaternion-identity! (-> s4-1 rotation)) + (send-event gp-0 'activate-object s4-1) + ) + ) + ) + (none) + ) + +(defmethod set-traffic-danger! hal-escort ((obj hal-escort)) + (let ((a0-1 *target*)) + (when a0-1 + (let ((gp-0 (new 'stack-no-clear 'traffic-danger-info))) + (set! (-> gp-0 sphere quad) (-> (get-trans a0-1 0) quad)) + (set! (-> gp-0 sphere r) 12288.0) + (vector-reset! (-> gp-0 velocity)) + (set! (-> gp-0 notify-radius) 102400.0) + (set! (-> gp-0 danger-level) 1.0) + (set! (-> gp-0 decay-rate) 0.0) + (set! (-> gp-0 flags) (traffic-danger-flags tdf0)) + (set! (-> gp-0 danger-type) (traffic-danger-type tdt4)) + (add-danger (-> (the-as traffic-manager *traffic-manager*) traffic-engine) gp-0) + ) + ) + ) + 0 + (none) + ) + +(defmethod hal-escort-method-230 hal-escort ((obj hal-escort)) + (local-vars (a2-5 float) (a2-12 float)) + (rlet ((vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + ) + (let ((gp-0 (new 'stack-no-clear 'matrix)) + (s5-0 528) + ) + (let ((v1-2 (-> obj hal4-course spots 9))) + (set! (-> gp-0 vector 1 quad) (-> v1-2 center quad)) + (set! (-> gp-0 vector 1 w) (+ 81920.0 (-> v1-2 center w))) + ) + (set! *actor-list-length* 0) + (if (logtest? s5-0 512) + (set! *actor-list-length* + (fill-actor-list-for-sphere *actor-hash* (the-as sphere (-> gp-0 vector 1)) *actor-list* 256) + ) + ) + (when (logtest? s5-0 1024) + (let ((a0-4 (-> *collide-player-list* alive-list next0))) + *collide-player-list* + (let ((v1-14 (-> a0-4 next0))) + (while (!= a0-4 (-> *collide-player-list* alive-list-end)) + (let* ((a0-5 (-> (the-as connection a0-4) param1)) + (a1-3 (-> (the-as collide-shape-moving a0-5) root-prim)) + ) + (when (logtest? (the-as collide-spec s5-0) (-> a1-3 prim-core collide-as)) + (let ((a1-4 (-> a1-3 prim-core))) + (let ((a2-4 a1-4) + (a3-1 (-> gp-0 vector 1)) + ) + (.lvf vf2 (&-> a2-4 world-sphere quad)) + (.lvf vf3 (&-> a3-1 quad)) + ) + (.sub.vf vf1 vf3 vf2) + (.mul.vf vf1 vf1 vf1) + (.add.y.vf vf1 vf1 vf1 :mask #b1) + (.add.z.vf vf1 vf1 vf1 :mask #b1) + (.mov a2-5 vf1) + (let ((f0-2 a2-5) + (f1-2 (+ (-> a1-4 world-sphere w) (-> gp-0 vector 1 w))) + ) + (when (< f0-2 (* f1-2 f1-2)) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-5)) + (set! *actor-list-length* (+ *actor-list-length* 1)) + ) + ) + ) + ) + ) + ) + (set! a0-4 v1-14) + *collide-player-list* + (set! v1-14 (-> v1-14 next0)) + ) + ) + ) + ) + (when (logtest? s5-0 256) + (let ((a0-7 (-> *collide-hit-by-player-list* alive-list next0))) + *collide-hit-by-player-list* + (let ((v1-22 (-> a0-7 next0))) + (while (!= a0-7 (-> *collide-hit-by-player-list* alive-list-end)) + (let* ((a0-8 (-> (the-as connection a0-7) param1)) + (a1-15 (-> (the-as collide-shape-moving a0-8) root-prim)) + ) + (when (logtest? (the-as collide-spec s5-0) (-> a1-15 prim-core collide-as)) + (let ((a1-16 (-> a1-15 prim-core))) + (let ((a2-11 a1-16) + (a3-2 (-> gp-0 vector 1)) + ) + (.lvf vf2 (&-> a2-11 world-sphere quad)) + (.lvf vf3 (&-> a3-2 quad)) + ) + (.sub.vf vf1 vf3 vf2) + (.mul.vf vf1 vf1 vf1) + (.add.y.vf vf1 vf1 vf1 :mask #b1) + (.add.z.vf vf1 vf1 vf1 :mask #b1) + (.mov a2-12 vf1) + (let ((f0-3 a2-12) + (f1-6 (+ (-> a1-16 world-sphere w) (-> gp-0 vector 1 w))) + ) + (when (< f0-3 (* f1-6 f1-6)) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-8)) + (set! *actor-list-length* (+ *actor-list-length* 1)) + ) + ) + ) + ) + ) + ) + (set! a0-7 v1-22) + *collide-hit-by-player-list* + (set! v1-22 (-> v1-22 next0)) + ) + ) + ) + ) + (dotimes (s4-0 *actor-list-length*) + (let ((v1-27 (-> *actor-list* s4-0))) + (when (logtest? (the-as collide-spec s5-0) (-> v1-27 root-prim prim-core collide-as)) + (let* ((s3-0 (-> v1-27 process)) + (a0-16 (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + (when (and a0-16 (= (-> a0-16 type) crimson-guard)) + (let ((s3-1 (get-trans (the-as process-focusable a0-16) 0))) + (if (and (>= (-> gp-0 vector 1 w) (vector-vector-xz-distance (-> gp-0 vector 1) s3-1)) + (>= (- (-> s3-1 y) (-> gp-0 vector 1 y)) -10240.0) + ) + (return #t) + ) + ) + ) + ) + ) + ) + ) + ) + #f + ) + ) + +(defmethod play-too-far-warn-speech hal-escort ((obj hal-escort)) + (when (not (channel-active? obj (the-as uint 0))) + (let ((s5-0 0)) + (let* ((v1-5 (-> obj actor-group 0 data 1 actor)) + (s4-0 (when v1-5 + (let ((s3-0 (-> v1-5 extra process))) + (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + ) + ) + (let* ((a0-3 (-> obj actor-group 0 data 2 actor)) + (v1-10 (when a0-3 + (let ((s3-1 (-> a0-3 extra process))) + (if (type? s3-1 process-focusable) + s3-1 + ) + ) + ) + ) + ) + (if (or (logtest? (-> (the-as process-focusable s4-0) draw status) (draw-control-status on-screen)) + (logtest? (-> (the-as process-focusable v1-10) draw status) (draw-control-status on-screen)) + ) + (set! s5-0 (logior s5-0 32)) + ) + ) + (let ((s3-2 #f)) + (when (and (>= (-> obj waypoint waypoint-id) 19) *target*) + (let* ((f30-0 (-> (get-trans (the-as process-focusable s4-0) 1) y)) + (f0-1 (- (-> (get-trans *target* 1) y) f30-0)) + ) + (cond + ((>= f0-1 8192.0) + (set! s5-0 (logior s5-0 8)) + (set! s3-2 #t) + ) + ((>= -8192.0 f0-1) + (set! s5-0 (logior s5-0 16)) + (set! s3-2 #t) + ) + ) + ) + ) + (when (not s3-2) + (let ((s3-3 (new 'stack-no-clear 'vector))) + (vector-! s3-3 (target-pos 0) (-> (the-as process-focusable s4-0) root-override trans)) + (vector-normalize! s3-3 1.0) + (if (>= (vector-dot s3-3 (-> obj follow-dir)) 0.0) + (set! s5-0 (logior s5-0 8)) + (set! s5-0 (logior s5-0 16)) + ) + ) + ) + ) + ) + (let ((a1-7 (bot-speech-list-method-9 + (-> obj hal4-course too-far-warn-speeches) + obj + (-> obj hal4-course speeches) + (the-as speech-flags s5-0) + ) + ) + ) + (when (>= a1-7 0) + (play-speech obj a1-7) + #t + ) + ) + ) + ) + ) + +(defun hal4-walking-too-far ((arg0 hal-escort)) + (let ((gp-0 0)) + (let* ((v1-3 (-> arg0 actor-group 0 data 1 actor)) + (a0-1 (when v1-3 + (let ((s4-0 (-> v1-3 extra process))) + (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + ) + ) + (if (and a0-1 (>= (vector-vector-xz-distance (get-trans (the-as process-focusable a0-1) 0) (target-pos 0)) + (-> arg0 too-far-warn-dist) + ) + ) + (set! gp-0 1) + ) + ) + gp-0 + ) + ) + +(define *hal4-course* + (new 'static 'hal4-course + :course-id #xa + :speech-count #x23 + :spot-count #xa + :too-far-warn-speeches (new 'static 'bot-speech-list-shuffle + :flags #xa + :last-local-index -1 + :speech-indexes (new 'static 'boxed-array :type int16 1 2 5 6 8 9 10 12 13 16 17 18 19) + ) + :default-check-too-far #f + :waypoints (new 'static 'boxed-array :type bot-waypoint + (new 'static 'bot-waypoint + :waypoint-id 1 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 hal-escort)) + (process-entity-status! arg0 (entity-perm-status no-kill) #t) + (set-setting! 'exclusive-task #f 0 34) + (set-setting! 'allow-continue #f 0 0) + (clear-speech-flags! arg0) + (speech-control-method-10 + *speech-control* + 6 + (new 'static 'speech-type-info + :channel #x1 + :priority -2 + :min-delay #x258 + :max-delay #x4b0 + :list (new 'static 'boxed-array :type string + "kg280a" + "kg281a" + "kg282a" + "kg283a" + "kg284a" + "kg285a" + "kg286a" + "kg287a" + "kg288a" + "kg289a" + "kg290a" + "kg291a" + "kg292a" + "kg294a" + "kg297a" + "kg298a" + ) + ) + ) + (speech-control-method-10 + *speech-control* + 7 + (new 'static 'speech-type-info + :channel #x1 + :priority -2 + :min-delay #x258 + :max-delay #x4b0 + :list (new 'static 'boxed-array :type string + "kg280a" + "kg281a" + "kg282a" + "kg283a" + "kg284a" + "kg285a" + "kg286a" + "kg287a" + "kg288a" + "kg289a" + "kg290a" + "kg291a" + "kg292a" + "kg294a" + "kg295a" + "kg296a" + "kg297a" + "kg298a" + ) + ) + ) + (let ((v1-12 (-> arg0 actor-group 0 data 3 actor))) + (if v1-12 + (logior! (-> v1-12 extra perm status) (entity-perm-status bit-9)) + ) + ) + (set-setting! 'airlock #f 0 0) + (set-setting! 'minimap 'clear 0 32) + (let ((s5-0 (new 'stack-no-clear 'task-arrow-params))) + (set! (-> s5-0 pos quad) (-> arg0 hal4-course spots 1 center quad)) + (quaternion-identity! (-> s5-0 quat)) + (set! (-> s5-0 flags) (task-arrow-flags)) + (set! (-> s5-0 map-icon) (the-as uint 15)) + (set! (-> arg0 arrow-handle) (process->handle (task-arrow-spawn s5-0 (the-as task-arrow arg0)))) + ) + (let ((v1-24 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-24 bytes 5) (the-as uint 1)) + (set! (-> v1-24 bytes 6) (the-as uint 0)) + (set! (-> v1-24 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-24) check-done) + (the-as + (function halt-wait-spot hal symbol) + (lambda ((arg0 object) (arg1 hal-escort)) + (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) + (s4-0 (when v1-3 + (let ((s5-0 (-> v1-3 extra process))) + (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + ) + (v1-8 (-> arg1 actor-group 0 data 2 actor)) + (s5-1 (when v1-8 + (let ((s3-0 (-> v1-8 extra process))) + (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + ) + (v1-10 *traffic-manager*) + ) + (cond + ((not (logtest? (-> arg1 waypoint-bits) 1)) + (when (and s4-0 (and s5-1 v1-10)) + (logior! (-> arg1 waypoint-bits) 1) + (set! (-> arg1 slave-handle 0) (process->handle s4-0)) + (set! (-> arg1 slave-handle 1) (process->handle s5-1)) + ) + #f + ) + ((not (logtest? (-> arg1 waypoint-bits) 2)) + (logior! (-> arg1 waypoint-bits) 2) + (hal-method-226 arg1) + (send-event s4-0 'request 'waypoint 2) + (send-event s5-1 'request 'waypoint 2) + #f + ) + ((not (logtest? (-> arg1 waypoint-bits) 4)) + (logior! (-> arg1 waypoint-bits) 4) + (let ((s5-2 *traffic-manager*)) + (send-event s5-2 'deactivate-all) + (let ((s4-1 (new 'stack 'traffic-object-spawn-params))) + (set! (-> s4-1 position quad) (-> arg1 hal4-course spots 2 center quad)) + (quaternion-axis-angle! (-> s4-1 rotation) 0.0 1.0 0.0 0.0) + (set! (-> s4-1 object-type) (traffic-type cara)) + (set! (-> s4-1 behavior) (the-as uint 0)) + (set! (-> s4-1 id) (the-as uint 0)) + (set! (-> s4-1 proc) #f) + (send-event s5-2 'spawn-object s4-1) + (let ((a0-26 (-> s4-1 proc))) + (if a0-26 + (set! (-> arg1 vehicle-handle) (process->handle a0-26)) + ) + ) + ) + ) + #f + ) + (else + (let ((a0-30 s4-0)) + (when (and (and a0-30 (let ((s4-2 1)) + (< s4-2 (the-as int (send-event a0-30 'query 'waypoint))) + ) + ) + (let ((a0-32 s5-1)) + (and a0-32 (let ((s5-3 1)) + (< s5-3 (the-as int (send-event a0-32 'query 'waypoint))) + ) + ) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 2 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 2 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 hal-escort)) + (set-setting! 'sound-mode #f 0 2) + (let ((s5-0 (-> arg0 hal4-course spots))) + (vector-! (the-as vector (-> arg0 notice-plane)) (the-as vector (-> s5-0 4)) (the-as vector (-> s5-0 3))) + (vector-normalize! (-> arg0 notice-plane) 1.0) + (set! (-> arg0 notice-plane w) + (- (vector-dot (the-as vector (-> s5-0 3)) (the-as vector (-> arg0 notice-plane)))) + ) + ) + (play-speech arg0 0) + (let ((v1-10 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-10 bytes 5) (the-as uint 1)) + (set! (-> v1-10 bytes 6) (the-as uint 0)) + (set! (-> v1-10 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-10) check-done) + (the-as + (function halt-wait-spot hal symbol) + (lambda ((arg0 object) (arg1 hal-escort)) + (local-vars (v1-14 symbol)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) + (a0-1 (when v1-3 + (let ((s4-0 (-> v1-3 extra process))) + (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + ) + ) + (when a0-1 + (set! (-> s5-0 quad) (-> (get-trans (the-as process-focusable a0-1) 0) quad)) + (set! (-> s5-0 w) 1.0) + (when (>= (vector4-dot s5-0 (the-as vector (-> arg1 notice-plane))) 0.0) + (set! v1-14 #t) + (goto cfg-14) + ) + ) + ) + (set! (-> s5-0 quad) (-> (math-camera-pos) quad)) + (set! (-> s5-0 w) 1.0) + (when (>= (vector4-dot s5-0 (the-as vector (-> arg1 notice-plane))) 0.0) + (set! v1-14 #t) + (goto cfg-14) + ) + (set! (-> s5-0 quad) (-> (target-pos 0) quad)) + (set! (-> s5-0 w) 1.0) + (when (>= (vector4-dot s5-0 (the-as vector (-> arg1 notice-plane))) 0.0) + (set! v1-14 #t) + (goto cfg-14) + ) + ) + (set! v1-14 #f) + (label cfg-14) + (when v1-14 + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 3 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 3 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 hal-escort)) + (init-traffic-params! arg0 #t) + (set-setting! 'sound-mode #f 0 1) + (let ((v1-5 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-5 bytes 5) (the-as uint 1)) + (set! (-> v1-5 bytes 6) (the-as uint 0)) + (set! (-> v1-5 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-5) check-done) + (the-as + (function halt-wait-spot hal symbol) + (lambda ((arg0 object) (arg1 hal-escort)) + (with-pp + (if (and (not (speech-playing? arg1 3)) + (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1)) + (not (channel-active? arg1 (the-as uint 0))) + ) + (play-speech arg1 3) + ) + (when (hal-escort-method-228 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 28 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (when (speech-playing? arg1 3) + (let* ((v1-27 (-> arg1 actor-group 0 data 2 actor)) + (a0-11 (when v1-27 + (let ((s5-0 (-> v1-27 extra process))) + (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + ) + ) + (when (and a0-11 (>= (the-as int (send-event a0-11 'query 'waypoint)) 6)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 6 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 hal-escort)) (set-traffic-danger! arg0) (hal-escort-method-235 arg0) (none)) + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 6 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 hal-escort)) + (reset-warn-time! arg0) + (let ((v1-3 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-3 bytes 5) (the-as uint 1)) + (set! (-> v1-3 bytes 6) (the-as uint 0)) + (set! (-> v1-3 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-3) check-done) + (the-as + (function halt-wait-spot hal symbol) + (lambda ((arg0 object) (arg1 hal-escort)) + (when (hal-escort-method-228 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 28 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (when (vehicle-destroyed? arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 29 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (let* ((v1-25 (-> arg1 actor-group 0 data 2 actor)) + (a0-9 (when v1-25 + (let ((s5-0 (-> v1-25 extra process))) + (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + ) + ) + (when (and a0-9 (>= (the-as int (send-event a0-9 'query 'waypoint)) 15)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 15 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 hal-escort)) (set-traffic-danger! arg0) (hal-escort-method-235 arg0) (none)) + :on-skipping-here #f + :check-too-far 'hal4-walking-too-far + ) + (new 'static 'bot-waypoint + :waypoint-id 15 + :nav-mesh-index -1 + :skip-to #x14 + :on-set (lambda ((arg0 hal-escort)) + (send-event *traffic-manager* 'set-guard-force-visible #f) + (let ((v1-5 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-5 bytes 5) (the-as uint 1)) + (set! (-> v1-5 bytes 6) (the-as uint 0)) + (set! (-> v1-5 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-5) check-done) + (the-as + (function halt-wait-spot hal symbol) + (lambda ((arg0 object) (arg1 hal-escort)) + (hal-escort-method-232 arg1) + (when (hal-escort-method-228 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 28 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (when (vehicle-destroyed? arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 29 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (when (hal-escort-method-227 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 30 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (let* ((v1-38 (-> arg1 actor-group 0 data 1 actor)) + (s4-0 (when v1-38 + (let ((s5-0 (-> v1-38 extra process))) + (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + ) + (v1-43 (-> arg1 actor-group 0 data 2 actor)) + (s5-1 (when v1-43 + (let ((s3-0 (-> v1-43 extra process))) + (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + ) + (a0-16 s4-0) + ) + (cond + ((and (and a0-16 (>= (the-as int (send-event a0-16 'query 'waypoint)) 18)) + (let ((a0-18 s5-1)) + (and a0-18 (>= (the-as int (send-event a0-18 'query 'waypoint)) 18)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 18 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + (else + (let ((a0-22 s4-0)) + (when (or (and a0-22 (>= (the-as int (send-event a0-22 'query 'waypoint)) 17)) + (let ((a0-24 s5-1)) + (and a0-24 (>= (the-as int (send-event a0-24 'query 'waypoint)) 17)) + ) + ) + (let ((s3-1 (try-enter-vehicle arg1)) + (gp-1 (handle->process (-> arg1 vehicle-handle))) + ) + (let ((a0-29 s4-0)) + (if (and a0-29 (>= (the-as int (send-event a0-29 'query 'waypoint)) 17)) + (send-event s4-0 'request 'move-to-vehicle gp-1 s3-1) + ) + ) + (let ((a0-33 s5-1)) + (if (and a0-33 (>= (the-as int (send-event a0-33 'query 'waypoint)) 17)) + (send-event s5-1 'request 'move-to-vehicle gp-1 s3-1) + ) + ) + ) + ) + ) + #f + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 hal-escort)) (set-traffic-danger! arg0) (hal-escort-method-235 arg0) (none)) + :on-skipping-here (lambda ((arg0 hal-escort)) + (with-pp + (set! (-> arg0 dont-fail-until) (+ (-> pp clock frame-counter) (seconds 10))) + (reset-warn-time! arg0) + (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) + (send-event *target* 'continue (get-continue-by-name *game-info* "lkiddoge-skip0")) + (let* ((v1-16 (-> arg0 actor-group 0 data 2 actor)) + (s5-1 (when v1-16 + (let ((s4-0 (-> v1-16 extra process))) + (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + ) + (v1-21 (-> arg0 actor-group 0 data 1 actor)) + (s4-1 (when v1-21 + (let ((s3-0 (-> v1-21 extra process))) + (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + ) + ) + (send-event s5-1 'skip) + (send-event s4-1 'skip) + ) + (init-traffic-params! arg0 #f) + (none) + ) + ) + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 18 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 hal-escort)) + (let ((s5-0 *traffic-manager*)) + (send-event s5-0 'set-alert-level 2) + (send-event s5-0 'set-max-alert-level 2) + (send-event s5-0 'set-guard-target-count-range 4 1 1) + (send-event s5-0 'set-guard-target-count-range 5 1 1) + ) + (let ((v1-25 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-25 bytes 5) (the-as uint 1)) + (set! (-> v1-25 bytes 6) (the-as uint 0)) + (set! (-> v1-25 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-25) check-done) + (the-as + (function halt-wait-spot hal symbol) + (lambda ((arg0 object) (arg1 hal-escort)) + (with-pp + (hal-escort-method-232 arg1) + (when (and (not (logtest? (-> arg1 waypoint-bits) 1)) (not (-> *setting-control* user-current pilot-exit))) + (send-event (handle->process (-> arg1 arrow-handle)) 'set-position (-> arg1 hal4-course spots 6)) + (logior! (-> arg1 waypoint-bits) 1) + ) + (if (and (not (speech-playing? arg1 14)) + (not (-> *setting-control* user-current pilot-exit)) + (>= (- (-> pp clock frame-counter) (-> arg1 locked-player-time)) (seconds 1.5)) + ) + (play-speech arg1 14) + ) + (when (vehicle-destroyed? arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 29 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (let* ((v1-45 (-> arg1 actor-group 0 data 1 actor)) + (s5-0 (when v1-45 + (let ((s4-0 (-> v1-45 extra process))) + (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + ) + (v1-50 (-> arg1 actor-group 0 data 2 actor)) + (s4-1 (when v1-50 + (let ((s3-0 (-> v1-50 extra process))) + (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + ) + ) + (let ((s3-1 #f)) + (let* ((s1-0 (handle->process (-> arg1 vehicle-handle))) + (s2-0 (if (type? s1-0 process-focusable) + s1-0 + ) + ) + ) + (when s2-0 + (let ((s1-1 (get-trans (the-as process-focusable s2-0) 0)) + (s0-0 (-> arg1 hal4-course spots 7)) + ) + (if (and (>= (-> arg1 hal4-course spots 7 center w) (vector-vector-xz-distance s1-1 (the-as vector s0-0))) + (>= 16384.0 (- (-> s1-1 y) (-> s0-0 center y))) + (>= 61440.0 (vector-length (-> (the-as process-focusable s2-0) root-override transv))) + (>= 1.0 (vector-length (-> (the-as process-focusable s2-0) rbody state ang-velocity))) + ) + (set! s3-1 #t) + ) + ) + ) + ) + (if (logtest? (focus-status pilot) (-> (the-as process-focusable s5-0) focus-status)) + (send-event s5-0 'request 'exit-vehicle s3-1 1) + ) + (if (logtest? (focus-status pilot) (-> (the-as process-focusable s5-0) focus-status)) + (send-event s4-1 'request 'exit-vehicle s3-1 1) + ) + (if (and (not (speech-playing? arg1 7)) + (not (logtest? (-> (the-as process-focusable s4-1) focus-status) (focus-status pilot-riding))) + (not (logtest? (bot-flags bf17) (-> (the-as bot s4-1) bot-flags))) + s3-1 + (not (channel-active? arg1 (the-as uint 0))) + ) + (play-speech arg1 7) + ) + ) + (when (and (not (logtest? (focus-status pilot) (-> (the-as process-focusable s4-1) focus-status))) + (not (logtest? (bot-flags bf17) (-> (the-as bot s4-1) bot-flags))) + (not (logtest? (focus-status pilot) (-> (the-as process-focusable s5-0) focus-status))) + (zero? (logand (bot-flags bf17) (-> (the-as bot s5-0) bot-flags))) + ) + (send-event *target* 'end-mode) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 19 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 hal-escort)) + (with-pp + (when (and (not (speech-playing? arg0 31)) (not (speech-playing? arg0 32))) + (let ((v1-7 (handle->process (-> arg0 vehicle-handle)))) + (if (and v1-7 + (and (not (logtest? (-> (the-as vehicle v1-7) flags) (rigid-body-object-flag dead))) + (>= (vector-length (-> (the-as vehicle v1-7) root-override-2 transv)) 40960.0) + (not (channel-active? arg0 (the-as uint 0))) + ) + ) + (play-speech arg0 (if (zero? (get-rand-int arg0 2)) + 32 + 31 + ) + ) + ) + ) + ) + (when (and (zero? (-> arg0 locked-player-time)) + (or (not (speech-playing? arg0 33)) (not (speech-playing? arg0 34))) + (>= (- (-> pp clock frame-counter) (-> arg0 played-get-in-time)) (seconds 6)) + (not (channel-active? arg0 (the-as uint 0))) + ) + (let ((a0-18 (handle->process (-> arg0 vehicle-handle)))) + (when a0-18 + (let ((f0-1 (vector-vector-xz-distance (get-trans (the-as vehicle a0-18) 0) (target-pos 0)))) + (when (and (< 28672.0 f0-1) (< f0-1 184320.0)) + (play-speech arg0 (if (speech-playing? arg0 33) + 34 + 33 + ) + ) + (set! (-> arg0 played-get-in-time) (-> pp clock frame-counter)) + ) + ) + ) + ) + ) + (none) + ) + ) + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 20 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 hal-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 7)) + (set! (-> v1-1 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-1) check-done) + (the-as + (function halt-wait-spot hal symbol) + (lambda ((arg0 object) (arg1 hal-escort)) + (with-pp + (if (!= (level-status *level* 'ctyinda) 'active) + (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) + ) + (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.25)) + (let* ((v1-11 (-> arg1 actor-group 0 data 2 actor)) + (s5-1 (when v1-11 + (let ((s4-0 (-> v1-11 extra process))) + (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + ) + (v1-16 (-> arg1 actor-group 0 data 1 actor)) + (s4-1 (when v1-16 + (let ((s3-0 (-> v1-16 extra process))) + (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + ) + ) + (send-event s5-1 'hide #f) + (send-event s4-1 'hide #f) + (send-event s5-1 'skip) + (send-event s4-1 'skip) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 19 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here (lambda ((arg0 hal-escort)) + (with-pp + (set! (-> arg0 dont-fail-until) (+ (-> pp clock frame-counter) (seconds 15))) + (reset-warn-time! arg0) + (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) + (let* ((v1-10 (-> arg0 actor-group 0 data 2 actor)) + (s5-0 (when v1-10 + (let ((s4-0 (-> v1-10 extra process))) + (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + ) + (v1-15 (-> arg0 actor-group 0 data 1 actor)) + (s4-1 (when v1-15 + (let ((s3-0 (-> v1-15 extra process))) + (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + ) + ) + (vector-reset! (-> (the-as process-focusable s5-0) root-override transv)) + (vector-reset! (-> (the-as process-focusable s4-1) root-override transv)) + (send-event s5-0 'hide #t) + (send-event s4-1 'hide #t) + ) + (send-event arg0 'move-trans (-> arg0 hal4-course spots 7)) + (send-event *target* 'continue (get-continue-by-name *game-info* "lkiddoge-skip1")) + (none) + ) + ) + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 19 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 hal-escort)) + (reset-warn-time! arg0) + (send-event (handle->process (-> arg0 arrow-handle)) 'set-position (-> arg0 hal4-course spots 8)) + (let ((s5-0 *traffic-manager*)) + (send-event s5-0 'set-alert-level 1) + (send-event s5-0 'set-max-alert-level 1) + (send-event s5-0 'set-guard-target-count-range 4 0 0) + (send-event s5-0 'end-pursuit-by-type 18) + (send-event s5-0 'set-guard-target-count-range 5 0 0) + (send-event s5-0 'end-pursuit-by-type 19) + ) + (let ((v1-43 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-43 bytes 5) (the-as uint 1)) + (set! (-> v1-43 bytes 6) (the-as uint 7)) + (set! (-> v1-43 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-43) check-done) + (the-as + (function halt-wait-spot hal symbol) + (lambda ((arg0 object) (arg1 hal-escort)) + (with-pp + (when (and (not (speech-playing? arg1 4)) + (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2)) + (not (channel-active? arg1 (the-as uint 0))) + ) + (play-speech arg1 15) + (play-speech arg1 4) + ) + (when (hal-escort-method-228 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 31 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (let* ((v1-27 (-> arg1 actor-group 0 data 2 actor)) + (s4-0 (when v1-27 + (let ((s5-0 (-> v1-27 extra process))) + (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + ) + (v1-32 (-> arg1 actor-group 0 data 1 actor)) + (s5-1 (when v1-32 + (let ((s3-0 (-> v1-32 extra process))) + (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + ) + ) + (when (and (and s4-0 (>= (the-as int (send-event s4-0 'query 'waypoint)) 25)) + (and s5-1 (>= (the-as int (send-event s5-1 'query 'waypoint)) 25)) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 25 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 hal-escort)) + (hal-escort-method-232 arg0) + (set-traffic-danger! arg0) + (hal-escort-method-235 arg0) + (none) + ) + :on-skipping-here (lambda ((arg0 hal-escort)) + (with-pp + (set! (-> arg0 dont-fail-until) (+ (-> pp clock frame-counter) (seconds 15))) + (reset-warn-time! arg0) + (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) + (send-event arg0 'move-trans (-> arg0 hal4-course spots 7)) + (send-event *target* 'continue (get-continue-by-name *game-info* "lkiddoge-skip1")) + (let* ((v1-23 (-> arg0 actor-group 0 data 2 actor)) + (s5-1 (when v1-23 + (let ((s4-0 (-> v1-23 extra process))) + (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + ) + (v1-28 (-> arg0 actor-group 0 data 1 actor)) + (gp-1 (when v1-28 + (let ((s4-1 (-> v1-28 extra process))) + (if (type? s4-1 process-focusable) + s4-1 + ) + ) + ) + ) + ) + (send-event s5-1 'skip) + (send-event gp-1 'skip) + ) + (none) + ) + ) + :check-too-far 'hal4-walking-too-far + ) + (new 'static 'bot-waypoint + :waypoint-id 25 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 hal-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 7)) + (set! (-> v1-1 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-1) check-done) + (the-as + (function halt-wait-spot hal symbol) + (lambda ((arg0 object) (arg1 hal-escort)) + (when (hal-escort-method-228 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 31 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (let ((s4-0 (target-pos 0)) + (s3-0 (-> arg1 hal4-course spots 9)) + (s5-0 *target*) + ) + (cond + ((and s5-0 + (>= (-> s3-0 center w) (vector-vector-xz-distance s4-0 (-> s3-0 center))) + (and (>= (- (-> s4-0 y) (-> s3-0 center y)) -10240.0) + (zero? (logand (-> s5-0 focus-status) (focus-status edge-grab))) + ) + ) + (when (not (logtest? (-> arg1 bot-task-bits) 1)) + (send-event *traffic-manager* 'set-alert-duration 300) + (logior! (-> arg1 bot-task-bits) 1) + ) + (when (not (hal-escort-method-230 arg1)) + (let* ((v1-34 (-> arg1 actor-group 0 data 2 actor)) + (s4-1 (when v1-34 + (let ((s3-1 (-> v1-34 extra process))) + (if (type? s3-1 process-focusable) + s3-1 + ) + ) + ) + ) + (v1-39 (-> arg1 actor-group 0 data 1 actor)) + (s3-2 (when v1-39 + (let ((s2-0 (-> v1-39 extra process))) + (if (type? s2-0 process-focusable) + s2-0 + ) + ) + ) + ) + ) + (when (and (process-grab? s4-1 #t) + (process-grab? s3-2 #t) + (not (channel-active? arg1 (the-as uint 0))) + (process-grab? s5-0 #f) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 26 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + ) + ) + ) + (else + (when (logtest? (-> arg1 bot-task-bits) 1) + (let ((s5-1 *traffic-manager*)) + (send-event s5-1 'set-alert-level 1) + (send-event s5-1 'set-alert-duration #xa4cb80) + ) + (set! (-> arg1 bot-task-bits) (logand -2 (-> arg1 bot-task-bits))) + ) + ) + ) + ) + #f + ) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 hal-escort)) (set-traffic-danger! arg0) (hal-escort-method-235 arg0) (none)) + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 26 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 hal-escort)) + (remove-setting! 'sound-mode) + (add-process + *gui-control* + arg0 + (gui-channel art-load) + (gui-action queue) + "dig-knock-down-scaffolding-intro" + -99.0 + 0 + ) + (remove-setting! 'airlock) + (apply-settings *setting-control*) + (send-event (handle->process (-> arg0 arrow-handle)) 'die) + (play-speech arg0 11) + (set-setting! 'entity-name "camera-224" 0 0) + (let ((s5-0 *traffic-manager*)) + (send-event s5-0 'set-guard-target-level 0) + (send-event s5-0 'set-max-alert-level 0) + (send-event s5-0 'set-alert-level 0) + ) + (let ((v1-32 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-32 bytes 5) (the-as uint 1)) + (set! (-> v1-32 bytes 6) (the-as uint 7)) + (set! (-> v1-32 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-32) check-done) + (the-as + (function halt-wait-spot hal symbol) + (lambda ((arg0 object) (arg1 hal-escort)) + (with-pp + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer pp)) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'open) + (let ((t9-0 send-event-function) + (v1-5 (-> arg1 actor-group 0 data 5 actor)) + ) + (t9-0 + (if v1-5 + (-> v1-5 extra process) + ) + a1-1 + ) + ) + ) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) (process->ppointer pp)) + (set! (-> a1-2 num-params) 0) + (set! (-> a1-2 message) 'open) + (let ((t9-1 send-event-function) + (v1-13 (-> arg1 actor-group 0 data 6 actor)) + ) + (t9-1 + (if v1-13 + (-> v1-13 extra process) + ) + a1-2 + ) + ) + ) + (when (and (not (logtest? (-> arg1 waypoint-bits) 2)) + (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.75)) + ) + (logior! (-> arg1 waypoint-bits) 2) + (let ((s5-0 *traffic-manager*)) + (send-event s5-0 'deactivate-by-type 6) + (send-event s5-0 'deactivate-by-type 18) + (send-event s5-0 'deactivate-by-type 19) + (send-event s5-0 'deactivate-by-type 20) + ) + ) + (when (and (not (logtest? (-> arg1 waypoint-bits) 1)) + (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.2)) + ) + (let* ((v1-55 (-> arg1 actor-group 0 data 2 actor)) + (s5-1 (when v1-55 + (let ((s4-0 (-> v1-55 extra process))) + (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + ) + ) + (let* ((v1-60 (-> arg1 actor-group 0 data 1 actor)) + (a0-16 (when v1-60 + (let ((s4-1 (-> v1-60 extra process))) + (if (type? s4-1 process-focusable) + s4-1 + ) + ) + ) + ) + ) + (logior! (-> arg1 waypoint-bits) 1) + (send-event a0-16 'request 'waypoint 26) + ) + (send-event s5-1 'request 'waypoint 26) + ) + ) + (when (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3)) + (not (channel-active? arg1 (the-as uint 0))) + (scene-play arg1 "dig-knock-down-scaffolding-intro" #t) + ) + (remove-setting! 'entity-name) + (go-to-waypoint! arg1 27 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 27 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 hal-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 7)) + (set! (-> v1-1 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-1) check-done) + (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 hal-escort)) (none))) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 28 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 hal-escort)) + (remove-setting! 'sound-mode) + (let ((a0-2 *traffic-manager*)) + (send-event a0-2 'deactivate-by-type 6) + ) + (let ((v1-8 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-8 bytes 5) (the-as uint 1)) + (set! (-> v1-8 bytes 6) (the-as uint 0)) + (set! (-> v1-8 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-8) check-done) + (the-as (function halt-wait-spot hal symbol) (lambda () #f)) + ) + ) + (none) + ) + :on-update (lambda ((arg0 hal-escort)) + (when (not (logtest? (-> arg0 waypoint-bits) 1)) + (let* ((a1-1 (nav-mesh-from-res-tag (-> arg0 entity) 'nav-mesh-actor 0)) + (gp-0 (hal-escort-method-234 arg0 a1-1)) + ) + (when gp-0 + (logior! (-> arg0 waypoint-bits) 1) + (let* ((v1-8 (-> arg0 actor-group 0 data 1 actor)) + (a0-3 (when v1-8 + (let ((s5-1 (-> v1-8 extra process))) + (if (type? s5-1 process-focusable) + s5-1 + ) + ) + ) + ) + ) + (send-event a0-3 'instant-arrest gp-0) + ) + ) + ) + ) + (none) + ) + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 29 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 hal-escort)) + (remove-setting! 'music) + (remove-setting! 'sound-mode) + (send-event (handle->process (-> arg0 arrow-handle)) 'die) + (let ((v1-11 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-11 bytes 5) (the-as uint 1)) + (set! (-> v1-11 bytes 6) (the-as uint 0)) + (set! (-> v1-11 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-11) check-done) + (the-as + (function halt-wait-spot hal symbol) + (lambda ((arg0 object) (arg1 hal-escort)) + (with-pp + (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3)) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer pp)) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'fail) + (let ((t9-0 send-event-function) + (v1-8 (-> *game-info* sub-task-list 111)) + ) + (t9-0 + (handle->process (if (-> v1-8 info) + (-> v1-8 info manager) + (the-as handle #f) + ) + ) + a1-1 + ) + ) + ) + ) + #f + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 30 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 hal-escort)) + (remove-setting! 'music) + (remove-setting! 'sound-mode) + (let* ((v1-7 (-> arg0 actor-group 0 data 2 actor)) + (a0-3 (when v1-7 + (let ((s5-0 (-> v1-7 extra process))) + (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + ) + ) + (send-event a0-3 'request 'too-far-fail) + ) + (let ((v1-15 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-15 bytes 5) (the-as uint 1)) + (set! (-> v1-15 bytes 6) (the-as uint 0)) + (set! (-> v1-15 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-15) check-done) + (the-as (function halt-wait-spot hal symbol) (lambda () #f)) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 31 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 hal-escort)) + (remove-setting! 'music) + (remove-setting! 'sound-mode) + (let ((a0-3 *traffic-manager*)) + (send-event a0-3 'deactivate-by-type 6) + ) + (set-action! + *gui-control* + (gui-action stop) + (the-as sound-id 1) + (gui-channel art-load) + (gui-action none) + (the-as string #f) + (the-as (function gui-connection symbol) #f) + (the-as process #f) + ) + (let ((v1-12 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-12 bytes 5) (the-as uint 1)) + (set! (-> v1-12 bytes 6) (the-as uint 7)) + (set! (-> v1-12 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-12) check-done) + (the-as (function halt-wait-spot hal symbol) (lambda () #f)) + ) + ) + (none) + ) + :on-update (lambda ((arg0 hal-escort)) + (when (not (logtest? (-> arg0 waypoint-bits) 1)) + (let* ((a1-1 (nav-mesh-from-res-tag (-> arg0 entity) 'nav-mesh-actor 1)) + (gp-0 (hal-escort-method-234 arg0 a1-1)) + ) + (when gp-0 + (logior! (-> arg0 waypoint-bits) 1) + (let* ((v1-8 (-> arg0 actor-group 0 data 1 actor)) + (a0-3 (when v1-8 + (let ((s5-1 (-> v1-8 extra process))) + (if (type? s5-1 process-focusable) + s5-1 + ) + ) + ) + ) + ) + (send-event a0-3 'instant-arrest gp-0) + ) + ) + ) + ) + (none) + ) + :on-skipping-here #f + :check-too-far #f + ) + ) + :speeches (new 'static 'inline-array bot-speech-info 35 + (new 'static 'bot-speech-info :flags (speech-flags sf03) :hold-time #x5a :slave-id -1 :name "jd001") + (new 'static 'bot-speech-info :flags (speech-flags sf03) :hold-time #x5a :slave-id -1 :name "dsek002") + (new 'static 'bot-speech-info :flags (speech-flags sf05) :hold-time #x5a :slave-id -1 :name "dsek003") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "dsek005") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "dsek006") + (new 'static 'bot-speech-info :flags (speech-flags sf03) :hold-time #x5a :slave-id -1 :name "dsek007") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "dsek008") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "dsek009") + (new 'static 'bot-speech-info :flags (speech-flags sf03) :hold-time #x5a :slave-id -1 :name "dsek010") + (new 'static 'bot-speech-info :flags (speech-flags sf03) :hold-time #x5a :slave-id -1 :name "dsek011") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "dsek012") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "dsek013") + (new 'static 'bot-speech-info :flags (speech-flags sf03) :hold-time #x5a :slave-id -1 :name "jk002") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "jk004") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "kg293a") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "kg299a") + (new 'static 'bot-speech-info :flags (speech-flags sf03) :hold-time #x5a :slave-id -1 :name "dsek001") + (new 'static 'bot-speech-info :flags (speech-flags sf03) :hold-time #x5a :slave-id -1 :name "dsek004") + (new 'static 'bot-speech-info :flags (speech-flags sf03) :hold-time #x5a :slave-id -1 :name "jk001") + (new 'static 'bot-speech-info :flags (speech-flags sf04) :hold-time #x5a :slave-id -1 :name "jk018") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "jk003") + (new 'static 'bot-speech-info :flags (speech-flags sf02) :hold-time #x5a :slave-id -1 :name "jk005") + (new 'static 'bot-speech-info :flags (speech-flags sf02) :hold-time #x5a :slave-id -1 :name "jk006") + (new 'static 'bot-speech-info :flags (speech-flags sf02) :hold-time #x5a :slave-id -1 :name "jk007") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "jk008") + (new 'static 'bot-speech-info :flags (speech-flags sf02) :hold-time #x5a :slave-id -1 :name "jk009") + (new 'static 'bot-speech-info :flags (speech-flags sf02) :hold-time #x5a :slave-id -1 :name "jk010") + (new 'static 'bot-speech-info :flags (speech-flags sf02) :hold-time #x5a :slave-id -1 :name "jk011") + (new 'static 'bot-speech-info :flags (speech-flags sf02) :hold-time #x5a :slave-id -1 :name "jk012") + (new 'static 'bot-speech-info :flags (speech-flags sf02) :hold-time #x5a :slave-id -1 :name "jk013") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "jk017") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "jk015") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "jk016") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "jk014") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "jk019") + ) + :speech-tunings (new 'static 'inline-array bot-speech-tuning 1 + (new 'static 'bot-speech-tuning :fo-min 100 :fo-max #x78 :fo-curve 1 :trans? #f) + ) + :spots (new 'static 'inline-array bot-spot 10 + (new 'static 'bot-spot :center (new 'static 'vector :x 4703355.0 :y 33341.44 :z 225280.0 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4729856.0 :y 33341.44 :z 712335.4 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4729856.0 :y 42926.08 :z 712335.4 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4689756.0 :y 33341.44 :z 103383.04 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4672880.5 :y 33341.44 :z 90644.48 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4530954.0 :y 33341.44 :z 149504.0 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4036812.8 :y 32768.0 :z 4608123.0 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4036812.8 :y 32768.0 :z 4608123.0 :w 53248.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4479918.0 :y 103424.0 :z 4484137.0 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4471275.5 :y 101703.68 :z 4472054.0 :w 126976.0)) + ) + :defend-speeches (new 'static 'bot-speech-list-shuffle + :flags #xa + :last-local-index -1 + :speech-indexes (new 'static 'boxed-array :type int16 20 21 22 23 24 25 26 27 28 29) + ) + ) + ) + +(set! (-> *bot-course-table* course 10) *hal4-course*) diff --git a/goal_src/jak2/levels/city/kid_escort/kidesc-h.gc b/goal_src/jak2/levels/city/kid_escort/kidesc-h.gc index 3a0a0962f9..ad43d23edb 100644 --- a/goal_src/jak2/levels/city/kid_escort/kidesc-h.gc +++ b/goal_src/jak2/levels/city/kid_escort/kidesc-h.gc @@ -19,21 +19,21 @@ :size-assert #x400 :flag-assert #xf003800400 (:methods - (kid-escort-method-225 () none 225) - (kid-escort-method-226 () none 226) - (kid-escort-method-227 () none 227) - (kid-escort-method-228 () none 228) - (kid-escort-method-229 () none 229) - (kid-escort-method-230 () none 230) - (kid-escort-method-231 () none 231) - (kid-escort-method-232 () none 232) - (kid-escort-method-233 () none 233) - (kid-escort-method-234 () none 234) - (kid-escort-method-235 () none 235) - (kid-escort-method-236 () none 236) - (kid-escort-method-237 () none 237) - (kid-escort-method-238 () none 238) - (kid-escort-method-239 () none 239) + (traveling () _type_ :state 225) + (traveling-blocked () _type_ :state 226) + (waiting-idle () _type_ :state 227) + (waiting-turn () _type_ :state 228) + (move-to-vehicle () _type_ :state 229) + (board-vehicle () _type_ :state 230) + (ride-vehicle () _type_ :state 231) + (exit-vehicle () _type_ :state 232) + (knocked-off-vehicle () _type_ :state 233) + (arrested () _type_ :state 234) + (want-exit-vehicle? (_type_ vector) symbol 235) + (check-arrest (_type_) none 236) + (go-waiting-turn (_type_) none 237) + (check-vehicle-exit (_type_) none 238) + (play-walk-anim (_type_) none 239) ) ) @@ -46,10 +46,10 @@ ) (deftype kidesct-wait-spot (ai-task) - ((check-done basic :offset 32) - (which-spot int8 :offset 36) - (num-spots uint8 :offset 37) - (spot-indexes int8 6 :offset 38) + ((check-done (function kidesct-wait-spot kid-escort symbol) :offset 32) + (which-spot int8 :offset 36) + (num-spots uint8 :offset 37) + (spot-indexes uint8 6 :offset 38) ) :method-count-assert 12 :size-assert #x30 diff --git a/goal_src/jak2/levels/city/kid_escort/kidesc-states.gc b/goal_src/jak2/levels/city/kid_escort/kidesc-states.gc index d948361d70..a36b03f742 100644 --- a/goal_src/jak2/levels/city/kid_escort/kidesc-states.gc +++ b/goal_src/jak2/levels/city/kid_escort/kidesc-states.gc @@ -7,3 +7,1128 @@ ;; DECOMP BEGINS +(defstate waiting-idle (kid-escort) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (nav-enemy-method-167 self) + (let ((v1-7 self)) + (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (vector-reset! (-> self root-override2 transv)) + (look-at-target! self (enemy-flag lock-focus)) + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + :trans (behavior () + (bot-method-223 self #f) + (b! + (not (and (-> self focus-info fproc) (>= (fabs (-> self focus-info ry-diff)) 9102.223))) + cfg-6 + :delay (empty-form) + ) + (go-waiting-turn self) + (b! #t cfg-15 :delay (nop!)) + (label cfg-6) + (let ((gp-0 (handle->process (-> self arrestor-handle)))) + (if (if (type? gp-0 process-focusable) + gp-0 + ) + (go-virtual arrested) + ) + ) + (label cfg-15) + (when (not (logtest? (-> self focus-status) (focus-status grabbed))) + (cond + ((logtest? (-> self bot-flags) (bot-flags bf15)) + (go-virtual move-to-vehicle) + ) + ((not (outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #f)) + (go-virtual traveling) + ) + ) + ) + (none) + ) + :code (behavior () + (let ((v1-2 (ja-group))) + (cond + ((and v1-2 (= v1-2 (-> self draw art-group data 3))) + (ja-no-eval :num! (seek! max 0.1)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + ) + (else + (ja-channel-push! 1 (seconds 0.2)) + ) + ) + ) + (until #f + (ja-no-eval :group! (-> self draw art-group data 3) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) frames num-frames) -1)) 0.1) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 0.1)) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior kid-escort) nav-enemy-simple-post) + ) + +(defstate waiting-turn (kid-escort) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (nav-enemy-method-167 self) + (let ((v1-7 self)) + (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (look-at-target! self (enemy-flag lock-focus)) + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + :trans (behavior () + (bot-method-223 self #f) + (when (not (logtest? (-> self focus-status) (focus-status grabbed))) + (if (and (not (outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #f)) + (let ((gp-0 (handle->process (-> self arrestor-handle)))) + (and (not (if (type? gp-0 process-focusable) + gp-0 + ) + ) + (zero? (logand (-> self bot-flags) (bot-flags bf15))) + ) + ) + ) + (go-virtual traveling) + ) + ) + (none) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.1)) + (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))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (check-arrest self) + (none) + ) + :post (behavior () + (seek-toward-heading-vec! + (-> self root-override2) + (-> self focus-info bullseye-xz-dir) + 49152.0 + (seconds 0.05) + ) + (nav-enemy-simple-post) + (none) + ) + ) + +(defstate traveling (kid-escort) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) + ) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag36) (-> v1-2 enemy-flags)))) + (set! (-> v1-2 nav callback-info) (-> v1-2 enemy-info-override callback-info)) + ) + 0 + (let ((v1-5 self)) + (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-5 enemy-flags)))) + ) + 0 + (stop-looking-at-target! self) + (nav-enemy-method-166 self) + (set! (-> self player-blocking) 0.0) + (none) + ) + :trans (behavior () + (bot-method-223 self #f) + (let ((gp-0 (handle->process (-> self arrestor-handle)))) + (cond + ((if (type? gp-0 process-focusable) + gp-0 + ) + (go-virtual arrested) + ) + ((logtest? (-> self bot-flags) (bot-flags bf15)) + (go-virtual move-to-vehicle) + ) + ((outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #t) + (check-arrest self) + ) + ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) + (go-virtual traveling-blocked) + ) + ((and (nav-enemy-method-163 self) + (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + ) + (go-stare2 self) + ) + ) + ) + 0 + (none) + ) + :code (behavior () + (until #f + (play-walk-anim self) + (suspend) + ) + #f + (none) + ) + :post (behavior () + (let ((a0-0 (-> self nav state)) + (v1-1 (-> self spot)) + ) + (logclear! (-> a0-0 flags) (nav-state-flag directional-mode)) + (logior! (-> a0-0 flags) (nav-state-flag target-poly-dirty)) + (set! (-> a0-0 target-post quad) (-> v1-1 center quad)) + ) + 0 + (nav-enemy-travel-post) + (none) + ) + ) + +(defstate move-to-vehicle (kid-escort) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) + ) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag36) (-> v1-2 enemy-flags)))) + (set! (-> v1-2 nav callback-info) (-> v1-2 enemy-info-override callback-info)) + ) + 0 + (let ((v1-5 self)) + (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-5 enemy-flags)))) + ) + 0 + (stop-looking-at-target! self) + (nav-enemy-method-166 self) + (set! (-> self player-blocking) 0.0) + (logclear! (-> self focus-status) (focus-status arrestable)) + (none) + ) + :trans (behavior () + (bot-method-223 self #f) + (let ((gp-0 (handle->process (-> self vehicle-handle)))) + (let ((s5-0 (handle->process (-> self arrestor-handle)))) + (cond + ((if (type? s5-0 process-focusable) + s5-0 + ) + (go-virtual arrested) + ) + ((or (not gp-0) + (logtest? (-> (the-as vehicle gp-0) flags) (rigid-body-object-flag dead)) + (not (logtest? (-> self bot-flags) (bot-flags bf15))) + (< (-> self vehicle-seat-index) 0) + ) + (logclear! (-> self bot-flags) (bot-flags bf15)) + (check-arrest self) + ) + ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) + (go-virtual traveling-blocked) + ) + ((and (nav-enemy-method-163 self) + (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + ) + (go-stare2 self) + ) + ) + ) + (let ((s5-1 (new 'stack-no-clear 'inline-array 'matrix 2))) + (compute-seat-position (the-as vehicle gp-0) (the-as vector (-> s5-1 0)) (-> self vehicle-seat-index)) + (set! (-> s5-1 0 vector 1 quad) (-> self root-override2 trans quad)) + (set! (-> s5-1 0 trans quad) (-> s5-1 0 quad 0)) + (vector-! + (the-as vector (-> s5-1 1)) + (the-as vector (-> s5-1 0)) + (-> (the-as vehicle gp-0) root-override-2 trans) + ) + (vector-z-quaternion! (-> s5-1 0 vector 2) (-> self root-override2 quat)) + (let ((f30-1 (* 0.5 (vector-vector-xz-distance (-> s5-1 0 vector 1) (-> s5-1 0 trans))))) + (vector-normalize! (-> s5-1 0 vector 2) (* 2.0 f30-1)) + (vector-normalize! (the-as vector (-> s5-1 1)) (* 4.0 f30-1)) + ) + (bot-method-181 + self + (-> s5-1 1 vector 1) + (-> s5-1 0 vector 1) + (-> s5-1 0 vector 2) + (-> s5-1 0 trans) + (the-as vector (-> s5-1 1)) + 0.8 + ) + (let ((a0-30 (-> self nav state)) + (v1-55 (-> s5-1 1 vector 1)) + ) + (logclear! (-> a0-30 flags) (nav-state-flag directional-mode)) + (logior! (-> a0-30 flags) (nav-state-flag target-poly-dirty)) + (set! (-> a0-30 target-post quad) (-> v1-55 quad)) + ) + 0 + (if (and (< (vector-vector-xz-distance (the-as vector (-> s5-1 0)) (-> self root-override2 trans)) 17203.2) + (< (fabs (- (-> s5-1 0 vector 0 y) (-> self root-override2 trans y))) 20480.0) + ) + (go-virtual board-vehicle) + ) + ) + ) + (none) + ) + :code (behavior () + (until #f + (play-walk-anim self) + (suspend) + ) + #f + (none) + ) + :post (the-as (function none :behavior kid-escort) nav-enemy-travel-post) + ) + +(defstate board-vehicle (kid-escort) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (let ((v1-5 self)) + (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (let ((gp-0 (handle->process (-> self vehicle-handle)))) + (when (or (not (logtest? (-> self bot-flags) (bot-flags bf15))) (< (-> self vehicle-seat-index) 0)) + (logclear! (-> self bot-flags) (bot-flags bf15)) + (check-arrest self) + ) + (put-rider-in-seat (the-as vehicle gp-0) (-> self vehicle-seat-index) self) + ) + (set! (-> self focus-status) (logior (focus-status pilot) (-> self focus-status))) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logior! (-> self focus-status) (focus-status disable)) + (logclear! (-> self focus-status) (focus-status arrestable)) + (logclear! (-> self bot-flags) (bot-flags bf15)) + (none) + ) + :exit (behavior () + (local-vars (v1-6 enemy-flag)) + (logior! (-> self root-override2 nav-flags) (nav-flags has-root-sphere)) + (logclear! (-> self focus-status) (focus-status disable)) + (let ((v1-5 (-> self enemy-flags))) + (if (logtest? v1-5 (enemy-flag checking-water)) + (set! v1-6 (logior v1-5 (enemy-flag enable-on-active))) + (set! v1-6 (logclear v1-5 (enemy-flag enable-on-active))) + ) + ) + (set! (-> self enemy-flags) v1-6) + (logclear! (-> self bot-flags) (bot-flags bf15)) + (none) + ) + :trans (behavior () + (check-vehicle-exit self) + (none) + ) + :code (behavior () + (local-vars (sv-112 float)) + (ja-channel-push! 1 (seconds 0.1)) + (let ((gp-0 (new 'stack-no-clear 'matrix))) + (quaternion-copy! (the-as quaternion (-> gp-0 vector)) (-> self root-override2 quat)) + (ja-no-eval :group! (-> self draw art-group data 10) + :num! (seek! (ja-aframe 1.0 0) 0.25) + :frame-num (ja-aframe 0.0 0) + ) + (until (ja-done? 0) + (let ((s5-1 (handle->process (-> self vehicle-handle))) + (f30-0 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 0.0 0) (ja-aframe 1.0 0))) + ) + (compute-seat-position (the-as vehicle s5-1) (-> gp-0 trans) (-> self vehicle-seat-index)) + (vector-! (-> gp-0 trans) (-> gp-0 trans) (-> self root-override2 trans)) + (quaternion<-rotate-y-vector (the-as quaternion (-> gp-0 vector 1)) (-> gp-0 trans)) + (quaternion-slerp! + (-> self root-override2 quat) + (the-as quaternion (-> gp-0 vector)) + (the-as quaternion (-> gp-0 vector 1)) + f30-0 + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 1.0 0) 0.25)) + ) + (let ((s5-3 (new 'stack-no-clear 'vector))) + (set! (-> s5-3 quad) (-> self root-override2 trans quad)) + (quaternion-copy! (the-as quaternion (-> gp-0 vector)) (-> self root-override2 quat)) + (ja-no-eval :group! (-> self draw art-group data 10) + :num! (seek! (ja-aframe 8.0 0)) + :frame-num (ja-aframe 1.0 0) + ) + (until (ja-done? 0) + (let ((s4-2 (handle->process (-> self vehicle-handle)))) + (compute-seat-position (the-as vehicle s4-2) (-> gp-0 vector 2) (-> self vehicle-seat-index)) + (vector-! (-> gp-0 trans) (-> gp-0 vector 2) s5-3) + (let ((s3-1 lerp-scale) + (s2-1 0.0) + (s1-1 1.0) + (s0-1 (ja-aframe-num 0)) + ) + (set! sv-112 (ja-aframe 1.0 0)) + (let* ((t0-1 (ja-aframe 8.0 0)) + (f30-1 (s3-1 s2-1 s1-1 s0-1 sv-112 t0-1)) + ) + (quaternion-rotate-local-y! + (the-as quaternion (-> gp-0 vector 1)) + (-> (the-as vehicle s4-2) root-override-2 quat) + (* f30-1 (if (zero? (-> self vehicle-seat-index)) + -16384.0 + 16384.0 + ) + ) + ) + (quaternion-slerp! + (-> self root-override2 quat) + (the-as quaternion (-> gp-0 vector)) + (the-as quaternion (-> gp-0 vector 1)) + f30-1 + ) + (vector+float*! (-> self root-override2 trans) s5-3 (-> gp-0 trans) f30-1) + ) + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 8.0 0))) + ) + ) + (logclear! (-> self root-override2 nav-flags) (nav-flags has-root-sphere)) + (let ((v1-49 (-> self nav))) + (logclear! (-> v1-49 shape nav-flags) (nav-flags has-extra-sphere)) + ) + 0 + (quaternion-copy! (new 'stack-no-clear 'quaternion) (-> self root-override2 quat)) + (ja-no-eval :group! (-> self draw art-group data 10) + :num! (seek! (ja-aframe 12.0 0) 0.25) + :frame-num (ja-aframe 8.0 0) + ) + (until (ja-done? 0) + (let ((s5-5 (handle->process (-> self vehicle-handle)))) + (quaternion-copy! (the-as quaternion (-> gp-0 vector 1)) (-> (the-as vehicle s5-5) root-override-2 quat)) + (compute-seat-position (the-as vehicle s5-5) (-> self root-override2 trans) (-> self vehicle-seat-index)) + ) + (let ((f0-16 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 8.0 0) (ja-aframe 11.0 0)))) + (quaternion-rotate-local-y! + (-> self root-override2 quat) + (the-as quaternion (-> gp-0 vector 1)) + (* (- 1.0 f0-16) (if (zero? (-> self vehicle-seat-index)) + -16384.0 + 16384.0 + ) + ) + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 12.0 0) 0.25)) + ) + ) + (set! (-> self focus-status) (logior (focus-status pilot-riding pilot) (-> self focus-status))) + (go-virtual ride-vehicle) + (none) + ) + :post (the-as (function none :behavior kid-escort) nav-enemy-simple-post) + ) + +(defstate ride-vehicle (kid-escort) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (let ((v1-5 self)) + (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self root-override2 nav-flags) (nav-flags has-root-sphere)) + (let ((v1-11 (-> self nav))) + (logclear! (-> v1-11 shape nav-flags) (nav-flags has-extra-sphere)) + ) + 0 + (set! (-> self focus-status) (logior (focus-status disable pilot-riding pilot) (-> self focus-status))) + (logclear! (-> self focus-status) (focus-status arrestable)) + (none) + ) + :exit (behavior () + (local-vars (v1-4 enemy-flag)) + (logior! (-> self root-override2 nav-flags) (nav-flags has-root-sphere)) + (let ((v1-3 (-> self enemy-flags))) + (if (logtest? v1-3 (enemy-flag checking-water)) + (set! v1-4 (logior v1-3 (enemy-flag enable-on-active))) + (set! v1-4 (logclear v1-3 (enemy-flag enable-on-active))) + ) + ) + (set! (-> self enemy-flags) v1-4) + (logclear! (-> self bot-flags) (bot-flags bf15)) + (none) + ) + :trans (behavior () + (check-vehicle-exit self) + (if (and (logtest? (bot-flags bf16) (-> self bot-flags)) (want-exit-vehicle? self (-> self exit-vehicle-dest))) + (go-virtual exit-vehicle) + ) + 0 + (none) + ) + :code (behavior () + (ja-channel-push! 2 (seconds 0.2)) + (ja :group! (-> self draw art-group data 11)) + (ja :chan 1 :group! (-> self draw art-group data 12)) + (let ((f30-0 0.5) + (f28-0 0.5) + (f26-0 0.5) + ) + (until #f + (let ((gp-0 (-> *target* pilot))) + (when (and (nonzero? gp-0) gp-0) + (let ((f20-0 (lerp-scale 0.0 1.0 (-> gp-0 left-right-interp) 1.0 -1.0)) + (f24-0 (lerp-scale 0.0 1.0 (-> gp-0 front-back-interp) -1.0 1.0)) + (f0-4 (+ (fabs (-> gp-0 left-right-interp)) (fabs (-> gp-0 front-back-interp)))) + (f22-0 0.5) + ) + (if (< 0.0 f0-4) + (set! f22-0 (/ (fabs (-> gp-0 front-back-interp)) f0-4)) + ) + (set! f30-0 (seek f30-0 f20-0 (* 4.0 (-> self clock seconds-per-frame)))) + (set! f28-0 (seek f28-0 f24-0 (* 4.0 (-> self clock seconds-per-frame)))) + (set! f26-0 (seek f26-0 f22-0 (* 4.0 (-> self clock seconds-per-frame)))) + ) + ) + ) + (ja :num-func num-func-identity :frame-num (ja-aframe f30-0 0)) + (let ((gp-2 (-> self skel root-channel 1))) + (set! (-> gp-2 frame-interp 1) f26-0) + (set! (-> gp-2 frame-interp 0) f26-0) + (set! (-> gp-2 num-func) num-func-identity) + (set! (-> gp-2 frame-num) (ja-aframe f28-0 0)) + ) + (suspend) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior kid-escort) nav-enemy-simple-post) + ) + +(defstate exit-vehicle (kid-escort) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (let ((v1-5 self)) + (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logior! (-> self root-override2 nav-flags) (nav-flags has-root-sphere)) + (logior! (-> self focus-status) (focus-status disable)) + (logclear! (-> self focus-status) (focus-status arrestable)) + (none) + ) + :exit (behavior () + (local-vars (v1-17 enemy-flag)) + (let ((a0-1 (handle->process (-> self vehicle-handle)))) + (if a0-1 + (remove-rider (the-as vehicle a0-1) self) + ) + ) + (set! (-> self vehicle-seat-index) -1) + (set! (-> self vehicle-handle) (the-as handle #f)) + (logclear! (-> self bot-flags) (bot-flags bf16)) + (logclear! (-> self focus-status) (focus-status pilot-riding pilot)) + (let ((v1-11 (-> self nav))) + (logclear! (-> v1-11 shape nav-flags) (nav-flags has-extra-sphere)) + ) + 0 + (logclear! (-> self focus-status) (focus-status disable)) + (let ((v1-16 (-> self enemy-flags))) + (if (logtest? v1-16 (enemy-flag checking-water)) + (set! v1-17 (logior v1-16 (enemy-flag enable-on-active))) + (set! v1-17 (logclear v1-16 (enemy-flag enable-on-active))) + ) + ) + (set! (-> self enemy-flags) v1-17) + (logclear! (-> self bot-flags) (bot-flags bf15)) + (none) + ) + :trans (behavior () + (check-vehicle-exit self) + (none) + ) + :code (behavior () + (local-vars (sv-80 float) (sv-96 float)) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 10) + :num! (seek! (ja-aframe 8.0 0) 0.25) + :frame-num (ja-aframe 12.0 0) + ) + (until (ja-done? 0) + (let ((gp-1 (handle->process (-> self vehicle-handle)))) + (quaternion-copy! (-> self root-override2 quat) (-> (the-as vehicle gp-1) root-override-2 quat)) + (compute-seat-position (the-as vehicle gp-1) (-> self root-override2 trans) (-> self vehicle-seat-index)) + ) + (let ((f0-3 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 11.0 0) (ja-aframe 8.0 0)))) + (quaternion-rotate-local-y! + (-> self root-override2 quat) + (-> self root-override2 quat) + (* f0-3 (if (zero? (-> self vehicle-seat-index)) + -16384.0 + 16384.0 + ) + ) + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 8.0 0) 0.25)) + ) + (logclear! (-> self focus-status) (focus-status pilot-riding)) + (let ((gp-4 (new 'stack-no-clear 'vector)) + (s5-1 (new 'stack-no-clear 'quaternion)) + ) + (set! (-> gp-4 quad) (-> self root-override2 trans quad)) + (ja-no-eval :group! (-> self draw art-group data 10) + :num! (seek! (ja-aframe 0.0 0)) + :frame-num (ja-aframe 8.0 0) + ) + (until (ja-done? 0) + (let ((s4-2 (handle->process (-> self vehicle-handle)))) + (compute-seat-position (the-as vehicle s4-2) gp-4 (-> self vehicle-seat-index)) + (quaternion-rotate-local-y! + s5-1 + (-> (the-as vehicle s4-2) root-override-2 quat) + (if (zero? (-> self vehicle-seat-index)) + -16384.0 + 16384.0 + ) + ) + ) + (let ((s4-3 (-> self root-override2 quat))) + (let ((f30-0 (quaternion-y-angle s5-1))) + (quaternion-identity! s4-3) + (quaternion-rotate-y! s4-3 s4-3 f30-0) + ) + (let ((s3-1 lerp-scale) + (s2-1 0.0) + (s1-0 1.0) + (s0-0 (ja-aframe-num 0)) + ) + (set! sv-80 (ja-aframe 8.0 0)) + (let* ((t0-1 (ja-aframe 1.0 0)) + (f0-11 (s3-1 s2-1 s1-0 s0-0 sv-80 t0-1)) + ) + (quaternion-slerp! s4-3 s5-1 s4-3 f0-11) + ) + ) + ) + (want-exit-vehicle? self (-> self exit-vehicle-dest)) + (let* ((v1-44 (-> self nav)) + (a1-25 (-> self exit-vehicle-dest)) + (f0-12 (-> v1-44 extra-nav-sphere w)) + ) + (set! (-> v1-44 extra-nav-sphere quad) (-> a1-25 quad)) + (set! (-> v1-44 extra-nav-sphere w) f0-12) + ) + 0 + (let ((v1-47 (-> self nav))) + (set! (-> v1-47 extra-nav-sphere w) (-> self nav-radius-backup)) + ) + 0 + (let ((v1-49 (-> self nav))) + (logior! (-> v1-49 shape nav-flags) (nav-flags has-extra-sphere)) + ) + 0 + (new 'stack-no-clear 'vector) + (let ((s4-4 (new 'stack-no-clear 'vector))) + (vector-! s4-4 gp-4 (-> self exit-vehicle-dest)) + (let ((s3-2 lerp-scale) + (s2-2 0.0) + (s1-1 1.0) + (s0-1 (ja-aframe-num 0)) + ) + (set! sv-96 (ja-aframe 1.0 0)) + (let* ((t0-2 (ja-aframe 8.0 0)) + (f0-15 (s3-2 s2-2 s1-1 s0-1 sv-96 t0-2)) + ) + (vector+float*! (-> self root-override2 trans) (-> self exit-vehicle-dest) s4-4 f0-15) + ) + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 0.0 0))) + ) + ) + (react-to-focus self) + (none) + ) + :post (the-as (function none :behavior kid-escort) nav-enemy-simple-post) + ) + +(defstate traveling-blocked (kid-escort) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (nav-enemy-method-167 self) + (let ((v1-7 self)) + (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (vector-reset! (-> self root-override2 transv)) + (look-at-target! self (enemy-flag lock-focus)) + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + :trans (behavior () + (bot-method-223 self #f) + (let ((gp-0 (handle->process (-> self arrestor-handle)))) + (cond + ((if (type? gp-0 process-focusable) + gp-0 + ) + (go-virtual arrested) + ) + ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) + (if (logtest? (-> self bot-flags) (bot-flags bf15)) + (go-virtual move-to-vehicle) + (go-virtual traveling) + ) + ) + ) + ) + (none) + ) + :code (-> (method-of-type kid-escort waiting-idle) code) + :post (the-as (function none :behavior kid-escort) nav-enemy-simple-post) + ) + +(defstate stare (kid-escort) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type bot stare) enter))) + (if t9-0 + (t9-0) + ) + ) + (let ((v1-4 self)) + (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + :trans (behavior () + (bot-method-223 self #f) + (let ((gp-0 (handle->process (-> self arrestor-handle)))) + (if (if (type? gp-0 process-focusable) + gp-0 + ) + (go-virtual arrested) + ) + ) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (not (nav-enemy-method-163 self)) + (if (logtest? (-> self bot-flags) (bot-flags bf15)) + (go-virtual move-to-vehicle) + (go-virtual traveling) + ) + ) + ) + (none) + ) + :code (-> (method-of-type kid-escort waiting-idle) code) + ) + +(defstate hit (kid-escort) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type bot hit) enter))) + (if t9-0 + (t9-0) + ) + ) + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + :code (behavior () + (local-vars (v1-7 enemy-flag) (v1-15 enemy-flag)) + (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logior! (-> self focus-status) (focus-status dangerous)) + (logclear! (-> self focus-status) (focus-status dangerous)) + ) + (let ((v1-6 (-> self enemy-flags))) + (if (logtest? v1-6 (enemy-flag checking-water)) + (set! v1-7 (logior v1-6 (enemy-flag enable-on-active))) + (set! v1-7 (logclear v1-6 (enemy-flag enable-on-active))) + ) + ) + (set! (-> self enemy-flags) v1-7) + (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (set! (-> self mask) (logior (process-mask collectable) (-> self mask))) + (logclear! (-> self mask) (process-mask collectable)) + ) + (let ((v1-14 (-> self enemy-flags))) + (if (logtest? (enemy-flag no-initial-move-to-ground) v1-14) + (set! v1-15 (logior (enemy-flag check-water-backup) v1-14)) + (set! v1-15 (logclear v1-14 (enemy-flag check-water-backup))) + ) + ) + (set! (-> self enemy-flags) v1-15) + (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self focus-status) (focus-status hit)) + (react-to-focus self) + (none) + ) + ) + +(defstate knocked (kid-escort) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type bot knocked) enter))) + (if t9-0 + (t9-0) + ) + ) + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + ) + +(defstate arrested (kid-escort) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (nav-enemy-method-167 self) + (let ((v1-7 self)) + (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (vector-reset! (-> self root-override2 transv)) + (stop-looking-at-target! self) + (set! (-> self travel-anim-interp) 0.0) + (set! (-> self focus-status) (logior (focus-status arrestable) (-> self focus-status))) + (logclear! (-> self focus-status) (focus-status disable)) + (if (logtest? (bot-flags bf19) (-> self bot-flags)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-active checking-water)) + ) + (none) + ) + :trans (behavior () + (cond + ((logtest? (-> self bot-flags) (bot-flags bf09)) + (fail-falling self) + ) + (else + (bot-method-223 self #f) + (when (not (logtest? (bot-flags bf19) (-> self bot-flags))) + (if (and (-> self focus-info fproc) (>= (fabs (-> self focus-info ry-diff)) 9102.223)) + (go-waiting-turn self) + ) + (when (not (logtest? (-> self focus-status) (focus-status grabbed))) + (let ((gp-0 (handle->process (-> self arrestor-handle)))) + (if (not (if (type? gp-0 process-focusable) + gp-0 + ) + ) + (react-to-focus self) + ) + ) + ) + ) + ) + ) + (none) + ) + :code (behavior () + (cond + ((logtest? (bot-flags bf19) (-> self bot-flags)) + (fail-mission! self) + (let* ((gp-0 (handle->process (-> self arrestor-handle))) + (v1-7 (if (type? gp-0 process-focusable) + gp-0 + ) + ) + ) + (if v1-7 + (logclear! (-> (the-as crimson-guard v1-7) enemy-flags) (enemy-flag enable-on-active checking-water)) + ) + ) + ) + (else + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 8) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 8)) frames num-frames) -1)) + 0.143 + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 0.143)) + ) + ) + ) + (let ((v1-34 (ja-group))) + (if (not (and v1-34 (= v1-34 (-> self draw art-group data 8)))) + (ja-channel-push! 1 (seconds 0.1)) + ) + ) + (ja-no-eval :group! (-> self draw art-group data 9) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 9)) frames num-frames) -1)) 0.1) + :frame-num 0.0 + ) + (when (not (logtest? (bot-flags bf19) (-> self bot-flags))) + (until #f + (until (ja-done? 0) + (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2.5)) + (goto cfg-27) + ) + (suspend) + (ja :num! (seek! max 0.1)) + ) + (ja-no-eval :group! (-> self draw art-group data 9) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 9)) frames num-frames) -1)) 0.1) + :frame-num 0.0 + ) + ) + #f + (label cfg-27) + (fail-mission! self) + (let* ((gp-1 (handle->process (-> self arrestor-handle))) + (v1-93 (if (type? gp-1 process-focusable) + gp-1 + ) + ) + ) + (if v1-93 + (logclear! (-> (the-as crimson-guard v1-93) enemy-flags) (enemy-flag enable-on-active checking-water)) + ) + ) + ) + (set! (-> self state-time) (-> self clock frame-counter)) + (until #f + (until (ja-done? 0) + (if (and (logtest? (-> self bot-flags) (bot-flags failed)) + (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (reset? *fail-mission-control*) + ) + (reset! *fail-mission-control*) + ) + (suspend) + (ja :num! (seek! max 0.1)) + ) + (ja-no-eval :group! (-> self draw art-group data 9) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 9)) frames num-frames) -1)) 0.1) + :frame-num 0.0 + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior kid-escort) nav-enemy-simple-post) + ) + +(defstate die-falling (kid-escort) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type bot die-falling) enter))) + (if t9-0 + (t9-0) + ) + ) + (set! (-> self travel-anim-interp) 0.0) + (set! (-> self focus-status) (logior (focus-status arrestable) (-> self focus-status))) + (logclear! (-> self focus-status) (focus-status disable)) + (none) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 8) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 8)) frames num-frames) -1)) + 0.143 + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 0.143)) + ) + (ja-no-eval :group! (-> self draw art-group data 9) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 9)) frames num-frames) -1)) 0.1) + :frame-num 0.0 + ) + (until #f + (until (ja-done? 0) + (if (and (logtest? (-> self bot-flags) (bot-flags failed)) + (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (reset? *fail-mission-control*) + ) + (reset! *fail-mission-control*) + ) + (suspend) + (ja :num! (seek! max 0.1)) + ) + (ja-no-eval :group! (-> self draw art-group data 9) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 9)) frames num-frames) -1)) 0.1) + :frame-num 0.0 + ) + ) + #f + (none) + ) + ) + +(defstate failed (kid-escort) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type bot failed) enter))) + (if t9-0 + (t9-0) + ) + ) + (set! (-> self travel-anim-interp) 0.0) + (set! (-> self focus-status) (logior (focus-status arrestable) (-> self focus-status))) + (logclear! (-> self focus-status) (focus-status disable)) + (none) + ) + :code (-> (method-of-type kid-escort die-falling) code) + ) + +(defstate knocked-off-vehicle (kid-escort) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (nav-enemy-method-167 self) + (let ((v1-7 self)) + (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (vector-reset! (-> self root-override2 transv)) + (stop-looking-at-target! self) + (logior! (-> self bot-flags) (bot-flags bf09)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> self focus-status) (focus-status dangerous)) + (logclear! (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self mask) (process-mask collectable)) + (logclear! (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> self mask) (process-mask actor-pause)) + (logclear! (-> self enemy-flags) (enemy-flag notice)) + (set! (-> self focus-status) (logior (focus-status arrestable) (-> self focus-status))) + (logior! (-> self focus-status) (focus-status disable)) + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.2)) + (dotimes (gp-0 3) + (ja-no-eval :group! (-> self draw art-group data 3) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) frames num-frames) -1)) 0.1) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 0.1)) + ) + ) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 8) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 8)) frames num-frames) -1)) + 0.143 + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 0.143)) + ) + (until #f + (ja-no-eval :group! (-> self draw art-group data 9) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 9)) frames num-frames) -1)) 0.1) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 0.1)) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior kid-escort) nav-enemy-simple-post) + ) diff --git a/goal_src/jak2/levels/city/kid_escort/kidesc-task.gc b/goal_src/jak2/levels/city/kid_escort/kidesc-task.gc index 161aef4801..f3f8c9472a 100644 --- a/goal_src/jak2/levels/city/kid_escort/kidesc-task.gc +++ b/goal_src/jak2/levels/city/kid_escort/kidesc-task.gc @@ -7,3 +7,42 @@ ;; DECOMP BEGINS +(defmethod reset-task! kidesct-wait-spot ((obj kidesct-wait-spot)) + (set! (-> obj check-done) #f) + (set! (-> obj which-spot) -1) + (set! (-> obj num-spots) (the-as uint 0)) + 0 + (none) + ) + +;; WARN: Return type mismatch symbol vs none. +(defmethod ai-task-method-11 kidesct-wait-spot ((obj kidesct-wait-spot) (arg0 bot)) + (let ((s4-0 (-> obj which-spot))) + (when (>= s4-0 0) + (let ((s3-0 (-> arg0 course spots (-> obj spot-indexes s4-0)))) + (if (and (not (outside-spot-radius? arg0 s3-0 (the-as vector #f) #f)) (player-blocking-spot? arg0 s3-0)) + (set! s4-0 -1) + ) + ) + ) + (when (< s4-0 0) + (set! s4-0 (choose-spot arg0 (the-as int (-> obj num-spots)) (the-as (pointer uint) (-> obj spot-indexes)))) + (set! (-> obj which-spot) s4-0) + (mem-copy! + (the-as pointer (-> arg0 spot)) + (the-as pointer (-> arg0 course spots (-> obj spot-indexes s4-0))) + 20 + ) + ) + (if (logtest? *display-bot-marks* (bot-marks-controls bmc16)) + (bot-debug-draw-spot-sphere + arg0 + (the-as int (-> obj num-spots)) + (the-as (pointer uint) (-> obj spot-indexes)) + (the-as int (-> obj spot-indexes s4-0)) + ) + ) + ) + ((-> obj check-done) obj (the-as kid-escort arg0)) + (none) + ) diff --git a/goal_src/jak2/levels/city/kid_escort/kidesc.gc b/goal_src/jak2/levels/city/kid_escort/kidesc.gc index 3b53842e8f..e6966099c5 100644 --- a/goal_src/jak2/levels/city/kid_escort/kidesc.gc +++ b/goal_src/jak2/levels/city/kid_escort/kidesc.gc @@ -7,3 +7,795 @@ ;; DECOMP BEGINS +(define *kid-escort-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 2 + (new 'static 'idle-control-frame :command (ic-cmd play) :anim #x3 :param0 #x1 :param1 #x1) + (new 'static 'idle-control-frame) + ) + :idle-anim 3 + :notice-anim 3 + :hostile-anim -1 + :hit-anim 3 + :knocked-anim 6 + :knocked-land-anim 7 + :die-anim 3 + :die-falling-anim 3 + :victory-anim -1 + :jump-wind-up-anim 3 + :jump-in-air-anim 3 + :jump-land-anim 3 + :neck-joint 6 + :look-at-joint 6 + :bullseye-joint 4 + :notice-distance (meters 30) + :notice-distance-delta (meters 10) + :proximity-notice-distance (meters 30) + :default-hit-points 100 + :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.7 + :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 40960.0 + :knocked-soft-vxz-hi 40960.0 + :knocked-soft-vy-lo 40960.0 + :knocked-soft-vy-hi 40960.0 + :knocked-medium-vxz-lo 40960.0 + :knocked-medium-vxz-hi 40960.0 + :knocked-medium-vy-lo 40960.0 + :knocked-medium-vy-hi 40960.0 + :knocked-hard-vxz-lo 40960.0 + :knocked-hard-vxz-hi 40960.0 + :knocked-hard-vy-lo 40960.0 + :knocked-hard-vy-hi 40960.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 40960.0 + :knocked-yellow-vxz-hi 40960.0 + :knocked-yellow-vy-lo 40960.0 + :knocked-yellow-vy-hi 40960.0 + :knocked-red-vxz-lo 40960.0 + :knocked-red-vxz-hi 40960.0 + :knocked-red-vy-lo 40960.0 + :knocked-red-vy-hi 40960.0 + :knocked-blue-vxz-lo 40960.0 + :knocked-blue-vxz-hi 40960.0 + :knocked-blue-vy-lo 40960.0 + :knocked-blue-vy-hi 40960.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 3 + :turn-anim -1 + :run-anim 3 + :taunt-anim -1 + :run-travel-speed (meters 4.5) + :run-acceleration (meters 5) + :run-turning-acceleration (meters 6) + :walk-travel-speed (meters 4.5) + :walk-acceleration (meters 5) + :walk-turning-acceleration (meters 6) + :maximum-rotation-rate (degrees 360.0) + :notice-nav-radius (meters 0.85) + :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! (-> *kid-escort-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) + +(defmethod general-event-handler kid-escort ((obj kid-escort) (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" + (with-pp + (case arg2 + (('arrest) + (let* ((s4-0 (handle->process (-> obj arrestor-handle))) + (v1-4 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + (when (or (not v1-4) + (= v1-4 arg0) + (and (!= v1-4 arg0) (>= (- (-> pp clock frame-counter) (-> obj arrest-attempt-time)) (seconds 0.1))) + ) + (set! (-> obj arrestor-handle) (process->handle arg0)) + (set! (-> obj arrest-attempt-time) (-> pp clock frame-counter)) + (if (!= v1-4 arg0) + (send-event (handle->process (-> obj master-handle)) 'notify 'arrest arg0) + ) + ) + ) + #t + ) + (('instant-arrest) + (set! (-> obj bot-flags) (logior (bot-flags bf19) (-> obj bot-flags))) + (let ((s5-1 (the-as crimson-guard (-> arg3 param 0)))) + (set! (-> obj arrestor-handle) (process->handle s5-1)) + (set! (-> obj arrest-attempt-time) (-> pp clock frame-counter)) + (let ((a1-11 (new 'stack-no-clear 'vector))) + (vector-! a1-11 (-> s5-1 root-override2 trans) (-> obj root-override2 trans)) + (set! (-> a1-11 y) 0.0) + (forward-up->quaternion (-> obj root-override2 quat) a1-11 *up-vector*) + ) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> obj mask) (process-mask collectable)) + (logclear! (-> obj enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj enemy-flags) (enemy-flag notice)) + (send-event (handle->process (-> obj master-handle)) 'notify 'arrest s5-1) + ) + (go (method-of-object obj arrested)) + ) + (('attack) + ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) + #f + ) + (('nav-mesh-kill) + (change-to *default-nav-mesh* obj) + #t + ) + (else + ((method-of-type bot general-event-handler) obj arg0 arg1 arg2 arg3) + ) + ) + ) + ) + +(defmethod run-logic? kid-escort ((obj kid-escort)) + (or (not (logtest? (process-mask enemy) (-> *setting-control* user-current process-mask))) + (logtest? (-> obj bot-flags) (bot-flags bf09)) + ) + ) + +(defmethod enemy-method-97 kid-escort ((obj kid-escort)) + (with-pp + (let* ((s4-0 (handle->process (-> obj attacker-handle))) + (s5-0 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + (s3-0 (handle->process (-> obj arrestor-handle))) + (s4-1 (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + (when s5-0 + (cond + ((= (-> s5-0 type) target) + (when (or (not (logtest? (-> obj bot-flags) (bot-flags attacked))) + (>= (- (-> pp clock frame-counter) (-> obj attacker-time)) (seconds 1.5)) + ) + (if (logtest? (-> obj bot-flags) (bot-flags attacked)) + (reset-attacker! obj) + ) + (set! s5-0 (the-as process #f)) + (set! (-> obj attacker-handle) (the-as handle #f)) + ) + ) + (else + (when (>= (- (-> pp clock frame-counter) (-> obj attacker-time)) (seconds 6)) + (set! s5-0 (the-as process #f)) + (set! (-> obj attacker-handle) (the-as handle #f)) + ) + ) + ) + ) + (when s4-1 + (when (or (>= (- (-> pp clock frame-counter) (-> obj arrest-attempt-time)) (seconds 0.5)) + (logtest? (-> (the-as process-focusable s4-1) focus-status) (focus-status dead hit)) + ) + (set! s4-1 (the-as process #f)) + (set! (-> obj arrestor-handle) (the-as handle #f)) + ) + ) + (let ((v1-34 (-> obj focus-mode)) + (s3-1 (the-as process #f)) + ) + (cond + ((zero? v1-34) + (cond + (s4-1 + (set! s3-1 s4-1) + ) + (s5-0 + (set! s3-1 s5-0) + ) + ((begin (set! s3-1 (select-focus! obj)) s3-1) + (empty) + ) + (else + (let ((s5-1 (handle->process (-> obj poi-handle)))) + (set! s3-1 (if (type? s5-1 process-focusable) + s5-1 + ) + ) + ) + (if s3-1 + (empty) + (set! s3-1 *target*) + ) + ) + ) + ) + ((= v1-34 1) + (cond + (s4-1 + (set! s3-1 s4-1) + ) + (s5-0 + (set! s3-1 s5-0) + ) + (else + (let ((s5-2 (handle->process (-> obj poi-handle)))) + (set! s3-1 (if (type? s5-2 process-focusable) + s5-2 + ) + ) + ) + (cond + (s3-1 + (empty) + ) + ((begin (set! s3-1 (select-focus! obj)) s3-1) + (empty) + ) + (else + (set! s3-1 *target*) + ) + ) + ) + ) + ) + ) + (cond + (s3-1 + (try-update-focus (-> obj focus) (the-as process-focusable s3-1) obj) + (if (and (logtest? (-> obj bot-flags) (bot-flags attacked)) (!= (-> s3-1 type) target)) + (logclear! (-> obj bot-flags) (bot-flags attacked)) + ) + ) + (else + (clear-focused (-> obj focus)) + (logclear! (-> obj bot-flags) (bot-flags attacked)) + ) + ) + s3-1 + ) + ) + ) + ) + +;; WARN: Return type mismatch object vs symbol. +(defmethod alive? kid-escort ((obj kid-escort)) + (let ((t9-0 (method-of-type bot alive?))) + (the-as symbol (and (t9-0 obj) (-> obj next-state) (let ((v1-3 (-> obj next-state name))) + (or (= v1-3 'waiting-idle) (= v1-3 'waiting-turn)) + ) + ) + ) + ) + ) + +(defmethod init-from-entity! kid-escort ((obj kid-escort) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (stack-size-set! (-> obj main-thread) 512) + ((method-of-type bot init-from-entity!) obj arg0) + (none) + ) + +(defmethod init-enemy-collision! kid-escort ((obj kid-escort)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-others)))) + (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 3) 0))) + (set! (-> s5-0 total-prims) (the-as uint 4)) + (set! (-> s4-0 prim-core collide-as) (collide-spec bot bot-targetable)) + (set! (-> s4-0 prim-core collide-with) + (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set! (-> s4-0 prim-core action) (collide-action solid can-ride no-standon)) + (set-vector! (-> s4-0 local-sphere) 0.0 3276.8 0.0 4505.6) + (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 bot bot-targetable)) + (set! (-> v1-13 prim-core collide-with) + (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set! (-> v1-13 prim-core action) (collide-action solid can-ride)) + (set-vector! (-> v1-13 local-sphere) 0.0 2048.0 0.0 2048.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 bot bot-targetable)) + (set! (-> v1-15 prim-core collide-with) + (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set! (-> v1-15 prim-core action) (collide-action solid)) + (set-vector! (-> v1-15 local-sphere) 0.0 3584.0 0.0 2048.0) + ) + (let ((v1-17 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-17 prim-core collide-as) (collide-spec bot bot-targetable)) + (set! (-> v1-17 prim-core collide-with) + (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set! (-> v1-17 prim-core action) (collide-action solid no-standon)) + (set-vector! (-> v1-17 local-sphere) 0.0 5120.0 0.0 2048.0) + ) + (set! (-> s5-0 nav-radius) 3481.6) + (let ((v1-19 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-19 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-19 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 3)) + (set! (-> s5-0 event-priority) (the-as uint 3)) + (set! (-> obj root-override2) s5-0) + ) + 0 + (none) + ) + +(defmethod init! kid-escort ((obj kid-escort)) + "Set defaults for various fields." + (let ((t9-0 (method-of-type bot init!))) + (t9-0 obj) + ) + (set! (-> obj min-speed) 18022.4) + (set! (-> obj max-speed) 18432.0) + (set! (-> obj channel) (the-as uint 26)) + (set! (-> obj notice-enemy-dist) 122880.0) + (set! (-> obj travel-anim-interp) 0.0) + (set! (-> obj focus-info max-los-dist) 0.0) + (set-vector! (-> obj root-override2 scale) 1.2 1.2 1.2 1.0) + (set! (-> obj spot-color) (the-as uint #x60004f8f)) + (set! (-> obj arrestor-handle) (the-as handle #f)) + (set! (-> obj crocadog-handle) (the-as handle #f)) + 0 + (none) + ) + +(defmethod init-enemy! kid-escort ((obj kid-escort)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" + (init! obj) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-kid-escort" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (init-enemy-behaviour-and-stats! obj *kid-escort-nav-enemy-info*) + (let ((v1-7 (-> obj neck))) + (set! (-> v1-7 up) (the-as uint 1)) + (set! (-> v1-7 nose) (the-as uint 2)) + (set! (-> v1-7 ear) (the-as uint 0)) + (set-vector! (-> v1-7 twist-max) 11832.889 11832.889 0.0 1.0) + (set! (-> v1-7 ignore-angle) 30947.555) + ) + (let ((t9-4 (method-of-type bot init-enemy!))) + (t9-4 obj) + ) + (let ((v1-10 (-> obj nav))) + (set! (-> v1-10 sphere-mask) (the-as uint 126)) + ) + 0 + (set! (-> obj my-simple-focus) (process-spawn simple-focus :to obj)) + (set! (-> obj draw light-index) (the-as uint 10)) + 0 + (none) + ) + +(defmethod bot-method-214 kid-escort ((obj kid-escort)) + #f + ) + +(defmethod react-to-focus kid-escort ((obj kid-escort)) + "@TODO - flesh out docs" + (check-arrest obj) + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod go-waiting-turn kid-escort ((obj kid-escort)) + (go (method-of-object obj waiting-turn)) + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod check-arrest kid-escort ((obj kid-escort)) + (let ((s5-0 (handle->process (-> obj arrestor-handle)))) + (cond + ((if (type? s5-0 process-focusable) + s5-0 + ) + (go (method-of-object obj arrested)) + ) + ((logtest? (-> obj bot-flags) (bot-flags bf15)) + (go (method-of-object obj move-to-vehicle)) + ) + (else + (go (method-of-object obj waiting-idle)) + ) + ) + ) + (none) + ) + +(defmethod play-walk-anim kid-escort ((obj kid-escort)) + (with-pp + (let ((f30-0 (-> obj nav state speed)) + (v1-5 (if (> (-> obj skel active-channels) 0) + (-> obj skel root-channel 0 frame-group) + ) + ) + ) + (cond + ((and v1-5 (= v1-5 (-> obj draw art-group data 4))) + (let* ((f28-0 (current-cycle-distance (-> obj skel))) + (f0-1 (quaternion-y-angle (-> obj root-override2 quat))) + (f1-0 (deg- f0-1 (-> obj travel-prev-ry))) + (f0-4 (fmin 18432.0 (* 0.35342914 (-> pp clock frames-per-second) (fabs f1-0)))) + (f0-7 (/ (* 8.0 (fmax f30-0 f0-4)) (* 15.0 f28-0))) + (a0-8 (-> obj skel root-channel 0)) + ) + (set! (-> a0-8 param 0) f0-7) + (joint-control-channel-group-eval! a0-8 (the-as art-joint-anim #f) num-func-loop!) + ) + ) + (else + (ja-channel-push! 1 (seconds 0.15)) + (let ((a0-10 (-> obj skel root-channel 0))) + (set! (-> a0-10 dist) 6553.6) + (set! (-> a0-10 frame-group) (the-as art-joint-anim (-> obj draw art-group data 4))) + (set! (-> a0-10 param 0) 1.0) + (joint-control-channel-group! a0-10 (the-as art-joint-anim (-> obj draw art-group data 4)) num-func-loop!) + ) + ) + ) + ) + (none) + ) + ) + +(defmethod damage-amount-from-attack kid-escort ((obj kid-escort) (arg0 process) (arg1 event-message-block)) + "@returns the amount of damage taken from an attack. This can come straight off the [[attack-info]] or via [[penetrate-using->damage]]" + 0 + ) + +(defmethod bot-method-190 kid-escort ((obj kid-escort)) + #t + ) + +(defmethod enemy-method-78 kid-escort ((obj kid-escort) (arg0 (pointer float))) + (ja-channel-push! 1 (seconds 0.1)) + (let ((a1-2 (-> obj draw art-group data (-> obj enemy-info-override knocked-land-anim))) + (a0-4 (-> obj skel root-channel 0)) + ) + (set! (-> a0-4 frame-group) (the-as art-joint-anim a1-2)) + (set! (-> a0-4 param 0) (the float (+ (-> (the-as art-joint-anim a1-2) frames num-frames) -1))) + (set! (-> a0-4 param 1) (-> arg0 0)) + (set! (-> a0-4 frame-num) 0.0) + (joint-control-channel-group! a0-4 (the-as art-joint-anim a1-2) num-func-seek!) + ) + #t + ) + +;; WARN: Return type mismatch float vs meters. +(defmethod set-cam-height! kid-escort ((obj kid-escort) (arg0 vector)) + (the-as + meters + (cond + ((and (-> obj next-state) (= (-> obj next-state name) 'arrested)) + (set-vector! arg0 49152.0 12288.0 49152.0 1.0) + (vector<-cspace+vector! arg0 (-> obj node-list data 2) arg0) + (if (logtest? (-> obj focus-status) (focus-status under-water)) + (set! (-> arg0 y) (+ (get-water-height obj) (-> *setting-control* cam-current target-height))) + ) + ) + (else + ((method-of-type bot set-cam-height!) obj arg0) + ) + ) + ) + ) + +(defmethod get-penetrate-info kid-escort ((obj kid-escort)) + "@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 bot get-penetrate-info) obj))) + (logior (penetrate jak-yellow-shot jak-red-shot jak-blue-shot) v1-1) + ) + ) + +(defmethod bot-method-193 kid-escort ((obj kid-escort)) + (let* ((t9-0 (method-of-type bot bot-method-193)) + (v0-0 (t9-0 obj)) + ) + (if (and (not v0-0) (logtest? #x1c00000 (-> obj incoming penetrate-using))) + (set! v0-0 #t) + ) + v0-0 + ) + ) + +(defmethod enemy-method-79 kid-escort ((obj kid-escort) (arg0 int) (arg1 enemy-knocked-info)) + (local-vars (gp-0 symbol)) + (case arg0 + ((3) + (set! gp-0 (ja-done? 0)) + (let ((f30-0 1.0)) + (if (>= (ja-aframe-num 0) 5.0) + (set! f30-0 0.28) + ) + (let ((a0-4 (-> obj skel root-channel 0))) + (set! (-> a0-4 param 0) (the float (+ (-> a0-4 frame-group frames num-frames) -1))) + (set! (-> a0-4 param 1) f30-0) + (joint-control-channel-group-eval! a0-4 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (else + (set! gp-0 ((method-of-type bot enemy-method-79) obj arg0 arg1)) + ) + ) + gp-0 + ) + +(defmethod want-exit-vehicle? kid-escort ((obj kid-escort) (arg0 vector)) + (let ((s3-0 (handle->process (-> obj vehicle-handle)))) + (if (or (not s3-0) (not (-> obj nav))) + (return #f) + ) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (compute-seat-position (the-as vehicle s3-0) s4-0 (-> obj vehicle-seat-index)) + (vector-! s4-0 s4-0 (-> (the-as vehicle s3-0) root-override-2 trans)) + (set! (-> s4-0 y) 0.0) + (vector-normalize! s4-0 (+ 14336.0 (vector-length s4-0))) + (vector+! s4-0 s4-0 (-> (the-as vehicle s3-0) root-override-2 trans)) + (let ((s3-1 (new 'stack-no-clear 'collide-query))) + (when (enemy-above-ground? obj s3-1 s4-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) + (set! (-> s4-0 y) (-> s3-1 best-other-tri intersect y)) + (let ((s3-2 (new 'stack-no-clear 'vector))) + (do-navigation-to-destination (-> obj nav state) (-> obj root-override2 trans)) + (when (cloest-point-on-mesh (-> obj nav) s3-2 s4-0 (the-as nav-poly #f)) + (let ((f0-4 2048.0)) + (when (>= (* f0-4 f0-4) (vector-vector-xz-distance-squared s3-2 s4-0)) + (set! (-> arg0 quad) (-> s3-2 quad)) + #t + ) + ) + ) + ) + ) + ) + ) + ) + ) + +(defmethod check-vehicle-exit kid-escort ((obj kid-escort)) + (local-vars (v1-25 enemy-flag)) + (with-pp + (when (logtest? (focus-status pilot) (-> obj focus-status)) + (let ((s5-0 (handle->process (-> obj vehicle-handle)))) + (when (or (not s5-0) (logtest? (-> (the-as vehicle s5-0) flags) (rigid-body-object-flag dead))) + (set! (-> obj bot-flags) (logior (bot-flags bf17) (-> obj bot-flags))) + (logclear! (-> obj bot-flags) (bot-flags bf15)) + (logclear! (-> obj focus-status) (focus-status pilot-riding pilot)) + (if (the-as vehicle s5-0) + (remove-rider (the-as vehicle s5-0) obj) + ) + (set! (-> obj vehicle-seat-index) -1) + (set! (-> obj vehicle-handle) (the-as handle #f)) + (logior! (-> obj root-override2 nav-flags) (nav-flags has-root-sphere)) + (let* ((s4-0 (-> obj root-override2 quat)) + (f30-0 (quaternion-y-angle s4-0)) + ) + (quaternion-identity! s4-0) + (quaternion-rotate-y! s4-0 s4-0 f30-0) + ) + (let ((v1-24 (-> obj enemy-flags))) + (if (logtest? v1-24 (enemy-flag checking-water)) + (set! v1-25 (logior v1-24 (enemy-flag enable-on-active))) + (set! v1-25 (logclear v1-24 (enemy-flag enable-on-active))) + ) + ) + (set! (-> obj enemy-flags) v1-25) + (let ((s4-2 (vector-! + (new 'stack-no-clear 'vector) + (-> obj root-override2 trans) + (-> (the-as vehicle s5-0) root-override-2 trans) + ) + ) + ) + (vector-normalize! s4-2 57344.0) + (let ((a1-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-4 from) (process->ppointer pp)) + (set! (-> a1-4 num-params) 2) + (set! (-> a1-4 message) 'attack) + (set! (-> a1-4 param 0) (the-as uint #f)) + (let ((v1-31 (new 'static 'attack-info :mask (attack-info-mask vector id attacker-velocity knock)))) + (let* ((a0-23 *game-info*) + (a2-2 (+ (-> a0-23 attack-id) 1)) + ) + (set! (-> a0-23 attack-id) a2-2) + (set! (-> v1-31 id) a2-2) + ) + (set! (-> v1-31 vector quad) (-> s4-2 quad)) + (set! (-> v1-31 attacker-velocity quad) (-> s4-2 quad)) + (set! (-> v1-31 knock) (the-as uint 8)) + (set! (-> a1-4 param 1) (the-as uint v1-31)) + ) + (send-event-function obj a1-4) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +(defmethod go-hostile kid-escort ((obj kid-escort)) + (cond + ((logtest? (bot-flags bf17) (-> obj bot-flags)) + (logior! (-> obj bot-flags) (bot-flags bf09)) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> obj focus-status) (focus-status dangerous)) + (logclear! (-> obj enemy-flags) (enemy-flag check-water)) + (logclear! (-> obj mask) (process-mask collectable)) + (logclear! (-> obj enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj enemy-flags) (enemy-flag notice)) + (logior! (-> obj focus-status) (focus-status disable)) + (go (method-of-object obj knocked-off-vehicle)) + ) + (else + (react-to-focus obj) + ) + ) + (none) + ) + +(defmethod enemy-method-102 kid-escort ((obj kid-escort)) + (if (logtest? (bot-flags bf19) (-> obj bot-flags)) + #f + ((method-of-type bot enemy-method-102) obj) + ) + ) + +(defmethod go-idle kid-escort ((obj kid-escort)) + (cond + ((task-node-closed? (game-task-node city-escort-kid-resolution)) + (cleanup-for-death obj) + (go (method-of-object obj die-fast)) + ) + (else + (check-arrest obj) + ) + ) + (none) + ) diff --git a/goal_src/jak2/levels/city/kid_escort/kidesc4-course.gc b/goal_src/jak2/levels/city/kid_escort/kidesc4-course.gc index 35078f7938..fd0dffc174 100644 --- a/goal_src/jak2/levels/city/kid_escort/kidesc4-course.gc +++ b/goal_src/jak2/levels/city/kid_escort/kidesc4-course.gc @@ -7,3 +7,397 @@ ;; DECOMP BEGINS +;; WARN: Return type mismatch float vs none. +(defun kid4-update-spot-to-track-crocadog ((arg0 kid-escort)) + (let* ((s5-0 (handle->process (-> arg0 crocadog-handle))) + (a0-5 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when a0-5 + (let ((v1-4 (get-trans (the-as process-focusable a0-5) 0)) + (a0-6 (-> arg0 spot)) + ) + (set! (-> a0-6 center x) (-> v1-4 x)) + (set! (-> a0-6 center y) (-> v1-4 y)) + (set! (-> a0-6 center z) (-> v1-4 z)) + ) + ) + ) + (none) + ) + +(define *kid4-course* + (new 'static 'bot-course + :course-id #xb + :spot-count #x8 + :default-check-too-far #f + :waypoints (new 'static 'boxed-array :type bot-waypoint + (new 'static 'bot-waypoint + :waypoint-id 1 + :skip-to -1 + :on-set (lambda ((arg0 kid-escort)) + (process-entity-status! arg0 (entity-perm-status no-kill) #t) + (clear-speech-flags! arg0) + (logior! (-> arg0 focus-status) (focus-status disable)) + (set! (-> arg0 notice-enemy-dist) 0.0) + (let ((v1-5 (-> arg0 root-override2 root-prim))) + (set! (-> v1-5 prim-core collide-as) (collide-spec)) + (set! (-> v1-5 prim-core collide-with) (collide-spec)) + ) + 0 + (move-to-point! (-> arg0 root-override2) (the-as vector (-> arg0 course spots 0))) + (logclear! (-> arg0 mask) (process-mask actor-pause)) + (logclear! (-> arg0 enemy-flags) (enemy-flag notice)) + (let ((v1-16 (get-task-by-type (-> arg0 ai-ctrl) kidesct-wait-spot arg0))) + (set! (-> v1-16 bytes 5) (the-as uint 1)) + (set! (-> v1-16 bytes 6) (the-as uint 0)) + (set! (-> v1-16 bytes 4) (the-as uint -1)) + (set! (-> (the-as kidesct-wait-spot v1-16) check-done) + (the-as + (function kidesct-wait-spot kid-escort symbol) + (lambda ((arg0 object) (arg1 kid-escort)) + (when (< 1 (-> arg1 waypoint-request)) + (let* ((a0-2 (-> arg1 actor-group 0 data 0 actor)) + (v1-4 (if a0-2 + (-> a0-2 extra process) + ) + ) + ) + (when v1-4 + (set! (-> arg1 master-handle) (process->handle v1-4)) + (set! (-> arg1 crocadog-handle) (-> (the-as hal-escort v1-4) slave-handle 1)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 2 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 2 + :nav-mesh-index -1 + :skip-to #xe + :on-set (lambda ((arg0 kid-escort)) + (add-icon! *minimap* arg0 (the-as uint 24) (the-as int #f) (the-as vector #t) 0) + (let ((v1-3 (-> arg0 root-override2 root-prim))) + (set! (-> v1-3 prim-core collide-as) (-> arg0 root-override2 backup-collide-as)) + (set! (-> v1-3 prim-core collide-with) (-> arg0 root-override2 backup-collide-with)) + ) + (logclear! (-> arg0 focus-status) (focus-status disable)) + (set! (-> arg0 focus-status) (logior (focus-status arrestable) (-> arg0 focus-status))) + (let ((v1-9 (get-task-by-type (-> arg0 ai-ctrl) kidesct-wait-spot arg0))) + (set! (-> v1-9 bytes 5) (the-as uint 1)) + (set! (-> v1-9 bytes 6) (the-as uint 1)) + (set! (-> v1-9 bytes 4) (the-as uint -1)) + (set! (-> (the-as kidesct-wait-spot v1-9) check-done) + (the-as + (function kidesct-wait-spot kid-escort symbol) + (lambda ((arg0 object) (arg1 kid-escort)) + (let* ((s5-0 (handle->process (-> arg1 crocadog-handle))) + (a0-5 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (and a0-5 (>= (the-as int (send-event a0-5 'query 'waypoint)) 17)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 17 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 kid-escort)) (kid4-update-spot-to-track-crocadog arg0) (none)) + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 14 + :nav-mesh-index -1 + :skip-to #x13 + :on-set (lambda ((arg0 kid-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) kidesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 3)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as kidesct-wait-spot v1-1) check-done) + (the-as + (function kidesct-wait-spot kid-escort symbol) + (lambda ((arg0 object) (arg1 kid-escort)) + (let* ((s5-0 (handle->process (-> arg1 crocadog-handle))) + (a0-5 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (and a0-5 (>= (the-as int (send-event a0-5 'query 'waypoint)) 17)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 17 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 kid-escort)) (kid4-update-spot-to-track-crocadog arg0) (none)) + :on-skipping-here (lambda ((arg0 kid-escort)) + (let ((v1-1 (-> arg0 root-override2 root-prim))) + (set! (-> v1-1 prim-core collide-as) (-> arg0 root-override2 backup-collide-as)) + (set! (-> v1-1 prim-core collide-with) (-> arg0 root-override2 backup-collide-with)) + ) + (logclear! (-> arg0 focus-status) (focus-status disable)) + (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) + (send-event arg0 'move-trans (-> arg0 course spots 2)) + (none) + ) + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 17 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 kid-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) kidesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 4)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as kidesct-wait-spot v1-1) check-done) + (the-as + (function kidesct-wait-spot kid-escort symbol) + (lambda ((arg0 object) (arg1 kid-escort)) (when (logtest? (focus-status pilot) (-> arg1 focus-status)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 18 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 18 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 kid-escort)) + (clear-poi-and-focus! arg0) + (let ((v1-3 (get-task-by-type (-> arg0 ai-ctrl) kidesct-wait-spot arg0))) + (set! (-> v1-3 bytes 5) (the-as uint 1)) + (set! (-> v1-3 bytes 6) (the-as uint 4)) + (set! (-> v1-3 bytes 4) (the-as uint -1)) + (set! (-> (the-as kidesct-wait-spot v1-3) check-done) + (the-as + (function kidesct-wait-spot kid-escort symbol) + (lambda ((arg0 object) (arg1 kid-escort)) + (when (and (not (logtest? (focus-status pilot) (-> arg1 focus-status))) + (zero? (logand (bot-flags bf17) (-> arg1 bot-flags))) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 19 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 19 + :nav-mesh-index 1 + :skip-to -1 + :on-set (lambda ((arg0 kid-escort)) + (logior! (-> arg0 focus-status) (focus-status disable)) + (set! (-> arg0 focus-status) (logior (focus-status arrestable) (-> arg0 focus-status))) + (let ((v1-5 (get-task-by-type (-> arg0 ai-ctrl) kidesct-wait-spot arg0))) + (set! (-> v1-5 bytes 5) (the-as uint 1)) + (set! (-> v1-5 bytes 6) (the-as uint 1)) + (set! (-> v1-5 bytes 4) (the-as uint -1)) + (set! (-> (the-as kidesct-wait-spot v1-5) check-done) + (the-as + (function kidesct-wait-spot kid-escort symbol) + (lambda ((arg0 object) (arg1 kid-escort)) + (let* ((s5-0 (handle->process (-> arg1 crocadog-handle))) + (a0-5 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (and a0-5 (>= (the-as int (send-event a0-5 'query 'waypoint)) 21)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 21 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 object) (arg1 kid-escort)) + (the-as symbol (kid4-update-spot-to-track-crocadog (the-as kid-escort arg0))) + ) + :on-skipping-here (lambda ((arg0 kid-escort)) + (let ((v1-1 (-> arg0 root-override2 root-prim))) + (set! (-> v1-1 prim-core collide-as) (-> arg0 root-override2 backup-collide-as)) + (set! (-> v1-1 prim-core collide-with) (-> arg0 root-override2 backup-collide-with)) + ) + (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) + (send-event arg0 'move-trans (-> arg0 course spots 5)) + (none) + ) + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 21 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 kid-escort)) + (logclear! (-> arg0 focus-status) (focus-status disable)) + (set! (-> arg0 focus-status) (logior (focus-status arrestable) (-> arg0 focus-status))) + (let ((v1-5 (get-task-by-type (-> arg0 ai-ctrl) kidesct-wait-spot arg0))) + (set! (-> v1-5 bytes 5) (the-as uint 1)) + (set! (-> v1-5 bytes 6) (the-as uint 1)) + (set! (-> v1-5 bytes 4) (the-as uint -1)) + (set! (-> (the-as kidesct-wait-spot v1-5) check-done) + (the-as + (function kidesct-wait-spot kid-escort symbol) + (lambda ((arg0 object) (arg1 kid-escort)) + (let* ((s4-0 (handle->process (-> arg1 crocadog-handle))) + (s5-0 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + (when (and (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + s5-0 + (>= (the-as int (send-event s5-0 'query 'waypoint)) 25) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 25 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 kid-escort)) (kid4-update-spot-to-track-crocadog arg0) (none)) + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 25 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 kid-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) kidesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 1)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as kidesct-wait-spot v1-1) check-done) + (the-as + (function kidesct-wait-spot kid-escort symbol) + (lambda ((arg0 object) (arg1 kid-escort)) (when (>= (-> arg1 waypoint-request) 26) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 26 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 kid-escort)) (kid4-update-spot-to-track-crocadog arg0) (none)) + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 26 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 kid-escort)) + (logclear! (-> arg0 focus-status) (focus-status disable)) + (send-event (ppointer->process (-> arg0 my-simple-focus)) 'move-trans (-> arg0 course spots 7)) + (set! (-> arg0 poi-handle) (ppointer->handle (-> arg0 my-simple-focus))) + (set! (-> arg0 focus-mode) 1) + (let ((v1-16 (get-task-by-type (-> arg0 ai-ctrl) kidesct-wait-spot arg0))) + (set! (-> v1-16 bytes 5) (the-as uint 1)) + (set! (-> v1-16 bytes 6) (the-as uint 6)) + (set! (-> v1-16 bytes 4) (the-as uint -1)) + (set! (-> (the-as kidesct-wait-spot v1-16) check-done) + (the-as + (function kidesct-wait-spot kid-escort symbol) + (lambda ((arg0 object) (arg1 kid-escort)) + (with-pp + (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2)) + (let ((v1-4 (-> arg1 spot))) + (set! (-> v1-4 center quad) (-> arg1 root-override2 trans quad)) + (set! (-> v1-4 center w) 20480.0) + ) + ) + #f + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + ) + :spots (new 'static 'inline-array bot-spot 8 + (new 'static 'bot-spot :center (new 'static 'vector :x 4704133.0 :y 33341.44 :z 194764.8 :w 10240.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4707041.5 :y 33341.44 :z 711761.94 :w 8192.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4454113.5 :y 33341.44 :z 694026.25 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4488438.0 :y 33341.44 :z 751697.94 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4746608.5 :y 33341.44 :z 715816.94 :w 61440.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4086620.2 :y 32768.0 :z 4637122.5 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4494663.5 :y 102891.52 :z 4493230.0 :w 8192.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4588544.0 :y 112640.0 :z 4589322.0 :w 4096.0)) + ) + ) + ) + +(set! (-> *bot-course-table* course 11) *kid4-course*) diff --git a/goal_src/jak2/levels/city/market/east/ashelin/ash4-course.gc b/goal_src/jak2/levels/city/market/east/ashelin/ash4-course.gc index e489c53340..7328960e0e 100644 --- a/goal_src/jak2/levels/city/market/east/ashelin/ash4-course.gc +++ b/goal_src/jak2/levels/city/market/east/ashelin/ash4-course.gc @@ -7,3 +7,536 @@ ;; DECOMP BEGINS +(deftype ashelin-tanker (ashelin) + ((suppress traffic-suppression-params :inline :offset-assert 1040) + ) + :heap-base #x3c0 + :method-count-assert 252 + :size-assert #x439 + :flag-assert #xfc03c00439 + (:methods + (suppress-traffic (_type_) none 251) + ) + ) + + +;; WARN: Return type mismatch object vs none. +(defmethod go-idle ashelin-tanker ((obj ashelin-tanker)) + (cond + ((task-node-closed? (game-task-node city-intercept-tanker-resolution)) + (cleanup-for-death obj) + (go (method-of-object obj die-fast)) + ) + (else + (go (method-of-object obj hidden)) + ) + ) + (none) + ) + +;; WARN: Return type mismatch vector vs none. +(defmethod init! ashelin-tanker ((obj ashelin-tanker)) + "Set defaults for various fields." + (let ((t9-0 (method-of-type ashelin init!))) + (t9-0 obj) + ) + (let ((v1-1 (-> obj suppress))) + (set! (-> v1-1 duration) (the-as uint 300)) + (set! (-> v1-1 id) -1) + (let ((a0-4 (-> v1-1 bbox))) + (set! (-> a0-4 min x) 1634304.0) + (set! (-> a0-4 min y) 28672.0) + (set! (-> a0-4 min z) 1708032.0) + (set! (-> a0-4 min w) 1.0) + ) + (set-vector! (-> v1-1 bbox max) 2048000.0 40960.0 2023424.0 1.0) + ) + (none) + ) + +(defmethod suppress-traffic ashelin-tanker ((obj ashelin-tanker)) + (when *traffic-manager* + (let ((a1-0 (new 'stack-no-clear 'traffic-danger-info))) + (set! (-> a1-0 sphere quad) (-> (new 'static 'vector :x 1837465.6 :y 34406.4 :z 1868103.6 :w 225280.0) quad)) + (set! (-> a1-0 velocity quad) (the-as uint128 0)) + (set! (-> a1-0 notify-radius) 286720.0) + (set! (-> a1-0 danger-level) 1.0) + (set! (-> a1-0 decay-rate) 0.0) + (set! (-> a1-0 flags) (traffic-danger-flags tdf0)) + (set! (-> a1-0 danger-type) (traffic-danger-type tdt4)) + (add-danger (-> (the-as traffic-manager *traffic-manager*) traffic-engine) a1-0) + ) + ) + (none) + ) + +(define *ash4-course* + (new 'static 'ashelin-course + :course-id #x9 + :speech-count #x2d + :spot-count #x1 + :attack-player-speeches (new 'static 'bot-speech-list-shuffle + :flags #xe + :last-local-index -1 + :speech-indexes (new 'static 'boxed-array :type int16 11 7 8 9 10 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26) + ) + :default-check-too-far #f + :waypoints (new 'static 'boxed-array :type bot-waypoint + (new 'static 'bot-waypoint + :waypoint-id 1 + :skip-to -1 + :on-set (lambda ((arg0 ashelin-tanker)) + (clear-speech-flags! arg0) + (move-to-point! (-> arg0 root-override2) (the-as vector (-> arg0 ash-course spots 0))) + (let ((v1-7 (get-task-by-type (-> arg0 ai-ctrl) asht-wait-spot arg0))) + (set! (-> v1-7 bytes 5) (the-as uint 1)) + (set! (-> v1-7 bytes 6) (the-as uint 0)) + (set! (-> v1-7 bytes 4) (the-as uint -1)) + (set! (-> (the-as asht-wait-spot v1-7) check-done) + (the-as + (function asht-wait-spot ashelin symbol) + (lambda ((arg0 object) (arg1 ashelin-tanker)) (let ((v1-0 *traffic-manager*)) + (cond + ((not (logtest? (-> arg1 waypoint-bits) 1)) + (if v1-0 + (logior! (-> arg1 waypoint-bits) 1) + ) + #f + ) + ((not (logtest? (-> arg1 waypoint-bits) 2)) + (logior! (-> arg1 waypoint-bits) 2) + #f + ) + ((not (logtest? (-> arg1 waypoint-bits) 4)) + (logior! (-> arg1 waypoint-bits) 4) + #f + ) + (else + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 2 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 2 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 ashelin-tanker)) + (let ((v1-1 (get-current-task-event (-> arg0 task)))) + (if (= (-> v1-1 action) (game-task-action say)) + (add-process + *gui-control* + arg0 + (gui-channel art-load) + (gui-action queue) + (the-as string (-> v1-1 scene)) + -99.0 + 0 + ) + ) + ) + (let ((v1-3 (get-task-by-type (-> arg0 ai-ctrl) asht-wait-spot arg0))) + (set! (-> v1-3 bytes 5) (the-as uint 1)) + (set! (-> v1-3 bytes 6) (the-as uint 0)) + (set! (-> v1-3 bytes 4) (the-as uint -1)) + (set! (-> (the-as asht-wait-spot v1-3) check-done) + (the-as + (function asht-wait-spot ashelin symbol) + (lambda ((arg0 object) (arg1 ashelin-tanker)) + (let ((a0-1 *target*)) + (when a0-1 + (let ((v1-2 (get-trans a0-1 0))) + (if (and (>= (-> v1-2 x) 1638400.0) + (>= 2031616.0 (-> v1-2 x)) + (>= (-> v1-2 z) 1703936.0) + (>= 2027520.0 (-> v1-2 z)) + ) + (logior! (-> arg1 bot-task-bits) 1) + ) + ) + ) + ) + (let ((v1-8 (get-current-task-event (-> arg1 task)))) + (when (and (logtest? (-> arg1 bot-task-bits) 1) (= (-> v1-8 action) (game-task-action say))) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 3 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 3 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 ashelin-tanker)) + (set-setting! 'calm #t 0 0) + (set-setting! 'exclusive-task #f 0 42) + (let ((v1-5 (get-task-by-type (-> arg0 ai-ctrl) asht-wait-spot arg0))) + (set! (-> v1-5 bytes 5) (the-as uint 1)) + (set! (-> v1-5 bytes 6) (the-as uint 0)) + (set! (-> v1-5 bytes 4) (the-as uint -1)) + (set! (-> (the-as asht-wait-spot v1-5) check-done) + (the-as + (function asht-wait-spot ashelin symbol) + (lambda ((arg0 object) (arg1 ashelin-tanker)) (let ((v1-1 (get-current-task-event (-> arg1 task)))) + (when (scene-play arg1 (the-as string (-> v1-1 scene)) #f) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 4 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 4 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 ashelin-tanker)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) asht-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 0)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as asht-wait-spot v1-1) check-done) + (the-as + (function asht-wait-spot ashelin symbol) + (lambda ((arg0 object) (arg1 ashelin-tanker)) (when (scene-release? arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 5 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 5 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 ashelin-tanker)) + (with-pp + (send-event arg0 'hide #f) + (remove-setting! 'calm) + (set-setting! 'music 'danger9 0 0) + (set! (-> arg0 notice-enemy-dist) 245760.0) + (logior! (-> arg0 bot-flags) (bot-flags bf06)) + (set! (-> arg0 bot-task-bits) (logand -3 (-> arg0 bot-task-bits))) + (let ((a1-3 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-3 from) (process->ppointer pp)) + (set! (-> a1-3 num-params) 0) + (set! (-> a1-3 message) 'trigger) + (let ((t9-3 send-event-function) + (v1-18 (-> arg0 actor-group 0 data 0 actor)) + ) + (t9-3 + (if v1-18 + (-> v1-18 extra process) + ) + a1-3 + ) + ) + ) + (ashelin-method-250 arg0 #t) + (add-process *gui-control* arg0 (gui-channel art-load) (gui-action queue) "city-intercept-tanker-res" -99.0 0) + (let ((v1-26 (get-task-by-type (-> arg0 ai-ctrl) asht-wait-spot arg0))) + (set! (-> v1-26 bytes 5) (the-as uint 1)) + (set! (-> v1-26 bytes 6) (the-as uint 0)) + (set! (-> v1-26 bytes 4) (the-as uint -1)) + (set! (-> (the-as asht-wait-spot v1-26) check-done) + (the-as + (function asht-wait-spot ashelin symbol) + (lambda ((arg0 object) (arg1 ashelin-tanker)) (with-pp + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer pp)) + (set! (-> a1-1 num-params) 1) + (set! (-> a1-1 message) 'query) + (set! (-> a1-1 param 0) (the-as uint 'beaten)) + (let ((t9-0 send-event-function) + (v1-7 (-> arg1 actor-group 0 data 0 actor)) + ) + (when (t9-0 + (if v1-7 + (-> v1-7 extra process) + ) + a1-1 + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 6 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + ) + :on-update (lambda ((arg0 ashelin-tanker)) + (suppress-traffic arg0) + (when (logtest? (-> arg0 bot-task-bits) 2) + (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) + (go-to-waypoint! arg0 9 #f) + ) + (none) + ) + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 6 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 ashelin-tanker)) + (with-pp + (set! (-> arg0 waypoint-time0) (-> pp clock frame-counter)) + (ashelin-method-250 arg0 #f) + (task-node-close! (game-task-node city-intercept-tanker-battle)) + (remove-setting! 'sound-mode) + (remove-setting! 'music) + (when (not (channel-active? arg0 (the-as uint 0))) + (let ((v1-12 (get-rand-int arg0 3))) + (cond + ((zero? v1-12) + (play-speech arg0 42) + ) + ((= v1-12 1) + (play-speech arg0 43) + ) + (else + (play-speech arg0 44) + ) + ) + ) + ) + (let ((v1-20 (get-task-by-type (-> arg0 ai-ctrl) asht-wait-spot arg0))) + (set! (-> v1-20 bytes 5) (the-as uint 1)) + (set! (-> v1-20 bytes 6) (the-as uint 0)) + (set! (-> v1-20 bytes 4) (the-as uint -1)) + (set! (-> (the-as asht-wait-spot v1-20) check-done) + (the-as + (function asht-wait-spot ashelin symbol) + (lambda ((arg0 object) (arg1 ashelin-tanker)) + (let ((s5-0 (get-current-task-event (-> arg1 task)))) + (when (and (= (-> s5-0 action) (game-task-action say)) + (not (channel-active? arg1 (the-as uint 0))) + (scene-play arg1 (the-as string (-> s5-0 scene)) #f) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 7 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + ) + :on-update (lambda ((arg0 ashelin-tanker)) + (suppress-traffic arg0) + (when (logtest? (-> arg0 bot-task-bits) 2) + (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) + (go-to-waypoint! arg0 9 #f) + ) + (none) + ) + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 7 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 ashelin-tanker)) + (logclear! (-> arg0 bot-flags) (bot-flags bf06)) + (bot-method-196 arg0) + (let ((v1-5 (-> arg0 root-override2 root-prim))) + (set! (-> v1-5 prim-core collide-as) (collide-spec)) + (set! (-> v1-5 prim-core collide-with) (collide-spec)) + ) + (set! (-> arg0 root-override2 backup-collide-as) (collide-spec)) + (set! (-> arg0 root-override2 backup-collide-with) (collide-spec)) + 0 + (send-event arg0 'hide #t) + (let ((v1-15 (get-task-by-type (-> arg0 ai-ctrl) asht-wait-spot arg0))) + (set! (-> v1-15 bytes 5) (the-as uint 1)) + (set! (-> v1-15 bytes 6) (the-as uint 0)) + (set! (-> v1-15 bytes 4) (the-as uint -1)) + (set! (-> (the-as asht-wait-spot v1-15) check-done) + (the-as + (function asht-wait-spot ashelin symbol) + (lambda ((arg0 object) (arg1 ashelin-tanker)) (when (scene-release? arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 8 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 ashelin-tanker)) (create-or-update-suppression-box (-> arg0 suppress)) (none)) + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 8 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 ashelin-tanker)) + (remove-setting! 'exclusive-task) + (process-entity-status! arg0 (entity-perm-status bit-4) #f) + (process-entity-status! arg0 (entity-perm-status no-kill) #f) + (let ((v1-3 (get-task-by-type (-> arg0 ai-ctrl) asht-wait-spot arg0))) + (set! (-> v1-3 bytes 5) (the-as uint 1)) + (set! (-> v1-3 bytes 6) (the-as uint 0)) + (set! (-> v1-3 bytes 4) (the-as uint -1)) + (set! (-> (the-as asht-wait-spot v1-3) check-done) + (the-as (function asht-wait-spot ashelin symbol) (lambda ((arg0 ashelin-tanker)) #f)) + ) + ) + (none) + ) + :on-update (lambda ((arg0 ashelin-tanker)) (create-or-update-suppression-box (-> arg0 suppress)) (none)) + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 9 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 ashelin-tanker)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) asht-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 0)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as asht-wait-spot v1-1) check-done) + (the-as + (function asht-wait-spot ashelin symbol) + (lambda ((arg0 object) (arg1 ashelin-tanker)) (send-event arg1 'instant-death) (none)) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 ashelin-tanker)) + (suppress-traffic arg0) + (create-or-update-suppression-box (-> arg0 suppress)) + (none) + ) + :on-skipping-here #f + :check-too-far #f + ) + ) + :speeches (new 'static 'inline-array bot-speech-info 45 + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha001") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha008") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha009") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha010") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha011") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha012") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha013") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha002") + (new 'static 'bot-speech-info :flags (speech-flags sf10) :hold-time #x5a :slave-id -1 :name "asha003") + (new 'static 'bot-speech-info :flags (speech-flags sf06) :hold-time #x5a :slave-id -1 :name "asha004") + (new 'static 'bot-speech-info :flags (speech-flags sf06) :hold-time #x5a :slave-id -1 :name "asha005") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha006") + (new 'static 'bot-speech-info :flags (speech-flags sf08) :hold-time #x5a :slave-id -1 :name "asha007") + (new 'static 'bot-speech-info :flags (speech-flags sf09) :hold-time #x5a :slave-id -1 :name "asha018") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha019") + (new 'static 'bot-speech-info :flags (speech-flags sf09) :hold-time #x5a :slave-id -1 :name "asha020") + (new 'static 'bot-speech-info :flags (speech-flags sf09) :hold-time #x5a :slave-id -1 :name "asha021") + (new 'static 'bot-speech-info :flags (speech-flags sf09) :hold-time #x5a :slave-id -1 :name "asha022") + (new 'static 'bot-speech-info :flags (speech-flags sf09) :hold-time #x5a :slave-id -1 :name "asha023") + (new 'static 'bot-speech-info :flags (speech-flags sf09) :hold-time #x5a :slave-id -1 :name "asha024") + (new 'static 'bot-speech-info :flags (speech-flags sf09) :hold-time #x5a :slave-id -1 :name "asha025") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha026") + (new 'static 'bot-speech-info :flags (speech-flags sf09) :hold-time #x5a :slave-id -1 :name "asha027") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha028") + (new 'static 'bot-speech-info :flags (speech-flags sf09) :hold-time #x5a :slave-id -1 :name "asha029") + (new 'static 'bot-speech-info :flags (speech-flags sf10) :hold-time #x5a :slave-id -1 :name "asha030") + (new 'static 'bot-speech-info :flags (speech-flags sf09) :hold-time #x5a :slave-id -1 :name "asha031") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha035") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha036") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha039") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha041") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha050") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha051") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha052") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha054") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha014") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha015") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha016") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha017") + (new 'static 'bot-speech-info :flags (speech-flags sf11) :hold-time #x5a :slave-id -1 :name "asha038") + (new 'static 'bot-speech-info :flags (speech-flags sf11) :hold-time #x5a :slave-id -1 :name "asha044") + (new 'static 'bot-speech-info :flags (speech-flags sf11) :hold-time #x5a :slave-id -1 :name "asha049") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha032") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha033") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha034") + ) + :speech-tunings (new 'static 'inline-array bot-speech-tuning 1 + (new 'static 'bot-speech-tuning :fo-min 20 :fo-max 100 :fo-curve #xb :trans? #t) + ) + :spots (new 'static 'inline-array bot-spot 1 + (new 'static 'bot-spot :center (new 'static 'vector :x 1902510.1 :y 33587.2 :z 1786101.8 :w 61440.0)) + ) + :ouch-speeches (new 'static 'bot-speech-list-shuffle + :flags #xe + :last-local-index -1 + :speech-indexes (new 'static 'boxed-array :type int16 35 36 37 38 39 40 41) + ) + :victory-speeches (new 'static 'bot-speech-list-shuffle + :flags #xe + :last-local-index -1 + :speech-indexes (new 'static 'boxed-array :type int16 0 1 2 3 4 5 6 27 28 29 30 31 32 33 34) + ) + ) + ) + +(set! (-> *bot-course-table* course 9) *ash4-course*) diff --git a/test/decompiler/reference/jak2/levels/city/kid_escort/crocesc-h_REF.gc b/test/decompiler/reference/jak2/levels/city/kid_escort/crocesc-h_REF.gc index d6d11e0ce9..95ce82f917 100644 --- a/test/decompiler/reference/jak2/levels/city/kid_escort/crocesc-h_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/kid_escort/crocesc-h_REF.gc @@ -15,20 +15,20 @@ :size-assert #x410 :flag-assert #xef03900410 (:methods - (crocadog-escort-method-225 () none 225) - (crocadog-escort-method-226 () none 226) - (crocadog-escort-method-227 () none 227) - (crocadog-escort-method-228 () none 228) - (crocadog-escort-method-229 () none 229) - (crocadog-escort-method-230 () none 230) - (crocadog-escort-method-231 () none 231) - (crocadog-escort-method-232 () none 232) - (crocadog-escort-method-233 () none 233) - (crocadog-escort-method-234 () none 234) - (crocadog-escort-method-235 () none 235) - (crocadog-escort-method-236 () none 236) - (crocadog-escort-method-237 () none 237) - (crocadog-escort-method-238 () none 238) + (traveling () _type_ :state 225) + (traveling-blocked () _type_ :state 226) + (waiting-idle () _type_ :state 227) + (waiting-turn () _type_ :state 228) + (move-to-vehicle () _type_ :state 229) + (board-vehicle () _type_ :state 230) + (ride-vehicle () _type_ :state 231) + (exit-vehicle () _type_ :state 232) + (knocked-off-vehicle () _type_ :state 233) + (want-exit-vehicle? (_type_ vector) symbol 234) + (go-idle-or-move (_type_) none 235) + (go-waiting-turn (_type_) none 236) + (check-vehicle-exit (_type_) none 237) + (play-walk-anim (_type_) none 238) ) ) @@ -61,10 +61,10 @@ ;; definition of type crocesct-wait-spot (deftype crocesct-wait-spot (ai-task) - ((check-done basic :offset 32) - (which-spot int8 :offset 36) - (num-spots uint8 :offset 37) - (spot-indexes int8 6 :offset 38) + ((check-done (function crocesct-wait-spot crocadog-escort symbol) :offset 32) + (which-spot int8 :offset 36) + (num-spots uint8 :offset 37) + (spot-indexes uint8 6 :offset 38) ) :method-count-assert 12 :size-assert #x30 diff --git a/test/decompiler/reference/jak2/levels/city/kid_escort/crocesc-states_REF.gc b/test/decompiler/reference/jak2/levels/city/kid_escort/crocesc-states_REF.gc new file mode 100644 index 0000000000..4aaaed8c09 --- /dev/null +++ b/test/decompiler/reference/jak2/levels/city/kid_escort/crocesc-states_REF.gc @@ -0,0 +1,1079 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(defstate waiting-idle (crocadog-escort) + :virtual #t + :event (the-as + (function process int symbol event-message-block object :behavior crocadog-escort) + enemy-event-handler + ) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (nav-enemy-method-167 self) + (let ((v1-7 self)) + (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (vector-reset! (-> self root-override2 transv)) + (look-at-target! self (enemy-flag lock-focus)) + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + :trans (behavior () + (bot-method-223 self #f) + (if (and (-> self focus-info fproc) (>= (fabs (-> self focus-info ry-diff)) 9102.223)) + (go-waiting-turn self) + ) + (when (not (logtest? (-> self focus-status) (focus-status grabbed))) + (cond + ((logtest? (-> self bot-flags) (bot-flags bf15)) + (go-virtual move-to-vehicle) + ) + ((not (outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #f)) + (go-virtual traveling) + ) + ) + ) + (none) + ) + :code (behavior () + (let ((gp-0 (get-rand-int self 4))) + (until #f + (let ((a2-0 (ash 1 gp-0))) + (if (= gp-0 3) + (set! a2-0 (logior a2-0 4)) + ) + (set! gp-0 (enemy-method-120 self 4 a2-0)) + ) + (let ((v1-7 gp-0)) + (cond + ((zero? v1-7) + (let ((v1-10 (ja-group))) + (cond + ((and v1-10 (= v1-10 (-> self draw art-group data 3))) + (ja-no-eval :num! (seek! max 0.5)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + ) + (else + (ja-channel-push! 1 (seconds 0.1)) + ) + ) + ) + (let ((s5-0 (get-rand-int-range self 3 7))) + (dotimes (s4-0 s5-0) + (ja-no-eval :group! (-> self draw art-group data 3) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) frames num-frames) -1)) 0.5) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 0.5)) + ) + ) + ) + ) + ((= v1-7 1) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 6) :num! (seek! (ja-aframe 3.0 0) 0.5) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 3.0 0) 0.5)) + ) + (ja-no-eval :group! (-> self draw art-group data 6) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 6)) frames num-frames) -1)) 0.33) + :frame-num (ja-aframe 3.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 0.33)) + ) + ) + ((= v1-7 2) + (let ((v1-90 (ja-group))) + (cond + ((and v1-90 (= v1-90 (-> self draw art-group data 5))) + (ja-no-eval :num! (seek! max 0.5)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + ) + (else + (ja-channel-push! 1 (seconds 0.1)) + ) + ) + ) + (let ((s5-4 (get-rand-int-range self 5 7))) + (dotimes (s4-1 s5-4) + (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)) 0.5) + :frame-num (ja-aframe 2.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 0.5)) + ) + ) + ) + ) + (else + (let ((v1-132 (ja-group))) + (cond + ((and v1-132 (= v1-132 (-> self draw art-group data 4))) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + ) + (else + (ja-channel-push! 1 (seconds 0.1)) + ) + ) + ) + (let ((s5-5 (get-rand-int-range self 3 7))) + (dotimes (s4-2 s5-5) + (ja-no-eval :group! (-> self draw art-group data 4) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 4)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + ) + ) + ) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior crocadog-escort) nav-enemy-simple-post) + ) + +;; failed to figure out what this is: +(defstate waiting-turn (crocadog-escort) + :virtual #t + :event (the-as + (function process int symbol event-message-block object :behavior crocadog-escort) + enemy-event-handler + ) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (nav-enemy-method-167 self) + (let ((v1-7 self)) + (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (look-at-target! self (enemy-flag lock-focus)) + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + :trans (behavior () + (bot-method-223 self #f) + (when (not (logtest? (-> self focus-status) (focus-status grabbed))) + (if (and (not (outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #f)) + (zero? (logand (-> self bot-flags) (bot-flags bf15))) + ) + (go-virtual traveling) + ) + ) + (none) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 9) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 9)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (go-idle-or-move self) + (none) + ) + :post (behavior () + (seek-toward-heading-vec! + (-> self root-override2) + (-> self focus-info bullseye-xz-dir) + 49152.0 + (seconds 0.05) + ) + (nav-enemy-simple-post) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate traveling (crocadog-escort) + :virtual #t + :event (the-as + (function process int symbol event-message-block object :behavior crocadog-escort) + enemy-event-handler + ) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) + ) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag36) (-> v1-2 enemy-flags)))) + (set! (-> v1-2 nav callback-info) (-> v1-2 enemy-info-override callback-info)) + ) + 0 + (let ((v1-5 self)) + (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-5 enemy-flags)))) + ) + 0 + (stop-looking-at-target! self) + (nav-enemy-method-166 self) + (set! (-> self player-blocking) 0.0) + (none) + ) + :trans (behavior () + (bot-method-223 self #f) + (cond + ((logtest? (-> self bot-flags) (bot-flags bf15)) + (go-virtual move-to-vehicle) + ) + ((outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #t) + (go-idle-or-move self) + ) + ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) + (go-virtual traveling-blocked) + ) + ((and (nav-enemy-method-163 self) + (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + ) + (go-stare2 self) + ) + ) + 0 + (none) + ) + :code (behavior () + (until #f + (play-walk-anim self) + (suspend) + ) + #f + (none) + ) + :post (behavior () + (let ((a0-0 (-> self nav state)) + (v1-1 (-> self spot)) + ) + (logclear! (-> a0-0 flags) (nav-state-flag directional-mode)) + (logior! (-> a0-0 flags) (nav-state-flag target-poly-dirty)) + (set! (-> a0-0 target-post quad) (-> v1-1 center quad)) + ) + 0 + (nav-enemy-travel-post) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate move-to-vehicle (crocadog-escort) + :virtual #t + :event (the-as + (function process int symbol event-message-block object :behavior crocadog-escort) + enemy-event-handler + ) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) + ) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag36) (-> v1-2 enemy-flags)))) + (set! (-> v1-2 nav callback-info) (-> v1-2 enemy-info-override callback-info)) + ) + 0 + (let ((v1-5 self)) + (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-5 enemy-flags)))) + ) + 0 + (stop-looking-at-target! self) + (nav-enemy-method-166 self) + (set! (-> self player-blocking) 0.0) + (none) + ) + :trans (behavior () + (bot-method-223 self #f) + (let ((gp-0 (handle->process (-> self vehicle-handle)))) + (cond + ((or (not gp-0) + (logtest? (-> (the-as vehicle gp-0) flags) (rigid-body-object-flag dead)) + (not (logtest? (-> self bot-flags) (bot-flags bf15))) + (< (-> self vehicle-seat-index) 0) + ) + (logclear! (-> self bot-flags) (bot-flags bf15)) + (go-idle-or-move self) + ) + ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) + (go-virtual traveling-blocked) + ) + ((and (nav-enemy-method-163 self) + (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + ) + (go-stare2 self) + ) + ) + (let ((s5-0 (new 'stack-no-clear 'inline-array 'matrix 2))) + (compute-seat-position (the-as vehicle gp-0) (the-as vector (-> s5-0 0)) (-> self vehicle-seat-index)) + (set! (-> s5-0 0 vector 1 quad) (-> self root-override2 trans quad)) + (set! (-> s5-0 0 trans quad) (-> s5-0 0 quad 0)) + (vector-! + (the-as vector (-> s5-0 1)) + (the-as vector (-> s5-0 0)) + (-> (the-as vehicle gp-0) root-override-2 trans) + ) + (vector-z-quaternion! (-> s5-0 0 vector 2) (-> self root-override2 quat)) + (let ((f30-1 (* 0.5 (vector-vector-xz-distance (-> s5-0 0 vector 1) (-> s5-0 0 trans))))) + (vector-normalize! (-> s5-0 0 vector 2) (* 2.0 f30-1)) + (vector-normalize! (the-as vector (-> s5-0 1)) (* 4.0 f30-1)) + ) + (bot-method-181 + self + (-> s5-0 1 vector 1) + (-> s5-0 0 vector 1) + (-> s5-0 0 vector 2) + (-> s5-0 0 trans) + (the-as vector (-> s5-0 1)) + 0.8 + ) + (let ((a0-26 (-> self nav state)) + (v1-47 (-> s5-0 1 vector 1)) + ) + (logclear! (-> a0-26 flags) (nav-state-flag directional-mode)) + (logior! (-> a0-26 flags) (nav-state-flag target-poly-dirty)) + (set! (-> a0-26 target-post quad) (-> v1-47 quad)) + ) + 0 + (if (and (< (vector-vector-xz-distance (the-as vector (-> s5-0 0)) (-> self root-override2 trans)) 17203.2) + (< (fabs (- (-> s5-0 0 vector 0 y) (-> self root-override2 trans y))) 20480.0) + ) + (go-virtual board-vehicle) + ) + ) + ) + (none) + ) + :code (behavior () + (until #f + (play-walk-anim self) + (suspend) + ) + #f + (none) + ) + :post (the-as (function none :behavior crocadog-escort) nav-enemy-travel-post) + ) + +;; failed to figure out what this is: +(defstate board-vehicle (crocadog-escort) + :virtual #t + :event (the-as + (function process int symbol event-message-block object :behavior crocadog-escort) + enemy-event-handler + ) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (let ((v1-5 self)) + (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (let ((gp-0 (handle->process (-> self vehicle-handle)))) + (when (or (not (logtest? (-> self bot-flags) (bot-flags bf15))) (< (-> self vehicle-seat-index) 0)) + (logclear! (-> self bot-flags) (bot-flags bf15)) + (go-idle-or-move self) + ) + (let* ((s5-0 (handle->process (-> self kid-handle))) + (a2-0 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (if a2-0 + (put-rider-in-seat (the-as vehicle gp-0) (-> self vehicle-seat-index) (the-as process-focusable a2-0)) + ) + ) + ) + (set! (-> self focus-status) (logior (focus-status pilot) (-> self focus-status))) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logior! (-> self focus-status) (focus-status disable)) + (logclear! (-> self focus-status) (focus-status arrestable)) + (logclear! (-> self bot-flags) (bot-flags bf15)) + (none) + ) + :exit (behavior () + (local-vars (v1-6 enemy-flag)) + (logior! (-> self root-override2 nav-flags) (nav-flags has-root-sphere)) + (logclear! (-> self focus-status) (focus-status disable)) + (let ((v1-5 (-> self enemy-flags))) + (if (logtest? v1-5 (enemy-flag checking-water)) + (set! v1-6 (logior v1-5 (enemy-flag enable-on-active))) + (set! v1-6 (logclear v1-5 (enemy-flag enable-on-active))) + ) + ) + (set! (-> self enemy-flags) v1-6) + (logclear! (-> self bot-flags) (bot-flags bf15)) + (none) + ) + :trans (behavior () + (check-vehicle-exit self) + (none) + ) + :code (behavior () + (local-vars (sv-128 float)) + (ja-channel-push! 1 (seconds 0.1)) + (let ((gp-0 (new 'stack-no-clear 'matrix))) + (ja-no-eval :group! (-> self draw art-group data 10) + :num! (seek! (ja-aframe 1.0 0) 0.5) + :frame-num (ja-aframe 0.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 1.0 0) 0.5)) + ) + (let ((s5-2 (new 'stack-no-clear 'vector))) + (set! (-> s5-2 quad) (-> self root-override2 trans quad)) + (let ((s4-0 (quaternion-copy! (new 'stack-no-clear 'quaternion) (-> self root-override2 quat)))) + (ja-no-eval :group! (-> self draw art-group data 10) + :num! (seek! (ja-aframe 5.0 0) 0.5) + :frame-num (ja-aframe 1.0 0) + ) + (until (ja-done? 0) + (let ((s3-1 (handle->process (-> self vehicle-handle)))) + (quaternion-copy! (the-as quaternion (-> gp-0 vector 2)) (-> (the-as vehicle s3-1) root-override-2 quat)) + (compute-seat-position (the-as vehicle s3-1) (the-as vector (-> gp-0 vector)) (-> self vehicle-seat-index)) + ) + (vector-! (-> gp-0 vector 1) (the-as vector (-> gp-0 vector)) s5-2) + (let ((s3-2 lerp-scale) + (s2-0 0.0) + (s1-0 1.0) + (s0-0 (ja-aframe-num 0)) + ) + (set! sv-128 (ja-aframe 1.0 0)) + (let* ((t0-0 (ja-aframe 4.0 0)) + (f30-0 (s3-2 s2-0 s1-0 s0-0 sv-128 t0-0)) + ) + (quaternion-rotate-local-y! + (the-as quaternion (-> gp-0 vector 2)) + (the-as quaternion (-> gp-0 vector 2)) + (* f30-0 (if (zero? (-> self vehicle-seat-index)) + -16384.0 + 16384.0 + ) + ) + ) + (quaternion-slerp! (-> self root-override2 quat) s4-0 (the-as quaternion (-> gp-0 vector 2)) f30-0) + (vector+float*! (-> self root-override2 trans) s5-2 (-> gp-0 vector 1) f30-0) + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 5.0 0) 0.5)) + ) + ) + ) + (let ((s5-3 (new 'stack-no-clear 'vector))) + (set! (-> s5-3 quad) (-> self root-override2 trans quad)) + (ja-no-eval :group! (-> self draw art-group data 10) + :num! (seek! (ja-aframe 7.0 0) 0.5) + :frame-num (ja-aframe 5.0 0) + ) + (until (ja-done? 0) + (let ((s4-2 (handle->process (-> self vehicle-handle)))) + (quaternion-copy! (-> self root-override2 quat) (-> (the-as vehicle s4-2) root-override-2 quat)) + (quaternion-rotate-local-y! + (-> self root-override2 quat) + (-> self root-override2 quat) + (if (zero? (-> self vehicle-seat-index)) + -16384.0 + 16384.0 + ) + ) + (vector-matrix*! + (the-as vector (-> gp-0 vector)) + (-> self local-seat-pos) + (-> (the-as vehicle s4-2) node-list data 0 bone transform) + ) + ) + (vector-! (-> gp-0 vector 1) (the-as vector (-> gp-0 vector)) s5-3) + (let ((f0-16 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 5.0 0) (ja-aframe 7.0 0)))) + (vector+float*! (-> self root-override2 trans) s5-3 (-> gp-0 vector 1) f0-16) + ) + (suspend) + (ja :num! (seek! (ja-aframe 7.0 0) 0.5)) + ) + ) + (quaternion-copy! (new 'stack-no-clear 'quaternion) (-> self root-override2 quat)) + (ja-no-eval :group! (-> self draw art-group data 10) + :num! (seek! (ja-aframe 12.0 0) 0.5) + :frame-num (ja-aframe 7.0 0) + ) + (until (ja-done? 0) + (let ((s5-5 (handle->process (-> self vehicle-handle)))) + (quaternion-copy! (the-as quaternion (-> gp-0 vector 2)) (-> (the-as vehicle s5-5) root-override-2 quat)) + (vector-matrix*! + (-> self root-override2 trans) + (-> self local-seat-pos) + (-> (the-as vehicle s5-5) node-list data 0 bone transform) + ) + ) + (let ((f0-22 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 7.0 0) (ja-aframe 9.0 0)))) + (quaternion-rotate-local-y! + (-> self root-override2 quat) + (the-as quaternion (-> gp-0 vector 2)) + (* (- 1.0 f0-22) (if (zero? (-> self vehicle-seat-index)) + -16384.0 + 16384.0 + ) + ) + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 12.0 0) 0.5)) + ) + ) + (set! (-> self focus-status) (logior (focus-status pilot-riding pilot) (-> self focus-status))) + (go-virtual ride-vehicle) + (none) + ) + :post (the-as (function none :behavior crocadog-escort) nav-enemy-simple-post) + ) + +;; failed to figure out what this is: +(defstate ride-vehicle (crocadog-escort) + :virtual #t + :event (the-as + (function process int symbol event-message-block object :behavior crocadog-escort) + enemy-event-handler + ) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (let ((v1-5 self)) + (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self root-override2 nav-flags) (nav-flags has-root-sphere)) + (let ((v1-11 (-> self nav))) + (logclear! (-> v1-11 shape nav-flags) (nav-flags has-extra-sphere)) + ) + 0 + (set! (-> self focus-status) (logior (focus-status disable pilot-riding pilot) (-> self focus-status))) + (set! (-> self anim-speed) 0.0) + (none) + ) + :exit (behavior () + (local-vars (v1-4 enemy-flag)) + (logior! (-> self root-override2 nav-flags) (nav-flags has-root-sphere)) + (let ((v1-3 (-> self enemy-flags))) + (if (logtest? v1-3 (enemy-flag checking-water)) + (set! v1-4 (logior v1-3 (enemy-flag enable-on-active))) + (set! v1-4 (logclear v1-3 (enemy-flag enable-on-active))) + ) + ) + (set! (-> self enemy-flags) v1-4) + (logclear! (-> self bot-flags) (bot-flags bf15)) + (none) + ) + :trans (behavior () + (check-vehicle-exit self) + 0.0 + (when (logtest? (-> self focus-status) (focus-status pilot-riding)) + (let ((s5-0 (handle->process (-> self vehicle-handle))) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (quaternion-copy! (-> self root-override2 quat) (-> (the-as vehicle s5-0) root-override-2 quat)) + (set! (-> gp-0 quad) (-> self root-override2 trans quad)) + (vector-matrix*! + (-> self root-override2 trans) + (-> self local-seat-pos) + (-> (the-as vehicle s5-0) node-list data 0 bone transform) + ) + (let* ((f0-2 (* (vector-vector-distance (-> self root-override2 trans) gp-0) (-> self clock frames-per-second))) + (f0-3 (lerp-scale 0.3 1.2 f0-2 0.0 81920.0)) + ) + (seek! (-> self anim-speed) f0-3 (* 2.0 (-> self clock seconds-per-frame))) + ) + ) + ) + (if (and (logtest? (bot-flags bf16) (-> self bot-flags)) (want-exit-vehicle? self (-> self exit-vehicle-dest))) + (go-virtual exit-vehicle) + ) + (none) + ) + :code (behavior () + (until #f + (ja-no-eval :group! (-> self draw art-group data 11) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 11)) frames num-frames) -1)) + (-> self anim-speed) + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max (-> self anim-speed))) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior crocadog-escort) nav-enemy-simple-post) + ) + +;; failed to figure out what this is: +(defstate exit-vehicle (crocadog-escort) + :virtual #t + :event (the-as + (function process int symbol event-message-block object :behavior crocadog-escort) + enemy-event-handler + ) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (let ((v1-5 self)) + (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logior! (-> self root-override2 nav-flags) (nav-flags has-root-sphere)) + (logior! (-> self focus-status) (focus-status disable)) + (none) + ) + :exit (behavior () + (local-vars (v1-11 enemy-flag)) + (set! (-> self vehicle-seat-index) -1) + (set! (-> self vehicle-handle) (the-as handle #f)) + (logclear! (-> self bot-flags) (bot-flags bf16)) + (logclear! (-> self focus-status) (focus-status pilot-riding pilot)) + (let ((v1-5 (-> self nav))) + (logclear! (-> v1-5 shape nav-flags) (nav-flags has-extra-sphere)) + ) + 0 + (logclear! (-> self focus-status) (focus-status disable)) + (let ((v1-10 (-> self enemy-flags))) + (if (logtest? v1-10 (enemy-flag checking-water)) + (set! v1-11 (logior v1-10 (enemy-flag enable-on-active))) + (set! v1-11 (logclear v1-10 (enemy-flag enable-on-active))) + ) + ) + (set! (-> self enemy-flags) v1-11) + (logclear! (-> self bot-flags) (bot-flags bf15)) + (none) + ) + :trans (behavior () + (check-vehicle-exit self) + (when (logtest? (-> self focus-status) (focus-status pilot-riding)) + (let ((gp-0 (handle->process (-> self vehicle-handle)))) + (quaternion-copy! (-> self root-override2 quat) (-> (the-as vehicle gp-0) root-override-2 quat)) + (vector-matrix*! + (-> self root-override2 trans) + (-> self local-seat-pos) + (-> (the-as vehicle gp-0) node-list data 0 bone transform) + ) + ) + ) + (none) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.1)) + (let ((gp-0 (new 'stack-no-clear 'inline-array 'matrix 2))) + (ja-no-eval :group! (-> self draw art-group data 10) + :num! (seek! (ja-aframe 7.0 0) 0.25) + :frame-num (ja-aframe 12.0 0) + ) + (until (ja-done? 0) + (let ((s5-1 (handle->process (-> self vehicle-handle)))) + (quaternion-copy! (-> self root-override2 quat) (-> (the-as vehicle s5-1) root-override-2 quat)) + (vector-matrix*! + (-> self root-override2 trans) + (-> self local-seat-pos) + (-> (the-as vehicle s5-1) node-list data 0 bone transform) + ) + ) + (let ((f0-3 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 9.0 0) (ja-aframe 7.0 0)))) + (quaternion-rotate-local-y! + (-> self root-override2 quat) + (-> self root-override2 quat) + (* f0-3 (if (zero? (-> self vehicle-seat-index)) + 16384.0 + -16384.0 + ) + ) + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 7.0 0) 0.25)) + ) + (set! (-> gp-0 0 vector 1 quad) (-> self root-override2 trans quad)) + (ja-no-eval :group! (-> self draw art-group data 10) + :num! (seek! (ja-aframe 5.0 0) 0.5) + :frame-num (ja-aframe 7.0 0) + ) + (until (ja-done? 0) + (let ((s5-5 (handle->process (-> self vehicle-handle)))) + (quaternion-copy! (-> self root-override2 quat) (-> (the-as vehicle s5-5) root-override-2 quat)) + (quaternion-rotate-local-y! + (-> self root-override2 quat) + (-> self root-override2 quat) + (if (zero? (-> self vehicle-seat-index)) + 16384.0 + -16384.0 + ) + ) + (compute-seat-position (the-as vehicle s5-5) (the-as vector (-> gp-0 0)) (-> self vehicle-seat-index)) + ) + (vector-! (-> gp-0 0 trans) (the-as vector (-> gp-0 0)) (-> gp-0 0 vector 1)) + (let ((f0-10 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 7.0 0) (ja-aframe 5.0 0)))) + (vector+float*! (-> self root-override2 trans) (-> gp-0 0 vector 1) (-> gp-0 0 trans) f0-10) + ) + (suspend) + (ja :num! (seek! (ja-aframe 5.0 0) 0.5)) + ) + (logclear! (-> self focus-status) (focus-status pilot-riding)) + (set! (-> gp-0 0 quad 0) (-> self root-override2 trans quad)) + (ja-no-eval :group! (-> self draw art-group data 10) + :num! (seek! (ja-aframe 0.0 0)) + :frame-num (ja-aframe 5.0 0) + ) + (until (ja-done? 0) + (let ((s5-9 (handle->process (-> self vehicle-handle)))) + (compute-seat-position (the-as vehicle s5-9) (the-as vector (-> gp-0 0)) (-> self vehicle-seat-index)) + (quaternion-rotate-local-y! + (the-as quaternion (-> gp-0 1)) + (-> (the-as vehicle s5-9) root-override-2 quat) + (if (zero? (-> self vehicle-seat-index)) + -49152.0 + 49152.0 + ) + ) + ) + (let ((s5-10 (-> self root-override2 quat))) + (let ((f30-0 (quaternion-y-angle (the-as quaternion (-> gp-0 1))))) + (quaternion-identity! s5-10) + (quaternion-rotate-y! s5-10 s5-10 f30-0) + ) + (let ((f0-16 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 5.0 0) (ja-aframe 1.0 0)))) + (quaternion-slerp! s5-10 (the-as quaternion (-> gp-0 1)) s5-10 f0-16) + ) + ) + (want-exit-vehicle? self (-> self exit-vehicle-dest)) + (let* ((v1-79 (-> self nav)) + (a1-40 (-> self exit-vehicle-dest)) + (f0-17 (-> v1-79 extra-nav-sphere w)) + ) + (set! (-> v1-79 extra-nav-sphere quad) (-> a1-40 quad)) + (set! (-> v1-79 extra-nav-sphere w) f0-17) + ) + 0 + (let ((v1-82 (-> self nav))) + (set! (-> v1-82 extra-nav-sphere w) (-> self nav-radius-backup)) + ) + 0 + (let ((v1-84 (-> self nav))) + (logior! (-> v1-84 shape nav-flags) (nav-flags has-extra-sphere)) + ) + 0 + (vector-! (-> gp-0 0 trans) (the-as vector (-> gp-0 0)) (-> self exit-vehicle-dest)) + (let ((f0-19 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 1.0 0) (ja-aframe 5.0 0)))) + (vector+float*! (-> self root-override2 trans) (-> self exit-vehicle-dest) (-> gp-0 0 trans) f0-19) + ) + (suspend) + (ja :num! (seek! (ja-aframe 0.0 0))) + ) + ) + (react-to-focus self) + (none) + ) + :post (the-as (function none :behavior crocadog-escort) nav-enemy-simple-post) + ) + +;; failed to figure out what this is: +(defstate traveling-blocked (crocadog-escort) + :virtual #t + :event (the-as + (function process int symbol event-message-block object :behavior crocadog-escort) + enemy-event-handler + ) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (nav-enemy-method-167 self) + (let ((v1-7 self)) + (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (vector-reset! (-> self root-override2 transv)) + (look-at-target! self (enemy-flag lock-focus)) + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + :trans (behavior () + (bot-method-223 self #f) + (if (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) + (go-virtual traveling) + ) + (none) + ) + :code (-> (method-of-type crocadog-escort waiting-idle) code) + :post (the-as (function none :behavior crocadog-escort) nav-enemy-simple-post) + ) + +;; failed to figure out what this is: +(defstate stare (crocadog-escort) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type bot stare) enter))) + (if t9-0 + (t9-0) + ) + ) + (let ((v1-4 self)) + (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + :trans (behavior () + (bot-method-223 self #f) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (if (not (nav-enemy-method-163 self)) + (go-virtual traveling) + ) + ) + (none) + ) + :code (-> (method-of-type crocadog-escort waiting-idle) code) + ) + +;; failed to figure out what this is: +(defstate hit (crocadog-escort) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type bot hit) enter))) + (if t9-0 + (t9-0) + ) + ) + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + :code (behavior () + (local-vars (v1-7 enemy-flag) (v1-15 enemy-flag)) + (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logior! (-> self focus-status) (focus-status dangerous)) + (logclear! (-> self focus-status) (focus-status dangerous)) + ) + (let ((v1-6 (-> self enemy-flags))) + (if (logtest? v1-6 (enemy-flag checking-water)) + (set! v1-7 (logior v1-6 (enemy-flag enable-on-active))) + (set! v1-7 (logclear v1-6 (enemy-flag enable-on-active))) + ) + ) + (set! (-> self enemy-flags) v1-7) + (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (set! (-> self mask) (logior (process-mask collectable) (-> self mask))) + (logclear! (-> self mask) (process-mask collectable)) + ) + (let ((v1-14 (-> self enemy-flags))) + (if (logtest? (enemy-flag no-initial-move-to-ground) v1-14) + (set! v1-15 (logior (enemy-flag check-water-backup) v1-14)) + (set! v1-15 (logclear v1-14 (enemy-flag check-water-backup))) + ) + ) + (set! (-> self enemy-flags) v1-15) + (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self focus-status) (focus-status hit)) + (react-to-focus self) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate knocked (crocadog-escort) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type bot knocked) enter))) + (if t9-0 + (t9-0) + ) + ) + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate die-falling (crocadog-escort) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type bot die-falling) enter))) + (if t9-0 + (t9-0) + ) + ) + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + :code (behavior () + 0.0 + (until #f + (if (and (logtest? (-> self bot-flags) (bot-flags failed)) + (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (reset? *fail-mission-control*) + ) + (reset! *fail-mission-control*) + ) + (cond + ((zero? (get-rand-int self 3)) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 6) :num! (seek! (ja-aframe 3.0 0) 0.5) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 3.0 0) 0.5)) + ) + (ja-no-eval :group! (-> self draw art-group data 6) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 6)) frames num-frames) -1)) 0.33) + :frame-num (ja-aframe 3.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 0.33)) + ) + ) + (else + (ja-channel-push! 1 (seconds 0.1)) + (let ((f30-0 (get-rand-float-range self 0.4 0.6))) + (ja-no-eval :group! (-> self draw art-group data 14) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 14)) frames num-frames) -1)) + f30-0 + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max f30-0)) + ) + ) + ) + ) + ) + #f + (none) + ) + ) + +;; failed to figure out what this is: +(defstate failed (crocadog-escort) + :virtual #t + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (nav-enemy-method-167 self) + (let ((v1-7 self)) + (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (vector-reset! (-> self root-override2 transv)) + (stop-looking-at-target! self) + (set! (-> self travel-anim-interp) 0.0) + (logior! (-> self bot-flags) (bot-flags bf09)) + (logclear! (-> self bot-flags) (bot-flags bf19)) + (none) + ) + :trans (behavior () + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (not (logtest? (bot-flags bf19) (-> self bot-flags))) + (set! (-> self bot-flags) (logior (bot-flags bf19) (-> self bot-flags))) + (fail-mission! self) + ) + (fail-falling self) + ) + (none) + ) + :code (-> (method-of-type crocadog-escort die-falling) code) + ) + +;; failed to figure out what this is: +(defstate knocked-off-vehicle (crocadog-escort) + :virtual #t + :event (the-as + (function process int symbol event-message-block object :behavior crocadog-escort) + enemy-event-handler + ) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (nav-enemy-method-167 self) + (let ((v1-7 self)) + (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (vector-reset! (-> self root-override2 transv)) + (stop-looking-at-target! self) + (logior! (-> self bot-flags) (bot-flags bf09)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> self focus-status) (focus-status dangerous)) + (logclear! (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self mask) (process-mask collectable)) + (logclear! (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> self mask) (process-mask actor-pause)) + (logclear! (-> self enemy-flags) (enemy-flag notice)) + (logclear! (-> self focus-status) (focus-status disable)) + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + :code (-> (method-of-type crocadog-escort waiting-idle) code) + :post (the-as (function none :behavior crocadog-escort) nav-enemy-simple-post) + ) diff --git a/test/decompiler/reference/jak2/levels/city/kid_escort/crocesc-task_REF.gc b/test/decompiler/reference/jak2/levels/city/kid_escort/crocesc-task_REF.gc new file mode 100644 index 0000000000..57429087c4 --- /dev/null +++ b/test/decompiler/reference/jak2/levels/city/kid_escort/crocesc-task_REF.gc @@ -0,0 +1,49 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 9 of type crocesct-wait-spot +;; WARN: Return type mismatch int vs none. +(defmethod reset-task! crocesct-wait-spot ((obj crocesct-wait-spot)) + (set! (-> obj check-done) #f) + (set! (-> obj which-spot) -1) + (set! (-> obj num-spots) (the-as uint 0)) + 0 + (none) + ) + +;; definition for method 11 of type crocesct-wait-spot +;; WARN: Return type mismatch symbol vs none. +(defmethod ai-task-method-11 crocesct-wait-spot ((obj crocesct-wait-spot) (arg0 bot)) + (let ((s4-0 (-> obj which-spot))) + (when (>= s4-0 0) + (let ((s3-0 (-> arg0 course spots (-> obj spot-indexes s4-0)))) + (if (and (not (outside-spot-radius? arg0 s3-0 (the-as vector #f) #f)) (player-blocking-spot? arg0 s3-0)) + (set! s4-0 -1) + ) + ) + ) + (when (< s4-0 0) + (set! s4-0 (choose-spot arg0 (the-as int (-> obj num-spots)) (the-as (pointer uint) (-> obj spot-indexes)))) + (set! (-> obj which-spot) s4-0) + (mem-copy! + (the-as pointer (-> arg0 spot)) + (the-as pointer (-> arg0 course spots (-> obj spot-indexes s4-0))) + 20 + ) + ) + (if (logtest? *display-bot-marks* (bot-marks-controls bmc16)) + (bot-debug-draw-spot-sphere + arg0 + (the-as int (-> obj num-spots)) + (the-as (pointer uint) (-> obj spot-indexes)) + (the-as int (-> obj spot-indexes s4-0)) + ) + ) + ) + ((-> obj check-done) obj (the-as crocadog-escort arg0)) + (none) + ) + + + + diff --git a/test/decompiler/reference/jak2/levels/city/kid_escort/crocesc4-course_REF.gc b/test/decompiler/reference/jak2/levels/city/kid_escort/crocesc4-course_REF.gc new file mode 100644 index 0000000000..399e6942f3 --- /dev/null +++ b/test/decompiler/reference/jak2/levels/city/kid_escort/crocesc4-course_REF.gc @@ -0,0 +1,1060 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *crocadog4-course*, type bot-course +(define *crocadog4-course* + (new 'static 'bot-course + :course-id #xc + :spot-count #x17 + :default-check-too-far #f + :waypoints (new 'static 'boxed-array :type bot-waypoint + (new 'static 'bot-waypoint + :waypoint-id 1 + :skip-to -1 + :on-set (lambda ((arg0 crocadog-escort)) + (process-entity-status! arg0 (entity-perm-status no-kill) #t) + (clear-speech-flags! arg0) + (logior! (-> arg0 focus-status) (focus-status disable)) + (set! (-> arg0 notice-enemy-dist) 0.0) + (let ((v1-5 (-> arg0 root-override2 root-prim))) + (set! (-> v1-5 prim-core collide-as) (collide-spec)) + (set! (-> v1-5 prim-core collide-with) (collide-spec)) + ) + 0 + (move-to-point! (-> arg0 root-override2) (the-as vector (-> arg0 course spots 0))) + (logclear! (-> arg0 mask) (process-mask actor-pause)) + (logclear! (-> arg0 enemy-flags) (enemy-flag notice)) + (let ((v1-16 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-16 bytes 5) (the-as uint 1)) + (set! (-> v1-16 bytes 6) (the-as uint 0)) + (set! (-> v1-16 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-16) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (< 1 (-> arg1 waypoint-request)) + (let* ((a0-2 (-> arg1 actor-group 0 data 0 actor)) + (v1-4 (if a0-2 + (-> a0-2 extra process) + ) + ) + ) + (when v1-4 + (set! (-> arg1 master-handle) (process->handle v1-4)) + (set! (-> arg1 kid-handle) (-> (the-as hal-escort v1-4) slave-handle 0)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 2 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 2 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (-> arg0 root-override2 root-prim))) + (set! (-> v1-1 prim-core collide-as) (-> arg0 root-override2 backup-collide-as)) + (set! (-> v1-1 prim-core collide-with) (-> arg0 root-override2 backup-collide-with)) + ) + (vector-! (-> arg0 follow-dir) (the-as vector (-> arg0 course spots 2)) (-> arg0 root-override2 trans)) + (vector-normalize! (-> arg0 follow-dir) 1.0) + (send-event (handle->process (-> arg0 master-handle)) 'notify 'follow-dir (-> arg0 follow-dir)) + (let ((v1-14 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-14 bytes 5) (the-as uint 1)) + (set! (-> v1-14 bytes 6) (the-as uint 1)) + (set! (-> v1-14 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-14) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 4 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 4 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 2)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-1) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 5 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 5 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 crocadog-escort)) + (vector-! (-> arg0 follow-dir) (the-as vector (-> arg0 course spots 3)) (-> arg0 root-override2 trans)) + (vector-normalize! (-> arg0 follow-dir) 1.0) + (send-event (handle->process (-> arg0 master-handle)) 'notify 'follow-dir (-> arg0 follow-dir)) + (let ((v1-12 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-12 bytes 5) (the-as uint 1)) + (set! (-> v1-12 bytes 6) (the-as uint 3)) + (set! (-> v1-12 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-12) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 6 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 6 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 crocadog-escort)) + (vector-! (-> arg0 follow-dir) (the-as vector (-> arg0 course spots 7)) (-> arg0 root-override2 trans)) + (vector-normalize! (-> arg0 follow-dir) 1.0) + (send-event (handle->process (-> arg0 master-handle)) 'notify 'follow-dir (-> arg0 follow-dir)) + (let ((v1-12 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-12 bytes 5) (the-as uint 1)) + (set! (-> v1-12 bytes 6) (the-as uint 4)) + (set! (-> v1-12 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-12) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 7 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 7 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 5)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-1) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 8 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 8 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 6)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-1) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 9 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 9 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 crocadog-escort)) + (vector-! (-> arg0 follow-dir) (the-as vector (-> arg0 course spots 12)) (-> arg0 root-override2 trans)) + (vector-normalize! (-> arg0 follow-dir) 1.0) + (send-event (handle->process (-> arg0 master-handle)) 'notify 'follow-dir (-> arg0 follow-dir)) + (let ((v1-12 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-12 bytes 5) (the-as uint 1)) + (set! (-> v1-12 bytes 6) (the-as uint 7)) + (set! (-> v1-12 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-12) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 10 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 10 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 8)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-1) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 11 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 11 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 9)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-1) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 12 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 12 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 10)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-1) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 13 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 13 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 11)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-1) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 14 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 14 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 crocadog-escort)) + (vector-! (-> arg0 follow-dir) (the-as vector (-> arg0 course spots 14)) (-> arg0 root-override2 trans)) + (vector-normalize! (-> arg0 follow-dir) 1.0) + (send-event (handle->process (-> arg0 master-handle)) 'notify 'follow-dir (-> arg0 follow-dir)) + (let ((v1-12 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-12 bytes 5) (the-as uint 1)) + (set! (-> v1-12 bytes 6) (the-as uint 12)) + (set! (-> v1-12 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-12) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 15 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 15 + :nav-mesh-index -1 + :skip-to #x13 + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 13)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-1) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 16 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (-> arg0 root-override2 root-prim))) + (set! (-> v1-1 prim-core collide-as) (-> arg0 root-override2 backup-collide-as)) + (set! (-> v1-1 prim-core collide-with) (-> arg0 root-override2 backup-collide-with)) + ) + (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) + (send-event arg0 'move-trans (-> arg0 course spots 12)) + (vector-! (-> arg0 follow-dir) (the-as vector (-> arg0 course spots 14)) (-> arg0 root-override2 trans)) + (vector-normalize! (-> arg0 follow-dir) 1.0) + (send-event (handle->process (-> arg0 master-handle)) 'notify 'follow-dir (-> arg0 follow-dir)) + (none) + ) + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 16 + :nav-mesh-index -1 + :skip-to #x13 + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-3 (-> arg0 actor-group 0 data 0 actor))) + (set! (-> arg0 poi-handle) (-> (the-as bot (if v1-3 + (the-as bot (-> v1-3 extra process)) + ) + ) + vehicle-handle + ) + ) + ) + (let ((v1-7 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-7 bytes 5) (the-as uint 1)) + (set! (-> v1-7 bytes 6) (the-as uint 14)) + (set! (-> v1-7 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-7) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 17 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 17 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 15)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-1) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) (when (logtest? (focus-status pilot) (-> arg1 focus-status)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 18 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 18 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 crocadog-escort)) + (clear-poi-and-focus! arg0) + (let ((v1-3 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-3 bytes 5) (the-as uint 1)) + (set! (-> v1-3 bytes 6) (the-as uint 15)) + (set! (-> v1-3 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-3) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (and (not (logtest? (focus-status pilot) (-> arg1 focus-status))) + (zero? (logand (bot-flags bf17) (-> arg1 bot-flags))) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 19 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 19 + :nav-mesh-index 1 + :skip-to -1 + :on-set (lambda ((arg0 crocadog-escort)) + (let ((a1-0 (-> arg0 course spots))) + (vector-! (-> arg0 follow-dir) (the-as vector (-> a1-0 19)) (the-as vector (-> a1-0 17))) + ) + (vector-normalize! (-> arg0 follow-dir) 1.0) + (send-event (handle->process (-> arg0 master-handle)) 'notify 'follow-dir (-> arg0 follow-dir)) + (let ((v1-12 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-12 bytes 5) (the-as uint 1)) + (set! (-> v1-12 bytes 6) (the-as uint 17)) + (set! (-> v1-12 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-12) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 21 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (-> arg0 root-override2 root-prim))) + (set! (-> v1-1 prim-core collide-as) (-> arg0 root-override2 backup-collide-as)) + (set! (-> v1-1 prim-core collide-with) (-> arg0 root-override2 backup-collide-with)) + ) + (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) + (send-event arg0 'move-trans (-> arg0 course spots 16)) + (none) + ) + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 21 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 18)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-1) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 22 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 22 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 19)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-1) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 23 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 23 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 crocadog-escort)) + (let ((a1-0 (-> arg0 course spots))) + (vector-! (-> arg0 follow-dir) (the-as vector (-> a1-0 20)) (the-as vector (-> a1-0 19))) + ) + (vector-normalize! (-> arg0 follow-dir) 1.0) + (send-event (handle->process (-> arg0 master-handle)) 'notify 'follow-dir (-> arg0 follow-dir)) + (let ((v1-12 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-12 bytes 5) (the-as uint 1)) + (set! (-> v1-12 bytes 6) (the-as uint 20)) + (set! (-> v1-12 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-12) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 24 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 24 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 21)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-1) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (let* ((s5-0 (handle->process (-> arg1 kid-handle))) + (a0-6 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (or (not a0-6) + (>= 20480.0 + (vector-vector-distance (get-trans (the-as process-focusable a0-6) 0) (-> arg1 root-override2 trans)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 25 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 25 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 crocadog-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 22)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-1) check-done) + (the-as + (function crocesct-wait-spot crocadog-escort symbol) + (lambda ((arg0 object) (arg1 crocadog-escort)) (when (>= (-> arg1 waypoint-request) 26) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 26 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 26 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 crocadog-escort)) + (set! (-> arg0 poi-handle) (-> arg0 kid-handle)) + (set! (-> arg0 focus-mode) 1) + (let ((v1-3 (get-task-by-type (-> arg0 ai-ctrl) crocesct-wait-spot arg0))) + (set! (-> v1-3 bytes 5) (the-as uint 1)) + (set! (-> v1-3 bytes 6) (the-as uint 22)) + (set! (-> v1-3 bytes 4) (the-as uint -1)) + (set! (-> (the-as crocesct-wait-spot v1-3) check-done) + (the-as (function crocesct-wait-spot crocadog-escort symbol) (lambda ((arg0 crocadog-escort)) #f)) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + ) + :spots (new 'static 'inline-array bot-spot 23 + (new 'static 'bot-spot :center (new 'static 'vector :x 4708434.0 :y 33341.44 :z 172400.64 :w 10240.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4712284.0 :y 33341.44 :z 152944.64 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4670955.5 :y 33341.44 :z 107397.12 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4572528.5 :y 33341.44 :z 89006.08 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4531732.5 :y 33341.44 :z 142458.88 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4538245.0 :y 33341.44 :z 256942.08 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4420280.5 :y 33341.44 :z 274104.3 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4404142.0 :y 32358.4 :z 319979.53 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4434084.0 :y 33341.44 :z 381788.16 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4487577.5 :y 33341.44 :z 449167.38 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4472873.0 :y 33341.44 :z 570122.25 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4454113.5 :y 33341.44 :z 694026.25 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4488438.0 :y 33341.44 :z 751697.94 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4579287.0 :y 33341.44 :z 755793.94 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4746608.5 :y 33341.44 :z 711720.94 :w 61440.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4746608.5 :y 33341.44 :z 711720.94 :w 61440.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4101202.0 :y 32768.0 :z 4632617.0 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4164853.8 :y 32727.04 :z 4686848.0 :w 28672.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4245053.5 :y 55951.36 :z 4678983.5 :w 28672.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4424990.5 :y 99409.92 :z 4697743.5 :w 32768.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4433715.0 :y 99328.0 :z 4584571.0 :w 28672.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4429250.5 :y 99328.0 :z 4518748.0 :w 28672.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4501954.5 :y 103874.56 :z 4503347.0 :w 14336.0)) + ) + ) + ) + +;; failed to figure out what this is: +(set! (-> *bot-course-table* course 12) *crocadog4-course*) + + + + diff --git a/test/decompiler/reference/jak2/levels/city/kid_escort/hal4-course_REF.gc b/test/decompiler/reference/jak2/levels/city/kid_escort/hal4-course_REF.gc new file mode 100644 index 0000000000..a8d487de9c --- /dev/null +++ b/test/decompiler/reference/jak2/levels/city/kid_escort/hal4-course_REF.gc @@ -0,0 +1,2091 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type hal4-course +(deftype hal4-course (bot-course) + ((defend-speeches bot-speech-list-shuffle :offset-assert 48) + ) + :method-count-assert 9 + :size-assert #x34 + :flag-assert #x900000034 + ) + +;; definition for method 3 of type hal4-course +(defmethod inspect hal4-course ((obj hal4-course)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tcourse-id: ~D~%" (-> obj course-id)) + (format #t "~1Tspeech-count: ~D~%" (-> obj speech-count)) + (format #t "~1Tspot-count: ~D~%" (-> obj spot-count)) + (format #t "~1Tretry-cookie: ~D~%" (-> obj retry-cookie)) + (format #t "~1Ttoo-far-warn-speeches: ~A~%" (-> obj too-far-warn-speeches)) + (format #t "~1Ttoo-far-fail-speeches: ~A~%" (-> obj too-far-fail-speeches)) + (format #t "~1Tattack-player-speeches: ~A~%" (-> obj attack-player-speeches)) + (format #t "~1Tdefault-check-too-far: ~A~%" (-> obj default-check-too-far)) + (format #t "~1Twaypoints: ~A~%" (-> obj waypoints)) + (format #t "~1Tspeeches: #x~X~%" (-> obj speeches)) + (format #t "~1Tspeech-tunings: #x~X~%" (-> obj speech-tunings)) + (format #t "~1Tdirs: #x~X~%" (-> obj dirs)) + (format #t "~1Tspots: #x~X~%" (-> obj spots)) + (format #t "~1Tdefend-speeches: ~A~%" (-> obj defend-speeches)) + (label cfg-4) + obj + ) + +;; definition of type hal-escort +(deftype hal-escort (hal) + ((hal4-course hal4-course :offset 652) + (arrow-handle handle :offset 1032) + (arrestor-handle handle :offset-assert 1040) + (arrestor-time time-frame :offset-assert 1048) + (locked-player-time time-frame :offset-assert 1056) + (dont-fail-until time-frame :offset-assert 1064) + (played-defend-time time-frame :offset-assert 1072) + (played-get-in-time time-frame :offset-assert 1080) + (notice-plane plane :inline :offset-assert 1088) + ) + :heap-base #x3d0 + :method-count-assert 237 + :size-assert #x450 + :flag-assert #xed03d00450 + (:methods + (hal-escort-method-227 (_type_) symbol 227) + (hal-escort-method-228 (_type_) symbol 228) + (try-enter-vehicle (_type_) int 229) + (hal-escort-method-230 (_type_) symbol 230) + (init-traffic-params! (_type_ symbol) none 231) + (hal-escort-method-232 (_type_) none 232) + (set-traffic-danger! (_type_) none 233) + (hal-escort-method-234 (_type_ nav-mesh) process 234) + (hal-escort-method-235 (_type_) none 235) + (vehicle-destroyed? (_type_) symbol 236) + ) + ) + +;; definition for method 3 of type hal-escort +(defmethod inspect hal-escort ((obj hal-escort)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type hal inspect))) + (t9-0 obj) + ) + (format #t "~2Tvehicle-handle: ~D~%" (-> obj vehicle-handle)) + (format #t "~2Tarrow-handle: ~D~%" (-> obj arrow-handle)) + (format #t "~2Tarrestor-handle: ~D~%" (-> obj arrestor-handle)) + (format #t "~2Tarrestor-time: ~D~%" (-> obj arrestor-time)) + (format #t "~2Tlocked-player-time: ~D~%" (-> obj locked-player-time)) + (format #t "~2Tdont-fail-until: ~D~%" (-> obj dont-fail-until)) + (format #t "~2Tplayed-defend-time: ~D~%" (-> obj played-defend-time)) + (format #t "~2Tplayed-get-in-time: ~D~%" (-> obj played-get-in-time)) + (format #t "~2Tnotice-plane: #~%" (-> obj notice-plane)) + (label cfg-4) + obj + ) + +;; definition for method 116 of type hal-escort +;; WARN: Return type mismatch object vs none. +(defmethod go-idle hal-escort ((obj hal-escort)) + (cond + ((task-node-closed? (game-task-node city-escort-kid-resolution)) + (cleanup-for-death obj) + (go (method-of-object obj die-fast)) + ) + (else + (go (method-of-object obj idle)) + ) + ) + (none) + ) + +;; definition for method 210 of type hal-escort +;; WARN: Return type mismatch int vs none. +(defmethod init! hal-escort ((obj hal-escort)) + "Set defaults for various fields." + (let ((t9-0 (method-of-type hal init!))) + (t9-0 obj) + ) + (set! (-> obj vehicle-handle) (the-as handle #f)) + (set! (-> obj arrestor-handle) (the-as handle #f)) + (set! (-> obj arrow-handle) (the-as handle #f)) + (set! (-> obj too-far-warn-dist-default) 61440.0) + (set! (-> obj too-far-fail-dist-delta-default) 2048000.0) + (set! (-> obj warn-to-fail-timeout) (the-as uint #x1b7740)) + (set! (-> obj warn-min-delay) (the-as uint 1200)) + (set! (-> obj warn-max-delay) (the-as uint 2100)) + 0 + (none) + ) + +;; definition for method 74 of type hal-escort +(defmethod general-event-handler hal-escort ((obj hal-escort) (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" + (with-pp + (case arg2 + (('notify) + (case (-> arg3 param 0) + (('arrest) + (set! (-> obj arrestor-handle) (process->handle (the-as process (-> arg3 param 1)))) + (let ((v0-0 (the-as object (-> pp clock frame-counter)))) + (set! (-> obj arrestor-time) (the-as time-frame v0-0)) + v0-0 + ) + ) + (else + ((method-of-type hal general-event-handler) obj arg0 arg1 arg2 arg3) + ) + ) + ) + (else + ((method-of-type hal general-event-handler) obj arg0 arg1 arg2 arg3) + ) + ) + ) + ) + +;; definition for method 115 of type hal-escort +;; WARN: Return type mismatch int vs none. +(defmethod init-enemy! hal-escort ((obj hal-escort)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" + (let ((t9-0 (method-of-type hal init-enemy!))) + (t9-0 obj) + ) + (set! (-> obj channel) (the-as uint 20)) + 0 + (none) + ) + +;; definition for method 235 of type hal-escort +(defmethod hal-escort-method-235 hal-escort ((obj hal-escort)) + (with-pp + (let* ((s5-0 (handle->process (-> obj arrestor-handle))) + (v1-3 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when v1-3 + (cond + ((>= (- (-> pp clock frame-counter) (-> obj arrestor-time)) (seconds 4)) + (set! (-> obj arrestor-handle) (the-as handle #f)) + ) + ((logtest? (-> (the-as process-focusable v1-3) focus-status) (focus-status hit)) + (when (and (>= (- (-> pp clock frame-counter) (-> obj played-defend-time)) (seconds 6)) + (not (channel-active? obj (the-as uint 0))) + ) + (let ((a1-5 (bot-speech-list-method-9 + (-> obj hal4-course defend-speeches) + obj + (-> obj hal4-course speeches) + (speech-flags) + ) + ) + ) + (when (>= a1-5 0) + (play-speech obj a1-5) + (set! (-> obj played-defend-time) (-> pp clock frame-counter)) + ) + ) + ) + (set! (-> obj arrestor-handle) (the-as handle #f)) + ) + ) + ) + ) + (if (and (not (speech-playing? obj 30)) + (nonzero? (-> obj played-defend-time)) + (>= (- (-> pp clock frame-counter) (-> obj played-defend-time)) (seconds 3)) + (not (channel-active? obj (the-as uint 0))) + ) + (play-speech obj 30) + ) + (none) + ) + ) + +;; definition for method 236 of type hal-escort +(defmethod vehicle-destroyed? hal-escort ((obj hal-escort)) + (let ((v1-1 (handle->process (-> obj vehicle-handle)))) + (or (not v1-1) (logtest? (-> (the-as vehicle v1-1) flags) (rigid-body-object-flag dead))) + ) + ) + +;; definition for method 227 of type hal-escort +(defmethod hal-escort-method-227 hal-escort ((obj hal-escort)) + (with-pp + (let ((s5-0 *target*)) + (when (logtest? (focus-status pilot-riding pilot) (-> s5-0 focus-status)) + (let* ((a0-2 (-> obj actor-group 0 data 1 actor)) + (v1-5 (when a0-2 + (let ((s4-0 (-> a0-2 extra process))) + (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + ) + ) + (when (logtest? (focus-status pilot-riding pilot) (-> (the-as process-focusable v1-5) focus-status)) + (let* ((v1-12 (-> obj actor-group 0 data 2 actor)) + (a0-5 (when v1-12 + (let ((s4-1 (-> v1-12 extra process))) + (if (type? s4-1 process-focusable) + s4-1 + ) + ) + ) + ) + ) + (when (not (logtest? (focus-status pilot-riding pilot) (-> (the-as process-focusable a0-5) focus-status))) + (let ((f0-0 245760.0)) + (and (< (* f0-0 f0-0) + (vector-vector-xz-distance-squared (get-trans (the-as process-focusable a0-5) 0) (get-trans s5-0 0)) + ) + (>= (-> pp clock frame-counter) (-> obj dont-fail-until)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + +;; definition for method 228 of type hal-escort +;; WARN: Return type mismatch object vs symbol. +(defmethod hal-escort-method-228 hal-escort ((obj hal-escort)) + (with-pp + (let* ((v1-3 (-> obj actor-group 0 data 1 actor)) + (a0-1 (when v1-3 + (let ((s5-0 (-> v1-3 extra process))) + (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + ) + (s5-1 *target*) + ) + (the-as + symbol + (and a0-1 + (and s5-1 + (let ((f0-0 409600.0)) + (and (< (* f0-0 f0-0) + (vector-vector-xz-distance-squared (get-trans (the-as process-focusable a0-1) 0) (get-trans s5-1 0)) + ) + (>= (-> pp clock frame-counter) (-> obj dont-fail-until)) + ) + ) + ) + ) + ) + ) + ) + ) + +;; definition for method 234 of type hal-escort +;; INFO: Used lq/sq +(defmethod hal-escort-method-234 hal-escort ((obj hal-escort) (arg0 nav-mesh)) + (let ((s2-0 (the-as process #f))) + (let* ((v1-3 (-> obj actor-group 0 data 1 actor)) + (gp-0 (when v1-3 + (let ((s5-0 (-> v1-3 extra process))) + (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + ) + (s5-1 (new 'stack-no-clear 'vector)) + ) + (when gp-0 + (let ((f30-0 -1.0)) + (countdown (s2-1 4) + (let ((s0-0 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + ) + (set-vector! s0-0 13312.0 0.0 17408.0 1.0) + (vector-rotate-around-y! s0-0 s0-0 (* 16384.0 (the float s2-1))) + (vector+! s0-0 s0-0 (-> (the-as process-focusable gp-0) root-override trans)) + (nav-mesh-method-10 arg0 s1-0 s0-0 (the-as nav-poly #f)) + (let ((f0-6 (vector-vector-xz-distance s1-0 (-> (the-as process-focusable gp-0) root-override trans)))) + (when (or (< f30-0 0.0) (< f30-0 f0-6)) + (set! f30-0 f0-6) + (set! (-> s5-1 quad) (-> s1-0 quad)) + ) + ) + ) + ) + ) + (let ((s2-2 (new 'stack 'traffic-object-spawn-params))) + (set! (-> s2-2 object-type) (traffic-type crimson-guard-1)) + (set! (-> s2-2 behavior) (the-as uint 5)) + (set! (-> s2-2 id) (the-as uint 0)) + (set! (-> s2-2 nav-mesh) arg0) + (set! (-> s2-2 nav-branch) #f) + (set! (-> s2-2 proc) #f) + (let ((v1-25 (-> obj actor-group 0 data 1 actor))) + (set! (-> s2-2 handle) (process->handle (when v1-25 + (let ((s4-1 (-> v1-25 extra process))) + (if (type? s4-1 process-focusable) + s4-1 + ) + ) + ) + ) + ) + ) + (set! (-> s2-2 user-data) (the-as uint 0)) + (set! (-> s2-2 flags) (the-as uint 0)) + (set! (-> s2-2 guard-type) (the-as uint 7)) + (vector-reset! (-> s2-2 velocity)) + (set! (-> s2-2 position quad) (-> s5-1 quad)) + (let ((a1-9 (new 'stack-no-clear 'vector))) + (vector-! a1-9 (-> (the-as process-focusable gp-0) root-override trans) (-> s2-2 position)) + (forward-up->quaternion (-> s2-2 rotation) a1-9 *up-vector*) + ) + (send-event *traffic-manager* 'activate-object s2-2) + (set! s2-0 (-> s2-2 proc)) + ) + ) + ) + s2-0 + ) + ) + +;; definition for method 229 of type hal-escort +(defmethod try-enter-vehicle hal-escort ((obj hal-escort)) + "Returns seat index" + (let* ((gp-0 (handle->process (-> obj vehicle-handle))) + (v1-6 (-> obj actor-group 0 data 1 actor)) + (s5-0 (when v1-6 + (let ((s4-0 (-> v1-6 extra process))) + (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + ) + (s4-1 -1) + ) + (when (and gp-0 (not (logtest? (-> (the-as vehicle gp-0) flags) (rigid-body-object-flag dead))) s5-0) + (set! s4-1 (get-seat-count (the-as vehicle gp-0))) + (while (nonzero? s4-1) + (+! s4-1 -1) + (if (= (get-rider-in-seat (the-as vehicle gp-0) s4-1) s5-0) + (goto cfg-20) + ) + ) + (set! s4-1 + (get-best-seat-for-vehicle (the-as vehicle gp-0) (-> (the-as process-focusable s5-0) root-override trans) 2 1) + ) + ) + (label cfg-20) + s4-1 + ) + ) + +;; definition for method 232 of type hal-escort +;; WARN: Return type mismatch int vs none. +(defmethod hal-escort-method-232 hal-escort ((obj hal-escort)) + (with-pp + (let* ((target *target*) + (v1-3 (-> obj actor-group 0 data 1 actor)) + (s5-0 (when v1-3 + (let ((s3-0 (-> v1-3 extra process))) + (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + ) + (a0-2 (-> obj actor-group 0 data 2 actor)) + (v1-8 (when a0-2 + (let ((s3-1 (-> a0-2 extra process))) + (if (type? s3-1 process-focusable) + s3-1 + ) + ) + ) + ) + ) + (when target + (cond + ((not (-> *setting-control* user-current pilot-exit)) + (when (and s5-0 + v1-8 + (not (logtest? (-> (the-as process-focusable s5-0) focus-status) (focus-status pilot-riding))) + (not (logtest? (-> (the-as process-focusable v1-8) focus-status) (focus-status pilot-riding))) + (>= (- (-> pp clock frame-counter) (-> obj locked-player-time)) (seconds 10)) + ) + (remove-setting! 'pilot-exit) + (set-setting! 'pilot #f 0 0) + (apply-settings *setting-control*) + ) + ) + ((logtest? (-> target focus-status) (focus-status pilot-riding)) + (when (and (nonzero? (-> target pilot)) + (and (= (handle->process (-> target pilot vehicle)) (handle->process (-> obj vehicle-handle))) + (or (and s5-0 (logtest? (focus-status pilot) (-> (the-as process-focusable s5-0) focus-status))) + (and v1-8 (logtest? (focus-status pilot) (-> (the-as process-focusable v1-8) focus-status))) + ) + ) + ) + (set-setting! 'pilot-exit #f 0 0) + (apply-settings *setting-control*) + (set! (-> obj locked-player-time) (-> pp clock frame-counter)) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +;; definition for method 231 of type hal-escort +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defmethod init-traffic-params! hal-escort ((obj hal-escort) (arg0 symbol)) + (let ((gp-0 *traffic-manager*)) + (send-event gp-0 'deactivate-all) + (send-event gp-0 'set-guard-multi-focus #t) + (send-event gp-0 'set-max-alert-level 1) + (send-event gp-0 'set-alert-level 1) + (send-event gp-0 'set-guard-target-count-range 4 0 0) + (send-event gp-0 'set-guard-target-count-range 5 0 0) + (send-event gp-0 'set-guard-target-count-range 0 6 6) + (send-event gp-0 'set-alert-duration #xa4cb80) + (send-event gp-0 'set-object-reserve-count 6 #x7d00) + (when arg0 + (send-event gp-0 'set-guard-force-visible #t) + (let ((s4-1 (new 'stack 'traffic-object-spawn-params))) + (let ((v1-51 (nav-mesh-from-res-tag (-> obj entity) 'nav-mesh-actor 0))) + (set! (-> s4-1 object-type) (traffic-type crimson-guard-1)) + (set! (-> s4-1 behavior) (the-as uint 3)) + (set! (-> s4-1 id) (the-as uint 0)) + (set! (-> s4-1 nav-mesh) v1-51) + ) + (set! (-> s4-1 nav-branch) #f) + (set! (-> s4-1 proc) #f) + (set! (-> s4-1 handle) (the-as handle #f)) + (set! (-> s4-1 user-data) (the-as uint 0)) + (set! (-> s4-1 flags) (the-as uint 0)) + (set! (-> s4-1 guard-type) (the-as uint 7)) + (vector-reset! (-> s4-1 velocity)) + (set! (-> s4-1 position quad) (-> obj hal4-course spots 5 center quad)) + (quaternion-identity! (-> s4-1 rotation)) + (send-event gp-0 'activate-object s4-1) + ) + ) + ) + (none) + ) + +;; definition for method 233 of type hal-escort +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod set-traffic-danger! hal-escort ((obj hal-escort)) + (let ((a0-1 *target*)) + (when a0-1 + (let ((gp-0 (new 'stack-no-clear 'traffic-danger-info))) + (set! (-> gp-0 sphere quad) (-> (get-trans a0-1 0) quad)) + (set! (-> gp-0 sphere r) 12288.0) + (vector-reset! (-> gp-0 velocity)) + (set! (-> gp-0 notify-radius) 102400.0) + (set! (-> gp-0 danger-level) 1.0) + (set! (-> gp-0 decay-rate) 0.0) + (set! (-> gp-0 flags) (traffic-danger-flags tdf0)) + (set! (-> gp-0 danger-type) (traffic-danger-type tdt4)) + (add-danger (-> (the-as traffic-manager *traffic-manager*) traffic-engine) gp-0) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 230 of type hal-escort +;; INFO: Used lq/sq +(defmethod hal-escort-method-230 hal-escort ((obj hal-escort)) + (local-vars (a2-5 float) (a2-12 float)) + (rlet ((vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + ) + (let ((gp-0 (new 'stack-no-clear 'matrix)) + (s5-0 528) + ) + (let ((v1-2 (-> obj hal4-course spots 9))) + (set! (-> gp-0 vector 1 quad) (-> v1-2 center quad)) + (set! (-> gp-0 vector 1 w) (+ 81920.0 (-> v1-2 center w))) + ) + (set! *actor-list-length* 0) + (if (logtest? s5-0 512) + (set! *actor-list-length* + (fill-actor-list-for-sphere *actor-hash* (the-as sphere (-> gp-0 vector 1)) *actor-list* 256) + ) + ) + (when (logtest? s5-0 1024) + (let ((a0-4 (-> *collide-player-list* alive-list next0))) + *collide-player-list* + (let ((v1-14 (-> a0-4 next0))) + (while (!= a0-4 (-> *collide-player-list* alive-list-end)) + (let* ((a0-5 (-> (the-as connection a0-4) param1)) + (a1-3 (-> (the-as collide-shape-moving a0-5) root-prim)) + ) + (when (logtest? (the-as collide-spec s5-0) (-> a1-3 prim-core collide-as)) + (let ((a1-4 (-> a1-3 prim-core))) + (let ((a2-4 a1-4) + (a3-1 (-> gp-0 vector 1)) + ) + (.lvf vf2 (&-> a2-4 world-sphere quad)) + (.lvf vf3 (&-> a3-1 quad)) + ) + (.sub.vf vf1 vf3 vf2) + (.mul.vf vf1 vf1 vf1) + (.add.y.vf vf1 vf1 vf1 :mask #b1) + (.add.z.vf vf1 vf1 vf1 :mask #b1) + (.mov a2-5 vf1) + (let ((f0-2 a2-5) + (f1-2 (+ (-> a1-4 world-sphere w) (-> gp-0 vector 1 w))) + ) + (when (< f0-2 (* f1-2 f1-2)) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-5)) + (set! *actor-list-length* (+ *actor-list-length* 1)) + ) + ) + ) + ) + ) + ) + (set! a0-4 v1-14) + *collide-player-list* + (set! v1-14 (-> v1-14 next0)) + ) + ) + ) + ) + (when (logtest? s5-0 256) + (let ((a0-7 (-> *collide-hit-by-player-list* alive-list next0))) + *collide-hit-by-player-list* + (let ((v1-22 (-> a0-7 next0))) + (while (!= a0-7 (-> *collide-hit-by-player-list* alive-list-end)) + (let* ((a0-8 (-> (the-as connection a0-7) param1)) + (a1-15 (-> (the-as collide-shape-moving a0-8) root-prim)) + ) + (when (logtest? (the-as collide-spec s5-0) (-> a1-15 prim-core collide-as)) + (let ((a1-16 (-> a1-15 prim-core))) + (let ((a2-11 a1-16) + (a3-2 (-> gp-0 vector 1)) + ) + (.lvf vf2 (&-> a2-11 world-sphere quad)) + (.lvf vf3 (&-> a3-2 quad)) + ) + (.sub.vf vf1 vf3 vf2) + (.mul.vf vf1 vf1 vf1) + (.add.y.vf vf1 vf1 vf1 :mask #b1) + (.add.z.vf vf1 vf1 vf1 :mask #b1) + (.mov a2-12 vf1) + (let ((f0-3 a2-12) + (f1-6 (+ (-> a1-16 world-sphere w) (-> gp-0 vector 1 w))) + ) + (when (< f0-3 (* f1-6 f1-6)) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-8)) + (set! *actor-list-length* (+ *actor-list-length* 1)) + ) + ) + ) + ) + ) + ) + (set! a0-7 v1-22) + *collide-hit-by-player-list* + (set! v1-22 (-> v1-22 next0)) + ) + ) + ) + ) + (dotimes (s4-0 *actor-list-length*) + (let ((v1-27 (-> *actor-list* s4-0))) + (when (logtest? (the-as collide-spec s5-0) (-> v1-27 root-prim prim-core collide-as)) + (let* ((s3-0 (-> v1-27 process)) + (a0-16 (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + (when (and a0-16 (= (-> a0-16 type) crimson-guard)) + (let ((s3-1 (get-trans (the-as process-focusable a0-16) 0))) + (if (and (>= (-> gp-0 vector 1 w) (vector-vector-xz-distance (-> gp-0 vector 1) s3-1)) + (>= (- (-> s3-1 y) (-> gp-0 vector 1 y)) -10240.0) + ) + (return #t) + ) + ) + ) + ) + ) + ) + ) + ) + #f + ) + ) + +;; definition for method 204 of type hal-escort +(defmethod play-too-far-warn-speech hal-escort ((obj hal-escort)) + (when (not (channel-active? obj (the-as uint 0))) + (let ((s5-0 0)) + (let* ((v1-5 (-> obj actor-group 0 data 1 actor)) + (s4-0 (when v1-5 + (let ((s3-0 (-> v1-5 extra process))) + (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + ) + ) + (let* ((a0-3 (-> obj actor-group 0 data 2 actor)) + (v1-10 (when a0-3 + (let ((s3-1 (-> a0-3 extra process))) + (if (type? s3-1 process-focusable) + s3-1 + ) + ) + ) + ) + ) + (if (or (logtest? (-> (the-as process-focusable s4-0) draw status) (draw-control-status on-screen)) + (logtest? (-> (the-as process-focusable v1-10) draw status) (draw-control-status on-screen)) + ) + (set! s5-0 (logior s5-0 32)) + ) + ) + (let ((s3-2 #f)) + (when (and (>= (-> obj waypoint waypoint-id) 19) *target*) + (let* ((f30-0 (-> (get-trans (the-as process-focusable s4-0) 1) y)) + (f0-1 (- (-> (get-trans *target* 1) y) f30-0)) + ) + (cond + ((>= f0-1 8192.0) + (set! s5-0 (logior s5-0 8)) + (set! s3-2 #t) + ) + ((>= -8192.0 f0-1) + (set! s5-0 (logior s5-0 16)) + (set! s3-2 #t) + ) + ) + ) + ) + (when (not s3-2) + (let ((s3-3 (new 'stack-no-clear 'vector))) + (vector-! s3-3 (target-pos 0) (-> (the-as process-focusable s4-0) root-override trans)) + (vector-normalize! s3-3 1.0) + (if (>= (vector-dot s3-3 (-> obj follow-dir)) 0.0) + (set! s5-0 (logior s5-0 8)) + (set! s5-0 (logior s5-0 16)) + ) + ) + ) + ) + ) + (let ((a1-7 (bot-speech-list-method-9 + (-> obj hal4-course too-far-warn-speeches) + obj + (-> obj hal4-course speeches) + (the-as speech-flags s5-0) + ) + ) + ) + (when (>= a1-7 0) + (play-speech obj a1-7) + #t + ) + ) + ) + ) + ) + +;; definition for function hal4-walking-too-far +(defun hal4-walking-too-far ((arg0 hal-escort)) + (let ((gp-0 0)) + (let* ((v1-3 (-> arg0 actor-group 0 data 1 actor)) + (a0-1 (when v1-3 + (let ((s4-0 (-> v1-3 extra process))) + (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + ) + ) + (if (and a0-1 (>= (vector-vector-xz-distance (get-trans (the-as process-focusable a0-1) 0) (target-pos 0)) + (-> arg0 too-far-warn-dist) + ) + ) + (set! gp-0 1) + ) + ) + gp-0 + ) + ) + +;; definition for symbol *hal4-course*, type hal4-course +(define *hal4-course* + (new 'static 'hal4-course + :course-id #xa + :speech-count #x23 + :spot-count #xa + :too-far-warn-speeches (new 'static 'bot-speech-list-shuffle + :flags #xa + :last-local-index -1 + :speech-indexes (new 'static 'boxed-array :type int16 1 2 5 6 8 9 10 12 13 16 17 18 19) + ) + :default-check-too-far #f + :waypoints (new 'static 'boxed-array :type bot-waypoint + (new 'static 'bot-waypoint + :waypoint-id 1 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 hal-escort)) + (process-entity-status! arg0 (entity-perm-status no-kill) #t) + (set-setting! 'exclusive-task #f 0 34) + (set-setting! 'allow-continue #f 0 0) + (clear-speech-flags! arg0) + (speech-control-method-10 + *speech-control* + 6 + (new 'static 'speech-type-info + :channel #x1 + :priority -2 + :min-delay #x258 + :max-delay #x4b0 + :list (new 'static 'boxed-array :type string + "kg280a" + "kg281a" + "kg282a" + "kg283a" + "kg284a" + "kg285a" + "kg286a" + "kg287a" + "kg288a" + "kg289a" + "kg290a" + "kg291a" + "kg292a" + "kg294a" + "kg297a" + "kg298a" + ) + ) + ) + (speech-control-method-10 + *speech-control* + 7 + (new 'static 'speech-type-info + :channel #x1 + :priority -2 + :min-delay #x258 + :max-delay #x4b0 + :list (new 'static 'boxed-array :type string + "kg280a" + "kg281a" + "kg282a" + "kg283a" + "kg284a" + "kg285a" + "kg286a" + "kg287a" + "kg288a" + "kg289a" + "kg290a" + "kg291a" + "kg292a" + "kg294a" + "kg295a" + "kg296a" + "kg297a" + "kg298a" + ) + ) + ) + (let ((v1-12 (-> arg0 actor-group 0 data 3 actor))) + (if v1-12 + (logior! (-> v1-12 extra perm status) (entity-perm-status bit-9)) + ) + ) + (set-setting! 'airlock #f 0 0) + (set-setting! 'minimap 'clear 0 32) + (let ((s5-0 (new 'stack-no-clear 'task-arrow-params))) + (set! (-> s5-0 pos quad) (-> arg0 hal4-course spots 1 center quad)) + (quaternion-identity! (-> s5-0 quat)) + (set! (-> s5-0 flags) (task-arrow-flags)) + (set! (-> s5-0 map-icon) (the-as uint 15)) + (set! (-> arg0 arrow-handle) (process->handle (task-arrow-spawn s5-0 (the-as task-arrow arg0)))) + ) + (let ((v1-24 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-24 bytes 5) (the-as uint 1)) + (set! (-> v1-24 bytes 6) (the-as uint 0)) + (set! (-> v1-24 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-24) check-done) + (the-as + (function halt-wait-spot hal symbol) + (lambda ((arg0 object) (arg1 hal-escort)) + (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) + (s4-0 (when v1-3 + (let ((s5-0 (-> v1-3 extra process))) + (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + ) + (v1-8 (-> arg1 actor-group 0 data 2 actor)) + (s5-1 (when v1-8 + (let ((s3-0 (-> v1-8 extra process))) + (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + ) + (v1-10 *traffic-manager*) + ) + (cond + ((not (logtest? (-> arg1 waypoint-bits) 1)) + (when (and s4-0 (and s5-1 v1-10)) + (logior! (-> arg1 waypoint-bits) 1) + (set! (-> arg1 slave-handle 0) (process->handle s4-0)) + (set! (-> arg1 slave-handle 1) (process->handle s5-1)) + ) + #f + ) + ((not (logtest? (-> arg1 waypoint-bits) 2)) + (logior! (-> arg1 waypoint-bits) 2) + (hal-method-226 arg1) + (send-event s4-0 'request 'waypoint 2) + (send-event s5-1 'request 'waypoint 2) + #f + ) + ((not (logtest? (-> arg1 waypoint-bits) 4)) + (logior! (-> arg1 waypoint-bits) 4) + (let ((s5-2 *traffic-manager*)) + (send-event s5-2 'deactivate-all) + (let ((s4-1 (new 'stack 'traffic-object-spawn-params))) + (set! (-> s4-1 position quad) (-> arg1 hal4-course spots 2 center quad)) + (quaternion-axis-angle! (-> s4-1 rotation) 0.0 1.0 0.0 0.0) + (set! (-> s4-1 object-type) (traffic-type cara)) + (set! (-> s4-1 behavior) (the-as uint 0)) + (set! (-> s4-1 id) (the-as uint 0)) + (set! (-> s4-1 proc) #f) + (send-event s5-2 'spawn-object s4-1) + (let ((a0-26 (-> s4-1 proc))) + (if a0-26 + (set! (-> arg1 vehicle-handle) (process->handle a0-26)) + ) + ) + ) + ) + #f + ) + (else + (let ((a0-30 s4-0)) + (when (and (and a0-30 (let ((s4-2 1)) + (< s4-2 (the-as int (send-event a0-30 'query 'waypoint))) + ) + ) + (let ((a0-32 s5-1)) + (and a0-32 (let ((s5-3 1)) + (< s5-3 (the-as int (send-event a0-32 'query 'waypoint))) + ) + ) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 2 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 2 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 hal-escort)) + (set-setting! 'sound-mode #f 0 2) + (let ((s5-0 (-> arg0 hal4-course spots))) + (vector-! (the-as vector (-> arg0 notice-plane)) (the-as vector (-> s5-0 4)) (the-as vector (-> s5-0 3))) + (vector-normalize! (-> arg0 notice-plane) 1.0) + (set! (-> arg0 notice-plane w) + (- (vector-dot (the-as vector (-> s5-0 3)) (the-as vector (-> arg0 notice-plane)))) + ) + ) + (play-speech arg0 0) + (let ((v1-10 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-10 bytes 5) (the-as uint 1)) + (set! (-> v1-10 bytes 6) (the-as uint 0)) + (set! (-> v1-10 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-10) check-done) + (the-as + (function halt-wait-spot hal symbol) + (lambda ((arg0 object) (arg1 hal-escort)) + (local-vars (v1-14 symbol)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (let* ((v1-3 (-> arg1 actor-group 0 data 1 actor)) + (a0-1 (when v1-3 + (let ((s4-0 (-> v1-3 extra process))) + (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + ) + ) + (when a0-1 + (set! (-> s5-0 quad) (-> (get-trans (the-as process-focusable a0-1) 0) quad)) + (set! (-> s5-0 w) 1.0) + (when (>= (vector4-dot s5-0 (the-as vector (-> arg1 notice-plane))) 0.0) + (set! v1-14 #t) + (goto cfg-14) + ) + ) + ) + (set! (-> s5-0 quad) (-> (math-camera-pos) quad)) + (set! (-> s5-0 w) 1.0) + (when (>= (vector4-dot s5-0 (the-as vector (-> arg1 notice-plane))) 0.0) + (set! v1-14 #t) + (goto cfg-14) + ) + (set! (-> s5-0 quad) (-> (target-pos 0) quad)) + (set! (-> s5-0 w) 1.0) + (when (>= (vector4-dot s5-0 (the-as vector (-> arg1 notice-plane))) 0.0) + (set! v1-14 #t) + (goto cfg-14) + ) + ) + (set! v1-14 #f) + (label cfg-14) + (when v1-14 + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 3 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 3 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 hal-escort)) + (init-traffic-params! arg0 #t) + (set-setting! 'sound-mode #f 0 1) + (let ((v1-5 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-5 bytes 5) (the-as uint 1)) + (set! (-> v1-5 bytes 6) (the-as uint 0)) + (set! (-> v1-5 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-5) check-done) + (the-as + (function halt-wait-spot hal symbol) + (lambda ((arg0 object) (arg1 hal-escort)) + (with-pp + (if (and (not (speech-playing? arg1 3)) + (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1)) + (not (channel-active? arg1 (the-as uint 0))) + ) + (play-speech arg1 3) + ) + (when (hal-escort-method-228 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 28 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (when (speech-playing? arg1 3) + (let* ((v1-27 (-> arg1 actor-group 0 data 2 actor)) + (a0-11 (when v1-27 + (let ((s5-0 (-> v1-27 extra process))) + (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + ) + ) + (when (and a0-11 (>= (the-as int (send-event a0-11 'query 'waypoint)) 6)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 6 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 hal-escort)) (set-traffic-danger! arg0) (hal-escort-method-235 arg0) (none)) + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 6 + :nav-mesh-index -1 + :skip-to #xf + :on-set (lambda ((arg0 hal-escort)) + (reset-warn-time! arg0) + (let ((v1-3 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-3 bytes 5) (the-as uint 1)) + (set! (-> v1-3 bytes 6) (the-as uint 0)) + (set! (-> v1-3 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-3) check-done) + (the-as + (function halt-wait-spot hal symbol) + (lambda ((arg0 object) (arg1 hal-escort)) + (when (hal-escort-method-228 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 28 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (when (vehicle-destroyed? arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 29 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (let* ((v1-25 (-> arg1 actor-group 0 data 2 actor)) + (a0-9 (when v1-25 + (let ((s5-0 (-> v1-25 extra process))) + (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + ) + ) + (when (and a0-9 (>= (the-as int (send-event a0-9 'query 'waypoint)) 15)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 15 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 hal-escort)) (set-traffic-danger! arg0) (hal-escort-method-235 arg0) (none)) + :on-skipping-here #f + :check-too-far 'hal4-walking-too-far + ) + (new 'static 'bot-waypoint + :waypoint-id 15 + :nav-mesh-index -1 + :skip-to #x14 + :on-set (lambda ((arg0 hal-escort)) + (send-event *traffic-manager* 'set-guard-force-visible #f) + (let ((v1-5 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-5 bytes 5) (the-as uint 1)) + (set! (-> v1-5 bytes 6) (the-as uint 0)) + (set! (-> v1-5 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-5) check-done) + (the-as + (function halt-wait-spot hal symbol) + (lambda ((arg0 object) (arg1 hal-escort)) + (hal-escort-method-232 arg1) + (when (hal-escort-method-228 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 28 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (when (vehicle-destroyed? arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 29 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (when (hal-escort-method-227 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 30 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (let* ((v1-38 (-> arg1 actor-group 0 data 1 actor)) + (s4-0 (when v1-38 + (let ((s5-0 (-> v1-38 extra process))) + (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + ) + (v1-43 (-> arg1 actor-group 0 data 2 actor)) + (s5-1 (when v1-43 + (let ((s3-0 (-> v1-43 extra process))) + (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + ) + (a0-16 s4-0) + ) + (cond + ((and (and a0-16 (>= (the-as int (send-event a0-16 'query 'waypoint)) 18)) + (let ((a0-18 s5-1)) + (and a0-18 (>= (the-as int (send-event a0-18 'query 'waypoint)) 18)) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 18 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + (else + (let ((a0-22 s4-0)) + (when (or (and a0-22 (>= (the-as int (send-event a0-22 'query 'waypoint)) 17)) + (let ((a0-24 s5-1)) + (and a0-24 (>= (the-as int (send-event a0-24 'query 'waypoint)) 17)) + ) + ) + (let ((s3-1 (try-enter-vehicle arg1)) + (gp-1 (handle->process (-> arg1 vehicle-handle))) + ) + (let ((a0-29 s4-0)) + (if (and a0-29 (>= (the-as int (send-event a0-29 'query 'waypoint)) 17)) + (send-event s4-0 'request 'move-to-vehicle gp-1 s3-1) + ) + ) + (let ((a0-33 s5-1)) + (if (and a0-33 (>= (the-as int (send-event a0-33 'query 'waypoint)) 17)) + (send-event s5-1 'request 'move-to-vehicle gp-1 s3-1) + ) + ) + ) + ) + ) + #f + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 hal-escort)) (set-traffic-danger! arg0) (hal-escort-method-235 arg0) (none)) + :on-skipping-here (lambda ((arg0 hal-escort)) + (with-pp + (set! (-> arg0 dont-fail-until) (+ (-> pp clock frame-counter) (seconds 10))) + (reset-warn-time! arg0) + (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) + (send-event *target* 'continue (get-continue-by-name *game-info* "lkiddoge-skip0")) + (let* ((v1-16 (-> arg0 actor-group 0 data 2 actor)) + (s5-1 (when v1-16 + (let ((s4-0 (-> v1-16 extra process))) + (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + ) + (v1-21 (-> arg0 actor-group 0 data 1 actor)) + (s4-1 (when v1-21 + (let ((s3-0 (-> v1-21 extra process))) + (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + ) + ) + (send-event s5-1 'skip) + (send-event s4-1 'skip) + ) + (init-traffic-params! arg0 #f) + (none) + ) + ) + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 18 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 hal-escort)) + (let ((s5-0 *traffic-manager*)) + (send-event s5-0 'set-alert-level 2) + (send-event s5-0 'set-max-alert-level 2) + (send-event s5-0 'set-guard-target-count-range 4 1 1) + (send-event s5-0 'set-guard-target-count-range 5 1 1) + ) + (let ((v1-25 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-25 bytes 5) (the-as uint 1)) + (set! (-> v1-25 bytes 6) (the-as uint 0)) + (set! (-> v1-25 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-25) check-done) + (the-as + (function halt-wait-spot hal symbol) + (lambda ((arg0 object) (arg1 hal-escort)) + (with-pp + (hal-escort-method-232 arg1) + (when (and (not (logtest? (-> arg1 waypoint-bits) 1)) (not (-> *setting-control* user-current pilot-exit))) + (send-event (handle->process (-> arg1 arrow-handle)) 'set-position (-> arg1 hal4-course spots 6)) + (logior! (-> arg1 waypoint-bits) 1) + ) + (if (and (not (speech-playing? arg1 14)) + (not (-> *setting-control* user-current pilot-exit)) + (>= (- (-> pp clock frame-counter) (-> arg1 locked-player-time)) (seconds 1.5)) + ) + (play-speech arg1 14) + ) + (when (vehicle-destroyed? arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 29 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (let* ((v1-45 (-> arg1 actor-group 0 data 1 actor)) + (s5-0 (when v1-45 + (let ((s4-0 (-> v1-45 extra process))) + (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + ) + (v1-50 (-> arg1 actor-group 0 data 2 actor)) + (s4-1 (when v1-50 + (let ((s3-0 (-> v1-50 extra process))) + (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + ) + ) + (let ((s3-1 #f)) + (let* ((s1-0 (handle->process (-> arg1 vehicle-handle))) + (s2-0 (if (type? s1-0 process-focusable) + s1-0 + ) + ) + ) + (when s2-0 + (let ((s1-1 (get-trans (the-as process-focusable s2-0) 0)) + (s0-0 (-> arg1 hal4-course spots 7)) + ) + (if (and (>= (-> arg1 hal4-course spots 7 center w) (vector-vector-xz-distance s1-1 (the-as vector s0-0))) + (>= 16384.0 (- (-> s1-1 y) (-> s0-0 center y))) + (>= 61440.0 (vector-length (-> (the-as process-focusable s2-0) root-override transv))) + (>= 1.0 (vector-length (-> (the-as process-focusable s2-0) rbody state ang-velocity))) + ) + (set! s3-1 #t) + ) + ) + ) + ) + (if (logtest? (focus-status pilot) (-> (the-as process-focusable s5-0) focus-status)) + (send-event s5-0 'request 'exit-vehicle s3-1 1) + ) + (if (logtest? (focus-status pilot) (-> (the-as process-focusable s5-0) focus-status)) + (send-event s4-1 'request 'exit-vehicle s3-1 1) + ) + (if (and (not (speech-playing? arg1 7)) + (not (logtest? (-> (the-as process-focusable s4-1) focus-status) (focus-status pilot-riding))) + (not (logtest? (bot-flags bf17) (-> (the-as bot s4-1) bot-flags))) + s3-1 + (not (channel-active? arg1 (the-as uint 0))) + ) + (play-speech arg1 7) + ) + ) + (when (and (not (logtest? (focus-status pilot) (-> (the-as process-focusable s4-1) focus-status))) + (not (logtest? (bot-flags bf17) (-> (the-as bot s4-1) bot-flags))) + (not (logtest? (focus-status pilot) (-> (the-as process-focusable s5-0) focus-status))) + (zero? (logand (bot-flags bf17) (-> (the-as bot s5-0) bot-flags))) + ) + (send-event *target* 'end-mode) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 19 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 hal-escort)) + (with-pp + (when (and (not (speech-playing? arg0 31)) (not (speech-playing? arg0 32))) + (let ((v1-7 (handle->process (-> arg0 vehicle-handle)))) + (if (and v1-7 + (and (not (logtest? (-> (the-as vehicle v1-7) flags) (rigid-body-object-flag dead))) + (>= (vector-length (-> (the-as vehicle v1-7) root-override-2 transv)) 40960.0) + (not (channel-active? arg0 (the-as uint 0))) + ) + ) + (play-speech arg0 (if (zero? (get-rand-int arg0 2)) + 32 + 31 + ) + ) + ) + ) + ) + (when (and (zero? (-> arg0 locked-player-time)) + (or (not (speech-playing? arg0 33)) (not (speech-playing? arg0 34))) + (>= (- (-> pp clock frame-counter) (-> arg0 played-get-in-time)) (seconds 6)) + (not (channel-active? arg0 (the-as uint 0))) + ) + (let ((a0-18 (handle->process (-> arg0 vehicle-handle)))) + (when a0-18 + (let ((f0-1 (vector-vector-xz-distance (get-trans (the-as vehicle a0-18) 0) (target-pos 0)))) + (when (and (< 28672.0 f0-1) (< f0-1 184320.0)) + (play-speech arg0 (if (speech-playing? arg0 33) + 34 + 33 + ) + ) + (set! (-> arg0 played-get-in-time) (-> pp clock frame-counter)) + ) + ) + ) + ) + ) + (none) + ) + ) + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 20 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 hal-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 7)) + (set! (-> v1-1 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-1) check-done) + (the-as + (function halt-wait-spot hal symbol) + (lambda ((arg0 object) (arg1 hal-escort)) + (with-pp + (if (!= (level-status *level* 'ctyinda) 'active) + (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) + ) + (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.25)) + (let* ((v1-11 (-> arg1 actor-group 0 data 2 actor)) + (s5-1 (when v1-11 + (let ((s4-0 (-> v1-11 extra process))) + (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + ) + (v1-16 (-> arg1 actor-group 0 data 1 actor)) + (s4-1 (when v1-16 + (let ((s3-0 (-> v1-16 extra process))) + (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + ) + ) + (send-event s5-1 'hide #f) + (send-event s4-1 'hide #f) + (send-event s5-1 'skip) + (send-event s4-1 'skip) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 19 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here (lambda ((arg0 hal-escort)) + (with-pp + (set! (-> arg0 dont-fail-until) (+ (-> pp clock frame-counter) (seconds 15))) + (reset-warn-time! arg0) + (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) + (let* ((v1-10 (-> arg0 actor-group 0 data 2 actor)) + (s5-0 (when v1-10 + (let ((s4-0 (-> v1-10 extra process))) + (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + ) + (v1-15 (-> arg0 actor-group 0 data 1 actor)) + (s4-1 (when v1-15 + (let ((s3-0 (-> v1-15 extra process))) + (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + ) + ) + (vector-reset! (-> (the-as process-focusable s5-0) root-override transv)) + (vector-reset! (-> (the-as process-focusable s4-1) root-override transv)) + (send-event s5-0 'hide #t) + (send-event s4-1 'hide #t) + ) + (send-event arg0 'move-trans (-> arg0 hal4-course spots 7)) + (send-event *target* 'continue (get-continue-by-name *game-info* "lkiddoge-skip1")) + (none) + ) + ) + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 19 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 hal-escort)) + (reset-warn-time! arg0) + (send-event (handle->process (-> arg0 arrow-handle)) 'set-position (-> arg0 hal4-course spots 8)) + (let ((s5-0 *traffic-manager*)) + (send-event s5-0 'set-alert-level 1) + (send-event s5-0 'set-max-alert-level 1) + (send-event s5-0 'set-guard-target-count-range 4 0 0) + (send-event s5-0 'end-pursuit-by-type 18) + (send-event s5-0 'set-guard-target-count-range 5 0 0) + (send-event s5-0 'end-pursuit-by-type 19) + ) + (let ((v1-43 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-43 bytes 5) (the-as uint 1)) + (set! (-> v1-43 bytes 6) (the-as uint 7)) + (set! (-> v1-43 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-43) check-done) + (the-as + (function halt-wait-spot hal symbol) + (lambda ((arg0 object) (arg1 hal-escort)) + (with-pp + (when (and (not (speech-playing? arg1 4)) + (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2)) + (not (channel-active? arg1 (the-as uint 0))) + ) + (play-speech arg1 15) + (play-speech arg1 4) + ) + (when (hal-escort-method-228 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 31 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (let* ((v1-27 (-> arg1 actor-group 0 data 2 actor)) + (s4-0 (when v1-27 + (let ((s5-0 (-> v1-27 extra process))) + (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + ) + (v1-32 (-> arg1 actor-group 0 data 1 actor)) + (s5-1 (when v1-32 + (let ((s3-0 (-> v1-32 extra process))) + (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + ) + ) + (when (and (and s4-0 (>= (the-as int (send-event s4-0 'query 'waypoint)) 25)) + (and s5-1 (>= (the-as int (send-event s5-1 'query 'waypoint)) 25)) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 25 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 hal-escort)) + (hal-escort-method-232 arg0) + (set-traffic-danger! arg0) + (hal-escort-method-235 arg0) + (none) + ) + :on-skipping-here (lambda ((arg0 hal-escort)) + (with-pp + (set! (-> arg0 dont-fail-until) (+ (-> pp clock frame-counter) (seconds 15))) + (reset-warn-time! arg0) + (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) + (send-event arg0 'move-trans (-> arg0 hal4-course spots 7)) + (send-event *target* 'continue (get-continue-by-name *game-info* "lkiddoge-skip1")) + (let* ((v1-23 (-> arg0 actor-group 0 data 2 actor)) + (s5-1 (when v1-23 + (let ((s4-0 (-> v1-23 extra process))) + (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + ) + (v1-28 (-> arg0 actor-group 0 data 1 actor)) + (gp-1 (when v1-28 + (let ((s4-1 (-> v1-28 extra process))) + (if (type? s4-1 process-focusable) + s4-1 + ) + ) + ) + ) + ) + (send-event s5-1 'skip) + (send-event gp-1 'skip) + ) + (none) + ) + ) + :check-too-far 'hal4-walking-too-far + ) + (new 'static 'bot-waypoint + :waypoint-id 25 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 hal-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 7)) + (set! (-> v1-1 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-1) check-done) + (the-as + (function halt-wait-spot hal symbol) + (lambda ((arg0 object) (arg1 hal-escort)) + (when (hal-escort-method-228 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 31 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (let ((s4-0 (target-pos 0)) + (s3-0 (-> arg1 hal4-course spots 9)) + (s5-0 *target*) + ) + (cond + ((and s5-0 + (>= (-> s3-0 center w) (vector-vector-xz-distance s4-0 (-> s3-0 center))) + (and (>= (- (-> s4-0 y) (-> s3-0 center y)) -10240.0) + (zero? (logand (-> s5-0 focus-status) (focus-status edge-grab))) + ) + ) + (when (not (logtest? (-> arg1 bot-task-bits) 1)) + (send-event *traffic-manager* 'set-alert-duration 300) + (logior! (-> arg1 bot-task-bits) 1) + ) + (when (not (hal-escort-method-230 arg1)) + (let* ((v1-34 (-> arg1 actor-group 0 data 2 actor)) + (s4-1 (when v1-34 + (let ((s3-1 (-> v1-34 extra process))) + (if (type? s3-1 process-focusable) + s3-1 + ) + ) + ) + ) + (v1-39 (-> arg1 actor-group 0 data 1 actor)) + (s3-2 (when v1-39 + (let ((s2-0 (-> v1-39 extra process))) + (if (type? s2-0 process-focusable) + s2-0 + ) + ) + ) + ) + ) + (when (and (process-grab? s4-1 #t) + (process-grab? s3-2 #t) + (not (channel-active? arg1 (the-as uint 0))) + (process-grab? s5-0 #f) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 26 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + ) + ) + ) + (else + (when (logtest? (-> arg1 bot-task-bits) 1) + (let ((s5-1 *traffic-manager*)) + (send-event s5-1 'set-alert-level 1) + (send-event s5-1 'set-alert-duration #xa4cb80) + ) + (set! (-> arg1 bot-task-bits) (logand -2 (-> arg1 bot-task-bits))) + ) + ) + ) + ) + #f + ) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 hal-escort)) (set-traffic-danger! arg0) (hal-escort-method-235 arg0) (none)) + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 26 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 hal-escort)) + (remove-setting! 'sound-mode) + (add-process + *gui-control* + arg0 + (gui-channel art-load) + (gui-action queue) + "dig-knock-down-scaffolding-intro" + -99.0 + 0 + ) + (remove-setting! 'airlock) + (apply-settings *setting-control*) + (send-event (handle->process (-> arg0 arrow-handle)) 'die) + (play-speech arg0 11) + (set-setting! 'entity-name "camera-224" 0 0) + (let ((s5-0 *traffic-manager*)) + (send-event s5-0 'set-guard-target-level 0) + (send-event s5-0 'set-max-alert-level 0) + (send-event s5-0 'set-alert-level 0) + ) + (let ((v1-32 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-32 bytes 5) (the-as uint 1)) + (set! (-> v1-32 bytes 6) (the-as uint 7)) + (set! (-> v1-32 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-32) check-done) + (the-as + (function halt-wait-spot hal symbol) + (lambda ((arg0 object) (arg1 hal-escort)) + (with-pp + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer pp)) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'open) + (let ((t9-0 send-event-function) + (v1-5 (-> arg1 actor-group 0 data 5 actor)) + ) + (t9-0 + (if v1-5 + (-> v1-5 extra process) + ) + a1-1 + ) + ) + ) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) (process->ppointer pp)) + (set! (-> a1-2 num-params) 0) + (set! (-> a1-2 message) 'open) + (let ((t9-1 send-event-function) + (v1-13 (-> arg1 actor-group 0 data 6 actor)) + ) + (t9-1 + (if v1-13 + (-> v1-13 extra process) + ) + a1-2 + ) + ) + ) + (when (and (not (logtest? (-> arg1 waypoint-bits) 2)) + (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.75)) + ) + (logior! (-> arg1 waypoint-bits) 2) + (let ((s5-0 *traffic-manager*)) + (send-event s5-0 'deactivate-by-type 6) + (send-event s5-0 'deactivate-by-type 18) + (send-event s5-0 'deactivate-by-type 19) + (send-event s5-0 'deactivate-by-type 20) + ) + ) + (when (and (not (logtest? (-> arg1 waypoint-bits) 1)) + (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.2)) + ) + (let* ((v1-55 (-> arg1 actor-group 0 data 2 actor)) + (s5-1 (when v1-55 + (let ((s4-0 (-> v1-55 extra process))) + (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + ) + ) + (let* ((v1-60 (-> arg1 actor-group 0 data 1 actor)) + (a0-16 (when v1-60 + (let ((s4-1 (-> v1-60 extra process))) + (if (type? s4-1 process-focusable) + s4-1 + ) + ) + ) + ) + ) + (logior! (-> arg1 waypoint-bits) 1) + (send-event a0-16 'request 'waypoint 26) + ) + (send-event s5-1 'request 'waypoint 26) + ) + ) + (when (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3)) + (not (channel-active? arg1 (the-as uint 0))) + (scene-play arg1 "dig-knock-down-scaffolding-intro" #t) + ) + (remove-setting! 'entity-name) + (go-to-waypoint! arg1 27 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 27 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 hal-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 7)) + (set! (-> v1-1 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-1) check-done) + (the-as (function halt-wait-spot hal symbol) (lambda ((arg0 hal-escort)) (none))) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 28 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 hal-escort)) + (remove-setting! 'sound-mode) + (let ((a0-2 *traffic-manager*)) + (send-event a0-2 'deactivate-by-type 6) + ) + (let ((v1-8 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-8 bytes 5) (the-as uint 1)) + (set! (-> v1-8 bytes 6) (the-as uint 0)) + (set! (-> v1-8 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-8) check-done) + (the-as (function halt-wait-spot hal symbol) (lambda () #f)) + ) + ) + (none) + ) + :on-update (lambda ((arg0 hal-escort)) + (when (not (logtest? (-> arg0 waypoint-bits) 1)) + (let* ((a1-1 (nav-mesh-from-res-tag (-> arg0 entity) 'nav-mesh-actor 0)) + (gp-0 (hal-escort-method-234 arg0 a1-1)) + ) + (when gp-0 + (logior! (-> arg0 waypoint-bits) 1) + (let* ((v1-8 (-> arg0 actor-group 0 data 1 actor)) + (a0-3 (when v1-8 + (let ((s5-1 (-> v1-8 extra process))) + (if (type? s5-1 process-focusable) + s5-1 + ) + ) + ) + ) + ) + (send-event a0-3 'instant-arrest gp-0) + ) + ) + ) + ) + (none) + ) + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 29 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 hal-escort)) + (remove-setting! 'music) + (remove-setting! 'sound-mode) + (send-event (handle->process (-> arg0 arrow-handle)) 'die) + (let ((v1-11 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-11 bytes 5) (the-as uint 1)) + (set! (-> v1-11 bytes 6) (the-as uint 0)) + (set! (-> v1-11 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-11) check-done) + (the-as + (function halt-wait-spot hal symbol) + (lambda ((arg0 object) (arg1 hal-escort)) + (with-pp + (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3)) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer pp)) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'fail) + (let ((t9-0 send-event-function) + (v1-8 (-> *game-info* sub-task-list 111)) + ) + (t9-0 + (handle->process (if (-> v1-8 info) + (-> v1-8 info manager) + (the-as handle #f) + ) + ) + a1-1 + ) + ) + ) + ) + #f + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 30 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 hal-escort)) + (remove-setting! 'music) + (remove-setting! 'sound-mode) + (let* ((v1-7 (-> arg0 actor-group 0 data 2 actor)) + (a0-3 (when v1-7 + (let ((s5-0 (-> v1-7 extra process))) + (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + ) + ) + (send-event a0-3 'request 'too-far-fail) + ) + (let ((v1-15 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-15 bytes 5) (the-as uint 1)) + (set! (-> v1-15 bytes 6) (the-as uint 0)) + (set! (-> v1-15 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-15) check-done) + (the-as (function halt-wait-spot hal symbol) (lambda () #f)) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 31 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 hal-escort)) + (remove-setting! 'music) + (remove-setting! 'sound-mode) + (let ((a0-3 *traffic-manager*)) + (send-event a0-3 'deactivate-by-type 6) + ) + (set-action! + *gui-control* + (gui-action stop) + (the-as sound-id 1) + (gui-channel art-load) + (gui-action none) + (the-as string #f) + (the-as (function gui-connection symbol) #f) + (the-as process #f) + ) + (let ((v1-12 (get-task-by-type (-> arg0 ai-ctrl) halt-wait-spot arg0))) + (set! (-> v1-12 bytes 5) (the-as uint 1)) + (set! (-> v1-12 bytes 6) (the-as uint 7)) + (set! (-> v1-12 bytes 4) (the-as uint 0)) + (set! (-> (the-as halt-wait-spot v1-12) check-done) + (the-as (function halt-wait-spot hal symbol) (lambda () #f)) + ) + ) + (none) + ) + :on-update (lambda ((arg0 hal-escort)) + (when (not (logtest? (-> arg0 waypoint-bits) 1)) + (let* ((a1-1 (nav-mesh-from-res-tag (-> arg0 entity) 'nav-mesh-actor 1)) + (gp-0 (hal-escort-method-234 arg0 a1-1)) + ) + (when gp-0 + (logior! (-> arg0 waypoint-bits) 1) + (let* ((v1-8 (-> arg0 actor-group 0 data 1 actor)) + (a0-3 (when v1-8 + (let ((s5-1 (-> v1-8 extra process))) + (if (type? s5-1 process-focusable) + s5-1 + ) + ) + ) + ) + ) + (send-event a0-3 'instant-arrest gp-0) + ) + ) + ) + ) + (none) + ) + :on-skipping-here #f + :check-too-far #f + ) + ) + :speeches (new 'static 'inline-array bot-speech-info 35 + (new 'static 'bot-speech-info :flags (speech-flags sf03) :hold-time #x5a :slave-id -1 :name "jd001") + (new 'static 'bot-speech-info :flags (speech-flags sf03) :hold-time #x5a :slave-id -1 :name "dsek002") + (new 'static 'bot-speech-info :flags (speech-flags sf05) :hold-time #x5a :slave-id -1 :name "dsek003") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "dsek005") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "dsek006") + (new 'static 'bot-speech-info :flags (speech-flags sf03) :hold-time #x5a :slave-id -1 :name "dsek007") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "dsek008") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "dsek009") + (new 'static 'bot-speech-info :flags (speech-flags sf03) :hold-time #x5a :slave-id -1 :name "dsek010") + (new 'static 'bot-speech-info :flags (speech-flags sf03) :hold-time #x5a :slave-id -1 :name "dsek011") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "dsek012") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "dsek013") + (new 'static 'bot-speech-info :flags (speech-flags sf03) :hold-time #x5a :slave-id -1 :name "jk002") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "jk004") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "kg293a") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "kg299a") + (new 'static 'bot-speech-info :flags (speech-flags sf03) :hold-time #x5a :slave-id -1 :name "dsek001") + (new 'static 'bot-speech-info :flags (speech-flags sf03) :hold-time #x5a :slave-id -1 :name "dsek004") + (new 'static 'bot-speech-info :flags (speech-flags sf03) :hold-time #x5a :slave-id -1 :name "jk001") + (new 'static 'bot-speech-info :flags (speech-flags sf04) :hold-time #x5a :slave-id -1 :name "jk018") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "jk003") + (new 'static 'bot-speech-info :flags (speech-flags sf02) :hold-time #x5a :slave-id -1 :name "jk005") + (new 'static 'bot-speech-info :flags (speech-flags sf02) :hold-time #x5a :slave-id -1 :name "jk006") + (new 'static 'bot-speech-info :flags (speech-flags sf02) :hold-time #x5a :slave-id -1 :name "jk007") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "jk008") + (new 'static 'bot-speech-info :flags (speech-flags sf02) :hold-time #x5a :slave-id -1 :name "jk009") + (new 'static 'bot-speech-info :flags (speech-flags sf02) :hold-time #x5a :slave-id -1 :name "jk010") + (new 'static 'bot-speech-info :flags (speech-flags sf02) :hold-time #x5a :slave-id -1 :name "jk011") + (new 'static 'bot-speech-info :flags (speech-flags sf02) :hold-time #x5a :slave-id -1 :name "jk012") + (new 'static 'bot-speech-info :flags (speech-flags sf02) :hold-time #x5a :slave-id -1 :name "jk013") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "jk017") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "jk015") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "jk016") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "jk014") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "jk019") + ) + :speech-tunings (new 'static 'inline-array bot-speech-tuning 1 + (new 'static 'bot-speech-tuning :fo-min 100 :fo-max #x78 :fo-curve 1 :trans? #f) + ) + :spots (new 'static 'inline-array bot-spot 10 + (new 'static 'bot-spot :center (new 'static 'vector :x 4703355.0 :y 33341.44 :z 225280.0 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4729856.0 :y 33341.44 :z 712335.4 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4729856.0 :y 42926.08 :z 712335.4 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4689756.0 :y 33341.44 :z 103383.04 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4672880.5 :y 33341.44 :z 90644.48 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4530954.0 :y 33341.44 :z 149504.0 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4036812.8 :y 32768.0 :z 4608123.0 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4036812.8 :y 32768.0 :z 4608123.0 :w 53248.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4479918.0 :y 103424.0 :z 4484137.0 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4471275.5 :y 101703.68 :z 4472054.0 :w 126976.0)) + ) + :defend-speeches (new 'static 'bot-speech-list-shuffle + :flags #xa + :last-local-index -1 + :speech-indexes (new 'static 'boxed-array :type int16 20 21 22 23 24 25 26 27 28 29) + ) + ) + ) + +;; failed to figure out what this is: +(set! (-> *bot-course-table* course 10) *hal4-course*) diff --git a/test/decompiler/reference/jak2/levels/city/kid_escort/kidesc-h_REF.gc b/test/decompiler/reference/jak2/levels/city/kid_escort/kidesc-h_REF.gc index 879786f1b3..6788f10de7 100644 --- a/test/decompiler/reference/jak2/levels/city/kid_escort/kidesc-h_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/kid_escort/kidesc-h_REF.gc @@ -14,21 +14,21 @@ :size-assert #x400 :flag-assert #xf003800400 (:methods - (kid-escort-method-225 () none 225) - (kid-escort-method-226 () none 226) - (kid-escort-method-227 () none 227) - (kid-escort-method-228 () none 228) - (kid-escort-method-229 () none 229) - (kid-escort-method-230 () none 230) - (kid-escort-method-231 () none 231) - (kid-escort-method-232 () none 232) - (kid-escort-method-233 () none 233) - (kid-escort-method-234 () none 234) - (kid-escort-method-235 () none 235) - (kid-escort-method-236 () none 236) - (kid-escort-method-237 () none 237) - (kid-escort-method-238 () none 238) - (kid-escort-method-239 () none 239) + (traveling () _type_ :state 225) + (traveling-blocked () _type_ :state 226) + (waiting-idle () _type_ :state 227) + (waiting-turn () _type_ :state 228) + (move-to-vehicle () _type_ :state 229) + (board-vehicle () _type_ :state 230) + (ride-vehicle () _type_ :state 231) + (exit-vehicle () _type_ :state 232) + (knocked-off-vehicle () _type_ :state 233) + (arrested () _type_ :state 234) + (want-exit-vehicle? (_type_ vector) symbol 235) + (check-arrest (_type_) none 236) + (go-waiting-turn (_type_) none 237) + (check-vehicle-exit (_type_) none 238) + (play-walk-anim (_type_) none 239) ) ) @@ -60,10 +60,10 @@ ;; definition of type kidesct-wait-spot (deftype kidesct-wait-spot (ai-task) - ((check-done basic :offset 32) - (which-spot int8 :offset 36) - (num-spots uint8 :offset 37) - (spot-indexes int8 6 :offset 38) + ((check-done (function kidesct-wait-spot kid-escort symbol) :offset 32) + (which-spot int8 :offset 36) + (num-spots uint8 :offset 37) + (spot-indexes uint8 6 :offset 38) ) :method-count-assert 12 :size-assert #x30 diff --git a/test/decompiler/reference/jak2/levels/city/kid_escort/kidesc-states_REF.gc b/test/decompiler/reference/jak2/levels/city/kid_escort/kidesc-states_REF.gc new file mode 100644 index 0000000000..e0ae95d9c6 --- /dev/null +++ b/test/decompiler/reference/jak2/levels/city/kid_escort/kidesc-states_REF.gc @@ -0,0 +1,1143 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(defstate waiting-idle (kid-escort) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (nav-enemy-method-167 self) + (let ((v1-7 self)) + (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (vector-reset! (-> self root-override2 transv)) + (look-at-target! self (enemy-flag lock-focus)) + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + :trans (behavior () + (bot-method-223 self #f) + (b! + (not (and (-> self focus-info fproc) (>= (fabs (-> self focus-info ry-diff)) 9102.223))) + cfg-6 + :delay (empty-form) + ) + (go-waiting-turn self) + (b! #t cfg-15 :delay (nop!)) + (label cfg-6) + (let ((gp-0 (handle->process (-> self arrestor-handle)))) + (if (if (type? gp-0 process-focusable) + gp-0 + ) + (go-virtual arrested) + ) + ) + (label cfg-15) + (when (not (logtest? (-> self focus-status) (focus-status grabbed))) + (cond + ((logtest? (-> self bot-flags) (bot-flags bf15)) + (go-virtual move-to-vehicle) + ) + ((not (outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #f)) + (go-virtual traveling) + ) + ) + ) + (none) + ) + :code (behavior () + (let ((v1-2 (ja-group))) + (cond + ((and v1-2 (= v1-2 (-> self draw art-group data 3))) + (ja-no-eval :num! (seek! max 0.1)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + ) + (else + (ja-channel-push! 1 (seconds 0.2)) + ) + ) + ) + (until #f + (ja-no-eval :group! (-> self draw art-group data 3) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) frames num-frames) -1)) 0.1) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 0.1)) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior kid-escort) nav-enemy-simple-post) + ) + +;; failed to figure out what this is: +(defstate waiting-turn (kid-escort) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (nav-enemy-method-167 self) + (let ((v1-7 self)) + (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (look-at-target! self (enemy-flag lock-focus)) + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + :trans (behavior () + (bot-method-223 self #f) + (when (not (logtest? (-> self focus-status) (focus-status grabbed))) + (if (and (not (outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #f)) + (let ((gp-0 (handle->process (-> self arrestor-handle)))) + (and (not (if (type? gp-0 process-focusable) + gp-0 + ) + ) + (zero? (logand (-> self bot-flags) (bot-flags bf15))) + ) + ) + ) + (go-virtual traveling) + ) + ) + (none) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.1)) + (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))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (check-arrest self) + (none) + ) + :post (behavior () + (seek-toward-heading-vec! + (-> self root-override2) + (-> self focus-info bullseye-xz-dir) + 49152.0 + (seconds 0.05) + ) + (nav-enemy-simple-post) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate traveling (kid-escort) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) + ) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag36) (-> v1-2 enemy-flags)))) + (set! (-> v1-2 nav callback-info) (-> v1-2 enemy-info-override callback-info)) + ) + 0 + (let ((v1-5 self)) + (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-5 enemy-flags)))) + ) + 0 + (stop-looking-at-target! self) + (nav-enemy-method-166 self) + (set! (-> self player-blocking) 0.0) + (none) + ) + :trans (behavior () + (bot-method-223 self #f) + (let ((gp-0 (handle->process (-> self arrestor-handle)))) + (cond + ((if (type? gp-0 process-focusable) + gp-0 + ) + (go-virtual arrested) + ) + ((logtest? (-> self bot-flags) (bot-flags bf15)) + (go-virtual move-to-vehicle) + ) + ((outside-spot-radius? self (the-as bot-spot #f) (the-as vector #f) #t) + (check-arrest self) + ) + ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) + (go-virtual traveling-blocked) + ) + ((and (nav-enemy-method-163 self) + (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + ) + (go-stare2 self) + ) + ) + ) + 0 + (none) + ) + :code (behavior () + (until #f + (play-walk-anim self) + (suspend) + ) + #f + (none) + ) + :post (behavior () + (let ((a0-0 (-> self nav state)) + (v1-1 (-> self spot)) + ) + (logclear! (-> a0-0 flags) (nav-state-flag directional-mode)) + (logior! (-> a0-0 flags) (nav-state-flag target-poly-dirty)) + (set! (-> a0-0 target-post quad) (-> v1-1 center quad)) + ) + 0 + (nav-enemy-travel-post) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate move-to-vehicle (kid-escort) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (if (not (logtest? (enemy-flag enemy-flag36) (-> v1-2 enemy-flags))) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-2 enemy-flags)))) + ) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag36) (-> v1-2 enemy-flags)))) + (set! (-> v1-2 nav callback-info) (-> v1-2 enemy-info-override callback-info)) + ) + 0 + (let ((v1-5 self)) + (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-5 enemy-flags)))) + ) + 0 + (stop-looking-at-target! self) + (nav-enemy-method-166 self) + (set! (-> self player-blocking) 0.0) + (logclear! (-> self focus-status) (focus-status arrestable)) + (none) + ) + :trans (behavior () + (bot-method-223 self #f) + (let ((gp-0 (handle->process (-> self vehicle-handle)))) + (let ((s5-0 (handle->process (-> self arrestor-handle)))) + (cond + ((if (type? s5-0 process-focusable) + s5-0 + ) + (go-virtual arrested) + ) + ((or (not gp-0) + (logtest? (-> (the-as vehicle gp-0) flags) (rigid-body-object-flag dead)) + (not (logtest? (-> self bot-flags) (bot-flags bf15))) + (< (-> self vehicle-seat-index) 0) + ) + (logclear! (-> self bot-flags) (bot-flags bf15)) + (check-arrest self) + ) + ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) (bot-method-208 self)) + (go-virtual traveling-blocked) + ) + ((and (nav-enemy-method-163 self) + (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time)) + ) + (go-stare2 self) + ) + ) + ) + (let ((s5-1 (new 'stack-no-clear 'inline-array 'matrix 2))) + (compute-seat-position (the-as vehicle gp-0) (the-as vector (-> s5-1 0)) (-> self vehicle-seat-index)) + (set! (-> s5-1 0 vector 1 quad) (-> self root-override2 trans quad)) + (set! (-> s5-1 0 trans quad) (-> s5-1 0 quad 0)) + (vector-! + (the-as vector (-> s5-1 1)) + (the-as vector (-> s5-1 0)) + (-> (the-as vehicle gp-0) root-override-2 trans) + ) + (vector-z-quaternion! (-> s5-1 0 vector 2) (-> self root-override2 quat)) + (let ((f30-1 (* 0.5 (vector-vector-xz-distance (-> s5-1 0 vector 1) (-> s5-1 0 trans))))) + (vector-normalize! (-> s5-1 0 vector 2) (* 2.0 f30-1)) + (vector-normalize! (the-as vector (-> s5-1 1)) (* 4.0 f30-1)) + ) + (bot-method-181 + self + (-> s5-1 1 vector 1) + (-> s5-1 0 vector 1) + (-> s5-1 0 vector 2) + (-> s5-1 0 trans) + (the-as vector (-> s5-1 1)) + 0.8 + ) + (let ((a0-30 (-> self nav state)) + (v1-55 (-> s5-1 1 vector 1)) + ) + (logclear! (-> a0-30 flags) (nav-state-flag directional-mode)) + (logior! (-> a0-30 flags) (nav-state-flag target-poly-dirty)) + (set! (-> a0-30 target-post quad) (-> v1-55 quad)) + ) + 0 + (if (and (< (vector-vector-xz-distance (the-as vector (-> s5-1 0)) (-> self root-override2 trans)) 17203.2) + (< (fabs (- (-> s5-1 0 vector 0 y) (-> self root-override2 trans y))) 20480.0) + ) + (go-virtual board-vehicle) + ) + ) + ) + (none) + ) + :code (behavior () + (until #f + (play-walk-anim self) + (suspend) + ) + #f + (none) + ) + :post (the-as (function none :behavior kid-escort) nav-enemy-travel-post) + ) + +;; failed to figure out what this is: +(defstate board-vehicle (kid-escort) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (let ((v1-5 self)) + (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (let ((gp-0 (handle->process (-> self vehicle-handle)))) + (when (or (not (logtest? (-> self bot-flags) (bot-flags bf15))) (< (-> self vehicle-seat-index) 0)) + (logclear! (-> self bot-flags) (bot-flags bf15)) + (check-arrest self) + ) + (put-rider-in-seat (the-as vehicle gp-0) (-> self vehicle-seat-index) self) + ) + (set! (-> self focus-status) (logior (focus-status pilot) (-> self focus-status))) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logior! (-> self focus-status) (focus-status disable)) + (logclear! (-> self focus-status) (focus-status arrestable)) + (logclear! (-> self bot-flags) (bot-flags bf15)) + (none) + ) + :exit (behavior () + (local-vars (v1-6 enemy-flag)) + (logior! (-> self root-override2 nav-flags) (nav-flags has-root-sphere)) + (logclear! (-> self focus-status) (focus-status disable)) + (let ((v1-5 (-> self enemy-flags))) + (if (logtest? v1-5 (enemy-flag checking-water)) + (set! v1-6 (logior v1-5 (enemy-flag enable-on-active))) + (set! v1-6 (logclear v1-5 (enemy-flag enable-on-active))) + ) + ) + (set! (-> self enemy-flags) v1-6) + (logclear! (-> self bot-flags) (bot-flags bf15)) + (none) + ) + :trans (behavior () + (check-vehicle-exit self) + (none) + ) + :code (behavior () + (local-vars (sv-112 float)) + (ja-channel-push! 1 (seconds 0.1)) + (let ((gp-0 (new 'stack-no-clear 'matrix))) + (quaternion-copy! (the-as quaternion (-> gp-0 vector)) (-> self root-override2 quat)) + (ja-no-eval :group! (-> self draw art-group data 10) + :num! (seek! (ja-aframe 1.0 0) 0.25) + :frame-num (ja-aframe 0.0 0) + ) + (until (ja-done? 0) + (let ((s5-1 (handle->process (-> self vehicle-handle))) + (f30-0 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 0.0 0) (ja-aframe 1.0 0))) + ) + (compute-seat-position (the-as vehicle s5-1) (-> gp-0 trans) (-> self vehicle-seat-index)) + (vector-! (-> gp-0 trans) (-> gp-0 trans) (-> self root-override2 trans)) + (quaternion<-rotate-y-vector (the-as quaternion (-> gp-0 vector 1)) (-> gp-0 trans)) + (quaternion-slerp! + (-> self root-override2 quat) + (the-as quaternion (-> gp-0 vector)) + (the-as quaternion (-> gp-0 vector 1)) + f30-0 + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 1.0 0) 0.25)) + ) + (let ((s5-3 (new 'stack-no-clear 'vector))) + (set! (-> s5-3 quad) (-> self root-override2 trans quad)) + (quaternion-copy! (the-as quaternion (-> gp-0 vector)) (-> self root-override2 quat)) + (ja-no-eval :group! (-> self draw art-group data 10) + :num! (seek! (ja-aframe 8.0 0)) + :frame-num (ja-aframe 1.0 0) + ) + (until (ja-done? 0) + (let ((s4-2 (handle->process (-> self vehicle-handle)))) + (compute-seat-position (the-as vehicle s4-2) (-> gp-0 vector 2) (-> self vehicle-seat-index)) + (vector-! (-> gp-0 trans) (-> gp-0 vector 2) s5-3) + (let ((s3-1 lerp-scale) + (s2-1 0.0) + (s1-1 1.0) + (s0-1 (ja-aframe-num 0)) + ) + (set! sv-112 (ja-aframe 1.0 0)) + (let* ((t0-1 (ja-aframe 8.0 0)) + (f30-1 (s3-1 s2-1 s1-1 s0-1 sv-112 t0-1)) + ) + (quaternion-rotate-local-y! + (the-as quaternion (-> gp-0 vector 1)) + (-> (the-as vehicle s4-2) root-override-2 quat) + (* f30-1 (if (zero? (-> self vehicle-seat-index)) + -16384.0 + 16384.0 + ) + ) + ) + (quaternion-slerp! + (-> self root-override2 quat) + (the-as quaternion (-> gp-0 vector)) + (the-as quaternion (-> gp-0 vector 1)) + f30-1 + ) + (vector+float*! (-> self root-override2 trans) s5-3 (-> gp-0 trans) f30-1) + ) + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 8.0 0))) + ) + ) + (logclear! (-> self root-override2 nav-flags) (nav-flags has-root-sphere)) + (let ((v1-49 (-> self nav))) + (logclear! (-> v1-49 shape nav-flags) (nav-flags has-extra-sphere)) + ) + 0 + (quaternion-copy! (new 'stack-no-clear 'quaternion) (-> self root-override2 quat)) + (ja-no-eval :group! (-> self draw art-group data 10) + :num! (seek! (ja-aframe 12.0 0) 0.25) + :frame-num (ja-aframe 8.0 0) + ) + (until (ja-done? 0) + (let ((s5-5 (handle->process (-> self vehicle-handle)))) + (quaternion-copy! (the-as quaternion (-> gp-0 vector 1)) (-> (the-as vehicle s5-5) root-override-2 quat)) + (compute-seat-position (the-as vehicle s5-5) (-> self root-override2 trans) (-> self vehicle-seat-index)) + ) + (let ((f0-16 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 8.0 0) (ja-aframe 11.0 0)))) + (quaternion-rotate-local-y! + (-> self root-override2 quat) + (the-as quaternion (-> gp-0 vector 1)) + (* (- 1.0 f0-16) (if (zero? (-> self vehicle-seat-index)) + -16384.0 + 16384.0 + ) + ) + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 12.0 0) 0.25)) + ) + ) + (set! (-> self focus-status) (logior (focus-status pilot-riding pilot) (-> self focus-status))) + (go-virtual ride-vehicle) + (none) + ) + :post (the-as (function none :behavior kid-escort) nav-enemy-simple-post) + ) + +;; failed to figure out what this is: +(defstate ride-vehicle (kid-escort) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (let ((v1-5 self)) + (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self root-override2 nav-flags) (nav-flags has-root-sphere)) + (let ((v1-11 (-> self nav))) + (logclear! (-> v1-11 shape nav-flags) (nav-flags has-extra-sphere)) + ) + 0 + (set! (-> self focus-status) (logior (focus-status disable pilot-riding pilot) (-> self focus-status))) + (logclear! (-> self focus-status) (focus-status arrestable)) + (none) + ) + :exit (behavior () + (local-vars (v1-4 enemy-flag)) + (logior! (-> self root-override2 nav-flags) (nav-flags has-root-sphere)) + (let ((v1-3 (-> self enemy-flags))) + (if (logtest? v1-3 (enemy-flag checking-water)) + (set! v1-4 (logior v1-3 (enemy-flag enable-on-active))) + (set! v1-4 (logclear v1-3 (enemy-flag enable-on-active))) + ) + ) + (set! (-> self enemy-flags) v1-4) + (logclear! (-> self bot-flags) (bot-flags bf15)) + (none) + ) + :trans (behavior () + (check-vehicle-exit self) + (if (and (logtest? (bot-flags bf16) (-> self bot-flags)) (want-exit-vehicle? self (-> self exit-vehicle-dest))) + (go-virtual exit-vehicle) + ) + 0 + (none) + ) + :code (behavior () + (ja-channel-push! 2 (seconds 0.2)) + (ja :group! (-> self draw art-group data 11)) + (ja :chan 1 :group! (-> self draw art-group data 12)) + (let ((f30-0 0.5) + (f28-0 0.5) + (f26-0 0.5) + ) + (until #f + (let ((gp-0 (-> *target* pilot))) + (when (and (nonzero? gp-0) gp-0) + (let ((f20-0 (lerp-scale 0.0 1.0 (-> gp-0 left-right-interp) 1.0 -1.0)) + (f24-0 (lerp-scale 0.0 1.0 (-> gp-0 front-back-interp) -1.0 1.0)) + (f0-4 (+ (fabs (-> gp-0 left-right-interp)) (fabs (-> gp-0 front-back-interp)))) + (f22-0 0.5) + ) + (if (< 0.0 f0-4) + (set! f22-0 (/ (fabs (-> gp-0 front-back-interp)) f0-4)) + ) + (set! f30-0 (seek f30-0 f20-0 (* 4.0 (-> self clock seconds-per-frame)))) + (set! f28-0 (seek f28-0 f24-0 (* 4.0 (-> self clock seconds-per-frame)))) + (set! f26-0 (seek f26-0 f22-0 (* 4.0 (-> self clock seconds-per-frame)))) + ) + ) + ) + (ja :num-func num-func-identity :frame-num (ja-aframe f30-0 0)) + (let ((gp-2 (-> self skel root-channel 1))) + (set! (-> gp-2 frame-interp 1) f26-0) + (set! (-> gp-2 frame-interp 0) f26-0) + (set! (-> gp-2 num-func) num-func-identity) + (set! (-> gp-2 frame-num) (ja-aframe f28-0 0)) + ) + (suspend) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior kid-escort) nav-enemy-simple-post) + ) + +;; failed to figure out what this is: +(defstate exit-vehicle (kid-escort) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (let ((v1-5 self)) + (set! (-> v1-5 enemy-flags) (the-as enemy-flag (logclear (-> v1-5 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (logior! (-> self root-override2 nav-flags) (nav-flags has-root-sphere)) + (logior! (-> self focus-status) (focus-status disable)) + (logclear! (-> self focus-status) (focus-status arrestable)) + (none) + ) + :exit (behavior () + (local-vars (v1-17 enemy-flag)) + (let ((a0-1 (handle->process (-> self vehicle-handle)))) + (if a0-1 + (remove-rider (the-as vehicle a0-1) self) + ) + ) + (set! (-> self vehicle-seat-index) -1) + (set! (-> self vehicle-handle) (the-as handle #f)) + (logclear! (-> self bot-flags) (bot-flags bf16)) + (logclear! (-> self focus-status) (focus-status pilot-riding pilot)) + (let ((v1-11 (-> self nav))) + (logclear! (-> v1-11 shape nav-flags) (nav-flags has-extra-sphere)) + ) + 0 + (logclear! (-> self focus-status) (focus-status disable)) + (let ((v1-16 (-> self enemy-flags))) + (if (logtest? v1-16 (enemy-flag checking-water)) + (set! v1-17 (logior v1-16 (enemy-flag enable-on-active))) + (set! v1-17 (logclear v1-16 (enemy-flag enable-on-active))) + ) + ) + (set! (-> self enemy-flags) v1-17) + (logclear! (-> self bot-flags) (bot-flags bf15)) + (none) + ) + :trans (behavior () + (check-vehicle-exit self) + (none) + ) + :code (behavior () + (local-vars (sv-80 float) (sv-96 float)) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 10) + :num! (seek! (ja-aframe 8.0 0) 0.25) + :frame-num (ja-aframe 12.0 0) + ) + (until (ja-done? 0) + (let ((gp-1 (handle->process (-> self vehicle-handle)))) + (quaternion-copy! (-> self root-override2 quat) (-> (the-as vehicle gp-1) root-override-2 quat)) + (compute-seat-position (the-as vehicle gp-1) (-> self root-override2 trans) (-> self vehicle-seat-index)) + ) + (let ((f0-3 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 11.0 0) (ja-aframe 8.0 0)))) + (quaternion-rotate-local-y! + (-> self root-override2 quat) + (-> self root-override2 quat) + (* f0-3 (if (zero? (-> self vehicle-seat-index)) + -16384.0 + 16384.0 + ) + ) + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 8.0 0) 0.25)) + ) + (logclear! (-> self focus-status) (focus-status pilot-riding)) + (let ((gp-4 (new 'stack-no-clear 'vector)) + (s5-1 (new 'stack-no-clear 'quaternion)) + ) + (set! (-> gp-4 quad) (-> self root-override2 trans quad)) + (ja-no-eval :group! (-> self draw art-group data 10) + :num! (seek! (ja-aframe 0.0 0)) + :frame-num (ja-aframe 8.0 0) + ) + (until (ja-done? 0) + (let ((s4-2 (handle->process (-> self vehicle-handle)))) + (compute-seat-position (the-as vehicle s4-2) gp-4 (-> self vehicle-seat-index)) + (quaternion-rotate-local-y! + s5-1 + (-> (the-as vehicle s4-2) root-override-2 quat) + (if (zero? (-> self vehicle-seat-index)) + -16384.0 + 16384.0 + ) + ) + ) + (let ((s4-3 (-> self root-override2 quat))) + (let ((f30-0 (quaternion-y-angle s5-1))) + (quaternion-identity! s4-3) + (quaternion-rotate-y! s4-3 s4-3 f30-0) + ) + (let ((s3-1 lerp-scale) + (s2-1 0.0) + (s1-0 1.0) + (s0-0 (ja-aframe-num 0)) + ) + (set! sv-80 (ja-aframe 8.0 0)) + (let* ((t0-1 (ja-aframe 1.0 0)) + (f0-11 (s3-1 s2-1 s1-0 s0-0 sv-80 t0-1)) + ) + (quaternion-slerp! s4-3 s5-1 s4-3 f0-11) + ) + ) + ) + (want-exit-vehicle? self (-> self exit-vehicle-dest)) + (let* ((v1-44 (-> self nav)) + (a1-25 (-> self exit-vehicle-dest)) + (f0-12 (-> v1-44 extra-nav-sphere w)) + ) + (set! (-> v1-44 extra-nav-sphere quad) (-> a1-25 quad)) + (set! (-> v1-44 extra-nav-sphere w) f0-12) + ) + 0 + (let ((v1-47 (-> self nav))) + (set! (-> v1-47 extra-nav-sphere w) (-> self nav-radius-backup)) + ) + 0 + (let ((v1-49 (-> self nav))) + (logior! (-> v1-49 shape nav-flags) (nav-flags has-extra-sphere)) + ) + 0 + (new 'stack-no-clear 'vector) + (let ((s4-4 (new 'stack-no-clear 'vector))) + (vector-! s4-4 gp-4 (-> self exit-vehicle-dest)) + (let ((s3-2 lerp-scale) + (s2-2 0.0) + (s1-1 1.0) + (s0-1 (ja-aframe-num 0)) + ) + (set! sv-96 (ja-aframe 1.0 0)) + (let* ((t0-2 (ja-aframe 8.0 0)) + (f0-15 (s3-2 s2-2 s1-1 s0-1 sv-96 t0-2)) + ) + (vector+float*! (-> self root-override2 trans) (-> self exit-vehicle-dest) s4-4 f0-15) + ) + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 0.0 0))) + ) + ) + (react-to-focus self) + (none) + ) + :post (the-as (function none :behavior kid-escort) nav-enemy-simple-post) + ) + +;; failed to figure out what this is: +(defstate traveling-blocked (kid-escort) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (nav-enemy-method-167 self) + (let ((v1-7 self)) + (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (vector-reset! (-> self root-override2 transv)) + (look-at-target! self (enemy-flag lock-focus)) + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + :trans (behavior () + (bot-method-223 self #f) + (let ((gp-0 (handle->process (-> self arrestor-handle)))) + (cond + ((if (type? gp-0 process-focusable) + gp-0 + ) + (go-virtual arrested) + ) + ((and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) (not (bot-method-208 self))) + (if (logtest? (-> self bot-flags) (bot-flags bf15)) + (go-virtual move-to-vehicle) + (go-virtual traveling) + ) + ) + ) + ) + (none) + ) + :code (-> (method-of-type kid-escort waiting-idle) code) + :post (the-as (function none :behavior kid-escort) nav-enemy-simple-post) + ) + +;; failed to figure out what this is: +(defstate stare (kid-escort) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type bot stare) enter))) + (if t9-0 + (t9-0) + ) + ) + (let ((v1-4 self)) + (set! (-> v1-4 enemy-flags) (the-as enemy-flag (logclear (-> v1-4 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + :trans (behavior () + (bot-method-223 self #f) + (let ((gp-0 (handle->process (-> self arrestor-handle)))) + (if (if (type? gp-0 process-focusable) + gp-0 + ) + (go-virtual arrested) + ) + ) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (when (not (nav-enemy-method-163 self)) + (if (logtest? (-> self bot-flags) (bot-flags bf15)) + (go-virtual move-to-vehicle) + (go-virtual traveling) + ) + ) + ) + (none) + ) + :code (-> (method-of-type kid-escort waiting-idle) code) + ) + +;; failed to figure out what this is: +(defstate hit (kid-escort) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type bot hit) enter))) + (if t9-0 + (t9-0) + ) + ) + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + :code (behavior () + (local-vars (v1-7 enemy-flag) (v1-15 enemy-flag)) + (if (logtest? (-> self enemy-flags) (enemy-flag check-water)) + (logior! (-> self focus-status) (focus-status dangerous)) + (logclear! (-> self focus-status) (focus-status dangerous)) + ) + (let ((v1-6 (-> self enemy-flags))) + (if (logtest? v1-6 (enemy-flag checking-water)) + (set! v1-7 (logior v1-6 (enemy-flag enable-on-active))) + (set! v1-7 (logclear v1-6 (enemy-flag enable-on-active))) + ) + ) + (set! (-> self enemy-flags) v1-7) + (if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (set! (-> self mask) (logior (process-mask collectable) (-> self mask))) + (logclear! (-> self mask) (process-mask collectable)) + ) + (let ((v1-14 (-> self enemy-flags))) + (if (logtest? (enemy-flag no-initial-move-to-ground) v1-14) + (set! v1-15 (logior (enemy-flag check-water-backup) v1-14)) + (set! v1-15 (logclear v1-14 (enemy-flag check-water-backup))) + ) + ) + (set! (-> self enemy-flags) v1-15) + (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logclear! (-> self focus-status) (focus-status hit)) + (react-to-focus self) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate knocked (kid-escort) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type bot knocked) enter))) + (if t9-0 + (t9-0) + ) + ) + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate arrested (kid-escort) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (nav-enemy-method-167 self) + (let ((v1-7 self)) + (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (vector-reset! (-> self root-override2 transv)) + (stop-looking-at-target! self) + (set! (-> self travel-anim-interp) 0.0) + (set! (-> self focus-status) (logior (focus-status arrestable) (-> self focus-status))) + (logclear! (-> self focus-status) (focus-status disable)) + (if (logtest? (bot-flags bf19) (-> self bot-flags)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-active checking-water)) + ) + (none) + ) + :trans (behavior () + (cond + ((logtest? (-> self bot-flags) (bot-flags bf09)) + (fail-falling self) + ) + (else + (bot-method-223 self #f) + (when (not (logtest? (bot-flags bf19) (-> self bot-flags))) + (if (and (-> self focus-info fproc) (>= (fabs (-> self focus-info ry-diff)) 9102.223)) + (go-waiting-turn self) + ) + (when (not (logtest? (-> self focus-status) (focus-status grabbed))) + (let ((gp-0 (handle->process (-> self arrestor-handle)))) + (if (not (if (type? gp-0 process-focusable) + gp-0 + ) + ) + (react-to-focus self) + ) + ) + ) + ) + ) + ) + (none) + ) + :code (behavior () + (cond + ((logtest? (bot-flags bf19) (-> self bot-flags)) + (fail-mission! self) + (let* ((gp-0 (handle->process (-> self arrestor-handle))) + (v1-7 (if (type? gp-0 process-focusable) + gp-0 + ) + ) + ) + (if v1-7 + (logclear! (-> (the-as crimson-guard v1-7) enemy-flags) (enemy-flag enable-on-active checking-water)) + ) + ) + ) + (else + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 8) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 8)) frames num-frames) -1)) + 0.143 + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 0.143)) + ) + ) + ) + (let ((v1-34 (ja-group))) + (if (not (and v1-34 (= v1-34 (-> self draw art-group data 8)))) + (ja-channel-push! 1 (seconds 0.1)) + ) + ) + (ja-no-eval :group! (-> self draw art-group data 9) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 9)) frames num-frames) -1)) 0.1) + :frame-num 0.0 + ) + (when (not (logtest? (bot-flags bf19) (-> self bot-flags))) + (until #f + (until (ja-done? 0) + (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2.5)) + (goto cfg-27) + ) + (suspend) + (ja :num! (seek! max 0.1)) + ) + (ja-no-eval :group! (-> self draw art-group data 9) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 9)) frames num-frames) -1)) 0.1) + :frame-num 0.0 + ) + ) + #f + (label cfg-27) + (fail-mission! self) + (let* ((gp-1 (handle->process (-> self arrestor-handle))) + (v1-93 (if (type? gp-1 process-focusable) + gp-1 + ) + ) + ) + (if v1-93 + (logclear! (-> (the-as crimson-guard v1-93) enemy-flags) (enemy-flag enable-on-active checking-water)) + ) + ) + ) + (set! (-> self state-time) (-> self clock frame-counter)) + (until #f + (until (ja-done? 0) + (if (and (logtest? (-> self bot-flags) (bot-flags failed)) + (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (reset? *fail-mission-control*) + ) + (reset! *fail-mission-control*) + ) + (suspend) + (ja :num! (seek! max 0.1)) + ) + (ja-no-eval :group! (-> self draw art-group data 9) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 9)) frames num-frames) -1)) 0.1) + :frame-num 0.0 + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior kid-escort) nav-enemy-simple-post) + ) + +;; failed to figure out what this is: +(defstate die-falling (kid-escort) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type bot die-falling) enter))) + (if t9-0 + (t9-0) + ) + ) + (set! (-> self travel-anim-interp) 0.0) + (set! (-> self focus-status) (logior (focus-status arrestable) (-> self focus-status))) + (logclear! (-> self focus-status) (focus-status disable)) + (none) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 8) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 8)) frames num-frames) -1)) + 0.143 + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 0.143)) + ) + (ja-no-eval :group! (-> self draw art-group data 9) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 9)) frames num-frames) -1)) 0.1) + :frame-num 0.0 + ) + (until #f + (until (ja-done? 0) + (if (and (logtest? (-> self bot-flags) (bot-flags failed)) + (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (reset? *fail-mission-control*) + ) + (reset! *fail-mission-control*) + ) + (suspend) + (ja :num! (seek! max 0.1)) + ) + (ja-no-eval :group! (-> self draw art-group data 9) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 9)) frames num-frames) -1)) 0.1) + :frame-num 0.0 + ) + ) + #f + (none) + ) + ) + +;; failed to figure out what this is: +(defstate failed (kid-escort) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type bot failed) enter))) + (if t9-0 + (t9-0) + ) + ) + (set! (-> self travel-anim-interp) 0.0) + (set! (-> self focus-status) (logior (focus-status arrestable) (-> self focus-status))) + (logclear! (-> self focus-status) (focus-status disable)) + (none) + ) + :code (-> (method-of-type kid-escort die-falling) code) + ) + +;; failed to figure out what this is: +(defstate knocked-off-vehicle (kid-escort) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior kid-escort) enemy-event-handler) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-2 self)) + (set! (-> v1-2 enemy-flags) (the-as enemy-flag (logclear (-> v1-2 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-2 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (nav-enemy-method-167 self) + (let ((v1-7 self)) + (set! (-> v1-7 enemy-flags) (the-as enemy-flag (logclear (-> v1-7 enemy-flags) (enemy-flag enemy-flag37)))) + ) + 0 + (vector-reset! (-> self root-override2 transv)) + (stop-looking-at-target! self) + (logior! (-> self bot-flags) (bot-flags bf09)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-active checking-water)) + (logclear! (-> self focus-status) (focus-status dangerous)) + (logclear! (-> self enemy-flags) (enemy-flag check-water)) + (logclear! (-> self mask) (process-mask collectable)) + (logclear! (-> self enemy-flags) (enemy-flag look-at-move-dest)) + (logclear! (-> self mask) (process-mask actor-pause)) + (logclear! (-> self enemy-flags) (enemy-flag notice)) + (set! (-> self focus-status) (logior (focus-status arrestable) (-> self focus-status))) + (logior! (-> self focus-status) (focus-status disable)) + (set! (-> self travel-anim-interp) 0.0) + (none) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.2)) + (dotimes (gp-0 3) + (ja-no-eval :group! (-> self draw art-group data 3) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) frames num-frames) -1)) 0.1) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 0.1)) + ) + ) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 8) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 8)) frames num-frames) -1)) + 0.143 + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 0.143)) + ) + (until #f + (ja-no-eval :group! (-> self draw art-group data 9) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 9)) frames num-frames) -1)) 0.1) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 0.1)) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior kid-escort) nav-enemy-simple-post) + ) diff --git a/test/decompiler/reference/jak2/levels/city/kid_escort/kidesc-task_REF.gc b/test/decompiler/reference/jak2/levels/city/kid_escort/kidesc-task_REF.gc new file mode 100644 index 0000000000..2f0f533f49 --- /dev/null +++ b/test/decompiler/reference/jak2/levels/city/kid_escort/kidesc-task_REF.gc @@ -0,0 +1,49 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 9 of type kidesct-wait-spot +;; WARN: Return type mismatch int vs none. +(defmethod reset-task! kidesct-wait-spot ((obj kidesct-wait-spot)) + (set! (-> obj check-done) #f) + (set! (-> obj which-spot) -1) + (set! (-> obj num-spots) (the-as uint 0)) + 0 + (none) + ) + +;; definition for method 11 of type kidesct-wait-spot +;; WARN: Return type mismatch symbol vs none. +(defmethod ai-task-method-11 kidesct-wait-spot ((obj kidesct-wait-spot) (arg0 bot)) + (let ((s4-0 (-> obj which-spot))) + (when (>= s4-0 0) + (let ((s3-0 (-> arg0 course spots (-> obj spot-indexes s4-0)))) + (if (and (not (outside-spot-radius? arg0 s3-0 (the-as vector #f) #f)) (player-blocking-spot? arg0 s3-0)) + (set! s4-0 -1) + ) + ) + ) + (when (< s4-0 0) + (set! s4-0 (choose-spot arg0 (the-as int (-> obj num-spots)) (the-as (pointer uint) (-> obj spot-indexes)))) + (set! (-> obj which-spot) s4-0) + (mem-copy! + (the-as pointer (-> arg0 spot)) + (the-as pointer (-> arg0 course spots (-> obj spot-indexes s4-0))) + 20 + ) + ) + (if (logtest? *display-bot-marks* (bot-marks-controls bmc16)) + (bot-debug-draw-spot-sphere + arg0 + (the-as int (-> obj num-spots)) + (the-as (pointer uint) (-> obj spot-indexes)) + (the-as int (-> obj spot-indexes s4-0)) + ) + ) + ) + ((-> obj check-done) obj (the-as kid-escort arg0)) + (none) + ) + + + + diff --git a/test/decompiler/reference/jak2/levels/city/kid_escort/kidesc4-course_REF.gc b/test/decompiler/reference/jak2/levels/city/kid_escort/kidesc4-course_REF.gc new file mode 100644 index 0000000000..950bd11462 --- /dev/null +++ b/test/decompiler/reference/jak2/levels/city/kid_escort/kidesc4-course_REF.gc @@ -0,0 +1,404 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for function kid4-update-spot-to-track-crocadog +;; WARN: Return type mismatch float vs none. +(defun kid4-update-spot-to-track-crocadog ((arg0 kid-escort)) + (let* ((s5-0 (handle->process (-> arg0 crocadog-handle))) + (a0-5 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when a0-5 + (let ((v1-4 (get-trans (the-as process-focusable a0-5) 0)) + (a0-6 (-> arg0 spot)) + ) + (set! (-> a0-6 center x) (-> v1-4 x)) + (set! (-> a0-6 center y) (-> v1-4 y)) + (set! (-> a0-6 center z) (-> v1-4 z)) + ) + ) + ) + (none) + ) + +;; definition for symbol *kid4-course*, type bot-course +(define *kid4-course* + (new 'static 'bot-course + :course-id #xb + :spot-count #x8 + :default-check-too-far #f + :waypoints (new 'static 'boxed-array :type bot-waypoint + (new 'static 'bot-waypoint + :waypoint-id 1 + :skip-to -1 + :on-set (lambda ((arg0 kid-escort)) + (process-entity-status! arg0 (entity-perm-status no-kill) #t) + (clear-speech-flags! arg0) + (logior! (-> arg0 focus-status) (focus-status disable)) + (set! (-> arg0 notice-enemy-dist) 0.0) + (let ((v1-5 (-> arg0 root-override2 root-prim))) + (set! (-> v1-5 prim-core collide-as) (collide-spec)) + (set! (-> v1-5 prim-core collide-with) (collide-spec)) + ) + 0 + (move-to-point! (-> arg0 root-override2) (the-as vector (-> arg0 course spots 0))) + (logclear! (-> arg0 mask) (process-mask actor-pause)) + (logclear! (-> arg0 enemy-flags) (enemy-flag notice)) + (let ((v1-16 (get-task-by-type (-> arg0 ai-ctrl) kidesct-wait-spot arg0))) + (set! (-> v1-16 bytes 5) (the-as uint 1)) + (set! (-> v1-16 bytes 6) (the-as uint 0)) + (set! (-> v1-16 bytes 4) (the-as uint -1)) + (set! (-> (the-as kidesct-wait-spot v1-16) check-done) + (the-as + (function kidesct-wait-spot kid-escort symbol) + (lambda ((arg0 object) (arg1 kid-escort)) + (when (< 1 (-> arg1 waypoint-request)) + (let* ((a0-2 (-> arg1 actor-group 0 data 0 actor)) + (v1-4 (if a0-2 + (-> a0-2 extra process) + ) + ) + ) + (when v1-4 + (set! (-> arg1 master-handle) (process->handle v1-4)) + (set! (-> arg1 crocadog-handle) (-> (the-as hal-escort v1-4) slave-handle 1)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 2 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 2 + :nav-mesh-index -1 + :skip-to #xe + :on-set (lambda ((arg0 kid-escort)) + (add-icon! *minimap* arg0 (the-as uint 24) (the-as int #f) (the-as vector #t) 0) + (let ((v1-3 (-> arg0 root-override2 root-prim))) + (set! (-> v1-3 prim-core collide-as) (-> arg0 root-override2 backup-collide-as)) + (set! (-> v1-3 prim-core collide-with) (-> arg0 root-override2 backup-collide-with)) + ) + (logclear! (-> arg0 focus-status) (focus-status disable)) + (set! (-> arg0 focus-status) (logior (focus-status arrestable) (-> arg0 focus-status))) + (let ((v1-9 (get-task-by-type (-> arg0 ai-ctrl) kidesct-wait-spot arg0))) + (set! (-> v1-9 bytes 5) (the-as uint 1)) + (set! (-> v1-9 bytes 6) (the-as uint 1)) + (set! (-> v1-9 bytes 4) (the-as uint -1)) + (set! (-> (the-as kidesct-wait-spot v1-9) check-done) + (the-as + (function kidesct-wait-spot kid-escort symbol) + (lambda ((arg0 object) (arg1 kid-escort)) + (let* ((s5-0 (handle->process (-> arg1 crocadog-handle))) + (a0-5 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (and a0-5 (>= (the-as int (send-event a0-5 'query 'waypoint)) 17)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 17 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 kid-escort)) (kid4-update-spot-to-track-crocadog arg0) (none)) + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 14 + :nav-mesh-index -1 + :skip-to #x13 + :on-set (lambda ((arg0 kid-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) kidesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 3)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as kidesct-wait-spot v1-1) check-done) + (the-as + (function kidesct-wait-spot kid-escort symbol) + (lambda ((arg0 object) (arg1 kid-escort)) + (let* ((s5-0 (handle->process (-> arg1 crocadog-handle))) + (a0-5 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (and a0-5 (>= (the-as int (send-event a0-5 'query 'waypoint)) 17)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 17 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 kid-escort)) (kid4-update-spot-to-track-crocadog arg0) (none)) + :on-skipping-here (lambda ((arg0 kid-escort)) + (let ((v1-1 (-> arg0 root-override2 root-prim))) + (set! (-> v1-1 prim-core collide-as) (-> arg0 root-override2 backup-collide-as)) + (set! (-> v1-1 prim-core collide-with) (-> arg0 root-override2 backup-collide-with)) + ) + (logclear! (-> arg0 focus-status) (focus-status disable)) + (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) + (send-event arg0 'move-trans (-> arg0 course spots 2)) + (none) + ) + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 17 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 kid-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) kidesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 4)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as kidesct-wait-spot v1-1) check-done) + (the-as + (function kidesct-wait-spot kid-escort symbol) + (lambda ((arg0 object) (arg1 kid-escort)) (when (logtest? (focus-status pilot) (-> arg1 focus-status)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 18 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 18 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 kid-escort)) + (clear-poi-and-focus! arg0) + (let ((v1-3 (get-task-by-type (-> arg0 ai-ctrl) kidesct-wait-spot arg0))) + (set! (-> v1-3 bytes 5) (the-as uint 1)) + (set! (-> v1-3 bytes 6) (the-as uint 4)) + (set! (-> v1-3 bytes 4) (the-as uint -1)) + (set! (-> (the-as kidesct-wait-spot v1-3) check-done) + (the-as + (function kidesct-wait-spot kid-escort symbol) + (lambda ((arg0 object) (arg1 kid-escort)) + (when (and (not (logtest? (focus-status pilot) (-> arg1 focus-status))) + (zero? (logand (bot-flags bf17) (-> arg1 bot-flags))) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 19 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 19 + :nav-mesh-index 1 + :skip-to -1 + :on-set (lambda ((arg0 kid-escort)) + (logior! (-> arg0 focus-status) (focus-status disable)) + (set! (-> arg0 focus-status) (logior (focus-status arrestable) (-> arg0 focus-status))) + (let ((v1-5 (get-task-by-type (-> arg0 ai-ctrl) kidesct-wait-spot arg0))) + (set! (-> v1-5 bytes 5) (the-as uint 1)) + (set! (-> v1-5 bytes 6) (the-as uint 1)) + (set! (-> v1-5 bytes 4) (the-as uint -1)) + (set! (-> (the-as kidesct-wait-spot v1-5) check-done) + (the-as + (function kidesct-wait-spot kid-escort symbol) + (lambda ((arg0 object) (arg1 kid-escort)) + (let* ((s5-0 (handle->process (-> arg1 crocadog-handle))) + (a0-5 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (when (and a0-5 (>= (the-as int (send-event a0-5 'query 'waypoint)) 21)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 21 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 object) (arg1 kid-escort)) + (the-as symbol (kid4-update-spot-to-track-crocadog (the-as kid-escort arg0))) + ) + :on-skipping-here (lambda ((arg0 kid-escort)) + (let ((v1-1 (-> arg0 root-override2 root-prim))) + (set! (-> v1-1 prim-core collide-as) (-> arg0 root-override2 backup-collide-as)) + (set! (-> v1-1 prim-core collide-with) (-> arg0 root-override2 backup-collide-with)) + ) + (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) + (send-event arg0 'move-trans (-> arg0 course spots 5)) + (none) + ) + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 21 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 kid-escort)) + (logclear! (-> arg0 focus-status) (focus-status disable)) + (set! (-> arg0 focus-status) (logior (focus-status arrestable) (-> arg0 focus-status))) + (let ((v1-5 (get-task-by-type (-> arg0 ai-ctrl) kidesct-wait-spot arg0))) + (set! (-> v1-5 bytes 5) (the-as uint 1)) + (set! (-> v1-5 bytes 6) (the-as uint 1)) + (set! (-> v1-5 bytes 4) (the-as uint -1)) + (set! (-> (the-as kidesct-wait-spot v1-5) check-done) + (the-as + (function kidesct-wait-spot kid-escort symbol) + (lambda ((arg0 object) (arg1 kid-escort)) + (let* ((s4-0 (handle->process (-> arg1 crocadog-handle))) + (s5-0 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + (when (and (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + s5-0 + (>= (the-as int (send-event s5-0 'query 'waypoint)) 25) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 25 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 kid-escort)) (kid4-update-spot-to-track-crocadog arg0) (none)) + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 25 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 kid-escort)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) kidesct-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 1)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as kidesct-wait-spot v1-1) check-done) + (the-as + (function kidesct-wait-spot kid-escort symbol) + (lambda ((arg0 object) (arg1 kid-escort)) (when (>= (-> arg1 waypoint-request) 26) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 26 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 kid-escort)) (kid4-update-spot-to-track-crocadog arg0) (none)) + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 26 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 kid-escort)) + (logclear! (-> arg0 focus-status) (focus-status disable)) + (send-event (ppointer->process (-> arg0 my-simple-focus)) 'move-trans (-> arg0 course spots 7)) + (set! (-> arg0 poi-handle) (ppointer->handle (-> arg0 my-simple-focus))) + (set! (-> arg0 focus-mode) 1) + (let ((v1-16 (get-task-by-type (-> arg0 ai-ctrl) kidesct-wait-spot arg0))) + (set! (-> v1-16 bytes 5) (the-as uint 1)) + (set! (-> v1-16 bytes 6) (the-as uint 6)) + (set! (-> v1-16 bytes 4) (the-as uint -1)) + (set! (-> (the-as kidesct-wait-spot v1-16) check-done) + (the-as + (function kidesct-wait-spot kid-escort symbol) + (lambda ((arg0 object) (arg1 kid-escort)) + (with-pp + (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2)) + (let ((v1-4 (-> arg1 spot))) + (set! (-> v1-4 center quad) (-> arg1 root-override2 trans quad)) + (set! (-> v1-4 center w) 20480.0) + ) + ) + #f + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + ) + :spots (new 'static 'inline-array bot-spot 8 + (new 'static 'bot-spot :center (new 'static 'vector :x 4704133.0 :y 33341.44 :z 194764.8 :w 10240.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4707041.5 :y 33341.44 :z 711761.94 :w 8192.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4454113.5 :y 33341.44 :z 694026.25 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4488438.0 :y 33341.44 :z 751697.94 :w 20480.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4746608.5 :y 33341.44 :z 715816.94 :w 61440.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4086620.2 :y 32768.0 :z 4637122.5 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4494663.5 :y 102891.52 :z 4493230.0 :w 8192.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x 4588544.0 :y 112640.0 :z 4589322.0 :w 4096.0)) + ) + ) + ) + +;; failed to figure out what this is: +(set! (-> *bot-course-table* course 11) *kid4-course*) + + + + diff --git a/test/decompiler/reference/jak2/levels/city/market/east/ashelin/ash4-course_REF.gc b/test/decompiler/reference/jak2/levels/city/market/east/ashelin/ash4-course_REF.gc new file mode 100644 index 0000000000..ac749efe5e --- /dev/null +++ b/test/decompiler/reference/jak2/levels/city/market/east/ashelin/ash4-course_REF.gc @@ -0,0 +1,560 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type ashelin-tanker +(deftype ashelin-tanker (ashelin) + ((suppress traffic-suppression-params :inline :offset-assert 1040) + ) + :heap-base #x3c0 + :method-count-assert 252 + :size-assert #x439 + :flag-assert #xfc03c00439 + (:methods + (suppress-traffic (_type_) none 251) + ) + ) + +;; definition for method 3 of type ashelin-tanker +(defmethod inspect ashelin-tanker ((obj ashelin-tanker)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type ashelin inspect))) + (t9-0 obj) + ) + (format #t "~2Tsuppress: #~%" (-> obj suppress)) + (label cfg-4) + obj + ) + +;; definition for method 116 of type ashelin-tanker +;; WARN: Return type mismatch object vs none. +(defmethod go-idle ashelin-tanker ((obj ashelin-tanker)) + (cond + ((task-node-closed? (game-task-node city-intercept-tanker-resolution)) + (cleanup-for-death obj) + (go (method-of-object obj die-fast)) + ) + (else + (go (method-of-object obj hidden)) + ) + ) + (none) + ) + +;; definition for method 210 of type ashelin-tanker +;; WARN: Return type mismatch vector vs none. +(defmethod init! ashelin-tanker ((obj ashelin-tanker)) + "Set defaults for various fields." + (let ((t9-0 (method-of-type ashelin init!))) + (t9-0 obj) + ) + (let ((v1-1 (-> obj suppress))) + (set! (-> v1-1 duration) (the-as uint 300)) + (set! (-> v1-1 id) -1) + (let ((a0-4 (-> v1-1 bbox))) + (set! (-> a0-4 min x) 1634304.0) + (set! (-> a0-4 min y) 28672.0) + (set! (-> a0-4 min z) 1708032.0) + (set! (-> a0-4 min w) 1.0) + ) + (set-vector! (-> v1-1 bbox max) 2048000.0 40960.0 2023424.0 1.0) + ) + (none) + ) + +;; definition for method 251 of type ashelin-tanker +;; INFO: Used lq/sq +(defmethod suppress-traffic ashelin-tanker ((obj ashelin-tanker)) + (when *traffic-manager* + (let ((a1-0 (new 'stack-no-clear 'traffic-danger-info))) + (set! (-> a1-0 sphere quad) (-> (new 'static 'vector :x 1837465.6 :y 34406.4 :z 1868103.6 :w 225280.0) quad)) + (set! (-> a1-0 velocity quad) (the-as uint128 0)) + (set! (-> a1-0 notify-radius) 286720.0) + (set! (-> a1-0 danger-level) 1.0) + (set! (-> a1-0 decay-rate) 0.0) + (set! (-> a1-0 flags) (traffic-danger-flags tdf0)) + (set! (-> a1-0 danger-type) (traffic-danger-type tdt4)) + (add-danger (-> (the-as traffic-manager *traffic-manager*) traffic-engine) a1-0) + ) + ) + (none) + ) + +;; definition for symbol *ash4-course*, type ashelin-course +(define *ash4-course* + (new 'static 'ashelin-course + :course-id #x9 + :speech-count #x2d + :spot-count #x1 + :attack-player-speeches (new 'static 'bot-speech-list-shuffle + :flags #xe + :last-local-index -1 + :speech-indexes (new 'static 'boxed-array :type int16 11 7 8 9 10 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26) + ) + :default-check-too-far #f + :waypoints (new 'static 'boxed-array :type bot-waypoint + (new 'static 'bot-waypoint + :waypoint-id 1 + :skip-to -1 + :on-set (lambda ((arg0 ashelin-tanker)) + (clear-speech-flags! arg0) + (move-to-point! (-> arg0 root-override2) (the-as vector (-> arg0 ash-course spots 0))) + (let ((v1-7 (get-task-by-type (-> arg0 ai-ctrl) asht-wait-spot arg0))) + (set! (-> v1-7 bytes 5) (the-as uint 1)) + (set! (-> v1-7 bytes 6) (the-as uint 0)) + (set! (-> v1-7 bytes 4) (the-as uint -1)) + (set! (-> (the-as asht-wait-spot v1-7) check-done) + (the-as + (function asht-wait-spot ashelin symbol) + (lambda ((arg0 object) (arg1 ashelin-tanker)) (let ((v1-0 *traffic-manager*)) + (cond + ((not (logtest? (-> arg1 waypoint-bits) 1)) + (if v1-0 + (logior! (-> arg1 waypoint-bits) 1) + ) + #f + ) + ((not (logtest? (-> arg1 waypoint-bits) 2)) + (logior! (-> arg1 waypoint-bits) 2) + #f + ) + ((not (logtest? (-> arg1 waypoint-bits) 4)) + (logior! (-> arg1 waypoint-bits) 4) + #f + ) + (else + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 2 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 2 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 ashelin-tanker)) + (let ((v1-1 (get-current-task-event (-> arg0 task)))) + (if (= (-> v1-1 action) (game-task-action say)) + (add-process + *gui-control* + arg0 + (gui-channel art-load) + (gui-action queue) + (the-as string (-> v1-1 scene)) + -99.0 + 0 + ) + ) + ) + (let ((v1-3 (get-task-by-type (-> arg0 ai-ctrl) asht-wait-spot arg0))) + (set! (-> v1-3 bytes 5) (the-as uint 1)) + (set! (-> v1-3 bytes 6) (the-as uint 0)) + (set! (-> v1-3 bytes 4) (the-as uint -1)) + (set! (-> (the-as asht-wait-spot v1-3) check-done) + (the-as + (function asht-wait-spot ashelin symbol) + (lambda ((arg0 object) (arg1 ashelin-tanker)) + (let ((a0-1 *target*)) + (when a0-1 + (let ((v1-2 (get-trans a0-1 0))) + (if (and (>= (-> v1-2 x) 1638400.0) + (>= 2031616.0 (-> v1-2 x)) + (>= (-> v1-2 z) 1703936.0) + (>= 2027520.0 (-> v1-2 z)) + ) + (logior! (-> arg1 bot-task-bits) 1) + ) + ) + ) + ) + (let ((v1-8 (get-current-task-event (-> arg1 task)))) + (when (and (logtest? (-> arg1 bot-task-bits) 1) (= (-> v1-8 action) (game-task-action say))) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 3 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 3 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 ashelin-tanker)) + (set-setting! 'calm #t 0 0) + (set-setting! 'exclusive-task #f 0 42) + (let ((v1-5 (get-task-by-type (-> arg0 ai-ctrl) asht-wait-spot arg0))) + (set! (-> v1-5 bytes 5) (the-as uint 1)) + (set! (-> v1-5 bytes 6) (the-as uint 0)) + (set! (-> v1-5 bytes 4) (the-as uint -1)) + (set! (-> (the-as asht-wait-spot v1-5) check-done) + (the-as + (function asht-wait-spot ashelin symbol) + (lambda ((arg0 object) (arg1 ashelin-tanker)) (let ((v1-1 (get-current-task-event (-> arg1 task)))) + (when (scene-play arg1 (the-as string (-> v1-1 scene)) #f) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 4 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 4 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 ashelin-tanker)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) asht-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 0)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as asht-wait-spot v1-1) check-done) + (the-as + (function asht-wait-spot ashelin symbol) + (lambda ((arg0 object) (arg1 ashelin-tanker)) (when (scene-release? arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 5 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 5 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 ashelin-tanker)) + (with-pp + (send-event arg0 'hide #f) + (remove-setting! 'calm) + (set-setting! 'music 'danger9 0 0) + (set! (-> arg0 notice-enemy-dist) 245760.0) + (logior! (-> arg0 bot-flags) (bot-flags bf06)) + (set! (-> arg0 bot-task-bits) (logand -3 (-> arg0 bot-task-bits))) + (let ((a1-3 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-3 from) (process->ppointer pp)) + (set! (-> a1-3 num-params) 0) + (set! (-> a1-3 message) 'trigger) + (let ((t9-3 send-event-function) + (v1-18 (-> arg0 actor-group 0 data 0 actor)) + ) + (t9-3 + (if v1-18 + (-> v1-18 extra process) + ) + a1-3 + ) + ) + ) + (ashelin-method-250 arg0 #t) + (add-process *gui-control* arg0 (gui-channel art-load) (gui-action queue) "city-intercept-tanker-res" -99.0 0) + (let ((v1-26 (get-task-by-type (-> arg0 ai-ctrl) asht-wait-spot arg0))) + (set! (-> v1-26 bytes 5) (the-as uint 1)) + (set! (-> v1-26 bytes 6) (the-as uint 0)) + (set! (-> v1-26 bytes 4) (the-as uint -1)) + (set! (-> (the-as asht-wait-spot v1-26) check-done) + (the-as + (function asht-wait-spot ashelin symbol) + (lambda ((arg0 object) (arg1 ashelin-tanker)) (with-pp + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer pp)) + (set! (-> a1-1 num-params) 1) + (set! (-> a1-1 message) 'query) + (set! (-> a1-1 param 0) (the-as uint 'beaten)) + (let ((t9-0 send-event-function) + (v1-7 (-> arg1 actor-group 0 data 0 actor)) + ) + (when (t9-0 + (if v1-7 + (-> v1-7 extra process) + ) + a1-1 + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 6 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + ) + :on-update (lambda ((arg0 ashelin-tanker)) + (suppress-traffic arg0) + (when (logtest? (-> arg0 bot-task-bits) 2) + (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) + (go-to-waypoint! arg0 9 #f) + ) + (none) + ) + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 6 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 ashelin-tanker)) + (with-pp + (set! (-> arg0 waypoint-time0) (-> pp clock frame-counter)) + (ashelin-method-250 arg0 #f) + (task-node-close! (game-task-node city-intercept-tanker-battle)) + (remove-setting! 'sound-mode) + (remove-setting! 'music) + (when (not (channel-active? arg0 (the-as uint 0))) + (let ((v1-12 (get-rand-int arg0 3))) + (cond + ((zero? v1-12) + (play-speech arg0 42) + ) + ((= v1-12 1) + (play-speech arg0 43) + ) + (else + (play-speech arg0 44) + ) + ) + ) + ) + (let ((v1-20 (get-task-by-type (-> arg0 ai-ctrl) asht-wait-spot arg0))) + (set! (-> v1-20 bytes 5) (the-as uint 1)) + (set! (-> v1-20 bytes 6) (the-as uint 0)) + (set! (-> v1-20 bytes 4) (the-as uint -1)) + (set! (-> (the-as asht-wait-spot v1-20) check-done) + (the-as + (function asht-wait-spot ashelin symbol) + (lambda ((arg0 object) (arg1 ashelin-tanker)) + (let ((s5-0 (get-current-task-event (-> arg1 task)))) + (when (and (= (-> s5-0 action) (game-task-action say)) + (not (channel-active? arg1 (the-as uint 0))) + (scene-play arg1 (the-as string (-> s5-0 scene)) #f) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 7 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + ) + :on-update (lambda ((arg0 ashelin-tanker)) + (suppress-traffic arg0) + (when (logtest? (-> arg0 bot-task-bits) 2) + (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) + (go-to-waypoint! arg0 9 #f) + ) + (none) + ) + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 7 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 ashelin-tanker)) + (logclear! (-> arg0 bot-flags) (bot-flags bf06)) + (bot-method-196 arg0) + (let ((v1-5 (-> arg0 root-override2 root-prim))) + (set! (-> v1-5 prim-core collide-as) (collide-spec)) + (set! (-> v1-5 prim-core collide-with) (collide-spec)) + ) + (set! (-> arg0 root-override2 backup-collide-as) (collide-spec)) + (set! (-> arg0 root-override2 backup-collide-with) (collide-spec)) + 0 + (send-event arg0 'hide #t) + (let ((v1-15 (get-task-by-type (-> arg0 ai-ctrl) asht-wait-spot arg0))) + (set! (-> v1-15 bytes 5) (the-as uint 1)) + (set! (-> v1-15 bytes 6) (the-as uint 0)) + (set! (-> v1-15 bytes 4) (the-as uint -1)) + (set! (-> (the-as asht-wait-spot v1-15) check-done) + (the-as + (function asht-wait-spot ashelin symbol) + (lambda ((arg0 object) (arg1 ashelin-tanker)) (when (scene-release? arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 8 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 ashelin-tanker)) (create-or-update-suppression-box (-> arg0 suppress)) (none)) + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 8 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 ashelin-tanker)) + (remove-setting! 'exclusive-task) + (process-entity-status! arg0 (entity-perm-status bit-4) #f) + (process-entity-status! arg0 (entity-perm-status no-kill) #f) + (let ((v1-3 (get-task-by-type (-> arg0 ai-ctrl) asht-wait-spot arg0))) + (set! (-> v1-3 bytes 5) (the-as uint 1)) + (set! (-> v1-3 bytes 6) (the-as uint 0)) + (set! (-> v1-3 bytes 4) (the-as uint -1)) + (set! (-> (the-as asht-wait-spot v1-3) check-done) + (the-as (function asht-wait-spot ashelin symbol) (lambda ((arg0 ashelin-tanker)) #f)) + ) + ) + (none) + ) + :on-update (lambda ((arg0 ashelin-tanker)) (create-or-update-suppression-box (-> arg0 suppress)) (none)) + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 9 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 ashelin-tanker)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) asht-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 0)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as asht-wait-spot v1-1) check-done) + (the-as + (function asht-wait-spot ashelin symbol) + (lambda ((arg0 object) (arg1 ashelin-tanker)) (send-event arg1 'instant-death) (none)) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 ashelin-tanker)) + (suppress-traffic arg0) + (create-or-update-suppression-box (-> arg0 suppress)) + (none) + ) + :on-skipping-here #f + :check-too-far #f + ) + ) + :speeches (new 'static 'inline-array bot-speech-info 45 + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha001") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha008") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha009") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha010") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha011") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha012") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha013") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha002") + (new 'static 'bot-speech-info :flags (speech-flags sf10) :hold-time #x5a :slave-id -1 :name "asha003") + (new 'static 'bot-speech-info :flags (speech-flags sf06) :hold-time #x5a :slave-id -1 :name "asha004") + (new 'static 'bot-speech-info :flags (speech-flags sf06) :hold-time #x5a :slave-id -1 :name "asha005") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha006") + (new 'static 'bot-speech-info :flags (speech-flags sf08) :hold-time #x5a :slave-id -1 :name "asha007") + (new 'static 'bot-speech-info :flags (speech-flags sf09) :hold-time #x5a :slave-id -1 :name "asha018") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha019") + (new 'static 'bot-speech-info :flags (speech-flags sf09) :hold-time #x5a :slave-id -1 :name "asha020") + (new 'static 'bot-speech-info :flags (speech-flags sf09) :hold-time #x5a :slave-id -1 :name "asha021") + (new 'static 'bot-speech-info :flags (speech-flags sf09) :hold-time #x5a :slave-id -1 :name "asha022") + (new 'static 'bot-speech-info :flags (speech-flags sf09) :hold-time #x5a :slave-id -1 :name "asha023") + (new 'static 'bot-speech-info :flags (speech-flags sf09) :hold-time #x5a :slave-id -1 :name "asha024") + (new 'static 'bot-speech-info :flags (speech-flags sf09) :hold-time #x5a :slave-id -1 :name "asha025") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha026") + (new 'static 'bot-speech-info :flags (speech-flags sf09) :hold-time #x5a :slave-id -1 :name "asha027") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha028") + (new 'static 'bot-speech-info :flags (speech-flags sf09) :hold-time #x5a :slave-id -1 :name "asha029") + (new 'static 'bot-speech-info :flags (speech-flags sf10) :hold-time #x5a :slave-id -1 :name "asha030") + (new 'static 'bot-speech-info :flags (speech-flags sf09) :hold-time #x5a :slave-id -1 :name "asha031") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha035") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha036") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha039") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha041") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha050") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha051") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha052") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha054") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha014") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha015") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha016") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha017") + (new 'static 'bot-speech-info :flags (speech-flags sf11) :hold-time #x5a :slave-id -1 :name "asha038") + (new 'static 'bot-speech-info :flags (speech-flags sf11) :hold-time #x5a :slave-id -1 :name "asha044") + (new 'static 'bot-speech-info :flags (speech-flags sf11) :hold-time #x5a :slave-id -1 :name "asha049") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha032") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha033") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "asha034") + ) + :speech-tunings (new 'static 'inline-array bot-speech-tuning 1 + (new 'static 'bot-speech-tuning :fo-min 20 :fo-max 100 :fo-curve #xb :trans? #t) + ) + :spots (new 'static 'inline-array bot-spot 1 + (new 'static 'bot-spot :center (new 'static 'vector :x 1902510.1 :y 33587.2 :z 1786101.8 :w 61440.0)) + ) + :ouch-speeches (new 'static 'bot-speech-list-shuffle + :flags #xe + :last-local-index -1 + :speech-indexes (new 'static 'boxed-array :type int16 35 36 37 38 39 40 41) + ) + :victory-speeches (new 'static 'bot-speech-list-shuffle + :flags #xe + :last-local-index -1 + :speech-indexes (new 'static 'boxed-array :type int16 0 1 2 3 4 5 6 27 28 29 30 31 32 33 34) + ) + ) + ) + +;; failed to figure out what this is: +(set! (-> *bot-course-table* course 9) *ash4-course*) + + + +