diff --git a/common/type_system/deftype.cpp b/common/type_system/deftype.cpp index b8467530ec..5e7760fc9c 100644 --- a/common/type_system/deftype.cpp +++ b/common/type_system/deftype.cpp @@ -261,8 +261,8 @@ void declare_method(Type* type, TypeSystem* type_system, const goos::Object& def if (id != -1) { // method id assert! if (id != info.id) { - printf("WARNING - ID assert failed on method %s of type %s (wanted %d got %d)\n", - method_name.c_str(), type->get_name().c_str(), id, info.id); + lg::print("WARNING - ID assert failed on method %s of type %s (wanted %d got %d)\n", + method_name.c_str(), type->get_name().c_str(), id, info.id); throw std::runtime_error("Method ID assert failed"); } } diff --git a/decompiler/ObjectFile/ObjectFileDB_IR2.cpp b/decompiler/ObjectFile/ObjectFileDB_IR2.cpp index f5d1a71fd9..215f22e26a 100644 --- a/decompiler/ObjectFile/ObjectFileDB_IR2.cpp +++ b/decompiler/ObjectFile/ObjectFileDB_IR2.cpp @@ -904,7 +904,7 @@ std::string ObjectFileDB::ir2_function_to_string(ObjectFileData& data, Function& result += func.prologue.to_string(2) + "\n"; if (func.guessed_name.kind == FunctionName::FunctionKind::NV_STATE || func.guessed_name.kind == FunctionName::FunctionKind::V_STATE) { - result += fmt::format(" ; function renamed from {}\n", func.state_handler_as_anon_func); + result += fmt::format(" ;internal_name: {}\n", func.state_handler_as_anon_func); } if (func.warnings.has_warnings()) { result += ";; Warnings:\n" + func.warnings.get_warning_text(true) + "\n"; diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index 8b579db47d..71ffe3f510 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -17199,7 +17199,7 @@ ) (deftype process-focusable (process-drawable) - ((root-override collide-shape :offset 128 :score 100) ;; TODO - potentiall collide-shape-moving? + ((root-override collide-shape :offset 128 :score 100) (focus-status focus-status :offset-assert 200) ) :method-count-assert 27 @@ -17249,7 +17249,7 @@ (play-game (game-task-event) _type_ :state 30) ;; (idle () _type_ :state 30) (process-taskable-method-31 (_type_) none 31) ;; (get-art-elem (_type_) art-element 31) (process-taskable-method-32 (_type_) none 32) ;; (play-anim! (_type_ symbol) basic 32) - (init-skeleton! + (init-art! "@see [[initialize-skeleton]]" (_type_) none 33) ;; (dummy-33 (_type_) none 33) (process-taskable-method-34 (_type_) symbol 34) ;; (get-accept-anim (_type_ symbol) spool-anim 34) @@ -27524,7 +27524,7 @@ ;; (define-extern launcher-init-by-other function) ;; (function vector float int float none :behavior launcher) (define-extern touch-tracker-init (function vector float time-frame none :behavior touch-tracker)) ;; (define-extern explosion-init-by-other function) -;; (define-extern explosion-spawn function) +(define-extern explosion-spawn (function process-drawable type explosion-init-params none)) (define-extern process-drawable-random-point! (function process-drawable vector vector)) (define-extern process-drawable-pair-random-point! (function process-drawable process-drawable vector float vector)) @@ -32259,7 +32259,8 @@ ) (deftype enemy (process-focusable) - ((fact-info-override fact-info-enemy :offset 160 :score 100) + ((root-override2 collide-shape-moving :offset 128 :score 200) + (fact-info-override fact-info-enemy :offset 160 :score 100) (enemy-flags enemy-flag :offset-assert 208) (enemy-info enemy-info :offset-assert 216) (hit-points int32 :offset-assert 220) @@ -32351,11 +32352,11 @@ (go-flee (_type_) none 71) (enemy-method-72 (_type_) none 72) (enemy-method-73 (_type_) none 73) - (enemy-method-74 (_type_ object object symbol) none 74) + (enemy-method-74 (_type_ object object symbol event-message-block) none 74) (enemy-method-75 (_type_ process touching-shapes-entry) none 75) (enemy-method-76 (_type_) none 76) - (enemy-method-77 (_type_) none 77) - (enemy-method-78 (_type_) none 78) + (enemy-method-77 (_type_ (pointer float)) none 77) + (enemy-method-78 (_type_ (pointer float)) none 78) (enemy-method-79 (_type_) none 79) (enemy-method-80 (_type_) none 80) (enemy-method-81 (_type_) symbol 81) @@ -33883,16 +33884,15 @@ ) ) -;; (define-extern guard-shot-move function) -;; (define-extern guard-lazer-shot-move function) +(define-extern guard-shot-move (function guard-shot none)) +(define-extern guard-lazer-shot-move (function guard-lazer-shot none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; metalhead-projectile ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype metalhead-shot (projectile) - ((tail-pos vector :inline :offset-assert 476) + ((tail-pos vector :inline :offset-assert 480) ) :method-count-assert 40 :size-assert #x1f0 @@ -33900,12 +33900,10 @@ (:methods ) ) -|# -#| (deftype metalhead-grenade-shot (projectile) - ((tumble-quat quaternion :inline :offset-assert 476) - (blast-radius float :offset-assert 492) + ((tumble-quat quaternion :inline :offset-assert 480) + (blast-radius float :offset-assert 496) ) :method-count-assert 40 :size-assert #x1f4 @@ -33913,13 +33911,12 @@ (:methods ) ) -|# -;; (define-extern metalhead-shot-move function) -;; (define-extern spawn-metalhead-projectile function) -;; (define-extern gren-canister-move function) -;; (define-extern gren-cshape-reaction-canister function) -;; (define-extern spawn-metalhead-grenade function) +(define-extern metalhead-shot-move (function metalhead-shot none)) +(define-extern spawn-metalhead-projectile (function metalhead-shot vector vector float (pointer metalhead-shot))) +(define-extern gren-canister-move (function metalhead-grenade-shot none)) +(define-extern gren-cshape-reaction-canister (function collide-shape-moving metalhead-grenade-shot none)) +(define-extern spawn-metalhead-grenade (function metalhead-grenade-shot vector vector float (pointer metalhead-grenade-shot))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; los-control ;; @@ -35235,90 +35232,143 @@ ;; crimson-guard-level ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| -(deftype guard-level-anim-info (UNKNOWN) - ((anim-index UNKNOWN 2 :offset-assert 0) - (anim-index-front int32 :offset-assert 0) - (anim-index-back int32 :offset-assert 4) +(deftype guard-level-anim-info (structure) + ((anim-index int32 2 :offset-assert 0) + (anim-index-front int32 :offset 0) + (anim-index-back int32 :offset 4) ) - :method-count-assert 0 - :size-assert #x0 - :flag-assert #x0 + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 ) -|# -#| -(deftype guard-level-global-info (UNKNOWN) +(deftype guard-level-global-info (basic) ((prev-yellow-hit int8 :offset-assert 4) (prev-blue-hit int8 :offset-assert 5) - (knocked UNKNOWN 2 :offset-assert 8) - (knocked-land UNKNOWN 2 :offset-assert 16) - (anim-knocked-front int32 :offset-assert 8) - (anim-knocked-back int32 :offset-assert 12) - (anim-knocked-front-land int32 :offset-assert 16) - (anim-knocked-back-land int32 :offset-assert 20) - (yellow-hit-anim UNKNOWN 2 :offset-assert 24) - (yellow-land-anim UNKNOWN 2 :offset-assert 40) - (blue-hit-anim UNKNOWN 1 :offset-assert 56) + (knocked int32 2 :offset-assert 8) + (knocked-land int32 2 :offset-assert 16) + (anim-knocked-front int32 :offset 8) + (anim-knocked-back int32 :offset 12) + (anim-knocked-front-land int32 :offset 16) + (anim-knocked-back-land int32 :offset 20) + (yellow-hit-anim handle 2 :offset-assert 24) + (yellow-land-anim handle 2 :offset-assert 40) + (blue-hit-anim handle 1 :offset-assert 56) ) - :method-count-assert 0 - :size-assert #x0 - :flag-assert #x0 + :method-count-assert 9 + :size-assert #x40 + :flag-assert #x900000040 ) -|# -#| -(deftype guard-level-shoot-info (UNKNOWN) +(deftype guard-level-shoot-info (structure) ((anim-index int32 :offset-assert 0) (start float :offset-assert 4) (end float :offset-assert 8) ) - :method-count-assert 0 - :size-assert #x0 - :flag-assert #x0 + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c ) -|# -#| -(deftype crimson-guard-level (UNKNOWN) - () - :method-count-assert 0 - :size-assert #x0 - :flag-assert #x0 - ;; Failed to read fields. +(deftype crimson-guard-level (nav-enemy) + ( + (info basic :offset-assert 604) + (hit-face uint32 :offset-assert 608) + (anim-get-up-front int32 :offset-assert 612) + (anim-get-up-back int32 :offset-assert 616) + (small-hit int32 :offset-assert 620) + (yellow-anim uint32 :offset-assert 624) + (pad-jh1b23 int32 :offset-assert 628) + (flags int64 :offset-assert 632) + (weapon int32 :offset-assert 640) + (pad-kjh1n23 int32 :offset-assert 644) + (last-time-see-target int64 :offset-assert 648) + (joint uint32 :offset-assert 656) + (joint-enable uint32 :offset-assert 660) + (l-control basic :offset-assert 664) + (already-shot uint32 :offset-assert 668) + (miss-amount float :offset-assert 672) + (pad-k1jh2n3 int32 :offset-assert 676) + (next-shot int64 :offset-assert 680) + (anim-shoot vector 3 :inline :offset-assert 688) + (target-pos vector :inline :offset-assert 736) + (target-pos-predict vector :inline :offset-assert 752) + (target-pos-predict-miss vector :inline :offset-assert 768) + (target-vel-vec vector :inline :offset-assert 784) + (target-vel float :offset-assert 800) + (target-self vector :inline :offset-assert 816) + (target-self-xz vector :inline :offset-assert 832) + (target-self-dist float :offset-assert 848) + (target-self-xz-dist float :offset-assert 852) + (target-y-angle float :offset-assert 856) + (lazer-sound sound-id :offset-assert 860) + (transport int64 :offset-assert 864) + (transport-side uint32 :offset-assert 872) + (other-side uint32 :offset-assert 876) + (start-target-pos vector :inline :offset-assert 880) + (start-target-vel vector :inline :offset-assert 896) + (trigger symbol :offset-assert 912) + (reachable-target-pos vector :inline :offset-assert 928) ) -|# + :method-count-assert 205 + :size-assert #x3b0 + :flag-assert #xcd033003b0 + (:methods + (gun-shoot () _type_ :state 178) + (attack () _type_ :state 179) + (get-up-front () _type_ :state 180) + (get-up-back () _type_ :state 181) + (close-attack () _type_ :state 182) + (grenade-attack () _type_ :state 183) + (exit-transport () _type_ :state 184) + (blast-hostile () _type_ :state 185) + (grenade-hostile () _type_ :state 186) + (tazer-hostile () _type_ :state 187) + (roll-right () _type_ :state 188) + (roll-left () _type_ :state 189) + (arrest () _type_ :state 190) + (crimson-guard-level-method-191 (_type_) (pointer process) 191) + (crimson-guard-level-method-192 (_type_) none 192) + (crimson-guard-level-method-193 (_type_) none 193) + (crimson-guard-level-method-194 (_type_) none 194) + (crimson-guard-level-method-195 (_type_) none 195) + (crimson-guard-level-method-196 (_type_ vector) none 196) + (crimson-guard-level-method-197 (_type_) quaternion 197) + (crimson-guard-level-method-198 (_type_) none 198) + (crimson-guard-level-method-199 (_type_) none 199) + (crimson-guard-level-method-200 (_type_) float 200) + (crimson-guard-level-method-201 (_type_) none 201) + (crimson-guard-level-method-202 (_type_) none 202) + (crimson-guard-level-method-203 (_type_) none 203) + (crimson-guard-level-method-204 (_type_) none 204))) -#| -(deftype crimson-guard-level-params (UNKNOWN) +(deftype crimson-guard-level-params (structure) ((pos vector :inline :offset-assert 0) (quat quaternion :inline :offset-assert 16) - (nav-mesh basic :offset-assert 32) + (nav-mesh nav-mesh :offset-assert 32) (handle uint64 :offset-assert 40) (transport-side uint32 :offset-assert 48) (weapon int32 :offset-assert 52) - (proc basic :offset-assert 56) + (proc process :offset-assert 56) ) - :method-count-assert 0 - :size-assert #x0 - :flag-assert #x0 + :method-count-assert 9 + :size-assert #x3c + :flag-assert #x90000003c ) -|# -;; (define-extern *crimson-guard-fact* fact-info-enemy-defaults) -;; (define-extern *crimson-guard-level-global-info* guard-level-global-info) -;; (define-extern *crimson-guard-level-info* nav-enemy-info) -;; (define-extern *crimson-guard-level-blast-info* nav-enemy-info) -;; (define-extern *crimson-guard-level-grenade-info* nav-enemy-info) -;; (define-extern *crimson-guard-level-sniper-info* nav-enemy-info) -;; (define-extern *crimson-guard-level-tazer-info* nav-enemy-info) +(define-extern *crimson-guard-fact* fact-info-enemy-defaults) +(define-extern *crimson-guard-level-global-info* guard-level-global-info) +(define-extern *crimson-guard-level-info* nav-enemy-info) +(define-extern *crimson-guard-level-blast-info* nav-enemy-info) +(define-extern *crimson-guard-level-grenade-info* nav-enemy-info) +(define-extern *crimson-guard-level-sniper-info* nav-enemy-info) +(define-extern *crimson-guard-level-tazer-info* nav-enemy-info) ;; (define-extern crimson-guard-level-init-by-other function) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; guard-conversation ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype gconv-speech (basic) ((name0 basic :offset-assert 4) (name1 basic :offset-assert 8) @@ -35328,36 +35378,30 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype gconv-dialogue (basic) - ((speeches basic :offset-assert 4) + ((speeches (array gconv-speech) :offset-assert 4) ) :method-count-assert 9 :size-assert #x8 :flag-assert #x900000008 ) -|# -#| (deftype gconv-dialogues (basic) - ((dialogues basic :offset-assert 4) + ((dialogues (array gconv-dialogue) :offset-assert 4) ) :method-count-assert 9 :size-assert #x8 :flag-assert #x900000008 ) -|# -#| (deftype guard-conversation (process-drawable) - ((triggered? basic :offset-assert 196) - (actor-group basic :offset-assert 200) - (actor-count int8 :offset-assert 204) - (remaining int8 :offset-assert 205) - (skip-mask uint32 :offset-assert 208) - (last-playing-time time-frame :offset-assert 212) + ((triggered? symbol :offset-assert 200) + (actor-group actor-group :offset-assert 204) + (actor-count int8 :offset-assert 208) + (remaining int8 :offset-assert 209) + (skip-mask uint32 :offset-assert 212) + (last-playing-time time-frame :offset-assert 216) ) :method-count-assert 25 :size-assert #xe0 @@ -35367,32 +35411,30 @@ (active () _type_ :state 21) (notice () _type_ :state 22) (die () _type_ :state 23) - (guard-conversation-method-24 () none 24) + (guard-conversation-method-24 (_type_) symbol 24) ) ) -|# -;; (define-extern *gconv-dialogues* gconv-dialogues) +(define-extern *gconv-dialogues* gconv-dialogues) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; transport-level ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype transport-level (process-focusable) - ((y-dest float :offset-assert 200) - (last-guard-spawn-time time-frame :offset-assert 204) - (nav-mesh basic :offset-assert 212) - (spawn-side uint32 :offset-assert 216) - (spawn? basic :offset-assert 220) - (leave-time time-frame :offset-assert 228) - (max-guard uint32 :offset-assert 236) - (count-guard uint32 :offset-assert 240) - (max-time float :offset-assert 244) - (spawn-time time-frame :offset-assert 252) - (ambient-sound-id uint32 :offset-assert 260) - (num-wanted-guards uint32 :offset-assert 264) - (guards UNKNOWN 8 :offset-assert 268) + ((y-dest float :offset-assert 204) + (last-guard-spawn-time time-frame :offset-assert 208) + (nav-mesh nav-mesh :offset-assert 216) + (spawn-side uint32 :offset-assert 220) + (spawn? symbol :offset-assert 224) + (leave-time time-frame :offset-assert 232) + (max-guard uint32 :offset-assert 240) + (count-guard uint32 :offset-assert 244) + (max-time float :offset-assert 248) + (spawn-time time-frame :offset-assert 256) + (ambient-sound-id uint32 :offset-assert 264) + (num-wanted-guards uint32 :offset-assert 268) + (guards handle 8 :offset-assert 272) ;; NOTE - probably 'guard' ) :method-count-assert 35 :size-assert #x150 @@ -35402,15 +35444,14 @@ (idle () _type_ :state 28) (leave () _type_ :state 29) (die-fast () _type_ :state 30) - (transport-level-method-31 () none 31) - (transport-level-method-32 () none 32) - (transport-level-method-33 () none 33) - (transport-level-method-34 () none 34) + (transport-level-method-31 (_type_) none 31) + (transport-level-method-32 (_type_) none 32) + (transport-level-method-33 (_type_) none 33) + (transport-level-method-34 (_type_) none 34) ) ) -|# -;; (define-extern transport-level-event-handler function) +(define-extern transport-level-event-handler (function process int symbol event-message-block transport-level :behavior transport-level)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; hover-formation-h ;; diff --git a/decompiler/config/jak2/anonymous_function_types.jsonc b/decompiler/config/jak2/anonymous_function_types.jsonc index fb75c2a8f4..334a5ad92a 100644 --- a/decompiler/config/jak2/anonymous_function_types.jsonc +++ b/decompiler/config/jak2/anonymous_function_types.jsonc @@ -451,5 +451,8 @@ "warp-gate": [ [8, "(function string none)"], [12, "(function none :behavior target)"] + ], + "crimson-guard-level": [ + [28, "(function crimson-guard-level collide-shape-moving vector symbol)"] ] } diff --git a/decompiler/config/jak2/inputs.jsonc b/decompiler/config/jak2/inputs.jsonc index 58e2437f4e..6750ee9109 100644 --- a/decompiler/config/jak2/inputs.jsonc +++ b/decompiler/config/jak2/inputs.jsonc @@ -18,7 +18,7 @@ "DGO/CTA.DGO", "DGO/PALOUT.DGO", "DGO/STD.DGO", - // "DGO/FOR.DGO", + "DGO/FOR.DGO", // "DGO/CASEXT.DGO", // "DGO/HIDEOUT.DGO", // "DGO/LWIDESTA.DGO", diff --git a/decompiler/config/jak2/label_types.jsonc b/decompiler/config/jak2/label_types.jsonc index c2a563d4a6..65a880dda4 100644 --- a/decompiler/config/jak2/label_types.jsonc +++ b/decompiler/config/jak2/label_types.jsonc @@ -438,7 +438,6 @@ ], "fma-sphere": [["L43", "attack-info"]], "process-taskable": [["L105", "attack-info"]], - "nav-mesh": [["L347", "(inline-array vector)", 2]], "gun-red-shot": [["L78", "attack-info"]], "neon-baron-part": [ ["L604", "uint64", true], @@ -489,5 +488,16 @@ "ocean-texture": [ ["L55", "vector4w"], ["L56", "vector"] + ], + "guard-projectile": [["L67", "attack-info"]], + "metalhead-projectile": [["L57", "attack-info"]], + "crimson-guard-level": [ + ["L644", "uint64", true], + ["L645", "uint64", true], + ["L646", "uint64", true], + ["L647", "uint64", true], + ["L648", "uint64", true], + ["L565", "uint64", true], + ["L567", "uint64", true] ] } diff --git a/decompiler/config/jak2/stack_structures.jsonc b/decompiler/config/jak2/stack_structures.jsonc index 7292ea7152..15933bd770 100644 --- a/decompiler/config/jak2/stack_structures.jsonc +++ b/decompiler/config/jak2/stack_structures.jsonc @@ -907,7 +907,7 @@ "(method 52 collide-shape)": [[16, "water-info"]], "cshape-reaction-update-state": [ [16, "vector"], - [64, "vector"] + [32, "vector"] ], "(code target-darkjak-giant)": [ [96, "collide-query"], @@ -1034,10 +1034,6 @@ "projectile-move-fill-line-sphere": [[16, "collide-query"]], "projectile-update-velocity-add-gravity": [[16, "vector"]], "projectile-bounce-falling-post": [[16, "collide-query"]], - "cshape-reaction-update-state": [ - [16, "vector"], - [32, "vector"] - ], "cshape-reaction-default": [ [16, "vector"], [32, "vector"] @@ -1103,9 +1099,7 @@ "(code target-carry-throw)": [[640, ["inline-array", "sphere", 1]]], "(code target-hit)": [[16, "vector"]], "(method 39 battle)": [[64, "transformq"]], - "add-collide-debug-box":[ - [16, "bounding-box"] - ], + "add-collide-debug-box": [[16, "bounding-box"]], "collide-list-fill-bg-using-box": [ [32, "matrix"], [96, "collide-query"] @@ -1114,16 +1108,16 @@ [32, "matrix"], [96, "collide-query"] ], - "add-a-bunch": [[16, "vector"]], "(method 11 collide-mesh)": [[16, "spat-work"]], "(method 10 collide-mesh)": [[16, "oot-work"]], "(method 9 touching-list)": [[16, "add-prims-touching-work"]], "(method 12 touching-list)": [[16, "event-message-block"]], - "(method 20 collide-edge-work)": [ - [16, "vector"] - ], + "(method 20 collide-edge-work)": [[16, "vector"]], "(method 13 collide-edge-work)": [[16, "faei-stack-vars"]], - "(method 9 collide-edge-edge)": [[16, "matrix"], [80, ["inline-array", "sphere", 6]]], + "(method 9 collide-edge-edge)": [ + [16, "matrix"], + [80, ["inline-array", "sphere", 6]] + ], "(method 12 ocean)": [[16, "vector"]], "(method 18 ocean)": [ [16, "vector"], @@ -1158,5 +1152,18 @@ ], "(method 67 ocean)": [[16, "vector"]], // placeholder - "placeholder-do-not-add-below": [] + "placeholder-do-not-add-below": [], + "(method 25 guard-shot)": [[32, "vector"]], + "(enter impact guard-shot)": [[16, "traffic-danger-info"]], + "(method 38 guard-shot)": [[16, "collide-query"]], + "(method 38 guard-lazer-shot)": [ + [16, "collide-query"], + [560, "vector"] + ], + "(method 25 metalhead-shot)": [ + [16, "vector"], + [32, "vector"] + ], + "spawn-metalhead-grenade": [[16, "projectile-init-by-other-params"]], + "spawn-metalhead-projectile": [[16, "projectile-init-by-other-params"]] } diff --git a/decompiler/config/jak2/type_casts.jsonc b/decompiler/config/jak2/type_casts.jsonc index 8a9b9f6c22..fce5ec492a 100644 --- a/decompiler/config/jak2/type_casts.jsonc +++ b/decompiler/config/jak2/type_casts.jsonc @@ -3201,10 +3201,7 @@ [13, "a0", "fact-info-crate"], [55, "v0", "float"] ], - "(method 0 carry-info)": [ - [44, "v1", "collide-shape-moving"], - [47, "v1", "collide-shape-moving"] - ], + "(method 0 carry-info)": [[42, "s5", "collide-shape"]], "crate-standard-event-handler": [ [14, "v1", "attack-info"], [15, "v1", "attack-info"], @@ -3499,13 +3496,7 @@ [34, "a0", "collide-shape-moving"], [37, "a0", "collide-shape-moving"] ], - "(enter fall crate)": [ - [[35, 40], "a0", "carry-info"], - [42, "v1", "collide-shape-moving"], - [46, "v1", "collide-shape-moving"], - [50, "a0", "collide-shape-moving"], - [54, "v1", "collide-shape-moving"] - ], + "(enter fall crate)": [[[35, 40], "a0", "carry-info"]], "(post carry crate)": [[[13, 16], "a0", "collide-shape-moving"]], "(event carry crate)": [[15, "a0", "vector"]], "(code idle crate)": [[[2, 5], "a0", "collide-shape-moving"]], @@ -3832,7 +3823,6 @@ "(method 19 grid-hash)": [[46, "t6", "(pointer uint8)"]], "(method 15 sphere-hash)": [[5, "v0", "(function grid-hash none)"]], "(method 32 sphere-hash)": [[107, "v1", "float"]], - "(method 0 carry-info)": [[42, "s5", "collide-shape"]], "(method 13 carry-info)": [ [14, "v1", "handle"], [22, "v0", "carry-info"], @@ -3909,7 +3899,6 @@ [60, "a0", "collide-shape"] ], "cshape-reaction-blue-shot": [[15, "v1", "gun-blue-shot"]], - "(enter fall crate)": [[[35, 40], "a0", "carry-info"]], "(method 10 idle-control)": [[64, "v1", "art-joint-anim"]], "(method 136 enemy)": [[34, "a1", "process-focusable"]], "(method 107 enemy)": [[17, "v0", "process-focusable"]], @@ -4049,9 +4038,7 @@ ["_stack_", 16, "res-tag"], ["_stack_", 32, "res-tag"] ], - "(method 12 collide-cache)": [ - [76, "v1", "process-drawable"] - ], + "(method 12 collide-cache)": [[76, "v1", "process-drawable"]], "collide-list-fill-bg-using-box": [ [[207, 213], "v1", "collide-hash-scratch"], [223, "a0", "collide-hash-scratch"], @@ -4071,32 +4058,21 @@ [62, "a2", "collide-hash-scratch"], [73, "a1", "collide-hash-scratch"] ], - "(method 9 collide-mesh)": [ - [[9, 63], "s5", "collide-mesh-tri"] - ], + "(method 9 collide-mesh)": [[[9, 63], "s5", "collide-mesh-tri"]], "(method 13 collide-mesh)": [ [21, "a3", "(inline-array vector)"], [[22, 61], "a3", "vector"], [[20, 61], "t0", "(inline-array vector)"], [[76, 123], "v1", "collide-mesh-tri"] ], - "(method 10 collide-mesh)": [ - [[13, 51], "s4", "collide-mesh-cache-tri"] - ], + "(method 10 collide-mesh)": [[[13, 51], "s4", "collide-mesh-cache-tri"]], "(method 9 collide-mesh-cache)": [ [[10, 83], "s4", "collide-mesh-cache-entry"] ], - "(method 10 touching-list)": [ - [[1, 12], "s5", "touching-shapes-entry"] - ], - "(method 13 touching-list)": [ - [[0, 77], "v0", "touching-shapes-entry"]], - "(method 11 touching-list)": [ - [[0, 57], "s5", "touching-shapes-entry"] - ], - "(method 12 touching-list)": [ - [[0, 105], "gp", "touching-shapes-entry"] - ], + "(method 10 touching-list)": [[[1, 12], "s5", "touching-shapes-entry"]], + "(method 13 touching-list)": [[[0, 77], "v0", "touching-shapes-entry"]], + "(method 11 touching-list)": [[[0, 57], "s5", "touching-shapes-entry"]], + "(method 12 touching-list)": [[[0, 105], "gp", "touching-shapes-entry"]], "(method 9 collide-edge-work)": [ [[6, 52], "s3", "collide-edge-edge"], [[5, 52], "s4", "collide-edge-hold-item"] @@ -4106,12 +4082,8 @@ [179, "v1", "int"], [179, "a1", "int"] ], - "(method 13 collide-edge-work)": [ - [[8, 119], "s1", "collide-edge-edge"] - ], - "(method 9 collide-edge-edge)": [ - [20, "a0", "collide-shape-moving"] - ], + "(method 13 collide-edge-work)": [[[8, 119], "s1", "collide-edge-edge"]], + "(method 9 collide-edge-edge)": [[20, "a0", "collide-shape-moving"]], "(method 13 ocean)": [ [248, "v1", "dma-packet"], [249, "v1", "dma-packet"], @@ -4554,5 +4526,79 @@ ], "(method 90 ocean)": [[0, "a2", "(pointer int32)"]], // placeholder - "placeholder-do-not-add-below": [] + "placeholder-do-not-add-below": [], + "(method 38 guard-lazer-shot)": [[[33, 37], "a0", "process-focusable"]], + "(method 28 metalhead-shot)": [ + [29, "s5", "process-drawable"], + [32, "s5", "process-drawable"], + [10, "v0", "sound-rpc-set-param"] + ], + "(event impact metalhead-grenade-shot)": [ + [11, "s4", "process-drawable"], + [28, "s4", "collide-shape"] + ], + "(trans active guard-conversation)": [[18, "a0", "nav-enemy"]], + "(method 11 guard-conversation)": [ + ["_stack_", 16, "res-tag"], + [75, "v0", "(pointer actor-group)"], + [128, "v1", "nav-enemy"] + ], + "(code come-down transport-level)": [[14, "v1", "art-joint-anim"]], + "(code idle transport-level)": [[29, "v1", "art-joint-anim"]], + "(code leave transport-level)": [[44, "v1", "art-joint-anim"]], + "(method 74 crimson-guard-level)": [[[95, 99], "v1", "process-focusable"]], + "(method 200 crimson-guard-level)": [ + [15, "s5", "process-focusable"], + [35, "s5", "process-focusable"] + ], + "(code notice crimson-guard-level)": [[31, "v1", "art-joint-anim"]], + "(trans blast-hostile crimson-guard-level)": [ + [[62, 66], "a0", "process-focusable"] + ], + "(trans grenade-hostile crimson-guard-level)": [ + [[62, 66], "a0", "process-focusable"] + ], + "(code arrest crimson-guard-level)": [[29, "v1", "art-joint-anim"]], + "(code gun-shoot crimson-guard-level)": [ + [28, "v1", "art-joint-anim"], + [[91, 97], "v1", "process-drawable"] + ], + "(code close-attack crimson-guard-level)": [[14, "v1", "art-joint-anim"]], + "(code attack crimson-guard-level)": [ + [257, "a0", "process-focusable"], + [535, "v1", "art-joint-anim"], + [286, "v1", "art-joint-anim"] + ], + "(code get-up-front crimson-guard-level)": [[20, "v1", "art-joint-anim"]], + "(code get-up-back crimson-guard-level)": [[20, "v1", "art-joint-anim"]], + "(code roll-right crimson-guard-level)": [ + [[95, 99], "a0", "process-focusable"], + [[182, 186], "a0", "process-focusable"] + ], + "(code roll-left crimson-guard-level)": [ + [[95, 99], "a0", "process-focusable"], + [[182, 186], "a0", "process-focusable"] + ], + "(method 77 crimson-guard-level)": [ + [42, "a1", "art-joint-anim"], + [100, "a1", "art-joint-anim"], + [129, "a1", "art-joint-anim"], + [160, "v1", "art-joint-anim"], + [196, "a1", "art-joint-anim"] + ], + "(method 78 crimson-guard-level)": [ + [18, "a1", "art-joint-anim"], + [72, "a1", "art-joint-anim"], + [104, "a1", "art-joint-anim"], + [136, "v1", "art-joint-anim"], + [175, "a1", "art-joint-anim"] + ], + "(code die-falling crimson-guard-level)": [ + [29, "gp", "art-joint-anim"], + [520, "v1", "art-joint-anim"], + [168, "v1", "art-joint-anim"], + [267, "v1", "art-joint-anim"], + [366, "v1", "art-joint-anim"], + [463, "v1", "art-joint-anim"] + ] } diff --git a/decompiler/config/jak2/var_names.jsonc b/decompiler/config/jak2/var_names.jsonc index c787761a92..3ee8d3ec58 100644 --- a/decompiler/config/jak2/var_names.jsonc +++ b/decompiler/config/jak2/var_names.jsonc @@ -2089,9 +2089,9 @@ } }, "(method 13 touching-list)": { - "args":["obj", "shape1", "shape2"], + "args": ["obj", "shape1", "shape2"], "vars": { - "v0-0":["entry", "touching-shapes-entry"] + "v0-0": ["entry", "touching-shapes-entry"] } }, "(method 68 ocean)": { diff --git a/decompiler/config/jak2_ntsc_v1.jsonc b/decompiler/config/jak2_ntsc_v1.jsonc index ab2695a415..67bb375880 100644 --- a/decompiler/config/jak2_ntsc_v1.jsonc +++ b/decompiler/config/jak2_ntsc_v1.jsonc @@ -7,7 +7,7 @@ // if you want to filter to only some object names. // it will make the decompiler much faster. - "allowed_objects": [], + "allowed_objects": ["crimson-guard-level"], "banned_objects": ["effect-control", "ctywide-scenes", "texture-anim-tables", "traffic-engine"], //////////////////////////// diff --git a/goal_src/jak2/engine/ai/enemy-h.gc b/goal_src/jak2/engine/ai/enemy-h.gc index 80c481d98c..45aae50e5e 100644 --- a/goal_src/jak2/engine/ai/enemy-h.gc +++ b/goal_src/jak2/engine/ai/enemy-h.gc @@ -262,42 +262,43 @@ (deftype enemy (process-focusable) - ((fact-info-override fact-info-enemy :offset 160) - (enemy-flags enemy-flag :offset-assert 208) - (enemy-info enemy-info :offset-assert 216) - (hit-points int32 :offset-assert 220) - (gnd-collide uint32 :offset-assert 224) - (attack-id uint32 :offset-assert 228) - (persistent-attack-id uint32 :offset-assert 232) - (water-max-height meters :offset-assert 236) - (water-surface-height meters :offset-assert 240) - (desired-angle degrees :offset-assert 244) - (jump-why uint64 :offset-assert 248) - (penetrated-by-all penetrate :offset-assert 256) - (penetrated-flinch penetrate :offset-assert 264) - (penetrated-knocked penetrate :offset-assert 272) - (reaction-time uint64 :offset-assert 280) - (notice-time uint64 :offset-assert 288) - (state-timeout uint64 :offset-assert 296) - (auto-reset-penetrate-time uint64 :offset-assert 304) - (hit-focus-time uint64 :offset-assert 312) - (last-draw-time uint64 :offset-assert 320) - (starting-time uint64 :offset-assert 328) - (fated-time uint64 :offset-assert 336) - (focus-pos vector :inline :offset-assert 352) - (event-param-point vector :inline :offset-assert 368) - (jump-dest vector :inline :offset 368) - (focus enemy-focus :inline :offset-assert 384) - (incoming enemy-attack-info :inline :offset-assert 416) - (actor-group actor-group :offset-assert 480) - (actor-group-count int32 :offset-assert 484) - (neck joint-mod :offset-assert 488) - (on-notice symbol :offset-assert 492) - (on-active symbol :offset-assert 496) - (on-hostile symbol :offset-assert 500) - (on-death symbol :offset-assert 504) - (idle-anim-player idle-control :inline :offset-assert 512) - (rand-gen symbol :offset-assert 528) + ((root-override2 collide-shape-moving :offset 128) + (fact-info-override fact-info-enemy :offset 160) + (enemy-flags enemy-flag :offset-assert 208) + (enemy-info enemy-info :offset-assert 216) + (hit-points int32 :offset-assert 220) + (gnd-collide uint32 :offset-assert 224) + (attack-id uint32 :offset-assert 228) + (persistent-attack-id uint32 :offset-assert 232) + (water-max-height meters :offset-assert 236) + (water-surface-height meters :offset-assert 240) + (desired-angle degrees :offset-assert 244) + (jump-why uint64 :offset-assert 248) + (penetrated-by-all penetrate :offset-assert 256) + (penetrated-flinch penetrate :offset-assert 264) + (penetrated-knocked penetrate :offset-assert 272) + (reaction-time uint64 :offset-assert 280) + (notice-time uint64 :offset-assert 288) + (state-timeout uint64 :offset-assert 296) + (auto-reset-penetrate-time uint64 :offset-assert 304) + (hit-focus-time uint64 :offset-assert 312) + (last-draw-time uint64 :offset-assert 320) + (starting-time uint64 :offset-assert 328) + (fated-time uint64 :offset-assert 336) + (focus-pos vector :inline :offset-assert 352) + (event-param-point vector :inline :offset-assert 368) + (jump-dest vector :inline :offset 368) + (focus enemy-focus :inline :offset-assert 384) + (incoming enemy-attack-info :inline :offset-assert 416) + (actor-group actor-group :offset-assert 480) + (actor-group-count int32 :offset-assert 484) + (neck joint-mod :offset-assert 488) + (on-notice symbol :offset-assert 492) + (on-active symbol :offset-assert 496) + (on-hostile symbol :offset-assert 500) + (on-death symbol :offset-assert 504) + (idle-anim-player idle-control :inline :offset-assert 512) + (rand-gen symbol :offset-assert 528) ) :heap-base #x1a0 :method-count-assert 137 @@ -351,11 +352,11 @@ (go-flee (_type_) none 71) (enemy-method-72 (_type_) none 72) (enemy-method-73 (_type_) none 73) - (enemy-method-74 (_type_ object object symbol) none 74) + (enemy-method-74 (_type_ object object symbol event-message-block) none 74) (enemy-method-75 (_type_ process touching-shapes-entry) none 75) (enemy-method-76 (_type_) none 76) - (enemy-method-77 (_type_) none 77) - (enemy-method-78 (_type_) none 78) + (enemy-method-77 (_type_ (pointer float)) none 77) + (enemy-method-78 (_type_ (pointer float)) none 78) (enemy-method-79 (_type_) none 79) (enemy-method-80 (_type_) none 80) (enemy-method-81 (_type_) symbol 81) diff --git a/goal_src/jak2/engine/common_objs/generic-obs.gc b/goal_src/jak2/engine/common_objs/generic-obs.gc index 094c9eccf4..5a06a6f51c 100644 --- a/goal_src/jak2/engine/common_objs/generic-obs.gc +++ b/goal_src/jak2/engine/common_objs/generic-obs.gc @@ -11,6 +11,9 @@ (define-extern process-grab? (function process symbol :behavior process)) (define-extern process-release? (function process symbol :behavior process)) +;; NOTE - for guard-projectile +(define-extern explosion-spawn (function process-drawable type explosion-init-params none)) + ;; DECOMP BEGINS (defbehavior clone-anim-once process-drawable ((arg0 handle) (arg1 symbol) (arg2 string)) diff --git a/goal_src/jak2/engine/process-drawable/process-taskable-h.gc b/goal_src/jak2/engine/process-drawable/process-taskable-h.gc index 789d2a02d5..6092384539 100644 --- a/goal_src/jak2/engine/process-drawable/process-taskable-h.gc +++ b/goal_src/jak2/engine/process-drawable/process-taskable-h.gc @@ -34,7 +34,7 @@ (play-game (game-task-event) _type_ :state 30) (process-taskable-method-31 (_type_) none 31) (process-taskable-method-32 (_type_) none 32) - (init-skeleton! (_type_) none 33) + (init-art! (_type_) none 33) (process-taskable-method-34 (_type_) symbol 34) (get-art-elem (_type_) art-element 35) (process-taskable-method-36 (_type_) none 36) diff --git a/goal_src/jak2/engine/process-drawable/process-taskable.gc b/goal_src/jak2/engine/process-drawable/process-taskable.gc index b7a606fab5..9af2bc81b9 100644 --- a/goal_src/jak2/engine/process-drawable/process-taskable.gc +++ b/goal_src/jak2/engine/process-drawable/process-taskable.gc @@ -444,7 +444,7 @@ (none) ) -(defmethod init-skeleton! process-taskable ((obj process-taskable)) +(defmethod init-art! process-taskable ((obj process-taskable)) "@see [[initialize-skeleton]]" 0 (none) @@ -458,7 +458,7 @@ (set! (-> obj task) (new 'process 'game-task-control (res-lump-value arg0 'task-actor game-task-actor :time -1000000000.0)) ) - (init-skeleton! obj) + (init-art! obj) (process-taskable-method-32 obj) (when (logtest? #x1000000 (res-lump-value arg0 'options uint128 :time -1000000000.0)) (let* ((s5-1 *level*) diff --git a/goal_src/jak2/game.gp b/goal_src/jak2/game.gp index 3ece73d628..a018a9c1a4 100644 --- a/goal_src/jak2/game.gp +++ b/goal_src/jak2/game.gp @@ -1967,50 +1967,50 @@ ;; ;; FOR ;; ;;;;;;;;;;;;;;;;;;;;; -;; (cgo "FOR.DGO" "for.gd") +(cgo "FOR.DGO" "for.gd") -;; (goal-src-sequence -;; "" -;; :deps ("$OUT/obj/los-control.o") -;; "levels/common/enemy/spyder.gc" -;; "levels/common/enemy/guards/crimson-guard-level.gc" -;; "levels/common/enemy/guards/guard-conversation.gc" -;; "levels/common/enemy/guards/transport-level.gc" -;; "levels/common/enemy/hover/hover-formation-h.gc" -;; "levels/common/enemy/hover/hover-nav-control-h.gc" -;; "levels/common/enemy/hover/hover-enemy-h.gc" -;; "levels/common/enemy/hover/hover-nav-network.gc" -;; "levels/common/enemy/hover/hover-nav-control.gc" -;; "levels/common/enemy/hover/hover-enemy.gc" -;; "levels/common/enemy/hover/hover-enemy-battle.gc" -;; "levels/common/enemy/hover/hover-formation.gc" -;; "levels/common/enemy/hover/hover-nav-edit.gc" -;; "levels/common/enemy/hover/wasp-part.gc" -;; "levels/common/enemy/hover/wasp.gc" -;; "levels/common/enemy/hover/crimson-guard-hover.gc" -;; "levels/common/enemy/hover/flamer.gc" -;; "levels/forest/forest-part.gc" -;; "levels/forest/forest-obs.gc" -;; "levels/forest/pegasus.gc" -;; "levels/forest/wren.gc" -;; "levels/forest/fish.gc" -;; "levels/forest/predator-h.gc" -;; "levels/forest/predator-graph.gc" -;; "levels/forest/predator.gc" -;; "levels/forest/forest-scenes.gc" -;; ) +(goal-src-sequence + "" + :deps ("$OUT/obj/los-control.o") + "levels/common/enemy/spyder.gc" + "levels/common/enemy/guards/crimson-guard-level.gc" + "levels/common/enemy/guards/guard-conversation.gc" + "levels/common/enemy/guards/transport-level.gc" + "levels/common/enemy/hover/hover-formation-h.gc" + "levels/common/enemy/hover/hover-nav-control-h.gc" + "levels/common/enemy/hover/hover-enemy-h.gc" + "levels/common/enemy/hover/hover-nav-network.gc" + "levels/common/enemy/hover/hover-nav-control.gc" + "levels/common/enemy/hover/hover-enemy.gc" + "levels/common/enemy/hover/hover-enemy-battle.gc" + "levels/common/enemy/hover/hover-formation.gc" + "levels/common/enemy/hover/hover-nav-edit.gc" + "levels/common/enemy/hover/wasp-part.gc" + "levels/common/enemy/hover/wasp.gc" + "levels/common/enemy/hover/crimson-guard-hover.gc" + "levels/common/enemy/hover/flamer.gc" + "levels/forest/forest-part.gc" + "levels/forest/forest-obs.gc" + "levels/forest/pegasus.gc" + "levels/forest/wren.gc" + "levels/forest/fish.gc" + "levels/forest/predator-h.gc" + "levels/forest/predator-graph.gc" + "levels/forest/predator.gc" + "levels/forest/forest-scenes.gc" + ) -;; (copy-textures 1414 1416 1415 1413 2335 1411 2845) +(copy-textures 1414 1416 1415 1413 2335 1411 2845) -;; (copy-gos -;; "jak-pegasus+0-ag" -;; "pegasus-ag" -;; "predator-ag" -;; "spyder-ag" -;; "wren-ag" -;; "minnow-ag" -;; "forest-vis" -;; ) +(copy-gos + "jak-pegasus+0-ag" + "pegasus-ag" + "predator-ag" + "spyder-ag" + "wren-ag" + "minnow-ag" + "forest-vis" + ) ;; ;;;;;;;;;;;;;;;;;;;;; ;; ;; FORDUMPC diff --git a/goal_src/jak2/levels/common/enemy/guards/guard-conversation.gc b/goal_src/jak2/levels/common/enemy/guards/guard-conversation.gc index 069184b0b9..1eaccf7184 100644 --- a/goal_src/jak2/levels/common/enemy/guards/guard-conversation.gc +++ b/goal_src/jak2/levels/common/enemy/guards/guard-conversation.gc @@ -7,3 +7,439 @@ ;; DECOMP BEGINS +(deftype gconv-speech (basic) + ((name0 basic :offset-assert 4) + (name1 basic :offset-assert 8) + (hold-time uint32 :offset-assert 12) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + + +(deftype gconv-dialogue (basic) + ((speeches (array gconv-speech) :offset-assert 4) + ) + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + + +(deftype gconv-dialogues (basic) + ((dialogues (array gconv-dialogue) :offset-assert 4) + ) + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + + +(define *gconv-dialogues* + (new 'static 'gconv-dialogues + :dialogues (new 'static 'boxed-array :type gconv-dialogue + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg186a" :name1 "kg186b" :hold-time #x258) + (new 'static 'gconv-speech :name0 "kg187a" :name1 "kg187b" :hold-time #x96) + (new 'static 'gconv-speech :name0 "kg188a" :name1 "kg188b" :hold-time #x12c) + (new 'static 'gconv-speech :name0 "kg189a" :name1 "kg189b" :hold-time #x258) + (new 'static 'gconv-speech :name0 "kg190a" :name1 "kg190b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg222a" :name1 "kg222b" :hold-time #x96) + (new 'static 'gconv-speech :name0 "kg223a" :name1 "kg223b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg203a" :name1 "kg203b" :hold-time #x96) + (new 'static 'gconv-speech :name0 "kg204a" :name1 "kg204b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg207a" :name1 "kg207b" :hold-time #x4b) + (new 'static 'gconv-speech :name0 "kg209a" :name1 "kg209b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg211a" :name1 "kg211b" :hold-time #x87) + (new 'static 'gconv-speech :name0 "kg212a" :name1 "kg212b" :hold-time #x5a) + (new 'static 'gconv-speech :name0 "kg213a" :name1 "kg213b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg179b" :name1 "kg179b" :hold-time #x12c) + (new 'static 'gconv-speech :name0 "kg180a" :name1 "kg180b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg181a" :name1 "kg181b" :hold-time #x96) + (new 'static 'gconv-speech :name0 "kg182a" :name1 "kg182b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg183a" :name1 "kg183b" :hold-time #x5a) + (new 'static 'gconv-speech :name0 "kg184a" :name1 "kg184b" :hold-time #x5a) + (new 'static 'gconv-speech :name0 "kg185a" :name1 "kg185b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg191a" :name1 "kg191b" :hold-time #x12c) + (new 'static 'gconv-speech :name0 "kg192a" :name1 "kg192b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg194a" :name1 "kg194b" :hold-time #x177) + (new 'static 'gconv-speech :name0 "kg195a" :name1 "kg195b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg197a" :name1 "kg197b" :hold-time #xd2) + (new 'static 'gconv-speech :name0 "kg198a" :name1 "kg198b" :hold-time #x96) + (new 'static 'gconv-speech :name0 "kg199a" :name1 "kg199b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg200a" :name1 "kg200b" :hold-time #x96) + (new 'static 'gconv-speech :name0 "kg201a" :name1 "kg201b" :hold-time #x177) + (new 'static 'gconv-speech :name0 "kg202a" :name1 "kg202b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg205a" :name1 "kg205b" :hold-time #x12c) + (new 'static 'gconv-speech :name0 "kg206a" :name1 "kg206b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg214a" :name1 "kg214b" :hold-time #x96) + (new 'static 'gconv-speech :name0 "kg215a" :name1 "kg215b" :hold-time #x78) + (new 'static 'gconv-speech :name0 "kg216a" :name1 "kg216b" :hold-time #x78) + (new 'static 'gconv-speech :name0 "kg217a" :name1 "kg217b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg218a" :name1 "kg218b" :hold-time #x12c) + (new 'static 'gconv-speech :name0 "kg219a" :name1 "kg219b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg220a" :name1 "kg220b" :hold-time #x96) + (new 'static 'gconv-speech :name0 "kg221a" :name1 "kg221b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg226a" :name1 "kg226b" :hold-time #x96) + (new 'static 'gconv-speech :name0 "kg227a" :name1 "kg227b" :hold-time #xe1) + (new 'static 'gconv-speech :name0 "kg228a" :name1 "kg228b" :hold-time #x258) + (new 'static 'gconv-speech :name0 "kg229a" :name1 "kg229b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg230a" :name1 "kg230b" :hold-time #x12c) + (new 'static 'gconv-speech :name0 "kg231a" :name1 "kg231b" :hold-time #xe1) + (new 'static 'gconv-speech :name0 "kg232a" :name1 "kg232b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg233a" :name1 "kg233b" :hold-time #x96) + (new 'static 'gconv-speech :name0 "kg234a" :name1 "kg234b" :hold-time #x96) + (new 'static 'gconv-speech :name0 "kg235a" :name1 "kg235b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech (new 'static 'gconv-speech :name0 "kg210a" :name1 "kg210b")) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg224a" :name1 "kg224b" :hold-time #x96) + (new 'static 'gconv-speech :name0 "kg225a" :name1 "kg225b") + ) + ) + ) + ) + ) + +(deftype guard-conversation (process-drawable) + ((triggered? symbol :offset-assert 200) + (actor-group actor-group :offset-assert 204) + (actor-count int8 :offset-assert 208) + (remaining int8 :offset-assert 209) + (skip-mask uint32 :offset-assert 212) + (last-playing-time time-frame :offset-assert 216) + ) + :heap-base #x60 + :method-count-assert 25 + :size-assert #xe0 + :flag-assert #x19006000e0 + (:methods + (dormant () _type_ :state 20) + (active () _type_ :state 21) + (notice () _type_ :state 22) + (die () _type_ :state 23) + (guard-conversation-method-24 (_type_) symbol 24) + ) + ) + + +(defmethod guard-conversation-method-24 guard-conversation ((obj guard-conversation)) + (let ((v1-0 (-> obj remaining))) + (when (> v1-0 0) + (set! (-> obj remaining) (+ v1-0 -1)) + (let* ((s3-0 (rand-vu-int-count-excluding 32 (the-as int (-> obj skip-mask)))) + (s5-0 (-> *gconv-dialogues* dialogues s3-0 speeches)) + (s4-1 (zero? (rand-vu-int-count 2))) + ) + (logior! (-> obj skip-mask) (ash 1 s3-0)) + (dotimes (s3-1 (-> s5-0 length)) + (let* ((v1-9 (-> s5-0 s3-1)) + (t0-0 (if s4-1 + (-> v1-9 name0) + (-> v1-9 name1) + ) + ) + ) + (gui-control-method-9 + *gui-control* + obj + (gui-channel guard) + (gui-action play) + (the-as string t0-0) + -99.0 + (the-as time-frame (-> v1-9 hold-time)) + ) + ) + (set! s4-1 (not s4-1)) + ) + ) + #f + ) + ) + ) + +(defstate dormant (guard-conversation) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('trigger) + (set! (-> self triggered?) #t) + (go-virtual active) + ) + (('untrigger) + (set! (-> self triggered?) #f) + #f + ) + ) + ) + :code (the-as (function none :behavior guard-conversation) sleep-code) + ) + +(defstate active (guard-conversation) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (let ((v1-0 event-type)) + (the-as object (cond + ((= v1-0 'trigger) + (let ((v0-0 #t)) + (set! (-> self triggered?) v0-0) + v0-0 + ) + ) + ((= v1-0 'untrigger) + (set! (-> self triggered?) #f) + #f + ) + ) + ) + ) + ) + :trans (behavior () + (let ((gp-0 #t)) + (countdown (s5-0 (-> self actor-count)) + (let ((v1-3 (-> self actor-group data s5-0 actor))) + (when (not (logtest? (-> v1-3 extra perm status) (entity-perm-status dead))) + (set! gp-0 #f) + (let ((a0-4 (if v1-3 + (-> v1-3 extra process) + ) + ) + ) + (when a0-4 + (if (nonzero? (-> (the-as nav-enemy a0-4) focus aware)) + (go-virtual notice) + ) + ) + ) + ) + ) + ) + (if gp-0 + (go-virtual die) + ) + ) + (if (nonzero? (gui-control-method-17 + *gui-control* + (the-as + sound-id + (gui-control-method-14 *gui-control* (the-as string #f) (gui-channel guard) (gui-action none)) + ) + ) + ) + (set! (-> self last-playing-time) (-> self clock frame-counter)) + ) + (if (and (-> self triggered?) (>= (- (-> self clock frame-counter) (-> self last-playing-time)) (seconds 6))) + (guard-conversation-method-24 self) + ) + (none) + ) + :code (the-as (function none :behavior guard-conversation) sleep-code) + ) + +(defstate notice (guard-conversation) + :virtual #t + :code (behavior () + (gui-control-method-16 + *gui-control* + (gui-action stop) + (the-as sound-id 1) + (gui-channel guard) + (gui-action none) + (the-as string #f) + (the-as (function gui-connection symbol) #f) + (the-as process #f) + ) + (let ((v1-2 (rand-vu-int-count 3))) + (gui-control-method-9 + *gui-control* + self + (gui-channel guard) + (gui-action play) + (cond + ((zero? v1-2) + "kg137" + ) + ((= v1-2 1) + "kg152" + ) + (else + "kg160" + ) + ) + -99.0 + 0 + ) + ) + (until (= (gui-control-method-17 + *gui-control* + (the-as + sound-id + (gui-control-method-14 *gui-control* (the-as string #f) (gui-channel guard) (gui-action none)) + ) + ) + (gui-action none) + ) + (suspend) + ) + (go-virtual die) + (none) + ) + ) + +(defstate die (guard-conversation) + :virtual #t + :code (behavior () + (process-entity-status! self (entity-perm-status bit-12) #t) + (process-entity-status! self (entity-perm-status dead) #t) + (suspend) + 0 + (none) + ) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! guard-conversation ((obj guard-conversation) (arg0 entity-actor)) + (local-vars (sv-16 res-tag)) + (set! (-> obj triggered?) #f) + (set! (-> obj root) (new 'process 'trsqv)) + (process-drawable-from-entity! obj arg0) + (let ((v1-2 (res-lump-value (-> obj entity) 'extra-id uint128 :time -1000000000.0))) + (let ((a1-4 (-> *gconv-dialogues* dialogues length)) + (a0-6 0) + ) + (dotimes (a2-1 31) + (when (logtest? v1-2 (ash 1 a2-1)) + (if (< a2-1 a1-4) + (+! a0-6 1) + (set! v1-2 (logxor v1-2 (the-as uint (ash 1 a2-1)))) + ) + ) + ) + (set! (-> obj remaining) a0-6) + ) + (set! (-> obj skip-mask) (the-as uint (lognot v1-2))) + ) + (let ((s5-1 (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status bit-12))))) + (set! sv-16 (new 'static 'res-tag)) + (let ((s4-0 (res-lump-data (-> obj entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (if (or (not s4-0) (zero? (-> sv-16 elt-count))) + (go process-drawable-art-error "missing actors") + ) + (let* ((s4-1 (-> s4-0 0)) + (s3-0 (-> s4-1 length)) + ) + (set! (-> obj actor-group) s4-1) + (set! (-> obj actor-count) s3-0) + (if (!= s3-0 2) + (go process-drawable-art-error "bad actor count") + ) + (dotimes (s2-0 s3-0) + (let ((s1-0 (-> s4-1 data s2-0 actor))) + (if (not s1-0) + (go process-drawable-art-error "bad actor") + ) + (cond + ((logtest? (-> s1-0 extra perm status) (entity-perm-status dead)) + (set! s5-1 #t) + ) + (else + (let ((v1-28 (if s1-0 + (-> s1-0 extra process) + ) + ) + ) + (if (and v1-28 (nonzero? (-> (the-as nav-enemy v1-28) focus aware))) + (set! s5-1 #t) + ) + ) + ) + ) + ) + ) + ) + ) + (if s5-1 + (go (method-of-object obj die)) + (go (method-of-object obj dormant)) + ) + ) + (none) + ) diff --git a/goal_src/jak2/levels/common/guard-projectile.gc b/goal_src/jak2/levels/common/guard-projectile.gc index eac4875260..40fa9660b4 100644 --- a/goal_src/jak2/levels/common/guard-projectile.gc +++ b/goal_src/jak2/levels/common/guard-projectile.gc @@ -7,3 +7,1020 @@ ;; DECOMP BEGINS +(defpart 605 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x9b :page #xb)) + (sp-rnd-flt spt-num 10.0 1.0 1.0) + (sp-flt spt-x (meters 0)) + (sp-flt spt-y (meters 0)) + (sp-flt spt-z (meters 0)) + (sp-flt spt-scale-x (meters 1)) + (sp-flt spt-rot-x 16384.0) + (sp-flt spt-rot-y (degrees 0.0)) + (sp-flt spt-rot-z (degrees 0.0)) + (sp-flt spt-scale-y (meters 0.1)) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-rnd-flt spt-a 64.0 32.0 1.0) + (sp-rnd-flt spt-accel-y -1.3653333 -4.096 1.0) + (sp-int spt-timer 5) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-14) + ) + ) + +(defpart 606 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x45 :page #xc)) + (sp-func spt-birth-func 'birth-func-set-quat) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 0.25)) + (sp-flt spt-scale-y (meters 9)) + (sp-flt spt-r 128.0) + (sp-rnd-flt spt-g 0.0 64.0 1.0) + (sp-flt spt-b 0.0) + (sp-flt spt-a 128.0) + (sp-flt spt-scalevel-x (meters 0.0016666667)) + (sp-flt spt-fade-a -2.1333334) + (sp-int spt-timer 40) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-14 left-multiply-quat) + ) + ) + +(defpart 607 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xca :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 1)) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-flt spt-b 0.0) + (sp-flt spt-a 64.0) + (sp-flt spt-scalevel-x (meters -0.016666668)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -1.6) + (sp-int spt-timer 25) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + ) + ) + +(defpart 608 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x47 :page #xc)) + (sp-flt spt-num 0.0) + (sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.3) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 64.0 32.0 1.0) + (sp-int spt-timer 5) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + ) + ) + +(defpart 609 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x14 :page #xc)) + (sp-rnd-flt spt-num 8.0 8.0 1.0) + (sp-rnd-flt spt-z (meters 0) (meters -3) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.4) (meters 0.4) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.4) (meters 0.4) 1.0) + (sp-flt spt-r 192.0) + (sp-rnd-flt spt-g 64.0 128.0 1.0) + (sp-flt spt-b 0.0) + (sp-flt spt-a 64.0) + (sp-flt spt-scalevel-x (meters -0.00234375)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-fade-g -1.2 -2.4 1.0) + (sp-rnd-flt spt-fade-a -0.53333336 -2.1333334 1.0) + (sp-rnd-flt spt-accel-y -0.68266666 -0.68266666 1.0) + (sp-int spt-timer 240) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-flt spt-rotate-y (degrees 0.0)) + ) + ) + +(defpart 610 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x81 :page #xc)) + (sp-func spt-birth-func 'birth-func-set-quat) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 2)) + (sp-flt spt-scale-y (meters 4.5)) + (sp-flt spt-r 128.0) + (sp-rnd-flt spt-g 0.0 128.0 1.0) + (sp-flt spt-b 0.0) + (sp-flt spt-a 128.0) + (sp-flt spt-fade-a -3.6571429) + (sp-int spt-timer 35) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 left-multiply-quat) + ) + ) + +(defpart 611 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 1) (meters 1) 1.0) + (sp-flt spt-rot-x 819.2) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 3600.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 0.0) + (sp-flt spt-a 255.0) + (sp-flt spt-omega 822067.2) + (sp-flt spt-scalevel-x (meters 0.053333335)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -3.6571429) + (sp-flt spt-fade-a -7.285714) + (sp-int spt-timer 35) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow) + (sp-flt spt-userdata 1024.0) + ) + ) + +(defpartgroup group-guard-shot-hit-object + :id 136 + :duration (seconds 1) + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 8) + :parts ((sp-item 612 :flags (bit6) :period 600 :length 5) + (sp-item 613 :flags (bit6) :period 600 :length 5) + (sp-item 614 :flags (bit6) :period 600 :length 5) + ) + ) + +(defpartgroup group-guard-shot-hit + :id 137 + :duration (seconds 1) + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 8) + :parts ((sp-item 612 :flags (bit6) :period 600 :length 5) + (sp-item 613 :flags (bit6) :period 600 :length 5) + (sp-item 614 :flags (bit6) :period 600 :length 5) + (sp-item 615 :period 600 :length 5) + ) + ) + +(defpart 614 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x33 :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 2)) + (sp-flt spt-rot-x 204.8) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 3600.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-rnd-flt spt-g 0.0 128.0 1.0) + (sp-flt spt-b 0.0) + (sp-flt spt-a 64.0) + (sp-flt spt-scalevel-x (meters 0.075)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -1.8285714) + (sp-int spt-timer 40) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow) + (sp-flt spt-userdata 8192.0) + ) + ) + +(defpart 615 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-rnd-flt spt-num 8.0 8.0 1.0) + (sp-rnd-flt spt-scale-x (meters 0.75) (meters 0.5) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 3600.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-rnd-flt spt-g 0.0 128.0 1.0) + (sp-flt spt-b 0.0) + (sp-rnd-flt spt-a 16.0 48.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.026666667) (meters 0.026666667) 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.0016666667) (meters 0.006666667) 1.0) + (sp-rnd-flt spt-rotvel-z (degrees -0.2) (degrees 0.4) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-r -0.30476192) + (sp-flt spt-fade-g 0.15238096) + (sp-flt spt-fade-b 0.30476192) + (sp-flt spt-fade-a -0.15238096) + (sp-rnd-flt spt-accel-y -0.68266666 -0.68266666 1.0) + (sp-flt spt-friction 0.9) + (sp-int spt-timer 420) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 3600.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 3600.0) 1.0) + ) + ) + +(defpart 613 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc)) + (sp-flt spt-num 2.0) + (sp-flt spt-scale-x (meters 2)) + (sp-flt spt-rot-x 819.2) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-rnd-flt spt-g 128.0 64.0 1.0) + (sp-rnd-flt spt-b 0.0 32.0 1.0) + (sp-flt spt-a 48.0) + (sp-flt spt-scalevel-x (meters 0.125)) + (sp-rnd-flt spt-rotvel-z (degrees -0.3) (degrees 0.6) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -2.1333334) + (sp-flt spt-fade-b -2.1333334) + (sp-int spt-timer 80) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 glow) + (sp-flt spt-userdata 0.0) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 616) + ) + ) + +(defpart 616 + :init-specs ((sp-flt spt-scale-x (meters 4.5)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-scalevel-x (meters -0.05)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -0.53333336) + (sp-flt spt-fade-a -0.8) + ) + ) + +(defpart 612 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 1)) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 96.0) + (sp-flt spt-scalevel-x (meters 0.1)) + (sp-flt spt-rotvel-z (degrees 0.3)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-int spt-timer 55) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-int spt-next-time 15) + (sp-launcher-by-id spt-next-launcher 617) + ) + ) + +(defpart 617 + :init-specs ((sp-flt spt-scale-x (meters 3.5)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-scalevel-x (meters -0.0625)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-b -6.4) + ) + ) + +(defpartgroup group-guard-grenade + :id 138 + :duration (seconds 0.5) + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 2) + :parts ((sp-item 618 :fade-after (meters 200) :falloff-to (meters 200))) + ) + +(defpart 618 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.25) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 3600.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 64.0 128.0 1.0) + (sp-copy-from-other spt-g -1) + (sp-copy-from-other spt-b -1) + (sp-rnd-flt spt-a 16.0 32.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0) (meters 0.016666668) 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.006666667) (meters 0.013333334) 1.0) + (sp-rnd-flt spt-rotvel-z (degrees -0.2) (degrees 0.4) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-fade-a -0.16 -0.16 1.0) + (sp-flt spt-friction 0.96) + (sp-int spt-timer 300) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-12) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 3600.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 3600.0) 1.0) + (sp-flt spt-conerot-radius (meters 0)) + ) + ) + +(defpartgroup group-guard-shot-die + :id 139 + :duration (seconds 0.017) + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 8) + :parts ((sp-item 209)) + ) + +(deftype guard-shot (projectile) + ((hit-actor? symbol :offset-assert 472) + (tail-pos vector :inline :offset-assert 480) + ) + :heap-base #x170 + :method-count-assert 40 + :size-assert #x1f0 + :flag-assert #x28017001f0 + ) + + +(defmethod deal-damage! guard-shot ((obj guard-shot) (arg0 process) (arg1 event-message-block)) + "Constructs an [[attack-info]] according to the projectile's `options`" + (let ((t9-0 (method-of-type projectile deal-damage!))) + (when (t9-0 obj arg0 arg1) + (set! (-> obj hit-actor?) #t) + #t + ) + ) + ) + +(defmethod draw-laser-sight guard-shot ((obj guard-shot)) + "TODO - confirm If applicable, draw the laser sight particles + :virtual" + (draw-beam (-> *part-id-table* 610) (-> obj tail-pos) (-> obj starting-dir) #f #t) + (let* ((a0-3 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> obj starting-dir) 2048.0)) + (v1-2 (vector+! (new 'stack-no-clear 'vector) (-> obj tail-pos) a0-3)) + (t9-2 sp-launch-particles-var) + (a0-4 *sp-particle-system-2d*) + (a1-4 (-> *part-id-table* 611)) + (a2-2 *launch-matrix*) + ) + (set! (-> a2-2 trans quad) (-> v1-2 quad)) + (t9-2 a0-4 a1-4 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + 0 + (none) + ) + +(defmethod spawn-impact-particles guard-shot ((obj guard-shot)) + "Spawns associated particles with the projectile if applicable" + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let* ((gp-0 (-> obj root-override trans)) + (a1-0 (-> obj tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) + ) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (let ((v1-4 a1-0)) + (let ((a0-2 s5-1)) + (let ((a2-1 0.8)) + (.mov vf7 a2-1) + ) + (.lvf vf5 (&-> a0-2 quad)) + ) + (.lvf vf4 (&-> v1-4 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> s4-0 quad) vf6) + (let ((f28-0 (-> *part-id-table* 606 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 606 init-specs 4 initial-valuef) (vector-length s5-1)) + (draw-beam (-> *part-id-table* 606) a1-0 s5-1 #f #t) + (set! (-> *part-id-table* 606 init-specs 4 initial-valuef) f28-0) + ) + (vector-normalize! s5-1 1.0) + (let ((t9-2 sp-launch-particles-var) + (a0-5 *sp-particle-system-2d*) + (a1-2 (-> *part-id-table* 607)) + (a2-3 *launch-matrix*) + ) + (set! (-> a2-3 trans quad) (-> s4-0 quad)) + (t9-2 a0-5 a1-2 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (let ((t9-3 sp-launch-particles-var) + (a0-6 *sp-particle-system-2d*) + (a1-3 (-> *part-id-table* 608)) + (a2-4 *launch-matrix*) + ) + (set! (-> a2-4 trans quad) (-> s4-0 quad)) + (t9-3 a0-6 a1-3 a2-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + (let ((s4-1 (new 'stack-no-clear 'matrix)) + (f26-0 (* 0.000027126736 f30-0)) + (f30-1 (-> *part-id-table* 609 init-specs 3 initial-valuef)) + (f28-1 (-> *part-id-table* 609 init-specs 4 initial-valuef)) + ) + (forward-up->inv-matrix s4-1 s5-1 *up-vector*) + (set! (-> s4-1 trans quad) (-> gp-0 quad)) + (set! (-> *part-id-table* 609 init-specs 3 initial-valuef) (* f26-0 f30-1)) + (set! (-> *part-id-table* 609 init-specs 4 initial-valuef) (* f26-0 f28-1)) + (sp-launch-particles-var + *sp-particle-system-2d* + (-> *part-id-table* 609) + s4-1 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + (set! (-> *part-id-table* 609 init-specs 3 initial-valuef) f30-1) + (set! (-> *part-id-table* 609 init-specs 4 initial-valuef) f28-1) + ) + ) + 0 + (none) + ) + ) + +(defmethod spawn-shell-particles guard-shot ((obj guard-shot)) + "TODO - confirm" + (let* ((s4-0 (-> obj root-override)) + (v1-1 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> obj tail-pos) (-> s4-0 trans)) 2048.0)) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> gp-0 quad) (-> s4-0 trans quad)) + (vector+! gp-0 gp-0 v1-1) + (cond + ((-> obj hit-actor?) + (let ((s5-1 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-1 + (let ((t9-2 (method-of-type part-tracker activate))) + (t9-2 + (the-as part-tracker s5-1) + *entity-pool* + (symbol->string (-> part-tracker symbol)) + (the-as pointer #x70004000) + ) + ) + (let ((t9-3 run-function-in-process) + (a0-8 s5-1) + (a1-6 part-tracker-init) + (a2-4 (-> *part-group-id-table* 136)) + (a3-1 0) + (t0-0 #f) + (t1-0 #f) + (t2-0 #f) + (t3-0 *launch-matrix*) + ) + (set! (-> t3-0 trans quad) (-> gp-0 quad)) + ((the-as (function object object object object object object object object none) t9-3) + a0-8 + a1-6 + a2-4 + a3-1 + t0-0 + t1-0 + t2-0 + t3-0 + ) + ) + (-> s5-1 ppointer) + ) + ) + ) + (else + (let ((s5-2 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-2 + (let ((t9-5 (method-of-type part-tracker activate))) + (t9-5 + (the-as part-tracker s5-2) + *entity-pool* + (symbol->string (-> part-tracker symbol)) + (the-as pointer #x70004000) + ) + ) + (let ((t9-6 run-function-in-process) + (a0-11 s5-2) + (a1-9 part-tracker-init) + (a2-9 (-> *part-group-id-table* 137)) + (a3-3 0) + (t0-1 #f) + (t1-1 #f) + (t2-1 #f) + (t3-1 *launch-matrix*) + ) + (set! (-> t3-1 trans quad) (-> gp-0 quad)) + ((the-as (function object object object object object object object object none) t9-6) + a0-11 + a1-9 + a2-9 + a3-3 + t0-1 + t1-1 + t2-1 + t3-1 + ) + ) + (-> s5-2 ppointer) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs sound-id. +(defmethod play-impact-sound guard-shot ((obj guard-shot) (arg0 projectile-options)) + (let ((v1-0 arg0)) + (cond + ((zero? v1-0) + (sound-play "guard-shot-fire") + ) + ((= v1-0 (projectile-options lose-altitude)) + (sound-play "guard-shot-hit") + ) + ) + ) + (the-as sound-id 0) + ) + +(defstate impact (guard-shot) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type projectile impact) enter))) + (if t9-0 + (t9-0) + ) + ) + (when *traffic-manager* + (let ((v1-5 (new 'stack-no-clear 'traffic-danger-info))) + (set! (-> v1-5 sphere quad) (-> self root-override trans quad)) + (set! (-> v1-5 sphere r) 40960.0) + (set! (-> v1-5 velocity quad) (-> self root-override transv quad)) + (set! (-> v1-5 notify-radius) 122880.0) + (set! (-> v1-5 danger-level) 1.0) + (set! (-> v1-5 decay-rate) 0.0) + (set! (-> v1-5 flags) (the-as uint 1)) + (set! (-> v1-5 danger-type) (the-as uint 0)) + (set! (-> v1-5 handle) (the-as uint #f)) + (send-event *traffic-manager* 'add-danger-sphere v1-5) + ) + ) + (none) + ) + ) + +(defun guard-shot-move ((arg0 guard-shot)) + (projectile-move-fill-line-sphere arg0) + (let ((s5-0 (-> arg0 root-override))) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (vector-! s4-0 (-> arg0 tail-pos) (-> s5-0 trans)) + (let ((f0-0 (vector-length s4-0))) + (when (< 36864.0 f0-0) + (vector-normalize! s4-0 36864.0) + (vector+! (-> arg0 tail-pos) (-> s5-0 trans) s4-0) + ) + ) + ) + (when (logtest? (-> s5-0 status) (cshape-moving-flags t-surface)) + (if (logtest? (-> arg0 root-override status) (cshape-moving-flags t-act)) + (set! (-> arg0 hit-actor?) #t) + ) + (go (method-of-object arg0 impact)) + ) + ) + 0 + (none) + ) + +(defmethod made-impact? guard-shot ((obj guard-shot)) + "TODO - queries the collision cache, return true/false" + (let ((v1-0 (-> obj root-override))) + (let ((a0-1 (new 'stack-no-clear 'collide-query))) + (set! (-> a0-1 radius) (-> v1-0 root-prim prim-core world-sphere w)) + (set! (-> a0-1 collide-with) (-> v1-0 root-prim prim-core collide-with)) + (set! (-> a0-1 ignore-process0) obj) + (set! (-> a0-1 ignore-process1) (ppointer->process (-> obj parent))) + (set! (-> a0-1 ignore-pat) (-> v1-0 pat-ignore-mask)) + (set! (-> a0-1 action-mask) (collide-action solid)) + ) + (when (collide-shape-moving-method-65 v1-0 (-> v1-0 transv) -6144.0 0.0 -2048.0) + (if (logtest? (-> obj root-override status) (cshape-moving-flags t-act)) + (set! (-> obj hit-actor?) #t) + ) + #t + ) + ) + ) + +(defmethod init-collision! guard-shot ((obj guard-shot)) + "Init the [[projectile]]'s [[collide-shape]]" + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) + (the-as (function control-info collide-query vector vector cshape-moving-flags) cshape-reaction-just-move) + ) + (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 penetrate-using) (penetrate enemy-yellow-shot)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec projectile)) + (set! (-> s4-0 prim-core collide-with) + (collide-spec backgnd jak bot crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list) + ) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 2457.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 projectile)) + (set! (-> v1-13 prim-core collide-with) + (collide-spec backgnd jak bot crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list) + ) + (set! (-> v1-13 prim-core action) (collide-action solid deadly)) + (set-vector! (-> v1-13 local-sphere) 0.0 0.0 0.0 819.2) + ) + (let ((v1-15 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-15 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-15 prim-core collide-with) + (collide-spec jak bot crate civilian enemy vehicle-sphere hit-by-others-list player-list) + ) + (set! (-> v1-15 prim-core action) (collide-action deadly)) + (set-vector! (-> v1-15 local-sphere) 0.0 0.0 0.0 2457.6) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-18 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-18 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-18 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 1)) + (set! (-> s5-0 event-self) 'touched) + (set! (-> obj root-override) s5-0) + ) + (set! (-> obj root-override pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1) + ) + 0 + (none) + ) + +(defmethod init-proj-settings! guard-shot ((obj guard-shot)) + "Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc + :virtual" + (set! (-> obj hit-actor?) #f) + (set! (-> obj tail-pos quad) (-> obj root-override trans quad)) + (set! (-> obj attack-mode) 'guard-shot) + (set! (-> obj max-speed) 819200.0) + (set! (-> obj move) guard-shot-move) + (set! (-> obj update-velocity) projectile-update-velocity-space-wars) + (set! (-> obj timeout) (seconds 0.5)) + (logior! (-> obj options) (projectile-options account-for-target-velocity)) + (set-gravity-length (-> obj root-override dynam) 573440.0) + (none) + ) + +(deftype vehicle-grenade (projectile-bounce) + ((blast-radius float :offset-assert 496) + ) + :heap-base #x180 + :method-count-assert 42 + :size-assert #x1f4 + :flag-assert #x2a018001f4 + ) + + +(defskelgroup skel-vehicle-grenade eco-canister 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 0.3) + :texture-level 6 + ) + +;; WARN: Return type mismatch int vs sound-id. +(defmethod play-impact-sound vehicle-grenade ((obj vehicle-grenade) (arg0 projectile-options)) + (let ((v1-0 arg0)) + (cond + ((zero? v1-0) + (sound-play "grenade-fire") + ) + ((= v1-0 (projectile-options lose-altitude)) + (sound-play "grenade-explode") + ) + ) + ) + (the-as sound-id 0) + ) + +(defmethod init-collision! vehicle-grenade ((obj vehicle-grenade)) + "Init the [[projectile]]'s [[collide-shape]]" + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) projectile-bounce-reaction) + (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 penetrate-using) (penetrate explode)) + (let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-7 prim-core action) (collide-action solid)) + (set-vector! (-> v1-7 local-sphere) 0.0 0.0 0.0 819.2) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-7) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-10 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-10 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-10 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 2)) + (set! (-> s5-0 event-self) 'touched) + (set! (-> obj root-override) s5-0) + ) + (set-collide-with! + (-> obj root-override) + (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set-collide-as! (-> obj root-override) (collide-spec enemy)) + (set! (-> obj root-override pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1) + ) + (none) + ) + +(defmethod init-proj-settings! vehicle-grenade ((obj vehicle-grenade)) + "Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc + :virtual" + (set! (-> obj attack-mode) 'eco-dark) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-vehicle-grenade" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (let ((t9-2 (method-of-type projectile-bounce init-proj-settings!))) + (t9-2 obj) + ) + (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 138) obj)) + (set! (-> obj blast-radius) 16384.0) + (set! (-> obj max-speed) 90112.0) + (set! (-> obj timeout) (seconds 4)) + 0 + (none) + ) + +(defmethod spawn-impact-particles vehicle-grenade ((obj vehicle-grenade)) + "Spawns associated particles with the projectile if applicable" + (spawn (-> obj part) (-> obj root-override trans)) + (ja-post) + 0 + (none) + ) + +(defmethod noop vehicle-grenade ((obj vehicle-grenade)) + "Does nothing" + (spawn (-> obj part) (-> obj root-override trans)) + 0 + (none) + ) + +(defmethod play-impact-sound! vehicle-grenade ((obj vehicle-grenade)) + "Plays impact sound + :virtual" + (let* ((a2-0 (-> obj root-override)) + (v1-0 (-> a2-0 status)) + ) + (if (logtest? v1-0 (cshape-moving-flags t-surface)) + (vector-float*! (-> a2-0 transv) (-> a2-0 transv) 0.2) + ) + (when (and (logtest? v1-0 (cshape-moving-flags csmf11)) + (>= (- (-> self clock frame-counter) (-> obj played-bounce-time)) (seconds 0.3)) + ) + (set! (-> obj played-bounce-time) (-> self clock frame-counter)) + (sound-play "grenade-bounce") + ) + ) + ) + +(defstate impact (vehicle-grenade) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (let ((v1-0 event-type)) + (the-as object (when (= v1-0 'touched) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) (process->ppointer self)) + (set! (-> a1-2 num-params) 2) + (set! (-> a1-2 message) 'attack) + (set! (-> a1-2 param 0) (-> event param 0)) + (let ((v1-5 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (set! (-> v1-5 id) (-> self attack-id)) + (set! (-> v1-5 mode) 'explode) + (set! (-> a1-2 param 1) (the-as uint v1-5)) + ) + (if (send-event-function proc a1-2) + #t + ) + ) + ) + ) + ) + ) + :code (behavior () + (let ((gp-0 (new 'stack-no-clear 'explosion-init-params))) + (set! (-> gp-0 spawn-point quad) (-> self root-override trans quad)) + (quaternion-copy! (-> gp-0 spawn-quat) (-> self root-override quat)) + (set! (-> gp-0 radius) (-> self blast-radius)) + (set! (-> gp-0 group) (-> *part-group-id-table* 76)) + (set! (-> gp-0 collide-with) + (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set! (-> gp-0 penetrate-using) (penetrate explode)) + (explosion-spawn self explosion gp-0) + ) + (logior! (-> self draw status) (draw-control-status no-draw)) + (let ((v1-11 (-> self root-override root-prim))) + (set! (-> v1-11 prim-core collide-as) (collide-spec)) + (set! (-> v1-11 prim-core collide-with) (collide-spec)) + ) + 0 + (while (-> self child) + (suspend) + ) + (deactivate self) + (none) + ) + ) + +(set! (-> *lightning-spec-id-table* 13) (new 'static 'lightning-spec + :name "lightning-trail-crimson-guard" + :flags (lightning-spec-flags lsf1) + :rand-func #x2 + :start-color (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + :fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5) + :fade-start-factor 0.2 + :fade-time 120.0 + :texture #xc08300 + :reduction 0.6 + :num-points 16 + :box-size 2048.0 + :merge-factor 0.5 + :merge-count 2 + :radius 1638.4 + :duration -1.0 + :sound #f + ) + ) + +(set! (-> *lightning-spec-id-table* 14) (new 'static 'lightning-spec + :name "lightning-fractal-crimson-guard" + :flags (lightning-spec-flags lsf1) + :start-color (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + :fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5) + :fade-start-factor 0.2 + :fade-time 120.0 + :texture #xc08300 + :reduction 0.6 + :num-points 16 + :box-size 2048.0 + :merge-factor 0.5 + :merge-count 2 + :radius 1638.4 + :duration -1.0 + :sound #f + ) + ) + +(defpart 619 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 0.8) (meters 0.2) 1.0) + (sp-flt spt-rot-x 409.6) + (sp-rnd-flt spt-rot-z (degrees -17.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 32.0 96.0 1.0) + (sp-copy-from-other spt-g -1) + (sp-flt spt-b 255.0) + (sp-rnd-flt spt-a 32.0 16.0 1.0) + (sp-flt spt-omega 412467.2) + (sp-int spt-timer 5) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow) + (sp-flt spt-userdata 819.2) + ) + ) + +(defpart 620 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 2.5) (meters 1) 1.0) + (sp-flt spt-rot-x 409.6) + (sp-flt spt-rot-z (degrees -17.0)) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 0.0 64.0 1.0) + (sp-copy-from-other spt-g -1) + (sp-flt spt-b 255.0) + (sp-rnd-flt spt-a 16.0 16.0 1.0) + (sp-flt spt-omega 412467.2) + (sp-int spt-timer 5) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow) + (sp-flt spt-userdata 819.2) + ) + ) + +(defpartgroup part-crimson-lightning-glow + :id 140 + :duration (seconds 0.017) + :linger-duration (seconds 0.035) + :bounds (static-bspherem 0 0 0 4) + :parts ((sp-item 620 :fade-after (meters 100) :flags (bit6)) (sp-item 619 :fade-after (meters 100) :flags (bit6))) + ) + +(deftype guard-lazer-shot (projectile) + () + :heap-base #x160 + :method-count-assert 40 + :size-assert #x1d8 + :flag-assert #x28016001d8 + ) + + +(defstate dissipate (guard-lazer-shot) + :virtual #t + :enter (behavior () + (go-virtual impact) + (none) + ) + ) + +(defmethod made-impact? guard-lazer-shot ((obj guard-lazer-shot)) + "TODO - queries the collision cache, return true/false" + (let ((gp-0 (-> obj root-override))) + (let* ((s5-0 (new 'stack-no-clear 'collide-query)) + (v1-0 s5-0) + ) + (set! (-> v1-0 radius) (-> gp-0 root-prim prim-core world-sphere w)) + (set! (-> v1-0 collide-with) (-> gp-0 root-prim prim-core collide-with)) + (set! (-> v1-0 ignore-process0) obj) + (set! (-> v1-0 ignore-process1) (ppointer->process (-> obj parent))) + (set! (-> v1-0 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-0 action-mask) (collide-action solid)) + ) + (let ((a0-2 (handle->process (-> obj notify-handle)))) + (when a0-2 + (let* ((s4-1 (vector-! (new 'stack-no-clear 'vector) (-> gp-0 trans) (get-trans (the-as process-focusable a0-2) 3))) + (f0-2 (- (vector-length s4-1))) + ) + (collide-shape-moving-method-65 gp-0 s4-1 f0-2 0.0 -3072.0) + ) + ) + ) + ) + ) + +(defun guard-lazer-shot-move ((arg0 guard-lazer-shot)) + (projectile-move-fill-line-sphere arg0) + (if (logtest? (-> arg0 root-override status) (cshape-moving-flags t-surface)) + (go (method-of-object arg0 impact)) + ) + 0 + (none) + ) + +(defmethod init-collision! guard-lazer-shot ((obj guard-lazer-shot)) + "Init the [[projectile]]'s [[collide-shape]]" + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-default) + (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 penetrate-using) (penetrate enemy-yellow-shot)) + (let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-7 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-7 prim-core collide-with) + (collide-spec + backgnd + jak + bot + crate + civilian + enemy + obstacle + vehicle-sphere + hit-by-others-list + player-list + pusher + ) + ) + (set! (-> v1-7 prim-core action) (collide-action solid)) + (set-vector! (-> v1-7 local-sphere) 0.0 0.0 0.0 1228.8) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-7) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-10 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-10 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-10 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 1)) + (set! (-> s5-0 event-self) 'touched) + (set! (-> obj root-override) s5-0) + ) + (set! (-> obj root-override pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1) + ) + 0 + (none) + ) + +(defmethod init-proj-settings! guard-lazer-shot ((obj guard-lazer-shot)) + "Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc + :virtual" + (set! (-> obj attack-mode) 'shock) + (set! (-> obj max-speed) 131072.0) + (set! (-> obj timeout) (seconds 0.125)) + (set! (-> obj move) guard-lazer-shot-move) + (set! (-> obj root-override dynam gravity y) 0.0) + (set! (-> obj root-override dynam gravity-length) 0.0) + (set! (-> obj root-override dynam gravity-max) 0.0) + 0 + (none) + ) diff --git a/goal_src/jak2/levels/common/metalhead-projectile.gc b/goal_src/jak2/levels/common/metalhead-projectile.gc index f6cf455703..eb04890014 100644 --- a/goal_src/jak2/levels/common/metalhead-projectile.gc +++ b/goal_src/jak2/levels/common/metalhead-projectile.gc @@ -7,3 +7,946 @@ ;; DECOMP BEGINS +(defpart 621 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x80 :page #xc)) + (sp-func spt-birth-func 'birth-func-set-quat) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 0.25)) + (sp-flt spt-scale-y (meters 12)) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 32.0 64.0 1.0) + (sp-int spt-timer 5) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-14 left-multiply-quat) + ) + ) + +(defpart 622 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xca :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 3)) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-flt spt-g 0.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 64.0) + (sp-flt spt-scalevel-x (meters -0.075)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -1.6) + (sp-int spt-timer 40) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + ) + ) + +(defpart 623 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x14 :page #xc)) + (sp-flt spt-num 16.0) + (sp-rnd-flt spt-z (meters 0) (meters -2) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.5) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 3600.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.5) (meters 0.5) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 64.0) + (sp-rnd-flt spt-fade-g -3.2 -6.4 1.0) + (sp-rnd-flt spt-fade-a -1.6 -6.4 1.0) + (sp-rnd-flt spt-accel-y -0.68266666 -0.68266666 1.0) + (sp-int spt-timer 80) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-flt spt-rotate-y (degrees 0.0)) + ) + ) + +(defpart 624 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x81 :page #xc)) + (sp-func spt-birth-func 'birth-func-set-quat) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 2)) + (sp-flt spt-scale-y (meters 4.5)) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 128.0) + (sp-flt spt-fade-a -3.6571429) + (sp-int spt-timer 35) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 left-multiply-quat) + ) + ) + +(defpart 625 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 2)) + (sp-flt spt-rot-x 819.2) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 3600.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-rnd-flt spt-g 0.0 64.0 1.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 255.0) + (sp-flt spt-omega 822067.2) + (sp-flt spt-scalevel-x (meters 0.10666667)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -7.285714) + (sp-int spt-timer 35) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow) + (sp-flt spt-userdata 1024.0) + ) + ) + +(defpartgroup group-metalhead-shot-hit + :id 141 + :duration (seconds 1) + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 8) + :parts ((sp-item 626 :period 600 :length 5) + (sp-item 627 :fade-after (meters 100) :flags (bit6) :period 600 :length 5) + (sp-item 628 :flags (bit6) :period 600 :length 5) + (sp-item 629 :flags (bit6) :period 600 :length 5) + (sp-item 630 :period 600 :length 5) + (sp-item 631 :fade-after (meters 50) :falloff-to (meters 50) :period 600 :length 5) + ) + ) + +(defpart 629 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x33 :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 1)) + (sp-flt spt-rot-x 204.8) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-rnd-flt spt-g 0.0 128.0 1.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 12.0) + (sp-flt spt-scalevel-x (meters 0.26666668)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.34285715) + (sp-int spt-timer 40) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow) + (sp-flt spt-userdata 4096.0) + ) + ) + +(defpart 630 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-rnd-flt spt-num 8.0 8.0 1.0) + (sp-rnd-flt spt-scale-x (meters 1) (meters 0.5) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 128.0 128.0 1.0) + (sp-rnd-flt spt-g 0.0 64.0 1.0) + (sp-rnd-flt spt-b 128.0 128.0 1.0) + (sp-rnd-flt spt-a 16.0 48.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.013333334) (meters 0.04) 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.0016666667) (meters 0.013333334) 1.0) + (sp-rnd-flt spt-rotvel-z (degrees -0.2) (degrees 0.4) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-r -0.30476192) + (sp-flt spt-fade-g -0.35555556) + (sp-flt spt-fade-b -0.17777778) + (sp-flt spt-fade-a -0.15238096) + (sp-rnd-flt spt-accel-y -0.68266666 -0.68266666 1.0) + (sp-flt spt-friction 0.9) + (sp-int spt-timer 420) + (sp-cpuinfo-flags sp-cpuinfo-flag-2) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 3600.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 3600.0) 1.0) + ) + ) + +(defpart 631 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x14 :page #xc)) + (sp-rnd-flt spt-num 20.0 10.0 1.0) + (sp-flt spt-y (meters 0.25)) + (sp-rnd-flt spt-scale-x (meters 0.075) (meters 0.05) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-rnd-flt spt-g 0.0 128.0 1.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 64.0 32.0 1.0) + (sp-rnd-flt spt-omega 4.096 4.096 1.0) + (sp-rnd-flt spt-vel-y (meters 0.033333335) (meters 0.1) 1.0) + (sp-rnd-int-flt spt-rotvel-z (degrees -2.4) 1 873.81335) + (sp-flt spt-fade-g -0.85333335) + (sp-flt spt-fade-a 0.0) + (sp-rnd-flt spt-accel-y -1.3653333 -5.4613333 1.0) + (sp-rnd-flt spt-friction 0.9 0.02 1.0) + (sp-int spt-timer 150) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + (sp-func spt-func 'sparticle-motion-blur) + (sp-int spt-next-time 100) + (sp-launcher-by-id spt-next-launcher 632) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +(defpart 632 + :init-specs ((sp-rnd-flt spt-fade-a -0.48 -0.48 1.0)) + ) + +(defpart 627 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 4)) + (sp-flt spt-rot-x 819.2) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-flt spt-g 128.0) + (sp-rnd-flt spt-b 128.0 128.0 1.0) + (sp-flt spt-a 128.0) + (sp-flt spt-rotvel-z (degrees -0.1)) + (sp-flt spt-fade-a -1.6) + (sp-int spt-timer 80) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow) + (sp-flt spt-userdata -4096.0) + (sp-launcher-by-id spt-next-launcher 633) + ) + ) + +(defpart 633 + :init-specs ((sp-rnd-flt spt-scale-x (meters 2) (meters 0.5) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-rnd-flt spt-g 0.0 64.0 1.0) + (sp-rnd-flt spt-b 128.0 128.0 1.0) + (sp-int spt-next-time 5) + (sp-launcher-by-id spt-next-launcher 633) + ) + ) + +(defpart 628 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc)) + (sp-flt spt-num 2.0) + (sp-flt spt-scale-x (meters 1)) + (sp-flt spt-rot-x 819.2) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-rnd-flt spt-g 0.0 64.0 1.0) + (sp-rnd-flt spt-b 128.0 128.0 1.0) + (sp-flt spt-a 48.0) + (sp-flt spt-scalevel-x (meters 0.12857144)) + (sp-rnd-flt spt-rotvel-z (degrees -0.3) (degrees 0.6) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -2.1333334) + (sp-flt spt-fade-b -2.1333334) + (sp-int spt-timer 80) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 glow) + (sp-flt spt-userdata -4096.0) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 634) + ) + ) + +(defpart 634 + :init-specs ((sp-flt spt-scale-x (meters 4.5)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-scalevel-x (meters -0.06666667)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -0.53333336) + (sp-flt spt-fade-a -0.8) + ) + ) + +(defpart 626 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 1)) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 96.0) + (sp-flt spt-scalevel-x (meters 0.16666667)) + (sp-flt spt-rotvel-z (degrees 0.3)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-int spt-timer 55) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-int spt-next-time 15) + (sp-launcher-by-id spt-next-launcher 635) + ) + ) + +(defpart 635 + :init-specs ((sp-flt spt-scale-x (meters 3.5)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-scalevel-x (meters -0.0875)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-b -6.4) + ) + ) + +(defpartgroup group-metalhead-shot-die + :id 142 + :duration (seconds 0.017) + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 8) + :parts ((sp-item 209)) + ) + +(defpart 636 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xca :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 2.5)) + (sp-flt spt-rot-x 409.6) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-flt spt-g 192.0) + (sp-flt spt-b 64.0) + (sp-flt spt-a 16.0) + (sp-int spt-timer 5) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow) + (sp-flt spt-userdata 819.2) + ) + ) + +(deftype metalhead-shot (projectile) + ((tail-pos vector :inline :offset-assert 480) + ) + :heap-base #x170 + :method-count-assert 40 + :size-assert #x1f0 + :flag-assert #x28017001f0 + ) + + +(defmethod draw-laser-sight metalhead-shot ((obj metalhead-shot)) + "TODO - confirm If applicable, draw the laser sight particles + :virtual" + (draw-beam (-> *part-id-table* 624) (-> obj tail-pos) (-> obj starting-dir) #f #t) + (let* ((a0-3 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> obj starting-dir) 2048.0)) + (v1-2 (vector+! (new 'stack-no-clear 'vector) (-> obj tail-pos) a0-3)) + (t9-2 sp-launch-particles-var) + (a0-4 *sp-particle-system-2d*) + (a1-4 (-> *part-id-table* 625)) + (a2-2 *launch-matrix*) + ) + (set! (-> a2-2 trans quad) (-> v1-2 quad)) + (t9-2 a0-4 a1-4 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + 0 + (none) + ) + +(defmethod spawn-impact-particles metalhead-shot ((obj metalhead-shot)) + "Spawns associated particles with the projectile if applicable" + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let* ((gp-0 (-> obj root-override trans)) + (a1-0 (-> obj tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) + ) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (let ((v1-4 a1-0)) + (let ((a0-2 s5-1)) + (let ((a2-1 0.8)) + (.mov vf7 a2-1) + ) + (.lvf vf5 (&-> a0-2 quad)) + ) + (.lvf vf4 (&-> v1-4 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> s4-0 quad) vf6) + (let ((f28-0 (-> *part-id-table* 621 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 621 init-specs 4 initial-valuef) (fmin f28-0 (vector-length s5-1))) + (draw-beam (-> *part-id-table* 621) a1-0 s5-1 #f #t) + (set! (-> *part-id-table* 621 init-specs 4 initial-valuef) f28-0) + ) + (vector-normalize! s5-1 1.0) + (let ((t9-2 sp-launch-particles-var) + (a0-5 *sp-particle-system-2d*) + (a1-2 (-> *part-id-table* 622)) + (a2-3 *launch-matrix*) + ) + (set! (-> a2-3 trans quad) (-> s4-0 quad)) + (t9-2 a0-5 a1-2 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + (let ((s4-1 (new 'stack-no-clear 'matrix)) + (f26-0 (* 0.000020345053 f30-0)) + (f30-1 (-> *part-id-table* 623 init-specs 3 initial-valuef)) + (f28-1 (-> *part-id-table* 623 init-specs 5 initial-valuef)) + ) + (forward-up->inv-matrix s4-1 s5-1 *up-vector*) + (set! (-> s4-1 trans quad) (-> gp-0 quad)) + (set! (-> *part-id-table* 623 init-specs 3 initial-valuef) (* f26-0 f30-1)) + (set! (-> *part-id-table* 623 init-specs 5 initial-valuef) (* f26-0 f28-1)) + (sp-launch-particles-var + *sp-particle-system-2d* + (-> *part-id-table* 623) + s4-1 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + (set! (-> *part-id-table* 623 init-specs 3 initial-valuef) f30-1) + (set! (-> *part-id-table* 623 init-specs 5 initial-valuef) f28-1) + ) + ) + 0 + (none) + ) + ) + +(defmethod spawn-shell-particles metalhead-shot ((obj metalhead-shot)) + "TODO - confirm" + (let* ((s5-0 (-> obj root-override)) + (v1-2 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> obj tail-pos) (-> s5-0 trans)) 2048.0)) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> gp-0 quad) (-> s5-0 trans quad)) + (vector+! gp-0 gp-0 v1-2) + (let ((s5-1 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-1 + (let ((t9-2 (method-of-type part-tracker activate))) + (t9-2 + (the-as part-tracker s5-1) + *entity-pool* + (symbol->string (-> part-tracker symbol)) + (the-as pointer #x70004000) + ) + ) + (let ((t9-3 run-function-in-process) + (a0-8 s5-1) + (a1-6 part-tracker-init) + (a2-4 (-> *part-group-id-table* 141)) + (a3-1 0) + (t0-0 #f) + (t1-0 #f) + (t2-0 #f) + (t3-0 *launch-matrix*) + ) + (set! (-> t3-0 trans quad) (-> gp-0 quad)) + ((the-as (function object object object object object object object object none) t9-3) + a0-8 + a1-6 + a2-4 + a3-1 + t0-0 + t1-0 + t2-0 + t3-0 + ) + ) + (-> s5-1 ppointer) + ) + ) + ) + 0 + (none) + ) + +(defmethod play-impact-sound metalhead-shot ((obj metalhead-shot) (arg0 projectile-options)) + (with-pp + (case arg0 + (((projectile-options lose-altitude proj-options-2)) + (when (nonzero? (-> obj sound-id)) + (when *sound-player-enable* + (let ((gp-0 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> gp-0 command) (sound-command set-param)) + (set! (-> gp-0 id) (-> obj sound-id)) + (let ((a1-1 (-> obj root-override trans))) + (let ((s5-1 pp)) + (when (= a1-1 #t) + (if (and s5-1 (type? s5-1 process-drawable) (nonzero? (-> (the-as process-drawable s5-1) root))) + (set! a1-1 (-> (the-as process-drawable s5-1) root trans)) + (set! a1-1 (the-as vector #f)) + ) + ) + ) + (sound-trans-convert (the-as vector3w (-> gp-0 params trans)) a1-1) + ) + (set! (-> gp-0 params mask) (the-as uint 32)) + (-> gp-0 id) + ) + ) + ) + ) + ) + ) + ) + +(defun metalhead-shot-move ((arg0 metalhead-shot)) + (projectile-move-fill-line-sphere arg0) + (let ((s5-0 (-> arg0 root-override))) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (vector-! s4-0 (-> arg0 tail-pos) (-> s5-0 trans)) + (let ((f0-0 (vector-length s4-0))) + (when (< 49152.0 f0-0) + (vector-normalize! s4-0 49152.0) + (vector+! (-> arg0 tail-pos) (-> s5-0 trans) s4-0) + ) + ) + ) + (if (logtest? (-> s5-0 status) (cshape-moving-flags t-surface)) + (go (method-of-object arg0 impact)) + ) + ) + 0 + (none) + ) + +(defmethod init-collision! metalhead-shot ((obj metalhead-shot)) + "Init the [[projectile]]'s [[collide-shape]]" + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) + (the-as (function control-info collide-query vector vector cshape-moving-flags) cshape-reaction-just-move) + ) + (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 penetrate-using) (penetrate enemy-yellow-shot)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec projectile)) + (set! (-> s4-0 prim-core collide-with) + (collide-spec backgnd jak bot crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list) + ) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 819.2) + (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 projectile)) + (set! (-> v1-13 prim-core collide-with) + (collide-spec backgnd jak bot crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list) + ) + (set! (-> v1-13 prim-core action) (collide-action solid deadly)) + (set-vector! (-> v1-13 local-sphere) 0.0 0.0 0.0 819.2) + ) + (let ((v1-15 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-15 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-15 prim-core collide-with) + (collide-spec jak bot crate civilian enemy vehicle-sphere hit-by-others-list player-list) + ) + (set! (-> v1-15 prim-core action) (collide-action deadly)) + (set-vector! (-> v1-15 local-sphere) 0.0 0.0 0.0 2457.6) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-18 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-18 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-18 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 1)) + (set! (-> s5-0 event-self) 'touched) + (set! (-> obj root-override) s5-0) + ) + (set! (-> obj root-override pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1) + ) + (none) + ) + +(defmethod init-proj-settings! metalhead-shot ((obj metalhead-shot)) + "Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc + :virtual" + (set! (-> obj tail-pos quad) (-> obj root-override trans quad)) + (set! (-> obj attack-mode) 'metalhead-shot) + (set! (-> obj max-speed) 532480.0) + (set! (-> obj move) metalhead-shot-move) + (set! (-> obj timeout) (seconds 0.767)) + (set-gravity-length (-> obj root-override dynam) 573440.0) + (none) + ) + +;; WARN: Return type mismatch (pointer process) vs (pointer metalhead-shot). +(defun spawn-metalhead-projectile ((arg0 metalhead-shot) (arg1 vector) (arg2 vector) (arg3 float)) + (let ((gp-0 (new 'stack-no-clear 'projectile-init-by-other-params))) + (let ((v1-1 (vector-! (new 'stack-no-clear 'vector) arg2 arg1))) + (set! (-> gp-0 ent) (-> arg0 entity)) + (set! (-> gp-0 charge) 1.0) + (set! (-> gp-0 options) (projectile-options)) + (set! (-> gp-0 notify-handle) (process->handle arg0)) + (set! (-> gp-0 owner-handle) (the-as handle #f)) + (set! (-> gp-0 ignore-handle) (process->handle arg0)) + (let* ((a0-10 *game-info*) + (a2-11 (+ (-> a0-10 attack-id) 1)) + ) + (set! (-> a0-10 attack-id) a2-11) + (set! (-> gp-0 attack-id) a2-11) + ) + (set! (-> gp-0 timeout) (new 'static 'handle :process #x4b0 :u64 #x4b0)) + (set! (-> gp-0 pos quad) (-> arg1 quad)) + (vector-normalize-copy! (-> gp-0 vel) v1-1 arg3) + ) + (the-as (pointer metalhead-shot) (spawn-projectile metalhead-shot gp-0 arg0 *default-dead-pool*)) + ) + ) + +(defpartgroup group-metalhead-grenade-shot + :id 143 + :duration (seconds 0.5) + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 4) + :parts ((sp-item 637) (sp-item 638) (sp-item 639)) + ) + +(defpart 637 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 3) (meters 1) 1.0) + (sp-flt spt-rot-x 409.6) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 64.0) + (sp-flt spt-fade-r -5.5) + (sp-flt spt-fade-g -51.0) + (sp-flt spt-fade-b -5.5) + (sp-flt spt-fade-a -8.533334) + (sp-int spt-timer 5) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow) + (sp-flt spt-userdata 409.6) + ) + ) + +(defpart 638 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x1 :page #xade)) + (sp-flt spt-num 4.0) + (sp-rnd-flt spt-scale-x (meters 1) (meters 0.2) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 128.0) + (sp-flt spt-scalevel-x (meters -0.01)) + (sp-rnd-flt spt-rotvel-z (degrees -1.2) (degrees 1.2) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-r -1.375) + (sp-flt spt-fade-g -6.375) + (sp-flt spt-fade-b -1.375) + (sp-rnd-flt spt-fade-a -3.2 -3.2 1.0) + (sp-int spt-timer 40) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-conerot-radius (meters 0) (meters 0.2) 1.0) + ) + ) + +(defpart 639 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x1 :page #xade)) + (sp-rnd-flt spt-num 2.0 1.0 1.0) + (sp-rnd-flt spt-scale-x (meters 0.8) (meters 0.4) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.6) (meters 0.2) 1.0) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-rnd-flt spt-a 64.0 32.0 1.0) + (sp-rnd-flt spt-scalevel-x (meters -0.0026666666) (meters -0.0026666666) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-r -0.73333335) + (sp-flt spt-fade-g -3.4) + (sp-flt spt-fade-b -0.73333335) + (sp-rnd-flt spt-accel-y -1.3653333 -4.096 1.0) + (sp-int spt-timer 300) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-14) + (sp-int spt-next-time 75) + (sp-launcher-by-id spt-next-launcher 640) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-conerot-radius (meters 0) (meters 0.35) 1.0) + ) + ) + +(defpart 640 + :init-specs ((sp-flt spt-fade-r 0.0) + (sp-flt spt-fade-g 0.0) + (sp-flt spt-fade-b 0.0) + (sp-rnd-flt spt-fade-a -0.48 -0.48 1.0) + ) + ) + +(deftype metalhead-grenade-shot (projectile) + ((tumble-quat quaternion :inline :offset-assert 480) + (blast-radius float :offset-assert 496) + ) + :heap-base #x180 + :method-count-assert 40 + :size-assert #x1f4 + :flag-assert #x28018001f4 + ) + + +(defmethod spawn-shell-particles metalhead-grenade-shot ((obj metalhead-grenade-shot)) + "TODO - confirm" + (let ((gp-0 (get-process *default-dead-pool* part-tracker #x4000))) + (when gp-0 + (let ((t9-1 (method-of-type part-tracker activate))) + (t9-1 (the-as part-tracker gp-0) obj (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) + ) + (let ((t9-2 run-function-in-process) + (a0-3 gp-0) + (a1-2 part-tracker-init) + (a2-4 (-> *part-group-id-table* 76)) + (a3-1 0) + (t0-0 #f) + (t1-0 #f) + (t2-0 #f) + (t3-0 *launch-matrix*) + ) + (set! (-> t3-0 trans quad) (-> obj root-override trans quad)) + ((the-as (function object object object object object object object object none) t9-2) + a0-3 + a1-2 + a2-4 + a3-1 + t0-0 + t1-0 + t2-0 + t3-0 + ) + ) + (-> gp-0 ppointer) + ) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs sound-id. +(defmethod play-impact-sound metalhead-grenade-shot ((obj metalhead-grenade-shot) (arg0 projectile-options)) + (case arg0 + (((projectile-options lose-altitude)) + (sound-play "gren-shot-hit") + ) + (((projectile-options lose-altitude proj-options-2)) + (sound-play "gren-missile" :id (-> obj sound-id) :position (-> obj root-override trans)) + ) + ) + (the-as sound-id 0) + ) + +(defstate impact (metalhead-grenade-shot) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('touched) + (let* ((s4-0 proc) + (v1-1 (if (type? s4-0 process-drawable) + (the-as process-drawable s4-0) + ) + ) + ) + (when v1-1 + (let ((s4-1 (-> v1-1 root)) + (a1-3 (new 'stack 'collide-query)) + ) + 0.0 + (set! (-> a1-3 start-pos quad) (-> self root-override root-prim prim-core world-sphere quad)) + (vector-! + (-> a1-3 move-dist) + (the-as vector (-> (the-as collide-shape s4-1) root-prim prim-core)) + (-> a1-3 start-pos) + ) + (let ((v1-6 a1-3)) + (set! (-> v1-6 radius) 40.96) + (set! (-> v1-6 collide-with) (collide-spec backgnd)) + (set! (-> v1-6 ignore-process0) self) + (set! (-> v1-6 ignore-process1) (ppointer->process (-> self parent))) + (set! (-> v1-6 ignore-pat) (-> self root-override pat-ignore-mask)) + (set! (-> v1-6 action-mask) (collide-action solid)) + ) + (when (< (fill-and-probe-using-line-sphere *collide-cache* a1-3) 0.0) + (let ((a1-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-4 from) (process->ppointer self)) + (set! (-> a1-4 num-params) 2) + (set! (-> a1-4 message) 'attack) + (set! (-> a1-4 param 0) (-> event param 0)) + (let ((v1-13 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (set! (-> v1-13 id) (-> self attack-id)) + (set! (-> v1-13 mode) 'explode) + (set! (-> a1-4 param 1) (the-as uint v1-13)) + ) + (send-event-function proc a1-4) + ) + (let ((v1-15 (-> self notify-handle))) + (if (handle->process v1-15) + (send-event (-> v1-15 process 0) 'notify 'attack proc) + ) + ) + ) + ) + ) + ) + ) + ) + ) + :code (behavior () + (let ((v1-1 (-> self root-override root-prim))) + (set! (-> v1-1 local-sphere w) (-> self blast-radius)) + (set! (-> v1-1 prim-core world-sphere w) (-> self blast-radius)) + (set! (-> v1-1 prim-core collide-with) + (collide-spec jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list) + ) + (set! (-> v1-1 prim-core collide-as) (collide-spec enemy)) + ) + (collide-shape-method-46 (-> self root-override)) + (let ((a1-0 (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> a1-0 options) (overlaps-others-options)) + (set! (-> a1-0 collide-with-filter) (the-as collide-spec -1)) + (set! (-> a1-0 tlist) *touching-list*) + (find-overlapping-shapes (-> self root-override) a1-0) + ) + (suspend) + (let ((v1-9 (-> self root-override root-prim))) + (set! (-> v1-9 prim-core collide-as) (collide-spec)) + (set! (-> v1-9 prim-core collide-with) (collide-spec)) + ) + 0 + (while (-> self child) + (suspend) + ) + (deactivate self) + (none) + ) + ) + +(defstate dissipate (metalhead-grenade-shot) + :virtual #t + :enter (behavior () + (go-virtual impact) + (none) + ) + ) + +(defmethod spawn-impact-particles metalhead-grenade-shot ((obj metalhead-grenade-shot)) + "Spawns associated particles with the projectile if applicable" + (spawn (-> obj part) (-> obj root-override trans)) + 0 + (none) + ) + +(defun gren-canister-move ((arg0 metalhead-grenade-shot)) + (quaternion*! (-> arg0 root-override quat) (-> arg0 root-override quat) (-> arg0 tumble-quat)) + (projectile-move-fill-all-dirs arg0) + (let ((s5-0 (new 'stack-no-clear 'water-info))) + (water-info-init! (-> arg0 root-override) s5-0 (collide-action solid semi-solid)) + (if (and (logtest? (-> s5-0 flags) (water-flags active)) (< (-> arg0 root-override trans y) (-> s5-0 trans y))) + (go (method-of-object arg0 impact)) + ) + ) + (if (logtest? (-> arg0 root-override status) (cshape-moving-flags t-surface)) + (go (method-of-object arg0 impact)) + ) + 0 + (none) + ) + +(defun gren-cshape-reaction-canister ((arg0 collide-shape-moving) (arg1 metalhead-grenade-shot)) + (let ((s5-0 0)) + (let ((a1-1 (new 'stack-no-clear 'vector))) + (vector-float*! a1-1 (the-as vector (&-> arg1 starting-dir y)) (the-as float (-> arg1 connection-list prev0))) + (move-by-vector! arg0 a1-1) + ) + (let ((f30-0 (vector-dot (-> arg0 transv) (the-as vector (&-> arg1 next-state)))) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (vector-float*! s3-0 (the-as vector (&-> arg1 next-state)) (* f30-0 (rand-vu-float-range 1.6 2.2))) + (vector-! (-> arg0 transv) (-> arg0 transv) s3-0) + ) + (let ((v0-2 (logior s5-0 7))) + (logior! (-> arg0 status) v0-2) + ) + ) + (vector-float*! (-> arg0 transv) (-> arg0 transv) 0.88) + (none) + ) + +(defmethod init-collision! metalhead-grenade-shot ((obj metalhead-grenade-shot)) + "Init the [[projectile]]'s [[collide-shape]]" + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) + (the-as (function control-info collide-query vector vector cshape-moving-flags) gren-cshape-reaction-canister) + ) + (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 penetrate-using) (penetrate enemy-dark-shot)) + (let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-7 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-7 prim-core collide-with) + (collide-spec backgnd jak crate obstacle hit-by-others-list player-list pusher) + ) + (set! (-> v1-7 prim-core action) (collide-action solid)) + (set-vector! (-> v1-7 local-sphere) 0.0 0.0 0.0 1228.8) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-7) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-10 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-10 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-10 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 2)) + (set! (-> s5-0 event-self) 'touched) + (set! (-> obj root-override) s5-0) + ) + (set! (-> obj root-override pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1) + ) + (none) + ) + +;; WARN: Return type mismatch sound-id vs none. +(defmethod init-proj-settings! metalhead-grenade-shot ((obj metalhead-grenade-shot)) + "Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc + :virtual" + (set! (-> obj attack-mode) 'eco-yellow) + (set! (-> obj blast-radius) 4096.0) + (set! (-> obj max-speed) 135168.0) + (set! (-> obj timeout) (seconds 4)) + (set! (-> obj update-velocity) projectile-update-velocity-add-gravity) + (set! (-> obj move) gren-canister-move) + (set! (-> obj root-override dynam gravity y) 102400.0) + (set! (-> obj root-override dynam gravity-length) 102400.0) + (set! (-> obj root-override dynam gravity-max) 102400.0) + (let ((f0-5 1092.2667)) + (quaternion-axis-angle! (-> obj tumble-quat) 1.0 0.0 0.0 f0-5) + ) + (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 143) obj)) + (set! (-> obj sound-id) (new-sound-id)) + (none) + ) + +;; WARN: Return type mismatch (pointer process) vs (pointer metalhead-grenade-shot). +(defun spawn-metalhead-grenade ((arg0 metalhead-grenade-shot) (arg1 vector) (arg2 vector) (arg3 float)) + (let ((gp-0 (new 'stack-no-clear 'projectile-init-by-other-params))) + (let ((v1-1 (vector-! (new 'stack-no-clear 'vector) arg2 arg1))) + (set! (-> gp-0 ent) (-> arg0 entity)) + (set! (-> gp-0 charge) 1.0) + (set! (-> gp-0 options) (projectile-options)) + (set! (-> gp-0 notify-handle) (process->handle arg0)) + (set! (-> gp-0 owner-handle) (the-as handle #f)) + (set! (-> gp-0 ignore-handle) (process->handle arg0)) + (let* ((a0-10 *game-info*) + (a2-11 (+ (-> a0-10 attack-id) 1)) + ) + (set! (-> a0-10 attack-id) a2-11) + (set! (-> gp-0 attack-id) a2-11) + ) + (set! (-> gp-0 timeout) (new 'static 'handle :process #x4b0 :u64 #x4b0)) + (set! (-> gp-0 pos quad) (-> arg1 quad)) + (vector-normalize-copy! (-> gp-0 vel) v1-1 arg3) + ) + (the-as (pointer metalhead-grenade-shot) (spawn-projectile metalhead-shot gp-0 arg0 *default-dead-pool*)) + ) + ) diff --git a/goal_src/jak2/levels/common/scene-actor.gc b/goal_src/jak2/levels/common/scene-actor.gc index 77cf05fd7f..e41de78d47 100644 --- a/goal_src/jak2/levels/common/scene-actor.gc +++ b/goal_src/jak2/levels/common/scene-actor.gc @@ -295,7 +295,7 @@ ) ) -(defmethod init-skeleton! kor-npc ((obj kor-npc)) +(defmethod init-art! kor-npc ((obj kor-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -470,7 +470,7 @@ ) ) -(defmethod init-skeleton! tess-npc ((obj tess-npc)) +(defmethod init-art! tess-npc ((obj tess-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -504,7 +504,7 @@ ) ) -(defmethod init-skeleton! keira-npc ((obj keira-npc)) +(defmethod init-art! keira-npc ((obj keira-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -531,7 +531,7 @@ (-> obj draw art-group data 4) ) -(defmethod init-skeleton! krew-npc ((obj krew-npc)) +(defmethod init-art! krew-npc ((obj krew-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -552,7 +552,7 @@ ) -(defmethod init-skeleton! kid-npc ((obj kid-npc)) +(defmethod init-art! kid-npc ((obj kid-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -608,7 +608,7 @@ ) ) -(defmethod init-skeleton! crocadog-npc ((obj crocadog-npc)) +(defmethod init-art! crocadog-npc ((obj crocadog-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -629,7 +629,7 @@ ) -(defmethod init-skeleton! torn-npc ((obj torn-npc)) +(defmethod init-art! torn-npc ((obj torn-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -658,7 +658,7 @@ ) (defmethod get-trans torn-npc ((obj torn-npc) (arg0 int)) - "@returns the `trans` [[vector]] from the process's `root` (typically either a [[trsqv]] or a [[collide-shape]]" + "@returns the `trans` [[vector]] from the process's `root` (typically either a [[trsqv]] or a [[collide-shape]])" (let ((v1-0 (-> obj root-override))) (if (= arg0 2) (vector<-cspace! (new 'static 'vector) (-> obj node-list data 6)) @@ -675,19 +675,8 @@ :flag-assert #x2600a00120 ) -(defmethod inspect youngsamos-npc ((obj youngsamos-npc)) - (when (not obj) - (set! obj obj) - (goto cfg-4) - ) - (let ((t9-0 (method-of-type process-taskable inspect))) - (t9-0 obj) - ) - (label cfg-4) - obj - ) -(defmethod init-skeleton! youngsamos-npc ((obj youngsamos-npc)) +(defmethod init-art! youngsamos-npc ((obj youngsamos-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -764,19 +753,8 @@ :flag-assert #x2600a00120 ) -(defmethod inspect samos-npc ((obj samos-npc)) - (when (not obj) - (set! obj obj) - (goto cfg-4) - ) - (let ((t9-0 (method-of-type process-taskable inspect))) - (t9-0 obj) - ) - (label cfg-4) - obj - ) -(defmethod init-skeleton! samos-npc ((obj samos-npc)) +(defmethod init-art! samos-npc ((obj samos-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -812,19 +790,8 @@ :flag-assert #x2600a00120 ) -(defmethod inspect onin-npc ((obj onin-npc)) - (when (not obj) - (set! obj obj) - (goto cfg-4) - ) - (let ((t9-0 (method-of-type process-taskable inspect))) - (t9-0 obj) - ) - (label cfg-4) - obj - ) -(defmethod init-skeleton! onin-npc ((obj onin-npc)) +(defmethod init-art! onin-npc ((obj onin-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -894,19 +861,8 @@ :flag-assert #x2600a00120 ) -(defmethod inspect pecker-npc ((obj pecker-npc)) - (when (not obj) - (set! obj obj) - (goto cfg-4) - ) - (let ((t9-0 (method-of-type process-taskable inspect))) - (t9-0 obj) - ) - (label cfg-4) - obj - ) -(defmethod init-skeleton! pecker-npc ((obj pecker-npc)) +(defmethod init-art! pecker-npc ((obj pecker-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -972,19 +928,8 @@ :flag-assert #x2600a00120 ) -(defmethod inspect brutter-npc ((obj brutter-npc)) - (when (not obj) - (set! obj obj) - (goto cfg-4) - ) - (let ((t9-0 (method-of-type process-taskable inspect))) - (t9-0 obj) - ) - (label cfg-4) - obj - ) -(defmethod init-skeleton! brutter-npc ((obj brutter-npc)) +(defmethod init-art! brutter-npc ((obj brutter-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -1004,19 +949,8 @@ :flag-assert #x2600a00120 ) -(defmethod inspect ashelin-npc ((obj ashelin-npc)) - (when (not obj) - (set! obj obj) - (goto cfg-4) - ) - (let ((t9-0 (method-of-type process-taskable inspect))) - (t9-0 obj) - ) - (label cfg-4) - obj - ) -(defmethod init-skeleton! ashelin-npc ((obj ashelin-npc)) +(defmethod init-art! ashelin-npc ((obj ashelin-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -1052,19 +986,8 @@ :flag-assert #x2600a00120 ) -(defmethod inspect daxter-npc ((obj daxter-npc)) - (when (not obj) - (set! obj obj) - (goto cfg-4) - ) - (let ((t9-0 (method-of-type process-taskable inspect))) - (t9-0 obj) - ) - (label cfg-4) - obj - ) -(defmethod init-skeleton! daxter-npc ((obj daxter-npc)) +(defmethod init-art! daxter-npc ((obj daxter-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj diff --git a/test/decompiler/reference/jak2/engine/process-drawable/process-focusable_REF.gc b/test/decompiler/reference/jak2/engine/process-drawable/process-focusable_REF.gc index 7207540bcd..ac0ee60476 100644 --- a/test/decompiler/reference/jak2/engine/process-drawable/process-focusable_REF.gc +++ b/test/decompiler/reference/jak2/engine/process-drawable/process-focusable_REF.gc @@ -1,5 +1,7 @@ +;;-*-Lisp-*- (in-package goal) +;; definition of type process-focusable (deftype process-focusable (process-drawable) ((root-override collide-shape :offset 128) (focus-status focus-status :offset-assert 200) @@ -19,6 +21,7 @@ ) ) +;; definition for method 3 of type process-focusable (defmethod inspect process-focusable ((obj process-focusable)) (when (not obj) (set! obj obj) @@ -32,6 +35,8 @@ obj ) +;; definition for method 20 of type process-focusable +;; WARN: Return type mismatch structure vs vector. (defmethod get-trans process-focusable ((obj process-focusable) (arg0 int)) "@returns the `trans` [[vector]] from the process's `root` (typically either a [[trsqv]] or a [[collide-shape]])" (let ((gp-0 (-> obj root-override))) @@ -53,28 +58,37 @@ ) ) +;; definition for method 22 of type process-focusable (defmethod get-transv process-focusable ((obj process-focusable)) (-> obj root-override transv) ) +;; definition for method 21 of type process-focusable (defmethod get-quat process-focusable ((obj process-focusable) (arg0 int)) (-> obj root-override quat) ) +;; definition for method 23 of type process-focusable (defmethod process-focusable-method-23 process-focusable ((obj process-focusable) (arg0 int)) 0 ) +;; definition for method 24 of type process-focusable +;; WARN: Return type mismatch int vs meters. (defmethod get-water-height process-focusable ((obj process-focusable)) (the-as meters 0) ) +;; definition for method 26 of type process-focusable (defmethod process-focusable-method-26 process-focusable ((obj process-focusable)) 0.0 ) +;; definition for method 25 of type process-focusable +;; WARN: Return type mismatch int vs time-frame. (defmethod process-focusable-method-25 process-focusable ((obj process-focusable)) (the-as time-frame 0) ) +;; failed to figure out what this is: 0 diff --git a/test/decompiler/reference/jak2/engine/process-drawable/process-taskable-h_REF.gc b/test/decompiler/reference/jak2/engine/process-drawable/process-taskable-h_REF.gc index 1327518e4a..71cdddbd79 100644 --- a/test/decompiler/reference/jak2/engine/process-drawable/process-taskable-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/process-drawable/process-taskable-h_REF.gc @@ -1,5 +1,7 @@ +;;-*-Lisp-*- (in-package goal) +;; definition of type process-taskable (deftype process-taskable (process-focusable) ((task game-task-control :offset-assert 204) (ambient ambient-control :inline :offset-assert 208) @@ -27,7 +29,7 @@ (play-game (game-task-event) _type_ :state 30) (process-taskable-method-31 (_type_) none 31) (process-taskable-method-32 (_type_) none 32) - (init-skeleton! (_type_) none 33) + (init-art! (_type_) none 33) (process-taskable-method-34 (_type_) symbol 34) (get-art-elem (_type_) art-element 35) (process-taskable-method-36 (_type_) none 36) @@ -35,6 +37,7 @@ ) ) +;; definition for method 3 of type process-taskable (defmethod inspect process-taskable ((obj process-taskable)) (when (not obj) (set! obj obj) @@ -61,4 +64,5 @@ obj ) +;; failed to figure out what this is: 0 diff --git a/test/decompiler/reference/jak2/engine/process-drawable/process-taskable_REF.gc b/test/decompiler/reference/jak2/engine/process-drawable/process-taskable_REF.gc index 670866a5a5..b2e12199b8 100644 --- a/test/decompiler/reference/jak2/engine/process-drawable/process-taskable_REF.gc +++ b/test/decompiler/reference/jak2/engine/process-drawable/process-taskable_REF.gc @@ -1,5 +1,8 @@ +;;-*-Lisp-*- (in-package goal) +;; definition for method 7 of type process-taskable +;; WARN: Return type mismatch process-focusable vs process-taskable. (defmethod relocate process-taskable ((obj process-taskable) (arg0 int)) (if (nonzero? (-> obj task)) (&+! (-> obj task) arg0) @@ -7,6 +10,8 @@ (the-as process-taskable ((method-of-type process-focusable relocate) obj arg0)) ) +;; definition for function process-taskable-anim-loop +;; WARN: Return type mismatch int vs none. (defbehavior process-taskable-anim-loop process-taskable ((arg0 (function process-taskable object))) "Takes in a function and loops as long as it's return value is truthy Seen take in - `true-func` which takes no args TODO - seems fishy @@ -28,10 +33,13 @@ (none) ) +;; definition for method 34 of type process-taskable (defmethod process-taskable-method-34 process-taskable ((obj process-taskable)) #t ) +;; definition for method 35 of type process-taskable +;; WARN: Return type mismatch art-joint-anim vs art-element. (defmethod get-art-elem process-taskable ((obj process-taskable)) "Checks various things such the current actor, task status, etc to determine the right art-group data to use @returns the appropriate [[art-element]] for the given NPC" @@ -41,11 +49,14 @@ ) ) +;; definition for method 36 of type process-taskable +;; WARN: Return type mismatch int vs none. (defmethod process-taskable-method-36 process-taskable ((obj process-taskable)) 0 (none) ) +;; definition for method 37 of type process-taskable (defmethod process-taskable-method-37 process-taskable ((obj process-taskable)) (let ((v1-1 (-> obj draw shadow-ctrl))) (cond @@ -64,6 +75,7 @@ (none) ) +;; failed to figure out what this is: (defstate hide (process-taskable) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) @@ -110,6 +122,7 @@ :code (the-as (function none :behavior process-taskable) sleep-code) ) +;; failed to figure out what this is: (defstate idle (process-taskable) :virtual #t :enter (behavior () @@ -266,6 +279,7 @@ ) ) +;; failed to figure out what this is: (defstate active (process-taskable) :virtual #t :event (-> (method-of-type process-taskable hide) event) @@ -312,6 +326,7 @@ ) ) +;; failed to figure out what this is: (defstate play-game (process-taskable) :virtual #t :enter (-> (method-of-type process-taskable active) enter) @@ -328,6 +343,8 @@ :post (-> (method-of-type process-taskable idle) post) ) +;; definition for method 31 of type process-taskable +;; WARN: Return type mismatch int vs none. (defmethod process-taskable-method-31 process-taskable ((obj process-taskable)) (let ((s5-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 3) 0))) @@ -367,6 +384,8 @@ (none) ) +;; definition for method 32 of type process-taskable +;; WARN: Return type mismatch int vs none. (defmethod process-taskable-method-32 process-taskable ((obj process-taskable)) (logior! (-> obj skel status) (joint-control-status eye-anim)) (set! (-> obj talk-message) (game-text-id text-x181)) @@ -398,12 +417,16 @@ (none) ) -(defmethod init-skeleton! process-taskable ((obj process-taskable)) +;; definition for method 33 of type process-taskable +;; WARN: Return type mismatch int vs none. +(defmethod init-art! process-taskable ((obj process-taskable)) "@see [[initialize-skeleton]]" 0 (none) ) +;; definition for method 11 of type process-taskable +;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! process-taskable ((obj process-taskable) (arg0 entity-actor)) (stack-size-set! (-> obj main-thread) 512) (process-taskable-method-31 obj) @@ -411,7 +434,7 @@ (set! (-> obj task) (new 'process 'game-task-control (res-lump-value arg0 'task-actor game-task-actor :time -1000000000.0)) ) - (init-skeleton! obj) + (init-art! obj) (process-taskable-method-32 obj) (when (logtest? #x1000000 (res-lump-value arg0 'options uint128 :time -1000000000.0)) (let* ((s5-1 *level*) diff --git a/test/decompiler/reference/jak2/engine/process-drawable/simple-focus_REF.gc b/test/decompiler/reference/jak2/engine/process-drawable/simple-focus_REF.gc index 1f48f01495..6b8c1262cd 100644 --- a/test/decompiler/reference/jak2/engine/process-drawable/simple-focus_REF.gc +++ b/test/decompiler/reference/jak2/engine/process-drawable/simple-focus_REF.gc @@ -1,5 +1,7 @@ +;;-*-Lisp-*- (in-package goal) +;; definition of type simple-focus (deftype simple-focus (process-focusable) ((first-time? symbol :offset-assert 204) ) @@ -12,6 +14,7 @@ ) ) +;; definition for method 3 of type simple-focus (defmethod inspect simple-focus ((obj simple-focus)) (when (not obj) (set! obj obj) @@ -25,11 +28,13 @@ obj ) +;; definition for method 20 of type simple-focus (defmethod get-trans simple-focus ((obj simple-focus) (arg0 int)) "@returns the `trans` [[vector]] from the process's `root` (typically either a [[trsqv]] or a [[collide-shape]])" (-> obj root-override trans) ) +;; definition for method 12 of type simple-focus (defmethod run-logic? simple-focus ((obj simple-focus)) (when (-> obj first-time?) (set! (-> obj first-time?) #f) @@ -37,6 +42,7 @@ ) ) +;; failed to figure out what this is: (defstate idle (simple-focus) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) @@ -53,6 +59,8 @@ :code (the-as (function none :behavior simple-focus) sleep-code) ) +;; definition for function simple-focus-init-by-other +;; WARN: Return type mismatch object vs none. (defbehavior simple-focus-init-by-other simple-focus () "Initializes the new [[simple-focus]]. `first-time?` will be set to [[#t]]" (let ((root (new 'process 'trsqv))) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/guards/guard-conversation_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/guards/guard-conversation_REF.gc new file mode 100644 index 0000000000..cdf98753a9 --- /dev/null +++ b/test/decompiler/reference/jak2/levels/common/enemy/guards/guard-conversation_REF.gc @@ -0,0 +1,504 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type gconv-speech +(deftype gconv-speech (basic) + ((name0 basic :offset-assert 4) + (name1 basic :offset-assert 8) + (hold-time uint32 :offset-assert 12) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; definition for method 3 of type gconv-speech +(defmethod inspect gconv-speech ((obj gconv-speech)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tname0: ~A~%" (-> obj name0)) + (format #t "~1Tname1: ~A~%" (-> obj name1)) + (format #t "~1Thold-time: ~D~%" (-> obj hold-time)) + (label cfg-4) + obj + ) + +;; definition of type gconv-dialogue +(deftype gconv-dialogue (basic) + ((speeches (array gconv-speech) :offset-assert 4) + ) + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + +;; definition for method 3 of type gconv-dialogue +(defmethod inspect gconv-dialogue ((obj gconv-dialogue)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tspeeches: ~A~%" (-> obj speeches)) + (label cfg-4) + obj + ) + +;; definition of type gconv-dialogues +(deftype gconv-dialogues (basic) + ((dialogues (array gconv-dialogue) :offset-assert 4) + ) + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + +;; definition for method 3 of type gconv-dialogues +(defmethod inspect gconv-dialogues ((obj gconv-dialogues)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tdialogues: ~A~%" (-> obj dialogues)) + (label cfg-4) + obj + ) + +;; definition for symbol *gconv-dialogues*, type gconv-dialogues +(define *gconv-dialogues* + (new 'static 'gconv-dialogues + :dialogues (new 'static 'boxed-array :type gconv-dialogue + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg186a" :name1 "kg186b" :hold-time #x258) + (new 'static 'gconv-speech :name0 "kg187a" :name1 "kg187b" :hold-time #x96) + (new 'static 'gconv-speech :name0 "kg188a" :name1 "kg188b" :hold-time #x12c) + (new 'static 'gconv-speech :name0 "kg189a" :name1 "kg189b" :hold-time #x258) + (new 'static 'gconv-speech :name0 "kg190a" :name1 "kg190b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg222a" :name1 "kg222b" :hold-time #x96) + (new 'static 'gconv-speech :name0 "kg223a" :name1 "kg223b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg203a" :name1 "kg203b" :hold-time #x96) + (new 'static 'gconv-speech :name0 "kg204a" :name1 "kg204b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg207a" :name1 "kg207b" :hold-time #x4b) + (new 'static 'gconv-speech :name0 "kg209a" :name1 "kg209b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg211a" :name1 "kg211b" :hold-time #x87) + (new 'static 'gconv-speech :name0 "kg212a" :name1 "kg212b" :hold-time #x5a) + (new 'static 'gconv-speech :name0 "kg213a" :name1 "kg213b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg179b" :name1 "kg179b" :hold-time #x12c) + (new 'static 'gconv-speech :name0 "kg180a" :name1 "kg180b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg181a" :name1 "kg181b" :hold-time #x96) + (new 'static 'gconv-speech :name0 "kg182a" :name1 "kg182b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg183a" :name1 "kg183b" :hold-time #x5a) + (new 'static 'gconv-speech :name0 "kg184a" :name1 "kg184b" :hold-time #x5a) + (new 'static 'gconv-speech :name0 "kg185a" :name1 "kg185b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg191a" :name1 "kg191b" :hold-time #x12c) + (new 'static 'gconv-speech :name0 "kg192a" :name1 "kg192b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg194a" :name1 "kg194b" :hold-time #x177) + (new 'static 'gconv-speech :name0 "kg195a" :name1 "kg195b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg197a" :name1 "kg197b" :hold-time #xd2) + (new 'static 'gconv-speech :name0 "kg198a" :name1 "kg198b" :hold-time #x96) + (new 'static 'gconv-speech :name0 "kg199a" :name1 "kg199b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg200a" :name1 "kg200b" :hold-time #x96) + (new 'static 'gconv-speech :name0 "kg201a" :name1 "kg201b" :hold-time #x177) + (new 'static 'gconv-speech :name0 "kg202a" :name1 "kg202b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg205a" :name1 "kg205b" :hold-time #x12c) + (new 'static 'gconv-speech :name0 "kg206a" :name1 "kg206b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg214a" :name1 "kg214b" :hold-time #x96) + (new 'static 'gconv-speech :name0 "kg215a" :name1 "kg215b" :hold-time #x78) + (new 'static 'gconv-speech :name0 "kg216a" :name1 "kg216b" :hold-time #x78) + (new 'static 'gconv-speech :name0 "kg217a" :name1 "kg217b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg218a" :name1 "kg218b" :hold-time #x12c) + (new 'static 'gconv-speech :name0 "kg219a" :name1 "kg219b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg220a" :name1 "kg220b" :hold-time #x96) + (new 'static 'gconv-speech :name0 "kg221a" :name1 "kg221b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg226a" :name1 "kg226b" :hold-time #x96) + (new 'static 'gconv-speech :name0 "kg227a" :name1 "kg227b" :hold-time #xe1) + (new 'static 'gconv-speech :name0 "kg228a" :name1 "kg228b" :hold-time #x258) + (new 'static 'gconv-speech :name0 "kg229a" :name1 "kg229b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg230a" :name1 "kg230b" :hold-time #x12c) + (new 'static 'gconv-speech :name0 "kg231a" :name1 "kg231b" :hold-time #xe1) + (new 'static 'gconv-speech :name0 "kg232a" :name1 "kg232b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg233a" :name1 "kg233b" :hold-time #x96) + (new 'static 'gconv-speech :name0 "kg234a" :name1 "kg234b" :hold-time #x96) + (new 'static 'gconv-speech :name0 "kg235a" :name1 "kg235b") + ) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech (new 'static 'gconv-speech :name0 "kg210a" :name1 "kg210b")) + ) + (new 'static 'gconv-dialogue + :speeches (new 'static 'boxed-array :type gconv-speech + (new 'static 'gconv-speech :name0 "kg224a" :name1 "kg224b" :hold-time #x96) + (new 'static 'gconv-speech :name0 "kg225a" :name1 "kg225b") + ) + ) + ) + ) + ) + +;; definition of type guard-conversation +(deftype guard-conversation (process-drawable) + ((triggered? symbol :offset-assert 200) + (actor-group actor-group :offset-assert 204) + (actor-count int8 :offset-assert 208) + (remaining int8 :offset-assert 209) + (skip-mask uint32 :offset-assert 212) + (last-playing-time time-frame :offset-assert 216) + ) + :heap-base #x60 + :method-count-assert 25 + :size-assert #xe0 + :flag-assert #x19006000e0 + (:methods + (dormant () _type_ :state 20) + (active () _type_ :state 21) + (notice () _type_ :state 22) + (die () _type_ :state 23) + (guard-conversation-method-24 (_type_) symbol 24) + ) + ) + +;; definition for method 3 of type guard-conversation +(defmethod inspect guard-conversation ((obj guard-conversation)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~2Ttriggered?: ~A~%" (-> obj triggered?)) + (format #t "~2Tactor-group: ~A~%" (-> obj actor-group)) + (format #t "~2Tactor-count: ~D~%" (-> obj actor-count)) + (format #t "~2Tremaining: ~D~%" (-> obj remaining)) + (format #t "~2Tskip-mask: ~D~%" (-> obj skip-mask)) + (format #t "~2Tlast-playing-time: ~D~%" (-> obj last-playing-time)) + (label cfg-4) + obj + ) + +;; definition for method 24 of type guard-conversation +(defmethod guard-conversation-method-24 guard-conversation ((obj guard-conversation)) + (let ((v1-0 (-> obj remaining))) + (when (> v1-0 0) + (set! (-> obj remaining) (+ v1-0 -1)) + (let* ((s3-0 (rand-vu-int-count-excluding 32 (the-as int (-> obj skip-mask)))) + (s5-0 (-> *gconv-dialogues* dialogues s3-0 speeches)) + (s4-1 (zero? (rand-vu-int-count 2))) + ) + (logior! (-> obj skip-mask) (ash 1 s3-0)) + (dotimes (s3-1 (-> s5-0 length)) + (let* ((v1-9 (-> s5-0 s3-1)) + (t0-0 (if s4-1 + (-> v1-9 name0) + (-> v1-9 name1) + ) + ) + ) + (gui-control-method-9 + *gui-control* + obj + (gui-channel guard) + (gui-action play) + (the-as string t0-0) + -99.0 + (the-as time-frame (-> v1-9 hold-time)) + ) + ) + (set! s4-1 (not s4-1)) + ) + ) + #f + ) + ) + ) + +;; failed to figure out what this is: +(defstate dormant (guard-conversation) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('trigger) + (set! (-> self triggered?) #t) + (go-virtual active) + ) + (('untrigger) + (set! (-> self triggered?) #f) + #f + ) + ) + ) + :code (the-as (function none :behavior guard-conversation) sleep-code) + ) + +;; failed to figure out what this is: +(defstate active (guard-conversation) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (let ((v1-0 event-type)) + (the-as object (cond + ((= v1-0 'trigger) + (let ((v0-0 #t)) + (set! (-> self triggered?) v0-0) + v0-0 + ) + ) + ((= v1-0 'untrigger) + (set! (-> self triggered?) #f) + #f + ) + ) + ) + ) + ) + :trans (behavior () + (let ((gp-0 #t)) + (countdown (s5-0 (-> self actor-count)) + (let ((v1-3 (-> self actor-group data s5-0 actor))) + (when (not (logtest? (-> v1-3 extra perm status) (entity-perm-status dead))) + (set! gp-0 #f) + (let ((a0-4 (if v1-3 + (-> v1-3 extra process) + ) + ) + ) + (when a0-4 + (if (nonzero? (-> (the-as nav-enemy a0-4) focus aware)) + (go-virtual notice) + ) + ) + ) + ) + ) + ) + (if gp-0 + (go-virtual die) + ) + ) + (if (nonzero? (gui-control-method-17 + *gui-control* + (the-as + sound-id + (gui-control-method-14 *gui-control* (the-as string #f) (gui-channel guard) (gui-action none)) + ) + ) + ) + (set! (-> self last-playing-time) (-> self clock frame-counter)) + ) + (if (and (-> self triggered?) (>= (- (-> self clock frame-counter) (-> self last-playing-time)) (seconds 6))) + (guard-conversation-method-24 self) + ) + (none) + ) + :code (the-as (function none :behavior guard-conversation) sleep-code) + ) + +;; failed to figure out what this is: +(defstate notice (guard-conversation) + :virtual #t + :code (behavior () + (gui-control-method-16 + *gui-control* + (gui-action stop) + (the-as sound-id 1) + (gui-channel guard) + (gui-action none) + (the-as string #f) + (the-as (function gui-connection symbol) #f) + (the-as process #f) + ) + (let ((v1-2 (rand-vu-int-count 3))) + (gui-control-method-9 + *gui-control* + self + (gui-channel guard) + (gui-action play) + (cond + ((zero? v1-2) + "kg137" + ) + ((= v1-2 1) + "kg152" + ) + (else + "kg160" + ) + ) + -99.0 + 0 + ) + ) + (until (= (gui-control-method-17 + *gui-control* + (the-as + sound-id + (gui-control-method-14 *gui-control* (the-as string #f) (gui-channel guard) (gui-action none)) + ) + ) + (gui-action none) + ) + (suspend) + ) + (go-virtual die) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate die (guard-conversation) + :virtual #t + :code (behavior () + (process-entity-status! self (entity-perm-status bit-12) #t) + (process-entity-status! self (entity-perm-status dead) #t) + (suspend) + 0 + (none) + ) + ) + +;; definition for method 11 of type guard-conversation +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! guard-conversation ((obj guard-conversation) (arg0 entity-actor)) + (local-vars (sv-16 res-tag)) + (set! (-> obj triggered?) #f) + (set! (-> obj root) (new 'process 'trsqv)) + (process-drawable-from-entity! obj arg0) + (let ((v1-2 (res-lump-value (-> obj entity) 'extra-id uint128 :time -1000000000.0))) + (let ((a1-4 (-> *gconv-dialogues* dialogues length)) + (a0-6 0) + ) + (dotimes (a2-1 31) + (when (logtest? v1-2 (ash 1 a2-1)) + (if (< a2-1 a1-4) + (+! a0-6 1) + (set! v1-2 (logxor v1-2 (the-as uint (ash 1 a2-1)))) + ) + ) + ) + (set! (-> obj remaining) a0-6) + ) + (set! (-> obj skip-mask) (the-as uint (lognot v1-2))) + ) + (let ((s5-1 (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status bit-12))))) + (set! sv-16 (new 'static 'res-tag)) + (let ((s4-0 (res-lump-data (-> obj entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (if (or (not s4-0) (zero? (-> sv-16 elt-count))) + (go process-drawable-art-error "missing actors") + ) + (let* ((s4-1 (-> s4-0 0)) + (s3-0 (-> s4-1 length)) + ) + (set! (-> obj actor-group) s4-1) + (set! (-> obj actor-count) s3-0) + (if (!= s3-0 2) + (go process-drawable-art-error "bad actor count") + ) + (dotimes (s2-0 s3-0) + (let ((s1-0 (-> s4-1 data s2-0 actor))) + (if (not s1-0) + (go process-drawable-art-error "bad actor") + ) + (cond + ((logtest? (-> s1-0 extra perm status) (entity-perm-status dead)) + (set! s5-1 #t) + ) + (else + (let ((v1-28 (if s1-0 + (-> s1-0 extra process) + ) + ) + ) + (if (and v1-28 (nonzero? (-> (the-as nav-enemy v1-28) focus aware))) + (set! s5-1 #t) + ) + ) + ) + ) + ) + ) + ) + ) + (if s5-1 + (go (method-of-object obj die)) + (go (method-of-object obj dormant)) + ) + ) + (none) + ) diff --git a/test/decompiler/reference/jak2/levels/common/guard-projectile_REF.gc b/test/decompiler/reference/jak2/levels/common/guard-projectile_REF.gc new file mode 100644 index 0000000000..96937a4bcf --- /dev/null +++ b/test/decompiler/reference/jak2/levels/common/guard-projectile_REF.gc @@ -0,0 +1,1128 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(defpart 605 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x9b :page #xb)) + (sp-rnd-flt spt-num 10.0 1.0 1.0) + (sp-flt spt-x (meters 0)) + (sp-flt spt-y (meters 0)) + (sp-flt spt-z (meters 0)) + (sp-flt spt-scale-x (meters 1)) + (sp-flt spt-rot-x 16384.0) + (sp-flt spt-rot-y (degrees 0.0)) + (sp-flt spt-rot-z (degrees 0.0)) + (sp-flt spt-scale-y (meters 0.1)) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-rnd-flt spt-a 64.0 32.0 1.0) + (sp-rnd-flt spt-accel-y -1.3653333 -4.096 1.0) + (sp-int spt-timer 5) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-14) + ) + ) + +;; failed to figure out what this is: +(defpart 606 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x45 :page #xc)) + (sp-func spt-birth-func 'birth-func-set-quat) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 0.25)) + (sp-flt spt-scale-y (meters 9)) + (sp-flt spt-r 128.0) + (sp-rnd-flt spt-g 0.0 64.0 1.0) + (sp-flt spt-b 0.0) + (sp-flt spt-a 128.0) + (sp-flt spt-scalevel-x (meters 0.0016666667)) + (sp-flt spt-fade-a -2.1333334) + (sp-int spt-timer 40) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-14 left-multiply-quat) + ) + ) + +;; failed to figure out what this is: +(defpart 607 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xca :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 1)) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-flt spt-b 0.0) + (sp-flt spt-a 64.0) + (sp-flt spt-scalevel-x (meters -0.016666668)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -1.6) + (sp-int spt-timer 25) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + ) + ) + +;; failed to figure out what this is: +(defpart 608 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x47 :page #xc)) + (sp-flt spt-num 0.0) + (sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.3) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 64.0 32.0 1.0) + (sp-int spt-timer 5) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + ) + ) + +;; failed to figure out what this is: +(defpart 609 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x14 :page #xc)) + (sp-rnd-flt spt-num 8.0 8.0 1.0) + (sp-rnd-flt spt-z (meters 0) (meters -3) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.4) (meters 0.4) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.4) (meters 0.4) 1.0) + (sp-flt spt-r 192.0) + (sp-rnd-flt spt-g 64.0 128.0 1.0) + (sp-flt spt-b 0.0) + (sp-flt spt-a 64.0) + (sp-flt spt-scalevel-x (meters -0.00234375)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-fade-g -1.2 -2.4 1.0) + (sp-rnd-flt spt-fade-a -0.53333336 -2.1333334 1.0) + (sp-rnd-flt spt-accel-y -0.68266666 -0.68266666 1.0) + (sp-int spt-timer 240) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-flt spt-rotate-y (degrees 0.0)) + ) + ) + +;; failed to figure out what this is: +(defpart 610 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x81 :page #xc)) + (sp-func spt-birth-func 'birth-func-set-quat) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 2)) + (sp-flt spt-scale-y (meters 4.5)) + (sp-flt spt-r 128.0) + (sp-rnd-flt spt-g 0.0 128.0 1.0) + (sp-flt spt-b 0.0) + (sp-flt spt-a 128.0) + (sp-flt spt-fade-a -3.6571429) + (sp-int spt-timer 35) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 left-multiply-quat) + ) + ) + +;; failed to figure out what this is: +(defpart 611 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 1) (meters 1) 1.0) + (sp-flt spt-rot-x 819.2) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 3600.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 0.0) + (sp-flt spt-a 255.0) + (sp-flt spt-omega 822067.2) + (sp-flt spt-scalevel-x (meters 0.053333335)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -3.6571429) + (sp-flt spt-fade-a -7.285714) + (sp-int spt-timer 35) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow) + (sp-flt spt-userdata 1024.0) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-guard-shot-hit-object + :id 136 + :duration (seconds 1) + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 8) + :parts ((sp-item 612 :flags (bit6) :period 600 :length 5) + (sp-item 613 :flags (bit6) :period 600 :length 5) + (sp-item 614 :flags (bit6) :period 600 :length 5) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-guard-shot-hit + :id 137 + :duration (seconds 1) + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 8) + :parts ((sp-item 612 :flags (bit6) :period 600 :length 5) + (sp-item 613 :flags (bit6) :period 600 :length 5) + (sp-item 614 :flags (bit6) :period 600 :length 5) + (sp-item 615 :period 600 :length 5) + ) + ) + +;; failed to figure out what this is: +(defpart 614 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x33 :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 2)) + (sp-flt spt-rot-x 204.8) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 3600.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-rnd-flt spt-g 0.0 128.0 1.0) + (sp-flt spt-b 0.0) + (sp-flt spt-a 64.0) + (sp-flt spt-scalevel-x (meters 0.075)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -1.8285714) + (sp-int spt-timer 40) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow) + (sp-flt spt-userdata 8192.0) + ) + ) + +;; failed to figure out what this is: +(defpart 615 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-rnd-flt spt-num 8.0 8.0 1.0) + (sp-rnd-flt spt-scale-x (meters 0.75) (meters 0.5) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 3600.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-rnd-flt spt-g 0.0 128.0 1.0) + (sp-flt spt-b 0.0) + (sp-rnd-flt spt-a 16.0 48.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.026666667) (meters 0.026666667) 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.0016666667) (meters 0.006666667) 1.0) + (sp-rnd-flt spt-rotvel-z (degrees -0.2) (degrees 0.4) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-r -0.30476192) + (sp-flt spt-fade-g 0.15238096) + (sp-flt spt-fade-b 0.30476192) + (sp-flt spt-fade-a -0.15238096) + (sp-rnd-flt spt-accel-y -0.68266666 -0.68266666 1.0) + (sp-flt spt-friction 0.9) + (sp-int spt-timer 420) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 3600.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 3600.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 613 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc)) + (sp-flt spt-num 2.0) + (sp-flt spt-scale-x (meters 2)) + (sp-flt spt-rot-x 819.2) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-rnd-flt spt-g 128.0 64.0 1.0) + (sp-rnd-flt spt-b 0.0 32.0 1.0) + (sp-flt spt-a 48.0) + (sp-flt spt-scalevel-x (meters 0.125)) + (sp-rnd-flt spt-rotvel-z (degrees -0.3) (degrees 0.6) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -2.1333334) + (sp-flt spt-fade-b -2.1333334) + (sp-int spt-timer 80) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 glow) + (sp-flt spt-userdata 0.0) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 616) + ) + ) + +;; failed to figure out what this is: +(defpart 616 + :init-specs ((sp-flt spt-scale-x (meters 4.5)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-scalevel-x (meters -0.05)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -0.53333336) + (sp-flt spt-fade-a -0.8) + ) + ) + +;; failed to figure out what this is: +(defpart 612 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 1)) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 96.0) + (sp-flt spt-scalevel-x (meters 0.1)) + (sp-flt spt-rotvel-z (degrees 0.3)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-int spt-timer 55) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-int spt-next-time 15) + (sp-launcher-by-id spt-next-launcher 617) + ) + ) + +;; failed to figure out what this is: +(defpart 617 + :init-specs ((sp-flt spt-scale-x (meters 3.5)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-scalevel-x (meters -0.0625)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-b -6.4) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-guard-grenade + :id 138 + :duration (seconds 0.5) + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 2) + :parts ((sp-item 618 :fade-after (meters 200) :falloff-to (meters 200))) + ) + +;; failed to figure out what this is: +(defpart 618 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.25) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 3600.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 64.0 128.0 1.0) + (sp-copy-from-other spt-g -1) + (sp-copy-from-other spt-b -1) + (sp-rnd-flt spt-a 16.0 32.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0) (meters 0.016666668) 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.006666667) (meters 0.013333334) 1.0) + (sp-rnd-flt spt-rotvel-z (degrees -0.2) (degrees 0.4) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-fade-a -0.16 -0.16 1.0) + (sp-flt spt-friction 0.96) + (sp-int spt-timer 300) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-12) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 3600.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 3600.0) 1.0) + (sp-flt spt-conerot-radius (meters 0)) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-guard-shot-die + :id 139 + :duration (seconds 0.017) + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 8) + :parts ((sp-item 209)) + ) + +;; definition of type guard-shot +(deftype guard-shot (projectile) + ((hit-actor? symbol :offset-assert 472) + (tail-pos vector :inline :offset-assert 480) + ) + :heap-base #x170 + :method-count-assert 40 + :size-assert #x1f0 + :flag-assert #x28017001f0 + ) + +;; definition for method 3 of type guard-shot +(defmethod inspect guard-shot ((obj guard-shot)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type projectile inspect))) + (t9-0 obj) + ) + (format #t "~2Thit-actor?: ~A~%" (-> obj hit-actor?)) + (format #t "~2Ttail-pos: #~%" (-> obj tail-pos)) + (label cfg-4) + obj + ) + +;; definition for method 37 of type guard-shot +(defmethod deal-damage! guard-shot ((obj guard-shot) (arg0 process) (arg1 event-message-block)) + "Constructs an [[attack-info]] according to the projectile's `options`" + (let ((t9-0 (method-of-type projectile deal-damage!))) + (when (t9-0 obj arg0 arg1) + (set! (-> obj hit-actor?) #t) + #t + ) + ) + ) + +;; definition for method 24 of type guard-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod draw-laser-sight guard-shot ((obj guard-shot)) + "TODO - confirm If applicable, draw the laser sight particles + :virtual" + (draw-beam (-> *part-id-table* 610) (-> obj tail-pos) (-> obj starting-dir) #f #t) + (let* ((a0-3 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> obj starting-dir) 2048.0)) + (v1-2 (vector+! (new 'stack-no-clear 'vector) (-> obj tail-pos) a0-3)) + (t9-2 sp-launch-particles-var) + (a0-4 *sp-particle-system-2d*) + (a1-4 (-> *part-id-table* 611)) + (a2-2 *launch-matrix*) + ) + (set! (-> a2-2 trans quad) (-> v1-2 quad)) + (t9-2 a0-4 a1-4 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + 0 + (none) + ) + +;; definition for method 25 of type guard-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod spawn-impact-particles guard-shot ((obj guard-shot)) + "Spawns associated particles with the projectile if applicable" + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let* ((gp-0 (-> obj root-override trans)) + (a1-0 (-> obj tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) + ) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (let ((v1-4 a1-0)) + (let ((a0-2 s5-1)) + (let ((a2-1 0.8)) + (.mov vf7 a2-1) + ) + (.lvf vf5 (&-> a0-2 quad)) + ) + (.lvf vf4 (&-> v1-4 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> s4-0 quad) vf6) + (let ((f28-0 (-> *part-id-table* 606 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 606 init-specs 4 initial-valuef) (vector-length s5-1)) + (draw-beam (-> *part-id-table* 606) a1-0 s5-1 #f #t) + (set! (-> *part-id-table* 606 init-specs 4 initial-valuef) f28-0) + ) + (vector-normalize! s5-1 1.0) + (let ((t9-2 sp-launch-particles-var) + (a0-5 *sp-particle-system-2d*) + (a1-2 (-> *part-id-table* 607)) + (a2-3 *launch-matrix*) + ) + (set! (-> a2-3 trans quad) (-> s4-0 quad)) + (t9-2 a0-5 a1-2 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (let ((t9-3 sp-launch-particles-var) + (a0-6 *sp-particle-system-2d*) + (a1-3 (-> *part-id-table* 608)) + (a2-4 *launch-matrix*) + ) + (set! (-> a2-4 trans quad) (-> s4-0 quad)) + (t9-3 a0-6 a1-3 a2-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + (let ((s4-1 (new 'stack-no-clear 'matrix)) + (f26-0 (* 0.000027126736 f30-0)) + (f30-1 (-> *part-id-table* 609 init-specs 3 initial-valuef)) + (f28-1 (-> *part-id-table* 609 init-specs 4 initial-valuef)) + ) + (forward-up->inv-matrix s4-1 s5-1 *up-vector*) + (set! (-> s4-1 trans quad) (-> gp-0 quad)) + (set! (-> *part-id-table* 609 init-specs 3 initial-valuef) (* f26-0 f30-1)) + (set! (-> *part-id-table* 609 init-specs 4 initial-valuef) (* f26-0 f28-1)) + (sp-launch-particles-var + *sp-particle-system-2d* + (-> *part-id-table* 609) + s4-1 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + (set! (-> *part-id-table* 609 init-specs 3 initial-valuef) f30-1) + (set! (-> *part-id-table* 609 init-specs 4 initial-valuef) f28-1) + ) + ) + 0 + (none) + ) + ) + +;; definition for method 26 of type guard-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod spawn-shell-particles guard-shot ((obj guard-shot)) + "TODO - confirm" + (let* ((s4-0 (-> obj root-override)) + (v1-1 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> obj tail-pos) (-> s4-0 trans)) 2048.0)) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> gp-0 quad) (-> s4-0 trans quad)) + (vector+! gp-0 gp-0 v1-1) + (cond + ((-> obj hit-actor?) + (let ((s5-1 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-1 + (let ((t9-2 (method-of-type part-tracker activate))) + (t9-2 + (the-as part-tracker s5-1) + *entity-pool* + (symbol->string (-> part-tracker symbol)) + (the-as pointer #x70004000) + ) + ) + (let ((t9-3 run-function-in-process) + (a0-8 s5-1) + (a1-6 part-tracker-init) + (a2-4 (-> *part-group-id-table* 136)) + (a3-1 0) + (t0-0 #f) + (t1-0 #f) + (t2-0 #f) + (t3-0 *launch-matrix*) + ) + (set! (-> t3-0 trans quad) (-> gp-0 quad)) + ((the-as (function object object object object object object object object none) t9-3) + a0-8 + a1-6 + a2-4 + a3-1 + t0-0 + t1-0 + t2-0 + t3-0 + ) + ) + (-> s5-1 ppointer) + ) + ) + ) + (else + (let ((s5-2 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-2 + (let ((t9-5 (method-of-type part-tracker activate))) + (t9-5 + (the-as part-tracker s5-2) + *entity-pool* + (symbol->string (-> part-tracker symbol)) + (the-as pointer #x70004000) + ) + ) + (let ((t9-6 run-function-in-process) + (a0-11 s5-2) + (a1-9 part-tracker-init) + (a2-9 (-> *part-group-id-table* 137)) + (a3-3 0) + (t0-1 #f) + (t1-1 #f) + (t2-1 #f) + (t3-1 *launch-matrix*) + ) + (set! (-> t3-1 trans quad) (-> gp-0 quad)) + ((the-as (function object object object object object object object object none) t9-6) + a0-11 + a1-9 + a2-9 + a3-3 + t0-1 + t1-1 + t2-1 + t3-1 + ) + ) + (-> s5-2 ppointer) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 28 of type guard-shot +;; WARN: Return type mismatch int vs sound-id. +(defmethod play-impact-sound guard-shot ((obj guard-shot) (arg0 projectile-options)) + (let ((v1-0 arg0)) + (cond + ((zero? v1-0) + (sound-play "guard-shot-fire") + ) + ((= v1-0 (projectile-options lose-altitude)) + (sound-play "guard-shot-hit") + ) + ) + ) + (the-as sound-id 0) + ) + +;; failed to figure out what this is: +(defstate impact (guard-shot) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type projectile impact) enter))) + (if t9-0 + (t9-0) + ) + ) + (when *traffic-manager* + (let ((v1-5 (new 'stack-no-clear 'traffic-danger-info))) + (set! (-> v1-5 sphere quad) (-> self root-override trans quad)) + (set! (-> v1-5 sphere r) 40960.0) + (set! (-> v1-5 velocity quad) (-> self root-override transv quad)) + (set! (-> v1-5 notify-radius) 122880.0) + (set! (-> v1-5 danger-level) 1.0) + (set! (-> v1-5 decay-rate) 0.0) + (set! (-> v1-5 flags) (the-as uint 1)) + (set! (-> v1-5 danger-type) (the-as uint 0)) + (set! (-> v1-5 handle) (the-as uint #f)) + (send-event *traffic-manager* 'add-danger-sphere v1-5) + ) + ) + (none) + ) + ) + +;; definition for function guard-shot-move +;; WARN: Return type mismatch int vs none. +(defun guard-shot-move ((arg0 guard-shot)) + (projectile-move-fill-line-sphere arg0) + (let ((s5-0 (-> arg0 root-override))) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (vector-! s4-0 (-> arg0 tail-pos) (-> s5-0 trans)) + (let ((f0-0 (vector-length s4-0))) + (when (< 36864.0 f0-0) + (vector-normalize! s4-0 36864.0) + (vector+! (-> arg0 tail-pos) (-> s5-0 trans) s4-0) + ) + ) + ) + (when (logtest? (-> s5-0 status) (cshape-moving-flags t-surface)) + (if (logtest? (-> arg0 root-override status) (cshape-moving-flags t-act)) + (set! (-> arg0 hit-actor?) #t) + ) + (go (method-of-object arg0 impact)) + ) + ) + 0 + (none) + ) + +;; definition for method 38 of type guard-shot +(defmethod made-impact? guard-shot ((obj guard-shot)) + "TODO - queries the collision cache, return true/false" + (let ((v1-0 (-> obj root-override))) + (let ((a0-1 (new 'stack-no-clear 'collide-query))) + (set! (-> a0-1 radius) (-> v1-0 root-prim prim-core world-sphere w)) + (set! (-> a0-1 collide-with) (-> v1-0 root-prim prim-core collide-with)) + (set! (-> a0-1 ignore-process0) obj) + (set! (-> a0-1 ignore-process1) (ppointer->process (-> obj parent))) + (set! (-> a0-1 ignore-pat) (-> v1-0 pat-ignore-mask)) + (set! (-> a0-1 action-mask) (collide-action solid)) + ) + (when (collide-shape-moving-method-65 v1-0 (-> v1-0 transv) -6144.0 0.0 -2048.0) + (if (logtest? (-> obj root-override status) (cshape-moving-flags t-act)) + (set! (-> obj hit-actor?) #t) + ) + #t + ) + ) + ) + +;; definition for method 30 of type guard-shot +;; WARN: Return type mismatch int vs none. +(defmethod init-collision! guard-shot ((obj guard-shot)) + "Init the [[projectile]]'s [[collide-shape]]" + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) + (the-as (function control-info collide-query vector vector cshape-moving-flags) cshape-reaction-just-move) + ) + (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 penetrate-using) (penetrate enemy-yellow-shot)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec projectile)) + (set! (-> s4-0 prim-core collide-with) + (collide-spec backgnd jak bot crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list) + ) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 2457.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 projectile)) + (set! (-> v1-13 prim-core collide-with) + (collide-spec backgnd jak bot crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list) + ) + (set! (-> v1-13 prim-core action) (collide-action solid deadly)) + (set-vector! (-> v1-13 local-sphere) 0.0 0.0 0.0 819.2) + ) + (let ((v1-15 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-15 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-15 prim-core collide-with) + (collide-spec jak bot crate civilian enemy vehicle-sphere hit-by-others-list player-list) + ) + (set! (-> v1-15 prim-core action) (collide-action deadly)) + (set-vector! (-> v1-15 local-sphere) 0.0 0.0 0.0 2457.6) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-18 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-18 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-18 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 1)) + (set! (-> s5-0 event-self) 'touched) + (set! (-> obj root-override) s5-0) + ) + (set! (-> obj root-override pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1) + ) + 0 + (none) + ) + +;; definition for method 31 of type guard-shot +;; INFO: Used lq/sq +(defmethod init-proj-settings! guard-shot ((obj guard-shot)) + "Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc + :virtual" + (set! (-> obj hit-actor?) #f) + (set! (-> obj tail-pos quad) (-> obj root-override trans quad)) + (set! (-> obj attack-mode) 'guard-shot) + (set! (-> obj max-speed) 819200.0) + (set! (-> obj move) guard-shot-move) + (set! (-> obj update-velocity) projectile-update-velocity-space-wars) + (set! (-> obj timeout) (seconds 0.5)) + (logior! (-> obj options) (projectile-options account-for-target-velocity)) + (set-gravity-length (-> obj root-override dynam) 573440.0) + (none) + ) + +;; definition of type vehicle-grenade +(deftype vehicle-grenade (projectile-bounce) + ((blast-radius float :offset-assert 496) + ) + :heap-base #x180 + :method-count-assert 42 + :size-assert #x1f4 + :flag-assert #x2a018001f4 + ) + +;; definition for method 3 of type vehicle-grenade +(defmethod inspect vehicle-grenade ((obj vehicle-grenade)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type projectile-bounce inspect))) + (t9-0 obj) + ) + (format #t "~2Tblast-radius: ~f~%" (-> obj blast-radius)) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defskelgroup skel-vehicle-grenade eco-canister 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 0.3) + :texture-level 6 + ) + +;; definition for method 28 of type vehicle-grenade +;; WARN: Return type mismatch int vs sound-id. +(defmethod play-impact-sound vehicle-grenade ((obj vehicle-grenade) (arg0 projectile-options)) + (let ((v1-0 arg0)) + (cond + ((zero? v1-0) + (sound-play "grenade-fire") + ) + ((= v1-0 (projectile-options lose-altitude)) + (sound-play "grenade-explode") + ) + ) + ) + (the-as sound-id 0) + ) + +;; definition for method 30 of type vehicle-grenade +;; WARN: Return type mismatch int vs none. +(defmethod init-collision! vehicle-grenade ((obj vehicle-grenade)) + "Init the [[projectile]]'s [[collide-shape]]" + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) projectile-bounce-reaction) + (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 penetrate-using) (penetrate explode)) + (let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-7 prim-core action) (collide-action solid)) + (set-vector! (-> v1-7 local-sphere) 0.0 0.0 0.0 819.2) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-7) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-10 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-10 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-10 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 2)) + (set! (-> s5-0 event-self) 'touched) + (set! (-> obj root-override) s5-0) + ) + (set-collide-with! + (-> obj root-override) + (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set-collide-as! (-> obj root-override) (collide-spec enemy)) + (set! (-> obj root-override pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1) + ) + (none) + ) + +;; definition for method 31 of type vehicle-grenade +;; WARN: Return type mismatch int vs none. +(defmethod init-proj-settings! vehicle-grenade ((obj vehicle-grenade)) + "Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc + :virtual" + (set! (-> obj attack-mode) 'eco-dark) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-vehicle-grenade" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (let ((t9-2 (method-of-type projectile-bounce init-proj-settings!))) + (t9-2 obj) + ) + (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 138) obj)) + (set! (-> obj blast-radius) 16384.0) + (set! (-> obj max-speed) 90112.0) + (set! (-> obj timeout) (seconds 4)) + 0 + (none) + ) + +;; definition for method 25 of type vehicle-grenade +;; WARN: Return type mismatch int vs none. +(defmethod spawn-impact-particles vehicle-grenade ((obj vehicle-grenade)) + "Spawns associated particles with the projectile if applicable" + (spawn (-> obj part) (-> obj root-override trans)) + (ja-post) + 0 + (none) + ) + +;; definition for method 41 of type vehicle-grenade +;; WARN: Return type mismatch int vs none. +(defmethod noop vehicle-grenade ((obj vehicle-grenade)) + "Does nothing" + (spawn (-> obj part) (-> obj root-override trans)) + 0 + (none) + ) + +;; definition for method 39 of type vehicle-grenade +(defmethod play-impact-sound! vehicle-grenade ((obj vehicle-grenade)) + "Plays impact sound + :virtual" + (let* ((a2-0 (-> obj root-override)) + (v1-0 (-> a2-0 status)) + ) + (if (logtest? v1-0 (cshape-moving-flags t-surface)) + (vector-float*! (-> a2-0 transv) (-> a2-0 transv) 0.2) + ) + (when (and (logtest? v1-0 (cshape-moving-flags csmf11)) + (>= (- (-> self clock frame-counter) (-> obj played-bounce-time)) (seconds 0.3)) + ) + (set! (-> obj played-bounce-time) (-> self clock frame-counter)) + (sound-play "grenade-bounce") + ) + ) + ) + +;; failed to figure out what this is: +(defstate impact (vehicle-grenade) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (let ((v1-0 event-type)) + (the-as object (when (= v1-0 'touched) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) (process->ppointer self)) + (set! (-> a1-2 num-params) 2) + (set! (-> a1-2 message) 'attack) + (set! (-> a1-2 param 0) (-> event param 0)) + (let ((v1-5 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (set! (-> v1-5 id) (-> self attack-id)) + (set! (-> v1-5 mode) 'explode) + (set! (-> a1-2 param 1) (the-as uint v1-5)) + ) + (if (send-event-function proc a1-2) + #t + ) + ) + ) + ) + ) + ) + :code (behavior () + (let ((gp-0 (new 'stack-no-clear 'explosion-init-params))) + (set! (-> gp-0 spawn-point quad) (-> self root-override trans quad)) + (quaternion-copy! (-> gp-0 spawn-quat) (-> self root-override quat)) + (set! (-> gp-0 radius) (-> self blast-radius)) + (set! (-> gp-0 group) (-> *part-group-id-table* 76)) + (set! (-> gp-0 collide-with) + (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set! (-> gp-0 penetrate-using) (penetrate explode)) + (explosion-spawn self explosion gp-0) + ) + (logior! (-> self draw status) (draw-control-status no-draw)) + (let ((v1-11 (-> self root-override root-prim))) + (set! (-> v1-11 prim-core collide-as) (collide-spec)) + (set! (-> v1-11 prim-core collide-with) (collide-spec)) + ) + 0 + (while (-> self child) + (suspend) + ) + (deactivate self) + (none) + ) + ) + +;; failed to figure out what this is: +(set! (-> *lightning-spec-id-table* 13) (new 'static 'lightning-spec + :name "lightning-trail-crimson-guard" + :flags (lightning-spec-flags lsf1) + :rand-func #x2 + :start-color (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + :fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5) + :fade-start-factor 0.2 + :fade-time 120.0 + :texture #xc08300 + :reduction 0.6 + :num-points 16 + :box-size 2048.0 + :merge-factor 0.5 + :merge-count 2 + :radius 1638.4 + :duration -1.0 + :sound #f + ) + ) + +;; failed to figure out what this is: +(set! (-> *lightning-spec-id-table* 14) (new 'static 'lightning-spec + :name "lightning-fractal-crimson-guard" + :flags (lightning-spec-flags lsf1) + :start-color (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + :fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5) + :fade-start-factor 0.2 + :fade-time 120.0 + :texture #xc08300 + :reduction 0.6 + :num-points 16 + :box-size 2048.0 + :merge-factor 0.5 + :merge-count 2 + :radius 1638.4 + :duration -1.0 + :sound #f + ) + ) + +;; failed to figure out what this is: +(defpart 619 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 0.8) (meters 0.2) 1.0) + (sp-flt spt-rot-x 409.6) + (sp-rnd-flt spt-rot-z (degrees -17.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 32.0 96.0 1.0) + (sp-copy-from-other spt-g -1) + (sp-flt spt-b 255.0) + (sp-rnd-flt spt-a 32.0 16.0 1.0) + (sp-flt spt-omega 412467.2) + (sp-int spt-timer 5) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow) + (sp-flt spt-userdata 819.2) + ) + ) + +;; failed to figure out what this is: +(defpart 620 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 2.5) (meters 1) 1.0) + (sp-flt spt-rot-x 409.6) + (sp-flt spt-rot-z (degrees -17.0)) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 0.0 64.0 1.0) + (sp-copy-from-other spt-g -1) + (sp-flt spt-b 255.0) + (sp-rnd-flt spt-a 16.0 16.0 1.0) + (sp-flt spt-omega 412467.2) + (sp-int spt-timer 5) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow) + (sp-flt spt-userdata 819.2) + ) + ) + +;; failed to figure out what this is: +(defpartgroup part-crimson-lightning-glow + :id 140 + :duration (seconds 0.017) + :linger-duration (seconds 0.035) + :bounds (static-bspherem 0 0 0 4) + :parts ((sp-item 620 :fade-after (meters 100) :flags (bit6)) (sp-item 619 :fade-after (meters 100) :flags (bit6))) + ) + +;; definition of type guard-lazer-shot +(deftype guard-lazer-shot (projectile) + () + :heap-base #x160 + :method-count-assert 40 + :size-assert #x1d8 + :flag-assert #x28016001d8 + ) + +;; definition for method 3 of type guard-lazer-shot +(defmethod inspect guard-lazer-shot ((obj guard-lazer-shot)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type projectile inspect))) + (t9-0 obj) + ) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defstate dissipate (guard-lazer-shot) + :virtual #t + :enter (behavior () + (go-virtual impact) + (none) + ) + ) + +;; definition for method 38 of type guard-lazer-shot +(defmethod made-impact? guard-lazer-shot ((obj guard-lazer-shot)) + "TODO - queries the collision cache, return true/false" + (let ((gp-0 (-> obj root-override))) + (let* ((s5-0 (new 'stack-no-clear 'collide-query)) + (v1-0 s5-0) + ) + (set! (-> v1-0 radius) (-> gp-0 root-prim prim-core world-sphere w)) + (set! (-> v1-0 collide-with) (-> gp-0 root-prim prim-core collide-with)) + (set! (-> v1-0 ignore-process0) obj) + (set! (-> v1-0 ignore-process1) (ppointer->process (-> obj parent))) + (set! (-> v1-0 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-0 action-mask) (collide-action solid)) + ) + (let ((a0-2 (handle->process (-> obj notify-handle)))) + (when a0-2 + (let* ((s4-1 (vector-! (new 'stack-no-clear 'vector) (-> gp-0 trans) (get-trans (the-as process-focusable a0-2) 3))) + (f0-2 (- (vector-length s4-1))) + ) + (collide-shape-moving-method-65 gp-0 s4-1 f0-2 0.0 -3072.0) + ) + ) + ) + ) + ) + +;; definition for function guard-lazer-shot-move +;; WARN: Return type mismatch int vs none. +(defun guard-lazer-shot-move ((arg0 guard-lazer-shot)) + (projectile-move-fill-line-sphere arg0) + (if (logtest? (-> arg0 root-override status) (cshape-moving-flags t-surface)) + (go (method-of-object arg0 impact)) + ) + 0 + (none) + ) + +;; definition for method 30 of type guard-lazer-shot +;; WARN: Return type mismatch int vs none. +(defmethod init-collision! guard-lazer-shot ((obj guard-lazer-shot)) + "Init the [[projectile]]'s [[collide-shape]]" + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-default) + (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 penetrate-using) (penetrate enemy-yellow-shot)) + (let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-7 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-7 prim-core collide-with) + (collide-spec + backgnd + jak + bot + crate + civilian + enemy + obstacle + vehicle-sphere + hit-by-others-list + player-list + pusher + ) + ) + (set! (-> v1-7 prim-core action) (collide-action solid)) + (set-vector! (-> v1-7 local-sphere) 0.0 0.0 0.0 1228.8) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-7) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-10 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-10 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-10 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 1)) + (set! (-> s5-0 event-self) 'touched) + (set! (-> obj root-override) s5-0) + ) + (set! (-> obj root-override pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1) + ) + 0 + (none) + ) + +;; definition for method 31 of type guard-lazer-shot +;; WARN: Return type mismatch int vs none. +(defmethod init-proj-settings! guard-lazer-shot ((obj guard-lazer-shot)) + "Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc + :virtual" + (set! (-> obj attack-mode) 'shock) + (set! (-> obj max-speed) 131072.0) + (set! (-> obj timeout) (seconds 0.125)) + (set! (-> obj move) guard-lazer-shot-move) + (set! (-> obj root-override dynam gravity y) 0.0) + (set! (-> obj root-override dynam gravity-length) 0.0) + (set! (-> obj root-override dynam gravity-max) 0.0) + 0 + (none) + ) + + + + diff --git a/test/decompiler/reference/jak2/levels/common/metalhead-projectile_REF.gc b/test/decompiler/reference/jak2/levels/common/metalhead-projectile_REF.gc new file mode 100644 index 0000000000..dfc2b0327e --- /dev/null +++ b/test/decompiler/reference/jak2/levels/common/metalhead-projectile_REF.gc @@ -0,0 +1,1037 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(defpart 621 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x80 :page #xc)) + (sp-func spt-birth-func 'birth-func-set-quat) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 0.25)) + (sp-flt spt-scale-y (meters 12)) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 32.0 64.0 1.0) + (sp-int spt-timer 5) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-14 left-multiply-quat) + ) + ) + +;; failed to figure out what this is: +(defpart 622 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xca :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 3)) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-flt spt-g 0.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 64.0) + (sp-flt spt-scalevel-x (meters -0.075)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -1.6) + (sp-int spt-timer 40) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + ) + ) + +;; failed to figure out what this is: +(defpart 623 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x14 :page #xc)) + (sp-flt spt-num 16.0) + (sp-rnd-flt spt-z (meters 0) (meters -2) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.5) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 3600.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.5) (meters 0.5) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 64.0) + (sp-rnd-flt spt-fade-g -3.2 -6.4 1.0) + (sp-rnd-flt spt-fade-a -1.6 -6.4 1.0) + (sp-rnd-flt spt-accel-y -0.68266666 -0.68266666 1.0) + (sp-int spt-timer 80) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-flt spt-rotate-y (degrees 0.0)) + ) + ) + +;; failed to figure out what this is: +(defpart 624 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x81 :page #xc)) + (sp-func spt-birth-func 'birth-func-set-quat) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 2)) + (sp-flt spt-scale-y (meters 4.5)) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 128.0) + (sp-flt spt-fade-a -3.6571429) + (sp-int spt-timer 35) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 left-multiply-quat) + ) + ) + +;; failed to figure out what this is: +(defpart 625 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 2)) + (sp-flt spt-rot-x 819.2) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 3600.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-rnd-flt spt-g 0.0 64.0 1.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 255.0) + (sp-flt spt-omega 822067.2) + (sp-flt spt-scalevel-x (meters 0.10666667)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -7.285714) + (sp-int spt-timer 35) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow) + (sp-flt spt-userdata 1024.0) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-metalhead-shot-hit + :id 141 + :duration (seconds 1) + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 8) + :parts ((sp-item 626 :period 600 :length 5) + (sp-item 627 :fade-after (meters 100) :flags (bit6) :period 600 :length 5) + (sp-item 628 :flags (bit6) :period 600 :length 5) + (sp-item 629 :flags (bit6) :period 600 :length 5) + (sp-item 630 :period 600 :length 5) + (sp-item 631 :fade-after (meters 50) :falloff-to (meters 50) :period 600 :length 5) + ) + ) + +;; failed to figure out what this is: +(defpart 629 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x33 :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 1)) + (sp-flt spt-rot-x 204.8) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-rnd-flt spt-g 0.0 128.0 1.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 12.0) + (sp-flt spt-scalevel-x (meters 0.26666668)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.34285715) + (sp-int spt-timer 40) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow) + (sp-flt spt-userdata 4096.0) + ) + ) + +;; failed to figure out what this is: +(defpart 630 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-rnd-flt spt-num 8.0 8.0 1.0) + (sp-rnd-flt spt-scale-x (meters 1) (meters 0.5) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 128.0 128.0 1.0) + (sp-rnd-flt spt-g 0.0 64.0 1.0) + (sp-rnd-flt spt-b 128.0 128.0 1.0) + (sp-rnd-flt spt-a 16.0 48.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.013333334) (meters 0.04) 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.0016666667) (meters 0.013333334) 1.0) + (sp-rnd-flt spt-rotvel-z (degrees -0.2) (degrees 0.4) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-r -0.30476192) + (sp-flt spt-fade-g -0.35555556) + (sp-flt spt-fade-b -0.17777778) + (sp-flt spt-fade-a -0.15238096) + (sp-rnd-flt spt-accel-y -0.68266666 -0.68266666 1.0) + (sp-flt spt-friction 0.9) + (sp-int spt-timer 420) + (sp-cpuinfo-flags sp-cpuinfo-flag-2) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 3600.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 3600.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 631 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x14 :page #xc)) + (sp-rnd-flt spt-num 20.0 10.0 1.0) + (sp-flt spt-y (meters 0.25)) + (sp-rnd-flt spt-scale-x (meters 0.075) (meters 0.05) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-rnd-flt spt-g 0.0 128.0 1.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 64.0 32.0 1.0) + (sp-rnd-flt spt-omega 4.096 4.096 1.0) + (sp-rnd-flt spt-vel-y (meters 0.033333335) (meters 0.1) 1.0) + (sp-rnd-int-flt spt-rotvel-z (degrees -2.4) 1 873.81335) + (sp-flt spt-fade-g -0.85333335) + (sp-flt spt-fade-a 0.0) + (sp-rnd-flt spt-accel-y -1.3653333 -5.4613333 1.0) + (sp-rnd-flt spt-friction 0.9 0.02 1.0) + (sp-int spt-timer 150) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + (sp-func spt-func 'sparticle-motion-blur) + (sp-int spt-next-time 100) + (sp-launcher-by-id spt-next-launcher 632) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 632 + :init-specs ((sp-rnd-flt spt-fade-a -0.48 -0.48 1.0)) + ) + +;; failed to figure out what this is: +(defpart 627 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 4)) + (sp-flt spt-rot-x 819.2) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-flt spt-g 128.0) + (sp-rnd-flt spt-b 128.0 128.0 1.0) + (sp-flt spt-a 128.0) + (sp-flt spt-rotvel-z (degrees -0.1)) + (sp-flt spt-fade-a -1.6) + (sp-int spt-timer 80) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow) + (sp-flt spt-userdata -4096.0) + (sp-launcher-by-id spt-next-launcher 633) + ) + ) + +;; failed to figure out what this is: +(defpart 633 + :init-specs ((sp-rnd-flt spt-scale-x (meters 2) (meters 0.5) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-rnd-flt spt-g 0.0 64.0 1.0) + (sp-rnd-flt spt-b 128.0 128.0 1.0) + (sp-int spt-next-time 5) + (sp-launcher-by-id spt-next-launcher 633) + ) + ) + +;; failed to figure out what this is: +(defpart 628 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc)) + (sp-flt spt-num 2.0) + (sp-flt spt-scale-x (meters 1)) + (sp-flt spt-rot-x 819.2) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-rnd-flt spt-g 0.0 64.0 1.0) + (sp-rnd-flt spt-b 128.0 128.0 1.0) + (sp-flt spt-a 48.0) + (sp-flt spt-scalevel-x (meters 0.12857144)) + (sp-rnd-flt spt-rotvel-z (degrees -0.3) (degrees 0.6) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -2.1333334) + (sp-flt spt-fade-b -2.1333334) + (sp-int spt-timer 80) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 glow) + (sp-flt spt-userdata -4096.0) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 634) + ) + ) + +;; failed to figure out what this is: +(defpart 634 + :init-specs ((sp-flt spt-scale-x (meters 4.5)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-scalevel-x (meters -0.06666667)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -0.53333336) + (sp-flt spt-fade-a -0.8) + ) + ) + +;; failed to figure out what this is: +(defpart 626 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 1)) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 96.0) + (sp-flt spt-scalevel-x (meters 0.16666667)) + (sp-flt spt-rotvel-z (degrees 0.3)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-int spt-timer 55) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-int spt-next-time 15) + (sp-launcher-by-id spt-next-launcher 635) + ) + ) + +;; failed to figure out what this is: +(defpart 635 + :init-specs ((sp-flt spt-scale-x (meters 3.5)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-scalevel-x (meters -0.0875)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-b -6.4) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-metalhead-shot-die + :id 142 + :duration (seconds 0.017) + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 8) + :parts ((sp-item 209)) + ) + +;; failed to figure out what this is: +(defpart 636 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xca :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 2.5)) + (sp-flt spt-rot-x 409.6) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-flt spt-g 192.0) + (sp-flt spt-b 64.0) + (sp-flt spt-a 16.0) + (sp-int spt-timer 5) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow) + (sp-flt spt-userdata 819.2) + ) + ) + +;; definition of type metalhead-shot +(deftype metalhead-shot (projectile) + ((tail-pos vector :inline :offset-assert 480) + ) + :heap-base #x170 + :method-count-assert 40 + :size-assert #x1f0 + :flag-assert #x28017001f0 + ) + +;; definition for method 3 of type metalhead-shot +(defmethod inspect metalhead-shot ((obj metalhead-shot)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type projectile inspect))) + (t9-0 obj) + ) + (format #t "~2Ttail-pos: #~%" (-> obj tail-pos)) + (label cfg-4) + obj + ) + +;; definition for method 24 of type metalhead-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod draw-laser-sight metalhead-shot ((obj metalhead-shot)) + "TODO - confirm If applicable, draw the laser sight particles + :virtual" + (draw-beam (-> *part-id-table* 624) (-> obj tail-pos) (-> obj starting-dir) #f #t) + (let* ((a0-3 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> obj starting-dir) 2048.0)) + (v1-2 (vector+! (new 'stack-no-clear 'vector) (-> obj tail-pos) a0-3)) + (t9-2 sp-launch-particles-var) + (a0-4 *sp-particle-system-2d*) + (a1-4 (-> *part-id-table* 625)) + (a2-2 *launch-matrix*) + ) + (set! (-> a2-2 trans quad) (-> v1-2 quad)) + (t9-2 a0-4 a1-4 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + 0 + (none) + ) + +;; definition for method 25 of type metalhead-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod spawn-impact-particles metalhead-shot ((obj metalhead-shot)) + "Spawns associated particles with the projectile if applicable" + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let* ((gp-0 (-> obj root-override trans)) + (a1-0 (-> obj tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) + ) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (let ((v1-4 a1-0)) + (let ((a0-2 s5-1)) + (let ((a2-1 0.8)) + (.mov vf7 a2-1) + ) + (.lvf vf5 (&-> a0-2 quad)) + ) + (.lvf vf4 (&-> v1-4 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> s4-0 quad) vf6) + (let ((f28-0 (-> *part-id-table* 621 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 621 init-specs 4 initial-valuef) (fmin f28-0 (vector-length s5-1))) + (draw-beam (-> *part-id-table* 621) a1-0 s5-1 #f #t) + (set! (-> *part-id-table* 621 init-specs 4 initial-valuef) f28-0) + ) + (vector-normalize! s5-1 1.0) + (let ((t9-2 sp-launch-particles-var) + (a0-5 *sp-particle-system-2d*) + (a1-2 (-> *part-id-table* 622)) + (a2-3 *launch-matrix*) + ) + (set! (-> a2-3 trans quad) (-> s4-0 quad)) + (t9-2 a0-5 a1-2 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + (let ((s4-1 (new 'stack-no-clear 'matrix)) + (f26-0 (* 0.000020345053 f30-0)) + (f30-1 (-> *part-id-table* 623 init-specs 3 initial-valuef)) + (f28-1 (-> *part-id-table* 623 init-specs 5 initial-valuef)) + ) + (forward-up->inv-matrix s4-1 s5-1 *up-vector*) + (set! (-> s4-1 trans quad) (-> gp-0 quad)) + (set! (-> *part-id-table* 623 init-specs 3 initial-valuef) (* f26-0 f30-1)) + (set! (-> *part-id-table* 623 init-specs 5 initial-valuef) (* f26-0 f28-1)) + (sp-launch-particles-var + *sp-particle-system-2d* + (-> *part-id-table* 623) + s4-1 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + (set! (-> *part-id-table* 623 init-specs 3 initial-valuef) f30-1) + (set! (-> *part-id-table* 623 init-specs 5 initial-valuef) f28-1) + ) + ) + 0 + (none) + ) + ) + +;; definition for method 26 of type metalhead-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod spawn-shell-particles metalhead-shot ((obj metalhead-shot)) + "TODO - confirm" + (let* ((s5-0 (-> obj root-override)) + (v1-2 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> obj tail-pos) (-> s5-0 trans)) 2048.0)) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> gp-0 quad) (-> s5-0 trans quad)) + (vector+! gp-0 gp-0 v1-2) + (let ((s5-1 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-1 + (let ((t9-2 (method-of-type part-tracker activate))) + (t9-2 + (the-as part-tracker s5-1) + *entity-pool* + (symbol->string (-> part-tracker symbol)) + (the-as pointer #x70004000) + ) + ) + (let ((t9-3 run-function-in-process) + (a0-8 s5-1) + (a1-6 part-tracker-init) + (a2-4 (-> *part-group-id-table* 141)) + (a3-1 0) + (t0-0 #f) + (t1-0 #f) + (t2-0 #f) + (t3-0 *launch-matrix*) + ) + (set! (-> t3-0 trans quad) (-> gp-0 quad)) + ((the-as (function object object object object object object object object none) t9-3) + a0-8 + a1-6 + a2-4 + a3-1 + t0-0 + t1-0 + t2-0 + t3-0 + ) + ) + (-> s5-1 ppointer) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 28 of type metalhead-shot +(defmethod play-impact-sound metalhead-shot ((obj metalhead-shot) (arg0 projectile-options)) + (with-pp + (case arg0 + (((projectile-options lose-altitude proj-options-2)) + (when (nonzero? (-> obj sound-id)) + (when *sound-player-enable* + (let ((gp-0 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> gp-0 command) (sound-command set-param)) + (set! (-> gp-0 id) (-> obj sound-id)) + (let ((a1-1 (-> obj root-override trans))) + (let ((s5-1 pp)) + (when (= a1-1 #t) + (if (and s5-1 (type? s5-1 process-drawable) (nonzero? (-> (the-as process-drawable s5-1) root))) + (set! a1-1 (-> (the-as process-drawable s5-1) root trans)) + (set! a1-1 (the-as vector #f)) + ) + ) + ) + (sound-trans-convert (the-as vector3w (-> gp-0 params trans)) a1-1) + ) + (set! (-> gp-0 params mask) (the-as uint 32)) + (-> gp-0 id) + ) + ) + ) + ) + ) + ) + ) + +;; definition for function metalhead-shot-move +;; WARN: Return type mismatch int vs none. +(defun metalhead-shot-move ((arg0 metalhead-shot)) + (projectile-move-fill-line-sphere arg0) + (let ((s5-0 (-> arg0 root-override))) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (vector-! s4-0 (-> arg0 tail-pos) (-> s5-0 trans)) + (let ((f0-0 (vector-length s4-0))) + (when (< 49152.0 f0-0) + (vector-normalize! s4-0 49152.0) + (vector+! (-> arg0 tail-pos) (-> s5-0 trans) s4-0) + ) + ) + ) + (if (logtest? (-> s5-0 status) (cshape-moving-flags t-surface)) + (go (method-of-object arg0 impact)) + ) + ) + 0 + (none) + ) + +;; definition for method 30 of type metalhead-shot +;; WARN: Return type mismatch int vs none. +(defmethod init-collision! metalhead-shot ((obj metalhead-shot)) + "Init the [[projectile]]'s [[collide-shape]]" + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) + (the-as (function control-info collide-query vector vector cshape-moving-flags) cshape-reaction-just-move) + ) + (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 penetrate-using) (penetrate enemy-yellow-shot)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec projectile)) + (set! (-> s4-0 prim-core collide-with) + (collide-spec backgnd jak bot crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list) + ) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 819.2) + (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 projectile)) + (set! (-> v1-13 prim-core collide-with) + (collide-spec backgnd jak bot crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list) + ) + (set! (-> v1-13 prim-core action) (collide-action solid deadly)) + (set-vector! (-> v1-13 local-sphere) 0.0 0.0 0.0 819.2) + ) + (let ((v1-15 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-15 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-15 prim-core collide-with) + (collide-spec jak bot crate civilian enemy vehicle-sphere hit-by-others-list player-list) + ) + (set! (-> v1-15 prim-core action) (collide-action deadly)) + (set-vector! (-> v1-15 local-sphere) 0.0 0.0 0.0 2457.6) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-18 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-18 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-18 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 1)) + (set! (-> s5-0 event-self) 'touched) + (set! (-> obj root-override) s5-0) + ) + (set! (-> obj root-override pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1) + ) + (none) + ) + +;; definition for method 31 of type metalhead-shot +;; INFO: Used lq/sq +(defmethod init-proj-settings! metalhead-shot ((obj metalhead-shot)) + "Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc + :virtual" + (set! (-> obj tail-pos quad) (-> obj root-override trans quad)) + (set! (-> obj attack-mode) 'metalhead-shot) + (set! (-> obj max-speed) 532480.0) + (set! (-> obj move) metalhead-shot-move) + (set! (-> obj timeout) (seconds 0.767)) + (set-gravity-length (-> obj root-override dynam) 573440.0) + (none) + ) + +;; definition for function spawn-metalhead-projectile +;; INFO: Used lq/sq +;; WARN: Return type mismatch (pointer process) vs (pointer metalhead-shot). +(defun spawn-metalhead-projectile ((arg0 metalhead-shot) (arg1 vector) (arg2 vector) (arg3 float)) + (let ((gp-0 (new 'stack-no-clear 'projectile-init-by-other-params))) + (let ((v1-1 (vector-! (new 'stack-no-clear 'vector) arg2 arg1))) + (set! (-> gp-0 ent) (-> arg0 entity)) + (set! (-> gp-0 charge) 1.0) + (set! (-> gp-0 options) (projectile-options)) + (set! (-> gp-0 notify-handle) (process->handle arg0)) + (set! (-> gp-0 owner-handle) (the-as handle #f)) + (set! (-> gp-0 ignore-handle) (process->handle arg0)) + (let* ((a0-10 *game-info*) + (a2-11 (+ (-> a0-10 attack-id) 1)) + ) + (set! (-> a0-10 attack-id) a2-11) + (set! (-> gp-0 attack-id) a2-11) + ) + (set! (-> gp-0 timeout) (new 'static 'handle :process #x4b0 :u64 #x4b0)) + (set! (-> gp-0 pos quad) (-> arg1 quad)) + (vector-normalize-copy! (-> gp-0 vel) v1-1 arg3) + ) + (the-as (pointer metalhead-shot) (spawn-projectile metalhead-shot gp-0 arg0 *default-dead-pool*)) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-metalhead-grenade-shot + :id 143 + :duration (seconds 0.5) + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 4) + :parts ((sp-item 637) (sp-item 638) (sp-item 639)) + ) + +;; failed to figure out what this is: +(defpart 637 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 3) (meters 1) 1.0) + (sp-flt spt-rot-x 409.6) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 64.0) + (sp-flt spt-fade-r -5.5) + (sp-flt spt-fade-g -51.0) + (sp-flt spt-fade-b -5.5) + (sp-flt spt-fade-a -8.533334) + (sp-int spt-timer 5) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow) + (sp-flt spt-userdata 409.6) + ) + ) + +;; failed to figure out what this is: +(defpart 638 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x1 :page #xade)) + (sp-flt spt-num 4.0) + (sp-rnd-flt spt-scale-x (meters 1) (meters 0.2) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 128.0) + (sp-flt spt-scalevel-x (meters -0.01)) + (sp-rnd-flt spt-rotvel-z (degrees -1.2) (degrees 1.2) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-r -1.375) + (sp-flt spt-fade-g -6.375) + (sp-flt spt-fade-b -1.375) + (sp-rnd-flt spt-fade-a -3.2 -3.2 1.0) + (sp-int spt-timer 40) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-conerot-radius (meters 0) (meters 0.2) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 639 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x1 :page #xade)) + (sp-rnd-flt spt-num 2.0 1.0 1.0) + (sp-rnd-flt spt-scale-x (meters 0.8) (meters 0.4) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.6) (meters 0.2) 1.0) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-rnd-flt spt-a 64.0 32.0 1.0) + (sp-rnd-flt spt-scalevel-x (meters -0.0026666666) (meters -0.0026666666) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-r -0.73333335) + (sp-flt spt-fade-g -3.4) + (sp-flt spt-fade-b -0.73333335) + (sp-rnd-flt spt-accel-y -1.3653333 -4.096 1.0) + (sp-int spt-timer 300) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-14) + (sp-int spt-next-time 75) + (sp-launcher-by-id spt-next-launcher 640) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-conerot-radius (meters 0) (meters 0.35) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 640 + :init-specs ((sp-flt spt-fade-r 0.0) + (sp-flt spt-fade-g 0.0) + (sp-flt spt-fade-b 0.0) + (sp-rnd-flt spt-fade-a -0.48 -0.48 1.0) + ) + ) + +;; definition of type metalhead-grenade-shot +(deftype metalhead-grenade-shot (projectile) + ((tumble-quat quaternion :inline :offset-assert 480) + (blast-radius float :offset-assert 496) + ) + :heap-base #x180 + :method-count-assert 40 + :size-assert #x1f4 + :flag-assert #x28018001f4 + ) + +;; definition for method 3 of type metalhead-grenade-shot +(defmethod inspect metalhead-grenade-shot ((obj metalhead-grenade-shot)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type projectile inspect))) + (t9-0 obj) + ) + (format #t "~2Ttumble-quat: #~%" (-> obj tumble-quat)) + (format #t "~2Tblast-radius: ~f~%" (-> obj blast-radius)) + (label cfg-4) + obj + ) + +;; definition for method 26 of type metalhead-grenade-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod spawn-shell-particles metalhead-grenade-shot ((obj metalhead-grenade-shot)) + "TODO - confirm" + (let ((gp-0 (get-process *default-dead-pool* part-tracker #x4000))) + (when gp-0 + (let ((t9-1 (method-of-type part-tracker activate))) + (t9-1 (the-as part-tracker gp-0) obj (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) + ) + (let ((t9-2 run-function-in-process) + (a0-3 gp-0) + (a1-2 part-tracker-init) + (a2-4 (-> *part-group-id-table* 76)) + (a3-1 0) + (t0-0 #f) + (t1-0 #f) + (t2-0 #f) + (t3-0 *launch-matrix*) + ) + (set! (-> t3-0 trans quad) (-> obj root-override trans quad)) + ((the-as (function object object object object object object object object none) t9-2) + a0-3 + a1-2 + a2-4 + a3-1 + t0-0 + t1-0 + t2-0 + t3-0 + ) + ) + (-> gp-0 ppointer) + ) + ) + 0 + (none) + ) + +;; definition for method 28 of type metalhead-grenade-shot +;; WARN: Return type mismatch int vs sound-id. +(defmethod play-impact-sound metalhead-grenade-shot ((obj metalhead-grenade-shot) (arg0 projectile-options)) + (case arg0 + (((projectile-options lose-altitude)) + (sound-play "gren-shot-hit") + ) + (((projectile-options lose-altitude proj-options-2)) + (sound-play "gren-missile" :id (-> obj sound-id) :position (-> obj root-override trans)) + ) + ) + (the-as sound-id 0) + ) + +;; failed to figure out what this is: +(defstate impact (metalhead-grenade-shot) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('touched) + (let* ((s4-0 proc) + (v1-1 (if (type? s4-0 process-drawable) + (the-as process-drawable s4-0) + ) + ) + ) + (when v1-1 + (let ((s4-1 (-> v1-1 root)) + (a1-3 (new 'stack 'collide-query)) + ) + 0.0 + (set! (-> a1-3 start-pos quad) (-> self root-override root-prim prim-core world-sphere quad)) + (vector-! + (-> a1-3 move-dist) + (the-as vector (-> (the-as collide-shape s4-1) root-prim prim-core)) + (-> a1-3 start-pos) + ) + (let ((v1-6 a1-3)) + (set! (-> v1-6 radius) 40.96) + (set! (-> v1-6 collide-with) (collide-spec backgnd)) + (set! (-> v1-6 ignore-process0) self) + (set! (-> v1-6 ignore-process1) (ppointer->process (-> self parent))) + (set! (-> v1-6 ignore-pat) (-> self root-override pat-ignore-mask)) + (set! (-> v1-6 action-mask) (collide-action solid)) + ) + (when (< (fill-and-probe-using-line-sphere *collide-cache* a1-3) 0.0) + (let ((a1-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-4 from) (process->ppointer self)) + (set! (-> a1-4 num-params) 2) + (set! (-> a1-4 message) 'attack) + (set! (-> a1-4 param 0) (-> event param 0)) + (let ((v1-13 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (set! (-> v1-13 id) (-> self attack-id)) + (set! (-> v1-13 mode) 'explode) + (set! (-> a1-4 param 1) (the-as uint v1-13)) + ) + (send-event-function proc a1-4) + ) + (let ((v1-15 (-> self notify-handle))) + (if (handle->process v1-15) + (send-event (-> v1-15 process 0) 'notify 'attack proc) + ) + ) + ) + ) + ) + ) + ) + ) + ) + :code (behavior () + (let ((v1-1 (-> self root-override root-prim))) + (set! (-> v1-1 local-sphere w) (-> self blast-radius)) + (set! (-> v1-1 prim-core world-sphere w) (-> self blast-radius)) + (set! (-> v1-1 prim-core collide-with) + (collide-spec jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list) + ) + (set! (-> v1-1 prim-core collide-as) (collide-spec enemy)) + ) + (collide-shape-method-46 (-> self root-override)) + (let ((a1-0 (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> a1-0 options) (overlaps-others-options)) + (set! (-> a1-0 collide-with-filter) (the-as collide-spec -1)) + (set! (-> a1-0 tlist) *touching-list*) + (find-overlapping-shapes (-> self root-override) a1-0) + ) + (suspend) + (let ((v1-9 (-> self root-override root-prim))) + (set! (-> v1-9 prim-core collide-as) (collide-spec)) + (set! (-> v1-9 prim-core collide-with) (collide-spec)) + ) + 0 + (while (-> self child) + (suspend) + ) + (deactivate self) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate dissipate (metalhead-grenade-shot) + :virtual #t + :enter (behavior () + (go-virtual impact) + (none) + ) + ) + +;; definition for method 25 of type metalhead-grenade-shot +;; WARN: Return type mismatch int vs none. +(defmethod spawn-impact-particles metalhead-grenade-shot ((obj metalhead-grenade-shot)) + "Spawns associated particles with the projectile if applicable" + (spawn (-> obj part) (-> obj root-override trans)) + 0 + (none) + ) + +;; definition for function gren-canister-move +;; WARN: Return type mismatch int vs none. +(defun gren-canister-move ((arg0 metalhead-grenade-shot)) + (quaternion*! (-> arg0 root-override quat) (-> arg0 root-override quat) (-> arg0 tumble-quat)) + (projectile-move-fill-all-dirs arg0) + (let ((s5-0 (new 'stack-no-clear 'water-info))) + (water-info-init! (-> arg0 root-override) s5-0 (collide-action solid semi-solid)) + (if (and (logtest? (-> s5-0 flags) (water-flags active)) (< (-> arg0 root-override trans y) (-> s5-0 trans y))) + (go (method-of-object arg0 impact)) + ) + ) + (if (logtest? (-> arg0 root-override status) (cshape-moving-flags t-surface)) + (go (method-of-object arg0 impact)) + ) + 0 + (none) + ) + +;; definition for function gren-cshape-reaction-canister +;; WARN: Return type mismatch int vs none. +(defun gren-cshape-reaction-canister ((arg0 collide-shape-moving) (arg1 metalhead-grenade-shot)) + (let ((s5-0 0)) + (let ((a1-1 (new 'stack-no-clear 'vector))) + (vector-float*! a1-1 (the-as vector (&-> arg1 starting-dir y)) (the-as float (-> arg1 connection-list prev0))) + (move-by-vector! arg0 a1-1) + ) + (let ((f30-0 (vector-dot (-> arg0 transv) (the-as vector (&-> arg1 next-state)))) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (vector-float*! s3-0 (the-as vector (&-> arg1 next-state)) (* f30-0 (rand-vu-float-range 1.6 2.2))) + (vector-! (-> arg0 transv) (-> arg0 transv) s3-0) + ) + (let ((v0-2 (logior s5-0 7))) + (logior! (-> arg0 status) v0-2) + ) + ) + (vector-float*! (-> arg0 transv) (-> arg0 transv) 0.88) + (none) + ) + +;; definition for method 30 of type metalhead-grenade-shot +;; WARN: Return type mismatch int vs none. +(defmethod init-collision! metalhead-grenade-shot ((obj metalhead-grenade-shot)) + "Init the [[projectile]]'s [[collide-shape]]" + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) + (the-as (function control-info collide-query vector vector cshape-moving-flags) gren-cshape-reaction-canister) + ) + (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 penetrate-using) (penetrate enemy-dark-shot)) + (let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-7 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-7 prim-core collide-with) + (collide-spec backgnd jak crate obstacle hit-by-others-list player-list pusher) + ) + (set! (-> v1-7 prim-core action) (collide-action solid)) + (set-vector! (-> v1-7 local-sphere) 0.0 0.0 0.0 1228.8) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-7) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-10 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-10 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-10 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 2)) + (set! (-> s5-0 event-self) 'touched) + (set! (-> obj root-override) s5-0) + ) + (set! (-> obj root-override pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1) + ) + (none) + ) + +;; definition for method 31 of type metalhead-grenade-shot +;; WARN: Return type mismatch sound-id vs none. +(defmethod init-proj-settings! metalhead-grenade-shot ((obj metalhead-grenade-shot)) + "Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc + :virtual" + (set! (-> obj attack-mode) 'eco-yellow) + (set! (-> obj blast-radius) 4096.0) + (set! (-> obj max-speed) 135168.0) + (set! (-> obj timeout) (seconds 4)) + (set! (-> obj update-velocity) projectile-update-velocity-add-gravity) + (set! (-> obj move) gren-canister-move) + (set! (-> obj root-override dynam gravity y) 102400.0) + (set! (-> obj root-override dynam gravity-length) 102400.0) + (set! (-> obj root-override dynam gravity-max) 102400.0) + (let ((f0-5 1092.2667)) + (quaternion-axis-angle! (-> obj tumble-quat) 1.0 0.0 0.0 f0-5) + ) + (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 143) obj)) + (set! (-> obj sound-id) (new-sound-id)) + (none) + ) + +;; definition for function spawn-metalhead-grenade +;; INFO: Used lq/sq +;; WARN: Return type mismatch (pointer process) vs (pointer metalhead-grenade-shot). +(defun spawn-metalhead-grenade ((arg0 metalhead-grenade-shot) (arg1 vector) (arg2 vector) (arg3 float)) + (let ((gp-0 (new 'stack-no-clear 'projectile-init-by-other-params))) + (let ((v1-1 (vector-! (new 'stack-no-clear 'vector) arg2 arg1))) + (set! (-> gp-0 ent) (-> arg0 entity)) + (set! (-> gp-0 charge) 1.0) + (set! (-> gp-0 options) (projectile-options)) + (set! (-> gp-0 notify-handle) (process->handle arg0)) + (set! (-> gp-0 owner-handle) (the-as handle #f)) + (set! (-> gp-0 ignore-handle) (process->handle arg0)) + (let* ((a0-10 *game-info*) + (a2-11 (+ (-> a0-10 attack-id) 1)) + ) + (set! (-> a0-10 attack-id) a2-11) + (set! (-> gp-0 attack-id) a2-11) + ) + (set! (-> gp-0 timeout) (new 'static 'handle :process #x4b0 :u64 #x4b0)) + (set! (-> gp-0 pos quad) (-> arg1 quad)) + (vector-normalize-copy! (-> gp-0 vel) v1-1 arg3) + ) + (the-as (pointer metalhead-grenade-shot) (spawn-projectile metalhead-shot gp-0 arg0 *default-dead-pool*)) + ) + ) + + + + diff --git a/test/decompiler/reference/jak2/levels/common/scene-actor_REF.gc b/test/decompiler/reference/jak2/levels/common/scene-actor_REF.gc index aa1cbb7f41..9fe7558cf0 100644 --- a/test/decompiler/reference/jak2/levels/common/scene-actor_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/scene-actor_REF.gc @@ -1,17 +1,21 @@ +;;-*-Lisp-*- (in-package goal) +;; failed to figure out what this is: (defskelgroup skel-scenecamera scenecamera 0 -1 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 4) :texture-level 6 ) +;; failed to figure out what this is: (defskelgroup skel-particleman particleman 0 -1 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 10) :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-jakone-highres jakone-highres 0 -1 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 3.2) @@ -21,6 +25,7 @@ :shadow-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-darkjak-highres darkjak-highres 0 -1 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 3.2) @@ -30,6 +35,7 @@ :shadow-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-jak-highres-prison jak-highres-prison 0 -1 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 3.2) @@ -40,6 +46,7 @@ :shadow-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-youngsamos-highres youngsamos-highres 0 3 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 3.2) @@ -47,6 +54,7 @@ :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-samos-highres samos-highres 0 3 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 3.2) @@ -54,6 +62,7 @@ :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-kor-highres kor-highres 0 3 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 3) @@ -61,6 +70,7 @@ :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-metalkor-highres metalkor-highres 0 3 ((1 (meters 999999))) :bounds (static-spherem 0 2 2 8) @@ -68,6 +78,7 @@ :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-metalkor-highres-lowtorso metalkor-highres 7 10 ((8 (meters 999999))) :bounds (static-spherem 0 -9 -12 22) @@ -75,6 +86,7 @@ :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-metalkor-highres-legs metalkor-highres 14 17 ((15 (meters 999999))) :bounds (static-spherem 0 -9 2 15) @@ -82,6 +94,7 @@ :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-metalkor-highres-wings metalkor-highres 21 24 ((22 (meters 999999))) :bounds (static-spherem 0 8 -5 20) @@ -89,6 +102,7 @@ :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-kor-transform kor-transform 0 3 ((1 (meters 999999))) :bounds (static-spherem 0 2 2 8) @@ -96,6 +110,7 @@ :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-kor-transform-monsterparts kor-transform 5 8 ((6 (meters 999999))) :bounds (static-spherem 0 -9 -12 22) @@ -103,6 +118,7 @@ :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-baron-highres baron-highres 0 3 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 3) @@ -110,6 +126,7 @@ :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-errol-highres errol-highres 0 3 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 3) @@ -117,6 +134,7 @@ :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-onin-highres onin-highres 0 3 ((1 (meters 200))) :bounds (static-spherem 0 0 0 5) @@ -124,6 +142,7 @@ :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-pecker-highres pecker-highres 0 3 ((1 (meters 200))) :bounds (static-spherem 0 0 0 5) @@ -131,6 +150,7 @@ :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-kid-highres kid-highres 0 3 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 3) @@ -139,6 +159,7 @@ :shadow-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-crocadog-highres crocadog-highres 0 3 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 3) @@ -146,6 +167,7 @@ :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-crimson-guard-highres crimson-guard-highres 0 -1 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 3) @@ -153,6 +175,7 @@ :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-crimson-guard-lowres crimson-guard-lowres 0 -1 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 3) @@ -160,6 +183,7 @@ :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-crimson-guard-hover crimson-guard-hover 0 -1 ((1 (meters 20)) (2 (meters 999999))) :bounds (static-spherem 0 0 0 7.5) @@ -167,12 +191,14 @@ :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-atoll-hellcat atoll-hellcat 0 4 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 8.5) :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-rift-rider rift-rider 0 4 ((1 (meters 999999))) :bounds (static-spherem 0 1.5 0 5) @@ -181,6 +207,7 @@ :shadow-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-torn-highres torn-highres 0 3 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 2.5) @@ -188,6 +215,7 @@ :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-sig-highres sig-highres 0 3 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 5) @@ -195,6 +223,7 @@ :origin-joint-index 30 ) +;; failed to figure out what this is: (defskelgroup skel-ashelin-highres ashelin-highres 0 3 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 5) @@ -203,6 +232,7 @@ :shadow-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-brutter-highres brutter-highres 0 4 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 5) @@ -211,12 +241,14 @@ :shadow-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-palmpilot palmpilot 0 -1 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 1.5) :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-krew-highres krew-highres 0 3 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 3) @@ -224,6 +256,7 @@ :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-tess-highres tess-highres 0 3 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 3) @@ -231,6 +264,7 @@ :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-keira-highres keira-highres 0 3 ((1 (meters 200))) :bounds (static-spherem 0 0 0 5) @@ -239,30 +273,35 @@ :shadow-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-sew-gold-key sew-gold-key 0 2 ((1 (meters 200))) :bounds (static-spherem 0 0 0 1) :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-life-seed life-seed 0 2 ((1 (meters 200))) :bounds (static-spherem 0 0 0 1) :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-grunt-fma grunt-fma 0 -1 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 10) :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-baron baron 0 2 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 3) :origin-joint-index 3 ) +;; definition of type kor-npc (deftype kor-npc (process-taskable) () :heap-base #xa0 @@ -271,6 +310,7 @@ :flag-assert #x2600a00120 ) +;; definition for method 3 of type kor-npc (defmethod inspect kor-npc ((obj kor-npc)) (when (not obj) (set! obj obj) @@ -283,6 +323,7 @@ obj ) +;; definition for method 35 of type kor-npc (defmethod get-art-elem kor-npc ((obj kor-npc)) "Checks various things such the current actor, task status, etc to determine the right art-group data to use @returns the appropriate [[art-element]] for the given NPC" @@ -296,7 +337,9 @@ ) ) -(defmethod init-skeleton! kor-npc ((obj kor-npc)) +;; definition for method 33 of type kor-npc +;; WARN: Return type mismatch int vs none. +(defmethod init-art! kor-npc ((obj kor-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -308,6 +351,7 @@ (none) ) +;; definition of type metalkor-highres (deftype metalkor-highres (process-drawable) () :heap-base #x50 @@ -319,6 +363,7 @@ ) ) +;; definition for method 3 of type metalkor-highres (defmethod inspect metalkor-highres ((obj metalkor-highres)) (when (not obj) (set! obj obj) @@ -331,6 +376,7 @@ obj ) +;; failed to figure out what this is: (defstate idle (metalkor-highres) :virtual #t :code (behavior () @@ -350,6 +396,8 @@ :post (the-as (function none :behavior metalkor-highres) ja-post) ) +;; definition for method 11 of type metalkor-highres +;; WARN: Return type mismatch object vs none. (defmethod init-from-entity! metalkor-highres ((obj metalkor-highres) (arg0 entity-actor)) (set! (-> obj root) (new 'process 'trsqv)) (process-drawable-from-entity! obj arg0) @@ -435,6 +483,7 @@ (none) ) +;; definition of type tess-npc (deftype tess-npc (process-taskable) () :heap-base #xa0 @@ -443,6 +492,7 @@ :flag-assert #x2600a00120 ) +;; definition for method 3 of type tess-npc (defmethod inspect tess-npc ((obj tess-npc)) (when (not obj) (set! obj obj) @@ -455,6 +505,7 @@ obj ) +;; definition for method 35 of type tess-npc (defmethod get-art-elem tess-npc ((obj tess-npc)) "Checks various things such the current actor, task status, etc to determine the right art-group data to use @returns the appropriate [[art-element]] for the given NPC" @@ -492,7 +543,9 @@ ) ) -(defmethod init-skeleton! tess-npc ((obj tess-npc)) +;; definition for method 33 of type tess-npc +;; WARN: Return type mismatch int vs none. +(defmethod init-art! tess-npc ((obj tess-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -504,6 +557,7 @@ (none) ) +;; definition of type keira-npc (deftype keira-npc (process-taskable) () :heap-base #xa0 @@ -512,6 +566,7 @@ :flag-assert #x2600a00120 ) +;; definition for method 3 of type keira-npc (defmethod inspect keira-npc ((obj keira-npc)) (when (not obj) (set! obj obj) @@ -524,6 +579,7 @@ obj ) +;; definition for method 35 of type keira-npc (defmethod get-art-elem keira-npc ((obj keira-npc)) "Checks various things such the current actor, task status, etc to determine the right art-group data to use @returns the appropriate [[art-element]] for the given NPC" @@ -537,7 +593,9 @@ ) ) -(defmethod init-skeleton! keira-npc ((obj keira-npc)) +;; definition for method 33 of type keira-npc +;; WARN: Return type mismatch int vs none. +(defmethod init-art! keira-npc ((obj keira-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -549,6 +607,7 @@ (none) ) +;; definition of type krew-npc (deftype krew-npc (process-taskable) () :heap-base #xa0 @@ -557,6 +616,7 @@ :flag-assert #x2600a00120 ) +;; definition for method 3 of type krew-npc (defmethod inspect krew-npc ((obj krew-npc)) (when (not obj) (set! obj obj) @@ -569,13 +629,16 @@ obj ) +;; definition for method 35 of type krew-npc (defmethod get-art-elem krew-npc ((obj krew-npc)) "Checks various things such the current actor, task status, etc to determine the right art-group data to use @returns the appropriate [[art-element]] for the given NPC" (-> obj draw art-group data 4) ) -(defmethod init-skeleton! krew-npc ((obj krew-npc)) +;; definition for method 33 of type krew-npc +;; WARN: Return type mismatch int vs none. +(defmethod init-art! krew-npc ((obj krew-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -587,6 +650,7 @@ (none) ) +;; definition of type kid-npc (deftype kid-npc (process-taskable) () :heap-base #xa0 @@ -595,6 +659,7 @@ :flag-assert #x2600a00120 ) +;; definition for method 3 of type kid-npc (defmethod inspect kid-npc ((obj kid-npc)) (when (not obj) (set! obj obj) @@ -607,7 +672,9 @@ obj ) -(defmethod init-skeleton! kid-npc ((obj kid-npc)) +;; definition for method 33 of type kid-npc +;; WARN: Return type mismatch int vs none. +(defmethod init-art! kid-npc ((obj kid-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -619,6 +686,7 @@ (none) ) +;; definition for method 35 of type kid-npc (defmethod get-art-elem kid-npc ((obj kid-npc)) "Checks various things such the current actor, task status, etc to determine the right art-group data to use @returns the appropriate [[art-element]] for the given NPC" @@ -638,6 +706,7 @@ ) ) +;; definition of type crocadog-npc (deftype crocadog-npc (process-taskable) () :heap-base #xa0 @@ -646,6 +715,7 @@ :flag-assert #x2600a00120 ) +;; definition for method 3 of type crocadog-npc (defmethod inspect crocadog-npc ((obj crocadog-npc)) (when (not obj) (set! obj obj) @@ -658,6 +728,7 @@ obj ) +;; definition for method 35 of type crocadog-npc (defmethod get-art-elem crocadog-npc ((obj crocadog-npc)) "Checks various things such the current actor, task status, etc to determine the right art-group data to use @returns the appropriate [[art-element]] for the given NPC" @@ -674,7 +745,9 @@ ) ) -(defmethod init-skeleton! crocadog-npc ((obj crocadog-npc)) +;; definition for method 33 of type crocadog-npc +;; WARN: Return type mismatch int vs none. +(defmethod init-art! crocadog-npc ((obj crocadog-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -686,6 +759,7 @@ (none) ) +;; definition of type torn-npc (deftype torn-npc (process-taskable) () :heap-base #xa0 @@ -694,6 +768,7 @@ :flag-assert #x2600a00120 ) +;; definition for method 3 of type torn-npc (defmethod inspect torn-npc ((obj torn-npc)) (when (not obj) (set! obj obj) @@ -706,7 +781,9 @@ obj ) -(defmethod init-skeleton! torn-npc ((obj torn-npc)) +;; definition for method 33 of type torn-npc +;; WARN: Return type mismatch int vs none. +(defmethod init-art! torn-npc ((obj torn-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -718,6 +795,7 @@ (none) ) +;; definition for method 35 of type torn-npc (defmethod get-art-elem torn-npc ((obj torn-npc)) "Checks various things such the current actor, task status, etc to determine the right art-group data to use @returns the appropriate [[art-element]] for the given NPC" @@ -734,6 +812,7 @@ ) ) +;; definition for method 20 of type torn-npc (defmethod get-trans torn-npc ((obj torn-npc) (arg0 int)) "@returns the `trans` [[vector]] from the process's `root` (typically either a [[trsqv]] or a [[collide-shape]])" (let ((v1-0 (-> obj root-override))) @@ -744,6 +823,7 @@ ) ) +;; definition of type youngsamos-npc (deftype youngsamos-npc (process-taskable) () :heap-base #xa0 @@ -752,6 +832,7 @@ :flag-assert #x2600a00120 ) +;; definition for method 3 of type youngsamos-npc (defmethod inspect youngsamos-npc ((obj youngsamos-npc)) (when (not obj) (set! obj obj) @@ -764,7 +845,9 @@ obj ) -(defmethod init-skeleton! youngsamos-npc ((obj youngsamos-npc)) +;; definition for method 33 of type youngsamos-npc +;; WARN: Return type mismatch int vs none. +(defmethod init-art! youngsamos-npc ((obj youngsamos-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -778,6 +861,8 @@ (none) ) +;; definition for method 32 of type youngsamos-npc +;; INFO: Used lq/sq (defmethod process-taskable-method-32 youngsamos-npc ((obj youngsamos-npc)) (case (-> obj task actor) (((game-task-actor youngsamos-forest)) @@ -805,6 +890,7 @@ (none) ) +;; definition for method 35 of type youngsamos-npc (defmethod get-art-elem youngsamos-npc ((obj youngsamos-npc)) "Checks various things such the current actor, task status, etc to determine the right art-group data to use @returns the appropriate [[art-element]] for the given NPC" @@ -833,6 +919,7 @@ ) ) +;; definition of type samos-npc (deftype samos-npc (process-taskable) () :heap-base #xa0 @@ -841,6 +928,7 @@ :flag-assert #x2600a00120 ) +;; definition for method 3 of type samos-npc (defmethod inspect samos-npc ((obj samos-npc)) (when (not obj) (set! obj obj) @@ -853,7 +941,9 @@ obj ) -(defmethod init-skeleton! samos-npc ((obj samos-npc)) +;; definition for method 33 of type samos-npc +;; WARN: Return type mismatch int vs none. +(defmethod init-art! samos-npc ((obj samos-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -865,6 +955,7 @@ (none) ) +;; definition for method 35 of type samos-npc (defmethod get-art-elem samos-npc ((obj samos-npc)) "Checks various things such the current actor, task status, etc to determine the right art-group data to use @returns the appropriate [[art-element]] for the given NPC" @@ -881,6 +972,7 @@ ) ) +;; definition of type onin-npc (deftype onin-npc (process-taskable) () :heap-base #xa0 @@ -889,6 +981,7 @@ :flag-assert #x2600a00120 ) +;; definition for method 3 of type onin-npc (defmethod inspect onin-npc ((obj onin-npc)) (when (not obj) (set! obj obj) @@ -901,7 +994,9 @@ obj ) -(defmethod init-skeleton! onin-npc ((obj onin-npc)) +;; definition for method 33 of type onin-npc +;; WARN: Return type mismatch int vs none. +(defmethod init-art! onin-npc ((obj onin-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -913,6 +1008,7 @@ (none) ) +;; definition for method 35 of type onin-npc (defmethod get-art-elem onin-npc ((obj onin-npc)) "Checks various things such the current actor, task status, etc to determine the right art-group data to use @returns the appropriate [[art-element]] for the given NPC" @@ -942,6 +1038,7 @@ ) ) +;; failed to figure out what this is: (defstate play-game (onin-npc) :virtual #t :code (behavior ((arg0 game-task-event)) @@ -963,6 +1060,7 @@ ) ) +;; definition of type pecker-npc (deftype pecker-npc (process-taskable) () :heap-base #xa0 @@ -971,6 +1069,7 @@ :flag-assert #x2600a00120 ) +;; definition for method 3 of type pecker-npc (defmethod inspect pecker-npc ((obj pecker-npc)) (when (not obj) (set! obj obj) @@ -983,7 +1082,9 @@ obj ) -(defmethod init-skeleton! pecker-npc ((obj pecker-npc)) +;; definition for method 33 of type pecker-npc +;; WARN: Return type mismatch int vs none. +(defmethod init-art! pecker-npc ((obj pecker-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -995,6 +1096,7 @@ (none) ) +;; definition for method 35 of type pecker-npc (defmethod get-art-elem pecker-npc ((obj pecker-npc)) "Checks various things such the current actor, task status, etc to determine the right art-group data to use @returns the appropriate [[art-element]] for the given NPC" @@ -1041,6 +1143,7 @@ ) ) +;; definition of type brutter-npc (deftype brutter-npc (process-taskable) () :heap-base #xa0 @@ -1049,6 +1152,7 @@ :flag-assert #x2600a00120 ) +;; definition for method 3 of type brutter-npc (defmethod inspect brutter-npc ((obj brutter-npc)) (when (not obj) (set! obj obj) @@ -1061,7 +1165,9 @@ obj ) -(defmethod init-skeleton! brutter-npc ((obj brutter-npc)) +;; definition for method 33 of type brutter-npc +;; WARN: Return type mismatch int vs none. +(defmethod init-art! brutter-npc ((obj brutter-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -1073,6 +1179,7 @@ (none) ) +;; definition of type ashelin-npc (deftype ashelin-npc (process-taskable) () :heap-base #xa0 @@ -1081,6 +1188,7 @@ :flag-assert #x2600a00120 ) +;; definition for method 3 of type ashelin-npc (defmethod inspect ashelin-npc ((obj ashelin-npc)) (when (not obj) (set! obj obj) @@ -1093,7 +1201,9 @@ obj ) -(defmethod init-skeleton! ashelin-npc ((obj ashelin-npc)) +;; definition for method 33 of type ashelin-npc +;; WARN: Return type mismatch int vs none. +(defmethod init-art! ashelin-npc ((obj ashelin-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -1105,6 +1215,7 @@ (none) ) +;; definition for method 35 of type ashelin-npc (defmethod get-art-elem ashelin-npc ((obj ashelin-npc)) "Checks various things such the current actor, task status, etc to determine the right art-group data to use @returns the appropriate [[art-element]] for the given NPC" @@ -1121,6 +1232,7 @@ (-> obj draw art-group data 3) ) +;; definition of type daxter-npc (deftype daxter-npc (process-taskable) () :heap-base #xa0 @@ -1129,6 +1241,7 @@ :flag-assert #x2600a00120 ) +;; definition for method 3 of type daxter-npc (defmethod inspect daxter-npc ((obj daxter-npc)) (when (not obj) (set! obj obj) @@ -1141,7 +1254,9 @@ obj ) -(defmethod init-skeleton! daxter-npc ((obj daxter-npc)) +;; definition for method 33 of type daxter-npc +;; WARN: Return type mismatch int vs none. +(defmethod init-art! daxter-npc ((obj daxter-npc)) "@see [[initialize-skeleton]]" (initialize-skeleton obj @@ -1153,90 +1268,106 @@ (none) ) +;; definition for method 35 of type daxter-npc (defmethod get-art-elem daxter-npc ((obj daxter-npc)) "Checks various things such the current actor, task status, etc to determine the right art-group data to use @returns the appropriate [[art-element]] for the given NPC" (-> obj draw art-group data 3) ) +;; failed to figure out what this is: (defskelgroup skel-prsn-torture prsn-torture 0 2 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 20) :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-tomb-boss-bridge-a tomb-boss-bridge 0 2 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 17) :origin-joint-index 30 ) +;; failed to figure out what this is: (defskelgroup skel-tomb-boss-bridge-b tomb-boss-bridge 6 8 ((7 (meters 999999))) :bounds (static-spherem 0 0 0 17) :origin-joint-index 31 ) +;; failed to figure out what this is: (defskelgroup skel-time-map time-map 0 -1 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 2) :origin-joint-index 20 ) +;; failed to figure out what this is: (defskelgroup skel-precursor-stone precursor-stone 0 -1 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 2) :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-seal-of-mar seal-of-mar 0 -1 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 10) :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-talk-box talk-box 0 2 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 2) :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-rift-ring rift-ring 0 -1 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 60) :origin-joint-index 6 ) +;; failed to figure out what this is: (defskelgroup skel-mtn-shard mtn-shard 0 2 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 0.5) :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-mtn-lens mtn-lens 0 2 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 0.5) :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-mtn-gear-device-gear mtn-gear-device-gear 0 2 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 0.5) :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-heart-of-mar heart-of-mar 0 2 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 2) :origin-joint-index 3 ) +;; failed to figure out what this is: (defskelgroup skel-gun-upgrade-a gun-upgrade-a 0 -1 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 1) :origin-joint-index 3 ) +;; definition for function intro-play +;; WARN: Return type mismatch int vs none. (defun intro-play () "A dedicated function for playing the intro cutscenes in the correct order ```opengoal @@ -1255,6 +1386,8 @@ (none) ) +;; definition for function outro-play +;; WARN: Return type mismatch int vs none. (defun outro-play () "A dedicated function for playing the intro cutscenes in the correct order ```opengoal diff --git a/test/offline/config/jak2/config.jsonc b/test/offline/config/jak2/config.jsonc index fbc27f7416..f5c992ec4c 100644 --- a/test/offline/config/jak2/config.jsonc +++ b/test/offline/config/jak2/config.jsonc @@ -7,7 +7,8 @@ "DGO/CWI.DGO", "DGO/STD.DGO", "DGO/PALOUT.DGO", - "DGO/CTA.DGO" + "DGO/CTA.DGO", + "DGO/FOR.DGO" ], "skip_compile_files": [],