diff --git a/.gitignore b/.gitignore index 906aec3455..e5568db9e5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ # for clion cmake-build-debug/* +cmake-build-debug--o0/* .idea/* build/* decompiler_out/* diff --git a/decompiler/Function/Warnings.h b/decompiler/Function/Warnings.h index 92426b73d1..0e4ef69dce 100644 --- a/decompiler/Function/Warnings.h +++ b/decompiler/Function/Warnings.h @@ -1,4 +1,5 @@ #pragma once +#include #include #include #include @@ -52,6 +53,12 @@ class DecompWarnings { bool has_warnings() const { return !m_warnings.empty(); } + bool has_errors() const { + return !m_warnings.empty() && + std::any_of(m_warnings.begin(), m_warnings.end(), + [](const Warning& warn) { return warn.warning_kind == Warning::Kind::ERR; }); + } + std::string get_warning_text(bool as_comment) const { std::string result; for (auto& w : m_warnings) { diff --git a/decompiler/IR2/AtomicOpForm.cpp b/decompiler/IR2/AtomicOpForm.cpp index a022f968d8..b3c53a6916 100644 --- a/decompiler/IR2/AtomicOpForm.cpp +++ b/decompiler/IR2/AtomicOpForm.cpp @@ -475,6 +475,10 @@ FormElement* StoreOp::get_as_form(FormPool& pool, const Env& env) const { } } } + // print warning about failed store, but only if decompilation passes without any major errors + if (!env.func->warnings.has_errors()) { + env.func->warnings.warning("Failed store: {} at op {}", to_string(env), m_my_idx); + } return pool.alloc_element(this); } @@ -733,6 +737,9 @@ Form* LoadVarOp::get_load_src(FormPool& pool, const Env& env) const { // LoadSourceElement::update_from_stack, which needs expressions) auto source = pool.alloc_single_element_form(nullptr, m_src, m_my_idx); + if (!env.func->warnings.has_errors()) { + env.func->warnings.warning("Failed load: {} at op {}", to_string(env), m_my_idx); + } return pool.alloc_single_element_form(nullptr, source, m_size, m_kind, ro, input_type); } @@ -746,6 +753,9 @@ Form* LoadVarOp::get_load_src(FormPool& pool, const Env& env) const { } auto source = pool.alloc_single_element_form(nullptr, m_src, m_my_idx); + if (!env.func->warnings.has_errors()) { + env.func->warnings.warning("Failed load: {} at op {}", to_string(env), m_my_idx); + } return pool.alloc_single_element_form( nullptr, source, m_size, m_kind, std::optional{}, TP_Type()); } diff --git a/decompiler/IR2/Form.cpp b/decompiler/IR2/Form.cpp index b6884aa6e4..2482b6f20d 100644 --- a/decompiler/IR2/Form.cpp +++ b/decompiler/IR2/Form.cpp @@ -3014,8 +3014,8 @@ goos::Object DefskelgroupElement::to_form_internal(const Env& env) const { std::vector forms; forms.push_back(pretty_print::to_symbol("defskelgroup")); forms.push_back(pretty_print::to_symbol(m_name)); - forms.push_back(pretty_print::to_symbol(m_static_info.art_name)); - const auto& art = env.dts->art_group_info.find(m_static_info.art_name + "-ag"); + forms.push_back(pretty_print::to_symbol(m_static_info.art_group_name)); + const auto& art = env.dts->art_group_info.find(m_static_info.art_group_name + "-ag"); bool has_art = art != env.dts->art_group_info.end(); auto jg = m_info.jgeo->to_form(env); if (jg.is_int() && has_art && art->second.count(jg.as_int())) { @@ -3069,8 +3069,29 @@ goos::Object DefskelgroupElement::to_form_internal(const Env& env) const { if (m_static_info.sort != 0) { forms.push_back(pretty_print::to_symbol(fmt::format(":sort {}", m_static_info.sort))); } - if (m_static_info.version != 6) { - forms.push_back(pretty_print::to_symbol(fmt::format(":version {}", m_static_info.version))); + // jak 2 skelgroups seem to be using version 7 + if (env.version != GameVersion::Jak1) { + if (m_static_info.version != 7) { + forms.push_back(pretty_print::to_symbol(fmt::format(":version {}", m_static_info.version))); + } + } else { + if (m_static_info.version != 6) { + forms.push_back(pretty_print::to_symbol(fmt::format(":version {}", m_static_info.version))); + } + } + if (env.version != GameVersion::Jak1) { + if (m_static_info.origin_joint_index != 0) { + forms.push_back(pretty_print::to_symbol( + fmt::format(":origin-joint-index {}", m_static_info.origin_joint_index))); + } + if (m_static_info.shadow_joint_index != 0) { + forms.push_back(pretty_print::to_symbol( + fmt::format(":shadow-joint-index {}", m_static_info.origin_joint_index))); + } + if (m_static_info.light_index != 0) { + forms.push_back(pretty_print::to_symbol( + fmt::format(":light-index {}", m_static_info.origin_joint_index))); + } } return pretty_print::build_list(forms); diff --git a/decompiler/IR2/Form.h b/decompiler/IR2/Form.h index 7775e9f4c8..9bffbd7a41 100644 --- a/decompiler/IR2/Form.h +++ b/decompiler/IR2/Form.h @@ -1676,7 +1676,8 @@ class DefstateElement : public FormElement { class DefskelgroupElement : public FormElement { public: struct StaticInfo { - std::string art_name; + std::string name; // jak 2 + std::string art_group_name; math::Vector4f bounds; int max_lod; float longest_edge; @@ -1684,6 +1685,9 @@ class DefskelgroupElement : public FormElement { s8 version; s8 shadow; s8 sort; + s8 origin_joint_index; + s8 shadow_joint_index; + s8 light_index; }; struct Entry { Form* mgeo = nullptr; diff --git a/decompiler/analysis/find_skelgroups.cpp b/decompiler/analysis/find_skelgroups.cpp index 324adaaf51..b7436dae8f 100644 --- a/decompiler/analysis/find_skelgroups.cpp +++ b/decompiler/analysis/find_skelgroups.cpp @@ -66,9 +66,9 @@ DefskelgroupElement::StaticInfo inspect_skel_group_data(DecompiledDataElement* s } auto& string_word = words.at(start_word_idx); if (string_word.kind() != LinkedWord::PTR) { - env.func->warnings.error_and_throw("Reference to skelgroup bad: invalid name label"); + env.func->warnings.error_and_throw("Reference to skelgroup bad: invalid art-group-name label"); } - result.art_name = env.file->get_goal_string_by_label( + result.art_group_name = env.file->get_goal_string_by_label( env.file->get_label_by_name(env.file->get_label_name(string_word.label_id()))); for (int i = 0; i < 4; i++) { auto& word = words.at(start_word_idx + 3 + i); @@ -106,6 +106,109 @@ DefskelgroupElement::StaticInfo inspect_skel_group_data(DecompiledDataElement* s return result; } +static const std::vector empty_words_jak2 = {2, 4, 5, 6, 8, 9, 10, 15, + 16, 17, 19, 20, 21, 22, 23, 24}; +DefskelgroupElement::StaticInfo inspect_skel_group_data_jak2(DecompiledDataElement* skel, + const Env& env) { + DefskelgroupElement::StaticInfo result; + + auto lab = skel->label(); + // example from "crates" + /* + .type skeleton-group + L30: + .symbol #f // info // 4 + .word L263 // name (string) // 8 + .word 0x0 // length // 12 + .symbol #f // extra // 16 + .word 0x0 // ? (word 4) // 20 + .word 0x0 // ? (word 5) // 24 + .word 0x0 // ? (word 6) // 28 + .word L262 // art-group-name (string) // 32 + .word 0x0 // jgeo // 36 + .word 0x0 // janim // 40 + .word 0x0 // ? (word 10) // 44 + .word 0x0 // bounds x // 48 + .word 0x45800000 // bounds y // 52 + .word 0x0 // bounds z // 56 + .word 0x45cccccd // bounds w/radius // 60 + .word 0x0 // mgeo 0/1 // 64 + .word 0x0 // mgeo 2/3 // 68 + .word 0x0 // mgeo 4/5 // 72 + .word 0x1 // max-lod // 76 + .word 0x0 // lod-dist 0 // 80 + .word 0x0 // lod-dist 1 // 84 + .word 0x0 // lod-dist 2 // 88 + .word 0x0 // lod-dist 3 // 92 + .word 0x0 // lod-dist 4 // 96 + .word 0x0 // lod-dist 5 // 100 + .word 0x0 // longest-edge // 104 + .word 0x706 // texture-level/version/shadow/sort // 108 + .word 0x0 // origin-joint-index/shadow-joint-index/light-index/pad // 112 + */ + + int start_word_idx = lab.offset / 4; + auto& words = env.file->words_by_seg.at(lab.target_segment); + + auto& type_word = words.at(start_word_idx - 1); + if (type_word.kind() != LinkedWord::TYPE_PTR || type_word.symbol_name() != "skeleton-group") { + env.func->warnings.error_and_throw("Reference to skelgroup bad: invalid type pointer"); + } + auto& name_word = words.at(start_word_idx + 1); + if (name_word.kind() != LinkedWord::PTR) { + env.func->warnings.error_and_throw("Reference to skelgroup bad: invalid name label"); + } + result.name = env.file->get_goal_string_by_label( + env.file->get_label_by_name(env.file->get_label_name(name_word.label_id()))); + auto& art_name_word = words.at(start_word_idx + 7); + if (art_name_word.kind() != LinkedWord::PTR) { + env.func->warnings.error_and_throw("Reference to skelgroup bad: invalid art-group-name label"); + } + result.art_group_name = env.file->get_goal_string_by_label( + env.file->get_label_by_name(env.file->get_label_name(art_name_word.label_id()))); + for (int i = 0; i < 4; i++) { + auto& word = words.at(start_word_idx + 11 + i); + if (word.kind() != LinkedWord::PLAIN_DATA) { + env.func->warnings.error_and_throw("Reference to skelgroup bad: invalid bounds"); + } + result.bounds[i] = *reinterpret_cast(&word.data); + } + auto& lod_word = words.at(start_word_idx + 18); + if (lod_word.kind() != LinkedWord::PLAIN_DATA) { + env.func->warnings.error_and_throw("Reference to skelgroup bad: invalid max-lod"); + } + result.max_lod = lod_word.data; + auto& edge_word = words.at(start_word_idx + 25); + if (edge_word.kind() != LinkedWord::PLAIN_DATA) { + env.func->warnings.error_and_throw("Reference to skelgroup bad: invalid longest-edge"); + } + result.longest_edge = *reinterpret_cast(&edge_word.data); + auto& other_word = words.at(start_word_idx + 26); + if (other_word.kind() != LinkedWord::PLAIN_DATA) { + env.func->warnings.error_and_throw("Reference to skelgroup bad: invalid other data"); + } + result.tex_level = other_word.get_byte(0); + result.version = other_word.get_byte(1); + result.shadow = other_word.get_byte(2); + result.sort = other_word.get_byte(3); + auto& index_word = words.at(start_word_idx + 27); + if (index_word.kind() != LinkedWord::PLAIN_DATA) { + env.func->warnings.error_and_throw("Reference to skelgroup bad: invalid index data"); + } + result.origin_joint_index = index_word.get_byte(0); + result.shadow_joint_index = index_word.get_byte(1); + result.light_index = index_word.get_byte(2); + + for (auto i : empty_words_jak2) { + auto& word = words.at(start_word_idx + i); + if (word.data != LinkedWord::PLAIN_DATA || word.data != 0) { + env.func->warnings.error_and_throw(fmt::format("Reference to skelgroup bad: set word {}", i)); + } + } + + return result; +} + DefskelgroupElement::Info get_defskelgroup_entries(Form* body, const Env& env, const RegisterAccess& let_dest_var) { @@ -177,8 +280,12 @@ FormElement* rewrite_defskelgroup(LetElement* elt, auto rest_info = get_defskelgroup_entries(elt->body(), env, elt->entries().at(0).dest); - return pool.alloc_element(get_skelgroup_name(elt->body()->back(), env), - rest_info, skelgroup_info); + if (env.version != GameVersion::Jak1) { + return pool.alloc_element(skelgroup_info.name, rest_info, skelgroup_info); + } else { + return pool.alloc_element(get_skelgroup_name(elt->body()->back(), env), + rest_info, skelgroup_info); + } } } // namespace @@ -210,7 +317,12 @@ void run_defskelgroups(Function& top_level_func) { auto src_as_label = as_let->entries().at(0).src->try_as_element(); if (src_as_label && env.get_variable_type(as_let->entries().at(0).dest, false) == TypeSpec("skeleton-group")) { - auto sg = inspect_skel_group_data(src_as_label, env); + DefskelgroupElement::StaticInfo sg; + if (env.version != GameVersion::Jak1) { + sg = inspect_skel_group_data_jak2(src_as_label, env); + } else { + sg = inspect_skel_group_data(src_as_label, env); + } auto rewritten = rewrite_defskelgroup(as_let, env, sg, pool); if (rewritten) { fe = rewritten; diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index 9a8375696e..8a7e742e7f 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -4735,7 +4735,7 @@ (deftype spool-anim (basic) ((name string :offset 16) ;; guessed by decompiler (anim-name basic :offset-assert 20) - (buffer external-art-buffer :offset 20 :score 10) ;; added + (buffer external-art-buffer :offset 20 :score -1) ;; added (parts int32 :offset-assert 24) (hint-id int32 :offset 24) (priority float :offset-assert 28) @@ -5170,7 +5170,8 @@ ) (deftype texture-anim-array (array) - () + ((array-data texture-anim :dynamic :inline :offset-assert 16) + ) :method-count-assert 11 :size-assert #x10 :flag-assert #xb00000010 @@ -8624,9 +8625,9 @@ (deftype region (structure) ((id uint32 :offset-assert 0) - (on-enter basic :offset-assert 4) - (on-inside basic :offset-assert 8) - (on-exit basic :offset-assert 12) + (on-enter pair :offset-assert 4) + (on-inside pair :offset-assert 8) + (on-exit pair :offset-assert 12) ) :method-count-assert 10 :size-assert #x10 @@ -10533,7 +10534,7 @@ :flag-assert #xb00000038 (:methods (set-height! (_type_ float) none 9) - (ocean-map-method-10 () none 10) + (ocean-map-method-10 (_type_) float 10) ) ) @@ -13429,7 +13430,7 @@ (effect effect-control) (interp-select int64 2) (top-anim top-anim-joint-control) - (override basic) + (override (array float)) (channel joint-control-channel :inline :dynamic) ) :method-count-assert 12 @@ -13438,7 +13439,7 @@ ;; Failed to read fields. (:methods (new (symbol type int) _type_ 0) - (joint-control-method-9 () none 9) ;; (current-cycle-distance (_type_) float 9) + (current-cycle-distance (_type_) float 9) (joint-control-method-10 (_type_) none 10) (debug-print-channels (_type_ symbol) int 11) ) @@ -14666,6 +14667,7 @@ (sf31 31) ) +(declare-type carry-info basic) (declare-type rigid-body-control basic) (deftype process-drawable (process) ((root trsqv :offset-assert 128) ;; guessed by decompiler @@ -14681,7 +14683,7 @@ (part sparticle-launch-control :offset-assert 168) ;; guessed by decompiler (water water-control :offset-assert 172) ;; guessed by decompiler (sound ambient-sound :offset-assert 176) ;; guessed by decompiler - (carry basic :offset-assert 180) + (carry carry-info :offset-assert 180) (rbody rigid-body-control :offset-assert 184) (state-flags state-flags :offset-assert 188) ;; guessed by decompiler (state-time time-frame :offset-assert 192) ;; time-frame @@ -14691,7 +14693,7 @@ :flag-assert #x14005000c8 (:methods (initialize-skeleton (_type_ skeleton-group pair) none 14) - (initialize-skeleton-by-name (_type_ string object) draw-control 15) + (initialize-skeleton-by-name (_type_ string) draw-control 15) (apply-alignment (_type_ align-opts transformq vector) object 16) (process-drawable-method-17 () none 17) ;; (do-joint-math! (_type_) none 17) (process-drawable-method-18 () none 18) ;; (cleanup-for-death (_type_) none 18) @@ -14905,6 +14907,8 @@ (test 22) ;; hi 64 ) +(declare-type touching-shapes-entry structure) + (deftype attack-info (structure) ((trans vector :inline) (vector vector :inline) @@ -14936,9 +14940,9 @@ :flag-assert #xc000000a0 ;; Failed to read fields. (:methods - (attack-info-method-9 () none 9) ;; (combine! (_type_ attack-info) none 9) - (attack-info-method-10 () none 10) - (attack-info-method-11 () none 11) + (attack-info-method-9 (_type_ attack-info process-drawable process-drawable) none 9) + (attack-info-method-10 (_type_ object process-drawable process touching-shapes-entry) attack-info 10) + (combine! (_type_ attack-info process-drawable) attack-info 11) ) ) @@ -16063,6 +16067,7 @@ ;; ---collide-shape-h:nav-flags (declare-type collide-query structure) +(declare-type water-info structure) (deftype collide-shape (trsqv) ((actor-hash-index int16 :offset 12) (process process-drawable :offset-assert 140) @@ -16109,11 +16114,11 @@ (collide-shape-method-46 (_type_) none 46) ;; (set-root-prim! (_type_ collide-shape-prim) collide-shape-prim 46) (collide-shape-method-47 () none 47) ;; (update-transforms! (_type_) symbol 47) (collide-shape-method-48 () none 48) ;; (clear-collide-with-as (_type_) none 48) - (collide-shape-method-49 () none 49) ;; (restore-collide-with-as (_type_) none 49) + (collide-shape-method-49 (_type_ int int int) none 49) ;; (restore-collide-with-as (_type_) none 49) (collide-shape-method-50 () none 50) ;; (backup-collide-with-as (_type_) none 50) (collide-shape-method-51 () none 51) ;; (set-root-prim-collide-with! (_type_ collide-kind) none 51) - (collide-shape-method-52 () none 52) ;; (set-root-prim-collide-as! (_type_ collide-kind) none 52) - (collide-shape-method-53 () none 53) ;; (set-collide-kinds (_type_ int collide-kind collide-kind) none 53) + (water-info-init! "Initialize a [[water-info]] with the currently loaded regions." (_type_ water-info collide-action) water-info 52) ;; (set-root-prim-collide-as! (_type_ collide-kind) none 52) + (collide-shape-method-53 (_type_) none 53) ;; (set-collide-kinds (_type_ int collide-kind collide-kind) none 53) (collide-shape-method-54 (_type_) none 54) ;; (set-collide-offense (_type_ int collide-offense) none 54) ) ) @@ -16227,7 +16232,7 @@ (:methods (new (symbol type process-drawable collide-list-enum) _type_ 0) (collide-shape-moving-method-55 (_type_ collide-query collide-spec float float float) symbol 55) - (collide-shape-moving-method-56 () none 56) ;; (set-and-handle-pat! (_type_ pat-surface) none 56) + (collide-shape-moving-method-56 (_type_ pat-surface) none 56) ;; (set-and-handle-pat! (_type_ pat-surface) none 56) (collide-shape-moving-method-57 () none 57) ;; (integrate-no-collide! (_type_ vector) none 57) (collide-shape-moving-method-58 () none 58) ;; (dummy-58 (_type_ vector) symbol 58) (collide-shape-moving-method-59 () none 59) ;; (integrate-for-enemy-with-move-to-ground! (_type_ vector collide-kind float symbol symbol symbol) none 59) @@ -16314,7 +16319,7 @@ (duration uint64 :offset-assert 224) ;; time-frame (linger-duration uint64 :offset-assert 232) ;; time-frame (start-time time-frame :offset-assert 240) ;; time-frame - (target uint64 :offset-assert 248) ;; handle + (target handle :offset-assert 248) ;; handle (target-joint int32 :offset-assert 256) (offset vector :inline :offset-assert 272) (userdata uint64 :offset-assert 288) @@ -16534,7 +16539,7 @@ ) (deftype combo-tracker (point-tracker) - ((target handle :offset-assert 32) + ((target handle :offset-assert 32) (move-start-time time-frame :offset-assert 40) ) :method-count-assert 14 @@ -16542,7 +16547,7 @@ :flag-assert #xe00000030 (:methods (combo-tracker-method-12 (_type_ vector vector process time-frame) combo-tracker 12) - (combo-tracker-method-13 (_type_ handle vector float vector float) none 13) + (combo-tracker-method-13 (_type_ handle vector float vector float) basic 13) ) ) @@ -16606,6 +16611,7 @@ (unknown-quaternion01 quaternion :inline :offset 544) ;; logic-target::reset-target-state (unknown-float04 float :offset 560) ;; logic-target::reset-target-state (unknown-float05 float :offset 564) ;; logic-target::target-print-stats + (unknown-float003 float :offset 568) ;; (anon-function 22 target-gun) (unknown-float06 float :offset 572) ;; logic-target::do-rotations2 (unknown-float07 float :offset 576) ;; logic-target::add-thrust (unknown-time-frame00 time-frame :offset 584) ;; logic-target::do-rotations2 @@ -16619,6 +16625,7 @@ (unknown-vector05 vector :inline :offset 3744) ;; logic-target::target-no-ja-move-post (unknown-vector06 vector :inline :offset 3760) ;; target::mod-var-jump (unknown-vector07 vector :inline :offset 3776) ;; logic-target::target-no-ja-move-post + (unknown-vector000 vector :inline :offset 3792) ;; target-handler::target-exit (unknown-dynamics00 dynamics :offset 3824) ;; logic-target::reset-target-state (unknown-surface00 surface :offset 3828) ;; logic-target::target-print-stats (unknown-surface01 surface :offset 3832) ;; board-h::want-to-board? @@ -16661,6 +16668,7 @@ (unknown-vector22 vector :inline :offset 4560) ;; logic-target::target-update-ik (unknown-vector23 vector :inline :offset 4576) ;; logic-target::flag-setup (unknown-time-frame05 time-frame :offset 4624) ;; board-h::want-to-board? + (unknown-float0000 float :offset 4632) ;; target-util::can-duck? (unknown-float17 float :offset 4636) ;; logic-target::target-print-stats (unknown-float18 float :offset 4640) ;; logic-target::target-print-stats (unknown-float19 float :offset 4644) ;; logic-target::target-compute-slopes @@ -16671,6 +16679,7 @@ (unknown-pat-surface00 pat-surface :offset 4680) ;; logic-target::target-print-stats (unknown-vector24 vector :inline :offset 4688) ;; logic-target::add-thrust (unknown-vector25 vector :inline :offset 4720) ;; logic-target::wall-hide? + (unknown-vector001 vector :inline :offset 4736) ;; target2::target-bonk-event-handler (unknown-handle00 handle :offset 4768) ;; logic-target::reset-target-state (unknown-pat-surface01 pat-surface :offset 4776) ;; logic-target::target-print-stats (unknown-float22 float :offset 4780) ;; logic-target::target-compute-slopes @@ -16678,6 +16687,8 @@ (unknown-float24 float :offset 4788) ;; logic-target::target-compute-slopes (unknown-float25 float :offset 4792) ;; logic-target::target-compute-slopes (unknown-float26 float :offset 4796) ;; logic-target::target-compute-slopes + (unknown-word000 int32 :offset 4800) ;; (anon-function 16 target-darkjak) + (unknown-float002 float :offset 4804) ;; target-gun::target-gun-joint-pre (unknown-time-frame08 time-frame :offset 4816) ;; logic-target::turn-around? (unknown-vector26 vector :inline :offset 4928) ;; logic-target::target-add-slide-factor (unknwon-vector27 vector :inline :offset 4976) ;; logic-target::add-thrust @@ -16687,7 +16698,9 @@ (unknown-word02 int32 :offset 5064) ;; (enter target-roll) (unknown-time-frame10 time-frame :offset 5072) ;; (exit target-roll) (unknown-time-frame11 time-frame :offset 5080) ;; (trans target-slide-down-to-ground) + (unknown-time-frame001 time-frame :offset 5088) ;; target-util::target-danger-set! (unknown-time-frame12 time-frame :offset 5096) ;; (exit target-attack) + (unknown-time-frame002 time-frame :offset 5104) ;; target-util::can-feet? (unknown-time-frame13 time-frame :offset 5112) ;; (exit target-slide-down) (unknown-time-frame14 time-frame :offset 5120) ;; (trans target-stance) (unknown-float28 float :offset 5132) ;; logic-target::target-print-stats @@ -16706,11 +16719,13 @@ (unknown-float32 float :offset 5520) ;; logic-target::turn-around? (unknown-word03 int32 :offset 5524) ;; logic-target::turn-around? (unknown-float33 float :offset 5528) ;; logic-target::target-compute-pole + (unknown-symbol000 symbol :offset 5532) ;; (code target-edge-grab) (unknown-vector34 vector :inline :offset 5536) ;; logic-target::target-compute-pole (unknown-vector35 vector :inline :offset 5552) ;; target-board::target-board-compute-edge (unknown-vector36 vector :inline :offset 5568) ;; logic-target::target-compute-pole (unknown-time-frame15 time-frame :offset 5584) ;; logic-target::target-compute-edge (unknown-time-frame16 time-frame :offset 5592) ;; logic-target::target-compute-edge + (unknown-handle000 handle :offset 5600) ;; (code target-edge-grab) (unknown-handle01 handle :offset 5608) ;; logic-target::reset-target-state (unknown-word04 uint32 :offset 5616) (unknown-spool-anim00 spool-anim :offset 5616) ;; (code target-board-get-on) @@ -16741,8 +16756,11 @@ (unknown-time-frame20 time-frame :offset 5944) ;; board-h::want-to-board? (unknown-symbol04 symbol :offset 5984) ;; target-board-spin-check (unknown-symbol05 symbol :offset 5988) ;; target-board::target-board-handler + (unknown-attack-id00 int32 :offset 5992) ;; target-handler::target-attacked + (unknown-float40 float :offset 5996) ;; target-util::target-danger-set! (unknown-dword05 uint64 :offset 6000) ;; target-board::target-board-handler - (unknown-dword06 uint64 :offset 6008) ;; (method 28 target) + (unknown-dword06 handle :offset 6008) ;; (method 28 target) + (unknown-time-frame000 time-frame :offset 6016) ;; target-handler::target-send-attack (unknown-combo-tracker00 combo-tracker :inline :offset 6032) ;; (enter target-running-attack) (unknown-time-frame21 time-frame :offset 6072) ;; (code target-running-attack) (unknown-dword07 int64 :offset 6096) ;; (enter target-double-jump) @@ -16752,8 +16770,8 @@ (unknown-symbol06 symbol :offset 6144) ;; logic-target::post-flag-setup (unknown-quaternion04 quaternion :inline :offset 6160) ;; (enter target-attack) (unknown-sound-id01 sound-id :offset 6176) ;; (code target-attack) - (unknown-float40 float :offset 6180) ;; (enter target-attack) - (unknown-float41 float :offset 6184) ;; (enter target-attack) + (unknown-float41 float :offset 6180) ;; (enter target-attack) + (unknown-float42 float :offset 6184) ;; (enter target-attack) (unknown-halfword00 uint16 :offset 6188) ;; logic-target::target-no-move-post (history-length uint16 :offset 6190) ;; logic-target::draw-history (unknown-word07 int32 :offset 6192) ;; logic-target::target-real-post @@ -16761,19 +16779,21 @@ (unknown-time-frame23 time-frame :offset 6208) ;; logic-target::post-flag-setup (unknown-time-frame24 time-frame :offset 6216) ;; logic-target::post-flag-setup (unknown-time-frame25 time-frame :offset 6224) ;; logic-target::post-flag-setup - (unknown-float42 float :offset 6232) ;; (event target-flop) + (unknown-float43 float :offset 6232) ;; (event target-flop) + (unknown-float001 float :offset 6236) ;; target-swim::target-swim-tilt (unknown-sound-id02 sound-id :offset 6240) ;; (method 28 target) (unknown-sound-id03 sound-id :offset 6244) ;; (method 28 target) (unknown-time-frame26 time-frame :offset 6248) ;; logic-target::target-calc-camera-pos (unknown-time-frame27 time-frame :offset 6256) ;; logic-target::target-calc-camera-pos (unknown-dword11 int64 :offset 6264) ;; logic-target::reset-target-state (unknown-vector44 vector :inline :offset 6272) ;; (code target-roll-flip) - (unknown-float43 float :offset 6288) ;; (code target-roll-flip) + (unknown-float44 float :offset 6288) ;; (code target-roll-flip) (unknown-sound-id04 sound-id :offset 6292) ;; (method 28 target) + (unknown-float45 float :offset 6296) ;; powerups::target-powerup-process (unknown-word08 int32 :offset 6300) ;; (method 28 target) - (unknown-word09 int32 :offset 6304) ;; (method 28 target) - (unknown-word10 int32 :offset 6308) ;; (method 28 target) - (unknown-word11 int32 :offset 6312) ;; (method 28 target) + (unknown-sphere000 sphere :offset 6304) ;; (method 28 target) + (unknown-word09 int32 :offset 6308) ;; (method 28 target) + (unknown-word10 uint32 :offset 6312) ;; (method 28 target) (unknown-time-frame28 time-frame :offset 6320) ;; logic-target::flag-setup (unknown-time-frame29 time-frame :offset 6328) ;; logic-target::flag-setup (unknown-dword12 int64 :offset 6336) ;; logic-target::flag-setup @@ -16852,7 +16872,7 @@ (get-head (_type_) touching-prims-entry 9) ;; (dummy-9 (_type_) none 9) (get-next (_type_ touching-shapes-entry) touching-prims-entry 10) ;; (get-touched-shape (_type_ collide-shape) collide-shape 10) (touching-shapes-entry-method-11 () none 11) ;; (dummy-11 () none 11) - (touching-shapes-entry-method-12 (_type_ collide-shape uint) touching-prims-entry 12) ;; (prims-touching? (_type_ collide-shape-moving uint) touching-prims-entry 12) + (prims-touching? (_type_ collide-shape uint) touching-prims-entry 12) ;; (prims-touching? (_type_ collide-shape-moving uint) touching-prims-entry 12) (touching-shapes-entry-method-13 (_type_ collide-shape uint uint) basic 13) ;; (prims-touching-action? (_type_ collide-shape collide-action collide-action) touching-prims-entry 13) (touching-shapes-entry-method-14 () none 14) ;; (dummy-14 () none 14) ) @@ -17116,8 +17136,8 @@ (_type_ int) vector 20) (get-quat (_type_ int) quaternion 21) (get-transv (_type_) vector 22) - (process-focusable-method-23 (_type_) none 23) - (process-focusable-method-24 (_type_) float 24) + (process-focusable-method-23 (_type_ int) int 23) + (get-water-height (_type_) meters 24) (process-focusable-method-25 (_type_) time-frame 25) (process-focusable-method-26 (_type_) float 26) ) @@ -17536,7 +17556,7 @@ (projectile-method-28 () none 28) ;; (dummy-28 (_type_) none 28) (projectile-method-29 () none 29) (projectile-method-30 () none 30) - (projectile-method-31 () none 31) + (projectile-method-31 (_type_) none 31) (projectile-method-32 () none 32) (projectile-method-33 () none 33) (projectile-method-34 () none 34) @@ -17605,7 +17625,7 @@ (deftype target (process-focusable) ((control control-info :score 1 :offset 128) ;; guessed by decompiler - (skel2 basic :offset-assert 204) + (skel2 joint-control :offset-assert 204) (shadow-backup shadow-geo :offset-assert 208) (target-flags uint32 :offset 188) (game game-info :offset-assert 212) ;; guessed by decompiler @@ -17640,7 +17660,7 @@ (excitement float :offset-assert 2052) (shock-effect-time time-frame :offset-assert 2056) (beard? symbol :offset-assert 2064) - (spool-anim symbol :offset-assert 2068) + (spool-anim spool-anim :offset-assert 2068) (ambient-time time-frame :offset-assert 2072) (fp-hud handle :offset-assert 2080) ;; handle (no-load-wait uint64 :offset-assert 2088) ;; time-frame @@ -18134,7 +18154,7 @@ (solid-only symbol :offset 120) (best-dist float :offset 112 :score -1) (best-other-prim basic :offset 116) - (best-my-prim basic :offset 120) + (best-my-prim collide-shape-prim :offset 120 :score 1) (move-vec vector :inline :offset 224) (best-u float :offset 112 :score -1) (action-mask collide-action :offset-assert 352) @@ -19700,6 +19720,7 @@ (launch-asap 3) (bit6 6) (bit7 7) + (bit8 8) ) (defenum sp-launch-state-flags @@ -23875,7 +23896,7 @@ (define-extern set-fog-height! (function float none)) (define-extern set-cloud-minmax! (function float float none)) (define-extern *darkjak-texture-anim-array* texture-anim-array) -;; (define-extern set-darkjak-texture-morph! function) +(define-extern set-darkjak-texture-morph! (function float none)) (define-extern *skull-gem-texture-anim-array* texture-anim-array) (define-extern *waterfall-texture-anim-array* texture-anim-array) (define-extern *waterfall-b-texture-anim-array* texture-anim-array) @@ -26163,8 +26184,8 @@ ;; (define-extern find-ground-point function) ;; (function control-info vector float float vector) ;; (define-extern target-attack-up function) ;; (function target symbol symbol none) -;; (define-extern collide-shape-moving-angle-set! function) ;; (function collide-shape-moving vector vector none) -;; (define-extern cshape-reaction-update-state function) +(define-extern collide-shape-moving-angle-set! (function collide-shape-moving vector vector none)) +(define-extern cshape-reaction-update-state (function collide-shape-moving collide-query vector none)) (define-extern cshape-reaction-default (function control-info collide-query vector vector cshape-moving-flags)) ;; (define-extern cshape-reaction-just-move function) (define-extern collide-shape-draw-debug-marks (function none)) @@ -26306,7 +26327,6 @@ ;; water-flow ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype flow-section (structure) ((start vector :inline :offset-assert 0) (trailing plane :inline :offset-assert 16) @@ -26317,42 +26337,36 @@ :size-assert #x40 :flag-assert #x900000040 ) -|# -#| (deftype flow-section-array (inline-array-class) - ((length int32 :offset-assert 4) - (allocated-length int32 :offset-assert 8) - (data UNKNOWN :dynamic :offset-assert 16) + ((data flow-section :dynamic :offset-assert 16) ) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype flow-control (basic) - ((path basic :offset-assert 4) - (speed float :offset-assert 8) - (belt-radius float :offset-assert 12) - (sections basic :offset-assert 16) - (leading plane :inline :offset-assert 32) - (collide-bounds sphere :inline :offset-assert 48) + ((path path-control :offset-assert 4) + (speed float :offset-assert 8) + (belt-radius float :offset-assert 12) + (sections flow-section-array :offset-assert 16) + (leading plane :inline :offset-assert 32) + (collide-bounds sphere :inline :offset-assert 48) ) :method-count-assert 13 :size-assert #x40 :flag-assert #xd00000040 (:methods - (flow-control-method-9 () none 9) + (new (symbol type process-drawable res-lump) _type_ 0) + (draw-path (_type_) none 9) (flow-control-method-10 () none 10) (flow-control-method-11 () none 11) (flow-control-method-12 () none 12) ) ) -|# -;; (define-extern ray-plane-equation-intersect function) +(define-extern ray-plane-equation-intersect (function vector vector vector vector float)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; water-h ;; @@ -26396,14 +26410,14 @@ ) (deftype water-info (structure) - ((trans vector :inline :offset-assert 0) - (normal vector :inline :offset-assert 16) - (base-height meters :offset-assert 32) - (depth meters :offset-assert 36) - (handle uint64 :offset-assert 40) - (flags water-flags :offset-assert 48) - (prim basic :offset-assert 52) - (extra-flags uint32 :offset-assert 56) + ((trans vector :inline :offset-assert 0) + (normal vector :inline :offset-assert 16) + (base-height meters :offset-assert 32) + (depth meters :offset-assert 36) + (handle handle :offset-assert 40) + (flags water-flags :offset-assert 48) + (prim drawable-region-prim :offset-assert 52) + (extra-flags uint32 :offset-assert 56) ) :method-count-assert 9 :size-assert #x3c @@ -26412,7 +26426,7 @@ (deftype water-control (basic) ((flags water-flags :offset-assert 4) - (process process-hidden :offset-assert 8) + (process target :offset-assert 8) (joint-index int32 :offset-assert 12) (top-y-offset float :offset-assert 16) (attack-id uint32 :offset-assert 20) @@ -26436,7 +26450,7 @@ (align-offset meters :offset 104) (swim-depth meters :offset 108) (bob smush-control :inline :offset 112) - (ripple int64 :offset 144) + (ripple handle :offset 144) (ripple-size meters :offset 152) (wake-size meters :offset 156) (bottom vector 2 :inline :offset 160) @@ -26456,14 +26470,14 @@ :flag-assert #x1100000128 (:methods (new (symbol type process int float float float) _type_ 0) - (water-control-method-9 () none 9) ;; (dummy-9 (_type_) none 9) - (water-control-method-10 () none 10) ;; (dummy-10 (_type_) none 10) - (water-control-method-11 () none 11) ;; (start-bobbing! (_type_ float int int) none 11) + (water-control-method-9 (_type_) none 9) + (water-control-method-10 (_type_) none 10) + (start-bobbing! (_type_ float int int) none 11) (distance-from-surface (_type_) float 12) - (water-control-method-13 (_type_ float vector int vector symbol) none 13) ;; (dummy-13 (_type_ float vector int vector) none 13) + (spawn-ripples (_type_ float vector int vector symbol) none 13) (display-water-marks? (_type_) symbol 14) - (water-control-method-15 () none 15) ;; (TODO-RENAME-15 (_type_) none 15) - (water-control-method-16 () none 16) ;; (TODO-RENAME-16 (_type_) none 16) + (enter-water (_type_) none 15) + (water-control-method-16 (_type_) none 16) ) ) @@ -27184,9 +27198,9 @@ (define-extern sleep-code (function symbol)) ;; (define-extern transform-and-sleep function) ;; (define-extern transform-and-sleep-code function) -(define-extern transform-post (function int :behavior process-drawable)) ;; -(define-extern rider-trans (function none :behavior process-drawable)) ;; -(define-extern rider-post (function none :behavior process-drawable)) ;; +(define-extern transform-post (function int :behavior process-drawable)) +(define-extern rider-trans (function none :behavior process-drawable)) +(define-extern rider-post (function none :behavior process-drawable)) ;; (define-extern pusher-post function) ;; (function int :behavior process-drawable) ;; (define-extern process-drawable-delay-player function) ;; (function time-frame int :behavior process-drawable) ;; (define-extern process-drawable-fuel-cell-handler function) ;; (function process int symbol event-message-block none :behavior process-drawable) @@ -27366,8 +27380,8 @@ (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 process-drawable-random-point! function) ;; (function process-drawable vector vector) -;; (define-extern process-drawable-pair-random-point! function) ;; (function process-drawable process-drawable vector float vector) +(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)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; lightning ;; @@ -27419,37 +27433,38 @@ ) (deftype carry-info (basic) - ((process (pointer target) :offset-assert 4) - (pickup-time time-frame :offset-assert 8) - (other-value float :offset-assert 16) - (other int64 :offset-assert 24) - (point vector :inline :offset-assert 32) - (normal vector :inline :offset-assert 48) - (max-angle degrees :offset-assert 64) - (max-distance meters :offset-assert 68) - (max-pull meters :offset-assert 72) - (min-pull meters :offset-assert 76) - (grab-trans-blend float :offset-assert 80) - (carry-radius meters :offset-assert 84) - (backup-radius meters :offset-assert 88) - (joint int8 :offset-assert 92) - (mode carry-mode :offset-assert 93) - (face-dir int8 :offset-assert 94) - (local-point vector :inline :offset-assert 96) - (local-normal vector :inline :offset-assert 112) - (grab-quat vector :inline :offset-assert 128) - (grab-trans vector :inline :offset-assert 144) - (hold-trans vector :inline :offset-assert 160) + ((process (pointer process-drawable) :offset-assert 4) + (pickup-time time-frame :offset-assert 8) + (other-value float :offset-assert 16) + (other handle :offset-assert 24) + (point vector :inline :offset-assert 32) + (normal vector :inline :offset-assert 48) + (max-angle degrees :offset-assert 64) + (max-distance meters :offset-assert 68) + (max-pull meters :offset-assert 72) + (min-pull meters :offset-assert 76) + (grab-trans-blend float :offset-assert 80) + (carry-radius meters :offset-assert 84) + (backup-radius meters :offset-assert 88) + (joint int8 :offset-assert 92) + (mode carry-mode :offset-assert 93) + (face-dir int8 :offset-assert 94) + (local-point vector :inline :offset-assert 96) + (local-normal vector :inline :offset-assert 112) + (grab-quat vector :inline :offset-assert 128) + (grab-trans vector :inline :offset-assert 144) + (hold-trans vector :inline :offset-assert 160) ) :method-count-assert 17 :size-assert #xb0 :flag-assert #x11000000b0 (:methods - (carry-info-method-9 () none 9) + (new (symbol type process-drawable int vector vector float) _type_ 0) + (carry-info-method-9 (_type_) int 9) (carry-info-method-10 () none 10) (carry-info-method-11 () none 11) (carry-info-method-12 (_type_) none 12) - (carry-info-method-13 () none 13) + (carry-info-method-13 (_type_) none 13) (carry-info-method-14 () none 14) (carry-info-method-15 (_type_) none 15) (carry-info-method-16 () none 16) @@ -27610,7 +27625,7 @@ (charge-ammo float :offset-assert 672) (charge-start-time time-frame :offset-assert 680) (charge-inc-time time-frame :offset-assert 688) - (charge-active? uint64 :offset-assert 696) + (charge-active? handle :offset-assert 696) ) :method-count-assert 10 :size-assert #x2c0 @@ -27854,25 +27869,25 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (deftype darkjak-info (basic) - ((process uint32 :offset-assert 4) - (attack-id uint32 :offset-assert 8) - (start-time time-frame :offset-assert 16) - (attack-time time-frame :offset-assert 24) - (attack-count uint64 :offset-assert 32) - (stage uint32 :offset-assert 40) - (want-stage uint32 :offset-assert 44) - (clock-pos float :offset-assert 48) - (clock-vel float :offset-assert 52) - (clock-on symbol :offset-assert 56) - (hud handle 1 :offset 64) - (tone uint32 :offset 72) - (bomb uint32 :offset 76) + ((process (pointer target) :offset-assert 4) + (attack-id uint32 :offset-assert 8) + (start-time time-frame :offset-assert 16) + (attack-time time-frame :offset-assert 24) + (attack-count uint64 :offset-assert 32) + (stage uint32 :offset-assert 40) + (want-stage uint32 :offset-assert 44) + (clock-pos float :offset-assert 48) + (clock-vel float :offset-assert 52) + (clock-on symbol :offset-assert 56) + (hud handle 1 :offset 64) + (tone uint32 :offset 72) + (bomb uint32 :offset 76) ) :method-count-assert 10 :size-assert #x50 :flag-assert #xa00000050 (:methods - (darkjak-info-method-9 (_type_ int) none :behavior target 9) + (update-clock! (_type_ int) none :behavior target 9) ) ) @@ -27993,11 +28008,11 @@ (define-extern *target-shadow-control* shadow-control) (define-extern *TARGET-bank* target-bank) (define-extern target-start-attack (function none :behavior target)) -(define-extern target-danger-set! (function symbol symbol float :behavior target)) +(define-extern target-danger-set! (function symbol symbol none :behavior target)) (define-extern target-collide-set! (function symbol float int :behavior target)) (define-extern debounce-speed (function float float vector vector float :behavior target)) (define-extern target-align-vel-z-adjust (function float float :behavior target)) -;; (define-extern average-turn-angle function) ;; (function target float) +(define-extern average-turn-angle (function target float)) (define-extern can-play-stance-amibent? (function symbol :behavior target)) (define-extern target-height-above-ground (function float :behavior target)) (define-extern can-jump? (function symbol symbol :behavior target)) @@ -28005,28 +28020,28 @@ (define-extern move-legs? (function symbol :behavior target)) (define-extern jump-hit-ground-stuck? (function symbol :behavior target)) (define-extern target-time-to-ground (function time-frame :behavior target)) -(define-extern fall-test (function state float none :behavior target)) +(define-extern fall-test (function (state symbol target) float none :behavior target)) (define-extern slide-down-test (function none :behavior target)) (define-extern smack-surface? (function symbol symbol :behavior target)) (define-extern can-roll? (function symbol :behavior target)) (define-extern can-duck? (function symbol :behavior target)) -(define-extern can-exit-duck? (function symbol :behavior target)) ;; (function symbol :behavior target) +(define-extern can-exit-duck? (function target symbol)) (define-extern can-hands? (function symbol symbol :behavior target)) (define-extern can-feet? (function symbol symbol :behavior target)) (define-extern are-still? (function symbol :behavior target)) -;; (define-extern vector-local+! function) ;; (function vector vector vector :behavior target) -;; (define-extern move-forward function) ;; (function float vector :behavior target) +(define-extern vector-local+! (function vector vector vector :behavior target)) +(define-extern move-forward (function float vector :behavior target)) (define-extern set-forward-vel (function float vector :behavior target)) (define-extern delete-back-vel (function none :behavior target)) -;; (define-extern set-side-vel function) ;; (function float vector :behavior target) -(define-extern target-timed-invulnerable (function time-frame target none)) +(define-extern set-side-vel (function float vector :behavior target)) +(define-extern target-timed-invulnerable (function time-frame target int none)) (define-extern target-timed-invulnerable-off (function target int none)) -;; (define-extern target-log-attack function) -(define-extern ground-tween-initialize (function ground-tween-info uint uint uint uint uint uint ground-tween-info :behavior target)) -(define-extern ground-tween-update (function ground-tween-info float float none :behavior target)) +(define-extern target-log-attack (function attack-info symbol symbol :behavior target)) +(define-extern ground-tween-initialize (function ground-tween-info uint uint uint uint uint uint float ground-tween-info :behavior target)) +(define-extern ground-tween-update (function ground-tween-info float float float none :behavior target)) (define-extern target-pos (function int vector)) -;; (define-extern target-cam-pos function) ;; (function vector) -;; (define-extern target-rot function) ;; (function quaternion) +(define-extern target-cam-pos (function vector)) +(define-extern target-rot (function quaternion)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; target-part ;; @@ -28041,8 +28056,8 @@ ;; (define-extern process-drawable-burn-effect function) ;; (function time-frame none :behavior target) (define-extern lightning-probe-callback (function lightning-tracker none)) (define-extern process-drawable-shock-effect (function process-drawable lightning-spec (function lightning-tracker none) sparticle-launcher int int float object)) ;; guess -;; (define-extern process-drawable-shock-wall-effect function) -;; (define-extern process-drawable2-shock-effect function) +(define-extern process-drawable-shock-wall-effect (function process-drawable lightning-spec (function lightning-tracker none) sparticle-launcher int int float none)) +(define-extern process-drawable2-shock-effect (function process-drawable lightning-spec (function lightning-tracker none) sparticle-launcher int int float none)) ;; (define-extern process-drawable-shock-skel-effect function) (define-extern *lightning-darkjak-pill* lightning-spec) @@ -28131,7 +28146,7 @@ ;; (define-extern cspace<-cspace+transformq! function) (define-extern target-sidekick-setup (function symbol none :behavior target)) ;; (define-extern sidekick-clone state) ;; (state sidekick) -;; (define-extern init-sidekick function) ;; (function none :behavior sidekick) +(define-extern init-sidekick (function none :behavior sidekick)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; voicebox ;; @@ -28340,9 +28355,9 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-extern target-shoved (function meters meters process (state object object target) object :behavior target)) -;; (define-extern attack-mode-is-invinc function) +(define-extern attack-mode-is-invinc (function symbol symbol)) (define-extern target-attacked (function symbol attack-info process process (state symbol attack-info target) object :behavior target)) -(define-extern target-send-attack (function process uint uint int int symbol :behavior target)) +(define-extern target-send-attack (function process uint uint int int uint symbol :behavior target)) (define-extern target-generic-event-handler (function process int symbol event-message-block object :behavior target)) ;; (function process int symbol event-message-block object :behavior target) (define-extern target-standard-event-handler (function process int symbol event-message-block object :behavior target)) (define-extern target-dangerous-event-handler (function process int symbol event-message-block object :behavior target)) @@ -28359,14 +28374,14 @@ ;; (define-extern target-land-anim function) (define-extern target-stance-anim (function none :behavior target)) -;; (define-extern target-stance-push function) +(define-extern target-stance-push (function none :behavior target)) (define-extern target-falling-anim (function int time-frame symbol :behavior target)) -;; (define-extern target-falling-anim-trans function) ;; (function none :behavior target) +(define-extern target-falling-anim-trans (function none :behavior target)) (define-extern target-walk-anim (function int none :behavior target)) ;; (define-extern target-hit-ground-flop-anim function) (define-extern target-hit-ground-anim (function symbol symbol :behavior target)) (define-extern target-attack-air-anim (function none :behavior target)) -;; (define-extern target-edge-grab-anim function) +(define-extern target-edge-grab-anim (function none :behavior target)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; target ;; @@ -28419,29 +28434,29 @@ ;; target2 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *trip-mods* object) -;; (define-extern target-load-wait state) ;; (state target) -;; (define-extern target-stance-ambient state) ;; (state target) -;; (define-extern target-stance-look-around state) ;; (state target) -;; (define-extern *look-around-mods* object) -;; (define-extern target-look-around state) ;; (state target) -(define-extern target-grab (state target)) -;; (define-extern target-pole-cycle state) ;; (state handle target) -;; (define-extern target-pole-flip-up state) ;; (state object object float target) -;; (define-extern target-pole-flip-up-jump state) ;; (state float float target) -;; (define-extern target-pole-flip-forward state) ;; (state float float float target) -;; (define-extern target-pole-flip-forward-jump state) ;; (state float float target) -;; (define-extern target-edge-grab state) ;; (state target) -;; (define-extern target-edge-grab-jump state) ;; (state float float target) -;; (define-extern target-edge-grab-off state) ;; (state target) -;; (define-extern *hit-ground-hard-mods* object) +(define-extern *trip-mods* surface) +(define-extern target-load-wait (state target)) +(define-extern target-stance-ambient (state target)) +(define-extern target-stance-look-around (state target)) +(define-extern *look-around-mods* surface) +(define-extern target-look-around (state target)) +(define-extern target-grab (state symbol target)) +(define-extern target-pole-cycle (state handle target)) +(define-extern target-pole-flip-up (state object object float target)) +(define-extern target-pole-flip-up-jump (state float float target)) +(define-extern target-pole-flip-forward (state float float float target)) +(define-extern target-pole-flip-forward-jump (state float float target)) +(define-extern target-edge-grab (state target)) +(define-extern target-edge-grab-jump (state float float target)) +(define-extern target-edge-grab-off (state target)) +(define-extern *hit-ground-hard-mods* surface) (define-extern target-hit-ground-hard (state float target)) -;; (define-extern *hide-mods* surface) +(define-extern *hide-mods* surface) (define-extern target-hide (state target)) (define-extern target-launch (state float symbol vector int target)) -;; (define-extern target-play-anim state) ;; (state string handle target) +(define-extern target-play-anim (state string handle target)) (define-extern target-clone-anim (state handle target)) -;; (define-extern *float-mods* object) +(define-extern *float-mods* surface) (define-extern target-float (state target)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -28450,13 +28465,13 @@ (define-extern target-wade-stance (state target)) (define-extern target-wade-walk (state target)) -;; (define-extern target-swim-tilt function) ;; (function float float float float float :behavior target) +(define-extern target-swim-tilt (function float float float float float :behavior target)) (define-extern target-swim-stance (state target)) (define-extern target-swim-walk (state target)) (define-extern target-swim-down (state target)) (define-extern target-swim-up (state target)) -;; (define-extern target-swim-jump-jump state) ;; (state float float surface target) -;; (define-extern target-swim-jump state) ;; (state float float target) +(define-extern target-swim-jump-jump (state float float surface target)) +(define-extern target-swim-jump (state float float target)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; target-carry ;; @@ -28481,17 +28496,17 @@ (define-extern target-darkjak-setup (function symbol none :behavior target)) (define-extern want-to-darkjak? (function symbol :behavior target)) -;; (define-extern *darkjak-trans-mods* object) -;; (define-extern target-darkjak-end-mode function) -;; (define-extern target-darkjak-process function) +(define-extern *darkjak-trans-mods* surface) +(define-extern target-darkjak-end-mode (function none :behavior target)) +(define-extern target-darkjak-process (function object object object object object object float none :behavior target)) ;; only arg6 used (define-extern target-darkjak-get-on (state int target)) -;; (define-extern target-darkjak-get-off state) +(define-extern target-darkjak-get-off (state target)) (define-extern target-darkjak-running-attack (state target)) -;; (define-extern target-darkjak-bomb-collide function) +(define-extern target-darkjak-bomb-collide (function float float none :behavior target)) (define-extern target-darkjak-bomb0 (state target)) -;; (define-extern target-bomb1-fire-shot function) -(define-extern target-darkjak-bomb1 (state target)) -;; (define-extern target-darkjak-giant state) +(define-extern target-bomb1-fire-shot (function (pointer handle) int int int none :behavior target)) +(define-extern target-darkjak-bomb1 (state float float target)) +(define-extern target-darkjak-giant (state target)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; target-death ;; @@ -28536,28 +28551,28 @@ ;; (define-extern *kernel-packages* object) ;; pair (define-extern *gun-walk-mods* surface) -;; (define-extern target-gun-event-handler function) +(define-extern target-gun-event-handler (function process int symbol event-message-block object :behavior target)) (define-extern target-gun-setup (function symbol none :behavior target)) -;; (define-extern target-gun-init function) -;; (define-extern target-gun-exit function) +(define-extern target-gun-init (function int none :behavior target)) +(define-extern target-gun-exit (function symbol)) (define-extern target-gun-end-mode (function symbol symbol :behavior target)) -;; (define-extern quat<-gun! function) -;; (define-extern target-gun-ammo-out-pick function) -;; (define-extern target-gun-type-set! function) -;; (define-extern target-gun-marking-menu function) -;; (define-extern target-gun-build-track-list function) -;; (define-extern target-gun-find-track function) +(define-extern quat<-gun! (function quaternion quaternion quaternion)) +(define-extern target-gun-ammo-out-pick (function int :behavior target)) +(define-extern target-gun-type-set! (function int none :behavior target)) +(define-extern target-gun-marking-menu (function target none)) +(define-extern target-gun-build-track-list (function none :behavior target)) +(define-extern target-gun-find-track (function none :behavior target)) (define-extern target-top-anim-base-mode (function int none :behavior target)) -;; (define-extern target-gun-combo-start function) +(define-extern target-gun-combo-start (function int time-frame none :behavior target)) (define-extern target-gun-joint-pre0 (function none :behavior target)) (define-extern target-gun-joint-pre (function none :behavior target)) (define-extern target-gun-compute-pos (function matrix :behavior target)) (define-extern target-gun-joint-points (function none :behavior target)) -;; (define-extern target-gun-fire function) +(define-extern target-gun-fire (function pickup-type none :behavior target)) (define-extern target-gun-check (function none :behavior target)) -;; (define-extern camera-rotate-to-vector function) -;; (define-extern target-gun-real-post function) -;; (define-extern target-gun-post function) +(define-extern camera-rotate-to-vector (function vector vector none)) +(define-extern target-gun-real-post (function none :behavior target)) +(define-extern target-gun-post (function none :behavior target)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; gun-util ;; @@ -28641,7 +28656,7 @@ ) |# -;; (define-extern target-gun-fire-blue function) +(define-extern target-gun-fire-blue (function none :behavior target)) ;; (define-extern gun-blue-shot-move function) ;; (define-extern cshape-reaction-blue-shot function) @@ -28698,7 +28713,7 @@ ) |# -;; (define-extern target-gun-fire-red function) +(define-extern target-gun-fire-red (function none :behavior target)) ;; (define-extern gun-red-shot-event-handler function) ;; (define-extern gun-red-shot-init-by-other function) @@ -28731,7 +28746,7 @@ ) |# -;; (define-extern target-gun-fire-dark function) +(define-extern target-gun-fire-dark (function none :behavior target)) ;; (define-extern process-drawable-shock-effect-bullseye function) ;; (define-extern gun-dark-shot-init-fizzle function) @@ -28805,7 +28820,7 @@ (define-extern target-board-anim-trans (function none :behavior target)) (define-extern target-board-spin-check (function none :behavior target)) (define-extern target-board-halfpipe-trans (function none :behavior target)) -(define-extern target-board-resolve-points (function float float float float none :behavior target)) ;; only arg3 used? +(define-extern target-board-resolve-points (function none :behavior target)) (define-extern target-board-ground-check (function none :behavior target)) (define-extern target-board-halfpipe-check (function collide-action :behavior target)) (define-extern target-board-jump-trans (function none :behavior target)) @@ -28829,7 +28844,7 @@ (define-extern target-board-get-off (state object symbol target)) ;; unused arg0 (define-extern target-board-grab (state symbol target)) (define-extern target-board-clone-anim (state handle target)) -(define-extern target-board-hit (state vector target)) +(define-extern target-board-hit (state vector attack-info target)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; mech-h ;; @@ -29507,15 +29522,15 @@ ;; water ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern check-water-level-drop function) ;; (function sparticle-system sparticle-cpuinfo vector none) -;; (define-extern check-water-level-drop-and-die function) ;; (function sparticle-system sparticle-cpuinfo vector none) -;; (define-extern check-water-level-drop-and-die-motion function) -;; (define-extern check-water-level-above-and-die function) ;; (function sparticle-system sparticle-cpuinfo vector none) -;; (define-extern check-water-level-drop-motion function) -;; (define-extern part-water-splash-callback function) ;; (function part-tracker none) -;; (define-extern splash-spawn function) ;; (function basic basic int none) -;; (define-extern rings-water-spawn function) -;; (define-extern water-info<-region function) +(define-extern check-water-level-drop (function sparticle-system sparticle-cpuinfo vector none)) +(define-extern check-water-level-drop-and-die (function sparticle-system sparticle-cpuinfo vector none)) +(define-extern check-water-level-drop-and-die-motion (function sparticle-system sparticle-cpuinfo vector none)) +(define-extern check-water-level-above-and-die (function sparticle-system sparticle-cpuinfo vector none)) +(define-extern check-water-level-drop-motion (function sparticle-system sparticle-cpuinfo vector none)) +(define-extern part-water-splash-callback (function part-tracker none)) +(define-extern splash-spawn (function float vector int none)) +(define-extern rings-water-spawn (function float vector vector float float none)) +(define-extern water-info<-region (function water-info drawable-region-prim collide-shape collide-action water-info)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; collectables ;; @@ -29865,19 +29880,18 @@ ;; powerups ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern cloud-track function) ;; (function process-tree process-tree (function vector none) time-frame time-frame time-frame none :behavior process) -;; (define-extern eco-blue-glow function) ;; (function vector none) -;; (define-extern target-eco-process function) -;; (define-extern target-color-effect-process function) +(define-extern cloud-track (function process-tree process-tree (function vector none) time-frame time-frame time-frame none :behavior process)) +(define-extern eco-blue-glow (function vector none)) +(define-extern target-eco-process (function none :behavior target)) +(define-extern target-color-effect-process (function none :behavior target)) (define-extern target-powerup-process (function none :behavior target)) -;; (define-extern target-powerup-effect function) ;; (function symbol none :behavior target) -;; (define-extern process-contact-action function) +(define-extern target-powerup-effect (function symbol none :behavior target)) +(define-extern process-contact-action (function process none :behavior target)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; crates ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype crate-bank (basic) ((COLLIDE_YOFF float :offset-assert 4) (COLLIDE_RADIUS float :offset-assert 8) @@ -29887,44 +29901,40 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype crate (process-focusable) - ((smush smush-control :inline :offset-assert 204) - (base vector :inline :offset-assert 236) - (look symbol :offset-assert 252) ;; guessed by decompiler - (defense symbol :offset-assert 256) ;; guessed by decompiler - (incoming-attack-id uint32 :offset-assert 260) - (target uint64 :offset-assert 268) ;; handle - (child-count int32 :offset-assert 276) - (victory-anim spool-anim :offset-assert 280) ;; guessed by decompiler + ((smush smush-control :inline :offset-assert 208) + (base vector :inline :offset-assert 240) + (look symbol :offset-assert 256) ;; guessed by decompiler + (defense symbol :offset-assert 260) ;; guessed by decompiler + (incoming-attack-id uint32 :offset-assert 264) + (target handle :offset-assert 272) ;; handle + (child-count int32 :offset-assert 280) + (victory-anim spool-anim :offset-assert 284) ;; guessed by decompiler ) :method-count-assert 41 :size-assert #x120 :flag-assert #x2900a00120 (:methods - (hide () _type_ :state 27) ;; (params-set! (_type_ symbol symbol) none 27) - (idle () _type_ :state 28) ;; (dummy-28 (_type_) none 28) - (die () _type_ :state 29) ;; (smush-update! (_type_) none 29) + (hide () _type_ :state 27) + (idle () _type_ :state 28) + (die (symbol int) _type_ :state 29) (special-contents-die () _type_ :state 30) (bounce-on () _type_ :state 31) - (notice-blue () _type_ :state 32) + (notice-blue (handle) _type_ :state 32) (carry () _type_ :state 33) (fall () _type_ :state 34) - (crate-method-35 () none 35) - (crate-method-36 () none 36) - (crate-method-37 () none 37) - (crate-method-38 () none 38) - (crate-method-39 () none 39) - (crate-method-40 () none 40) + (crate-init! "Initialize the [[crate]] with the specified [[entity-actor]]." (_type_ entity-actor) none 35) + (skel-init! "Initialize the [[crate]]'s skeleton and other parameters based on the crate type." (_type_) none 36) + (params-set! "Set [[crate]] params based on the arguments." (_type_ symbol symbol) none 37) + (crate-method-38 (_type_) none 38) + (smush-update! (_type_) none 39) + (crate-method-40 (_type_) symbol :behavior crate 40) ) ) -|# -#| (deftype pickup-spawner (crate) - ((blocker entity-actor :offset-assert 284) ;; guessed by decompiler + ((blocker entity-actor :offset-assert 288) ;; guessed by decompiler ) :method-count-assert 41 :size-assert #x124 @@ -29932,12 +29942,11 @@ (:methods ) ) -|# -;; (define-extern *CRATE-bank* crate-bank) ;; crate-bank -;; (define-extern crate-post function) ;; (function int :behavior crate) -;; (define-extern crate-standard-event-handler function) ;; (function process int symbol event-message-block object :behavior crate) -;; (define-extern crate-init-by-other function) ;; (function entity vector symbol none :behavior crate) +(define-extern *CRATE-bank* crate-bank) +(define-extern crate-post (function int :behavior crate)) +(define-extern crate-standard-event-handler (function process int symbol event-message-block object :behavior crate)) +(define-extern crate-init-by-other (function entity vector symbol fact-info-crate none :behavior crate)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; hud ;; @@ -31753,41 +31762,40 @@ ;; water-anim ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype water-anim (process-drawable) - ((water-height meters :offset-assert 196) - (wade-height meters :offset-assert 200) - (swim-height meters :offset-assert 204) - (bottom-height meters :offset-assert 208) - (attack-event symbol :offset-assert 212) ;; guessed by decompiler - (attack-id uint32 :offset-assert 216) - (flow basic :offset-assert 220) - (target uint64 :offset-assert 228) ;; handle - (flags water-flags :offset-assert 236) ;; guessed by decompiler - (look int32 :offset-assert 240) - (play-ambient-sound? symbol :offset-assert 244) ;; guessed by decompiler - (visible basic :offset-assert 248) + ((water-height meters :offset-assert 200) + (wade-height meters :offset-assert 204) + (swim-height meters :offset-assert 208) + (bottom-height meters :offset-assert 212) + (attack-event symbol :offset-assert 216) ;; guessed by decompiler + (attack-id uint32 :offset-assert 220) + (flow flow-control :offset-assert 224) + (target handle :offset-assert 232) ;; handle + (flags water-flags :offset-assert 240) ;; guessed by decompiler + (look int32 :offset-assert 244) + (play-ambient-sound? symbol :offset-assert 248) ;; guessed by decompiler + (visible symbol :offset-assert 252) ) :method-count-assert 29 :size-assert #x100 :flag-assert #x1d00800100 (:methods - (water-anim-method-20 () none 20) + (water-anim-method-20 "Nonexistent?" () none 20) (idle () _type_ :state 21) - (water-anim-method-22 () none 22) - (water-anim-method-23 () none 23) - (water-anim-method-24 () none 24) - (water-anim-method-25 () none 25) - (water-anim-method-26 () none 26) - (water-anim-method-27 () none 27) - (water-anim-method-28 () none 28) + (move-to-point! + "Set a [[water-anim]]'s `trans` as specified by the [[vector]] and update `water-height`." + (_type_ vector) int 22) + (get-ripple-height (_type_ vector) float 23) + (art-init! "Initialize a [[water-anim]]'s [[skeleton-group]], joints and ambience." (_type_) none 24) + (reset-root! "Reset a [[water-anim]]'s `root`." (_type_) trsqv 25) + (water-anim-init! "Initialize a [[water-anim]]." (_type_) none 26) + (water-anim-method-27 "Empty." (_type_) none 27) + (offset! "Offset a [[water-anim]]'s `trans` and `quat` by the lump data in `entity`." (_type_) none 28) ) ) -|# -#| (deftype water-anim-look (structure) - ((skel-group symbol :offset-assert 0) ;; guessed by decompiler + ((skel-group string :offset-assert 0) ;; guessed by decompiler (anim int32 :offset-assert 4) (ambient-sound-spec sound-spec :offset-assert 8) ;; guessed by decompiler ) @@ -31795,11 +31803,10 @@ :size-assert #xc :flag-assert #x90000000c ) -|# -;; (define-extern *water-anim-look* array) ;; (array water-anim-look) -;; (define-extern water-anim-event-handler function) -;; (define-extern water-anim-init-by-other function) +(define-extern *water-anim-look* (array water-anim-look)) +(define-extern water-anim-event-handler (function process int symbol event-message-block object :behavior water-anim)) +(define-extern water-anim-init-by-other (function entity-actor none :behavior water-anim)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; blocking-plane ;; @@ -31859,7 +31866,6 @@ ;; dark-eco-pool ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype dark-eco-pool (water-anim) () :method-count-assert 29 @@ -31868,10 +31874,9 @@ (:methods ) ) -|# -;; (define-extern *ripple-for-dark-eco-pool* ripple-wave-set) -;; (define-extern *ripple-strip-dark-eco-near-lift* ripple-wave-set) +(define-extern *ripple-for-dark-eco-pool* ripple-wave-set) +(define-extern *ripple-strip-dark-eco-near-lift* ripple-wave-set) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; enemy-h ;; @@ -38038,8 +38043,8 @@ ;; oracle-texture ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *darkjak-hires-texture-anim-array* texture-anim-array) -;; (define-extern set-darkjak-highres-texture-morph! function) +(define-extern *darkjak-hires-texture-anim-array* texture-anim-array) +(define-extern set-darkjak-highres-texture-morph! (function float none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; oracle-part ;; @@ -43495,7 +43500,7 @@ ;; (define-extern demo-wait-for-press function) ;; (define-extern demo-menu function) ;; (define-extern demo-control-init function) -;; (define-extern target-demo state) ;; (state target) +(define-extern target-demo (state symbol target)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; errol-chal-part ;; @@ -44772,7 +44777,7 @@ ;; (define-extern title-fade-out function) ;; (define-extern title-progress function) ;; (define-extern title-control-init function) -;; (define-extern target-title state) ;; (state target) +(define-extern target-title (state symbol target)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; mech-part ;; diff --git a/decompiler/config/jak2/anonymous_function_types.jsonc b/decompiler/config/jak2/anonymous_function_types.jsonc index 4f252379a3..b28c27231d 100644 --- a/decompiler/config/jak2/anonymous_function_types.jsonc +++ b/decompiler/config/jak2/anonymous_function_types.jsonc @@ -398,5 +398,23 @@ [45, "(function surface object object int float :behavior target)"], [76, "(function surface surface surface int float :behavior target)"] ], - "scene": [[4, "(function symbol)"]] + "scene": [[4, "(function symbol)"]], + "target-darkjak": [ + [6, "(function vector :behavior target)"], + [7, "(function vector :behavior target)"], + [ + 15, + "(function (pointer float) (pointer uint64) (pointer uint64) none :behavior target)" + ], + [16, "(function impact-control :behavior target)"] + ], + "target-handler": [[10, "(function handle none :behavior target)"]], + "target2": [ + [11, "(function vector time-frame float none :behavior target)"], + [14, "(function none :behavior target)"], + [55, "(function process-drawable symbol)"] + ], + "water": [[10, "(function vector :behavior process-drawable)"]], + "dark-eco-pool": [[0, "(function none :behavior dark-eco-pool)"]], + "target-gun": [[22, "(function surface object object int object :behavior target)"]] } diff --git a/decompiler/config/jak2/hacks.jsonc b/decompiler/config/jak2/hacks.jsonc index 9c69ef9713..40b4b62c8d 100644 --- a/decompiler/config/jak2/hacks.jsonc +++ b/decompiler/config/jak2/hacks.jsonc @@ -118,6 +118,7 @@ "draw-inline-array-instance-shrub", "target-land-effect", + "target-standard-event-handler", "(method 12 effect-control)", "(method 11 effect-control)", "(method 10 effect-control)", diff --git a/decompiler/config/jak2/label_types.jsonc b/decompiler/config/jak2/label_types.jsonc index 593795ebf3..3578161b65 100644 --- a/decompiler/config/jak2/label_types.jsonc +++ b/decompiler/config/jak2/label_types.jsonc @@ -271,7 +271,18 @@ ["L790", "uint64", true], ["L791", "uint64", true] ], - "target-gun": [["L595", "uint64", true]], + "target-gun": [ + ["L588", "uint64", true], + ["L589", "uint64", true], + ["L590", "uint64", true], + ["L591", "uint64", true], + ["L592", "uint64", true], + ["L593", "uint64", true], + ["L594", "uint64", true], + ["L595", "uint64", true], + ["L596", "uint64", true], + ["L597", "uint64", true] + ], "tie-methods": [["L328", "(inline-array tie-init-data)", 6]], "blocking-plane": [["L43", "vector"]], "elec-gate": [["L141", "attack-info"]], @@ -374,5 +385,46 @@ ["L1024", "uint64", true], ["L1025", "uint64", true], ["L1041", "uint64", true] + ], + "crates": [ + ["L213", "attack-info"], + ["L214", "attack-info"], + ["L206", "attack-info"] + ], + "target-darkjak": [ + ["L369", "(pointer handle)", 128], + ["L370", "attack-info"] + ], + "target-util": [ + ["L309", "vector"], + ["L312", "vector"] + ], + "target-handler": [ + ["L371", "attack-info"], + ["L372", "attack-info"], + ["L373", "uint64", true], + ["L374", "uint64", true], + ["L375", "uint64", true], + ["L376", "uint64", true], + ["L377", "uint64", true], + ["L378", "uint64", true], + ["L379", "uint64", true], + ["L380", "uint64", true], + ["L382", "uint64", true], + ["L381", "uint64", true], + ["L383", "uint64", true] + ], + "target2": [ + ["L385", "uint64", true], + ["L386", "uint64", true] + ], + "target-swim": [["L225", "attack-info"]], + "water": [ + ["L206", "attack-info"], + ["L205", "attack-info"] + ], + "water-anim": [ + ["L63", "attack-info"], + ["L62", "attack-info"] ] } diff --git a/decompiler/config/jak2/stack_structures.jsonc b/decompiler/config/jak2/stack_structures.jsonc index 932f2d353f..0cc117f017 100644 --- a/decompiler/config/jak2/stack_structures.jsonc +++ b/decompiler/config/jak2/stack_structures.jsonc @@ -932,6 +932,86 @@ "sparticle-respawn-heights": [[16, "vector"]], "sparticle-respawn-timer": [[16, "vector"]], "check-drop-level-rain": [[16, "vector"]], + "check-water-level-drop": [[16, "vector"]], + "check-water-level-drop-motion": [[16, "vector"]], + "water-info<-region": [[16, "script-context"]], + "(method 52 collide-shape)": [[16, "water-info"]], + "cshape-reaction-update-state": [ + [16, "vector"], + [64, "vector"] + ], + "(code target-darkjak-giant)": [ + [96, "collide-query"], + [640, ["inline-array", "sphere", 1]] + ], + "(code target-darkjak-bomb1)": [ + [16, "vector"], + [112, "vector"], + [128, "event-message-block"] + ], + "(code target-darkjak-bomb0)": [ + [32, "vector"], + [48, "vector"] + ], + "set-forward-vel": [ + [16, "vector"], + [32, "vector"] + ], + "delete-back-vel": [ + [16, "vector"], + [32, "vector"] + ], + "(method 16 target)": [[16, "vector"]], + "can-exit-duck?": [ + [16, "collide-query"], + [560, ["inline-array", "sphere", 2]] + ], + "target-send-attack": [[16, "event-message-block"]], + "(trans target-pole-cycle)": [[16, "vector"]], + "(enter target-float)": [[16, "vector"]], + "(trans target-float)": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "vector"], + [80, "vector"] + ], + "(code target-launch)": [[16, "event-message-block"]], + "(anon-function 11 target2)": [[16, "vector"]], + "(code target-load-wait)": [[16, "event-message-block"]], + "target-generic-event-handler": [[16, "event-message-block"]], + "(code target-swim-jump)": [[16, "vector"]], + "(code target-swim-down)": [[16, "vector"]], + "(method 10 water-control)": [ + [16, "water-info"], + [224, "vector"] + ], + "(anon-function 10 water)": [[16, "vector"]], + "target-bomb1-fire-shot": [ + [96, "vector"], + [112, "vector"] + ], + "water-anim-event-handler": [ + [16, "vector"], + [32, "event-message-block"] + ], + "(post fall crate)": [ + [32, "collide-query"], + [16, "vector"] + ], + "(enter fall crate)": [[16, "event-message-block"]], + "target-gun-find-track": [[64, "event-message-block"]], + "target-gun-build-track-list": [ + [16, "vector"], + [32, "vector"] + ], + "target-gun-joint-pre0": [ + [640, ["inline-array", "sphere", 2]], + [656, "vector"] + ], + "cloud-track": [ + [16, "vector"] + ], "progress-post": [[112, "hud-box"]], "(method 10 menu-missions-option)": [[224, "hud-box"]], "(method 10 menu-secret-option)": [[64, "hud-box"]], @@ -940,5 +1020,7 @@ "cam-string-line-of-sight": [[192, "collide-query"]], "(enter cam-circular)": [[32, "collide-query"]], "(method 26 rigid-body)": [[16, ["inline-array", "vector", 8]]], - "(method 47 rigid-body-object)": [[16, "matrix"]] + "(method 47 rigid-body-object)": [[16, "matrix"]], + // placeholder + "placeholder-do-not-add-below": [] } diff --git a/decompiler/config/jak2/type_casts.jsonc b/decompiler/config/jak2/type_casts.jsonc index 985a80faf9..c838e99daf 100644 --- a/decompiler/config/jak2/type_casts.jsonc +++ b/decompiler/config/jak2/type_casts.jsonc @@ -3089,5 +3089,399 @@ "get-penetrate-using-from-attack-event": [ [[0, 6], "v1", "attack-info"], [23, "gp", "collide-shape"] - ] + ], + "(method 13 water-control)": [ + [142, "v1", "process-drawable"], + [135, "v1", "process-drawable"] + ], + "(method 10 water-control)": [ + [9, "a0", "collide-shape"], + [13, "a0", "collide-shape"], + [195, "v1", "collide-shape-moving"], + [375, "v1", "process-drawable"], + [707, "v1", "control-info"], + [719, "a1", "collide-shape-moving"], + [735, "a0", "collide-shape-moving"], + [750, "a0", "collide-shape-moving"], + [756, "a0", "collide-shape-moving"], + [855, "v1", "collide-shape-moving"], + [875, "s3", "collide-shape-moving"], + [899, "s3", "collide-shape-moving"], + [904, "s3", "collide-shape-moving"], + [1017, "s4", "collide-shape-moving"], + [1018, "s4", "collide-shape-moving"], + [1024, "s4", "collide-shape-moving"], + [1037, "v1", "collide-shape-moving"], + [1104, "a0", "collide-shape-moving"], + [1125, "v1", "collide-shape-moving"] + ], + "(method 52 collide-shape)": [ + [76, "v1", "region-prim-area"], + [77, "v1", "region-prim-area"], + [83, "a1", "region-prim-area"], + [84, "a1", "region-prim-area"], + [20, "a0", "region-prim-area"], + [15, "v1", "region-prim-area"], + [17, "v1", "region-prim-area"], + [53, "a1", "region-prim-area"], + [56, "v1", "region-prim-area"] + ], + "(method 40 crate)": [ + [2, "v1", "fact-info-crate"], + [13, "a0", "fact-info-crate"], + [55, "v0", "float"] + ], + "(method 0 carry-info)": [ + [44, "v1", "collide-shape-moving"], + [47, "v1", "collide-shape-moving"] + ], + "crate-standard-event-handler": [ + [14, "v1", "attack-info"], + [15, "v1", "attack-info"], + [19, "v1", "attack-info"], + [75, "gp", "target"], + [209, "v1", "attack-info"], + [458, "v1", "attack-info"], + [643, "a0", "vector"] + ], + "target-darkjak-process": [ + [43, "a0", "fact-info-target"], + [46, "a0", "fact-info-target"] + ], + "want-to-darkjak?": [[53, "a0", "fact-info-target"]], + "target-powerup-process": [ + [235, "v0", "sound-rpc-set-param"], + [253, "v1", "fact-info-target"], + [259, "a0", "fact-info-target"], + [262, "a0", "fact-info-target"], + [268, "v1", "fact-info-target"], + [283, "v1", "fact-info-target"], + [313, "a0", "fact-info-target"], + [366, "v1", "fact-info-target"], + [390, "v1", "fact-info-target"], + [407, "v1", "fact-info-target"] + ], + "target-eco-process": [ + [1, "v1", "fact-info-target"], + [11, "a0", "fact-info-target"], + [19, "v1", "fact-info-target"], + [21, "v1", "fact-info-target"], + [14, "a0", "fact-info-target"], + [54, "v1", "fact-info-target"], + [77, "v1", "fact-info-target"], + [82, "a3", "fact-info-target"], + [97, "v1", "fact-info-target"] + ], + "cloud-track": [ + [32, "s1", "handle"], + [45, "s2", "handle"], + [81, "s1", "handle"], + [83, "s2", "handle"], + [107, "s2", "handle"] + ], + "(code target-darkjak-bomb1)": [ + [408, "v1", "art-joint-anim"], + [166, "s5", "int"], + [336, "v1", "float"], + ["_stack_", 56, "sphere"], + ["_stack_", 88, "float"] + ], + "target-darkjak-bomb-collide": [ + [2, "gp", "(pointer float)"], + [12, "gp", "(pointer float)"], + [13, "gp", "(pointer float)"] + ], + "(anon-function 16 target-darkjak)": [[61, "gp", "art-joint-anim"]], + "(code target-darkjak-get-on)": [ + [214, "v1", "art-joint-anim"], + [390, "v0", "sound-rpc-set-param"], + [111, "a0", "fact-info-target"], + [113, "a0", "fact-info-target"], + [114, "a0", "fact-info-target"] + ], + "(code target-darkjak-bomb0)": [ + [37, "v1", "art-joint-anim"], + [133, "v1", "art-joint-anim"], + [213, "v1", "art-joint-anim"], + [644, "v1", "process-drawable"], + [750, "v1", "process-drawable"], + [888, "v1", "process-drawable"], + [994, "v1", "process-drawable"], + ["_stack_", 16, "float"], + [18, "v1", "float"] + ], + "water-info<-region": [ + [12, "a0", "symbol"], + [48, "s2", "pair"], + [49, "v1", "pair"], + [57, "s2", "pair"], + [58, "v1", "pair"], + [59, "v1", "pair"], + [99, "s2", "pair"], + [100, "v1", "pair"], + [101, "v1", "pair"], + [133, "s1", "process-drawable"], + [143, "s2", "pair"], + [144, "v1", "pair"], + [145, "v1", "pair"], + [146, "v1", "pair"], + [147, "s2", "pair"], + [148, "v1", "pair"], + [199, "a0", "process-focusable"], + [208, "s2", "pair"], + [209, "s2", "pair"], + [231, "a0", "region-prim-area"], + [238, "v1", "region-prim-area"] + ], + "target-danger-set!": [[823, "v1", "fact-info-target"]], + "(method 26 target)": [[23, "v0", "float"]], + "(method 11 attack-info)": [ + [[118, 130], "v1", "process-drawable"], + [[156, 161], "v1", "process-drawable"] + ], + "(method 10 attack-info)": [[13, "a1", "collide-shape"]], + "target-log-attack": [[47, "a3", "attack-info"]], + "can-hands?": [ + [39, "a0", "fact-info-target"], + [45, "a0", "fact-info-target"] + ], + "target-attacked": [ + [56, "v1", "fact-info-target"], + [66, "v1", "fact-info-target"], + [72, "v1", "fact-info-target"], + [176, "v1", "fact-info-target"], + [241, "t4", "vector"], + [290, "v1", "fact-info-target"] + ], + "(anon-function 10 target-handler)": [ + [70, "a0", "handle"], + [146, "a0", "process-focusable"], + [154, "a0", "process-focusable"], + [161, "a0", "process-focusable"], + [175, "a0", "process-focusable"], + [99, "t2", "float"], + [99, "t1", "float"] + ], + "(code target-edge-grab)": [ + [21, "v1", "process-drawable"], + [22, "a0", "collide-shape-moving"], + [25, "v1", "process-drawable"], + [26, "v1", "collide-shape-moving"] + ], + "(exit target-edge-grab)": [ + [17, "v1", "process-drawable"], + [18, "a1", "collide-shape-moving"], + [21, "v1", "process-drawable"], + [22, "v1", "collide-shape-moving"] + ], + "(code target-pole-flip-forward-jump)": [ + [26, "t9", "(function none :behavior target)"] + ], + "(code target-pole-flip-up)": [[23, "v1", "art-joint-anim"]], + "(code target-pole-cycle)": [ + [103, "v1", "art-joint-anim"], + [163, "v1", "art-joint-anim"] + ], + "(code target-grab)": [ + [232, "v1", "art-joint-anim"], + [422, "v1", "art-joint-anim"] + ], + "(event target-grab)": [ + [33, "a0", "process"], + [125, "gp", "object"] + ], + "(code target-load-wait)": [ + [21, "v1", "art-joint-anim"], + [134, "v1", "art-joint-anim"], + [191, "v1", "art-joint-anim"] + ], + "(code target-edge-grab-jump)": [[72, "a1", "art-joint-anim"]], + "(code target-hit-ground-hard)": [[46, "v1", "fact-info-target"]], + "(anon-function 11 target2)": [[[19, 140], "s4", "target"]], + "(anon-function 14 target2)": [[26, "f0", "float"]], + "(code target-hide)": [ + [14, "v1", "art-joint-anim"], + [143, "v1", "art-joint-anim"], + [204, "v1", "art-joint-anim"], + [258, "v1", "art-joint-anim"], + [317, "v1", "art-joint-anim"], + [385, "v1", "art-joint-anim"], + [431, "v1", "art-joint-anim"], + [488, "v1", "art-joint-anim"] + ], + "target-generic-event-handler": [ + [10, "v1", "float"], + [314, "v1", "fact-info-target"], + [321, "v1", "fact-info-target"], + [527, "a0", "vector"], + [681, "v1", "fact-info-target"], + [699, "v1", "fact-info-target"], + [866, "v1", "(state target)"], + [894, "a0", "process"] + ], + "target-dangerous-event-handler": [ + [9, "v1", "fact-info-target"], + [20, "v1", "fact-info-target"] + ], + "(code target-swim-up)": [[18, "v1", "art-joint-anim"]], + "(code target-swim-down)": [[69, "v1", "art-joint-anim"]], + "(event target-swim-down)": [ + [[12, 99], "v1", "attack-info"], + [88, "t0", "fact-info-target"] + ], + "(code target-swim-walk)": [ + [143, "v1", "art-joint-anim"], + [58, "v1", "art-joint-anim"] + ], + "(code target-swim-stance)": [[33, "v1", "art-joint-anim"]], + "(method 15 water-control)": [ + [47, "v0", "float"], + [48, "v1", "float"] + ], + "(anon-function 10 water)": [ + [5, "s5", "process-drawable"], + [28, "s5", "process-drawable"] + ], + "part-water-splash-callback": [[3, "v1", "float"]], + "(event target-darkjak-bomb0)": [[51, "v1", "process"]], + "(code target-darkjak-running-attack)": [ + [16, "v1", "float"], + [259, "gp", "process-focusable"], + [278, "v1", "handle"], + [281, "v1", "handle"], + [363, "v1", "handle"], + [366, "v1", "handle"], + [576, "v1", "art-joint-anim"], + [604, "v1", "art-joint-anim"], + [632, "v1", "art-joint-anim"], + [672, "v1", "art-joint-anim"], + [700, "v1", "art-joint-anim"], + [835, "v1", "art-joint-anim"], + [872, "f1", "float"], + [22, "v1", "float"], + ["_stack_", 56, "handle"], + ["_stack_", 16, "float"] + ], + "target-bomb1-fire-shot": [ + [12, "v1", "handle"], + [20, "gp", "process-focusable"] + ], + "(method 9 external-art-control)": [ + [173, "s4", "external-art-buffer"], + [177, "s4", "external-art-buffer"], + [183, "s4", "external-art-buffer"], + [190, "s4", "external-art-buffer"] + ], + "(code target-darkjak-get-off)": [ + [159, "v1", "art-joint-anim"], + [359, "v1", "art-joint-anim"], + [472, "v1", "art-joint-anim"] + ], + "(anon-function 15 target-darkjak)": [ + [16, "v0", "process-focusable"], + [82, "v1", "art-joint-anim"], + [113, "v1", "art-joint-anim"] + ], + "(trans target-float)": [[130, "v1", "(state target)"]], + "(code target-stance-look-around)": [[12, "v0", "float"]], + "(code target-look-around)": [[21, "v0", "float"]], + "(exit target-swim-stance)": [[51, "v0", "sound-rpc-set-param"]], + "(exit target-swim-down)": [[56, "v0", "sound-rpc-set-param"]], + "(method 7 water-anim)": [[14, "t9", "(function water-anim int water-anim)"]], + "(method 26 water-anim)": [ + ["_stack_", 16, "res-tag"], + [52, "v0", "(pointer float)"] + ], + "(method 7 flow-control)": [ + [19, "t9", "(function flow-control int flow-control)"] + ], + "water-anim-event-handler": [ + [23, "v1", "float"], + [40, "s4", "process"], + [50, "s5", "water-info"], + [96, "gp", "process-focusable"], + [116, "gp", "process-focusable"], + [137, "gp", "process-focusable"], + [182, "s5", "water-info"] + ], + "(code die crate)": [ + [6, "v1", "collide-shape"], + [37, "v1", "process-focusable"] + ], + "(code notice-blue crate)": [ + [19, "v1", "process-drawable"], + [21, "gp", "collide-shape-moving"], + [28, "a0", "collide-shape-moving"], + [30, "v1", "collide-shape-moving"] + ], + "(post fall crate)": [ + [4, "a0", "collide-shape-moving"], + [15, "v1", "collide-shape-moving"], + [26, "v1", "collide-shape-moving"], + [[34, 53], "gp", "collide-shape-moving"] + ], + "(trans fall crate)": [ + [1, "v1", "collide-shape-moving"], + [6, "v1", "float"], + [8, "v1", "collide-shape-moving"], + [24, "v1", "collide-shape-moving"], + [32, "v1", "collide-shape-moving"], + [34, "a0", "collide-shape-moving"], + [37, "a0", "collide-shape-moving"] + ], + "(enter fall crate)": [ + [35, "v0", "carry-info"], + [42, "v1", "collide-shape-moving"], + [46, "v1", "collide-shape-moving"], + [50, "a0", "collide-shape-moving"], + [54, "v1", "collide-shape-moving"] + ], + "(post carry crate)": [[[13, 16], "a0", "collide-shape-moving"]], + "(event carry crate)": [[15, "a0", "vector"]], + "(code idle crate)": [ + [[2, 5], "a0", "collide-shape-moving"] + ], + "(code hide crate)": [ + [27, "v1", "collide-shape-moving"], + [95, "v1", "collide-shape-moving"], + [97, "a0", "collide-shape-moving"], + [100, "a0", "collide-shape-moving"] + ], + "(code special-contents-die crate)": [[42, "v1", "collide-shape-moving"]], + "target-send-attack": [ + ["_stack_", 96, "symbol"], + [16, "s4", "process-focusable"] + ], + "(method 36 crate)": [ + [6, "a0", "collide-shape-moving"], + [27, "a0", "collide-shape-moving"] + ], + "camera-rotate-to-vector": [ + [63, "v1", "float"] + ], + "target-gun-find-track": [ + [182, "v0", "process-focusable"], + [[192, 224], "gp", "process-focusable"], + [[249, 475], "s5", "process-focusable"], + [431, "a0", "process-focusable"], + [434, "a0", "process-focusable"], + [519, "v1", "int"], + [520, "v1", "int"] + ], + "target-gun-check": [[599, "v0", "sound-rpc-set-param"]], + "target-gun-build-track-list": [ + [46, "v1", "vector"] + ], + "target-gun-joint-pre0": [ + [[131, 165], "gp", "process-focusable"] + ], + "(method 28 water-anim)": [ + ["_stack_", 16, "res-tag"], + [27, "v0", "vector"] + ], + "(method 7 drop-plat)": [ + [18, "v1", "external-art-buffer"] + ], + // placeholder + "placeholder-do-not-add-below": [] } diff --git a/decompiler/config/jak2_ntsc_v1.jsonc b/decompiler/config/jak2_ntsc_v1.jsonc index 4e3d7b149a..3516646474 100644 --- a/decompiler/config/jak2_ntsc_v1.jsonc +++ b/decompiler/config/jak2_ntsc_v1.jsonc @@ -8,7 +8,7 @@ // if you want to filter to only some object names. // it will make the decompiler much faster. "allowed_objects": [], - "banned_objects": ["effect-control", "target-util", "ctywide-scenes"], + "banned_objects": ["effect-control", "ctywide-scenes", "texture-anim-tables", "sky-tng", "traffic-engine"], //////////////////////////// // CODE ANALYSIS OPTIONS diff --git a/decompiler/config/jak3/all-types.gc b/decompiler/config/jak3/all-types.gc new file mode 100644 index 0000000000..4cd5842433 --- /dev/null +++ b/decompiler/config/jak3/all-types.gc @@ -0,0 +1,30 @@ +;; All Types + +;; type system setup +(define-extern object type) +(define-extern type type) +(define-extern structure type) +(define-extern uint128 type) +(define-extern basic type) +(define-extern pair type) +(define-extern array type) +(define-extern symbol type) +(define-extern binteger type) +(define-extern number type) +(define-extern integer type) +(define-extern uinteger type) +(define-extern float type) +(define-extern boolean type) ;; not actually added as a runtime type in jak2, but valid? supports it. +(define-extern uint16 type) +(define-extern uint32 type) +(define-extern int32 type) +(define-extern int64 type) +(define-extern uint8 type) +(define-extern uint64 type) +(define-extern process-tree type) +(define-extern process type) +(define-extern stack-frame type) +(define-extern global kheap) +(define-extern kheap type) + +(define-extern #t symbol) \ No newline at end of file diff --git a/decompiler/config/jak3/anonymous_function_types.jsonc b/decompiler/config/jak3/anonymous_function_types.jsonc new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/decompiler/config/jak3/anonymous_function_types.jsonc @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/decompiler/config/jak3/art_info.jsonc b/decompiler/config/jak3/art_info.jsonc new file mode 100644 index 0000000000..7a115d726a --- /dev/null +++ b/decompiler/config/jak3/art_info.jsonc @@ -0,0 +1,4 @@ +{ + "files": {}, + "functions": {} +} diff --git a/decompiler/config/jak3/hacks.jsonc b/decompiler/config/jak3/hacks.jsonc new file mode 100644 index 0000000000..0f226e7568 --- /dev/null +++ b/decompiler/config/jak3/hacks.jsonc @@ -0,0 +1,56 @@ +{ + //////////////////////////// + // HACKS and ASM FUNCTIONS + //////////////////////////// + + "types_with_bad_inspect_methods": [], + + "no_type_analysis_functions_by_name": [], + + // this limits the number of cases in a cond. The first argument is the name of the function. + // the second argument is the name of the first condition in the cond. Use print_cfg to find it out. + // The third argument is the number of cases. If you set it too small it may fail to build the CFG. + "cond_with_else_max_lengths": [], + + // if a cond with an else case is being used a value in a place where it looks wrong + // you can add the function name to this list and it will more aggressively reject this rewrite. + "aggressively_reject_cond_to_value_rewrite": [], + + // this provides a hint to the decompiler that these functions will have a lot of inline assembly. + // currently it just leaves pcpyld as an asm op. + "hint_inline_assembly_functions": [], + + "asm_functions_by_name": [], + + // these functions use pairs and the decompiler + // will be less picky about types related to pairs. + "pair_functions_by_name": [], + + // If format is used with the wrong number of arguments, + // it will often mess up the decompilation, as the decompiler assumes + // that they used the correct number. This will override the decompiler's + // automatic detection. + "bad_format_strings": {}, + + "blocks_ending_in_asm_branch": {}, + + // Sometimes the game might use format strings that are fetched dynamically, + // for example using the game text lookup method + // Add information about those format instructions here. + // e.g. "function-name":[[op, argc], [op, argc], ...] + // where "op" is the op number for the call to format. + "dynamic_format_arg_counts": {}, + + "mips2c_functions_by_name": [], + + "mips2c_jump_table_functions": {}, + + // there are some missing textures. I don't know what the game actually does here. + // the format for entries is [level, tpage, index] + "missing_textures": [], + + // some object files have garbage pad data at the end which makes the decompiler + // assume they must be different files, such as the art group for orb-cache-top. + // this just suppresses a message. + "expected_merged_objs": [] +} diff --git a/decompiler/config/jak3/import_deps.jsonc b/decompiler/config/jak3/import_deps.jsonc new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/decompiler/config/jak3/import_deps.jsonc @@ -0,0 +1 @@ +{} diff --git a/decompiler/config/jak3/inputs.jsonc b/decompiler/config/jak3/inputs.jsonc new file mode 100644 index 0000000000..3f97810187 --- /dev/null +++ b/decompiler/config/jak3/inputs.jsonc @@ -0,0 +1,316 @@ +{ + ////////////////////// + // INPUT FILES + ////////////////////// + + // input is GOAL object files, possibly in containers. + // most objects are part of CGO/DGO files (both go in dgo_names). This includes levels and the engine + // the DGOs will be processed in this order. Usually it's best to have KERNEL, ENGINE, then the levels when + // you want to run on the entire game. + "dgo_names":[ + //"CGO/ART.CGO", + "CGO/KERNEL.CGO", + "CGO/ENGINE.CGO", + "CGO/GAME.CGO", + "CGO/COMMON.CGO" + //"DGO/LJKDMPK.DGO", + //"DGO/LBBSDRP1.DGO", + //"DGO/LTNJXHIP.DGO", + //"DGO/MIC.DGO", + //"DGO/OASISCST.DGO", + //"DGO/CTYPEPA.DGO", + //"DGO/LPRENME.DGO", + //"DGO/LFREEOUT.DGO", + //"DGO/LGUNNORM.DGO", + //"DGO/LTOWA.DGO", + //"DGO/TEMA.DGO", + //"DGO/CTA.DGO", + //"DGO/LPRECC.DGO", + //"DGO/LJKDXVIN.DGO", + //"DGO/CTYPEPC.DGO", + //"DGO/SEA.DGO", + //"DGO/COMBE.DGO", + //"DGO/CTYPESA.DGO", + //"DGO/LBLOWCST.DGO", + //"DGO/WSD.DGO", + //"DGO/LBBRING3.DGO", + //"DGO/LCTYPATK.DGO", + //"DGO/WCB.DGO", + //"DGO/DESRESC.DGO", + //"DGO/LBBRING4.DGO", + //"DGO/GRIDCST.DGO", + //"DGO/RAILX.DGO", + //"DGO/SEJ.DGO", + //"DGO/LJAKC.DGO", + //"DGO/CTB.DGO", + //"DGO/CTYCARC.DGO", + //"DGO/LMECH.DGO", + //"DGO/LBBSDRP2.DGO", + //"DGO/NSA.DGO", + //"DGO/LBBTCHA3.DGO", + //"DGO/GUNGAME2.DGO", + //"DGO/CTC.DGO", + //"DGO/LVINCST.DGO", + //"DGO/COMBX.DGO", + //"DGO/DESH.DGO", + //"DGO/DESRACE2.DGO", + //"DGO/RAILD.DGO", + //"DGO/FACC.DGO", + //"DGO/CTYPESC.DGO", + //"DGO/LWASBBV.DGO", + //"DGO/TOWB.DGO", + //"DGO/HGA.DGO", + //"DGO/SEH.DGO", + //"DGO/MHCTYCST.DGO", + //"DGO/GUNGAME1.DGO", + //"DGO/INTROCST.DGO", + //"DGO/DESJUMP.DGO", + //"DGO/SEM.DGO", + //"DGO/SEI.DGO", + //"DGO/DESG.DGO", + //"DGO/DESW.DGO", + //"DGO/LOUTRO3.DGO", + //"DGO/LDAMKLEV.DGO", + //"DGO/DESERROL.DGO", + //"DGO/RAILB2.DGO", + //"DGO/LERROL.DGO", + //"DGO/IPF.DGO", + //"DGO/RAILB.DGO", + //"DGO/LCTYHIJK.DGO", + //"DGO/CTYPEPB.DGO", + //"DGO/PRECB.DGO", + //"DGO/LFORM.DGO", + //"DGO/WASLEAPR.DGO", + //"DGO/LKEIRA.DGO", + //"DGO/LJAK.DGO", + //"DGO/SLUMBSET.DGO", + //"DGO/FACD.DGO", + //"DGO/LWASSIG.DGO", + //"DGO/LBIPED.DGO", + //"DGO/DESD.DGO", + //"DGO/CFB.DGO", + //"DGO/FREECAST.DGO", + //"DGO/SEG.DGO", + //"DGO/FACTORYA.DGO", + //"DGO/LPATK.DGO", + //"DGO/FRSTX.DGO", + //"DGO/SEB.DGO", + //"DGO/DESBCST.DGO", + //"DGO/DESE.DGO", + //"DGO/DESOASIS.DGO", + //"DGO/CTYCARA.DGO", + //"DGO/LSIGKLV.DGO", + //"DGO/CIB.DGO", + //"DGO/LBBRING2.DGO", + //"DGO/LTNFXHIP.DGO", + //"DGO/MIA.DGO", + //"DGO/MHCB.DGO", + //"DGO/LNSTOBC.DGO", + //"DGO/COMBD.DGO", + //"DGO/RBCT.DGO", + //"DGO/LTORNJNX.DGO", + //"DGO/DESBATTL.DGO", + //"DGO/SEK.DGO", + //"DGO/LSNKWHLS.DGO", + //"DGO/LMHCB.DGO", + //"DGO/LBOMBBOT.DGO", + //"DGO/OUTCAST3.DGO", + //"DGO/LBLOWTMH.DGO", + //"DGO/TEMD.DGO", + //"DGO/LTOWCITY.DGO", + //"DGO/OUTROCST.DGO", + //"DGO/WASCAST.DGO", + //"DGO/LFACRM2.DGO", + //"DGO/WASPGAME.DGO", + //"DGO/RAILE.DGO", + //"DGO/CTYPESB.DGO", + //"DGO/DESBOSS1.DGO", + //"DGO/FREEHQ.DGO", + //"DGO/LTORN.DGO", + //"DGO/TOWERA.DGO", + //"DGO/LSAMOS.DGO", + //"DGO/LFORP.DGO", + //"DGO/CFA.DGO", + //"DGO/LJINX.DGO", + //"DGO/SEO.DGO", + //"DGO/PRECA.DGO", + //"DGO/TOWERC.DGO", + //"DGO/WCA.DGO", + //"DGO/SEC.DGO", + //"DGO/DESF.DGO", + //"DGO/SEL.DGO", + //"DGO/LCTYDEST.DGO", + //"DGO/LTORNSAM.DGO", + //"DGO/MUSEUM3B.DGO", + //"DGO/SEE.DGO", + //"DGO/DESHUNT.DGO", + //"DGO/RAILA.DGO", + //"DGO/TITLE.DGO", + //"DGO/RUBC.DGO", + //"DGO/DESB.DGO", + //"DGO/LFACCAR.DGO", + //"DGO/LNSTOA.DGO", + //"DGO/MUSEUM3.DGO", + //"DGO/ONINTENT.DGO", + //"DGO/STA.DGO", + //"DGO/WASSTADA.DGO", + //"DGO/POWERGD.DGO", + //"DGO/LKLEEVER.DGO", + //"DGO/FACB.DGO", + //"DGO/LCTYASS.DGO", + //"DGO/MHCA.DGO", + //"DGO/LTOWB.DGO", + //"DGO/LNSTCST.DGO", + //"DGO/DESRESCG.DGO", + //"DGO/INTPALRF.DGO", + //"DGO/LMHCA.DGO", + //"DGO/TOWERCST.DGO", + //"DGO/RAILF.DGO", + //"DGO/CIA.DGO", + //"DGO/CTYCARKG.DGO", + //"DGO/WASCHASE.DGO", + //"DGO/LFACO.DGO", + //"DGO/WIN.DGO", + //"DGO/TEMPLEE.DGO", + //"DGO/LBBSPIRT.DGO", + //"DGO/MUSEUM2.DGO", + //"DGO/INTTITLE.DGO", + //"DGO/STAA.DGO", + //"DGO/MUSEUM4B.DGO", + //"DGO/PRECD.DGO", + //"DGO/SEF.DGO", + //"DGO/CTYCARB.DGO", + //"DGO/WASDEFEN.DGO", + //"DGO/LBLOWTKG.DGO", + //"DGO/DESA.DGO", + //"DGO/COMBB.DGO", + //"DGO/WASSTADC.DGO", + //"DGO/DESC.DGO", + //"DGO/LDAMPECK.DGO", + //"DGO/LJAKSIG.DGO", + //"DGO/HALFPIPE.DGO", + //"DGO/DESRACE1.DGO", + //"DGO/SEN.DGO", + //"DGO/TEMP.DGO", + //"DGO/SED.DGO", + //"DGO/LFACB.DGO", + //"DGO/LCTYSNPR.DGO", + //"DGO/LBBSPID.DGO", + //"DGO/FRSTA.DGO", + //"DGO/LBBRING5.DGO", + //"DGO/LBBSPRT3.DGO", + //"DGO/HHG.DGO", + //"DGO/LBBSPRT2.DGO", + //"DGO/CGB.DGO", + //"DGO/LDMPCKGN.DGO", + //"DGO/LSEEMWCA.DGO", + //"DGO/HGB.DGO", + //"DGO/LONINSIM.DGO", + //"DGO/RUBA.DGO", + //"DGO/DESRALLY.DGO", + //"DGO/WWD.DGO", + //"DGO/STB.DGO", + //"DGO/MIB.DGO", + //"DGO/LCTYBLOW.DGO", + //"DGO/LWSTDPCK.DGO", + //"DGO/MUSEUM.DGO", + //"DGO/LJAKCKLV.DGO", + //"DGO/LBBRING1.DGO", + //"DGO/MUSEUM4.DGO", + //"DGO/LFACRM1.DGO", + //"DGO/LJKCDMKL.DGO", + //"DGO/LDAMSIG.DGO", + //"DGO/DESTRACK.DGO", + //"DGO/GGA.DGO", + //"DGO/RAILC.DGO", + //"DGO/LBBTCHA2.DGO", + //"DGO/DESINTER.DGO", + //"DGO/NSB.DGO", + //"DGO/LOUTRO.DGO", + //"DGO/VIN.DGO", + //"DGO/LDESGCST.DGO", + //"DGO/WARPCAST.DGO", + //"DGO/LBBRING6.DGO", + //"DGO/FRSTB.DGO", + //"DGO/TEMC.DGO", + //"DGO/COMBC.DGO", + //"DGO/LTRTWHLS.DGO", + //"DGO/PRECC.DGO", + //"DGO/DESCHASE.DGO", + //"DGO/CITYCAST.DGO", + //"DGO/CPO.DGO", + //"DGO/LFACCITY.DGO", + //"DGO/RAILCST.DGO", + //"DGO/LJNDKLEV.DGO", + //"DGO/CWI.DGO", + //"DGO/MINEE.DGO", + //"DGO/LFORRING.DGO", + //"DGO/LASHELIN.DGO", + //"DGO/LJAKKLEV.DGO", + //"DGO/LCTYPALT.DGO", + //"DGO/LNSTOBB.DGO", + //"DGO/LJKFEET.DGO", + //"DGO/DST.DGO", + //"DGO/LBBTCHA1.DGO", + //"DGO/LGUNRNC.DGO", + //"DGO/COMBN.DGO", + //"DGO/DESRESCC.DGO", + //"DGO/LSIGJAKC.DGO", + //"DGO/DESLIZ.DGO", + //"DGO/WASPALA.DGO", + //"DGO/LJAKNDAX.DGO", + //"DGO/WASSEEM.DGO", + //"DGO/WASALL.DGO", + //"DGO/WCASEEM.DGO", + //"DGO/LSIG.DGO", + //"DGO/LFACTORY.DGO", + //"DGO/LWLANDM.DGO", + //"DGO/LPTRL.DGO", + //"DGO/MINED.DGO", + //"DGO/LDAMPKSM.DGO", + //"DGO/RUBB.DGO", + //"DGO/LCITYSML.DGO", + //"DGO/RUBA2.DGO", + //"DGO/LOUTRO2.DGO", + //"DGO/VOCX.DGO", + //"DGO/TEMX.DGO", + //"DGO/ARENACST.DGO", + //"DGO/TEMB.DGO", + //"DGO/COMBA.DGO", + //"DGO/LBBSDRP3.DGO", + //"DGO/LPATKCS.DGO", + //"DGO/VOCA.DGO", + //"DGO/WASSTADB.DGO", + //"DGO/LDAX.DGO", + //"DGO/LCTYPROT.DGO", + //"DGO/DESHOVER.DGO", + //"DGO/DESBOSS2.DGO" +], + + // some objects are part of STR files (streaming data). + "str_file_names": [], + + // some objects are directly stored as files on the DVD. This is just text files. + "object_file_names": [ + "TEXT/0COMMON.TXT", + "TEXT/1COMMON.TXT", + "TEXT/2COMMON.TXT", + "TEXT/3COMMON.TXT", + "TEXT/4COMMON.TXT", + "TEXT/5COMMON.TXT", + "TEXT/6COMMON.TXT", + "TEXT/7COMMON.TXT", + "TEXT/8COMMON.TXT", + "TEXT/9COMMON.TXT", + "TEXT/10COMMON.TXT", + "TEXT/11COMMON.TXT" + ], + + // uncomment the next line to extract audio to wave files. + // "audio_dir_file_name": "jak3/VAG", + "audio_dir_file_name": "", + + "streamed_audio_file_names": [], + + "levels_to_extract": [] +} diff --git a/decompiler/config/jak3/label_types.jsonc b/decompiler/config/jak3/label_types.jsonc new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/decompiler/config/jak3/label_types.jsonc @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/decompiler/config/jak3/stack_structures.jsonc b/decompiler/config/jak3/stack_structures.jsonc new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/decompiler/config/jak3/stack_structures.jsonc @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/decompiler/config/jak3/type_casts.jsonc b/decompiler/config/jak3/type_casts.jsonc new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/decompiler/config/jak3/type_casts.jsonc @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/decompiler/config/jak3/var_names.jsonc b/decompiler/config/jak3/var_names.jsonc new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/decompiler/config/jak3/var_names.jsonc @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/decompiler/config/jak3_ntsc.jsonc b/decompiler/config/jak3_ntsc.jsonc index a9dc87961a..c02443c358 100644 --- a/decompiler/config/jak3_ntsc.jsonc +++ b/decompiler/config/jak3_ntsc.jsonc @@ -1,326 +1,121 @@ { - "game_version":3, - "dgo_names":["CGO/ART.CGO", -"CGO/KERNEL.CGO", -"CGO/ENGINE.CGO", -"CGO/GAME.CGO", -"CGO/COMMON.CGO", -"DGO/LJKDMPK.DGO", -"DGO/LBBSDRP1.DGO", -"DGO/LTNJXHIP.DGO", -"DGO/MIC.DGO", -"DGO/OASISCST.DGO", -"DGO/CTYPEPA.DGO", -"DGO/LPRENME.DGO", -"DGO/LFREEOUT.DGO", -"DGO/LGUNNORM.DGO", -"DGO/LTOWA.DGO", -"DGO/TEMA.DGO", -"DGO/CTA.DGO", -"DGO/LPRECC.DGO", -"DGO/LJKDXVIN.DGO", -"DGO/CTYPEPC.DGO", -"DGO/SEA.DGO", -"DGO/COMBE.DGO", -"DGO/CTYPESA.DGO", -"DGO/LBLOWCST.DGO", -"DGO/WSD.DGO", -"DGO/LBBRING3.DGO", -"DGO/LCTYPATK.DGO", -"DGO/WCB.DGO", -"DGO/DESRESC.DGO", -"DGO/LBBRING4.DGO", -"DGO/GRIDCST.DGO", -"DGO/RAILX.DGO", -"DGO/SEJ.DGO", -"DGO/LJAKC.DGO", -"DGO/CTB.DGO", -"DGO/CTYCARC.DGO", -"DGO/LMECH.DGO", -"DGO/LBBSDRP2.DGO", -"DGO/NSA.DGO", -"DGO/LBBTCHA3.DGO", -"DGO/GUNGAME2.DGO", -"DGO/CTC.DGO", -"DGO/LVINCST.DGO", -"DGO/COMBX.DGO", -"DGO/DESH.DGO", -"DGO/DESRACE2.DGO", -"DGO/RAILD.DGO", -"DGO/FACC.DGO", -"DGO/CTYPESC.DGO", -"DGO/LWASBBV.DGO", -"DGO/TOWB.DGO", -"DGO/HGA.DGO", -"DGO/SEH.DGO", -"DGO/MHCTYCST.DGO", -"DGO/GUNGAME1.DGO", -"DGO/INTROCST.DGO", -"DGO/DESJUMP.DGO", -"DGO/SEM.DGO", -"DGO/SEI.DGO", -"DGO/DESG.DGO", -"DGO/DESW.DGO", -"DGO/LOUTRO3.DGO", -"DGO/LDAMKLEV.DGO", -"DGO/DESERROL.DGO", -"DGO/RAILB2.DGO", -"DGO/LERROL.DGO", -"DGO/IPF.DGO", -"DGO/RAILB.DGO", -"DGO/LCTYHIJK.DGO", -"DGO/CTYPEPB.DGO", -"DGO/PRECB.DGO", -"DGO/LFORM.DGO", -"DGO/WASLEAPR.DGO", -"DGO/LKEIRA.DGO", -"DGO/LJAK.DGO", -"DGO/SLUMBSET.DGO", -"DGO/FACD.DGO", -"DGO/LWASSIG.DGO", -"DGO/LBIPED.DGO", -"DGO/DESD.DGO", -"DGO/CFB.DGO", -"DGO/FREECAST.DGO", -"DGO/SEG.DGO", -"DGO/FACTORYA.DGO", -"DGO/LPATK.DGO", -"DGO/FRSTX.DGO", -"DGO/SEB.DGO", -"DGO/DESBCST.DGO", -"DGO/DESE.DGO", -"DGO/DESOASIS.DGO", -"DGO/CTYCARA.DGO", -"DGO/LSIGKLV.DGO", -"DGO/CIB.DGO", -"DGO/LBBRING2.DGO", -"DGO/LTNFXHIP.DGO", -"DGO/MIA.DGO", -"DGO/MHCB.DGO", -"DGO/LNSTOBC.DGO", -"DGO/COMBD.DGO", -"DGO/RBCT.DGO", -"DGO/LTORNJNX.DGO", -"DGO/DESBATTL.DGO", -"DGO/SEK.DGO", -"DGO/LSNKWHLS.DGO", -"DGO/LMHCB.DGO", -"DGO/LBOMBBOT.DGO", -"DGO/OUTCAST3.DGO", -"DGO/LBLOWTMH.DGO", -"DGO/TEMD.DGO", -"DGO/LTOWCITY.DGO", -"DGO/OUTROCST.DGO", -"DGO/WASCAST.DGO", -"DGO/LFACRM2.DGO", -"DGO/WASPGAME.DGO", -"DGO/RAILE.DGO", -"DGO/CTYPESB.DGO", -"DGO/DESBOSS1.DGO", -"DGO/FREEHQ.DGO", -"DGO/LTORN.DGO", -"DGO/TOWERA.DGO", -"DGO/LSAMOS.DGO", -"DGO/LFORP.DGO", -"DGO/CFA.DGO", -"DGO/LJINX.DGO", -"DGO/SEO.DGO", -"DGO/PRECA.DGO", -"DGO/TOWERC.DGO", -"DGO/WCA.DGO", -"DGO/SEC.DGO", -"DGO/DESF.DGO", -"DGO/SEL.DGO", -"DGO/LCTYDEST.DGO", -"DGO/LTORNSAM.DGO", -"DGO/MUSEUM3B.DGO", -"DGO/SEE.DGO", -"DGO/DESHUNT.DGO", -"DGO/RAILA.DGO", -"DGO/TITLE.DGO", -"DGO/RUBC.DGO", -"DGO/DESB.DGO", -"DGO/LFACCAR.DGO", -"DGO/LNSTOA.DGO", -"DGO/MUSEUM3.DGO", -"DGO/ONINTENT.DGO", -"DGO/STA.DGO", -"DGO/WASSTADA.DGO", -"DGO/POWERGD.DGO", -"DGO/LKLEEVER.DGO", -"DGO/FACB.DGO", -"DGO/LCTYASS.DGO", -"DGO/MHCA.DGO", -"DGO/LTOWB.DGO", -"DGO/LNSTCST.DGO", -"DGO/DESRESCG.DGO", -"DGO/INTPALRF.DGO", -"DGO/LMHCA.DGO", -"DGO/TOWERCST.DGO", -"DGO/RAILF.DGO", -"DGO/CIA.DGO", -"DGO/CTYCARKG.DGO", -"DGO/WASCHASE.DGO", -"DGO/LFACO.DGO", -"DGO/WIN.DGO", -"DGO/TEMPLEE.DGO", -"DGO/LBBSPIRT.DGO", -"DGO/MUSEUM2.DGO", -"DGO/INTTITLE.DGO", -"DGO/STAA.DGO", -"DGO/MUSEUM4B.DGO", -"DGO/PRECD.DGO", -"DGO/SEF.DGO", -"DGO/CTYCARB.DGO", -"DGO/WASDEFEN.DGO", -"DGO/LBLOWTKG.DGO", -"DGO/DESA.DGO", -"DGO/COMBB.DGO", -"DGO/WASSTADC.DGO", -"DGO/DESC.DGO", -"DGO/LDAMPECK.DGO", -"DGO/LJAKSIG.DGO", -"DGO/HALFPIPE.DGO", -"DGO/DESRACE1.DGO", -"DGO/SEN.DGO", -"DGO/TEMP.DGO", -"DGO/SED.DGO", -"DGO/LFACB.DGO", -"DGO/LCTYSNPR.DGO", -"DGO/LBBSPID.DGO", -"DGO/FRSTA.DGO", -"DGO/LBBRING5.DGO", -"DGO/LBBSPRT3.DGO", -"DGO/HHG.DGO", -"DGO/LBBSPRT2.DGO", -"DGO/CGB.DGO", -"DGO/LDMPCKGN.DGO", -"DGO/LSEEMWCA.DGO", -"DGO/HGB.DGO", -"DGO/LONINSIM.DGO", -"DGO/RUBA.DGO", -"DGO/DESRALLY.DGO", -"DGO/WWD.DGO", -"DGO/STB.DGO", -"DGO/MIB.DGO", -"DGO/LCTYBLOW.DGO", -"DGO/LWSTDPCK.DGO", -"DGO/MUSEUM.DGO", -"DGO/LJAKCKLV.DGO", -"DGO/LBBRING1.DGO", -"DGO/MUSEUM4.DGO", -"DGO/LFACRM1.DGO", -"DGO/LJKCDMKL.DGO", -"DGO/LDAMSIG.DGO", -"DGO/DESTRACK.DGO", -"DGO/GGA.DGO", -"DGO/RAILC.DGO", -"DGO/LBBTCHA2.DGO", -"DGO/DESINTER.DGO", -"DGO/NSB.DGO", -"DGO/LOUTRO.DGO", -"DGO/VIN.DGO", -"DGO/LDESGCST.DGO", -"DGO/WARPCAST.DGO", -"DGO/LBBRING6.DGO", -"DGO/FRSTB.DGO", -"DGO/TEMC.DGO", -"DGO/COMBC.DGO", -"DGO/LTRTWHLS.DGO", -"DGO/PRECC.DGO", -"DGO/DESCHASE.DGO", -"DGO/CITYCAST.DGO", -"DGO/CPO.DGO", -"DGO/LFACCITY.DGO", -"DGO/RAILCST.DGO", -"DGO/LJNDKLEV.DGO", -"DGO/CWI.DGO", -"DGO/MINEE.DGO", -"DGO/LFORRING.DGO", -"DGO/LASHELIN.DGO", -"DGO/LJAKKLEV.DGO", -"DGO/LCTYPALT.DGO", -"DGO/LNSTOBB.DGO", -"DGO/LJKFEET.DGO", -"DGO/DST.DGO", -"DGO/LBBTCHA1.DGO", -"DGO/LGUNRNC.DGO", -"DGO/COMBN.DGO", -"DGO/DESRESCC.DGO", -"DGO/LSIGJAKC.DGO", -"DGO/DESLIZ.DGO", -"DGO/WASPALA.DGO", -"DGO/LJAKNDAX.DGO", -"DGO/WASSEEM.DGO", -"DGO/WASALL.DGO", -"DGO/WCASEEM.DGO", -"DGO/LSIG.DGO", -"DGO/LFACTORY.DGO", -"DGO/LWLANDM.DGO", -"DGO/LPTRL.DGO", -"DGO/MINED.DGO", -"DGO/LDAMPKSM.DGO", -"DGO/RUBB.DGO", -"DGO/LCITYSML.DGO", -"DGO/RUBA2.DGO", -"DGO/LOUTRO2.DGO", -"DGO/VOCX.DGO", -"DGO/TEMX.DGO", -"DGO/ARENACST.DGO", -"DGO/TEMB.DGO", -"DGO/COMBA.DGO", -"DGO/LBBSDRP3.DGO", -"DGO/LPATKCS.DGO", -"DGO/VOCA.DGO", -"DGO/WASSTADB.DGO", -"DGO/LDAX.DGO", -"DGO/LCTYPROT.DGO", -"DGO/DESHOVER.DGO", -"DGO/DESBOSS2.DGO"], + "game_version": 3, + "text_version": 20, - "object_file_names":[], + "game_name": "jak3", + "expected_elf_name": "SCUS_973.30", - "type_hints_file":"decompiler/config/jak2/type_hints.jsonc", - "anonymous_function_types_file":"decompiler/config/jak2/anonymous_function_types.jsonc", - "var_names_file":"decompiler/config/jak2/var_names.jsonc", - "label_types_file":"decompiler/config/jak2/label_types.jsonc", + // if you want to filter to only some object names. + // it will make the decompiler much faster. + "allowed_objects": [], + "banned_objects": [], - "str_file_names":[], + //////////////////////////// + // CODE ANALYSIS OPTIONS + //////////////////////////// - "str_file_names_":[], - "allowed_objects":[], + // set to true to generate plain .asm files with MIPS disassembly, with no fancy decompilation. + // this is fast and should succeed 100% of the time. + "disassemble_code": true, - "analyze_functions":false, - "analyze_expressions":false, - "function_type_prop":false, - "write_disassembly":true, - "write_hex_near_instructions":false, - "insert_lets":false, + // Run the decompiler + "decompile_code": false, - "run_ir2":false, + "find_functions": false, - // if false, skips printing disassembly of object with functions, as these are usually large (~1 GB) and not interesting yet. - "disassemble_objects_without_functions":false, + //////////////////////////// + // DATA ANALYSIS OPTIONS + //////////////////////////// - "process_tpages":false, - "process_game_text":false, - "process_game_count":false, - "dump_objs":true, - "write_func_json":false, + // set to true to generate plain .asm files for data files. + // this will display most data as hex, but will add labels/references/type pointers/strings + // this generates a huge amount of output if you run it on the entire game. + "disassemble_data": false, - // to write out data of each object file - "write_hexdump":false, - // to write out hexdump on the v3 only, to avoid the huge level data files. Only if write_hexdump is true. - "write_hexdump_on_v3_only":true, + // unpack textures to assets folder + "process_tpages": false, + // unpack game text to assets folder + "process_game_text": false, + // unpack game count to assets folder + "process_game_count": false, + // write goal imports for art groups + "process_art_groups": false, - // to write out "scripts", which are currently just all the linked lists found. mostly a jak 2/3 thing - "write_scripts":true, + /////////////////////////// + // WEIRD OPTIONS + /////////////////////////// - // Experimental Stuff - "find_basic_blocks":true, + // these options are used rarely and should usually be left at false - "types_with_bad_inspect_methods":[], - "no_type_analysis_functions_by_name":[], - "asm_functions_by_name":[], - "pair_functions_by_name":[] + // generate the symbol_map.json file. + // this is a guess at where each symbol is first defined/used. + "generate_symbol_definition_map": false, + + // generate the all-types file + "generate_all_types": false, + + // debug option for instruction decoder + "write_hex_near_instructions": false, + + // to write out "scripts", which are currently just all the linked lists found. mostly a jak 2/3 thing + "write_scripts": true, + + // hex dump of code/data files. + "hexdump_code": false, + "hexdump_data": false, + // dump raw obj files + "dump_objs": true, + // print control flow graph + "print_cfgs": false, + + // set to true for PAL versions. this will forcefully skip files that have some data missing at the end. + "is_pal": false, + + "old_all_types_file": "decompiler/config/jak2/all-types.gc", + + //////////////////////////// + // CONFIG FILES + //////////////////////////// + + "type_casts_file": "decompiler/config/jak3/type_casts.jsonc", + "anonymous_function_types_file": "decompiler/config/jak3/anonymous_function_types.jsonc", + "var_names_file": "decompiler/config/jak3/var_names.jsonc", + "label_types_file": "decompiler/config/jak3/label_types.jsonc", + "stack_structures_file": "decompiler/config/jak3/stack_structures.jsonc", + "hacks_file": "decompiler/config/jak3/hacks.jsonc", + "inputs_file": "decompiler/config/jak3/inputs.jsonc", + "art_info_file": "decompiler/config/jak3/art_info.jsonc", + "import_deps_file": "decompiler/config/jak3/import_deps.jsonc", + "all_types_file": "decompiler/config/jak3/all-types.gc", + + // optional: a predetermined object file name map from a file. + // this will make decompilation naming consistent even if you only run on some objects. + "obj_file_name_map_file": "goal_src/jak3/build/all_objs.json", + + //////////////////////////// + // LEVEL EXTRACTION + //////////////////////////// + + // turn this on to extract level background graphics data + "levels_extract": false, + // turn this on if you want extracted levels to be saved out as .obj files + "rip_levels": false, + // should we extract collision meshes? + // these can be displayed in game, but makes the .fr3 files slightly larger + "extract_collision": false, + + //////////////////////////// + // PATCHING OPTIONS + //////////////////////////// + + // these are options related to xdelta3 patches on specific objects + // this allows us to get a more consistent input + + // set to true to write new patch files + "write_patches": false, + // set to true to apply patch files + "apply_patches": true, + // what to patch an object to and what the patch file is + "object_patches": { + } } \ No newline at end of file diff --git a/goal_src/jak2/engine/anim/joint-h.gc b/goal_src/jak2/engine/anim/joint-h.gc index 881508abbe..34c075e015 100644 --- a/goal_src/jak2/engine/anim/joint-h.gc +++ b/goal_src/jak2/engine/anim/joint-h.gc @@ -100,7 +100,7 @@ (effect effect-control :offset-assert 36) (interp-select int64 2 :offset-assert 40) (top-anim top-anim-joint-control :offset-assert 56) - (override basic :offset-assert 60) + (override (array float) :offset-assert 60) (channel joint-control-channel :inline :dynamic :offset-assert 64) ) :method-count-assert 12 @@ -108,7 +108,7 @@ :flag-assert #xc00000040 (:methods (new (symbol type int) _type_ 0) - (joint-control-method-9 () none 9) + (current-cycle-distance (_type_) float 9) (joint-control-method-10 (_type_) none 10) (debug-print-channels (_type_ symbol) int 11) ) @@ -160,10 +160,3 @@ :size-assert #x3640 :flag-assert #x900003640 ) - - -0 - - - - diff --git a/goal_src/jak2/engine/camera/cam-master.gc b/goal_src/jak2/engine/camera/cam-master.gc index 6df57da2e0..277ebbea2a 100644 --- a/goal_src/jak2/engine/camera/cam-master.gc +++ b/goal_src/jak2/engine/camera/cam-master.gc @@ -279,7 +279,7 @@ (when (and (logtest? (-> (the-as target gp-0) focus-status) (focus-status on-water under-water)) (zero? (logand (focus-status mech) (-> (the-as target gp-0) focus-status))) ) - (let ((f0-41 (- (process-focusable-method-24 (the-as target gp-0)) (-> self settings target-height)))) + (let ((f0-41 (- (get-water-height (the-as target gp-0)) (-> self settings target-height)))) (if (< (-> self tpos-curr-adj y) f0-41) (set! (-> self tpos-curr-adj y) f0-41) ) diff --git a/goal_src/jak2/engine/collide/collide-h.gc b/goal_src/jak2/engine/collide/collide-h.gc index 4835be4011..beff12f9fc 100644 --- a/goal_src/jak2/engine/collide/collide-h.gc +++ b/goal_src/jak2/engine/collide/collide-h.gc @@ -30,7 +30,7 @@ (solid-only symbol :offset 120) (best-dist float :offset 112) (best-other-prim basic :offset 116) - (best-my-prim basic :offset 120) + (best-my-prim collide-shape-prim :offset 120) (move-vec vector :inline :offset 224) (best-u float :offset 112) (action-mask collide-action :offset-assert 352) @@ -53,9 +53,3 @@ (define *collide-test-flag* #f) - -0 - - - - diff --git a/goal_src/jak2/engine/collide/collide-shape-h.gc b/goal_src/jak2/engine/collide/collide-shape-h.gc index ab69588935..7800d5e48a 100644 --- a/goal_src/jak2/engine/collide/collide-shape-h.gc +++ b/goal_src/jak2/engine/collide/collide-shape-h.gc @@ -9,6 +9,7 @@ (declare-type collide-shape-moving collide-shape) (declare-type touching-list structure) (declare-type collide-query structure) +(declare-type water-info structure) (declare-type control-info basic) (defenum penetrate @@ -478,11 +479,11 @@ (collide-shape-method-46 (_type_) none 46) (collide-shape-method-47 () none 47) (collide-shape-method-48 () none 48) - (collide-shape-method-49 () none 49) + (collide-shape-method-49 (_type_ int int int) none 49) (collide-shape-method-50 () none 50) (collide-shape-method-51 () none 51) - (collide-shape-method-52 () none 52) - (collide-shape-method-53 () none 53) + (water-info-init! (_type_ water-info collide-action) water-info 52) + (collide-shape-method-53 (_type_) none 53) (collide-shape-method-54 (_type_) none 54) ) ) @@ -522,7 +523,7 @@ (:methods (new (symbol type process-drawable collide-list-enum) _type_ 0) (collide-shape-moving-method-55 (_type_ collide-query collide-spec float float float) symbol 55) - (collide-shape-moving-method-56 () none 56) + (collide-shape-moving-method-56 (_type_ pat-surface) none 56) (collide-shape-moving-method-57 () none 57) (collide-shape-moving-method-58 () none 58) (collide-shape-moving-method-59 () none 59) diff --git a/goal_src/jak2/engine/collide/collide-target-h.gc b/goal_src/jak2/engine/collide/collide-target-h.gc index 70eeeda6ba..d569057352 100644 --- a/goal_src/jak2/engine/collide/collide-target-h.gc +++ b/goal_src/jak2/engine/collide/collide-target-h.gc @@ -19,6 +19,7 @@ (unknown-quaternion01 quaternion :inline :offset 544) (unknown-float04 float :offset 560) (unknown-float05 float :offset 564) + (unknown-float003 float :offset 568) (unknown-float06 float :offset 572) (unknown-float07 float :offset 576) (unknown-time-frame00 time-frame :offset 584) @@ -32,6 +33,7 @@ (unknown-vector05 vector :inline :offset 3744) (unknown-vector06 vector :inline :offset 3760) (unknown-vector07 vector :inline :offset 3776) + (unknown-vector000 vector :inline :offset 3792) (unknown-dynamics00 dynamics :offset 3824) (unknown-surface00 surface :offset 3828) (unknown-surface01 surface :offset 3832) @@ -74,6 +76,7 @@ (unknown-vector22 vector :inline :offset 4560) (unknown-vector23 vector :inline :offset 4576) (unknown-time-frame05 time-frame :offset 4624) + (unknown-float0000 float :offset 4632) (unknown-float17 float :offset 4636) (unknown-float18 float :offset 4640) (unknown-float19 float :offset 4644) @@ -84,6 +87,7 @@ (unknown-pat-surface00 pat-surface :offset 4680) (unknown-vector24 vector :inline :offset 4688) (unknown-vector25 vector :inline :offset 4720) + (unknown-vector001 vector :inline :offset 4736) (unknown-handle00 handle :offset 4768) (unknown-pat-surface01 pat-surface :offset 4776) (unknown-float22 float :offset 4780) @@ -91,6 +95,8 @@ (unknown-float24 float :offset 4788) (unknown-float25 float :offset 4792) (unknown-float26 float :offset 4796) + (unknown-word000 int32 :offset 4800) + (unknown-float002 float :offset 4804) (unknown-time-frame08 time-frame :offset 4816) (unknown-vector26 vector :inline :offset 4928) (unknwon-vector27 vector :inline :offset 4976) @@ -100,7 +106,9 @@ (unknown-word02 int32 :offset 5064) (unknown-time-frame10 time-frame :offset 5072) (unknown-time-frame11 time-frame :offset 5080) + (unknown-time-frame001 time-frame :offset 5088) (unknown-time-frame12 time-frame :offset 5096) + (unknown-time-frame002 time-frame :offset 5104) (unknown-time-frame13 time-frame :offset 5112) (unknown-time-frame14 time-frame :offset 5120) (unknown-float28 float :offset 5132) @@ -119,11 +127,13 @@ (unknown-float32 float :offset 5520) (unknown-word03 int32 :offset 5524) (unknown-float33 float :offset 5528) + (unknown-symbol000 symbol :offset 5532) (unknown-vector34 vector :inline :offset 5536) (unknown-vector35 vector :inline :offset 5552) (unknown-vector36 vector :inline :offset 5568) (unknown-time-frame15 time-frame :offset 5584) (unknown-time-frame16 time-frame :offset 5592) + (unknown-handle000 handle :offset 5600) (unknown-handle01 handle :offset 5608) (unknown-word04 uint32 :offset 5616) (unknown-spool-anim00 spool-anim :offset 5616) @@ -154,8 +164,11 @@ (unknown-time-frame20 time-frame :offset 5944) (unknown-symbol04 symbol :offset 5984) (unknown-symbol05 symbol :offset 5988) + (unknown-attack-id00 int32 :offset 5992) + (unknown-float40 float :offset 5996) (unknown-dword05 uint64 :offset 6000) - (unknown-dword06 uint64 :offset 6008) + (unknown-dword06 handle :offset 6008) + (unknown-time-frame000 time-frame :offset 6016) (unknown-combo-tracker00 combo-tracker :inline :offset 6032) (unknown-time-frame21 time-frame :offset 6072) (unknown-dword07 int64 :offset 6096) @@ -165,8 +178,8 @@ (unknown-symbol06 symbol :offset 6144) (unknown-quaternion04 quaternion :inline :offset 6160) (unknown-sound-id01 sound-id :offset 6176) - (unknown-float40 float :offset 6180) - (unknown-float41 float :offset 6184) + (unknown-float41 float :offset 6180) + (unknown-float42 float :offset 6184) (unknown-halfword00 uint16 :offset 6188) (history-length uint16 :offset 6190) (unknown-word07 int32 :offset 6192) @@ -174,19 +187,21 @@ (unknown-time-frame23 time-frame :offset 6208) (unknown-time-frame24 time-frame :offset 6216) (unknown-time-frame25 time-frame :offset 6224) - (unknown-float42 float :offset 6232) + (unknown-float43 float :offset 6232) + (unknown-float001 float :offset 6236) (unknown-sound-id02 sound-id :offset 6240) (unknown-sound-id03 sound-id :offset 6244) (unknown-time-frame26 time-frame :offset 6248) (unknown-time-frame27 time-frame :offset 6256) (unknown-dword11 int64 :offset 6264) (unknown-vector44 vector :inline :offset 6272) - (unknown-float43 float :offset 6288) + (unknown-float44 float :offset 6288) (unknown-sound-id04 sound-id :offset 6292) + (unknown-float45 float :offset 6296) (unknown-word08 int32 :offset 6300) - (unknown-word09 int32 :offset 6304) - (unknown-word10 int32 :offset 6308) - (unknown-word11 int32 :offset 6312) + (unknown-sphere000 sphere :offset 6304) + (unknown-word09 int32 :offset 6308) + (unknown-word10 uint32 :offset 6312) (unknown-time-frame28 time-frame :offset 6320) (unknown-time-frame29 time-frame :offset 6328) (unknown-dword12 int64 :offset 6336) @@ -200,4 +215,3 @@ :size-assert #x1910 :flag-assert #x4400001910 ) - diff --git a/goal_src/jak2/engine/collide/collide-touch-h.gc b/goal_src/jak2/engine/collide/collide-touch-h.gc index 31cc34e4f0..51b2ec58c2 100644 --- a/goal_src/jak2/engine/collide/collide-touch-h.gc +++ b/goal_src/jak2/engine/collide/collide-touch-h.gc @@ -107,7 +107,7 @@ (get-head (_type_) touching-prims-entry 9) (get-next (_type_ touching-shapes-entry) touching-prims-entry 10) (touching-shapes-entry-method-11 () none 11) - (touching-shapes-entry-method-12 (_type_ collide-shape uint) touching-prims-entry 12) + (prims-touching? (_type_ collide-shape uint) touching-prims-entry 12) (touching-shapes-entry-method-13 (_type_ collide-shape uint uint) basic 13) (touching-shapes-entry-method-14 () none 14) ) diff --git a/goal_src/jak2/engine/common_objs/basebutton.gc b/goal_src/jak2/engine/common_objs/basebutton.gc index ffd9b15c37..9592d8bf4e 100644 --- a/goal_src/jak2/engine/common_objs/basebutton.gc +++ b/goal_src/jak2/engine/common_objs/basebutton.gc @@ -55,22 +55,7 @@ ) -(let ((a0-2 (new 'static 'skeleton-group - :name "skel-generic-button" - :extra #f - :info #f - :art-group-name "mtn-dice-button" - :bounds (new 'static 'vector :w 12288.0) - :version #x7 - ) - ) - ) - (set! (-> a0-2 jgeo) 0) - (set! (-> a0-2 janim) 3) - (set! (-> a0-2 mgeo 0) 1) - (set! (-> a0-2 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-2) - ) +(defskelgroup skel-generic-button mtn-dice-button 0 3 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 3)) (defmethod move-to! basebutton ((obj basebutton) (vec vector) (quat quaternion)) (logclear! (-> obj button-status) (button-status button-status-2)) diff --git a/goal_src/jak2/engine/common_objs/blocking-plane.gc b/goal_src/jak2/engine/common_objs/blocking-plane.gc index bfe8c08e81..55bfb0eb96 100644 --- a/goal_src/jak2/engine/common_objs/blocking-plane.gc +++ b/goal_src/jak2/engine/common_objs/blocking-plane.gc @@ -21,23 +21,11 @@ ) -(let ((a0-2 (new 'static 'skeleton-group - :name "skel-blocking-plane" - :extra #f - :info #f - :art-group-name "blocking-plane" - :bounds (new 'static 'vector :w 410009.6) - :texture-level #x6 - :version #x7 +(defskelgroup skel-blocking-plane blocking-plane 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 100.1) + :texture-level 6 ) - ) - ) - (set! (-> a0-2 jgeo) 0) - (set! (-> a0-2 janim) 2) - (set! (-> a0-2 mgeo 0) 1) - (set! (-> a0-2 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-2) - ) (defstate idle (blocking-plane) :virtual #t diff --git a/goal_src/jak2/engine/common_objs/crates.gc b/goal_src/jak2/engine/common_objs/crates.gc index f02f8e91c9..3d4156cf08 100644 --- a/goal_src/jak2/engine/common_objs/crates.gc +++ b/goal_src/jak2/engine/common_objs/crates.gc @@ -5,5 +5,1483 @@ ;; name in dgo: crates ;; dgos: ENGINE, GAME +(define-extern process-contact-action (function process none :behavior target)) +(define-extern eco-blue-glow (function vector none)) +(define-extern cshape-reaction-default (function control-info collide-query vector vector cshape-moving-flags)) + ;; DECOMP BEGINS +(defskelgroup skel-crate-krimson crate 0 3 + ((1 (meters 20)) (2 (meters 999999))) + :bounds (static-spherem 0 1 0 1.6) + :texture-level 6 + ) + +(deftype crate-bank (basic) + ((COLLIDE_YOFF float :offset-assert 4) + (COLLIDE_RADIUS float :offset-assert 8) + (DARKECO_EXPLODE_RADIUS float :offset-assert 12) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +(define *CRATE-bank* + (new 'static 'crate-bank :COLLIDE_YOFF 4096.0 :COLLIDE_RADIUS 6963.2 :DARKECO_EXPLODE_RADIUS 16384.0) + ) + +(deftype crate (process-focusable) + ((smush smush-control :inline :offset-assert 208) + (base vector :inline :offset-assert 240) + (look symbol :offset-assert 256) + (defense symbol :offset-assert 260) + (incoming-attack-id uint32 :offset-assert 264) + (target handle :offset-assert 272) + (child-count int32 :offset-assert 280) + (victory-anim spool-anim :offset-assert 284) + ) + :heap-base #xa0 + :method-count-assert 41 + :size-assert #x120 + :flag-assert #x2900a00120 + (:methods + (hide () _type_ :state 27) + (idle () _type_ :state 28) + (die (symbol int) _type_ :state 29) + (special-contents-die () _type_ :state 30) + (bounce-on () _type_ :state 31) + (notice-blue (handle) _type_ :state 32) + (carry () _type_ :state 33) + (fall () _type_ :state 34) + (crate-init! (_type_ entity-actor) none 35) + (skel-init! (_type_) none 36) + (params-set! (_type_ symbol symbol) none 37) + (crate-method-38 (_type_) none 38) + (smush-update! (_type_) none 39) + (crate-method-40 (_type_) symbol :behavior crate 40) + ) + ) + +(method-set! crate 12 (method-of-type process run-logic?)) + +(defbehavior crate-post crate () + (rider-trans) + (smush-update! self) + (rider-post) + (carry-info-method-9 (-> self carry)) + ) + +(defpart 565 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-flt spt-num 16.0) + (sp-rnd-flt spt-y (meters 0.5) (meters 1) 1.0) + (sp-rnd-flt spt-scale-x (meters 1.5) (meters 1.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 32.0 1.0) + (sp-rnd-flt spt-g 128.0 32.0 1.0) + (sp-rnd-flt spt-b 128.0 32.0 1.0) + (sp-rnd-flt spt-a 32.0 16.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.016666668) (meters 0.033333335) 1.0) + (sp-rnd-flt spt-rotvel-z (degrees -1.2) (degrees 1.2) 1.0) + (sp-flt spt-accel-y 2.7306666) + (sp-int spt-timer 120) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-12 sp-cpuinfo-flag-14 sp-cpuinfo-flag-21) + (sp-int-plain-rnd spt-next-time 30 59 1) + (sp-launcher-by-id spt-next-launcher 566) + (sp-rnd-flt spt-conerot-x (degrees 70.0) (degrees 20.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +(defpart 566 + :init-specs ((sp-flt spt-fade-a -1.0666667)) + ) + +(defpart 567 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x92 :page #xc)) + (sp-flt spt-num 4.0) + (sp-flt spt-y (meters 0.75)) + (sp-flt spt-scale-x (meters 6)) + (sp-int spt-rot-x 4) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.3) (meters 1) 1.0) + (sp-flt spt-r 192.0) + (sp-flt spt-g 192.0) + (sp-rnd-flt spt-b 64.0 128.0 1.0) + (sp-flt spt-a 0.0) + (sp-flt spt-scalevel-x (meters 0.009765625)) + (sp-rnd-flt spt-rotvel-z (degrees -0.15) (degrees 0.3) 1.0) + (sp-flt spt-scalevel-y (meters 0.009765625)) + (sp-flt spt-fade-a 2.1333334) + (sp-int spt-timer 30) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 sp-cpuinfo-flag-21) + (sp-int spt-next-time 15) + (sp-launcher-by-id spt-next-launcher 568) + (sp-flt spt-rotate-y (degrees 0.0)) + ) + ) + +(defpart 568 + :init-specs ((sp-flt spt-fade-a -2.1333334)) + ) + +(defpart 569 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-y (meters 1)) + (sp-flt spt-scale-x (meters 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 196.0) + (sp-flt spt-g 196.0) + (sp-flt spt-b 196.0) + (sp-flt spt-a 28.0) + (sp-int spt-timer 10) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 sp-cpuinfo-flag-21) + ) + ) + +(defpart 570 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc :page #xc)) + (sp-flt spt-num 5.0) + (sp-rnd-flt spt-x (meters -0.5) (meters 1) 1.0) + (sp-rnd-flt spt-y (meters 0.25) (meters 1.5) 1.0) + (sp-rnd-flt spt-z (meters -0.5) (meters 1) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.6) (meters 0.00048828125) 2457.6) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-scale-y (meters 0.3)) + (sp-flt spt-r 160.0) + (sp-flt spt-g 160.0) + (sp-flt spt-b 160.0) + (sp-flt spt-a 128.0) + (sp-rnd-flt spt-vel-y (meters 0.06666667) (meters 0.06666667) 1.0) + (sp-flt spt-rotvel-x (degrees 1.2)) + (sp-flt spt-rotvel-y (degrees 2.4)) + (sp-rnd-int-flt spt-rotvel-z (degrees 0.0) 2 436.90668) + (sp-flt spt-accel-y -13.653334) + (sp-flt spt-friction 0.97) + (sp-int spt-timer 150) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-12 sp-cpuinfo-flag-14 sp-cpuinfo-flag-21) + (sp-int spt-next-time 75) + (sp-launcher-by-id spt-next-launcher 571) + (sp-rnd-flt spt-conerot-x (degrees 40.0) (degrees 30.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +(defpart 571 + :init-specs ((sp-flt spt-scalevel-x (meters -0.0033333334)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -3.4) + ) + ) + +(defpart 572 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xb :page #xc)) + (sp-flt spt-num 4.5) + (sp-rnd-flt spt-x (meters -0.5) (meters 1) 1.0) + (sp-rnd-flt spt-y (meters 0.25) (meters 1.5) 1.0) + (sp-rnd-flt spt-z (meters -0.5) (meters 1) 1.0) + (sp-rnd-int-flt spt-scale-x (meters 0.3) 1 4096.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-scale-y (meters 0.3)) + (sp-flt spt-r 100.0) + (sp-flt spt-g 100.0) + (sp-flt spt-b 100.0) + (sp-flt spt-a 128.0) + (sp-rnd-flt spt-vel-y (meters 0.06666667) (meters 0.06666667) 1.0) + (sp-flt spt-rotvel-x (degrees 1.2)) + (sp-flt spt-rotvel-y (degrees 2.4)) + (sp-rnd-int-flt spt-rotvel-z (degrees 0.0) 3 436.90668) + (sp-flt spt-accel-y -13.653334) + (sp-flt spt-friction 0.97) + (sp-int spt-timer 150) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-12 sp-cpuinfo-flag-14 sp-cpuinfo-flag-21) + (sp-int spt-next-time 75) + (sp-launcher-by-id spt-next-launcher 571) + (sp-rnd-flt spt-conerot-x (degrees 40.0) (degrees 30.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +(defpartgroup group-crate-explode + :id 124 + :duration (seconds 0.017) + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 12) + :parts ((sp-item 565 :flags (bit7)) + (sp-item 567 :flags (bit7)) + (sp-item 569 :flags (bit7)) + (sp-item 570 :flags (bit7)) + (sp-item 572 :flags (bit7)) + ) + ) + +(defpartgroup group-crate-steel-explode + :id 125 + :duration (seconds 0.017) + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 12) + :parts ((sp-item 565) (sp-item 567) (sp-item 569) (sp-item 572) (sp-item 572) (sp-item 572)) + ) + +(defpartgroup group-dark-eco-box-explosion + :id 126 + :duration (seconds 2) + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 12) + :parts ((sp-item 154 :fade-after (meters 100) :period 600 :length 5 :binding 152) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 573 :fade-after (meters 160) :period 600 :length 5) + (sp-item 155 :period 600 :length 5) + (sp-item 156 :fade-after (meters 80) :falloff-to (meters 80) :period 600 :length 40) + (sp-item 157 :period 600 :length 20) + (sp-item 574 :fade-after (meters 120) :falloff-to (meters 120) :period 600 :length 20) + ) + ) + +(defpart 156 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 6.0) + (sp-rnd-flt spt-scale-x (meters 0.2) (meters 0.4) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 64.0 128.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 96.0 64.0 1.0) + (sp-rnd-flt spt-a 32.0 96.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.026666667) (meters 0.10666667) 1.0) + (sp-flt spt-scalevel-x (meters -0.0016666667)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-accel-y -0.68266666 -0.68266666 1.0) + (sp-flt spt-friction 0.9) + (sp-int spt-timer 300) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-14) + (sp-int-plain-rnd spt-next-time 30 29 1) + (sp-launcher-by-id spt-next-launcher 575) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 140.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-conerot-radius (meters 2) (meters 4) 1.0) + ) + ) + +(defpart 575 + :init-specs ((sp-flt spt-fade-r 0.0) (sp-flt spt-fade-g 0.0) (sp-flt spt-fade-b 0.0) (sp-flt spt-fade-a -1.4222223)) + ) + +(defpart 574 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 3.0) + (sp-flt spt-scale-x (meters 0.2)) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 180.0) 1.0) + (sp-flt spt-scale-y (meters 8)) + (sp-rnd-flt spt-r 64.0 192.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 128.0 64.0 1.0) + (sp-rnd-flt spt-a 32.0 64.0 1.0) + (sp-flt spt-scalevel-y (meters 0.42666668)) + (sp-flt spt-fade-a -1.6) + (sp-int spt-timer 60) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + ) + ) + +(defpart 155 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 16)) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 64.0 192.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 128.0 64.0 1.0) + (sp-flt spt-a 96.0) + (sp-flt spt-fade-a -1.7454545) + (sp-int spt-timer 54) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + ) + ) + +(defpart 157 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-flt spt-num 4.0) + (sp-rnd-flt spt-scale-x (meters 2.5) (meters 1.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 0.0 96.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-rnd-flt spt-a 64.0 64.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.053333335) (meters 0.013333334) 1.0) + (sp-flt spt-scalevel-x (meters 0.013333334)) + (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-a -0.42666668) + (sp-rnd-flt spt-accel-y 0.68266666 0.68266666 1.0) + (sp-flt spt-friction 0.8) + (sp-int spt-timer 510) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-14) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 110.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +(defpart 154 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) + (sp-flt spt-num 16.0) + (sp-flt spt-y (meters 1)) + (sp-flt spt-scale-x (meters 0.1)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-y (meters 0.053333335) (meters 0.026666667) 1.0) + (sp-flt spt-accel-y -1.3653333) + (sp-flt spt-friction 0.94) + (sp-int spt-timer 240) + (sp-cpuinfo-flags sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 140.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +(defpart 152 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-y (meters 0) (meters 16) 1.0) + (sp-rnd-flt spt-z (meters 0.3) (meters 0.3) 1.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-rnd-flt spt-r 0.0 96.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-rnd-flt spt-a 64.0 64.0 1.0) + (sp-rnd-flt spt-omega 0.0 65536.0 1.0) + (sp-rnd-flt spt-vel-x (meters 0.026666667) (meters 0.10666667) 1.0) + (sp-flt spt-scalevel-x (meters -0.000909091)) + (sp-rnd-int-flt spt-rotvel-z (degrees -0.3) 1 109.22667) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -0.26666668) + (sp-flt spt-fade-a -0.19393939) + (sp-int-plain-rnd spt-timer 90 149 1) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 ready-to-launch sp-cpuinfo-flag-14) + ) + ) + +(defpart 153 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.1) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 32.0 96.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-rnd-flt spt-a 32.0 32.0 1.0) + (sp-flt spt-scalevel-x (meters -0.0006190476)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.01904762) + (sp-rnd-flt spt-accel-y -0.40960002 -0.6144 1.0) + (sp-int-plain-rnd spt-timer 30 299 1) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + (sp-int spt-next-time 240) + (sp-launcher-by-id spt-next-launcher 397) + ) + ) + +(defpart 573 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xb :page #xc)) + (sp-rnd-flt spt-num 8.0 16.0 1.0) + (sp-rnd-flt spt-x (meters -0.5) (meters 1) 1.0) + (sp-rnd-flt spt-y (meters 0.25) (meters 1.5) 1.0) + (sp-rnd-flt spt-z (meters -0.5) (meters 1) 1.0) + (sp-rnd-int-flt spt-scale-x (meters 0.3) 1 4096.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-scale-y (meters 0.3)) + (sp-flt spt-r 128.0) + (sp-rnd-int spt-g 1115684864 1 32.0) + (sp-flt spt-b 32.0) + (sp-flt spt-a 128.0) + (sp-rnd-flt spt-vel-y (meters 0.06666667) (meters 0.06666667) 1.0) + (sp-flt spt-rotvel-x (degrees 1.2)) + (sp-flt spt-rotvel-y (degrees 2.4)) + (sp-rnd-int-flt spt-rotvel-z (degrees 0.0) 3 436.90668) + (sp-flt spt-accel-y -13.653334) + (sp-flt spt-friction 0.97) + (sp-int spt-timer 150) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-12 sp-cpuinfo-flag-14) + (sp-int spt-next-time 75) + (sp-launcher-by-id spt-next-launcher 576) + (sp-rnd-flt spt-conerot-x (degrees 40.0) (degrees 30.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +(defpart 576 + :init-specs ((sp-flt spt-scalevel-x (meters -0.0033333334)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -3.4) + ) + ) + +(defbehavior crate-standard-event-handler crate ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('track) + (zero? (logand (actor-option no-track) (-> self fact options))) + ) + (('attack) + (let* ((v1-3 (the-as attack-info (-> arg3 param 1))) + (s4-0 (-> v1-3 id)) + (s5-0 (-> v1-3 count)) + ) + (case (-> self defense) + (('iron) + (case (-> v1-3 mode) + (('flop 'uppercut 'explode 'eco-yellow 'racer 'board 'tube 'flut-bonk 'flut-attack 'darkjak 'mech-punch) + (if (and (logtest? (-> self fact options) (actor-option racer-only)) + (= (-> arg0 type) target) + (zero? (logand (focus-status pilot) (-> (the-as target arg0) focus-status))) + ) + (return #f) + ) + (send-event arg0 'get-attack-count 1) + (process-contact-action arg0) + (set! (-> self target) (process->handle arg0)) + (go-virtual die #f (the-as int s5-0)) + ) + (else + (when (and (!= s4-0 (-> self incoming-attack-id)) (= (-> self root trans y) (-> self base y))) + (if (not (and (demo?) (= (-> *setting-control* user-current language) (language-enum japanese)))) + (talker-spawn-func (-> *talker-speech* 313) *entity-pool* (target-pos 0) (the-as region #f)) + ) + (talker-spawn-func (-> *talker-speech* 315) *entity-pool* (target-pos 0) (the-as region #f)) + (set! (-> self incoming-attack-id) s4-0) + (if (not (!= (-> self smush amp) 0.0)) + (sound-play "icrate-nobreak") + ) + (activate! (-> self smush) 0.1 90 150 1.0 1.0 (-> self clock)) + (go-virtual bounce-on) + ) + #f + ) + ) + ) + (('steel) + (case (-> v1-3 mode) + (('explode 'eco-yellow 'tube 'flut-bonk 'flut-attack 'racer 'board 'darkjak 'mech-punch) + (send-event arg0 'get-attack-count 1) + (when (logtest? (-> self draw status) (draw-control-status on-screen)) + (talker-spawn-func (-> *talker-speech* 316) *entity-pool* (target-pos 0) (the-as region #f)) + (talker-spawn-func (-> *talker-speech* 317) *entity-pool* (target-pos 0) (the-as region #f)) + ) + (process-contact-action arg0) + (set! (-> self target) (process->handle arg0)) + (go-virtual die #f (the-as int s5-0)) + ) + (else + (when (and (!= s4-0 (-> self incoming-attack-id)) (= (-> self root trans y) (-> self base y))) + (talker-spawn-func (-> *talker-speech* 318) *entity-pool* (target-pos 0) (the-as region #f)) + (set! (-> self incoming-attack-id) s4-0) + (if (not (!= (-> self smush amp) 0.0)) + (sound-play "scrate-nobreak") + ) + (activate! (-> self smush) 0.1 90 150 1.0 1.0 (-> self clock)) + (go-virtual bounce-on) + ) + #f + ) + ) + ) + (('darkeco) + (let ((a1-36 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-36 from) (process->ppointer self)) + (set! (-> a1-36 num-params) 2) + (set! (-> a1-36 message) 'attack) + (set! (-> a1-36 param 0) (-> arg3 param 0)) + (let ((v1-83 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (let* ((a0-67 *game-info*) + (a2-11 (+ (-> a0-67 attack-id) 1)) + ) + (set! (-> a0-67 attack-id) a2-11) + (set! (-> v1-83 id) a2-11) + ) + (set! (-> v1-83 mode) 'darkeco) + (set! (-> a1-36 param 1) (the-as uint v1-83)) + ) + (send-event-function arg0 a1-36) + ) + (when (= (-> arg0 type) target) + (talker-spawn-func (-> *talker-speech* 319) *entity-pool* (target-pos 0) (the-as region #f)) + (talker-spawn-func (-> *talker-speech* 314) *entity-pool* (target-pos 0) (the-as region #f)) + ) + (process-contact-action arg0) + (set! (-> self target) (process->handle arg0)) + (go-virtual die #f (the-as int s5-0)) + ) + (else + (-> v1-3 mode) + (send-event arg0 'get-attack-count 1) + (process-contact-action arg0) + (set! (-> self target) (process->handle arg0)) + (go-virtual die #f (the-as int s5-0)) + ) + ) + ) + ) + (('touch) + (case (-> self defense) + (('darkeco) + (let ((a1-42 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-42 from) (process->ppointer self)) + (set! (-> a1-42 num-params) 2) + (set! (-> a1-42 message) 'attack) + (set! (-> a1-42 param 0) (-> arg3 param 0)) + (let ((v1-111 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (let* ((a0-93 *game-info*) + (a2-15 (+ (-> a0-93 attack-id) 1)) + ) + (set! (-> a0-93 attack-id) a2-15) + (set! (-> v1-111 id) a2-15) + ) + (set! (-> v1-111 mode) 'darkeco) + (set! (-> a1-42 param 1) (the-as uint v1-111)) + ) + (send-event-function arg0 a1-42) + ) + (process-contact-action arg0) + (set! (-> self target) (process->handle arg0)) + (go-virtual die #f 0) + ) + ) + ) + (('bonk) + (when (= (-> self root trans y) (-> self base y)) + (activate! (-> self smush) -0.1 75 150 1.0 1.0 (-> self clock)) + (go-virtual bounce-on) + ) + ) + (('wake) + (let ((v0-1 (the-as object (logclear (-> self mask) (process-mask sleep))))) + (set! (-> self mask) (the-as process-mask v0-1)) + v0-1 + ) + ) + (('hide) + (go-virtual hide) + ) + (('eco-blue) + (if (not (or (= (-> self defense) 'darkeco) + (and (-> self next-state) (let ((v1-131 (-> self next-state name))) + (or (= v1-131 'notice-blue) (= v1-131 'die)) + ) + ) + (!= (-> self root trans y) (-> self base y)) + ) + ) + (go-virtual notice-blue (process->handle arg0)) + ) + ) + (('fall) + (when (not (and (-> self next-state) (= (-> self next-state name) 'fall))) + (set! (-> self root transv quad) (-> (the-as vector (-> arg3 param 0)) quad)) + (go-virtual fall) + ) + ) + ) + ) + +(defstate hide (crate) + :virtual #t + :code (behavior () + (process-entity-status! self (entity-perm-status dead) #f) + (process-entity-status! self (entity-perm-status subtask-complete) #f) + (vector+! (-> self draw origin) (-> self root trans) (-> self draw bounds)) + (set! (-> self draw origin w) (-> self draw bounds w)) + (logior! (-> self draw status) (draw-control-status no-draw)) + (let ((v1-9 (-> (the-as collide-shape-moving (-> self root)) root-prim))) + (set! (-> v1-9 prim-core collide-as) (collide-spec)) + (set! (-> v1-9 prim-core collide-with) (collide-spec)) + ) + 0 + (ja-post) + (while (or (crate-method-40 self) + (and (sphere-in-view-frustum? (the-as sphere (-> self draw origin))) + (< (vector-vector-distance (camera-pos) (-> self root trans)) 327680.0) + ) + (and *target* (and (>= 40960.0 (vector-vector-distance (-> self root trans) (-> *target* control trans))) + (zero? (logand (focus-status teleporting) (-> *target* focus-status))) + ) + ) + ) + (suspend) + ) + (logclear! (-> self draw status) (draw-control-status no-draw)) + (let ((v1-29 (-> (the-as collide-shape-moving (-> self root)) root-prim))) + (set! (-> v1-29 prim-core collide-as) (-> (the-as collide-shape-moving (-> self root)) backup-collide-as)) + (set! (-> v1-29 prim-core collide-with) (-> (the-as collide-shape-moving (-> self root)) backup-collide-with)) + ) + (go-virtual idle) + (none) + ) + ) + +(defstate idle (crate) + :virtual #t + :event crate-standard-event-handler + :code (behavior () + (suspend) + (collide-shape-method-46 (the-as collide-shape-moving (-> self root))) + (carry-info-method-9 (-> self carry)) + (logior! (-> self mask) (process-mask sleep)) + (until #f + (suspend) + ) + #f + (none) + ) + :post (the-as (function none :behavior crate) ja-post) + ) + +(defstate carry (crate) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('carry? 'carry-info) + (-> self carry) + ) + (('drop) + (set! (-> self root transv quad) (-> (the-as vector (-> event param 1)) quad)) + (go-virtual fall) + ) + ) + ) + :code (the-as (function none :behavior crate) sleep-code) + :post (behavior () + (ja-post) + (carry-info-method-9 (-> self carry)) + (carry-info-method-13 (-> self carry)) + (collide-shape-method-46 (the-as collide-shape-moving (-> self root))) + (none) + ) + ) + +(defstate fall (crate) + :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 'carry-info) + (-> self carry) + ) + ((or (= v1-0 'carry?) (= v1-0 'pickup)) + (the-as carry-info #f) + ) + ) + ) + ) + ) + :enter (behavior () + (when (handle->process (-> self carry other)) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer self)) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'carry-info) + (let* ((a0-9 (the-as carry-info (send-event-function (handle->process (-> self carry other)) a1-1))) + (t9-1 (method-of-object a0-9 carry-info-method-12)) + ) + (-> self carry) + (t9-1 a0-9) + ) + ) + ) + (set! (-> (the-as collide-shape-moving (-> self root)) status) (cshape-moving-flags)) + (set! (-> (the-as collide-shape-moving (-> self root)) root-prim local-sphere w) (-> self carry carry-radius)) + (set! (-> (the-as collide-shape-moving (-> self root)) root-prim prim-core collide-with) + (logior (collide-spec backgnd crate obstacle hit-by-others-list pusher) + (-> (the-as collide-shape-moving (-> self root)) root-prim prim-core collide-with) + ) + ) + (none) + ) + :trans (behavior () + (when (and (logtest? (-> (the-as collide-shape-moving (-> self root)) status) (cshape-moving-flags on-surface)) + (< 0.8 (-> (the-as collide-shape-moving (-> self root)) surface-angle)) + ) + (vector-reset! (-> self root transv)) + (when (= (vector-length (-> self root transv)) 0.0) + (set! (-> (the-as collide-shape-moving (-> self root)) root-prim local-sphere w) + (-> self carry backup-radius) + ) + (set! (-> self base quad) (-> self root trans quad)) + (let ((v1-16 (-> (the-as collide-shape-moving (-> self root)) root-prim))) + (set! (-> v1-16 prim-core collide-as) (-> (the-as collide-shape-moving (-> self root)) backup-collide-as)) + (set! (-> v1-16 prim-core collide-with) (-> (the-as collide-shape-moving (-> self root)) backup-collide-with)) + ) + (go-virtual idle) + ) + ) + (none) + ) + :code (the-as (function none :behavior crate) sleep-code) + :post (behavior () + (let* ((gp-0 vector-v++!) + (s5-0 (-> self root transv)) + (a0-0 (-> self root)) + (t9-0 (method-of-object (the-as collide-shape-moving a0-0) collide-shape-moving-method-62)) + ) + (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) + 0 + (gp-0 s5-0 (the-as vector (t9-0 (the-as collide-shape-moving a0-0)))) + ) + (if (< (-> (the-as collide-shape-moving (-> self root)) dynam gravity-max) (vector-length (-> self root transv))) + (vector-normalize! (-> self root transv) (-> (the-as collide-shape-moving (-> self root)) dynam gravity-max)) + ) + (let ((gp-1 (-> self root))) + (let ((a2-1 (new 'stack-no-clear 'collide-query))) + (set! (-> (the-as collide-shape-moving gp-1) root-prim type) collide-shape-prim-sphere) + (set! (-> a2-1 collide-with) (collide-spec backgnd crate obstacle pusher)) + (set! (-> a2-1 ignore-process0) self) + (set! (-> a2-1 ignore-process1) #f) + (set! (-> a2-1 ignore-pat) (-> (the-as collide-shape-moving gp-1) pat-ignore-mask)) + (set! (-> a2-1 action-mask) (collide-action solid)) + (collide-shape-method-32 + (the-as collide-shape-moving gp-1) + (-> (the-as collide-shape-moving gp-1) transv) + a2-1 + (meters 0) + ) + ) + (set! (-> (the-as collide-shape-moving gp-1) root-prim type) collide-shape-prim-mesh) + ) + (crate-post) + (none) + ) + ) + +(defstate bounce-on (crate) + :virtual #t + :event crate-standard-event-handler + :code (behavior () + (while (!= (-> self smush amp) 0.0) + (suspend) + ) + (go-virtual idle) + (none) + ) + :post (the-as (function none :behavior crate) crate-post) + ) + +(defstate notice-blue (crate) + :virtual #t + :event crate-standard-event-handler + :trans (behavior () + (cond + ((not (send-event *target* 'query 'powerup (pickup-type eco-blue))) + (logior! (-> self mask) (process-mask sleep-code)) + (if (not (!= (-> self smush amp) 0.0)) + (go-virtual idle) + ) + ) + (else + (logclear! (-> self mask) (process-mask sleep-code)) + ) + ) + (none) + ) + :code (behavior ((arg0 handle)) + (set! (-> self target) arg0) + (until #f + (let* ((gp-0 (handle->process (-> self target))) + (v1-3 (if (type? gp-0 process-drawable) + gp-0 + ) + ) + ) + (when v1-3 + (let* ((gp-1 (-> (the-as process-drawable v1-3) root)) + (v1-4 (if (type? (the-as collide-shape-moving gp-1) collide-shape) + gp-1 + ) + ) + ) + (when v1-4 + (let* ((gp-2 (-> (the-as collide-shape-moving (-> self root)) root-prim prim-core)) + (a1-3 (-> (the-as collide-shape-moving v1-4) root-prim prim-core)) + (f30-0 (vector-vector-distance (the-as vector gp-2) (the-as vector a1-3))) + ) + (when (and (< f30-0 (-> *FACT-bank* suck-suck-dist)) (!= (-> self defense) 'steel)) + (logior! (-> self fact options) (actor-option suck-in)) + (process-contact-action (handle->process (-> self target))) + (go-virtual die #f 0) + ) + (when (rand-vu-percent? 0.5) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 quad) (-> gp-2 world-sphere quad)) + (dotimes (gp-3 3) + (+! (-> s5-0 data gp-3) (rand-vu-float-range -5324.8 5324.8)) + ) + (eco-blue-glow s5-0) + ) + ) + (activate! + (-> self smush) + (lerp-scale + (rand-vu-float-range 0.1 0.3) + (rand-vu-float-range 0.0 0.02) + f30-0 + (-> *FACT-bank* suck-suck-dist) + (-> *FACT-bank* suck-bounce-dist) + ) + 60 + 60 + 1.0 + 1.0 + (-> self clock) + ) + ) + ) + ) + ) + ) + (suspend) + ) + #f + (none) + ) + :post (the-as (function none :behavior crate) crate-post) + ) + +(defstate die (crate) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('touched) + (case (-> self defense) + (('darkeco) + (let ((a1-3 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-3 from) (process->ppointer self)) + (set! (-> a1-3 num-params) 2) + (set! (-> a1-3 message) 'attack) + (set! (-> a1-3 param 0) (-> event param 0)) + (let ((v1-6 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (let* ((a2-2 *game-info*) + (a3-2 (+ (-> a2-2 attack-id) 1)) + ) + (set! (-> a2-2 attack-id) a3-2) + (set! (-> v1-6 id) a3-2) + ) + (set! (-> v1-6 mode) 'darkeco) + (set! (-> a1-3 param 1) (the-as uint v1-6)) + ) + (send-event-function proc a1-3) + ) + ) + ) + ) + ) + ) + :code (behavior ((arg0 symbol) (arg1 int)) + (logior! (-> self focus-status) (focus-status dead)) + (let ((v1-3 (-> (the-as collide-shape (-> self root)) root-prim))) + (set! (-> v1-3 prim-core collide-as) (collide-spec)) + (set! (-> v1-3 prim-core collide-with) (collide-spec)) + ) + 0 + (if (nonzero? (-> self sound)) + (stop! (-> self sound)) + ) + (let ((v1-10 (handle->process (-> self target)))) + (if (and (and v1-10 + (= (-> v1-10 type) target) + (logtest? (focus-status flut tube board pilot) (-> (the-as process-focusable v1-10) focus-status)) + ) + (and (!= (-> self fact pickup-type) 10) (not arg0)) + ) + (logior! (-> self fact options) (actor-option suck-in)) + ) + ) + (when (not arg0) + (let ((s5-1 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) s5-1) (seconds 0.04)) + (suspend) + ) + ) + (logior! (-> self draw status) (draw-control-status no-draw)) + (case (-> self look) + (('iron) + (sound-play "icrate-break") + ) + (('steel) + (sound-play "scrate-break") + ) + (('darkeco) + (sound-play "dcrate-break") + ) + (else + (sound-play "wcrate-break") + ) + ) + (case (-> self defense) + (('darkeco) + (let ((f0-0 (lerp-scale 1.0 0.0 (vector-vector-distance (-> self root trans) (target-pos 0)) 8192.0 40960.0))) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 (the int (* 255.0 f0-0)) (seconds 0.3)) + ) + (process-spawn + touch-tracker + :init touch-tracker-init + (-> self root trans) + (-> *CRATE-bank* DARKECO_EXPLODE_RADIUS) + 30 + :to self + ) + ) + ) + (case (-> self look) + (('darkeco) + (let ((s5-8 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-8 + (let ((t9-17 (method-of-type part-tracker activate))) + (t9-17 (the-as part-tracker s5-8) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) + ) + (let ((t9-18 run-function-in-process) + (a0-34 s5-8) + (a1-21 part-tracker-init) + (a2-11 (-> *part-group-id-table* 126)) + (a3-9 0) + (t0-6 #f) + (t1-4 #f) + (t2-4 #f) + (t3-0 *launch-matrix*) + ) + (set! (-> t3-0 trans quad) (-> self root trans quad)) + ((the-as (function object object object object object object object object none) t9-18) + a0-34 + a1-21 + a2-11 + a3-9 + t0-6 + t1-4 + t2-4 + t3-0 + ) + ) + (-> s5-8 ppointer) + ) + ) + ) + (('steel 'iron) + (let ((s5-9 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-9 + (let ((t9-20 (method-of-type part-tracker activate))) + (t9-20 (the-as part-tracker s5-9) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) + ) + (let ((t9-21 run-function-in-process) + (a0-39 s5-9) + (a1-27 part-tracker-init) + (a2-14 (-> *part-group-id-table* 125)) + (a3-11 0) + (t0-7 #f) + (t1-5 #f) + (t2-5 #f) + (t3-1 *launch-matrix*) + ) + (set! (-> t3-1 trans quad) (-> self root trans quad)) + ((the-as (function object object object object object object object object none) t9-21) + a0-39 + a1-27 + a2-14 + a3-11 + t0-7 + t1-5 + t2-5 + t3-1 + ) + ) + (-> s5-9 ppointer) + ) + ) + ) + (else + (let ((s5-10 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-10 + (let ((t9-23 (method-of-type part-tracker activate))) + (t9-23 (the-as part-tracker s5-10) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) + ) + (let ((t9-24 run-function-in-process) + (a0-42 s5-10) + (a1-32 part-tracker-init) + (a2-17 (-> *part-group-id-table* 124)) + (a3-13 0) + (t0-8 #f) + (t1-6 #f) + (t2-6 #f) + (t3-2 *launch-matrix*) + ) + (set! (-> t3-2 trans quad) (-> self root trans quad)) + ((the-as (function object object object object object object object object none) t9-24) + a0-42 + a1-32 + a2-17 + a3-13 + t0-8 + t1-6 + t2-6 + t3-2 + ) + ) + (-> s5-10 ppointer) + ) + ) + ) + ) + ) + (case (-> self fact pickup-type) + (((pickup-type money) + (pickup-type buzzer) + (pickup-type eco-blue) + (pickup-type eco-yellow) + (pickup-type eco-red) + (pickup-type fuel-cell) + (pickup-type gem) + (pickup-type skill) + ) + (go-virtual special-contents-die) + ) + (((pickup-type health)) + (if (not (demo?)) + (talker-spawn-func (-> *talker-speech* 8) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ) + ) + (let ((t9-29 (method-of-object (-> self fact) fact-info-method-9))) + #t + *entity-pool* + (t9-29) + ) + (process-entity-status! self (entity-perm-status dead) #t) + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (let ((gp-1 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) gp-1) (seconds 5)) + (suspend) + ) + ) + (when (logtest? (actor-option cond-respawn) (-> self fact options)) + (let ((gp-2 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) gp-2) (seconds 15)) + (suspend) + ) + ) + (go-virtual hide) + ) + (none) + ) + ) + +(defstate special-contents-die (crate) + :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 'notify) + (case (-> event param 0) + (('pickup) + (let ((gp-0 (-> self entity extra perm))) + (logior! (-> gp-0 status) (entity-perm-status bit-5)) + (set! (-> gp-0 user-int8 1) (min 127 (+ (-> gp-0 user-int8 1) 1))) + (+! (-> self child-count) -1) + (when (<= (-> self child-count) 0) + (if (or (= (-> self defense) 'iron) (= (-> self defense) 'steel)) + (process-entity-status! self (entity-perm-status bit-4) #f) + ) + (process-entity-status! self (entity-perm-status dead) #t) + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (set! (-> gp-0 user-int8 0) 2) + (let ((v0-0 (logclear (-> self mask) (process-mask sleep)))) + (set! (-> self mask) v0-0) + v0-0 + ) + ) + ) + ) + ) + ) + ) + ) + ) + :trans (-> (method-of-type crate die) trans) + :code (behavior () + (logior! (-> self focus-status) (focus-status dead)) + (when (or (= (-> self fact pickup-type) (pickup-type money)) + (= (-> self fact pickup-type) (pickup-type gem)) + (= (-> self fact pickup-type) (pickup-type skill)) + (= (-> self defense) 'iron) + (= (-> self defense) 'steel) + ) + (let ((a0-6 (-> self entity))) + (if (when a0-6 + (let ((a0-7 (-> a0-6 extra perm task))) + (if a0-7 + (zero? a0-7) + ) + ) + ) + (set! (-> self entity extra perm task) (the-as uint 1)) + ) + ) + ) + (let ((v1-20 (-> (the-as collide-shape-moving (-> self root)) root-prim))) + (set! (-> v1-20 prim-core collide-as) (collide-spec)) + (set! (-> v1-20 prim-core collide-with) (collide-spec)) + ) + 0 + (logior! (-> self draw status) (draw-control-status no-draw)) + (let ((t9-0 (method-of-object (-> self fact) fact-info-method-9))) + #t + self + 0 + (t9-0) + ) + (set! (-> self child-count) (+ (process-count self) -1)) + (process-entity-status! self (entity-perm-status bit-4) #t) + (when (-> self entity) + (let ((v1-32 (-> self entity extra perm))) + (logior! (-> v1-32 status) (entity-perm-status bit-5)) + (set! (-> v1-32 user-int8 0) 1) + ) + ) + (when (-> self child) + (logior! (-> self mask) (process-mask sleep)) + (suspend) + (while (-> self child) + (suspend) + ) + ) + (none) + ) + ) + +(defbehavior crate-init-by-other crate ((arg0 entity) (arg1 vector) (arg2 symbol) (arg3 fact-info-crate)) + (crate-init! self (the-as entity-actor arg0)) + (set! (-> self root trans quad) (-> arg1 quad)) + (set! (-> self look) arg2) + (set! (-> self defense) arg2) + (skel-init! self) + (when arg3 + (set! (-> self fact pickup-type) (-> arg3 pickup-type)) + (set! (-> self fact pickup-amount) (-> arg3 pickup-spawn-amount)) + (set! (-> self fact options) (-> arg3 options)) + ) + (crate-method-38 self) + (none) + ) + +(defmethod init-from-entity! crate ((obj crate) (arg0 entity-actor)) + (crate-init! obj arg0) + (skel-init! obj) + (crate-method-38 obj) + (none) + ) + +(defmethod crate-init! crate ((obj crate) (arg0 entity-actor)) + "Initialize the [[crate]] with the specified [[entity-actor]]." + (stack-size-set! (-> obj main-thread) 128) + (set! (-> obj mask) (logior (process-mask crate) (-> obj mask))) + (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s4-0 reaction) cshape-reaction-default) + (set! (-> s4-0 no-reaction) nothing) + (let ((v1-10 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-10 prim-core collide-as) (collide-spec crate notice-blue-eco-powerup)) + (set! (-> v1-10 prim-core collide-with) (collide-spec jak player-list tobot)) + (set! (-> v1-10 prim-core action) (collide-action solid rideable)) + (set! (-> v1-10 transform-index) 3) + (set-vector! (-> v1-10 local-sphere) 0.0 3072.0 0.0 (-> *CRATE-bank* COLLIDE_RADIUS)) + (set! (-> s4-0 total-prims) (the-as uint 1)) + (set! (-> s4-0 root-prim) v1-10) + ) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (let ((v1-13 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-13 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-13 prim-core collide-with)) + ) + (set! (-> s4-0 penetrated-by) + (penetrate + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + dark-skin + dark-punch + dark-giant + knocked + ) + ) + (set! (-> obj root) s4-0) + ) + (set! (-> obj fact) + (new 'process 'fact-info-crate obj (pickup-type eco-pill-random) (-> *FACT-bank* default-eco-pill-green-inc)) + ) + (when (-> obj entity) + (let ((v1-22 (-> obj entity extra perm))) + (set! (-> obj fact pickup-amount) + (fmax 0.0 (- (-> obj fact pickup-amount) (the float (-> v1-22 user-int8 1)))) + ) + ) + ) + (when (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status subtask-complete))) + (set! (-> obj fact pickup-type) (pickup-type eco-pill-random)) + (set! (-> obj fact pickup-amount) 0.0) + ) + (when arg0 + (process-drawable-from-entity! obj arg0) + (logclear! (-> obj mask) (process-mask actor-pause)) + ) + (let ((v1-37 + ((method-of-type res-lump get-property-struct) + (-> obj entity) + 'crate-type + 'interp + -1000000000.0 + (the-as structure 'wood) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (set! (-> obj look) (the-as symbol v1-37)) + (set! (-> obj defense) (the-as symbol v1-37)) + ) + (set! (-> obj carry) + (new 'process 'carry-info obj 3 (new 'static 'vector :w 1.0) (new 'static 'vector :y 1.0 :w 1.0) 0.0) + ) + (set! (-> obj carry max-pull) 3686.4) + (set! (-> obj carry carry-radius) 3276.8) + (set! (-> obj target) (the-as handle #f)) + (none) + ) + +(defmethod skel-init! crate ((obj crate)) + "Initialize the [[crate]]'s skeleton and other parameters based on the crate type." + (case (-> obj look) + (('iron) + (set! (-> (the-as collide-shape-moving (-> obj root)) penetrated-by) + (penetrate flop uppercut tube vehicle flut-attack board dark-skin explode) + ) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-crate-krimson" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + ) + (('steel) + (set! (-> (the-as collide-shape-moving (-> obj root)) penetrated-by) + (penetrate tube vehicle flut-attack board dark-skin explode) + ) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-crate-krimson" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + ) + (('darkeco) + (when (= (-> obj fact pickup-type) (pickup-type eco-pill-random)) + (set! (-> obj fact pickup-type) (pickup-type none)) + (set! (-> obj fact pickup-amount) 0.0) + ) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-crate-krimson" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (set-vector! (-> obj draw color-mult) 0.8 0.8 0.8 1.0) + (set-vector! (-> obj draw color-emissive) 0.2 0.2 0.2 1.0) + ) + (('none) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-crate-krimson" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (logior! (-> obj draw status) (draw-control-status no-draw)) + ) + (else + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-crate-krimson" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + ) + ) + (set! (-> obj base quad) (-> obj root trans quad)) + (crate-post) + (nav-mesh-connect-from-ent (the-as entity-nav-mesh obj)) + (none) + ) + +(defmethod params-set! crate ((obj crate) (arg0 symbol) (arg1 symbol)) + "Set [[crate]] params based on the arguments." + (if arg0 + (set! (-> obj look) arg0) + ) + (if arg1 + (set! (-> obj defense) arg1) + ) + (none) + ) + +(defmethod crate-method-38 crate ((obj crate)) + (when (-> obj entity) + (if (>= (-> obj entity extra perm user-int8 0) 1) + (go (method-of-object obj die) #t 0) + ) + ) + (cond + ((logtest? (actor-option cond-hide) (-> obj fact options)) + (go (method-of-object obj hide)) + ) + ((logtest? (actor-option fall) (-> obj fact options)) + (go (method-of-object obj fall)) + ) + (else + (go (method-of-object obj idle)) + ) + ) + 0 + (none) + ) + +(defmethod smush-update! crate ((obj crate)) + (let ((f0-0 (update! (-> obj smush)))) + (set! (-> obj root scale x) (+ 1.0 (* -0.5 f0-0))) + (set! (-> obj root scale y) (+ 1.0 f0-0)) + (set! (-> obj root scale z) (+ 1.0 (* -0.5 f0-0))) + ) + 0 + (none) + ) + +(defmethod crate-method-40 crate ((obj crate)) + (cond + ((and (> (-> (the-as fact-info-crate (-> obj fact)) suck-count) 0) + (< (you-suck-stage *game-info* #f) (-> (the-as fact-info-crate (-> obj fact)) suck-count)) + ) + #t + ) + ((logtest? (actor-option cond-low-ammo) (-> obj fact options)) + (case (-> obj fact pickup-type) + (((pickup-type ammo-yellow) (pickup-type ammo-red) (pickup-type ammo-blue) (pickup-type ammo-dark)) + (let ((a1-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-4 from) (process->ppointer self)) + (set! (-> a1-4 num-params) 1) + (set! (-> a1-4 message) 'test-pickup) + (set! (-> a1-4 param 0) (the-as uint (-> obj fact pickup-type))) + (let ((v1-15 (the-as float (send-event-function *target* a1-4)))) + (or (not v1-15) (< 10.0 v1-15)) + ) + ) + ) + (else + #f + ) + ) + ) + (else + #f + ) + ) + ) + +(deftype pickup-spawner (crate) + ((blocker entity-actor :offset-assert 288) + ) + :heap-base #xb0 + :method-count-assert 41 + :size-assert #x124 + :flag-assert #x2900b00124 + ) + +(defmethod inspect pickup-spawner ((obj pickup-spawner)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type crate inspect))) + (t9-0 obj) + ) + (format #t "~2Tblocker: ~A~%" (-> obj blocker)) + (label cfg-4) + obj + ) + +(defmethod crate-init! pickup-spawner ((obj pickup-spawner) (arg0 entity-actor)) + "Initialize the [[crate]] with the specified [[entity-actor]]." + (let ((t9-0 (method-of-type crate crate-init!))) + (t9-0 obj arg0) + ) + (set! (-> obj look) 'none) + (set! (-> obj blocker) #f) + (if (logtest? (-> obj fact options) (actor-option blocked)) + (set! (-> obj blocker) (entity-actor-lookup (-> obj entity) 'alt-actor 0)) + ) + (none) + ) + +(defmethod crate-method-38 pickup-spawner ((obj pickup-spawner)) + (go (method-of-object obj idle)) + 0 + (none) + ) + +(defstate idle (pickup-spawner) + :virtual #t + :code (behavior () + (until #f + (if (or (not (-> self blocker)) + (logtest? (-> self blocker extra perm status) (entity-perm-status subtask-complete)) + ) + (go-virtual die #t 0) + ) + (suspend) + ) + #f + (none) + ) + ) diff --git a/goal_src/jak2/engine/common_objs/dark-eco-pool.gc b/goal_src/jak2/engine/common_objs/dark-eco-pool.gc index 6080d33766..389c8a6ad0 100644 --- a/goal_src/jak2/engine/common_objs/dark-eco-pool.gc +++ b/goal_src/jak2/engine/common_objs/dark-eco-pool.gc @@ -7,3 +7,303 @@ ;; DECOMP BEGINS +(deftype dark-eco-pool (water-anim) + () + :heap-base #x80 + :method-count-assert 29 + :size-assert #x100 + :flag-assert #x1d00800100 + ) + +(define *ripple-for-dark-eco-pool* (new 'static 'ripple-wave-set + :count 3 + :converted #f + :normal-scale 3.0 + :wave (new 'static 'inline-array ripple-wave 4 + (new 'static 'ripple-wave :scale 11.0 :xdiv 1 :speed 1.0) + (new 'static 'ripple-wave :scale 7.5 :xdiv -1 :zdiv 1 :speed 4.0) + (new 'static 'ripple-wave :scale 2.0 :xdiv 5 :zdiv 3 :speed 2.0) + (new 'static 'ripple-wave) + ) + ) + ) + +(define *ripple-strip-dark-eco-near-lift* + (new 'static 'ripple-wave-set + :count 3 + :converted #f + :normal-scale 3.0 + :wave (new 'static 'inline-array ripple-wave 4 + (new 'static 'ripple-wave :scale 4.0 :xdiv 1 :speed 1.0) + (new 'static 'ripple-wave :scale 2.5 :xdiv -1 :zdiv 1 :speed 3.0) + (new 'static 'ripple-wave :scale 3.0 :xdiv 5 :zdiv 3 :speed 2.0) + (new 'static 'ripple-wave) + ) + ) + ) + +(defmethod offset! dark-eco-pool ((obj dark-eco-pool)) + "Offset a [[water-anim]]'s `trans` and `quat` by the lump data in `entity`." + (let ((t9-0 (method-of-type water-anim offset!))) + (t9-0 obj) + ) + (logclear! (-> obj flags) (water-flags part-water)) + (logior! (-> obj flags) (water-flags dark-eco)) + (set! (-> obj attack-event) + (the-as + symbol + ((method-of-type res-lump get-property-struct) + (-> obj entity) + 'attack-event + 'interp + -1000000000.0 + (the-as structure 'dark-eco-pool) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "eco-pool" :fo-min 30 :fo-max 50) (-> obj root trans)) + ) + (none) + ) + +(defmethod art-init! dark-eco-pool ((obj dark-eco-pool)) + "Initialize a [[water-anim]]'s [[skel-group]], joints and ambience." + (let ((t9-0 (method-of-type water-anim art-init!))) + (t9-0 obj) + ) + (let ((s5-0 (new 'process 'ripple-control))) + (set! (-> obj draw ripple) s5-0) + (set! (-> s5-0 global-scale) 3072.0) + (set! (-> s5-0 close-fade-dist) 163840.0) + (set! (-> s5-0 far-fade-dist) 245760.0) + (set! (-> s5-0 waveform) *ripple-for-dark-eco-pool*) + (set! (-> s5-0 query) (new 'process 'ripple-merc-query 100)) + (case (-> obj look) + ((5) + (set! (-> s5-0 waveform) *ripple-strip-dark-eco-near-lift*) + ) + ) + ) + (none) + ) + +(defpartgroup group-dark-eco-nasty + :id 128 + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 8) + :parts ((sp-item 577 :fade-after (meters 50))) + ) + +(defpart 577 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-y (meters 0)) + (sp-rnd-flt spt-scale-x (meters 1) (meters 4) 1.0) + (sp-flt spt-scale-y (meters 0.25)) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-rnd-flt spt-a 96.0 32.0 1.0) + (sp-flt spt-scalevel-x (meters 0.1875)) + (sp-flt spt-scalevel-y (meters -0.001875)) + (sp-flt spt-fade-a -3.2) + (sp-int spt-timer 10) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + (sp-int spt-next-time 15) + (sp-launcher-by-id spt-next-launcher 578) + ) + ) + +(defpart 578 + :init-specs ((sp-flt spt-r 255.0) (sp-rnd-flt spt-g 128.0 128.0 1.0) (sp-flt spt-b 0.0) (sp-flt spt-fade-a -1.28)) + ) + +(defpartgroup group-dark-eco-pool-nasty + :id 129 + :duration (seconds 2) + :linger-duration (seconds 2) + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 12) + :parts ((sp-item 583 :fade-after (meters 100) :period 600 :length 5) + (sp-item 584 :fade-after (meters 100) :period 600 :length 5 :binding 579) + (sp-item 579 :flags (start-dead launch-asap) :binding 580) + (sp-item 580 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 579 :flags (start-dead launch-asap) :binding 580) + (sp-item 580 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 579 :flags (start-dead launch-asap) :binding 580) + (sp-item 580 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 579 :flags (start-dead launch-asap) :binding 580) + (sp-item 580 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 585 :fade-after (meters 100) :period 600 :length 5 :binding 581) + (sp-item 581 :flags (start-dead launch-asap) :binding 582) + (sp-item 582 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 581 :flags (start-dead launch-asap) :binding 582) + (sp-item 582 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 581 :flags (start-dead launch-asap) :binding 582) + (sp-item 582 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 581 :flags (start-dead launch-asap) :binding 582) + (sp-item 582 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + ) + ) + +(defpart 583 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 8)) + (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 0.0 96.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-flt spt-a 64.0) + (sp-flt spt-fade-a -1.8285716) + (sp-int spt-timer 54) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + ) + ) + +(defpart 584 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) + (sp-rnd-flt spt-num 1.0 6.0 1.0) + (sp-flt spt-y (meters 1)) + (sp-flt spt-scale-x (meters 0.1)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-y (meters 0.04) (meters 0.02) 1.0) + (sp-flt spt-accel-y -3.4133334) + (sp-flt spt-friction 0.94) + (sp-int spt-timer 240) + (sp-cpuinfo-flags sp-cpuinfo-flag-3) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 140.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +(defpart 579 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-y (meters 0) (meters 16) 1.0) + (sp-rnd-flt spt-z (meters 0.3) (meters 0.3) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.4) (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-rnd-flt spt-r 0.0 96.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-rnd-flt spt-a 64.0 64.0 1.0) + (sp-rnd-flt spt-omega 0.0 65536.0 1.0) + (sp-rnd-flt spt-vel-x (meters 0.026666667) (meters 0.10666667) 1.0) + (sp-flt spt-scalevel-x (meters -0.000909091)) + (sp-rnd-int-flt spt-rotvel-z (degrees -0.3) 1 109.22667) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -0.26666668) + (sp-flt spt-fade-a -0.19393939) + (sp-int-plain-rnd spt-timer 60 179 1) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 ready-to-launch sp-cpuinfo-flag-14) + ) + ) + +(defpart 580 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 0.4) (meters 0.1) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 32.0 96.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-rnd-flt spt-a 32.0 32.0 1.0) + (sp-flt spt-scalevel-x (meters -0.0006190476)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.01904762) + (sp-rnd-flt spt-accel-y -0.40960002 -0.6144 1.0) + (sp-int-plain-rnd spt-timer 30 239 1) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + (sp-int spt-next-time 240) + (sp-launcher-by-id spt-next-launcher 397) + ) + ) + +(defpart 585 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) + (sp-rnd-flt spt-num 1.0 6.0 1.0) + (sp-flt spt-y (meters 1)) + (sp-flt spt-scale-x (meters 0.1)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-y (meters 0.04) (meters 0.02) 1.0) + (sp-flt spt-accel-y -3.4133334) + (sp-flt spt-friction 0.94) + (sp-int spt-timer 240) + (sp-cpuinfo-flags sp-cpuinfo-flag-3) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 140.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +(defpart 581 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-y (meters 0) (meters 16) 1.0) + (sp-rnd-flt spt-z (meters 0.3) (meters 0.3) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.4) (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-rnd-flt spt-r 16.0 32.0 1.0) + (sp-rnd-flt spt-g 0.0 16.0 1.0) + (sp-rnd-flt spt-b 192.0 64.0 1.0) + (sp-rnd-flt spt-a 64.0 64.0 1.0) + (sp-rnd-flt spt-omega 0.0 65536.0 1.0) + (sp-rnd-flt spt-vel-x (meters 0.026666667) (meters 0.10666667) 1.0) + (sp-flt spt-scalevel-x (meters -0.000909091)) + (sp-rnd-int-flt spt-rotvel-z (degrees -0.3) 1 109.22667) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -0.26666668) + (sp-flt spt-fade-a -0.19393939) + (sp-int-plain-rnd spt-timer 60 179 1) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 ready-to-launch sp-cpuinfo-flag-14) + ) + ) + +(defpart 582 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 0.4) (meters 0.1) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 16.0 32.0 1.0) + (sp-rnd-flt spt-g 0.0 16.0 1.0) + (sp-rnd-flt spt-b 192.0 64.0 1.0) + (sp-rnd-flt spt-a 32.0 32.0 1.0) + (sp-flt spt-scalevel-x (meters -0.0006190476)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.01904762) + (sp-rnd-flt spt-accel-y -0.40960002 -0.6144 1.0) + (sp-int-plain-rnd spt-timer 30 239 1) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + (sp-int spt-next-time 240) + (sp-launcher-by-id spt-next-launcher 397) + ) + ) + +(defstate idle (dark-eco-pool) + :virtual #t + :trans (behavior () + (let ((t9-0 (-> (method-of-type water-anim idle) trans))) + (if t9-0 + (t9-0) + ) + ) + (let* ((gp-0 (-> self draw ripple)) + (f0-1 (the float (logand (-> self clock frame-counter) #xffff))) + (f0-6 (cos (the float (sar (shl (the int (* 5.0 f0-1)) 48) 48)))) + (f0-7 (* f0-6 f0-6)) + (f0-9 (fmax -1.0 (fmin 1.0 f0-7))) + ) + (set! (-> gp-0 global-scale) (* 4096.0 (* 3.0 (+ 1.0 f0-9)))) + (set! (-> gp-0 individual-normal-scale) (+ 0.5 (* 0.5 f0-9))) + ) + (none) + ) + ) diff --git a/goal_src/jak2/engine/common_objs/generic-obs-h.gc b/goal_src/jak2/engine/common_objs/generic-obs-h.gc index 40ac137ffb..10ca4db1ab 100644 --- a/goal_src/jak2/engine/common_objs/generic-obs-h.gc +++ b/goal_src/jak2/engine/common_objs/generic-obs-h.gc @@ -78,7 +78,7 @@ (duration uint64 :offset-assert 224) (linger-duration uint64 :offset-assert 232) (start-time time-frame :offset-assert 240) - (target uint64 :offset-assert 248) + (target handle :offset-assert 248) (target-joint int32 :offset-assert 256) (offset vector :inline :offset-assert 272) (userdata uint64 :offset-assert 288) diff --git a/goal_src/jak2/engine/common_objs/plat.gc b/goal_src/jak2/engine/common_objs/plat.gc index 6a8fa4695e..71e4ad7617 100644 --- a/goal_src/jak2/engine/common_objs/plat.gc +++ b/goal_src/jak2/engine/common_objs/plat.gc @@ -24,27 +24,10 @@ ) -(let ((a0-2 (new 'static 'skeleton-group - :name "skel-plat" - :extra #f - :info #f - :art-group-name "plat" - :bounds (new 'static 'vector :y -2048.0 :w 12288.0) - :max-lod 2 - :version #x7 +(defskelgroup skel-plat plat 0 4 + ((1 (meters 20)) (2 (meters 40)) (3 (meters 999999))) + :bounds (static-spherem 0 -0.5 0 3) ) - ) - ) - (set! (-> a0-2 jgeo) 0) - (set! (-> a0-2 janim) 4) - (set! (-> a0-2 mgeo 0) 1) - (set! (-> a0-2 lod-dist 0) 81920.0) - (set! (-> a0-2 mgeo 1) 2) - (set! (-> a0-2 lod-dist 1) 163840.0) - (set! (-> a0-2 mgeo 2) 3) - (set! (-> a0-2 lod-dist 2) 4095996000.0) - (add-to-loading-level a0-2) - ) (defmethod get-art-group plat ((obj plat)) "@returns The associated [[art-group]]" @@ -243,11 +226,11 @@ (if (nonzero? (-> obj break-anim-name)) (&+! (-> obj break-anim-name) arg0) ) - (let ((v1-5 (-> obj anim buffer))) + (let ((v1-5 (-> obj anim anim-name))) (if (and (>= (the-as int v1-5) (-> *kernel-context* relocating-min)) (< (the-as int v1-5) (-> *kernel-context* relocating-max)) ) - (&+! (-> obj anim buffer) arg0) + (set! (-> obj anim anim-name) (&+ (the-as external-art-buffer (-> obj anim anim-name)) arg0)) ) ) (the-as drop-plat ((method-of-type base-plat relocate) obj arg0)) diff --git a/goal_src/jak2/engine/common_objs/projectile-h.gc b/goal_src/jak2/engine/common_objs/projectile-h.gc index 1977d374ef..a0d9045b49 100644 --- a/goal_src/jak2/engine/common_objs/projectile-h.gc +++ b/goal_src/jak2/engine/common_objs/projectile-h.gc @@ -10,6 +10,10 @@ :bitfield #t ) +(declare-type projectile-init-by-other-params structure) +(declare-type projectile process-drawable) +(define-extern projectile-init-by-other (function projectile-init-by-other-params projectile)) + ;; DECOMP BEGINS (deftype projectile (process-drawable) @@ -58,7 +62,7 @@ (projectile-method-28 () none 28) (projectile-method-29 () none 29) (projectile-method-30 () none 30) - (projectile-method-31 () none 31) + (projectile-method-31 (_type_) none 31) (projectile-method-32 () none 32) (projectile-method-33 () none 33) (projectile-method-34 () none 34) @@ -70,6 +74,7 @@ ) ) + (deftype projectile-init-by-other-params (structure) ((ent basic :offset-assert 0) (charge float :offset-assert 4) @@ -87,7 +92,6 @@ :flag-assert #x900000058 ) -(define-extern projectile-init-by-other (function projectile-init-by-other-params projectile)) (defun spawn-projectile ((arg0 type) (arg1 projectile-init-by-other-params) (arg2 process-tree) (arg3 dead-pool)) (let ((s4-0 (get-process arg3 arg0 #x4000))) diff --git a/goal_src/jak2/engine/common_objs/water-anim.gc b/goal_src/jak2/engine/common_objs/water-anim.gc index d12ed608af..d3d034ab73 100644 --- a/goal_src/jak2/engine/common_objs/water-anim.gc +++ b/goal_src/jak2/engine/common_objs/water-anim.gc @@ -5,5 +5,617 @@ ;; name in dgo: water-anim ;; dgos: GAME, COMMON +(declare-type flow-control basic) + ;; DECOMP BEGINS +(deftype water-anim (process-drawable) + ((water-height meters :offset-assert 200) + (wade-height meters :offset-assert 204) + (swim-height meters :offset-assert 208) + (bottom-height meters :offset-assert 212) + (attack-event symbol :offset-assert 216) + (attack-id uint32 :offset-assert 220) + (flow flow-control :offset-assert 224) + (target handle :offset-assert 232) + (flags water-flags :offset-assert 240) + (look int32 :offset-assert 244) + (play-ambient-sound? symbol :offset-assert 248) + (visible symbol :offset-assert 252) + ) + :heap-base #x80 + :method-count-assert 29 + :size-assert #x100 + :flag-assert #x1d00800100 + (:methods + (water-anim-method-20 () none 20) + (idle () _type_ :state 21) + (move-to-point! (_type_ vector) int 22) + (get-ripple-height (_type_ vector) float 23) + (art-init! (_type_) none 24) + (reset-root! (_type_) trsqv 25) + (water-anim-init! (_type_) none 26) + (water-anim-method-27 (_type_) none 27) + (offset! (_type_) none 28) + ) + ) + +(defmethod relocate water-anim ((obj water-anim) (arg0 int)) + (if (nonzero? (-> obj flow)) + (&+! (-> obj flow) arg0) + ) + ((the-as (function water-anim int water-anim) (find-parent-method water-anim 7)) obj arg0) + ) + +(defskelgroup skel-water-anim-nest-dark-eco-largepool water-anim-nest-dark-eco 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 50) + ) + +(defskelgroup skel-water-anim-nest-dark-eco-smlupperpool water-anim-nest-dark-eco 2 -1 + ((3 (meters 999999))) + :bounds (static-spherem 0 0 0 30) + ) + +(defskelgroup skel-water-anim-nest-dark-eco-middlepool water-anim-nest-dark-eco 4 -1 + ((5 (meters 999999))) + :bounds (static-spherem 0 0 0 32) + ) + +(defskelgroup skel-water-anim-nest-dark-eco-botpool water-anim-nest-dark-eco 6 -1 + ((7 (meters 999999))) + :bounds (static-spherem 0 0 0 35) + ) + +(defskelgroup skel-water-anim-strip-dark-eco-near-lift water-anim-strip-dark-eco 0 -1 + ((1 (meters 20)) (2 (meters 999999))) + :bounds (static-spherem 0 0 0 29) + ) + +(defskelgroup skel-water-anim-strip-dark-eco-near-crane water-anim-strip-dark-eco 3 -1 + ((4 (meters 20)) (5 (meters 999999))) + :bounds (static-spherem 0 0 0 35) + ) + +(defskelgroup skel-water-anim-strip-dark-eco-with-eggs water-anim-strip-dark-eco 6 -1 + ((7 (meters 999999))) + :bounds (static-spherem 0 0 0 40) + ) + +(defskelgroup skel-water-anim-strip-dark-eco-under-bridge water-anim-strip-dark-eco 9 -1 + ((10 (meters 20)) (11 (meters 999999))) + :bounds (static-spherem 0 0 0 32) + ) + +(defskelgroup skel-water-anim-mountain-dark-eco-dice water-anim-mountain-dark-eco 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem -20 0 0 110) + ) + +(defskelgroup skel-water-anim-under-pool water-anim-under 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 51) + ) + +(defskelgroup skel-water-anim-under-drainout water-anim-under 2 -1 + ((3 (meters 999999))) + :bounds (static-spherem 0 0 0 20) + ) + +(defskelgroup skel-water-anim-under-fillup water-anim-under 4 -1 + ((5 (meters 999999))) + :bounds (static-spherem 0 0 0 23) + ) + +(defskelgroup skel-water-anim-mountain-fall-hi water-anim-mountain 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 42) + ) + +(defskelgroup skel-water-anim-mountain-fall-med water-anim-mountain 2 -1 + ((3 (meters 999999))) + :bounds (static-spherem 0 0 0 30) + ) + +(defskelgroup skel-water-anim-mountain-fall-low water-anim-mountain 4 -1 + ((5 (meters 999999))) + :bounds (static-spherem 0 0 0 25) + ) + +(defskelgroup skel-water-anim-stadium-middle-pool water-anim-stadium 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 24) + ) + +(defskelgroup skel-water-anim-stadium-top-fountain water-anim-stadium 2 -1 + ((3 (meters 999999))) + :bounds (static-spherem 0 0 0 9.5) + ) + +(defskelgroup skel-water-anim-stadium-floor-pool water-anim-stadium 4 -1 + ((5 (meters 999999))) + :bounds (static-spherem 0 0 0 22) + ) + +(defskelgroup skel-water-anim-tomb-dark-eco-stair-block water-anim-tomb-dark-eco 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 80) + ) + +(defskelgroup skel-water-anim-tomb-dark-eco-raised-block water-anim-tomb-dark-eco 2 -1 + ((3 (meters 999999))) + :bounds (static-spherem 0 0 0 80) + ) + +(defskelgroup skel-water-anim-fortress-exitb-pool water-anim-fortress 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 51) + ) + +(defskelgroup skel-water-anim-tomb-main-hall water-anim-tomb 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 150) + ) + +(defskelgroup skel-water-anim-tomb-tunnel-b water-anim-tomb 2 -1 + ((3 (meters 999999))) + :bounds (static-spherem 0 0 0 36) + ) + +(defskelgroup skel-water-anim-tomb-tunnel-c water-anim-tomb 4 -1 + ((5 (meters 999999))) + :bounds (static-spherem 0 0 0 23) + ) + +(defskelgroup skel-water-anim-tomb-tunnel-d water-anim-tomb 6 -1 + ((7 (meters 999999))) + :bounds (static-spherem 5 0 5 42) + ) + +(defskelgroup skel-water-anim-tomb-tunnel-e water-anim-tomb 8 -1 + ((9 (meters 999999))) + :bounds (static-spherem 0 0 0 37) + ) + +(defskelgroup skel-water-anim-tomb-tunnel-f water-anim-tomb 10 -1 + ((11 (meters 999999))) + :bounds (static-spherem 0 0 0 24) + ) + +(defskelgroup skel-water-anim-mincan-exitb-pool water-anim-mincan 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 55) + ) + +(defskelgroup skel-water-anim-ctypal-lrgsqr-pool water-anim-ctypal 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 24) + ) + +(defskelgroup skel-water-anim-ctypal-smlsqr-pool water-anim-ctypal 2 -1 + ((3 (meters 999999))) + :bounds (static-spherem 0 0 0 11.25) + ) + +(defskelgroup skel-water-anim-ctypal-lrgfloor-pool water-anim-ctypal 4 -1 + ((5 (meters 999999))) + :bounds (static-spherem 0 0 0 22) + ) + +(defskelgroup skel-water-anim-ctypal-smlground-pool water-anim-ctypal 6 -1 + ((7 (meters 999999))) + :bounds (static-spherem 0 0 0 22.5) + ) + +(defskelgroup skel-water-anim-ctypal-middle-fountain water-anim-ctypal 8 -1 + ((9 (meters 999999))) + :bounds (static-spherem 0 0 0 22.5) + ) + +(defskelgroup skel-water-anim-ctypal-long-grnd-pool water-anim-ctypal 10 -1 + ((11 (meters 999999))) + :bounds (static-spherem 0 0 0 50) + ) + +(deftype water-anim-look (structure) + ((skel-group string :offset-assert 0) + (anim int32 :offset-assert 4) + (ambient-sound-spec sound-spec :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + +(define *water-anim-look* + (new 'static 'boxed-array :type water-anim-look + (new 'static 'water-anim-look :skel-group "water-anim-nest-dark-eco-largepool" :anim 8 :ambient-sound-spec #f) + (new 'static 'water-anim-look + :skel-group "water-anim-nest-dark-eco-smlupperpool" + :anim 8 + :ambient-sound-spec #f + ) + (new 'static 'water-anim-look + :skel-group "water-anim-nest-dark-eco-middlepool" + :anim 8 + :ambient-sound-spec #f + ) + (new 'static 'water-anim-look :skel-group "water-anim-nest-dark-eco-botpool" :anim 8 :ambient-sound-spec #f) + (new 'static 'water-anim-look + :skel-group "water-anim-strip-dark-eco-near-lift" + :anim 12 + :ambient-sound-spec #f + ) + (new 'static 'water-anim-look + :skel-group "water-anim-strip-dark-eco-near-lift" + :anim 12 + :ambient-sound-spec #f + ) + (new 'static 'water-anim-look + :skel-group "water-anim-strip-dark-eco-near-crane" + :anim 12 + :ambient-sound-spec #f + ) + (new 'static 'water-anim-look + :skel-group "water-anim-strip-dark-eco-with-eggs" + :anim 12 + :ambient-sound-spec #f + ) + (new 'static 'water-anim-look + :skel-group "water-anim-strip-dark-eco-under-bridge" + :anim 12 + :ambient-sound-spec #f + ) + (new 'static 'water-anim-look :skel-group "water-anim-mountain-dark-eco-dice" :anim 2 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-under-pool" :anim 6 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-under-drainout" :anim 6 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-under-fillup" :anim 6 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-mountain-fall-hi" :anim 6 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-mountain-fall-med" :anim 6 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-mountain-fall-low" :anim 6 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-stadium-middle-pool" :anim 6 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-stadium-top-fountain" :anim 6 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-stadium-floor-pool" :anim 6 :ambient-sound-spec #f) + (new 'static 'water-anim-look + :skel-group "water-anim-tomb-dark-eco-stair-block" + :anim 4 + :ambient-sound-spec #f + ) + (new 'static 'water-anim-look + :skel-group "water-anim-tomb-dark-eco-raised-block" + :anim 4 + :ambient-sound-spec #f + ) + (new 'static 'water-anim-look :skel-group "water-anim-fortress-exitb-pool" :anim 2 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-tomb-main-hall" :anim 12 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-tomb-tunnel-b" :anim 12 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-tomb-tunnel-c" :anim 12 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-tomb-tunnel-d" :anim 12 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-tomb-tunnel-e" :anim 12 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-tomb-tunnel-f" :anim 12 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-mincan-exitb-pool" :anim 2 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-ctypal-lrgsqr-pool" :anim 12 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-ctypal-smlsqr-pool" :anim 12 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-ctypal-lrgfloor-pool" :anim 12 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-ctypal-smlground-pool" :anim 12 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-ctypal-middle-fountain" :anim 12 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-ctypal-long-grnd-pool" :anim 12 :ambient-sound-spec #f) + ) + ) + +(defbehavior water-anim-event-handler water-anim ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-1 none)) + (let ((v1-0 arg2)) + (the-as + object + (cond + ((= v1-0 'move-to) + (move-to-point! self (the-as vector (-> arg3 param 0))) + (set! v0-1 (the-as none (logclear (-> self mask) (process-mask sleep-code)))) + (set! (-> self mask) (the-as process-mask v0-1)) + v0-1 + ) + ((= v1-0 'move-to-y) + (let ((a1-2 (new 'stack-no-clear 'vector))) + (set! (-> a1-2 quad) (-> self root trans quad)) + (set! (-> a1-2 y) (the-as float (-> arg3 param 0))) + (move-to-point! self a1-2) + ) + (set! v0-1 (the-as none (logclear (-> self mask) (process-mask sleep-code)))) + (set! (-> self mask) (the-as process-mask v0-1)) + v0-1 + ) + ((= v1-0 'water) + (let ((s5-0 (the-as object (-> arg3 param 0)))) + (let* ((s4-0 (the-as object (-> arg3 param 1))) + (gp-0 (if (type? (the-as process s4-0) process-focusable) + (the-as uint s4-0) + ) + ) + ) + (when (and (logtest? (-> self flags) (water-flags deadly)) + (logtest? (water-flags touch-water) (-> (the-as water-info s5-0) flags)) + (the-as uint gp-0) + ) + (let ((v1-15 (-> self attack-event))) + (case v1-15 + ((#f) + ) + (('heat) + (send-event (the-as process-tree gp-0) 'heat (* 10.0 (-> self clock seconds-per-frame))) + ) + (('drown-death 'lava 'dark-eco-pool) + (if (and (not (logtest? (focus-status board) (-> (the-as process-focusable gp-0) focus-status))) + (let ((a1-10 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-10 from) (process->ppointer self)) + (set! (-> a1-10 num-params) 2) + (set! (-> a1-10 message) 'attack-invinc) + (set! (-> a1-10 param 0) (the-as uint #f)) + (let ((a2-4 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (set! (-> a2-4 id) (-> self attack-id)) + (set! (-> a2-4 mode) v1-15) + (set! (-> a1-10 param 1) (the-as uint a2-4)) + ) + (send-event-function (the-as process-focusable gp-0) a1-10) + ) + ) + (send-event self 'notify 'attack) + ) + ) + (else + (if (and (not (logtest? (focus-status board) (-> (the-as process-focusable gp-0) focus-status))) + (let ((a1-13 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-13 from) (process->ppointer self)) + (set! (-> a1-13 num-params) 2) + (set! (-> a1-13 message) 'attack) + (set! (-> a1-13 param 0) (the-as uint #f)) + (let ((a2-6 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (set! (-> a2-6 id) (-> self attack-id)) + (set! (-> a2-6 mode) v1-15) + (set! (-> a1-13 param 1) (the-as uint a2-6)) + ) + (send-event-function (the-as process-tree gp-0) a1-13) + ) + ) + (send-event self 'notify 'attack) + ) + ) + ) + ) + ) + ) + (when (and (logtest? (-> self flags) (water-flags flow)) + (logtest? (water-flags touch-water) (-> (the-as water-info s5-0) flags)) + ) + (let ((a0-40 (-> self flow))) + (if (nonzero? a0-40) + ((method-of-object a0-40 flow-control-method-11)) + ) + ) + ) + ) + ) + ((= v1-0 'visible) + (cond + ((-> arg3 param 0) + (set! (-> self visible) #t) + ) + (else + (set! (-> self visible) #f) + (logior! (-> self draw status) (draw-control-status no-draw)) + ) + ) + (logclear! (-> self mask) (process-mask sleep-code)) + #t + ) + ) + ) + ) + ) + +(defstate idle (water-anim) + :virtual #t + :event water-anim-event-handler + :trans (behavior () + (let ((a0-0 (-> self flow))) + (if (and (nonzero? a0-0) *display-vol-marks*) + (draw-path a0-0) + ) + ) + (cond + ((not (-> self visible)) + ) + ((< (-> (math-camera-pos) y) (+ -8192.0 (-> self root trans y))) + (logior! (-> self draw status) (draw-control-status no-draw)) + ) + (else + (logclear! (-> self draw status) (draw-control-status no-draw)) + ) + ) + (if (and (-> self visible) (and (-> self play-ambient-sound?) (nonzero? (-> self sound)))) + (update! (-> self sound)) + ) + (none) + ) + :code (behavior () + (until #f + (ja-post) + (logior! (-> self mask) (process-mask sleep-code)) + (suspend) + ) + #f + (none) + ) + ) + +(defmethod move-to-point! water-anim ((obj water-anim) (arg0 vector)) + "Set a [[water-anim]]'s `trans` as specified by the [[vector]] and update `water-height`." + (set! (-> obj root trans quad) (-> arg0 quad)) + (set! (-> obj water-height) (-> obj root trans y)) + (if (nonzero? (-> obj sound)) + (update-trans! (-> obj sound) (-> obj root trans)) + ) + ) + +(defmethod get-ripple-height water-anim ((obj water-anim) (arg0 vector)) + (ripple-find-height obj 0 arg0) + ) + +(defmethod water-anim-method-27 water-anim ((obj water-anim)) + "Empty." + (none) + ) + +(defmethod offset! water-anim ((obj water-anim)) + "Offset a [[water-anim]]'s `trans` and `quat` by the lump data in `entity`." + (local-vars (sv-16 res-tag)) + (set! (-> obj play-ambient-sound?) #t) + (set! (-> obj visible) #t) + (set! (-> obj look) + (res-lump-value (-> obj entity) 'look int :default (the-as uint128 -1) :time -1000000000.0) + ) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-4 (res-lump-data (-> obj entity) 'trans-offset vector :tag-ptr (& sv-16)))) + (when v1-4 + (+! (-> obj root trans x) (-> v1-4 x)) + (+! (-> obj root trans y) (-> v1-4 y)) + (+! (-> obj root trans z) (-> v1-4 z)) + ) + ) + (let ((f0-6 (res-lump-float (-> obj entity) 'rotoffset))) + (if (!= f0-6 0.0) + (quaternion-rotate-y! (-> obj root quat) (-> obj root quat) f0-6) + ) + ) + (none) + ) + +(defmethod art-init! water-anim ((obj water-anim)) + "Initialize a [[water-anim]]'s [[skeleton-group]], joints and ambience." + (let ((s5-0 (-> obj look))) + (if (or (< s5-0 0) (>= s5-0 (-> *water-anim-look* length))) + (go process-drawable-art-error "skel group") + ) + (let ((s5-1 (-> *water-anim-look* s5-0))) + (initialize-skeleton-by-name obj (-> s5-1 skel-group)) + (ja-channel-set! 1) + (let ((s4-0 (-> obj skel root-channel 0))) + (joint-control-channel-group-eval! + s4-0 + (the-as art-joint-anim (-> obj draw art-group data (-> s5-1 anim))) + num-func-identity + ) + (set! (-> s4-0 frame-num) 0.0) + ) + (let ((a2-1 (-> s5-1 ambient-sound-spec))) + (when a2-1 + (let ((a3-0 (new 'stack-no-clear 'vector))) + (vector+! a3-0 (-> obj root trans) (-> obj draw bounds)) + (set! (-> obj sound) (new 'process 'ambient-sound a2-1 a3-0)) + ) + ) + ) + ) + ) + (ja-post) + (none) + ) + +(defmethod reset-root! water-anim ((obj water-anim)) + "Reset a [[water-anim]]'s `root`." + (let ((v0-0 (new 'process 'trsqv))) + (set! (-> obj root) v0-0) + v0-0 + ) + ) + +(defmethod water-anim-init! water-anim ((obj water-anim)) + "Initialize a [[water-anim]]." + (local-vars (sv-16 res-tag)) + (set! (-> obj attack-event) (the-as symbol ((method-of-type res-lump get-property-struct) + (-> obj entity) + 'attack-event + 'interp + -1000000000.0 + (the-as structure 'drown) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (process-drawable-from-entity! obj (-> obj entity)) + (logclear! (-> obj mask) (process-mask actor-pause)) + (set! (-> obj vol) (new 'process 'vol-control obj)) + (logior! (-> obj vol flags) (vol-flags display? vol-flags-1)) + (set! (-> obj bottom-height) 32768.0) + (let* ((v1-8 *game-info*) + (a0-7 (+ (-> v1-8 attack-id) 1)) + ) + (set! (-> v1-8 attack-id) a0-7) + (set! (-> obj attack-id) a0-7) + ) + (set! (-> obj target) (the-as handle #f)) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-10 (the-as (pointer float) ((method-of-type res-lump get-property-data) + (-> obj entity) + 'water-height + 'exact + -1000000000.0 + (the-as pointer #f) + (& sv-16) + *res-static-buf* + ) + ) + ) + ) + (when v1-10 + (set! (-> obj water-height) (-> v1-10 0)) + (set! (-> obj wade-height) (-> v1-10 1)) + (set! (-> obj swim-height) (-> v1-10 2)) + (if (>= (-> sv-16 elt-count) (the-as uint 4)) + (set! (-> obj flags) (the-as water-flags (the int (-> v1-10 3)))) + ) + (if (>= (-> sv-16 elt-count) (the-as uint 5)) + (set! (-> obj bottom-height) (-> v1-10 4)) + ) + ) + ) + (set! (-> obj flags) (logior (water-flags part-water) (-> obj flags))) + (if (logtest? (-> obj flags) (water-flags flow)) + (set! (-> obj flow) (new 'process 'flow-control obj (the-as res-lump #f))) + ) + (cond + ((zero? (-> obj flags)) + (if (< 0.0 (-> obj wade-height)) + (logior! (-> obj flags) (water-flags can-wade)) + ) + (if (< 0.0 (-> obj swim-height)) + (logior! (-> obj flags) (water-flags can-swim)) + ) + ) + (else + ) + ) + (none) + ) + +(defbehavior water-anim-init-by-other water-anim ((arg0 entity-actor)) + (process-entity-set! self arg0) + (water-anim-method-27 self) + (reset-root! self) + (water-anim-init! self) + (offset! self) + (art-init! self) + (go-virtual idle) + (none) + ) + +(defmethod init-from-entity! water-anim ((obj water-anim) (arg0 entity-actor)) + (water-anim-method-27 obj) + (reset-root! obj) + (water-anim-init! obj) + (offset! obj) + (art-init! obj) + (go (method-of-object obj idle)) + (none) + ) diff --git a/goal_src/jak2/engine/common_objs/water-flow.gc b/goal_src/jak2/engine/common_objs/water-flow.gc index ede5693117..9a32ba167f 100644 --- a/goal_src/jak2/engine/common_objs/water-flow.gc +++ b/goal_src/jak2/engine/common_objs/water-flow.gc @@ -7,3 +7,104 @@ ;; DECOMP BEGINS +(defun ray-plane-equation-intersect ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector)) + (let* ((f0-1 (vector4-dot arg3 arg1)) + (f1-1 (vector-dot arg3 arg2)) + (f30-0 (/ (- f0-1) f1-1)) + ) + (vector-v*float+! arg0 arg1 arg2 f30-0) + f30-0 + ) + ) + +(deftype flow-section (structure) + ((start vector :inline :offset-assert 0) + (trailing plane :inline :offset-assert 16) + (pull-dir vector :inline :offset-assert 32) + (radial-dir vector :inline :offset-assert 48) + ) + :method-count-assert 9 + :size-assert #x40 + :flag-assert #x900000040 + ) + + +(deftype flow-section-array (inline-array-class) + ((data flow-section :dynamic :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + + +(set! (-> flow-section-array heap-base) (the-as uint 64)) + +(deftype flow-control (basic) + ((path path-control :offset-assert 4) + (speed float :offset-assert 8) + (belt-radius float :offset-assert 12) + (sections flow-section-array :offset-assert 16) + (leading plane :inline :offset-assert 32) + (collide-bounds sphere :inline :offset-assert 48) + ) + :method-count-assert 13 + :size-assert #x40 + :flag-assert #xd00000040 + (:methods + (new (symbol type process-drawable res-lump) _type_ 0) + (draw-path (_type_) none 9) + (flow-control-method-10 () none 10) + (flow-control-method-11 () none 11) + (flow-control-method-12 () none 12) + ) + ) + + +(defmethod relocate flow-control ((obj flow-control) (arg0 int)) + (if (nonzero? (-> obj sections)) + (&+! (-> obj sections) arg0) + ) + (if (nonzero? (-> obj path)) + (&+! (-> obj path) arg0) + ) + ((the-as (function flow-control int flow-control) (find-parent-method flow-control 7)) obj arg0) + ) + +(defmethod draw-path flow-control ((obj flow-control)) + (let ((a0-1 (-> obj path))) + (if (nonzero? a0-1) + (debug-draw a0-1) + ) + ) + 0 + (none) + ) + +(defmethod new flow-control ((allocation symbol) (type-to-make type) (arg0 process-drawable) (arg1 res-lump)) + (if (not arg1) + (set! arg1 (-> arg0 entity)) + ) + (let ((s5-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (when (nonzero? s5-0) + (let ((v1-6 (new 'process 'curve-control arg0 'flow -1000000000.0))) + (cond + ((nonzero? v1-6) + (set! (-> s5-0 path) v1-6) + (logior! (-> v1-6 flags) (path-control-flag display draw-line draw-point draw-text)) + (if (< (-> v1-6 curve num-cverts) 2) + (go process-drawable-art-error "bad flow path") + ) + (set! (-> s5-0 speed) (res-lump-float arg1 'speed :default 12288.0)) + (set! (-> s5-0 belt-radius) (res-lump-float arg1 'extra-radius :default 16384.0)) + ((method-of-object s5-0 flow-control-method-10)) + ) + (else + (go process-drawable-art-error "no flow path") + ) + ) + ) + ) + s5-0 + ) + ) diff --git a/goal_src/jak2/engine/common_objs/water-h.gc b/goal_src/jak2/engine/common_objs/water-h.gc index e78fce7ee2..48a096879c 100644 --- a/goal_src/jak2/engine/common_objs/water-h.gc +++ b/goal_src/jak2/engine/common_objs/water-h.gc @@ -42,17 +42,19 @@ (touch-water-good) ) +(define-extern ripple-find-height (function process-drawable int vector float)) + ;; DECOMP BEGINS (deftype water-info (structure) - ((trans vector :inline :offset-assert 0) - (normal vector :inline :offset-assert 16) - (base-height meters :offset-assert 32) - (depth meters :offset-assert 36) - (handle uint64 :offset-assert 40) - (flags water-flags :offset-assert 48) - (prim basic :offset-assert 52) - (extra-flags uint32 :offset-assert 56) + ((trans vector :inline :offset-assert 0) + (normal vector :inline :offset-assert 16) + (base-height meters :offset-assert 32) + (depth meters :offset-assert 36) + (handle handle :offset-assert 40) + (flags water-flags :offset-assert 48) + (prim drawable-region-prim :offset-assert 52) + (extra-flags uint32 :offset-assert 56) ) :method-count-assert 9 :size-assert #x3c @@ -60,59 +62,59 @@ ) (deftype water-control (basic) - ((flags water-flags :offset-assert 4) - (process process-hidden :offset-assert 8) - (joint-index int32 :offset-assert 12) - (top-y-offset float :offset-assert 16) - (attack-id uint32 :offset-assert 20) - (enter-water-time time-frame :offset-assert 24) - (wade-time time-frame :offset-assert 32) - (on-water-time time-frame :offset-assert 40) - (enter-swim-time time-frame :offset-assert 48) - (swim-time time-frame :offset-assert 56) - (base-height meters :offset-assert 64) - (wade-height meters :offset-assert 68) - (swim-height meters :offset-assert 72) - (surface-height meters :offset-assert 76) - (bottom-height meters :offset-assert 80) - (collide-height meters :offset-assert 84) - (height meters :offset-assert 88) - (height-offset float 4 :offset-assert 92) - (base-ocean-offset meters :offset 92) - (real-ocean-offset meters :offset 92) - (ocean-offset meters :offset 96) - (bob-offset meters :offset 100) - (align-offset meters :offset 104) - (swim-depth meters :offset 108) - (bob smush-control :inline :offset 112) - (ripple int64 :offset 144) - (ripple-size meters :offset 152) - (wake-size meters :offset 156) - (bottom vector 2 :inline :offset 160) - (top vector 2 :inline :offset 192) - (enter-water-pos vector :inline :offset 224) - (drip-old-pos vector :inline :offset 240) - (drip-joint-index int32 :offset 256) - (drip-wetness float :offset 260) - (drip-time time-frame :offset 264) - (drip-speed float :offset 272) - (drip-height meters :offset 276) - (drip-mult float :offset 280) - (distort-time time-frame :offset 288) + ((flags water-flags :offset-assert 4) + (process target :offset-assert 8) + (joint-index int32 :offset-assert 12) + (top-y-offset float :offset-assert 16) + (attack-id uint32 :offset-assert 20) + (enter-water-time time-frame :offset-assert 24) + (wade-time time-frame :offset-assert 32) + (on-water-time time-frame :offset-assert 40) + (enter-swim-time time-frame :offset-assert 48) + (swim-time time-frame :offset-assert 56) + (base-height meters :offset-assert 64) + (wade-height meters :offset-assert 68) + (swim-height meters :offset-assert 72) + (surface-height meters :offset-assert 76) + (bottom-height meters :offset-assert 80) + (collide-height meters :offset-assert 84) + (height meters :offset-assert 88) + (height-offset float 4 :offset-assert 92) + (base-ocean-offset meters :offset 92) + (real-ocean-offset meters :offset 92) + (ocean-offset meters :offset 96) + (bob-offset meters :offset 100) + (align-offset meters :offset 104) + (swim-depth meters :offset 108) + (bob smush-control :inline :offset 112) + (ripple handle :offset 144) + (ripple-size meters :offset 152) + (wake-size meters :offset 156) + (bottom vector 2 :inline :offset 160) + (top vector 2 :inline :offset 192) + (enter-water-pos vector :inline :offset 224) + (drip-old-pos vector :inline :offset 240) + (drip-joint-index int32 :offset 256) + (drip-wetness float :offset 260) + (drip-time time-frame :offset 264) + (drip-speed float :offset 272) + (drip-height meters :offset 276) + (drip-mult float :offset 280) + (distort-time time-frame :offset 288) ) :method-count-assert 17 :size-assert #x128 :flag-assert #x1100000128 (:methods (new (symbol type process int float float float) _type_ 0) - (water-control-method-9 () none 9) - (water-control-method-10 () none 10) - (water-control-method-11 () none 11) + (water-control-method-9 (_type_) none 9) + (water-control-method-10 (_type_) none 10) + (start-bobbing! (_type_ float int int) none 11) (distance-from-surface (_type_) float 12) - (water-control-method-13 (_type_ float vector int vector symbol) none 13) + (spawn-ripples (_type_ float vector int vector symbol) none 13) (display-water-marks? (_type_) symbol 14) - (water-control-method-15 () none 15) - (water-control-method-16 () none 16) + (enter-water (_type_) none 15) + (water-control-method-16 (_type_) none 16) ) ) @@ -122,14 +124,14 @@ (defmethod new water-control ((allocation symbol) (type-to-make type) (arg0 process) (arg1 int) (arg2 float) (arg3 float) (arg4 float)) (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) - (set! (-> v0-0 process) (the-as process-hidden arg0)) + (set! (-> v0-0 process) (the-as target arg0)) (set! (-> v0-0 joint-index) arg1) (set! (-> v0-0 wade-height) arg4) (set! (-> v0-0 swim-height) arg3) (set! (-> v0-0 bottom-height) 32768.0) (set! (-> v0-0 ripple-size) 1638.4) (set! (-> v0-0 wake-size) 3072.0) - (set! (-> v0-0 ripple) (the-as int #f)) + (set! (-> v0-0 ripple) (the-as handle #f)) (set! (-> v0-0 drip-mult) 1.0) (set! (-> v0-0 top-y-offset) arg2) (let* ((v1-6 *game-info*) diff --git a/goal_src/jak2/engine/common_objs/water.gc b/goal_src/jak2/engine/common_objs/water.gc index 3708683c9e..3dcbe07dd2 100644 --- a/goal_src/jak2/engine/common_objs/water.gc +++ b/goal_src/jak2/engine/common_objs/water.gc @@ -7,3 +7,1673 @@ ;; DECOMP BEGINS +(defun check-water-level-drop ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (when (and (< (-> arg2 y) (-> arg1 user-float)) (< (-> arg1 vel-sxvel y) 0.0)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (sp-kill-particle arg0 arg1) + (set-vector! gp-0 (-> arg2 x) (-> arg1 user-float) (-> arg2 z) 1.0) + (sound-play "water-drop" :position gp-0) + (let ((t9-3 sp-launch-particles-var) + (a0-4 *sp-particle-system-3d*) + (a1-3 (-> *part-id-table* 501)) + (a2-2 *launch-matrix*) + ) + (set! (-> a2-2 trans quad) (-> gp-0 quad)) + (t9-3 a0-4 a1-3 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + 0 + (none) + ) + +(defun check-water-level-drop-and-die ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (if (and (< (-> arg2 y) (-> arg1 user-float)) (< (-> arg1 vel-sxvel y) 0.0)) + (sp-kill-particle arg0 arg1) + ) + (none) + ) + +(defun check-water-level-drop-and-die-motion ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (if (and (< (-> arg2 y) (-> arg1 user-float)) (< (-> arg1 vel-sxvel y) 0.0)) + (sp-kill-particle arg0 arg1) + ) + (sparticle-motion-blur arg0 arg1 arg2) + (none) + ) + +(defun check-water-level-above-and-die ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (if (or (>= (-> arg2 y) (-> arg1 user-float)) (and *target* (>= (-> arg2 y) (-> *target* water height)))) + (sp-kill-particle arg0 arg1) + ) + (none) + ) + +(defpart 502 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 9.0) + (sp-rnd-flt spt-x (meters -0.25) (meters 0.5) 1.0) + (sp-rnd-flt spt-y (meters -0.05) (meters 0.1) 1.0) + (sp-rnd-flt spt-z (meters -0.25) (meters 0.5) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.1) (meters 0.1) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.05) (meters 0.05) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 24.0 40.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0) (meters 0.006666667) 1.0) + (sp-rnd-flt spt-accel-y 0.68266666 0.68266666 1.0) + (sp-flt spt-friction 0.96) + (sp-int spt-timer 1500) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-above-and-die) + (sp-flt spt-conerot-x (degrees 90.0)) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +(defpart 503 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 0.1) + (sp-rnd-flt spt-x (meters -0.25) (meters 0.5) 1.0) + (sp-flt spt-y (meters 0.15)) + (sp-rnd-flt spt-z (meters -0.25) (meters 0.5) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.1) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.15) (meters 0.05) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 40.0 24.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0) (meters 0.006666667) 1.0) + (sp-flt spt-accel-y 1.3653333) + (sp-flt spt-friction 0.96) + (sp-int spt-timer 1500) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-above-and-die) + (sp-flt spt-conerot-x (degrees 90.0)) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +(defpart 504 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x2c :page #xc)) + (sp-flt spt-num 0.05) + (sp-rnd-flt spt-scale-x (meters 1.6) (meters 0.8) 1.0) + (sp-rnd-flt spt-rot-y (degrees 0.0) (degrees 3600.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 1.6) (meters 0.8) 1.0) + (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 16.0 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.004) (meters 0.0037333334) 1.0) + (sp-rnd-flt spt-scalevel-y (meters 0.004) (meters 0.0037333334) 1.0) + (sp-int spt-timer 800) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 left-multiply-quat) + (sp-int-plain-rnd spt-next-time 150 299 1) + (sp-launcher-by-id spt-next-launcher 505) + ) + ) + +(defpart 506 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x2e :page #xc)) + (sp-flt spt-num 0.06) + (sp-flt spt-x (meters 10)) + (sp-rnd-flt spt-scale-x (meters 0.75) (meters 1.5) 1.0) + (sp-flt spt-rot-y (degrees 0.0)) + (sp-rnd-flt spt-scale-y (meters 0.75) (meters 1.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 0.0) + (sp-rnd-flt spt-vel-x (meters 0.01) (meters 0.006666667) 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.0033333334) (meters 0.004333333) 1.0) + (sp-rnd-flt spt-scalevel-y (meters 0.0033333334) (meters 0.004333333) 1.0) + (sp-flt spt-fade-a 0.7111111) + (sp-flt spt-friction 0.94) + (sp-int spt-timer 600) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 left-multiply-quat) + (sp-int spt-next-time 90) + (sp-launcher-by-id spt-next-launcher 507) + (sp-flt spt-rotate-y (degrees 0.0)) + ) + ) + +(defpart 507 + :init-specs ((sp-flt spt-fade-a 0.0) (sp-int-plain-rnd spt-next-time 90 119 1) (sp-launcher-by-id spt-next-launcher 508)) + ) + +(defpart 508 + :init-specs ((sp-flt spt-fade-a -0.21333334)) + ) + +(defpart 509 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x33 :page #xc)) + (sp-rnd-flt spt-num 0.05 0.4 1.0) + (sp-rnd-flt spt-x (meters -0.75) (meters 1.5) 1.0) + (sp-rnd-flt spt-z (meters -0.75) (meters 1.5) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.2) (meters 0.7) 1.0) + (sp-rnd-flt spt-rot-y (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 128.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-scalevel-x (meters 0.0016666667) (meters 0.003) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a 0.42666668) + (sp-int spt-timer 600) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 left-multiply-quat) + (sp-int spt-next-time 150) + (sp-launcher-by-id spt-next-launcher 510) + (sp-flt spt-rotate-y (degrees 0.0)) + ) + ) + +(defpart 510 + :init-specs ((sp-flt spt-fade-a 0.0) (sp-int spt-next-time 360) (sp-launcher-by-id spt-next-launcher 511)) + ) + +(defpart 511 + :init-specs ((sp-flt spt-fade-a -0.7111111)) + ) + +(defpartgroup group-part-water-splash + :id 121 + :duration (seconds 3) + :flags (use-local-clock) + :bounds (static-bspherem 0 -12 0 14) + :parts ((sp-item 514 :flags (is-3d) :period 900 :length 63) + (sp-item 515 :period 900 :length 15) + (sp-item 516 :flags (is-3d) :period 900 :length 15) + (sp-item 517 :period 900 :length 15 :binding 512) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 518 :flags (is-3d) :period 900 :length 15 :offset 60) + (sp-item 519 :flags (is-3d) :period 900 :length 60 :offset 60) + (sp-item 520 :period 900 :length 10 :offset 60 :binding 513) + (sp-item 513 :flags (start-dead) :period 900 :length 120 :offset 60) + (sp-item 513 :flags (start-dead) :period 900 :length 120 :offset 60) + (sp-item 513 :flags (start-dead) :period 900 :length 120 :offset 60) + (sp-item 513 :flags (start-dead) :period 900 :length 120 :offset 60) + (sp-item 513 :flags (start-dead) :period 900 :length 120 :offset 60) + (sp-item 513 :flags (start-dead) :period 900 :length 120 :offset 60) + (sp-item 513 :flags (start-dead) :period 900 :length 120 :offset 60) + (sp-item 513 :flags (start-dead) :period 900 :length 120 :offset 60) + (sp-item 513 :flags (start-dead) :period 900 :length 120 :offset 60) + (sp-item 513 :flags (start-dead) :period 900 :length 120 :offset 60) + (sp-item 513 :flags (start-dead) :period 900 :length 120 :offset 60) + (sp-item 521 :period 900 :length 5) + (sp-item 521 :period 900 :length 15) + (sp-item 521 :period 900 :length 40) + (sp-item 522 :flags (launch-asap) :period 900 :length 5) + ) + ) + +(defpartgroup group-part-water-splash-small + :id 122 + :duration (seconds 3) + :flags (use-local-clock) + :bounds (static-bspherem 0 -12 0 14) + :parts ((sp-item 514 :flags (is-3d) :period 900 :length 63) + (sp-item 515 :period 900 :length 15) + (sp-item 516 :flags (is-3d) :period 900 :length 15) + (sp-item 517 :period 900 :length 10 :binding 512) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + ) + ) + +(defpart 512 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 0.2) + (sp-rnd-flt spt-x (meters -0.2) (meters 0.4) 1.0) + (sp-rnd-flt spt-y (meters -0.2) (meters 0.4) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.05) (meters 0.15) 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 40.0 24.0 1.0) + (sp-flt spt-scalevel-x (meters 0.000033333334)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-accel-y -1.6384001 -0.81920004 1.0) + (sp-int spt-timer 450) + (sp-cpuinfo-flags sp-cpuinfo-flag-3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-drop-and-die) + ) + ) + +(defpart 513 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 0.2) + (sp-rnd-flt spt-x (meters -0.2) (meters 0.4) 1.0) + (sp-rnd-flt spt-y (meters -0.2) (meters 0.4) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.05) (meters 0.15) 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 40.0 24.0 1.0) + (sp-flt spt-scalevel-x (meters 0.000033333334)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-accel-y -1.6384001 -0.81920004 1.0) + (sp-int spt-timer 450) + (sp-cpuinfo-flags sp-cpuinfo-flag-3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-drop-and-die) + ) + ) + +(defpart 519 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x2c :page #xc)) + (sp-flt spt-num 0.05) + (sp-rnd-flt spt-scale-x (meters 0.080000006) (meters 0.32000002) 1.0) + (sp-rnd-flt spt-rot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.080000006) (meters 0.32000002) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-scalevel-x (meters 0.004) (meters 0.0090666665) 1.0) + (sp-rnd-flt spt-scalevel-y (meters 0.004) (meters 0.0090666665) 1.0) + (sp-flt spt-fade-a 0.32) + (sp-int spt-timer 600) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 left-multiply-quat) + (sp-int spt-next-time 150) + (sp-launcher-by-id spt-next-launcher 523) + ) + ) + +(defpart 520 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 3.2) + (sp-rnd-flt spt-x (meters -0.2) (meters 0.4) 1.0) + (sp-rnd-flt spt-y (meters -0.2) (meters 0.4) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.35) (meters 0.075) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.2) (meters 0.075) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 40.0 24.0 1.0) + (sp-rnd-flt spt-vel-x (meters -0.002) (meters 0.004) 1.0) + (sp-rnd-flt spt-vel-y (meters 0.018666666) (meters 0.0053333333) 1.0) + (sp-rnd-flt spt-vel-z (meters -0.002) (meters 0.004) 1.0) + (sp-flt spt-scalevel-x (meters -0.00066666666)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-accel-y -3.2768002 -0.81920004 1.0) + (sp-int spt-timer 900) + (sp-cpuinfo-flags sp-cpuinfo-flag-3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-drop) + (sp-int spt-next-time 120) + (sp-launcher-by-id spt-next-launcher 524) + ) + ) + +(defpart 518 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x2d :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 0.24000001) (meters 0.71999997) 1.0) + (sp-flt spt-rot-x 16384.0) + (sp-rnd-flt spt-rot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-rot-z (degrees 0.0)) + (sp-rnd-flt spt-scale-y (meters 0.8) (meters 1.7600001) 1.0) + (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 32.0 1.0) + (sp-rnd-flt spt-scalevel-y (meters 0.053333335) (meters 0.013333334) 1.0) + (sp-int spt-timer 240) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 left-multiply-quat set-conerot) + (sp-int-plain-rnd spt-next-time 20 19 1) + (sp-launcher-by-id spt-next-launcher 525) + ) + ) + +(defpart 525 + :init-specs ((sp-flt spt-scalevel-y (meters 0.026666667)) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 526) + ) + ) + +(defpart 526 + :init-specs ((sp-flt spt-scalevel-y (meters 0)) + (sp-flt spt-fade-a -0.64) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 527) + ) + ) + +(defpart 527 + :init-specs ((sp-flt spt-scalevel-x (meters 0.0016666667)) + (sp-flt spt-scalevel-y (meters -0.026666667)) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 528) + ) + ) + +(defpart 528 + :init-specs ((sp-flt spt-scalevel-x (meters 0.0033333334)) (sp-flt spt-scalevel-y (meters -0.053333335))) + ) + +(defpart 516 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-func spt-birth-func 'birth-func-texture-group) + (sp-flt spt-num 3.0) + (sp-rnd-flt spt-scale-x (meters 1.6) (meters 0.8) 1.0) + (sp-rnd-flt spt-rot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 1.6) (meters 0.8) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 48.0 16.0 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.004) (meters 0.0037333334) 1.0) + (sp-rnd-flt spt-scalevel-y (meters 0.004) (meters 0.0037333334) 1.0) + (sp-int spt-timer 800) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 left-multiply-quat) + (new 'static 'sp-field-init-spec + :field (sp-field-id spt-userdata) + :flags (sp-flag plain-v2) + :object (new 'static 'boxed-array :type int32 10 0 0 #xc0c900 #xc03300 #xc02c00) + ) + (sp-int-plain-rnd spt-next-time 150 299 1) + (sp-launcher-by-id spt-next-launcher 505) + ) + ) + +(defpart 505 + :init-specs ((sp-flt spt-fade-a -0.21333334)) + ) + +(defpart 517 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 3.2) + (sp-flt spt-x (meters 0.96000004)) + (sp-rnd-flt spt-scale-x (meters 0.35) (meters 0.075) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.2) (meters 0.075) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 40.0 24.0 1.0) + (sp-rnd-flt spt-vel-x (meters 0.0026666666) (meters 0.0053333333) 1.0) + (sp-rnd-flt spt-vel-y (meters 0.016) (meters 0.0053333333) 1.0) + (sp-flt spt-scalevel-x (meters -0.00066666666)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-accel-y -3.2768002 -0.81920004 1.0) + (sp-int spt-timer 900) + (sp-cpuinfo-flags sp-cpuinfo-flag-3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-drop) + (sp-int spt-next-time 120) + (sp-launcher-by-id spt-next-launcher 524) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +(defpart 524 + :init-specs ((sp-flt spt-scalevel-x (meters 0)) (sp-copy-from-other spt-scalevel-y -4)) + ) + +(defpart 515 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 8.0) + (sp-flt spt-x (meters 0.8)) + (sp-rnd-flt spt-scale-x (meters 0.15) (meters 0.05) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.15) (meters 0.05) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 40.0 24.0 1.0) + (sp-rnd-flt spt-vel-x (meters 0.0026666666) (meters 0.0053333333) 1.0) + (sp-rnd-flt spt-vel-y (meters 0.0053333333) (meters 0.0053333333) 1.0) + (sp-flt spt-scalevel-x (meters -0.00033333333)) + (sp-flt spt-scalevel-y (meters -0.00033333333)) + (sp-rnd-flt spt-accel-y -2.1845336 -0.5461334 1.0) + (sp-int spt-timer 375) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-drop-and-die) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +(defpart 514 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x2d :page #xc)) + (sp-flt spt-num 1.5) + (sp-rnd-flt spt-x (meters 0.16000001) (meters 0.16000001) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.32000002) (meters 0.96000004) 1.0) + (sp-flt spt-rot-x 16384.0) + (sp-flt spt-rot-y (degrees 90.0)) + (sp-flt spt-rot-z (degrees 0.0)) + (sp-rnd-flt spt-scale-y (meters 0.16000001) (meters 1.7600001) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 48.0 24.0 1.0) + (sp-flt spt-vel-x (meters 0.0026666666)) + (sp-rnd-flt spt-scalevel-x (meters 0) (meters 0.0016666667) 1.0) + (sp-flt spt-rotvel-x (degrees 0.2)) + (sp-flt spt-scalevel-y (meters 0.04)) + (sp-int spt-timer 240) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 left-multiply-quat set-conerot) + (sp-int-plain-rnd spt-next-time 20 19 1) + (sp-launcher-by-id spt-next-launcher 529) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +(defpart 529 + :init-specs ((sp-flt spt-scalevel-x (meters 0)) + (sp-flt spt-rotvel-x (degrees 0.16666667)) + (sp-flt spt-scalevel-y (meters 0.016666668)) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 530) + ) + ) + +(defpart 530 + :init-specs ((sp-flt spt-rotvel-x (degrees 0.13333334)) + (sp-flt spt-scalevel-y (meters 0)) + (sp-flt spt-fade-a -0.64) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 531) + ) + ) + +(defpart 531 + :init-specs ((sp-flt spt-rotvel-x (degrees 0.1)) + (sp-flt spt-scalevel-y (meters -0.016666668)) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 532) + ) + ) + +(defpart 532 + :init-specs ((sp-flt spt-rotvel-x (degrees 0.06666667)) (sp-flt spt-scalevel-y (meters -0.033333335))) + ) + +(defpart 522 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xca :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 6) (meters 0.1) 1.0) + (sp-flt spt-rot-x 2048.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-copy-from-other spt-g -1) + (sp-flt spt-b 255.0) + (sp-flt spt-a 0.0) + (sp-flt spt-scalevel-x (meters 0.16)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a 1.0666667) + (sp-int spt-timer 60) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow sp-cpuinfo-flag-21) + (sp-flt spt-userdata 10240.0) + (sp-int spt-next-time 15) + (sp-launcher-by-id spt-next-launcher 533) + (sp-flt spt-rotate-y (degrees 0.0)) + ) + ) + +(defpart 533 + :init-specs ((sp-flt spt-fade-a -0.64)) + ) + +(defpart 521 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 12.0) + (sp-flt spt-y (meters 0)) + (sp-rnd-flt spt-scale-x (meters 0.08) (meters 0.03) 1.0) + (sp-int spt-rot-x 4) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 32.0 32.0 1.0) + (sp-copy-from-other spt-g -1) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-flt spt-a 128.0) + (sp-rnd-flt spt-omega 2.8672 1.6384 1.0) + (sp-rnd-flt spt-vel-y (meters 0.033333335) (meters 0.05) 1.0) + (sp-rnd-flt spt-accel-y -20.48 -2.7306666 1.0) + (sp-rnd-flt spt-friction 0.96 0.02 1.0) + (sp-int spt-timer 300) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-21) + (sp-flt spt-userdata -208896.0) + (sp-func spt-func 'check-water-level-drop-motion) + (sp-int-plain-rnd spt-next-time 0 174 1) + (sp-launcher-by-id spt-next-launcher 63) + (sp-rnd-flt spt-conerot-x (degrees 15.0) (degrees 65.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 3600.0) 1.0) + (sp-flt spt-rotate-y (degrees 0.0)) + (sp-rnd-flt spt-conerot-radius (meters 0) (meters 1) 1.0) + ) + ) + +(defpart 63 + :init-specs ((sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-int spt-next-time 5) + (sp-launcher-by-id spt-next-launcher 534) + ) + ) + +(defpart 534 + :init-specs ((sp-rnd-flt spt-r 32.0 32.0 1.0) + (sp-rnd-flt spt-g 32.0 32.0 1.0) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-int-plain-rnd spt-next-time 0 449 1) + (sp-launcher-by-id spt-next-launcher 535) + ) + ) + +(defpart 501 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 0.3) + (sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.25) 1.0) + (sp-rnd-flt spt-rot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 32.0 32.0 1.0) + (sp-copy-from-other spt-g -1) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-rnd-flt spt-a 64.0 32.0 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.006666667) (meters 0.006666667) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-fade-a -0.32 -0.32 1.0) + (sp-int spt-timer 450) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-21) + (new 'static 'sp-field-init-spec + :field (sp-field-id spt-userdata) + :flags (sp-flag plain-v2) + :object (new 'static 'boxed-array :type int32 10 0 0 #xc0c900 #xc02600 #xc03300 #xc02c00) + ) + (sp-func spt-func 'sparticle-texture-animate) + (sp-flt spt-rotate-y (degrees 0.0)) + ) + ) + +(defpart 536 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-rnd-flt spt-num 0.0 0.5 1.0) + (sp-rnd-flt spt-scale-x (meters 0.08) (meters 0.03) 1.0) + (sp-int spt-rot-x 4) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 32.0 32.0 1.0) + (sp-copy-from-other spt-g -1) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-flt spt-a 128.0) + (sp-rnd-flt spt-omega 2.8672 1.6384 1.0) + (sp-rnd-flt spt-vel-y (meters 0.026666667) (meters 0.05) 1.0) + (sp-rnd-flt spt-accel-y -20.48 -2.7306666 1.0) + (sp-flt spt-friction 0.95) + (sp-int spt-timer 600) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-21) + (sp-flt spt-userdata -208896.0) + (sp-func spt-func 'check-water-level-drop-and-die-motion) + (sp-int-plain-rnd spt-next-time 0 99 1) + (sp-launcher-by-id spt-next-launcher 63) + (sp-rnd-flt spt-conerot-x (degrees 30.0) (degrees 40.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 3600.0) 1.0) + (sp-flt spt-rotate-y (degrees 0.0)) + ) + ) + +(defun check-water-level-drop-motion ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (when (and (< (-> arg2 y) (-> arg1 user-float)) (< (-> arg1 vel-sxvel y) 0.0)) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (sp-kill-particle arg0 arg1) + (set-vector! s3-0 (-> arg2 x) (-> arg1 user-float) (-> arg2 z) 1.0) + (sound-play "water-drop" :position s3-0) + (let ((t9-3 sp-launch-particles-var) + (a0-5 *sp-particle-system-3d*) + (a1-3 (-> *part-id-table* 501)) + (a2-2 *launch-matrix*) + ) + (set! (-> a2-2 trans quad) (-> s3-0 quad)) + (t9-3 a0-5 a1-3 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (set! (-> *part-id-table* 536 init-specs 15 initial-valuef) (-> s3-0 y)) + (let ((t9-4 sp-launch-particles-var) + (a0-6 *sp-particle-system-2d*) + (a1-4 (-> *part-id-table* 536)) + (a2-3 *launch-matrix*) + ) + (set! (-> a2-3 trans quad) (-> s3-0 quad)) + (t9-4 a0-6 a1-4 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + (sparticle-motion-blur arg0 arg1 arg2) + (none) + ) + +(defpart 537 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 0.15) (meters 0.05) 1.0) + (sp-int spt-rot-x 4) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 32.0 32.0 1.0) + (sp-copy-from-other spt-g -1) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-flt spt-a 128.0) + (sp-rnd-flt spt-omega 4.096 4.096 1.0) + (sp-rnd-flt spt-vel-x (meters -0.016666668) (meters 0.0016666667) 1.0) + (sp-flt spt-vel-y (meters 0.016666668)) + (sp-rnd-flt spt-vel-z (meters -0.016666668) (meters 0.0016666667) 1.0) + (sp-flt spt-scalevel-x (meters -0.00016666666)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-accel-y -4.096 -1.3653333 1.0) + (sp-int spt-timer 600) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-drop-motion) + (sp-int spt-next-time 600) + (sp-launcher-by-id spt-next-launcher 538) + ) + ) + +(defmethod water-control-method-9 water-control ((obj water-control)) + 0 + (none) + ) + +(defmethod water-control-method-10 water-control ((obj water-control)) + (local-vars + (sv-272 (function vector entity-actor skeleton-group vector none :behavior manipy)) + (sv-288 vector) + (sv-304 entity-actor) + ) + (with-pp + (let ((s4-0 (-> obj flags)) + (s5-0 (new 'stack-no-clear 'water-info)) + ) + (when (logtest? (water-flags find-water) (-> obj flags)) + (water-info-init! (the-as collide-shape (-> obj process control)) s5-0 (collide-action solid semi-solid)) + (set! (-> obj flags) + (logior (logclear + (-> obj flags) + (water-flags active can-wade can-swim can-ground use-ocean tar mud use-water-anim swamp over-water) + ) + (logclear (-> s5-0 flags) (water-flags touch-water)) + ) + ) + (set! (-> obj base-height) (-> s5-0 base-height)) + (set! (-> obj base-ocean-offset) (- (-> s5-0 trans y) (-> s5-0 base-height))) + ) + (cond + ((not (logtest? (-> obj flags) (water-flags active))) + (logclear! + (-> obj flags) + (water-flags under-water head-under-water bouncing wading swimming touch-water jump-out break-surface) + ) + ) + ((and (logtest? (-> obj flags) (water-flags no-grab-ground)) + (logtest? (-> obj process focus-status) (focus-status grabbed)) + ) + (set! (-> obj flags) (logior (water-flags jump-out) (-> obj flags))) + (logclear! (-> obj flags) (water-flags break-surface)) + ) + ((begin + (set! (-> obj top 1 quad) (-> obj top 0 quad)) + (vector<-cspace! (the-as vector (-> obj top)) (-> obj process node-list data (-> obj joint-index))) + (+! (-> obj top 0 y) (-> obj top-y-offset)) + (set! (-> obj bottom 1 quad) (-> obj bottom 0 quad)) + (set! (-> obj bottom 0 quad) (-> obj process control trans quad)) + (logclear! (-> obj flags) (water-flags under-water head-under-water bouncing wading swimming break-surface)) + (set! (-> obj bob-offset) (update! (-> obj bob))) + (cond + ((logtest? (-> obj flags) (water-flags use-ocean use-water-anim)) + (if (not (logtest? (water-flags touch-water) (-> obj flags))) + (set! (-> obj ocean-offset) (-> obj base-ocean-offset)) + (set! (-> obj ocean-offset) (lerp (-> obj ocean-offset) (-> obj base-ocean-offset) 0.2)) + ) + (set! (-> obj base-ocean-offset) 0.0) + ) + (else + (set! (-> obj base-ocean-offset) 0.0) + (set! (-> obj base-ocean-offset) 0.0) + (set! (-> obj ocean-offset) 0.0) + ) + ) + (if (logtest? (focus-status board pilot) (-> obj process focus-status)) + (set! (-> obj bob-offset) 0.0) + ) + (set! (-> obj height) + (+ (-> obj base-height) (-> obj ocean-offset) (-> obj bob-offset) (-> obj align-offset)) + ) + (set! (-> obj surface-height) (+ (-> obj base-height) (-> obj base-ocean-offset))) + (cond + ((logtest? (focus-status board pilot) (-> obj process focus-status)) + (set! (-> obj collide-height) (+ -819.2 (-> obj base-ocean-offset) (-> obj base-height))) + ) + ((logtest? (-> obj flags) (water-flags swim-ground)) + (set! (-> obj collide-height) (- (-> obj height) (-> obj swim-height))) + ) + (else + (set! (-> obj collide-height) (- (-> obj height) (-> obj bottom-height))) + ) + ) + (set! (-> obj swim-depth) (fmax 0.0 (- (- (-> obj surface-height) (-> obj swim-height)) (-> obj bottom 0 y)))) + (and (>= (-> obj height) (-> obj bottom 0 y)) (logtest? (water-flags touch-water) (-> s5-0 flags))) + ) + (if (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (cshape-moving-flags on-water)) + (set! (-> obj on-water-time) (-> pp clock frame-counter)) + ) + (when (not (logtest? (-> obj flags) (water-flags dark-eco lava))) + (set! (-> obj drip-wetness) 1.0) + (set! (-> obj drip-height) (fmax (- (-> obj surface-height) (-> obj bottom 0 y)) (-> obj drip-height))) + (set! (-> obj drip-speed) 15.0) + ) + (if (and (not (logtest? (water-flags touch-water) (-> obj flags))) + (zero? (logand (-> obj process focus-status) (focus-status touch-water))) + ) + (enter-water obj) + ) + (set! (-> obj flags) (logior (water-flags touch-water) (-> obj flags))) + (cond + ((>= (-> obj top 0 y) (-> obj height)) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (set! (-> s3-0 quad) (-> obj bottom 0 quad)) + (let ((v1-79 (-> obj process control transv))) + (sqrtf (+ (* (-> v1-79 x) (-> v1-79 x)) (* (-> v1-79 z) (-> v1-79 z)))) + ) + (set! (-> obj flags) (logior (water-flags break-surface) (-> obj flags))) + (set! (-> s3-0 y) (+ 40.96 (-> obj surface-height))) + (when (and (not (handle->process (-> obj ripple))) + (>= (+ (-> pp clock frame-counter) (seconds -1.5)) (-> obj enter-water-time)) + ) + (let* ((s1-0 (get-process *default-dead-pool* manipy #x4000)) + (s2-0 + (when s1-0 + (let ((t9-6 (method-of-type manipy activate))) + (t9-6 (the-as manipy s1-0) (-> obj process) (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) + ) + (let ((s2-1 run-function-in-process) + (s0-0 s1-0) + ) + (set! sv-272 manipy-init) + (set! sv-288 s3-0) + (set! sv-304 (-> obj process entity)) + (let ((t0-0 (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer uint32) #f))) + (t1-0 #f) + ) + 0 + ((the-as (function object object object object object object none) s2-1) s0-0 sv-272 sv-288 sv-304 t0-0 t1-0) + ) + ) + (-> s1-0 ppointer) + ) + ) + ) + (set! (-> obj ripple) (ppointer->handle s2-0)) + (when s2-0 + (send-event (ppointer->process s2-0) 'anim-mode 'loop) + (send-event (ppointer->process s2-0) 'art-joint-anim "generic-ripples-cycle" 0) + (set-vector! (-> (the-as process-drawable (-> s2-0 0)) root scale) 0.0 0.5 0.0 1.0) + (send-event + (ppointer->process s2-0) + 'trans-hook + (lambda :behavior process-drawable + () + (let ((s5-0 (ppointer->process (-> self parent))) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> gp-0 quad) (-> (the-as process-drawable s5-0) water bottom 0 quad)) + (seek! (-> self root scale x) 2.0 (* 2.0 (-> self clock seconds-per-frame))) + (set! (-> self root scale z) (-> self root scale x)) + (set! (-> gp-0 y) (-> (the-as process-drawable s5-0) water surface-height)) + (let ((v0-1 (-> self root trans))) + (set! (-> v0-1 quad) (-> gp-0 quad)) + v0-1 + ) + ) + ) + ) + ) + ) + ) + (when (and (logtest? (-> obj process draw status) (draw-control-status on-screen)) + (zero? (-> obj process draw cur-lod)) + (logtest? (water-flags part-rings) (-> obj flags)) + (logtest? (water-flags part-water) (-> obj flags)) + ) + (let* ((f30-0 (y-angle (-> obj process control))) + (v1-141 (-> obj process control transv)) + (f28-0 (sqrtf (+ (* (-> v1-141 x) (-> v1-141 x)) (* (-> v1-141 z) (-> v1-141 z))))) + ) + (set! (-> *part-id-table* 506 init-specs 4 initial-valuef) (+ 24576.0 f30-0)) + (set! (-> *part-id-table* 506 init-specs 19 initial-valuef) (+ 49152.0 f30-0)) + (set! (-> *part-id-table* 506 init-specs 1 initial-valuef) (* 0.0000036621095 f28-0)) + (set! (-> *part-id-table* 506 init-specs 2 initial-valuef) (* 0.1 f28-0)) + (set! (-> *part-id-table* 506 init-specs 13 initial-valuef) 0.7111111) + (set! (-> *part-id-table* 506 init-specs 3 initial-valuef) (-> obj wake-size)) + (set! (-> *part-id-table* 506 init-specs 5 initial-valuef) (-> obj wake-size)) + (let ((t9-13 sp-launch-particles-var) + (a0-62 *sp-particle-system-3d*) + (a1-16 (-> *part-id-table* 506)) + (a2-8 *launch-matrix*) + ) + (set! (-> a2-8 trans quad) (-> s3-0 quad)) + (t9-13 a0-62 a1-16 a2-8 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (set! (-> *part-id-table* 509 init-specs 1 initial-valuef) (* 0.000004150391 f28-0)) + (set! (-> *part-id-table* 509 init-specs 18 initial-valuef) f30-0) + (let ((t9-14 sp-launch-particles-var) + (a0-63 *sp-particle-system-3d*) + (a1-17 (-> *part-id-table* 509)) + (a2-9 *launch-matrix*) + ) + (set! (-> a2-9 trans quad) (-> s3-0 quad)) + (t9-14 a0-63 a1-17 a2-9 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (when (< f28-0 4096.0) + (set! (-> *part-id-table* 504 init-specs 2 random-rangef) (-> obj ripple-size)) + (let ((t9-15 sp-launch-particles-var) + (a0-64 *sp-particle-system-3d*) + (a1-18 (-> *part-id-table* 504)) + (a2-10 *launch-matrix*) + ) + (set! (-> a2-10 trans quad) (-> s3-0 quad)) + (t9-15 a0-64 a1-18 a2-10 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + ) + (if (< (-> obj top 1 y) (-> obj height)) + (spawn-ripples obj 0.2 s3-0 1 (-> obj process control transv) #t) + ) + ) + ) + (else + (set! (-> obj flags) (logior (water-flags head-under-water) (-> obj flags))) + ) + ) + (when (and (logtest? (water-flags part-splash) (-> obj flags)) (logtest? (water-flags part-water) (-> obj flags))) + (cond + ((logtest? (-> obj flags) (water-flags lava)) + ) + ((logtest? (-> obj flags) (water-flags dark-eco)) + ) + ((logtest? (focus-status mech) (-> obj process focus-status)) + ) + (else + (let* ((v0-17 (rand-vu-int-range 3 (+ (-> obj process node-list length) -1))) + (s3-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data v0-17))) + ) + (when (< (-> s3-1 y) (-> obj surface-height)) + (set! (-> *part-id-table* 502 init-specs 16 initial-valuef) (-> obj surface-height)) + (let ((f0-72 (lerp-scale 12.0 0.4 (the float (- (-> pp clock frame-counter) (-> obj enter-water-time))) 0.0 600.0)) + (f1-26 0.00012207031) + (v1-222 (-> obj process control transv)) + ) + (set! (-> *part-id-table* 502 init-specs 1 initial-valuef) + (+ f0-72 (* f1-26 (sqrtf (+ (* (-> v1-222 x) (-> v1-222 x)) (* (-> v1-222 z) (-> v1-222 z)))))) + ) + ) + (let ((t9-20 sp-launch-particles-var) + (a0-75 *sp-particle-system-2d*) + (a1-26 (-> *part-id-table* 502)) + (a2-14 *launch-matrix*) + ) + (set! (-> a2-14 trans quad) (-> s3-1 quad)) + (t9-20 a0-75 a1-26 a2-14 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (set! (-> *part-id-table* 503 init-specs 16 initial-valuef) (-> obj surface-height)) + (let ((t9-21 sp-launch-particles-var) + (a0-76 *sp-particle-system-2d*) + (a1-27 (-> *part-id-table* 503)) + (a2-15 *launch-matrix*) + ) + (set! (-> a2-15 trans quad) (-> s3-1 quad)) + (t9-21 a0-76 a1-27 a2-15 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + ) + ) + ) + (let ((f30-1 (- (+ (-> obj base-height) (-> obj ocean-offset) (-> obj bob-offset) (-> obj align-offset)) + (-> obj swim-height) + ) + ) + ) + (let* ((s3-2 (-> obj process control)) + (v1-236 (if (type? s3-2 control-info) + s3-2 + ) + ) + (v1-237 (and v1-236 (< (- (-> pp clock frame-counter) (-> v1-236 unknown-time-frame06)) (seconds 0.5)))) + ) + (if (and (logtest? (-> obj flags) (water-flags swim-ground)) + (and v1-237 + (zero? (logand (-> (the-as collide-shape-moving (-> obj process control)) status) (cshape-moving-flags on-water)) + ) + ) + ) + (set! (-> obj bob amp) (* 0.8 (-> obj bob amp))) + ) + (cond + ((and (logtest? (-> obj flags) (water-flags can-swim)) + (or (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (cshape-moving-flags on-water)) + (>= f30-1 (-> obj bottom 0 y)) + (and (logtest? (water-flags swimming) s4-0) + (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (cshape-moving-flags t-surface)) + (not (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (cshape-moving-flags on-surface)) + ) + (>= (+ 204.8 f30-1) (-> obj bottom 0 y)) + ) + ) + (or (logtest? (water-flags swimming) s4-0) + (let ((f0-84 12288.0) + (a0-112 (-> obj process control transv)) + ) + (< f0-84 (sqrtf (+ (* (-> a0-112 x) (-> a0-112 x)) (* (-> a0-112 z) (-> a0-112 z))))) + ) + (< (+ (-> pp clock frame-counter) (seconds -0.2)) (-> obj enter-water-time)) + (or (>= (+ (- 204.8 (fmin 6144.0 (+ (-> obj ocean-offset) (-> obj bob-offset) (-> obj align-offset)))) f30-1) + (-> obj bottom 0 y) + ) + (and (-> obj process next-state) (= (-> obj process next-state name) 'target-hit-ground)) + ) + ) + ) + (set! (-> obj swim-time) (-> pp clock frame-counter)) + (send-event (-> obj process) 'swim) + (set! (-> obj flags) (logior (water-flags swimming) (-> obj flags))) + (if (not (logtest? (water-flags swimming) s4-0)) + (set! (-> obj enter-swim-time) (-> pp clock frame-counter)) + ) + (cond + ((and (logtest? (-> obj flags) (water-flags swim-ground)) + (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (cshape-moving-flags t-surface)) + (zero? (logand (water-flags jump-out) (-> obj flags))) + ) + (let ((v1-260 (new 'stack-no-clear 'vector))) + (set! (-> v1-260 quad) (-> obj bottom 0 quad)) + (set! (-> v1-260 y) (- (-> obj height) (-> obj swim-height))) + (let ((s3-3 (the-as collide-shape-moving (-> obj process control)))) + (when (and (not (logtest? (-> s3-3 status) (cshape-moving-flags csmf12))) + (logtest? (water-flags swimming) (-> obj flags)) + (zero? (logand (focus-status board pilot) (-> obj process focus-status))) + ) + (let ((a1-42 (vector-! (new 'stack-no-clear 'vector) v1-260 (-> (the-as control-info s3-3) trans)))) + (vector-float*! a1-42 a1-42 (-> pp clock frames-per-second)) + ) + ((method-of-object s3-3 collide-shape-method-37)) + (set! (-> (the-as control-info s3-3) status) + (logior (-> s3-3 status) (cshape-moving-flags on-surface on-ground t-surface on-water)) + ) + ) + ) + ) + ) + ((and (< (-> obj bottom 0 y) f30-1) (zero? (logand (water-flags jump-out) (-> obj flags)))) + (logior! (-> obj flags) (water-flags under-water)) + ) + ) + ) + ((begin + (set! v1-237 + (and (logtest? (-> obj flags) (water-flags can-wade)) + (or (not (!= (-> obj bob amp) 0.0)) (>= (- (-> pp clock frame-counter) (-> obj swim-time)) (seconds 0.05))) + (and (>= (- (-> obj height) (-> obj wade-height)) (-> obj bottom 0 y)) v1-237) + ) + ) + v1-237 + ) + (set! (-> obj wade-time) (-> pp clock frame-counter)) + (send-event (-> obj process) 'wade) + (set! (-> obj flags) (logior (water-flags wading) (-> obj flags))) + ) + ((and (< (-> obj bottom 0 y) f30-1) (zero? (logand (water-flags jump-out) (-> obj flags)))) + (logior! (-> obj flags) (water-flags under-water)) + ) + ) + ) + (when (and (logtest? (-> obj flags) (water-flags can-swim)) + (< (-> obj bottom 1 y) f30-1) + (and (< f30-1 (-> obj bottom 0 y)) (logtest? s4-0 (water-flags under-water))) + ) + (set! (-> obj flags) (logior (water-flags swimming) (-> obj flags))) + (let ((a1-47 (new 'stack-no-clear 'vector))) + (set! (-> a1-47 quad) (-> obj bottom 0 quad)) + (let ((s4-1 (the-as collide-shape-moving (-> obj process control)))) + (set! (-> a1-47 y) f30-1) + (when (not (logtest? (focus-status board pilot) (-> obj process focus-status))) + (let ((f30-2 (-> s4-1 ground-impact-vel))) + (let ((t9-26 (method-of-object s4-1 collide-shape-moving-method-61))) + (-> (the-as control-info s4-1) transv) + *up-vector* + (t9-26) + ) + (set! (-> (the-as control-info s4-1) status) (logior (-> s4-1 status) (cshape-moving-flags on-water))) + (set! (-> (the-as control-info s4-1) ground-impact-vel) f30-2) + ) + ) + ) + ) + ) + ) + (when (= (-> obj process type) target) + (cond + ((logtest? (-> obj flags) (water-flags tar)) + (when (and (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) + (cshape-moving-flags on-surface on-water) + ) + (zero? (logand (focus-status board pilot) (-> obj process focus-status))) + ) + (when (< (-> obj process control trans y) (+ -1228.8 (-> obj base-height))) + (send-event (-> obj process) 'no-look-around (seconds 1.5)) + (when (not (logtest? (-> obj process focus-status) (focus-status flut))) + (let ((a1-51 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-51 from) (process->ppointer pp)) + (set! (-> a1-51 num-params) 2) + (set! (-> a1-51 message) 'attack) + (set! (-> a1-51 param 0) (the-as uint #f)) + (let ((v1-327 (new 'static 'attack-info :mask (attack-info-mask mode shove-back shove-up id)))) + (set! (-> v1-327 id) (-> obj attack-id)) + (set! (-> v1-327 shove-up) 2048.0) + (set! (-> v1-327 shove-back) 0.0) + (set! (-> v1-327 mode) 'tar) + (set! (-> a1-51 param 1) (the-as uint v1-327)) + ) + (send-event-function (-> obj process) a1-51) + ) + ) + (let ((v1-329 (-> obj process))) + (set! (-> v1-329 control surf) *tar-surface*) + (set! (-> v1-329 control ground-pat) + (copy-and-set-field (-> (the-as collide-shape-moving (-> v1-329 control)) ground-pat) material 4) + ) + ) + ) + (set! (-> obj swim-height) (lerp (-> obj swim-height) 7372.8 0.05)) + ) + ) + ((logtest? (-> obj flags) (water-flags lava)) + (when (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) + (cshape-moving-flags on-surface on-water) + ) + (when (< (-> obj process control trans y) (+ -204.8 (-> obj base-height))) + (send-event (-> obj process) 'no-look-around (seconds 1.5)) + (let ((a1-56 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-56 from) (process->ppointer pp)) + (set! (-> a1-56 num-params) 2) + (set! (-> a1-56 message) 'attack) + (set! (-> a1-56 param 0) (the-as uint #f)) + (let ((v1-350 (new 'static 'attack-info :mask (attack-info-mask intersection mode shove-back shove-up id)))) + (set! (-> v1-350 id) (the-as uint 2)) + (set! (-> v1-350 shove-up) 2048.0) + (set! (-> v1-350 shove-back) 0.0) + (set! (-> v1-350 mode) 'melt) + (set! (-> v1-350 intersection quad) (-> s5-0 trans quad)) + (set! (-> a1-56 param 1) (the-as uint v1-350)) + ) + (send-event-function (-> obj process) a1-56) + ) + ) + (set! (-> obj swim-height) (lerp (-> obj swim-height) 7372.8 0.05)) + ) + ) + ((and (logtest? (focus-status dark) (-> obj process focus-status)) + (nonzero? (-> obj process darkjak)) + (logtest? (-> obj process darkjak stage) 32) + ) + (set! (-> obj swim-height) 16384.0) + ) + (else + (set! (-> obj swim-height) 8192.0) + ) + ) + ) + ) + (else + (if (logtest? (water-flags touch-water) (-> obj flags)) + (water-control-method-16 obj) + ) + ) + ) + ) + (when (not (or (not (logtest? (water-flags part-drip) (-> obj flags))) + (not (logtest? (water-flags part-water) (-> obj flags))) + (= (-> obj drip-wetness) 0.0) + ) + ) + (cond + ((logtest? (water-flags spawn-drip) (-> obj flags)) + (let ((v0-34 + (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data (-> obj drip-joint-index))) + ) + ) + (set! (-> *part-id-table* 537 init-specs 18 initial-valuef) (-> obj surface-height)) + (set! (-> *part-id-table* 537 init-specs 10 initial-valuef) (* 0.05 (- (-> v0-34 x) (-> obj drip-old-pos x)))) + (set! (-> *part-id-table* 537 init-specs 11 initial-valuef) (* 0.05 (- (-> v0-34 y) (-> obj drip-old-pos y)))) + (set! (-> *part-id-table* 537 init-specs 12 initial-valuef) (* 0.05 (- (-> v0-34 z) (-> obj drip-old-pos z)))) + (let ((t9-35 sp-launch-particles-var) + (a0-208 *sp-particle-system-2d*) + (a1-61 (-> *part-id-table* 537)) + (a2-22 *launch-matrix*) + ) + (set! (-> a2-22 trans quad) (-> v0-34 quad)) + (t9-35 a0-208 a1-61 a2-22 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + (set! (-> obj drip-time) (-> pp clock frame-counter)) + (logclear! (-> obj flags) (water-flags spawn-drip)) + (seek! (-> obj drip-wetness) 0.0 (* 0.001 (-> obj drip-speed))) + (set! (-> obj drip-speed) (* 1.05 (-> obj drip-speed))) + (if (= (-> obj drip-wetness) 0.0) + (set! (-> obj drip-height) 0.0) + ) + ) + ((>= (- (-> pp clock frame-counter) + (the-as time-frame (the int (/ (the float (-> obj drip-time)) (-> obj drip-mult)))) + ) + (the int (-> obj drip-speed)) + ) + (let* ((s5-1 (rand-vu-int-range 3 (+ (-> obj process node-list length) -1))) + (v0-38 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-1))) + ) + (when (and (< (- (-> v0-38 y) (-> obj process control trans y)) (-> obj drip-height)) + (< (-> obj height) (-> v0-38 y)) + ) + (set! (-> obj drip-joint-index) s5-1) + (set! (-> obj drip-old-pos quad) (-> v0-38 quad)) + (set! (-> obj flags) (logior (water-flags spawn-drip) (-> obj flags))) + ) + ) + ) + ) + ) + (if (and (not (logtest? (water-flags break-surface) (-> obj flags))) (handle->process (-> obj ripple))) + (send-event (handle->process (-> obj ripple)) 'die) + ) + 0 + (none) + ) + ) + +(defmethod start-bobbing! water-control ((obj water-control) (arg0 float) (arg1 int) (arg2 int)) + (with-pp + (activate! (-> obj bob) (- arg0) arg1 arg2 0.9 1.0 (-> pp clock)) + 0 + (none) + ) + ) + +(defun part-water-splash-callback ((arg0 part-tracker)) + (let ((f1-0 (-> arg0 root trans y)) + (f0-0 (the-as float (-> arg0 userdata))) + ) + (set! (-> *part-id-table* 521 init-specs 16 initial-valuef) f1-0) + (set! (-> *part-id-table* 521 init-specs 1 initial-valuef) (* 12.0 f0-0)) + (set! (-> *part-id-table* 517 init-specs 16 initial-valuef) f1-0) + (set! (-> *part-id-table* 520 init-specs 18 initial-valuef) f1-0) + (set! (-> *part-id-table* 515 init-specs 16 initial-valuef) f1-0) + (set! (-> *part-id-table* 512 init-specs 15 initial-valuef) f1-0) + (set! (-> *part-id-table* 513 init-specs 15 initial-valuef) f1-0) + (set! (-> *part-id-table* 512 init-specs 12 initial-valuef) (* 13.653334 (* -0.15 f0-0))) + (set! (-> *part-id-table* 512 init-specs 12 random-rangef) (* 13.653334 (* -0.075 f0-0))) + (set! (-> *part-id-table* 513 init-specs 12 initial-valuef) (* 13.653334 (* -0.15 f0-0))) + (set! (-> *part-id-table* 513 init-specs 12 random-rangef) (* 13.653334 (* -0.075 f0-0))) + (set! (-> *part-id-table* 519 init-specs 2 initial-valuef) (* 4096.0 (* 0.1 f0-0))) + (set! (-> *part-id-table* 519 init-specs 2 random-rangef) (* 4096.0 (* 0.4 f0-0))) + (set! (-> *part-id-table* 519 init-specs 4 initial-valuef) (* 4096.0 (* 0.1 f0-0))) + (set! (-> *part-id-table* 519 init-specs 4 random-rangef) (* 4096.0 (* 0.4 f0-0))) + (set! (-> *part-id-table* 519 init-specs 9 initial-valuef) (* 13.653334 (* 1.5 f0-0))) + (set! (-> *part-id-table* 519 init-specs 9 random-rangef) (* 13.653334 (* 3.4 f0-0))) + (set! (-> *part-id-table* 519 init-specs 10 initial-valuef) (* 13.653334 (* 1.5 f0-0))) + (set! (-> *part-id-table* 519 init-specs 10 random-rangef) (* 13.653334 (* 3.4 f0-0))) + (set! (-> *part-id-table* 516 init-specs 3 initial-valuef) (* 4096.0 (* 1.5 f0-0))) + (set! (-> *part-id-table* 516 init-specs 3 random-rangef) (* 4096.0 (* 1.5 f0-0))) + (set! (-> *part-id-table* 516 init-specs 5 initial-valuef) (* 4096.0 (* 1.5 f0-0))) + (set! (-> *part-id-table* 516 init-specs 5 random-rangef) (* 4096.0 (* 1.5 f0-0))) + (set! (-> *part-id-table* 516 init-specs 10 initial-valuef) (* 13.653334 (* 1.5 f0-0))) + (set! (-> *part-id-table* 516 init-specs 10 random-rangef) (* 13.653334 (* 2.4 f0-0))) + (set! (-> *part-id-table* 516 init-specs 11 initial-valuef) (* 13.653334 (* 1.5 f0-0))) + (set! (-> *part-id-table* 516 init-specs 11 random-rangef) (* 13.653334 (* 2.4 f0-0))) + (set! (-> *part-id-table* 520 init-specs 1 initial-valuef) (* 0.5 f0-0)) + (set! (-> *part-id-table* 520 init-specs 2 initial-valuef) (* 4096.0 (* -0.25 f0-0))) + (set! (-> *part-id-table* 520 init-specs 2 random-rangef) (* 4096.0 (* 0.5 f0-0))) + (set! (-> *part-id-table* 520 init-specs 3 initial-valuef) (* 4096.0 (* -0.25 f0-0))) + (set! (-> *part-id-table* 520 init-specs 3 random-rangef) (* 4096.0 (* 0.5 f0-0))) + (set! (-> *part-id-table* 520 init-specs 10 initial-valuef) (* 13.653334 (* -0.75 f0-0))) + (set! (-> *part-id-table* 520 init-specs 10 random-rangef) (* 13.653334 (* 1.5 f0-0))) + (set! (-> *part-id-table* 520 init-specs 12 initial-valuef) (* 13.653334 (* -0.75 f0-0))) + (set! (-> *part-id-table* 520 init-specs 12 random-rangef) (* 13.653334 (* 1.5 f0-0))) + (set! (-> *part-id-table* 520 init-specs 11 initial-valuef) (* 13.653334 (* 7.0 f0-0))) + (set! (-> *part-id-table* 520 init-specs 11 random-rangef) (* 13.653334 (* 2.0 f0-0))) + (set! (-> *part-id-table* 520 init-specs 15 initial-valuef) (* 13.653334 (* -0.3 f0-0))) + (set! (-> *part-id-table* 520 init-specs 15 random-rangef) (* 13.653334 (* -0.075 f0-0))) + (set! (-> *part-id-table* 517 init-specs 1 initial-valuef) (* 0.5 f0-0)) + (set! (-> *part-id-table* 517 init-specs 2 initial-valuef) (* 1.2 f0-0)) + (set! (-> *part-id-table* 517 init-specs 9 initial-valuef) (* 13.653334 f0-0)) + (set! (-> *part-id-table* 517 init-specs 9 random-rangef) (* 13.653334 (* 2.0 f0-0))) + (set! (-> *part-id-table* 517 init-specs 10 initial-valuef) (* 13.653334 (* 6.0 f0-0))) + (set! (-> *part-id-table* 517 init-specs 10 random-rangef) (* 13.653334 (* 2.0 f0-0))) + (set! (-> *part-id-table* 517 init-specs 13 initial-valuef) (* 13.653334 (* -0.3 f0-0))) + (set! (-> *part-id-table* 517 init-specs 13 random-rangef) (* 13.653334 (* -0.075 f0-0))) + (set! (-> *part-id-table* 517 init-specs 9 initial-valuef) (* 13.653334 f0-0)) + (set! (-> *part-id-table* 517 init-specs 9 random-rangef) (* 13.653334 (* 2.0 f0-0))) + (set! (-> *part-id-table* 517 init-specs 10 initial-valuef) (* 13.653334 (* 6.0 f0-0))) + (set! (-> *part-id-table* 517 init-specs 10 random-rangef) (* 13.653334 (* 2.0 f0-0))) + (set! (-> *part-id-table* 517 init-specs 13 initial-valuef) (* 13.653334 (* -0.3 f0-0))) + (set! (-> *part-id-table* 517 init-specs 13 random-rangef) (* 13.653334 (* -0.075 f0-0))) + (set! (-> *part-id-table* 515 init-specs 1 initial-valuef) (* 4.0 f0-0)) + (set! (-> *part-id-table* 515 init-specs 2 initial-valuef) (* 4096.0 f0-0)) + (set! (-> *part-id-table* 515 init-specs 9 initial-valuef) (* 13.653334 f0-0)) + (set! (-> *part-id-table* 515 init-specs 9 random-rangef) (* 13.653334 (* 2.0 f0-0))) + (set! (-> *part-id-table* 515 init-specs 10 initial-valuef) (* 13.653334 (* 6.0 f0-0))) + (set! (-> *part-id-table* 515 init-specs 10 random-rangef) (* 13.653334 (* 2.0 f0-0))) + (set! (-> *part-id-table* 515 init-specs 13 initial-valuef) (* 13.653334 (* -0.3 f0-0))) + (set! (-> *part-id-table* 515 init-specs 13 random-rangef) (* 13.653334 (* -0.075 f0-0))) + (set! (-> *part-id-table* 514 init-specs 2 initial-valuef) (* 4096.0 (* 1.2 f0-0))) + (set! (-> *part-id-table* 514 init-specs 2 random-rangef) (* 4096.0 (* 0.2 f0-0))) + (set! (-> *part-id-table* 514 init-specs 3 initial-valuef) (* 4096.0 (* 0.4 f0-0))) + (set! (-> *part-id-table* 514 init-specs 3 random-rangef) (* 4096.0 (* 1.2 f0-0))) + (set! (-> *part-id-table* 514 init-specs 7 initial-valuef) (* 4096.0 (* 0.2 f0-0))) + (set! (-> *part-id-table* 514 init-specs 7 random-rangef) (* 4096.0 (* 2.2 f0-0))) + (set! (-> *part-id-table* 518 init-specs 2 initial-valuef) (* 4096.0 (* 0.3 f0-0))) + (set! (-> *part-id-table* 518 init-specs 2 random-rangef) (* 4096.0 (* 0.9 f0-0))) + (set! (-> *part-id-table* 518 init-specs 6 initial-valuef) (* 4096.0 f0-0)) + (set! (-> *part-id-table* 518 init-specs 6 random-rangef) (* 4096.0 (* 2.2 f0-0))) + ) + 0 + (none) + ) + +(defmethod enter-water water-control ((obj water-control)) + (with-pp + (set! (-> obj flags) (logior (water-flags touch-water) (-> obj flags))) + (logclear! (-> obj flags) (water-flags jump-out)) + (set! (-> obj enter-water-time) (-> pp clock frame-counter)) + (set-vector! (-> obj enter-water-pos) (-> obj bottom 0 x) (-> obj surface-height) (-> obj bottom 0 z) 1.0) + (when (and (logtest? (water-flags part-splash) (-> obj flags)) (logtest? (water-flags part-water) (-> obj flags))) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer pp)) + (set! (-> a1-1 num-params) 1) + (set! (-> a1-1 message) 'query) + (set! (-> a1-1 param 0) (the-as uint 'ground-height)) + (let* ((f0-4 (the-as float (send-event-function (-> obj process) a1-1))) + (f30-0 (lerp-scale 0.3 1.0 f0-4 2048.0 24576.0)) + ) + (when (not (logtest? (-> obj flags) (water-flags dark-eco lava))) + (if (nonzero? (-> obj process skel effect)) + (sound-play "swim-enter") + ) + (spawn-ripples obj f30-0 (-> obj enter-water-pos) 1 (-> obj process control transv) #t) + ) + ) + ) + ) + (if (logtest? (-> obj flags) (water-flags tar lava)) + (set! (-> obj swim-height) 2867.2) + ) + 0 + (none) + ) + ) + +(defmethod water-control-method-16 water-control ((obj water-control)) + (logclear! (-> obj flags) (water-flags touch-water)) + (set-zero! (-> obj bob)) + (if (logtest? (-> obj flags) (water-flags tar lava)) + (set! (-> obj swim-height) 2867.2) + ) + 0 + (none) + ) + +(defun splash-spawn ((arg0 float) (arg1 vector) (arg2 int)) + (let ((s5-0 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-0 + (let ((t9-1 (method-of-type part-tracker activate))) + (t9-1 + (the-as part-tracker s5-0) + *entity-pool* + (symbol->string (-> part-tracker symbol)) + (the-as pointer #x70004000) + ) + ) + (let ((t9-2 run-function-in-process) + (a0-3 s5-0) + (a1-3 part-tracker-init) + (a2-5 (if (zero? arg2) + (-> *part-group-id-table* 122) + (-> *part-group-id-table* 121) + ) + ) + (a3-1 0) + (t0-0 part-water-splash-callback) + (t2-0 #f) + (t3-0 *launch-matrix*) + ) + (set! (-> t3-0 trans quad) (-> arg1 quad)) + ((the-as (function object object object object object object object object none) t9-2) + a0-3 + a1-3 + a2-5 + a3-1 + t0-0 + arg0 + t2-0 + t3-0 + ) + ) + (-> s5-0 ppointer) + ) + ) + 0 + (none) + ) + +(defun rings-water-spawn ((arg0 float) (arg1 vector) (arg2 vector) (arg3 float) (arg4 float)) + (let* ((v1-0 arg2) + (f30-0 (sqrtf (+ (* (-> v1-0 x) (-> v1-0 x)) (* (-> v1-0 z) (-> v1-0 z))))) + ) + (set! (-> *part-id-table* 506 init-specs 4 initial-valuef) (+ 24576.0 arg0)) + (set! (-> *part-id-table* 506 init-specs 19 initial-valuef) (+ 49152.0 arg0)) + (set! (-> *part-id-table* 506 init-specs 1 initial-valuef) (* 0.0000036621095 f30-0)) + (set! (-> *part-id-table* 506 init-specs 2 initial-valuef) (* 0.1 f30-0)) + (set! (-> *part-id-table* 506 init-specs 13 initial-valuef) 0.7111111) + (set! (-> *part-id-table* 506 init-specs 3 initial-valuef) arg3) + (set! (-> *part-id-table* 506 init-specs 5 initial-valuef) arg3) + (let ((t9-0 sp-launch-particles-var) + (a0-1 *sp-particle-system-3d*) + (a1-1 (-> *part-id-table* 506)) + (a2-1 *launch-matrix*) + ) + (set! (-> a2-1 trans quad) (-> arg1 quad)) + (t9-0 a0-1 a1-1 a2-1 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (set! (-> *part-id-table* 509 init-specs 1 initial-valuef) (* 0.000004150391 f30-0)) + (set! (-> *part-id-table* 509 init-specs 18 initial-valuef) arg0) + (let ((t9-1 sp-launch-particles-var) + (a0-2 *sp-particle-system-3d*) + (a1-2 (-> *part-id-table* 509)) + (a2-2 *launch-matrix*) + ) + (set! (-> a2-2 trans quad) (-> arg1 quad)) + (t9-1 a0-2 a1-2 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (when (< f30-0 4096.0) + (set! (-> *part-id-table* 504 init-specs 2 random-rangef) arg4) + (let ((t9-2 sp-launch-particles-var) + (a0-3 *sp-particle-system-3d*) + (a1-3 (-> *part-id-table* 504)) + (a2-3 *launch-matrix*) + ) + (set! (-> a2-3 trans quad) (-> arg1 quad)) + (t9-2 a0-3 a1-3 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + 0 + (none) + ) + +(defmethod spawn-ripples water-control ((obj water-control) (arg0 float) (arg1 vector) (arg2 int) (arg3 vector) (arg4 symbol)) + (with-pp + (when (and (logtest? (water-flags part-splash) (-> obj flags)) (logtest? (water-flags part-water) (-> obj flags))) + (let ((s4-1 (vector+float*! (new 'stack-no-clear 'vector) arg1 arg3 0.05))) + (set! (-> s4-1 y) (+ 40.96 (-> obj surface-height))) + (if (>= (- (-> pp clock frame-counter) (-> obj distort-time)) (seconds 0.1)) + (splash-spawn arg0 s4-1 arg2) + ) + (when (and arg4 (>= (- (-> pp clock frame-counter) (-> obj distort-time)) (seconds 0.3))) + (set! (-> obj distort-time) (-> pp clock frame-counter)) + (let* ((s2-0 (get-process *default-dead-pool* manipy #x4000)) + (s3-1 + (when s2-0 + (let ((t9-2 (method-of-type manipy activate))) + (t9-2 (the-as manipy s2-0) (-> obj process) (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) + ) + (let ((s3-2 run-function-in-process) + (s1-0 s2-0) + (s0-0 manipy-init) + (s5-1 (-> obj process entity)) + (t0-1 (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer uint32) #f))) + (t1-1 #f) + ) + 0 + ((the-as (function object object object object object object none) s3-2) s1-0 s0-0 s4-1 s5-1 t0-1 t1-1) + ) + (-> s2-0 ppointer) + ) + ) + ) + (when s3-1 + (send-event (ppointer->process s3-1) 'anim-mode 'play1) + (send-event (ppointer->process s3-1) 'anim "idle") + (let ((f0-4 (fmax 0.6 (fmin 1.0 (* 2.0 arg0))))) + (set-vector! (-> (the-as process-drawable (-> s3-1 0)) root scale) f0-4 0.5 f0-4 1.0) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +(defun water-info<-region ((arg0 water-info) (arg1 drawable-region-prim) (arg2 collide-shape) (arg3 collide-action)) + (with-pp + (set! (-> arg0 flags) (water-flags)) + (set! (-> arg0 handle) (the-as handle #f)) + (set! (-> arg0 depth) 0.0) + (let ((s2-0 (the-as object (-> arg1 region on-inside)))) + (set! s2-0 (cond + ((= (the-as symbol (-> (the-as pair s2-0) car)) 'water) + (empty) + s2-0 + ) + (else + (eval! + (new 'stack 'script-context (the-as basic (process->ppointer pp)) pp (the-as vector #f)) + (the-as pair s2-0) + ) + ) + ) + ) + (let ((a0-4 (-> arg2 root-prim))) + (when s2-0 + (set! (-> arg0 trans quad) (-> a0-4 prim-core world-sphere quad)) + (set-vector! (-> arg0 normal) 0.0 1.0 0.0 1.0) + (set! (-> arg0 prim) arg1) + (case (-> (the-as pair (-> (the-as pair s2-0) cdr)) car) + (('height) + (set! (-> arg0 flags) (water-flags active)) + (set! (-> arg0 trans y) + (* 4096.0 (command-get-float (-> (the-as pair (-> (the-as pair (-> (the-as pair s2-0) cdr)) cdr)) car) 0.0)) + ) + (set! (-> arg0 base-height) (-> arg0 trans y)) + ) + (('ocean) + (set! (-> arg0 flags) (water-flags active use-ocean)) + (set! (-> arg0 trans y) (ocean-method-11 *ocean* (the-as (inline-array vector) (-> arg0 trans)) #f)) + (set! (-> arg0 base-height) (ocean-map-method-10 *ocean-map*)) + (when (= (-> arg0 trans y) 4095996000.0) + (set! (-> arg0 flags) (water-flags)) + 0 + ) + ) + (('water-anim) + (let* ((s0-0 (command-get-process + (-> (the-as pair (-> (the-as pair (-> (the-as pair s2-0) cdr)) cdr)) car) + (the-as process #f) + ) + ) + (s1-0 (if (type? s0-0 process-drawable) + s0-0 + ) + ) + ) + (cond + (s1-0 + (set! (-> arg0 flags) (water-flags active use-water-anim)) + (set! (-> arg0 trans y) (ripple-find-height (the-as process-drawable s1-0) 0 (-> arg0 trans))) + (set! (-> arg0 handle) (process->handle s1-0)) + (set! (-> arg0 base-height) (-> (the-as process-drawable s1-0) root trans y)) + ) + (else + (set! (-> arg0 flags) (water-flags)) + 0 + ) + ) + ) + ) + ) + (when (logtest? (-> arg0 flags) (water-flags active)) + (let* ((s2-1 (-> (the-as pair (-> (the-as pair (-> (the-as pair (-> (the-as pair s2-0) cdr)) cdr)) cdr)) car)) + (v1-39 (-> (the-as pair s2-1) car)) + ) + (while (not (null? s2-1)) + (cond + ((= v1-39 'swim) + (logior! (-> arg0 flags) (water-flags can-swim can-ground)) + ) + ((= v1-39 'wade) + (logior! (-> arg0 flags) (water-flags can-wade can-ground)) + ) + ((= v1-39 'event) + (set! (-> arg0 flags) (logior (water-flags event) (-> arg0 flags))) + ) + ((= v1-39 'tar) + (logior! (-> arg0 flags) (water-flags tar)) + ) + ((= v1-39 'darkeco) + (logior! (-> arg0 flags) (water-flags dark-eco)) + ) + ((= v1-39 'lava) + (logior! (-> arg0 flags) (water-flags lava)) + ) + ((= v1-39 'mech) + (let* ((s1-1 (-> arg2 process)) + (a0-39 (if (type? s1-1 process-focusable) + s1-1 + ) + ) + ) + (when (and a0-39 (zero? (logand (focus-status mech) (-> (the-as process-focusable a0-39) focus-status)))) + (set! (-> arg0 flags) (water-flags)) + 0 + ) + ) + (logior! (-> arg0 extra-flags) 1) + ) + ) + (set! s2-1 (-> (the-as pair s2-1) cdr)) + (set! v1-39 (-> (the-as pair s2-1) car)) + ) + ) + (let ((s2-2 (-> arg2 root-prim))) + (countdown (s1-2 (-> arg2 total-prims)) + (when (and (nonzero? (-> s2-2 prim-core prim-type)) + (logtest? (-> s2-2 prim-core action) arg3) + (nonzero? (-> s2-2 prim-core collide-with)) + ) + (set! (-> (the-as region-prim-area #x70000000) pos quad) (-> s2-2 prim-core world-sphere quad)) + (if (and (within-area? arg1 (the-as region-prim-area (+ #x70000000 0))) + (begin + (set! (-> arg0 flags) (logior (water-flags over-water) (-> arg0 flags))) + (>= (-> arg0 trans y) (- (-> s2-2 prim-core world-sphere y) (-> s2-2 prim-core world-sphere w))) + ) + ) + (set! (-> arg0 flags) (logior (water-flags touch-water) (-> arg0 flags))) + ) + ) + (&+! s2-2 80) + ) + ) + (if (and (logtest? (water-flags event) (-> arg0 flags)) (logtest? (water-flags touch-water) (-> arg0 flags))) + (send-event (handle->process (-> arg0 handle)) 'water arg0 (-> arg2 process)) + ) + ) + ) + ) + ) + arg0 + ) + ) + +(defmethod water-info-init! collide-shape ((obj collide-shape) (arg0 water-info) (arg1 collide-action)) + "Initialize a [[water-info]] with the currently loaded regions." + (local-vars (sv-80 int)) + (let ((s3-0 (new 'stack 'water-info))) + (set! (-> s3-0 flags) (water-flags)) + (set! (-> s3-0 handle) (the-as handle #f)) + (set! (-> arg0 flags) (water-flags)) + (set! (-> arg0 handle) (the-as handle #f)) + (set! (-> s3-0 extra-flags) (the-as uint 0)) + (set! (-> (the-as region-prim-area #x70000000) region-prim-list num-items) 0) + (set! (-> (the-as region-prim-area #x70000000) region-inside-count) 0) + (set! (-> (the-as region-prim-area #x70000000) pos quad) (-> obj root-prim prim-core world-sphere quad)) + (dotimes (s2-0 (-> *level* length)) + (let ((v1-8 (-> *level* level s2-0))) + (when (= (-> v1-8 status) 'active) + (let ((s1-0 (-> v1-8 bsp region-trees))) + (when (nonzero? s1-0) + (let ((s0-0 (-> s1-0 length))) + (set! sv-80 0) + (let ((a0-10 (-> s1-0 sv-80))) + (while (< sv-80 s0-0) + (if (= (-> a0-10 name) 'water) + (collect-regions + a0-10 + (the-as sphere (-> (the-as region-prim-area #x70000000) pos)) + 0 + (-> (the-as region-prim-area #x70000000) region-prim-list) + ) + ) + (set! sv-80 (+ sv-80 1)) + (set! a0-10 (-> s1-0 sv-80)) + ) + ) + ) + ) + ) + ) + ) + ) + (countdown (s2-1 (-> (the-as region-prim-area #x70000000) region-prim-list num-items)) + (water-info<-region s3-0 (-> (the-as region-prim-area #x70000000) region-prim-list items s2-1) obj arg1) + (when (and (logtest? (-> s3-0 flags) (water-flags active)) + (logtest? (water-flags touch-water) (-> s3-0 flags)) + (zero? (logand (-> s3-0 extra-flags) 1)) + ) + (mem-copy! (the-as pointer arg0) (the-as pointer s3-0) 60) + (set! arg0 arg0) + (goto cfg-27) + ) + (if (and (logtest? (-> s3-0 flags) (water-flags active)) + (logtest? (water-flags touch-water over-water) (-> s3-0 flags)) + ) + (mem-copy! (the-as pointer arg0) (the-as pointer s3-0) 60) + ) + ) + ) + (label cfg-27) + arg0 + ) diff --git a/goal_src/jak2/engine/data/art-h.gc b/goal_src/jak2/engine/data/art-h.gc index 431baf08f6..43c4c2d7f5 100644 --- a/goal_src/jak2/engine/data/art-h.gc +++ b/goal_src/jak2/engine/data/art-h.gc @@ -401,6 +401,71 @@ (-> obj skeleton bones 0 transform trans) ) +;; look up the index of an art element in an art group. +(desfun art-elt->index (ag-name elt-name) + (if (number? elt-name) + elt-name + (let ((ag-info (hash-table-try-ref *art-info* (symbol->string ag-name)))) + (if (not (car ag-info)) + -1 + (let ((elt-info (hash-table-try-ref (cdr ag-info) (symbol->string elt-name)))) + (if (not (car elt-info)) + -1 + (cadr (cdr elt-info))) + ) + ) + ) + ) + ) + +(defmacro defskelgroup (name ag-name joint-geom joint-anim lods + &key (shadow 0) + &key bounds + &key (longest-edge 0.0) + &key (texture-level 0) + &key (sort 0) + &key (version 7) ;; do NOT use this! + &key (origin-joint-index 0) + &key (shadow-joint-index 0) + &key (light-index 0) + ) + "define a new static skeleton group" + + `(let ((skel (new 'static 'skeleton-group + :name ,(symbol->string name) + :info #f ;; all skeleton-groups seem to have these as #f + :extra #f + :art-group-name ,(symbol->string ag-name) + :bounds ,bounds + :longest-edge ,longest-edge + :version ,version + :max-lod ,(- (length lods) 1) + :shadow ,(art-elt->index (string->symbol-format "{}-ag" ag-name) shadow) + :texture-level ,texture-level + :sort ,sort + :origin-joint-index ,origin-joint-index + :shadow-joint-index ,shadow-joint-index + :light-index ,light-index + ))) + ;; set joint geometry and joint bones + (set! (-> skel jgeo) ,(art-elt->index (string->symbol-format "{}-ag" ag-name) joint-geom)) + (set! (-> skel janim) ,(art-elt->index (string->symbol-format "{}-ag" ag-name) joint-anim)) + + ;; set lods + ,@(apply-i (lambda (x i) + `(begin + (set! (-> skel mgeo ,i) ,(art-elt->index (string->symbol-format "{}-ag" ag-name) (car x))) + (set! (-> skel lod-dist ,i) ,(cadr x)) + ) + ) lods) + + ;; define skel group + (define ,name skel) + ;; add to level + (add-to-loading-level ,name) + ) + ) + 0 diff --git a/goal_src/jak2/engine/game/game-h.gc b/goal_src/jak2/engine/game/game-h.gc index f10095f113..ff0ade2dc6 100644 --- a/goal_src/jak2/engine/game/game-h.gc +++ b/goal_src/jak2/engine/game/game-h.gc @@ -12,6 +12,8 @@ (declare-type water-control basic) (declare-type align-control basic) (declare-type fact-info basic) +(declare-type carry-info basic) +(declare-type touching-shapes-entry structure) (declare-type rigid-body-control basic) (define-extern vector<-cspace! (function vector cspace vector)) @@ -96,7 +98,7 @@ (part sparticle-launch-control :offset-assert 168) (water water-control :offset-assert 172) (sound ambient-sound :offset-assert 176) - (carry basic :offset-assert 180) + (carry carry-info :offset-assert 180) (rbody rigid-body-control :offset-assert 184) (state-flags state-flags :offset-assert 188) (state-time time-frame :offset-assert 192) @@ -107,7 +109,7 @@ :flag-assert #x14005000c8 (:methods (initialize-skeleton (_type_ skeleton-group pair) none 14) - (initialize-skeleton-by-name (_type_ string object) draw-control 15) + (initialize-skeleton-by-name (_type_ string) draw-control 15) (apply-alignment (_type_ align-opts transformq vector) object 16) (process-drawable-method-17 () none 17) (process-drawable-method-18 () none 18) @@ -327,9 +329,9 @@ :size-assert #xa0 :flag-assert #xc000000a0 (:methods - (attack-info-method-9 () none 9) - (attack-info-method-10 () none 10) - (attack-info-method-11 () none 11) + (attack-info-method-9 (_type_ attack-info process-drawable process-drawable) none 9) + (attack-info-method-10 (_type_ object process-drawable process touching-shapes-entry) attack-info 10) + (combine! (_type_ attack-info process-drawable) attack-info 11) ) ) diff --git a/goal_src/jak2/engine/gfx/ocean/ocean-h.gc b/goal_src/jak2/engine/gfx/ocean/ocean-h.gc index aa1960867f..66de0851bd 100644 --- a/goal_src/jak2/engine/gfx/ocean/ocean-h.gc +++ b/goal_src/jak2/engine/gfx/ocean/ocean-h.gc @@ -407,7 +407,7 @@ :flag-assert #xb00000038 (:methods (set-height! (_type_ float) none 9) - (ocean-map-method-10 () none 10) + (ocean-map-method-10 (_type_) float 10) ) ) @@ -844,9 +844,3 @@ :mask-lo (new 'static 'vector4w :x #xffff :y #xffff :z #xffff :w #xffff) ) ) - -0 - - - - diff --git a/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher-h.gc b/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher-h.gc index 9a0b39383c..ac03f714e2 100644 --- a/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher-h.gc +++ b/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher-h.gc @@ -110,6 +110,7 @@ (launch-asap 3) (bit6 6) (bit7 7) + (bit8 8) ) (defenum sp-launch-state-flags diff --git a/goal_src/jak2/engine/gfx/texture/texture-anim-h.gc b/goal_src/jak2/engine/gfx/texture/texture-anim-h.gc index 90094ac4d0..37197222d1 100644 --- a/goal_src/jak2/engine/gfx/texture/texture-anim-h.gc +++ b/goal_src/jak2/engine/gfx/texture/texture-anim-h.gc @@ -5,6 +5,8 @@ ;; name in dgo: texture-anim-h ;; dgos: ENGINE, GAME +(define-extern update-texture-anim (function bucket-id none)) + ;; DECOMP BEGINS (deftype texture-anim-layer (structure) @@ -74,7 +76,8 @@ ) (deftype texture-anim-array (array) - () + ((array-data texture-anim :inline :dynamic :offset-assert 16) + ) :method-count-assert 11 :size-assert #x10 :flag-assert #xb00000010 @@ -177,27 +180,70 @@ :flag-assert #x90000008c ) -(define *clut-translate* - (new 'static 'array uint32 64 - #x3020100 #x7060504 #x13121110 #x17161514 - #xb0a0908 #xf0e0d0c #x1b1a1918 #x1f1e1d1c - #x23222120 #x27262524 #x33323130 #x37363534 - #x2b2a2928 #x2f2e2d2c #x3b3a3938 #x3f3e3d3c - #x43424140 #x47464544 #x53525150 #x57565554 - #x4b4a4948 #x4f4e4d4c #x5b5a5958 #x5f5e5d5c - #x63626160 #x67666564 #x73727170 #x77767574 - #x6b6a6968 #x6f6e6d6c #x7b7a7978 #x7f7e7d7c - #x83828180 #x87868584 #x93929190 #x97969594 - #x8b8a8988 #x8f8e8d8c #x9b9a9998 #x9f9e9d9c - #xa3a2a1a0 #xa7a6a5a4 #xb3b2b1b0 #xb7b6b5b4 - #xabaaa9a8 #xafaeadac #xbbbab9b8 #xbfbebdbc - #xc3c2c1c0 #xc7c6c5c4 #xd3d2d1d0 #xd7d6d5d4 - #xcbcac9c8 #xcfcecdcc #xdbdad9d8 #xdfdedddc - #xe3e2e1e0 #xe7e6e5e4 #xf3f2f1f0 #xf7f6f5f4 - #xebeae9e8 #xefeeedec #xfbfaf9f8 #xfffefdfc - ) +(define *clut-translate* (new 'static 'array uint32 64 + #x3020100 + #x7060504 + #x13121110 + #x17161514 + #xb0a0908 + #xf0e0d0c + #x1b1a1918 + #x1f1e1d1c + #x23222120 + #x27262524 + #x33323130 + #x37363534 + #x2b2a2928 + #x2f2e2d2c + #x3b3a3938 + #x3f3e3d3c + #x43424140 + #x47464544 + #x53525150 + #x57565554 + #x4b4a4948 + #x4f4e4d4c + #x5b5a5958 + #x5f5e5d5c + #x63626160 + #x67666564 + #x73727170 + #x77767574 + #x6b6a6968 + #x6f6e6d6c + #x7b7a7978 + #x7f7e7d7c + #x83828180 + #x87868584 + #x93929190 + #x97969594 + #x8b8a8988 + #x8f8e8d8c + #x9b9a9998 + #x9f9e9d9c + #xa3a2a1a0 + #xa7a6a5a4 + #xb3b2b1b0 + #xb7b6b5b4 + #xabaaa9a8 + #xafaeadac + #xbbbab9b8 + #xbfbebdbc + #xc3c2c1c0 + #xc7c6c5c4 + #xd3d2d1d0 + #xd7d6d5d4 + #xcbcac9c8 + #xcfcecdcc + #xdbdad9d8 + #xdfdedddc + #xe3e2e1e0 + #xe7e6e5e4 + #xf3f2f1f0 + #xf7f6f5f4 + #xebeae9e8 + #xefeeedec + #xfbfaf9f8 + #xfffefdfc + ) ) - - -(define-extern update-texture-anim (function bucket-id none)) -(define-extern *skull-gem-texture-anim-array* texture-anim-array) diff --git a/goal_src/jak2/engine/gfx/texture/texture-h.gc b/goal_src/jak2/engine/gfx/texture/texture-h.gc index 1b84a20913..a37c10e75e 100644 --- a/goal_src/jak2/engine/gfx/texture/texture-h.gc +++ b/goal_src/jak2/engine/gfx/texture/texture-h.gc @@ -11,6 +11,7 @@ (declare-type adgif-shader structure) (declare-type texture basic) (declare-type texture-id uint32) +(declare-type texture-anim-array array) (define-extern adgif-shader<-texture-simple! (function adgif-shader texture adgif-shader)) (define-extern lookup-texture-by-id-fast (function texture-id texture)) (define-extern *edit-shader* texture-id) @@ -19,6 +20,7 @@ (define-extern texture-page-dir-inspect (function texture-page-dir symbol none)) (define-extern *texture-pool* texture-pool) (define-extern *fog-texture-work* fog-texture-work) +(define-extern *skull-gem-texture-anim-array* texture-anim-array) (defenum tex-upload-mode (none -3) diff --git a/goal_src/jak2/engine/level/region-h.gc b/goal_src/jak2/engine/level/region-h.gc index b0a056e98e..62e357d52b 100644 --- a/goal_src/jak2/engine/level/region-h.gc +++ b/goal_src/jak2/engine/level/region-h.gc @@ -11,9 +11,9 @@ (deftype region (structure) ((id uint32 :offset-assert 0) - (on-enter basic :offset-assert 4) - (on-inside basic :offset-assert 8) - (on-exit basic :offset-assert 12) + (on-enter pair :offset-assert 4) + (on-inside pair :offset-assert 8) + (on-exit pair :offset-assert 12) ) :method-count-assert 10 :size-assert #x10 diff --git a/goal_src/jak2/engine/load/loader-h.gc b/goal_src/jak2/engine/load/loader-h.gc index 2ead41ed73..beed349e3d 100644 --- a/goal_src/jak2/engine/load/loader-h.gc +++ b/goal_src/jak2/engine/load/loader-h.gc @@ -7,10 +7,15 @@ ;; TODO: document this stuff when doing loader.gc +(declare-type spool-anim basic) +(declare-type art-joint-anim art-element) (declare-type external-art-buffer basic) +(declare-type process-drawable process) (define-extern external-art-buffer-init (function external-art-buffer int)) +(define-extern ja-abort-spooled-anim (function spool-anim art-joint-anim int int :behavior process-drawable)) (declare-type art basic) (declare-type art-group art) +(define-extern *stack-top* pointer) ;; DECOMP BEGINS diff --git a/goal_src/jak2/engine/load/loader.gc b/goal_src/jak2/engine/load/loader.gc index 0fd06b0b61..619f2a171f 100644 --- a/goal_src/jak2/engine/load/loader.gc +++ b/goal_src/jak2/engine/load/loader.gc @@ -21,6 +21,7 @@ ) +;; WARN: Return type mismatch symbol vs load-dir. (defmethod mem-usage load-dir ((obj load-dir) (arg0 memory-usage-block) (arg1 int)) (set! (-> arg0 length) (max 85 (-> arg0 length))) (set! (-> arg0 data 84 name) "array") @@ -94,13 +95,13 @@ ) (defun drawable-load ((arg0 drawable) (arg1 kheap)) - ;; (local-vars (sp-0 pointer)) + (local-vars (sp-0 pointer)) (cond ((type? arg0 string) - ;; (the-as none sp-0) - ;; (if (< (the-as uint sp-0) (the-as uint *stack-top*)) - ;; (set! sp-0 (&+ *kernel-sp* -1024)) - ;; ) + (the-as none sp-0) + (if (< (the-as uint sp-0) (the-as uint *stack-top*)) + (set! sp-0 (&+ *kernel-sp* -1024)) + ) (let ((s5-1 (loado (the-as string arg0) arg1))) (if (and s5-1 (type? s5-1 drawable)) (login (the-as drawable s5-1)) @@ -114,11 +115,11 @@ ) (defun art-load ((arg0 string) (arg1 kheap)) - ;; (local-vars (sp-0 pointer)) - ;; (the-as none sp-0) - ;; (if (< (the-as uint sp-0) (the-as uint *stack-top*)) - ;; (set! sp-0 (&+ *kernel-sp* -1024)) - ;; ) + (local-vars (sp-0 pointer)) + (the-as none sp-0) + (if (< (the-as uint sp-0) (the-as uint *stack-top*)) + (set! sp-0 (&+ *kernel-sp* -1024)) + ) (let ((s5-0 (loado arg0 arg1))) (if (type? s5-0 art) (login (the-as art s5-0)) @@ -128,12 +129,12 @@ ) (defun art-group-load-check ((arg0 string) (arg1 kheap) (arg2 int)) - ;; (local-vars (sp-0 pointer)) + (local-vars (sp-0 pointer)) (when *debug-segment* - ;; (the-as none sp-0) - ;; (if (< (the-as uint sp-0) (the-as uint *stack-top*)) - ;; (set! sp-0 (&+ *kernel-sp* -1024)) - ;; ) + (the-as none sp-0) + (if (< (the-as uint sp-0) (the-as uint *stack-top*)) + (set! sp-0 (&+ *kernel-sp* -1024)) + ) (let ((s3-1 (loado (make-file-name (file-kind art-group) arg0 arg2 #f) arg1))) (cond ((not s3-1) @@ -515,7 +516,7 @@ (set! (-> obj buffer v1-5 frame-lock) #f) ) (dotimes (v1-8 3) - (set! (-> obj rec v1-8 buffer) #f) + (set! (-> obj rec v1-8 anim-name) #f) ) (dotimes (s4-0 2) (let ((s3-0 (-> obj rec s4-0))) @@ -525,7 +526,7 @@ (not (-> obj buffer s2-0 frame-lock)) ) (set! (-> obj buffer s2-0 frame-lock) #t) - (set! (-> s3-0 buffer) (-> obj buffer s2-0)) + (set! (-> s3-0 anim-name) (-> obj buffer s2-0)) (set! (-> obj buffer s2-0 pending-load-file-owner) (-> s3-0 owner)) (set! (-> obj buffer s2-0 load-file-owner) (-> s3-0 owner)) (set! (-> obj buffer s2-0 pending-load-file-priority) (-> s3-0 priority)) @@ -539,7 +540,7 @@ ) (dotimes (s4-1 2) (let ((s3-1 (-> obj rec s4-1))) - (when (and (-> s3-1 name) (not (-> s3-1 buffer))) + (when (and (-> s3-1 name) (not (-> s3-1 anim-name))) (if (and (not *preload-spool-anims*) (>= (-> s3-1 priority) 0.0)) (goto cfg-46) ) @@ -553,7 +554,7 @@ (-> s3-1 owner) (-> s3-1 priority) ) - (set! (-> s3-1 buffer) (-> obj buffer s2-1)) + (set! (-> s3-1 anim-name) (-> obj buffer s2-1)) (goto cfg-46) ) ) @@ -562,13 +563,19 @@ (label cfg-46) ) (when (not (-> obj reserve-buffer)) - (let ((s4-2 (-> obj rec 0 buffer))) + (let ((s4-2 (-> obj rec 0 anim-name))) (if (and s4-2 - (-> s4-2 locked?) - (not (string= (-> s4-2 pending-load-file) "reserved")) - (not (string= (-> s4-2 other pending-load-file) "reserved")) + (-> (the-as external-art-buffer s4-2) locked?) + (not (string= (-> (the-as external-art-buffer s4-2) pending-load-file) "reserved")) + (not (string= (-> (the-as external-art-buffer s4-2) other pending-load-file) "reserved")) ) - (set-pending-file (-> s4-2 other) (the-as string #f) -1 (the-as handle #f) 100000000.0) + (set-pending-file + (-> (the-as external-art-buffer s4-2) other) + (the-as string #f) + -1 + (the-as handle #f) + 100000000.0 + ) ) ) ) @@ -777,7 +784,6 @@ ) -(define-extern ja-abort-spooled-anim (function spool-anim art-joint-anim int int :behavior process-drawable)) (defbehavior ja-play-spooled-anim process-drawable ((arg0 spool-anim) (arg1 art-joint-anim) (arg2 art-joint-anim) (arg3 (function process-drawable symbol))) (local-vars (v0-59 int) (sv-176 int)) (let ((s2-0 arg2) @@ -993,7 +999,7 @@ -20.0 (-> gp-0 sid) ) - (let ((s5-8 (get-art-by-name (-> self draw art-group) (the-as string (-> gp-0 anim buffer)) art-joint-anim))) + (let ((s5-8 (get-art-by-name (-> self draw art-group) (the-as string (-> gp-0 anim anim-name)) art-joint-anim))) (cond (s5-8 (ja-channel-set! 1) @@ -1109,7 +1115,7 @@ (restore-load-state-and-cleanup *load-state*) (set! (-> *art-control* active-stream) #f) (logclear! (-> self skel status) (joint-control-status spooling spooling-not-last-block)) - (if (zero? (logand (-> self skel status) (joint-control-status sync-math))) + (if (not (logtest? (-> self skel status) (joint-control-status sync-math))) (logclear! (-> self skel status) (joint-control-status sync-math)) ) (cond @@ -1462,6 +1468,7 @@ ) ) +;; WARN: Return type mismatch object vs symbol. ;; WARN: disable def twice: 34. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. (defmethod gui-control-method-18 gui-control ((obj gui-control) (arg0 gui-channel)) (let ((v1-0 arg0)) @@ -1620,6 +1627,7 @@ ) ) +;; WARN: Return type mismatch int vs gui-action. (defmethod gui-control-method-17 gui-control ((obj gui-control) (arg0 sound-id)) (let ((gp-0 (the-as gui-connection #f))) (if (zero? arg0) @@ -1801,6 +1809,7 @@ 0 ) +;; WARN: Return type mismatch int vs sound-id. (defmethod gui-control-method-9 gui-control ((obj gui-control) (arg0 process) (arg1 gui-channel) @@ -1891,6 +1900,7 @@ (none) ) +;; WARN: Return type mismatch int vs sound-id. (defmethod gui-control-method-12 gui-control ((obj gui-control) (arg0 process) (arg1 gui-channel) @@ -2463,7 +2473,3 @@ ) (kmemclose) - - - - diff --git a/goal_src/jak2/engine/physics/trajectory-h.gc b/goal_src/jak2/engine/physics/trajectory-h.gc index 785f4c8bb1..1ebea18301 100644 --- a/goal_src/jak2/engine/physics/trajectory-h.gc +++ b/goal_src/jak2/engine/physics/trajectory-h.gc @@ -101,7 +101,7 @@ :flag-assert #xe00000030 (:methods (combo-tracker-method-12 (_type_ vector vector process time-frame) combo-tracker 12) - (combo-tracker-method-13 (_type_ handle vector float vector float) none 13) + (combo-tracker-method-13 (_type_ handle vector float vector float) basic 13) ) ) @@ -150,10 +150,3 @@ (debug-draw-curve (_type_) none 13) ) ) - - -0 - - - - diff --git a/goal_src/jak2/engine/physics/trajectory.gc b/goal_src/jak2/engine/physics/trajectory.gc index 1a4cb82c58..1029cc9d34 100644 --- a/goal_src/jak2/engine/physics/trajectory.gc +++ b/goal_src/jak2/engine/physics/trajectory.gc @@ -234,13 +234,12 @@ ) ) -;; WARN: Return type mismatch basic vs none. (defmethod combo-tracker-method-13 combo-tracker ((obj combo-tracker) (arg0 handle) (arg1 vector) (arg2 float) (arg3 vector) (arg4 float)) (cond ((send-event (handle->process arg0) 'combo) (let ((gp-1 (handle->process arg0))) (if (type? gp-1 process-focusable) - (empty) + gp-1 ) ) ) @@ -278,13 +277,12 @@ ) ) (if (type? gp-2 process-focusable) - (empty) + gp-2 ) ) ) ) ) - (none) ) (defmethod combo-tracker-method-12 combo-tracker ((obj combo-tracker) (arg0 vector) (arg1 vector) (arg2 process) (arg3 time-frame)) diff --git a/goal_src/jak2/engine/process-drawable/process-focusable.gc b/goal_src/jak2/engine/process-drawable/process-focusable.gc index 910d864b99..7c9e1b5f4e 100644 --- a/goal_src/jak2/engine/process-drawable/process-focusable.gc +++ b/goal_src/jak2/engine/process-drawable/process-focusable.gc @@ -55,8 +55,8 @@ (get-trans (_type_ int) vector 20) (get-quat (_type_ int) quaternion 21) (get-transv (_type_) vector 22) - (process-focusable-method-23 (_type_) none 23) - (process-focusable-method-24 (_type_) float 24) + (process-focusable-method-23 (_type_ int) int 23) + (get-water-height (_type_) meters 24) (process-focusable-method-25 (_type_) time-frame 25) (process-focusable-method-26 (_type_) float 26) ) @@ -93,13 +93,13 @@ (-> obj root quat) ) -(defmethod process-focusable-method-23 process-focusable ((obj process-focusable)) +(defmethod process-focusable-method-23 process-focusable ((obj process-focusable) (arg0 int)) 0 - (none) ) -(defmethod process-focusable-method-24 process-focusable ((obj process-focusable)) - 0.0 +;; WARN: Return type mismatch int vs meters. +(defmethod get-water-height process-focusable ((obj process-focusable)) + (the-as meters 0) ) (defmethod process-focusable-method-26 process-focusable ((obj process-focusable)) diff --git a/goal_src/jak2/engine/target/board/board-h.gc b/goal_src/jak2/engine/target/board/board-h.gc index 8089ec6803..bccde6ee98 100644 --- a/goal_src/jak2/engine/target/board/board-h.gc +++ b/goal_src/jak2/engine/target/board/board-h.gc @@ -254,14 +254,13 @@ ) (-> self board latch?) ) - (zero? (logand (focus-status dead hit grabbed in-head edge-grab pole board pilot mech dark) (-> self focus-status))) + (not (logtest? (focus-status dead hit grabbed in-head edge-grab pole board pilot mech dark) (-> self focus-status)) + ) (or (zero? (-> self board)) (>= (- (-> self clock frame-counter) (-> self board board-time)) (seconds 0.5))) - (zero? (logand (state-flags sf17) (-> self state-flags))) + (not (logtest? (state-flags sf17) (-> self state-flags))) (< (-> self board board-time) (-> self control unknown-time-frame05)) - (zero? (logand (surface-flag no-board) (-> self control unknown-surface01 flags))) - (or (zero? (logand (-> self control unknown-surface01 flags) (surface-flag duck))) - (begin self (can-exit-duck?)) - ) + (not (logtest? (surface-flag no-board) (-> self control unknown-surface01 flags))) + (or (not (logtest? (-> self control unknown-surface01 flags) (surface-flag duck))) (can-exit-duck? self)) (not (and (logtest? (-> self water flags) (water-flags under-water)) (zero? (logand (-> self water flags) (water-flags swim-ground))) ) @@ -279,14 +278,14 @@ ) (set! (-> s5-0 0 quad) (-> v1-51 quad)) (set! (-> s5-0 0 y) (+ 8192.0 (-> s5-0 0 y))) - (set! (-> s5-0 0 w) 2867.2) + (set! (-> s5-0 0 r) 2867.2) (set! (-> s5-0 1 quad) (-> v1-51 quad)) (set! (-> s5-0 1 y) (+ 12288.0 (-> s5-0 1 y))) - (set! (-> s5-0 1 w) 2867.2) + (set! (-> s5-0 1 r) 2867.2) (set! (-> s5-0 2 quad) (-> v1-51 quad)) ) (set! (-> s5-0 2 y) (+ 16384.0 (-> s5-0 2 y))) - (set! (-> s5-0 2 w) 2867.2) + (set! (-> s5-0 2 r) 2867.2) (let ((v1-55 gp-0)) (set! (-> v1-55 spheres) s5-0) (set! (-> v1-55 num-spheres) (the-as uint 3)) @@ -298,7 +297,7 @@ (set! (-> v1-55 ignore-process0) #f) (set! (-> v1-55 ignore-process1) #f) (set! (-> v1-55 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) - (set! (-> v1-55 solid-only) #t) + (set! (-> v1-55 best-my-prim) (the-as collide-shape-prim #t)) (set! (-> v1-55 action-mask) (collide-action solid)) ) ) @@ -315,25 +314,13 @@ ) ) -(let ((a0-6 (new 'static 'skeleton-group - :name "skel-board" - :extra #f - :info #f - :art-group-name "board" - :bounds (new 'static 'vector :w 14336.0) - :version #x7 - :shadow 2 +(defskelgroup skel-board board board-lod0-jg board-board-idle-ja + ((board-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 3.5) + :shadow board-shadow-mg :sort 1 :origin-joint-index 3 ) - ) - ) - (set! (-> a0-6 jgeo) 0) - (set! (-> a0-6 janim) 5) - (set! (-> a0-6 mgeo 0) 1) - (set! (-> a0-6 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-6) - ) (define *board-shadow-control* (new 'static 'shadow-control :settings (new 'static 'shadow-settings @@ -344,7 +331,3 @@ ) ) ) - - - - diff --git a/goal_src/jak2/engine/target/board/board-states.gc b/goal_src/jak2/engine/target/board/board-states.gc index 9f9626ca13..3fd52fae5d 100644 --- a/goal_src/jak2/engine/target/board/board-states.gc +++ b/goal_src/jak2/engine/target/board/board-states.gc @@ -9,13 +9,12 @@ (define-extern jump-hit-ground-stuck? (function symbol :behavior target)) (define-extern target-board-start (state object target)) (define-extern target-board-handler (function process int symbol event-message-block object :behavior target)) -(define-extern ground-tween-initialize (function ground-tween-info uint uint uint uint uint uint ground-tween-info :behavior target)) -(define-extern ground-tween-update (function ground-tween-info float float none :behavior target)) +(define-extern ground-tween-initialize (function ground-tween-info uint uint uint uint uint uint float ground-tween-info :behavior target)) +(define-extern ground-tween-update (function ground-tween-info float float float none :behavior target)) (define-extern can-play-stance-amibent? (function symbol :behavior target)) (define-extern ja-blend-eval (function int :behavior process-drawable)) (define-extern spawn-projectile (function type projectile-init-by-other-params process-tree dead-pool (pointer process))) (define-extern target-attacked (function symbol attack-info process process (state symbol attack-info target) object :behavior target)) -(define-extern target-grab (state target)) (define-extern target-clone-anim (state handle target)) (define-extern clone-anim (function handle symbol string none :behavior process-drawable)) (define-extern lightning-probe-callback (function lightning-tracker none)) @@ -316,7 +315,7 @@ (none) ) -(defbehavior target-board-resolve-points target ((arg0 float) (arg1 float) (arg2 float) (arg3 float)) +(defbehavior target-board-resolve-points target () (when (= (-> self board main mode) (joint-mod-mode rotate)) (let ((f0-1 (fabs (-> self board troty-cum)))) (cond @@ -342,12 +341,7 @@ ) ;; WARN: Return type mismatch symbol vs none. -;; ERROR: Function may read a register that is not set: a0 -;; ERROR: Function may read a register that is not set: a1 -;; ERROR: Function may read a register that is not set: a2 -;; ERROR: Function may read a register that is not set: a3 (defbehavior target-board-ground-check target () - (local-vars (a0-4 object) (a1-0 object) (a2-3 number) (a3-0 number)) (when (board-on-ground?) (when (!= (-> self board troty-cum) 0.0) (let ((f30-0 (fabs (-> self board troty-cum))) @@ -357,131 +351,101 @@ (if (< (- (-> self clock frame-counter) (-> self board halfpipe-time)) (seconds 0.1)) (set! f28-0 (+ 32768.0 f28-0)) ) - (let ((t9-3 deg-diff)) - (set! a0-4 f0-2) - (set! a1-0 f28-0) - (let ((f0-5 (fabs (t9-3 (the-as float a0-4) (the-as float a1-0))))) - (when (and (>= f30-0 49152.0) (>= 4551.1113 f0-5)) - (cond - ((>= f30-0 191146.67) - (add-to-trick-list (-> self board) (board-tricks board-boost) 2000.0) - ) - ((>= f30-0 126520.89) - (add-to-trick-list (-> self board) (board-tricks board-boost) 1000.0) - ) - (else - (add-to-trick-list (-> self board) (board-tricks board-boost) 500.0) - ) + (let ((f0-5 (fabs (deg-diff f0-2 f28-0)))) + (when (and (>= f30-0 49152.0) (>= 4551.1113 f0-5)) + (cond + ((>= f30-0 191146.67) + (add-to-trick-list (-> self board) (board-tricks board-boost) 2000.0) + ) + ((>= f30-0 126520.89) + (add-to-trick-list (-> self board) (board-tricks board-boost) 1000.0) + ) + (else + (add-to-trick-list (-> self board) (board-tricks board-boost) 500.0) ) - (let ((t9-7 lerp-scale) - (a0-8 20480.0) - (a1-4 40960.0) - ) - (set! a2-3 f30-0) - (set! a3-0 49152.0) - (let ((f0-8 (t9-7 a0-8 a1-4 (the-as float a2-3) (the-as float a3-0) 182044.44)) - (v1-28 (-> self control transv)) + ) + (let ((f0-8 (lerp-scale 20480.0 40960.0 f30-0 49152.0 182044.44))) + (vector+float*! + (-> self control transv) + (-> self control transv) + (-> self control unknown-matrix01 vector 2) + f0-8 + ) + ) + (if (< (vector-length (-> self control transv)) 114688.0) + (vector-normalize! (-> self control transv) 114688.0) + ) + (when (not (logtest? (-> self control old-status) (cshape-moving-flags on-surface))) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (set! (-> gp-0 quad) (-> self control trans quad)) + (set! (-> gp-0 y) (+ 2048.0 (-> gp-0 y))) + (let ((s5-0 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-0 + (let ((t9-10 (method-of-type part-tracker activate))) + (t9-10 (the-as part-tracker s5-0) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) ) - (set! a0-4 (-> self control transv)) - (set! a1-0 (-> self control unknown-matrix01 vector 2)) - (vector+float*! v1-28 (the-as vector a0-4) (the-as vector a1-0) f0-8) - ) - ) - (when (< (vector-length (-> self control transv)) 114688.0) - (let ((t9-8 vector-normalize!)) - (set! a0-4 (-> self control transv)) - (set! a1-0 114688.0) - (t9-8 (the-as vector a0-4) (the-as float a1-0)) - ) - ) - (when (not (logtest? (-> self control old-status) (cshape-moving-flags on-surface))) - (let ((gp-0 (new 'stack-no-clear 'vector))) - (set! (-> gp-0 quad) (-> self control trans quad)) - (set! (-> gp-0 y) (+ 2048.0 (-> gp-0 y))) - (let ((s5-0 (get-process *default-dead-pool* part-tracker #x4000))) - (when s5-0 - (let ((t9-10 (method-of-type part-tracker activate))) - (t9-10 (the-as part-tracker s5-0) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) - ) - (let ((t9-11 run-function-in-process) - (a0-12 s5-0) - (a1-8 part-tracker-init) - (a2-8 (-> *part-group-id-table* 119)) - (a3-2 0) - (t0-1 #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-11) - a0-12 - a1-8 - a2-8 - a3-2 - t0-1 - t1-0 - t2-0 - t3-0 - ) - ) - (-> s5-0 ppointer) + (let ((t9-11 run-function-in-process) + (a0-14 s5-0) + (a1-10 part-tracker-init) + (a2-8 (-> *part-group-id-table* 119)) + (a3-2 0) + (t0-1 #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-11) + a0-14 + a1-10 + a2-8 + a3-2 + t0-1 + t1-0 + t2-0 + t3-0 + ) ) + (-> s5-0 ppointer) ) - (let* ((s4-0 (get-process *default-dead-pool* manipy #x4000)) - (s5-1 - (when s4-0 - (let ((t9-13 (method-of-type manipy activate))) - (t9-13 (the-as manipy s4-0) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((s5-2 run-function-in-process) - (s3-0 s4-0) - (s2-0 manipy-init) - (s1-0 (-> self entity)) - (t0-2 (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f))) - (t1-1 #f) - ) - 0 - ((the-as (function object object object object object object none) s5-2) s3-0 s2-0 gp-0 s1-0 t0-2 t1-1) - ) - (-> s4-0 ppointer) + ) + (let* ((s4-0 (get-process *default-dead-pool* manipy #x4000)) + (s5-1 + (when s4-0 + (let ((t9-13 (method-of-type manipy activate))) + (t9-13 (the-as manipy s4-0) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) ) + (let ((s5-2 run-function-in-process) + (s3-0 s4-0) + (s2-0 manipy-init) + (s1-0 (-> self entity)) + (t0-2 (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f))) + (t1-1 #f) + ) + 0 + ((the-as (function object object object object object object none) s5-2) s3-0 s2-0 gp-0 s1-0 t0-2 t1-1) + ) + (-> s4-0 ppointer) ) ) - (when s5-1 - (quaternion-copy! (-> (the-as board (-> s5-1 0)) root quat) (-> self control unknown-quaternion00)) - (send-event (ppointer->process s5-1) 'anim-mode 'play1) - (send-event (ppointer->process s5-1) 'anim "idle") - (send-event (ppointer->process s5-1) 'speed #x3fc00000) - (set-vector! (-> (the-as board (-> s5-1 0)) root scale) 0.2 0.4 0.2 1.0) - ) - ) - ) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.3)) - (let ((gp-1 sound-play-by-name)) - (let ((s5-3 (make-u128 #x74736f (the-as uint #x6f622d6472616f62)))) - (set! a1-0 (new-sound-id)) - (set! a2-3 1024) - (set! a3-0 0) - (set! a0-4 s5-3) - ) - (gp-1 - (the-as sound-name a0-4) - (the-as sound-id a1-0) - (the-as int a2-3) - (the-as int a3-0) - 0 - (sound-group sfx) - #t + ) + (when s5-1 + (quaternion-copy! (-> (the-as board (-> s5-1 0)) root quat) (-> self control unknown-quaternion00)) + (send-event (ppointer->process s5-1) 'anim-mode 'play1) + (send-event (ppointer->process s5-1) 'anim "idle") + (send-event (ppointer->process s5-1) 'speed #x3fc00000) + (set-vector! (-> (the-as board (-> s5-1 0)) root scale) 0.2 0.4 0.2 1.0) ) ) ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.3)) + (sound-play "board-boost") ) ) ) ) ) - (target-board-resolve-points (the-as float a0-4) (the-as float a1-0) (the-as float a2-3) (the-as float a3-0)) + (target-board-resolve-points) ) (set! (-> self board turn-anim-tilt?) #t) (none) @@ -712,42 +676,44 @@ ) :code (behavior () (let ((gp-0 (-> self board stance-info))) - (let ((f30-0 (the-as number 0.0)) - (s5-0 30) - (v1-3 (ja-group)) - ) - (when (not (and (and v1-3 (= v1-3 (-> self draw art-group data 161))) (= (ja-group-size) 4))) - (let ((v1-10 (ja-group))) - (when (and v1-10 (= v1-10 (-> self draw art-group data 170))) - (ja-channel-set! 1) - (ja-no-eval :group! (-> self draw art-group data 190) - :num! (seek! - (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 190)) frames num-frames) -1)) - 1.8 - ) - :frame-num 0.0 - ) - (until (ja-done? 0) - (suspend) - (ja :num! (seek! max 1.8)) - ) - (suspend) - (set! (-> self board turn-anim-duck) 1.0) - (set! (-> self board turn-anim-duck-vel) 15.0) + (let ((f30-0 0.0)) + (let ((s5-0 30) + (v1-3 (ja-group)) ) + (when (not (and (and v1-3 (= v1-3 (-> self draw art-group data 161))) (= (ja-group-size) 4))) + (let ((v1-10 (ja-group))) + (when (and v1-10 (= v1-10 (-> self draw art-group data 170))) + (ja-channel-set! 1) + (ja-no-eval :group! (-> self draw art-group data 190) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 190)) frames num-frames) -1)) + 1.8 + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 1.8)) + ) + (suspend) + (set! (-> self board turn-anim-duck) 1.0) + (set! (-> self board turn-anim-duck-vel) 15.0) + ) + ) + (ja-channel-push! 4 (the-as time-frame s5-0)) + (set! f30-0 (ja-frame-num 0)) ) - (ja-channel-push! 4 (the-as time-frame s5-0)) - (set! f30-0 (ja-frame-num 0)) ) - ) - (ground-tween-initialize - gp-0 - (the-as uint 0) - (the-as uint (-> self draw art-group data 153)) - (the-as uint (-> self draw art-group data 163)) - (the-as uint (-> self draw art-group data 164)) - (the-as uint (-> self draw art-group data 162)) - (the-as uint (-> self draw art-group data 161)) + (ground-tween-initialize + gp-0 + (the-as uint 0) + (the-as uint (-> self draw art-group data 153)) + (the-as uint (-> self draw art-group data 163)) + (the-as uint (-> self draw art-group data 164)) + (the-as uint (-> self draw art-group data 162)) + (the-as uint (-> self draw art-group data 161)) + f30-0 + ) ) (ja :chan 3 :group! (-> self draw art-group data 152)) (until #f @@ -764,14 +730,7 @@ (set! f0-10 0.0) ) ) - (let ((t9-9 ground-tween-update) - (a0-24 gp-0) - (a1-4 f0-10) - (a2-3 f1-2) - ) - #x3dcccccd - (t9-9 a0-24 a1-4 a2-3) - ) + (ground-tween-update gp-0 f0-10 f1-2 0.1) ) (ja :chan 1 :num! (chan 0)) (ja :chan 2 :num! (chan 0)) @@ -836,7 +795,7 @@ (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) ) - (begin self (can-exit-duck?)) + (can-exit-duck? self) ) (go target-board-stance) ) @@ -3085,9 +3044,7 @@ (('change-mode) (case (-> event param 0) (('normal) - enter-state - 'stance - (go target-grab) + (go target-grab 'stance) ) ) ) @@ -3191,7 +3148,7 @@ ) (none) ) - :code (behavior ((arg0 vector)) + :code (behavior ((arg0 vector) (arg1 attack-info)) (logclear! (-> self water flags) (water-flags jump-out)) (logclear! (-> self focus-status) (focus-status halfpipe)) (set! (-> self state-time) (-> self clock frame-counter)) @@ -3219,8 +3176,7 @@ ) ) ) - self - ((method-of-type attack-info attack-info-method-11)) + (combine! gp-0 arg1 self) (when (not (logtest? (-> gp-0 mask) (attack-info-mask vector))) (vector-z-quaternion! (-> gp-0 vector) (-> self control unknown-quaternion00)) (vector-xz-normalize! (-> gp-0 vector) (- (fabs (-> gp-0 shove-back)))) diff --git a/goal_src/jak2/engine/target/board/target-board.gc b/goal_src/jak2/engine/target/board/target-board.gc index e8362e7fad..e45eea3899 100644 --- a/goal_src/jak2/engine/target/board/target-board.gc +++ b/goal_src/jak2/engine/target/board/target-board.gc @@ -26,7 +26,7 @@ (define-extern target-board-anim-trans (function none :behavior target)) (define-extern target-board-spin-check (function none :behavior target)) (define-extern target-board-halfpipe-trans (function none :behavior target)) -(define-extern target-board-resolve-points (function float float float float none :behavior target)) +(define-extern target-board-resolve-points (function none :behavior target)) (define-extern target-board-ground-check (function none :behavior target)) (define-extern target-board-halfpipe-check (function collide-action :behavior target)) (define-extern target-board-jump-trans (function none :behavior target)) @@ -50,7 +50,7 @@ (define-extern target-board-get-off (state object symbol target)) (define-extern target-board-grab (state symbol target)) (define-extern target-board-clone-anim (state handle target)) -(define-extern target-board-hit (state vector target)) +(define-extern target-board-hit (state vector attack-info target)) ;; decomp begins diff --git a/goal_src/jak2/engine/target/darkjak-h.gc b/goal_src/jak2/engine/target/darkjak-h.gc index 8b99663276..c2b5417e38 100644 --- a/goal_src/jak2/engine/target/darkjak-h.gc +++ b/goal_src/jak2/engine/target/darkjak-h.gc @@ -8,24 +8,24 @@ ;; DECOMP BEGINS (deftype darkjak-info (basic) - ((process uint32 :offset-assert 4) - (attack-id uint32 :offset-assert 8) - (start-time time-frame :offset-assert 16) - (attack-time time-frame :offset-assert 24) - (attack-count uint64 :offset-assert 32) - (stage uint32 :offset-assert 40) - (want-stage uint32 :offset-assert 44) - (clock-pos float :offset-assert 48) - (clock-vel float :offset-assert 52) - (clock-on symbol :offset-assert 56) - (hud handle 1 :offset 64) - (tone uint32 :offset 72) - (bomb uint32 :offset 76) + ((process (pointer target) :offset-assert 4) + (attack-id uint32 :offset-assert 8) + (start-time time-frame :offset-assert 16) + (attack-time time-frame :offset-assert 24) + (attack-count uint64 :offset-assert 32) + (stage uint32 :offset-assert 40) + (want-stage uint32 :offset-assert 44) + (clock-pos float :offset-assert 48) + (clock-vel float :offset-assert 52) + (clock-on symbol :offset-assert 56) + (hud handle 1 :offset 64) + (tone uint32 :offset 72) + (bomb uint32 :offset 76) ) :method-count-assert 10 :size-assert #x50 :flag-assert #xa00000050 (:methods - (darkjak-info-method-9 (_type_ int) none :behavior target 9) + (update-clock! (_type_ int) none :behavior target 9) ) - ) \ No newline at end of file + ) diff --git a/goal_src/jak2/engine/target/gun/gun-h.gc b/goal_src/jak2/engine/target/gun/gun-h.gc index d93551cd80..7db083af49 100644 --- a/goal_src/jak2/engine/target/gun/gun-h.gc +++ b/goal_src/jak2/engine/target/gun/gun-h.gc @@ -6,7 +6,8 @@ ;; dgos: ENGINE, GAME (define-extern *setting-control* setting-control) -(define-extern can-exit-duck? (function symbol :behavior target)) +(define-extern can-exit-duck? (function target symbol)) +(define-extern target-collide-set! (function symbol float int :behavior target)) ;; DECOMP BEGINS @@ -114,7 +115,7 @@ (charge-ammo float :offset-assert 672) (charge-start-time time-frame :offset-assert 680) (charge-inc-time time-frame :offset-assert 688) - (charge-active? uint64 :offset-assert 696) + (charge-active? handle :offset-assert 696) ) :method-count-assert 10 :size-assert #x2c0 @@ -129,19 +130,19 @@ (local-vars (v1-36 symbol)) (and (logtest? (-> arg0 game features) (game-feature unk-game-feature-06)) (>= (- (-> self clock frame-counter) (-> arg0 gun gun-time)) (seconds 0.1)) - (zero? (logand (focus-status dead hit board mech dark teleporting) (-> arg0 focus-status))) - (zero? (logand (surface-flag gun-inactive gun-hide gun-off) (-> arg0 control unknown-surface01 flags))) - (zero? (logand (state-flags sf18) (-> arg0 state-flags))) + (not (logtest? (focus-status dead hit board mech dark teleporting) (-> arg0 focus-status))) + (not (logtest? (surface-flag gun-inactive gun-hide gun-off) (-> arg0 control unknown-surface01 flags))) + (not (logtest? (state-flags sf18) (-> arg0 state-flags))) (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-yellow gun-red gun-blue gun-dark)) (-> arg0 game features) ) - (or (zero? (logand (-> arg0 control unknown-surface01 flags) (surface-flag duck))) (can-exit-duck?)) - (or (zero? (logand (focus-status pilot) (-> arg0 focus-status))) (-> arg0 pilot gun?)) + (or (not (logtest? (-> arg0 control unknown-surface01 flags) (surface-flag duck))) (can-exit-duck? arg0)) + (or (not (logtest? (focus-status pilot) (-> arg0 focus-status))) (-> arg0 pilot gun?)) (or arg1 (nonzero? (-> arg0 gun using-gun-type)) (begin (set! v1-36 (and (cpad-hold? (-> arg0 control unknown-cpad-info00 number) r1) - (zero? (logand (-> arg0 focus-status) (focus-status grabbed))) + (not (logtest? (-> arg0 focus-status) (focus-status grabbed))) (begin (set! v1-36 #t) (set! (-> arg0 gun latch?) v1-36) v1-36) ) ) @@ -191,25 +192,13 @@ ) ) -(let ((a0-5 (new 'static 'skeleton-group - :name "skel-gun" - :extra #f - :info #f - :art-group-name "gun" - :bounds (new 'static 'vector :w 6144.0) - :version #x7 - :shadow #xb +(defskelgroup skel-gun gun gun-lod0-jg -1 + ((gun-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 1.5) + :shadow gun-shadow-mg :sort 1 :origin-joint-index 3 ) - ) - ) - (set! (-> a0-5 jgeo) 9) - (set! (-> a0-5 janim) -1) - (set! (-> a0-5 mgeo 0) 10) - (set! (-> a0-5 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-5) - ) (define *gun-shadow-control* (new 'static 'shadow-control :settings (new 'static 'shadow-settings @@ -221,96 +210,36 @@ ) ) -(let ((a0-6 (new 'static 'skeleton-group - :name "skel-ammo-yellow" - :extra #f - :info #f - :art-group-name "gun" - :bounds (new 'static 'vector :w 4096.0) - :texture-level #x6 - :version #x7 +(defskelgroup skel-ammo-yellow gun gun-ammo-yellow-lod0-jg gun-ammo-idle-ja + ((gun-ammo-yellow-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 1) + :texture-level 6 :sort 1 ) - ) - ) - (set! (-> a0-6 jgeo) 0) - (set! (-> a0-6 janim) 8) - (set! (-> a0-6 mgeo 0) 1) - (set! (-> a0-6 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-6) - ) -(let ((a0-7 (new 'static 'skeleton-group - :name "skel-ammo-red" - :extra #f - :info #f - :art-group-name "gun" - :bounds (new 'static 'vector :w 4096.0) - :texture-level #x6 - :version #x7 +(defskelgroup skel-ammo-red gun gun-ammo-red-lod0-jg gun-ammo-idle-ja + ((gun-ammo-red-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 1) + :texture-level 6 :sort 1 ) - ) - ) - (set! (-> a0-7 jgeo) 2) - (set! (-> a0-7 janim) 8) - (set! (-> a0-7 mgeo 0) 3) - (set! (-> a0-7 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-7) - ) -(let ((a0-8 (new 'static 'skeleton-group - :name "skel-ammo-blue" - :extra #f - :info #f - :art-group-name "gun" - :bounds (new 'static 'vector :w 4096.0) - :texture-level #x6 - :version #x7 +(defskelgroup skel-ammo-blue gun gun-ammo-blue-lod0-jg gun-ammo-idle-ja + ((gun-ammo-blue-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 1) + :texture-level 6 :sort 1 ) - ) - ) - (set! (-> a0-8 jgeo) 4) - (set! (-> a0-8 janim) 8) - (set! (-> a0-8 mgeo 0) 5) - (set! (-> a0-8 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-8) - ) -(let ((a0-9 (new 'static 'skeleton-group - :name "skel-ammo-dark" - :extra #f - :info #f - :art-group-name "gun" - :bounds (new 'static 'vector :w 4096.0) - :texture-level #x6 - :version #x7 +(defskelgroup skel-ammo-dark gun gun-ammo-dark-lod0-jg gun-ammo-idle-ja + ((gun-ammo-dark-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 1) + :texture-level 6 :sort 1 ) - ) - ) - (set! (-> a0-9 jgeo) 6) - (set! (-> a0-9 janim) 8) - (set! (-> a0-9 mgeo 0) 7) - (set! (-> a0-9 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-9) - ) -(let ((a0-10 (new 'static 'skeleton-group - :name "skel-gun-red-cone" - :extra #f - :info #f - :art-group-name "gun" - :bounds (new 'static 'vector :w 4096.0) - :texture-level #x6 - :version #x7 - ) - ) - ) - (set! (-> a0-10 jgeo) 40) - (set! (-> a0-10 janim) 42) - (set! (-> a0-10 mgeo 0) 41) - (set! (-> a0-10 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-10) - ) +(defskelgroup skel-gun-red-cone gun gun-red-cone-lod0-jg gun-red-cone-idle-ja + ((gun-red-cone-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 1) + :texture-level 6 + ) diff --git a/goal_src/jak2/engine/target/logic-target.gc b/goal_src/jak2/engine/target/logic-target.gc index 741bbce6d4..7a40f05a0e 100644 --- a/goal_src/jak2/engine/target/logic-target.gc +++ b/goal_src/jak2/engine/target/logic-target.gc @@ -3254,9 +3254,9 @@ ) (let ((v1-69 (-> obj control))) (set! (-> v1-69 unknown-word08) s4-0) - (set! (-> v1-69 unknown-word10) s3-0) - (set! (-> v1-69 unknown-word09) s2-0) - (set! (-> v1-69 unknown-word11) s1-0) + (set! (-> v1-69 unknown-word09) s3-0) + (set! (-> v1-69 unknown-sphere000) (the-as sphere s2-0)) + (set! (-> v1-69 unknown-word10) (the-as uint s1-0)) (set! (-> v1-69 max-iteration-count) (the-as uint 8)) (set! (-> v1-69 event-self) 'touched) ) @@ -3270,7 +3270,7 @@ (set! (-> obj control unknown-surface01 name) 'current) (set! (-> obj control unknown-surface01 active-hook) nothing) (set! (-> obj control unknown-surface01 touch-hook) nothing) - (set! (-> obj control unknown-dword06) (the-as uint #f)) + (set! (-> obj control unknown-dword06) (the-as handle #f)) (dotimes (v1-84 8) (set! (-> obj attack-info-old v1-84 attacker) (the-as handle #f)) ) @@ -3294,16 +3294,17 @@ (logior! (-> obj skel status) (joint-control-status sync-math blend-shape eye-anim)) (set! (-> obj draw shadow-ctrl) *target-shadow-control*) (set! (-> obj shadow-backup) (-> obj draw shadow)) - (let ((t9-24 (method-of-type carry-info new)) - (a0-65 'process) - (a1-23 carry-info) + (set! (-> obj carry) + (new + 'process + 'carry-info + obj + 41 + (the-as vector (new 'static 'array float 1 0.0)) + (the-as vector (new 'static 'array float 1 0.0)) + 12743.111 + ) ) - 41 - (new 'static 'array float 1 0.0) - (new 'static 'array float 1 0.0) - #x46471c72 - (set! (-> obj carry) (t9-24 a0-65 a1-23)) - ) (set! (-> obj control unknown-vector29 x) (the-as float (-> obj node-list data 45))) (set! (-> obj control unknown-vector29 y) (the-as float (-> obj node-list data 55))) (set! (-> obj control unknown-vector29 y) (the-as float (-> obj node-list data 55))) @@ -3374,7 +3375,7 @@ (level-setup) (set! (-> obj pre-joint-hook) (the-as (function none :behavior target) nothing)) (set! (-> obj init-time) (-> self clock frame-counter)) - (set! (-> obj spool-anim) #t) + (set! (-> obj spool-anim) (the-as spool-anim #t)) (set! (-> obj ambient-time) (-> self clock frame-counter)) 0 (none) diff --git a/goal_src/jak2/engine/target/mech_suit/carry-h.gc b/goal_src/jak2/engine/target/mech_suit/carry-h.gc index 1c641f52d7..f802531e02 100644 --- a/goal_src/jak2/engine/target/mech_suit/carry-h.gc +++ b/goal_src/jak2/engine/target/mech_suit/carry-h.gc @@ -21,37 +21,38 @@ ;; DECOMP BEGINS (deftype carry-info (basic) - ((process (pointer target) :offset-assert 4) - (pickup-time time-frame :offset-assert 8) - (other-value float :offset-assert 16) - (other int64 :offset-assert 24) - (point vector :inline :offset-assert 32) - (normal vector :inline :offset-assert 48) - (max-angle degrees :offset-assert 64) - (max-distance meters :offset-assert 68) - (max-pull meters :offset-assert 72) - (min-pull meters :offset-assert 76) - (grab-trans-blend float :offset-assert 80) - (carry-radius meters :offset-assert 84) - (backup-radius meters :offset-assert 88) - (joint int8 :offset-assert 92) - (mode carry-mode :offset-assert 93) - (face-dir int8 :offset-assert 94) - (local-point vector :inline :offset-assert 96) - (local-normal vector :inline :offset-assert 112) - (grab-quat vector :inline :offset-assert 128) - (grab-trans vector :inline :offset-assert 144) - (hold-trans vector :inline :offset-assert 160) + ((process (pointer process-drawable) :offset-assert 4) + (pickup-time time-frame :offset-assert 8) + (other-value float :offset-assert 16) + (other handle :offset-assert 24) + (point vector :inline :offset-assert 32) + (normal vector :inline :offset-assert 48) + (max-angle degrees :offset-assert 64) + (max-distance meters :offset-assert 68) + (max-pull meters :offset-assert 72) + (min-pull meters :offset-assert 76) + (grab-trans-blend float :offset-assert 80) + (carry-radius meters :offset-assert 84) + (backup-radius meters :offset-assert 88) + (joint int8 :offset-assert 92) + (mode carry-mode :offset-assert 93) + (face-dir int8 :offset-assert 94) + (local-point vector :inline :offset-assert 96) + (local-normal vector :inline :offset-assert 112) + (grab-quat vector :inline :offset-assert 128) + (grab-trans vector :inline :offset-assert 144) + (hold-trans vector :inline :offset-assert 160) ) :method-count-assert 17 :size-assert #xb0 :flag-assert #x11000000b0 (:methods - (carry-info-method-9 () none 9) + (new (symbol type process-drawable int vector vector float) _type_ 0) + (carry-info-method-9 (_type_) int 9) (carry-info-method-10 () none 10) (carry-info-method-11 () none 11) (carry-info-method-12 (_type_) none 12) - (carry-info-method-13 () none 13) + (carry-info-method-13 (_type_) none 13) (carry-info-method-14 () none 14) (carry-info-method-15 (_type_) none 15) (carry-info-method-16 () none 16) diff --git a/goal_src/jak2/engine/target/mech_suit/mech-h.gc b/goal_src/jak2/engine/target/mech_suit/mech-h.gc index 97c6924ee0..acb38d9334 100644 --- a/goal_src/jak2/engine/target/mech_suit/mech-h.gc +++ b/goal_src/jak2/engine/target/mech_suit/mech-h.gc @@ -58,25 +58,14 @@ :flag-assert #x9000001fc ) -(let ((a0-2 (new 'static 'skeleton-group - :name "skel-mech" - :extra #f - :info #f - :art-group-name "mech" - :bounds (new 'static 'vector :w 18432.0) - :version #x7 - :shadow 2 + +(defskelgroup skel-mech mech mech-lod0-jg mech-mech-idle-ja + ((mech-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 4.5) + :shadow mech-shadow-mg :origin-joint-index 3 :shadow-joint-index 3 ) - ) - ) - (set! (-> a0-2 jgeo) 0) - (set! (-> a0-2 janim) 3) - (set! (-> a0-2 mgeo 0) 1) - (set! (-> a0-2 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-2) - ) (define *mech-shadow-control* (new 'static 'shadow-control :settings (new 'static 'shadow-settings @@ -88,20 +77,8 @@ ) ) -(let ((a0-3 (new 'static 'skeleton-group - :name "skel-mech-explode" - :extra #f - :info #f - :art-group-name "mech" - :bounds (new 'static 'vector :w 18432.0) - :version #x7 +(defskelgroup skel-mech-explode mech mech-explode-lod0-jg mech-explode-idle-ja + ((mech-explode-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 4.5) :origin-joint-index 3 ) - ) - ) - (set! (-> a0-3 jgeo) 39) - (set! (-> a0-3 janim) 41) - (set! (-> a0-3 mgeo 0) 40) - (set! (-> a0-3 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-3) - ) diff --git a/goal_src/jak2/engine/target/target-darkjak.gc b/goal_src/jak2/engine/target/target-darkjak.gc index b322dbd246..8fa7fc1837 100644 --- a/goal_src/jak2/engine/target/target-darkjak.gc +++ b/goal_src/jak2/engine/target/target-darkjak.gc @@ -5,5 +5,2044 @@ ;; name in dgo: target-darkjak ;; dgos: ENGINE, GAME +(define-extern *darkjak-trans-mods* surface) + ;; DECOMP BEGINS +(format 0 "SKIP: target-darkjak-giant in target-darkjak (missing target-standard-event-handler)~%") +(format 0 "SKIP: target-darkjak-get-on in target-darkjak~%") +(format 0 "SKIP: target-darkjak-get-off in target-darkjak~%") + +(defbehavior target-darkjak-setup target ((arg0 symbol)) + (when (zero? (-> self darkjak)) + (set! (-> self darkjak) (new 'process 'darkjak-info)) + (set! (-> self darkjak process) (the-as (pointer target) (process->ppointer self))) + (let* ((v1-4 (-> self game)) + (a0-5 (+ (-> v1-4 attack-id) 1)) + ) + (set! (-> v1-4 attack-id) a0-5) + (set! (-> self darkjak attack-id) a0-5) + ) + (set! (-> self darkjak hud 0) (the-as handle #f)) + (set! (-> self darkjak tone) (the-as uint (new-sound-id))) + (set! (-> self darkjak-giant-interp) 1.0) + ) + 0 + (none) + ) + +(defbehavior want-to-darkjak? target () + (and (cpad-pressed? (-> self control unknown-cpad-info00 number) l2) + (not *pause-lock*) + (-> *setting-control* user-current darkjak) + (logtest? (-> self game features) (game-feature darkjak)) + (not (logtest? (focus-status + dead + hit + grabbed + in-head + under-water + edge-grab + pole + flut + tube + board + pilot + mech + carry + indax + teleporting + ) + (-> self focus-status) + ) + ) + (not (and (logtest? (-> self water flags) (water-flags under-water)) + (zero? (logand (-> self water flags) (water-flags swim-ground))) + ) + ) + (or (and (not (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak)))) + (and (>= (- (-> self clock frame-counter) (-> (the-as fact-info-target (-> self fact)) darkjak-start-time)) + (seconds 0.05) + ) + (>= (-> self game eco-pill-dark) (-> *FACT-bank* eco-pill-dark-max-default)) + ) + ) + (and (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (not (and (logtest? (focus-status dark) (-> self focus-status)) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) 32) + ) + ) + (logtest? (game-feature darkjak-giant) (-> self game features)) + ) + ) + ) + ) + +;; (let ((v1-3 (copy *walk-mods* 'global))) +;; (set! (-> v1-3 name) 'darkjak) +;; (set! (-> v1-3 flags) (surface-flag gun-off)) +;; (set! *darkjak-trans-mods* v1-3) +;; ) + +(defbehavior target-darkjak-end-mode target () + (when (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (logclear! (-> self focus-status) (focus-status dark)) + (send-event self 'reset-collide) + (logclear! (-> self state-flags) (state-flags sf4)) + (remove-setting! 'sound-flava) + (remove-setting! 'string-min-length) + (remove-setting! 'string-max-length) + (remove-setting! 'string-spline-max-move) + (remove-setting! 'string-spline-accel) + (remove-setting! 'string-spline-max-move-player) + (remove-setting! 'string-spline-accel-player) + (sound-stop (the-as sound-id (-> self darkjak tone))) + ) + 0 + (none) + ) + +(defbehavior target-darkjak-process target ((arg0 object) (arg1 object) (arg2 object) (arg3 object) (arg4 object) (arg5 object) (arg6 float)) + (local-vars (gp-0 vector)) + (cond + ((and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (let ((a1-1 'eco-red)) + (target-danger-set! (-> self control unknown-symbol04) a1-1) + ) + (collide-shape-method-46 (-> self control)) + (let ((a1-2 (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> a1-2 options) (overlaps-others-options)) + (set! (-> a1-2 collide-with-filter) (the-as collide-spec -1)) + (set! (-> a1-2 tlist) *touching-list*) + (find-overlapping-shapes (-> self control) a1-2) + ) + (target-danger-set! (-> self control unknown-symbol04) #f) + (collide-shape-method-46 (-> self control)) + (if (and (or (>= (- (-> self clock frame-counter) (-> (the-as fact-info-target (-> self fact)) darkjak-start-time)) + (-> (the-as fact-info-target (-> self fact)) darkjak-effect-time) + ) + (not (-> *setting-control* user-current darkjak)) + ) + (not (logtest? (-> self focus-status) (focus-status dead dangerous hit grabbed))) + (not (and (-> self next-state) (= (-> self next-state name) 'target-darkjak-get-off))) + (zero? (logand (-> self darkjak stage) 1)) + ) + (go target-darkjak-get-off) + ) + ) + (else + (seek! (-> self darkjak-interp) 0.0 (* 2.0 (-> self clock seconds-per-frame))) + (if (= (-> self darkjak-interp) 0.0) + (set! (-> self darkjak-giant-interp) 1.0) + ) + ) + ) + (let ((f30-0 (-> self darkjak-interp))) + (let ((f28-0 (lerp-scale 1.0 (* 1.05 (-> self darkjak-giant-interp)) f30-0 0.0 1.0)) + (f26-0 (lerp-scale 1.0 (* 0.20000002 (+ 5.0 (-> self darkjak-giant-interp))) f30-0 0.0 1.0)) + ) + (set-vector! (-> self control scale) f28-0 f28-0 f28-0 1.0) + (let ((a3-3 (new 'stack-no-clear 'vector))) + (set! (-> a3-3 x) f26-0) + (set! (-> a3-3 y) 1.0) + (set! (-> a3-3 z) f26-0) + (set! (-> a3-3 w) 1.0) + (trs-set! (-> self upper-body) (the-as vector #f) (the-as quaternion #f) a3-3) + ) + (let ((f26-1 (* 1.1 f26-0))) + (cond + ((and (logtest? (focus-status dark) (-> self focus-status)) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) 32) + ) + (set! gp-0 (new 'stack-no-clear 'vector)) + (set! (-> gp-0 x) (/ f28-0 (* f28-0 f26-1 (lerp-scale 1.0 1.3 f30-0 0.0 1.0)))) + (set! (-> gp-0 y) (/ f28-0 (* f28-0 (lerp-scale 1.0 1.4 f30-0 0.0 1.0)))) + (set! (-> gp-0 z) (/ f28-0 (* f28-0 f26-1 (lerp-scale 1.0 1.3 f30-0 0.0 1.0)))) + (set! (-> gp-0 w) 1.0) + ) + (else + (set! gp-0 (new 'stack-no-clear 'vector)) + (set! (-> gp-0 x) (/ f28-0 (* f28-0 f26-1))) + (set! (-> gp-0 y) (/ f28-0 f28-0)) + (set! (-> gp-0 z) (/ f28-0 (* f28-0 f26-1))) + (set! (-> gp-0 w) 1.0) + ) + ) + ) + ) + (cond + ((logtest? (game-secrets little-head) (-> self game secrets)) + (dotimes (v1-56 3) + (set! (-> gp-0 data v1-56) (* 0.4 (-> gp-0 data v1-56))) + ) + ) + ((logtest? (game-secrets big-head) (-> self game secrets)) + (dotimes (v1-62 3) + (set! (-> gp-0 data v1-62) (* 2.0 (-> gp-0 data v1-62))) + ) + ) + ) + (trs-set! (-> self neck) (the-as vector #f) (the-as quaternion #f) gp-0) + (let* ((a0-44 (-> self horns)) + (t9-14 (method-of-object a0-44 trs-set!)) + (a1-12 #f) + (a2-9 #f) + (a3-8 (new 'stack-no-clear 'vector)) + ) + (set! (-> a3-8 x) f30-0) + (set! (-> a3-8 y) f30-0) + (set! (-> a3-8 z) f30-0) + (set! (-> a3-8 w) 1.0) + (t9-14 a0-44 (the-as vector a1-12) (the-as quaternion a2-9) a3-8) + ) + (set-darkjak-texture-morph! f30-0) + (cond + ((and (= f30-0 0.0) (< (- (-> self clock frame-counter) (-> self teleport-time)) (seconds 0.5))) + (set! (-> self skel override 0) 0.00001) + (set! (-> self skel override 41) 0.000001) + ) + ((= f30-0 0.0) + (set! (-> self skel override 0) 0.0) + (set! (-> self skel override 41) 0.0) + ) + (else + (set! (-> self skel override 0) 1.0) + (set! (-> self skel override 1) f30-0) + (set! (-> self skel override 2) f30-0) + (set! (-> self skel override 3) f30-0) + (set! (-> self skel override 4) f30-0) + (set! (-> self skel override 5) f30-0) + (set! (-> self skel override 41) 1.0) + (set! (-> self skel override 46) 2.0) + (set! (-> self skel override 52) 2.0) + ) + ) + (when (and (>= f30-0 0.5) + (not (logtest? (-> self focus-status) (focus-status in-head))) + (not (logtest? (-> self draw status) (draw-control-status no-draw no-draw-temp))) + (not (movie?)) + ) + (let ((gp-1 sp-launch-particles-var) + (s5-0 *sp-particle-system-2d*) + (s4-0 (-> *part-id-table* 178)) + (s2-0 *launch-matrix*) + ) + (set! (-> s2-0 trans quad) (-> (process-drawable-random-point! self (new 'stack-no-clear 'vector)) quad)) + (let ((a3-9 #f) + (t0-6 #f) + (t1-1 1.0) + ) + (gp-1 s5-0 s4-0 s2-0 (the-as sparticle-launch-state a3-9) (the-as sparticle-launch-control t0-6) t1-1) + (cond + ((rand-vu-percent? 0.25) + (when (>= (- (-> *display* game-clock frame-counter) (-> self shock-effect-time)) (seconds 0.02)) + (set! (-> self shock-effect-time) (-> *display* game-clock frame-counter)) + (process-drawable-shock-wall-effect + self + (-> *lightning-spec-id-table* 8) + lightning-probe-callback + (-> *part-id-table* 179) + (the-as int t0-6) + (the-as int t1-1) + arg6 + ) + ) + ) + ((rand-vu-percent? 0.1) + (when (>= (- (-> *display* game-clock frame-counter) (-> self shock-effect-time)) (seconds 0.02)) + (set! (-> self shock-effect-time) (-> *display* game-clock frame-counter)) + (process-drawable-shock-effect + self + (-> *lightning-spec-id-table* 6) + lightning-probe-callback + (-> *part-id-table* 179) + 0 + 0 + 40960.0 + ) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; (defstate target-darkjak-get-on (target) +;; :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) +;; (case event-type +;; (('darkjak) +;; (when (zero? (-> self darkjak want-stage)) +;; (set! (-> self darkjak want-stage) (-> event param 0)) +;; #t +;; ) +;; ) +;; (else +;; (target-generic-event-handler proc arg1 event-type event) +;; ) +;; ) +;; ) +;; :exit (behavior () +;; (logclear! (-> self state-flags) (state-flags lleg-still rleg-still)) +;; (set! (-> self darkjak-interp) 1.0) +;; (remove-setting! 'bg-r) +;; (remove-setting! 'bg-g) +;; (remove-setting! 'bg-b) +;; (remove-setting! 'bg-a) +;; (persist-with-delay *setting-control* 'bg-a-speed (seconds 3) 'bg-a-speed 'abs 0.5 0) +;; (if (not (and (-> self next-state) (= (-> self next-state name) 'target-darkjak-get-off))) +;; (pickup-collectable! +;; (-> self fact) +;; (pickup-type eco-pill-dark) +;; (- (-> *FACT-bank* eco-pill-dark-max-default)) +;; (the-as handle #f) +;; ) +;; ) +;; (none) +;; ) +;; :code (behavior ((arg0 int)) +;; (send-event (handle->process (-> self notify)) 'notify 'attack 15) +;; (if (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) +;; (go target-darkjak-giant) +;; ) +;; (set! (-> self darkjak stage) (the-as uint (logior arg0 2))) +;; (if (logtest? (game-feature darkjak-bomb0) (-> self game features)) +;; (logior! (-> self darkjak stage) 4) +;; ) +;; (if (logtest? (game-feature darkjak-bomb1) (-> self game features)) +;; (logior! (-> self darkjak stage) 8) +;; ) +;; (if (logtest? (game-feature darkjak-invinc) (-> self game features)) +;; (logior! (-> self darkjak stage) 16) +;; ) +;; (set! (-> self darkjak want-stage) (-> self darkjak stage)) +;; (set! (-> self neck flex-blend) 0.0) +;; (set! (-> self control unknown-surface00) *darkjak-trans-mods*) +;; (set! (-> self darkjak start-time) (-> self clock frame-counter)) +;; (set! (-> self darkjak attack-count) (the-as uint 0)) +;; (set! (-> self darkjak-giant-interp) 1.0) +;; (set-setting! 'sound-flava #f #x41f00000 4) +;; (set! (-> self focus-status) (logior (focus-status dark) (-> self focus-status))) +;; (set! (-> (the-as fact-info-target (-> self fact)) darkjak-start-time) (-> self clock frame-counter)) +;; (set! (-> (the-as fact-info-target (-> self fact)) darkjak-effect-time) (seconds 20)) +;; (if (logtest? (-> self darkjak stage) 16) +;; (logior! (-> self state-flags) (state-flags sf4)) +;; (logclear! (-> self state-flags) (state-flags sf4)) +;; ) +;; (if (logtest? arg0 64) +;; (go target-stance) +;; ) +;; (set-setting! 'bg-r 'abs #x3dcccccd 0) +;; (set-setting! 'bg-b 'abs #x3dcccccd 0) +;; (set-forward-vel 0.0) +;; (let ((s5-0 0)) +;; (while (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) +;; (target-falling-anim-trans) +;; (+! s5-0 (- (-> self clock frame-counter) (-> self clock old-frame-counter))) +;; (if (>= s5-0 300) +;; (go target-falling #f) +;; ) +;; (suspend) +;; ) +;; ) +;; (let ((s5-2 (sound-play "djak-transform"))) +;; (cond +;; ((task-node-open? (game-task-node city-help-kid-battle)) +;; (ja-channel-push! 1 (seconds 0.1)) +;; (ja-no-eval :group! (-> self draw art-group data 390) +;; :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 390)) frames num-frames) -1))) +;; :frame-num 0.0 +;; ) +;; (until (ja-done? 0) +;; (set! (-> self darkjak-interp) (lerp-scale 0.0 1.0 (ja-aframe-num 0) 10.0 25.0)) +;; (set-setting! 'bg-a 'abs (* 0.45 (-> self darkjak-interp)) 0) +;; (suspend) +;; (ja :num! (seek!)) +;; ) +;; ) +;; (else +;; (ja-channel-push! 1 (seconds 0.1)) +;; (ja-no-eval :group! (-> self draw art-group data 412) :num! (seek! (ja-aframe 17.0 0)) :frame-num 0.0) +;; (until (ja-done? 0) +;; (set! (-> self darkjak-interp) (lerp-scale 0.0 1.0 (ja-aframe-num 0) 5.0 15.0)) +;; (set-setting! 'bg-a 'abs (* 0.45 (-> self darkjak-interp)) 0) +;; (when (and (or (not (cpad-hold? (-> self control unknown-cpad-info00 number) l2)) +;; (and (= *cheat-mode* 'debug) (cpad-hold? (-> self control unknown-cpad-info00 number) r2)) +;; ) +;; (and (< (ja-aframe-num 0) 5.0) (zero? (logand arg0 1))) +;; ) +;; (let ((v1-131 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) +;; (set! (-> v1-131 command) (sound-command set-param)) +;; (set! (-> v1-131 id) s5-2) +;; (set! (-> v1-131 params volume) -4) +;; (set! (-> v1-131 auto-time) 24) +;; (set! (-> v1-131 auto-from) 2) +;; (set! (-> v1-131 params mask) (the-as uint 17)) +;; (-> v1-131 id) +;; ) +;; (go target-darkjak-get-off) +;; ) +;; (suspend) +;; (ja :num! (seek! (ja-aframe 17.0 0))) +;; ) +;; ) +;; ) +;; ) +;; (send-event +;; *traffic-manager* +;; 'increase-alert-level +;; (if (and (logtest? (focus-status dark) (-> self focus-status)) +;; (nonzero? (-> self darkjak)) +;; (logtest? (-> self darkjak stage) 16) +;; ) +;; 3 +;; 2 +;; ) +;; ) +;; (go target-stance) +;; (none) +;; ) +;; :post (-> target-grab post) +;; ) + +;; (defstate target-darkjak-get-off (target) +;; :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) +;; (case event-type +;; (('pole-grab 'darkjak 'slide 'wade 'launch 'edge-grab) +;; #f +;; ) +;; (('change-mode) +;; (case (-> event param 0) +;; (('grab) +;; (when (not (logtest? (-> self focus-status) (focus-status dead))) +;; (if (not (-> event param 1)) +;; #t +;; (go target-grab 'stance) +;; ) +;; ) +;; ) +;; ) +;; ) +;; (else +;; (target-generic-event-handler proc arg1 event-type event) +;; ) +;; ) +;; ) +;; :enter (behavior () +;; (set! (-> self state-flags) (logior (state-flags lleg-still rleg-still) (-> self state-flags))) +;; (set! (-> self neck flex-blend) 0.0) +;; (set! (-> self control unknown-surface00) *darkjak-trans-mods*) +;; (kill-persister *setting-control* (the-as engine-pers 'bg-a-speed) 'bg-a-speed) +;; (let ((a1-1 (new 'stack-no-clear 'event-message-block))) +;; (set! (-> a1-1 from) (process->ppointer self)) +;; (set! (-> a1-1 num-params) 1) +;; (set! (-> a1-1 message) 'target) +;; (set! (-> a1-1 param 0) (the-as uint 'normal)) +;; (let ((t9-1 send-event-function) +;; (v1-12 (-> *game-info* sub-task-list 4)) +;; ) +;; (t9-1 +;; (handle->process (if (-> v1-12 info) +;; (-> v1-12 info manager) +;; (the-as handle #f) +;; ) +;; ) +;; a1-1 +;; ) +;; ) +;; ) +;; (none) +;; ) +;; :exit (behavior () +;; (logclear! (-> self state-flags) (state-flags lleg-still rleg-still)) +;; (target-darkjak-end-mode) +;; (none) +;; ) +;; :trans (-> target-darkjak-get-on trans) +;; :code (behavior () +;; (let ((v1-1 (-> self water flags))) +;; (cond +;; ((and (logtest? (water-flags touch-water) v1-1) +;; (logtest? (water-flags under-water swimming) v1-1) +;; (zero? (logand (focus-status mech) (-> self focus-status))) +;; ) +;; (go target-swim-stance) +;; ) +;; ((let ((v1-10 (ja-group))) +;; (not (and v1-10 (= v1-10 (-> self draw art-group data 412)))) +;; ) +;; (let ((gp-0 0)) +;; (while (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) +;; (target-falling-anim-trans) +;; (+! gp-0 (- (-> self clock frame-counter) (-> self clock old-frame-counter))) +;; (if (>= gp-0 300) +;; (go target-falling #f) +;; ) +;; (suspend) +;; ) +;; ) +;; ) +;; ) +;; ) +;; (cond +;; ((logtest? (-> self control status) (cshape-moving-flags on-water)) +;; ) +;; (else +;; (let ((v1-30 (ja-group))) +;; (cond +;; ((and v1-30 (= v1-30 (-> self draw art-group data 412))) +;; (ja-no-eval :num! (seek! 0.0)) +;; (while (not (ja-done? 0)) +;; (seek! (-> self darkjak-interp) 0.0 (* 2.0 (-> self clock seconds-per-frame))) +;; (suspend) +;; (ja-eval) +;; ) +;; (ja-channel-push! 1 (seconds 0.1)) +;; ) +;; ((let ((v1-43 (ja-group))) +;; (and v1-43 +;; (or (= v1-43 (-> self draw art-group data 401)) +;; (= v1-43 (-> self draw art-group data 416)) +;; (= v1-43 (-> self draw art-group data 417)) +;; (= v1-43 (-> self draw art-group data 418)) +;; ) +;; ) +;; ) +;; (ja-no-eval :group! (-> self draw art-group data 411) +;; :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 411)) frames num-frames) -1))) +;; :frame-num 0.0 +;; ) +;; (until (ja-done? 0) +;; (set! (-> self darkjak-interp) (lerp-scale 1.0 0.0 (ja-aframe-num 0) 90.0 115.0)) +;; (if (and (!= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) +;; (or (not (and (logtest? (focus-status dark) (-> self focus-status)) +;; (nonzero? (-> self darkjak)) +;; (logtest? (-> self darkjak stage) 32) +;; ) +;; ) +;; (= (-> self darkjak-interp) 0.0) +;; ) +;; ) +;; (goto cfg-133) +;; ) +;; (suspend) +;; (ja :num! (seek!)) +;; ) +;; ) +;; ((let ((v1-88 (ja-group))) +;; (and v1-88 (= v1-88 (-> self draw art-group data 411))) +;; ) +;; (ja-no-eval :num! (seek!)) +;; (while (not (ja-done? 0)) +;; (set! (-> self darkjak-interp) (lerp-scale 1.0 0.0 (ja-aframe-num 0) 90.0 115.0)) +;; (if (and (!= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) +;; (or (not (and (logtest? (focus-status dark) (-> self focus-status)) +;; (nonzero? (-> self darkjak)) +;; (logtest? (-> self darkjak stage) 32) +;; ) +;; ) +;; (= (-> self darkjak-interp) 0.0) +;; ) +;; ) +;; (goto cfg-133) +;; ) +;; (suspend) +;; (ja-eval) +;; ) +;; ) +;; (else +;; (ja-channel-push! 1 (seconds 0.05)) +;; (ja-no-eval :group! (-> self draw art-group data 408) +;; :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 408)) frames num-frames) -1))) +;; :frame-num 0.0 +;; ) +;; (until (ja-done? 0) +;; (set! (-> self darkjak-interp) (lerp-scale 1.0 0.0 (ja-aframe-num 0) 10.0 60.0)) +;; (if (and (>= (ja-aframe-num 0) 24.0) +;; (!= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) +;; (or (not (and (logtest? (focus-status dark) (-> self focus-status)) +;; (nonzero? (-> self darkjak)) +;; (logtest? (-> self darkjak stage) 32) +;; ) +;; ) +;; (= (-> self darkjak-interp) 0.0) +;; ) +;; ) +;; (goto cfg-133) +;; ) +;; (suspend) +;; (ja :num! (seek!)) +;; ) +;; (ja-no-eval :group! (-> self draw art-group data 415) +;; :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 415)) frames num-frames) -1))) +;; :frame-num 0.0 +;; ) +;; (until (ja-done? 0) +;; (set! (-> self darkjak-interp) (lerp-scale 1.0 0.0 (ja-aframe-num 0) 10.0 60.0)) +;; (if (and (>= (ja-aframe-num 0) 24.0) +;; (!= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) +;; (or (not (and (logtest? (focus-status dark) (-> self focus-status)) +;; (nonzero? (-> self darkjak)) +;; (logtest? (-> self darkjak stage) 32) +;; ) +;; ) +;; (= (-> self darkjak-interp) 0.0) +;; ) +;; ) +;; (goto cfg-133) +;; ) +;; (suspend) +;; (ja :num! (seek!)) +;; ) +;; ) +;; ) +;; ) +;; ) +;; ) +;; (label cfg-133) +;; (vector-reset! (-> self control transv)) +;; ((-> target-darkjak-get-off exit)) +;; (go target-stance) +;; (none) +;; ) +;; :post (-> target-grab post) +;; ) + +(defstate target-darkjak-running-attack (target) + :event (-> target-running-attack event) + :enter (-> target-running-attack enter) + :exit (behavior () + (remove-setting! 'rapid-tracking) + ((-> target-running-attack exit)) + (none) + ) + :trans (-> target-running-attack trans) + :code (behavior () + (local-vars + (sv-16 float) + (sv-20 float) + (sv-24 int) + (sv-32 int) + (sv-40 int) + (sv-48 float) + (sv-56 handle) + (sv-64 int) + ) + (set-setting! 'rapid-tracking #f 0 0) + ((lambda :behavior target + () + (set! (-> self control unknown-float29) (* 0.5 (-> self control unknown-float29))) + (if (logtest? (water-flags touch-water) (-> self water flags)) + (sound-play "swim-stroke") + ) + (set! (-> self control dynam gravity-max) 368640.0) + (set! (-> self control dynam gravity-length) 368640.0) + (let ((gp-1 (cond + ((zero? (-> self control unknown-word000)) + (set! (-> self control unknown-word000) 1) + (-> self draw art-group data 402) + ) + (else + (set! (-> self control unknown-word000) 0) + (-> self draw art-group data 409) + ) + ) + ) + ) + (ja-channel-push! 1 (seconds 0.02)) + (ja-no-eval :group! gp-1 :num! (seek! (the float (+ (-> (the-as art-joint-anim gp-1) frames num-frames) -1)))) + ) + (target-start-attack) + (target-danger-set! 'punch #f) + (let ((a0-8 (-> self control unknown-impact-control00)) + (t9-6 (method-of-type impact-control initialize)) + (a1-4 self) + (v1-33 (ja-group)) + ) + (t9-6 + a0-8 + a1-4 + (if (and v1-33 (= v1-33 (-> self draw art-group data 402))) + 22 + 18 + ) + 3276.8 + (-> self control root-prim prim-core collide-with) + ) + ) + ) + ) + (set! sv-16 (the-as float 0.0)) + (set! sv-20 1.0) + (set! sv-24 0) + (set! sv-32 0) + (set! sv-40 0) + (set! sv-48 1.0) + (set! sv-56 (the-as handle #f)) + (set! sv-64 0) + (until (ja-done? 0) + (if (and (cpad-pressed? (-> self control unknown-cpad-info00 number) square) + (not (logtest? (-> self state-flags) (state-flags sf7 sf8))) + (not (logtest? (-> self control unknown-surface01 flags) (surface-flag no-attack))) + (and (logtest? (focus-status dark) (-> self focus-status)) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) 2) + ) + (< sv-32 2) + ) + (set! sv-40 (the-as int (-> self clock frame-counter))) + ) + (when (>= (- (-> self clock frame-counter) (the-as time-frame sv-40)) (seconds 0.5)) + (set! sv-40 0) + 0 + ) + (if (and (nonzero? sv-40) + (< (- (the float (+ (-> (ja-group) frames num-frames) -1)) (/ 2.0 (-> (ja-group) artist-step))) + (ja-frame-num 0) + ) + ) + ((lambda :behavior target + ((arg0 (pointer float)) (arg1 (pointer uint64)) (arg2 (pointer uint64))) + (let ((s4-0 (the-as process-focusable (combo-tracker-method-13 + (-> self control unknown-combo-tracker00) + (-> self control unknown-dword06) + (-> self control trans) + 24576.0 + (-> self control unknown-matrix01 vector 2) + 65536.0 + ) + ) + ) + ) + (when #t + (+! (-> arg1 0) 1) + (if s4-0 + (combo-tracker-method-12 + (-> self control unknown-combo-tracker00) + (-> self control trans) + (get-trans s4-0 3) + s4-0 + (-> self clock frame-counter) + ) + ) + (target-start-attack) + (target-danger-set! 'punch #f) + (let ((v1-18 (ja-group))) + (cond + ((and v1-18 (or (= v1-18 (-> self draw art-group data 402)) (= v1-18 (-> self draw art-group data 409)))) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 404) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 404)) frames num-frames) -1))) + ) + ) + (else + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 413) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 413)) frames num-frames) -1))) + ) + ) + ) + ) + (initialize + (-> self control unknown-impact-control00) + self + 22 + 3276.8 + (-> self control root-prim prim-core collide-with) + ) + (set! (-> arg0 0) (fmax 0.0 (-> arg0 0))) + ) + ) + (set! (-> arg2 0) (the-as uint 0)) + 0 + (none) + ) + (& sv-16) + (the-as (pointer uint64) (& sv-32)) + (the-as (pointer uint64) (& sv-40)) + ) + ) + (compute-alignment! (-> self align)) + (when (not (ja-min? 0)) + (cond + ((and (>= (ja-frame-num 0) 20.0) + (and (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) + (the-as time-frame (-> *TARGET-bank* ground-timeout)) + ) + (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (>= (target-height-above-ground) (-> *TARGET-bank* fall-height)) + ) + (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame17)) (seconds 0.04)) + ) + ) + (go target-falling #f) + ) + ((and (nonzero? sv-32) + (>= sv-16 -40960.0) + (let ((v1-84 (ja-group))) + (not (and (and v1-84 (= v1-84 (-> self draw art-group data 406))) (>= (ja-aframe-num 0) 77.0))) + ) + (send-event (handle->process (-> self control unknown-combo-tracker00 target)) 'combo) + ) + (let* ((s5-0 (handle->process (-> self control unknown-combo-tracker00 target))) + (gp-0 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (let ((s5-1 (get-trans (the-as process-focusable gp-0) 3))) + (when (and (< 2048.0 (vector-vector-distance (-> self control trans) s5-1)) + (or (and (= gp-0 (handle->process sv-56)) + (< (- (-> self clock frame-counter) (the-as time-frame sv-64)) (seconds 0.1)) + ) + (>= (- (-> self clock frame-counter) (the-as time-frame sv-64)) (seconds 1)) + ) + ) + (forward-up-nopitch->quaternion + (-> self control dir-targ) + (vector-! (new 'stack-no-clear 'vector) s5-1 (-> self control trans)) + (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self control quat)) + ) + (let ((v1-125 + (point-tracker-method-11 + (-> self control unknown-combo-tracker00) + (new 'stack-no-clear 'vector) + (-> self control trans) + s5-1 + (* 0.009107469 + (the float (- (-> self clock frame-counter) (-> self control unknown-combo-tracker00 move-start-time))) + ) + ) + ) + ) + (set! sv-16 (fmin 163840.0 (sqrtf (+ (* (-> v1-125 x) (-> v1-125 x)) (* (-> v1-125 z) (-> v1-125 z)))))) + ) + (set-forward-vel sv-16) + ) + ) + (when (!= gp-0 (handle->process sv-56)) + (set! sv-56 (process->handle gp-0)) + (set! sv-64 (the-as int (-> self clock frame-counter))) + ) + ) + ) + ((< sv-16 0.0) + (set! sv-16 (seek sv-16 -0.04096 (* 491520.0 (-> self clock seconds-per-frame)))) + (set-forward-vel sv-16) + ) + ((and (nonzero? (-> self control unknown-time-frame18)) + (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame18)) (seconds 0.04)) + ) + (set-forward-vel 0.0) + ) + ((and (not (cpad-hold? (-> self control unknown-cpad-info00 number) square)) + (zero? sv-32) + (>= (- (-> self clock frame-counter) (-> self control unknown-combo-tracker00 move-start-time)) (seconds 0.2)) + ) + (if (= (-> self control ground-pat material) (pat-material ice)) + (set-forward-vel (fmax 32768.0 (* 0.8 (-> self control unknown-float05)))) + (set-forward-vel (* 0.8 (-> self control unknown-float05))) + ) + ) + ((ja-done? 0) + (set-forward-vel sv-16) + ) + (else + (set! sv-16 + (* (target-align-vel-z-adjust (-> self align delta trans z)) (-> self clock frames-per-second) sv-20) + ) + (set-forward-vel sv-16) + ) + ) + ) + (let ((gp-1 (new-stack-vector0))) + (vector-matrix*! gp-1 (-> self control transv) (-> self control unknown-matrix00)) + (set! (-> gp-1 y) 0.0) + (vector-matrix*! (-> self control unknown-vector44) gp-1 (-> self control unknown-matrix01)) + ) + (when (!= (the-as float (-> self control unknown-word04)) 0.0) + (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) + (set! sv-16 (the-as float (-> self control unknown-word04))) + (set! (-> self control unknown-word04) (the-as uint 0.0)) + ) + (when (and (>= sv-16 0.0) + (let ((gp-2 (ja-group)) + (f30-2 (ja-aframe-num 0)) + ) + (if (or (and (= gp-2 (-> self draw art-group data 402)) + (>= f30-2 11.0) + (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 402)) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + (and (= gp-2 (-> self draw art-group data 409)) + (>= f30-2 11.0) + (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 409)) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + (and (= gp-2 (-> self draw art-group data 404)) + (>= f30-2 49.0) + (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 404)) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + (and (= gp-2 (-> self draw art-group data 406)) + (or (and (>= f30-2 62.0) (>= 77.0 f30-2)) + (and (>= f30-2 82.0) + (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 406)) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + ) + ) + (and (= gp-2 (-> self draw art-group data 413)) + (>= f30-2 62.0) + (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 413)) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + ) + #t + ) + ) + ) + (let ((gp-3 (new 'stack-no-clear 'collide-query))) + (when (and (>= (impact-control-method-11 + (-> self control unknown-impact-control00) + gp-3 + (the-as process #f) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1) + ) + 0.0 + ) + (>= 0.0 (vector-dot (-> gp-3 best-other-tri normal) (-> self control unknown-impact-control00 dir))) + ) + (when (= (-> gp-3 best-other-tri pat mode) (pat-mode wall)) + (let ((s5-2 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-2 + (let ((t9-38 (method-of-type part-tracker activate))) + (t9-38 (the-as part-tracker s5-2) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) + ) + (let ((t9-39 run-function-in-process) + (a0-96 s5-2) + (a1-21 part-tracker-init) + (a2-12 (-> *part-group-id-table* 11)) + (a3-7 0) + (t0-3 #f) + (t1-2 #f) + (t2-1 #f) + (t3-0 *launch-matrix*) + ) + (set! (-> t3-0 trans quad) (-> gp-3 best-other-tri intersect quad)) + ((the-as (function object object object object object object object object none) t9-39) + a0-96 + a1-21 + a2-12 + a3-7 + t0-3 + t1-2 + t2-1 + t3-0 + ) + ) + (-> s5-2 ppointer) + ) + ) + (let ((t1-3 (make-u128 (the-as uint #x7469682d6863) (the-as uint #x6e75702d6b616a64)))) + (effect-control-method-12 + (-> self skel effect) + 'punch + -1.0 + (the-as int (-> self control unknown-impact-control00 joint)) + (the-as basic #f) + (the-as sound-name t1-3) + ) + ) + (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) + (set! sv-16 (the-as float -61440.0)) + ) + ) + ) + ) + (let ((gp-4 (ja-group)) + (f0-53 (ja-aframe-num 0)) + ) + (if (and (= gp-4 (-> self draw art-group data 406)) + (>= f0-53 80.0) + (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 406)) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + (align! (-> self align) (align-opts adjust-y-vel) 1.0 1.6 1.0) + ) + ) + (suspend) + (ja :num! (seek! max (* (-> self control unknown-surface01 align-speed) (the-as float sv-48)))) + (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (set! (-> *run-attack-mods* turnvv) 0.0) + ) + (if (< 2 sv-24) + (set! sv-20 (* sv-20 (fmin 1.0 (-> self control unknown-float44)))) + ) + (set! sv-24 (+ sv-24 1)) + ) + (if (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) + (the-as time-frame (-> *TARGET-bank* ground-timeout)) + ) + (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (>= (target-height-above-ground) (-> *TARGET-bank* fall-height)) + ) + (go target-falling #f) + ) + (go target-stance) + (none) + ) + :post target-post + ) + +(defmethod update-clock! darkjak-info ((obj darkjak-info) (arg0 int)) + (when (-> obj clock-on) + (+! (-> obj clock-pos) (* (-> obj clock-vel) (-> self clock seconds-per-frame))) + (+! (-> obj clock-vel) (* 4.0 (-> self clock seconds-per-frame))) + (cond + ((< 1.0 (-> obj clock-pos)) + (set! (-> obj clock-pos) 1.0) + (set! (-> obj clock-vel) 0.0) + ) + ((< (-> obj clock-pos) 0.05) + (set! (-> obj clock-pos) 0.05) + (set! (-> obj clock-vel) 1.0) + ) + ) + (update-rates! (-> *display* entity-clock) (-> obj clock-pos)) + (update-rates! (-> *display* bg-clock) (-> obj clock-pos)) + (if (= arg0 4) + (update-rates! (-> *display* target-clock) (-> obj clock-pos)) + ) + (when *sound-player-enable* + (let ((v1-27 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-27 command) (sound-command set-param)) + (set! (-> v1-27 id) (-> obj process 0 control unknown-sound-id00)) + (set! (-> v1-27 params pitch-mod) (the int (* 1524.0 (- (- 1.0 (-> obj clock-pos)))))) + (set! (-> v1-27 params mask) (the-as uint 2)) + (-> v1-27 id) + ) + ) + ) + 0 + (none) + ) + +(defbehavior target-darkjak-bomb-collide target ((arg0 float) (arg1 float)) + (seek! (-> (the-as (pointer float) arg0) 0) arg1 (* 4.0 (-> self clock seconds-per-frame))) + (set! (-> self control unknown-float40) (-> (the-as (pointer float) arg0) 0)) + (target-danger-set! 'bomb #f) + (collide-shape-method-46 (-> self control)) + (let ((a1-2 (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> a1-2 options) (overlaps-others-options)) + (set! (-> a1-2 collide-with-filter) (the-as collide-spec -1)) + (set! (-> a1-2 tlist) *touching-list*) + (find-overlapping-shapes (-> self control) a1-2) + ) + (set! (-> self control unknown-float40) 0.0) + (target-danger-set! 'bomb #f) + (collide-shape-method-46 (-> self control)) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate target-darkjak-bomb0 (target) + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('pole-grab 'darkjak 'slide 'wade 'launch 'edge-grab 'jump 'shove 'attack 'attack-or-shove) + #f + ) + (('hit) + (let ((v1-1 (the-as object (-> event param 1)))) + (when (and (= (-> event param 0) 'bomb) + (logtest? (process-mask enemy) (-> (the-as process v1-1) mask)) + (let ((v1-7 (ja-group))) + (and v1-7 (= v1-7 (-> self draw art-group data 418))) + ) + (>= (ja-aframe-num 0) 35.0) + (not (-> self darkjak clock-on)) + ) + (set! (-> self darkjak clock-vel) -8.0) + (let ((v0-0 (the-as object #t))) + (set! (-> self darkjak clock-on) (the-as symbol v0-0)) + v0-0 + ) + ) + ) + ) + (('attack 'attack-or-shove 'swim) + #f + ) + (else + (target-dangerous-event-handler proc arg1 event-type event) + ) + ) + ) + :enter (behavior () + (logior! (-> self state-flags) (state-flags sf4)) + (set! (-> self darkjak clock-pos) 1.0) + (set! (-> self darkjak clock-vel) 0.0) + (set! (-> self darkjak clock-on) #f) + (set! (-> self control unknown-sound-id00) + (gui-control-method-9 *gui-control* self (gui-channel jak) (gui-action queue) "darkbom0" -99.0 0) + ) + (none) + ) + :exit (behavior () + (gui-control-method-16 + *gui-control* + (gui-action fade) + (-> self control unknown-sound-id00) + (gui-channel none) + (gui-action none) + (the-as string #f) + (the-as (function gui-connection symbol) #f) + (the-as process #f) + ) + (logclear! (-> self state-flags) (state-flags sf6)) + (target-exit) + (remove-setting! 'music-volume) + (remove-setting! 'sfx-volume) + (remove-setting! 'ambient-volume) + (set! (-> self darkjak clock-pos) 1.0) + (set! (-> self darkjak clock-vel) 0.0) + (set! (-> self darkjak clock-on) #f) + (update-rates! (-> *display* entity-clock) 1.0) + (update-rates! (-> *display* bg-clock) 1.0) + (update-rates! (-> *display* target-clock) 1.0) + (if (not (and (-> self next-state) (= (-> self next-state name) 'target-darkjak-get-off))) + ((-> target-darkjak-get-off exit)) + ) + (none) + ) + :trans (behavior () + (update-clock! (-> self darkjak) 4) + (none) + ) + :code (behavior () + (local-vars + (v1-100 symbol) + (sv-16 float) + (sv-20 float) + (sv-80 vector) + (sv-84 (function vector :behavior target)) + ) + (set! (-> self darkjak stage) (-> self darkjak want-stage)) + (set! (-> self neck flex-blend) 0.0) + (set! (-> self control unknown-surface00) *roll-flip-mods*) + (set! (-> self alt-cam-pos quad) (-> self control trans quad)) + (set! sv-16 (the-as float 0.0)) + (set! sv-20 1.0) + (ja-channel-push! 1 (seconds 0.15)) + (when (jump-hit-ground-stuck?) + (ja-no-eval :group! (-> self draw art-group data 401) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 401)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (set! (-> self alt-cam-pos x) (-> self control trans x)) + (set! (-> self alt-cam-pos z) (-> self control trans z)) + (set-forward-vel (* 0.85 (-> self control unknown-float05))) + (suspend) + (ja :num! (seek!)) + ) + ) + (set-setting! 'music-volume 'rel 0 0) + (set-setting! 'sfx-volume 'rel 0 0) + (set-setting! 'ambient-volume 'rel 0 0) + (ja-no-eval :group! (-> self draw art-group data 416) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 416)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (align! (-> self align) (align-opts adjust-y-vel) 1.0 1.0 1.0) + (set! (-> self alt-cam-pos x) (-> self control trans x)) + (set! (-> self alt-cam-pos z) (-> self control trans z)) + (set-forward-vel (* 0.98 (-> self control unknown-float05))) + (suspend) + (ja :num! (seek!)) + ) + (ja-no-eval :group! (-> self draw art-group data 417) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 417)) frames num-frames) -1))) + :frame-num 0.0 + ) + (let ((f30-0 (the float (target-time-to-ground)))) + (until v1-100 + (set! (-> self alt-cam-pos x) (-> self control trans x)) + (set! (-> self alt-cam-pos z) (-> self control trans z)) + (set-forward-vel (* 0.98 (-> self control unknown-float05))) + (let ((v1-92 (new-stack-vector0)) + (f0-35 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + ) + 0.0 + (vector-! v1-92 (-> self control transv) (vector-float*! v1-92 (-> self control dynam gravity-normal) f0-35)) + (let* ((f1-5 (vector-length v1-92)) + (f2-0 f1-5) + (f0-36 (+ f0-35 (* -491520.0 (-> self clock seconds-per-frame)))) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-36) + (vector-float*! v1-92 v1-92 (/ f1-5 f2-0)) + ) + ) + ) + (suspend) + (ja :num! (seek! max (lerp-scale 1.5 0.3 f30-0 30.0 210.0))) + (set! v1-100 (or (ja-done? 0) (logtest? (-> self control status) (cshape-moving-flags on-surface)))) + ) + ) + (logclear! (-> self state-flags) (state-flags sf6)) + (while (not (jump-hit-ground-stuck?)) + (let ((v1-105 (new-stack-vector0)) + (f0-42 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + ) + 0.0 + (vector-! + v1-105 + (-> self control transv) + (vector-float*! v1-105 (-> self control dynam gravity-normal) f0-42) + ) + (let* ((f1-8 (vector-length v1-105)) + (f2-1 f1-8) + (f0-43 (+ f0-42 (* -491520.0 (-> self clock seconds-per-frame)))) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-43) + (vector-float*! v1-105 v1-105 (/ f1-8 f2-1)) + ) + ) + ) + (ja :num! (seek! (ja-aframe 33.0 0))) + (suspend) + ) + (set-forward-vel 0.0) + (ja-no-eval :group! (-> self draw art-group data 418) :num! (seek! (ja-aframe 35.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 35.0 0))) + ) + (gui-control-method-16 + *gui-control* + (gui-action play) + (-> self control unknown-sound-id00) + (gui-channel none) + (gui-action none) + (the-as string #f) + (the-as (function gui-connection symbol) #f) + (the-as process #f) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.5)) + (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) + (target-start-attack) + (target-danger-set! 'bomb #f) + (set! sv-80 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 18))) + (set! sv-84 (lambda :behavior target + () + (set-vector! (-> self draw color-mult) 0.0 0.0 0.0 1.0) + (cond + ((>= 10.0 (ja-aframe-num 0)) + (let ((v0-1 (the-as vector (-> self draw color-emissive)))) + (set! (-> (the-as rgbaf v0-1) x) 1.0) + (set! (-> (the-as rgbaf v0-1) y) 1.0) + (set! (-> (the-as rgbaf v0-1) z) 1.0) + (set! (-> (the-as rgbaf v0-1) w) 1.0) + v0-1 + ) + ) + ((>= 20.0 (ja-aframe-num 0)) + (vector-lerp! + (-> self draw color-emissive) + (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) + (new 'static 'vector :x 0.5 :z 1.0 :w 1.0) + (lerp-scale 0.0 1.0 (ja-aframe-num 0) 10.0 20.0) + ) + ) + (else + (vector-lerp! + (-> self draw color-emissive) + (new 'static 'vector :x 0.5 :z 1.0 :w 1.0) + (new 'static 'vector :w 1.0) + (lerp-scale 0.0 1.0 (ja-aframe-num 0) 20.0 30.0) + ) + ) + ) + ) + ) + (if (and (logtest? (focus-status dark) (-> self focus-status)) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) 32) + ) + (set! (-> sv-80 y) (* 0.5 (+ (-> self control trans y) (-> self control root-prim prim-core world-sphere y)))) + (set! (-> sv-80 y) (-> self control root-prim prim-core world-sphere y)) + ) + (let ((gp-4 (get-process *default-dead-pool* part-tracker #x4000))) + (when gp-4 + (let ((t9-37 (method-of-type part-tracker activate))) + (t9-37 + (the-as part-tracker gp-4) + *entity-pool* + (symbol->string (-> part-tracker symbol)) + (the-as pointer #x70004000) + ) + ) + (let ((t9-38 run-function-in-process) + (a0-75 gp-4) + (a1-37 part-tracker-init) + (a2-35 (-> *part-group-id-table* 63)) + (a3-15 0) + (t0-7 #f) + (t1-5 #f) + (t2-2 #f) + (t3-1 *launch-matrix*) + ) + (set! (-> t3-1 trans quad) (-> sv-80 quad)) + ((the-as (function object object object object object object object object none) t9-38) + a0-75 + a1-37 + a2-35 + a3-15 + t0-7 + t1-5 + t2-2 + t3-1 + ) + ) + (-> gp-4 ppointer) + ) + ) + (let* ((s5-0 (get-process *default-dead-pool* manipy #x4000)) + (gp-5 + (when s5-0 + (let ((t9-40 (method-of-type manipy activate))) + (t9-40 (the-as manipy s5-0) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) + ) + (let ((gp-6 run-function-in-process) + (s4-0 s5-0) + (s3-0 manipy-init) + (s2-0 sv-80) + (s1-0 (-> self entity)) + (t0-8 (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f))) + (t1-6 #f) + ) + 0 + ((the-as (function object object object object object object none) gp-6) s4-0 s3-0 s2-0 s1-0 t0-8 t1-6) + ) + (-> s5-0 ppointer) + ) + ) + ) + (when gp-5 + (send-event (ppointer->process gp-5) 'anim-mode 'play1) + (send-event (ppointer->process gp-5) 'anim "idle") + (set-vector! (-> (the-as process-drawable (-> gp-5 0)) root scale) sv-20 1.0 sv-20 1.0) + (send-event (ppointer->process gp-5) 'trans-hook sv-84) + ) + ) + (let* ((s5-1 (get-process *default-dead-pool* manipy #x4000)) + (gp-7 + (when s5-1 + (let ((t9-47 (method-of-type manipy activate))) + (t9-47 (the-as manipy s5-1) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) + ) + (let ((gp-8 run-function-in-process) + (s4-1 s5-1) + (s3-1 manipy-init) + (s2-1 sv-80) + (s1-1 (-> self entity)) + (t0-9 (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f))) + (t1-7 #f) + ) + 0 + ((the-as (function object object object object object object none) gp-8) s4-1 s3-1 s2-1 s1-1 t0-9 t1-7) + ) + (-> s5-1 ppointer) + ) + ) + ) + (when gp-7 + (send-event (ppointer->process gp-7) 'anim-mode 'play1) + (send-event (ppointer->process gp-7) 'anim "idle") + (set-vector! (-> (the-as process-drawable (-> gp-7 0)) root scale) sv-20 1.0 sv-20 1.0) + ) + ) + (ja-no-eval :num! (seek! (ja-aframe 38.0 0))) + (while (not (ja-done? 0)) + (target-darkjak-bomb-collide (the-as float (& sv-16)) sv-20) + (set-forward-vel 0.0) + (suspend) + (ja-eval) + ) + (when (and (logtest? (focus-status dark) (-> self focus-status)) + (and (nonzero? (-> self darkjak)) (logtest? (-> self darkjak stage) 32)) + ) + (let* ((s5-2 (get-process *default-dead-pool* manipy #x4000)) + (gp-10 + (when s5-2 + (let ((t9-59 (method-of-type manipy activate))) + (t9-59 (the-as manipy s5-2) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) + ) + (let ((gp-11 run-function-in-process) + (s4-2 s5-2) + (s3-2 manipy-init) + (s2-2 sv-80) + (s1-2 (-> self entity)) + (t0-10 (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f))) + (t1-8 #f) + ) + 0 + ((the-as (function object object object object object object none) gp-11) s4-2 s3-2 s2-2 s1-2 t0-10 t1-8) + ) + (-> s5-2 ppointer) + ) + ) + ) + (when gp-10 + (send-event (ppointer->process gp-10) 'anim-mode 'play1) + (send-event (ppointer->process gp-10) 'anim "idle") + (set-vector! (-> (the-as process-drawable (-> gp-10 0)) root scale) sv-20 1.0 sv-20 1.0) + (send-event + (ppointer->process gp-10) + 'trans-hook + (lambda :behavior target + () + (set-vector! (-> self draw color-mult) 0.0 0.0 0.0 1.0) + (cond + ((>= 10.0 (ja-aframe-num 0)) + (let ((v0-1 (the-as vector (-> self draw color-emissive)))) + (set! (-> (the-as rgbaf v0-1) x) 0.5) + (set! (-> (the-as rgbaf v0-1) y) 0.25) + (set! (-> (the-as rgbaf v0-1) z) 1.0) + (set! (-> (the-as rgbaf v0-1) w) 1.0) + v0-1 + ) + ) + ((>= 20.0 (ja-aframe-num 0)) + (vector-lerp! + (-> self draw color-emissive) + (new 'static 'vector :x 0.5 :z 1.0 :w 1.0) + (new 'static 'vector :x 0.5 :y 0.25 :z 1.0 :w 1.0) + (lerp-scale 0.0 1.0 (ja-aframe-num 0) 10.0 20.0) + ) + ) + (else + (vector-lerp! + (-> self draw color-emissive) + (new 'static 'vector :x 0.25 :z 1.0 :w 1.0) + (new 'static 'vector :w 1.0) + (lerp-scale 0.0 1.0 (ja-aframe-num 0) 20.0 30.0) + ) + ) + ) + ) + ) + ) + ) + (let* ((s5-3 (get-process *default-dead-pool* manipy #x4000)) + (gp-12 + (when s5-3 + (let ((t9-66 (method-of-type manipy activate))) + (t9-66 (the-as manipy s5-3) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) + ) + (let ((gp-13 run-function-in-process) + (s4-3 s5-3) + (s3-3 manipy-init) + (s2-3 sv-80) + (s1-3 (-> self entity)) + (t0-11 (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f))) + (t1-9 #f) + ) + 0 + ((the-as (function object object object object object object none) gp-13) s4-3 s3-3 s2-3 s1-3 t0-11 t1-9) + ) + (-> s5-3 ppointer) + ) + ) + ) + (when gp-12 + (send-event (ppointer->process gp-12) 'anim-mode 'play1) + (send-event (ppointer->process gp-12) 'anim "idle") + (set-vector! (-> (the-as process-drawable (-> gp-12 0)) root scale) sv-20 0.5 sv-20 1.0) + ) + ) + ) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (target-darkjak-bomb-collide (the-as float (& sv-16)) sv-20) + (set-forward-vel 0.0) + (suspend) + (ja-eval) + ) + (remove-setting! 'music-volume) + (remove-setting! 'sfx-volume) + (remove-setting! 'ambient-volume) + (ja-no-eval :group! (-> self draw art-group data 411) :num! (seek! (ja-aframe 90.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (target-darkjak-bomb-collide (the-as float (& sv-16)) sv-20) + (suspend) + (ja :num! (seek! (ja-aframe 90.0 0))) + ) + (logior! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (send-event (handle->process (-> self notify)) 'notify 'attack 16) + (go target-darkjak-get-off) + (none) + ) + :post target-no-stick-post + ) + +;; (set! (-> *lightning-spec-id-table* 10) (new 'static 'lightning-spec +;; :name "lightning-darkjak-bomb1" +;; :flags (lightning-spec-flags lsf0 size-from-adjust-dist) +;; :adjust-distance #xa +;; :start-color #x80ffffff +;; :end-color #x80ffffff +;; :fade-to-color #x58f00bf +;; :fade-start-factor 0.2 +;; :texture #xc08400 +;; :reduction 0.42 +;; :num-points 96 +;; :box-size 32768.0 +;; :merge-factor 0.2 +;; :merge-count 2 +;; :radius 2048.0 +;; :duration 300.0 +;; :duration-rand 90.0 +;; :sound (static-sound-spec "transform-zap") +;; ) +;; ) + +(defbehavior target-bomb1-fire-shot target ((arg0 (pointer handle)) (arg1 int) (arg2 int) (arg3 int)) + (local-vars (sv-128 target) (sv-144 int) (sv-160 vector) (sv-176 vector) (sv-192 vector)) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (cond + ((and (>= arg1 0) (< arg1 arg2)) + (let ((gp-0 (handle->process (-> arg0 arg1)))) + (when gp-0 + (get-trans (the-as process-focusable gp-0) 3) + (process-spawn + lightning-tracker + :init lightning-tracker-init + (-> *lightning-spec-id-table* 10) + 0 + lightning-probe-callback + gp-0 + 3 + 3 + :to self + ) + (let ((a1-6 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-6 from) (process->ppointer self)) + (set! (-> a1-6 num-params) 2) + (set! (-> a1-6 message) 'attack) + (set! (-> a1-6 param 0) (the-as uint #f)) + (let ((v1-19 (new 'static 'attack-info :mask (attack-info-mask mode id penetrate-using damage)))) + (set! (-> v1-19 id) (the-as uint arg3)) + (set! (-> v1-19 mode) 'ice) + (set! (-> v1-19 damage) 15.0) + (set! (-> v1-19 penetrate-using) (the-as uint (if (and (logtest? (focus-status dark) (-> self focus-status)) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) 32) + ) + #xd0001 + #x50001 + ) + ) + ) + (set! (-> a1-6 param 1) (the-as uint v1-19)) + ) + (send-event-function gp-0 a1-6) + ) + ) + ) + ) + (else + (let ((gp-1 (get-process *default-dead-pool* lightning-tracker #x4000))) + (when gp-1 + (let ((t9-6 (method-of-type lightning-tracker activate))) + (t9-6 + (the-as lightning-tracker gp-1) + self + (symbol->string (-> lightning-tracker symbol)) + (the-as pointer #x70004000) + ) + ) + (let ((s5-1 run-function-in-process) + (s4-1 gp-1) + (s3-0 lightning-tracker-init) + (s2-0 (-> *lightning-spec-id-table* 10)) + (s1-0 0) + (s0-0 lightning-probe-callback) + ) + (set! sv-128 self) + (set! sv-144 3) + (set! sv-192 (new 'stack-no-clear 'vector)) + (set! sv-160 (-> self control trans)) + (set! sv-176 (new 'stack-no-clear 'vector)) + (set! (-> sv-176 x) (rand-vu-float-range -40960.0 40960.0)) + (set! (-> sv-176 y) (rand-vu-float-range -8192.0 8192.0)) + (set! (-> sv-176 z) (rand-vu-float-range -40960.0 40960.0)) + (set! (-> sv-176 w) 1.0) + (.mov.vf vf6 vf0 :mask #b1000) + (.lvf vf4 (&-> sv-160 quad)) + (.lvf vf5 (&-> sv-176 quad)) + (.add.vf vf6 vf4 vf5 :mask #b111) + (.svf (&-> sv-192 quad) vf6) + ((the-as (function object object object object object object object object none) s5-1) + s4-1 + s3-0 + s2-0 + s1-0 + s0-0 + sv-128 + sv-144 + sv-192 + ) + ) + (-> gp-1 ppointer) + ) + ) + ) + ) + (none) + ) + ) + +(defstate target-darkjak-bomb1 (target) + :event (-> target-darkjak-bomb0 event) + :enter (-> target-attack-uppercut-jump enter) + :exit (-> target-darkjak-bomb0 exit) + :trans (behavior () + (if (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (go target-hit-ground #f) + ) + (mod-var-jump #t #t (cpad-hold? (-> self control unknown-cpad-info00 number) x) (-> self control transv)) + (if (and (= (-> self control unknown-symbol04) 'uppercut) + (< (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) -8192.0) + ) + (target-danger-set! 'harmless #f) + ) + (slide-down-test) + (update-clock! (-> self darkjak) 8) + (none) + ) + :code (behavior ((arg0 float) (arg1 float)) + (local-vars + (sv-32 (array collide-shape)) + (sv-40 int) + (sv-48 int) + (sv-56 sphere) + (sv-60 (pointer handle)) + (sv-64 int) + (sv-72 time-frame) + (sv-80 time-frame) + (sv-88 float) + (sv-92 number) + (sv-96 time-frame) + (sv-104 uint) + ) + (logior! (-> self state-flags) (state-flags sf4)) + (set! (-> self neck flex-blend) 0.0) + (set-setting! 'music-volume 'rel 0 0) + (set-setting! 'ambient-volume 'rel 0 0) + (compute-alignment! (-> self align)) + (gui-control-method-16 + *gui-control* + (gui-action play) + (-> self control unknown-sound-id00) + (gui-channel none) + (gui-action none) + (the-as string #f) + (the-as (function gui-connection symbol) #f) + (the-as process #f) + ) + (let ((f0-1 0.9)) + (ja-no-eval :num! (seek! max f0-1)) + ) + (while (not (ja-done? 0)) + (compute-alignment! (-> self align)) + (set! (-> self control unknown-float06) 1.0) + (set! (-> self darkjak clock-vel) -4.0) + (set! (-> self darkjak clock-on) #t) + (align! (-> self align) (align-opts adjust-y-vel) 1.0 1.0 1.0) + (suspend) + (ja-eval) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.5)) + (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) + (let ((gp-0 (-> self post-hook))) + (set! (-> self post-hook) target-no-move-post) + (set! sv-32 (-> self focus-search)) + (set! sv-40 0) + (set! sv-48 0) + (set! sv-56 (the-as sphere (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 3)))) + (set! sv-60 + (new 'static 'array handle 128 + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + ) + ) + (set! (-> sv-56 r) + (if (and (logtest? (focus-status dark) (-> self focus-status)) + (and (nonzero? (-> self darkjak)) (logtest? (-> self darkjak stage) 32)) + ) + 614400.0 + 327680.0 + ) + ) + (set! sv-40 (spatial-hash-method-36 *actor-hash* sv-56 (-> sv-32 data) (-> sv-32 allocated-length))) + (set! (-> sv-32 length) sv-40) + (countdown (s5-0 sv-40) + (let* ((s4-0 (-> sv-32 s5-0 process)) + (v1-53 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + (when (and v1-53 (logtest? (process-mask enemy guard vehicle) (-> v1-53 mask))) + (set! (-> sv-60 sv-48) (process->handle v1-53)) + (set! sv-48 (+ sv-48 1)) + (if (< 128 sv-48) + (set! sv-48 128) + ) + ) + ) + ) + (set! (-> self control unknown-surface00) + (new 'static 'surface + :name 'uppercut + :turnv 524288.0 + :tiltv 32768.0 + :tiltvv 262144.0 + :transv-max 32768.0 + :target-speed 32768.0 + :fric 0.2 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :turnvf 15.0 + :tiltvf 150.0 + :tiltvvf 15.0 + :mode 'air + :flags (surface-flag air attack spin gun-off laser-hide) + ) + ) + (set! sv-64 0) + (set! sv-72 (-> self clock frame-counter)) + (set! sv-80 (-> self clock frame-counter)) + (set! sv-88 (the-as float 0.0)) + (set! sv-92 0.0) + (set! sv-96 (-> self clock frame-counter)) + (let* ((v1-70 (-> self game)) + (a0-33 (+ (-> v1-70 attack-id) 1)) + ) + (set! (-> v1-70 attack-id) a0-33) + (set! sv-104 a0-33) + ) + (ja-channel-push! 2 (seconds 0.05)) + (ja :group! (-> self draw art-group data 419)) + (ja :chan 1 :group! (-> self draw art-group data 420)) + (while (or (< sv-64 sv-48) (< (- (-> self clock frame-counter) sv-80) (seconds 1.5))) + (let ((v1-77 (new-stack-vector0))) + (let ((f0-8 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! v1-77 (-> self control transv) (vector-float*! v1-77 (-> self control dynam gravity-normal) f0-8)) + ) + (let* ((f0-9 (vector-length v1-77)) + (f1-3 f0-9) + (f2-0 0.0) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-0) + (vector-float*! v1-77 v1-77 (/ f0-9 f1-3)) + ) + ) + ) + (set! (-> self darkjak clock-vel) -4.0) + (set! (-> self darkjak clock-on) #t) + (send-event *camera* 'joystick -1098907648 #x3f800000) + (when (>= (- (-> self clock frame-counter) sv-72) (seconds 0.1)) + (set! sv-72 (-> self clock frame-counter)) + (target-bomb1-fire-shot sv-60 sv-64 sv-48 (the-as int sv-104)) + (set! sv-64 (+ sv-64 1)) + (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (set! sv-92 1.0) + ) + ) + (set! sv-88 (seek sv-88 (the-as float sv-92) (* 6.0 (-> self clock seconds-per-frame)))) + (ja :num! (loop!)) + (let ((a0-60 (-> self skel root-channel 1))) + (let ((f0-17 sv-88)) + (set! (-> a0-60 frame-interp 1) f0-17) + (set! (-> a0-60 frame-interp 0) f0-17) + ) + (set! (-> a0-60 param 0) 0.0) + (joint-control-channel-group-eval! a0-60 (the-as art-joint-anim #f) num-func-chan) + ) + (suspend) + ) + 0 + (set! (-> self post-hook) gp-0) + ) + (set! (-> self control unknown-surface00) *double-jump-mods*) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 421) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 421)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (ja-blend-eval) + (compute-alignment! (-> self align)) + (set! (-> self control unknown-float06) 1.0) + (set! (-> self darkjak clock-vel) 4.0) + (suspend) + (ja :num! (seek!)) + ) + (set! (-> self gun surpress-time) (-> self clock frame-counter)) + (send-event (handle->process (-> self notify)) 'notify 'attack 17) + (go target-darkjak-get-off) + (none) + ) + :post target-post + ) + +;; (defstate target-darkjak-giant (target) +;; :event target-standard-event-handler +;; :exit (behavior () +;; (logclear! (-> self state-flags) (state-flags lleg-still rleg-still)) +;; (set! (-> self darkjak-interp) 1.0) +;; (set! (-> self darkjak-giant-interp) (the-as float (-> self control unknown-word04))) +;; (when (= (the-as float (-> self control unknown-word04)) 1.0) +;; (set! (-> self darkjak stage) (logand -33 (-> self darkjak stage))) +;; (set! (-> self darkjak want-stage) (-> self darkjak stage)) +;; ) +;; (none) +;; ) +;; :code (behavior () +;; (send-event (handle->process (-> self notify)) 'notify 'attack 18) +;; (set! (-> self darkjak want-stage) (-> self darkjak stage)) +;; (logior! (-> self state-flags) (state-flags sf4)) +;; (set! (-> self neck flex-blend) 0.0) +;; (set! (-> self control unknown-surface00) *darkjak-trans-mods*) +;; (logior! (-> self darkjak stage) 32) +;; (set! (-> self darkjak want-stage) (-> self darkjak stage)) +;; (sound-play "djak-transform") +;; (let ((gp-1 (new 'stack-no-clear 'collide-query))) +;; (let ((s5-1 (new 'stack-no-clear 'inline-array 'sphere 1))) +;; (dotimes (s4-0 1) +;; ((method-of-type sphere new) (the-as symbol (-> s5-1 s4-0)) sphere) +;; ) +;; (set! (-> s5-1 0 quad) (-> self control trans quad)) +;; (set! (-> s5-1 0 y) (+ 12697.6 (-> s5-1 0 y))) +;; (set! (-> s5-1 0 r) 11878.4) +;; (let ((v1-29 gp-1)) +;; (set! (-> v1-29 spheres) s5-1) +;; (set! (-> v1-29 num-spheres) (the-as uint 1)) +;; (set! (-> v1-29 collide-with) (logclear +;; (-> self control root-prim prim-core collide-with) +;; (collide-spec civilian enemy vehicle-sphere projectile) +;; ) +;; ) +;; (set! (-> v1-29 ignore-process0) #f) +;; (set! (-> v1-29 ignore-process1) #f) +;; (set! (-> v1-29 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) +;; (set! (-> v1-29 best-my-prim) (the-as collide-shape-prim #t)) +;; (set! (-> v1-29 action-mask) (collide-action solid)) +;; ) +;; ) +;; (let ((gp-2 (not (fill-and-probe-using-spheres *collide-cache* gp-1)))) +;; (set! (-> self control unknown-word04) (the-as uint (if gp-2 +;; 2.0 +;; 1.0 +;; ) +;; ) +;; ) +;; (when gp-2 +;; (set-setting! 'string-min-length 'rel #x3fe66666 0) +;; (set-setting! 'string-max-length 'rel #x3fc00000 0) +;; (set-setting! 'string-spline-max-move 'abs #x46000000 0) +;; (set-setting! 'string-spline-accel 'abs #x433851ec 0) +;; (set-setting! 'string-spline-max-move-player 'abs #x45c00000 0) +;; (set-setting! 'string-spline-accel-player 'abs #x430f5c29 0) +;; ) +;; (ja-channel-push! 1 (seconds 0.1)) +;; (ja-no-eval :group! (-> self draw art-group data 412) :num! (seek! (ja-aframe 17.0 0)) :frame-num 0.0) +;; (until (ja-done? 0) +;; (cond +;; (gp-2 +;; (set! (-> self darkjak-giant-interp) (lerp-scale 1.0 2.0 (ja-aframe-num 0) 5.0 15.0)) +;; ) +;; ((>= (ja-aframe-num 0) 10.0) +;; (set! (-> self darkjak-giant-interp) (lerp-scale 2.0 1.0 (ja-aframe-num 0) 5.0 15.0)) +;; ) +;; (else +;; (set! (-> self darkjak-giant-interp) (lerp-scale 1.0 2.0 (ja-aframe-num 0) 5.0 15.0)) +;; ) +;; ) +;; (suspend) +;; (ja :num! (seek! (ja-aframe 17.0 0))) +;; ) +;; ) +;; ) +;; (send-event *traffic-manager* 'increase-alert-level 4) +;; (go target-stance) +;; (none) +;; ) +;; :post (-> target-grab post) +;; ) diff --git a/goal_src/jak2/engine/target/target-gun.gc b/goal_src/jak2/engine/target/target-gun.gc index 8d76b8ae9f..4e81e35f93 100644 --- a/goal_src/jak2/engine/target/target-gun.gc +++ b/goal_src/jak2/engine/target/target-gun.gc @@ -7,3 +7,2966 @@ ;; DECOMP BEGINS +(if (not (nmember "gunp" *kernel-packages*)) + (set! *kernel-packages* (cons "gunp" *kernel-packages*)) + ) + +(define *gun-walk-mods* + (new 'static 'surface + :name 'run + :turnv 18204.445 + :turnvv 72817.78 + :tiltv 65536.0 + :tiltvv 262144.0 + :transv-max 40960.0 + :target-speed 40960.0 + :seek0 1.0 + :seek90 1.0 + :seek180 1.0 + :fric 1.0 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :turnvf 60.0 + :turnvvf 300.0 + :tiltvf 150.0 + :tiltvvf 15.0 + :mult-hook (lambda :behavior target + ((arg0 surface) (arg1 object) (arg2 object) (arg3 int)) + (case arg3 + ((1) + (let* ((f0-0 (deg-diff (y-angle (-> self control)) (vector-y-angle (-> self control unknown-vector08)))) + (f30-0 (lerp-scale 0.0 1.0 (fabs f0-0) 1820.4445 6371.5557)) + ) + (cond + ((and (logtest? (-> self gun track?) 1) + (!= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + (>= (-> self gun track-turnv-range) + (vector-vector-distance (-> self control trans) (-> self gun track-trans)) + ) + ) + (let* ((s5-1 (-> self control)) + (s3-0 (-> self gun track-trans)) + (f0-4 + (deg-diff (y-angle s5-1) (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s3-0 (-> s5-1 trans)))) + ) + ) + (set! (-> self control unknown-float003) (lerp-scale 0.0 2.0 (fabs f0-4) 0.0 3640.889)) + ) + #t + ) + ((< (-> self control unknown-float003) f30-0) + (seek! (-> self control unknown-float003) f30-0 (* 4.0 (-> self clock seconds-per-frame))) + ) + (else + (seek! (-> self control unknown-float003) f30-0 (-> self clock seconds-per-frame)) + ) + ) + ) + (let ((f30-1 131072.0) + (f0-15 30.0) + ) + (when (< 1.0 (-> self control unknown-float003)) + (set! f30-1 (lerp-scale 131072.0 291271.12 (-> self control unknown-float003) 1.0 2.0)) + (set! f0-15 (lerp-scale 30.0 15.0 (-> self control unknown-float003) 1.0 2.0)) + (set! (-> arg0 turnvv) f30-1) + (set! (-> arg0 turnvvf) f0-15) + ) + (set! (-> arg0 turnv) f30-1) + (set! (-> arg0 turnvf) f0-15) + ) + (cond + ((and (nonzero? (-> self gun track-target-hold-time)) + (< (-> self clock frame-counter) (-> self gun track-target-hold-time)) + ) + (set! (-> arg0 turnvv) 0.0) + (set! (-> arg0 turnvvf) 0.0) + (set! (-> arg0 seek0) 0.0) + (set! (-> arg0 seek90) 0.0) + (set! (-> arg0 seek180) 0.0) + (set! (-> arg0 transv-max) 0.0) + ) + ((and (-> self next-state) (= (-> self next-state name) 'target-gun-stance)) + (set! (-> arg0 turnv) 364088.88) + (set! (-> arg0 turnvf) 30.0) + arg0 + ) + ) + ) + ) + ) + :flags (surface-flag look-around no-turn-around) + ) + ) + +(defbehavior target-gun-event-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (cond + ((and (= arg2 'query) (= (-> arg3 param 0) 'mode)) + 'gun + ) + (else + (case arg2 + (('change-mode) + (case (-> arg3 param 0) + (('grab) + (when (not (logtest? (-> self focus-status) (focus-status dead))) + (if (not (-> arg3 param 1)) + #t + (go target-grab 'stance) + ) + ) + ) + (('gun) + (let ((v1-9 (-> arg3 param 2))) + (when (nonzero? v1-9) + (set! (-> self gun using-gun-type) (the-as pickup-type v1-9)) + v1-9 + ) + ) + ) + (('falling) + (go target-falling #f) + ) + (('look-around) + (go target-look-around) + ) + (('normal 'board 'pilot) + (if (and (using-gun? self) (target-gun-end-mode #f)) + (go target-stance) + ) + ) + ) + ) + (else + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + ) + +(defbehavior target-gun-setup target ((arg0 symbol)) + (when (zero? (-> self gun)) + (if (zero? (-> self game gun-type)) + (set! (-> self game gun-type) 2) + ) + (set! (-> self gun) (new 'process 'gun-info)) + (set! (-> self gun process) (the-as (pointer target) (process->ppointer self))) + (set! (-> self gun gun) (the-as (pointer gun) #f)) + (set! (-> self gun active?) #f) + (set! (-> self gun latch?) #f) + (set! (-> self gun put-away?) #f) + (set! (-> self gun charge-active?) (the-as handle #f)) + self + (set! (-> self skel top-anim) (new 'process 'top-anim-joint-control)) + (set! (-> self skel interp-select 0) 0) + (set! (-> self skel interp-select 1) 0) + (quaternion-identity! (the-as quaternion (-> self gun top-anim-twist))) + (set! (-> self gun combo-window-state) #f) + ((method-of-type focus reset-to-collide-spec) + (the-as focus (-> self gun track-target)) + (collide-spec jak player-list) + ) + (reset-to-collide-spec (-> self gun track-target 1) (collide-spec jak player-list)) + (add-connection *pad-engine* self target-gun-marking-menu self #f #f) + ) + (if (not arg0) + (target-gun-end-mode #f) + ) + (when (-> self gun gun) + (deactivate (-> self gun gun 0)) + (set! (-> self gun gun) (the-as (pointer gun) #f)) + ) + (if arg0 + (set! (-> self gun gun) (process-spawn gun :init gun-init :from *8k-dead-pool* :to self)) + ) + 0 + (none) + ) + +(defbehavior target-gun-init target ((arg0 int)) + (let ((gp-0 (-> self gun))) + (if (zero? (-> gp-0 hips)) + (set! (-> gp-0 hips) (new 'process 'joint-mod (joint-mod-mode rotate) self 26)) + ) + (if (zero? (-> gp-0 upper-body)) + (set! (-> gp-0 upper-body) (-> self upper-body)) + ) + (mode-set! (-> gp-0 hips) (joint-mod-mode rotate)) + (set! (-> gp-0 gun-roty) (y-angle (-> self control))) + (top-anim-joint-control-method-9 (-> self skel top-anim)) + (set! (-> self skel top-anim interp) 1.0) + (quaternion-identity! (the-as quaternion (-> self gun top-anim-twist))) + (quaternion-identity! (the-as quaternion (-> self gun top-anim-twist-targ))) + (set! (-> self gun top-anim-twist-reset) (the-as uint 0)) + (set! (-> gp-0 gun-type) (pickup-type eco-yellow)) + (target-gun-type-set! arg0) + (set! (-> gp-0 gun-get-on-time) (-> self clock frame-counter)) + ) + (set! (-> self board latch?) #f) + (set! (-> self gun put-away?) #f) + (set! (-> self gun active?) #f) + (set! (-> self gun surpress-time) 0) + (set! (-> self gun track?) (the-as uint 6)) + (set! (-> self gun track-turn) 0.0) + (set! (-> self gun track-tilt) 0.0) + (set! (-> self gun track-target-hold-time) 0) + (set! (-> self gun turn-fast-hold-time) 0) + ((method-of-type focus reset-to-collide-spec) + (the-as focus (-> self gun track-target)) + (collide-spec jak player-list) + ) + (set! (-> self gun fire-dir-rot) 0.0) + (set! (-> self control unknown-float003) 0.0) + (set! (-> self gun blue-whine-volume) 0.0) + (if (zero? (-> self gun blue-whine-sound-id)) + (set! (-> self gun blue-whine-sound-id) (the-as uint (new-sound-id))) + ) + (set-setting! 'mode-sound-bank 'gun 0 0) + (sound-play "gun-takeout") + (set-setting! 'sound-flava #f #x41f00000 1) + (set! (-> self gun charge-ammo) 0.0) + (set! (-> self gun charge-start-time) 0) + (set! (-> self gun top-anim-tilt-up) 0.0) + (let ((f0-9 (if (or (nonzero? (-> self gun fire-pending)) + (cpad-hold? (-> self control unknown-cpad-info00 number) r1) + (-> self gun latch?) + ) + 2.0 + 1.0 + ) + ) + ) + (cond + ((logtest? (-> self focus-status) (focus-status pilot-riding)) + (case (-> self gun gun-type) + (((pickup-type eco-yellow)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 229) + 0.0 + 0 + 15 + f0-9 + 0.0 + #f + ) + ) + (((pickup-type eco-red)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 198) + 0.0 + 0 + 15 + f0-9 + 0.0 + #f + ) + ) + (((pickup-type eco-blue)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 230) + 0.0 + 0 + 15 + f0-9 + 0.0 + #f + ) + ) + (((pickup-type eco-dark)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 231) + 0.0 + 0 + 15 + f0-9 + 0.0 + #f + ) + ) + ) + ) + (else + (case (-> self gun gun-type) + (((pickup-type eco-yellow)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 265) + 0.0 + 0 + 15 + f0-9 + 0.0 + #f + ) + ) + (((pickup-type eco-red)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 263) + 0.0 + 0 + 15 + f0-9 + 0.0 + #f + ) + ) + (((pickup-type eco-blue)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 266) + 0.0 + 0 + 15 + f0-9 + 0.0 + #f + ) + ) + (((pickup-type eco-dark)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 264) + 0.0 + 0 + 15 + f0-9 + 0.0 + #f + ) + ) + ) + ) + ) + ) + (if (= (-> self control unknown-symbol00) 'duck) + (target-collide-set! (-> self control unknown-symbol00) (-> self control unknown-float000)) + (target-collide-set! 'gun 0.0) + ) + 0 + (none) + ) + +(defun target-gun-exit () + #f + ) + +(defbehavior target-gun-end-mode target ((arg0 symbol)) + (when (using-gun? self) + (set! (-> self gun fire-pending) 0) + (mode-set! (-> self gun hips) (joint-mod-mode flex-blend)) + (send-event *camera* 'clear-slave-option #x58000) + (send-event *camera* 'set-dist #f #f) + (send-event *camera* 'yes-follow) + (let ((v1-16 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-16 command) (sound-command set-param)) + (set! (-> v1-16 id) (the-as sound-id (-> self gun blue-whine-sound-id))) + (set! (-> v1-16 params volume) -4) + (set! (-> v1-16 auto-time) 120) + (set! (-> v1-16 auto-from) 2) + (set! (-> v1-16 params mask) (the-as uint 17)) + (-> v1-16 id) + ) + (set! (-> self gun active?) #f) + (cond + ((and (not (logtest? (surface-flag gun-fast-exit) (-> self control unknown-surface01 flags))) + (zero? (logand (-> self focus-status) (focus-status dead))) + ) + (sound-play "gun-putaway") + (cond + ((logtest? (-> self focus-status) (focus-status pilot-riding)) + (case (-> self gun gun-type) + (((pickup-type eco-yellow)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 229) + 0.0 + 10 + 0 + -1.0 + 0.0 + #f + ) + (set! (-> self skel top-anim frame-post-put-away) (the-as basic #t)) + ) + (((pickup-type eco-red)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 198) + 0.0 + 10 + 0 + -1.0 + 0.0 + #f + ) + (set! (-> self skel top-anim frame-post-put-away) (the-as basic #t)) + ) + (((pickup-type eco-blue)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 230) + 0.0 + 10 + 0 + -1.0 + 0.0 + #f + ) + (set! (-> self skel top-anim frame-post-put-away) (the-as basic #t)) + ) + (((pickup-type eco-dark)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 231) + 0.0 + 10 + 0 + -1.0 + 0.0 + #f + ) + (set! (-> self skel top-anim frame-post-put-away) (the-as basic #t)) + ) + (else + (set! (-> self skel top-anim interp) 0.0) + ) + ) + ) + (else + (case (-> self gun gun-type) + (((pickup-type eco-yellow)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 265) + 0.0 + 10 + 0 + -1.0 + 0.0 + #f + ) + (set! (-> self skel top-anim frame-post-put-away) (the-as basic #t)) + ) + (((pickup-type eco-red)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 263) + 0.0 + 10 + 0 + -1.0 + 0.0 + #f + ) + (set! (-> self skel top-anim frame-post-put-away) (the-as basic #t)) + ) + (((pickup-type eco-blue)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 266) + 14.0 + 10 + 0 + -1.0 + 0.0 + #f + ) + (set! (-> self skel top-anim frame-post-put-away) (the-as basic #t)) + ) + (((pickup-type eco-dark)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 264) + 0.0 + 10 + 0 + -1.0 + 0.0 + #f + ) + (set! (-> self skel top-anim frame-post-put-away) (the-as basic #t)) + ) + (else + (set! (-> self skel top-anim interp) 0.0) + ) + ) + ) + ) + ) + (else + (set! (-> self skel top-anim interp) 0.0) + ) + ) + (set! (-> self gun gun-type) (pickup-type none)) + (remove-setting! 'mode-sound-bank) + (remove-setting! 'sound-flava) + (if (= (-> self control unknown-symbol00) 'duck) + (target-collide-set! (-> self control unknown-symbol00) (-> self control unknown-float000)) + (target-collide-set! 'normal 0.0) + ) + (when arg0 + (set! (-> self gun using-gun-type) (pickup-type none)) + (set! (-> self gun latch?) #f) + (set! (-> self gun put-away?) #f) + ) + #t + ) + ) + +(defun quat<-gun! ((arg0 quaternion) (arg1 quaternion)) + (quaternion-copy! arg0 (the-as quaternion *null-vector*)) + ) + +(defbehavior target-gun-ammo-out-pick target () + (cond + ((and (and (logtest? (-> self game features) (game-feature unk-game-feature-06)) + (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-yellow)) + (-> self game features) + ) + ) + (< 0.0 (-> self game gun-ammo 0)) + ) + 1 + ) + ((and (and (logtest? (-> self game features) (game-feature unk-game-feature-06)) + (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-red)) + (-> self game features) + ) + ) + (< 0.0 (-> self game gun-ammo 1)) + ) + 2 + ) + ((and (and (logtest? (-> self game features) (game-feature unk-game-feature-06)) + (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-blue)) + (-> self game features) + ) + ) + (< 0.0 (-> self game gun-ammo 2)) + ) + 3 + ) + ((and (and (logtest? (-> self game features) (game-feature unk-game-feature-06)) + (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-dark)) + (-> self game features) + ) + ) + (< 0.0 (-> self game gun-ammo 3)) + ) + 4 + ) + (else + 0 + ) + ) + ) + +(defbehavior target-gun-type-set! target ((arg0 int)) + (if (zero? arg0) + (set! arg0 (-> self game gun-type)) + ) + (when (not (logtest? (the-as game-feature (ash 1 (+ arg0 5))) + (logand (-> self game features) (-> *setting-control* user-current features)) + ) + ) + (when (and (logtest? (-> self game features) (game-feature unk-game-feature-06)) + (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-yellow)) + (-> self game features) + ) + ) + (set! arg0 1) + (goto cfg-39) + ) + (when (and (logtest? (-> self game features) (game-feature unk-game-feature-06)) + (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-red)) + (-> self game features) + ) + ) + (set! arg0 2) + (goto cfg-39) + ) + (when (and (logtest? (-> self game features) (game-feature unk-game-feature-06)) + (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-blue)) + (-> self game features) + ) + ) + (set! arg0 3) + (goto cfg-39) + ) + (when (and (logtest? (-> self game features) (game-feature unk-game-feature-06)) + (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-dark)) + (-> self game features) + ) + ) + (set! arg0 4) + (goto cfg-39) + ) + (set! arg0 0) + (label cfg-39) + (cond + ((zero? arg0) + (set! arg0 arg0) + (goto cfg-190) + ) + (else + (empty) + ) + ) + ) + (set! (-> self game gun-type) arg0) + (set! (-> self gun track-turnv-range) 81920.0) + (set! (-> self gun track-tilt-range) 0.0) + (set! (-> self gun track-turn-range) 0.0) + (set! (-> self gun track-turn-max) 1820.4445) + (set! (-> self gun track-tilt-max) 16019.911) + (set! (-> self gun gun-control) (the-as uint 1)) + (set! (-> self gun fire-spin) 0.0) + (set! (-> self gun fire-spinv) 0.0) + (set! (-> self gun fire-time) 0) + (set! (-> self gun laser-active?) #t) + (set! (-> self gun top-anim-gun-height) 5283.84) + (set! (-> self gun top-anim-low-high) 0.0) + (set! (-> self skel top-anim frame-speed) 1.0) + (set! (-> self skel top-anim frame-targ) #f) + (when (using-gun? self) + (let ((s5-0 (-> self gun gun-type))) + (set! (-> self gun gun-type) (the-as pickup-type arg0)) + (set! (-> self gun using-gun-type) (the-as pickup-type arg0)) + (case arg0 + ((3) + (set! (-> self gun gun-control) (the-as uint 4)) + (set! (-> self gun fire-range) 327680.0) + (set! (-> self gun track-find-range) 327680.0) + (set! (-> self gun track-turn-range) 327680.0) + (set! (-> self gun track-turn-max) 910.2222) + (set! (-> self gun track-tilt-range) 327680.0) + (set! (-> self gun track-angle-mult) 1.75) + (set! (-> self gun track-require) (the-as uint 3)) + (set! (-> self gun fire-delay) (the-as uint 15)) + (set! (-> self gun combo-fire-delay) (the-as uint 30)) + (set! (-> self gun track-beam-size) 2457.6) + (remove-setting! 'gun-min-height) + (remove-setting! 'gun-max-height) + ) + ((1) + (set! (-> self gun fire-range) 409600.0) + (set! (-> self gun track-find-range) 286720.0) + (set! (-> self gun track-tilt-range) 409600.0) + (set! (-> self gun track-turn-range) 409600.0) + (set! (-> self gun track-angle-mult) 1.75) + (set! (-> self gun track-require) (the-as uint 3)) + (set! (-> self gun fire-delay) (the-as uint 96)) + (set! (-> self gun combo-fire-delay) (the-as uint 30)) + (set! (-> self gun track-beam-size) 819.2) + (remove-setting! 'gun-min-height) + (remove-setting! 'gun-max-height) + ) + ((2) + (set! (-> self gun fire-range) 61440.0) + (set! (-> self gun track-find-range) 81920.0) + (set! (-> self gun track-tilt-range) 61440.0) + (set! (-> self gun track-turn-range) 61440.0) + (set! (-> self gun track-turn-max) 910.2222) + (set! (-> self gun track-angle-mult) 0.0) + (set! (-> self gun track-require) (the-as uint 3)) + (if (logtest? (-> self game features) (game-feature gun-upgrade-speed)) + (set! (-> self gun fire-delay) (the-as uint 180)) + (set! (-> self gun fire-delay) (the-as uint 330)) + ) + (set! (-> self gun combo-fire-delay) (the-as uint 150)) + (set! (-> self gun track-beam-size) 1228.8) + (remove-setting! 'gun-min-height) + (set-setting! 'gun-max-height 'abs #x46c00000 0) + ) + ((4) + (set! (-> self gun gun-control) (the-as uint 2)) + (set! (-> self gun fire-range) 1638400.0) + (set! (-> self gun track-tilt-range) 1638400.0) + (set! (-> self gun track-turn-range) 1638400.0) + (set! (-> self gun track-find-range) 1638400.0) + (set! (-> self gun track-angle-mult) 1.75) + (set! (-> self gun fire-delay) (the-as uint 255)) + (set! (-> self gun combo-fire-delay) (the-as uint 150)) + (set! (-> self gun track-beam-size) 1228.8) + (set! (-> self gun track-require) (the-as uint 2)) + (remove-setting! 'gun-min-height) + (remove-setting! 'gun-max-height) + ) + ) + (quat<-gun! (the-as quaternion (-> self gun top-anim-twist-targ)) (the-as quaternion arg0)) + (set! (-> self skel top-anim frame-post-blend) 0.1333333) + (cond + ((logtest? (-> self focus-status) (focus-status pilot-riding)) + (let ((v1-164 arg0)) + (cond + ((and (= s5-0 (pickup-type eco-red)) (= v1-164 4)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 225) + 0.0 + 30 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ((and (= s5-0 (pickup-type eco-dark)) (= v1-164 2)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 225) + 0.0 + 30 + 0 + -1.0 + 0.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ((and (= s5-0 (pickup-type eco-red)) (= v1-164 1)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 226) + 0.0 + 30 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ((and (= s5-0 (pickup-type eco-yellow)) (= v1-164 2)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 226) + 0.0 + 30 + 0 + -1.0 + 0.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ((and (= s5-0 (pickup-type eco-red)) (= v1-164 3)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 227) + 0.0 + 30 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ((and (= s5-0 (pickup-type eco-blue)) (= v1-164 2)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 227) + 0.0 + 30 + 0 + -1.0 + 0.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ((and (= s5-0 (pickup-type eco-yellow)) (= v1-164 3)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 228) + 0.0 + 30 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ((and (= s5-0 (pickup-type eco-blue)) (= v1-164 1)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 228) + 0.0 + 30 + 0 + -1.0 + 0.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ((and (= s5-0 (pickup-type eco-dark)) (= v1-164 1)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 226) + 0.0 + 30 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ((and (= s5-0 (pickup-type eco-dark)) (= v1-164 3)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 227) + 0.0 + 30 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ((and (= s5-0 (pickup-type eco-blue)) (= v1-164 4)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 227) + 0.0 + 30 + 0 + -1.0 + 0.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ((and (= s5-0 (pickup-type eco-yellow)) (= v1-164 4)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 226) + 0.0 + 30 + 0 + -1.0 + 0.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ) + ) + ) + (else + (let ((v1-227 arg0)) + (cond + ((and (= s5-0 (pickup-type eco-red)) (= v1-227 4)) + (if (rand-vu-percent? 0.5) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 268) + 0.0 + 30 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 269) + 0.0 + 19 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-2")) + ) + ) + ) + ((and (= s5-0 (pickup-type eco-dark)) (= v1-227 2)) + (if (rand-vu-percent? 0.5) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 268) + 0.0 + 30 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 269) + 0.0 + 19 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-2")) + ) + ) + ) + ((and (= s5-0 (pickup-type eco-dark)) (= v1-227 1)) + (if (rand-vu-percent? 0.5) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 269) + 0.0 + 19 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-2")) + ) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 270) + 0.0 + 19 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-3")) + ) + ) + ) + ((and (= s5-0 (pickup-type eco-red)) (= v1-227 1)) + (if (rand-vu-percent? 0.5) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 269) + 0.0 + 19 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-2")) + ) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 270) + 0.0 + 19 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-3")) + ) + ) + ) + ((and (= s5-0 (pickup-type eco-yellow)) (= v1-227 2)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 268) + 0.0 + 19 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ((and (= s5-0 (pickup-type eco-yellow)) (= v1-227 4)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 268) + 0.0 + 19 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ((and (= s5-0 (pickup-type eco-red)) (= v1-227 3)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 271) + 0.0 + 19 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-4")) + ) + ) + ((and (= s5-0 (pickup-type eco-dark)) (= v1-227 3)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 271) + 0.0 + 19 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-4")) + ) + ) + ((and (= s5-0 (pickup-type eco-blue)) (= v1-227 2)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 272) + 0.0 + 19 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-5")) + ) + ) + ((and (= s5-0 (pickup-type eco-blue)) (= v1-227 4)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 272) + 0.0 + 19 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-5")) + ) + ) + ((and (= s5-0 (pickup-type eco-yellow)) (= v1-227 3)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 271) + 0.0 + 30 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-4")) + ) + ) + ((and (= s5-0 (pickup-type eco-blue)) (= v1-227 1)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 252) + 0.0 + 19 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-6")) + ) + ) + ) + ) + ) + ) + ) + ) + (set! (-> self gun upper-body twist-max x) (-> self gun track-tilt-max)) + (set! (-> self gun upper-body twist-max y) (-> self gun track-turn-max)) + (set! (-> self gun upper-body twist-max z) (-> self gun track-tilt-range)) + (set! (-> self gun upper-body twist-max w) (-> self gun track-turn-range)) + (set! (-> self gun upper-body max-dist) (fmax (-> self gun track-tilt-range) (-> self gun track-turn-range))) + (label cfg-190) + (none) + ) + +(defun target-gun-marking-menu ((arg0 target)) + (when (and (not (paused?)) + (not (and (logtest? (focus-status dark) (-> arg0 focus-status)) (nonzero? (-> arg0 darkjak)))) + (zero? (logand (-> arg0 focus-status) (focus-status grabbed))) + ) + (let ((s5-0 (the-as int (-> arg0 gun using-gun-type)))) + (cond + ((cpad-pressed? (-> arg0 control unknown-cpad-info00 number) down) + (set! s5-0 1) + ) + ((cpad-pressed? (-> arg0 control unknown-cpad-info00 number) up) + (set! s5-0 2) + ) + ((cpad-pressed? (-> arg0 control unknown-cpad-info00 number) left) + (set! s5-0 3) + ) + ((cpad-pressed? (-> arg0 control unknown-cpad-info00 number) right) + (set! s5-0 4) + ) + ) + (when (and (nonzero? s5-0) + (and (logtest? (the-as game-feature (ash 1 (+ s5-0 5))) + (logand (-> arg0 game features) (-> *setting-control* user-current features)) + ) + (or (not (logtest? (focus-status pilot) (-> arg0 focus-status))) + (and (nonzero? (-> arg0 pilot)) (-> arg0 pilot gun?)) + ) + (begin + (set! (-> arg0 gun using-gun-type) (the-as pickup-type s5-0)) + (and s5-0 + (!= s5-0 (-> arg0 gun gun-type)) + (let ((v1-62 (-> arg0 skel top-anim frame-targ))) + (or (not v1-62) + (= v1-62 (-> arg0 draw art-group data 304)) + (= v1-62 (-> arg0 draw art-group data 300)) + (= v1-62 (-> arg0 draw art-group data 305)) + (= v1-62 (-> arg0 draw art-group data 301)) + ) + ) + (not (handle->process (-> arg0 gun charge-active?))) + ) + ) + ) + ) + (cond + ((using-gun? arg0) + (sound-play "select-option") + (send-event arg0 'gun-type s5-0) + ) + ((want-to-gun? arg0 #t) + (send-event arg0 'change-mode 'gun #f s5-0) + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defbehavior target-gun-build-track-list target () + (let ((gp-0 (new 'stack-no-clear 'vector))) + (set! (-> gp-0 quad) (-> self control trans quad)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (let ((s4-0 (-> self gun track-dir))) + (set! (-> s4-0 quad) + (-> (the-as + vector + (if (and (or (= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + (logtest? (surface-flag gun-strafe) (-> self control unknown-surface01 flags)) + ) + (not (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak)))) + ) + (-> self gun fire-dir) + (-> self control unknown-vector08) + ) + ) + quad + ) + ) + (vector-flatten! s4-0 s4-0 (-> self control unknown-matrix01 vector 1)) + (vector-normalize! s4-0 1.0) + (set! (-> gp-0 y) (+ 6144.0 (-> gp-0 y))) + (vector+float*! gp-0 gp-0 s4-0 -32768.0) + (vector+float*! s5-0 gp-0 s4-0 (+ 32768.0 (-> self gun track-find-range))) + ) + (let ((s4-1 (-> self focus-search)) + (s3-0 (vector-average! (new 'stack-no-clear 'vector) gp-0 s5-0)) + ) + (set! (-> s3-0 w) (* 0.5 (vector-vector-distance gp-0 s5-0))) + (set! (-> s4-1 length) + (spatial-hash-method-36 *actor-hash* (the-as sphere s3-0) (-> s4-1 data) (-> s4-1 allocated-length)) + ) + ) + ) + ) + 0 + (none) + ) + +(defbehavior target-gun-find-track target () + (if (logtest? (-> self gun upper-body track-mode) (track-mode lock-on)) + (logior! (-> self gun track?) 8) + (set! (-> self gun track?) (logand -9 (-> self gun track?))) + ) + (let ((gp-0 (the-as basic #f))) + (when (and (or (< (- (-> self clock frame-counter) (-> self control unknown-time-frame29)) (seconds 0.2)) + (and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) + (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + ) + (or (logtest? (surface-flag gun-direct) (-> self control unknown-surface01 flags)) + (= (-> self gun gun-type) (pickup-type eco-dark)) + ) + ) + (>= (-> self clock frame-counter) (-> self gun track-target-hold-time)) + ) + (target-gun-build-track-list) + (let ((t2-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 8)))) + (set! (-> t2-0 y) (+ 2048.0 (-> t2-0 y))) + (cond + ((logtest? (surface-flag gun-strafe) (-> self control unknown-surface01 flags)) + (set! gp-0 (find-nearest-focusable + (-> self focus-search) + (-> self control trans) + (+ 32768.0 (-> self gun track-find-range)) + (search-info-flag crate enemy cull-angle probe check-track prefer-center) + (the-as search-info-flag (-> self gun track-require)) + (-> self gun track-dir) + t2-0 + 10922.667 + ) + ) + ) + ((or (and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) + (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + ) + (logtest? (surface-flag gun-direct) (-> self control unknown-surface01 flags)) + ) + (set! gp-0 (find-nearest-focusable + (-> self focus-search) + (-> self control trans) + (fmin 122880.0 (+ 32768.0 (-> self gun track-find-range))) + (search-info-flag crate enemy cull-angle probe check-track) + (the-as search-info-flag (-> self gun track-require)) + (-> self gun track-dir) + t2-0 + 16384.0 + ) + ) + ) + ((= (-> self gun gun-type) (pickup-type eco-dark)) + (set! gp-0 (find-nearest-focusable + (-> self focus-search) + (-> self control trans) + (+ 32768.0 (-> self gun track-find-range)) + (search-info-flag crate enemy cull-angle check-track prefer-center) + (the-as search-info-flag (-> self gun track-require)) + (-> self gun track-dir) + t2-0 + 5461.3335 + ) + ) + ) + (else + (set! gp-0 (find-nearest-focusable + (-> self focus-search) + (-> self control trans) + (+ 32768.0 (-> self gun track-find-range)) + (search-info-flag crate enemy cull-angle probe check-track prefer-center) + (the-as search-info-flag (-> self gun track-require)) + (-> self gun track-dir) + t2-0 + 5461.3335 + ) + ) + ) + ) + ) + ) + (cond + (gp-0 + (set! (-> self gun track-target-hold-time) 0) + (set! (-> self gun track?) (the-as uint 7)) + (set! (-> self gun track-trans quad) (-> (get-trans (the-as process-focusable gp-0) 3) quad)) + (when ((method-of-type focus try-update-focus) + (the-as focus (-> self gun track-target)) + (the-as process-focusable gp-0) + ) + (set! (-> self gun track-start-time) (-> self clock frame-counter)) + (if (< (- (-> self clock frame-counter) (-> self control unknown-time-frame29)) (seconds 0.2)) + (set! (-> self gun track-press-start-time) (-> self clock frame-counter)) + ) + ) + (if (logtest? (process-mask enemy guard) (-> (the-as process-focusable gp-0) mask)) + (try-update-focus (-> self gun track-target 1) (the-as process-focusable gp-0)) + ) + ) + (else + (let ((s5-1 (handle->process (-> self gun track-target 0 handle)))) + (cond + ((or (not s5-1) + (or (and (logtest? (-> (the-as process-focusable s5-1) focus-status) (focus-status dead)) + (zero? (-> self gun track-target-hold-time)) + ) + (and (not (and (nonzero? (-> self gun track-target-hold-time)) + (< (-> self clock frame-counter) (-> self gun track-target-hold-time)) + ) + ) + (and (not (logtest? (surface-flag spin) (-> self control unknown-surface01 flags))) + (let ((f30-0 21845.334) + (s4-0 (-> self control)) + (s2-0 (-> self gun track-trans)) + ) + (< f30-0 + (fabs + (deg-diff (y-angle s4-0) (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s2-0 (-> s4-0 trans)))) + ) + ) + ) + ) + ) + (and (or (and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) + (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + ) + (logtest? (surface-flag gun-direct) (-> self control unknown-surface01 flags)) + ) + (< 102400.0 (vector-vector-distance (-> self control trans) (-> self gun track-trans))) + (< (vector-dot + (-> self gun track-dir) + (vector-normalize! + (vector-! (new 'stack-no-clear 'vector) (-> self gun track-trans) (-> self control trans)) + 1.0 + ) + ) + 0.5 + ) + ) + (= (send-event (the-as process-focusable s5-1) 'track #t) 'abort) + ) + ) + (set! (-> self gun track?) (the-as uint 6)) + (set! (-> self gun track-target-hold-time) 0) + ((method-of-type focus clear-focused) (the-as focus (-> self gun track-target))) + ) + (else + (let ((a1-21 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-21 from) (process->ppointer self)) + (set! (-> a1-21 num-params) 1) + (set! (-> a1-21 message) 'track) + (set! (-> a1-21 param 0) (the-as uint #f)) + (cond + ((and (not (send-event-function (the-as process-focusable s5-1) a1-21)) + (zero? (-> self gun track-target-hold-time)) + ) + (set! (-> self gun track?) (logand -5 (-> self gun track?))) + (set! (-> self gun track-trans quad) (-> (get-trans (the-as process-focusable s5-1) 3) quad)) + ) + (else + (set! (-> self gun track-trans quad) (-> (get-trans (the-as process-focusable s5-1) 3) quad)) + ) + ) + ) + ) + ) + ) + ) + ) + (let ((s5-2 (handle->process (-> self gun track-target 1 handle)))) + (cond + ((logtest? (surface-flag gun-strafe) (-> self control unknown-surface01 flags)) + (send-event *camera* 'set-slave-option #x8000) + ) + ((the-as process-focusable s5-2) + (let ((s4-5 (get-trans (the-as process-focusable s5-2) 3))) + (let ((s3-1 (new 'stack-no-clear 'vector4w))) + (cond + ((and (logtest? (process-mask enemy guard) (-> s5-2 mask)) (transform-point-qword! s3-1 s4-5)) + (let ((v1-173 (the-as int (+ (/ (the-as int (-> s3-1 x)) 16) -2048)))) + (+ (/ (the-as int (-> s3-1 y)) 16) -2048) + (let ((a0-91 (abs v1-173))) + (cond + ((< a0-91 65) + (send-event *camera* 'set-slave-option #x8000) + ) + ((let ((a0-95 120)) + (set! v1-173 (abs v1-173)) + (< a0-95 v1-173) + ) + (send-event *camera* 'clear-slave-option #x8000) + ) + ) + ) + ) + ) + (else + (send-event *camera* 'clear-slave-option #x8000) + ) + ) + ) + (if (and s5-2 *gun-marks* (!= gp-0 s5-2)) + (add-debug-sphere #t (bucket-id debug-no-zbuf1) s4-5 (-> s4-5 w) (new 'static 'rgba :g #x80 :b #xff :a #x40)) + ) + ) + ) + (else + (send-event *camera* 'clear-slave-option #x8000) + ) + ) + ) + ) + (when (logtest? (-> self gun track?) 1) + (if *gun-marks* + (add-debug-sphere + #t + (bucket-id debug-no-zbuf1) + (-> self gun track-trans) + (-> self gun track-trans w) + (new 'static 'rgba :r #xff :g #xff :a #x40) + ) + ) + (send-event (handle->process (-> self gun track-target 0 handle)) 'tracked) + ) + 0 + (none) + ) + +(defbehavior target-top-anim-base-mode target ((arg0 int)) + (cond + ((logtest? (-> self focus-status) (focus-status pilot-riding)) + (case (-> self gun gun-type) + (((pickup-type eco-yellow)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 220) + 0.0 + arg0 + 0 + 1.0 + 0.0 + #f + ) + ) + (((pickup-type eco-blue)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 221) + 0.0 + arg0 + 0 + 1.0 + 0.0 + #f + ) + ) + (((pickup-type eco-red)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 218) + 0.0 + arg0 + 0 + 1.0 + 0.0 + #f + ) + ) + (((pickup-type eco-dark)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 219) + 0.0 + arg0 + 0 + 1.0 + 0.0 + #f + ) + ) + ) + ) + (else + (case (-> self gun gun-type) + (((pickup-type eco-yellow)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 254) + 0.0 + arg0 + 0 + 1.0 + 0.0 + #f + ) + (set! (-> self gun top-anim-low-high) 1.0) + (if (zero? (-> self gun fire-pending)) + (set! (-> self gun fire-time) (-> self clock frame-counter)) + ) + ) + (((pickup-type eco-blue)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 255) + 0.0 + arg0 + 0 + 1.0 + 0.0 + #f + ) + ) + (((pickup-type eco-red)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 244) + 0.0 + arg0 + 0 + 1.0 + 0.0 + #f + ) + ) + (((pickup-type eco-dark)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 253) + 0.0 + arg0 + 0 + 1.0 + 0.0 + #f + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defbehavior target-gun-combo-start target ((arg0 int) (arg1 time-frame)) + (target-top-anim-base-mode arg0) + (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) arg0)) + (set! (-> self gun track-target-hold-time) (+ (-> self clock frame-counter) arg1)) + 0 + (none) + ) + +(defbehavior target-gun-joint-pre0 target () + (if (!= (zero? (logand (-> self game features) (game-feature unk-game-feature-06))) (not (-> self gun gun))) + (target-gun-setup (logtest? (-> self game features) (game-feature unk-game-feature-06))) + ) + (if (and (>= (- (-> self clock frame-counter) (-> self gun combo-window-start)) (seconds 0.7)) + (zero? (-> self gun fire-pending)) + ) + (set! (-> self gun combo-window-state) #f) + ) + (cond + ((and (cpad-pressed? (-> self control unknown-cpad-info00 number) r1) + (< (- (-> self clock frame-counter) (-> self gun combo-window-start)) (seconds 0.7)) + (not (logtest? (focus-status mech dark) (-> self focus-status))) + (not (logtest? (surface-flag gun-off) (-> self control unknown-surface01 flags))) + (not (logtest? (state-flags sf18) (-> self state-flags))) + (zero? (-> self gun track-target-hold-time)) + ) + (when (send-event self 'gun-combo #f) + (let ((gp-0 (combo-tracker-method-13 + (-> self gun attack-combo) + (the-as handle #f) + (-> self control trans) + 61440.0 + (-> self control unknown-matrix01 vector 2) + 65536.0 + ) + ) + ) + (when gp-0 + (if (not (using-gun? self)) + (send-event self 'change-mode 'gun #f 0) + ) + (combo-tracker-method-12 + (-> self gun attack-combo) + (-> self control trans) + (get-trans (the-as process-focusable gp-0) 3) + (the-as process-focusable gp-0) + (-> self clock frame-counter) + ) + ((method-of-type focus try-update-focus) + (the-as focus (-> self gun track-target)) + (the-as process-focusable gp-0) + ) + (try-update-focus (-> self gun track-target 1) (the-as process-focusable gp-0)) + (set! (-> self gun track-trans quad) (-> (get-trans (the-as process-focusable gp-0) 3) quad)) + (set! (-> self gun track?) (the-as uint 7)) + (if (zero? (-> self gun fire-pending)) + (+! (-> self gun fire-pending) 1) + ) + (set! (-> self gun fire-pending-time) (-> self clock frame-counter)) + (target-gun-combo-start 20 (seconds 0.4)) + (send-event self 'gun-combo #t) + (case (-> self gun combo-window-state) + (('target-attack 'target-running-attack) + (case (-> self gun gun-type) + (((pickup-type eco-red) (pickup-type eco-dark)) + ) + (else + (+! (-> self gun fire-pending) 2) + ) + ) + ) + ) + ) + ) + ) + ) + ((and (cpad-pressed? (-> self control unknown-cpad-info00 number) r1) + (using-gun? self) + (logtest? (surface-flag gun-turn-fast) (-> self control unknown-surface01 flags)) + (not (logtest? (state-flags sf18) (-> self state-flags))) + (zero? (-> self gun track-target-hold-time)) + (or (zero? (-> self gun turn-fast-hold-time)) + (>= (-> self clock frame-counter) (-> self gun turn-fast-hold-time)) + ) + ) + (if (zero? (-> self gun fire-pending)) + (+! (-> self gun fire-pending) 1) + ) + (set! (-> self gun fire-pending-time) (-> self clock frame-counter)) + (target-top-anim-base-mode 60) + (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.2))) + (set! (-> self gun turn-fast-hold-time) (+ (-> self clock frame-counter) (seconds 0.2))) + (send-event self 'gun-combo #t) + ) + ) + (when (and (not (using-gun? self)) (want-to-gun? self #f)) + (let ((gp-2 (nonzero? (-> self gun using-gun-type)))) + (send-event self 'change-mode 'gun #f (-> self gun using-gun-type)) + (when (and (not gp-2) (or (cpad-hold? (-> self control unknown-cpad-info00 number) r1) (-> self gun latch?))) + (if (zero? (-> self gun fire-pending)) + (+! (-> self gun fire-pending) 1) + ) + (set! (-> self gun fire-pending-time) (-> self clock frame-counter)) + ) + ) + ) + (cond + ((using-gun? self) + (when (and (nonzero? (-> self gun top-anim-twist-reset)) + (< (the-as time-frame (-> self gun top-anim-twist-reset)) (-> self clock frame-counter)) + ) + (quat<-gun! (the-as quaternion (-> self gun top-anim-twist-targ)) (the-as quaternion (-> self gun gun-type))) + (set! (-> self gun top-anim-twist-reset) (the-as uint 0)) + 0 + ) + (cond + ((and (= (-> self control unknown-symbol00) 'normal) (!= (-> self control unknown-symbol00) 'duck)) + (target-collide-set! 'gun 0.0) + ) + ((= (-> self control unknown-symbol00) 'gun) + (cond + ((or (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (or (and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) + (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + ) + (< 2048.0 (target-height-above-ground)) + ) + ) + (logtest? (-> self focus-status) (focus-status edge-grab)) + (-> *setting-control* user-current doorway) + ) + (if (!= (-> self control unknown-float31) 0.0) + (target-collide-set! 'gun 0.0) + ) + ) + (else + (when (!= (-> self control unknown-float31) 1.0) + (when (= (-> self control unknown-symbol00) 'gun) + (let ((gp-3 (new 'stack-no-clear 'collide-query)) + (s5-2 (new 'stack-no-clear 'inline-array 'sphere 2)) + ) + (dotimes (s4-1 1) + ((method-of-type sphere new) (the-as symbol (-> s5-2 s4-1)) sphere) + ) + (let ((f30-1 (seek (-> self control unknown-float000) 1.0 (* 0.1 (-> self clock time-adjust-ratio))))) + (set! (-> s5-2 0 quad) (-> self control unknown-sphere-array00 2 prim-core world-sphere quad)) + (set! (-> s5-2 0 r) (lerp-scale (-> *TARGET-bank* body-radius) 7372.8 f30-1 0.0 1.0)) + (let ((v1-212 gp-3)) + (set! (-> v1-212 spheres) s5-2) + (set! (-> v1-212 num-spheres) (the-as uint 1)) + (set! (-> v1-212 collide-with) (-> self control root-prim prim-core collide-with)) + (set! (-> v1-212 ignore-process0) #f) + (set! (-> v1-212 ignore-process1) #f) + (set! (-> v1-212 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1) + ) + (set! (-> v1-212 best-my-prim) (the-as collide-shape-prim #t)) + (set! (-> v1-212 action-mask) (collide-action solid)) + ) + (if (not (fill-and-probe-using-spheres *collide-cache* gp-3)) + (target-collide-set! 'gun f30-1) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (target-gun-find-track) + (cond + ((and (= (-> self gun gun-type) (pickup-type eco-blue)) (zero? (logand (-> self gun track?) 1))) + (let ((f0-8 (vector-vector-distance (-> self gun fire-point) (-> self gun laser-hit-point)))) + (cond + ((< f0-8 122880.0) + (seek! + (-> self gun top-anim-tilt-up) + (lerp-scale -1820.4445 0.0 f0-8 61440.0 122880.0) + (* 5461.3335 (-> self clock seconds-per-frame)) + ) + ) + ((!= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + (seek! (-> self gun top-anim-tilt-up) 0.0 (* 1820.4445 (-> self clock seconds-per-frame))) + ) + ) + ) + (quaternion-rotate-x! + (the-as quaternion (-> self gun top-anim-twist-targ)) + (the-as quaternion *null-vector*) + (-> self gun top-anim-tilt-up) + ) + ) + (else + (set! (-> self gun top-anim-tilt-up) 0.0) + (quat<-gun! (the-as quaternion (-> self gun top-anim-twist-targ)) (the-as quaternion (-> self gun gun-type))) + ) + ) + (quaternion-slerp! + (the-as quaternion (-> self gun top-anim-twist)) + (the-as quaternion (-> self gun top-anim-twist)) + (the-as quaternion (-> self gun top-anim-twist-targ)) + 0.1 + ) + (trs-set! + (-> self upper-body) + (the-as vector #f) + (the-as quaternion (-> self gun top-anim-twist)) + (the-as vector #f) + ) + (cond + ((or (and (nonzero? (-> self gun track-target-hold-time)) + (< (-> self clock frame-counter) (-> self gun track-target-hold-time)) + ) + (and (nonzero? (-> self gun turn-fast-hold-time)) + (< (-> self clock frame-counter) (-> self gun turn-fast-hold-time)) + ) + (and (logtest? (-> self gun track?) 1) (logtest? (-> self gun track?) 4)) + (or (logtest? (surface-flag gun-strafe) (-> self control unknown-surface01 flags)) + (logtest? (-> self focus-status) (focus-status pilot-riding)) + ) + ) + (seek! (-> self upper-body twist z) 0.0 (* 65536.0 (-> self clock seconds-per-frame))) + ) + ((logtest? (surface-flag gun-no-twist) (-> self control unknown-surface01 flags)) + (seek! (-> self upper-body twist z) 0.0 (* 16384.0 (-> self clock seconds-per-frame))) + ) + ((and (< 0.0 (-> self control unknown-float10)) + (zero? (logand (-> self control unknown-surface01 flags) (surface-flag duck))) + ) + (let* ((f0-28 (deg-diff (y-angle (-> self control)) (vector-y-angle (-> self control unknown-vector08)))) + (f0-30 (fmax -5461.3335 (fmin 5461.3335 f0-28))) + ) + (seek! (-> self upper-body twist z) f0-30 (fabs (* 0.2 f0-30))) + ) + ) + ) + (set! (-> (new 'stack-no-clear 'vector) quad) (-> self control trans quad)) + (if (logtest? (surface-flag gun-no-twist) (-> self control unknown-surface01 flags)) + (set! (-> self upper-body flex-blend) 0.0) + (seek! (-> self upper-body flex-blend) 1.0 (* 8.0 (-> self clock seconds-per-frame))) + ) + (when (logtest? (-> self gun track?) 1) + (set! (-> self gun top-anim-look-at quad) (-> self gun track-trans quad)) + (let ((gp-6 (new 'stack-no-clear 'vector))) + (set! (-> gp-6 quad) (-> self gun top-anim-look-at quad)) + (case (-> self gun gun-type) + (((pickup-type eco-yellow)) + (set! (-> gp-6 y) (+ -409.6 (-> gp-6 y))) + ) + (((pickup-type eco-blue)) + (set! (-> gp-6 y) (+ 2457.6 (-> gp-6 y))) + ) + (else + (set! (-> gp-6 y) (+ -1638.4 (-> gp-6 y))) + ) + ) + (if (not (logtest? (surface-flag gun-no-twist) (-> self control unknown-surface01 flags))) + (target-set! (-> self upper-body) gp-6) + ) + (when *gun-marks* + (add-debug-sphere + #t + (bucket-id debug-no-zbuf1) + (-> self gun top-anim-look-at) + (meters 0.2) + (new 'static 'rgba :r #xff :a #x80) + ) + (add-debug-sphere #t (bucket-id debug-no-zbuf1) gp-6 (meters 0.1) (new 'static 'rgba :r #xff :g #xff :a #x80)) + ) + ) + (let ((v1-340 (-> self neck))) + (set! (-> v1-340 blend) 0.0) + ) + ) + (cond + ((and (logtest? (-> self gun track?) 1) + (logtest? (process-mask enemy guard) (-> (handle->process (-> self gun track-target 0 handle)) mask)) + ) + (if (and (< (- (-> self clock frame-counter) (-> self gun track-press-start-time)) (seconds 0.5)) + (< (-> self control unknown-dword12) 150) + (and (= (-> self control unknown-float10) 0.0) + (not (logtest? (-> self control unknown-surface01 flags) (surface-flag air attack))) + (-> self gun active?) + ) + ) + (forward-up-nopitch->quaternion + (-> self control dir-targ) + (vector-! (new 'stack-no-clear 'vector) (-> self gun track-trans) (-> self control trans)) + (vector-y-quaternion! (new-stack-vector0) (-> self control dir-targ)) + ) + ) + (cond + ((or (and (nonzero? (-> self gun track-target-hold-time)) + (< (-> self clock frame-counter) (-> self gun track-target-hold-time)) + ) + (and (nonzero? (-> self gun turn-fast-hold-time)) + (< (-> self clock frame-counter) (-> self gun turn-fast-hold-time)) + ) + ) + (set! (-> self gun track?) (the-as uint 7)) + (set! (-> self gun upper-body twist-max y) 21845.334) + (set! (-> self gun upper-body twist-speed-y) 0.2) + (set! (-> self gun upper-body twist-speed-x) 0.6) + ) + ((and (or (and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) + (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + ) + (logtest? (surface-flag gun-direct) (-> self control unknown-surface01 flags)) + ) + (< (vector-vector-distance (-> self control trans) (-> self gun track-trans)) 81920.0) + ) + (set! (-> self gun upper-body twist-max y) 16384.0) + (set! (-> self gun upper-body twist-speed-y) 0.2) + (set! (-> self gun upper-body twist-speed-x) 0.1) + ) + ((or (= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + (let ((f30-2 10922.667) + (gp-8 deg-diff) + (v1-417 (-> self control)) + (a1-54 (-> self gun track-trans)) + ) + (>= f30-2 + (gp-8 + (vector-y-angle (vector-! (new 'stack-no-clear 'vector) a1-54 (-> v1-417 trans))) + (vector-y-angle (-> self control unknown-vector08)) + ) + ) + ) + ) + (set! (-> self gun upper-body twist-max y) + (lerp-scale + 10922.667 + (-> self gun track-turn-max) + (vector-vector-distance (-> self control trans) (-> self gun track-trans)) + 20480.0 + 61440.0 + ) + ) + (set! (-> self gun upper-body twist-speed-y) + (lerp-scale + 0.3 + 0.1 + (vector-vector-distance (-> self control trans) (-> self gun track-trans)) + 16384.0 + 40960.0 + ) + ) + (set! (-> self gun upper-body twist-speed-x) 0.1) + ) + (else + (set! (-> self gun upper-body twist-max y) (-> self gun track-turn-max)) + (set! (-> self gun upper-body twist-speed-y) 0.1) + (set! (-> self gun upper-body twist-speed-x) 0.1) + ) + ) + ) + (else + (set! (-> self gun upper-body twist-max y) (-> self gun track-turn-max)) + (set! (-> self gun upper-body twist-speed-y) 0.1) + (set! (-> self gun upper-body twist-speed-x) 0.1) + ) + ) + (set! (-> self gun upper-body track-mode) (the-as track-mode (-> self gun track?))) + (when (< (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 1.5)) + (let ((v1-459 (-> self neck))) + (set! (-> v1-459 blend) 0.0) + ) + ) + ) + (else + (seek! (-> self upper-body flex-blend) 0.0 (* 16.0 (-> self clock seconds-per-frame))) + (seek! (-> self upper-body twist z) 0.0 (* 65536.0 (-> self clock seconds-per-frame))) + ) + ) + 0 + (none) + ) + +(defbehavior target-gun-joint-pre target () + (local-vars (gp-0 art-element)) + (target-gun-joint-pre0) + (cond + ((logtest? (-> self focus-status) (focus-status pilot-riding)) + (let ((v1-3 (-> self gun gun-type))) + (set! (-> self skel top-anim base-anim) (cond + ((= v1-3 (pickup-type eco-yellow)) + (-> self draw art-group data 220) + ) + ((= v1-3 (pickup-type eco-red)) + (-> self draw art-group data 218) + ) + ((= v1-3 (pickup-type eco-blue)) + (-> self draw art-group data 221) + ) + (else + (-> self draw art-group data 219) + ) + ) + ) + ) + ) + (else + (let ((v1-14 (-> self gun gun-type))) + (set! gp-0 + (cond + ((= v1-14 (pickup-type eco-yellow)) + (let ((v1-17 (ja-group))) + (cond + ((and (and v1-17 (or (= v1-17 self) (= v1-17 (-> self draw art-group data 261)))) + (< (-> self gun top-anim-low-high) 0.5) + ) + (let ((s5-0 (top-anim-joint-control-method-11 (-> self skel top-anim) 0))) + (set! gp-0 (if (< 0.9 (-> self control unknown-float002)) + (-> self draw art-group data 299) + (-> self draw art-group data 298) + ) + ) + (set! (-> self skel top-anim base-anim-blend) 0.1) + (when (and s5-0 (= (-> s5-0 frame-group) gp-0)) + (set! (-> s5-0 frame-num) (ja-frame-num 0)) + (set! (-> self skel top-anim base-anim-speed) 0.0) + ) + ) + gp-0 + ) + ((< (-> self gun top-anim-low-high) 0.5) + (-> self draw art-group data 245) + ) + (else + (when (and (>= (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 1.5)) + (let ((v1-50 (-> self skel top-anim frame-group))) + (or (= v1-50 (-> self draw art-group data 247)) (= v1-50 (-> self draw art-group data 254))) + ) + ) + (seek! (-> self gun top-anim-low-high) 0.0 (* 6.0 (-> self clock seconds-per-frame))) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 247) + 0.0 + 0 + 60 + (if (< 20480.0 (-> self control unknown-float05)) + 2.0 + 1.0 + ) + 0.0 + #f + ) + ) + (-> self draw art-group data 254) + ) + ) + ) + ) + ((= v1-14 (pickup-type eco-red)) + (let ((v1-67 (ja-group))) + (cond + ((and v1-67 (or (= v1-67 self) (= v1-67 (-> self draw art-group data 12)))) + (let ((s5-1 (top-anim-joint-control-method-11 (-> self skel top-anim) 0))) + (set! gp-0 (if (< 0.9 (-> self control unknown-float002)) + (-> self draw art-group data 299) + (-> self draw art-group data 298) + ) + ) + (set! (-> self skel top-anim base-anim-blend) 0.1) + (when (and s5-1 (= (-> s5-1 frame-group) gp-0)) + (set! (-> s5-1 frame-num) (ja-frame-num 0)) + (set! (-> self skel top-anim base-anim-speed) 0.0) + ) + ) + gp-0 + ) + ((< (-> self gun top-anim-low-high) 0.5) + (-> self draw art-group data 244) + ) + (else + (when (and (or (>= (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 2.5)) + (and (< 4096.0 (-> self control unknown-float05)) + (>= (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 1.25)) + ) + ) + (let ((v1-104 (-> self skel top-anim frame-group))) + (or (= v1-104 (-> self draw art-group data 294)) + (= v1-104 (-> self draw art-group data 295)) + (= v1-104 (-> self draw art-group data 244)) + ) + ) + ) + (seek! (-> self gun top-anim-low-high) 0.0 (* 6.0 (-> self clock seconds-per-frame))) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 295) + 0.0 + 0 + 30 + 1.0 + 0.0 + #f + ) + ) + (-> self draw art-group data 294) + ) + ) + ) + ) + ((= v1-14 (pickup-type eco-blue)) + (let ((v1-119 (ja-group))) + (cond + ((and (and v1-119 (or (= v1-119 self) (= v1-119 (-> self draw art-group data 261)))) + (and (< (-> self gun top-anim-low-high) 0.5) + (>= (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 0.2)) + ) + ) + (let ((s5-2 (top-anim-joint-control-method-11 (-> self skel top-anim) 0))) + (set! gp-0 (if (< 0.9 (-> self control unknown-float002)) + (-> self draw art-group data 262) + (-> self draw art-group data 303) + ) + ) + (set! (-> self skel top-anim base-anim-blend) 0.1) + (when (and s5-2 (= (-> s5-2 frame-group) gp-0)) + (set! (-> s5-2 frame-num) (ja-frame-num 0)) + (set! (-> self skel top-anim base-anim-speed) 0.0) + ) + ) + gp-0 + ) + (else + (-> self draw art-group data 255) + ) + ) + ) + ) + ((let ((v1-150 (ja-group))) + (and v1-150 (or (= v1-150 self) (= v1-150 (-> self draw art-group data 12)))) + ) + (let ((s5-3 (top-anim-joint-control-method-11 (-> self skel top-anim) 0))) + (set! gp-0 (if (< 0.9 (-> self control unknown-float002)) + (-> self draw art-group data 299) + (-> self draw art-group data 298) + ) + ) + (set! (-> self skel top-anim base-anim-blend) 0.1) + (when (and s5-3 (= (-> s5-3 frame-group) gp-0)) + (set! (-> s5-3 frame-num) (ja-frame-num 0)) + (set! (-> self skel top-anim base-anim-speed) 0.0) + ) + ) + gp-0 + ) + (else + (-> self draw art-group data 253) + ) + ) + ) + ) + (set! (-> self skel top-anim base-anim) gp-0) + ) + ) + 0 + (none) + ) + +(defbehavior target-gun-compute-pos target () + (let ((a1-0 (-> self node-list data 24 bone transform)) + (a2-0 (if (-> self sidekick) + (-> self sidekick 0 node-list data 28 bone transform) + (-> self node-list data 24 bone transform) + ) + ) + (gp-0 (new 'stack-no-clear 'matrix)) + ) + (matrix-lerp! gp-0 a1-0 a2-0 (-> self gun gun-daxter)) + (matrix->transformq (-> self gun gun-pos) gp-0) + (set! (-> self gun gun-pos scale quad) (-> self control scale quad)) + (when (and (using-gun? self) (and (logtest? (-> self focus-status) (focus-status edge-grab)) + (let ((v1-18 (ja-group))) + (and v1-18 (or (= v1-18 (-> self draw art-group data 27)) + (= v1-18 (-> self draw art-group data 35)) + (= v1-18 (-> self draw art-group data 33)) + (= v1-18 (-> self draw art-group data 34)) + ) + ) + ) + ) + ) + (let ((s4-0 (new 'static 'vector :y 491.52 :w 1.0)) + (a1-5 (new 'static 'vector :x -16384.0 :z -16384.0 :w 1.0)) + (s5-0 (new 'stack-no-clear 'quaternion)) + ) + (matrix-rotate-xyz! gp-0 a1-5) + (matrix->quaternion s5-0 gp-0) + (vector+! (the-as vector (-> self gun gun-pos)) (-> *edge-grab-info* center-hold) s4-0) + (vector+float*! + (the-as vector (-> self gun gun-pos)) + (the-as vector (-> self gun gun-pos)) + (-> self node-list data 0 bone transform vector 2) + 778.24 + ) + (quaternion-normalize! (quaternion*! (-> self gun gun-pos quat) (-> self control quat) s5-0)) + ) + ) + gp-0 + ) + ) + +(defbehavior target-gun-joint-points target () + (when (-> self gun gun) + (set! (-> self gun gun-daxter) + (if (and (logtest? (-> self focus-status) (focus-status pilot-riding)) + (nonzero? (-> self skel float-channels)) + (= (-> (top-anim-joint-control-method-11 (-> self skel top-anim) (the-as int (+ (-> self skel float-channels) -1))) + frame-interp + 1 + ) + 1.0 + ) + ) + 1.0 + 0.0 + ) + ) + (cond + ((using-gun? self) + (set! (-> self gun gun-roty-targ) (y-angle (-> self control))) + (set! (-> self gun gun-roty) (-> self gun gun-roty-targ)) + (set! (-> self gun gun-roty-rel) 0.0) + (let ((v1-24 (top-anim-joint-control-method-11 (-> self skel top-anim) 0))) + (cond + ((not v1-24) + ) + ((handle->process (-> self gun charge-active?)) + (cond + ((and (= (-> v1-24 frame-group) (-> self draw art-group data 259)) (>= (-> v1-24 frame-num) 8.5)) + (set! (-> v1-24 frame-num) 5.0) + ) + ((and (= (-> v1-24 frame-group) (-> self draw art-group data 224)) (>= (-> v1-24 frame-num) 8.0)) + (set! (-> v1-24 frame-num) 3.0) + ) + ) + ) + ((and (= (-> v1-24 frame-group) (-> self draw art-group data 259)) (< (-> v1-24 frame-num) 9.0)) + (set! (-> v1-24 frame-num) 10.0) + ) + ((and (= (-> v1-24 frame-group) (-> self draw art-group data 224)) (< (-> v1-24 frame-num) 9.0)) + (set! (-> v1-24 frame-num) 9.0) + ) + ) + ) + (set! (-> self gun active?) + (and (not (logtest? (surface-flag gun-inactive gun-hide gun-off) (-> self control unknown-surface01 flags))) + (and (>= (- (-> self clock frame-counter) (-> self gun gun-get-on-time)) (seconds 0.1)) + (>= (-> self clock frame-counter) (-> self gun surpress-time)) + (let ((v1-35 (-> self skel top-anim frame-group)) + (f0-13 (-> self skel top-anim frame-num)) + ) + (and (not (or (= v1-35 (-> self draw art-group data 263)) + (= v1-35 (-> self draw art-group data 266)) + (= v1-35 (-> self draw art-group data 265)) + (= v1-35 (-> self draw art-group data 264)) + (and (-> self draw art-group data 198) + (or (= v1-35 (-> self draw art-group data 198)) + (= v1-35 (-> self draw art-group data 230)) + (= v1-35 (-> self draw art-group data 229)) + (= v1-35 (-> self draw art-group data 231)) + (= v1-35 (-> self draw art-group data 225)) + (= v1-35 (-> self draw art-group data 226)) + (= v1-35 (-> self draw art-group data 227)) + (= v1-35 (-> self draw art-group data 228)) + ) + ) + (and (= v1-35 (-> self draw art-group data 274)) (>= 6.8 f0-13)) + (or (and (= v1-35 (-> self draw art-group data 276)) (>= 6.8 f0-13)) + (= v1-35 (-> self draw art-group data 293)) + (= v1-35 (-> self draw art-group data 296)) + (= v1-35 (-> self draw art-group data 269)) + (= v1-35 (-> self draw art-group data 270)) + (= v1-35 (-> self draw art-group data 268)) + (= v1-35 (-> self draw art-group data 272)) + (= v1-35 (-> self draw art-group data 271)) + (= v1-35 (-> self draw art-group data 289)) + (= v1-35 (-> self draw art-group data 290)) + ) + ) + ) + (let ((v1-40 (-> self skel top-anim frame-group-push))) + (not (or (= v1-40 (-> self draw art-group data 263)) + (= v1-40 (-> self draw art-group data 266)) + (= v1-40 (-> self draw art-group data 265)) + (= v1-40 (-> self draw art-group data 264)) + (and (-> self draw art-group data 198) + (or (= v1-40 (-> self draw art-group data 198)) + (= v1-40 (-> self draw art-group data 230)) + (= v1-40 (-> self draw art-group data 229)) + (= v1-40 (-> self draw art-group data 231)) + (= v1-40 (-> self draw art-group data 225)) + (= v1-40 (-> self draw art-group data 226)) + (= v1-40 (-> self draw art-group data 227)) + (= v1-40 (-> self draw art-group data 228)) + ) + ) + (= v1-40 (-> self draw art-group data 293)) + (= v1-40 (-> self draw art-group data 296)) + (= v1-40 (-> self draw art-group data 269)) + (= v1-40 (-> self draw art-group data 270)) + (= v1-40 (-> self draw art-group data 268)) + (= v1-40 (-> self draw art-group data 272)) + (= v1-40 (-> self draw art-group data 271)) + (= v1-40 (-> self draw art-group data 289)) + (= v1-40 (-> self draw art-group data 290)) + ) + ) + ) + ) + ) + ) + ) + ) + (if (-> self gun active?) + (set! (-> self gun active-time) (-> self clock frame-counter)) + ) + (set! (-> self gun laser-active?) + (zero? (logand (surface-flag gun-inactive gun-hide gun-off laser-hide) (-> self control unknown-surface01 flags)) + ) + ) + (when (and (not (and (not (logtest? (surface-flag gun-inactive gun-hide gun-off) (-> self control unknown-surface01 flags))) + (>= (- (-> self clock frame-counter) (-> self gun gun-get-on-time)) (seconds 0.1)) + (>= (-> self clock frame-counter) (-> self gun surpress-time)) + ) + ) + (and (>= (- (-> self clock frame-counter) (-> self gun fire-pending-time)) (seconds 0.2)) + (>= (- (-> self clock frame-counter) (-> self gun active-time)) (seconds 0.2)) + (= (-> self gun fire-pending) 1) + ) + ) + (set! (-> self gun fire-pending) 0) + 0 + ) + (if (and (or (logtest? (surface-flag gun-hide gun-off) (-> self control unknown-surface01 flags)) + (logtest? (state-flags sf18) (-> self state-flags)) + (let ((v1-75 (-> self gun gun-type))) + (or (and (cond + ((= v1-75 (pickup-type eco-yellow)) + (logtest? (logior (logior (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 0) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 2) + ) + (pad-buttons down) + ) + ) + ((= v1-75 (pickup-type eco-red)) + (logtest? (logior (logior (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 0) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 2) + ) + (pad-buttons up) + ) + ) + ((= v1-75 (pickup-type eco-blue)) + (logtest? (logior (logior (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 0) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 2) + ) + (pad-buttons left) + ) + ) + (else + (logtest? (logior (logior (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 0) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 2) + ) + (pad-buttons right) + ) + ) + ) + (and (not (cpad-hold? (-> self control unknown-cpad-info00 number) r1)) + (not (logtest? (surface-flag gun-inactive) (-> self control unknown-surface01 flags))) + (zero? (logand (-> self focus-status) (focus-status grabbed))) + ) + ) + (-> self gun put-away?) + (not (logtest? (-> self game features) (game-feature unk-game-feature-06))) + (not (logtest? (the-as game-feature (ash 1 (+ (-> self gun gun-type) 5))) + (logand (-> self game features) (-> *setting-control* user-current features)) + ) + ) + (logtest? (focus-status dead dark) (-> self focus-status)) + (-> self board latch?) + ) + ) + ) + (>= (- (-> self clock frame-counter) (-> self gun gun-get-on-time)) (seconds 0.1)) + (let ((v1-110 (-> self skel top-anim frame-targ))) + (or (not v1-110) + (= v1-110 (-> self draw art-group data 304)) + (= v1-110 (-> self draw art-group data 300)) + (= v1-110 (-> self draw art-group data 305)) + (= v1-110 (-> self draw art-group data 301)) + (= v1-110 (-> self draw art-group data 299)) + (= v1-110 (-> self draw art-group data 298)) + (= v1-110 (-> self draw art-group data 262)) + (= v1-110 (-> self draw art-group data 303)) + (logtest? (surface-flag gun-fast-exit) (-> self control unknown-surface01 flags)) + ) + ) + ) + (target-gun-end-mode (zero? (logand (surface-flag gun-hide) (-> self control unknown-surface01 flags)))) + ) + ) + (else + (set! (-> self gun active?) #f) + ) + ) + ) + 0 + (none) + ) + +(defbehavior target-gun-fire target ((arg0 pickup-type)) + (when (using-gun? self) + (let* ((gp-0 (-> self gun)) + (a1-0 (gun->ammo arg0)) + (f0-0 (-> self game gun-ammo (+ a1-0 -13))) + ) + (cond + ((or (< 0.0 f0-0) + (logtest? (state-flags sf16) (-> self state-flags)) + (logtest? (-> self game secrets) (game-secrets endless-ammo)) + ) + (pickup-collectable! (-> self fact) (the-as pickup-type a1-0) -1.0 (the-as handle #f)) + (case (-> gp-0 gun-type) + (((pickup-type eco-blue)) + (cond + ((logtest? (-> self focus-status) (focus-status pilot-riding)) + (let ((v1-15 (top-anim-joint-control-method-11 (-> self skel top-anim) 0))) + (when (not (or (= (-> self skel top-anim frame-group) (-> self draw art-group data 206)) + (and v1-15 (= (-> v1-15 frame-group) (-> self draw art-group data 206))) + ) + ) + (if (< 4096.0 (-> self control unknown-float05)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 207) + 1.0 + 9 + 9 + 1.0 + 0.0 + #f + ) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 207) + 1.0 + 6 + 6 + 1.0 + 0.0 + #f + ) + ) + ) + ) + ) + (else + (let ((v1-32 (top-anim-joint-control-method-11 (-> self skel top-anim) 0))) + (when (not (or (= (-> self skel top-anim frame-group) (-> self draw art-group data 257)) + (and v1-32 (= (-> v1-32 frame-group) (-> self draw art-group data 257))) + ) + ) + (if (< 4096.0 (-> self control unknown-float05)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 258) + 1.0 + 9 + 9 + 1.0 + 0.0 + #f + ) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 258) + 1.0 + 6 + 6 + 1.0 + 0.0 + #f + ) + ) + ) + ) + ) + ) + (target-gun-fire-blue) + ) + (((pickup-type eco-yellow)) + (cond + ((logtest? (-> self focus-status) (focus-status pilot-riding)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 223) + 0.0 + 15 + 0 + 1.0 + 0.0 + #f + ) + ) + ((< (-> self gun top-anim-low-high) 0.5) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 246) + 0.0 + 15 + 0 + 1.0 + 0.0 + #f + ) + (set! (-> self gun top-anim-low-high) 1.0) + ) + (else + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 260) + 0.0 + 0 + 0 + 1.0 + 0.0 + #f + ) + ) + ) + (target-gun-fire-yellow) + ) + (((pickup-type eco-red)) + (let ((f30-0 (if (logtest? (-> self game features) (game-feature gun-upgrade-speed)) + 1.4 + 1.0 + ) + ) + ) + (cond + ((logtest? (-> self focus-status) (focus-status pilot-riding)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 222) + 0.0 + 15 + 0 + (if (= f30-0 1.0) + f30-0 + (* 1.05 f30-0) + ) + 0.0 + #f + ) + ) + ((< 0.5 (-> self gun top-anim-low-high)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 292) + 0.0 + 0 + 15 + f30-0 + 0.0 + #f + ) + (set! (-> self gun top-anim-low-high) 0.0) + ) + ((and (rand-vu-percent? 0.2) (< (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 2))) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 293) + 0.0 + 0 + 15 + (if (logtest? (-> self game features) (game-feature gun-upgrade-speed)) + 1.7 + 1.0 + ) + 0.0 + #f + ) + ) + ((and (or (rand-vu-percent? 0.2) (= (-> self skel top-anim frame-targ) (-> self draw art-group data 256))) + (< (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 2)) + ) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 291) + 0.0 + 0 + 15 + f30-0 + 0.0 + #f + ) + (set! (-> self gun top-anim-low-high) 1.0) + ) + ((logtest? (-> self game features) (game-feature gun-upgrade-speed)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 309) + 0.0 + 0 + 15 + 1.0 + 0.0 + #f + ) + ) + (else + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 256) + 1.0 + 0 + 15 + f30-0 + 0.0 + #f + ) + ) + ) + ) + (target-gun-fire-red) + ) + (((pickup-type eco-dark)) + (if (logtest? (-> self focus-status) (focus-status pilot-riding)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 224) + 0.0 + 0 + 15 + 1.0 + 0.0 + #f + ) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 259) + 0.0 + 0 + 15 + 1.0 + 0.0 + #f + ) + ) + (target-gun-fire-dark) + ) + ) + #t + ) + (else + (let ((v1-149 (target-gun-ammo-out-pick))) + (cond + ((nonzero? v1-149) + (if (nonzero? v1-149) + (set! (-> self gun using-gun-type) (the-as pickup-type v1-149)) + ) + (if (zero? (-> self gun fire-pending)) + (+! (-> self gun fire-pending) 1) + ) + ) + (else + (sound-play "walk-san1") + ) + ) + ) + ) + ) + ) + ) + (none) + ) + +(defbehavior target-gun-check target () + (when (using-gun? self) + (let ((gp-0 (-> self gun))) + (cond + ((and (logtest? (-> self focus-status) (focus-status pilot-riding)) (nonzero? (-> self skel float-channels))) + (set! (-> self skel top-anim interp-select 0) (the-as uint #x800000)) + (set! (-> self skel top-anim interp-select 1) (the-as uint 0)) + 0 + ) + (else + (set! (-> self skel top-anim interp-select 0) (the-as uint #x3ffffc0001fffff0)) + (set! (-> self skel top-anim interp-select 1) (the-as uint 0)) + 0 + ) + ) + (if (not (or (logtest? (-> self focus-status) (focus-status in-head)) (= (-> self gun gun-type) (pickup-type eco-red))) + ) + (gun-info-method-9 gp-0) + ) + (if (and (logtest? (surface-flag spin) (-> self control unknown-surface01 flags)) + (logtest? (-> self control unknown-surface01 flags) (surface-flag air)) + ) + (set! (-> gp-0 combo-window-state) 'target-attack-air) + ) + (if (cpad-pressed? (-> self control unknown-cpad-info00 number) r1) + (set! (-> gp-0 fire-start-time) (-> self clock frame-counter)) + ) + (case (-> gp-0 gun-control) + ((1) + (when (and (cpad-pressed? (-> self control unknown-cpad-info00 number) r1) + (< (the-as time-frame (+ (-> gp-0 fire-delay) -30)) (- (-> self clock frame-counter) (-> gp-0 fire-time))) + ) + (set! (-> gp-0 fire-pending-time) (-> self clock frame-counter)) + (if (zero? (-> self gun fire-pending)) + (+! (-> self gun fire-pending) 1) + ) + (set! (-> gp-0 fire-charge) 0.5) + ) + (when (and (or (>= (- (-> self clock frame-counter) (-> gp-0 fire-time)) (the-as time-frame (-> gp-0 fire-delay))) + (case (-> gp-0 combo-window-state) + (('target-attack-air 'target-attack 'target-running-attack) + (>= (- (-> self clock frame-counter) (-> gp-0 fire-time)) (the-as time-frame (-> gp-0 combo-fire-delay))) + ) + ) + ) + (> (-> gp-0 fire-pending) 0) + (-> self gun active?) + ) + (seekl! (-> self gun fire-pending) 0 1) + (cond + ((send-event self 'gun (-> gp-0 gun-type)) + (set! (-> self gun fire-time) (-> self clock frame-counter)) + ) + (else + (set! (-> self gun fire-time) 0) + 0 + ) + ) + #t + ) + ) + ((2) + (when (and (cpad-hold? (-> self control unknown-cpad-info00 number) r1) + (and (not (handle->process (-> self gun charge-active?))) + (< (the-as time-frame (+ (-> gp-0 fire-delay) -30)) (- (-> self clock frame-counter) (-> gp-0 fire-time))) + ) + ) + (set! (-> gp-0 fire-pending-time) (-> self clock frame-counter)) + (if (zero? (-> self gun fire-pending)) + (+! (-> self gun fire-pending) 1) + ) + (set! (-> gp-0 fire-charge) 0.5) + ) + (when (and (>= (- (-> self clock frame-counter) (-> gp-0 fire-time)) (the-as time-frame (-> gp-0 fire-delay))) + (> (-> gp-0 fire-pending) 0) + (-> self gun active?) + ) + (seekl! (-> self gun fire-pending) 0 1) + (cond + ((send-event self 'gun (-> gp-0 gun-type)) + (set! (-> self gun fire-time) (-> self clock frame-counter)) + ) + (else + (set! (-> self gun fire-time) 0) + 0 + ) + ) + #t + ) + ) + ((4) + (cond + ((cpad-hold? (-> self control unknown-cpad-info00 number) r1) + (seek! (-> gp-0 fire-spinv) 218453.33 (* 145635.56 (-> self clock seconds-per-frame))) + (if (and (nonzero? (-> self gun track-target-hold-time)) + (< (-> self clock frame-counter) (-> self gun track-target-hold-time)) + ) + (set! (-> gp-0 fire-spinv) 218453.33) + ) + ) + (else + (seek! (-> gp-0 fire-spinv) 0.0 (* 109226.664 (-> self clock seconds-per-frame))) + ) + ) + (set! (-> gp-0 fire-spin) + (the float + (sar (shl (the int (+ (-> gp-0 fire-spin) (* (-> gp-0 fire-spinv) (-> self clock seconds-per-frame)))) 48) 48) + ) + ) + (set! (-> gp-0 fire-delay) (the-as uint (the int (lerp-scale 120.0 30.0 (-> gp-0 fire-spinv) 0.0 218453.33)))) + (when (and (>= (-> gp-0 fire-spinv) 218453.33) + (and (or (< 0.0 (-> self game gun-ammo 2)) + (logtest? (state-flags sf16) (-> self state-flags)) + (logtest? (-> self game secrets) (game-secrets endless-ammo)) + ) + (and (-> gp-0 active?) (not (or (= (-> self skel top-anim frame-group) (-> self draw art-group data 257)) + (= (-> self skel top-anim frame-group) (-> self draw art-group data 206)) + ) + ) + ) + ) + ) + (let* ((f0-23 (+ (-> self gun top-anim-blue-cycle) (the float (rand-vu-int-range 1 3)))) + (f0-24 (- f0-23 (* (the float (the int (/ f0-23 4.0))) 4.0))) + ) + (set! (-> self gun top-anim-blue-cycle) f0-24) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (if (logtest? (-> self focus-status) (focus-status pilot-riding)) + (-> self draw art-group data 206) + (-> self draw art-group data 257) + ) + (* 6.0 f0-24) + 0 + 5 + 1.0 + (- 18.0 (* 6.0 f0-24)) + #f + ) + ) + ) + (when (and (cpad-hold? (-> self control unknown-cpad-info00 number) r1) + (-> self gun active?) + (< (the-as time-frame (+ (-> gp-0 fire-delay) -30)) (- (-> self clock frame-counter) (-> gp-0 fire-time))) + ) + (set! (-> gp-0 fire-pending-time) (-> self clock frame-counter)) + (if (zero? (-> self gun fire-pending)) + (+! (-> self gun fire-pending) 1) + ) + (set! (-> gp-0 fire-charge) 0.5) + ) + (when (and (>= (- (-> self clock frame-counter) (-> gp-0 fire-time)) (the-as time-frame (-> gp-0 fire-delay))) + (> (-> gp-0 fire-pending) 0) + (-> self gun active?) + ) + (seekl! (-> self gun fire-pending) 0 1) + (cond + ((send-event self 'gun (-> gp-0 gun-type)) + (set! (-> self gun fire-time) (-> self clock frame-counter)) + ) + (else + (set! (-> self gun fire-time) 0) + 0 + ) + ) + #t + ) + ) + ) + (case (-> gp-0 gun-type) + (((pickup-type eco-blue)) + (set! (-> gp-0 blue-whine-volume) (* 0.000004577637 (-> gp-0 fire-spinv))) + (sound-play-by-name + (static-sound-name "blue-gun-whine") + (the-as sound-id (-> gp-0 blue-whine-sound-id)) + (the int (* 1024.0 (fmin 1.0 (* 2.0 (-> gp-0 blue-whine-volume))))) + (the int (* 1524.0 (lerp-scale -0.9 0.5 (-> gp-0 blue-whine-volume) 0.0 1.0))) + 0 + (sound-group sfx) + #t + ) + ) + (else + (when (!= (-> gp-0 blue-whine-volume) 0.0) + (let ((v1-245 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-245 command) (sound-command set-param)) + (set! (-> v1-245 id) (the-as sound-id (-> gp-0 blue-whine-sound-id))) + (set! (-> v1-245 params volume) -4) + (set! (-> v1-245 auto-time) 120) + (set! (-> v1-245 auto-from) 2) + (set! (-> v1-245 params mask) (the-as uint 17)) + (-> v1-245 id) + ) + (set! (-> gp-0 blue-whine-volume) 0.0) + ) + ) + ) + (set! (-> gp-0 gun-time) (-> self clock frame-counter)) + ) + ) + 0 + (none) + ) + +(defun camera-rotate-to-vector ((arg0 vector) (arg1 vector)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 quad) (-> arg0 quad)) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (set! (-> s4-0 quad) (-> (camera-matrix) vector 2 quad)) + (vector-flatten! s5-0 s5-0 arg1) + (vector-normalize! s5-0 1.0) + (vector-flatten! s4-0 s4-0 arg1) + (vector-normalize! s4-0 1.0) + (let ((f30-0 (vector-y-angle s5-0)) + (f0-0 (vector-y-angle s4-0)) + ) + (send-event *camera* 'joystick (fmax -1.0 (fmin 1.0 (* 0.00018310547 (deg-diff f0-0 f30-0)))) 1.0) + ) + ) + ) + (none) + ) + +(defbehavior target-gun-real-post target () + (let ((f30-0 (-> self clock clock-ratio))) + (let ((gp-1 (max 1 (the int (-> self clock time-adjust-ratio))))) + (update-rates! (-> self clock) (/ f30-0 (the float gp-1))) + (while (nonzero? gp-1) + (+! gp-1 -1) + (set! (-> self control unknown-word07) gp-1) + (flag-setup) + (build-conversions (-> self control transv)) + (do-rotations1) + (let ((s4-0 (new-stack-vector0))) + (read-pad s4-0) + (turn-to-vector s4-0 (debounce-speed + (-> self control unknown-float12) + (-> self control unknown-float13) + (-> self control unknown-vector12) + (-> self control unknown-vector13) + ) + ) + ) + (add-thrust) + (add-gravity) + (do-rotations2) + (reverse-conversions (-> self control transv)) + (pre-collide-setup) + (when *debug-segment* + (let ((s5-1 (-> *display* frames (-> *display* on-screen) profile-array data 0)) + (v1-20 'target) + (s4-1 *profile-target-color*) + ) + (when (and *dproc* *debug-segment*) + (let ((s3-0 (-> s5-1 data (-> s5-1 count)))) + (let ((s2-0 (-> s5-1 base-time))) + (set! (-> s3-0 name) v1-20) + (set! (-> s3-0 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s2-0)))) + ) + (set! (-> s3-0 depth) (the-as uint (-> s5-1 depth))) + (set! (-> s3-0 color) s4-1) + (set! (-> s5-1 segment (-> s5-1 depth)) s3-0) + ) + (+! (-> s5-1 count) 1) + (+! (-> s5-1 depth) 1) + (set! (-> s5-1 max-depth) (max (-> s5-1 max-depth) (-> s5-1 depth))) + ) + ) + 0 + ) + (let ((a2-1 (new 'stack-no-clear 'collide-query)) + (v1-33 (-> self control)) + ) + (set! (-> a2-1 collide-with) (-> v1-33 root-prim prim-core collide-with)) + (set! (-> a2-1 ignore-process0) self) + (set! (-> a2-1 ignore-process1) #f) + (set! (-> a2-1 ignore-pat) (-> v1-33 pat-ignore-mask)) + (set! (-> a2-1 action-mask) (collide-action solid)) + (collide-shape-method-32 v1-33 (-> v1-33 transv) a2-1 (meters 1)) + ) + (if (and (logtest? (-> self control root-prim prim-core action) (collide-action check-edge)) + (>= (vector-dot + (-> self control dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> self control trans) (-> self control gspot-pos)) + ) + (-> *TARGET-bank* edge-grab-height-off-ground) + ) + ) + (target-method-27 *target* *collide-cache* *collide-edge-spec*) + ) + (when *debug-segment* + (let ((s5-2 (-> *display* frames (-> *display* on-screen) profile-array data 0))) + (when (and *dproc* *debug-segment*) + (let* ((v1-60 (+ (-> s5-2 depth) -1)) + (s4-2 (-> s5-2 segment v1-60)) + (s3-1 (-> s5-2 base-time)) + ) + (when (>= v1-60 0) + (set! (-> s4-2 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s3-1)))) + (+! (-> s5-2 depth) -1) + ) + ) + ) + ) + 0 + ) + (bend-gravity) + (post-flag-setup) + ) + ) + (update-rates! (-> self clock) f30-0) + ) + (when *debug-segment* + (let ((gp-2 (-> *display* frames (-> *display* on-screen) profile-array data 0)) + (v1-77 'target-post) + (s5-3 *profile-target-post-color*) + ) + (when (and *dproc* *debug-segment*) + (let ((s4-3 (-> gp-2 data (-> gp-2 count)))) + (let ((s3-2 (-> gp-2 base-time))) + (set! (-> s4-3 name) v1-77) + (set! (-> s4-3 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s3-2)))) + ) + (set! (-> s4-3 depth) (the-as uint (-> gp-2 depth))) + (set! (-> s4-3 color) s5-3) + (set! (-> gp-2 segment (-> gp-2 depth)) s4-3) + ) + (+! (-> gp-2 count) 1) + (+! (-> gp-2 depth) 1) + (set! (-> gp-2 max-depth) (max (-> gp-2 max-depth) (-> gp-2 depth))) + ) + ) + 0 + ) + (ja-post) + (when *debug-segment* + (let ((gp-3 (-> *display* frames (-> *display* on-screen) profile-array data 0))) + (when (and *dproc* *debug-segment*) + (let* ((v1-101 (+ (-> gp-3 depth) -1)) + (s5-4 (-> gp-3 segment v1-101)) + (s4-4 (-> gp-3 base-time)) + ) + (when (>= v1-101 0) + (set! (-> s5-4 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s4-4)))) + (+! (-> gp-3 depth) -1) + ) + ) + ) + ) + 0 + ) + (joint-points) + (do-target-gspot) + (target-powerup-process) + (none) + ) + +(defbehavior target-gun-post target () + (target-gun-real-post) + (none) + ) diff --git a/goal_src/jak2/engine/target/target-h.gc b/goal_src/jak2/engine/target/target-h.gc index bbbacf4edb..d2411b16bc 100644 --- a/goal_src/jak2/engine/target/target-h.gc +++ b/goal_src/jak2/engine/target/target-h.gc @@ -6,6 +6,7 @@ ;; dgos: ENGINE, GAME (declare-type sidekick process-drawable) +(declare-type gun process-drawable) (declare-type racer-info basic) (declare-type tube-info basic) (declare-type flut-info basic) @@ -13,6 +14,7 @@ (declare-type pilot-info basic) (declare-type gun-info basic) (declare-type darkjak-info basic) +(declare-type sparticle-launcher basic) ;; NOTE - for level-info, defined in `logic-target` (define-extern start (function symbol continue-point target)) @@ -22,7 +24,7 @@ (define-extern target-darkjak-get-on (state int target)) (define-extern target-darkjak-running-attack (state target)) (define-extern target-darkjak-bomb0 (state target)) -(define-extern target-darkjak-bomb1 (state target)) +(define-extern target-darkjak-bomb1 (state float float target)) (define-extern can-feet? (function symbol symbol :behavior target)) (define-extern target-attack-air (state symbol target)) (define-extern target-hit-ground (state symbol target)) @@ -44,7 +46,7 @@ (define-extern target-running-attack (state target)) (define-extern target-gun-stance (state target)) (define-extern target-carry-pickup (state target)) -(define-extern fall-test (function state float none :behavior target)) +(define-extern fall-test (function (state symbol target) float none :behavior target)) (define-extern target-falling (state symbol target)) (define-extern target-stance-anim (function none :behavior target)) (define-extern target-effect-exit (function none :behavior target)) @@ -81,10 +83,10 @@ (define-extern target-hit-ground-anim (function symbol symbol :behavior target)) (define-extern are-still? (function symbol :behavior target)) (define-extern *attack-end-mods* surface) -(define-extern target-send-attack (function process uint uint int int symbol :behavior target)) +(define-extern target-send-attack (function process uint uint int int uint symbol :behavior target)) (define-extern target-dangerous-event-handler (function process int symbol event-message-block object :behavior target)) (define-extern target-start-attack (function none :behavior target)) -(define-extern target-danger-set! (function symbol symbol float :behavior target)) +(define-extern target-danger-set! (function symbol symbol none :behavior target)) (define-extern smack-surface? (function symbol symbol :behavior target)) (define-extern target-height-above-ground (function float :behavior target)) (define-extern target-align-vel-z-adjust (function float float :behavior target)) @@ -104,11 +106,41 @@ (define-extern target-shoved (function meters meters process (state object object target) object :behavior target)) (define-extern target-roll-flip (state float float target)) +;; target-util +(define-extern target-move-dist (function time-frame float :behavior target)) +(define-extern target-slide-down (state target)) +(define-extern get-intersect-point (function vector touching-prims-entry collide-shape touching-shapes-entry vector)) + +;; target-swim +(define-extern target-swim-jump (state float float target)) +(define-extern target-swim-jump-jump (state float float surface target)) + +;; target-darkjak +(define-extern target-darkjak-get-off (state target)) +(define-extern set-darkjak-texture-morph! (function float none)) +(define-extern process-drawable-random-point! (function process-drawable vector vector)) +(define-extern process-drawable-shock-wall-effect (function process-drawable lightning-spec (function lightning-tracker none) sparticle-launcher int int float none)) +(define-extern target-grab (state symbol target)) +(define-extern target-darkjak-giant (state target)) +(define-extern target-falling-anim-trans (function none :behavior target)) +(define-extern ja-blend-eval (function int :behavior process-drawable)) + +;; target-gun +(define-extern target-look-around (state target)) +(define-extern target-gun-end-mode (function symbol symbol :behavior target)) +(define-extern target-gun-marking-menu (function target none)) +(define-extern gun-init (function none :behavior gun)) +(define-extern target-gun-type-set! (function int none :behavior target)) +(define-extern target-gun-fire-blue (function none :behavior target)) +(define-extern target-gun-fire-yellow (function none :behavior target)) +(define-extern target-gun-fire-red (function none :behavior target)) +(define-extern target-gun-fire-dark (function none :behavior target)) + ;; DECOMP BEGINS (deftype target (process-focusable) ((control control-info :offset 128) - (skel2 basic :offset-assert 204) + (skel2 joint-control :offset-assert 204) (shadow-backup shadow-geo :offset-assert 208) (target-flags uint32 :offset 188) (game game-info :offset-assert 212) @@ -143,7 +175,7 @@ (excitement float :offset-assert 2052) (shock-effect-time time-frame :offset-assert 2056) (beard? symbol :offset-assert 2064) - (spool-anim symbol :offset-assert 2068) + (spool-anim spool-anim :offset-assert 2068) (ambient-time time-frame :offset-assert 2072) (fp-hud handle :offset-assert 2080) (no-load-wait uint64 :offset-assert 2088) diff --git a/goal_src/jak2/engine/target/target-swim.gc b/goal_src/jak2/engine/target/target-swim.gc index 7b519373e6..96c0376b86 100644 --- a/goal_src/jak2/engine/target/target-swim.gc +++ b/goal_src/jak2/engine/target/target-swim.gc @@ -7,3 +7,1089 @@ ;; DECOMP BEGINS +(defstate target-wade-stance (target) + :event target-standard-event-handler + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self control unknown-surface00) *wade-mods*) + (set-zero! (-> self water bob)) + (none) + ) + :exit (behavior () + (target-state-hook-exit) + (target-exit) + (let ((v1-1 (-> self skel effect))) + (set! (-> v1-1 channel-offset) 0) + ) + 0 + (none) + ) + :trans (behavior () + ((-> self state-hook)) + (when (and (not (logtest? (water-flags wading) (-> self water flags))) + (>= (- (-> self clock frame-counter) (-> self water wade-time)) (seconds 0.05)) + ) + (if (logtest? (water-flags swimming) (-> self water flags)) + (go target-swim-stance) + (go target-stance) + ) + ) + (if (and (cpad-hold? (-> self control unknown-cpad-info00 number) l1) (can-duck?)) + (go target-duck-stance #f) + ) + (if (!= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + (go target-wade-walk) + ) + (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 0) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (target-jump-go) + ) + (when (and (cpad-pressed? (-> self control unknown-cpad-info00 number) circle) (can-feet? #t)) + (sound-play "swim-stroke") + (spawn-ripples (-> self water) 1.4 (-> self control trans) 0 (-> self control transv) #f) + (go target-attack) + ) + (if (and (cpad-pressed? (-> self control unknown-cpad-info00 number) square) (can-hands? #t)) + (go target-running-attack) + ) + (if (and (using-gun? self) (let ((v1-79 (ja-group))) + (and v1-79 (= v1-79 (-> self draw art-group data 5))) + ) + ) + (go target-gun-stance) + ) + (none) + ) + :code (-> target-stance code) + :post target-post + ) + +(defstate target-wade-walk (target) + :event target-standard-event-handler + :enter (behavior () + ((-> target-wade-stance enter)) + (none) + ) + :exit (-> target-wade-stance exit) + :trans (behavior () + ((-> self state-hook)) + (when (and (not (logtest? (water-flags wading) (-> self water flags))) + (>= (- (-> self clock frame-counter) (-> self water wade-time)) (seconds 0.1)) + ) + (if (logtest? (water-flags swimming) (-> self water flags)) + (go target-swim-stance) + (go target-stance) + ) + ) + (if (= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + (go target-wade-stance) + ) + (if (and (cpad-hold? (-> self control unknown-cpad-info00 number) l1) (can-duck?)) + (go target-duck-walk #f) + ) + (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 0) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (target-jump-go) + ) + (when (and (cpad-pressed? (-> self control unknown-cpad-info00 number) circle) (can-feet? #t)) + (sound-play "swim-stroke") + (spawn-ripples (-> self water) 1.4 (-> self control trans) 0 (-> self control transv) #f) + (go target-attack) + ) + (if (and (cpad-pressed? (-> self control unknown-cpad-info00 number) square) (can-hands? #t)) + (go target-running-attack) + ) + (none) + ) + :code (behavior () + (let ((gp-0 105) + (f30-0 0.0) + ) + (let ((v1-2 (ja-group))) + (cond + ((and v1-2 (or (= v1-2 (-> self draw art-group data 12)) (= v1-2 (-> self draw art-group data 7)))) + (set! gp-0 15) + (set! f30-0 (ja-frame-num 0)) + ) + ((let ((v1-9 (ja-group))) + (and v1-9 (or (= v1-9 (-> self draw art-group data 23)) (= v1-9 (-> self draw art-group data 27)))) + ) + (set! gp-0 30) + ) + ((let ((v1-16 (ja-group))) + (and v1-16 (= v1-16 (-> self draw art-group data 97))) + ) + (set! gp-0 120) + ) + ) + ) + (cond + ((and (= (ja-group-size) 6) (let ((v1-25 (ja-group))) + (and v1-25 (= v1-25 (-> self draw art-group data 94))) + ) + ) + ) + (else + (ja-channel-push! 6 (the-as time-frame gp-0)) + (ja :group! (-> self draw art-group data 94) + :num! (identity f30-0) + :dist (-> *TARGET-bank* wade-shallow-walk-cycle-dist) + ) + (ja :chan 1 + :group! (-> self draw art-group data 95) + :num! (identity f30-0) + :dist (-> *TARGET-bank* wade-deep-walk-cycle-dist) + ) + (let ((gp-3 (-> self skel root-channel 2))) + (let ((f0-2 0.0)) + (set! (-> gp-3 frame-interp 1) f0-2) + (set! (-> gp-3 frame-interp 0) f0-2) + ) + (set! (-> gp-3 dist) (-> *TARGET-bank* walk-cycle-dist)) + (joint-control-channel-group-eval! + gp-3 + (the-as art-joint-anim (-> self draw art-group data 12)) + num-func-identity + ) + (set! (-> gp-3 frame-num) f30-0) + ) + (let ((gp-4 (-> self skel root-channel 3))) + (let ((f0-4 0.0)) + (set! (-> gp-4 frame-interp 1) f0-4) + (set! (-> gp-4 frame-interp 0) f0-4) + ) + (set! (-> gp-4 dist) (-> *TARGET-bank* walk-down-cycle-dist)) + (joint-control-channel-group-eval! + gp-4 + (the-as art-joint-anim (-> self draw art-group data 14)) + num-func-identity + ) + (set! (-> gp-4 frame-num) f30-0) + ) + (let ((gp-5 (-> self skel root-channel 4))) + (let ((f0-6 0.0)) + (set! (-> gp-5 frame-interp 1) f0-6) + (set! (-> gp-5 frame-interp 0) f0-6) + ) + (set! (-> gp-5 dist) (-> *TARGET-bank* walk-side-cycle-dist)) + (joint-control-channel-group-eval! + gp-5 + (the-as art-joint-anim (-> self draw art-group data 16)) + num-func-identity + ) + (set! (-> gp-5 frame-num) f30-0) + ) + ) + ) + ) + (set! (-> self skel root-channel 2 command) (joint-control-command push)) + (set! (-> self skel root-channel 5 command) (joint-control-command stack)) + (let ((f28-0 0.0) + (f26-0 0.0) + (f30-1 (lerp-scale 1.0 0.0 (-> self control unknown-float05) 16384.0 32768.0)) + (gp-6 0) + ) + (until #f + (let ((f0-10 (fmax -1.0 (fmin 1.0 (* 2.0 (-> self control unknown-float17))))) + (f24-0 (fmax -1.0 (fmin 1.0 (* 1.6 (-> self control unknown-float18))))) + ) + (let ((f1-4 (fabs (- f0-10 f28-0)))) + (set! f28-0 (seek f28-0 f0-10 (fmax 0.05 (fmin 0.2 (* 0.25 f1-4))))) + ) + (let ((f0-14 (fabs (- f24-0 f26-0)))) + (set! f26-0 (seek f26-0 f24-0 (fmax 0.05 (fmin 0.2 (* 0.25 f0-14))))) + ) + ) + (ja :chan 3 :group! (-> self draw art-group data 14) :dist (-> *TARGET-bank* walk-down-cycle-dist)) + (cond + ((>= f28-0 0.0) + (let ((v1-83 (-> self skel root-channel 3))) + (let ((f0-20 (fabs f28-0))) + (set! (-> v1-83 frame-interp 1) f0-20) + (set! (-> v1-83 frame-interp 0) f0-20) + ) + (set! (-> v1-83 dist) (-> *TARGET-bank* walk-up-cycle-dist)) + (set! (-> v1-83 frame-group) (the-as art-joint-anim (-> self draw art-group data 13))) + ) + ) + (else + (let ((v1-86 (-> self skel root-channel 3))) + (let ((f0-22 (fabs f28-0))) + (set! (-> v1-86 frame-interp 1) f0-22) + (set! (-> v1-86 frame-interp 0) f0-22) + ) + (set! (-> v1-86 dist) (-> *TARGET-bank* walk-down-cycle-dist)) + (set! (-> v1-86 frame-group) (the-as art-joint-anim (-> self draw art-group data 14))) + ) + ) + ) + (cond + ((>= f26-0 0.0) + (let ((v1-89 (-> self skel root-channel 4))) + (let ((f0-25 (fabs f26-0))) + (set! (-> v1-89 frame-interp 1) f0-25) + (set! (-> v1-89 frame-interp 0) f0-25) + ) + (set! (-> v1-89 dist) (-> *TARGET-bank* walk-side-cycle-dist)) + (set! (-> v1-89 frame-group) (the-as art-joint-anim (-> self draw art-group data 15))) + ) + ) + (else + (let ((v1-92 (-> self skel root-channel 4))) + (let ((f0-27 (fabs f26-0))) + (set! (-> v1-92 frame-interp 1) f0-27) + (set! (-> v1-92 frame-interp 0) f0-27) + ) + (set! (-> v1-92 dist) (-> *TARGET-bank* walk-side-cycle-dist)) + (set! (-> v1-92 frame-group) (the-as art-joint-anim (-> self draw art-group data 16))) + ) + ) + ) + (let* ((f0-30 (- (-> self water height) (-> self control trans y))) + (f24-1 + (lerp-scale + 0.0 + 1.0 + f0-30 + (lerp (-> self water wade-height) (-> self water swim-height) 0.25) + (lerp (-> self water wade-height) (-> self water swim-height) 0.75) + ) + ) + ) + (let ((v1-100 (-> self skel effect))) + (set! (-> v1-100 channel-offset) (if (< 0.5 f24-1) + 1 + 0 + ) + ) + ) + 0 + (set! f30-1 + (seek + f30-1 + (lerp-scale 1.0 0.0 (-> self control unknown-float05) 16384.0 32768.0) + (* 4.0 (-> self clock seconds-per-frame)) + ) + ) + (let ((v1-107 (-> self skel root-channel 1))) + (set! (-> v1-107 frame-interp 1) f24-1) + (set! (-> v1-107 frame-interp 0) f24-1) + ) + (ja :num! (loop! + (/ (-> self control unknown-float05) + (* 60.0 + (/ (* (current-cycle-distance (-> self skel)) (-> self control scale x)) (-> *TARGET-bank* run-cycle-length)) + ) + ) + ) + ) + (let ((s5-3 (-> self skel root-channel 5)) + (f0-44 (lerp f30-1 0.0 f24-1)) + ) + (set! (-> s5-3 frame-interp 1) f0-44) + (set! (-> s5-3 frame-interp 0) f0-44) + ) + ) + (ja :chan 1 :num! (chan 0)) + (ja :chan 2 :num! (chan 0)) + (ja :chan 3 :num! (chan 0)) + (ja :chan 4 :num! (chan 0)) + (when (and (>= (- (-> self clock frame-counter) (the-as time-frame gp-6)) (seconds 0.2)) + (< (- (-> self water height) (-> self control trans y)) 4096.0) + ) + (case (the int (ja-aframe-num 0)) + ((15 16 17 18) + (spawn-ripples + (-> self water) + 0.2 + (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 39)) + 0 + (vector-float*! (new 'stack-no-clear 'vector) (-> self control transv) 2.5) + #f + ) + (set! gp-6 (the-as int (-> self clock frame-counter))) + ) + ((46 47 48 49) + (spawn-ripples + (-> self water) + 0.2 + (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 32)) + 0 + (vector-float*! (new 'stack-no-clear 'vector) (-> self control transv) 2.5) + #f + ) + (set! gp-6 (the-as int (-> self clock frame-counter))) + ) + ) + ) + (suspend) + ) + ) + #f + (none) + ) + :post target-post + ) + +(defbehavior target-swim-tilt target ((arg0 float) (arg1 float) (arg2 float) (arg3 float)) + (let ((gp-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self control unknown-quaternion00)))) + (let ((v1-2 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self control dir-targ))) + (f0-1 + (fmin 1.0 (* arg0 (/ (-> self control unknown-float05) (-> self control unknown-surface01 target-speed)))) + ) + ) + (seek! + (-> self control unknown-float43) + (fmax (fmin (* (+ f0-1 arg2) (fmax 0.5 (+ 0.5 (vector-dot gp-0 v1-2)))) arg3) (- arg3)) + (* arg1 (-> self clock seconds-per-frame)) + ) + ) + (let ((a2-2 (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self control unknown-quaternion00)))) + (forward-up-nopitch->quaternion (-> self control unknown-quaternion01) gp-0 a2-2) + ) + ) + (quaternion-rotate-x! + (-> self control unknown-quaternion01) + (-> self control unknown-quaternion01) + (if (>= (-> self control unknown-float43) 0.0) + 16384.0 + -16384.0 + ) + ) + (set! (-> self control unknown-float04) (fabs (-> self control unknown-float43))) + (if (and (-> self next-state) (= (-> self next-state name) 'target-swim-down)) + (seek! (-> self control unknown-float001) -6144.0 (* 4096.0 (-> self clock seconds-per-frame))) + (seek! (-> self control unknown-float001) 0.0 (* 2048.0 (-> self clock seconds-per-frame))) + ) + (set! (-> self control unknown-vector04 y) (-> self control unknown-float001)) + ) + +(defstate target-swim-stance (target) + :event target-standard-event-handler + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self control unknown-surface00) *swim-mods*) + (logior! (-> self water flags) (water-flags swim-ground)) + (set! (-> self state-flags) (logior (state-flags lleg-no-ik rleg-no-ik) (-> self state-flags))) + (none) + ) + :exit (behavior () + (target-state-hook-exit) + (set! (-> self control unknown-surface00 target-speed) 28672.0) + (target-exit) + (when (not (and (-> self next-state) (let ((v1-6 (-> self next-state name))) + (or (= v1-6 'target-swim-stance) + (= v1-6 'target-swim-walk) + (= v1-6 'target-swim-down) + (= v1-6 'target-swim-up) + ) + ) + ) + ) + (quaternion-identity! (-> self control unknown-quaternion01)) + (set! (-> self control unknown-float04) 0.0) + ) + (when (not (and (-> self next-state) (let ((v1-14 (-> self next-state name))) + (or (= v1-14 'target-swim-stance) (= v1-14 'target-swim-walk)) + ) + ) + ) + (let ((v1-15 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-15 command) (sound-command set-param)) + (set! (-> v1-15 id) (-> self control unknown-sound-id02)) + (set! (-> v1-15 params volume) -4) + (set! (-> v1-15 auto-time) 960) + (set! (-> v1-15 auto-from) 2) + (set! (-> v1-15 params mask) (the-as uint 17)) + (-> v1-15 id) + ) + ) + (none) + ) + :trans (behavior () + ((-> self state-hook)) + (if (and (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (zero? (logand (-> self control status) (cshape-moving-flags on-water))) + ) + (set-zero! (-> self water bob)) + ) + (when (and (not (logtest? (water-flags swimming) (-> self water flags))) + (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + ) + (if (logtest? (water-flags wading) (-> self water flags)) + (go target-wade-stance) + (go target-stance) + ) + ) + (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 0) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? #f) + (>= (- (-> self clock frame-counter) (-> self water enter-swim-time)) (seconds 0.1)) + ) + (go target-swim-jump (-> *TARGET-bank* swim-jump-height-min) (-> *TARGET-bank* swim-jump-height-max)) + ) + (when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 0) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 2) + ) + (pad-buttons circle square) + ) + (< (-> *TARGET-bank* min-dive-depth) (target-height-above-ground)) + ) + (spawn-ripples (-> self water) 0.7 (-> self control trans) 1 *null-vector* #t) + (set! (-> self control unknown-float43) 0.0) + (go target-swim-down) + ) + (if (and (!= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + (let ((gp-0 (ja-group))) + (ja-aframe-num 0) + (if (or (and (= gp-0 (-> self draw art-group data 101)) #t) (and (= gp-0 (-> self draw art-group data 100)) #t)) + #f + #t + ) + ) + ) + (go target-swim-walk) + ) + (target-swim-tilt 0.0 2.0 0.0 1.0) + (sound-play "swim-bubbles" :id (-> self control unknown-sound-id02)) + (none) + ) + :code (behavior () + (let ((v1-2 (ja-group))) + (cond + ((and v1-2 (or (= v1-2 (-> self draw art-group data 101)) (= v1-2 (-> self draw art-group data 100)))) + (ja-channel-push! 1 (seconds 0.075)) + (ja-no-eval :group! (-> self draw art-group data 102) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 102)) frames num-frames) -1)) + (if (= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + 1.0 + 2.0 + ) + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (let ((a0-9 (-> self skel root-channel 0))) + (set! (-> a0-9 param 0) (the float (+ (-> a0-9 frame-group frames num-frames) -1))) + (let ((v1-38 (if (= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + 1.0 + 2.0 + ) + ) + ) + (set! (-> a0-9 param 1) v1-38) + ) + (joint-control-channel-group-eval! a0-9 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (else + (let ((v1-43 (ja-group))) + (if (and v1-43 (= v1-43 (-> self draw art-group data 97))) + (ja-channel-push! 1 (seconds 0.83)) + (ja-channel-push! 1 (seconds 0.15)) + ) + ) + ) + ) + ) + (until #f + (ja :group! (-> self draw art-group data 96) :num! min) + (until (and (ja-done? 0) (= (-> self skel root-channel 0) (-> self skel channel))) + (can-play-stance-amibent?) + (suspend) + (if (= (-> self skel root-channel 0) (-> self skel channel)) + (ja :num! (seek!)) + ) + ) + ) + #f + (none) + ) + :post target-swim-post + ) + +(defstate target-swim-walk (target) + :event target-standard-event-handler + :enter (behavior () + ((-> target-swim-stance enter)) + (die-on-next-update! (-> self water bob)) + (set! (-> self control unknown-word04) (the-as uint (-> self clock frame-counter))) + (set! (-> self state-flags) (logior (state-flags lleg-no-ik rleg-no-ik) (-> self state-flags))) + (none) + ) + :exit (-> target-swim-stance exit) + :trans (behavior () + ((-> self state-hook)) + (if (and (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (zero? (logand (-> self control status) (cshape-moving-flags on-water))) + ) + (set-zero! (-> self water bob)) + ) + (when (and (not (logtest? (water-flags swimming) (-> self water flags))) + (>= (- (-> self clock frame-counter) (-> self water swim-time)) (seconds 0.1)) + ) + (if (logtest? (water-flags wading) (-> self water flags)) + (go target-wade-stance) + (go target-stance) + ) + ) + (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 0) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? #f) + (>= (- (-> self clock frame-counter) (-> self water enter-swim-time)) (seconds 0.1)) + ) + (go target-swim-jump (-> *TARGET-bank* swim-jump-height-min) (-> *TARGET-bank* swim-jump-height-max)) + ) + (when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 0) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 2) + ) + (pad-buttons circle square) + ) + (< (-> *TARGET-bank* min-dive-depth) (target-height-above-ground)) + ) + (spawn-ripples (-> self water) 0.7 (-> self control trans) 1 *null-vector* #t) + (set! (-> self control unknown-float43) 0.0) + (go target-swim-down) + ) + (cond + ((= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + (if (>= (the-as uint (- (-> self clock frame-counter) (the-as int (-> self control unknown-word04)))) + (the-as uint 15) + ) + (go target-swim-stance) + ) + ) + (else + (set! (-> self control unknown-word04) (the-as uint (-> self clock frame-counter))) + ) + ) + (target-swim-tilt 0.0 2.0 0.0 1.0) + (sound-play "swim-bubbles" :id (-> self control unknown-sound-id02)) + (none) + ) + :code (behavior () + (let ((v1-2 (ja-group))) + (cond + ((and v1-2 (or (= v1-2 (-> self draw art-group data 101)) + (= v1-2 (-> self draw art-group data 100)) + (= v1-2 (-> self draw art-group data 102)) + ) + ) + (ja-channel-push! 1 (seconds 0.3)) + ) + ((let ((v1-8 (ja-group))) + (and v1-8 (= v1-8 (-> self draw art-group data 102))) + ) + (ja-channel-push! 1 (seconds 0.15)) + (ja-no-eval :group! (-> self draw art-group data 97) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 97)) frames num-frames) -1))) + :frame-num (ja-aframe 19.0 0) + ) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (if (not (logtest? (-> self align flags) (align-flags disabled))) + (set! (-> self control unknown-surface00 target-speed) + (* (-> self align delta trans z) (-> self control unknown-surface01 alignv) (-> self clock frames-per-second)) + ) + ) + (suspend) + (ja :num! (seek!)) + ) + ) + (else + (ja-channel-push! 1 (seconds 0.15)) + ) + ) + ) + (until #f + (ja-no-eval :group! (-> self draw art-group data 97) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 97)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (if (not (logtest? (-> self align flags) (align-flags disabled))) + (set! (-> self control unknown-surface00 target-speed) + (* (-> self align delta trans z) (-> self control unknown-surface01 alignv) (-> self clock frames-per-second)) + ) + ) + (suspend) + (ja :num! (seek!)) + ) + ) + #f + (none) + ) + :post target-swim-post + ) + +(defstate target-swim-down (target) + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (local-vars (t0-7 symbol)) + (case event-type + (('attack 'attack-invinc 'attack-or-shove) + (let ((v1-1 (the-as attack-info (-> event param 1)))) + (set! t0-7 (or (not (logtest? (-> v1-1 mask) (attack-info-mask mode))) + (case (-> v1-1 mode) + (('bot 'lava 'melt 'dark-eco-pool) + #f + ) + (('drown-death 'sharkey 'instant-death 'crush 'death 'grenade 'endlessfall) + (set! t0-7 'drown-death) + (set! (-> v1-1 mode) t0-7) + t0-7 + ) + (else + #t + ) + ) + ) + ) + (when t0-7 + (if (not (logtest? (attack-info-mask damage) (-> v1-1 mask))) + (set! (-> v1-1 damage) (-> *FACT-bank* health-single-inc)) + ) + (if (!= (-> v1-1 mode) 'drown-death) + (set! (-> v1-1 mode) 'damage) + ) + (if (and (= (-> self game mode) 'play) + (>= 0.0 (- (-> (the-as fact-info-target (-> self fact)) health) (-> v1-1 damage))) + ) + (set! (-> v1-1 mode) 'drown-death) + ) + (logior! (-> v1-1 mask) (attack-info-mask mode)) + (set! (-> self control unknown-word04) (the-as uint #t)) + ) + ) + ) + (('slide) + ) + ) + (target-standard-event-handler proc arg1 event-type event) + ) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-flags) (logior (state-flags lleg-no-ik rleg-no-ik) (-> self state-flags))) + (logclear! (-> self water flags) (water-flags swim-ground)) + (set! (-> self control unknown-surface00) *dive-mods*) + (set! (-> self control dynam gravity-max) 16384.0) + (set! (-> self control dynam gravity-length) 16384.0) + (set! (-> self water swim-time) (-> self clock frame-counter)) + (set! (-> self control unknown-word04) (the-as uint #f)) + (set! (-> self neck flex-blend) 0.0) + (none) + ) + :exit (behavior () + (set! (-> self control dynam gravity-max) (-> self control unknown-dynamics00 gravity-max)) + (set! (-> self control dynam gravity-length) (-> self control unknown-dynamics00 gravity-length)) + (target-exit) + (when (not (and (-> self next-state) (let ((v1-11 (-> self next-state name))) + (or (= v1-11 'target-swim-stance) + (= v1-11 'target-swim-walk) + (= v1-11 'target-swim-down) + (= v1-11 'target-swim-up) + ) + ) + ) + ) + (quaternion-identity! (-> self control unknown-quaternion01)) + (set! (-> self control unknown-float04) 0.0) + ) + (when (not (and (-> self next-state) (let ((v1-19 (-> self next-state name))) + (or (= v1-19 'target-swim-down) (= v1-19 'target-swim-up)) + ) + ) + ) + (let ((v1-21 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-21 command) (sound-command set-param)) + (set! (-> v1-21 id) (-> self control unknown-sound-id03)) + (set! (-> v1-21 params volume) -4) + (set! (-> v1-21 auto-time) 960) + (set! (-> v1-21 auto-from) 2) + (set! (-> v1-21 params mask) (the-as uint 17)) + (-> v1-21 id) + ) + ) + (set! (-> self neck flex-blend) 1.0) + (none) + ) + :trans (behavior () + (if (>= (- (-> self clock frame-counter) (-> self water swim-time)) (seconds 0.5)) + (go target-stance) + ) + (cond + ((>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) (seconds 0.1)) + (set! (-> self control unknown-surface00) *dive-mods*) + (if (and (-> self next-state) (= (-> self next-state name) 'target-swim-down)) + (target-swim-tilt -0.9 1.0 0.0 0.5) + ) + ) + (else + (set! (-> self control unknown-surface00) *dive-bottom-mods*) + (if (and (-> self next-state) (let ((v1-18 (-> self next-state name))) + (or (= v1-18 'target-swim-down) (= v1-18 'target-swim-stance)) + ) + ) + (target-swim-tilt 0.0 2.0 -1.0 1.0) + ) + ) + ) + (none) + ) + :code (behavior () + (let ((gp-0 60) + (s5-0 3000) + (f30-0 0.0) + ) + (let ((v1-2 (ja-group))) + (set! f30-0 + (cond + ((and v1-2 + (or (= v1-2 (-> self draw art-group data 96)) + (= v1-2 (-> self draw art-group data 97)) + (= v1-2 (-> self draw art-group data 102)) + (= v1-2 (-> self draw art-group data 101)) + (= v1-2 (-> self draw art-group data 100)) + ) + ) + (let ((t9-0 ja-channel-push!) + (a0-16 1) + (v1-7 (ja-group)) + ) + (t9-0 a0-16 (the-as time-frame (if (and v1-7 (= v1-7 (-> self draw art-group data 100))) + 105 + 22 + ) + ) + ) + ) + (ja-no-eval :group! (-> self draw art-group data 98) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 98)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (align! (-> self align) (align-opts adjust-y-vel adjust-xz-vel) 1.0 1.0 1.0) + (if (= (ja-aframe-num 0) 73.0) + (spawn-ripples (-> self water) 0.7 (-> self control trans) 1 *null-vector* #f) + ) + (suspend) + (ja :num! (seek!)) + ) + (ja :group! (-> self draw art-group data 99) :num! min) + f30-0 + ) + (else + (let ((v1-50 (ja-group))) + (cond + ((and v1-50 (or (= v1-50 (-> self draw art-group data 52)) + (= v1-50 (-> self draw art-group data 55)) + (= v1-50 (-> self draw art-group data 53)) + (= v1-50 (-> self draw art-group data 56)) + ) + ) + (ja-channel-push! 1 (seconds 0.075)) + (set! gp-0 120) + (ja :group! (-> self draw art-group data 99) :num! (identity (ja-aframe 124.0 0))) + -16384.0 + ) + (else + (ja-channel-push! 1 (seconds 0.075)) + (ja :group! (-> self draw art-group data 99) :num! min) + f30-0 + ) + ) + ) + ) + ) + ) + ) + (until #f + (when (and (!= (-> self tobot?) 'tobot) (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05))) + (if (and (or (not (cpad-hold? (-> self control unknown-cpad-info00 number) circle square)) + (-> self control unknown-spool-anim00) + ) + (>= (- (-> self clock frame-counter) (-> self state-time)) gp-0) + ) + (go target-swim-up) + ) + (if (or (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame27)) s5-0) + (and (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (and (< (-> self water swim-depth) 8192.0) (>= (- (-> self clock frame-counter) (-> self state-time)) gp-0)) + ) + ) + (go target-swim-up) + ) + ) + (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (sound-play "water-bubbles" :id (-> self control unknown-sound-id03)) + ) + (let ((s4-3 (new-stack-vector0)) + (f0-13 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + ) + 0.0 + (vector-! s4-3 (-> self control transv) (vector-float*! s4-3 (-> self control dynam gravity-normal) f0-13)) + (let* ((f28-0 (vector-length s4-3)) + (f26-0 f28-0) + (f24-0 (+ f0-13 f30-0)) + ) + (set! f30-0 (seek f30-0 0.0 (* 32768.0 (-> self clock seconds-per-frame)))) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f24-0) + (vector-float*! s4-3 s4-3 (/ f28-0 f26-0)) + ) + ) + ) + (suspend) + (ja :num! (loop! (lerp-scale 0.4 1.0 (vector-length (-> self control transv)) 0.0 16384.0))) + ) + ) + #f + (none) + ) + :post target-swim-post + ) + +(defstate target-swim-up (target) + :event (-> target-swim-down event) + :enter (behavior () + ((-> target-swim-down enter)) + (none) + ) + :exit (-> target-swim-down exit) + :trans (behavior () + (if (and (cpad-pressed? (-> self control unknown-cpad-info00 number) x) + (not (logtest? (-> self state-flags) (state-flags sf7))) + (zero? (logand (water-flags head-under-water bouncing) (-> self water flags))) + ) + (go + target-swim-jump-jump + (-> *TARGET-bank* swim-jump-height-min) + (-> *TARGET-bank* swim-jump-height-max) + (the-as surface #f) + ) + ) + (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 10)) + (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) + ) + (let ((a1-3 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-3 from) (process->ppointer self)) + (set! (-> a1-3 num-params) 2) + (set! (-> a1-3 message) 'attack) + (set! (-> a1-3 param 0) (the-as uint #f)) + (let ((v1-27 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (let* ((a0-8 *game-info*) + (a2-2 (+ (-> a0-8 attack-id) 1)) + ) + (set! (-> a0-8 attack-id) a2-2) + (set! (-> v1-27 id) a2-2) + ) + (set! (-> v1-27 mode) 'drown-death) + (set! (-> a1-3 param 1) (the-as uint v1-27)) + ) + (send-event-function self a1-3) + ) + ) + (if (and (cpad-pressed? (-> self control unknown-cpad-info00 number) circle square) + (or (< (- (-> self clock frame-counter) (-> self control unknown-time-frame27)) (seconds 10)) + (logtest? (-> self control status) (cshape-moving-flags t-ceil)) + ) + (and (< (-> *TARGET-bank* min-dive-depth) (target-height-above-ground)) + (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) + ) + ) + (go target-swim-down) + ) + (sound-play "water-bubbles" :id (-> self control unknown-sound-id03)) + ((-> target-swim-down trans)) + (none) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.1)) + (let ((f30-0 1.0)) + (let ((s5-0 #t) + (gp-0 #f) + ) + (ja-no-eval :group! (-> self draw art-group data 100) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 100)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (target-swim-tilt + (if (< 8192.0 (-> self water swim-depth)) + 0.5 + 0.0 + ) + 1.0 + 0.0 + 0.1 + ) + (when (and (not gp-0) + (or (>= (ja-aframe-num 0) 240.0) (zero? (logand (water-flags head-under-water) (-> self water flags)))) + ) + (set! gp-0 #t) + (sound-play "swim-surface") + (spawn-ripples (-> self water) 0.2 (-> self control trans) 1 (-> self control transv) #t) + ) + (if (and (not (logtest? (-> self water flags) (water-flags under-water))) + (and (or (>= (ja-aframe-num 0) 222.0) + (and (!= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + (>= (ja-aframe-num 0) 200.0) + ) + ) + (!= (-> self tobot?) 'tobot) + ) + ) + (goto cfg-51) + ) + (compute-alignment! (-> self align)) + (when (not (logtest? (-> self water flags) (water-flags under-water))) + (logior! (-> self water flags) (water-flags swim-ground)) + (set! s5-0 #f) + ) + (if s5-0 + (align! (-> self align) (align-opts adjust-y-vel) 1.0 1.0 1.0) + ) + (suspend) + (ja :num! (seek!)) + ) + ) + (ja :group! (-> self draw art-group data 101) :num! min) + (until #f + (target-swim-tilt + (if (< 8192.0 (-> self water swim-depth)) + 0.3 + 0.0 + ) + 1.0 + 0.0 + 0.1 + ) + (if (and (not (logtest? (-> self water flags) (water-flags under-water))) (!= (-> self tobot?) 'tobot)) + (goto cfg-51) + ) + (if (cpad-pressed? (-> self control unknown-cpad-info00 number) x) + (set! f30-0 2.0) + ) + (compute-alignment! (-> self align)) + (when (logtest? (-> self water flags) (water-flags under-water)) + (align! (-> self align) (align-opts adjust-y-vel) 1.0 1.0 1.0) + (set! (-> self control transv y) (+ 8192.0 (* 8192.0 f30-0))) + ) + (suspend) + (ja :num! (loop! f30-0)) + (set! f30-0 (seek f30-0 1.0 (-> self clock seconds-per-frame))) + ) + ) + #f + (label cfg-51) + (logior! (-> self water flags) (water-flags swim-ground)) + (set! (-> self water swim-time) (-> self clock frame-counter)) + (start-bobbing! (-> self water) -4096.0 600 1500) + (set! (-> self water bob start-time) (+ (-> self clock frame-counter) (seconds -0.05))) + (go target-swim-stance) + (none) + ) + :post target-swim-post + ) + +(defstate target-swim-jump-jump (target) + :event (-> target-jump event) + :enter (-> target-jump enter) + :exit target-exit + :trans (behavior () + (cond + ((< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (set! (-> self water flags) (logior (water-flags jump-out) (-> self water flags))) + (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + ) + (else + (set! (-> self trans-hook) (-> target-jump trans)) + ) + ) + ((-> target-jump trans)) + (none) + ) + :code (-> target-jump code) + :post target-post + ) + +(defstate target-swim-jump (target) + :event target-standard-event-handler + :enter (-> target-swim-stance enter) + :exit (behavior () + ((-> target-swim-stance exit)) + (die-on-next-update! (-> self water bob)) + (set! (-> self water align-offset) 0.0) + (set! (-> self water flags) (logior (water-flags jump-out) (-> self water flags))) + (none) + ) + :code (behavior ((arg0 float) (arg1 float)) + (die-on-next-update! (-> self water bob)) + (ja-channel-push! 1 (seconds 0.05)) + (ja :group! (-> self draw art-group data 103) :num! min) + (until (and (ja-done? 0) (= (-> self skel root-channel 0) (-> self skel channel))) + (compute-alignment! (-> self align)) + (if (not (logtest? (-> self align flags) (align-flags disabled))) + (+! (-> self water align-offset) (* 0.6 (-> self align delta trans y))) + ) + (suspend) + (if (= (-> self skel root-channel 0) (-> self skel channel)) + (ja :num! (seek! max 2.0)) + ) + ) + (let ((f0-7 (fmax 0.0 (- (-> self water bob-offset))))) + (let ((v1-36 (new-stack-vector0))) + (let ((f1-5 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! v1-36 (-> self control transv) (vector-float*! v1-36 (-> self control dynam gravity-normal) f1-5)) + ) + (let* ((f1-6 (vector-length v1-36)) + (f2-2 f1-6) + (f3-0 0.4096) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f3-0) + (vector-float*! v1-36 v1-36 (/ f1-6 f2-2)) + ) + ) + ) + (go target-swim-jump-jump (+ f0-7 arg0) (+ f0-7 arg1) (the-as surface #f)) + ) + (none) + ) + :post target-swim-post + ) diff --git a/goal_src/jak2/engine/target/target-util.gc b/goal_src/jak2/engine/target/target-util.gc index 2719523973..8378b9281d 100644 --- a/goal_src/jak2/engine/target/target-util.gc +++ b/goal_src/jak2/engine/target/target-util.gc @@ -7,31 +7,83 @@ ;; DECOMP BEGINS +(defskelgroup skel-jchar jakb jakb-lod0-jg -1 + ((jakb-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 3.2) + :longest-edge (meters 1) + :shadow jakb-shadow-mg + :texture-level 6 + :sort 1 + :origin-joint-index 3 + :shadow-joint-index 3 + ) + +(define *target-shadow-control* + (new 'static 'shadow-control :settings (new 'static 'shadow-settings + :center (new 'static 'vector :w (the-as float #x2)) + :shadow-dir (new 'static 'vector :x -0.4226 :y -0.9063 :w 409600.0) + :bot-plane (new 'static 'plane :y 1.0 :w 37683.2) + :top-plane (new 'static 'plane :y 1.0 :w 4096.0) + ) + ) + ) + +(defskelgroup skel-jak-highres jak-highres 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 3.2) + :longest-edge (meters 1) + :shadow 2 + :sort 1 + :origin-joint-index 3 + :shadow-joint-index 3 + ) + +(defskelgroup skel-generic-blast collectables collectables-generic-blast-lod0-jg collectables-generic-blast-idle-ja + ((collectables-generic-blast-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 50) + :texture-level 6 + :sort 4 + ) + +(defskelgroup skel-generic-ripples collectables collectables-generic-ripples-lod0-jg collectables-generic-ripples-idle-ja + ((collectables-generic-ripples-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 6) + :texture-level 6 + :sort 4 + ) + +(defskelgroup skel-bomb-blast collectables collectables-bomb-blast-lod0-jg collectables-bomb-blast-idle-ja + ((collectables-bomb-blast-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 50) + :texture-level 6 + :sort 4 + ) + (deftype target-bank (basic) - ((jump-collide-offset meters :offset-assert 4) - (jump-height-min meters :offset-assert 8) - (jump-height-max meters :offset-assert 12) - (double-jump-height-min meters :offset-assert 16) - (double-jump-height-max meters :offset-assert 20) - (flip-jump-height-min meters :offset-assert 24) - (flip-jump-height-max meters :offset-assert 28) - (duck-jump-height-min meters :offset-assert 32) - (duck-jump-height-max meters :offset-assert 36) - (flop-jump-height-min meters :offset-assert 40) - (flop-jump-height-max meters :offset-assert 44) - (attack-jump-height-min meters :offset-assert 48) - (attack-jump-height-max meters :offset-assert 52) - (edge-grab-jump-height-min meters :offset-assert 56) - (edge-grab-jump-height-max meters :offset-assert 60) - (swim-jump-height-min meters :offset-assert 64) - (swim-jump-height-max meters :offset-assert 68) - (tube-jump-height-min meters :offset-assert 72) - (tube-jump-height-max meters :offset-assert 76) - (carry-jump-height-min meters :offset-assert 80) - (carry-jump-height-max meters :offset-assert 84) - (mech-jump-height-min meters :offset-assert 88) - (mech-jump-height-max meters :offset-assert 92) - (mech-carry-jump-height-min meters :offset-assert 96) + ((jump-collide-offset meters :offset-assert 4) + (jump-height-min meters :offset-assert 8) + (jump-height-max meters :offset-assert 12) + (double-jump-height-min meters :offset-assert 16) + (double-jump-height-max meters :offset-assert 20) + (flip-jump-height-min meters :offset-assert 24) + (flip-jump-height-max meters :offset-assert 28) + (duck-jump-height-min meters :offset-assert 32) + (duck-jump-height-max meters :offset-assert 36) + (flop-jump-height-min meters :offset-assert 40) + (flop-jump-height-max meters :offset-assert 44) + (attack-jump-height-min meters :offset-assert 48) + (attack-jump-height-max meters :offset-assert 52) + (edge-grab-jump-height-min meters :offset-assert 56) + (edge-grab-jump-height-max meters :offset-assert 60) + (swim-jump-height-min meters :offset-assert 64) + (swim-jump-height-max meters :offset-assert 68) + (tube-jump-height-min meters :offset-assert 72) + (tube-jump-height-max meters :offset-assert 76) + (carry-jump-height-min meters :offset-assert 80) + (carry-jump-height-max meters :offset-assert 84) + (mech-jump-height-min meters :offset-assert 88) + (mech-jump-height-max meters :offset-assert 92) + (mech-carry-jump-height-min meters :offset-assert 96) (mech-carry-jump-height-max meters :offset-assert 100) (indax-jump-height-min meters :offset-assert 104) (indax-jump-height-max meters :offset-assert 108) @@ -51,13 +103,13 @@ (duck-slide-distance meters :offset-assert 184) (fall-far meters :offset-assert 188) (fall-far-inc meters :offset-assert 192) - (attack-timeout uint64 :offset-assert 200) ;; time-frame - (ground-timeout uint64 :offset-assert 208) ;; time-frame - (slide-down-timeout uint64 :offset-assert 216) ;; time-frame - (fall-timeout uint64 :offset-assert 224) ;; time-frame + (attack-timeout uint64 :offset-assert 200) + (ground-timeout uint64 :offset-assert 208) + (slide-down-timeout uint64 :offset-assert 216) + (fall-timeout uint64 :offset-assert 224) (fall-stumble-threshold meters :offset-assert 232) (yellow-projectile-speed meters :offset-assert 236) - (hit-invulnerable-timeout uint64 :offset-assert 240) ;; time-frame + (hit-invulnerable-timeout uint64 :offset-assert 240) (same-attack-invulnerable-timeout uint64 :offset-assert 248) (run-cycle-length float :offset-assert 256) (walk-cycle-dist meters :offset-assert 260) @@ -103,7 +155,7 @@ (stuck-distance meters :offset-assert 624) (tongue-pull-speed-min float :offset-assert 628) (tongue-pull-speed-max float :offset-assert 632) - (yellow-attack-timeout uint64 :offset-assert 640) ;; time-frame + (yellow-attack-timeout uint64 :offset-assert 640) (fall-height meters :offset-assert 648) (mech-jump-thrust-fuel float :offset-assert 652) (strafe-jump-pre-window uint64 :offset-assert 656) @@ -117,8 +169,1633 @@ :flag-assert #x9000002a8 ) -(define-extern *target-shadow-control* shadow-control) -(define-extern *TARGET-bank* target-bank) +(define *TARGET-bank* (new 'static 'target-bank + :jump-collide-offset (meters 0.7) + :jump-height-min (meters 1.01) + :jump-height-max (meters 3.5) + :double-jump-height-min (meters 1) + :double-jump-height-max (meters 2.5) + :flip-jump-height-min (meters 5) + :flip-jump-height-max (meters 7) + :duck-jump-height-min (meters 7) + :duck-jump-height-max (meters 7) + :flop-jump-height-min (meters 5) + :flop-jump-height-max (meters 7) + :attack-jump-height-min (meters 5) + :attack-jump-height-max (meters 6.5) + :edge-grab-jump-height-min (meters 1.7) + :edge-grab-jump-height-max (meters 1.7) + :swim-jump-height-min (meters 5) + :swim-jump-height-max (meters 5) + :tube-jump-height-min (meters 1.75) + :tube-jump-height-max (meters 2.5) + :carry-jump-height-min (meters 1.75) + :carry-jump-height-max (meters 2) + :mech-jump-height-min (meters 1.5) + :mech-jump-height-max (meters 1.5) + :mech-carry-jump-height-min (meters 2.5) + :mech-carry-jump-height-max (meters 3) + :indax-jump-height-min (meters 1.01) + :indax-jump-height-max (meters 3.5) + :indax-double-jump-height-min (meters 1) + :indax-double-jump-height-max (meters 2.5) + :roll-duration #x96 + :roll-jump-pre-window #x12c + :roll-jump-post-window #x1e + :roll-speed-min (meters 11.5) + :roll-speed-inc (meters 1.5) + :roll-flip-duration #xd2 + :roll-flip-height (meters 3.52) + :roll-flip-dist (meters 17.3) + :roll-flip-art-height (meters 3.2969) + :roll-flip-art-dist (meters 12.5) + :duck-slide-distance (meters 5.75) + :fall-far (meters 30) + :fall-far-inc (meters 20) + :attack-timeout #x5a + :ground-timeout #x3c + :slide-down-timeout #x3c + :fall-timeout #x12c + :fall-stumble-threshold (meters 39.9) + :yellow-projectile-speed (meters 60) + :hit-invulnerable-timeout #x12c + :same-attack-invulnerable-timeout #x258 + :run-cycle-length 60.0 + :walk-cycle-dist (meters 2.8) + :walk-up-cycle-dist (meters 2.8) + :walk-down-cycle-dist (meters 2.8) + :walk-side-cycle-dist (meters 2.8) + :run-cycle-dist (meters 6.25) + :run-up-cycle-dist (meters 5) + :run-down-cycle-dist (meters 5) + :run-side-cycle-dist (meters 6.25) + :run-wall-cycle-dist (meters 2.8) + :duck-walk-cycle-dist (meters 3.25) + :wade-shallow-walk-cycle-dist (meters 6) + :wade-deep-walk-cycle-dist (meters 6) + :mech-walk-cycle-dist (meters 4) + :mech-run-cycle-dist (meters 8) + :smack-surface-dist (meters 1.25) + :min-dive-depth (meters 2) + :root-radius (meters 2.2) + :root-offset (new 'static 'vector :y 4915.2 :w 1.0) + :body-radius (meters 0.7) + :edge-radius (meters 0.35) + :edge-offset (new 'static 'vector :y 4915.2 :z 4096.0 :w 1.0) + :edge-grab-height-off-ground (meters 2.3) + :head-radius (meters 0.7) + :head-height (meters 1.4) + :head-offset (new 'static 'vector :y 4915.2 :w 1.0) + :spin-radius (meters 2.2) + :spin-offset (new 'static 'vector :y 6553.6 :w 1.0) + :duck-spin-radius (meters 1.2) + :duck-spin-offset (new 'static 'vector :y 4096.0 :w 1.0) + :punch-radius (meters 1.3) + :punch-offset (new 'static 'vector :y 5324.8 :w 1.0) + :uppercut-radius (meters 1) + :uppercut0-offset (new 'static 'vector :y 3276.8 :w 1.0) + :uppercut1-offset (new 'static 'vector :y 9011.2 :w 1.0) + :flop-radius (meters 1.4) + :flop0-offset (new 'static 'vector :y 3276.8 :w 1.0) + :flop1-offset (new 'static 'vector :y 9011.2 :w 1.0) + :stuck-time (seconds 0.3) + :stuck-timeout (seconds 2) + :stuck-distance (meters 0.05) + :tongue-pull-speed-min 0.15 + :tongue-pull-speed-max 0.22 + :yellow-attack-timeout #x3c + :fall-height (meters 1) + :mech-jump-thrust-fuel 900.0 + :strafe-jump-pre-window #x96 + :strafe-jump #f + :strafe-duck-jump #f + :dark-jump-height-min (meters 20.5) + :dark-jump-height-max (meters 20.5) + ) + ) + +(defbehavior target-start-attack target () + (let* ((v1-0 *game-info*) + (a0-1 (+ (-> v1-0 attack-id) 1)) + ) + (set! (-> v1-0 attack-id) a0-1) + (set! (-> self control unknown-symbol05) (the-as symbol a0-1)) + ) + (set! (-> self control unknown-dword05) (the-as uint 0)) + (set! (-> self control unknown-float40) 0.0) + (+! (-> self anim-seed) 1) + 0 + (none) + ) + +(defbehavior target-danger-set! target ((arg0 symbol) (arg1 symbol)) + (let ((s4-0 (-> self control unknown-sphere-array00 6)) + (s5-0 (-> self control unknown-sphere-array00 7)) + (gp-0 (-> self control unknown-sphere-array00 8)) + ) + (let* ((s2-0 (-> self control unknown-sphere-array00 9)) + (v1-4 arg1) + (f30-0 (if (or (= v1-4 'cone) (= v1-4 'eco-red)) + 2.0 + 1.0 + ) + ) + ) + (if (and (logtest? (focus-status dark) (-> self focus-status)) + (and (nonzero? (-> self darkjak)) (logtest? (-> self darkjak stage) 32)) + ) + (set! f30-0 1.0) + ) + (set! (-> self control penetrate-using) (penetrate touch)) + (set! (-> self control penetrated-by) (penetrate lunge)) + (sphere<-vector+r! + (the-as sphere (-> self control root-prim local-sphere)) + (-> *TARGET-bank* root-offset) + (-> *TARGET-bank* root-radius) + ) + (set! (-> self control unknown-symbol04) arg0) + (logclear! (-> self focus-status) (focus-status dangerous)) + (set! (-> s4-0 transform-index) -2) + (set! (-> s4-0 prim-core collide-as) (collide-spec)) + (set! (-> s4-0 prim-core collide-with) (collide-spec)) + (set! (-> s4-0 local-sphere w) 0.0) + (set! (-> s5-0 transform-index) -2) + (set! (-> s5-0 prim-core collide-as) (collide-spec)) + (set! (-> s5-0 prim-core collide-with) (collide-spec)) + (set! (-> s5-0 local-sphere w) 0.0) + (set! (-> gp-0 transform-index) -2) + (set! (-> gp-0 prim-core collide-as) (collide-spec)) + (set! (-> gp-0 prim-core collide-with) (collide-spec)) + (set! (-> gp-0 local-sphere w) 0.0) + (set! (-> s2-0 transform-index) -2) + (set! (-> s2-0 prim-core collide-as) (collide-spec)) + (set! (-> s2-0 prim-core collide-with) (collide-spec)) + (set! (-> s2-0 local-sphere w) 0.0) + (case arg0 + (('harmless #f) + (set! (-> self control unknown-symbol04) #f) + (target-collide-set! (-> self control unknown-symbol00) (-> self control unknown-float000)) + ) + (('carry?) + (set! (-> s4-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s4-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> s4-0 local-sphere)) + (-> *TARGET-bank* spin-offset) + (+ 8192.0 (-> *TARGET-bank* spin-radius)) + ) + (set! (-> self control root-prim local-sphere quad) (-> s4-0 local-sphere quad)) + ) + (('spin 'spin-air) + (sphere<-vector+r! + (the-as sphere (-> self control root-prim local-sphere)) + (new 'static 'vector :y 6553.6 :w 1.0) + 9830.4 + ) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> s4-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s4-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> s4-0 local-sphere)) + (-> *TARGET-bank* spin-offset) + (-> *TARGET-bank* spin-radius) + ) + (set! (-> self control penetrate-using) (penetrate touch spin)) + ) + (('board-spin) + (sphere<-vector+r! + (the-as sphere (-> self control root-prim local-sphere)) + (new 'static 'vector :y 6553.6 :w 1.0) + 9830.4 + ) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> s4-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s4-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! (the-as sphere (-> s4-0 local-sphere)) (-> *TARGET-bank* spin-offset) 6963.2) + (set! (-> self control penetrate-using) (penetrate touch spin board)) + ) + (('duck-spin) + (sphere<-vector+r! + (the-as sphere (-> self control root-prim local-sphere)) + (new 'static 'vector :y 6553.6 :w 1.0) + 10649.6 + ) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> s4-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s4-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> s4-0 local-sphere)) + (-> *TARGET-bank* duck-spin-offset) + (-> *TARGET-bank* duck-spin-radius) + ) + (set! (-> s5-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s5-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! (the-as sphere (-> s5-0 local-sphere)) *null-vector* (-> *TARGET-bank* duck-spin-radius)) + (set! (-> s5-0 transform-index) 35) + (set! (-> self control penetrate-using) (penetrate touch spin)) + ) + (('duck-slide) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> s4-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s4-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> s4-0 local-sphere)) + (-> *TARGET-bank* duck-spin-offset) + (-> *TARGET-bank* duck-spin-radius) + ) + (set! (-> s5-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s5-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! (the-as sphere (-> s5-0 local-sphere)) *null-vector* (-> *TARGET-bank* duck-spin-radius)) + (set! (-> s5-0 transform-index) 28) + (set! (-> self control penetrate-using) (penetrate touch punch)) + ) + (('roll-solid) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> s4-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s4-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> s4-0 local-sphere)) + (-> *TARGET-bank* duck-spin-offset) + (+ 819.2 (-> *TARGET-bank* duck-spin-radius)) + ) + (set! (-> s5-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s5-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! (the-as sphere (-> s5-0 local-sphere)) *null-vector* (-> *TARGET-bank* duck-spin-radius)) + (set! (-> s5-0 transform-index) 8) + (set! (-> self control unknown-symbol04) 'roll) + (set! (-> self control penetrate-using) (penetrate touch roll)) + ) + (('flip) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> s4-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s4-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> s4-0 local-sphere)) + (-> *TARGET-bank* duck-spin-offset) + (+ 819.2 (-> *TARGET-bank* duck-spin-radius)) + ) + (set! (-> s5-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s5-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! (the-as sphere (-> s5-0 local-sphere)) *null-vector* (-> *TARGET-bank* duck-spin-radius)) + (set! (-> s5-0 transform-index) 8) + (set! (-> self control unknown-symbol04) 'flip) + (set! (-> self control penetrate-using) (penetrate touch roll)) + ) + (('punch) + (sphere<-vector+r! + (the-as sphere (-> self control root-prim local-sphere)) + (new 'static 'vector :y 6553.6 :w 1.0) + 11878.4 + ) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> s4-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s4-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> s4-0 local-sphere)) + (-> *TARGET-bank* punch-offset) + (-> *TARGET-bank* punch-radius) + ) + (when (not (logtest? (focus-status indax) (-> self focus-status))) + (set! (-> s5-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s5-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! (the-as sphere (-> s5-0 local-sphere)) *null-vector* (-> *TARGET-bank* punch-radius)) + (set! (-> s5-0 transform-index) 21) + ) + (set! (-> self control penetrate-using) (penetrate touch punch)) + (if (and (logtest? (focus-status dark) (-> self focus-status)) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) 2) + ) + (set! (-> self control penetrate-using) (logior (penetrate dark-punch) (-> self control penetrate-using))) + ) + ) + (('uppercut) + (sphere<-vector+r! + (the-as sphere (-> self control root-prim local-sphere)) + (new 'static 'vector :y 6553.6 :w 1.0) + 11878.4 + ) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> s4-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s4-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> s4-0 local-sphere)) + (-> *TARGET-bank* uppercut0-offset) + (-> *TARGET-bank* uppercut-radius) + ) + (set! (-> s5-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s5-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! (the-as sphere (-> s5-0 local-sphere)) *null-vector* (-> *TARGET-bank* uppercut-radius)) + (set! (-> s5-0 transform-index) 21) + (set! (-> gp-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> gp-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> gp-0 local-sphere)) + (-> *TARGET-bank* uppercut1-offset) + (-> *TARGET-bank* uppercut-radius) + ) + (set! (-> self control penetrate-using) (penetrate touch uppercut)) + ) + (('flop) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> s4-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s4-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> s4-0 local-sphere)) + (-> *TARGET-bank* flop0-offset) + (-> *TARGET-bank* flop-radius) + ) + (set! f30-0 1.0) + (set! (-> self control unknown-symbol04) 'flop) + (set! (-> self control penetrate-using) (penetrate touch flop)) + ) + (('flop-down) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> s4-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s4-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> s4-0 local-sphere)) + (-> *TARGET-bank* flop0-offset) + (-> *TARGET-bank* flop-radius) + ) + (set! (-> s5-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s5-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> s5-0 local-sphere)) + (-> *TARGET-bank* flop1-offset) + (-> *TARGET-bank* flop-radius) + ) + (if (!= f30-0 1.0) + (set! f30-0 2.1) + ) + (set! (-> self control unknown-symbol04) 'flop) + (set! (-> self control penetrate-using) (penetrate touch flop)) + ) + (('flut-attack) + (sphere<-vector+r! + (the-as sphere (-> self control root-prim local-sphere)) + (new 'static 'vector :y 6553.6 :w 1.0) + 12288.0 + ) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> s4-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s4-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> s4-0 local-sphere)) + (-> *TARGET-bank* spin-offset) + (+ 2048.0 (-> *TARGET-bank* punch-radius)) + ) + (set! (-> s5-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s5-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> s5-0 local-sphere)) + *null-vector* + (+ 1228.8 (-> *TARGET-bank* punch-radius)) + ) + (set! (-> s5-0 transform-index) 8) + (set! (-> self control penetrate-using) (penetrate touch flut-attack)) + ) + (('mech-punch) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> self control penetrate-using) (penetrate touch mech)) + ) + (('bomb) + (let* ((f0-32 (-> self control unknown-float40)) + (f28-0 (lerp-scale (-> *TARGET-bank* root-radius) 122880.0 f0-32 0.0 1.0)) + ) + (sphere<-vector+r! + (the-as sphere (-> self control root-prim local-sphere)) + (-> *TARGET-bank* root-offset) + f28-0 + ) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> s4-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s4-0 prim-core collide-with) (the-as collide-spec (logand -4097 (-> self control unknown-word10)))) + (sphere<-vector+r! (the-as sphere (-> s4-0 local-sphere)) (-> *TARGET-bank* root-offset) f28-0) + ) + (set! (-> self control penetrate-using) (penetrate touch dark-bomb)) + ) + (else + (format 0 "ERROR: ~A unknown danger mode ~A" self arg0) + ) + ) + (when (= arg1 'cone) + (let ((f28-1 16384.0)) + (sphere<-vector+r! + (the-as sphere (-> self control root-prim local-sphere)) + (-> *TARGET-bank* root-offset) + (+ (-> *TARGET-bank* root-radius) (* 2.0 f28-1)) + ) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> s2-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s2-0 prim-core collide-with) (the-as collide-spec (logand -4097 (-> self control unknown-word10)))) + (set! (-> s2-0 transform-index) 0) + (sphere<-vector+r! + (the-as sphere (-> s2-0 local-sphere)) + (new 'static 'vector :y 12288.0 :z 16384.0 :w 1.0) + f28-1 + ) + ) + (set! (-> self control penetrate-using) (penetrate touch dark-bomb)) + ) + (when (and (!= f30-0 1.0) (not (or (= arg0 'harmless) (= arg0 #f)))) + (set! (-> self control root-prim local-sphere w) (* (-> self control root-prim local-sphere w) f30-0)) + (set! (-> s4-0 local-sphere w) (* (-> s4-0 local-sphere w) f30-0)) + (set! (-> s5-0 local-sphere w) (* (-> s5-0 local-sphere w) f30-0)) + (set! (-> gp-0 local-sphere w) (* (-> gp-0 local-sphere w) f30-0)) + ) + ) + (when (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (set! (-> self control penetrate-using) (logior (penetrate dark-skin) (-> self control penetrate-using))) + (when (and (logtest? (focus-status dark) (-> self focus-status)) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) 32) + ) + (set! (-> self control penetrate-using) (logior (penetrate dark-giant) (-> self control penetrate-using))) + (let ((f0-46 (lerp-scale 1.0 (-> self darkjak-giant-interp) (-> self darkjak-interp) 0.0 1.0))) + (set! (-> self control root-prim local-sphere w) (* (-> self control root-prim local-sphere w) f0-46)) + (set! (-> self control root-prim local-sphere y) (* (-> self control root-prim local-sphere y) f0-46)) + (set! (-> s4-0 local-sphere w) (* (-> s4-0 local-sphere w) f0-46)) + (set! (-> s4-0 local-sphere y) (* (-> s4-0 local-sphere y) f0-46)) + (set! (-> s5-0 local-sphere w) (* (-> s5-0 local-sphere w) f0-46)) + (set! (-> s5-0 local-sphere y) (* (-> s5-0 local-sphere y) f0-46)) + (set! (-> gp-0 local-sphere w) (* (-> gp-0 local-sphere w) f0-46)) + (set! (-> gp-0 local-sphere y) (* (-> gp-0 local-sphere y) f0-46)) + ) + ) + ) + ) + (case (-> (the-as fact-info-target (-> self fact)) eco-type) + ((1) + (set! (-> self control penetrate-using) (logior (penetrate eco-yellow) (-> self control penetrate-using))) + ) + ((2) + (set! (-> self control penetrate-using) (logior (penetrate eco-red) (-> self control penetrate-using))) + ) + ((3) + (set! (-> self control penetrate-using) (logior (penetrate eco-blue) (-> self control penetrate-using))) + ) + ((5) + (set! (-> self control penetrate-using) + (the-as penetrate (logior (penetrate eco-green) (-> self control penetrate-using))) + ) + ) + ) + (none) + ) + +(defbehavior target-collide-set! target ((arg0 symbol) (arg1 float)) + (let ((gp-0 (-> self control))) + (if (and (= arg0 'normal) + (enabled-gun? self) + (zero? (logand (-> self control unknown-surface01 flags) (surface-flag duck))) + ) + (set! arg0 'gun) + ) + (set! (-> self control unknown-symbol00) arg0) + (set! (-> self control unknown-float000) arg1) + (logclear! (-> self control penetrate-using) (penetrate tube vehicle board mech)) + (set! (-> self control penetrated-by) (penetrate lunge)) + (dotimes (v1-10 4) + (set! (-> gp-0 unknown-sphere-array00 v1-10 transform-index) -2) + ) + (set! (-> gp-0 unknown-sphere-array00 3 prim-core collide-as) (collide-spec)) + (set! (-> gp-0 unknown-sphere-array00 3 prim-core collide-with) (collide-spec)) + (set! (-> gp-0 unknown-sphere-array00 4 prim-core collide-as) (collide-spec jak)) + (set! (-> gp-0 unknown-sphere-array00 4 prim-core collide-with) (collide-spec + backgnd + bot + crate + civilian + enemy + obstacle + hit-by-player-list + hit-by-others-list + player-list + water + collectable + blocking-plane + tobot + pusher + vehicle-mesh + obstacle-for-jak + ) + ) + (cond + ((= arg0 'pole) + (set-vector! (-> gp-0 unknown-sphere-array00 0 local-sphere) 0.0 0.0 0.0 (-> *TARGET-bank* body-radius)) + (set-vector! (-> gp-0 unknown-sphere-array00 1 local-sphere) 0.0 0.0 0.0 (-> *TARGET-bank* body-radius)) + (set-vector! (-> gp-0 unknown-sphere-array00 2 local-sphere) 0.0 0.0 0.0 (-> *TARGET-bank* body-radius)) + (set! (-> gp-0 unknown-sphere-array00 0 transform-index) 28) + (set! (-> gp-0 unknown-sphere-array00 1 transform-index) 26) + (set! (-> gp-0 unknown-sphere-array00 2 transform-index) 8) + ) + ((= arg0 'board) + (logior! (-> self control penetrate-using) (penetrate touch board)) + ) + ((= arg0 'racer) + (set! (-> gp-0 unknown-vector04 y) 4096.0) + (sphere<-vector+r! + (the-as sphere (-> gp-0 root-prim local-sphere)) + (new 'static 'vector :y 8192.0 :w 1.0) + 16384.0 + ) + (set-vector! (-> gp-0 unknown-sphere-array00 0 local-sphere) 0.0 6553.6 0.0 6553.6) + (set-vector! (-> gp-0 unknown-sphere-array00 1 local-sphere) 0.0 9420.8 0.0 6553.6) + (set-vector! (-> gp-0 unknown-sphere-array00 2 local-sphere) 0.0 12288.0 0.0 6553.6) + (logior! (-> self control penetrate-using) (penetrate touch vehicle)) + ) + ((= arg0 'flut) + (sphere<-vector+r! + (the-as sphere (-> gp-0 root-prim local-sphere)) + (new 'static 'vector :y 8192.0 :w 1.0) + 12288.0 + ) + (set-vector! (-> gp-0 unknown-sphere-array00 0 local-sphere) 0.0 4915.2 0.0 4915.2) + (set-vector! (-> gp-0 unknown-sphere-array00 1 local-sphere) 0.0 7782.4004 0.0 4915.2) + (set-vector! (-> gp-0 unknown-sphere-array00 2 local-sphere) 0.0 10649.6 0.0 4915.2) + ) + ((= arg0 'mech) + (sphere<-vector+r! + (the-as sphere (-> gp-0 root-prim local-sphere)) + (new 'static 'vector :y 8192.0 :w 1.0) + 16384.0 + ) + (set-vector! (-> gp-0 unknown-sphere-array00 0 local-sphere) 0.0 4096.0 0.0 4096.0) + (set-vector! (-> gp-0 unknown-sphere-array00 1 local-sphere) 0.0 8601.6 0.0 6553.6) + (set-vector! (-> gp-0 unknown-sphere-array00 2 local-sphere) 0.0 14745.6 0.0 9420.8) + (logior! (-> self control penetrate-using) (penetrate touch mech)) + ) + ((= arg0 'mech-carry) + (set! (-> gp-0 unknown-vector04 y) 0.0) + (sphere<-vector+r! + (the-as sphere (-> gp-0 root-prim local-sphere)) + (new 'static 'vector :y 12288.0 :w 1.0) + 20480.0 + ) + (set-vector! (-> gp-0 unknown-sphere-array00 0 local-sphere) 0.0 4096.0 0.0 4096.0) + (set-vector! (-> gp-0 unknown-sphere-array00 1 local-sphere) 0.0 8601.6 0.0 6553.6) + (set-vector! + (-> gp-0 unknown-sphere-array00 2 local-sphere) + 0.0 + (+ 5734.4 (lerp-scale 9011.2 12288.0 arg1 0.0 1.0)) + 0.0 + (lerp-scale 9420.8 12697.6 arg1 0.0 1.0) + ) + ) + ((= arg0 'duck) + (set! (-> self control unknown-float31) arg1) + (let ((f30-1 (- 1.0 arg1))) + (set! (-> gp-0 unknown-vector04 y) 0.0) + (sphere<-vector+r! + (the-as sphere (-> gp-0 root-prim local-sphere)) + (-> *TARGET-bank* root-offset) + (-> *TARGET-bank* root-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 0 local-sphere) + 0.0 + (-> *TARGET-bank* body-radius) + (* 0.0 f30-1) + (-> *TARGET-bank* body-radius) + ) + (if (using-gun? self) + (set-vector! + (-> gp-0 unknown-sphere-array00 1 local-sphere) + 0.0 + (+ 2867.2 (-> *TARGET-bank* body-radius)) + 0.0 + (-> *TARGET-bank* body-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 1 local-sphere) + 0.0 + (+ (-> *TARGET-bank* body-radius) (* 2867.2 f30-1)) + 0.0 + (-> *TARGET-bank* body-radius) + ) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 2 local-sphere) + 0.0 + (+ (-> *TARGET-bank* body-radius) (* 5734.4 f30-1)) + 0.0 + (-> *TARGET-bank* body-radius) + ) + ) + ) + ((= arg0 'indax) + (let ((f30-2 0.2)) + (set! (-> gp-0 unknown-vector04 y) 0.0) + (sphere<-vector+r! + (the-as sphere (-> gp-0 root-prim local-sphere)) + (-> *TARGET-bank* root-offset) + (-> *TARGET-bank* root-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 0 local-sphere) + 0.0 + (-> *TARGET-bank* body-radius) + (* 0.0 f30-2) + (-> *TARGET-bank* body-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 1 local-sphere) + 0.0 + (+ (-> *TARGET-bank* body-radius) (* 2867.2 f30-2)) + 0.0 + (-> *TARGET-bank* body-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 2 local-sphere) + 0.0 + (+ (-> *TARGET-bank* body-radius) (* 5734.4 f30-2)) + 0.0 + (-> *TARGET-bank* body-radius) + ) + ) + (set! (-> gp-0 unknown-sphere-array00 4 prim-core collide-as) (collide-spec)) + (set! (-> gp-0 unknown-sphere-array00 4 prim-core collide-with) (collide-spec)) + 0 + ) + ((= arg0 'tube) + (set! (-> self control unknown-float31) arg1) + (let ((f30-3 (- 1.0 arg1))) + (set! (-> gp-0 unknown-vector04 y) 0.0) + (sphere<-vector+r! + (the-as sphere (-> gp-0 root-prim local-sphere)) + (-> *TARGET-bank* root-offset) + (-> *TARGET-bank* root-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 0 local-sphere) + 0.0 + (-> *TARGET-bank* body-radius) + (* 0.0 f30-3) + (-> *TARGET-bank* body-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 1 local-sphere) + 0.0 + (+ (-> *TARGET-bank* body-radius) (* 2867.2 f30-3)) + 0.0 + (-> *TARGET-bank* body-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 2 local-sphere) + 0.0 + (+ (-> *TARGET-bank* body-radius) (* 5734.4 f30-3)) + 0.0 + (-> *TARGET-bank* body-radius) + ) + ) + (logior! (-> self control penetrate-using) (penetrate touch tube)) + ) + ((= arg0 'carry) + (set! (-> gp-0 unknown-vector04 y) 0.0) + (sphere<-vector+r! + (the-as sphere (-> gp-0 root-prim local-sphere)) + (-> *TARGET-bank* root-offset) + (-> *TARGET-bank* root-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 0 local-sphere) + 0.0 + (-> *TARGET-bank* body-radius) + 0.0 + (-> *TARGET-bank* body-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 1 local-sphere) + 0.0 + (+ 2867.2 (-> *TARGET-bank* body-radius)) + 0.0 + (-> *TARGET-bank* body-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 2 local-sphere) + 0.0 + (+ 5734.4 (-> *TARGET-bank* body-radius)) + 0.0 + (lerp-scale (-> *TARGET-bank* body-radius) 7372.8 arg1 0.0 1.0) + ) + ) + ((= arg0 'gun) + (set! (-> self control unknown-float31) arg1) + (set! (-> gp-0 unknown-vector04 y) 0.0) + (sphere<-vector+r! + (the-as sphere (-> gp-0 root-prim local-sphere)) + (-> *TARGET-bank* root-offset) + (-> *TARGET-bank* root-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 0 local-sphere) + 0.0 + (-> *TARGET-bank* body-radius) + 0.0 + (-> *TARGET-bank* body-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 1 local-sphere) + 0.0 + (+ 2867.2 (-> *TARGET-bank* body-radius)) + 0.0 + (-> *TARGET-bank* body-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 2 local-sphere) + 0.0 + (+ 5734.4 (-> *TARGET-bank* body-radius)) + 0.0 + (-> *TARGET-bank* body-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 3 local-sphere) + 0.0 + (+ 5734.4 (-> *TARGET-bank* body-radius)) + 0.0 + (lerp-scale (-> *TARGET-bank* body-radius) 4915.2 arg1 0.0 1.0) + ) + (set! (-> gp-0 unknown-sphere-array00 3 prim-core collide-with) (collide-spec + backgnd + bot + crate + obstacle + hit-by-player-list + hit-by-others-list + player-list + water + collectable + blocking-plane + tobot + pusher + vehicle-mesh + obstacle-for-jak + ) + ) + ) + (else + (set! (-> self control unknown-float31) 0.0) + (set! (-> gp-0 unknown-vector04 y) 0.0) + (sphere<-vector+r! + (the-as sphere (-> gp-0 root-prim local-sphere)) + (-> *TARGET-bank* root-offset) + (-> *TARGET-bank* root-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 0 local-sphere) + 0.0 + (-> *TARGET-bank* body-radius) + 0.0 + (-> *TARGET-bank* body-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 1 local-sphere) + 0.0 + (+ 2867.2 (-> *TARGET-bank* body-radius)) + 0.0 + (-> *TARGET-bank* body-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 2 local-sphere) + 0.0 + (+ 5734.4 (-> *TARGET-bank* body-radius)) + 0.0 + (-> *TARGET-bank* body-radius) + ) + ) + ) + (when (and (logtest? (focus-status dark) (-> self focus-status)) + (and (nonzero? (-> self darkjak)) (logtest? (-> self darkjak stage) 32)) + ) + (let ((f0-183 (lerp-scale 1.0 (-> self darkjak-giant-interp) (-> self darkjak-interp) 0.0 1.0))) + (set! (-> gp-0 unknown-sphere-array00 0 local-sphere w) + (* 0.5 (+ 1.0 f0-183) (-> gp-0 unknown-sphere-array00 0 local-sphere w)) + ) + (set! (-> gp-0 unknown-sphere-array00 0 local-sphere y) + (* 0.5 (+ 1.0 f0-183) (-> gp-0 unknown-sphere-array00 0 local-sphere y)) + ) + (set! (-> gp-0 unknown-sphere-array00 1 local-sphere w) + (* (-> gp-0 unknown-sphere-array00 1 local-sphere w) f0-183) + ) + (set! (-> gp-0 unknown-sphere-array00 1 local-sphere y) + (* (-> gp-0 unknown-sphere-array00 1 local-sphere y) f0-183) + ) + (set! (-> gp-0 unknown-sphere-array00 2 local-sphere w) + (* (-> gp-0 unknown-sphere-array00 2 local-sphere w) f0-183) + ) + (set! (-> gp-0 unknown-sphere-array00 2 local-sphere y) + (* (-> gp-0 unknown-sphere-array00 2 local-sphere y) f0-183) + ) + ) + ) + ) + 0 + ) + +(defmethod get-quaternion control-info ((obj control-info)) + (-> obj unknown-quaternion00) + ) + +(defbehavior debounce-speed target ((arg0 float) (arg1 float) (arg2 vector) (arg3 vector)) + (if (and (< 0.3 arg0) (< arg0 0.7) (< 0.0 arg1) (< (vector-dot arg2 arg3) 0.2)) + (set! arg0 0.0) + ) + arg0 + ) + +(defbehavior target-align-vel-z-adjust target ((arg0 float)) + (let ((f1-0 (-> self control unknown-float17))) + (* arg0 (if (< 0.0 f1-0) + (* (- 1.0 f1-0) (-> self control unknown-surface01 alignv)) + (-> self control unknown-surface01 alignv) + ) + ) + ) + ) + +(defmethod process-focusable-method-26 target ((obj target)) + (if (or (and (logtest? (focus-status dark) (-> obj focus-status)) + (nonzero? (-> obj darkjak)) + (logtest? (-> obj darkjak stage) 32) + ) + (logtest? (focus-status mech) (-> obj focus-status)) + ) + 0.1 + 1.0 + ) + ) + +(defmethod apply-alignment target ((obj target) (arg0 align-opts) (arg1 transformq) (arg2 vector)) + (with-pp + (let ((s2-0 (new 'stack-no-clear 'vector))) + (set! (-> s2-0 quad) (-> arg2 quad)) + (set! (-> s2-0 z) (target-align-vel-z-adjust (-> s2-0 z))) + (when (logtest? arg0 (align-opts adjust-x-vel adjust-y-vel adjust-xz-vel)) + (let* ((s3-0 (-> obj control unknown-matrix01)) + (s0-0 (-> obj control unknown-matrix00)) + (s1-0 (vector-matrix*! (new 'stack-no-clear 'vector) (-> obj control dynam gravity) s0-0)) + (a1-3 (vector-matrix*! (new 'stack-no-clear 'vector) (-> obj control transv) s0-0)) + ) + (if (logtest? arg0 (align-opts no-gravity)) + (set-vector! s1-0 0.0 0.0 0.0 1.0) + ) + (when (logtest? arg0 (align-opts adjust-x-vel)) + (set! (-> a1-3 x) (+ (* (-> arg1 trans x) (-> s2-0 x) (-> pp clock frames-per-second)) + (* (-> s1-0 x) (-> pp clock seconds-per-frame)) + ) + ) + (if (not (logtest? arg0 (align-opts adjust-xz-vel keep-other-velocities))) + (set! (-> a1-3 z) 0.0) + ) + ) + (if (and (logtest? arg0 (align-opts adjust-y-vel)) + (not (and (logtest? arg0 (align-opts ignore-y-if-zero)) (= (-> arg1 trans y) 0.0))) + ) + (set! (-> a1-3 y) (+ (* (-> arg1 trans y) (-> s2-0 y) (-> pp clock frames-per-second)) + (* (-> s1-0 y) (-> pp clock seconds-per-frame)) + ) + ) + ) + (when (logtest? arg0 (align-opts adjust-xz-vel)) + (set! (-> a1-3 z) (+ (* (-> arg1 trans z) (-> s2-0 z) (-> pp clock frames-per-second)) + (* (-> s1-0 z) (-> pp clock seconds-per-frame)) + ) + ) + (if (not (logtest? arg0 (align-opts adjust-x-vel keep-other-velocities))) + (set! (-> a1-3 x) 0.0) + ) + ) + (vector-matrix*! (-> obj control transv) a1-3 s3-0) + ) + ) + ) + (if (logtest? arg0 (align-opts adjust-quat)) + (quaternion-normalize! + (quaternion*! (-> obj control unknown-quaternion00) (-> obj control unknown-quaternion00) (-> arg1 quat)) + ) + ) + (the-as object (-> obj control)) + ) + ) + +(defun average-turn-angle ((arg0 target)) + (let ((f30-0 0.0)) + (dotimes (s5-0 8) + (+! f30-0 + (fabs + (deg-diff + (atan (-> arg0 control unknown-vector-array01 s5-0 x) (-> arg0 control unknown-vector-array01 s5-0 z)) + 0.0 + ) + ) + ) + ) + (* 0.125 f30-0) + ) + ) + +(defbehavior can-play-stance-amibent? target () + (and (or (and (= *kernel-boot-message* 'kiosk) + (>= (+ -300000 (-> *display* real-clock frame-counter)) (seconds 60)) + (>= (- (-> *display* base-clock frame-counter) (-> self control unknown-cpad-info00 change-time)) + (seconds 60) + ) + (>= (- (-> *display* game-clock frame-counter) (the-as int (-> self game kiosk-timeout))) (seconds 60)) + ) + (and (>= (- (-> self clock frame-counter) (-> self ambient-time)) (seconds 30)) + (not (logtest? (-> self control status) (cshape-moving-flags t-act))) + (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (not (or (logtest? (water-flags touch-water) (-> self water flags)) + (logtest? (-> self control status) (cshape-moving-flags on-water)) + ) + ) + (zero? (logand (focus-status dead hit grabbed in-head edge-grab pole flut tube board mech dark indax teleporting) + (-> self focus-status) + ) + ) + ) + ) + (not (paused?)) + (not (movie?)) + (>= (- (-> *display* base-clock frame-counter) (-> self control unknown-cpad-info00 change-time)) + (seconds 30) + ) + (!= (-> self tobot?) 'tobot) + (not (-> *setting-control* user-current talking)) + (not (-> *setting-control* user-current spooling)) + (not (-> *setting-control* user-current movie)) + (not (-> *setting-control* user-current hint)) + (not (logtest? (-> self focus-status) (focus-status dead hit grabbed))) + (logtest? (-> self game features) (game-feature sidekick)) + (case *kernel-boot-message* + (('kiosk) + (set! (-> self control unknown-cpad-info00 change-time) (-> *display* base-clock frame-counter)) + (auto-save-command 'restore 0 0 *default-pool* #f) + #f + ) + (else + #t + ) + ) + ) + ) + +(defbehavior target-height-above-ground target () + (- (-> self control trans y) (-> self control gspot-pos y)) + ) + +(defbehavior can-jump? target ((arg0 symbol)) + (and (or (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (< (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) + (the-as time-frame (-> *TARGET-bank* ground-timeout)) + ) + (and (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (< 0.866 (-> self control surface-angle)) + ) + (and (= arg0 'board) + (or (< (- (-> self clock frame-counter) (-> self board unknown-time-frame00)) (seconds 0.05)) + (and (< (- (-> self clock frame-counter) (-> self control unknown-time-frame14)) (seconds 0.5)) + (< (target-height-above-ground) 2048.0) + ) + ) + ) + ) + (and (not (logtest? (-> self control unknown-surface01 flags) (surface-flag no-jump))) + (not (logtest? (-> self state-flags) (state-flags sf7))) + (or (= arg0 'board) (!= (-> self control poly-pat event) 13)) + (if (= arg0 'target-roll-flip) + (>= 0.5 (-> self control unknown-float17)) + #t + ) + ) + ) + ) + +(defbehavior target-jump-go target () + (go target-jump (-> *TARGET-bank* jump-height-min) (-> *TARGET-bank* jump-height-max) (the-as surface #f)) + (none) + ) + +(defbehavior move-legs? target () + (!= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + ) + +(defbehavior jump-hit-ground-stuck? target () + (or (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (when (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) + (not (and *cheat-mode* (cpad-hold? (-> self control unknown-cpad-info00 number) r2))) + ) + (set! (-> self control unknown-time-frame14) (-> self clock frame-counter)) + #t + ) + ) + ) + +(defbehavior target-time-to-ground target () + (let ((f0-0 (target-height-above-ground)) + (f2-0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (f1-1 0.0) + ) + (while (< 0.0 f0-0) + (set! f1-1 (+ 5.0 f1-1)) + (+! f0-0 (* f2-0 (-> self clock seconds-per-frame))) + (set! f2-0 (- f2-0 (* (-> self control dynam gravity-length) (-> self clock seconds-per-frame)))) + ) + (the time-frame f1-1) + ) + ) + +(defbehavior fall-test target ((arg0 (state symbol target)) (arg1 float)) + (when (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) + (the-as time-frame (-> *TARGET-bank* ground-timeout)) + ) + (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (>= (target-height-above-ground) arg1) + ) + (if (< (- (-> self clock frame-counter) (-> self control rider-time)) + (the-as time-frame (-> *TARGET-bank* ground-timeout)) + ) + (send-event self 'push-transv (-> self control rider-last-move) #x7530) + ) + (go arg0 #f) + ) + (none) + ) + +(defbehavior slide-down-test target () + (if (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface csmf07))) + (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) + (the-as time-frame (-> *TARGET-bank* ground-timeout)) + ) + (logtest? (-> self control status) (cshape-moving-flags t-surface)) + (< 0.5 (-> self control surface-angle)) + ) + (go target-slide-down) + ) + (none) + ) + +(defbehavior smack-surface? target ((arg0 symbol)) + (and (< 0.7 (-> self control touch-angle)) + (and (< (-> self control surface-angle) 0.3) + (logtest? (-> self control status) (cshape-moving-flags t-wall)) + (or arg0 (zero? (logand (-> self control status) (cshape-moving-flags t-act)))) + ) + ) + ) + +(defbehavior can-roll? target () + (and (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (or (not (logtest? (-> self control status) (cshape-moving-flags t-wall))) + (>= 0.7 (-> self control touch-angle)) + ) + (< (-> self control unknown-float17) 0.7) + (not (logtest? (-> self state-flags) (state-flags sf8 sf9))) + (not (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak)))) + (>= (- (-> self clock frame-counter) (the-as int (-> *TARGET-bank* roll-timeout))) + (-> self control unknown-time-frame10) + ) + (or (not (enabled-gun? self)) + (not (-> *TARGET-bank* strafe-duck-jump)) + (and (< 0.3 (vector-dot (-> self control unknown-vector08) (-> self control unknown-matrix01 vector 2))) + (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame28)) (seconds 0.3)) + ) + ) + (not (and (not (using-gun? self)) (!= (-> self skel top-anim interp) 0.0))) + ) + ) + +(defbehavior can-duck? target () + (and (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (>= (-> self control unknown-float0000) 0.7) + (not (logtest? (water-flags under-water swimming) (-> self water flags))) + (not (logtest? (-> self state-flags) (state-flags sf9))) + (or (not (logtest? (water-flags wading) (-> self water flags))) + (< (- (- (-> self control trans y) (- (-> self water base-height) (-> self water wade-height)))) 2457.6) + ) + ) + ) + +(defun can-exit-duck? ((arg0 target)) + (let ((gp-0 (new 'stack-no-clear 'collide-query))) + (let ((s4-0 (new 'stack-no-clear 'inline-array 'sphere 2))) + (dotimes (s3-0 2) + ((method-of-type sphere new) (the-as symbol (-> s4-0 s3-0)) sphere) + ) + (set! (-> s4-0 0 quad) (-> arg0 control trans quad)) + (set! (-> s4-0 0 y) (+ 5734.4 (-> *TARGET-bank* body-radius) (-> s4-0 0 y))) + (set! (-> s4-0 0 r) (-> *TARGET-bank* body-radius)) + (set! (-> s4-0 1 quad) (-> arg0 control trans quad)) + (set! (-> s4-0 1 y) (+ 2867.2 (-> *TARGET-bank* body-radius) (-> s4-0 1 y))) + (set! (-> s4-0 1 r) (-> *TARGET-bank* body-radius)) + (let ((v1-12 gp-0)) + (set! (-> v1-12 spheres) s4-0) + (set! (-> v1-12 num-spheres) (the-as uint 2)) + (set! (-> v1-12 collide-with) (logclear + (-> arg0 control root-prim prim-core collide-with) + (collide-spec civilian enemy vehicle-sphere projectile) + ) + ) + (set! (-> v1-12 ignore-process0) #f) + (set! (-> v1-12 ignore-process1) #f) + (set! (-> v1-12 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-12 best-my-prim) (the-as collide-shape-prim #t)) + (set! (-> v1-12 action-mask) (collide-action solid)) + ) + ) + (if (fill-and-probe-using-spheres *collide-cache* gp-0) + #f + #t + ) + ) + ) + +(defbehavior can-hands? target ((arg0 symbol)) + (cond + ((or (logtest? (-> self state-flags) (state-flags sf8)) + (logtest? (-> self control unknown-surface01 flags) (surface-flag no-attack no-hands)) + ) + #f + ) + ((and (or (not arg0) + (and (< (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) + (the-as time-frame (-> *TARGET-bank* ground-timeout)) + ) + (< (-> self control unknown-float17) 0.7) + ) + ) + (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame11)) + (the-as time-frame (if (and (= (-> (the-as fact-info-target (-> self fact)) eco-type) 1) + (>= (-> (the-as fact-info-target (-> self fact)) eco-level) 1.0) + ) + (-> *TARGET-bank* yellow-attack-timeout) + (-> *TARGET-bank* attack-timeout) + ) + ) + ) + ) + #t + ) + (else + (set! (-> self control unknown-time-frame001) (-> self clock frame-counter)) + #f + ) + ) + ) + +(defbehavior can-feet? target ((arg0 symbol)) + (cond + ((or (logtest? (-> self state-flags) (state-flags sf8)) + (logtest? (-> self control unknown-surface01 flags) (surface-flag no-attack no-feet)) + ) + #f + ) + ((>= (- (-> self clock frame-counter) (-> self control unknown-time-frame12)) + (the-as time-frame (-> *TARGET-bank* attack-timeout)) + ) + #t + ) + (else + (set! (-> self control unknown-time-frame002) (-> self clock frame-counter)) + #f + ) + ) + ) + +(defbehavior are-still? target () + (or (= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + (< (-> self control unknown-float05) 61440.0) + ) + ) + +(defbehavior vector-local+! target ((arg0 vector) (arg1 vector)) + (let ((s5-0 (new-stack-vector0))) + (vector-matrix*! s5-0 arg1 (-> self control unknown-matrix01)) + (vector+! arg0 arg0 s5-0) + ) + ) + +(defbehavior move-forward target ((arg0 float)) + (let ((a1-0 (new-stack-vector0)) + (gp-0 (new-stack-vector0)) + ) + (set-vector! a1-0 0.0 0.0 arg0 1.0) + (vector-matrix*! gp-0 a1-0 (-> self control unknown-matrix01)) + (vector+! (-> self control transv) (-> self control transv) gp-0) + ) + ) + +(defbehavior set-forward-vel target ((arg0 float)) + (let ((gp-0 (new-stack-vector0))) + (vector-matrix*! gp-0 (-> self control transv) (-> self control unknown-matrix00)) + (set! (-> gp-0 z) arg0) + (set! (-> gp-0 x) 0.0) + (vector-matrix*! (-> self control transv) gp-0 (-> self control unknown-matrix01)) + ) + ) + +(defbehavior delete-back-vel target () + (let ((gp-0 (new-stack-vector0))) + (vector-z-quaternion! gp-0 (-> self control dir-targ)) + (let ((v1-1 (new-stack-vector0)) + (f0-1 (vector-dot gp-0 (-> self control transv))) + ) + 0.0 + (vector-! v1-1 (-> self control transv) (vector-float*! v1-1 gp-0 f0-1)) + (let* ((f1-2 (vector-length v1-1)) + (f2-0 f1-2) + ) + (if (< f0-1 0.0) + (set! f0-1 0.0) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) gp-0 f0-1) + (vector-float*! v1-1 v1-1 (/ f1-2 f2-0)) + ) + ) + ) + ) + 0 + (none) + ) + +(defbehavior set-side-vel target ((arg0 float)) + (let ((gp-0 (new-stack-vector0))) + (vector-matrix*! gp-0 (-> self control transv) (-> self control unknown-matrix00)) + (set! (-> gp-0 x) arg0) + (set! (-> gp-0 z) 0.0) + (vector-matrix*! (-> self control transv) gp-0 (-> self control unknown-matrix01)) + ) + ) + +(defun target-timed-invulnerable ((arg0 time-frame) (arg1 target) (arg2 int)) + (with-pp + (case arg2 + ((1) + (logior! (-> arg1 state-flags) (state-flags tinvul1)) + (set! (-> arg1 control unknown-time-frame22) (-> pp clock frame-counter)) + (set! (-> arg1 control unknown-time-frame23) arg0) + ) + ((2) + (set! (-> arg1 state-flags) (logior (state-flags tinvul2) (-> arg1 state-flags))) + (set! (-> arg1 control unknown-time-frame24) (-> pp clock frame-counter)) + (set! (-> arg1 control unknown-time-frame25) arg0) + ) + ) + (collide-shape-method-49 (-> arg1 control) 2 #x8000 0) + (logior! (-> arg1 focus-status) (focus-status ignore)) + 0 + (none) + ) + ) + +(defun target-timed-invulnerable-off ((arg0 target) (arg1 int)) + (let ((v1-0 arg1)) + (cond + ((zero? v1-0) + (logclear! (-> arg0 state-flags) (state-flags tinvul1 tinvul2)) + ) + ((= v1-0 1) + (logclear! (-> arg0 state-flags) (state-flags tinvul1)) + ) + ((= v1-0 2) + (logclear! (-> arg0 state-flags) (state-flags tinvul2)) + ) + ) + ) + (when (not (logtest? (state-flags tinvul1 tinvul2) (-> arg0 state-flags))) + (logclear! (-> arg0 draw status) (draw-control-status no-draw-bounds)) + (collide-shape-method-49 (-> arg0 control) 2 0 #x8000) + ) + 0 + (none) + ) + +(defbehavior target-log-attack target ((arg0 attack-info) (arg1 symbol)) + (if (and (= arg1 'background) (= (-> arg0 id) 2)) + (return #t) + ) + (let ((a3-0 (the-as object (-> self attack-info-old)))) + (dotimes (a2-2 8) + (let ((v1-9 (-> self attack-info-old a2-2))) + (when (= (-> arg0 id) (-> v1-9 id)) + (if (< (- (-> self clock frame-counter) (-> v1-9 attack-time)) + (the-as time-frame (-> *TARGET-bank* same-attack-invulnerable-timeout)) + ) + (return #f) + ) + (cond + ((= arg1 'test) + ) + (else + (mem-copy! (the-as pointer v1-9) (the-as pointer arg0) 160) + ) + ) + (return #t) + ) + (if (< (-> v1-9 attack-time) (-> (the-as attack-info a3-0) attack-time)) + (set! a3-0 v1-9) + ) + ) + ) + (case arg1 + (('test) + ) + (else + (mem-copy! (the-as pointer a3-0) (the-as pointer arg0) 160) + ) + ) + ) + #t + ) + +(defmethod attack-info-method-9 attack-info ((obj attack-info) (arg0 attack-info) (arg1 process-drawable) (arg2 process-drawable)) + (local-vars (v1-14 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((s5-0 (if (type? arg1 process-drawable) + arg1 + ) + ) + ) + (let ((v1-0 (if (type? arg2 process-drawable) + arg2 + ) + ) + ) + (cond + ((logtest? (attack-info-mask attacker-velocity) (-> obj mask)) + (set! (-> arg0 attacker-velocity quad) (-> obj attacker-velocity quad)) + (vector-normalize-copy! (-> arg0 trans) (-> arg0 attacker-velocity) 1.0) + ) + (v1-0 + (cond + (s5-0 + (vector-! (-> arg0 trans) (-> v1-0 root trans) (-> s5-0 root trans)) + (vector-normalize! (-> arg0 trans) 1.0) + (set! (-> arg0 attacker-velocity quad) (-> arg0 trans quad)) + ) + (else + (vector-z-quaternion! (-> arg0 trans) (-> v1-0 root quat)) + (vector-negate-in-place! (-> arg0 trans)) + (vector-normalize! (-> arg0 trans) 1.0) + (set! (-> arg0 attacker-velocity quad) (-> arg0 trans quad)) + ) + ) + ) + (else + (set! (-> arg0 trans quad) (the-as uint128 0)) + (set! (-> arg0 attacker-velocity quad) (the-as uint128 0)) + ) + ) + ) + (if s5-0 + (set! (-> arg0 intersection quad) (-> s5-0 root trans quad)) + (set! (-> arg0 intersection quad) (-> (target-pos 0) quad)) + ) + ) + (.lvf vf1 (&-> (-> arg0 trans) quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.mov v1-14 vf1) + (cond + ((!= v1-14 0.0) + (set! (-> arg0 vector quad) (-> arg0 trans quad)) + (set! (-> arg0 vector y) 0.0) + (vector-xz-normalize! (-> arg0 vector) 1.0) + ) + (else + (set! (-> arg0 vector quad) (the-as uint128 0)) + ) + ) + 0 + (none) + ) + ) + +(defmethod attack-info-method-10 attack-info ((obj attack-info) (arg0 object) (arg1 process-drawable) (arg2 process) (arg3 touching-shapes-entry)) + (when (and arg3 arg1) + (let ((a1-2 (prims-touching? arg3 (the-as collide-shape (-> arg1 root)) (the-as uint -1)))) + (when a1-2 + (get-intersect-point (-> obj intersection) a1-2 (the-as collide-shape (-> arg1 root)) arg3) + (logior! (-> obj mask) (attack-info-mask intersection)) + ) + ) + ) + (when arg1 + (set! (-> obj prev-state) (-> arg1 state)) + (logior! (-> obj mask) (attack-info-mask prev-state)) + ) + (when (not (logtest? (-> obj mask) (attack-info-mask attacker))) + (set! (-> obj attacker) (process->handle arg2)) + (logior! (-> obj mask) (attack-info-mask attacker)) + ) + (when (not (logtest? (-> obj mask) (attack-info-mask attack-time))) + (set! (-> obj attack-time) (-> *display* base-clock frame-counter)) + (logior! (-> obj mask) (attack-info-mask attack-time)) + ) + (if (not (logtest? (attack-info-mask damage) (-> obj mask))) + (set! (-> obj damage) (-> *FACT-bank* health-default-inc)) + ) + obj + ) + +(defmethod combine! attack-info ((obj attack-info) (arg0 attack-info) (arg1 process-drawable)) + (let ((s4-0 (-> arg0 mask))) + (set! (-> obj mask) (-> arg0 mask)) + (if (logtest? s4-0 (attack-info-mask attacker)) + (set! (-> obj attacker) (-> arg0 attacker)) + ) + (if (logtest? s4-0 (attack-info-mask mode)) + (set! (-> obj mode) (-> arg0 mode)) + ) + (if (logtest? s4-0 (attack-info-mask angle)) + (set! (-> obj angle) (-> arg0 angle)) + ) + (if (logtest? s4-0 (attack-info-mask dist)) + (set! (-> obj dist) (-> arg0 dist)) + ) + (if (logtest? s4-0 (attack-info-mask control)) + (set! (-> obj control) (-> arg0 control)) + ) + (if (logtest? s4-0 (attack-info-mask speed)) + (set! (-> obj speed) (-> arg0 speed)) + ) + (if (logtest? (attack-info-mask penetrate-using) s4-0) + (set! (-> obj penetrate-using) (-> arg0 penetrate-using)) + ) + (if (logtest? (attack-info-mask damage) s4-0) + (set! (-> obj damage) (-> arg0 damage)) + ) + (if (logtest? (attack-info-mask shield-damage) s4-0) + (set! (-> obj shield-damage) (-> arg0 shield-damage)) + ) + (if (logtest? (attack-info-mask knock) s4-0) + (set! (-> obj knock) (-> arg0 knock)) + ) + (if (logtest? (attack-info-mask count) s4-0) + (set! (-> obj count) (-> arg0 count)) + ) + (if (logtest? s4-0 (attack-info-mask id)) + (set! (-> obj id) (-> arg0 id)) + ) + (if (logtest? s4-0 (attack-info-mask shove-back)) + (set! (-> obj shove-back) (-> arg0 shove-back)) + ) + (if (logtest? s4-0 (attack-info-mask shove-up)) + (set! (-> obj shove-up) (-> arg0 shove-up)) + ) + (if (logtest? s4-0 (attack-info-mask invinc-time)) + (set! (-> obj invinc-time) (-> arg0 invinc-time)) + ) + (if (logtest? s4-0 (attack-info-mask rotate-to)) + (set! (-> obj rotate-to) (-> arg0 rotate-to)) + ) + (if (logtest? s4-0 (attack-info-mask intersection)) + (set! (-> obj intersection quad) (-> arg0 intersection quad)) + ) + (if (logtest? (attack-info-mask attacker-velocity) s4-0) + (set! (-> obj attacker-velocity quad) (-> arg0 attacker-velocity quad)) + ) + (cond + ((not (logtest? s4-0 (attack-info-mask vector))) + (let* ((s2-0 (handle->process (-> obj attacker))) + (v1-65 (if (type? s2-0 process-drawable) + s2-0 + ) + ) + ) + (when (and v1-65 (nonzero? (-> (the-as process-drawable v1-65) root))) + (set! (-> obj trans quad) (-> (the-as process-drawable v1-65) root trans quad)) + (vector-! (-> obj vector) (-> arg1 root trans) (-> (the-as process-drawable v1-65) root trans)) + (logior! (-> obj mask) (attack-info-mask vector)) + ) + ) + ) + (else + (let* ((s3-1 (handle->process (-> obj attacker))) + (v1-72 (if (type? s3-1 process-drawable) + s3-1 + ) + ) + ) + (if (and v1-72 (nonzero? (-> (the-as process-drawable v1-72) root))) + (set! (-> obj trans quad) (-> (the-as process-drawable v1-72) root trans quad)) + ) + ) + (set! (-> obj vector quad) (-> arg0 vector quad)) + (when (not (logtest? s4-0 (attack-info-mask shove-back))) + (let ((v1-79 (-> obj vector))) + (set! (-> obj shove-back) (sqrtf (+ (* (-> v1-79 x) (-> v1-79 x)) (* (-> v1-79 z) (-> v1-79 z))))) + ) + ) + (if (not (logtest? s4-0 (attack-info-mask shove-up))) + (set! (-> obj shove-up) (-> obj vector y)) + ) + ) + ) + (if (not (logtest? (-> obj mask) (attack-info-mask dist))) + (set! (-> obj dist) (fabs (-> obj shove-back))) + ) + (if (logtest? s4-0 (attack-info-mask trans)) + (set! (-> obj trans quad) (-> arg0 trans quad)) + ) + ) + obj + ) + +(defbehavior ground-tween-initialize target ((arg0 ground-tween-info) + (arg1 uint) + (arg2 uint) + (arg3 uint) + (arg4 uint) + (arg5 uint) + (arg6 uint) + (arg7 float) + ) + (set! (-> arg0 group 0) arg2) + (set! (-> arg0 group 1) arg3) + (set! (-> arg0 group 2) arg4) + (set! (-> arg0 group 3) arg5) + (set! (-> arg0 group 4) arg6) + (dotimes (s2-0 3) + (set! (-> arg0 chan s2-0) (+ arg1 s2-0)) + (let ((s1-0 (-> self skel root-channel (-> arg0 chan s2-0)))) + (let ((f0-1 (fabs (-> arg0 blend s2-0)))) + (set! (-> s1-0 frame-interp 1) f0-1) + (set! (-> s1-0 frame-interp 0) f0-1) + ) + (joint-control-channel-group-eval! s1-0 (the-as art-joint-anim arg2) num-func-identity) + (set! (-> s1-0 frame-num) arg7) + ) + ) + arg0 + ) + +(defbehavior ground-tween-update target ((arg0 ground-tween-info) (arg1 float) (arg2 float) (arg3 float)) + (let ((f0-1 (fmax -1.0 (fmin 1.0 arg1))) + (f30-0 (fmax -1.0 (fmin 1.0 arg2))) + ) + (let ((f1-5 (fabs (- f0-1 (-> arg0 blend 1))))) + (seek! (-> arg0 blend 1) f0-1 (fmax (fmin (* f1-5 arg3) (* 0.8 arg3)) (* 0.2 arg3))) + ) + (let ((f0-9 (fabs (- f30-0 (-> arg0 blend 2))))) + (seek! (-> arg0 blend 2) f30-0 (fmax (fmin (* f0-9 arg3) (* 0.8 arg3)) (* 0.2 arg3))) + ) + ) + (cond + ((>= (-> arg0 blend 1) 0.0) + (let ((v1-12 (-> self skel root-channel (-> arg0 chan 1)))) + (let ((f0-16 (fabs (-> arg0 blend 1)))) + (set! (-> v1-12 frame-interp 1) f0-16) + (set! (-> v1-12 frame-interp 0) f0-16) + ) + (set! (-> v1-12 frame-group) (the-as art-joint-anim (-> arg0 group 1))) + ) + ) + (else + (let ((v1-15 (-> self skel root-channel (-> arg0 chan 1)))) + (let ((f0-18 (fabs (-> arg0 blend 1)))) + (set! (-> v1-15 frame-interp 1) f0-18) + (set! (-> v1-15 frame-interp 0) f0-18) + ) + (set! (-> v1-15 frame-group) (the-as art-joint-anim (-> arg0 group 2))) + ) + ) + ) + (cond + ((>= (-> arg0 blend 2) 0.0) + (let ((v1-18 (-> self skel root-channel (-> arg0 chan 2)))) + (let ((f0-21 (fabs (-> arg0 blend 2)))) + (set! (-> v1-18 frame-interp 1) f0-21) + (set! (-> v1-18 frame-interp 0) f0-21) + ) + (set! (-> v1-18 frame-group) (the-as art-joint-anim (-> arg0 group 4))) + ) + ) + (else + (let ((v1-21 (-> self skel root-channel (-> arg0 chan 2)))) + (let ((f0-23 (fabs (-> arg0 blend 2)))) + (set! (-> v1-21 frame-interp 1) f0-23) + (set! (-> v1-21 frame-interp 0) f0-23) + ) + (set! (-> v1-21 frame-group) (the-as art-joint-anim (-> arg0 group 3))) + ) + ) + ) + 0 + (none) + ) (defun target-pos ((arg0 int)) (let ((a1-0 *target*)) @@ -134,4 +1811,201 @@ ) ) ) - ) \ No newline at end of file + ) + +(defun target-cam-pos () + (let ((gp-0 *target*)) + (cond + ((not gp-0) + (camera-pos) + ) + ((logtest? (-> gp-0 state-flags) (state-flags sf6)) + (add-debug-sphere + *display-camera-marks* + (bucket-id debug-no-zbuf1) + (-> gp-0 alt-cam-pos) + (meters 0.2) + (new 'static 'rgba :r #xff :a #x80) + ) + (-> gp-0 alt-cam-pos) + ) + ((logtest? (-> gp-0 state-flags) (state-flags sf12)) + (add-debug-sphere + *display-camera-marks* + (bucket-id debug-no-zbuf1) + (-> gp-0 alt-cam-pos) + (meters 0.2) + (new 'static 'rgba :r #xff :a #x80) + ) + (-> gp-0 alt-cam-pos) + ) + ((logtest? (-> gp-0 state-flags) (state-flags sf14)) + (let ((s5-0 (new 'static 'vector))) + (set! (-> s5-0 quad) (-> gp-0 control unknown-vector15 quad)) + (set! (-> s5-0 y) (fmax (-> s5-0 y) (-> gp-0 alt-cam-pos y))) + (add-debug-sphere + *display-camera-marks* + (bucket-id debug-no-zbuf1) + s5-0 + (meters 0.2) + (new 'static 'rgba :r #xff :a #x80) + ) + s5-0 + ) + ) + (else + (add-debug-sphere + *display-camera-marks* + (bucket-id debug-no-zbuf1) + (-> gp-0 control unknown-vector15) + (meters 0.2) + (new 'static 'rgba :r #xff :a #x80) + ) + (-> gp-0 control unknown-vector15) + ) + ) + ) + ) + +(defun target-rot () + (let ((v1-0 *target*)) + (if v1-0 + (-> v1-0 control unknown-quaternion00) + *unity-quaternion* + ) + ) + ) + +(defmethod get-trans target ((obj target) (arg0 int)) + "@returns the `trans` [[vector]] from the process's `root` (typically either a [[trsqv]] or a [[collide-shape]]" + (local-vars (v0-0 vector)) + (let ((v1-0 (-> obj control))) + (cond + ((zero? arg0) + (-> v1-0 trans) + ) + ((= arg0 1) + (let ((a1-2 (-> obj water flags))) + (cond + ((and (logtest? (water-flags touch-water) a1-2) + (logtest? (water-flags under-water swimming) a1-2) + (zero? (logand (focus-status mech) (-> obj focus-status))) + ) + (set! v0-0 (new 'static 'vector :w 1.0)) + (set! (-> v0-0 quad) (-> obj control trans quad)) + (set! (-> v0-0 y) (-> obj water height)) + v0-0 + ) + (else + (-> v1-0 gspot-pos) + ) + ) + ) + ) + ((= arg0 2) + (vector<-cspace! (new 'static 'vector) (-> obj node-list data 8)) + ) + ((= arg0 3) + (set! v0-0 (vector<-cspace! (new 'static 'vector) (-> obj node-list data 6))) + (set! (-> v0-0 w) 4096.0) + v0-0 + ) + ((= arg0 4) + (target-cam-pos) + ) + ((= arg0 5) + (if (= (-> obj draw origin w) 0.0) + (-> v1-0 trans) + (-> obj draw origin) + ) + ) + ((= arg0 6) + (let ((f0-4 (vector-dot (-> v1-0 dynam gravity-normal) (-> v1-0 transv)))) + (cond + ((and (< 0.0 f0-4) (logtest? (-> obj focus-status) (focus-status in-air))) + (let* ((v0-1 (new 'static 'vector)) + (f0-5 (+ (* 0.0016666667 (-> v1-0 dynam gravity-length)) f0-4)) + (f0-8 (/ (* 0.5 f0-5 f0-5) (-> v1-0 dynam gravity-length))) + ) + (vector+float*! v0-1 (-> v1-0 trans) (-> v1-0 dynam gravity-normal) f0-8) + ) + ) + (else + (-> v1-0 trans) + ) + ) + ) + ) + ((= arg0 7) + (-> v1-0 unknown-vector23) + ) + ((= arg0 8) + (-> v1-0 unknown-vector42) + ) + (else + (-> v1-0 trans) + ) + ) + ) + ) + +(defmethod process-focusable-method-23 target ((obj target) (arg0 int)) + (let ((v1-0 (-> obj control))) + (cond + ((zero? arg0) + (let ((f0-1 (vector-dot (-> v1-0 dynam gravity-normal) (-> v1-0 transv)))) + (if (and (< 0.0 f0-1) (logtest? (-> obj focus-status) (focus-status in-air))) + (time-to-apex f0-1 (- (-> v1-0 dynam gravity-length))) + 0 + ) + ) + ) + ((= arg0 1) + (if (logtest? (-> obj focus-status) (focus-status in-air)) + (the-as int (target-time-to-ground)) + 0 + ) + ) + (else + 0 + ) + ) + ) + ) + +(defmethod get-quat target ((obj target) (arg0 int)) + (let ((v1-0 arg0)) + (cond + ((zero? v1-0) + (-> obj control quat) + ) + ((= v1-0 1) + (-> obj control unknown-quaternion00) + ) + ((= v1-0 2) + (-> obj control dir-targ) + ) + ((= v1-0 3) + (if (using-gun? obj) + (forward-up->quaternion + (new 'static 'quaternion) + (-> obj gun fire-dir-out) + (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> obj control unknown-quaternion00)) + ) + (-> obj control quat) + ) + ) + (else + (-> obj control quat) + ) + ) + ) + ) + +(defmethod get-water-height target ((obj target)) + (-> obj water surface-height) + ) + +(defmethod process-focusable-method-25 target ((obj target)) + (-> obj neck notice-time) + ) diff --git a/goal_src/jak2/engine/target/target.gc b/goal_src/jak2/engine/target/target.gc index 385782742a..b5b585f0ed 100644 --- a/goal_src/jak2/engine/target/target.gc +++ b/goal_src/jak2/engine/target/target.gc @@ -7,8 +7,6 @@ ;; DECOMP BEGINS -;; definition for function target-falling-trans -;; WARN: Return type mismatch int vs none. (defbehavior target-falling-trans target ((arg0 symbol) (arg1 time-frame)) (if (want-to-darkjak?) (go target-darkjak-get-on 2) @@ -36,7 +34,6 @@ (none) ) -;; failed to figure out what this is: (defstate target-startup (target) :event target-standard-event-handler :code (behavior () @@ -48,7 +45,6 @@ :post target-no-move-post ) -;; failed to figure out what this is: (defstate target-stance (target) :event target-standard-event-handler :enter (behavior () @@ -148,7 +144,6 @@ :post target-post ) -;; failed to figure out what this is: (defstate target-walk (target) :event target-walk-event-handler :enter (behavior () @@ -260,7 +255,6 @@ :post target-post ) -;; failed to figure out what this is: (defstate target-turn-around (target) :event target-standard-event-handler :enter (behavior () @@ -296,7 +290,7 @@ (if (and (cpad-pressed? (-> self control unknown-cpad-info00 number) square) (can-hands? #t)) (go target-running-attack) ) - (if (and (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (if (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) (seconds 0.08)) ) (go target-falling #f) @@ -326,7 +320,6 @@ :post target-no-stick-post ) -;; failed to figure out what this is: (defstate target-slide-down (target) :event target-walk-event-handler :enter (behavior () @@ -373,7 +366,6 @@ :post target-post ) -;; definition for symbol *slide-down-mods*, type surface (define *slide-down-mods* (new 'static 'surface :name 'run :turnv 131072.0 @@ -406,7 +398,6 @@ ) ) -;; definition for symbol *slide-jump-mods*, type surface (define *slide-jump-mods* (new 'static 'surface :name 'jump :turnv 32768.0 @@ -440,15 +431,14 @@ ) ) -;; failed to figure out what this is: (defstate target-slide-down-to-ground (target) - :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (case arg2 + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type (('slide) #f ) (else - (target-standard-event-handler arg0 arg1 arg2 arg3) + (target-standard-event-handler proc arg1 event-type event) ) ) ) @@ -578,8 +568,6 @@ ) ) -;; definition for function init-var-jump -;; INFO: Used lq/sq (defbehavior init-var-jump target ((arg0 float) (arg1 float) (arg2 symbol) (arg3 symbol) (arg4 vector) (arg5 float)) (when (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak)) @@ -658,8 +646,6 @@ ) ) -;; definition for function mod-var-jump -;; INFO: Used lq/sq (defbehavior mod-var-jump target ((arg0 symbol) (arg1 symbol) (arg2 symbol) (arg3 vector)) (local-vars (v0-1 vector)) (let ((f0-1 (* 0.033333335 (the float (- (-> self clock frame-counter) (-> self state-time)))))) @@ -736,7 +722,6 @@ ) ) -;; definition for symbol *duck-mods*, type surface (define *duck-mods* (new 'static 'surface :name 'duck @@ -790,7 +775,6 @@ ) ) -;; failed to figure out what this is: (defstate target-duck-stance (target) :event target-standard-event-handler :enter (behavior ((arg0 symbol)) @@ -823,8 +807,7 @@ ) :trans (behavior () ((-> self state-hook)) - (if (and (or (zero? (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons l1)) - ) + (if (and (or (not (cpad-hold? (-> self control unknown-cpad-info00 number) l1)) (logtest? (-> self state-flags) (state-flags sf9)) ) (let ((v1-13 (ja-group))) @@ -835,7 +818,7 @@ ) ) ) - (begin self (can-exit-duck?)) + (can-exit-duck? self) ) ) ) @@ -863,8 +846,8 @@ ) (if (and (cpad-pressed? (-> self control unknown-cpad-info00 number) square) (can-hands? #t) - (begin self (can-exit-duck?)) - (zero? (logand (-> self control unknown-surface01 flags) (surface-flag no-jump))) + (can-exit-duck? self) + (not (logtest? (-> self control unknown-surface01 flags) (surface-flag no-jump))) (zero? (logand (-> self state-flags) (state-flags sf7))) ) (go @@ -962,7 +945,6 @@ :post target-post ) -;; failed to figure out what this is: (defstate target-duck-walk (target) :event target-standard-event-handler :enter (behavior ((arg0 symbol)) @@ -982,14 +964,13 @@ :trans (behavior () (local-vars (v1-22 joint-control-channel)) ((-> self state-hook)) - (when (and (or (zero? (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) (pad-buttons l1)) - ) + (when (and (or (not (cpad-hold? (-> self control unknown-cpad-info00 number) l1)) (logtest? (-> self state-flags) (state-flags sf9)) (and (logtest? (water-flags wading) (-> self water flags)) (>= (- (- (-> self control trans y) (- (-> self water base-height) (-> self water wade-height)))) 2457.6) ) ) - (begin self (can-exit-duck?)) + (can-exit-duck? self) ) (if (and (using-gun? self) (begin (set! v1-22 (top-anim-joint-control-method-11 (-> self skel top-anim) 0)) v1-22) @@ -1021,8 +1002,8 @@ ) (if (and (cpad-pressed? (-> self control unknown-cpad-info00 number) square) (can-hands? #t) - (begin self (can-exit-duck?)) - (zero? (logand (-> self control unknown-surface01 flags) (surface-flag no-jump))) + (can-exit-duck? self) + (not (logtest? (-> self control unknown-surface01 flags) (surface-flag no-jump))) (zero? (logand (-> self state-flags) (state-flags sf7))) ) (go @@ -1083,8 +1064,6 @@ :post target-post ) -;; definition for function target-jump-top-anim -;; WARN: Return type mismatch int vs none. (defbehavior target-jump-top-anim target () (let ((gp-0 (top-anim-joint-control-method-11 (-> self skel top-anim) 0))) (when gp-0 @@ -1106,7 +1085,6 @@ (none) ) -;; failed to figure out what this is: (defstate target-jump (target) :event target-jump-event-handler :enter (behavior ((arg0 float) (arg1 float) (arg2 surface)) @@ -1169,7 +1147,7 @@ (* 12288.0 (-> self darkjak-giant-interp) (-> self darkjak-giant-interp)) ) (and (< -61440.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) - (zero? (logand (water-flags touch-water) (-> self water flags))) + (not (logtest? (water-flags touch-water) (-> self water flags))) (zero? (logand (state-flags sf7 sf23) (-> self state-flags))) ) ) @@ -1183,8 +1161,8 @@ (and (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame14)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) - (zero? (logand (-> self state-flags) (state-flags sf8))) - (zero? (logand (-> self control unknown-surface01 flags) (surface-flag no-attack no-hands))) + (not (logtest? (-> self state-flags) (state-flags sf8))) + (not (logtest? (-> self control unknown-surface01 flags) (surface-flag no-attack no-hands))) (not (and (not (using-gun? self)) (!= (-> self skel top-anim interp) 0.0))) ) ) @@ -1336,7 +1314,6 @@ :post target-post ) -;; failed to figure out what this is: (defstate target-jump-forward (target) :event target-jump-event-handler :enter (behavior ((arg0 float) (arg1 float)) @@ -1398,7 +1375,6 @@ :post target-post ) -;; failed to figure out what this is: (defstate target-double-jump (target) :event target-jump-event-handler :enter (behavior ((arg0 float) (arg1 float)) @@ -1439,8 +1415,8 @@ (and (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame14)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) - (zero? (logand (-> self state-flags) (state-flags sf8))) - (zero? (logand (-> self control unknown-surface01 flags) (surface-flag no-attack no-hands))) + (not (logtest? (-> self state-flags) (state-flags sf8))) + (not (logtest? (-> self control unknown-surface01 flags) (surface-flag no-attack no-hands))) (not (and (not (using-gun? self)) (!= (-> self skel top-anim interp) 0.0))) ) ) @@ -1535,7 +1511,6 @@ :post target-post ) -;; failed to figure out what this is: (defstate target-high-jump (target) :event target-jump-event-handler :enter (behavior ((arg0 float) (arg1 float) (arg2 object)) @@ -1599,8 +1574,8 @@ (and (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame14)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) - (zero? (logand (-> self state-flags) (state-flags sf8))) - (zero? (logand (-> self control unknown-surface01 flags) (surface-flag no-attack no-hands))) + (not (logtest? (-> self state-flags) (state-flags sf8))) + (not (logtest? (-> self control unknown-surface01 flags) (surface-flag no-attack no-hands))) (not (and (not (using-gun? self)) (!= (-> self skel top-anim interp) 0.0))) ) ) @@ -1627,7 +1602,6 @@ :post target-post ) -;; failed to figure out what this is: (defstate target-duck-high-jump (target) :event target-standard-event-handler :enter (behavior ((arg0 float) (arg1 float) (arg2 symbol)) @@ -1679,7 +1653,6 @@ :post target-post ) -;; failed to figure out what this is: (defstate target-duck-high-jump-jump (target) :event target-jump-event-handler :enter (behavior ((arg0 float) (arg1 float) (arg2 symbol)) @@ -1827,7 +1800,6 @@ :post target-post ) -;; failed to figure out what this is: (defstate target-falling (target) :event target-jump-event-handler :enter (behavior ((arg0 symbol)) @@ -1885,7 +1857,6 @@ :post target-post ) -;; failed to figure out what this is: (defstate target-hit-ground (target) :event target-walk-event-handler :enter (behavior ((arg0 symbol)) @@ -1894,11 +1865,12 @@ ((or (= arg0 'stuck) (logtest? (focus-status indax) (-> self focus-status))) ) (else - (let ((f0-2 (vector-dot - (-> self control dynam gravity-normal) - (vector-! (new 'stack-no-clear 'vector) (-> self control unknown-vector21) (-> self control trans)) - ) - ) + (let ((f0-2 + (vector-dot + (-> self control dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> self control unknown-vector21) (-> self control trans)) + ) + ) ) (if (and (< (-> *TARGET-bank* fall-far) f0-2) (zero? (logand (-> self control status) (cshape-moving-flags on-water))) @@ -1924,11 +1896,11 @@ (delete-back-vel) ) (set! (-> self control unknown-surface00) *walk-mods*) - (let ((s5-0 (method-of-object (-> self water) water-control-method-11))) + (start-bobbing! + (-> self water) (lerp-scale 0.0 4096.0 (-> self control ground-impact-vel) 40960.0 102400.0) 600 1500 - (s5-0) ) (if (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak)) @@ -2002,7 +1974,7 @@ ) (target-jump-go) ) - (if (and (or (cpad-hold? (-> self control unknown-cpad-info00 number) l1) (begin self (not (can-exit-duck?)))) + (if (and (or (cpad-hold? (-> self control unknown-cpad-info00 number) l1) (not (can-exit-duck? self))) (can-duck?) ) (go target-duck-stance #f) @@ -2052,7 +2024,6 @@ :post target-post ) -;; definition for symbol *attack-mods*, type surface (define *attack-mods* (new 'static 'surface :name 'attack :tiltv 65536.0 @@ -2096,7 +2067,6 @@ ) ) -;; failed to figure out what this is: (let ((v1-25 (copy *attack-mods* 'global))) (set! (-> v1-25 flags) (surface-flag attack spin gun-turn-fast)) (set! (-> v1-25 mult-hook) (lambda :behavior target @@ -2115,40 +2085,38 @@ (set! *attack-end-mods* v1-25) ) -;; failed to figure out what this is: (defstate target-attack (target) - :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (case arg2 + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type (('touched) (cond - (((method-of-type touching-shapes-entry touching-shapes-entry-method-12) - (the-as touching-shapes-entry (-> arg3 param 0)) + (((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> event param 0)) (-> self control) (the-as uint 1920) ) - (let ((t9-1 target-send-attack) - (a1-2 (-> self control unknown-symbol04)) - (a2-2 (-> arg3 param 0)) - (a3-1 (-> self control unknown-symbol05)) - (t0-0 (-> self control unknown-dword05)) - ) - (-> self control penetrate-using) - (when (t9-1 arg0 (the-as uint a1-2) a2-2 (the-as int a3-1) (the-as int t0-0)) - (set! (-> self gun combo-window-start) (-> self clock frame-counter)) - (let ((v0-2 (the-as object (-> self state name)))) - (set! (-> self gun combo-window-state) (the-as symbol v0-2)) - v0-2 - ) + (when (target-send-attack + proc + (the-as uint (-> self control unknown-symbol04)) + (-> event param 0) + (the-as int (-> self control unknown-symbol05)) + (the-as int (-> self control unknown-dword05)) + (the-as uint (-> self control penetrate-using)) + ) + (set! (-> self gun combo-window-start) (-> self clock frame-counter)) + (let ((v0-2 (the-as object (-> self state name)))) + (set! (-> self gun combo-window-state) (the-as symbol v0-2)) + v0-2 ) ) ) (else - (target-dangerous-event-handler arg0 arg1 arg2 arg3) + (target-dangerous-event-handler proc arg1 event-type event) ) ) ) (('gun-combo) - (when (-> arg3 param 0) + (when (-> event param 0) (forward-up-nopitch->quaternion (-> self control dir-targ) (vector-! (new 'stack-no-clear 'vector) (-> self gun track-trans) (-> self control trans)) @@ -2163,7 +2131,7 @@ #f ) (else - (target-dangerous-event-handler arg0 arg1 arg2 arg3) + (target-dangerous-event-handler proc arg1 event-type event) ) ) ) @@ -2184,8 +2152,8 @@ ) (set-quaternion! (-> self control) (-> self control dir-targ)) (quaternion-copy! (-> self control unknown-quaternion04) (-> self control dir-targ)) - (set! (-> self control unknown-float40) 0.0) (set! (-> self control unknown-float41) 0.0) + (set! (-> self control unknown-float42) 0.0) (none) ) :exit (behavior () @@ -2376,7 +2344,6 @@ :post target-post ) -;; definition for symbol *run-attack-mods*, type surface (define *run-attack-mods* (new 'static 'surface :name 'punch :tiltv 32768.0 @@ -2403,76 +2370,75 @@ ) ) -;; failed to figure out what this is: (defstate target-running-attack (target) - :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (case arg2 + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type (('touched) (cond - (((method-of-type touching-shapes-entry touching-shapes-entry-method-12) - (the-as touching-shapes-entry (-> arg3 param 0)) + (((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> event param 0)) (-> self control) (the-as uint 1920) ) - (let ((t9-1 target-send-attack) - (a0-3 arg0) - (a1-2 (-> self control unknown-symbol04)) - (a2-2 (-> arg3 param 0)) - (a3-1 (-> self control unknown-symbol05)) - (t0-0 (-> self control unknown-dword05)) + (let ((gp-1 (target-send-attack + proc + (the-as uint (-> self control unknown-symbol04)) + (-> event param 0) + (the-as int (-> self control unknown-symbol05)) + (the-as int (-> self control unknown-dword05)) + (the-as uint (-> self control penetrate-using)) + ) + ) ) - (-> self control penetrate-using) - (let ((gp-1 (t9-1 a0-3 (the-as uint a1-2) a2-2 (the-as int a3-1) (the-as int t0-0)))) - (when gp-1 - (set! (-> self control unknown-time-frame17) (-> self clock frame-counter)) - (set! (-> self gun combo-window-start) (-> self clock frame-counter)) - (set! (-> self gun combo-window-state) (-> self state name)) - (let ((v1-13 (if (type? arg0 process-focusable) - arg0 - ) - ) - ) - (when v1-13 - (let* ((s5-1 (-> (the-as target v1-13) control)) - (v1-14 (if (type? s5-1 collide-shape) - s5-1 - ) - ) - ) - (if (and v1-14 (or (logtest? (-> v1-14 root-prim prim-core collide-as) (collide-spec enemy)) - (logtest? (-> v1-14 root-prim prim-core action) (collide-action no-smack)) - ) + (when gp-1 + (set! (-> self control unknown-time-frame17) (-> self clock frame-counter)) + (set! (-> self gun combo-window-start) (-> self clock frame-counter)) + (set! (-> self gun combo-window-state) (-> self state name)) + (let ((v1-13 (if (type? proc process-focusable) + proc ) - (set! (-> self control unknown-word04) (the-as uint (+ (-> self control unknown-word04) 1))) - ) - ) + ) + ) + (when v1-13 + (let* ((s5-1 (-> (the-as target v1-13) control)) + (v1-14 (if (type? s5-1 collide-shape) + s5-1 + ) + ) + ) + (if (and v1-14 (or (logtest? (-> v1-14 root-prim prim-core collide-as) (collide-spec enemy)) + (logtest? (-> v1-14 root-prim prim-core action) (collide-action no-smack)) + ) + ) + (set! (-> self control unknown-word04) (the-as uint (+ (-> self control unknown-word04) 1))) + ) ) ) - (cond - ((or (= gp-1 'die) (= gp-1 'push)) - (let ((v0-2 (the-as object (-> self clock frame-counter)))) - (set! (-> self control unknown-time-frame18) (the-as time-frame v0-2)) - v0-2 - ) + ) + (cond + ((or (= gp-1 'die) (= gp-1 'push)) + (let ((v0-2 (the-as object (-> self clock frame-counter)))) + (set! (-> self control unknown-time-frame18) (the-as time-frame v0-2)) + v0-2 ) - ((= gp-1 'back) - (let ((f0-0 -122880.0)) - (set! (-> self control unknown-word04) (the-as uint f0-0)) - f0-0 - ) + ) + ((= gp-1 'back) + (let ((f0-0 -122880.0)) + (set! (-> self control unknown-word04) (the-as uint f0-0)) + f0-0 ) - ) + ) ) ) ) ) (else - (target-dangerous-event-handler arg0 arg1 arg2 arg3) + (target-dangerous-event-handler proc arg1 event-type event) ) ) ) (('gun-combo) - (if (-> arg3 param 0) + (if (-> event param 0) (go target-stance) ) #t @@ -2481,7 +2447,7 @@ #f ) (else - (target-dangerous-event-handler arg0 arg1 arg2 arg3) + (target-dangerous-event-handler proc arg1 event-type event) ) ) ) @@ -2581,11 +2547,11 @@ ) ) ) - (zero? (logand (-> self state-flags) (state-flags sf7 sf8))) - (zero? (logand (-> self control unknown-surface01 flags) (surface-flag no-attack))) + (not (logtest? (-> self state-flags) (state-flags sf7 sf8))) + (not (logtest? (-> self control unknown-surface01 flags) (surface-flag no-attack))) (let ((v1-48 (ja-group))) (and (not (and v1-48 (= v1-48 (-> self draw art-group data 406)))) - (and (zero? (logand (-> self control unknown-surface01 flags) (surface-flag no-jump))) + (and (not (logtest? (-> self control unknown-surface01 flags) (surface-flag no-jump))) (zero? (logand (-> self state-flags) (state-flags sf7))) ) ) @@ -2600,7 +2566,7 @@ (if (and (logtest? (water-flags touch-water) (-> self water flags)) (zero? (mod (- (-> self clock frame-counter) (-> self state-time)) 21)) ) - (water-control-method-13 + (spawn-ripples (-> self water) 0.6 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 8)) @@ -2697,7 +2663,7 @@ (when (not (ja-min? 0)) (cond ((and (>= (ja-aframe-num 0) 20.0) - (and (and (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (and (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) @@ -2718,10 +2684,7 @@ ) (set-forward-vel 0.0) ) - ((and (zero? (logand (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-abs 0) - (pad-buttons square) - ) - ) + ((and (not (cpad-hold? (-> self control unknown-cpad-info00 number) square)) (>= (- (-> self clock frame-counter) (-> self control unknown-combo-tracker00 move-start-time)) (seconds 0.05) ) @@ -2848,12 +2811,12 @@ (set! (-> *run-attack-mods* turnvv) 0.0) ) (if (< 2 gp-2) - (set! f30-0 (* f30-0 (fmin 1.0 (-> self control unknown-float43)))) + (set! f30-0 (* f30-0 (fmin 1.0 (-> self control unknown-float44)))) ) (+! gp-2 1) ) ) - (if (and (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (if (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) @@ -2901,7 +2864,6 @@ :post target-post ) -;; definition for symbol *jump-attack-mods*, type surface (define *jump-attack-mods* (new 'static 'surface :name 'attack @@ -2952,17 +2914,16 @@ ) ) -;; failed to figure out what this is: (defstate target-attack-air (target) - :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (let ((v0-0 (target-bonk-event-handler arg0 arg1 arg2 arg3))) + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (let ((v0-0 (target-bonk-event-handler proc arg1 event-type event))) (cond (v0-0 (empty) v0-0 ) (else - (target-dangerous-event-handler arg0 arg1 arg2 arg3) + (target-dangerous-event-handler proc arg1 event-type event) ) ) ) @@ -3105,13 +3066,11 @@ :post target-post ) -;; failed to figure out what this is: (let ((v1-32 (copy *turn-around-mods* 'global))) (set! (-> v1-32 flags) (surface-flag attack gun-inactive)) (set! *uppercut-mods* v1-32) ) -;; definition for symbol *uppercut-jump-mods*, type surface (define *uppercut-jump-mods* (new 'static 'surface :name 'uppercut :turnvv 18204.445 @@ -3153,7 +3112,6 @@ ) ) -;; failed to figure out what this is: (defstate target-attack-uppercut (target) :event target-dangerous-event-handler :enter (behavior ((arg0 float) (arg1 float)) @@ -3255,7 +3213,7 @@ (suspend) (ja :num! (seek! (ja-aframe 7.0 0))) ) - (go target-darkjak-bomb1) + (go target-darkjak-bomb1 arg0 arg1) ) (else (ja-no-eval :group! (-> self draw art-group data 51) @@ -3275,12 +3233,11 @@ :post target-post ) -;; failed to figure out what this is: (defstate target-attack-uppercut-jump (target) - :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (case arg2 + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type (('gun-combo) - (when (-> arg3 param 0) + (when (-> event param 0) (forward-up-nopitch->quaternion (-> self control dir-targ) (vector-! (new 'stack-no-clear 'vector) (-> self gun track-trans) (-> self control trans)) @@ -3312,7 +3269,7 @@ #t ) (else - (target-dangerous-event-handler arg0 arg1 arg2 arg3) + (target-dangerous-event-handler proc arg1 event-type event) ) ) ) @@ -3346,8 +3303,8 @@ (and (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame14)) (the-as time-frame (-> *TARGET-bank* stuck-timeout)) ) - (zero? (logand (-> self state-flags) (state-flags sf8))) - (zero? (logand (-> self control unknown-surface01 flags) (surface-flag no-attack no-hands))) + (not (logtest? (-> self state-flags) (state-flags sf8))) + (not (logtest? (-> self control unknown-surface01 flags) (surface-flag no-attack no-hands))) (not (and (not (using-gun? self)) (!= (-> self skel top-anim interp) 0.0))) ) ) @@ -3468,24 +3425,23 @@ :post target-post ) -;; failed to figure out what this is: (defstate target-flop (target) - :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (local-vars (v1-0 symbol)) - (let ((v0-0 (target-bonk-event-handler arg0 arg1 arg2 arg3))) + (let ((v0-0 (target-bonk-event-handler proc arg1 event-type event))) (cond (v0-0 (empty) v0-0 ) - ((begin (set! v1-0 arg2) (= v1-0 'slide)) + ((begin (set! v1-0 event-type) (= v1-0 'slide)) #f ) ((= v1-0 'swim) (cond ((< 6144.0 (target-height-above-ground)) (sound-play "swim-flop") - (set! (-> self control unknown-float42) 0.0) + (set! (-> self control unknown-float43) 0.0) (go target-swim-down) ) (else @@ -3494,7 +3450,7 @@ ) ) (else - (target-dangerous-event-handler arg0 arg1 arg2 arg3) + (target-dangerous-event-handler proc arg1 event-type event) ) ) ) @@ -3570,7 +3526,7 @@ (when (and (or (< (target-move-dist (seconds 0.1)) 1638.4) (and (logtest? (-> self control status) (cshape-moving-flags t-wall)) (< 0.7 (-> self control poly-angle))) ) - (zero? (logand (-> self control status) (cshape-moving-flags t-act))) + (not (logtest? (-> self control status) (cshape-moving-flags t-act))) (>= (the-as uint (-> self control unknown-word04)) (the-as uint 2)) ) (set! (-> self control unknown-time-frame14) (-> self clock frame-counter)) @@ -3731,7 +3687,7 @@ (set! (-> gp-1 param 0) 0.0) (joint-control-channel-group-eval! gp-1 (the-as art-joint-anim #f) num-func-chan) ) - (set! f30-0 (* f30-0 (fmin 1.0 (-> self control unknown-float43)))) + (set! f30-0 (* f30-0 (fmin 1.0 (-> self control unknown-float44)))) (let ((v1-77 (new-stack-vector0)) (f0-33 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) ) @@ -3773,22 +3729,21 @@ :post target-post ) -;; failed to figure out what this is: (defstate target-flop-hit-ground (target) - :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (cond ((and (-> self next-state) (= (-> self next-state name) 'target-flop-hit-ground)) - (case arg2 + (case event-type (('swim 'slide) #f ) (else - (target-standard-event-handler arg0 arg1 arg2 arg3) + (target-standard-event-handler proc arg1 event-type event) ) ) ) (else - (target-jump-event-handler arg0 arg1 arg2 arg3) + (target-jump-event-handler proc arg1 event-type event) ) ) ) @@ -3876,15 +3831,14 @@ :post target-post ) -;; failed to figure out what this is: (defstate target-roll (target) - :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (if (= arg2 'touched) - (send-event arg0 'roll) + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (if (= event-type 'touched) + (send-event proc 'roll) ) - (case arg2 + (case event-type (('gun-combo) - (when (-> arg3 param 0) + (when (-> event param 0) (forward-up-nopitch->quaternion (-> self control dir-targ) (vector-! (new 'stack-no-clear 'vector) (-> self gun track-trans) (-> self control trans)) @@ -3898,7 +3852,7 @@ #t ) (else - (target-standard-event-handler arg0 arg1 arg2 arg3) + (target-standard-event-handler proc arg1 event-type event) ) ) ) @@ -4006,7 +3960,7 @@ ) (suspend) (ja :num! (seek!)) - (set! f30-0 (* f30-0 (fmin 1.0 (-> self control unknown-float43)))) + (set! f30-0 (* f30-0 (fmin 1.0 (-> self control unknown-float44)))) ) ) (if (and (or (< (- (-> self clock frame-counter) (the-as time-frame gp-0)) @@ -4053,12 +4007,11 @@ :post target-post ) -;; failed to figure out what this is: (defstate target-roll-flip (target) - :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (case arg2 + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type (('gun-combo) - (when (-> arg3 param 0) + (when (-> event param 0) (forward-up-nopitch->quaternion (-> self control dir-targ) (vector-! (new 'stack-no-clear 'vector) (-> self gun track-trans) (-> self control trans)) @@ -4070,7 +4023,7 @@ #t ) (else - (target-jump-event-handler arg0 arg1 arg2 arg3) + (target-jump-event-handler proc arg1 event-type event) ) ) ) @@ -4157,7 +4110,7 @@ ) (suspend) (ja :num! (seek!)) - (set! f30-0 (* f30-0 (fmin 1.0 (-> self control unknown-float43)))) + (set! f30-0 (* f30-0 (fmin 1.0 (-> self control unknown-float44)))) (set! v1-37 (or (ja-max? 0) (and (>= (ja-aframe-num 0) 4.0) (logtest? (-> self control status) (cshape-moving-flags on-surface))) @@ -4166,7 +4119,7 @@ ) ) (set! (-> self state-time) (-> self clock frame-counter)) - (while (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + (while (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.01)) (let ((v1-50 (ja-group))) (when (not (and v1-50 (= v1-50 (-> self draw art-group data 27)))) @@ -4227,9 +4180,8 @@ (none) ) ) - self (cond - ((not (can-exit-duck?)) + ((not (can-exit-duck? self)) (go target-duck-stance #f) ) (else diff --git a/goal_src/jak2/levels/common/airlock.gc b/goal_src/jak2/levels/common/airlock.gc index 037e70d201..18e103388f 100644 --- a/goal_src/jak2/levels/common/airlock.gc +++ b/goal_src/jak2/levels/common/airlock.gc @@ -356,39 +356,15 @@ (none) ) -(let ((a0-10 (new 'static 'skeleton-group - :name "skel-com-airlock-outer" - :extra #f - :info #f - :art-group-name "com-airlock-outer" - :bounds (new 'static 'vector :y 20480.0 :w 57344.0) - :version #x7 - ) - ) - ) - (set! (-> a0-10 jgeo) 0) - (set! (-> a0-10 janim) 2) - (set! (-> a0-10 mgeo 0) 1) - (set! (-> a0-10 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-10) - ) +(defskelgroup skel-com-airlock-outer com-airlock-outer 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 5 0 14) + ) -(let ((a0-11 (new 'static 'skeleton-group - :name "skel-com-airlock-inner" - :extra #f - :info #f - :art-group-name "com-airlock-inner" - :bounds (new 'static 'vector :y 20480.0 :w 57344.0) - :version #x7 - ) - ) - ) - (set! (-> a0-11 jgeo) 0) - (set! (-> a0-11 janim) 2) - (set! (-> a0-11 mgeo 0) 1) - (set! (-> a0-11 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-11) - ) +(defskelgroup skel-com-airlock-inner com-airlock-inner 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 5 0 14) + ) (defstate close (com-airlock) :virtual #t @@ -978,22 +954,10 @@ (none) ) -(let ((a0-20 (new 'static 'skeleton-group - :name "skel-fort-entry-gate" - :extra #f - :info #f - :art-group-name "fort-entry-gate" - :bounds (new 'static 'vector :y 12288.0 :w 40960.0) - :version #x7 - ) - ) - ) - (set! (-> a0-20 jgeo) 0) - (set! (-> a0-20 janim) 2) - (set! (-> a0-20 mgeo 0) 1) - (set! (-> a0-20 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-20) - ) +(defskelgroup skel-fort-entry-gate fort-entry-gate fort-entry-gate-lod0-jg fort-entry-gate-idle-ja + ((fort-entry-gate-lod0-mg (meters 999999))) + :bounds (static-spherem 0 3 0 10) + ) (deftype fort-entry-gate (com-airlock) () @@ -1051,22 +1015,7 @@ (none) ) -(let ((a0-24 (new 'static 'skeleton-group - :name "skel-hip-door-a" - :extra #f - :info #f - :art-group-name "hip-door-a" - :bounds (new 'static 'vector :y 8192.0 :w 20480.0) - :version #x7 - ) - ) - ) - (set! (-> a0-24 jgeo) 0) - (set! (-> a0-24 janim) 2) - (set! (-> a0-24 mgeo 0) 1) - (set! (-> a0-24 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-24) - ) +(defskelgroup skel-hip-door-a hip-door-a 0 2 ((1 (meters 999999))) :bounds (static-spherem 0 2 0 5)) (deftype hip-door-a (com-airlock) () @@ -1125,23 +1074,11 @@ (none) ) -(let ((a0-28 (new 'static 'skeleton-group - :name "skel-tomb-mar-door" - :extra #f - :info #f - :art-group-name "tomb-mar-door" - :bounds (new 'static 'vector :y 24576.0 :w 73728.0) - :version #x7 - :origin-joint-index 3 - ) - ) - ) - (set! (-> a0-28 jgeo) 0) - (set! (-> a0-28 janim) 2) - (set! (-> a0-28 mgeo 0) 1) - (set! (-> a0-28 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-28) - ) +(defskelgroup skel-tomb-mar-door tomb-mar-door 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 6 0 18) + :origin-joint-index 3 + ) (deftype tomb-mar-door (com-airlock) () @@ -1195,23 +1132,11 @@ ) -(let ((a0-34 (new 'static 'skeleton-group - :name "skel-pal-throne-door" - :extra #f - :info #f - :art-group-name "pal-throne-door" - :bounds (new 'static 'vector :y 24576.0 :w 98304.0) - :version #x7 - :origin-joint-index 3 - ) - ) - ) - (set! (-> a0-34 jgeo) 0) - (set! (-> a0-34 janim) 2) - (set! (-> a0-34 mgeo 0) 1) - (set! (-> a0-34 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-34) - ) +(defskelgroup skel-pal-throne-door pal-throne-door 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 6 0 24) + :origin-joint-index 3 + ) (deftype pal-throne-door (com-airlock) () @@ -1270,22 +1195,10 @@ (none) ) -(let ((a0-38 (new 'static 'skeleton-group - :name "skel-vin-door-ctyinda" - :extra #f - :info #f - :art-group-name "vin-door-ctyinda" - :bounds (new 'static 'vector :y 12288.0 :w 24576.0) - :version #x7 - ) - ) - ) - (set! (-> a0-38 jgeo) 0) - (set! (-> a0-38 janim) 2) - (set! (-> a0-38 mgeo 0) 1) - (set! (-> a0-38 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-38) - ) +(defskelgroup skel-vin-door-ctyinda vin-door-ctyinda 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 3 0 6) + ) (deftype vin-door-ctyinda (com-airlock) () @@ -1344,22 +1257,7 @@ (none) ) -(let ((a0-42 (new 'static 'skeleton-group - :name "skel-under-door" - :extra #f - :info #f - :art-group-name "hip-door-a" - :bounds (new 'static 'vector :y 8192.0 :w 20480.0) - :version #x7 - ) - ) - ) - (set! (-> a0-42 jgeo) 0) - (set! (-> a0-42 janim) 2) - (set! (-> a0-42 mgeo 0) 1) - (set! (-> a0-42 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-42) - ) +(defskelgroup skel-under-door hip-door-a 0 2 ((1 (meters 999999))) :bounds (static-spherem 0 2 0 5)) (deftype under-door (com-airlock) () @@ -1418,22 +1316,7 @@ (none) ) -(let ((a0-46 (new 'static 'skeleton-group - :name "skel-oracle-door" - :extra #f - :info #f - :art-group-name "oracle-door" - :bounds (new 'static 'vector :y 16384.0 :w 40960.0) - :version #x7 - ) - ) - ) - (set! (-> a0-46 jgeo) 0) - (set! (-> a0-46 janim) 2) - (set! (-> a0-46 mgeo 0) 1) - (set! (-> a0-46 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-46) - ) +(defskelgroup skel-oracle-door oracle-door 0 2 ((1 (meters 999999))) :bounds (static-spherem 0 4 0 10)) (deftype oracle-door (com-airlock) () diff --git a/goal_src/jak2/levels/common/enemy/bouncer.gc b/goal_src/jak2/levels/common/enemy/bouncer.gc index 4468d7ee4d..8999fdf310 100644 --- a/goal_src/jak2/levels/common/enemy/bouncer.gc +++ b/goal_src/jak2/levels/common/enemy/bouncer.gc @@ -28,22 +28,7 @@ (method-set! bouncer 12 (method-of-type process run-logic?)) -(let ((a0-3 (new 'static 'skeleton-group - :name "skel-bouncer" - :extra #f - :info #f - :art-group-name "bounceytarp" - :bounds (new 'static 'vector :w 16384.0) - :version #x7 - ) - ) - ) - (set! (-> a0-3 jgeo) 0) - (set! (-> a0-3 janim) 2) - (set! (-> a0-3 mgeo 0) 1) - (set! (-> a0-3 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-3) - ) +(defskelgroup skel-bouncer bounceytarp 0 2 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 4)) (defstate idle (bouncer) :virtual #t @@ -53,7 +38,7 @@ object (cond ((= evt-type 'bonk) - (when ((method-of-type touching-shapes-entry touching-shapes-entry-method-12) + (when ((method-of-type touching-shapes-entry prims-touching?) (the-as touching-shapes-entry (-> event param 0)) (the-as collide-shape (-> self root)) (the-as uint 1) @@ -73,7 +58,7 @@ (the-as uint 1) (the-as uint 0) ) - (when ((method-of-type touching-shapes-entry touching-shapes-entry-method-12) + (when ((method-of-type touching-shapes-entry prims-touching?) (the-as touching-shapes-entry gp-2) (the-as collide-shape (-> self root)) (the-as uint 1) @@ -87,7 +72,7 @@ ) ) ) - (((method-of-type touching-shapes-entry touching-shapes-entry-method-12) + (((method-of-type touching-shapes-entry prims-touching?) (the-as touching-shapes-entry gp-2) (the-as collide-shape (-> self root)) (the-as uint 4) @@ -119,7 +104,7 @@ ) ) (when (and (nonzero? a2-7) - (and ((method-of-type touching-shapes-entry touching-shapes-entry-method-12) + (and ((method-of-type touching-shapes-entry prims-touching?) (the-as touching-shapes-entry a0-17) (the-as collide-shape (-> self root)) (the-as uint a2-7) diff --git a/test/decompiler/reference/jak1/engine/anim/joint_REF.gc b/test/decompiler/reference/jak1/engine/anim/joint_REF.gc index 814afae408..d24554f0a5 100644 --- a/test/decompiler/reference/jak1/engine/anim/joint_REF.gc +++ b/test/decompiler/reference/jak1/engine/anim/joint_REF.gc @@ -741,6 +741,7 @@ ;; definition for function joint-control-remap! ;; INFO: Used lq/sq ;; INFO: Return type mismatch symbol vs object. +;; WARN: Failed load: (set! v1-29 (l.wu (+ a0-9 -4))) at op 75 (defun joint-control-remap! ((arg0 joint-control) (arg1 art-group) (arg2 art-group) (arg3 pair) (arg4 int) (arg5 string)) (local-vars (sv-16 int) diff --git a/test/decompiler/reference/jak1/engine/collide/collide-mesh_REF.gc b/test/decompiler/reference/jak1/engine/collide/collide-mesh_REF.gc index 94fa72bbe8..84dfa9fd15 100644 --- a/test/decompiler/reference/jak1/engine/collide/collide-mesh_REF.gc +++ b/test/decompiler/reference/jak1/engine/collide/collide-mesh_REF.gc @@ -169,6 +169,9 @@ ;; definition for method 13 of type collide-mesh ;; INFO: Return type mismatch int vs none. +;; WARN: Failed load: (set! vf1 (l.vf t0-4)) at op 77 +;; WARN: Failed load: (set! vf2 (l.vf t1-1)) at op 79 +;; WARN: Failed load: (set! vf3 (l.vf t2-2)) at op 81 (defmethod populate-cache! collide-mesh ((obj collide-mesh) (arg0 collide-mesh-cache-tri) (arg1 matrix)) (local-vars (t0-2 uint)) (rlet ((acc :class vf) diff --git a/test/decompiler/reference/jak1/engine/collide/collide-reaction-target_REF.gc b/test/decompiler/reference/jak1/engine/collide/collide-reaction-target_REF.gc index fe69ebec43..448188631d 100644 --- a/test/decompiler/reference/jak1/engine/collide/collide-reaction-target_REF.gc +++ b/test/decompiler/reference/jak1/engine/collide/collide-reaction-target_REF.gc @@ -26,6 +26,7 @@ ;; WARN: Stack slot offset 36 signed mismatch ;; WARN: Stack slot offset 36 signed mismatch ;; WARN: Stack slot offset 48 signed mismatch +;; WARN: Failed store: (s.q! v1-20 a0-7) at op 72 (defun poly-find-nearest-edge ((arg0 vector) (arg1 (inline-array vector)) (arg2 vector) (arg3 vector)) (local-vars (sv-32 vector) (sv-36 float) (sv-40 int) (sv-48 float) (sv-80 vector)) (set! sv-32 (new 'stack-no-clear 'vector)) diff --git a/test/decompiler/reference/jak1/engine/data/res_REF.gc b/test/decompiler/reference/jak1/engine/data/res_REF.gc index de8ce2cb3b..4a03f977d6 100644 --- a/test/decompiler/reference/jak1/engine/data/res_REF.gc +++ b/test/decompiler/reference/jak1/engine/data/res_REF.gc @@ -788,6 +788,7 @@ ;; definition for method 8 of type res-lump ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs res-lump. +;; WARN: Failed load: (set! v1-72 (l.wu (+ a0-58 -4))) at op 206 (defmethod mem-usage res-lump ((obj res-lump) (block memory-usage-block) (flags int)) (local-vars (sv-16 int)) (let ((mem-use-id 48) diff --git a/test/decompiler/reference/jak1/engine/debug/menu_REF.gc b/test/decompiler/reference/jak1/engine/debug/menu_REF.gc index 912e0346ed..0cd8d05780 100644 --- a/test/decompiler/reference/jak1/engine/debug/menu_REF.gc +++ b/test/decompiler/reference/jak1/engine/debug/menu_REF.gc @@ -621,6 +621,7 @@ ;; definition for function debug-menu-func-decode ;; INFO: Return type mismatch object vs function. +;; WARN: Failed load: (set! v1-1 (l.wu (+ a0-0 -4))) at op 5 (defun debug-menu-func-decode ((arg0 object)) (let ((v1-1 (rtype-of arg0))) (the-as function (cond @@ -809,6 +810,7 @@ ;; definition for function debug-menu-find-from-template ;; INFO: Return type mismatch object vs debug-menu. +;; WARN: Failed load: (set! a0-2 (l.wu (+ s5-0 -4))) at op 19 (defun debug-menu-find-from-template ((arg0 debug-menu-context) (arg1 pair)) (let ((s4-0 (the-as object (-> arg0 root-menu)))) (while (begin diff --git a/test/decompiler/reference/jak1/engine/draw/drawable_REF.gc b/test/decompiler/reference/jak1/engine/draw/drawable_REF.gc index f36c4f6cc1..80351f87b5 100644 --- a/test/decompiler/reference/jak1/engine/draw/drawable_REF.gc +++ b/test/decompiler/reference/jak1/engine/draw/drawable_REF.gc @@ -358,6 +358,9 @@ ;; definition (debug) for function draw-instance-info ;; INFO: Used lq/sq ;; INFO: Return type mismatch object vs none. +;; WARN: Failed load: (set! a2-12 (l.hu (+ a2-11 68))) at op 283 +;; WARN: Failed load: (set! a2-15 (l.hu (+ a2-14 70))) at op 289 +;; WARN: Failed load: (set! a2-18 (l.hu (+ a2-17 60))) at op 295 (defun-debug draw-instance-info ((arg0 string)) (local-vars (sv-16 uint) @@ -978,6 +981,7 @@ ;; definition for function real-main-draw-hook ;; INFO: Return type mismatch int vs none. +;; WARN: Failed store: (s.d! (+ (the-as (pointer gs-reg) a0-47) 8) a1-28) at op 332 ;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] ;; ERROR: Unsupported inline assembly instruction kind - [sync.l] ;; ERROR: Unsupported inline assembly instruction kind - [sync.p] diff --git a/test/decompiler/reference/jak1/engine/game/generic-obs_REF.gc b/test/decompiler/reference/jak1/engine/game/generic-obs_REF.gc index a9967cc84f..db8574784c 100644 --- a/test/decompiler/reference/jak1/engine/game/generic-obs_REF.gc +++ b/test/decompiler/reference/jak1/engine/game/generic-obs_REF.gc @@ -711,6 +711,8 @@ ;; definition for function command-get-process ;; INFO: Return type mismatch object vs process. +;; WARN: Failed load: (set! a0-1 (l.wu (+ a0-0 -4))) at op 11 +;; WARN: Failed load: (set! a0-2 (l.wu (+ a0-0 -4))) at op 48 ;; WARN: disable def twice: 68. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. ;; WARN: disable def twice: 82. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. ;; WARN: disable def twice: 96. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. @@ -784,6 +786,9 @@ ;; definition for function command-get-camera ;; INFO: Return type mismatch object vs state. +;; WARN: Failed load: (set! a0-3 (l.wu (+ a0-0 -4))) at op 47 +;; WARN: Failed load: (set! a0-1 (l.wu (+ a0-0 -4))) at op 23 +;; WARN: Failed load: (set! a0-2 (l.wu (+ a0-0 -4))) at op 35 (defun command-get-camera ((arg0 object) (arg1 state)) (the-as state (cond ((null? arg0) @@ -977,6 +982,8 @@ ;; definition for method 14 of type camera-tracker ;; INFO: Return type mismatch object vs process. +;; WARN: Failed load: (set! v1-42 (l.wu (+ a0-22 -4))) at op 159 +;; WARN: Failed load: (set! a0-72 (l.wu (+ s2-3 -4))) at op 393 (defmethod eval camera-tracker ((obj camera-tracker) (arg0 pair)) (with-pp (let ((gp-0 (the-as object #f))) @@ -1220,6 +1227,7 @@ ) ;; definition for function camera-tracker-init +;; WARN: Failed load: (set! a0-3 (l.wu (+ a0-0 -4))) at op 42 (defbehavior camera-tracker-init camera-tracker ((arg0 object)) (stack-size-set! (-> self main-thread) 512) (logclear! (-> self mask) (process-mask actor-pause movie enemy platform projectile)) diff --git a/test/decompiler/reference/jak1/engine/game/main_REF.gc b/test/decompiler/reference/jak1/engine/game/main_REF.gc index 5bc7e520cb..842ebd79a0 100644 --- a/test/decompiler/reference/jak1/engine/game/main_REF.gc +++ b/test/decompiler/reference/jak1/engine/game/main_REF.gc @@ -934,6 +934,7 @@ ) ;; definition for function display-loop +;; WARN: Failed store: (s.w! (+ v1-28 16) 0) at op 124 ;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] ;; ERROR: Unsupported inline assembly instruction kind - [sync.l] ;; ERROR: Unsupported inline assembly instruction kind - [sync.p] diff --git a/test/decompiler/reference/jak1/engine/geometry/bounding-box_REF.gc b/test/decompiler/reference/jak1/engine/geometry/bounding-box_REF.gc index 7c782b45ed..b3a76cb9df 100644 --- a/test/decompiler/reference/jak1/engine/geometry/bounding-box_REF.gc +++ b/test/decompiler/reference/jak1/engine/geometry/bounding-box_REF.gc @@ -24,6 +24,8 @@ ) ;; definition for method 11 of type bounding-box +;; WARN: Failed load: (set! vf3 (l.vf a2-0)) at op 0 +;; WARN: Failed load: (set! vf4 (l.vf a1-0)) at op 1 (defmethod set-from-point-offset! bounding-box ((obj bounding-box) (arg0 vector3s) (arg1 vector3s)) (rlet ((vf0 :class vf) (vf1 :class vf) @@ -47,6 +49,7 @@ ) ;; definition for method 10 of type bounding-box +;; WARN: Failed load: (set! vf3 (l.vf a1-0)) at op 2 (defmethod add-point! bounding-box ((obj bounding-box) (arg0 vector3s)) (rlet ((vf1 :class vf) (vf2 :class vf) @@ -83,6 +86,8 @@ ) ;; definition for method 12 of type bounding-box +;; WARN: Failed load: (set! vf4 (l.vf a2-0)) at op 0 +;; WARN: Failed load: (set! vf5 (l.vf a1-0)) at op 1 (defmethod set-from-point-offset-pad! bounding-box ((obj bounding-box) (arg0 vector3s) (arg1 vector3s) (arg2 float)) (rlet ((vf0 :class vf) (vf1 :class vf) diff --git a/test/decompiler/reference/jak1/engine/geometry/geometry_REF.gc b/test/decompiler/reference/jak1/engine/geometry/geometry_REF.gc index 70ddb230a6..a8282284dd 100644 --- a/test/decompiler/reference/jak1/engine/geometry/geometry_REF.gc +++ b/test/decompiler/reference/jak1/engine/geometry/geometry_REF.gc @@ -1043,6 +1043,9 @@ ) ;; definition for function curve-evaluate! +;; WARN: Failed load: (set! vf3 (l.vf (+ v1-9 16))) at op 67 +;; WARN: Failed load: (set! vf4 (l.vf (+ v1-9 32))) at op 69 +;; WARN: Failed load: (set! vf5 (l.vf (+ v1-9 48))) at op 71 ;; ERROR: Unsupported inline assembly instruction kind - [addiu v1, s3, -3] ;; ERROR: Unsupported inline assembly instruction kind - [sll v1, v1, 4] (defun curve-evaluate! ((arg0 vector) (arg1 float) (arg2 (inline-array vector)) (arg3 int) (arg4 (pointer float)) (arg5 int)) diff --git a/test/decompiler/reference/jak1/engine/gfx/generic/generic-merc_REF.gc b/test/decompiler/reference/jak1/engine/gfx/generic/generic-merc_REF.gc index 8da1aefdff..a661c47228 100644 --- a/test/decompiler/reference/jak1/engine/gfx/generic/generic-merc_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/generic/generic-merc_REF.gc @@ -70,6 +70,7 @@ ;; definition for function generic-merc-execute-all ;; INFO: Return type mismatch profile-frame vs none. +;; WARN: Failed store: (s.w! (the-as int a0-19) a1-7) at op 109 ;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] ;; ERROR: Unsupported inline assembly instruction kind - [sync.l] ;; ERROR: Unsupported inline assembly instruction kind - [sync.p] diff --git a/test/decompiler/reference/jak1/engine/gfx/generic/generic-vu1_REF.gc b/test/decompiler/reference/jak1/engine/gfx/generic/generic-vu1_REF.gc index 50ea707c36..359c431a25 100644 --- a/test/decompiler/reference/jak1/engine/gfx/generic/generic-vu1_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/generic/generic-vu1_REF.gc @@ -115,6 +115,13 @@ ;; definition for function generic-reset-buffers ;; INFO: Return type mismatch int vs none. +;; WARN: Failed store: (s.w! (+ t0-1 4) 0) at op 17 +;; WARN: Failed store: (s.w! (+ t0-1 8) a1-3) at op 21 +;; WARN: Failed store: (s.w! (+ t0-1 12) v1-5) at op 25 +;; WARN: Failed store: (s.w! (+ t0-1 16) 0) at op 26 +;; WARN: Failed store: (s.w! (+ t0-1 20) 0) at op 27 +;; WARN: Failed store: (s.w! (+ t0-1 24) 0) at op 28 +;; WARN: Failed store: (s.w! (+ t0-1 28) v1-6) at op 30 (defun generic-reset-buffers ((arg0 dma-buffer) (arg1 int) (arg2 int)) (when (logtest? *vu1-enable-user* (vu1-renderer-mask generic)) (let ((a3-0 (new 'static 'vector4w :x #x345 :y #x363)) diff --git a/test/decompiler/reference/jak1/engine/gfx/tie/tie-near_REF.gc b/test/decompiler/reference/jak1/engine/gfx/tie/tie-near_REF.gc index ab378dad23..a617f75fab 100644 --- a/test/decompiler/reference/jak1/engine/gfx/tie/tie-near_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/tie/tie-near_REF.gc @@ -129,6 +129,19 @@ ;; definition for function tie-near-init-engine ;; INFO: Return type mismatch int vs none. +;; WARN: Failed store: (s.w! (+ a0-2 8) a1-4) at op 19 +;; WARN: Failed store: (s.w! (+ a0-2 12) a1-6) at op 24 +;; WARN: Failed store: (s.w! (+ a0-6 8) a1-9) at op 40 +;; WARN: Failed store: (s.w! (+ a0-6 12) a1-10) at op 42 +;; WARN: Failed store: (s.w! (+ a0-8 8) 0) at op 49 +;; WARN: Failed store: (s.w! (+ a0-8 12) a1-12) at op 51 +;; WARN: Failed store: (s.w! (+ v1-7 4) a0-11) at op 58 +;; WARN: Failed store: (s.w! (+ v1-7 8) a0-12) at op 60 +;; WARN: Failed store: (s.w! (+ v1-7 12) a0-13) at op 62 +;; WARN: Failed store: (s.w! (+ v1-7 16) a0-14) at op 64 +;; WARN: Failed store: (s.w! (+ v1-7 20) a0-15) at op 66 +;; WARN: Failed store: (s.w! (+ v1-7 24) a0-16) at op 68 +;; WARN: Failed store: (s.w! (+ v1-7 28) a0-17) at op 70 (defun tie-near-init-engine ((arg0 dma-buffer) (arg1 gs-test) (arg2 int)) (when (logtest? *vu1-enable-user* (vu1-renderer-mask tie-near)) (dma-buffer-add-vu-function arg0 tie-near-vu1-block 1) @@ -202,6 +215,19 @@ ;; definition for function tie-near-end-buffer ;; INFO: Return type mismatch int vs none. +;; WARN: Failed store: (s.w! (+ a1-0 8) 0) at op 7 +;; WARN: Failed store: (s.w! (+ a1-0 12) a2-1) at op 9 +;; WARN: Failed store: (s.d! (+ a1-2 8) a2-4) at op 18 +;; WARN: Failed store: (s.d! (+ a1-4 8) a2-6) at op 26 +;; WARN: Failed store: (s.w! (+ a1-6 8) a2-8) at op 34 +;; WARN: Failed store: (s.w! (+ a1-6 12) 0) at op 35 +;; WARN: Failed store: (s.w! (+ a0-1 4) a1-9) at op 43 +;; WARN: Failed store: (s.w! (+ a0-1 8) a1-10) at op 45 +;; WARN: Failed store: (s.w! (+ a0-1 12) a1-11) at op 47 +;; WARN: Failed store: (s.w! (+ a0-1 16) 0) at op 48 +;; WARN: Failed store: (s.w! (+ a0-1 20) 0) at op 49 +;; WARN: Failed store: (s.w! (+ a0-1 24) 0) at op 50 +;; WARN: Failed store: (s.w! (+ a0-1 28) 0) at op 51 (defun tie-near-end-buffer ((arg0 dma-buffer)) (when (logtest? *vu1-enable-user* (vu1-renderer-mask tie-near)) (let* ((v1-2 arg0) diff --git a/test/decompiler/reference/jak1/engine/level/level_REF.gc b/test/decompiler/reference/jak1/engine/level/level_REF.gc index 6e42ecb485..1ec341cda6 100644 --- a/test/decompiler/reference/jak1/engine/level/level_REF.gc +++ b/test/decompiler/reference/jak1/engine/level/level_REF.gc @@ -730,6 +730,7 @@ ) ;; definition for method 12 of type level +;; WARN: Failed load: (set! v1-52 (l.wu (+ a0-29 -4))) at op 146 (defmethod unload! level ((obj level)) (deactivate obj) (when (!= (-> obj status) 'inactive) @@ -1126,6 +1127,7 @@ ) ;; definition for function bg +;; WARN: Failed load: (set! v1-4 (l.wu (+ a0-8 -4))) at op 32 (defun bg ((arg0 symbol)) (set! *cheat-mode* (if *debug-segment* 'debug diff --git a/test/decompiler/reference/jak1/engine/level/load-boundary_REF.gc b/test/decompiler/reference/jak1/engine/level/load-boundary_REF.gc index 1986f5f6bb..e3badb0f3a 100644 --- a/test/decompiler/reference/jak1/engine/level/load-boundary_REF.gc +++ b/test/decompiler/reference/jak1/engine/level/load-boundary_REF.gc @@ -1421,6 +1421,8 @@ ) ;; definition for function command-get-int +;; WARN: Failed load: (set! a0-2 (l.wu (+ a0-0 -4))) at op 23 +;; WARN: Failed load: (set! a0-1 (l.wu (+ a0-0 -4))) at op 11 (defun command-get-int ((arg0 object) (arg1 int)) (cond ((null? arg0) @@ -1441,6 +1443,8 @@ ) ;; definition for function command-get-float +;; WARN: Failed load: (set! a0-2 (l.wu (+ a0-0 -4))) at op 26 +;; WARN: Failed load: (set! a0-1 (l.wu (+ a0-0 -4))) at op 11 (defun command-get-float ((arg0 object) (arg1 float)) (cond ((null? arg0) @@ -1461,6 +1465,8 @@ ) ;; definition for function command-get-time +;; WARN: Failed load: (set! a0-5 (l.wu (+ a0-0 -4))) at op 42 +;; WARN: Failed load: (set! a0-4 (l.wu (+ a0-0 -4))) at op 30 (defun command-get-time ((arg0 object) (arg1 int)) (cond ((null? arg0) @@ -1484,6 +1490,8 @@ ) ;; definition for function command-get-param +;; WARN: Failed load: (set! a0-16 (l.wu (+ a0-0 -4))) at op 121 +;; WARN: Failed load: (set! a0-15 (l.wu (+ a0-0 -4))) at op 109 (defun command-get-param ((arg0 object) (arg1 object)) (cond ((null? arg0) @@ -1706,6 +1714,8 @@ ;; definition for function command-list-get-process ;; INFO: Return type mismatch object vs process. +;; WARN: Failed load: (set! a0-1 (l.wu (+ a0-0 -4))) at op 11 +;; WARN: Failed load: (set! a0-2 (l.wu (+ a0-0 -4))) at op 51 (defun command-list-get-process ((arg0 object)) (with-pp (set! arg0 @@ -1811,6 +1821,7 @@ ;; definition for method 15 of type load-state ;; INFO: Return type mismatch int vs none. +;; WARN: Failed load: (set! v1-138 (l.wu (+ a0-142 -4))) at op 648 (defmethod execute-command load-state ((obj load-state) (arg0 pair)) (local-vars (v1-26 int) (v1-57 int)) (with-pp diff --git a/test/decompiler/reference/jak1/engine/nav/navigate_REF.gc b/test/decompiler/reference/jak1/engine/nav/navigate_REF.gc index 939f604749..5df251fab8 100644 --- a/test/decompiler/reference/jak1/engine/nav/navigate_REF.gc +++ b/test/decompiler/reference/jak1/engine/nav/navigate_REF.gc @@ -803,6 +803,9 @@ ) ;; definition for method 29 of type nav-mesh +;; WARN: Failed load: (set! vf3 (l.vf a0-4)) at op 42 +;; WARN: Failed load: (set! vf4 (l.vf a1-3)) at op 45 +;; WARN: Failed load: (set! vf5 (l.vf v1-9)) at op 46 (defmethod is-in-mesh? nav-mesh ((obj nav-mesh) (arg0 vector) (arg1 float) (arg2 meters)) (local-vars (v1-10 float)) (rlet ((vf1 :class vf) diff --git a/test/decompiler/reference/jak1/kernel/gcommon_REF.gc b/test/decompiler/reference/jak1/kernel/gcommon_REF.gc index 8d805ab99e..a0b3d9b4d1 100644 --- a/test/decompiler/reference/jak1/kernel/gcommon_REF.gc +++ b/test/decompiler/reference/jak1/kernel/gcommon_REF.gc @@ -830,11 +830,13 @@ (define *print-column* (the-as binteger 0)) ;; definition for function print +;; WARN: Failed load: (set! v1-1 (l.wu (+ a0-0 -4))) at op 5 (defun print ((arg0 object)) ((method-of-type (rtype-of arg0) print) arg0) ) ;; definition for function printl +;; WARN: Failed load: (set! v1-1 (l.wu (+ a0-1 -4))) at op 7 (defun printl ((arg0 object)) (let ((a0-1 arg0)) ((method-of-type (rtype-of a0-1) print) a0-1) @@ -844,6 +846,7 @@ ) ;; definition for function inspect +;; WARN: Failed load: (set! v1-1 (l.wu (+ a0-0 -4))) at op 5 (defun inspect ((arg0 object)) ((method-of-type (rtype-of arg0) inspect) arg0) ) @@ -891,6 +894,12 @@ ) ;; definition for function valid? +;; WARN: Failed load: (set! a0-23 (l.wu (+ a0-0 -4))) at op 190 +;; WARN: Failed load: (set! t1-1 (l.wu (+ a0-0 -4))) at op 211 +;; WARN: Failed load: (set! a0-25 (l.wu (+ a0-0 -4))) at op 222 +;; WARN: Failed load: (set! t1-2 (l.wu (+ a0-0 -4))) at op 238 +;; WARN: Failed load: (set! v1-28 (l.wu (+ a0-0 -4))) at op 159 +;; WARN: Failed load: (set! t1-0 (l.wu (+ a0-0 -4))) at op 175 ;; ERROR: Unsupported inline assembly instruction kind - [daddu v1, v1, s7] ;; ERROR: Unsupported inline assembly instruction kind - [daddu v1, v1, s7] ;; ERROR: Unsupported inline assembly instruction kind - [daddu v1, v1, s7] diff --git a/test/decompiler/reference/jak1/levels/finalboss/robotboss-misc_REF.gc b/test/decompiler/reference/jak1/levels/finalboss/robotboss-misc_REF.gc index 2ee619a3fc..5c8dad1925 100644 --- a/test/decompiler/reference/jak1/levels/finalboss/robotboss-misc_REF.gc +++ b/test/decompiler/reference/jak1/levels/finalboss/robotboss-misc_REF.gc @@ -175,6 +175,9 @@ ;; definition for function ecoclaw-handler ;; INFO: Used lq/sq ;; INFO: Return type mismatch none vs object. +;; WARN: Failed load: (set! a0-3 (l.wu (+ gp-1 -4))) at op 13 +;; WARN: Failed load: (set! a0-6 (l.wu (+ s5-0 -4))) at op 41 +;; WARN: Failed load: (set! a0-7 (l.wu (+ s5-1 -4))) at op 65 ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 28] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 79] (defbehavior ecoclaw-handler ecoclaw ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) diff --git a/test/decompiler/reference/jak2/decompiler-macros.gc b/test/decompiler/reference/jak2/decompiler-macros.gc index 5fa7634c95..a16a12c554 100644 --- a/test/decompiler/reference/jak2/decompiler-macros.gc +++ b/test/decompiler/reference/jak2/decompiler-macros.gc @@ -1143,3 +1143,68 @@ (defmacro static-bspherem (x y z r) `(new 'static 'sphere :x (meters ,x) :y (meters ,y) :z (meters ,z) :w (meters ,r)) ) + +;; art-h +(desfun art-elt->index (ag-name elt-name) + (if (number? elt-name) + elt-name + (let ((ag-info (hash-table-try-ref *art-info* (symbol->string ag-name)))) + (if (not (car ag-info)) + -1 + (let ((elt-info (hash-table-try-ref (cdr ag-info) (symbol->string elt-name)))) + (if (not (car elt-info)) + -1 + (cadr (cdr elt-info))) + ) + ) + ) + ) + ) + +(defmacro defskelgroup (name ag-name joint-geom joint-anim lods + &key (shadow 0) + &key bounds + &key (longest-edge 0.0) + &key (texture-level 0) + &key (sort 0) + &key (version 7) ;; do NOT use this! + &key (origin-joint-index 0) + &key (shadow-joint-index 0) + &key (light-index 0) + ) + "define a new static skeleton group" + + `(let ((skel (new 'static 'skeleton-group + :name ,(symbol->string name) + :info #f ;; all skeleton-groups seem to have these as #f + :extra #f + :art-group-name ,(symbol->string ag-name) + :bounds ,bounds + :longest-edge ,longest-edge + :version ,version + :max-lod ,(- (length lods) 1) + :shadow ,(art-elt->index (string->symbol-format "{}-ag" ag-name) shadow) + :texture-level ,texture-level + :sort ,sort + :origin-joint-index ,origin-joint-index + :shadow-joint-index ,shadow-joint-index + :light-index ,light-index + ))) + ;; set joint geometry and joint bones + (set! (-> skel jgeo) ,(art-elt->index (string->symbol-format "{}-ag" ag-name) joint-geom)) + (set! (-> skel janim) ,(art-elt->index (string->symbol-format "{}-ag" ag-name) joint-anim)) + + ;; set lods + ,@(apply-i (lambda (x i) + `(begin + (set! (-> skel mgeo ,i) ,(art-elt->index (string->symbol-format "{}-ag" ag-name) (car x))) + (set! (-> skel lod-dist ,i) ,(cadr x)) + ) + ) lods) + + ;; define skel group + (define ,name skel) + ;; add to level + (add-to-loading-level ,name) + ) + ) \ No newline at end of file diff --git a/test/decompiler/reference/jak2/engine/anim/joint-h_REF.gc b/test/decompiler/reference/jak2/engine/anim/joint-h_REF.gc index d5edef8ac0..0d405b7709 100644 --- a/test/decompiler/reference/jak2/engine/anim/joint-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/anim/joint-h_REF.gc @@ -158,7 +158,7 @@ (effect effect-control :offset-assert 36) (interp-select int64 2 :offset-assert 40) (top-anim top-anim-joint-control :offset-assert 56) - (override basic :offset-assert 60) + (override (array float) :offset-assert 60) (channel joint-control-channel :inline :dynamic :offset-assert 64) ) :method-count-assert 12 @@ -166,7 +166,7 @@ :flag-assert #xc00000040 (:methods (new (symbol type int) _type_ 0) - (joint-control-method-9 () none 9) + (current-cycle-distance (_type_) float 9) (joint-control-method-10 (_type_) none 10) (debug-print-channels (_type_ symbol) int 11) ) diff --git a/test/decompiler/reference/jak2/engine/anim/joint_REF.gc b/test/decompiler/reference/jak2/engine/anim/joint_REF.gc index 122dff2551..c889310100 100644 --- a/test/decompiler/reference/jak2/engine/anim/joint_REF.gc +++ b/test/decompiler/reference/jak2/engine/anim/joint_REF.gc @@ -810,6 +810,24 @@ ;; definition for function flatten-joint-control-to-spr ;; INFO: Used lq/sq +;; WARN: Failed load: (set! vf2 (l.vf (the-as int a2-1))) at op 46 +;; WARN: Failed load: (set! vf3 (l.vf (+ (the-as int a2-1) 16))) at op 48 +;; WARN: Failed load: (set! vf4 (l.vf (+ (the-as int a2-1) 32))) at op 49 +;; WARN: Failed load: (set! vf5 (l.vf (+ (the-as int a2-1) 48))) at op 50 +;; WARN: Failed load: (set! vf6 (l.vf (+ (the-as int a2-1) 64))) at op 51 +;; WARN: Failed load: (set! vf7 (l.vf (+ (the-as int a2-1) 80))) at op 52 +;; WARN: Failed load: (set! vf3 (l.vf (the-as int a2-2))) at op 82 +;; WARN: Failed load: (set! vf4 (l.vf (+ (the-as int a2-2) 16))) at op 83 +;; WARN: Failed load: (set! vf5 (l.vf (+ (the-as int a2-2) 32))) at op 84 +;; WARN: Failed load: (set! vf6 (l.vf (+ (the-as int a2-2) 48))) at op 85 +;; WARN: Failed load: (set! vf7 (l.vf (+ (the-as int a2-2) 64))) at op 86 +;; WARN: Failed load: (set! vf8 (l.vf (+ (the-as int a2-2) 80))) at op 87 +;; WARN: Failed load: (set! vf9 (l.vf (+ (the-as int a2-2) 96))) at op 94 +;; WARN: Failed load: (set! vf10 (l.vf (+ (the-as int a2-2) 112))) at op 95 +;; WARN: Failed load: (set! vf11 (l.vf (+ (the-as int a2-2) 128))) at op 96 +;; WARN: Failed load: (set! vf12 (l.vf (+ (the-as int a2-2) 144))) at op 97 +;; WARN: Failed load: (set! vf13 (l.vf (+ (the-as int a2-2) 160))) at op 98 +;; WARN: Failed load: (set! vf14 (l.vf (+ (the-as int a2-2) 176))) at op 99 (defun flatten-joint-control-to-spr ((arg0 joint-control)) (rlet ((vf1 :class vf) (vf10 :class vf) @@ -1630,6 +1648,54 @@ ;; ERROR: function was not converted to expressions. Cannot decompile. ;; definition for function make-joint-jump-tables +;; WARN: Failed store: (s.w! (+ a0-2 1616) v1-1) at op 5 +;; WARN: Failed store: (s.w! (+ a0-5 1620) v1-3) at op 11 +;; WARN: Failed store: (s.w! (+ a0-8 1624) v1-5) at op 17 +;; WARN: Failed store: (s.w! (+ a0-11 1628) v1-7) at op 23 +;; WARN: Failed store: (s.w! (+ a0-14 1632) v1-9) at op 29 +;; WARN: Failed store: (s.w! (+ a0-17 1636) v1-11) at op 35 +;; WARN: Failed store: (s.w! (+ a0-20 1640) v1-13) at op 41 +;; WARN: Failed store: (s.w! (+ a0-23 1644) v1-15) at op 47 +;; WARN: Failed store: (s.w! (+ a0-26 1648) v1-17) at op 53 +;; WARN: Failed store: (s.w! (+ a0-29 1652) v1-19) at op 59 +;; WARN: Failed store: (s.w! (+ a0-32 1656) v1-21) at op 65 +;; WARN: Failed store: (s.w! (+ a0-35 1660) v1-23) at op 71 +;; WARN: Failed store: (s.w! (+ a0-38 1664) v1-25) at op 77 +;; WARN: Failed store: (s.w! (+ a0-41 1668) v1-27) at op 83 +;; WARN: Failed store: (s.w! (+ a0-44 1672) v1-29) at op 89 +;; WARN: Failed store: (s.w! (+ a0-47 1676) v1-31) at op 95 +;; WARN: Failed store: (s.w! (+ a0-50 1680) v1-33) at op 101 +;; WARN: Failed store: (s.w! (+ a0-53 1684) v1-35) at op 107 +;; WARN: Failed store: (s.w! (+ a0-56 1688) v1-37) at op 113 +;; WARN: Failed store: (s.w! (+ a0-59 1692) v1-39) at op 119 +;; WARN: Failed store: (s.w! (+ a0-62 1696) v1-41) at op 125 +;; WARN: Failed store: (s.w! (+ a0-65 1700) v1-43) at op 131 +;; WARN: Failed store: (s.w! (+ a0-68 1704) v1-45) at op 137 +;; WARN: Failed store: (s.w! (+ a0-71 1708) v1-47) at op 143 +;; WARN: Failed store: (s.w! (+ a0-74 1712) v1-49) at op 149 +;; WARN: Failed store: (s.w! (+ a0-77 1716) v1-51) at op 155 +;; WARN: Failed store: (s.w! (+ a0-80 1720) v1-53) at op 161 +;; WARN: Failed store: (s.w! (+ a0-83 1724) v1-55) at op 167 +;; WARN: Failed store: (s.w! (+ a0-86 1728) v1-57) at op 173 +;; WARN: Failed store: (s.w! (+ a0-89 1732) v1-59) at op 179 +;; WARN: Failed store: (s.w! (+ a0-92 1736) v1-61) at op 185 +;; WARN: Failed store: (s.w! (+ a0-95 1740) v1-63) at op 191 +;; WARN: Failed store: (s.w! (+ a0-98 1744) v1-65) at op 197 +;; WARN: Failed store: (s.w! (+ a0-101 1748) v1-67) at op 203 +;; WARN: Failed store: (s.w! (+ a0-104 1752) v1-69) at op 209 +;; WARN: Failed store: (s.w! (+ a0-107 1756) v1-71) at op 215 +;; WARN: Failed store: (s.w! (+ a0-110 1760) v1-73) at op 221 +;; WARN: Failed store: (s.w! (+ a0-113 1764) v1-75) at op 227 +;; WARN: Failed store: (s.w! (+ a0-116 1768) v1-77) at op 233 +;; WARN: Failed store: (s.w! (+ a0-119 1772) v1-79) at op 239 +;; WARN: Failed store: (s.w! (+ a0-122 1776) v1-81) at op 245 +;; WARN: Failed store: (s.w! (+ a0-125 1780) v1-83) at op 251 +;; WARN: Failed store: (s.w! (+ a0-128 1784) v1-85) at op 257 +;; WARN: Failed store: (s.w! (+ a0-131 1788) v1-87) at op 263 +;; WARN: Failed store: (s.w! (+ a0-134 1792) v1-89) at op 269 +;; WARN: Failed store: (s.w! (+ a0-137 1796) v1-91) at op 275 +;; WARN: Failed store: (s.w! (+ a0-140 1800) v1-93) at op 281 +;; WARN: Failed store: (s.w! (+ a0-143 1804) v1-95) at op 287 (defun make-joint-jump-tables () (let ((v1-1 (+ (the-as uint decompress-fixed-data-to-accumulator) (* 108 4))) (a0-2 #x70000000) diff --git a/test/decompiler/reference/jak2/engine/camera/cam-master_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-master_REF.gc index 151a159a48..3968263d16 100644 --- a/test/decompiler/reference/jak2/engine/camera/cam-master_REF.gc +++ b/test/decompiler/reference/jak2/engine/camera/cam-master_REF.gc @@ -291,7 +291,7 @@ (when (and (logtest? (-> (the-as target gp-0) focus-status) (focus-status on-water under-water)) (zero? (logand (focus-status mech) (-> (the-as target gp-0) focus-status))) ) - (let ((f0-41 (- (process-focusable-method-24 (the-as target gp-0)) (-> self settings target-height)))) + (let ((f0-41 (- (get-water-height (the-as target gp-0)) (-> self settings target-height)))) (if (< (-> self tpos-curr-adj y) f0-41) (set! (-> self tpos-curr-adj y) f0-41) ) diff --git a/test/decompiler/reference/jak2/engine/collide/collide-h_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-h_REF.gc index 32b65f6fe2..a27e50ac98 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-h_REF.gc @@ -25,7 +25,7 @@ (solid-only symbol :offset 120) (best-dist float :offset 112) (best-other-prim basic :offset 116) - (best-my-prim basic :offset 120) + (best-my-prim collide-shape-prim :offset 120) (move-vec vector :inline :offset 224) (best-u float :offset 112) (action-mask collide-action :offset-assert 352) @@ -72,10 +72,10 @@ (format #t "~1Tinv-mat: #~%" (-> obj inv-mat)) (format #t "~1Tspheres: #x~X~%" (-> obj spheres)) (format #t "~1Tnum-spheres: ~D~%" (-> obj num-spheres)) - (format #t "~1Tsolid-only: ~A~%" (-> obj solid-only)) + (format #t "~1Tsolid-only: ~A~%" (-> obj best-my-prim)) (format #t "~1Tbest-dist: ~f~%" (the-as float (-> obj spheres))) (format #t "~1Tbest-other-prim: ~A~%" (-> obj num-spheres)) - (format #t "~1Tbest-my-prim: ~A~%" (-> obj solid-only)) + (format #t "~1Tbest-my-prim: ~A~%" (-> obj best-my-prim)) (format #t "~1Tmove-vec: #~%" (-> obj move-dist)) (format #t "~1Tbest-u: ~f~%" (the-as float (-> obj spheres))) (format #t "~1Taction-mask: ~D~%" (-> obj action-mask)) diff --git a/test/decompiler/reference/jak2/engine/collide/collide-shape-h_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-shape-h_REF.gc index dc5d908aea..275925ce4e 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-shape-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-shape-h_REF.gc @@ -1327,11 +1327,11 @@ (collide-shape-method-46 (_type_) none 46) (collide-shape-method-47 () none 47) (collide-shape-method-48 () none 48) - (collide-shape-method-49 () none 49) + (collide-shape-method-49 (_type_ int int int) none 49) (collide-shape-method-50 () none 50) (collide-shape-method-51 () none 51) - (collide-shape-method-52 () none 52) - (collide-shape-method-53 () none 53) + (water-info-init! (_type_ water-info collide-action) water-info 52) + (collide-shape-method-53 (_type_) none 53) (collide-shape-method-54 (_type_) none 54) ) ) @@ -1615,7 +1615,7 @@ (:methods (new (symbol type process-drawable collide-list-enum) _type_ 0) (collide-shape-moving-method-55 (_type_ collide-query collide-spec float float float) symbol 55) - (collide-shape-moving-method-56 () none 56) + (collide-shape-moving-method-56 (_type_ pat-surface) none 56) (collide-shape-moving-method-57 () none 57) (collide-shape-moving-method-58 () none 58) (collide-shape-moving-method-59 () none 59) diff --git a/test/decompiler/reference/jak2/engine/collide/collide-target-h_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-target-h_REF.gc index 36435e39c6..9a17177e61 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-target-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-target-h_REF.gc @@ -14,6 +14,7 @@ (unknown-quaternion01 quaternion :inline :offset 544) (unknown-float04 float :offset 560) (unknown-float05 float :offset 564) + (unknown-float003 float :offset 568) (unknown-float06 float :offset 572) (unknown-float07 float :offset 576) (unknown-time-frame00 time-frame :offset 584) @@ -27,6 +28,7 @@ (unknown-vector05 vector :inline :offset 3744) (unknown-vector06 vector :inline :offset 3760) (unknown-vector07 vector :inline :offset 3776) + (unknown-vector000 vector :inline :offset 3792) (unknown-dynamics00 dynamics :offset 3824) (unknown-surface00 surface :offset 3828) (unknown-surface01 surface :offset 3832) @@ -69,6 +71,7 @@ (unknown-vector22 vector :inline :offset 4560) (unknown-vector23 vector :inline :offset 4576) (unknown-time-frame05 time-frame :offset 4624) + (unknown-float0000 float :offset 4632) (unknown-float17 float :offset 4636) (unknown-float18 float :offset 4640) (unknown-float19 float :offset 4644) @@ -79,6 +82,7 @@ (unknown-pat-surface00 pat-surface :offset 4680) (unknown-vector24 vector :inline :offset 4688) (unknown-vector25 vector :inline :offset 4720) + (unknown-vector001 vector :inline :offset 4736) (unknown-handle00 handle :offset 4768) (unknown-pat-surface01 pat-surface :offset 4776) (unknown-float22 float :offset 4780) @@ -86,6 +90,8 @@ (unknown-float24 float :offset 4788) (unknown-float25 float :offset 4792) (unknown-float26 float :offset 4796) + (unknown-word000 int32 :offset 4800) + (unknown-float002 float :offset 4804) (unknown-time-frame08 time-frame :offset 4816) (unknown-vector26 vector :inline :offset 4928) (unknwon-vector27 vector :inline :offset 4976) @@ -95,7 +101,9 @@ (unknown-word02 int32 :offset 5064) (unknown-time-frame10 time-frame :offset 5072) (unknown-time-frame11 time-frame :offset 5080) + (unknown-time-frame001 time-frame :offset 5088) (unknown-time-frame12 time-frame :offset 5096) + (unknown-time-frame002 time-frame :offset 5104) (unknown-time-frame13 time-frame :offset 5112) (unknown-time-frame14 time-frame :offset 5120) (unknown-float28 float :offset 5132) @@ -114,11 +122,13 @@ (unknown-float32 float :offset 5520) (unknown-word03 int32 :offset 5524) (unknown-float33 float :offset 5528) + (unknown-symbol000 symbol :offset 5532) (unknown-vector34 vector :inline :offset 5536) (unknown-vector35 vector :inline :offset 5552) (unknown-vector36 vector :inline :offset 5568) (unknown-time-frame15 time-frame :offset 5584) (unknown-time-frame16 time-frame :offset 5592) + (unknown-handle000 handle :offset 5600) (unknown-handle01 handle :offset 5608) (unknown-word04 uint32 :offset 5616) (unknown-spool-anim00 spool-anim :offset 5616) @@ -149,8 +159,11 @@ (unknown-time-frame20 time-frame :offset 5944) (unknown-symbol04 symbol :offset 5984) (unknown-symbol05 symbol :offset 5988) + (unknown-attack-id00 int32 :offset 5992) + (unknown-float40 float :offset 5996) (unknown-dword05 uint64 :offset 6000) - (unknown-dword06 uint64 :offset 6008) + (unknown-dword06 handle :offset 6008) + (unknown-time-frame000 time-frame :offset 6016) (unknown-combo-tracker00 combo-tracker :inline :offset 6032) (unknown-time-frame21 time-frame :offset 6072) (unknown-dword07 int64 :offset 6096) @@ -160,8 +173,8 @@ (unknown-symbol06 symbol :offset 6144) (unknown-quaternion04 quaternion :inline :offset 6160) (unknown-sound-id01 sound-id :offset 6176) - (unknown-float40 float :offset 6180) - (unknown-float41 float :offset 6184) + (unknown-float41 float :offset 6180) + (unknown-float42 float :offset 6184) (unknown-halfword00 uint16 :offset 6188) (history-length uint16 :offset 6190) (unknown-word07 int32 :offset 6192) @@ -169,19 +182,21 @@ (unknown-time-frame23 time-frame :offset 6208) (unknown-time-frame24 time-frame :offset 6216) (unknown-time-frame25 time-frame :offset 6224) - (unknown-float42 float :offset 6232) + (unknown-float43 float :offset 6232) + (unknown-float001 float :offset 6236) (unknown-sound-id02 sound-id :offset 6240) (unknown-sound-id03 sound-id :offset 6244) (unknown-time-frame26 time-frame :offset 6248) (unknown-time-frame27 time-frame :offset 6256) (unknown-dword11 int64 :offset 6264) (unknown-vector44 vector :inline :offset 6272) - (unknown-float43 float :offset 6288) + (unknown-float44 float :offset 6288) (unknown-sound-id04 sound-id :offset 6292) + (unknown-float45 float :offset 6296) (unknown-word08 int32 :offset 6300) - (unknown-word09 int32 :offset 6304) - (unknown-word10 int32 :offset 6308) - (unknown-word11 int32 :offset 6312) + (unknown-sphere000 sphere :offset 6304) + (unknown-word09 int32 :offset 6308) + (unknown-word10 uint32 :offset 6312) (unknown-time-frame28 time-frame :offset 6320) (unknown-time-frame29 time-frame :offset 6328) (unknown-dword12 int64 :offset 6336) diff --git a/test/decompiler/reference/jak2/engine/collide/collide-touch-h_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-touch-h_REF.gc index 8b4c2dba35..c0a7476577 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-touch-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-touch-h_REF.gc @@ -145,7 +145,7 @@ (get-head (_type_) touching-prims-entry 9) (get-next (_type_ touching-shapes-entry) touching-prims-entry 10) (touching-shapes-entry-method-11 () none 11) - (touching-shapes-entry-method-12 (_type_ collide-shape uint) touching-prims-entry 12) + (prims-touching? (_type_ collide-shape uint) touching-prims-entry 12) (touching-shapes-entry-method-13 (_type_ collide-shape uint uint) basic 13) (touching-shapes-entry-method-14 () none 14) ) diff --git a/test/decompiler/reference/jak2/engine/common_objs/basebutton_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/basebutton_REF.gc index 89346ae68a..fb5e6acb2e 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/basebutton_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/basebutton_REF.gc @@ -67,22 +67,7 @@ ) ;; failed to figure out what this is: -(let ((a0-2 (new 'static 'skeleton-group - :name "skel-generic-button" - :extra #f - :info #f - :art-group-name "mtn-dice-button" - :bounds (new 'static 'vector :w 12288.0) - :version #x7 - ) - ) - ) - (set! (-> a0-2 jgeo) 0) - (set! (-> a0-2 janim) 3) - (set! (-> a0-2 mgeo 0) 1) - (set! (-> a0-2 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-2) - ) +(defskelgroup skel-generic-button mtn-dice-button 0 3 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 3)) ;; definition for method 37 of type basebutton ;; INFO: Used lq/sq diff --git a/test/decompiler/reference/jak2/engine/common_objs/blocking-plane_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/blocking-plane_REF.gc index 4ede4de5f9..3eea8f98eb 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/blocking-plane_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/blocking-plane_REF.gc @@ -29,23 +29,11 @@ ) ;; failed to figure out what this is: -(let ((a0-2 (new 'static 'skeleton-group - :name "skel-blocking-plane" - :extra #f - :info #f - :art-group-name "blocking-plane" - :bounds (new 'static 'vector :w 410009.6) - :texture-level #x6 - :version #x7 +(defskelgroup skel-blocking-plane blocking-plane 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 100.1) + :texture-level 6 ) - ) - ) - (set! (-> a0-2 jgeo) 0) - (set! (-> a0-2 janim) 2) - (set! (-> a0-2 mgeo 0) 1) - (set! (-> a0-2 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-2) - ) ;; failed to figure out what this is: (defstate idle (blocking-plane) diff --git a/test/decompiler/reference/jak2/engine/common_objs/conveyor_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/conveyor_REF.gc index 4facad4c4f..5be2a1532d 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/conveyor_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/conveyor_REF.gc @@ -480,22 +480,7 @@ ) ;; failed to figure out what this is: -(let ((a0-19 (new 'static 'skeleton-group - :name "skel-strip-conveyor" - :extra #f - :info #f - :art-group-name "strip-conveyor" - :bounds (new 'static 'vector :w 147456.0) - :version #x7 - ) - ) - ) - (set! (-> a0-19 jgeo) 0) - (set! (-> a0-19 janim) 2) - (set! (-> a0-19 mgeo 0) 1) - (set! (-> a0-19 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-19) - ) +(defskelgroup skel-strip-conveyor strip-conveyor 0 2 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 36)) ;; definition for method 22 of type strip-conveyor (defmethod get-art-group strip-conveyor ((obj strip-conveyor)) @@ -526,24 +511,12 @@ ) ;; failed to figure out what this is: -(let ((a0-23 (new 'static 'skeleton-group - :name "skel-lgconveyor" - :extra #f - :info #f - :art-group-name "lgconveyor" - :bounds (new 'static 'vector :y 12288.0 :w 61440.0) - :longest-edge (meters 24.7389) - :version #x7 - :origin-joint-index 3 - ) - ) - ) - (set! (-> a0-23 jgeo) 0) - (set! (-> a0-23 janim) 3) - (set! (-> a0-23 mgeo 0) 1) - (set! (-> a0-23 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-23) - ) +(defskelgroup skel-lgconveyor lgconveyor 0 3 + ((1 (meters 999999))) + :bounds (static-spherem 0 3 0 15) + :longest-edge (meters 24.7389) + :origin-joint-index 3 + ) ;; definition for method 22 of type lgconveyor (defmethod get-art-group lgconveyor ((obj lgconveyor)) diff --git a/test/decompiler/reference/jak2/engine/common_objs/crates_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/crates_REF.gc new file mode 100644 index 0000000000..593e88d0ac --- /dev/null +++ b/test/decompiler/reference/jak2/engine/common_objs/crates_REF.gc @@ -0,0 +1,1572 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(defskelgroup skel-crate-krimson crate 0 3 + ((1 (meters 20)) (2 (meters 999999))) + :bounds (static-spherem 0 1 0 1.6) + :texture-level 6 + ) + +;; definition of type crate-bank +(deftype crate-bank (basic) + ((COLLIDE_YOFF float :offset-assert 4) + (COLLIDE_RADIUS float :offset-assert 8) + (DARKECO_EXPLODE_RADIUS float :offset-assert 12) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; definition for method 3 of type crate-bank +(defmethod inspect crate-bank ((obj crate-bank)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1TCOLLIDE_YOFF: ~f~%" (-> obj COLLIDE_YOFF)) + (format #t "~1TCOLLIDE_RADIUS: ~f~%" (-> obj COLLIDE_RADIUS)) + (format #t "~1TDARKECO_EXPLODE_RADIUS: ~f~%" (-> obj DARKECO_EXPLODE_RADIUS)) + (label cfg-4) + obj + ) + +;; definition for symbol *CRATE-bank*, type crate-bank +(define *CRATE-bank* + (new 'static 'crate-bank :COLLIDE_YOFF 4096.0 :COLLIDE_RADIUS 6963.2 :DARKECO_EXPLODE_RADIUS 16384.0) + ) + +;; definition of type crate +(deftype crate (process-focusable) + ((smush smush-control :inline :offset-assert 208) + (base vector :inline :offset-assert 240) + (look symbol :offset-assert 256) + (defense symbol :offset-assert 260) + (incoming-attack-id uint32 :offset-assert 264) + (target handle :offset-assert 272) + (child-count int32 :offset-assert 280) + (victory-anim spool-anim :offset-assert 284) + ) + :heap-base #xa0 + :method-count-assert 41 + :size-assert #x120 + :flag-assert #x2900a00120 + (:methods + (hide () _type_ :state 27) + (idle () _type_ :state 28) + (die (symbol int) _type_ :state 29) + (special-contents-die () _type_ :state 30) + (bounce-on () _type_ :state 31) + (notice-blue (handle) _type_ :state 32) + (carry () _type_ :state 33) + (fall () _type_ :state 34) + (crate-init! (_type_ entity-actor) none 35) + (skel-init! (_type_) none 36) + (params-set! (_type_ symbol symbol) none 37) + (crate-method-38 (_type_) none 38) + (smush-update! (_type_) none 39) + (crate-method-40 (_type_) symbol :behavior crate 40) + ) + ) + +;; definition for method 3 of type crate +(defmethod inspect crate ((obj crate)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-focusable inspect))) + (t9-0 obj) + ) + (format #t "~2Tsmush: #~%" (-> obj smush)) + (format #t "~2Tbase: ~`vector`P~%" (-> obj base)) + (format #t "~2Tlook: ~A~%" (-> obj look)) + (format #t "~2Tdefense: ~A~%" (-> obj defense)) + (format #t "~2Tincoming-attack-id: ~D~%" (-> obj incoming-attack-id)) + (format #t "~2Ttarget: ~D~%" (-> obj target)) + (format #t "~2Tchild-count: ~D~%" (-> obj child-count)) + (format #t "~2Tvictory-anim: ~A~%" (-> obj victory-anim)) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(method-set! crate 12 (method-of-type process run-logic?)) + +;; definition for function crate-post +(defbehavior crate-post crate () + (rider-trans) + (smush-update! self) + (rider-post) + (carry-info-method-9 (-> self carry)) + ) + +;; failed to figure out what this is: +(defpart 565 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-flt spt-num 16.0) + (sp-rnd-flt spt-y (meters 0.5) (meters 1) 1.0) + (sp-rnd-flt spt-scale-x (meters 1.5) (meters 1.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 32.0 1.0) + (sp-rnd-flt spt-g 128.0 32.0 1.0) + (sp-rnd-flt spt-b 128.0 32.0 1.0) + (sp-rnd-flt spt-a 32.0 16.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.016666668) (meters 0.033333335) 1.0) + (sp-rnd-flt spt-rotvel-z (degrees -1.2) (degrees 1.2) 1.0) + (sp-flt spt-accel-y 2.7306666) + (sp-int spt-timer 120) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-12 sp-cpuinfo-flag-14 sp-cpuinfo-flag-21) + (sp-int-plain-rnd spt-next-time 30 59 1) + (sp-launcher-by-id spt-next-launcher 566) + (sp-rnd-flt spt-conerot-x (degrees 70.0) (degrees 20.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 566 + :init-specs ((sp-flt spt-fade-a -1.0666667)) + ) + +;; failed to figure out what this is: +(defpart 567 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x92 :page #xc)) + (sp-flt spt-num 4.0) + (sp-flt spt-y (meters 0.75)) + (sp-flt spt-scale-x (meters 6)) + (sp-int spt-rot-x 4) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.3) (meters 1) 1.0) + (sp-flt spt-r 192.0) + (sp-flt spt-g 192.0) + (sp-rnd-flt spt-b 64.0 128.0 1.0) + (sp-flt spt-a 0.0) + (sp-flt spt-scalevel-x (meters 0.009765625)) + (sp-rnd-flt spt-rotvel-z (degrees -0.15) (degrees 0.3) 1.0) + (sp-flt spt-scalevel-y (meters 0.009765625)) + (sp-flt spt-fade-a 2.1333334) + (sp-int spt-timer 30) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 sp-cpuinfo-flag-21) + (sp-int spt-next-time 15) + (sp-launcher-by-id spt-next-launcher 568) + (sp-flt spt-rotate-y (degrees 0.0)) + ) + ) + +;; failed to figure out what this is: +(defpart 568 + :init-specs ((sp-flt spt-fade-a -2.1333334)) + ) + +;; failed to figure out what this is: +(defpart 569 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-y (meters 1)) + (sp-flt spt-scale-x (meters 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 196.0) + (sp-flt spt-g 196.0) + (sp-flt spt-b 196.0) + (sp-flt spt-a 28.0) + (sp-int spt-timer 10) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 sp-cpuinfo-flag-21) + ) + ) + +;; failed to figure out what this is: +(defpart 570 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc :page #xc)) + (sp-flt spt-num 5.0) + (sp-rnd-flt spt-x (meters -0.5) (meters 1) 1.0) + (sp-rnd-flt spt-y (meters 0.25) (meters 1.5) 1.0) + (sp-rnd-flt spt-z (meters -0.5) (meters 1) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.6) (meters 0.00048828125) 2457.6) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-scale-y (meters 0.3)) + (sp-flt spt-r 160.0) + (sp-flt spt-g 160.0) + (sp-flt spt-b 160.0) + (sp-flt spt-a 128.0) + (sp-rnd-flt spt-vel-y (meters 0.06666667) (meters 0.06666667) 1.0) + (sp-flt spt-rotvel-x (degrees 1.2)) + (sp-flt spt-rotvel-y (degrees 2.4)) + (sp-rnd-int-flt spt-rotvel-z (degrees 0.0) 2 436.90668) + (sp-flt spt-accel-y -13.653334) + (sp-flt spt-friction 0.97) + (sp-int spt-timer 150) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-12 sp-cpuinfo-flag-14 sp-cpuinfo-flag-21) + (sp-int spt-next-time 75) + (sp-launcher-by-id spt-next-launcher 571) + (sp-rnd-flt spt-conerot-x (degrees 40.0) (degrees 30.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 571 + :init-specs ((sp-flt spt-scalevel-x (meters -0.0033333334)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -3.4) + ) + ) + +;; failed to figure out what this is: +(defpart 572 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xb :page #xc)) + (sp-flt spt-num 4.5) + (sp-rnd-flt spt-x (meters -0.5) (meters 1) 1.0) + (sp-rnd-flt spt-y (meters 0.25) (meters 1.5) 1.0) + (sp-rnd-flt spt-z (meters -0.5) (meters 1) 1.0) + (sp-rnd-int-flt spt-scale-x (meters 0.3) 1 4096.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-scale-y (meters 0.3)) + (sp-flt spt-r 100.0) + (sp-flt spt-g 100.0) + (sp-flt spt-b 100.0) + (sp-flt spt-a 128.0) + (sp-rnd-flt spt-vel-y (meters 0.06666667) (meters 0.06666667) 1.0) + (sp-flt spt-rotvel-x (degrees 1.2)) + (sp-flt spt-rotvel-y (degrees 2.4)) + (sp-rnd-int-flt spt-rotvel-z (degrees 0.0) 3 436.90668) + (sp-flt spt-accel-y -13.653334) + (sp-flt spt-friction 0.97) + (sp-int spt-timer 150) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-12 sp-cpuinfo-flag-14 sp-cpuinfo-flag-21) + (sp-int spt-next-time 75) + (sp-launcher-by-id spt-next-launcher 571) + (sp-rnd-flt spt-conerot-x (degrees 40.0) (degrees 30.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-crate-explode + :id 124 + :duration (seconds 0.017) + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 12) + :parts ((sp-item 565 :flags (bit7)) + (sp-item 567 :flags (bit7)) + (sp-item 569 :flags (bit7)) + (sp-item 570 :flags (bit7)) + (sp-item 572 :flags (bit7)) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-crate-steel-explode + :id 125 + :duration (seconds 0.017) + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 12) + :parts ((sp-item 565) (sp-item 567) (sp-item 569) (sp-item 572) (sp-item 572) (sp-item 572)) + ) + +;; failed to figure out what this is: +(defpartgroup group-dark-eco-box-explosion + :id 126 + :duration (seconds 2) + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 12) + :parts ((sp-item 154 :fade-after (meters 100) :period 600 :length 5 :binding 152) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 152 :flags (start-dead launch-asap) :binding 153) + (sp-item 153 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 573 :fade-after (meters 160) :period 600 :length 5) + (sp-item 155 :period 600 :length 5) + (sp-item 156 :fade-after (meters 80) :falloff-to (meters 80) :period 600 :length 40) + (sp-item 157 :period 600 :length 20) + (sp-item 574 :fade-after (meters 120) :falloff-to (meters 120) :period 600 :length 20) + ) + ) + +;; failed to figure out what this is: +(defpart 156 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 6.0) + (sp-rnd-flt spt-scale-x (meters 0.2) (meters 0.4) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 64.0 128.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 96.0 64.0 1.0) + (sp-rnd-flt spt-a 32.0 96.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.026666667) (meters 0.10666667) 1.0) + (sp-flt spt-scalevel-x (meters -0.0016666667)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-accel-y -0.68266666 -0.68266666 1.0) + (sp-flt spt-friction 0.9) + (sp-int spt-timer 300) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-14) + (sp-int-plain-rnd spt-next-time 30 29 1) + (sp-launcher-by-id spt-next-launcher 575) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 140.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-conerot-radius (meters 2) (meters 4) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 575 + :init-specs ((sp-flt spt-fade-r 0.0) (sp-flt spt-fade-g 0.0) (sp-flt spt-fade-b 0.0) (sp-flt spt-fade-a -1.4222223)) + ) + +;; failed to figure out what this is: +(defpart 574 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 3.0) + (sp-flt spt-scale-x (meters 0.2)) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 180.0) 1.0) + (sp-flt spt-scale-y (meters 8)) + (sp-rnd-flt spt-r 64.0 192.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 128.0 64.0 1.0) + (sp-rnd-flt spt-a 32.0 64.0 1.0) + (sp-flt spt-scalevel-y (meters 0.42666668)) + (sp-flt spt-fade-a -1.6) + (sp-int spt-timer 60) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + ) + ) + +;; failed to figure out what this is: +(defpart 155 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 16)) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 64.0 192.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 128.0 64.0 1.0) + (sp-flt spt-a 96.0) + (sp-flt spt-fade-a -1.7454545) + (sp-int spt-timer 54) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + ) + ) + +;; failed to figure out what this is: +(defpart 157 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-flt spt-num 4.0) + (sp-rnd-flt spt-scale-x (meters 2.5) (meters 1.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 0.0 96.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-rnd-flt spt-a 64.0 64.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.053333335) (meters 0.013333334) 1.0) + (sp-flt spt-scalevel-x (meters 0.013333334)) + (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-a -0.42666668) + (sp-rnd-flt spt-accel-y 0.68266666 0.68266666 1.0) + (sp-flt spt-friction 0.8) + (sp-int spt-timer 510) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-14) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 110.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 154 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) + (sp-flt spt-num 16.0) + (sp-flt spt-y (meters 1)) + (sp-flt spt-scale-x (meters 0.1)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-y (meters 0.053333335) (meters 0.026666667) 1.0) + (sp-flt spt-accel-y -1.3653333) + (sp-flt spt-friction 0.94) + (sp-int spt-timer 240) + (sp-cpuinfo-flags sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 140.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 152 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-y (meters 0) (meters 16) 1.0) + (sp-rnd-flt spt-z (meters 0.3) (meters 0.3) 1.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-rnd-flt spt-r 0.0 96.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-rnd-flt spt-a 64.0 64.0 1.0) + (sp-rnd-flt spt-omega 0.0 65536.0 1.0) + (sp-rnd-flt spt-vel-x (meters 0.026666667) (meters 0.10666667) 1.0) + (sp-flt spt-scalevel-x (meters -0.000909091)) + (sp-rnd-int-flt spt-rotvel-z (degrees -0.3) 1 109.22667) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -0.26666668) + (sp-flt spt-fade-a -0.19393939) + (sp-int-plain-rnd spt-timer 90 149 1) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 ready-to-launch sp-cpuinfo-flag-14) + ) + ) + +;; failed to figure out what this is: +(defpart 153 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.1) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 32.0 96.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-rnd-flt spt-a 32.0 32.0 1.0) + (sp-flt spt-scalevel-x (meters -0.0006190476)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.01904762) + (sp-rnd-flt spt-accel-y -0.40960002 -0.6144 1.0) + (sp-int-plain-rnd spt-timer 30 299 1) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + (sp-int spt-next-time 240) + (sp-launcher-by-id spt-next-launcher 397) + ) + ) + +;; failed to figure out what this is: +(defpart 573 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xb :page #xc)) + (sp-rnd-flt spt-num 8.0 16.0 1.0) + (sp-rnd-flt spt-x (meters -0.5) (meters 1) 1.0) + (sp-rnd-flt spt-y (meters 0.25) (meters 1.5) 1.0) + (sp-rnd-flt spt-z (meters -0.5) (meters 1) 1.0) + (sp-rnd-int-flt spt-scale-x (meters 0.3) 1 4096.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-scale-y (meters 0.3)) + (sp-flt spt-r 128.0) + (sp-rnd-int spt-g 1115684864 1 32.0) + (sp-flt spt-b 32.0) + (sp-flt spt-a 128.0) + (sp-rnd-flt spt-vel-y (meters 0.06666667) (meters 0.06666667) 1.0) + (sp-flt spt-rotvel-x (degrees 1.2)) + (sp-flt spt-rotvel-y (degrees 2.4)) + (sp-rnd-int-flt spt-rotvel-z (degrees 0.0) 3 436.90668) + (sp-flt spt-accel-y -13.653334) + (sp-flt spt-friction 0.97) + (sp-int spt-timer 150) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-12 sp-cpuinfo-flag-14) + (sp-int spt-next-time 75) + (sp-launcher-by-id spt-next-launcher 576) + (sp-rnd-flt spt-conerot-x (degrees 40.0) (degrees 30.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 576 + :init-specs ((sp-flt spt-scalevel-x (meters -0.0033333334)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -3.4) + ) + ) + +;; definition for function crate-standard-event-handler +;; INFO: Used lq/sq +(defbehavior crate-standard-event-handler crate ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('track) + (zero? (logand (actor-option no-track) (-> self fact options))) + ) + (('attack) + (let* ((v1-3 (the-as attack-info (-> arg3 param 1))) + (s4-0 (-> v1-3 id)) + (s5-0 (-> v1-3 count)) + ) + (case (-> self defense) + (('iron) + (case (-> v1-3 mode) + (('flop 'uppercut 'explode 'eco-yellow 'racer 'board 'tube 'flut-bonk 'flut-attack 'darkjak 'mech-punch) + (if (and (logtest? (-> self fact options) (actor-option racer-only)) + (= (-> arg0 type) target) + (zero? (logand (focus-status pilot) (-> (the-as target arg0) focus-status))) + ) + (return #f) + ) + (send-event arg0 'get-attack-count 1) + (process-contact-action arg0) + (set! (-> self target) (process->handle arg0)) + (go-virtual die #f (the-as int s5-0)) + ) + (else + (when (and (!= s4-0 (-> self incoming-attack-id)) (= (-> self root trans y) (-> self base y))) + (if (not (and (demo?) (= (-> *setting-control* user-current language) (language-enum japanese)))) + (talker-spawn-func (-> *talker-speech* 313) *entity-pool* (target-pos 0) (the-as region #f)) + ) + (talker-spawn-func (-> *talker-speech* 315) *entity-pool* (target-pos 0) (the-as region #f)) + (set! (-> self incoming-attack-id) s4-0) + (if (not (!= (-> self smush amp) 0.0)) + (sound-play "icrate-nobreak") + ) + (activate! (-> self smush) 0.1 90 150 1.0 1.0 (-> self clock)) + (go-virtual bounce-on) + ) + #f + ) + ) + ) + (('steel) + (case (-> v1-3 mode) + (('explode 'eco-yellow 'tube 'flut-bonk 'flut-attack 'racer 'board 'darkjak 'mech-punch) + (send-event arg0 'get-attack-count 1) + (when (logtest? (-> self draw status) (draw-control-status on-screen)) + (talker-spawn-func (-> *talker-speech* 316) *entity-pool* (target-pos 0) (the-as region #f)) + (talker-spawn-func (-> *talker-speech* 317) *entity-pool* (target-pos 0) (the-as region #f)) + ) + (process-contact-action arg0) + (set! (-> self target) (process->handle arg0)) + (go-virtual die #f (the-as int s5-0)) + ) + (else + (when (and (!= s4-0 (-> self incoming-attack-id)) (= (-> self root trans y) (-> self base y))) + (talker-spawn-func (-> *talker-speech* 318) *entity-pool* (target-pos 0) (the-as region #f)) + (set! (-> self incoming-attack-id) s4-0) + (if (not (!= (-> self smush amp) 0.0)) + (sound-play "scrate-nobreak") + ) + (activate! (-> self smush) 0.1 90 150 1.0 1.0 (-> self clock)) + (go-virtual bounce-on) + ) + #f + ) + ) + ) + (('darkeco) + (let ((a1-36 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-36 from) (process->ppointer self)) + (set! (-> a1-36 num-params) 2) + (set! (-> a1-36 message) 'attack) + (set! (-> a1-36 param 0) (-> arg3 param 0)) + (let ((v1-83 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (let* ((a0-67 *game-info*) + (a2-11 (+ (-> a0-67 attack-id) 1)) + ) + (set! (-> a0-67 attack-id) a2-11) + (set! (-> v1-83 id) a2-11) + ) + (set! (-> v1-83 mode) 'darkeco) + (set! (-> a1-36 param 1) (the-as uint v1-83)) + ) + (send-event-function arg0 a1-36) + ) + (when (= (-> arg0 type) target) + (talker-spawn-func (-> *talker-speech* 319) *entity-pool* (target-pos 0) (the-as region #f)) + (talker-spawn-func (-> *talker-speech* 314) *entity-pool* (target-pos 0) (the-as region #f)) + ) + (process-contact-action arg0) + (set! (-> self target) (process->handle arg0)) + (go-virtual die #f (the-as int s5-0)) + ) + (else + (-> v1-3 mode) + (send-event arg0 'get-attack-count 1) + (process-contact-action arg0) + (set! (-> self target) (process->handle arg0)) + (go-virtual die #f (the-as int s5-0)) + ) + ) + ) + ) + (('touch) + (case (-> self defense) + (('darkeco) + (let ((a1-42 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-42 from) (process->ppointer self)) + (set! (-> a1-42 num-params) 2) + (set! (-> a1-42 message) 'attack) + (set! (-> a1-42 param 0) (-> arg3 param 0)) + (let ((v1-111 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (let* ((a0-93 *game-info*) + (a2-15 (+ (-> a0-93 attack-id) 1)) + ) + (set! (-> a0-93 attack-id) a2-15) + (set! (-> v1-111 id) a2-15) + ) + (set! (-> v1-111 mode) 'darkeco) + (set! (-> a1-42 param 1) (the-as uint v1-111)) + ) + (send-event-function arg0 a1-42) + ) + (process-contact-action arg0) + (set! (-> self target) (process->handle arg0)) + (go-virtual die #f 0) + ) + ) + ) + (('bonk) + (when (= (-> self root trans y) (-> self base y)) + (activate! (-> self smush) -0.1 75 150 1.0 1.0 (-> self clock)) + (go-virtual bounce-on) + ) + ) + (('wake) + (let ((v0-1 (the-as object (logclear (-> self mask) (process-mask sleep))))) + (set! (-> self mask) (the-as process-mask v0-1)) + v0-1 + ) + ) + (('hide) + (go-virtual hide) + ) + (('eco-blue) + (if (not (or (= (-> self defense) 'darkeco) + (and (-> self next-state) (let ((v1-131 (-> self next-state name))) + (or (= v1-131 'notice-blue) (= v1-131 'die)) + ) + ) + (!= (-> self root trans y) (-> self base y)) + ) + ) + (go-virtual notice-blue (process->handle arg0)) + ) + ) + (('fall) + (when (not (and (-> self next-state) (= (-> self next-state name) 'fall))) + (set! (-> self root transv quad) (-> (the-as vector (-> arg3 param 0)) quad)) + (go-virtual fall) + ) + ) + ) + ) + +;; failed to figure out what this is: +(defstate hide (crate) + :virtual #t + :code (behavior () + (process-entity-status! self (entity-perm-status dead) #f) + (process-entity-status! self (entity-perm-status subtask-complete) #f) + (vector+! (-> self draw origin) (-> self root trans) (-> self draw bounds)) + (set! (-> self draw origin w) (-> self draw bounds w)) + (logior! (-> self draw status) (draw-control-status no-draw)) + (let ((v1-9 (-> (the-as collide-shape-moving (-> self root)) root-prim))) + (set! (-> v1-9 prim-core collide-as) (collide-spec)) + (set! (-> v1-9 prim-core collide-with) (collide-spec)) + ) + 0 + (ja-post) + (while (or (crate-method-40 self) + (and (sphere-in-view-frustum? (the-as sphere (-> self draw origin))) + (< (vector-vector-distance (camera-pos) (-> self root trans)) 327680.0) + ) + (and *target* (and (>= 40960.0 (vector-vector-distance (-> self root trans) (-> *target* control trans))) + (zero? (logand (focus-status teleporting) (-> *target* focus-status))) + ) + ) + ) + (suspend) + ) + (logclear! (-> self draw status) (draw-control-status no-draw)) + (let ((v1-29 (-> (the-as collide-shape-moving (-> self root)) root-prim))) + (set! (-> v1-29 prim-core collide-as) (-> (the-as collide-shape-moving (-> self root)) backup-collide-as)) + (set! (-> v1-29 prim-core collide-with) (-> (the-as collide-shape-moving (-> self root)) backup-collide-with)) + ) + (go-virtual idle) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate idle (crate) + :virtual #t + :event crate-standard-event-handler + :code (behavior () + (suspend) + (collide-shape-method-46 (the-as collide-shape-moving (-> self root))) + (carry-info-method-9 (-> self carry)) + (logior! (-> self mask) (process-mask sleep)) + (until #f + (suspend) + ) + #f + (none) + ) + :post (the-as (function none :behavior crate) ja-post) + ) + +;; failed to figure out what this is: +(defstate carry (crate) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('carry? 'carry-info) + (-> self carry) + ) + (('drop) + (set! (-> self root transv quad) (-> (the-as vector (-> event param 1)) quad)) + (go-virtual fall) + ) + ) + ) + :code (the-as (function none :behavior crate) sleep-code) + :post (behavior () + (ja-post) + (carry-info-method-9 (-> self carry)) + (carry-info-method-13 (-> self carry)) + (collide-shape-method-46 (the-as collide-shape-moving (-> self root))) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate fall (crate) + :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 'carry-info) + (-> self carry) + ) + ((or (= v1-0 'carry?) (= v1-0 'pickup)) + (the-as carry-info #f) + ) + ) + ) + ) + ) + :enter (behavior () + (when (handle->process (-> self carry other)) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer self)) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'carry-info) + (let* ((a0-9 (the-as carry-info (send-event-function (handle->process (-> self carry other)) a1-1))) + (t9-1 (method-of-object a0-9 carry-info-method-12)) + ) + (-> self carry) + (t9-1 a0-9) + ) + ) + ) + (set! (-> (the-as collide-shape-moving (-> self root)) status) (cshape-moving-flags)) + (set! (-> (the-as collide-shape-moving (-> self root)) root-prim local-sphere w) (-> self carry carry-radius)) + (set! (-> (the-as collide-shape-moving (-> self root)) root-prim prim-core collide-with) + (logior (collide-spec backgnd crate obstacle hit-by-others-list pusher) + (-> (the-as collide-shape-moving (-> self root)) root-prim prim-core collide-with) + ) + ) + (none) + ) + :trans (behavior () + (when (and (logtest? (-> (the-as collide-shape-moving (-> self root)) status) (cshape-moving-flags on-surface)) + (< 0.8 (-> (the-as collide-shape-moving (-> self root)) surface-angle)) + ) + (vector-reset! (-> self root transv)) + (when (= (vector-length (-> self root transv)) 0.0) + (set! (-> (the-as collide-shape-moving (-> self root)) root-prim local-sphere w) + (-> self carry backup-radius) + ) + (set! (-> self base quad) (-> self root trans quad)) + (let ((v1-16 (-> (the-as collide-shape-moving (-> self root)) root-prim))) + (set! (-> v1-16 prim-core collide-as) (-> (the-as collide-shape-moving (-> self root)) backup-collide-as)) + (set! (-> v1-16 prim-core collide-with) (-> (the-as collide-shape-moving (-> self root)) backup-collide-with)) + ) + (go-virtual idle) + ) + ) + (none) + ) + :code (the-as (function none :behavior crate) sleep-code) + :post (behavior () + (let* ((gp-0 vector-v++!) + (s5-0 (-> self root transv)) + (a0-0 (-> self root)) + (t9-0 (method-of-object (the-as collide-shape-moving a0-0) collide-shape-moving-method-62)) + ) + (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) + 0 + (gp-0 s5-0 (the-as vector (t9-0 (the-as collide-shape-moving a0-0)))) + ) + (if (< (-> (the-as collide-shape-moving (-> self root)) dynam gravity-max) (vector-length (-> self root transv))) + (vector-normalize! (-> self root transv) (-> (the-as collide-shape-moving (-> self root)) dynam gravity-max)) + ) + (let ((gp-1 (-> self root))) + (let ((a2-1 (new 'stack-no-clear 'collide-query))) + (set! (-> (the-as collide-shape-moving gp-1) root-prim type) collide-shape-prim-sphere) + (set! (-> a2-1 collide-with) (collide-spec backgnd crate obstacle pusher)) + (set! (-> a2-1 ignore-process0) self) + (set! (-> a2-1 ignore-process1) #f) + (set! (-> a2-1 ignore-pat) (-> (the-as collide-shape-moving gp-1) pat-ignore-mask)) + (set! (-> a2-1 action-mask) (collide-action solid)) + (collide-shape-method-32 + (the-as collide-shape-moving gp-1) + (-> (the-as collide-shape-moving gp-1) transv) + a2-1 + (meters 0) + ) + ) + (set! (-> (the-as collide-shape-moving gp-1) root-prim type) collide-shape-prim-mesh) + ) + (crate-post) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate bounce-on (crate) + :virtual #t + :event crate-standard-event-handler + :code (behavior () + (while (!= (-> self smush amp) 0.0) + (suspend) + ) + (go-virtual idle) + (none) + ) + :post (the-as (function none :behavior crate) crate-post) + ) + +;; failed to figure out what this is: +(defstate notice-blue (crate) + :virtual #t + :event crate-standard-event-handler + :trans (behavior () + (cond + ((not (send-event *target* 'query 'powerup (pickup-type eco-blue))) + (logior! (-> self mask) (process-mask sleep-code)) + (if (not (!= (-> self smush amp) 0.0)) + (go-virtual idle) + ) + ) + (else + (logclear! (-> self mask) (process-mask sleep-code)) + ) + ) + (none) + ) + :code (behavior ((arg0 handle)) + (set! (-> self target) arg0) + (until #f + (let* ((gp-0 (handle->process (-> self target))) + (v1-3 (if (type? gp-0 process-drawable) + gp-0 + ) + ) + ) + (when v1-3 + (let* ((gp-1 (-> (the-as process-drawable v1-3) root)) + (v1-4 (if (type? (the-as collide-shape-moving gp-1) collide-shape) + gp-1 + ) + ) + ) + (when v1-4 + (let* ((gp-2 (-> (the-as collide-shape-moving (-> self root)) root-prim prim-core)) + (a1-3 (-> (the-as collide-shape-moving v1-4) root-prim prim-core)) + (f30-0 (vector-vector-distance (the-as vector gp-2) (the-as vector a1-3))) + ) + (when (and (< f30-0 (-> *FACT-bank* suck-suck-dist)) (!= (-> self defense) 'steel)) + (logior! (-> self fact options) (actor-option suck-in)) + (process-contact-action (handle->process (-> self target))) + (go-virtual die #f 0) + ) + (when (rand-vu-percent? 0.5) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 quad) (-> gp-2 world-sphere quad)) + (dotimes (gp-3 3) + (+! (-> s5-0 data gp-3) (rand-vu-float-range -5324.8 5324.8)) + ) + (eco-blue-glow s5-0) + ) + ) + (activate! + (-> self smush) + (lerp-scale + (rand-vu-float-range 0.1 0.3) + (rand-vu-float-range 0.0 0.02) + f30-0 + (-> *FACT-bank* suck-suck-dist) + (-> *FACT-bank* suck-bounce-dist) + ) + 60 + 60 + 1.0 + 1.0 + (-> self clock) + ) + ) + ) + ) + ) + ) + (suspend) + ) + #f + (none) + ) + :post (the-as (function none :behavior crate) crate-post) + ) + +;; failed to figure out what this is: +(defstate die (crate) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('touched) + (case (-> self defense) + (('darkeco) + (let ((a1-3 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-3 from) (process->ppointer self)) + (set! (-> a1-3 num-params) 2) + (set! (-> a1-3 message) 'attack) + (set! (-> a1-3 param 0) (-> event param 0)) + (let ((v1-6 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (let* ((a2-2 *game-info*) + (a3-2 (+ (-> a2-2 attack-id) 1)) + ) + (set! (-> a2-2 attack-id) a3-2) + (set! (-> v1-6 id) a3-2) + ) + (set! (-> v1-6 mode) 'darkeco) + (set! (-> a1-3 param 1) (the-as uint v1-6)) + ) + (send-event-function proc a1-3) + ) + ) + ) + ) + ) + ) + :code (behavior ((arg0 symbol) (arg1 int)) + (logior! (-> self focus-status) (focus-status dead)) + (let ((v1-3 (-> (the-as collide-shape (-> self root)) root-prim))) + (set! (-> v1-3 prim-core collide-as) (collide-spec)) + (set! (-> v1-3 prim-core collide-with) (collide-spec)) + ) + 0 + (if (nonzero? (-> self sound)) + (stop! (-> self sound)) + ) + (let ((v1-10 (handle->process (-> self target)))) + (if (and (and v1-10 + (= (-> v1-10 type) target) + (logtest? (focus-status flut tube board pilot) (-> (the-as process-focusable v1-10) focus-status)) + ) + (and (!= (-> self fact pickup-type) 10) (not arg0)) + ) + (logior! (-> self fact options) (actor-option suck-in)) + ) + ) + (when (not arg0) + (let ((s5-1 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) s5-1) (seconds 0.04)) + (suspend) + ) + ) + (logior! (-> self draw status) (draw-control-status no-draw)) + (case (-> self look) + (('iron) + (sound-play "icrate-break") + ) + (('steel) + (sound-play "scrate-break") + ) + (('darkeco) + (sound-play "dcrate-break") + ) + (else + (sound-play "wcrate-break") + ) + ) + (case (-> self defense) + (('darkeco) + (let ((f0-0 (lerp-scale 1.0 0.0 (vector-vector-distance (-> self root trans) (target-pos 0)) 8192.0 40960.0))) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 (the int (* 255.0 f0-0)) (seconds 0.3)) + ) + (process-spawn + touch-tracker + :init touch-tracker-init + (-> self root trans) + (-> *CRATE-bank* DARKECO_EXPLODE_RADIUS) + 30 + :to self + ) + ) + ) + (case (-> self look) + (('darkeco) + (let ((s5-8 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-8 + (let ((t9-17 (method-of-type part-tracker activate))) + (t9-17 (the-as part-tracker s5-8) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) + ) + (let ((t9-18 run-function-in-process) + (a0-34 s5-8) + (a1-21 part-tracker-init) + (a2-11 (-> *part-group-id-table* 126)) + (a3-9 0) + (t0-6 #f) + (t1-4 #f) + (t2-4 #f) + (t3-0 *launch-matrix*) + ) + (set! (-> t3-0 trans quad) (-> self root trans quad)) + ((the-as (function object object object object object object object object none) t9-18) + a0-34 + a1-21 + a2-11 + a3-9 + t0-6 + t1-4 + t2-4 + t3-0 + ) + ) + (-> s5-8 ppointer) + ) + ) + ) + (('steel 'iron) + (let ((s5-9 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-9 + (let ((t9-20 (method-of-type part-tracker activate))) + (t9-20 (the-as part-tracker s5-9) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) + ) + (let ((t9-21 run-function-in-process) + (a0-39 s5-9) + (a1-27 part-tracker-init) + (a2-14 (-> *part-group-id-table* 125)) + (a3-11 0) + (t0-7 #f) + (t1-5 #f) + (t2-5 #f) + (t3-1 *launch-matrix*) + ) + (set! (-> t3-1 trans quad) (-> self root trans quad)) + ((the-as (function object object object object object object object object none) t9-21) + a0-39 + a1-27 + a2-14 + a3-11 + t0-7 + t1-5 + t2-5 + t3-1 + ) + ) + (-> s5-9 ppointer) + ) + ) + ) + (else + (let ((s5-10 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-10 + (let ((t9-23 (method-of-type part-tracker activate))) + (t9-23 (the-as part-tracker s5-10) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) + ) + (let ((t9-24 run-function-in-process) + (a0-42 s5-10) + (a1-32 part-tracker-init) + (a2-17 (-> *part-group-id-table* 124)) + (a3-13 0) + (t0-8 #f) + (t1-6 #f) + (t2-6 #f) + (t3-2 *launch-matrix*) + ) + (set! (-> t3-2 trans quad) (-> self root trans quad)) + ((the-as (function object object object object object object object object none) t9-24) + a0-42 + a1-32 + a2-17 + a3-13 + t0-8 + t1-6 + t2-6 + t3-2 + ) + ) + (-> s5-10 ppointer) + ) + ) + ) + ) + ) + (case (-> self fact pickup-type) + (((pickup-type money) + (pickup-type buzzer) + (pickup-type eco-blue) + (pickup-type eco-yellow) + (pickup-type eco-red) + (pickup-type fuel-cell) + (pickup-type gem) + (pickup-type skill) + ) + (go-virtual special-contents-die) + ) + (((pickup-type health)) + (if (not (demo?)) + (talker-spawn-func (-> *talker-speech* 8) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ) + ) + (let ((t9-29 (method-of-object (-> self fact) fact-info-method-9))) + #t + *entity-pool* + (t9-29) + ) + (process-entity-status! self (entity-perm-status dead) #t) + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (let ((gp-1 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) gp-1) (seconds 5)) + (suspend) + ) + ) + (when (logtest? (actor-option cond-respawn) (-> self fact options)) + (let ((gp-2 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) gp-2) (seconds 15)) + (suspend) + ) + ) + (go-virtual hide) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate special-contents-die (crate) + :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 'notify) + (case (-> event param 0) + (('pickup) + (let ((gp-0 (-> self entity extra perm))) + (logior! (-> gp-0 status) (entity-perm-status bit-5)) + (set! (-> gp-0 user-int8 1) (min 127 (+ (-> gp-0 user-int8 1) 1))) + (+! (-> self child-count) -1) + (when (<= (-> self child-count) 0) + (if (or (= (-> self defense) 'iron) (= (-> self defense) 'steel)) + (process-entity-status! self (entity-perm-status bit-4) #f) + ) + (process-entity-status! self (entity-perm-status dead) #t) + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (set! (-> gp-0 user-int8 0) 2) + (let ((v0-0 (logclear (-> self mask) (process-mask sleep)))) + (set! (-> self mask) v0-0) + v0-0 + ) + ) + ) + ) + ) + ) + ) + ) + ) + :trans (-> (method-of-type crate die) trans) + :code (behavior () + (logior! (-> self focus-status) (focus-status dead)) + (when (or (= (-> self fact pickup-type) (pickup-type money)) + (= (-> self fact pickup-type) (pickup-type gem)) + (= (-> self fact pickup-type) (pickup-type skill)) + (= (-> self defense) 'iron) + (= (-> self defense) 'steel) + ) + (let ((a0-6 (-> self entity))) + (if (when a0-6 + (let ((a0-7 (-> a0-6 extra perm task))) + (if a0-7 + (zero? a0-7) + ) + ) + ) + (set! (-> self entity extra perm task) (the-as uint 1)) + ) + ) + ) + (let ((v1-20 (-> (the-as collide-shape-moving (-> self root)) root-prim))) + (set! (-> v1-20 prim-core collide-as) (collide-spec)) + (set! (-> v1-20 prim-core collide-with) (collide-spec)) + ) + 0 + (logior! (-> self draw status) (draw-control-status no-draw)) + (let ((t9-0 (method-of-object (-> self fact) fact-info-method-9))) + #t + self + 0 + (t9-0) + ) + (set! (-> self child-count) (+ (process-count self) -1)) + (process-entity-status! self (entity-perm-status bit-4) #t) + (when (-> self entity) + (let ((v1-32 (-> self entity extra perm))) + (logior! (-> v1-32 status) (entity-perm-status bit-5)) + (set! (-> v1-32 user-int8 0) 1) + ) + ) + (when (-> self child) + (logior! (-> self mask) (process-mask sleep)) + (suspend) + (while (-> self child) + (suspend) + ) + ) + (none) + ) + ) + +;; definition for function crate-init-by-other +;; INFO: Used lq/sq +(defbehavior crate-init-by-other crate ((arg0 entity) (arg1 vector) (arg2 symbol) (arg3 fact-info-crate)) + (crate-init! self (the-as entity-actor arg0)) + (set! (-> self root trans quad) (-> arg1 quad)) + (set! (-> self look) arg2) + (set! (-> self defense) arg2) + (skel-init! self) + (when arg3 + (set! (-> self fact pickup-type) (-> arg3 pickup-type)) + (set! (-> self fact pickup-amount) (-> arg3 pickup-spawn-amount)) + (set! (-> self fact options) (-> arg3 options)) + ) + (crate-method-38 self) + (none) + ) + +;; definition for method 11 of type crate +(defmethod init-from-entity! crate ((obj crate) (arg0 entity-actor)) + (crate-init! obj arg0) + (skel-init! obj) + (crate-method-38 obj) + (none) + ) + +;; definition for method 35 of type crate +;; WARN: Return type mismatch crate vs none. +(defmethod crate-init! crate ((obj crate) (arg0 entity-actor)) + "Initialize the [[crate]] with the specified [[entity-actor]]." + (stack-size-set! (-> obj main-thread) 128) + (set! (-> obj mask) (logior (process-mask crate) (-> obj mask))) + (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s4-0 reaction) cshape-reaction-default) + (set! (-> s4-0 no-reaction) nothing) + (let ((v1-10 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-10 prim-core collide-as) (collide-spec crate notice-blue-eco-powerup)) + (set! (-> v1-10 prim-core collide-with) (collide-spec jak player-list tobot)) + (set! (-> v1-10 prim-core action) (collide-action solid rideable)) + (set! (-> v1-10 transform-index) 3) + (set-vector! (-> v1-10 local-sphere) 0.0 3072.0 0.0 (-> *CRATE-bank* COLLIDE_RADIUS)) + (set! (-> s4-0 total-prims) (the-as uint 1)) + (set! (-> s4-0 root-prim) v1-10) + ) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (let ((v1-13 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-13 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-13 prim-core collide-with)) + ) + (set! (-> s4-0 penetrated-by) + (penetrate + generic-attack + lunge + flop + punch + spin + roll + uppercut + bonk + tube + vehicle + flut-attack + board + mech + mech-punch + dark-skin + dark-punch + dark-giant + knocked + ) + ) + (set! (-> obj root) s4-0) + ) + (set! (-> obj fact) + (new 'process 'fact-info-crate obj (pickup-type eco-pill-random) (-> *FACT-bank* default-eco-pill-green-inc)) + ) + (when (-> obj entity) + (let ((v1-22 (-> obj entity extra perm))) + (set! (-> obj fact pickup-amount) + (fmax 0.0 (- (-> obj fact pickup-amount) (the float (-> v1-22 user-int8 1)))) + ) + ) + ) + (when (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status subtask-complete))) + (set! (-> obj fact pickup-type) (pickup-type eco-pill-random)) + (set! (-> obj fact pickup-amount) 0.0) + ) + (when arg0 + (process-drawable-from-entity! obj arg0) + (logclear! (-> obj mask) (process-mask actor-pause)) + ) + (let ((v1-37 + ((method-of-type res-lump get-property-struct) + (-> obj entity) + 'crate-type + 'interp + -1000000000.0 + (the-as structure 'wood) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (set! (-> obj look) (the-as symbol v1-37)) + (set! (-> obj defense) (the-as symbol v1-37)) + ) + (set! (-> obj carry) + (new 'process 'carry-info obj 3 (new 'static 'vector :w 1.0) (new 'static 'vector :y 1.0 :w 1.0) 0.0) + ) + (set! (-> obj carry max-pull) 3686.4) + (set! (-> obj carry carry-radius) 3276.8) + (set! (-> obj target) (the-as handle #f)) + (none) + ) + +;; definition for method 36 of type crate +;; INFO: Used lq/sq +;; WARN: Return type mismatch crate vs none. +(defmethod skel-init! crate ((obj crate)) + "Initialize the [[crate]]'s skeleton and other parameters based on the crate type." + (case (-> obj look) + (('iron) + (set! (-> (the-as collide-shape-moving (-> obj root)) penetrated-by) + (penetrate flop uppercut tube vehicle flut-attack board dark-skin explode) + ) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-crate-krimson" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + ) + (('steel) + (set! (-> (the-as collide-shape-moving (-> obj root)) penetrated-by) + (penetrate tube vehicle flut-attack board dark-skin explode) + ) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-crate-krimson" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + ) + (('darkeco) + (when (= (-> obj fact pickup-type) (pickup-type eco-pill-random)) + (set! (-> obj fact pickup-type) (pickup-type none)) + (set! (-> obj fact pickup-amount) 0.0) + ) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-crate-krimson" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (set-vector! (-> obj draw color-mult) 0.8 0.8 0.8 1.0) + (set-vector! (-> obj draw color-emissive) 0.2 0.2 0.2 1.0) + ) + (('none) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-crate-krimson" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (logior! (-> obj draw status) (draw-control-status no-draw)) + ) + (else + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-crate-krimson" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + ) + ) + (set! (-> obj base quad) (-> obj root trans quad)) + (crate-post) + (nav-mesh-connect-from-ent (the-as entity-nav-mesh obj)) + (none) + ) + +;; definition for method 37 of type crate +;; WARN: Return type mismatch crate vs none. +(defmethod params-set! crate ((obj crate) (arg0 symbol) (arg1 symbol)) + "Set [[crate]] params based on the arguments." + (if arg0 + (set! (-> obj look) arg0) + ) + (if arg1 + (set! (-> obj defense) arg1) + ) + (none) + ) + +;; definition for method 38 of type crate +;; WARN: Return type mismatch int vs none. +(defmethod crate-method-38 crate ((obj crate)) + (when (-> obj entity) + (if (>= (-> obj entity extra perm user-int8 0) 1) + (go (method-of-object obj die) #t 0) + ) + ) + (cond + ((logtest? (actor-option cond-hide) (-> obj fact options)) + (go (method-of-object obj hide)) + ) + ((logtest? (actor-option fall) (-> obj fact options)) + (go (method-of-object obj fall)) + ) + (else + (go (method-of-object obj idle)) + ) + ) + 0 + (none) + ) + +;; definition for method 39 of type crate +;; WARN: Return type mismatch int vs none. +(defmethod smush-update! crate ((obj crate)) + (let ((f0-0 (update! (-> obj smush)))) + (set! (-> obj root scale x) (+ 1.0 (* -0.5 f0-0))) + (set! (-> obj root scale y) (+ 1.0 f0-0)) + (set! (-> obj root scale z) (+ 1.0 (* -0.5 f0-0))) + ) + 0 + (none) + ) + +;; definition for method 40 of type crate +;; WARN: disable def twice: 57. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +(defmethod crate-method-40 crate ((obj crate)) + (cond + ((and (> (-> (the-as fact-info-crate (-> obj fact)) suck-count) 0) + (< (you-suck-stage *game-info* #f) (-> (the-as fact-info-crate (-> obj fact)) suck-count)) + ) + #t + ) + ((logtest? (actor-option cond-low-ammo) (-> obj fact options)) + (case (-> obj fact pickup-type) + (((pickup-type ammo-yellow) (pickup-type ammo-red) (pickup-type ammo-blue) (pickup-type ammo-dark)) + (let ((a1-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-4 from) (process->ppointer self)) + (set! (-> a1-4 num-params) 1) + (set! (-> a1-4 message) 'test-pickup) + (set! (-> a1-4 param 0) (the-as uint (-> obj fact pickup-type))) + (let ((v1-15 (the-as float (send-event-function *target* a1-4)))) + (or (not v1-15) (< 10.0 v1-15)) + ) + ) + ) + (else + #f + ) + ) + ) + (else + #f + ) + ) + ) + +;; definition of type pickup-spawner +(deftype pickup-spawner (crate) + ((blocker entity-actor :offset-assert 288) + ) + :heap-base #xb0 + :method-count-assert 41 + :size-assert #x124 + :flag-assert #x2900b00124 + ) + +;; definition for method 3 of type pickup-spawner +(defmethod inspect pickup-spawner ((obj pickup-spawner)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type crate inspect))) + (t9-0 obj) + ) + (format #t "~2Tblocker: ~A~%" (-> obj blocker)) + (label cfg-4) + obj + ) + +;; definition for method 35 of type pickup-spawner +;; WARN: Return type mismatch pickup-spawner vs none. +(defmethod crate-init! pickup-spawner ((obj pickup-spawner) (arg0 entity-actor)) + "Initialize the [[crate]] with the specified [[entity-actor]]." + (let ((t9-0 (method-of-type crate crate-init!))) + (t9-0 obj arg0) + ) + (set! (-> obj look) 'none) + (set! (-> obj blocker) #f) + (if (logtest? (-> obj fact options) (actor-option blocked)) + (set! (-> obj blocker) (entity-actor-lookup (-> obj entity) 'alt-actor 0)) + ) + (none) + ) + +;; definition for method 38 of type pickup-spawner +;; WARN: Return type mismatch int vs none. +(defmethod crate-method-38 pickup-spawner ((obj pickup-spawner)) + (go (method-of-object obj idle)) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate idle (pickup-spawner) + :virtual #t + :code (behavior () + (until #f + (if (or (not (-> self blocker)) + (logtest? (-> self blocker extra perm status) (entity-perm-status subtask-complete)) + ) + (go-virtual die #t 0) + ) + (suspend) + ) + #f + (none) + ) + ) diff --git a/test/decompiler/reference/jak2/engine/common_objs/dark-eco-pool_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/dark-eco-pool_REF.gc new file mode 100644 index 0000000000..5f6b288d34 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/common_objs/dark-eco-pool_REF.gc @@ -0,0 +1,335 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type dark-eco-pool +(deftype dark-eco-pool (water-anim) + () + :heap-base #x80 + :method-count-assert 29 + :size-assert #x100 + :flag-assert #x1d00800100 + ) + +;; definition for method 3 of type dark-eco-pool +(defmethod inspect dark-eco-pool ((obj dark-eco-pool)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type water-anim inspect))) + (t9-0 obj) + ) + (label cfg-4) + obj + ) + +;; definition for symbol *ripple-for-dark-eco-pool*, type ripple-wave-set +(define *ripple-for-dark-eco-pool* (new 'static 'ripple-wave-set + :count 3 + :converted #f + :normal-scale 3.0 + :wave (new 'static 'inline-array ripple-wave 4 + (new 'static 'ripple-wave :scale 11.0 :xdiv 1 :speed 1.0) + (new 'static 'ripple-wave :scale 7.5 :xdiv -1 :zdiv 1 :speed 4.0) + (new 'static 'ripple-wave :scale 2.0 :xdiv 5 :zdiv 3 :speed 2.0) + (new 'static 'ripple-wave) + ) + ) + ) + +;; definition for symbol *ripple-strip-dark-eco-near-lift*, type ripple-wave-set +(define *ripple-strip-dark-eco-near-lift* + (new 'static 'ripple-wave-set + :count 3 + :converted #f + :normal-scale 3.0 + :wave (new 'static 'inline-array ripple-wave 4 + (new 'static 'ripple-wave :scale 4.0 :xdiv 1 :speed 1.0) + (new 'static 'ripple-wave :scale 2.5 :xdiv -1 :zdiv 1 :speed 3.0) + (new 'static 'ripple-wave :scale 3.0 :xdiv 5 :zdiv 3 :speed 2.0) + (new 'static 'ripple-wave) + ) + ) + ) + +;; definition for method 28 of type dark-eco-pool +;; WARN: Return type mismatch ambient-sound vs none. +(defmethod offset! dark-eco-pool ((obj dark-eco-pool)) + "Offset a [[water-anim]]'s `trans` and `quat` by the lump data in `entity`." + (let ((t9-0 (method-of-type water-anim offset!))) + (t9-0 obj) + ) + (logclear! (-> obj flags) (water-flags part-water)) + (logior! (-> obj flags) (water-flags dark-eco)) + (set! (-> obj attack-event) + (the-as + symbol + ((method-of-type res-lump get-property-struct) + (-> obj entity) + 'attack-event + 'interp + -1000000000.0 + (the-as structure 'dark-eco-pool) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "eco-pool" :fo-min 30 :fo-max 50) (-> obj root trans)) + ) + (none) + ) + +;; definition for method 24 of type dark-eco-pool +;; WARN: Return type mismatch ripple-wave-set vs none. +(defmethod art-init! dark-eco-pool ((obj dark-eco-pool)) + "Initialize a [[water-anim]]'s [[skeleton-group]], joints and ambience." + (let ((t9-0 (method-of-type water-anim art-init!))) + (t9-0 obj) + ) + (let ((s5-0 (new 'process 'ripple-control))) + (set! (-> obj draw ripple) s5-0) + (set! (-> s5-0 global-scale) 3072.0) + (set! (-> s5-0 close-fade-dist) 163840.0) + (set! (-> s5-0 far-fade-dist) 245760.0) + (set! (-> s5-0 waveform) *ripple-for-dark-eco-pool*) + (set! (-> s5-0 query) (new 'process 'ripple-merc-query 100)) + (case (-> obj look) + ((5) + (set! (-> s5-0 waveform) *ripple-strip-dark-eco-near-lift*) + ) + ) + ) + (none) + ) + +;; failed to figure out what this is: +(defpartgroup group-dark-eco-nasty + :id 128 + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 8) + :parts ((sp-item 577 :fade-after (meters 50))) + ) + +;; failed to figure out what this is: +(defpart 577 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-y (meters 0)) + (sp-rnd-flt spt-scale-x (meters 1) (meters 4) 1.0) + (sp-flt spt-scale-y (meters 0.25)) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-rnd-flt spt-a 96.0 32.0 1.0) + (sp-flt spt-scalevel-x (meters 0.1875)) + (sp-flt spt-scalevel-y (meters -0.001875)) + (sp-flt spt-fade-a -3.2) + (sp-int spt-timer 10) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + (sp-int spt-next-time 15) + (sp-launcher-by-id spt-next-launcher 578) + ) + ) + +;; failed to figure out what this is: +(defpart 578 + :init-specs ((sp-flt spt-r 255.0) (sp-rnd-flt spt-g 128.0 128.0 1.0) (sp-flt spt-b 0.0) (sp-flt spt-fade-a -1.28)) + ) + +;; failed to figure out what this is: +(defpartgroup group-dark-eco-pool-nasty + :id 129 + :duration (seconds 2) + :linger-duration (seconds 2) + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 12) + :parts ((sp-item 583 :fade-after (meters 100) :period 600 :length 5) + (sp-item 584 :fade-after (meters 100) :period 600 :length 5 :binding 579) + (sp-item 579 :flags (start-dead launch-asap) :binding 580) + (sp-item 580 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 579 :flags (start-dead launch-asap) :binding 580) + (sp-item 580 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 579 :flags (start-dead launch-asap) :binding 580) + (sp-item 580 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 579 :flags (start-dead launch-asap) :binding 580) + (sp-item 580 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 585 :fade-after (meters 100) :period 600 :length 5 :binding 581) + (sp-item 581 :flags (start-dead launch-asap) :binding 582) + (sp-item 582 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 581 :flags (start-dead launch-asap) :binding 582) + (sp-item 582 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 581 :flags (start-dead launch-asap) :binding 582) + (sp-item 582 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + (sp-item 581 :flags (start-dead launch-asap) :binding 582) + (sp-item 582 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead)) + ) + ) + +;; failed to figure out what this is: +(defpart 583 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 8)) + (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 0.0 96.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-flt spt-a 64.0) + (sp-flt spt-fade-a -1.8285716) + (sp-int spt-timer 54) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + ) + ) + +;; failed to figure out what this is: +(defpart 584 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) + (sp-rnd-flt spt-num 1.0 6.0 1.0) + (sp-flt spt-y (meters 1)) + (sp-flt spt-scale-x (meters 0.1)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-y (meters 0.04) (meters 0.02) 1.0) + (sp-flt spt-accel-y -3.4133334) + (sp-flt spt-friction 0.94) + (sp-int spt-timer 240) + (sp-cpuinfo-flags sp-cpuinfo-flag-3) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 140.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 579 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-y (meters 0) (meters 16) 1.0) + (sp-rnd-flt spt-z (meters 0.3) (meters 0.3) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.4) (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-rnd-flt spt-r 0.0 96.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-rnd-flt spt-a 64.0 64.0 1.0) + (sp-rnd-flt spt-omega 0.0 65536.0 1.0) + (sp-rnd-flt spt-vel-x (meters 0.026666667) (meters 0.10666667) 1.0) + (sp-flt spt-scalevel-x (meters -0.000909091)) + (sp-rnd-int-flt spt-rotvel-z (degrees -0.3) 1 109.22667) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -0.26666668) + (sp-flt spt-fade-a -0.19393939) + (sp-int-plain-rnd spt-timer 60 179 1) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 ready-to-launch sp-cpuinfo-flag-14) + ) + ) + +;; failed to figure out what this is: +(defpart 580 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 0.4) (meters 0.1) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 32.0 96.0 1.0) + (sp-rnd-flt spt-g 0.0 32.0 1.0) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-rnd-flt spt-a 32.0 32.0 1.0) + (sp-flt spt-scalevel-x (meters -0.0006190476)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.01904762) + (sp-rnd-flt spt-accel-y -0.40960002 -0.6144 1.0) + (sp-int-plain-rnd spt-timer 30 239 1) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + (sp-int spt-next-time 240) + (sp-launcher-by-id spt-next-launcher 397) + ) + ) + +;; failed to figure out what this is: +(defpart 585 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) + (sp-rnd-flt spt-num 1.0 6.0 1.0) + (sp-flt spt-y (meters 1)) + (sp-flt spt-scale-x (meters 0.1)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-y (meters 0.04) (meters 0.02) 1.0) + (sp-flt spt-accel-y -3.4133334) + (sp-flt spt-friction 0.94) + (sp-int spt-timer 240) + (sp-cpuinfo-flags sp-cpuinfo-flag-3) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 140.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 581 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-y (meters 0) (meters 16) 1.0) + (sp-rnd-flt spt-z (meters 0.3) (meters 0.3) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.4) (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-rnd-flt spt-r 16.0 32.0 1.0) + (sp-rnd-flt spt-g 0.0 16.0 1.0) + (sp-rnd-flt spt-b 192.0 64.0 1.0) + (sp-rnd-flt spt-a 64.0 64.0 1.0) + (sp-rnd-flt spt-omega 0.0 65536.0 1.0) + (sp-rnd-flt spt-vel-x (meters 0.026666667) (meters 0.10666667) 1.0) + (sp-flt spt-scalevel-x (meters -0.000909091)) + (sp-rnd-int-flt spt-rotvel-z (degrees -0.3) 1 109.22667) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -0.26666668) + (sp-flt spt-fade-a -0.19393939) + (sp-int-plain-rnd spt-timer 60 179 1) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 ready-to-launch sp-cpuinfo-flag-14) + ) + ) + +;; failed to figure out what this is: +(defpart 582 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 0.4) (meters 0.1) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 16.0 32.0 1.0) + (sp-rnd-flt spt-g 0.0 16.0 1.0) + (sp-rnd-flt spt-b 192.0 64.0 1.0) + (sp-rnd-flt spt-a 32.0 32.0 1.0) + (sp-flt spt-scalevel-x (meters -0.0006190476)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.01904762) + (sp-rnd-flt spt-accel-y -0.40960002 -0.6144 1.0) + (sp-int-plain-rnd spt-timer 30 239 1) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + (sp-int spt-next-time 240) + (sp-launcher-by-id spt-next-launcher 397) + ) + ) + +;; failed to figure out what this is: +(defstate idle (dark-eco-pool) + :virtual #t + :trans (behavior () + (let ((t9-0 (-> (method-of-type water-anim idle) trans))) + (if t9-0 + (t9-0) + ) + ) + (let* ((gp-0 (-> self draw ripple)) + (f0-1 (the float (logand (-> self clock frame-counter) #xffff))) + (f0-6 (cos (the float (sar (shl (the int (* 5.0 f0-1)) 48) 48)))) + (f0-7 (* f0-6 f0-6)) + (f0-9 (fmax -1.0 (fmin 1.0 f0-7))) + ) + (set! (-> gp-0 global-scale) (* 4096.0 (* 3.0 (+ 1.0 f0-9)))) + (set! (-> gp-0 individual-normal-scale) (+ 0.5 (* 0.5 f0-9))) + ) + (none) + ) + ) diff --git a/test/decompiler/reference/jak2/engine/common_objs/generic-obs-h_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/generic-obs-h_REF.gc index e784496fdc..78a5e73e1c 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/generic-obs-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/generic-obs-h_REF.gc @@ -118,7 +118,7 @@ (duration uint64 :offset-assert 224) (linger-duration uint64 :offset-assert 232) (start-time time-frame :offset-assert 240) - (target uint64 :offset-assert 248) + (target handle :offset-assert 248) (target-joint int32 :offset-assert 256) (offset vector :inline :offset-assert 272) (userdata uint64 :offset-assert 288) diff --git a/test/decompiler/reference/jak2/engine/common_objs/plat_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/plat_REF.gc index b67a655a62..adf2c876d7 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/plat_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/plat_REF.gc @@ -35,27 +35,10 @@ ) ;; failed to figure out what this is: -(let ((a0-2 (new 'static 'skeleton-group - :name "skel-plat" - :extra #f - :info #f - :art-group-name "plat" - :bounds (new 'static 'vector :y -2048.0 :w 12288.0) - :max-lod 2 - :version #x7 +(defskelgroup skel-plat plat 0 4 + ((1 (meters 20)) (2 (meters 40)) (3 (meters 999999))) + :bounds (static-spherem 0 -0.5 0 3) ) - ) - ) - (set! (-> a0-2 jgeo) 0) - (set! (-> a0-2 janim) 4) - (set! (-> a0-2 mgeo 0) 1) - (set! (-> a0-2 lod-dist 0) 81920.0) - (set! (-> a0-2 mgeo 1) 2) - (set! (-> a0-2 lod-dist 1) 163840.0) - (set! (-> a0-2 mgeo 2) 3) - (set! (-> a0-2 lod-dist 2) 4095996000.0) - (add-to-loading-level a0-2) - ) ;; definition for method 30 of type plat (defmethod get-art-group plat ((obj plat)) @@ -284,11 +267,11 @@ (if (nonzero? (-> obj break-anim-name)) (&+! (-> obj break-anim-name) arg0) ) - (let ((v1-5 (-> obj anim buffer))) + (let ((v1-5 (-> obj anim anim-name))) (if (and (>= (the-as int v1-5) (-> *kernel-context* relocating-min)) (< (the-as int v1-5) (-> *kernel-context* relocating-max)) ) - (&+! (-> obj anim buffer) arg0) + (set! (-> obj anim anim-name) (&+ (the-as external-art-buffer (-> obj anim anim-name)) arg0)) ) ) (the-as drop-plat ((method-of-type base-plat relocate) obj arg0)) diff --git a/test/decompiler/reference/jak2/engine/common_objs/projectile-h_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/projectile-h_REF.gc index a09c397acd..baeeb3f172 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/projectile-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/projectile-h_REF.gc @@ -48,7 +48,7 @@ (projectile-method-28 () none 28) (projectile-method-29 () none 29) (projectile-method-30 () none 30) - (projectile-method-31 () none 31) + (projectile-method-31 (_type_) none 31) (projectile-method-32 () none 32) (projectile-method-33 () none 33) (projectile-method-34 () none 34) diff --git a/test/decompiler/reference/jak2/engine/common_objs/water-anim_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/water-anim_REF.gc new file mode 100644 index 0000000000..9b4f215ea5 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/common_objs/water-anim_REF.gc @@ -0,0 +1,712 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type water-anim +(deftype water-anim (process-drawable) + ((water-height meters :offset-assert 200) + (wade-height meters :offset-assert 204) + (swim-height meters :offset-assert 208) + (bottom-height meters :offset-assert 212) + (attack-event symbol :offset-assert 216) + (attack-id uint32 :offset-assert 220) + (flow flow-control :offset-assert 224) + (target handle :offset-assert 232) + (flags water-flags :offset-assert 240) + (look int32 :offset-assert 244) + (play-ambient-sound? symbol :offset-assert 248) + (visible symbol :offset-assert 252) + ) + :heap-base #x80 + :method-count-assert 29 + :size-assert #x100 + :flag-assert #x1d00800100 + (:methods + (water-anim-method-20 () none 20) + (idle () _type_ :state 21) + (move-to-point! (_type_ vector) int 22) + (get-ripple-height (_type_ vector) float 23) + (art-init! (_type_) none 24) + (reset-root! (_type_) trsqv 25) + (water-anim-init! (_type_) none 26) + (water-anim-method-27 (_type_) none 27) + (offset! (_type_) none 28) + ) + ) + +;; definition for method 3 of type water-anim +(defmethod inspect water-anim ((obj water-anim)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~2Twater-height: (meters ~m)~%" (-> obj water-height)) + (format #t "~2Twade-height: (meters ~m)~%" (-> obj wade-height)) + (format #t "~2Tswim-height: (meters ~m)~%" (-> obj swim-height)) + (format #t "~2Tbottom-height: (meters ~m)~%" (-> obj bottom-height)) + (format #t "~2Tattack-event: ~A~%" (-> obj attack-event)) + (format #t "~2Tattack-id: ~D~%" (-> obj attack-id)) + (format #t "~2Tflow: ~A~%" (-> obj flow)) + (format #t "~2Ttarget: ~D~%" (-> obj target)) + (format #t "~2Tflags: #x~X~%" (-> obj flags)) + (format #t "~2Tlook: ~D~%" (-> obj look)) + (format #t "~2Tplay-ambient-sound?: ~A~%" (-> obj play-ambient-sound?)) + (format #t "~2Tvisible: ~A~%" (-> obj visible)) + (label cfg-4) + obj + ) + +;; definition for method 7 of type water-anim +(defmethod relocate water-anim ((obj water-anim) (arg0 int)) + (if (nonzero? (-> obj flow)) + (&+! (-> obj flow) arg0) + ) + ((the-as (function water-anim int water-anim) (find-parent-method water-anim 7)) obj arg0) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-nest-dark-eco-largepool water-anim-nest-dark-eco 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 50) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-nest-dark-eco-smlupperpool water-anim-nest-dark-eco 2 -1 + ((3 (meters 999999))) + :bounds (static-spherem 0 0 0 30) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-nest-dark-eco-middlepool water-anim-nest-dark-eco 4 -1 + ((5 (meters 999999))) + :bounds (static-spherem 0 0 0 32) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-nest-dark-eco-botpool water-anim-nest-dark-eco 6 -1 + ((7 (meters 999999))) + :bounds (static-spherem 0 0 0 35) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-strip-dark-eco-near-lift water-anim-strip-dark-eco 0 -1 + ((1 (meters 20)) (2 (meters 999999))) + :bounds (static-spherem 0 0 0 29) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-strip-dark-eco-near-crane water-anim-strip-dark-eco 3 -1 + ((4 (meters 20)) (5 (meters 999999))) + :bounds (static-spherem 0 0 0 35) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-strip-dark-eco-with-eggs water-anim-strip-dark-eco 6 -1 + ((7 (meters 999999))) + :bounds (static-spherem 0 0 0 40) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-strip-dark-eco-under-bridge water-anim-strip-dark-eco 9 -1 + ((10 (meters 20)) (11 (meters 999999))) + :bounds (static-spherem 0 0 0 32) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-mountain-dark-eco-dice water-anim-mountain-dark-eco 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem -20 0 0 110) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-under-pool water-anim-under 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 51) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-under-drainout water-anim-under 2 -1 + ((3 (meters 999999))) + :bounds (static-spherem 0 0 0 20) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-under-fillup water-anim-under 4 -1 + ((5 (meters 999999))) + :bounds (static-spherem 0 0 0 23) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-mountain-fall-hi water-anim-mountain 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 42) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-mountain-fall-med water-anim-mountain 2 -1 + ((3 (meters 999999))) + :bounds (static-spherem 0 0 0 30) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-mountain-fall-low water-anim-mountain 4 -1 + ((5 (meters 999999))) + :bounds (static-spherem 0 0 0 25) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-stadium-middle-pool water-anim-stadium 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 24) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-stadium-top-fountain water-anim-stadium 2 -1 + ((3 (meters 999999))) + :bounds (static-spherem 0 0 0 9.5) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-stadium-floor-pool water-anim-stadium 4 -1 + ((5 (meters 999999))) + :bounds (static-spherem 0 0 0 22) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-tomb-dark-eco-stair-block water-anim-tomb-dark-eco 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 80) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-tomb-dark-eco-raised-block water-anim-tomb-dark-eco 2 -1 + ((3 (meters 999999))) + :bounds (static-spherem 0 0 0 80) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-fortress-exitb-pool water-anim-fortress 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 51) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-tomb-main-hall water-anim-tomb 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 150) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-tomb-tunnel-b water-anim-tomb 2 -1 + ((3 (meters 999999))) + :bounds (static-spherem 0 0 0 36) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-tomb-tunnel-c water-anim-tomb 4 -1 + ((5 (meters 999999))) + :bounds (static-spherem 0 0 0 23) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-tomb-tunnel-d water-anim-tomb 6 -1 + ((7 (meters 999999))) + :bounds (static-spherem 5 0 5 42) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-tomb-tunnel-e water-anim-tomb 8 -1 + ((9 (meters 999999))) + :bounds (static-spherem 0 0 0 37) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-tomb-tunnel-f water-anim-tomb 10 -1 + ((11 (meters 999999))) + :bounds (static-spherem 0 0 0 24) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-mincan-exitb-pool water-anim-mincan 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 55) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-ctypal-lrgsqr-pool water-anim-ctypal 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 24) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-ctypal-smlsqr-pool water-anim-ctypal 2 -1 + ((3 (meters 999999))) + :bounds (static-spherem 0 0 0 11.25) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-ctypal-lrgfloor-pool water-anim-ctypal 4 -1 + ((5 (meters 999999))) + :bounds (static-spherem 0 0 0 22) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-ctypal-smlground-pool water-anim-ctypal 6 -1 + ((7 (meters 999999))) + :bounds (static-spherem 0 0 0 22.5) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-ctypal-middle-fountain water-anim-ctypal 8 -1 + ((9 (meters 999999))) + :bounds (static-spherem 0 0 0 22.5) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-ctypal-long-grnd-pool water-anim-ctypal 10 -1 + ((11 (meters 999999))) + :bounds (static-spherem 0 0 0 50) + ) + +;; definition of type water-anim-look +(deftype water-anim-look (structure) + ((skel-group string :offset-assert 0) + (anim int32 :offset-assert 4) + (ambient-sound-spec sound-spec :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + +;; definition for method 3 of type water-anim-look +(defmethod inspect water-anim-look ((obj water-anim-look)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'water-anim-look) + (format #t "~1Tskel-group: ~A~%" (-> obj skel-group)) + (format #t "~1Tanim: ~D~%" (-> obj anim)) + (format #t "~1Tambient-sound-spec: ~A~%" (-> obj ambient-sound-spec)) + (label cfg-4) + obj + ) + +;; definition for symbol *water-anim-look*, type (array water-anim-look) +(define *water-anim-look* + (new 'static 'boxed-array :type water-anim-look + (new 'static 'water-anim-look :skel-group "water-anim-nest-dark-eco-largepool" :anim 8 :ambient-sound-spec #f) + (new 'static 'water-anim-look + :skel-group "water-anim-nest-dark-eco-smlupperpool" + :anim 8 + :ambient-sound-spec #f + ) + (new 'static 'water-anim-look + :skel-group "water-anim-nest-dark-eco-middlepool" + :anim 8 + :ambient-sound-spec #f + ) + (new 'static 'water-anim-look :skel-group "water-anim-nest-dark-eco-botpool" :anim 8 :ambient-sound-spec #f) + (new 'static 'water-anim-look + :skel-group "water-anim-strip-dark-eco-near-lift" + :anim 12 + :ambient-sound-spec #f + ) + (new 'static 'water-anim-look + :skel-group "water-anim-strip-dark-eco-near-lift" + :anim 12 + :ambient-sound-spec #f + ) + (new 'static 'water-anim-look + :skel-group "water-anim-strip-dark-eco-near-crane" + :anim 12 + :ambient-sound-spec #f + ) + (new 'static 'water-anim-look + :skel-group "water-anim-strip-dark-eco-with-eggs" + :anim 12 + :ambient-sound-spec #f + ) + (new 'static 'water-anim-look + :skel-group "water-anim-strip-dark-eco-under-bridge" + :anim 12 + :ambient-sound-spec #f + ) + (new 'static 'water-anim-look :skel-group "water-anim-mountain-dark-eco-dice" :anim 2 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-under-pool" :anim 6 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-under-drainout" :anim 6 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-under-fillup" :anim 6 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-mountain-fall-hi" :anim 6 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-mountain-fall-med" :anim 6 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-mountain-fall-low" :anim 6 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-stadium-middle-pool" :anim 6 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-stadium-top-fountain" :anim 6 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-stadium-floor-pool" :anim 6 :ambient-sound-spec #f) + (new 'static 'water-anim-look + :skel-group "water-anim-tomb-dark-eco-stair-block" + :anim 4 + :ambient-sound-spec #f + ) + (new 'static 'water-anim-look + :skel-group "water-anim-tomb-dark-eco-raised-block" + :anim 4 + :ambient-sound-spec #f + ) + (new 'static 'water-anim-look :skel-group "water-anim-fortress-exitb-pool" :anim 2 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-tomb-main-hall" :anim 12 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-tomb-tunnel-b" :anim 12 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-tomb-tunnel-c" :anim 12 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-tomb-tunnel-d" :anim 12 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-tomb-tunnel-e" :anim 12 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-tomb-tunnel-f" :anim 12 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-mincan-exitb-pool" :anim 2 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-ctypal-lrgsqr-pool" :anim 12 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-ctypal-smlsqr-pool" :anim 12 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-ctypal-lrgfloor-pool" :anim 12 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-ctypal-smlground-pool" :anim 12 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-ctypal-middle-fountain" :anim 12 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-ctypal-long-grnd-pool" :anim 12 :ambient-sound-spec #f) + ) + ) + +;; definition for function water-anim-event-handler +;; INFO: Used lq/sq +;; WARN: Return type mismatch none vs object. +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 210] +(defbehavior water-anim-event-handler water-anim ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-1 none)) + (let ((v1-0 arg2)) + (the-as + object + (cond + ((= v1-0 'move-to) + (move-to-point! self (the-as vector (-> arg3 param 0))) + (set! v0-1 (the-as none (logclear (-> self mask) (process-mask sleep-code)))) + (set! (-> self mask) (the-as process-mask v0-1)) + v0-1 + ) + ((= v1-0 'move-to-y) + (let ((a1-2 (new 'stack-no-clear 'vector))) + (set! (-> a1-2 quad) (-> self root trans quad)) + (set! (-> a1-2 y) (the-as float (-> arg3 param 0))) + (move-to-point! self a1-2) + ) + (set! v0-1 (the-as none (logclear (-> self mask) (process-mask sleep-code)))) + (set! (-> self mask) (the-as process-mask v0-1)) + v0-1 + ) + ((= v1-0 'water) + (let ((s5-0 (the-as object (-> arg3 param 0)))) + (let* ((s4-0 (the-as object (-> arg3 param 1))) + (gp-0 (if (type? (the-as process s4-0) process-focusable) + (the-as uint s4-0) + ) + ) + ) + (when (and (logtest? (-> self flags) (water-flags deadly)) + (logtest? (water-flags touch-water) (-> (the-as water-info s5-0) flags)) + (the-as uint gp-0) + ) + (let ((v1-15 (-> self attack-event))) + (case v1-15 + ((#f) + ) + (('heat) + (send-event (the-as process-tree gp-0) 'heat (* 10.0 (-> self clock seconds-per-frame))) + ) + (('drown-death 'lava 'dark-eco-pool) + (if (and (not (logtest? (focus-status board) (-> (the-as process-focusable gp-0) focus-status))) + (let ((a1-10 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-10 from) (process->ppointer self)) + (set! (-> a1-10 num-params) 2) + (set! (-> a1-10 message) 'attack-invinc) + (set! (-> a1-10 param 0) (the-as uint #f)) + (let ((a2-4 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (set! (-> a2-4 id) (-> self attack-id)) + (set! (-> a2-4 mode) v1-15) + (set! (-> a1-10 param 1) (the-as uint a2-4)) + ) + (send-event-function (the-as process-focusable gp-0) a1-10) + ) + ) + (send-event self 'notify 'attack) + ) + ) + (else + (if (and (not (logtest? (focus-status board) (-> (the-as process-focusable gp-0) focus-status))) + (let ((a1-13 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-13 from) (process->ppointer self)) + (set! (-> a1-13 num-params) 2) + (set! (-> a1-13 message) 'attack) + (set! (-> a1-13 param 0) (the-as uint #f)) + (let ((a2-6 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (set! (-> a2-6 id) (-> self attack-id)) + (set! (-> a2-6 mode) v1-15) + (set! (-> a1-13 param 1) (the-as uint a2-6)) + ) + (send-event-function (the-as process-tree gp-0) a1-13) + ) + ) + (send-event self 'notify 'attack) + ) + ) + ) + ) + ) + ) + (when (and (logtest? (-> self flags) (water-flags flow)) + (logtest? (water-flags touch-water) (-> (the-as water-info s5-0) flags)) + ) + (let ((a0-40 (-> self flow))) + (if (nonzero? a0-40) + ((method-of-object a0-40 flow-control-method-11)) + ) + ) + ) + ) + ) + ((= v1-0 'visible) + (cond + ((-> arg3 param 0) + (set! (-> self visible) #t) + ) + (else + (set! (-> self visible) #f) + (logior! (-> self draw status) (draw-control-status no-draw)) + ) + ) + (logclear! (-> self mask) (process-mask sleep-code)) + #t + ) + ) + ) + ) + ) + +;; failed to figure out what this is: +(defstate idle (water-anim) + :virtual #t + :event water-anim-event-handler + :trans (behavior () + (let ((a0-0 (-> self flow))) + (if (and (nonzero? a0-0) *display-vol-marks*) + (draw-path a0-0) + ) + ) + (cond + ((not (-> self visible)) + ) + ((< (-> (math-camera-pos) y) (+ -8192.0 (-> self root trans y))) + (logior! (-> self draw status) (draw-control-status no-draw)) + ) + (else + (logclear! (-> self draw status) (draw-control-status no-draw)) + ) + ) + (if (and (-> self visible) (and (-> self play-ambient-sound?) (nonzero? (-> self sound)))) + (update! (-> self sound)) + ) + (none) + ) + :code (behavior () + (until #f + (ja-post) + (logior! (-> self mask) (process-mask sleep-code)) + (suspend) + ) + #f + (none) + ) + ) + +;; definition for method 22 of type water-anim +;; INFO: Used lq/sq +(defmethod move-to-point! water-anim ((obj water-anim) (arg0 vector)) + "Set a [[water-anim]]'s `trans` as specified by the [[vector]] and update `water-height`." + (set! (-> obj root trans quad) (-> arg0 quad)) + (set! (-> obj water-height) (-> obj root trans y)) + (if (nonzero? (-> obj sound)) + (update-trans! (-> obj sound) (-> obj root trans)) + ) + ) + +;; definition for method 23 of type water-anim +(defmethod get-ripple-height water-anim ((obj water-anim) (arg0 vector)) + (ripple-find-height obj 0 arg0) + ) + +;; definition for method 27 of type water-anim +;; WARN: Return type mismatch symbol vs none. +(defmethod water-anim-method-27 water-anim ((obj water-anim)) + "Empty." + (none) + ) + +;; definition for method 28 of type water-anim +;; INFO: Used lq/sq +;; WARN: Return type mismatch quaternion vs none. +(defmethod offset! water-anim ((obj water-anim)) + "Offset a [[water-anim]]'s `trans` and `quat` by the lump data in `entity`." + (local-vars (sv-16 res-tag)) + (set! (-> obj play-ambient-sound?) #t) + (set! (-> obj visible) #t) + (set! (-> obj look) + (res-lump-value (-> obj entity) 'look int :default (the-as uint128 -1) :time -1000000000.0) + ) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-4 (res-lump-data (-> obj entity) 'trans-offset vector :tag-ptr (& sv-16)))) + (when v1-4 + (+! (-> obj root trans x) (-> v1-4 x)) + (+! (-> obj root trans y) (-> v1-4 y)) + (+! (-> obj root trans z) (-> v1-4 z)) + ) + ) + (let ((f0-6 (res-lump-float (-> obj entity) 'rotoffset))) + (if (!= f0-6 0.0) + (quaternion-rotate-y! (-> obj root quat) (-> obj root quat) f0-6) + ) + ) + (none) + ) + +;; definition for method 24 of type water-anim +(defmethod art-init! water-anim ((obj water-anim)) + "Initialize a [[water-anim]]'s [[skeleton-group]], joints and ambience." + (let ((s5-0 (-> obj look))) + (if (or (< s5-0 0) (>= s5-0 (-> *water-anim-look* length))) + (go process-drawable-art-error "skel group") + ) + (let ((s5-1 (-> *water-anim-look* s5-0))) + (initialize-skeleton-by-name obj (-> s5-1 skel-group)) + (ja-channel-set! 1) + (let ((s4-0 (-> obj skel root-channel 0))) + (joint-control-channel-group-eval! + s4-0 + (the-as art-joint-anim (-> obj draw art-group data (-> s5-1 anim))) + num-func-identity + ) + (set! (-> s4-0 frame-num) 0.0) + ) + (let ((a2-1 (-> s5-1 ambient-sound-spec))) + (when a2-1 + (let ((a3-0 (new 'stack-no-clear 'vector))) + (vector+! a3-0 (-> obj root trans) (-> obj draw bounds)) + (set! (-> obj sound) (new 'process 'ambient-sound a2-1 a3-0)) + ) + ) + ) + ) + ) + (ja-post) + (none) + ) + +;; definition for method 25 of type water-anim +(defmethod reset-root! water-anim ((obj water-anim)) + "Reset a [[water-anim]]'s `root`." + (let ((v0-0 (new 'process 'trsqv))) + (set! (-> obj root) v0-0) + v0-0 + ) + ) + +;; definition for method 26 of type water-anim +;; INFO: Used lq/sq +;; WARN: Return type mismatch water-flags vs none. +(defmethod water-anim-init! water-anim ((obj water-anim)) + "Initialize a [[water-anim]]." + (local-vars (sv-16 res-tag)) + (set! (-> obj attack-event) (the-as symbol ((method-of-type res-lump get-property-struct) + (-> obj entity) + 'attack-event + 'interp + -1000000000.0 + (the-as structure 'drown) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (process-drawable-from-entity! obj (-> obj entity)) + (logclear! (-> obj mask) (process-mask actor-pause)) + (set! (-> obj vol) (new 'process 'vol-control obj)) + (logior! (-> obj vol flags) (vol-flags display? vol-flags-1)) + (set! (-> obj bottom-height) 32768.0) + (let* ((v1-8 *game-info*) + (a0-7 (+ (-> v1-8 attack-id) 1)) + ) + (set! (-> v1-8 attack-id) a0-7) + (set! (-> obj attack-id) a0-7) + ) + (set! (-> obj target) (the-as handle #f)) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-10 (the-as (pointer float) ((method-of-type res-lump get-property-data) + (-> obj entity) + 'water-height + 'exact + -1000000000.0 + (the-as pointer #f) + (& sv-16) + *res-static-buf* + ) + ) + ) + ) + (when v1-10 + (set! (-> obj water-height) (-> v1-10 0)) + (set! (-> obj wade-height) (-> v1-10 1)) + (set! (-> obj swim-height) (-> v1-10 2)) + (if (>= (-> sv-16 elt-count) (the-as uint 4)) + (set! (-> obj flags) (the-as water-flags (the int (-> v1-10 3)))) + ) + (if (>= (-> sv-16 elt-count) (the-as uint 5)) + (set! (-> obj bottom-height) (-> v1-10 4)) + ) + ) + ) + (set! (-> obj flags) (logior (water-flags part-water) (-> obj flags))) + (if (logtest? (-> obj flags) (water-flags flow)) + (set! (-> obj flow) (new 'process 'flow-control obj (the-as res-lump #f))) + ) + (cond + ((zero? (-> obj flags)) + (if (< 0.0 (-> obj wade-height)) + (logior! (-> obj flags) (water-flags can-wade)) + ) + (if (< 0.0 (-> obj swim-height)) + (logior! (-> obj flags) (water-flags can-swim)) + ) + ) + (else + ) + ) + (none) + ) + +;; definition for function water-anim-init-by-other +;; WARN: Return type mismatch object vs none. +(defbehavior water-anim-init-by-other water-anim ((arg0 entity-actor)) + (process-entity-set! self arg0) + (water-anim-method-27 self) + (reset-root! self) + (water-anim-init! self) + (offset! self) + (art-init! self) + (go-virtual idle) + (none) + ) + +;; definition for method 11 of type water-anim +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! water-anim ((obj water-anim) (arg0 entity-actor)) + (water-anim-method-27 obj) + (reset-root! obj) + (water-anim-init! obj) + (offset! obj) + (art-init! obj) + (go (method-of-object obj idle)) + (none) + ) diff --git a/test/decompiler/reference/jak2/engine/common_objs/water-h_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/water-h_REF.gc index 0936828321..23f31f1f60 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/water-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/water-h_REF.gc @@ -3,14 +3,14 @@ ;; definition of type water-info (deftype water-info (structure) - ((trans vector :inline :offset-assert 0) - (normal vector :inline :offset-assert 16) - (base-height meters :offset-assert 32) - (depth meters :offset-assert 36) - (handle uint64 :offset-assert 40) - (flags water-flags :offset-assert 48) - (prim basic :offset-assert 52) - (extra-flags uint32 :offset-assert 56) + ((trans vector :inline :offset-assert 0) + (normal vector :inline :offset-assert 16) + (base-height meters :offset-assert 32) + (depth meters :offset-assert 36) + (handle handle :offset-assert 40) + (flags water-flags :offset-assert 48) + (prim drawable-region-prim :offset-assert 52) + (extra-flags uint32 :offset-assert 56) ) :method-count-assert 9 :size-assert #x3c @@ -137,59 +137,59 @@ ;; definition of type water-control (deftype water-control (basic) - ((flags water-flags :offset-assert 4) - (process process-hidden :offset-assert 8) - (joint-index int32 :offset-assert 12) - (top-y-offset float :offset-assert 16) - (attack-id uint32 :offset-assert 20) - (enter-water-time time-frame :offset-assert 24) - (wade-time time-frame :offset-assert 32) - (on-water-time time-frame :offset-assert 40) - (enter-swim-time time-frame :offset-assert 48) - (swim-time time-frame :offset-assert 56) - (base-height meters :offset-assert 64) - (wade-height meters :offset-assert 68) - (swim-height meters :offset-assert 72) - (surface-height meters :offset-assert 76) - (bottom-height meters :offset-assert 80) - (collide-height meters :offset-assert 84) - (height meters :offset-assert 88) - (height-offset float 4 :offset-assert 92) - (base-ocean-offset meters :offset 92) - (real-ocean-offset meters :offset 92) - (ocean-offset meters :offset 96) - (bob-offset meters :offset 100) - (align-offset meters :offset 104) - (swim-depth meters :offset 108) - (bob smush-control :inline :offset 112) - (ripple int64 :offset 144) - (ripple-size meters :offset 152) - (wake-size meters :offset 156) - (bottom vector 2 :inline :offset 160) - (top vector 2 :inline :offset 192) - (enter-water-pos vector :inline :offset 224) - (drip-old-pos vector :inline :offset 240) - (drip-joint-index int32 :offset 256) - (drip-wetness float :offset 260) - (drip-time time-frame :offset 264) - (drip-speed float :offset 272) - (drip-height meters :offset 276) - (drip-mult float :offset 280) - (distort-time time-frame :offset 288) + ((flags water-flags :offset-assert 4) + (process target :offset-assert 8) + (joint-index int32 :offset-assert 12) + (top-y-offset float :offset-assert 16) + (attack-id uint32 :offset-assert 20) + (enter-water-time time-frame :offset-assert 24) + (wade-time time-frame :offset-assert 32) + (on-water-time time-frame :offset-assert 40) + (enter-swim-time time-frame :offset-assert 48) + (swim-time time-frame :offset-assert 56) + (base-height meters :offset-assert 64) + (wade-height meters :offset-assert 68) + (swim-height meters :offset-assert 72) + (surface-height meters :offset-assert 76) + (bottom-height meters :offset-assert 80) + (collide-height meters :offset-assert 84) + (height meters :offset-assert 88) + (height-offset float 4 :offset-assert 92) + (base-ocean-offset meters :offset 92) + (real-ocean-offset meters :offset 92) + (ocean-offset meters :offset 96) + (bob-offset meters :offset 100) + (align-offset meters :offset 104) + (swim-depth meters :offset 108) + (bob smush-control :inline :offset 112) + (ripple handle :offset 144) + (ripple-size meters :offset 152) + (wake-size meters :offset 156) + (bottom vector 2 :inline :offset 160) + (top vector 2 :inline :offset 192) + (enter-water-pos vector :inline :offset 224) + (drip-old-pos vector :inline :offset 240) + (drip-joint-index int32 :offset 256) + (drip-wetness float :offset 260) + (drip-time time-frame :offset 264) + (drip-speed float :offset 272) + (drip-height meters :offset 276) + (drip-mult float :offset 280) + (distort-time time-frame :offset 288) ) :method-count-assert 17 :size-assert #x128 :flag-assert #x1100000128 (:methods (new (symbol type process int float float float) _type_ 0) - (water-control-method-9 () none 9) - (water-control-method-10 () none 10) - (water-control-method-11 () none 11) + (water-control-method-9 (_type_) none 9) + (water-control-method-10 (_type_) none 10) + (start-bobbing! (_type_ float int int) none 11) (distance-from-surface (_type_) float 12) - (water-control-method-13 (_type_ float vector int vector symbol) none 13) + (spawn-ripples (_type_ float vector int vector symbol) none 13) (display-water-marks? (_type_) symbol 14) - (water-control-method-15 () none 15) - (water-control-method-16 () none 16) + (enter-water (_type_) none 15) + (water-control-method-16 (_type_) none 16) ) ) @@ -350,14 +350,14 @@ ;; definition for method 0 of type water-control (defmethod new water-control ((allocation symbol) (type-to-make type) (arg0 process) (arg1 int) (arg2 float) (arg3 float) (arg4 float)) (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) - (set! (-> v0-0 process) (the-as process-hidden arg0)) + (set! (-> v0-0 process) (the-as target arg0)) (set! (-> v0-0 joint-index) arg1) (set! (-> v0-0 wade-height) arg4) (set! (-> v0-0 swim-height) arg3) (set! (-> v0-0 bottom-height) 32768.0) (set! (-> v0-0 ripple-size) 1638.4) (set! (-> v0-0 wake-size) 3072.0) - (set! (-> v0-0 ripple) (the-as int #f)) + (set! (-> v0-0 ripple) (the-as handle #f)) (set! (-> v0-0 drip-mult) 1.0) (set! (-> v0-0 top-y-offset) arg2) (let* ((v1-6 *game-info*) diff --git a/test/decompiler/reference/jak2/engine/common_objs/water_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/water_REF.gc new file mode 100644 index 0000000000..32844b7904 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/common_objs/water_REF.gc @@ -0,0 +1,1746 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for function check-water-level-drop +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defun check-water-level-drop ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (when (and (< (-> arg2 y) (-> arg1 user-float)) (< (-> arg1 vel-sxvel y) 0.0)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (sp-kill-particle arg0 arg1) + (set-vector! gp-0 (-> arg2 x) (-> arg1 user-float) (-> arg2 z) 1.0) + (sound-play "water-drop" :position gp-0) + (let ((t9-3 sp-launch-particles-var) + (a0-4 *sp-particle-system-3d*) + (a1-3 (-> *part-id-table* 501)) + (a2-2 *launch-matrix*) + ) + (set! (-> a2-2 trans quad) (-> gp-0 quad)) + (t9-3 a0-4 a1-3 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + 0 + (none) + ) + +;; definition for function check-water-level-drop-and-die +;; WARN: Return type mismatch symbol vs none. +(defun check-water-level-drop-and-die ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (if (and (< (-> arg2 y) (-> arg1 user-float)) (< (-> arg1 vel-sxvel y) 0.0)) + (sp-kill-particle arg0 arg1) + ) + (none) + ) + +;; definition for function check-water-level-drop-and-die-motion +(defun check-water-level-drop-and-die-motion ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (if (and (< (-> arg2 y) (-> arg1 user-float)) (< (-> arg1 vel-sxvel y) 0.0)) + (sp-kill-particle arg0 arg1) + ) + (sparticle-motion-blur arg0 arg1 arg2) + (none) + ) + +;; definition for function check-water-level-above-and-die +;; WARN: Return type mismatch symbol vs none. +(defun check-water-level-above-and-die ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (if (or (>= (-> arg2 y) (-> arg1 user-float)) (and *target* (>= (-> arg2 y) (-> *target* water height)))) + (sp-kill-particle arg0 arg1) + ) + (none) + ) + +;; failed to figure out what this is: +(defpart 502 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 9.0) + (sp-rnd-flt spt-x (meters -0.25) (meters 0.5) 1.0) + (sp-rnd-flt spt-y (meters -0.05) (meters 0.1) 1.0) + (sp-rnd-flt spt-z (meters -0.25) (meters 0.5) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.1) (meters 0.1) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.05) (meters 0.05) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 24.0 40.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0) (meters 0.006666667) 1.0) + (sp-rnd-flt spt-accel-y 0.68266666 0.68266666 1.0) + (sp-flt spt-friction 0.96) + (sp-int spt-timer 1500) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-above-and-die) + (sp-flt spt-conerot-x (degrees 90.0)) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 503 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 0.1) + (sp-rnd-flt spt-x (meters -0.25) (meters 0.5) 1.0) + (sp-flt spt-y (meters 0.15)) + (sp-rnd-flt spt-z (meters -0.25) (meters 0.5) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.1) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.15) (meters 0.05) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 40.0 24.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0) (meters 0.006666667) 1.0) + (sp-flt spt-accel-y 1.3653333) + (sp-flt spt-friction 0.96) + (sp-int spt-timer 1500) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-above-and-die) + (sp-flt spt-conerot-x (degrees 90.0)) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 504 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x2c :page #xc)) + (sp-flt spt-num 0.05) + (sp-rnd-flt spt-scale-x (meters 1.6) (meters 0.8) 1.0) + (sp-rnd-flt spt-rot-y (degrees 0.0) (degrees 3600.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 1.6) (meters 0.8) 1.0) + (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 16.0 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.004) (meters 0.0037333334) 1.0) + (sp-rnd-flt spt-scalevel-y (meters 0.004) (meters 0.0037333334) 1.0) + (sp-int spt-timer 800) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 left-multiply-quat) + (sp-int-plain-rnd spt-next-time 150 299 1) + (sp-launcher-by-id spt-next-launcher 505) + ) + ) + +;; failed to figure out what this is: +(defpart 506 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x2e :page #xc)) + (sp-flt spt-num 0.06) + (sp-flt spt-x (meters 10)) + (sp-rnd-flt spt-scale-x (meters 0.75) (meters 1.5) 1.0) + (sp-flt spt-rot-y (degrees 0.0)) + (sp-rnd-flt spt-scale-y (meters 0.75) (meters 1.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 0.0) + (sp-rnd-flt spt-vel-x (meters 0.01) (meters 0.006666667) 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.0033333334) (meters 0.004333333) 1.0) + (sp-rnd-flt spt-scalevel-y (meters 0.0033333334) (meters 0.004333333) 1.0) + (sp-flt spt-fade-a 0.7111111) + (sp-flt spt-friction 0.94) + (sp-int spt-timer 600) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 left-multiply-quat) + (sp-int spt-next-time 90) + (sp-launcher-by-id spt-next-launcher 507) + (sp-flt spt-rotate-y (degrees 0.0)) + ) + ) + +;; failed to figure out what this is: +(defpart 507 + :init-specs ((sp-flt spt-fade-a 0.0) (sp-int-plain-rnd spt-next-time 90 119 1) (sp-launcher-by-id spt-next-launcher 508)) + ) + +;; failed to figure out what this is: +(defpart 508 + :init-specs ((sp-flt spt-fade-a -0.21333334)) + ) + +;; failed to figure out what this is: +(defpart 509 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x33 :page #xc)) + (sp-rnd-flt spt-num 0.05 0.4 1.0) + (sp-rnd-flt spt-x (meters -0.75) (meters 1.5) 1.0) + (sp-rnd-flt spt-z (meters -0.75) (meters 1.5) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.2) (meters 0.7) 1.0) + (sp-rnd-flt spt-rot-y (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 128.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-scalevel-x (meters 0.0016666667) (meters 0.003) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a 0.42666668) + (sp-int spt-timer 600) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 left-multiply-quat) + (sp-int spt-next-time 150) + (sp-launcher-by-id spt-next-launcher 510) + (sp-flt spt-rotate-y (degrees 0.0)) + ) + ) + +;; failed to figure out what this is: +(defpart 510 + :init-specs ((sp-flt spt-fade-a 0.0) (sp-int spt-next-time 360) (sp-launcher-by-id spt-next-launcher 511)) + ) + +;; failed to figure out what this is: +(defpart 511 + :init-specs ((sp-flt spt-fade-a -0.7111111)) + ) + +;; failed to figure out what this is: +(defpartgroup group-part-water-splash + :id 121 + :duration (seconds 3) + :flags (use-local-clock) + :bounds (static-bspherem 0 -12 0 14) + :parts ((sp-item 514 :flags (is-3d) :period 900 :length 63) + (sp-item 515 :period 900 :length 15) + (sp-item 516 :flags (is-3d) :period 900 :length 15) + (sp-item 517 :period 900 :length 15 :binding 512) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 518 :flags (is-3d) :period 900 :length 15 :offset 60) + (sp-item 519 :flags (is-3d) :period 900 :length 60 :offset 60) + (sp-item 520 :period 900 :length 10 :offset 60 :binding 513) + (sp-item 513 :flags (start-dead) :period 900 :length 120 :offset 60) + (sp-item 513 :flags (start-dead) :period 900 :length 120 :offset 60) + (sp-item 513 :flags (start-dead) :period 900 :length 120 :offset 60) + (sp-item 513 :flags (start-dead) :period 900 :length 120 :offset 60) + (sp-item 513 :flags (start-dead) :period 900 :length 120 :offset 60) + (sp-item 513 :flags (start-dead) :period 900 :length 120 :offset 60) + (sp-item 513 :flags (start-dead) :period 900 :length 120 :offset 60) + (sp-item 513 :flags (start-dead) :period 900 :length 120 :offset 60) + (sp-item 513 :flags (start-dead) :period 900 :length 120 :offset 60) + (sp-item 513 :flags (start-dead) :period 900 :length 120 :offset 60) + (sp-item 513 :flags (start-dead) :period 900 :length 120 :offset 60) + (sp-item 521 :period 900 :length 5) + (sp-item 521 :period 900 :length 15) + (sp-item 521 :period 900 :length 40) + (sp-item 522 :flags (launch-asap) :period 900 :length 5) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-part-water-splash-small + :id 122 + :duration (seconds 3) + :flags (use-local-clock) + :bounds (static-bspherem 0 -12 0 14) + :parts ((sp-item 514 :flags (is-3d) :period 900 :length 63) + (sp-item 515 :period 900 :length 15) + (sp-item 516 :flags (is-3d) :period 900 :length 15) + (sp-item 517 :period 900 :length 10 :binding 512) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + (sp-item 512 :flags (start-dead) :period 900 :length 120) + ) + ) + +;; failed to figure out what this is: +(defpart 512 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 0.2) + (sp-rnd-flt spt-x (meters -0.2) (meters 0.4) 1.0) + (sp-rnd-flt spt-y (meters -0.2) (meters 0.4) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.05) (meters 0.15) 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 40.0 24.0 1.0) + (sp-flt spt-scalevel-x (meters 0.000033333334)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-accel-y -1.6384001 -0.81920004 1.0) + (sp-int spt-timer 450) + (sp-cpuinfo-flags sp-cpuinfo-flag-3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-drop-and-die) + ) + ) + +;; failed to figure out what this is: +(defpart 513 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 0.2) + (sp-rnd-flt spt-x (meters -0.2) (meters 0.4) 1.0) + (sp-rnd-flt spt-y (meters -0.2) (meters 0.4) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.05) (meters 0.15) 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 40.0 24.0 1.0) + (sp-flt spt-scalevel-x (meters 0.000033333334)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-accel-y -1.6384001 -0.81920004 1.0) + (sp-int spt-timer 450) + (sp-cpuinfo-flags sp-cpuinfo-flag-3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-drop-and-die) + ) + ) + +;; failed to figure out what this is: +(defpart 519 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x2c :page #xc)) + (sp-flt spt-num 0.05) + (sp-rnd-flt spt-scale-x (meters 0.080000006) (meters 0.32000002) 1.0) + (sp-rnd-flt spt-rot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.080000006) (meters 0.32000002) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-scalevel-x (meters 0.004) (meters 0.0090666665) 1.0) + (sp-rnd-flt spt-scalevel-y (meters 0.004) (meters 0.0090666665) 1.0) + (sp-flt spt-fade-a 0.32) + (sp-int spt-timer 600) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 left-multiply-quat) + (sp-int spt-next-time 150) + (sp-launcher-by-id spt-next-launcher 523) + ) + ) + +;; failed to figure out what this is: +(defpart 520 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 3.2) + (sp-rnd-flt spt-x (meters -0.2) (meters 0.4) 1.0) + (sp-rnd-flt spt-y (meters -0.2) (meters 0.4) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.35) (meters 0.075) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.2) (meters 0.075) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 40.0 24.0 1.0) + (sp-rnd-flt spt-vel-x (meters -0.002) (meters 0.004) 1.0) + (sp-rnd-flt spt-vel-y (meters 0.018666666) (meters 0.0053333333) 1.0) + (sp-rnd-flt spt-vel-z (meters -0.002) (meters 0.004) 1.0) + (sp-flt spt-scalevel-x (meters -0.00066666666)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-accel-y -3.2768002 -0.81920004 1.0) + (sp-int spt-timer 900) + (sp-cpuinfo-flags sp-cpuinfo-flag-3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-drop) + (sp-int spt-next-time 120) + (sp-launcher-by-id spt-next-launcher 524) + ) + ) + +;; failed to figure out what this is: +(defpart 518 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x2d :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 0.24000001) (meters 0.71999997) 1.0) + (sp-flt spt-rot-x 16384.0) + (sp-rnd-flt spt-rot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-rot-z (degrees 0.0)) + (sp-rnd-flt spt-scale-y (meters 0.8) (meters 1.7600001) 1.0) + (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 32.0 1.0) + (sp-rnd-flt spt-scalevel-y (meters 0.053333335) (meters 0.013333334) 1.0) + (sp-int spt-timer 240) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 left-multiply-quat set-conerot) + (sp-int-plain-rnd spt-next-time 20 19 1) + (sp-launcher-by-id spt-next-launcher 525) + ) + ) + +;; failed to figure out what this is: +(defpart 525 + :init-specs ((sp-flt spt-scalevel-y (meters 0.026666667)) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 526) + ) + ) + +;; failed to figure out what this is: +(defpart 526 + :init-specs ((sp-flt spt-scalevel-y (meters 0)) + (sp-flt spt-fade-a -0.64) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 527) + ) + ) + +;; failed to figure out what this is: +(defpart 527 + :init-specs ((sp-flt spt-scalevel-x (meters 0.0016666667)) + (sp-flt spt-scalevel-y (meters -0.026666667)) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 528) + ) + ) + +;; failed to figure out what this is: +(defpart 528 + :init-specs ((sp-flt spt-scalevel-x (meters 0.0033333334)) (sp-flt spt-scalevel-y (meters -0.053333335))) + ) + +;; failed to figure out what this is: +(defpart 516 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-func spt-birth-func 'birth-func-texture-group) + (sp-flt spt-num 3.0) + (sp-rnd-flt spt-scale-x (meters 1.6) (meters 0.8) 1.0) + (sp-rnd-flt spt-rot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 1.6) (meters 0.8) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 48.0 16.0 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.004) (meters 0.0037333334) 1.0) + (sp-rnd-flt spt-scalevel-y (meters 0.004) (meters 0.0037333334) 1.0) + (sp-int spt-timer 800) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 left-multiply-quat) + (new 'static 'sp-field-init-spec + :field (sp-field-id spt-userdata) + :flags (sp-flag plain-v2) + :object (new 'static 'boxed-array :type int32 10 0 0 #xc0c900 #xc03300 #xc02c00) + ) + (sp-int-plain-rnd spt-next-time 150 299 1) + (sp-launcher-by-id spt-next-launcher 505) + ) + ) + +;; failed to figure out what this is: +(defpart 505 + :init-specs ((sp-flt spt-fade-a -0.21333334)) + ) + +;; failed to figure out what this is: +(defpart 517 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 3.2) + (sp-flt spt-x (meters 0.96000004)) + (sp-rnd-flt spt-scale-x (meters 0.35) (meters 0.075) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.2) (meters 0.075) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 40.0 24.0 1.0) + (sp-rnd-flt spt-vel-x (meters 0.0026666666) (meters 0.0053333333) 1.0) + (sp-rnd-flt spt-vel-y (meters 0.016) (meters 0.0053333333) 1.0) + (sp-flt spt-scalevel-x (meters -0.00066666666)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-accel-y -3.2768002 -0.81920004 1.0) + (sp-int spt-timer 900) + (sp-cpuinfo-flags sp-cpuinfo-flag-3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-drop) + (sp-int spt-next-time 120) + (sp-launcher-by-id spt-next-launcher 524) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 524 + :init-specs ((sp-flt spt-scalevel-x (meters 0)) (sp-copy-from-other spt-scalevel-y -4)) + ) + +;; failed to figure out what this is: +(defpart 515 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 8.0) + (sp-flt spt-x (meters 0.8)) + (sp-rnd-flt spt-scale-x (meters 0.15) (meters 0.05) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.15) (meters 0.05) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 40.0 24.0 1.0) + (sp-rnd-flt spt-vel-x (meters 0.0026666666) (meters 0.0053333333) 1.0) + (sp-rnd-flt spt-vel-y (meters 0.0053333333) (meters 0.0053333333) 1.0) + (sp-flt spt-scalevel-x (meters -0.00033333333)) + (sp-flt spt-scalevel-y (meters -0.00033333333)) + (sp-rnd-flt spt-accel-y -2.1845336 -0.5461334 1.0) + (sp-int spt-timer 375) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-drop-and-die) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 514 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x2d :page #xc)) + (sp-flt spt-num 1.5) + (sp-rnd-flt spt-x (meters 0.16000001) (meters 0.16000001) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.32000002) (meters 0.96000004) 1.0) + (sp-flt spt-rot-x 16384.0) + (sp-flt spt-rot-y (degrees 90.0)) + (sp-flt spt-rot-z (degrees 0.0)) + (sp-rnd-flt spt-scale-y (meters 0.16000001) (meters 1.7600001) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 48.0 24.0 1.0) + (sp-flt spt-vel-x (meters 0.0026666666)) + (sp-rnd-flt spt-scalevel-x (meters 0) (meters 0.0016666667) 1.0) + (sp-flt spt-rotvel-x (degrees 0.2)) + (sp-flt spt-scalevel-y (meters 0.04)) + (sp-int spt-timer 240) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 left-multiply-quat set-conerot) + (sp-int-plain-rnd spt-next-time 20 19 1) + (sp-launcher-by-id spt-next-launcher 529) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 529 + :init-specs ((sp-flt spt-scalevel-x (meters 0)) + (sp-flt spt-rotvel-x (degrees 0.16666667)) + (sp-flt spt-scalevel-y (meters 0.016666668)) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 530) + ) + ) + +;; failed to figure out what this is: +(defpart 530 + :init-specs ((sp-flt spt-rotvel-x (degrees 0.13333334)) + (sp-flt spt-scalevel-y (meters 0)) + (sp-flt spt-fade-a -0.64) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 531) + ) + ) + +;; failed to figure out what this is: +(defpart 531 + :init-specs ((sp-flt spt-rotvel-x (degrees 0.1)) + (sp-flt spt-scalevel-y (meters -0.016666668)) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 532) + ) + ) + +;; failed to figure out what this is: +(defpart 532 + :init-specs ((sp-flt spt-rotvel-x (degrees 0.06666667)) (sp-flt spt-scalevel-y (meters -0.033333335))) + ) + +;; failed to figure out what this is: +(defpart 522 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xca :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 6) (meters 0.1) 1.0) + (sp-flt spt-rot-x 2048.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-copy-from-other spt-g -1) + (sp-flt spt-b 255.0) + (sp-flt spt-a 0.0) + (sp-flt spt-scalevel-x (meters 0.16)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a 1.0666667) + (sp-int spt-timer 60) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow sp-cpuinfo-flag-21) + (sp-flt spt-userdata 10240.0) + (sp-int spt-next-time 15) + (sp-launcher-by-id spt-next-launcher 533) + (sp-flt spt-rotate-y (degrees 0.0)) + ) + ) + +;; failed to figure out what this is: +(defpart 533 + :init-specs ((sp-flt spt-fade-a -0.64)) + ) + +;; failed to figure out what this is: +(defpart 521 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 12.0) + (sp-flt spt-y (meters 0)) + (sp-rnd-flt spt-scale-x (meters 0.08) (meters 0.03) 1.0) + (sp-int spt-rot-x 4) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 32.0 32.0 1.0) + (sp-copy-from-other spt-g -1) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-flt spt-a 128.0) + (sp-rnd-flt spt-omega 2.8672 1.6384 1.0) + (sp-rnd-flt spt-vel-y (meters 0.033333335) (meters 0.05) 1.0) + (sp-rnd-flt spt-accel-y -20.48 -2.7306666 1.0) + (sp-rnd-flt spt-friction 0.96 0.02 1.0) + (sp-int spt-timer 300) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-21) + (sp-flt spt-userdata -208896.0) + (sp-func spt-func 'check-water-level-drop-motion) + (sp-int-plain-rnd spt-next-time 0 174 1) + (sp-launcher-by-id spt-next-launcher 63) + (sp-rnd-flt spt-conerot-x (degrees 15.0) (degrees 65.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 3600.0) 1.0) + (sp-flt spt-rotate-y (degrees 0.0)) + (sp-rnd-flt spt-conerot-radius (meters 0) (meters 1) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 63 + :init-specs ((sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-int spt-next-time 5) + (sp-launcher-by-id spt-next-launcher 534) + ) + ) + +;; failed to figure out what this is: +(defpart 534 + :init-specs ((sp-rnd-flt spt-r 32.0 32.0 1.0) + (sp-rnd-flt spt-g 32.0 32.0 1.0) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-int-plain-rnd spt-next-time 0 449 1) + (sp-launcher-by-id spt-next-launcher 535) + ) + ) + +;; failed to figure out what this is: +(defpart 501 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 0.3) + (sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.25) 1.0) + (sp-rnd-flt spt-rot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 32.0 32.0 1.0) + (sp-copy-from-other spt-g -1) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-rnd-flt spt-a 64.0 32.0 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.006666667) (meters 0.006666667) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-fade-a -0.32 -0.32 1.0) + (sp-int spt-timer 450) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-21) + (new 'static 'sp-field-init-spec + :field (sp-field-id spt-userdata) + :flags (sp-flag plain-v2) + :object (new 'static 'boxed-array :type int32 10 0 0 #xc0c900 #xc02600 #xc03300 #xc02c00) + ) + (sp-func spt-func 'sparticle-texture-animate) + (sp-flt spt-rotate-y (degrees 0.0)) + ) + ) + +;; failed to figure out what this is: +(defpart 536 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-rnd-flt spt-num 0.0 0.5 1.0) + (sp-rnd-flt spt-scale-x (meters 0.08) (meters 0.03) 1.0) + (sp-int spt-rot-x 4) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 32.0 32.0 1.0) + (sp-copy-from-other spt-g -1) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-flt spt-a 128.0) + (sp-rnd-flt spt-omega 2.8672 1.6384 1.0) + (sp-rnd-flt spt-vel-y (meters 0.026666667) (meters 0.05) 1.0) + (sp-rnd-flt spt-accel-y -20.48 -2.7306666 1.0) + (sp-flt spt-friction 0.95) + (sp-int spt-timer 600) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-21) + (sp-flt spt-userdata -208896.0) + (sp-func spt-func 'check-water-level-drop-and-die-motion) + (sp-int-plain-rnd spt-next-time 0 99 1) + (sp-launcher-by-id spt-next-launcher 63) + (sp-rnd-flt spt-conerot-x (degrees 30.0) (degrees 40.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 3600.0) 1.0) + (sp-flt spt-rotate-y (degrees 0.0)) + ) + ) + +;; definition for function check-water-level-drop-motion +;; INFO: Used lq/sq +(defun check-water-level-drop-motion ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (when (and (< (-> arg2 y) (-> arg1 user-float)) (< (-> arg1 vel-sxvel y) 0.0)) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (sp-kill-particle arg0 arg1) + (set-vector! s3-0 (-> arg2 x) (-> arg1 user-float) (-> arg2 z) 1.0) + (sound-play "water-drop" :position s3-0) + (let ((t9-3 sp-launch-particles-var) + (a0-5 *sp-particle-system-3d*) + (a1-3 (-> *part-id-table* 501)) + (a2-2 *launch-matrix*) + ) + (set! (-> a2-2 trans quad) (-> s3-0 quad)) + (t9-3 a0-5 a1-3 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (set! (-> *part-id-table* 536 init-specs 15 initial-valuef) (-> s3-0 y)) + (let ((t9-4 sp-launch-particles-var) + (a0-6 *sp-particle-system-2d*) + (a1-4 (-> *part-id-table* 536)) + (a2-3 *launch-matrix*) + ) + (set! (-> a2-3 trans quad) (-> s3-0 quad)) + (t9-4 a0-6 a1-4 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + (sparticle-motion-blur arg0 arg1 arg2) + (none) + ) + +;; failed to figure out what this is: +(defpart 537 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 0.15) (meters 0.05) 1.0) + (sp-int spt-rot-x 4) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 32.0 32.0 1.0) + (sp-copy-from-other spt-g -1) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-flt spt-a 128.0) + (sp-rnd-flt spt-omega 4.096 4.096 1.0) + (sp-rnd-flt spt-vel-x (meters -0.016666668) (meters 0.0016666667) 1.0) + (sp-flt spt-vel-y (meters 0.016666668)) + (sp-rnd-flt spt-vel-z (meters -0.016666668) (meters 0.0016666667) 1.0) + (sp-flt spt-scalevel-x (meters -0.00016666666)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-accel-y -4.096 -1.3653333 1.0) + (sp-int spt-timer 600) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-drop-motion) + (sp-int spt-next-time 600) + (sp-launcher-by-id spt-next-launcher 538) + ) + ) + +;; definition for method 9 of type water-control +;; WARN: Return type mismatch int vs none. +(defmethod water-control-method-9 water-control ((obj water-control)) + 0 + (none) + ) + +;; definition for method 10 of type water-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod water-control-method-10 water-control ((obj water-control)) + (local-vars + (sv-272 (function vector entity-actor skeleton-group vector none :behavior manipy)) + (sv-288 vector) + (sv-304 entity-actor) + ) + (with-pp + (let ((s4-0 (-> obj flags)) + (s5-0 (new 'stack-no-clear 'water-info)) + ) + (when (logtest? (water-flags find-water) (-> obj flags)) + (water-info-init! (the-as collide-shape (-> obj process control)) s5-0 (collide-action solid semi-solid)) + (set! (-> obj flags) + (logior (logclear + (-> obj flags) + (water-flags active can-wade can-swim can-ground use-ocean tar mud use-water-anim swamp over-water) + ) + (logclear (-> s5-0 flags) (water-flags touch-water)) + ) + ) + (set! (-> obj base-height) (-> s5-0 base-height)) + (set! (-> obj base-ocean-offset) (- (-> s5-0 trans y) (-> s5-0 base-height))) + ) + (cond + ((not (logtest? (-> obj flags) (water-flags active))) + (logclear! + (-> obj flags) + (water-flags under-water head-under-water bouncing wading swimming touch-water jump-out break-surface) + ) + ) + ((and (logtest? (-> obj flags) (water-flags no-grab-ground)) + (logtest? (-> obj process focus-status) (focus-status grabbed)) + ) + (set! (-> obj flags) (logior (water-flags jump-out) (-> obj flags))) + (logclear! (-> obj flags) (water-flags break-surface)) + ) + ((begin + (set! (-> obj top 1 quad) (-> obj top 0 quad)) + (vector<-cspace! (the-as vector (-> obj top)) (-> obj process node-list data (-> obj joint-index))) + (+! (-> obj top 0 y) (-> obj top-y-offset)) + (set! (-> obj bottom 1 quad) (-> obj bottom 0 quad)) + (set! (-> obj bottom 0 quad) (-> obj process control trans quad)) + (logclear! (-> obj flags) (water-flags under-water head-under-water bouncing wading swimming break-surface)) + (set! (-> obj bob-offset) (update! (-> obj bob))) + (cond + ((logtest? (-> obj flags) (water-flags use-ocean use-water-anim)) + (if (not (logtest? (water-flags touch-water) (-> obj flags))) + (set! (-> obj ocean-offset) (-> obj base-ocean-offset)) + (set! (-> obj ocean-offset) (lerp (-> obj ocean-offset) (-> obj base-ocean-offset) 0.2)) + ) + (set! (-> obj base-ocean-offset) 0.0) + ) + (else + (set! (-> obj base-ocean-offset) 0.0) + (set! (-> obj base-ocean-offset) 0.0) + (set! (-> obj ocean-offset) 0.0) + ) + ) + (if (logtest? (focus-status board pilot) (-> obj process focus-status)) + (set! (-> obj bob-offset) 0.0) + ) + (set! (-> obj height) + (+ (-> obj base-height) (-> obj ocean-offset) (-> obj bob-offset) (-> obj align-offset)) + ) + (set! (-> obj surface-height) (+ (-> obj base-height) (-> obj base-ocean-offset))) + (cond + ((logtest? (focus-status board pilot) (-> obj process focus-status)) + (set! (-> obj collide-height) (+ -819.2 (-> obj base-ocean-offset) (-> obj base-height))) + ) + ((logtest? (-> obj flags) (water-flags swim-ground)) + (set! (-> obj collide-height) (- (-> obj height) (-> obj swim-height))) + ) + (else + (set! (-> obj collide-height) (- (-> obj height) (-> obj bottom-height))) + ) + ) + (set! (-> obj swim-depth) (fmax 0.0 (- (- (-> obj surface-height) (-> obj swim-height)) (-> obj bottom 0 y)))) + (and (>= (-> obj height) (-> obj bottom 0 y)) (logtest? (water-flags touch-water) (-> s5-0 flags))) + ) + (if (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (cshape-moving-flags on-water)) + (set! (-> obj on-water-time) (-> pp clock frame-counter)) + ) + (when (not (logtest? (-> obj flags) (water-flags dark-eco lava))) + (set! (-> obj drip-wetness) 1.0) + (set! (-> obj drip-height) (fmax (- (-> obj surface-height) (-> obj bottom 0 y)) (-> obj drip-height))) + (set! (-> obj drip-speed) 15.0) + ) + (if (and (not (logtest? (water-flags touch-water) (-> obj flags))) + (zero? (logand (-> obj process focus-status) (focus-status touch-water))) + ) + (enter-water obj) + ) + (set! (-> obj flags) (logior (water-flags touch-water) (-> obj flags))) + (cond + ((>= (-> obj top 0 y) (-> obj height)) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (set! (-> s3-0 quad) (-> obj bottom 0 quad)) + (let ((v1-79 (-> obj process control transv))) + (sqrtf (+ (* (-> v1-79 x) (-> v1-79 x)) (* (-> v1-79 z) (-> v1-79 z)))) + ) + (set! (-> obj flags) (logior (water-flags break-surface) (-> obj flags))) + (set! (-> s3-0 y) (+ 40.96 (-> obj surface-height))) + (when (and (not (handle->process (-> obj ripple))) + (>= (+ (-> pp clock frame-counter) (seconds -1.5)) (-> obj enter-water-time)) + ) + (let* ((s1-0 (get-process *default-dead-pool* manipy #x4000)) + (s2-0 + (when s1-0 + (let ((t9-6 (method-of-type manipy activate))) + (t9-6 (the-as manipy s1-0) (-> obj process) (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) + ) + (let ((s2-1 run-function-in-process) + (s0-0 s1-0) + ) + (set! sv-272 manipy-init) + (set! sv-288 s3-0) + (set! sv-304 (-> obj process entity)) + (let ((t0-0 (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer uint32) #f))) + (t1-0 #f) + ) + 0 + ((the-as (function object object object object object object none) s2-1) s0-0 sv-272 sv-288 sv-304 t0-0 t1-0) + ) + ) + (-> s1-0 ppointer) + ) + ) + ) + (set! (-> obj ripple) (ppointer->handle s2-0)) + (when s2-0 + (send-event (ppointer->process s2-0) 'anim-mode 'loop) + (send-event (ppointer->process s2-0) 'art-joint-anim "generic-ripples-cycle" 0) + (set-vector! (-> (the-as process-drawable (-> s2-0 0)) root scale) 0.0 0.5 0.0 1.0) + (send-event + (ppointer->process s2-0) + 'trans-hook + (lambda :behavior process-drawable + () + (let ((s5-0 (ppointer->process (-> self parent))) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> gp-0 quad) (-> (the-as process-drawable s5-0) water bottom 0 quad)) + (seek! (-> self root scale x) 2.0 (* 2.0 (-> self clock seconds-per-frame))) + (set! (-> self root scale z) (-> self root scale x)) + (set! (-> gp-0 y) (-> (the-as process-drawable s5-0) water surface-height)) + (let ((v0-1 (-> self root trans))) + (set! (-> v0-1 quad) (-> gp-0 quad)) + v0-1 + ) + ) + ) + ) + ) + ) + ) + (when (and (logtest? (-> obj process draw status) (draw-control-status on-screen)) + (zero? (-> obj process draw cur-lod)) + (logtest? (water-flags part-rings) (-> obj flags)) + (logtest? (water-flags part-water) (-> obj flags)) + ) + (let* ((f30-0 (y-angle (-> obj process control))) + (v1-141 (-> obj process control transv)) + (f28-0 (sqrtf (+ (* (-> v1-141 x) (-> v1-141 x)) (* (-> v1-141 z) (-> v1-141 z))))) + ) + (set! (-> *part-id-table* 506 init-specs 4 initial-valuef) (+ 24576.0 f30-0)) + (set! (-> *part-id-table* 506 init-specs 19 initial-valuef) (+ 49152.0 f30-0)) + (set! (-> *part-id-table* 506 init-specs 1 initial-valuef) (* 0.0000036621095 f28-0)) + (set! (-> *part-id-table* 506 init-specs 2 initial-valuef) (* 0.1 f28-0)) + (set! (-> *part-id-table* 506 init-specs 13 initial-valuef) 0.7111111) + (set! (-> *part-id-table* 506 init-specs 3 initial-valuef) (-> obj wake-size)) + (set! (-> *part-id-table* 506 init-specs 5 initial-valuef) (-> obj wake-size)) + (let ((t9-13 sp-launch-particles-var) + (a0-62 *sp-particle-system-3d*) + (a1-16 (-> *part-id-table* 506)) + (a2-8 *launch-matrix*) + ) + (set! (-> a2-8 trans quad) (-> s3-0 quad)) + (t9-13 a0-62 a1-16 a2-8 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (set! (-> *part-id-table* 509 init-specs 1 initial-valuef) (* 0.000004150391 f28-0)) + (set! (-> *part-id-table* 509 init-specs 18 initial-valuef) f30-0) + (let ((t9-14 sp-launch-particles-var) + (a0-63 *sp-particle-system-3d*) + (a1-17 (-> *part-id-table* 509)) + (a2-9 *launch-matrix*) + ) + (set! (-> a2-9 trans quad) (-> s3-0 quad)) + (t9-14 a0-63 a1-17 a2-9 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (when (< f28-0 4096.0) + (set! (-> *part-id-table* 504 init-specs 2 random-rangef) (-> obj ripple-size)) + (let ((t9-15 sp-launch-particles-var) + (a0-64 *sp-particle-system-3d*) + (a1-18 (-> *part-id-table* 504)) + (a2-10 *launch-matrix*) + ) + (set! (-> a2-10 trans quad) (-> s3-0 quad)) + (t9-15 a0-64 a1-18 a2-10 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + ) + (if (< (-> obj top 1 y) (-> obj height)) + (spawn-ripples obj 0.2 s3-0 1 (-> obj process control transv) #t) + ) + ) + ) + (else + (set! (-> obj flags) (logior (water-flags head-under-water) (-> obj flags))) + ) + ) + (when (and (logtest? (water-flags part-splash) (-> obj flags)) (logtest? (water-flags part-water) (-> obj flags))) + (cond + ((logtest? (-> obj flags) (water-flags lava)) + ) + ((logtest? (-> obj flags) (water-flags dark-eco)) + ) + ((logtest? (focus-status mech) (-> obj process focus-status)) + ) + (else + (let* ((v0-17 (rand-vu-int-range 3 (+ (-> obj process node-list length) -1))) + (s3-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data v0-17))) + ) + (when (< (-> s3-1 y) (-> obj surface-height)) + (set! (-> *part-id-table* 502 init-specs 16 initial-valuef) (-> obj surface-height)) + (let ((f0-72 (lerp-scale 12.0 0.4 (the float (- (-> pp clock frame-counter) (-> obj enter-water-time))) 0.0 600.0)) + (f1-26 0.00012207031) + (v1-222 (-> obj process control transv)) + ) + (set! (-> *part-id-table* 502 init-specs 1 initial-valuef) + (+ f0-72 (* f1-26 (sqrtf (+ (* (-> v1-222 x) (-> v1-222 x)) (* (-> v1-222 z) (-> v1-222 z)))))) + ) + ) + (let ((t9-20 sp-launch-particles-var) + (a0-75 *sp-particle-system-2d*) + (a1-26 (-> *part-id-table* 502)) + (a2-14 *launch-matrix*) + ) + (set! (-> a2-14 trans quad) (-> s3-1 quad)) + (t9-20 a0-75 a1-26 a2-14 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (set! (-> *part-id-table* 503 init-specs 16 initial-valuef) (-> obj surface-height)) + (let ((t9-21 sp-launch-particles-var) + (a0-76 *sp-particle-system-2d*) + (a1-27 (-> *part-id-table* 503)) + (a2-15 *launch-matrix*) + ) + (set! (-> a2-15 trans quad) (-> s3-1 quad)) + (t9-21 a0-76 a1-27 a2-15 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + ) + ) + ) + (let ((f30-1 (- (+ (-> obj base-height) (-> obj ocean-offset) (-> obj bob-offset) (-> obj align-offset)) + (-> obj swim-height) + ) + ) + ) + (let* ((s3-2 (-> obj process control)) + (v1-236 (if (type? s3-2 control-info) + s3-2 + ) + ) + (v1-237 (and v1-236 (< (- (-> pp clock frame-counter) (-> v1-236 unknown-time-frame06)) (seconds 0.5)))) + ) + (if (and (logtest? (-> obj flags) (water-flags swim-ground)) + (and v1-237 + (zero? (logand (-> (the-as collide-shape-moving (-> obj process control)) status) (cshape-moving-flags on-water)) + ) + ) + ) + (set! (-> obj bob amp) (* 0.8 (-> obj bob amp))) + ) + (cond + ((and (logtest? (-> obj flags) (water-flags can-swim)) + (or (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (cshape-moving-flags on-water)) + (>= f30-1 (-> obj bottom 0 y)) + (and (logtest? (water-flags swimming) s4-0) + (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (cshape-moving-flags t-surface)) + (not (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (cshape-moving-flags on-surface)) + ) + (>= (+ 204.8 f30-1) (-> obj bottom 0 y)) + ) + ) + (or (logtest? (water-flags swimming) s4-0) + (let ((f0-84 12288.0) + (a0-112 (-> obj process control transv)) + ) + (< f0-84 (sqrtf (+ (* (-> a0-112 x) (-> a0-112 x)) (* (-> a0-112 z) (-> a0-112 z))))) + ) + (< (+ (-> pp clock frame-counter) (seconds -0.2)) (-> obj enter-water-time)) + (or (>= (+ (- 204.8 (fmin 6144.0 (+ (-> obj ocean-offset) (-> obj bob-offset) (-> obj align-offset)))) f30-1) + (-> obj bottom 0 y) + ) + (and (-> obj process next-state) (= (-> obj process next-state name) 'target-hit-ground)) + ) + ) + ) + (set! (-> obj swim-time) (-> pp clock frame-counter)) + (send-event (-> obj process) 'swim) + (set! (-> obj flags) (logior (water-flags swimming) (-> obj flags))) + (if (not (logtest? (water-flags swimming) s4-0)) + (set! (-> obj enter-swim-time) (-> pp clock frame-counter)) + ) + (cond + ((and (logtest? (-> obj flags) (water-flags swim-ground)) + (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) (cshape-moving-flags t-surface)) + (zero? (logand (water-flags jump-out) (-> obj flags))) + ) + (let ((v1-260 (new 'stack-no-clear 'vector))) + (set! (-> v1-260 quad) (-> obj bottom 0 quad)) + (set! (-> v1-260 y) (- (-> obj height) (-> obj swim-height))) + (let ((s3-3 (the-as collide-shape-moving (-> obj process control)))) + (when (and (not (logtest? (-> s3-3 status) (cshape-moving-flags csmf12))) + (logtest? (water-flags swimming) (-> obj flags)) + (zero? (logand (focus-status board pilot) (-> obj process focus-status))) + ) + (let ((a1-42 (vector-! (new 'stack-no-clear 'vector) v1-260 (-> (the-as control-info s3-3) trans)))) + (vector-float*! a1-42 a1-42 (-> pp clock frames-per-second)) + ) + ((method-of-object s3-3 collide-shape-method-37)) + (set! (-> (the-as control-info s3-3) status) + (logior (-> s3-3 status) (cshape-moving-flags on-surface on-ground t-surface on-water)) + ) + ) + ) + ) + ) + ((and (< (-> obj bottom 0 y) f30-1) (zero? (logand (water-flags jump-out) (-> obj flags)))) + (logior! (-> obj flags) (water-flags under-water)) + ) + ) + ) + ((begin + (set! v1-237 + (and (logtest? (-> obj flags) (water-flags can-wade)) + (or (not (!= (-> obj bob amp) 0.0)) (>= (- (-> pp clock frame-counter) (-> obj swim-time)) (seconds 0.05))) + (and (>= (- (-> obj height) (-> obj wade-height)) (-> obj bottom 0 y)) v1-237) + ) + ) + v1-237 + ) + (set! (-> obj wade-time) (-> pp clock frame-counter)) + (send-event (-> obj process) 'wade) + (set! (-> obj flags) (logior (water-flags wading) (-> obj flags))) + ) + ((and (< (-> obj bottom 0 y) f30-1) (zero? (logand (water-flags jump-out) (-> obj flags)))) + (logior! (-> obj flags) (water-flags under-water)) + ) + ) + ) + (when (and (logtest? (-> obj flags) (water-flags can-swim)) + (< (-> obj bottom 1 y) f30-1) + (and (< f30-1 (-> obj bottom 0 y)) (logtest? s4-0 (water-flags under-water))) + ) + (set! (-> obj flags) (logior (water-flags swimming) (-> obj flags))) + (let ((a1-47 (new 'stack-no-clear 'vector))) + (set! (-> a1-47 quad) (-> obj bottom 0 quad)) + (let ((s4-1 (the-as collide-shape-moving (-> obj process control)))) + (set! (-> a1-47 y) f30-1) + (when (not (logtest? (focus-status board pilot) (-> obj process focus-status))) + (let ((f30-2 (-> s4-1 ground-impact-vel))) + (let ((t9-26 (method-of-object s4-1 collide-shape-moving-method-61))) + (-> (the-as control-info s4-1) transv) + *up-vector* + (t9-26) + ) + (set! (-> (the-as control-info s4-1) status) (logior (-> s4-1 status) (cshape-moving-flags on-water))) + (set! (-> (the-as control-info s4-1) ground-impact-vel) f30-2) + ) + ) + ) + ) + ) + ) + (when (= (-> obj process type) target) + (cond + ((logtest? (-> obj flags) (water-flags tar)) + (when (and (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) + (cshape-moving-flags on-surface on-water) + ) + (zero? (logand (focus-status board pilot) (-> obj process focus-status))) + ) + (when (< (-> obj process control trans y) (+ -1228.8 (-> obj base-height))) + (send-event (-> obj process) 'no-look-around (seconds 1.5)) + (when (not (logtest? (-> obj process focus-status) (focus-status flut))) + (let ((a1-51 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-51 from) (process->ppointer pp)) + (set! (-> a1-51 num-params) 2) + (set! (-> a1-51 message) 'attack) + (set! (-> a1-51 param 0) (the-as uint #f)) + (let ((v1-327 (new 'static 'attack-info :mask (attack-info-mask mode shove-back shove-up id)))) + (set! (-> v1-327 id) (-> obj attack-id)) + (set! (-> v1-327 shove-up) 2048.0) + (set! (-> v1-327 shove-back) 0.0) + (set! (-> v1-327 mode) 'tar) + (set! (-> a1-51 param 1) (the-as uint v1-327)) + ) + (send-event-function (-> obj process) a1-51) + ) + ) + (let ((v1-329 (-> obj process))) + (set! (-> v1-329 control surf) *tar-surface*) + (set! (-> v1-329 control ground-pat) + (copy-and-set-field (-> (the-as collide-shape-moving (-> v1-329 control)) ground-pat) material 4) + ) + ) + ) + (set! (-> obj swim-height) (lerp (-> obj swim-height) 7372.8 0.05)) + ) + ) + ((logtest? (-> obj flags) (water-flags lava)) + (when (logtest? (-> (the-as collide-shape-moving (-> obj process control)) status) + (cshape-moving-flags on-surface on-water) + ) + (when (< (-> obj process control trans y) (+ -204.8 (-> obj base-height))) + (send-event (-> obj process) 'no-look-around (seconds 1.5)) + (let ((a1-56 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-56 from) (process->ppointer pp)) + (set! (-> a1-56 num-params) 2) + (set! (-> a1-56 message) 'attack) + (set! (-> a1-56 param 0) (the-as uint #f)) + (let ((v1-350 (new 'static 'attack-info :mask (attack-info-mask intersection mode shove-back shove-up id)))) + (set! (-> v1-350 id) (the-as uint 2)) + (set! (-> v1-350 shove-up) 2048.0) + (set! (-> v1-350 shove-back) 0.0) + (set! (-> v1-350 mode) 'melt) + (set! (-> v1-350 intersection quad) (-> s5-0 trans quad)) + (set! (-> a1-56 param 1) (the-as uint v1-350)) + ) + (send-event-function (-> obj process) a1-56) + ) + ) + (set! (-> obj swim-height) (lerp (-> obj swim-height) 7372.8 0.05)) + ) + ) + ((and (logtest? (focus-status dark) (-> obj process focus-status)) + (nonzero? (-> obj process darkjak)) + (logtest? (-> obj process darkjak stage) 32) + ) + (set! (-> obj swim-height) 16384.0) + ) + (else + (set! (-> obj swim-height) 8192.0) + ) + ) + ) + ) + (else + (if (logtest? (water-flags touch-water) (-> obj flags)) + (water-control-method-16 obj) + ) + ) + ) + ) + (when (not (or (not (logtest? (water-flags part-drip) (-> obj flags))) + (not (logtest? (water-flags part-water) (-> obj flags))) + (= (-> obj drip-wetness) 0.0) + ) + ) + (cond + ((logtest? (water-flags spawn-drip) (-> obj flags)) + (let ((v0-34 + (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data (-> obj drip-joint-index))) + ) + ) + (set! (-> *part-id-table* 537 init-specs 18 initial-valuef) (-> obj surface-height)) + (set! (-> *part-id-table* 537 init-specs 10 initial-valuef) (* 0.05 (- (-> v0-34 x) (-> obj drip-old-pos x)))) + (set! (-> *part-id-table* 537 init-specs 11 initial-valuef) (* 0.05 (- (-> v0-34 y) (-> obj drip-old-pos y)))) + (set! (-> *part-id-table* 537 init-specs 12 initial-valuef) (* 0.05 (- (-> v0-34 z) (-> obj drip-old-pos z)))) + (let ((t9-35 sp-launch-particles-var) + (a0-208 *sp-particle-system-2d*) + (a1-61 (-> *part-id-table* 537)) + (a2-22 *launch-matrix*) + ) + (set! (-> a2-22 trans quad) (-> v0-34 quad)) + (t9-35 a0-208 a1-61 a2-22 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + (set! (-> obj drip-time) (-> pp clock frame-counter)) + (logclear! (-> obj flags) (water-flags spawn-drip)) + (seek! (-> obj drip-wetness) 0.0 (* 0.001 (-> obj drip-speed))) + (set! (-> obj drip-speed) (* 1.05 (-> obj drip-speed))) + (if (= (-> obj drip-wetness) 0.0) + (set! (-> obj drip-height) 0.0) + ) + ) + ((>= (- (-> pp clock frame-counter) + (the-as time-frame (the int (/ (the float (-> obj drip-time)) (-> obj drip-mult)))) + ) + (the int (-> obj drip-speed)) + ) + (let* ((s5-1 (rand-vu-int-range 3 (+ (-> obj process node-list length) -1))) + (v0-38 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-1))) + ) + (when (and (< (- (-> v0-38 y) (-> obj process control trans y)) (-> obj drip-height)) + (< (-> obj height) (-> v0-38 y)) + ) + (set! (-> obj drip-joint-index) s5-1) + (set! (-> obj drip-old-pos quad) (-> v0-38 quad)) + (set! (-> obj flags) (logior (water-flags spawn-drip) (-> obj flags))) + ) + ) + ) + ) + ) + (if (and (not (logtest? (water-flags break-surface) (-> obj flags))) (handle->process (-> obj ripple))) + (send-event (handle->process (-> obj ripple)) 'die) + ) + 0 + (none) + ) + ) + +;; definition for method 11 of type water-control +;; WARN: Return type mismatch int vs none. +(defmethod start-bobbing! water-control ((obj water-control) (arg0 float) (arg1 int) (arg2 int)) + (with-pp + (activate! (-> obj bob) (- arg0) arg1 arg2 0.9 1.0 (-> pp clock)) + 0 + (none) + ) + ) + +;; definition for function part-water-splash-callback +;; WARN: Return type mismatch int vs none. +(defun part-water-splash-callback ((arg0 part-tracker)) + (let ((f1-0 (-> arg0 root trans y)) + (f0-0 (the-as float (-> arg0 userdata))) + ) + (set! (-> *part-id-table* 521 init-specs 16 initial-valuef) f1-0) + (set! (-> *part-id-table* 521 init-specs 1 initial-valuef) (* 12.0 f0-0)) + (set! (-> *part-id-table* 517 init-specs 16 initial-valuef) f1-0) + (set! (-> *part-id-table* 520 init-specs 18 initial-valuef) f1-0) + (set! (-> *part-id-table* 515 init-specs 16 initial-valuef) f1-0) + (set! (-> *part-id-table* 512 init-specs 15 initial-valuef) f1-0) + (set! (-> *part-id-table* 513 init-specs 15 initial-valuef) f1-0) + (set! (-> *part-id-table* 512 init-specs 12 initial-valuef) (* 13.653334 (* -0.15 f0-0))) + (set! (-> *part-id-table* 512 init-specs 12 random-rangef) (* 13.653334 (* -0.075 f0-0))) + (set! (-> *part-id-table* 513 init-specs 12 initial-valuef) (* 13.653334 (* -0.15 f0-0))) + (set! (-> *part-id-table* 513 init-specs 12 random-rangef) (* 13.653334 (* -0.075 f0-0))) + (set! (-> *part-id-table* 519 init-specs 2 initial-valuef) (* 4096.0 (* 0.1 f0-0))) + (set! (-> *part-id-table* 519 init-specs 2 random-rangef) (* 4096.0 (* 0.4 f0-0))) + (set! (-> *part-id-table* 519 init-specs 4 initial-valuef) (* 4096.0 (* 0.1 f0-0))) + (set! (-> *part-id-table* 519 init-specs 4 random-rangef) (* 4096.0 (* 0.4 f0-0))) + (set! (-> *part-id-table* 519 init-specs 9 initial-valuef) (* 13.653334 (* 1.5 f0-0))) + (set! (-> *part-id-table* 519 init-specs 9 random-rangef) (* 13.653334 (* 3.4 f0-0))) + (set! (-> *part-id-table* 519 init-specs 10 initial-valuef) (* 13.653334 (* 1.5 f0-0))) + (set! (-> *part-id-table* 519 init-specs 10 random-rangef) (* 13.653334 (* 3.4 f0-0))) + (set! (-> *part-id-table* 516 init-specs 3 initial-valuef) (* 4096.0 (* 1.5 f0-0))) + (set! (-> *part-id-table* 516 init-specs 3 random-rangef) (* 4096.0 (* 1.5 f0-0))) + (set! (-> *part-id-table* 516 init-specs 5 initial-valuef) (* 4096.0 (* 1.5 f0-0))) + (set! (-> *part-id-table* 516 init-specs 5 random-rangef) (* 4096.0 (* 1.5 f0-0))) + (set! (-> *part-id-table* 516 init-specs 10 initial-valuef) (* 13.653334 (* 1.5 f0-0))) + (set! (-> *part-id-table* 516 init-specs 10 random-rangef) (* 13.653334 (* 2.4 f0-0))) + (set! (-> *part-id-table* 516 init-specs 11 initial-valuef) (* 13.653334 (* 1.5 f0-0))) + (set! (-> *part-id-table* 516 init-specs 11 random-rangef) (* 13.653334 (* 2.4 f0-0))) + (set! (-> *part-id-table* 520 init-specs 1 initial-valuef) (* 0.5 f0-0)) + (set! (-> *part-id-table* 520 init-specs 2 initial-valuef) (* 4096.0 (* -0.25 f0-0))) + (set! (-> *part-id-table* 520 init-specs 2 random-rangef) (* 4096.0 (* 0.5 f0-0))) + (set! (-> *part-id-table* 520 init-specs 3 initial-valuef) (* 4096.0 (* -0.25 f0-0))) + (set! (-> *part-id-table* 520 init-specs 3 random-rangef) (* 4096.0 (* 0.5 f0-0))) + (set! (-> *part-id-table* 520 init-specs 10 initial-valuef) (* 13.653334 (* -0.75 f0-0))) + (set! (-> *part-id-table* 520 init-specs 10 random-rangef) (* 13.653334 (* 1.5 f0-0))) + (set! (-> *part-id-table* 520 init-specs 12 initial-valuef) (* 13.653334 (* -0.75 f0-0))) + (set! (-> *part-id-table* 520 init-specs 12 random-rangef) (* 13.653334 (* 1.5 f0-0))) + (set! (-> *part-id-table* 520 init-specs 11 initial-valuef) (* 13.653334 (* 7.0 f0-0))) + (set! (-> *part-id-table* 520 init-specs 11 random-rangef) (* 13.653334 (* 2.0 f0-0))) + (set! (-> *part-id-table* 520 init-specs 15 initial-valuef) (* 13.653334 (* -0.3 f0-0))) + (set! (-> *part-id-table* 520 init-specs 15 random-rangef) (* 13.653334 (* -0.075 f0-0))) + (set! (-> *part-id-table* 517 init-specs 1 initial-valuef) (* 0.5 f0-0)) + (set! (-> *part-id-table* 517 init-specs 2 initial-valuef) (* 1.2 f0-0)) + (set! (-> *part-id-table* 517 init-specs 9 initial-valuef) (* 13.653334 f0-0)) + (set! (-> *part-id-table* 517 init-specs 9 random-rangef) (* 13.653334 (* 2.0 f0-0))) + (set! (-> *part-id-table* 517 init-specs 10 initial-valuef) (* 13.653334 (* 6.0 f0-0))) + (set! (-> *part-id-table* 517 init-specs 10 random-rangef) (* 13.653334 (* 2.0 f0-0))) + (set! (-> *part-id-table* 517 init-specs 13 initial-valuef) (* 13.653334 (* -0.3 f0-0))) + (set! (-> *part-id-table* 517 init-specs 13 random-rangef) (* 13.653334 (* -0.075 f0-0))) + (set! (-> *part-id-table* 517 init-specs 9 initial-valuef) (* 13.653334 f0-0)) + (set! (-> *part-id-table* 517 init-specs 9 random-rangef) (* 13.653334 (* 2.0 f0-0))) + (set! (-> *part-id-table* 517 init-specs 10 initial-valuef) (* 13.653334 (* 6.0 f0-0))) + (set! (-> *part-id-table* 517 init-specs 10 random-rangef) (* 13.653334 (* 2.0 f0-0))) + (set! (-> *part-id-table* 517 init-specs 13 initial-valuef) (* 13.653334 (* -0.3 f0-0))) + (set! (-> *part-id-table* 517 init-specs 13 random-rangef) (* 13.653334 (* -0.075 f0-0))) + (set! (-> *part-id-table* 515 init-specs 1 initial-valuef) (* 4.0 f0-0)) + (set! (-> *part-id-table* 515 init-specs 2 initial-valuef) (* 4096.0 f0-0)) + (set! (-> *part-id-table* 515 init-specs 9 initial-valuef) (* 13.653334 f0-0)) + (set! (-> *part-id-table* 515 init-specs 9 random-rangef) (* 13.653334 (* 2.0 f0-0))) + (set! (-> *part-id-table* 515 init-specs 10 initial-valuef) (* 13.653334 (* 6.0 f0-0))) + (set! (-> *part-id-table* 515 init-specs 10 random-rangef) (* 13.653334 (* 2.0 f0-0))) + (set! (-> *part-id-table* 515 init-specs 13 initial-valuef) (* 13.653334 (* -0.3 f0-0))) + (set! (-> *part-id-table* 515 init-specs 13 random-rangef) (* 13.653334 (* -0.075 f0-0))) + (set! (-> *part-id-table* 514 init-specs 2 initial-valuef) (* 4096.0 (* 1.2 f0-0))) + (set! (-> *part-id-table* 514 init-specs 2 random-rangef) (* 4096.0 (* 0.2 f0-0))) + (set! (-> *part-id-table* 514 init-specs 3 initial-valuef) (* 4096.0 (* 0.4 f0-0))) + (set! (-> *part-id-table* 514 init-specs 3 random-rangef) (* 4096.0 (* 1.2 f0-0))) + (set! (-> *part-id-table* 514 init-specs 7 initial-valuef) (* 4096.0 (* 0.2 f0-0))) + (set! (-> *part-id-table* 514 init-specs 7 random-rangef) (* 4096.0 (* 2.2 f0-0))) + (set! (-> *part-id-table* 518 init-specs 2 initial-valuef) (* 4096.0 (* 0.3 f0-0))) + (set! (-> *part-id-table* 518 init-specs 2 random-rangef) (* 4096.0 (* 0.9 f0-0))) + (set! (-> *part-id-table* 518 init-specs 6 initial-valuef) (* 4096.0 f0-0)) + (set! (-> *part-id-table* 518 init-specs 6 random-rangef) (* 4096.0 (* 2.2 f0-0))) + ) + 0 + (none) + ) + +;; definition for method 15 of type water-control +;; WARN: Return type mismatch int vs none. +(defmethod enter-water water-control ((obj water-control)) + (with-pp + (set! (-> obj flags) (logior (water-flags touch-water) (-> obj flags))) + (logclear! (-> obj flags) (water-flags jump-out)) + (set! (-> obj enter-water-time) (-> pp clock frame-counter)) + (set-vector! (-> obj enter-water-pos) (-> obj bottom 0 x) (-> obj surface-height) (-> obj bottom 0 z) 1.0) + (when (and (logtest? (water-flags part-splash) (-> obj flags)) (logtest? (water-flags part-water) (-> obj flags))) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer pp)) + (set! (-> a1-1 num-params) 1) + (set! (-> a1-1 message) 'query) + (set! (-> a1-1 param 0) (the-as uint 'ground-height)) + (let* ((f0-4 (the-as float (send-event-function (-> obj process) a1-1))) + (f30-0 (lerp-scale 0.3 1.0 f0-4 2048.0 24576.0)) + ) + (when (not (logtest? (-> obj flags) (water-flags dark-eco lava))) + (if (nonzero? (-> obj process skel effect)) + (sound-play "swim-enter") + ) + (spawn-ripples obj f30-0 (-> obj enter-water-pos) 1 (-> obj process control transv) #t) + ) + ) + ) + ) + (if (logtest? (-> obj flags) (water-flags tar lava)) + (set! (-> obj swim-height) 2867.2) + ) + 0 + (none) + ) + ) + +;; definition for method 16 of type water-control +;; WARN: Return type mismatch int vs none. +(defmethod water-control-method-16 water-control ((obj water-control)) + (logclear! (-> obj flags) (water-flags touch-water)) + (set-zero! (-> obj bob)) + (if (logtest? (-> obj flags) (water-flags tar lava)) + (set! (-> obj swim-height) 2867.2) + ) + 0 + (none) + ) + +;; definition for function splash-spawn +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defun splash-spawn ((arg0 float) (arg1 vector) (arg2 int)) + (let ((s5-0 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-0 + (let ((t9-1 (method-of-type part-tracker activate))) + (t9-1 + (the-as part-tracker s5-0) + *entity-pool* + (symbol->string (-> part-tracker symbol)) + (the-as pointer #x70004000) + ) + ) + (let ((t9-2 run-function-in-process) + (a0-3 s5-0) + (a1-3 part-tracker-init) + (a2-5 (if (zero? arg2) + (-> *part-group-id-table* 122) + (-> *part-group-id-table* 121) + ) + ) + (a3-1 0) + (t0-0 part-water-splash-callback) + (t2-0 #f) + (t3-0 *launch-matrix*) + ) + (set! (-> t3-0 trans quad) (-> arg1 quad)) + ((the-as (function object object object object object object object object none) t9-2) + a0-3 + a1-3 + a2-5 + a3-1 + t0-0 + arg0 + t2-0 + t3-0 + ) + ) + (-> s5-0 ppointer) + ) + ) + 0 + (none) + ) + +;; definition for function rings-water-spawn +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defun rings-water-spawn ((arg0 float) (arg1 vector) (arg2 vector) (arg3 float) (arg4 float)) + (let* ((v1-0 arg2) + (f30-0 (sqrtf (+ (* (-> v1-0 x) (-> v1-0 x)) (* (-> v1-0 z) (-> v1-0 z))))) + ) + (set! (-> *part-id-table* 506 init-specs 4 initial-valuef) (+ 24576.0 arg0)) + (set! (-> *part-id-table* 506 init-specs 19 initial-valuef) (+ 49152.0 arg0)) + (set! (-> *part-id-table* 506 init-specs 1 initial-valuef) (* 0.0000036621095 f30-0)) + (set! (-> *part-id-table* 506 init-specs 2 initial-valuef) (* 0.1 f30-0)) + (set! (-> *part-id-table* 506 init-specs 13 initial-valuef) 0.7111111) + (set! (-> *part-id-table* 506 init-specs 3 initial-valuef) arg3) + (set! (-> *part-id-table* 506 init-specs 5 initial-valuef) arg3) + (let ((t9-0 sp-launch-particles-var) + (a0-1 *sp-particle-system-3d*) + (a1-1 (-> *part-id-table* 506)) + (a2-1 *launch-matrix*) + ) + (set! (-> a2-1 trans quad) (-> arg1 quad)) + (t9-0 a0-1 a1-1 a2-1 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (set! (-> *part-id-table* 509 init-specs 1 initial-valuef) (* 0.000004150391 f30-0)) + (set! (-> *part-id-table* 509 init-specs 18 initial-valuef) arg0) + (let ((t9-1 sp-launch-particles-var) + (a0-2 *sp-particle-system-3d*) + (a1-2 (-> *part-id-table* 509)) + (a2-2 *launch-matrix*) + ) + (set! (-> a2-2 trans quad) (-> arg1 quad)) + (t9-1 a0-2 a1-2 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (when (< f30-0 4096.0) + (set! (-> *part-id-table* 504 init-specs 2 random-rangef) arg4) + (let ((t9-2 sp-launch-particles-var) + (a0-3 *sp-particle-system-3d*) + (a1-3 (-> *part-id-table* 504)) + (a2-3 *launch-matrix*) + ) + (set! (-> a2-3 trans quad) (-> arg1 quad)) + (t9-2 a0-3 a1-3 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 13 of type water-control +;; WARN: Return type mismatch int vs none. +(defmethod spawn-ripples water-control ((obj water-control) (arg0 float) (arg1 vector) (arg2 int) (arg3 vector) (arg4 symbol)) + (with-pp + (when (and (logtest? (water-flags part-splash) (-> obj flags)) (logtest? (water-flags part-water) (-> obj flags))) + (let ((s4-1 (vector+float*! (new 'stack-no-clear 'vector) arg1 arg3 0.05))) + (set! (-> s4-1 y) (+ 40.96 (-> obj surface-height))) + (if (>= (- (-> pp clock frame-counter) (-> obj distort-time)) (seconds 0.1)) + (splash-spawn arg0 s4-1 arg2) + ) + (when (and arg4 (>= (- (-> pp clock frame-counter) (-> obj distort-time)) (seconds 0.3))) + (set! (-> obj distort-time) (-> pp clock frame-counter)) + (let* ((s2-0 (get-process *default-dead-pool* manipy #x4000)) + (s3-1 + (when s2-0 + (let ((t9-2 (method-of-type manipy activate))) + (t9-2 (the-as manipy s2-0) (-> obj process) (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) + ) + (let ((s3-2 run-function-in-process) + (s1-0 s2-0) + (s0-0 manipy-init) + (s5-1 (-> obj process entity)) + (t0-1 (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer uint32) #f))) + (t1-1 #f) + ) + 0 + ((the-as (function object object object object object object none) s3-2) s1-0 s0-0 s4-1 s5-1 t0-1 t1-1) + ) + (-> s2-0 ppointer) + ) + ) + ) + (when s3-1 + (send-event (ppointer->process s3-1) 'anim-mode 'play1) + (send-event (ppointer->process s3-1) 'anim "idle") + (let ((f0-4 (fmax 0.6 (fmin 1.0 (* 2.0 arg0))))) + (set-vector! (-> (the-as process-drawable (-> s3-1 0)) root scale) f0-4 0.5 f0-4 1.0) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +;; definition for function water-info<-region +;; INFO: Used lq/sq +(defun water-info<-region ((arg0 water-info) (arg1 drawable-region-prim) (arg2 collide-shape) (arg3 collide-action)) + (with-pp + (set! (-> arg0 flags) (water-flags)) + (set! (-> arg0 handle) (the-as handle #f)) + (set! (-> arg0 depth) 0.0) + (let ((s2-0 (the-as object (-> arg1 region on-inside)))) + (set! s2-0 (cond + ((= (the-as symbol (-> (the-as pair s2-0) car)) 'water) + (empty) + s2-0 + ) + (else + (eval! + (new 'stack 'script-context (the-as basic (process->ppointer pp)) pp (the-as vector #f)) + (the-as pair s2-0) + ) + ) + ) + ) + (let ((a0-4 (-> arg2 root-prim))) + (when s2-0 + (set! (-> arg0 trans quad) (-> a0-4 prim-core world-sphere quad)) + (set-vector! (-> arg0 normal) 0.0 1.0 0.0 1.0) + (set! (-> arg0 prim) arg1) + (case (-> (the-as pair (-> (the-as pair s2-0) cdr)) car) + (('height) + (set! (-> arg0 flags) (water-flags active)) + (set! (-> arg0 trans y) + (* 4096.0 (command-get-float (-> (the-as pair (-> (the-as pair (-> (the-as pair s2-0) cdr)) cdr)) car) 0.0)) + ) + (set! (-> arg0 base-height) (-> arg0 trans y)) + ) + (('ocean) + (set! (-> arg0 flags) (water-flags active use-ocean)) + (set! (-> arg0 trans y) (ocean-method-11 *ocean* (the-as (inline-array vector) (-> arg0 trans)) #f)) + (set! (-> arg0 base-height) (ocean-map-method-10 *ocean-map*)) + (when (= (-> arg0 trans y) 4095996000.0) + (set! (-> arg0 flags) (water-flags)) + 0 + ) + ) + (('water-anim) + (let* ((s0-0 (command-get-process + (-> (the-as pair (-> (the-as pair (-> (the-as pair s2-0) cdr)) cdr)) car) + (the-as process #f) + ) + ) + (s1-0 (if (type? s0-0 process-drawable) + s0-0 + ) + ) + ) + (cond + (s1-0 + (set! (-> arg0 flags) (water-flags active use-water-anim)) + (set! (-> arg0 trans y) (ripple-find-height (the-as process-drawable s1-0) 0 (-> arg0 trans))) + (set! (-> arg0 handle) (process->handle s1-0)) + (set! (-> arg0 base-height) (-> (the-as process-drawable s1-0) root trans y)) + ) + (else + (set! (-> arg0 flags) (water-flags)) + 0 + ) + ) + ) + ) + ) + (when (logtest? (-> arg0 flags) (water-flags active)) + (let* ((s2-1 (-> (the-as pair (-> (the-as pair (-> (the-as pair (-> (the-as pair s2-0) cdr)) cdr)) cdr)) car)) + (v1-39 (-> (the-as pair s2-1) car)) + ) + (while (not (null? s2-1)) + (cond + ((= v1-39 'swim) + (logior! (-> arg0 flags) (water-flags can-swim can-ground)) + ) + ((= v1-39 'wade) + (logior! (-> arg0 flags) (water-flags can-wade can-ground)) + ) + ((= v1-39 'event) + (set! (-> arg0 flags) (logior (water-flags event) (-> arg0 flags))) + ) + ((= v1-39 'tar) + (logior! (-> arg0 flags) (water-flags tar)) + ) + ((= v1-39 'darkeco) + (logior! (-> arg0 flags) (water-flags dark-eco)) + ) + ((= v1-39 'lava) + (logior! (-> arg0 flags) (water-flags lava)) + ) + ((= v1-39 'mech) + (let* ((s1-1 (-> arg2 process)) + (a0-39 (if (type? s1-1 process-focusable) + s1-1 + ) + ) + ) + (when (and a0-39 (zero? (logand (focus-status mech) (-> (the-as process-focusable a0-39) focus-status)))) + (set! (-> arg0 flags) (water-flags)) + 0 + ) + ) + (logior! (-> arg0 extra-flags) 1) + ) + ) + (set! s2-1 (-> (the-as pair s2-1) cdr)) + (set! v1-39 (-> (the-as pair s2-1) car)) + ) + ) + (let ((s2-2 (-> arg2 root-prim))) + (countdown (s1-2 (-> arg2 total-prims)) + (when (and (nonzero? (-> s2-2 prim-core prim-type)) + (logtest? (-> s2-2 prim-core action) arg3) + (nonzero? (-> s2-2 prim-core collide-with)) + ) + (set! (-> (the-as region-prim-area #x70000000) pos quad) (-> s2-2 prim-core world-sphere quad)) + (if (and (within-area? arg1 (the-as region-prim-area (+ #x70000000 0))) + (begin + (set! (-> arg0 flags) (logior (water-flags over-water) (-> arg0 flags))) + (>= (-> arg0 trans y) (- (-> s2-2 prim-core world-sphere y) (-> s2-2 prim-core world-sphere w))) + ) + ) + (set! (-> arg0 flags) (logior (water-flags touch-water) (-> arg0 flags))) + ) + ) + (&+! s2-2 80) + ) + ) + (if (and (logtest? (water-flags event) (-> arg0 flags)) (logtest? (water-flags touch-water) (-> arg0 flags))) + (send-event (handle->process (-> arg0 handle)) 'water arg0 (-> arg2 process)) + ) + ) + ) + ) + ) + arg0 + ) + ) + +;; definition for method 52 of type collide-shape +;; INFO: Used lq/sq +(defmethod water-info-init! collide-shape ((obj collide-shape) (arg0 water-info) (arg1 collide-action)) + "Initialize a [[water-info]] with the currently loaded regions." + (local-vars (sv-80 int)) + (let ((s3-0 (new 'stack 'water-info))) + (set! (-> s3-0 flags) (water-flags)) + (set! (-> s3-0 handle) (the-as handle #f)) + (set! (-> arg0 flags) (water-flags)) + (set! (-> arg0 handle) (the-as handle #f)) + (set! (-> s3-0 extra-flags) (the-as uint 0)) + (set! (-> (the-as region-prim-area #x70000000) region-prim-list num-items) 0) + (set! (-> (the-as region-prim-area #x70000000) region-inside-count) 0) + (set! (-> (the-as region-prim-area #x70000000) pos quad) (-> obj root-prim prim-core world-sphere quad)) + (dotimes (s2-0 (-> *level* length)) + (let ((v1-8 (-> *level* level s2-0))) + (when (= (-> v1-8 status) 'active) + (let ((s1-0 (-> v1-8 bsp region-trees))) + (when (nonzero? s1-0) + (let ((s0-0 (-> s1-0 length))) + (set! sv-80 0) + (let ((a0-10 (-> s1-0 sv-80))) + (while (< sv-80 s0-0) + (if (= (-> a0-10 name) 'water) + (collect-regions + a0-10 + (the-as sphere (-> (the-as region-prim-area #x70000000) pos)) + 0 + (-> (the-as region-prim-area #x70000000) region-prim-list) + ) + ) + (set! sv-80 (+ sv-80 1)) + (set! a0-10 (-> s1-0 sv-80)) + ) + ) + ) + ) + ) + ) + ) + ) + (countdown (s2-1 (-> (the-as region-prim-area #x70000000) region-prim-list num-items)) + (water-info<-region s3-0 (-> (the-as region-prim-area #x70000000) region-prim-list items s2-1) obj arg1) + (when (and (logtest? (-> s3-0 flags) (water-flags active)) + (logtest? (water-flags touch-water) (-> s3-0 flags)) + (zero? (logand (-> s3-0 extra-flags) 1)) + ) + (mem-copy! (the-as pointer arg0) (the-as pointer s3-0) 60) + (set! arg0 arg0) + (goto cfg-27) + ) + (if (and (logtest? (-> s3-0 flags) (water-flags active)) + (logtest? (water-flags touch-water over-water) (-> s3-0 flags)) + ) + (mem-copy! (the-as pointer arg0) (the-as pointer s3-0) 60) + ) + ) + ) + (label cfg-27) + arg0 + ) diff --git a/test/decompiler/reference/jak2/engine/debug/editable-player_REF.gc b/test/decompiler/reference/jak2/engine/debug/editable-player_REF.gc index 795b00eb5a..1e0093d4dc 100644 --- a/test/decompiler/reference/jak2/engine/debug/editable-player_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/editable-player_REF.gc @@ -38,6 +38,41 @@ ;; definition for function insert-box ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. +;; WARN: Failed store: (s.w! (+ a0-9 120) v1-10) at op 39 +;; WARN: Failed store: (s.w! (+ a0-18 120) #f) at op 57 +;; WARN: Failed store: (s.w! (+ a0-24 120) v1-21) at op 93 +;; WARN: Failed store: (s.w! (+ a0-30 120) v1-24) at op 118 +;; WARN: Failed store: (s.w! (+ a0-36 120) v1-27) at op 143 +;; WARN: Failed store: (s.w! (+ a0-42 120) v1-30) at op 168 +;; WARN: Failed store: (s.w! (+ a0-48 120) v1-33) at op 193 +;; WARN: Failed store: (s.w! (+ a0-54 120) v1-36) at op 218 +;; WARN: Failed store: (s.w! (+ a0-60 120) v1-39) at op 243 +;; WARN: Failed store: (s.w! (+ a0-65 120) v1-42) at op 267 +;; WARN: Failed load: (set! a0-67 (l.wu (+ v1-47 120))) at op 278 +;; WARN: Failed load: (set! a0-68 (l.wu (+ v1-52 120))) at op 287 +;; WARN: Failed load: (set! a0-69 (l.wu (+ v1-57 120))) at op 296 +;; WARN: Failed load: (set! a0-70 (l.wu (+ v1-62 120))) at op 305 +;; WARN: Failed load: (set! a0-73 (l.wu (+ v1-71 120))) at op 329 +;; WARN: Failed load: (set! a0-74 (l.wu (+ v1-76 120))) at op 338 +;; WARN: Failed load: (set! a0-75 (l.wu (+ v1-81 120))) at op 347 +;; WARN: Failed load: (set! a0-76 (l.wu (+ v1-86 120))) at op 356 +;; WARN: Failed load: (set! a0-80 (l.wu (+ v1-97 120))) at op 387 +;; WARN: Failed load: (set! a0-81 (l.wu (+ v1-102 120))) at op 396 +;; WARN: Failed load: (set! a0-82 (l.wu (+ v1-107 120))) at op 405 +;; WARN: Failed load: (set! a0-83 (l.wu (+ v1-112 120))) at op 414 +;; WARN: Failed load: (set! a0-86 (l.wu (+ v1-121 120))) at op 438 +;; WARN: Failed load: (set! a0-87 (l.wu (+ v1-126 120))) at op 447 +;; WARN: Failed load: (set! a0-88 (l.wu (+ v1-131 120))) at op 456 +;; WARN: Failed load: (set! a0-89 (l.wu (+ v1-136 120))) at op 465 +;; WARN: Failed load: (set! a0-93 (l.wu (+ v1-147 120))) at op 496 +;; WARN: Failed load: (set! a0-94 (l.wu (+ v1-152 120))) at op 505 +;; WARN: Failed load: (set! a0-95 (l.wu (+ v1-157 120))) at op 514 +;; WARN: Failed load: (set! a0-96 (l.wu (+ v1-162 120))) at op 523 +;; WARN: Failed load: (set! a0-100 (l.wu (+ v1-173 120))) at op 554 +;; WARN: Failed load: (set! a0-101 (l.wu (+ v1-178 120))) at op 563 +;; WARN: Failed load: (set! a0-102 (l.wu (+ v1-183 120))) at op 572 +;; WARN: Failed load: (set! a0-103 (l.wu (+ v1-188 120))) at op 581 +;; WARN: Failed load: (set! a0-106 (l.wu (+ v1-199 120))) at op 610 ;; WARN: Function insert-box has a return type of none, but the expression builder found a return statement. (defun insert-box ((arg0 editable-array) (arg1 vector)) (if (not (-> arg0 region)) diff --git a/test/decompiler/reference/jak2/engine/debug/editable_REF.gc b/test/decompiler/reference/jak2/engine/debug/editable_REF.gc index 07e0a7b6b9..089f7c1273 100644 --- a/test/decompiler/reference/jak2/engine/debug/editable_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/editable_REF.gc @@ -1118,6 +1118,10 @@ ) ;; definition for method 27 of type editable-face +;; WARN: Failed load: (set! a0-3 (l.wu (+ v1-1 60))) at op 15 +;; WARN: Failed store: (s.w! (+ a0-5 60) v1-3) at op 23 +;; WARN: Failed load: (set! v1-10 (l.wu (+ v1-9 60))) at op 36 +;; WARN: Failed store: (s.w! (+ v1-10 16) v0-3) at op 37 (defmethod editable-method-27 editable-face ((obj editable-face) (arg0 editable-array)) (let ((gp-1 ((the-as (function editable-face editable-array editable) (find-parent-method editable-face 27)) obj arg0) @@ -1488,6 +1492,9 @@ ) ;; definition for method 27 of type editable-plane +;; WARN: Failed store: (s.w! (+ a0-5 28) v1-3) at op 23 +;; WARN: Failed load: (set! v1-10 (l.wu (+ v1-9 28))) at op 36 +;; WARN: Failed store: (s.w! (+ v1-10 16) v0-3) at op 37 (defmethod editable-method-27 editable-plane ((obj editable-plane) (arg0 editable-array)) (let ((gp-1 ((the-as (function editable-plane editable-array editable) (find-parent-method editable-plane 27)) obj arg0) @@ -2019,6 +2026,8 @@ ;; WARN: Stack slot offset 40 signed mismatch ;; WARN: Stack slot offset 44 signed mismatch ;; WARN: Return type mismatch symbol vs none. +;; WARN: Failed load: (set! a0-82 (l.wu (+ v1-135 12))) at op 466 +;; WARN: Failed load: (set! a0-119 (l.wu (+ v1-208 12))) at op 647 ;; WARN: Function (method 12 editable-array) has a return type of none, but the expression builder found a return statement. (defmethod editable-array-method-12 editable-array ((obj editable-array) (arg0 editable-array)) (local-vars diff --git a/test/decompiler/reference/jak2/engine/debug/nav/mysql-nav-graph_REF.gc b/test/decompiler/reference/jak2/engine/debug/nav/mysql-nav-graph_REF.gc index 88fd7e70b2..75b029d7c1 100644 --- a/test/decompiler/reference/jak2/engine/debug/nav/mysql-nav-graph_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/nav/mysql-nav-graph_REF.gc @@ -1268,6 +1268,7 @@ ) ;; definition for method 10 of type mysql-nav-graph +;; WARN: Failed load: (set! v1-36 (l.wu (+ v1-35 32))) at op 97 (defmethod exec-sql! mysql-nav-graph ((obj mysql-nav-graph)) (format #t "Saving nodes ...~%") (dotimes (s5-0 (-> obj node-array length)) diff --git a/test/decompiler/reference/jak2/engine/game/game-h_REF.gc b/test/decompiler/reference/jak2/engine/game/game-h_REF.gc index 54761838dd..8a49f47459 100644 --- a/test/decompiler/reference/jak2/engine/game/game-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/game-h_REF.gc @@ -16,7 +16,7 @@ (part sparticle-launch-control :offset-assert 168) (water water-control :offset-assert 172) (sound ambient-sound :offset-assert 176) - (carry basic :offset-assert 180) + (carry carry-info :offset-assert 180) (rbody rigid-body-control :offset-assert 184) (state-flags state-flags :offset-assert 188) (state-time time-frame :offset-assert 192) @@ -27,7 +27,7 @@ :flag-assert #x14005000c8 (:methods (initialize-skeleton (_type_ skeleton-group pair) none 14) - (initialize-skeleton-by-name (_type_ string object) draw-control 15) + (initialize-skeleton-by-name (_type_ string) draw-control 15) (apply-alignment (_type_ align-opts transformq vector) object 16) (process-drawable-method-17 () none 17) (process-drawable-method-18 () none 18) @@ -305,9 +305,9 @@ :size-assert #xa0 :flag-assert #xc000000a0 (:methods - (attack-info-method-9 () none 9) - (attack-info-method-10 () none 10) - (attack-info-method-11 () none 11) + (attack-info-method-9 (_type_ attack-info process-drawable process-drawable) none 9) + (attack-info-method-10 (_type_ object process-drawable process touching-shapes-entry) attack-info 10) + (combine! (_type_ attack-info process-drawable) attack-info 11) ) ) diff --git a/test/decompiler/reference/jak2/engine/geometry/geometry_REF.gc b/test/decompiler/reference/jak2/engine/geometry/geometry_REF.gc index 0608929095..2245156416 100644 --- a/test/decompiler/reference/jak2/engine/geometry/geometry_REF.gc +++ b/test/decompiler/reference/jak2/engine/geometry/geometry_REF.gc @@ -1449,6 +1449,9 @@ ) ;; definition for function curve-evaluate! +;; WARN: Failed load: (set! vf3 (l.vf (+ v1-9 16))) at op 67 +;; WARN: Failed load: (set! vf4 (l.vf (+ v1-9 32))) at op 69 +;; WARN: Failed load: (set! vf5 (l.vf (+ v1-9 48))) at op 71 ;; ERROR: Unsupported inline assembly instruction kind - [addiu v1, s3, -3] ;; ERROR: Unsupported inline assembly instruction kind - [sll v1, v1, 4] (defun curve-evaluate! ((arg0 vector) (arg1 float) (arg2 (inline-array vector)) (arg3 int) (arg4 (pointer float)) (arg5 int)) diff --git a/test/decompiler/reference/jak2/engine/gfx/math-camera_REF.gc b/test/decompiler/reference/jak2/engine/gfx/math-camera_REF.gc index b165783463..55ec8d4982 100644 --- a/test/decompiler/reference/jak2/engine/gfx/math-camera_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/math-camera_REF.gc @@ -41,6 +41,10 @@ ;; WARN: Stack slot offset 16 signed mismatch ;; WARN: Stack slot offset 16 signed mismatch ;; WARN: Stack slot offset 16 signed mismatch +;; WARN: Failed store: (s.w! a0-43 v1-54) at op 457 +;; WARN: Failed store: (s.w! (+ a0-43 4) a1-9) at op 461 +;; WARN: Failed store: (s.w! (+ a0-43 8) a1-10) at op 463 +;; WARN: Failed store: (s.w! (+ a0-43 12) a1-11) at op 465 (defun update-math-camera ((arg0 math-camera) (arg1 symbol) (arg2 symbol) (arg3 float)) (local-vars (sv-16 float)) (set! (-> arg0 x-ratio) (tan (* 0.5 arg3))) diff --git a/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-h_REF.gc b/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-h_REF.gc index 9f60b93f42..7c311ad82a 100644 --- a/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-h_REF.gc @@ -870,7 +870,7 @@ :flag-assert #xb00000038 (:methods (set-height! (_type_ float) none 9) - (ocean-map-method-10 () none 10) + (ocean-map-method-10 (_type_) float 10) ) ) diff --git a/test/decompiler/reference/jak2/engine/gfx/texture/texture-anim-h_REF.gc b/test/decompiler/reference/jak2/engine/gfx/texture/texture-anim-h_REF.gc index f499b558b9..64d337bc0a 100644 --- a/test/decompiler/reference/jak2/engine/gfx/texture/texture-anim-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/texture/texture-anim-h_REF.gc @@ -137,7 +137,8 @@ ;; definition of type texture-anim-array (deftype texture-anim-array (array) - () + ((array-data texture-anim :inline :dynamic :offset-assert 16) + ) :method-count-assert 11 :size-assert #x10 :flag-assert #xb00000010 diff --git a/test/decompiler/reference/jak2/engine/level/region-h_REF.gc b/test/decompiler/reference/jak2/engine/level/region-h_REF.gc index c8d25e9da5..350d13d478 100644 --- a/test/decompiler/reference/jak2/engine/level/region-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/level/region-h_REF.gc @@ -4,9 +4,9 @@ ;; definition of type region (deftype region (structure) ((id uint32 :offset-assert 0) - (on-enter basic :offset-assert 4) - (on-inside basic :offset-assert 8) - (on-exit basic :offset-assert 12) + (on-enter pair :offset-assert 4) + (on-inside pair :offset-assert 8) + (on-exit pair :offset-assert 12) ) :method-count-assert 10 :size-assert #x10 diff --git a/test/decompiler/reference/jak2/engine/load/load-state_REF.gc b/test/decompiler/reference/jak2/engine/load/load-state_REF.gc index a41c5ed258..91a3a1d293 100644 --- a/test/decompiler/reference/jak2/engine/load/load-state_REF.gc +++ b/test/decompiler/reference/jak2/engine/load/load-state_REF.gc @@ -149,6 +149,18 @@ ;; definition for method 21 of type load-state ;; WARN: Return type mismatch int vs none. +;; WARN: Failed store: (s.w! (+ v1-22 12) a0-5) at op 48 +;; WARN: Failed store: (s.w! (+ a1-4 12) v1-25) at op 56 +;; WARN: Failed store: (s.w! (+ a1-8 12) v1-28) at op 64 +;; WARN: Failed store: (s.w! (+ a1-12 12) v1-31) at op 72 +;; WARN: Failed store: (s.w! (+ a2-4 12) a1-21) at op 97 +;; WARN: Failed store: (s.w! (+ a2-8 12) a1-25) at op 109 +;; WARN: Failed store: (s.w! (+ a1-31 12) #f) at op 114 +;; WARN: Failed store: (s.w! (+ a1-35 12) #f) at op 119 +;; WARN: Failed load: (set! a0-11 (l.wu (+ a0-10 12))) at op 138 +;; WARN: Failed load: (set! a0-16 (l.wu (+ a0-15 12))) at op 146 +;; WARN: Failed load: (set! a0-21 (l.wu (+ a0-20 12))) at op 154 +;; WARN: Failed load: (set! a0-26 (l.wu (+ a0-25 12))) at op 162 (defmethod add-borrow-levels load-state ((obj load-state)) (dotimes (s5-0 6) (let ((a0-1 (-> obj want s5-0 name))) @@ -353,7 +365,3 @@ ;; failed to figure out what this is: (kmemclose) - - - - diff --git a/test/decompiler/reference/jak2/engine/load/loader-h_REF.gc b/test/decompiler/reference/jak2/engine/load/loader-h_REF.gc index 0d310af778..13b6d5e2d1 100644 --- a/test/decompiler/reference/jak2/engine/load/loader-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/load/loader-h_REF.gc @@ -167,7 +167,7 @@ ) (format #t "[~8x] ~A~%" obj (-> obj type)) (format #t "~1Tname: ~A~%" (-> obj name)) - (format #t "~1Tanim-name: ~A~%" (-> obj buffer)) + (format #t "~1Tanim-name: ~A~%" (-> obj anim-name)) (format #t "~1Tparts: ~D~%" (-> obj parts)) (format #t "~1Thint-id: ~D~%" (-> obj parts)) (format #t "~1Tpriority: ~f~%" (-> obj priority)) diff --git a/test/decompiler/reference/jak2/engine/load/loader_REF.gc b/test/decompiler/reference/jak2/engine/load/loader_REF.gc index f35ee993ec..e0f0d7b317 100644 --- a/test/decompiler/reference/jak2/engine/load/loader_REF.gc +++ b/test/decompiler/reference/jak2/engine/load/loader_REF.gc @@ -552,7 +552,7 @@ (set! (-> obj buffer v1-5 frame-lock) #f) ) (dotimes (v1-8 3) - (set! (-> obj rec v1-8 buffer) #f) + (set! (-> obj rec v1-8 anim-name) #f) ) (dotimes (s4-0 2) (let ((s3-0 (-> obj rec s4-0))) @@ -562,7 +562,7 @@ (not (-> obj buffer s2-0 frame-lock)) ) (set! (-> obj buffer s2-0 frame-lock) #t) - (set! (-> s3-0 buffer) (-> obj buffer s2-0)) + (set! (-> s3-0 anim-name) (-> obj buffer s2-0)) (set! (-> obj buffer s2-0 pending-load-file-owner) (-> s3-0 owner)) (set! (-> obj buffer s2-0 load-file-owner) (-> s3-0 owner)) (set! (-> obj buffer s2-0 pending-load-file-priority) (-> s3-0 priority)) @@ -576,7 +576,7 @@ ) (dotimes (s4-1 2) (let ((s3-1 (-> obj rec s4-1))) - (when (and (-> s3-1 name) (not (-> s3-1 buffer))) + (when (and (-> s3-1 name) (not (-> s3-1 anim-name))) (if (and (not *preload-spool-anims*) (>= (-> s3-1 priority) 0.0)) (goto cfg-46) ) @@ -590,7 +590,7 @@ (-> s3-1 owner) (-> s3-1 priority) ) - (set! (-> s3-1 buffer) (-> obj buffer s2-1)) + (set! (-> s3-1 anim-name) (-> obj buffer s2-1)) (goto cfg-46) ) ) @@ -599,13 +599,19 @@ (label cfg-46) ) (when (not (-> obj reserve-buffer)) - (let ((s4-2 (-> obj rec 0 buffer))) + (let ((s4-2 (-> obj rec 0 anim-name))) (if (and s4-2 - (-> s4-2 locked?) - (not (string= (-> s4-2 pending-load-file) "reserved")) - (not (string= (-> s4-2 other pending-load-file) "reserved")) + (-> (the-as external-art-buffer s4-2) locked?) + (not (string= (-> (the-as external-art-buffer s4-2) pending-load-file) "reserved")) + (not (string= (-> (the-as external-art-buffer s4-2) other pending-load-file) "reserved")) ) - (set-pending-file (-> s4-2 other) (the-as string #f) -1 (the-as handle #f) 100000000.0) + (set-pending-file + (-> (the-as external-art-buffer s4-2) other) + (the-as string #f) + -1 + (the-as handle #f) + 100000000.0 + ) ) ) ) @@ -1060,7 +1066,7 @@ -20.0 (-> gp-0 sid) ) - (let ((s5-8 (get-art-by-name (-> self draw art-group) (the-as string (-> gp-0 anim buffer)) art-joint-anim))) + (let ((s5-8 (get-art-by-name (-> self draw art-group) (the-as string (-> gp-0 anim anim-name)) art-joint-anim))) (cond (s5-8 (ja-channel-set! 1) diff --git a/test/decompiler/reference/jak2/engine/physics/trajectory-h_REF.gc b/test/decompiler/reference/jak2/engine/physics/trajectory-h_REF.gc index 0deb829dca..336eaf038d 100644 --- a/test/decompiler/reference/jak2/engine/physics/trajectory-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/physics/trajectory-h_REF.gc @@ -147,7 +147,7 @@ :flag-assert #xe00000030 (:methods (combo-tracker-method-12 (_type_ vector vector process time-frame) combo-tracker 12) - (combo-tracker-method-13 (_type_ handle vector float vector float) none 13) + (combo-tracker-method-13 (_type_ handle vector float vector float) basic 13) ) ) diff --git a/test/decompiler/reference/jak2/engine/physics/trajectory_REF.gc b/test/decompiler/reference/jak2/engine/physics/trajectory_REF.gc index 46b8cc90df..e2bd9309d6 100644 --- a/test/decompiler/reference/jak2/engine/physics/trajectory_REF.gc +++ b/test/decompiler/reference/jak2/engine/physics/trajectory_REF.gc @@ -259,13 +259,12 @@ ) ;; definition for method 13 of type combo-tracker -;; WARN: Return type mismatch basic vs none. (defmethod combo-tracker-method-13 combo-tracker ((obj combo-tracker) (arg0 handle) (arg1 vector) (arg2 float) (arg3 vector) (arg4 float)) (cond ((send-event (handle->process arg0) 'combo) (let ((gp-1 (handle->process arg0))) (if (type? gp-1 process-focusable) - (empty) + gp-1 ) ) ) @@ -303,13 +302,12 @@ ) ) (if (type? gp-2 process-focusable) - (empty) + gp-2 ) ) ) ) ) - (none) ) ;; definition for method 12 of type combo-tracker 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 a12f8d6e8c..f00d777410 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 @@ -13,8 +13,8 @@ (get-trans (_type_ int) vector 20) (get-quat (_type_ int) quaternion 21) (get-transv (_type_) vector 22) - (process-focusable-method-23 (_type_) none 23) - (process-focusable-method-24 (_type_) float 24) + (process-focusable-method-23 (_type_ int) int 23) + (get-water-height (_type_) meters 24) (process-focusable-method-25 (_type_) time-frame 25) (process-focusable-method-26 (_type_) float 26) ) @@ -68,15 +68,14 @@ ) ;; definition for method 23 of type process-focusable -;; WARN: Return type mismatch int vs none. -(defmethod process-focusable-method-23 process-focusable ((obj process-focusable)) +(defmethod process-focusable-method-23 process-focusable ((obj process-focusable) (arg0 int)) 0 - (none) ) ;; definition for method 24 of type process-focusable -(defmethod process-focusable-method-24 process-focusable ((obj process-focusable)) - 0.0 +;; 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 diff --git a/test/decompiler/reference/jak2/engine/target/board/board-h_REF.gc b/test/decompiler/reference/jak2/engine/target/board/board-h_REF.gc index d0a6cbb632..9dd96c9aee 100644 --- a/test/decompiler/reference/jak2/engine/target/board/board-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/board/board-h_REF.gc @@ -423,9 +423,7 @@ (not (logtest? (state-flags sf17) (-> self state-flags))) (< (-> self board board-time) (-> self control unknown-time-frame05)) (not (logtest? (surface-flag no-board) (-> self control unknown-surface01 flags))) - (or (not (logtest? (-> self control unknown-surface01 flags) (surface-flag duck))) - (begin self (can-exit-duck?)) - ) + (or (not (logtest? (-> self control unknown-surface01 flags) (surface-flag duck))) (can-exit-duck? self)) (not (and (logtest? (-> self water flags) (water-flags under-water)) (zero? (logand (-> self water flags) (water-flags swim-ground))) ) @@ -462,7 +460,7 @@ (set! (-> v1-55 ignore-process0) #f) (set! (-> v1-55 ignore-process1) #f) (set! (-> v1-55 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) - (set! (-> v1-55 solid-only) #t) + (set! (-> v1-55 best-my-prim) (the-as collide-shape-prim #t)) (set! (-> v1-55 action-mask) (collide-action solid)) ) ) @@ -480,25 +478,13 @@ ) ;; failed to figure out what this is: -(let ((a0-6 (new 'static 'skeleton-group - :name "skel-board" - :extra #f - :info #f - :art-group-name "board" - :bounds (new 'static 'vector :w 14336.0) - :version #x7 +(defskelgroup skel-board board 0 5 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 3.5) :shadow 2 :sort 1 :origin-joint-index 3 ) - ) - ) - (set! (-> a0-6 jgeo) 0) - (set! (-> a0-6 janim) 5) - (set! (-> a0-6 mgeo 0) 1) - (set! (-> a0-6 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-6) - ) ;; definition for symbol *board-shadow-control*, type shadow-control (define *board-shadow-control* diff --git a/test/decompiler/reference/jak2/engine/target/board/board-states_REF.gc b/test/decompiler/reference/jak2/engine/target/board/board-states_REF.gc index 269f69d708..ea27cef4e3 100644 --- a/test/decompiler/reference/jak2/engine/target/board/board-states_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/board/board-states_REF.gc @@ -295,7 +295,7 @@ ;; definition for function target-board-resolve-points ;; WARN: Return type mismatch int vs none. -(defbehavior target-board-resolve-points target ((arg0 float) (arg1 float) (arg2 float) (arg3 float)) +(defbehavior target-board-resolve-points target () (when (= (-> self board main mode) (joint-mod-mode rotate)) (let ((f0-1 (fabs (-> self board troty-cum)))) (cond @@ -323,12 +323,7 @@ ;; definition for function target-board-ground-check ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs none. -;; ERROR: Function may read a register that is not set: a0 -;; ERROR: Function may read a register that is not set: a1 -;; ERROR: Function may read a register that is not set: a2 -;; ERROR: Function may read a register that is not set: a3 (defbehavior target-board-ground-check target () - (local-vars (a0-4 object) (a1-0 object) (a2-3 number) (a3-0 number)) (when (board-on-ground?) (when (!= (-> self board troty-cum) 0.0) (let ((f30-0 (fabs (-> self board troty-cum))) @@ -338,131 +333,101 @@ (if (< (- (-> self clock frame-counter) (-> self board halfpipe-time)) (seconds 0.1)) (set! f28-0 (+ 32768.0 f28-0)) ) - (let ((t9-3 deg-diff)) - (set! a0-4 f0-2) - (set! a1-0 f28-0) - (let ((f0-5 (fabs (t9-3 (the-as float a0-4) (the-as float a1-0))))) - (when (and (>= f30-0 49152.0) (>= 4551.1113 f0-5)) - (cond - ((>= f30-0 191146.67) - (add-to-trick-list (-> self board) (board-tricks board-boost) 2000.0) - ) - ((>= f30-0 126520.89) - (add-to-trick-list (-> self board) (board-tricks board-boost) 1000.0) - ) - (else - (add-to-trick-list (-> self board) (board-tricks board-boost) 500.0) - ) + (let ((f0-5 (fabs (deg-diff f0-2 f28-0)))) + (when (and (>= f30-0 49152.0) (>= 4551.1113 f0-5)) + (cond + ((>= f30-0 191146.67) + (add-to-trick-list (-> self board) (board-tricks board-boost) 2000.0) + ) + ((>= f30-0 126520.89) + (add-to-trick-list (-> self board) (board-tricks board-boost) 1000.0) + ) + (else + (add-to-trick-list (-> self board) (board-tricks board-boost) 500.0) ) - (let ((t9-7 lerp-scale) - (a0-8 20480.0) - (a1-4 40960.0) - ) - (set! a2-3 f30-0) - (set! a3-0 49152.0) - (let ((f0-8 (t9-7 a0-8 a1-4 (the-as float a2-3) (the-as float a3-0) 182044.44)) - (v1-28 (-> self control transv)) + ) + (let ((f0-8 (lerp-scale 20480.0 40960.0 f30-0 49152.0 182044.44))) + (vector+float*! + (-> self control transv) + (-> self control transv) + (-> self control unknown-matrix01 vector 2) + f0-8 + ) + ) + (if (< (vector-length (-> self control transv)) 114688.0) + (vector-normalize! (-> self control transv) 114688.0) + ) + (when (not (logtest? (-> self control old-status) (cshape-moving-flags on-surface))) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (set! (-> gp-0 quad) (-> self control trans quad)) + (set! (-> gp-0 y) (+ 2048.0 (-> gp-0 y))) + (let ((s5-0 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-0 + (let ((t9-10 (method-of-type part-tracker activate))) + (t9-10 (the-as part-tracker s5-0) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) ) - (set! a0-4 (-> self control transv)) - (set! a1-0 (-> self control unknown-matrix01 vector 2)) - (vector+float*! v1-28 (the-as vector a0-4) (the-as vector a1-0) f0-8) - ) - ) - (when (< (vector-length (-> self control transv)) 114688.0) - (let ((t9-8 vector-normalize!)) - (set! a0-4 (-> self control transv)) - (set! a1-0 114688.0) - (t9-8 (the-as vector a0-4) (the-as float a1-0)) - ) - ) - (when (not (logtest? (-> self control old-status) (cshape-moving-flags on-surface))) - (let ((gp-0 (new 'stack-no-clear 'vector))) - (set! (-> gp-0 quad) (-> self control trans quad)) - (set! (-> gp-0 y) (+ 2048.0 (-> gp-0 y))) - (let ((s5-0 (get-process *default-dead-pool* part-tracker #x4000))) - (when s5-0 - (let ((t9-10 (method-of-type part-tracker activate))) - (t9-10 (the-as part-tracker s5-0) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) - ) - (let ((t9-11 run-function-in-process) - (a0-12 s5-0) - (a1-8 part-tracker-init) - (a2-8 (-> *part-group-id-table* 119)) - (a3-2 0) - (t0-1 #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-11) - a0-12 - a1-8 - a2-8 - a3-2 - t0-1 - t1-0 - t2-0 - t3-0 - ) - ) - (-> s5-0 ppointer) + (let ((t9-11 run-function-in-process) + (a0-14 s5-0) + (a1-10 part-tracker-init) + (a2-8 (-> *part-group-id-table* 119)) + (a3-2 0) + (t0-1 #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-11) + a0-14 + a1-10 + a2-8 + a3-2 + t0-1 + t1-0 + t2-0 + t3-0 + ) ) + (-> s5-0 ppointer) ) - (let* ((s4-0 (get-process *default-dead-pool* manipy #x4000)) - (s5-1 - (when s4-0 - (let ((t9-13 (method-of-type manipy activate))) - (t9-13 (the-as manipy s4-0) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((s5-2 run-function-in-process) - (s3-0 s4-0) - (s2-0 manipy-init) - (s1-0 (-> self entity)) - (t0-2 (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f))) - (t1-1 #f) - ) - 0 - ((the-as (function object object object object object object none) s5-2) s3-0 s2-0 gp-0 s1-0 t0-2 t1-1) - ) - (-> s4-0 ppointer) + ) + (let* ((s4-0 (get-process *default-dead-pool* manipy #x4000)) + (s5-1 + (when s4-0 + (let ((t9-13 (method-of-type manipy activate))) + (t9-13 (the-as manipy s4-0) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) ) + (let ((s5-2 run-function-in-process) + (s3-0 s4-0) + (s2-0 manipy-init) + (s1-0 (-> self entity)) + (t0-2 (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f))) + (t1-1 #f) + ) + 0 + ((the-as (function object object object object object object none) s5-2) s3-0 s2-0 gp-0 s1-0 t0-2 t1-1) + ) + (-> s4-0 ppointer) ) ) - (when s5-1 - (quaternion-copy! (-> (the-as board (-> s5-1 0)) root quat) (-> self control unknown-quaternion00)) - (send-event (ppointer->process s5-1) 'anim-mode 'play1) - (send-event (ppointer->process s5-1) 'anim "idle") - (send-event (ppointer->process s5-1) 'speed #x3fc00000) - (set-vector! (-> (the-as board (-> s5-1 0)) root scale) 0.2 0.4 0.2 1.0) - ) - ) - ) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.3)) - (let ((gp-1 sound-play-by-name)) - (let ((s5-3 (make-u128 #x74736f (the-as uint #x6f622d6472616f62)))) - (set! a1-0 (new-sound-id)) - (set! a2-3 1024) - (set! a3-0 0) - (set! a0-4 s5-3) - ) - (gp-1 - (the-as sound-name a0-4) - (the-as sound-id a1-0) - (the-as int a2-3) - (the-as int a3-0) - 0 - (sound-group sfx) - #t + ) + (when s5-1 + (quaternion-copy! (-> (the-as board (-> s5-1 0)) root quat) (-> self control unknown-quaternion00)) + (send-event (ppointer->process s5-1) 'anim-mode 'play1) + (send-event (ppointer->process s5-1) 'anim "idle") + (send-event (ppointer->process s5-1) 'speed #x3fc00000) + (set-vector! (-> (the-as board (-> s5-1 0)) root scale) 0.2 0.4 0.2 1.0) ) ) ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.3)) + (sound-play "board-boost") ) ) ) ) ) - (target-board-resolve-points (the-as float a0-4) (the-as float a1-0) (the-as float a2-3) (the-as float a3-0)) + (target-board-resolve-points) ) (set! (-> self board turn-anim-tilt?) #t) (none) @@ -698,42 +663,44 @@ ) :code (behavior () (let ((gp-0 (-> self board stance-info))) - (let ((f30-0 (the-as number 0.0)) - (s5-0 30) - (v1-3 (ja-group)) - ) - (when (not (and (and v1-3 (= v1-3 (-> self draw art-group data 161))) (= (ja-group-size) 4))) - (let ((v1-10 (ja-group))) - (when (and v1-10 (= v1-10 (-> self draw art-group data 170))) - (ja-channel-set! 1) - (ja-no-eval :group! (-> self draw art-group data 190) - :num! (seek! - (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 190)) frames num-frames) -1)) - 1.8 - ) - :frame-num 0.0 - ) - (until (ja-done? 0) - (suspend) - (ja :num! (seek! max 1.8)) - ) - (suspend) - (set! (-> self board turn-anim-duck) 1.0) - (set! (-> self board turn-anim-duck-vel) 15.0) + (let ((f30-0 0.0)) + (let ((s5-0 30) + (v1-3 (ja-group)) ) + (when (not (and (and v1-3 (= v1-3 (-> self draw art-group data 161))) (= (ja-group-size) 4))) + (let ((v1-10 (ja-group))) + (when (and v1-10 (= v1-10 (-> self draw art-group data 170))) + (ja-channel-set! 1) + (ja-no-eval :group! (-> self draw art-group data 190) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 190)) frames num-frames) -1)) + 1.8 + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 1.8)) + ) + (suspend) + (set! (-> self board turn-anim-duck) 1.0) + (set! (-> self board turn-anim-duck-vel) 15.0) + ) + ) + (ja-channel-push! 4 (the-as time-frame s5-0)) + (set! f30-0 (ja-frame-num 0)) ) - (ja-channel-push! 4 (the-as time-frame s5-0)) - (set! f30-0 (ja-frame-num 0)) ) - ) - (ground-tween-initialize - gp-0 - (the-as uint 0) - (the-as uint (-> self draw art-group data 153)) - (the-as uint (-> self draw art-group data 163)) - (the-as uint (-> self draw art-group data 164)) - (the-as uint (-> self draw art-group data 162)) - (the-as uint (-> self draw art-group data 161)) + (ground-tween-initialize + gp-0 + (the-as uint 0) + (the-as uint (-> self draw art-group data 153)) + (the-as uint (-> self draw art-group data 163)) + (the-as uint (-> self draw art-group data 164)) + (the-as uint (-> self draw art-group data 162)) + (the-as uint (-> self draw art-group data 161)) + f30-0 + ) ) (ja :chan 3 :group! (-> self draw art-group data 152)) (until #f @@ -750,14 +717,7 @@ (set! f0-10 0.0) ) ) - (let ((t9-9 ground-tween-update) - (a0-24 gp-0) - (a1-4 f0-10) - (a2-3 f1-2) - ) - #x3dcccccd - (t9-9 a0-24 a1-4 a2-3) - ) + (ground-tween-update gp-0 f0-10 f1-2 0.1) ) (ja :chan 1 :num! (chan 0)) (ja :chan 2 :num! (chan 0)) @@ -823,7 +783,7 @@ (the-as time-frame (-> *TARGET-bank* ground-timeout)) ) ) - (begin self (can-exit-duck?)) + (can-exit-duck? self) ) (go target-board-stance) ) @@ -3088,9 +3048,7 @@ (('change-mode) (case (-> event param 0) (('normal) - enter-state - 'stance - (go target-grab) + (go target-grab 'stance) ) ) ) @@ -3196,7 +3154,7 @@ ) (none) ) - :code (behavior ((arg0 vector)) + :code (behavior ((arg0 vector) (arg1 attack-info)) (logclear! (-> self water flags) (water-flags jump-out)) (logclear! (-> self focus-status) (focus-status halfpipe)) (set! (-> self state-time) (-> self clock frame-counter)) @@ -3224,8 +3182,7 @@ ) ) ) - self - ((method-of-type attack-info attack-info-method-11)) + (combine! gp-0 arg1 self) (when (not (logtest? (-> gp-0 mask) (attack-info-mask vector))) (vector-z-quaternion! (-> gp-0 vector) (-> self control unknown-quaternion00)) (vector-xz-normalize! (-> gp-0 vector) (- (fabs (-> gp-0 shove-back)))) diff --git a/test/decompiler/reference/jak2/engine/target/darkjak-h_REF.gc b/test/decompiler/reference/jak2/engine/target/darkjak-h_REF.gc index c086700fc9..cafa40db81 100644 --- a/test/decompiler/reference/jak2/engine/target/darkjak-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/darkjak-h_REF.gc @@ -3,25 +3,25 @@ ;; definition of type darkjak-info (deftype darkjak-info (basic) - ((process uint32 :offset-assert 4) - (attack-id uint32 :offset-assert 8) - (start-time time-frame :offset-assert 16) - (attack-time time-frame :offset-assert 24) - (attack-count uint64 :offset-assert 32) - (stage uint32 :offset-assert 40) - (want-stage uint32 :offset-assert 44) - (clock-pos float :offset-assert 48) - (clock-vel float :offset-assert 52) - (clock-on symbol :offset-assert 56) - (hud handle 1 :offset 64) - (tone uint32 :offset 72) - (bomb uint32 :offset 76) + ((process (pointer target) :offset-assert 4) + (attack-id uint32 :offset-assert 8) + (start-time time-frame :offset-assert 16) + (attack-time time-frame :offset-assert 24) + (attack-count uint64 :offset-assert 32) + (stage uint32 :offset-assert 40) + (want-stage uint32 :offset-assert 44) + (clock-pos float :offset-assert 48) + (clock-vel float :offset-assert 52) + (clock-on symbol :offset-assert 56) + (hud handle 1 :offset 64) + (tone uint32 :offset 72) + (bomb uint32 :offset 76) ) :method-count-assert 10 :size-assert #x50 :flag-assert #xa00000050 (:methods - (darkjak-info-method-9 (_type_ int) none :behavior target 9) + (update-clock! (_type_ int) none :behavior target 9) ) ) diff --git a/test/decompiler/reference/jak2/engine/target/gun/gun-h_REF.gc b/test/decompiler/reference/jak2/engine/target/gun/gun-h_REF.gc index 857e3b571a..5dacdf53c7 100644 --- a/test/decompiler/reference/jak2/engine/target/gun/gun-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/gun/gun-h_REF.gc @@ -127,7 +127,7 @@ (charge-ammo float :offset-assert 672) (charge-start-time time-frame :offset-assert 680) (charge-inc-time time-frame :offset-assert 688) - (charge-active? uint64 :offset-assert 696) + (charge-active? handle :offset-assert 696) ) :method-count-assert 10 :size-assert #x2c0 @@ -472,7 +472,7 @@ (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-yellow gun-red gun-blue gun-dark)) (-> arg0 game features) ) - (or (not (logtest? (-> arg0 control unknown-surface01 flags) (surface-flag duck))) (can-exit-duck?)) + (or (not (logtest? (-> arg0 control unknown-surface01 flags) (surface-flag duck))) (can-exit-duck? arg0)) (or (not (logtest? (focus-status pilot) (-> arg0 focus-status))) (-> arg0 pilot gun?)) (or arg1 (nonzero? (-> arg0 gun using-gun-type)) @@ -533,25 +533,13 @@ ) ;; failed to figure out what this is: -(let ((a0-5 (new 'static 'skeleton-group - :name "skel-gun" - :extra #f - :info #f - :art-group-name "gun" - :bounds (new 'static 'vector :w 6144.0) - :version #x7 - :shadow #xb +(defskelgroup skel-gun gun 9 -1 + ((10 (meters 999999))) + :bounds (static-spherem 0 0 0 1.5) + :shadow 11 :sort 1 :origin-joint-index 3 ) - ) - ) - (set! (-> a0-5 jgeo) 9) - (set! (-> a0-5 janim) -1) - (set! (-> a0-5 mgeo 0) 10) - (set! (-> a0-5 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-5) - ) ;; definition for symbol *gun-shadow-control*, type shadow-control (define *gun-shadow-control* @@ -565,100 +553,40 @@ ) ;; failed to figure out what this is: -(let ((a0-6 (new 'static 'skeleton-group - :name "skel-ammo-yellow" - :extra #f - :info #f - :art-group-name "gun" - :bounds (new 'static 'vector :w 4096.0) - :texture-level #x6 - :version #x7 +(defskelgroup skel-ammo-yellow gun 0 8 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 1) + :texture-level 6 :sort 1 ) - ) - ) - (set! (-> a0-6 jgeo) 0) - (set! (-> a0-6 janim) 8) - (set! (-> a0-6 mgeo 0) 1) - (set! (-> a0-6 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-6) - ) ;; failed to figure out what this is: -(let ((a0-7 (new 'static 'skeleton-group - :name "skel-ammo-red" - :extra #f - :info #f - :art-group-name "gun" - :bounds (new 'static 'vector :w 4096.0) - :texture-level #x6 - :version #x7 +(defskelgroup skel-ammo-red gun 2 8 + ((3 (meters 999999))) + :bounds (static-spherem 0 0 0 1) + :texture-level 6 :sort 1 ) - ) - ) - (set! (-> a0-7 jgeo) 2) - (set! (-> a0-7 janim) 8) - (set! (-> a0-7 mgeo 0) 3) - (set! (-> a0-7 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-7) - ) ;; failed to figure out what this is: -(let ((a0-8 (new 'static 'skeleton-group - :name "skel-ammo-blue" - :extra #f - :info #f - :art-group-name "gun" - :bounds (new 'static 'vector :w 4096.0) - :texture-level #x6 - :version #x7 +(defskelgroup skel-ammo-blue gun 4 8 + ((5 (meters 999999))) + :bounds (static-spherem 0 0 0 1) + :texture-level 6 :sort 1 ) - ) - ) - (set! (-> a0-8 jgeo) 4) - (set! (-> a0-8 janim) 8) - (set! (-> a0-8 mgeo 0) 5) - (set! (-> a0-8 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-8) - ) ;; failed to figure out what this is: -(let ((a0-9 (new 'static 'skeleton-group - :name "skel-ammo-dark" - :extra #f - :info #f - :art-group-name "gun" - :bounds (new 'static 'vector :w 4096.0) - :texture-level #x6 - :version #x7 +(defskelgroup skel-ammo-dark gun 6 8 + ((7 (meters 999999))) + :bounds (static-spherem 0 0 0 1) + :texture-level 6 :sort 1 ) - ) - ) - (set! (-> a0-9 jgeo) 6) - (set! (-> a0-9 janim) 8) - (set! (-> a0-9 mgeo 0) 7) - (set! (-> a0-9 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-9) - ) ;; failed to figure out what this is: -(let ((a0-10 (new 'static 'skeleton-group - :name "skel-gun-red-cone" - :extra #f - :info #f - :art-group-name "gun" - :bounds (new 'static 'vector :w 4096.0) - :texture-level #x6 - :version #x7 - ) - ) - ) - (set! (-> a0-10 jgeo) 40) - (set! (-> a0-10 janim) 42) - (set! (-> a0-10 mgeo 0) 41) - (set! (-> a0-10 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-10) - ) +(defskelgroup skel-gun-red-cone gun 40 42 + ((41 (meters 999999))) + :bounds (static-spherem 0 0 0 1) + :texture-level 6 + ) diff --git a/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc b/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc index 2124326a17..111c22669e 100644 --- a/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc @@ -3313,9 +3313,9 @@ ) (let ((v1-69 (-> obj control))) (set! (-> v1-69 unknown-word08) s4-0) - (set! (-> v1-69 unknown-word10) s3-0) - (set! (-> v1-69 unknown-word09) s2-0) - (set! (-> v1-69 unknown-word11) s1-0) + (set! (-> v1-69 unknown-word09) s3-0) + (set! (-> v1-69 unknown-sphere000) (the-as sphere s2-0)) + (set! (-> v1-69 unknown-word10) (the-as uint s1-0)) (set! (-> v1-69 max-iteration-count) (the-as uint 8)) (set! (-> v1-69 event-self) 'touched) ) @@ -3329,7 +3329,7 @@ (set! (-> obj control unknown-surface01 name) 'current) (set! (-> obj control unknown-surface01 active-hook) nothing) (set! (-> obj control unknown-surface01 touch-hook) nothing) - (set! (-> obj control unknown-dword06) (the-as uint #f)) + (set! (-> obj control unknown-dword06) (the-as handle #f)) (dotimes (v1-84 8) (set! (-> obj attack-info-old v1-84 attacker) (the-as handle #f)) ) @@ -3353,16 +3353,17 @@ (logior! (-> obj skel status) (joint-control-status sync-math blend-shape eye-anim)) (set! (-> obj draw shadow-ctrl) *target-shadow-control*) (set! (-> obj shadow-backup) (-> obj draw shadow)) - (let ((t9-24 (method-of-type carry-info new)) - (a0-65 'process) - (a1-23 carry-info) + (set! (-> obj carry) + (new + 'process + 'carry-info + obj + 41 + (the-as vector (new 'static 'array float 1 0.0)) + (the-as vector (new 'static 'array float 1 0.0)) + 12743.111 + ) ) - 41 - (new 'static 'array float 1 0.0) - (new 'static 'array float 1 0.0) - #x46471c72 - (set! (-> obj carry) (t9-24 a0-65 a1-23)) - ) (set! (-> obj control unknown-vector29 x) (the-as float (-> obj node-list data 45))) (set! (-> obj control unknown-vector29 y) (the-as float (-> obj node-list data 55))) (set! (-> obj control unknown-vector29 y) (the-as float (-> obj node-list data 55))) @@ -3433,7 +3434,7 @@ (level-setup) (set! (-> obj pre-joint-hook) (the-as (function none :behavior target) nothing)) (set! (-> obj init-time) (-> self clock frame-counter)) - (set! (-> obj spool-anim) #t) + (set! (-> obj spool-anim) (the-as spool-anim #t)) (set! (-> obj ambient-time) (-> self clock frame-counter)) 0 (none) diff --git a/test/decompiler/reference/jak2/engine/target/mech_suit/mech-h_REF.gc b/test/decompiler/reference/jak2/engine/target/mech_suit/mech-h_REF.gc index 4db11f727c..5ffb02de4b 100644 --- a/test/decompiler/reference/jak2/engine/target/mech_suit/mech-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/mech_suit/mech-h_REF.gc @@ -109,25 +109,13 @@ ) ;; failed to figure out what this is: -(let ((a0-2 (new 'static 'skeleton-group - :name "skel-mech" - :extra #f - :info #f - :art-group-name "mech" - :bounds (new 'static 'vector :w 18432.0) - :version #x7 +(defskelgroup skel-mech mech 0 3 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 4.5) :shadow 2 :origin-joint-index 3 :shadow-joint-index 3 ) - ) - ) - (set! (-> a0-2 jgeo) 0) - (set! (-> a0-2 janim) 3) - (set! (-> a0-2 mgeo 0) 1) - (set! (-> a0-2 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-2) - ) ;; definition for symbol *mech-shadow-control*, type shadow-control (define *mech-shadow-control* @@ -141,23 +129,11 @@ ) ;; failed to figure out what this is: -(let ((a0-3 (new 'static 'skeleton-group - :name "skel-mech-explode" - :extra #f - :info #f - :art-group-name "mech" - :bounds (new 'static 'vector :w 18432.0) - :version #x7 +(defskelgroup skel-mech-explode mech 39 41 + ((40 (meters 999999))) + :bounds (static-spherem 0 0 0 4.5) :origin-joint-index 3 ) - ) - ) - (set! (-> a0-3 jgeo) 39) - (set! (-> a0-3 janim) 41) - (set! (-> a0-3 mgeo 0) 40) - (set! (-> a0-3 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-3) - ) ;; failed to figure out what this is: 0 diff --git a/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc b/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc new file mode 100644 index 0000000000..e3f6767f4c --- /dev/null +++ b/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc @@ -0,0 +1,2058 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for function target-darkjak-setup +;; WARN: Return type mismatch int vs none. +(defbehavior target-darkjak-setup target ((arg0 symbol)) + (when (zero? (-> self darkjak)) + (set! (-> self darkjak) (new 'process 'darkjak-info)) + (set! (-> self darkjak process) (the-as (pointer target) (process->ppointer self))) + (let* ((v1-4 (-> self game)) + (a0-5 (+ (-> v1-4 attack-id) 1)) + ) + (set! (-> v1-4 attack-id) a0-5) + (set! (-> self darkjak attack-id) a0-5) + ) + (set! (-> self darkjak hud 0) (the-as handle #f)) + (set! (-> self darkjak tone) (the-as uint (new-sound-id))) + (set! (-> self darkjak-giant-interp) 1.0) + ) + 0 + (none) + ) + +;; definition for function want-to-darkjak? +(defbehavior want-to-darkjak? target () + (and (cpad-pressed? (-> self control unknown-cpad-info00 number) l2) + (not *pause-lock*) + (-> *setting-control* user-current darkjak) + (logtest? (-> self game features) (game-feature darkjak)) + (not (logtest? (focus-status + dead + hit + grabbed + in-head + under-water + edge-grab + pole + flut + tube + board + pilot + mech + carry + indax + teleporting + ) + (-> self focus-status) + ) + ) + (not (and (logtest? (-> self water flags) (water-flags under-water)) + (zero? (logand (-> self water flags) (water-flags swim-ground))) + ) + ) + (or (and (not (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak)))) + (and (>= (- (-> self clock frame-counter) (-> (the-as fact-info-target (-> self fact)) darkjak-start-time)) + (seconds 0.05) + ) + (>= (-> self game eco-pill-dark) (-> *FACT-bank* eco-pill-dark-max-default)) + ) + ) + (and (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (not (and (logtest? (focus-status dark) (-> self focus-status)) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) 32) + ) + ) + (logtest? (game-feature darkjak-giant) (-> self game features)) + ) + ) + ) + ) + +;; failed to figure out what this is: +(let ((v1-3 (copy *walk-mods* 'global))) + (set! (-> v1-3 name) 'darkjak) + (set! (-> v1-3 flags) (surface-flag gun-off)) + (set! *darkjak-trans-mods* v1-3) + ) + +;; definition for function target-darkjak-end-mode +;; WARN: Return type mismatch int vs none. +(defbehavior target-darkjak-end-mode target () + (when (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (logclear! (-> self focus-status) (focus-status dark)) + (send-event self 'reset-collide) + (logclear! (-> self state-flags) (state-flags sf4)) + (remove-setting! 'sound-flava) + (remove-setting! 'string-min-length) + (remove-setting! 'string-max-length) + (remove-setting! 'string-spline-max-move) + (remove-setting! 'string-spline-accel) + (remove-setting! 'string-spline-max-move-player) + (remove-setting! 'string-spline-accel-player) + (sound-stop (the-as sound-id (-> self darkjak tone))) + ) + 0 + (none) + ) + +;; definition for function target-darkjak-process +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior target-darkjak-process target ((arg0 object) (arg1 object) (arg2 object) (arg3 object) (arg4 object) (arg5 object) (arg6 float)) + (local-vars (gp-0 vector)) + (cond + ((and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (let ((a1-1 'eco-red)) + (target-danger-set! (-> self control unknown-symbol04) a1-1) + ) + (collide-shape-method-46 (-> self control)) + (let ((a1-2 (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> a1-2 options) (overlaps-others-options)) + (set! (-> a1-2 collide-with-filter) (the-as collide-spec -1)) + (set! (-> a1-2 tlist) *touching-list*) + (find-overlapping-shapes (-> self control) a1-2) + ) + (target-danger-set! (-> self control unknown-symbol04) #f) + (collide-shape-method-46 (-> self control)) + (if (and (or (>= (- (-> self clock frame-counter) (-> (the-as fact-info-target (-> self fact)) darkjak-start-time)) + (-> (the-as fact-info-target (-> self fact)) darkjak-effect-time) + ) + (not (-> *setting-control* user-current darkjak)) + ) + (not (logtest? (-> self focus-status) (focus-status dead dangerous hit grabbed))) + (not (and (-> self next-state) (= (-> self next-state name) 'target-darkjak-get-off))) + (zero? (logand (-> self darkjak stage) 1)) + ) + (go target-darkjak-get-off) + ) + ) + (else + (seek! (-> self darkjak-interp) 0.0 (* 2.0 (-> self clock seconds-per-frame))) + (if (= (-> self darkjak-interp) 0.0) + (set! (-> self darkjak-giant-interp) 1.0) + ) + ) + ) + (let ((f30-0 (-> self darkjak-interp))) + (let ((f28-0 (lerp-scale 1.0 (* 1.05 (-> self darkjak-giant-interp)) f30-0 0.0 1.0)) + (f26-0 (lerp-scale 1.0 (* 0.20000002 (+ 5.0 (-> self darkjak-giant-interp))) f30-0 0.0 1.0)) + ) + (set-vector! (-> self control scale) f28-0 f28-0 f28-0 1.0) + (let ((a3-3 (new 'stack-no-clear 'vector))) + (set! (-> a3-3 x) f26-0) + (set! (-> a3-3 y) 1.0) + (set! (-> a3-3 z) f26-0) + (set! (-> a3-3 w) 1.0) + (trs-set! (-> self upper-body) (the-as vector #f) (the-as quaternion #f) a3-3) + ) + (let ((f26-1 (* 1.1 f26-0))) + (cond + ((and (logtest? (focus-status dark) (-> self focus-status)) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) 32) + ) + (set! gp-0 (new 'stack-no-clear 'vector)) + (set! (-> gp-0 x) (/ f28-0 (* f28-0 f26-1 (lerp-scale 1.0 1.3 f30-0 0.0 1.0)))) + (set! (-> gp-0 y) (/ f28-0 (* f28-0 (lerp-scale 1.0 1.4 f30-0 0.0 1.0)))) + (set! (-> gp-0 z) (/ f28-0 (* f28-0 f26-1 (lerp-scale 1.0 1.3 f30-0 0.0 1.0)))) + (set! (-> gp-0 w) 1.0) + ) + (else + (set! gp-0 (new 'stack-no-clear 'vector)) + (set! (-> gp-0 x) (/ f28-0 (* f28-0 f26-1))) + (set! (-> gp-0 y) (/ f28-0 f28-0)) + (set! (-> gp-0 z) (/ f28-0 (* f28-0 f26-1))) + (set! (-> gp-0 w) 1.0) + ) + ) + ) + ) + (cond + ((logtest? (game-secrets little-head) (-> self game secrets)) + (dotimes (v1-56 3) + (set! (-> gp-0 data v1-56) (* 0.4 (-> gp-0 data v1-56))) + ) + ) + ((logtest? (game-secrets big-head) (-> self game secrets)) + (dotimes (v1-62 3) + (set! (-> gp-0 data v1-62) (* 2.0 (-> gp-0 data v1-62))) + ) + ) + ) + (trs-set! (-> self neck) (the-as vector #f) (the-as quaternion #f) gp-0) + (let* ((a0-44 (-> self horns)) + (t9-14 (method-of-object a0-44 trs-set!)) + (a1-12 #f) + (a2-9 #f) + (a3-8 (new 'stack-no-clear 'vector)) + ) + (set! (-> a3-8 x) f30-0) + (set! (-> a3-8 y) f30-0) + (set! (-> a3-8 z) f30-0) + (set! (-> a3-8 w) 1.0) + (t9-14 a0-44 (the-as vector a1-12) (the-as quaternion a2-9) a3-8) + ) + (set-darkjak-texture-morph! f30-0) + (cond + ((and (= f30-0 0.0) (< (- (-> self clock frame-counter) (-> self teleport-time)) (seconds 0.5))) + (set! (-> self skel override 0) 0.00001) + (set! (-> self skel override 41) 0.000001) + ) + ((= f30-0 0.0) + (set! (-> self skel override 0) 0.0) + (set! (-> self skel override 41) 0.0) + ) + (else + (set! (-> self skel override 0) 1.0) + (set! (-> self skel override 1) f30-0) + (set! (-> self skel override 2) f30-0) + (set! (-> self skel override 3) f30-0) + (set! (-> self skel override 4) f30-0) + (set! (-> self skel override 5) f30-0) + (set! (-> self skel override 41) 1.0) + (set! (-> self skel override 46) 2.0) + (set! (-> self skel override 52) 2.0) + ) + ) + (when (and (>= f30-0 0.5) + (not (logtest? (-> self focus-status) (focus-status in-head))) + (not (logtest? (-> self draw status) (draw-control-status no-draw no-draw-temp))) + (not (movie?)) + ) + (let ((gp-1 sp-launch-particles-var) + (s5-0 *sp-particle-system-2d*) + (s4-0 (-> *part-id-table* 178)) + (s2-0 *launch-matrix*) + ) + (set! (-> s2-0 trans quad) (-> (process-drawable-random-point! self (new 'stack-no-clear 'vector)) quad)) + (let ((a3-9 #f) + (t0-6 #f) + (t1-1 1.0) + ) + (gp-1 s5-0 s4-0 s2-0 (the-as sparticle-launch-state a3-9) (the-as sparticle-launch-control t0-6) t1-1) + (cond + ((rand-vu-percent? 0.25) + (when (>= (- (-> *display* game-clock frame-counter) (-> self shock-effect-time)) (seconds 0.02)) + (set! (-> self shock-effect-time) (-> *display* game-clock frame-counter)) + (process-drawable-shock-wall-effect + self + (-> *lightning-spec-id-table* 8) + lightning-probe-callback + (-> *part-id-table* 179) + (the-as int t0-6) + (the-as int t1-1) + arg6 + ) + ) + ) + ((rand-vu-percent? 0.1) + (when (>= (- (-> *display* game-clock frame-counter) (-> self shock-effect-time)) (seconds 0.02)) + (set! (-> self shock-effect-time) (-> *display* game-clock frame-counter)) + (process-drawable-shock-effect + self + (-> *lightning-spec-id-table* 6) + lightning-probe-callback + (-> *part-id-table* 179) + 0 + 0 + 40960.0 + ) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate target-darkjak-get-on (target) + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('darkjak) + (when (zero? (-> self darkjak want-stage)) + (set! (-> self darkjak want-stage) (-> event param 0)) + #t + ) + ) + (else + (target-generic-event-handler proc arg1 event-type event) + ) + ) + ) + :exit (behavior () + (logclear! (-> self state-flags) (state-flags lleg-still rleg-still)) + (set! (-> self darkjak-interp) 1.0) + (remove-setting! 'bg-r) + (remove-setting! 'bg-g) + (remove-setting! 'bg-b) + (remove-setting! 'bg-a) + (persist-with-delay *setting-control* 'bg-a-speed (seconds 3) 'bg-a-speed 'abs 0.5 0) + (if (not (and (-> self next-state) (= (-> self next-state name) 'target-darkjak-get-off))) + (pickup-collectable! + (-> self fact) + (pickup-type eco-pill-dark) + (- (-> *FACT-bank* eco-pill-dark-max-default)) + (the-as handle #f) + ) + ) + (none) + ) + :code (behavior ((arg0 int)) + (send-event (handle->process (-> self notify)) 'notify 'attack 15) + (if (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (go target-darkjak-giant) + ) + (set! (-> self darkjak stage) (the-as uint (logior arg0 2))) + (if (logtest? (game-feature darkjak-bomb0) (-> self game features)) + (logior! (-> self darkjak stage) 4) + ) + (if (logtest? (game-feature darkjak-bomb1) (-> self game features)) + (logior! (-> self darkjak stage) 8) + ) + (if (logtest? (game-feature darkjak-invinc) (-> self game features)) + (logior! (-> self darkjak stage) 16) + ) + (set! (-> self darkjak want-stage) (-> self darkjak stage)) + (set! (-> self neck flex-blend) 0.0) + (set! (-> self control unknown-surface00) *darkjak-trans-mods*) + (set! (-> self darkjak start-time) (-> self clock frame-counter)) + (set! (-> self darkjak attack-count) (the-as uint 0)) + (set! (-> self darkjak-giant-interp) 1.0) + (set-setting! 'sound-flava #f #x41f00000 4) + (set! (-> self focus-status) (logior (focus-status dark) (-> self focus-status))) + (set! (-> (the-as fact-info-target (-> self fact)) darkjak-start-time) (-> self clock frame-counter)) + (set! (-> (the-as fact-info-target (-> self fact)) darkjak-effect-time) (seconds 20)) + (if (logtest? (-> self darkjak stage) 16) + (logior! (-> self state-flags) (state-flags sf4)) + (logclear! (-> self state-flags) (state-flags sf4)) + ) + (if (logtest? arg0 64) + (go target-stance) + ) + (set-setting! 'bg-r 'abs #x3dcccccd 0) + (set-setting! 'bg-b 'abs #x3dcccccd 0) + (set-forward-vel 0.0) + (let ((s5-0 0)) + (while (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (target-falling-anim-trans) + (+! s5-0 (- (-> self clock frame-counter) (-> self clock old-frame-counter))) + (if (>= s5-0 300) + (go target-falling #f) + ) + (suspend) + ) + ) + (let ((s5-2 (sound-play "djak-transform"))) + (cond + ((task-node-open? (game-task-node city-help-kid-battle)) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 390) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 390)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (set! (-> self darkjak-interp) (lerp-scale 0.0 1.0 (ja-aframe-num 0) 10.0 25.0)) + (set-setting! 'bg-a 'abs (* 0.45 (-> self darkjak-interp)) 0) + (suspend) + (ja :num! (seek!)) + ) + ) + (else + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 412) :num! (seek! (ja-aframe 17.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (set! (-> self darkjak-interp) (lerp-scale 0.0 1.0 (ja-aframe-num 0) 5.0 15.0)) + (set-setting! 'bg-a 'abs (* 0.45 (-> self darkjak-interp)) 0) + (when (and (or (not (cpad-hold? (-> self control unknown-cpad-info00 number) l2)) + (and (= *cheat-mode* 'debug) (cpad-hold? (-> self control unknown-cpad-info00 number) r2)) + ) + (and (< (ja-aframe-num 0) 5.0) (zero? (logand arg0 1))) + ) + (let ((v1-131 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-131 command) (sound-command set-param)) + (set! (-> v1-131 id) s5-2) + (set! (-> v1-131 params volume) -4) + (set! (-> v1-131 auto-time) 24) + (set! (-> v1-131 auto-from) 2) + (set! (-> v1-131 params mask) (the-as uint 17)) + (-> v1-131 id) + ) + (go target-darkjak-get-off) + ) + (suspend) + (ja :num! (seek! (ja-aframe 17.0 0))) + ) + ) + ) + ) + (send-event + *traffic-manager* + 'increase-alert-level + (if (and (logtest? (focus-status dark) (-> self focus-status)) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) 16) + ) + 3 + 2 + ) + ) + (go target-stance) + (none) + ) + :post (-> target-grab post) + ) + +;; failed to figure out what this is: +(defstate target-darkjak-get-off (target) + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('pole-grab 'darkjak 'slide 'wade 'launch 'edge-grab) + #f + ) + (('change-mode) + (case (-> event param 0) + (('grab) + (when (not (logtest? (-> self focus-status) (focus-status dead))) + (if (not (-> event param 1)) + #t + (go target-grab 'stance) + ) + ) + ) + ) + ) + (else + (target-generic-event-handler proc arg1 event-type event) + ) + ) + ) + :enter (behavior () + (set! (-> self state-flags) (logior (state-flags lleg-still rleg-still) (-> self state-flags))) + (set! (-> self neck flex-blend) 0.0) + (set! (-> self control unknown-surface00) *darkjak-trans-mods*) + (kill-persister *setting-control* (the-as engine-pers 'bg-a-speed) 'bg-a-speed) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer self)) + (set! (-> a1-1 num-params) 1) + (set! (-> a1-1 message) 'target) + (set! (-> a1-1 param 0) (the-as uint 'normal)) + (let ((t9-1 send-event-function) + (v1-12 (-> *game-info* sub-task-list 4)) + ) + (t9-1 + (handle->process (if (-> v1-12 info) + (-> v1-12 info manager) + (the-as handle #f) + ) + ) + a1-1 + ) + ) + ) + (none) + ) + :exit (behavior () + (logclear! (-> self state-flags) (state-flags lleg-still rleg-still)) + (target-darkjak-end-mode) + (none) + ) + :trans (-> target-darkjak-get-on trans) + :code (behavior () + (let ((v1-1 (-> self water flags))) + (cond + ((and (logtest? (water-flags touch-water) v1-1) + (logtest? (water-flags under-water swimming) v1-1) + (zero? (logand (focus-status mech) (-> self focus-status))) + ) + (go target-swim-stance) + ) + ((let ((v1-10 (ja-group))) + (not (and v1-10 (= v1-10 (-> self draw art-group data 412)))) + ) + (let ((gp-0 0)) + (while (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (target-falling-anim-trans) + (+! gp-0 (- (-> self clock frame-counter) (-> self clock old-frame-counter))) + (if (>= gp-0 300) + (go target-falling #f) + ) + (suspend) + ) + ) + ) + ) + ) + (cond + ((logtest? (-> self control status) (cshape-moving-flags on-water)) + ) + (else + (let ((v1-30 (ja-group))) + (cond + ((and v1-30 (= v1-30 (-> self draw art-group data 412))) + (ja-no-eval :num! (seek! 0.0)) + (while (not (ja-done? 0)) + (seek! (-> self darkjak-interp) 0.0 (* 2.0 (-> self clock seconds-per-frame))) + (suspend) + (ja-eval) + ) + (ja-channel-push! 1 (seconds 0.1)) + ) + ((let ((v1-43 (ja-group))) + (and v1-43 + (or (= v1-43 (-> self draw art-group data 401)) + (= v1-43 (-> self draw art-group data 416)) + (= v1-43 (-> self draw art-group data 417)) + (= v1-43 (-> self draw art-group data 418)) + ) + ) + ) + (ja-no-eval :group! (-> self draw art-group data 411) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 411)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (set! (-> self darkjak-interp) (lerp-scale 1.0 0.0 (ja-aframe-num 0) 90.0 115.0)) + (if (and (!= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + (or (not (and (logtest? (focus-status dark) (-> self focus-status)) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) 32) + ) + ) + (= (-> self darkjak-interp) 0.0) + ) + ) + (goto cfg-133) + ) + (suspend) + (ja :num! (seek!)) + ) + ) + ((let ((v1-88 (ja-group))) + (and v1-88 (= v1-88 (-> self draw art-group data 411))) + ) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (set! (-> self darkjak-interp) (lerp-scale 1.0 0.0 (ja-aframe-num 0) 90.0 115.0)) + (if (and (!= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + (or (not (and (logtest? (focus-status dark) (-> self focus-status)) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) 32) + ) + ) + (= (-> self darkjak-interp) 0.0) + ) + ) + (goto cfg-133) + ) + (suspend) + (ja-eval) + ) + ) + (else + (ja-channel-push! 1 (seconds 0.05)) + (ja-no-eval :group! (-> self draw art-group data 408) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 408)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (set! (-> self darkjak-interp) (lerp-scale 1.0 0.0 (ja-aframe-num 0) 10.0 60.0)) + (if (and (>= (ja-aframe-num 0) 24.0) + (!= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + (or (not (and (logtest? (focus-status dark) (-> self focus-status)) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) 32) + ) + ) + (= (-> self darkjak-interp) 0.0) + ) + ) + (goto cfg-133) + ) + (suspend) + (ja :num! (seek!)) + ) + (ja-no-eval :group! (-> self draw art-group data 415) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 415)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (set! (-> self darkjak-interp) (lerp-scale 1.0 0.0 (ja-aframe-num 0) 10.0 60.0)) + (if (and (>= (ja-aframe-num 0) 24.0) + (!= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + (or (not (and (logtest? (focus-status dark) (-> self focus-status)) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) 32) + ) + ) + (= (-> self darkjak-interp) 0.0) + ) + ) + (goto cfg-133) + ) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + ) + ) + ) + (label cfg-133) + (vector-reset! (-> self control transv)) + ((-> target-darkjak-get-off exit)) + (go target-stance) + (none) + ) + :post (-> target-grab post) + ) + +;; failed to figure out what this is: +(defstate target-darkjak-running-attack (target) + :event (-> target-running-attack event) + :enter (-> target-running-attack enter) + :exit (behavior () + (remove-setting! 'rapid-tracking) + ((-> target-running-attack exit)) + (none) + ) + :trans (-> target-running-attack trans) + :code (behavior () + (local-vars + (sv-16 float) + (sv-20 float) + (sv-24 int) + (sv-32 int) + (sv-40 int) + (sv-48 float) + (sv-56 handle) + (sv-64 int) + ) + (set-setting! 'rapid-tracking #f 0 0) + ((lambda :behavior target + () + (set! (-> self control unknown-float29) (* 0.5 (-> self control unknown-float29))) + (if (logtest? (water-flags touch-water) (-> self water flags)) + (sound-play "swim-stroke") + ) + (set! (-> self control dynam gravity-max) 368640.0) + (set! (-> self control dynam gravity-length) 368640.0) + (let ((gp-1 (cond + ((zero? (-> self control unknown-word000)) + (set! (-> self control unknown-word000) 1) + (-> self draw art-group data 402) + ) + (else + (set! (-> self control unknown-word000) 0) + (-> self draw art-group data 409) + ) + ) + ) + ) + (ja-channel-push! 1 (seconds 0.02)) + (ja-no-eval :group! gp-1 :num! (seek! (the float (+ (-> (the-as art-joint-anim gp-1) frames num-frames) -1)))) + ) + (target-start-attack) + (target-danger-set! 'punch #f) + (let ((a0-8 (-> self control unknown-impact-control00)) + (t9-6 (method-of-type impact-control initialize)) + (a1-4 self) + (v1-33 (ja-group)) + ) + (t9-6 + a0-8 + a1-4 + (if (and v1-33 (= v1-33 (-> self draw art-group data 402))) + 22 + 18 + ) + 3276.8 + (-> self control root-prim prim-core collide-with) + ) + ) + ) + ) + (set! sv-16 (the-as float 0.0)) + (set! sv-20 1.0) + (set! sv-24 0) + (set! sv-32 0) + (set! sv-40 0) + (set! sv-48 1.0) + (set! sv-56 (the-as handle #f)) + (set! sv-64 0) + (until (ja-done? 0) + (if (and (cpad-pressed? (-> self control unknown-cpad-info00 number) square) + (not (logtest? (-> self state-flags) (state-flags sf7 sf8))) + (not (logtest? (-> self control unknown-surface01 flags) (surface-flag no-attack))) + (and (logtest? (focus-status dark) (-> self focus-status)) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) 2) + ) + (< sv-32 2) + ) + (set! sv-40 (the-as int (-> self clock frame-counter))) + ) + (when (>= (- (-> self clock frame-counter) (the-as time-frame sv-40)) (seconds 0.5)) + (set! sv-40 0) + 0 + ) + (if (and (nonzero? sv-40) + (< (- (the float (+ (-> (ja-group) frames num-frames) -1)) (/ 2.0 (-> (ja-group) artist-step))) + (ja-frame-num 0) + ) + ) + ((lambda :behavior target + ((arg0 (pointer float)) (arg1 (pointer uint64)) (arg2 (pointer uint64))) + (let ((s4-0 (the-as process-focusable (combo-tracker-method-13 + (-> self control unknown-combo-tracker00) + (-> self control unknown-dword06) + (-> self control trans) + 24576.0 + (-> self control unknown-matrix01 vector 2) + 65536.0 + ) + ) + ) + ) + (when #t + (+! (-> arg1 0) 1) + (if s4-0 + (combo-tracker-method-12 + (-> self control unknown-combo-tracker00) + (-> self control trans) + (get-trans s4-0 3) + s4-0 + (-> self clock frame-counter) + ) + ) + (target-start-attack) + (target-danger-set! 'punch #f) + (let ((v1-18 (ja-group))) + (cond + ((and v1-18 (or (= v1-18 (-> self draw art-group data 402)) (= v1-18 (-> self draw art-group data 409)))) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 404) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 404)) frames num-frames) -1))) + ) + ) + (else + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 413) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 413)) frames num-frames) -1))) + ) + ) + ) + ) + (initialize + (-> self control unknown-impact-control00) + self + 22 + 3276.8 + (-> self control root-prim prim-core collide-with) + ) + (set! (-> arg0 0) (fmax 0.0 (-> arg0 0))) + ) + ) + (set! (-> arg2 0) (the-as uint 0)) + 0 + (none) + ) + (& sv-16) + (the-as (pointer uint64) (& sv-32)) + (the-as (pointer uint64) (& sv-40)) + ) + ) + (compute-alignment! (-> self align)) + (when (not (ja-min? 0)) + (cond + ((and (>= (ja-frame-num 0) 20.0) + (and (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) + (the-as time-frame (-> *TARGET-bank* ground-timeout)) + ) + (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (>= (target-height-above-ground) (-> *TARGET-bank* fall-height)) + ) + (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame17)) (seconds 0.04)) + ) + ) + (go target-falling #f) + ) + ((and (nonzero? sv-32) + (>= sv-16 -40960.0) + (let ((v1-84 (ja-group))) + (not (and (and v1-84 (= v1-84 (-> self draw art-group data 406))) (>= (ja-aframe-num 0) 77.0))) + ) + (send-event (handle->process (-> self control unknown-combo-tracker00 target)) 'combo) + ) + (let* ((s5-0 (handle->process (-> self control unknown-combo-tracker00 target))) + (gp-0 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (let ((s5-1 (get-trans (the-as process-focusable gp-0) 3))) + (when (and (< 2048.0 (vector-vector-distance (-> self control trans) s5-1)) + (or (and (= gp-0 (handle->process sv-56)) + (< (- (-> self clock frame-counter) (the-as time-frame sv-64)) (seconds 0.1)) + ) + (>= (- (-> self clock frame-counter) (the-as time-frame sv-64)) (seconds 1)) + ) + ) + (forward-up-nopitch->quaternion + (-> self control dir-targ) + (vector-! (new 'stack-no-clear 'vector) s5-1 (-> self control trans)) + (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self control quat)) + ) + (let ((v1-125 + (point-tracker-method-11 + (-> self control unknown-combo-tracker00) + (new 'stack-no-clear 'vector) + (-> self control trans) + s5-1 + (* 0.009107469 + (the float (- (-> self clock frame-counter) (-> self control unknown-combo-tracker00 move-start-time))) + ) + ) + ) + ) + (set! sv-16 (fmin 163840.0 (sqrtf (+ (* (-> v1-125 x) (-> v1-125 x)) (* (-> v1-125 z) (-> v1-125 z)))))) + ) + (set-forward-vel sv-16) + ) + ) + (when (!= gp-0 (handle->process sv-56)) + (set! sv-56 (process->handle gp-0)) + (set! sv-64 (the-as int (-> self clock frame-counter))) + ) + ) + ) + ((< sv-16 0.0) + (set! sv-16 (seek sv-16 -0.04096 (* 491520.0 (-> self clock seconds-per-frame)))) + (set-forward-vel sv-16) + ) + ((and (nonzero? (-> self control unknown-time-frame18)) + (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame18)) (seconds 0.04)) + ) + (set-forward-vel 0.0) + ) + ((and (not (cpad-hold? (-> self control unknown-cpad-info00 number) square)) + (zero? sv-32) + (>= (- (-> self clock frame-counter) (-> self control unknown-combo-tracker00 move-start-time)) (seconds 0.2)) + ) + (if (= (-> self control ground-pat material) (pat-material ice)) + (set-forward-vel (fmax 32768.0 (* 0.8 (-> self control unknown-float05)))) + (set-forward-vel (* 0.8 (-> self control unknown-float05))) + ) + ) + ((ja-done? 0) + (set-forward-vel sv-16) + ) + (else + (set! sv-16 + (* (target-align-vel-z-adjust (-> self align delta trans z)) (-> self clock frames-per-second) sv-20) + ) + (set-forward-vel sv-16) + ) + ) + ) + (let ((gp-1 (new-stack-vector0))) + (vector-matrix*! gp-1 (-> self control transv) (-> self control unknown-matrix00)) + (set! (-> gp-1 y) 0.0) + (vector-matrix*! (-> self control unknown-vector44) gp-1 (-> self control unknown-matrix01)) + ) + (when (!= (the-as float (-> self control unknown-word04)) 0.0) + (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) + (set! sv-16 (the-as float (-> self control unknown-word04))) + (set! (-> self control unknown-word04) (the-as uint 0.0)) + ) + (when (and (>= sv-16 0.0) + (let ((gp-2 (ja-group)) + (f30-2 (ja-aframe-num 0)) + ) + (if (or (and (= gp-2 (-> self draw art-group data 402)) + (>= f30-2 11.0) + (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 402)) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + (and (= gp-2 (-> self draw art-group data 409)) + (>= f30-2 11.0) + (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 409)) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + (and (= gp-2 (-> self draw art-group data 404)) + (>= f30-2 49.0) + (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 404)) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + (and (= gp-2 (-> self draw art-group data 406)) + (or (and (>= f30-2 62.0) (>= 77.0 f30-2)) + (and (>= f30-2 82.0) + (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 406)) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + ) + ) + (and (= gp-2 (-> self draw art-group data 413)) + (>= f30-2 62.0) + (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 413)) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + ) + #t + ) + ) + ) + (let ((gp-3 (new 'stack-no-clear 'collide-query))) + (when (and (>= (impact-control-method-11 + (-> self control unknown-impact-control00) + gp-3 + (the-as process #f) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1) + ) + 0.0 + ) + (>= 0.0 (vector-dot (-> gp-3 best-other-tri normal) (-> self control unknown-impact-control00 dir))) + ) + (when (= (-> gp-3 best-other-tri pat mode) (pat-mode wall)) + (let ((s5-2 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-2 + (let ((t9-38 (method-of-type part-tracker activate))) + (t9-38 (the-as part-tracker s5-2) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) + ) + (let ((t9-39 run-function-in-process) + (a0-96 s5-2) + (a1-21 part-tracker-init) + (a2-12 (-> *part-group-id-table* 11)) + (a3-7 0) + (t0-3 #f) + (t1-2 #f) + (t2-1 #f) + (t3-0 *launch-matrix*) + ) + (set! (-> t3-0 trans quad) (-> gp-3 best-other-tri intersect quad)) + ((the-as (function object object object object object object object object none) t9-39) + a0-96 + a1-21 + a2-12 + a3-7 + t0-3 + t1-2 + t2-1 + t3-0 + ) + ) + (-> s5-2 ppointer) + ) + ) + (let ((t1-3 (make-u128 (the-as uint #x7469682d6863) (the-as uint #x6e75702d6b616a64)))) + (effect-control-method-12 + (-> self skel effect) + 'punch + -1.0 + (the-as int (-> self control unknown-impact-control00 joint)) + (the-as basic #f) + (the-as sound-name t1-3) + ) + ) + (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) + (set! sv-16 (the-as float -61440.0)) + ) + ) + ) + ) + (let ((gp-4 (ja-group)) + (f0-53 (ja-aframe-num 0)) + ) + (if (and (= gp-4 (-> self draw art-group data 406)) + (>= f0-53 80.0) + (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 406)) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + (align! (-> self align) (align-opts adjust-y-vel) 1.0 1.6 1.0) + ) + ) + (suspend) + (ja :num! (seek! max (* (-> self control unknown-surface01 align-speed) (the-as float sv-48)))) + (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (set! (-> *run-attack-mods* turnvv) 0.0) + ) + (if (< 2 sv-24) + (set! sv-20 (* sv-20 (fmin 1.0 (-> self control unknown-float44)))) + ) + (set! sv-24 (+ sv-24 1)) + ) + (if (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) + (the-as time-frame (-> *TARGET-bank* ground-timeout)) + ) + (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (>= (target-height-above-ground) (-> *TARGET-bank* fall-height)) + ) + (go target-falling #f) + ) + (go target-stance) + (none) + ) + :post target-post + ) + +;; definition for method 9 of type darkjak-info +;; WARN: Return type mismatch int vs none. +(defmethod update-clock! darkjak-info ((obj darkjak-info) (arg0 int)) + (when (-> obj clock-on) + (+! (-> obj clock-pos) (* (-> obj clock-vel) (-> self clock seconds-per-frame))) + (+! (-> obj clock-vel) (* 4.0 (-> self clock seconds-per-frame))) + (cond + ((< 1.0 (-> obj clock-pos)) + (set! (-> obj clock-pos) 1.0) + (set! (-> obj clock-vel) 0.0) + ) + ((< (-> obj clock-pos) 0.05) + (set! (-> obj clock-pos) 0.05) + (set! (-> obj clock-vel) 1.0) + ) + ) + (update-rates! (-> *display* entity-clock) (-> obj clock-pos)) + (update-rates! (-> *display* bg-clock) (-> obj clock-pos)) + (if (= arg0 4) + (update-rates! (-> *display* target-clock) (-> obj clock-pos)) + ) + (when *sound-player-enable* + (let ((v1-27 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-27 command) (sound-command set-param)) + (set! (-> v1-27 id) (-> obj process 0 control unknown-sound-id00)) + (set! (-> v1-27 params pitch-mod) (the int (* 1524.0 (- (- 1.0 (-> obj clock-pos)))))) + (set! (-> v1-27 params mask) (the-as uint 2)) + (-> v1-27 id) + ) + ) + ) + 0 + (none) + ) + +;; definition for function target-darkjak-bomb-collide +;; WARN: Return type mismatch int vs none. +(defbehavior target-darkjak-bomb-collide target ((arg0 float) (arg1 float)) + (seek! (-> (the-as (pointer float) arg0) 0) arg1 (* 4.0 (-> self clock seconds-per-frame))) + (set! (-> self control unknown-float40) (-> (the-as (pointer float) arg0) 0)) + (target-danger-set! 'bomb #f) + (collide-shape-method-46 (-> self control)) + (let ((a1-2 (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> a1-2 options) (overlaps-others-options)) + (set! (-> a1-2 collide-with-filter) (the-as collide-spec -1)) + (set! (-> a1-2 tlist) *touching-list*) + (find-overlapping-shapes (-> self control) a1-2) + ) + (set! (-> self control unknown-float40) 0.0) + (target-danger-set! 'bomb #f) + (collide-shape-method-46 (-> self control)) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate target-darkjak-bomb0 (target) + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('pole-grab 'darkjak 'slide 'wade 'launch 'edge-grab 'jump 'shove 'attack 'attack-or-shove) + #f + ) + (('hit) + (let ((v1-1 (the-as object (-> event param 1)))) + (when (and (= (-> event param 0) 'bomb) + (logtest? (process-mask enemy) (-> (the-as process v1-1) mask)) + (let ((v1-7 (ja-group))) + (and v1-7 (= v1-7 (-> self draw art-group data 418))) + ) + (>= (ja-aframe-num 0) 35.0) + (not (-> self darkjak clock-on)) + ) + (set! (-> self darkjak clock-vel) -8.0) + (let ((v0-0 (the-as object #t))) + (set! (-> self darkjak clock-on) (the-as symbol v0-0)) + v0-0 + ) + ) + ) + ) + (('attack 'attack-or-shove 'swim) + #f + ) + (else + (target-dangerous-event-handler proc arg1 event-type event) + ) + ) + ) + :enter (behavior () + (logior! (-> self state-flags) (state-flags sf4)) + (set! (-> self darkjak clock-pos) 1.0) + (set! (-> self darkjak clock-vel) 0.0) + (set! (-> self darkjak clock-on) #f) + (set! (-> self control unknown-sound-id00) + (gui-control-method-9 *gui-control* self (gui-channel jak) (gui-action queue) "darkbom0" -99.0 0) + ) + (none) + ) + :exit (behavior () + (gui-control-method-16 + *gui-control* + (gui-action fade) + (-> self control unknown-sound-id00) + (gui-channel none) + (gui-action none) + (the-as string #f) + (the-as (function gui-connection symbol) #f) + (the-as process #f) + ) + (logclear! (-> self state-flags) (state-flags sf6)) + (target-exit) + (remove-setting! 'music-volume) + (remove-setting! 'sfx-volume) + (remove-setting! 'ambient-volume) + (set! (-> self darkjak clock-pos) 1.0) + (set! (-> self darkjak clock-vel) 0.0) + (set! (-> self darkjak clock-on) #f) + (update-rates! (-> *display* entity-clock) 1.0) + (update-rates! (-> *display* bg-clock) 1.0) + (update-rates! (-> *display* target-clock) 1.0) + (if (not (and (-> self next-state) (= (-> self next-state name) 'target-darkjak-get-off))) + ((-> target-darkjak-get-off exit)) + ) + (none) + ) + :trans (behavior () + (update-clock! (-> self darkjak) 4) + (none) + ) + :code (behavior () + (local-vars + (v1-100 symbol) + (sv-16 float) + (sv-20 float) + (sv-80 vector) + (sv-84 (function vector :behavior target)) + ) + (set! (-> self darkjak stage) (-> self darkjak want-stage)) + (set! (-> self neck flex-blend) 0.0) + (set! (-> self control unknown-surface00) *roll-flip-mods*) + (set! (-> self alt-cam-pos quad) (-> self control trans quad)) + (set! sv-16 (the-as float 0.0)) + (set! sv-20 1.0) + (ja-channel-push! 1 (seconds 0.15)) + (when (jump-hit-ground-stuck?) + (ja-no-eval :group! (-> self draw art-group data 401) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 401)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (set! (-> self alt-cam-pos x) (-> self control trans x)) + (set! (-> self alt-cam-pos z) (-> self control trans z)) + (set-forward-vel (* 0.85 (-> self control unknown-float05))) + (suspend) + (ja :num! (seek!)) + ) + ) + (set-setting! 'music-volume 'rel 0 0) + (set-setting! 'sfx-volume 'rel 0 0) + (set-setting! 'ambient-volume 'rel 0 0) + (ja-no-eval :group! (-> self draw art-group data 416) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 416)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (align! (-> self align) (align-opts adjust-y-vel) 1.0 1.0 1.0) + (set! (-> self alt-cam-pos x) (-> self control trans x)) + (set! (-> self alt-cam-pos z) (-> self control trans z)) + (set-forward-vel (* 0.98 (-> self control unknown-float05))) + (suspend) + (ja :num! (seek!)) + ) + (ja-no-eval :group! (-> self draw art-group data 417) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 417)) frames num-frames) -1))) + :frame-num 0.0 + ) + (let ((f30-0 (the float (target-time-to-ground)))) + (until v1-100 + (set! (-> self alt-cam-pos x) (-> self control trans x)) + (set! (-> self alt-cam-pos z) (-> self control trans z)) + (set-forward-vel (* 0.98 (-> self control unknown-float05))) + (let ((v1-92 (new-stack-vector0)) + (f0-35 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + ) + 0.0 + (vector-! v1-92 (-> self control transv) (vector-float*! v1-92 (-> self control dynam gravity-normal) f0-35)) + (let* ((f1-5 (vector-length v1-92)) + (f2-0 f1-5) + (f0-36 (+ f0-35 (* -491520.0 (-> self clock seconds-per-frame)))) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-36) + (vector-float*! v1-92 v1-92 (/ f1-5 f2-0)) + ) + ) + ) + (suspend) + (ja :num! (seek! max (lerp-scale 1.5 0.3 f30-0 30.0 210.0))) + (set! v1-100 (or (ja-done? 0) (logtest? (-> self control status) (cshape-moving-flags on-surface)))) + ) + ) + (logclear! (-> self state-flags) (state-flags sf6)) + (while (not (jump-hit-ground-stuck?)) + (let ((v1-105 (new-stack-vector0)) + (f0-42 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + ) + 0.0 + (vector-! + v1-105 + (-> self control transv) + (vector-float*! v1-105 (-> self control dynam gravity-normal) f0-42) + ) + (let* ((f1-8 (vector-length v1-105)) + (f2-1 f1-8) + (f0-43 (+ f0-42 (* -491520.0 (-> self clock seconds-per-frame)))) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-43) + (vector-float*! v1-105 v1-105 (/ f1-8 f2-1)) + ) + ) + ) + (ja :num! (seek! (ja-aframe 33.0 0))) + (suspend) + ) + (set-forward-vel 0.0) + (ja-no-eval :group! (-> self draw art-group data 418) :num! (seek! (ja-aframe 35.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 35.0 0))) + ) + (gui-control-method-16 + *gui-control* + (gui-action play) + (-> self control unknown-sound-id00) + (gui-channel none) + (gui-action none) + (the-as string #f) + (the-as (function gui-connection symbol) #f) + (the-as process #f) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.5)) + (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) + (target-start-attack) + (target-danger-set! 'bomb #f) + (set! sv-80 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 18))) + (set! sv-84 (lambda :behavior target + () + (set-vector! (-> self draw color-mult) 0.0 0.0 0.0 1.0) + (cond + ((>= 10.0 (ja-aframe-num 0)) + (let ((v0-1 (the-as vector (-> self draw color-emissive)))) + (set! (-> (the-as rgbaf v0-1) x) 1.0) + (set! (-> (the-as rgbaf v0-1) y) 1.0) + (set! (-> (the-as rgbaf v0-1) z) 1.0) + (set! (-> (the-as rgbaf v0-1) w) 1.0) + v0-1 + ) + ) + ((>= 20.0 (ja-aframe-num 0)) + (vector-lerp! + (-> self draw color-emissive) + (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) + (new 'static 'vector :x 0.5 :z 1.0 :w 1.0) + (lerp-scale 0.0 1.0 (ja-aframe-num 0) 10.0 20.0) + ) + ) + (else + (vector-lerp! + (-> self draw color-emissive) + (new 'static 'vector :x 0.5 :z 1.0 :w 1.0) + (new 'static 'vector :w 1.0) + (lerp-scale 0.0 1.0 (ja-aframe-num 0) 20.0 30.0) + ) + ) + ) + ) + ) + (if (and (logtest? (focus-status dark) (-> self focus-status)) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) 32) + ) + (set! (-> sv-80 y) (* 0.5 (+ (-> self control trans y) (-> self control root-prim prim-core world-sphere y)))) + (set! (-> sv-80 y) (-> self control root-prim prim-core world-sphere y)) + ) + (let ((gp-4 (get-process *default-dead-pool* part-tracker #x4000))) + (when gp-4 + (let ((t9-37 (method-of-type part-tracker activate))) + (t9-37 + (the-as part-tracker gp-4) + *entity-pool* + (symbol->string (-> part-tracker symbol)) + (the-as pointer #x70004000) + ) + ) + (let ((t9-38 run-function-in-process) + (a0-75 gp-4) + (a1-37 part-tracker-init) + (a2-35 (-> *part-group-id-table* 63)) + (a3-15 0) + (t0-7 #f) + (t1-5 #f) + (t2-2 #f) + (t3-1 *launch-matrix*) + ) + (set! (-> t3-1 trans quad) (-> sv-80 quad)) + ((the-as (function object object object object object object object object none) t9-38) + a0-75 + a1-37 + a2-35 + a3-15 + t0-7 + t1-5 + t2-2 + t3-1 + ) + ) + (-> gp-4 ppointer) + ) + ) + (let* ((s5-0 (get-process *default-dead-pool* manipy #x4000)) + (gp-5 + (when s5-0 + (let ((t9-40 (method-of-type manipy activate))) + (t9-40 (the-as manipy s5-0) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) + ) + (let ((gp-6 run-function-in-process) + (s4-0 s5-0) + (s3-0 manipy-init) + (s2-0 sv-80) + (s1-0 (-> self entity)) + (t0-8 (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f))) + (t1-6 #f) + ) + 0 + ((the-as (function object object object object object object none) gp-6) s4-0 s3-0 s2-0 s1-0 t0-8 t1-6) + ) + (-> s5-0 ppointer) + ) + ) + ) + (when gp-5 + (send-event (ppointer->process gp-5) 'anim-mode 'play1) + (send-event (ppointer->process gp-5) 'anim "idle") + (set-vector! (-> (the-as process-drawable (-> gp-5 0)) root scale) sv-20 1.0 sv-20 1.0) + (send-event (ppointer->process gp-5) 'trans-hook sv-84) + ) + ) + (let* ((s5-1 (get-process *default-dead-pool* manipy #x4000)) + (gp-7 + (when s5-1 + (let ((t9-47 (method-of-type manipy activate))) + (t9-47 (the-as manipy s5-1) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) + ) + (let ((gp-8 run-function-in-process) + (s4-1 s5-1) + (s3-1 manipy-init) + (s2-1 sv-80) + (s1-1 (-> self entity)) + (t0-9 (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f))) + (t1-7 #f) + ) + 0 + ((the-as (function object object object object object object none) gp-8) s4-1 s3-1 s2-1 s1-1 t0-9 t1-7) + ) + (-> s5-1 ppointer) + ) + ) + ) + (when gp-7 + (send-event (ppointer->process gp-7) 'anim-mode 'play1) + (send-event (ppointer->process gp-7) 'anim "idle") + (set-vector! (-> (the-as process-drawable (-> gp-7 0)) root scale) sv-20 1.0 sv-20 1.0) + ) + ) + (ja-no-eval :num! (seek! (ja-aframe 38.0 0))) + (while (not (ja-done? 0)) + (target-darkjak-bomb-collide (the-as float (& sv-16)) sv-20) + (set-forward-vel 0.0) + (suspend) + (ja-eval) + ) + (when (and (logtest? (focus-status dark) (-> self focus-status)) + (and (nonzero? (-> self darkjak)) (logtest? (-> self darkjak stage) 32)) + ) + (let* ((s5-2 (get-process *default-dead-pool* manipy #x4000)) + (gp-10 + (when s5-2 + (let ((t9-59 (method-of-type manipy activate))) + (t9-59 (the-as manipy s5-2) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) + ) + (let ((gp-11 run-function-in-process) + (s4-2 s5-2) + (s3-2 manipy-init) + (s2-2 sv-80) + (s1-2 (-> self entity)) + (t0-10 (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f))) + (t1-8 #f) + ) + 0 + ((the-as (function object object object object object object none) gp-11) s4-2 s3-2 s2-2 s1-2 t0-10 t1-8) + ) + (-> s5-2 ppointer) + ) + ) + ) + (when gp-10 + (send-event (ppointer->process gp-10) 'anim-mode 'play1) + (send-event (ppointer->process gp-10) 'anim "idle") + (set-vector! (-> (the-as process-drawable (-> gp-10 0)) root scale) sv-20 1.0 sv-20 1.0) + (send-event + (ppointer->process gp-10) + 'trans-hook + (lambda :behavior target + () + (set-vector! (-> self draw color-mult) 0.0 0.0 0.0 1.0) + (cond + ((>= 10.0 (ja-aframe-num 0)) + (let ((v0-1 (the-as vector (-> self draw color-emissive)))) + (set! (-> (the-as rgbaf v0-1) x) 0.5) + (set! (-> (the-as rgbaf v0-1) y) 0.25) + (set! (-> (the-as rgbaf v0-1) z) 1.0) + (set! (-> (the-as rgbaf v0-1) w) 1.0) + v0-1 + ) + ) + ((>= 20.0 (ja-aframe-num 0)) + (vector-lerp! + (-> self draw color-emissive) + (new 'static 'vector :x 0.5 :z 1.0 :w 1.0) + (new 'static 'vector :x 0.5 :y 0.25 :z 1.0 :w 1.0) + (lerp-scale 0.0 1.0 (ja-aframe-num 0) 10.0 20.0) + ) + ) + (else + (vector-lerp! + (-> self draw color-emissive) + (new 'static 'vector :x 0.25 :z 1.0 :w 1.0) + (new 'static 'vector :w 1.0) + (lerp-scale 0.0 1.0 (ja-aframe-num 0) 20.0 30.0) + ) + ) + ) + ) + ) + ) + ) + (let* ((s5-3 (get-process *default-dead-pool* manipy #x4000)) + (gp-12 + (when s5-3 + (let ((t9-66 (method-of-type manipy activate))) + (t9-66 (the-as manipy s5-3) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) + ) + (let ((gp-13 run-function-in-process) + (s4-3 s5-3) + (s3-3 manipy-init) + (s2-3 sv-80) + (s1-3 (-> self entity)) + (t0-11 (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f))) + (t1-9 #f) + ) + 0 + ((the-as (function object object object object object object none) gp-13) s4-3 s3-3 s2-3 s1-3 t0-11 t1-9) + ) + (-> s5-3 ppointer) + ) + ) + ) + (when gp-12 + (send-event (ppointer->process gp-12) 'anim-mode 'play1) + (send-event (ppointer->process gp-12) 'anim "idle") + (set-vector! (-> (the-as process-drawable (-> gp-12 0)) root scale) sv-20 0.5 sv-20 1.0) + ) + ) + ) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (target-darkjak-bomb-collide (the-as float (& sv-16)) sv-20) + (set-forward-vel 0.0) + (suspend) + (ja-eval) + ) + (remove-setting! 'music-volume) + (remove-setting! 'sfx-volume) + (remove-setting! 'ambient-volume) + (ja-no-eval :group! (-> self draw art-group data 411) :num! (seek! (ja-aframe 90.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (target-darkjak-bomb-collide (the-as float (& sv-16)) sv-20) + (suspend) + (ja :num! (seek! (ja-aframe 90.0 0))) + ) + (logior! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + (send-event (handle->process (-> self notify)) 'notify 'attack 16) + (go target-darkjak-get-off) + (none) + ) + :post target-no-stick-post + ) + +;; failed to figure out what this is: +(set! (-> *lightning-spec-id-table* 10) (new 'static 'lightning-spec + :name "lightning-darkjak-bomb1" + :flags (lightning-spec-flags lsf0 size-from-adjust-dist) + :adjust-distance #xa + :start-color #x80ffffff + :end-color #x80ffffff + :fade-to-color #x58f00bf + :fade-start-factor 0.2 + :texture #xc08400 + :reduction 0.42 + :num-points 96 + :box-size 32768.0 + :merge-factor 0.2 + :merge-count 2 + :radius 2048.0 + :duration 300.0 + :duration-rand 90.0 + :sound (static-sound-spec "transform-zap") + ) + ) + +;; definition for function target-bomb1-fire-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defbehavior target-bomb1-fire-shot target ((arg0 (pointer handle)) (arg1 int) (arg2 int) (arg3 int)) + (local-vars (sv-128 target) (sv-144 int) (sv-160 vector) (sv-176 vector) (sv-192 vector)) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (cond + ((and (>= arg1 0) (< arg1 arg2)) + (let ((gp-0 (handle->process (-> arg0 arg1)))) + (when gp-0 + (get-trans (the-as process-focusable gp-0) 3) + (process-spawn + lightning-tracker + :init lightning-tracker-init + (-> *lightning-spec-id-table* 10) + 0 + lightning-probe-callback + gp-0 + 3 + 3 + :to self + ) + (let ((a1-6 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-6 from) (process->ppointer self)) + (set! (-> a1-6 num-params) 2) + (set! (-> a1-6 message) 'attack) + (set! (-> a1-6 param 0) (the-as uint #f)) + (let ((v1-19 (new 'static 'attack-info :mask (attack-info-mask mode id penetrate-using damage)))) + (set! (-> v1-19 id) (the-as uint arg3)) + (set! (-> v1-19 mode) 'ice) + (set! (-> v1-19 damage) 15.0) + (set! (-> v1-19 penetrate-using) (the-as uint (if (and (logtest? (focus-status dark) (-> self focus-status)) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) 32) + ) + #xd0001 + #x50001 + ) + ) + ) + (set! (-> a1-6 param 1) (the-as uint v1-19)) + ) + (send-event-function gp-0 a1-6) + ) + ) + ) + ) + (else + (let ((gp-1 (get-process *default-dead-pool* lightning-tracker #x4000))) + (when gp-1 + (let ((t9-6 (method-of-type lightning-tracker activate))) + (t9-6 + (the-as lightning-tracker gp-1) + self + (symbol->string (-> lightning-tracker symbol)) + (the-as pointer #x70004000) + ) + ) + (let ((s5-1 run-function-in-process) + (s4-1 gp-1) + (s3-0 lightning-tracker-init) + (s2-0 (-> *lightning-spec-id-table* 10)) + (s1-0 0) + (s0-0 lightning-probe-callback) + ) + (set! sv-128 self) + (set! sv-144 3) + (set! sv-192 (new 'stack-no-clear 'vector)) + (set! sv-160 (-> self control trans)) + (set! sv-176 (new 'stack-no-clear 'vector)) + (set! (-> sv-176 x) (rand-vu-float-range -40960.0 40960.0)) + (set! (-> sv-176 y) (rand-vu-float-range -8192.0 8192.0)) + (set! (-> sv-176 z) (rand-vu-float-range -40960.0 40960.0)) + (set! (-> sv-176 w) 1.0) + (.mov.vf vf6 vf0 :mask #b1000) + (.lvf vf4 (&-> sv-160 quad)) + (.lvf vf5 (&-> sv-176 quad)) + (.add.vf vf6 vf4 vf5 :mask #b111) + (.svf (&-> sv-192 quad) vf6) + ((the-as (function object object object object object object object object none) s5-1) + s4-1 + s3-0 + s2-0 + s1-0 + s0-0 + sv-128 + sv-144 + sv-192 + ) + ) + (-> gp-1 ppointer) + ) + ) + ) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate target-darkjak-bomb1 (target) + :event (-> target-darkjak-bomb0 event) + :enter (-> target-attack-uppercut-jump enter) + :exit (-> target-darkjak-bomb0 exit) + :trans (behavior () + (if (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (go target-hit-ground #f) + ) + (mod-var-jump #t #t (cpad-hold? (-> self control unknown-cpad-info00 number) x) (-> self control transv)) + (if (and (= (-> self control unknown-symbol04) 'uppercut) + (< (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) -8192.0) + ) + (target-danger-set! 'harmless #f) + ) + (slide-down-test) + (update-clock! (-> self darkjak) 8) + (none) + ) + :code (behavior ((arg0 float) (arg1 float)) + (local-vars + (sv-32 (array collide-shape)) + (sv-40 int) + (sv-48 int) + (sv-56 sphere) + (sv-60 (pointer handle)) + (sv-64 int) + (sv-72 time-frame) + (sv-80 time-frame) + (sv-88 float) + (sv-92 number) + (sv-96 time-frame) + (sv-104 uint) + ) + (logior! (-> self state-flags) (state-flags sf4)) + (set! (-> self neck flex-blend) 0.0) + (set-setting! 'music-volume 'rel 0 0) + (set-setting! 'ambient-volume 'rel 0 0) + (compute-alignment! (-> self align)) + (gui-control-method-16 + *gui-control* + (gui-action play) + (-> self control unknown-sound-id00) + (gui-channel none) + (gui-action none) + (the-as string #f) + (the-as (function gui-connection symbol) #f) + (the-as process #f) + ) + (let ((f0-1 0.9)) + (ja-no-eval :num! (seek! max f0-1)) + ) + (while (not (ja-done? 0)) + (compute-alignment! (-> self align)) + (set! (-> self control unknown-float06) 1.0) + (set! (-> self darkjak clock-vel) -4.0) + (set! (-> self darkjak clock-on) #t) + (align! (-> self align) (align-opts adjust-y-vel) 1.0 1.0 1.0) + (suspend) + (ja-eval) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.5)) + (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) + (let ((gp-0 (-> self post-hook))) + (set! (-> self post-hook) target-no-move-post) + (set! sv-32 (-> self focus-search)) + (set! sv-40 0) + (set! sv-48 0) + (set! sv-56 (the-as sphere (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 3)))) + (set! sv-60 + (new 'static 'array handle 128 + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + ) + ) + (set! (-> sv-56 r) + (if (and (logtest? (focus-status dark) (-> self focus-status)) + (and (nonzero? (-> self darkjak)) (logtest? (-> self darkjak stage) 32)) + ) + 614400.0 + 327680.0 + ) + ) + (set! sv-40 (spatial-hash-method-36 *actor-hash* sv-56 (-> sv-32 data) (-> sv-32 allocated-length))) + (set! (-> sv-32 length) sv-40) + (countdown (s5-0 sv-40) + (let* ((s4-0 (-> sv-32 s5-0 process)) + (v1-53 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + (when (and v1-53 (logtest? (process-mask enemy guard vehicle) (-> v1-53 mask))) + (set! (-> sv-60 sv-48) (process->handle v1-53)) + (set! sv-48 (+ sv-48 1)) + (if (< 128 sv-48) + (set! sv-48 128) + ) + ) + ) + ) + (set! (-> self control unknown-surface00) + (new 'static 'surface + :name 'uppercut + :turnv 524288.0 + :tiltv 32768.0 + :tiltvv 262144.0 + :transv-max 32768.0 + :target-speed 32768.0 + :fric 0.2 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :turnvf 15.0 + :tiltvf 150.0 + :tiltvvf 15.0 + :mode 'air + :flags (surface-flag air attack spin gun-off laser-hide) + ) + ) + (set! sv-64 0) + (set! sv-72 (-> self clock frame-counter)) + (set! sv-80 (-> self clock frame-counter)) + (set! sv-88 (the-as float 0.0)) + (set! sv-92 0.0) + (set! sv-96 (-> self clock frame-counter)) + (let* ((v1-70 (-> self game)) + (a0-33 (+ (-> v1-70 attack-id) 1)) + ) + (set! (-> v1-70 attack-id) a0-33) + (set! sv-104 a0-33) + ) + (ja-channel-push! 2 (seconds 0.05)) + (ja :group! (-> self draw art-group data 419)) + (ja :chan 1 :group! (-> self draw art-group data 420)) + (while (or (< sv-64 sv-48) (< (- (-> self clock frame-counter) sv-80) (seconds 1.5))) + (let ((v1-77 (new-stack-vector0))) + (let ((f0-8 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! v1-77 (-> self control transv) (vector-float*! v1-77 (-> self control dynam gravity-normal) f0-8)) + ) + (let* ((f0-9 (vector-length v1-77)) + (f1-3 f0-9) + (f2-0 0.0) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-0) + (vector-float*! v1-77 v1-77 (/ f0-9 f1-3)) + ) + ) + ) + (set! (-> self darkjak clock-vel) -4.0) + (set! (-> self darkjak clock-on) #t) + (send-event *camera* 'joystick -1098907648 #x3f800000) + (when (>= (- (-> self clock frame-counter) sv-72) (seconds 0.1)) + (set! sv-72 (-> self clock frame-counter)) + (target-bomb1-fire-shot sv-60 sv-64 sv-48 (the-as int sv-104)) + (set! sv-64 (+ sv-64 1)) + (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (set! sv-92 1.0) + ) + ) + (set! sv-88 (seek sv-88 (the-as float sv-92) (* 6.0 (-> self clock seconds-per-frame)))) + (ja :num! (loop!)) + (let ((a0-60 (-> self skel root-channel 1))) + (let ((f0-17 sv-88)) + (set! (-> a0-60 frame-interp 1) f0-17) + (set! (-> a0-60 frame-interp 0) f0-17) + ) + (set! (-> a0-60 param 0) 0.0) + (joint-control-channel-group-eval! a0-60 (the-as art-joint-anim #f) num-func-chan) + ) + (suspend) + ) + 0 + (set! (-> self post-hook) gp-0) + ) + (set! (-> self control unknown-surface00) *double-jump-mods*) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 421) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 421)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (ja-blend-eval) + (compute-alignment! (-> self align)) + (set! (-> self control unknown-float06) 1.0) + (set! (-> self darkjak clock-vel) 4.0) + (suspend) + (ja :num! (seek!)) + ) + (set! (-> self gun surpress-time) (-> self clock frame-counter)) + (send-event (handle->process (-> self notify)) 'notify 'attack 17) + (go target-darkjak-get-off) + (none) + ) + :post target-post + ) + +;; failed to figure out what this is: +(defstate target-darkjak-giant (target) + :event target-standard-event-handler + :exit (behavior () + (logclear! (-> self state-flags) (state-flags lleg-still rleg-still)) + (set! (-> self darkjak-interp) 1.0) + (set! (-> self darkjak-giant-interp) (the-as float (-> self control unknown-word04))) + (when (= (the-as float (-> self control unknown-word04)) 1.0) + (set! (-> self darkjak stage) (logand -33 (-> self darkjak stage))) + (set! (-> self darkjak want-stage) (-> self darkjak stage)) + ) + (none) + ) + :code (behavior () + (send-event (handle->process (-> self notify)) 'notify 'attack 18) + (set! (-> self darkjak want-stage) (-> self darkjak stage)) + (logior! (-> self state-flags) (state-flags sf4)) + (set! (-> self neck flex-blend) 0.0) + (set! (-> self control unknown-surface00) *darkjak-trans-mods*) + (logior! (-> self darkjak stage) 32) + (set! (-> self darkjak want-stage) (-> self darkjak stage)) + (sound-play "djak-transform") + (let ((gp-1 (new 'stack-no-clear 'collide-query))) + (let ((s5-1 (new 'stack-no-clear 'inline-array 'sphere 1))) + (dotimes (s4-0 1) + ((method-of-type sphere new) (the-as symbol (-> s5-1 s4-0)) sphere) + ) + (set! (-> s5-1 0 quad) (-> self control trans quad)) + (set! (-> s5-1 0 y) (+ 12697.6 (-> s5-1 0 y))) + (set! (-> s5-1 0 r) 11878.4) + (let ((v1-29 gp-1)) + (set! (-> v1-29 spheres) s5-1) + (set! (-> v1-29 num-spheres) (the-as uint 1)) + (set! (-> v1-29 collide-with) (logclear + (-> self control root-prim prim-core collide-with) + (collide-spec civilian enemy vehicle-sphere projectile) + ) + ) + (set! (-> v1-29 ignore-process0) #f) + (set! (-> v1-29 ignore-process1) #f) + (set! (-> v1-29 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-29 best-my-prim) (the-as collide-shape-prim #t)) + (set! (-> v1-29 action-mask) (collide-action solid)) + ) + ) + (let ((gp-2 (not (fill-and-probe-using-spheres *collide-cache* gp-1)))) + (set! (-> self control unknown-word04) (the-as uint (if gp-2 + 2.0 + 1.0 + ) + ) + ) + (when gp-2 + (set-setting! 'string-min-length 'rel #x3fe66666 0) + (set-setting! 'string-max-length 'rel #x3fc00000 0) + (set-setting! 'string-spline-max-move 'abs #x46000000 0) + (set-setting! 'string-spline-accel 'abs #x433851ec 0) + (set-setting! 'string-spline-max-move-player 'abs #x45c00000 0) + (set-setting! 'string-spline-accel-player 'abs #x430f5c29 0) + ) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 412) :num! (seek! (ja-aframe 17.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (cond + (gp-2 + (set! (-> self darkjak-giant-interp) (lerp-scale 1.0 2.0 (ja-aframe-num 0) 5.0 15.0)) + ) + ((>= (ja-aframe-num 0) 10.0) + (set! (-> self darkjak-giant-interp) (lerp-scale 2.0 1.0 (ja-aframe-num 0) 5.0 15.0)) + ) + (else + (set! (-> self darkjak-giant-interp) (lerp-scale 1.0 2.0 (ja-aframe-num 0) 5.0 15.0)) + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 17.0 0))) + ) + ) + ) + (send-event *traffic-manager* 'increase-alert-level 4) + (go target-stance) + (none) + ) + :post (-> target-grab post) + ) diff --git a/test/decompiler/reference/jak2/engine/target/target-gun_REF.gc b/test/decompiler/reference/jak2/engine/target/target-gun_REF.gc new file mode 100644 index 0000000000..392dbbc84b --- /dev/null +++ b/test/decompiler/reference/jak2/engine/target/target-gun_REF.gc @@ -0,0 +1,3010 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(if (not (nmember "gunp" *kernel-packages*)) + (set! *kernel-packages* (cons "gunp" *kernel-packages*)) + ) + +;; definition for symbol *gun-walk-mods*, type surface +(define *gun-walk-mods* + (new 'static 'surface + :name 'run + :turnv 18204.445 + :turnvv 72817.78 + :tiltv 65536.0 + :tiltvv 262144.0 + :transv-max 40960.0 + :target-speed 40960.0 + :seek0 1.0 + :seek90 1.0 + :seek180 1.0 + :fric 1.0 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :turnvf 60.0 + :turnvvf 300.0 + :tiltvf 150.0 + :tiltvvf 15.0 + :mult-hook (lambda :behavior target + ((arg0 surface) (arg1 object) (arg2 object) (arg3 int)) + (case arg3 + ((1) + (let* ((f0-0 (deg-diff (y-angle (-> self control)) (vector-y-angle (-> self control unknown-vector08)))) + (f30-0 (lerp-scale 0.0 1.0 (fabs f0-0) 1820.4445 6371.5557)) + ) + (cond + ((and (logtest? (-> self gun track?) 1) + (!= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + (>= (-> self gun track-turnv-range) + (vector-vector-distance (-> self control trans) (-> self gun track-trans)) + ) + ) + (let* ((s5-1 (-> self control)) + (s3-0 (-> self gun track-trans)) + (f0-4 + (deg-diff (y-angle s5-1) (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s3-0 (-> s5-1 trans)))) + ) + ) + (set! (-> self control unknown-float003) (lerp-scale 0.0 2.0 (fabs f0-4) 0.0 3640.889)) + ) + #t + ) + ((< (-> self control unknown-float003) f30-0) + (seek! (-> self control unknown-float003) f30-0 (* 4.0 (-> self clock seconds-per-frame))) + ) + (else + (seek! (-> self control unknown-float003) f30-0 (-> self clock seconds-per-frame)) + ) + ) + ) + (let ((f30-1 131072.0) + (f0-15 30.0) + ) + (when (< 1.0 (-> self control unknown-float003)) + (set! f30-1 (lerp-scale 131072.0 291271.12 (-> self control unknown-float003) 1.0 2.0)) + (set! f0-15 (lerp-scale 30.0 15.0 (-> self control unknown-float003) 1.0 2.0)) + (set! (-> arg0 turnvv) f30-1) + (set! (-> arg0 turnvvf) f0-15) + ) + (set! (-> arg0 turnv) f30-1) + (set! (-> arg0 turnvf) f0-15) + ) + (cond + ((and (nonzero? (-> self gun track-target-hold-time)) + (< (-> self clock frame-counter) (-> self gun track-target-hold-time)) + ) + (set! (-> arg0 turnvv) 0.0) + (set! (-> arg0 turnvvf) 0.0) + (set! (-> arg0 seek0) 0.0) + (set! (-> arg0 seek90) 0.0) + (set! (-> arg0 seek180) 0.0) + (set! (-> arg0 transv-max) 0.0) + ) + ((and (-> self next-state) (= (-> self next-state name) 'target-gun-stance)) + (set! (-> arg0 turnv) 364088.88) + (set! (-> arg0 turnvf) 30.0) + arg0 + ) + ) + ) + ) + ) + :flags (surface-flag look-around no-turn-around) + ) + ) + +;; definition for function target-gun-event-handler +(defbehavior target-gun-event-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (cond + ((and (= arg2 'query) (= (-> arg3 param 0) 'mode)) + 'gun + ) + (else + (case arg2 + (('change-mode) + (case (-> arg3 param 0) + (('grab) + (when (not (logtest? (-> self focus-status) (focus-status dead))) + (if (not (-> arg3 param 1)) + #t + (go target-grab 'stance) + ) + ) + ) + (('gun) + (let ((v1-9 (-> arg3 param 2))) + (when (nonzero? v1-9) + (set! (-> self gun using-gun-type) (the-as pickup-type v1-9)) + v1-9 + ) + ) + ) + (('falling) + (go target-falling #f) + ) + (('look-around) + (go target-look-around) + ) + (('normal 'board 'pilot) + (if (and (using-gun? self) (target-gun-end-mode #f)) + (go target-stance) + ) + ) + ) + ) + (else + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + ) + +;; definition for function target-gun-setup +;; WARN: Return type mismatch int vs none. +(defbehavior target-gun-setup target ((arg0 symbol)) + (when (zero? (-> self gun)) + (if (zero? (-> self game gun-type)) + (set! (-> self game gun-type) 2) + ) + (set! (-> self gun) (new 'process 'gun-info)) + (set! (-> self gun process) (the-as (pointer target) (process->ppointer self))) + (set! (-> self gun gun) (the-as (pointer gun) #f)) + (set! (-> self gun active?) #f) + (set! (-> self gun latch?) #f) + (set! (-> self gun put-away?) #f) + (set! (-> self gun charge-active?) (the-as handle #f)) + self + (set! (-> self skel top-anim) (new 'process 'top-anim-joint-control)) + (set! (-> self skel interp-select 0) 0) + (set! (-> self skel interp-select 1) 0) + (quaternion-identity! (the-as quaternion (-> self gun top-anim-twist))) + (set! (-> self gun combo-window-state) #f) + ((method-of-type focus reset-to-collide-spec) + (the-as focus (-> self gun track-target)) + (collide-spec jak player-list) + ) + (reset-to-collide-spec (-> self gun track-target 1) (collide-spec jak player-list)) + (add-connection *pad-engine* self target-gun-marking-menu self #f #f) + ) + (if (not arg0) + (target-gun-end-mode #f) + ) + (when (-> self gun gun) + (deactivate (-> self gun gun 0)) + (set! (-> self gun gun) (the-as (pointer gun) #f)) + ) + (if arg0 + (set! (-> self gun gun) (process-spawn gun :init gun-init :from *8k-dead-pool* :to self)) + ) + 0 + (none) + ) + +;; definition for function target-gun-init +;; WARN: Return type mismatch int vs none. +(defbehavior target-gun-init target ((arg0 int)) + (let ((gp-0 (-> self gun))) + (if (zero? (-> gp-0 hips)) + (set! (-> gp-0 hips) (new 'process 'joint-mod (joint-mod-mode rotate) self 26)) + ) + (if (zero? (-> gp-0 upper-body)) + (set! (-> gp-0 upper-body) (-> self upper-body)) + ) + (mode-set! (-> gp-0 hips) (joint-mod-mode rotate)) + (set! (-> gp-0 gun-roty) (y-angle (-> self control))) + (top-anim-joint-control-method-9 (-> self skel top-anim)) + (set! (-> self skel top-anim interp) 1.0) + (quaternion-identity! (the-as quaternion (-> self gun top-anim-twist))) + (quaternion-identity! (the-as quaternion (-> self gun top-anim-twist-targ))) + (set! (-> self gun top-anim-twist-reset) (the-as uint 0)) + (set! (-> gp-0 gun-type) (pickup-type eco-yellow)) + (target-gun-type-set! arg0) + (set! (-> gp-0 gun-get-on-time) (-> self clock frame-counter)) + ) + (set! (-> self board latch?) #f) + (set! (-> self gun put-away?) #f) + (set! (-> self gun active?) #f) + (set! (-> self gun surpress-time) 0) + (set! (-> self gun track?) (the-as uint 6)) + (set! (-> self gun track-turn) 0.0) + (set! (-> self gun track-tilt) 0.0) + (set! (-> self gun track-target-hold-time) 0) + (set! (-> self gun turn-fast-hold-time) 0) + ((method-of-type focus reset-to-collide-spec) + (the-as focus (-> self gun track-target)) + (collide-spec jak player-list) + ) + (set! (-> self gun fire-dir-rot) 0.0) + (set! (-> self control unknown-float003) 0.0) + (set! (-> self gun blue-whine-volume) 0.0) + (if (zero? (-> self gun blue-whine-sound-id)) + (set! (-> self gun blue-whine-sound-id) (the-as uint (new-sound-id))) + ) + (set-setting! 'mode-sound-bank 'gun 0 0) + (sound-play "gun-takeout") + (set-setting! 'sound-flava #f #x41f00000 1) + (set! (-> self gun charge-ammo) 0.0) + (set! (-> self gun charge-start-time) 0) + (set! (-> self gun top-anim-tilt-up) 0.0) + (let ((f0-9 (if (or (nonzero? (-> self gun fire-pending)) + (cpad-hold? (-> self control unknown-cpad-info00 number) r1) + (-> self gun latch?) + ) + 2.0 + 1.0 + ) + ) + ) + (cond + ((logtest? (-> self focus-status) (focus-status pilot-riding)) + (case (-> self gun gun-type) + (((pickup-type eco-yellow)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 229) + 0.0 + 0 + 15 + f0-9 + 0.0 + #f + ) + ) + (((pickup-type eco-red)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 198) + 0.0 + 0 + 15 + f0-9 + 0.0 + #f + ) + ) + (((pickup-type eco-blue)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 230) + 0.0 + 0 + 15 + f0-9 + 0.0 + #f + ) + ) + (((pickup-type eco-dark)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 231) + 0.0 + 0 + 15 + f0-9 + 0.0 + #f + ) + ) + ) + ) + (else + (case (-> self gun gun-type) + (((pickup-type eco-yellow)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 265) + 0.0 + 0 + 15 + f0-9 + 0.0 + #f + ) + ) + (((pickup-type eco-red)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 263) + 0.0 + 0 + 15 + f0-9 + 0.0 + #f + ) + ) + (((pickup-type eco-blue)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 266) + 0.0 + 0 + 15 + f0-9 + 0.0 + #f + ) + ) + (((pickup-type eco-dark)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 264) + 0.0 + 0 + 15 + f0-9 + 0.0 + #f + ) + ) + ) + ) + ) + ) + (if (= (-> self control unknown-symbol00) 'duck) + (target-collide-set! (-> self control unknown-symbol00) (-> self control unknown-float000)) + (target-collide-set! 'gun 0.0) + ) + 0 + (none) + ) + +;; definition for function target-gun-exit +(defun target-gun-exit () + #f + ) + +;; definition for function target-gun-end-mode +(defbehavior target-gun-end-mode target ((arg0 symbol)) + (when (using-gun? self) + (set! (-> self gun fire-pending) 0) + (mode-set! (-> self gun hips) (joint-mod-mode flex-blend)) + (send-event *camera* 'clear-slave-option #x58000) + (send-event *camera* 'set-dist #f #f) + (send-event *camera* 'yes-follow) + (let ((v1-16 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-16 command) (sound-command set-param)) + (set! (-> v1-16 id) (the-as sound-id (-> self gun blue-whine-sound-id))) + (set! (-> v1-16 params volume) -4) + (set! (-> v1-16 auto-time) 120) + (set! (-> v1-16 auto-from) 2) + (set! (-> v1-16 params mask) (the-as uint 17)) + (-> v1-16 id) + ) + (set! (-> self gun active?) #f) + (cond + ((and (not (logtest? (surface-flag gun-fast-exit) (-> self control unknown-surface01 flags))) + (zero? (logand (-> self focus-status) (focus-status dead))) + ) + (sound-play "gun-putaway") + (cond + ((logtest? (-> self focus-status) (focus-status pilot-riding)) + (case (-> self gun gun-type) + (((pickup-type eco-yellow)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 229) + 0.0 + 10 + 0 + -1.0 + 0.0 + #f + ) + (set! (-> self skel top-anim frame-post-put-away) (the-as basic #t)) + ) + (((pickup-type eco-red)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 198) + 0.0 + 10 + 0 + -1.0 + 0.0 + #f + ) + (set! (-> self skel top-anim frame-post-put-away) (the-as basic #t)) + ) + (((pickup-type eco-blue)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 230) + 0.0 + 10 + 0 + -1.0 + 0.0 + #f + ) + (set! (-> self skel top-anim frame-post-put-away) (the-as basic #t)) + ) + (((pickup-type eco-dark)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 231) + 0.0 + 10 + 0 + -1.0 + 0.0 + #f + ) + (set! (-> self skel top-anim frame-post-put-away) (the-as basic #t)) + ) + (else + (set! (-> self skel top-anim interp) 0.0) + ) + ) + ) + (else + (case (-> self gun gun-type) + (((pickup-type eco-yellow)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 265) + 0.0 + 10 + 0 + -1.0 + 0.0 + #f + ) + (set! (-> self skel top-anim frame-post-put-away) (the-as basic #t)) + ) + (((pickup-type eco-red)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 263) + 0.0 + 10 + 0 + -1.0 + 0.0 + #f + ) + (set! (-> self skel top-anim frame-post-put-away) (the-as basic #t)) + ) + (((pickup-type eco-blue)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 266) + 14.0 + 10 + 0 + -1.0 + 0.0 + #f + ) + (set! (-> self skel top-anim frame-post-put-away) (the-as basic #t)) + ) + (((pickup-type eco-dark)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 264) + 0.0 + 10 + 0 + -1.0 + 0.0 + #f + ) + (set! (-> self skel top-anim frame-post-put-away) (the-as basic #t)) + ) + (else + (set! (-> self skel top-anim interp) 0.0) + ) + ) + ) + ) + ) + (else + (set! (-> self skel top-anim interp) 0.0) + ) + ) + (set! (-> self gun gun-type) (pickup-type none)) + (remove-setting! 'mode-sound-bank) + (remove-setting! 'sound-flava) + (if (= (-> self control unknown-symbol00) 'duck) + (target-collide-set! (-> self control unknown-symbol00) (-> self control unknown-float000)) + (target-collide-set! 'normal 0.0) + ) + (when arg0 + (set! (-> self gun using-gun-type) (pickup-type none)) + (set! (-> self gun latch?) #f) + (set! (-> self gun put-away?) #f) + ) + #t + ) + ) + +;; definition for function quat<-gun! +(defun quat<-gun! ((arg0 quaternion) (arg1 quaternion)) + (quaternion-copy! arg0 (the-as quaternion *null-vector*)) + ) + +;; definition for function target-gun-ammo-out-pick +(defbehavior target-gun-ammo-out-pick target () + (cond + ((and (and (logtest? (-> self game features) (game-feature unk-game-feature-06)) + (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-yellow)) + (-> self game features) + ) + ) + (< 0.0 (-> self game gun-ammo 0)) + ) + 1 + ) + ((and (and (logtest? (-> self game features) (game-feature unk-game-feature-06)) + (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-red)) + (-> self game features) + ) + ) + (< 0.0 (-> self game gun-ammo 1)) + ) + 2 + ) + ((and (and (logtest? (-> self game features) (game-feature unk-game-feature-06)) + (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-blue)) + (-> self game features) + ) + ) + (< 0.0 (-> self game gun-ammo 2)) + ) + 3 + ) + ((and (and (logtest? (-> self game features) (game-feature unk-game-feature-06)) + (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-dark)) + (-> self game features) + ) + ) + (< 0.0 (-> self game gun-ammo 3)) + ) + 4 + ) + (else + 0 + ) + ) + ) + +;; definition for function target-gun-type-set! +;; WARN: Return type mismatch int vs none. +(defbehavior target-gun-type-set! target ((arg0 int)) + (if (zero? arg0) + (set! arg0 (-> self game gun-type)) + ) + (when (not (logtest? (the-as game-feature (ash 1 (+ arg0 5))) + (logand (-> self game features) (-> *setting-control* user-current features)) + ) + ) + (when (and (logtest? (-> self game features) (game-feature unk-game-feature-06)) + (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-yellow)) + (-> self game features) + ) + ) + (set! arg0 1) + (goto cfg-39) + ) + (when (and (logtest? (-> self game features) (game-feature unk-game-feature-06)) + (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-red)) + (-> self game features) + ) + ) + (set! arg0 2) + (goto cfg-39) + ) + (when (and (logtest? (-> self game features) (game-feature unk-game-feature-06)) + (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-blue)) + (-> self game features) + ) + ) + (set! arg0 3) + (goto cfg-39) + ) + (when (and (logtest? (-> self game features) (game-feature unk-game-feature-06)) + (-> *setting-control* user-current gun) + (logtest? (logand (-> *setting-control* user-current features) (game-feature gun-dark)) + (-> self game features) + ) + ) + (set! arg0 4) + (goto cfg-39) + ) + (set! arg0 0) + (label cfg-39) + (cond + ((zero? arg0) + (set! arg0 arg0) + (goto cfg-190) + ) + (else + (empty) + ) + ) + ) + (set! (-> self game gun-type) arg0) + (set! (-> self gun track-turnv-range) 81920.0) + (set! (-> self gun track-tilt-range) 0.0) + (set! (-> self gun track-turn-range) 0.0) + (set! (-> self gun track-turn-max) 1820.4445) + (set! (-> self gun track-tilt-max) 16019.911) + (set! (-> self gun gun-control) (the-as uint 1)) + (set! (-> self gun fire-spin) 0.0) + (set! (-> self gun fire-spinv) 0.0) + (set! (-> self gun fire-time) 0) + (set! (-> self gun laser-active?) #t) + (set! (-> self gun top-anim-gun-height) 5283.84) + (set! (-> self gun top-anim-low-high) 0.0) + (set! (-> self skel top-anim frame-speed) 1.0) + (set! (-> self skel top-anim frame-targ) #f) + (when (using-gun? self) + (let ((s5-0 (-> self gun gun-type))) + (set! (-> self gun gun-type) (the-as pickup-type arg0)) + (set! (-> self gun using-gun-type) (the-as pickup-type arg0)) + (case arg0 + ((3) + (set! (-> self gun gun-control) (the-as uint 4)) + (set! (-> self gun fire-range) 327680.0) + (set! (-> self gun track-find-range) 327680.0) + (set! (-> self gun track-turn-range) 327680.0) + (set! (-> self gun track-turn-max) 910.2222) + (set! (-> self gun track-tilt-range) 327680.0) + (set! (-> self gun track-angle-mult) 1.75) + (set! (-> self gun track-require) (the-as uint 3)) + (set! (-> self gun fire-delay) (the-as uint 15)) + (set! (-> self gun combo-fire-delay) (the-as uint 30)) + (set! (-> self gun track-beam-size) 2457.6) + (remove-setting! 'gun-min-height) + (remove-setting! 'gun-max-height) + ) + ((1) + (set! (-> self gun fire-range) 409600.0) + (set! (-> self gun track-find-range) 286720.0) + (set! (-> self gun track-tilt-range) 409600.0) + (set! (-> self gun track-turn-range) 409600.0) + (set! (-> self gun track-angle-mult) 1.75) + (set! (-> self gun track-require) (the-as uint 3)) + (set! (-> self gun fire-delay) (the-as uint 96)) + (set! (-> self gun combo-fire-delay) (the-as uint 30)) + (set! (-> self gun track-beam-size) 819.2) + (remove-setting! 'gun-min-height) + (remove-setting! 'gun-max-height) + ) + ((2) + (set! (-> self gun fire-range) 61440.0) + (set! (-> self gun track-find-range) 81920.0) + (set! (-> self gun track-tilt-range) 61440.0) + (set! (-> self gun track-turn-range) 61440.0) + (set! (-> self gun track-turn-max) 910.2222) + (set! (-> self gun track-angle-mult) 0.0) + (set! (-> self gun track-require) (the-as uint 3)) + (if (logtest? (-> self game features) (game-feature gun-upgrade-speed)) + (set! (-> self gun fire-delay) (the-as uint 180)) + (set! (-> self gun fire-delay) (the-as uint 330)) + ) + (set! (-> self gun combo-fire-delay) (the-as uint 150)) + (set! (-> self gun track-beam-size) 1228.8) + (remove-setting! 'gun-min-height) + (set-setting! 'gun-max-height 'abs #x46c00000 0) + ) + ((4) + (set! (-> self gun gun-control) (the-as uint 2)) + (set! (-> self gun fire-range) 1638400.0) + (set! (-> self gun track-tilt-range) 1638400.0) + (set! (-> self gun track-turn-range) 1638400.0) + (set! (-> self gun track-find-range) 1638400.0) + (set! (-> self gun track-angle-mult) 1.75) + (set! (-> self gun fire-delay) (the-as uint 255)) + (set! (-> self gun combo-fire-delay) (the-as uint 150)) + (set! (-> self gun track-beam-size) 1228.8) + (set! (-> self gun track-require) (the-as uint 2)) + (remove-setting! 'gun-min-height) + (remove-setting! 'gun-max-height) + ) + ) + (quat<-gun! (the-as quaternion (-> self gun top-anim-twist-targ)) (the-as quaternion arg0)) + (set! (-> self skel top-anim frame-post-blend) 0.1333333) + (cond + ((logtest? (-> self focus-status) (focus-status pilot-riding)) + (let ((v1-164 arg0)) + (cond + ((and (= s5-0 (pickup-type eco-red)) (= v1-164 4)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 225) + 0.0 + 30 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ((and (= s5-0 (pickup-type eco-dark)) (= v1-164 2)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 225) + 0.0 + 30 + 0 + -1.0 + 0.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ((and (= s5-0 (pickup-type eco-red)) (= v1-164 1)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 226) + 0.0 + 30 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ((and (= s5-0 (pickup-type eco-yellow)) (= v1-164 2)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 226) + 0.0 + 30 + 0 + -1.0 + 0.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ((and (= s5-0 (pickup-type eco-red)) (= v1-164 3)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 227) + 0.0 + 30 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ((and (= s5-0 (pickup-type eco-blue)) (= v1-164 2)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 227) + 0.0 + 30 + 0 + -1.0 + 0.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ((and (= s5-0 (pickup-type eco-yellow)) (= v1-164 3)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 228) + 0.0 + 30 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ((and (= s5-0 (pickup-type eco-blue)) (= v1-164 1)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 228) + 0.0 + 30 + 0 + -1.0 + 0.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ((and (= s5-0 (pickup-type eco-dark)) (= v1-164 1)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 226) + 0.0 + 30 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ((and (= s5-0 (pickup-type eco-dark)) (= v1-164 3)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 227) + 0.0 + 30 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ((and (= s5-0 (pickup-type eco-blue)) (= v1-164 4)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 227) + 0.0 + 30 + 0 + -1.0 + 0.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ((and (= s5-0 (pickup-type eco-yellow)) (= v1-164 4)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 226) + 0.0 + 30 + 0 + -1.0 + 0.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ) + ) + ) + (else + (let ((v1-227 arg0)) + (cond + ((and (= s5-0 (pickup-type eco-red)) (= v1-227 4)) + (if (rand-vu-percent? 0.5) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 268) + 0.0 + 30 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 269) + 0.0 + 19 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-2")) + ) + ) + ) + ((and (= s5-0 (pickup-type eco-dark)) (= v1-227 2)) + (if (rand-vu-percent? 0.5) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 268) + 0.0 + 30 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 269) + 0.0 + 19 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-2")) + ) + ) + ) + ((and (= s5-0 (pickup-type eco-dark)) (= v1-227 1)) + (if (rand-vu-percent? 0.5) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 269) + 0.0 + 19 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-2")) + ) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 270) + 0.0 + 19 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-3")) + ) + ) + ) + ((and (= s5-0 (pickup-type eco-red)) (= v1-227 1)) + (if (rand-vu-percent? 0.5) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 269) + 0.0 + 19 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-2")) + ) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 270) + 0.0 + 19 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-3")) + ) + ) + ) + ((and (= s5-0 (pickup-type eco-yellow)) (= v1-227 2)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 268) + 0.0 + 19 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ((and (= s5-0 (pickup-type eco-yellow)) (= v1-227 4)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 268) + 0.0 + 19 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-1")) + ) + ) + ((and (= s5-0 (pickup-type eco-red)) (= v1-227 3)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 271) + 0.0 + 19 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-4")) + ) + ) + ((and (= s5-0 (pickup-type eco-dark)) (= v1-227 3)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 271) + 0.0 + 19 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-4")) + ) + ) + ((and (= s5-0 (pickup-type eco-blue)) (= v1-227 2)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 272) + 0.0 + 19 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-5")) + ) + ) + ((and (= s5-0 (pickup-type eco-blue)) (= v1-227 4)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 272) + 0.0 + 19 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-5")) + ) + ) + ((and (= s5-0 (pickup-type eco-yellow)) (= v1-227 3)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 271) + 0.0 + 30 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-4")) + ) + ) + ((and (= s5-0 (pickup-type eco-blue)) (= v1-227 1)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 252) + 0.0 + 19 + 19 + 1.0 + 2.0 + (the-as symbol (static-sound-spec "gun-trans-6")) + ) + ) + ) + ) + ) + ) + ) + ) + (set! (-> self gun upper-body twist-max x) (-> self gun track-tilt-max)) + (set! (-> self gun upper-body twist-max y) (-> self gun track-turn-max)) + (set! (-> self gun upper-body twist-max z) (-> self gun track-tilt-range)) + (set! (-> self gun upper-body twist-max w) (-> self gun track-turn-range)) + (set! (-> self gun upper-body max-dist) (fmax (-> self gun track-tilt-range) (-> self gun track-turn-range))) + (label cfg-190) + (none) + ) + +;; definition for function target-gun-marking-menu +;; WARN: Return type mismatch int vs none. +(defun target-gun-marking-menu ((arg0 target)) + (when (and (not (paused?)) + (not (and (logtest? (focus-status dark) (-> arg0 focus-status)) (nonzero? (-> arg0 darkjak)))) + (zero? (logand (-> arg0 focus-status) (focus-status grabbed))) + ) + (let ((s5-0 (the-as int (-> arg0 gun using-gun-type)))) + (cond + ((cpad-pressed? (-> arg0 control unknown-cpad-info00 number) down) + (set! s5-0 1) + ) + ((cpad-pressed? (-> arg0 control unknown-cpad-info00 number) up) + (set! s5-0 2) + ) + ((cpad-pressed? (-> arg0 control unknown-cpad-info00 number) left) + (set! s5-0 3) + ) + ((cpad-pressed? (-> arg0 control unknown-cpad-info00 number) right) + (set! s5-0 4) + ) + ) + (when (and (nonzero? s5-0) + (and (logtest? (the-as game-feature (ash 1 (+ s5-0 5))) + (logand (-> arg0 game features) (-> *setting-control* user-current features)) + ) + (or (not (logtest? (focus-status pilot) (-> arg0 focus-status))) + (and (nonzero? (-> arg0 pilot)) (-> arg0 pilot gun?)) + ) + (begin + (set! (-> arg0 gun using-gun-type) (the-as pickup-type s5-0)) + (and s5-0 + (!= s5-0 (-> arg0 gun gun-type)) + (let ((v1-62 (-> arg0 skel top-anim frame-targ))) + (or (not v1-62) + (= v1-62 (-> arg0 draw art-group data 304)) + (= v1-62 (-> arg0 draw art-group data 300)) + (= v1-62 (-> arg0 draw art-group data 305)) + (= v1-62 (-> arg0 draw art-group data 301)) + ) + ) + (not (handle->process (-> arg0 gun charge-active?))) + ) + ) + ) + ) + (cond + ((using-gun? arg0) + (sound-play "select-option") + (send-event arg0 'gun-type s5-0) + ) + ((want-to-gun? arg0 #t) + (send-event arg0 'change-mode 'gun #f s5-0) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for function target-gun-build-track-list +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior target-gun-build-track-list target () + (let ((gp-0 (new 'stack-no-clear 'vector))) + (set! (-> gp-0 quad) (-> self control trans quad)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (let ((s4-0 (-> self gun track-dir))) + (set! (-> s4-0 quad) + (-> (the-as + vector + (if (and (or (= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + (logtest? (surface-flag gun-strafe) (-> self control unknown-surface01 flags)) + ) + (not (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak)))) + ) + (-> self gun fire-dir) + (-> self control unknown-vector08) + ) + ) + quad + ) + ) + (vector-flatten! s4-0 s4-0 (-> self control unknown-matrix01 vector 1)) + (vector-normalize! s4-0 1.0) + (set! (-> gp-0 y) (+ 6144.0 (-> gp-0 y))) + (vector+float*! gp-0 gp-0 s4-0 -32768.0) + (vector+float*! s5-0 gp-0 s4-0 (+ 32768.0 (-> self gun track-find-range))) + ) + (let ((s4-1 (-> self focus-search)) + (s3-0 (vector-average! (new 'stack-no-clear 'vector) gp-0 s5-0)) + ) + (set! (-> s3-0 w) (* 0.5 (vector-vector-distance gp-0 s5-0))) + (set! (-> s4-1 length) + (spatial-hash-method-36 *actor-hash* (the-as sphere s3-0) (-> s4-1 data) (-> s4-1 allocated-length)) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for function target-gun-find-track +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior target-gun-find-track target () + (if (logtest? (-> self gun upper-body track-mode) (track-mode lock-on)) + (logior! (-> self gun track?) 8) + (set! (-> self gun track?) (logand -9 (-> self gun track?))) + ) + (let ((gp-0 (the-as basic #f))) + (when (and (or (< (- (-> self clock frame-counter) (-> self control unknown-time-frame29)) (seconds 0.2)) + (and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) + (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + ) + (or (logtest? (surface-flag gun-direct) (-> self control unknown-surface01 flags)) + (= (-> self gun gun-type) (pickup-type eco-dark)) + ) + ) + (>= (-> self clock frame-counter) (-> self gun track-target-hold-time)) + ) + (target-gun-build-track-list) + (let ((t2-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 8)))) + (set! (-> t2-0 y) (+ 2048.0 (-> t2-0 y))) + (cond + ((logtest? (surface-flag gun-strafe) (-> self control unknown-surface01 flags)) + (set! gp-0 (find-nearest-focusable + (-> self focus-search) + (-> self control trans) + (+ 32768.0 (-> self gun track-find-range)) + (search-info-flag crate enemy cull-angle probe check-track prefer-center) + (the-as search-info-flag (-> self gun track-require)) + (-> self gun track-dir) + t2-0 + 10922.667 + ) + ) + ) + ((or (and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) + (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + ) + (logtest? (surface-flag gun-direct) (-> self control unknown-surface01 flags)) + ) + (set! gp-0 (find-nearest-focusable + (-> self focus-search) + (-> self control trans) + (fmin 122880.0 (+ 32768.0 (-> self gun track-find-range))) + (search-info-flag crate enemy cull-angle probe check-track) + (the-as search-info-flag (-> self gun track-require)) + (-> self gun track-dir) + t2-0 + 16384.0 + ) + ) + ) + ((= (-> self gun gun-type) (pickup-type eco-dark)) + (set! gp-0 (find-nearest-focusable + (-> self focus-search) + (-> self control trans) + (+ 32768.0 (-> self gun track-find-range)) + (search-info-flag crate enemy cull-angle check-track prefer-center) + (the-as search-info-flag (-> self gun track-require)) + (-> self gun track-dir) + t2-0 + 5461.3335 + ) + ) + ) + (else + (set! gp-0 (find-nearest-focusable + (-> self focus-search) + (-> self control trans) + (+ 32768.0 (-> self gun track-find-range)) + (search-info-flag crate enemy cull-angle probe check-track prefer-center) + (the-as search-info-flag (-> self gun track-require)) + (-> self gun track-dir) + t2-0 + 5461.3335 + ) + ) + ) + ) + ) + ) + (cond + (gp-0 + (set! (-> self gun track-target-hold-time) 0) + (set! (-> self gun track?) (the-as uint 7)) + (set! (-> self gun track-trans quad) (-> (get-trans (the-as process-focusable gp-0) 3) quad)) + (when ((method-of-type focus try-update-focus) + (the-as focus (-> self gun track-target)) + (the-as process-focusable gp-0) + ) + (set! (-> self gun track-start-time) (-> self clock frame-counter)) + (if (< (- (-> self clock frame-counter) (-> self control unknown-time-frame29)) (seconds 0.2)) + (set! (-> self gun track-press-start-time) (-> self clock frame-counter)) + ) + ) + (if (logtest? (process-mask enemy guard) (-> (the-as process-focusable gp-0) mask)) + (try-update-focus (-> self gun track-target 1) (the-as process-focusable gp-0)) + ) + ) + (else + (let ((s5-1 (handle->process (-> self gun track-target 0 handle)))) + (cond + ((or (not s5-1) + (or (and (logtest? (-> (the-as process-focusable s5-1) focus-status) (focus-status dead)) + (zero? (-> self gun track-target-hold-time)) + ) + (and (not (and (nonzero? (-> self gun track-target-hold-time)) + (< (-> self clock frame-counter) (-> self gun track-target-hold-time)) + ) + ) + (and (not (logtest? (surface-flag spin) (-> self control unknown-surface01 flags))) + (let ((f30-0 21845.334) + (s4-0 (-> self control)) + (s2-0 (-> self gun track-trans)) + ) + (< f30-0 + (fabs + (deg-diff (y-angle s4-0) (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s2-0 (-> s4-0 trans)))) + ) + ) + ) + ) + ) + (and (or (and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) + (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + ) + (logtest? (surface-flag gun-direct) (-> self control unknown-surface01 flags)) + ) + (< 102400.0 (vector-vector-distance (-> self control trans) (-> self gun track-trans))) + (< (vector-dot + (-> self gun track-dir) + (vector-normalize! + (vector-! (new 'stack-no-clear 'vector) (-> self gun track-trans) (-> self control trans)) + 1.0 + ) + ) + 0.5 + ) + ) + (= (send-event (the-as process-focusable s5-1) 'track #t) 'abort) + ) + ) + (set! (-> self gun track?) (the-as uint 6)) + (set! (-> self gun track-target-hold-time) 0) + ((method-of-type focus clear-focused) (the-as focus (-> self gun track-target))) + ) + (else + (let ((a1-21 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-21 from) (process->ppointer self)) + (set! (-> a1-21 num-params) 1) + (set! (-> a1-21 message) 'track) + (set! (-> a1-21 param 0) (the-as uint #f)) + (cond + ((and (not (send-event-function (the-as process-focusable s5-1) a1-21)) + (zero? (-> self gun track-target-hold-time)) + ) + (set! (-> self gun track?) (logand -5 (-> self gun track?))) + (set! (-> self gun track-trans quad) (-> (get-trans (the-as process-focusable s5-1) 3) quad)) + ) + (else + (set! (-> self gun track-trans quad) (-> (get-trans (the-as process-focusable s5-1) 3) quad)) + ) + ) + ) + ) + ) + ) + ) + ) + (let ((s5-2 (handle->process (-> self gun track-target 1 handle)))) + (cond + ((logtest? (surface-flag gun-strafe) (-> self control unknown-surface01 flags)) + (send-event *camera* 'set-slave-option #x8000) + ) + ((the-as process-focusable s5-2) + (let ((s4-5 (get-trans (the-as process-focusable s5-2) 3))) + (let ((s3-1 (new 'stack-no-clear 'vector4w))) + (cond + ((and (logtest? (process-mask enemy guard) (-> s5-2 mask)) (transform-point-qword! s3-1 s4-5)) + (let ((v1-173 (the-as int (+ (/ (the-as int (-> s3-1 x)) 16) -2048)))) + (+ (/ (the-as int (-> s3-1 y)) 16) -2048) + (let ((a0-91 (abs v1-173))) + (cond + ((< a0-91 65) + (send-event *camera* 'set-slave-option #x8000) + ) + ((let ((a0-95 120)) + (set! v1-173 (abs v1-173)) + (< a0-95 v1-173) + ) + (send-event *camera* 'clear-slave-option #x8000) + ) + ) + ) + ) + ) + (else + (send-event *camera* 'clear-slave-option #x8000) + ) + ) + ) + (if (and s5-2 *gun-marks* (!= gp-0 s5-2)) + (add-debug-sphere #t (bucket-id debug-no-zbuf1) s4-5 (-> s4-5 w) (new 'static 'rgba :g #x80 :b #xff :a #x40)) + ) + ) + ) + (else + (send-event *camera* 'clear-slave-option #x8000) + ) + ) + ) + ) + (when (logtest? (-> self gun track?) 1) + (if *gun-marks* + (add-debug-sphere + #t + (bucket-id debug-no-zbuf1) + (-> self gun track-trans) + (-> self gun track-trans w) + (new 'static 'rgba :r #xff :g #xff :a #x40) + ) + ) + (send-event (handle->process (-> self gun track-target 0 handle)) 'tracked) + ) + 0 + (none) + ) + +;; definition for function target-top-anim-base-mode +;; WARN: Return type mismatch int vs none. +(defbehavior target-top-anim-base-mode target ((arg0 int)) + (cond + ((logtest? (-> self focus-status) (focus-status pilot-riding)) + (case (-> self gun gun-type) + (((pickup-type eco-yellow)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 220) + 0.0 + arg0 + 0 + 1.0 + 0.0 + #f + ) + ) + (((pickup-type eco-blue)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 221) + 0.0 + arg0 + 0 + 1.0 + 0.0 + #f + ) + ) + (((pickup-type eco-red)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 218) + 0.0 + arg0 + 0 + 1.0 + 0.0 + #f + ) + ) + (((pickup-type eco-dark)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 219) + 0.0 + arg0 + 0 + 1.0 + 0.0 + #f + ) + ) + ) + ) + (else + (case (-> self gun gun-type) + (((pickup-type eco-yellow)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 254) + 0.0 + arg0 + 0 + 1.0 + 0.0 + #f + ) + (set! (-> self gun top-anim-low-high) 1.0) + (if (zero? (-> self gun fire-pending)) + (set! (-> self gun fire-time) (-> self clock frame-counter)) + ) + ) + (((pickup-type eco-blue)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 255) + 0.0 + arg0 + 0 + 1.0 + 0.0 + #f + ) + ) + (((pickup-type eco-red)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 244) + 0.0 + arg0 + 0 + 1.0 + 0.0 + #f + ) + ) + (((pickup-type eco-dark)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 253) + 0.0 + arg0 + 0 + 1.0 + 0.0 + #f + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for function target-gun-combo-start +;; WARN: Return type mismatch int vs none. +(defbehavior target-gun-combo-start target ((arg0 int) (arg1 time-frame)) + (target-top-anim-base-mode arg0) + (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) arg0)) + (set! (-> self gun track-target-hold-time) (+ (-> self clock frame-counter) arg1)) + 0 + (none) + ) + +;; definition for function target-gun-joint-pre0 +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior target-gun-joint-pre0 target () + (if (!= (zero? (logand (-> self game features) (game-feature unk-game-feature-06))) (not (-> self gun gun))) + (target-gun-setup (logtest? (-> self game features) (game-feature unk-game-feature-06))) + ) + (if (and (>= (- (-> self clock frame-counter) (-> self gun combo-window-start)) (seconds 0.7)) + (zero? (-> self gun fire-pending)) + ) + (set! (-> self gun combo-window-state) #f) + ) + (cond + ((and (cpad-pressed? (-> self control unknown-cpad-info00 number) r1) + (< (- (-> self clock frame-counter) (-> self gun combo-window-start)) (seconds 0.7)) + (not (logtest? (focus-status mech dark) (-> self focus-status))) + (not (logtest? (surface-flag gun-off) (-> self control unknown-surface01 flags))) + (not (logtest? (state-flags sf18) (-> self state-flags))) + (zero? (-> self gun track-target-hold-time)) + ) + (when (send-event self 'gun-combo #f) + (let ((gp-0 (combo-tracker-method-13 + (-> self gun attack-combo) + (the-as handle #f) + (-> self control trans) + 61440.0 + (-> self control unknown-matrix01 vector 2) + 65536.0 + ) + ) + ) + (when gp-0 + (if (not (using-gun? self)) + (send-event self 'change-mode 'gun #f 0) + ) + (combo-tracker-method-12 + (-> self gun attack-combo) + (-> self control trans) + (get-trans (the-as process-focusable gp-0) 3) + (the-as process-focusable gp-0) + (-> self clock frame-counter) + ) + ((method-of-type focus try-update-focus) + (the-as focus (-> self gun track-target)) + (the-as process-focusable gp-0) + ) + (try-update-focus (-> self gun track-target 1) (the-as process-focusable gp-0)) + (set! (-> self gun track-trans quad) (-> (get-trans (the-as process-focusable gp-0) 3) quad)) + (set! (-> self gun track?) (the-as uint 7)) + (if (zero? (-> self gun fire-pending)) + (+! (-> self gun fire-pending) 1) + ) + (set! (-> self gun fire-pending-time) (-> self clock frame-counter)) + (target-gun-combo-start 20 (seconds 0.4)) + (send-event self 'gun-combo #t) + (case (-> self gun combo-window-state) + (('target-attack 'target-running-attack) + (case (-> self gun gun-type) + (((pickup-type eco-red) (pickup-type eco-dark)) + ) + (else + (+! (-> self gun fire-pending) 2) + ) + ) + ) + ) + ) + ) + ) + ) + ((and (cpad-pressed? (-> self control unknown-cpad-info00 number) r1) + (using-gun? self) + (logtest? (surface-flag gun-turn-fast) (-> self control unknown-surface01 flags)) + (not (logtest? (state-flags sf18) (-> self state-flags))) + (zero? (-> self gun track-target-hold-time)) + (or (zero? (-> self gun turn-fast-hold-time)) + (>= (-> self clock frame-counter) (-> self gun turn-fast-hold-time)) + ) + ) + (if (zero? (-> self gun fire-pending)) + (+! (-> self gun fire-pending) 1) + ) + (set! (-> self gun fire-pending-time) (-> self clock frame-counter)) + (target-top-anim-base-mode 60) + (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.2))) + (set! (-> self gun turn-fast-hold-time) (+ (-> self clock frame-counter) (seconds 0.2))) + (send-event self 'gun-combo #t) + ) + ) + (when (and (not (using-gun? self)) (want-to-gun? self #f)) + (let ((gp-2 (nonzero? (-> self gun using-gun-type)))) + (send-event self 'change-mode 'gun #f (-> self gun using-gun-type)) + (when (and (not gp-2) (or (cpad-hold? (-> self control unknown-cpad-info00 number) r1) (-> self gun latch?))) + (if (zero? (-> self gun fire-pending)) + (+! (-> self gun fire-pending) 1) + ) + (set! (-> self gun fire-pending-time) (-> self clock frame-counter)) + ) + ) + ) + (cond + ((using-gun? self) + (when (and (nonzero? (-> self gun top-anim-twist-reset)) + (< (the-as time-frame (-> self gun top-anim-twist-reset)) (-> self clock frame-counter)) + ) + (quat<-gun! (the-as quaternion (-> self gun top-anim-twist-targ)) (the-as quaternion (-> self gun gun-type))) + (set! (-> self gun top-anim-twist-reset) (the-as uint 0)) + 0 + ) + (cond + ((and (= (-> self control unknown-symbol00) 'normal) (!= (-> self control unknown-symbol00) 'duck)) + (target-collide-set! 'gun 0.0) + ) + ((= (-> self control unknown-symbol00) 'gun) + (cond + ((or (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (or (and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) + (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + ) + (< 2048.0 (target-height-above-ground)) + ) + ) + (logtest? (-> self focus-status) (focus-status edge-grab)) + (-> *setting-control* user-current doorway) + ) + (if (!= (-> self control unknown-float31) 0.0) + (target-collide-set! 'gun 0.0) + ) + ) + (else + (when (!= (-> self control unknown-float31) 1.0) + (when (= (-> self control unknown-symbol00) 'gun) + (let ((gp-3 (new 'stack-no-clear 'collide-query)) + (s5-2 (new 'stack-no-clear 'inline-array 'sphere 2)) + ) + (dotimes (s4-1 1) + ((method-of-type sphere new) (the-as symbol (-> s5-2 s4-1)) sphere) + ) + (let ((f30-1 (seek (-> self control unknown-float000) 1.0 (* 0.1 (-> self clock time-adjust-ratio))))) + (set! (-> s5-2 0 quad) (-> self control unknown-sphere-array00 2 prim-core world-sphere quad)) + (set! (-> s5-2 0 r) (lerp-scale (-> *TARGET-bank* body-radius) 7372.8 f30-1 0.0 1.0)) + (let ((v1-212 gp-3)) + (set! (-> v1-212 spheres) s5-2) + (set! (-> v1-212 num-spheres) (the-as uint 1)) + (set! (-> v1-212 collide-with) (-> self control root-prim prim-core collide-with)) + (set! (-> v1-212 ignore-process0) #f) + (set! (-> v1-212 ignore-process1) #f) + (set! (-> v1-212 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1) + ) + (set! (-> v1-212 best-my-prim) (the-as collide-shape-prim #t)) + (set! (-> v1-212 action-mask) (collide-action solid)) + ) + (if (not (fill-and-probe-using-spheres *collide-cache* gp-3)) + (target-collide-set! 'gun f30-1) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (target-gun-find-track) + (cond + ((and (= (-> self gun gun-type) (pickup-type eco-blue)) (zero? (logand (-> self gun track?) 1))) + (let ((f0-8 (vector-vector-distance (-> self gun fire-point) (-> self gun laser-hit-point)))) + (cond + ((< f0-8 122880.0) + (seek! + (-> self gun top-anim-tilt-up) + (lerp-scale -1820.4445 0.0 f0-8 61440.0 122880.0) + (* 5461.3335 (-> self clock seconds-per-frame)) + ) + ) + ((!= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + (seek! (-> self gun top-anim-tilt-up) 0.0 (* 1820.4445 (-> self clock seconds-per-frame))) + ) + ) + ) + (quaternion-rotate-x! + (the-as quaternion (-> self gun top-anim-twist-targ)) + (the-as quaternion *null-vector*) + (-> self gun top-anim-tilt-up) + ) + ) + (else + (set! (-> self gun top-anim-tilt-up) 0.0) + (quat<-gun! (the-as quaternion (-> self gun top-anim-twist-targ)) (the-as quaternion (-> self gun gun-type))) + ) + ) + (quaternion-slerp! + (the-as quaternion (-> self gun top-anim-twist)) + (the-as quaternion (-> self gun top-anim-twist)) + (the-as quaternion (-> self gun top-anim-twist-targ)) + 0.1 + ) + (trs-set! + (-> self upper-body) + (the-as vector #f) + (the-as quaternion (-> self gun top-anim-twist)) + (the-as vector #f) + ) + (cond + ((or (and (nonzero? (-> self gun track-target-hold-time)) + (< (-> self clock frame-counter) (-> self gun track-target-hold-time)) + ) + (and (nonzero? (-> self gun turn-fast-hold-time)) + (< (-> self clock frame-counter) (-> self gun turn-fast-hold-time)) + ) + (and (logtest? (-> self gun track?) 1) (logtest? (-> self gun track?) 4)) + (or (logtest? (surface-flag gun-strafe) (-> self control unknown-surface01 flags)) + (logtest? (-> self focus-status) (focus-status pilot-riding)) + ) + ) + (seek! (-> self upper-body twist z) 0.0 (* 65536.0 (-> self clock seconds-per-frame))) + ) + ((logtest? (surface-flag gun-no-twist) (-> self control unknown-surface01 flags)) + (seek! (-> self upper-body twist z) 0.0 (* 16384.0 (-> self clock seconds-per-frame))) + ) + ((and (< 0.0 (-> self control unknown-float10)) + (zero? (logand (-> self control unknown-surface01 flags) (surface-flag duck))) + ) + (let* ((f0-28 (deg-diff (y-angle (-> self control)) (vector-y-angle (-> self control unknown-vector08)))) + (f0-30 (fmax -5461.3335 (fmin 5461.3335 f0-28))) + ) + (seek! (-> self upper-body twist z) f0-30 (fabs (* 0.2 f0-30))) + ) + ) + ) + (set! (-> (new 'stack-no-clear 'vector) quad) (-> self control trans quad)) + (if (logtest? (surface-flag gun-no-twist) (-> self control unknown-surface01 flags)) + (set! (-> self upper-body flex-blend) 0.0) + (seek! (-> self upper-body flex-blend) 1.0 (* 8.0 (-> self clock seconds-per-frame))) + ) + (when (logtest? (-> self gun track?) 1) + (set! (-> self gun top-anim-look-at quad) (-> self gun track-trans quad)) + (let ((gp-6 (new 'stack-no-clear 'vector))) + (set! (-> gp-6 quad) (-> self gun top-anim-look-at quad)) + (case (-> self gun gun-type) + (((pickup-type eco-yellow)) + (set! (-> gp-6 y) (+ -409.6 (-> gp-6 y))) + ) + (((pickup-type eco-blue)) + (set! (-> gp-6 y) (+ 2457.6 (-> gp-6 y))) + ) + (else + (set! (-> gp-6 y) (+ -1638.4 (-> gp-6 y))) + ) + ) + (if (not (logtest? (surface-flag gun-no-twist) (-> self control unknown-surface01 flags))) + (target-set! (-> self upper-body) gp-6) + ) + (when *gun-marks* + (add-debug-sphere + #t + (bucket-id debug-no-zbuf1) + (-> self gun top-anim-look-at) + (meters 0.2) + (new 'static 'rgba :r #xff :a #x80) + ) + (add-debug-sphere #t (bucket-id debug-no-zbuf1) gp-6 (meters 0.1) (new 'static 'rgba :r #xff :g #xff :a #x80)) + ) + ) + (let ((v1-340 (-> self neck))) + (set! (-> v1-340 blend) 0.0) + ) + ) + (cond + ((and (logtest? (-> self gun track?) 1) + (logtest? (process-mask enemy guard) (-> (handle->process (-> self gun track-target 0 handle)) mask)) + ) + (if (and (< (- (-> self clock frame-counter) (-> self gun track-press-start-time)) (seconds 0.5)) + (< (-> self control unknown-dword12) 150) + (and (= (-> self control unknown-float10) 0.0) + (not (logtest? (-> self control unknown-surface01 flags) (surface-flag air attack))) + (-> self gun active?) + ) + ) + (forward-up-nopitch->quaternion + (-> self control dir-targ) + (vector-! (new 'stack-no-clear 'vector) (-> self gun track-trans) (-> self control trans)) + (vector-y-quaternion! (new-stack-vector0) (-> self control dir-targ)) + ) + ) + (cond + ((or (and (nonzero? (-> self gun track-target-hold-time)) + (< (-> self clock frame-counter) (-> self gun track-target-hold-time)) + ) + (and (nonzero? (-> self gun turn-fast-hold-time)) + (< (-> self clock frame-counter) (-> self gun turn-fast-hold-time)) + ) + ) + (set! (-> self gun track?) (the-as uint 7)) + (set! (-> self gun upper-body twist-max y) 21845.334) + (set! (-> self gun upper-body twist-speed-y) 0.2) + (set! (-> self gun upper-body twist-speed-x) 0.6) + ) + ((and (or (and (logtest? (-> self control unknown-surface00 flags) (surface-flag air)) + (zero? (logand (-> self control status) (cshape-moving-flags on-surface))) + ) + (logtest? (surface-flag gun-direct) (-> self control unknown-surface01 flags)) + ) + (< (vector-vector-distance (-> self control trans) (-> self gun track-trans)) 81920.0) + ) + (set! (-> self gun upper-body twist-max y) 16384.0) + (set! (-> self gun upper-body twist-speed-y) 0.2) + (set! (-> self gun upper-body twist-speed-x) 0.1) + ) + ((or (= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + (let ((f30-2 10922.667) + (gp-8 deg-diff) + (v1-417 (-> self control)) + (a1-54 (-> self gun track-trans)) + ) + (>= f30-2 + (gp-8 + (vector-y-angle (vector-! (new 'stack-no-clear 'vector) a1-54 (-> v1-417 trans))) + (vector-y-angle (-> self control unknown-vector08)) + ) + ) + ) + ) + (set! (-> self gun upper-body twist-max y) + (lerp-scale + 10922.667 + (-> self gun track-turn-max) + (vector-vector-distance (-> self control trans) (-> self gun track-trans)) + 20480.0 + 61440.0 + ) + ) + (set! (-> self gun upper-body twist-speed-y) + (lerp-scale + 0.3 + 0.1 + (vector-vector-distance (-> self control trans) (-> self gun track-trans)) + 16384.0 + 40960.0 + ) + ) + (set! (-> self gun upper-body twist-speed-x) 0.1) + ) + (else + (set! (-> self gun upper-body twist-max y) (-> self gun track-turn-max)) + (set! (-> self gun upper-body twist-speed-y) 0.1) + (set! (-> self gun upper-body twist-speed-x) 0.1) + ) + ) + ) + (else + (set! (-> self gun upper-body twist-max y) (-> self gun track-turn-max)) + (set! (-> self gun upper-body twist-speed-y) 0.1) + (set! (-> self gun upper-body twist-speed-x) 0.1) + ) + ) + (set! (-> self gun upper-body track-mode) (the-as track-mode (-> self gun track?))) + (when (< (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 1.5)) + (let ((v1-459 (-> self neck))) + (set! (-> v1-459 blend) 0.0) + ) + ) + ) + (else + (seek! (-> self upper-body flex-blend) 0.0 (* 16.0 (-> self clock seconds-per-frame))) + (seek! (-> self upper-body twist z) 0.0 (* 65536.0 (-> self clock seconds-per-frame))) + ) + ) + 0 + (none) + ) + +;; definition for function target-gun-joint-pre +;; WARN: Return type mismatch int vs none. +(defbehavior target-gun-joint-pre target () + (local-vars (gp-0 art-element)) + (target-gun-joint-pre0) + (cond + ((logtest? (-> self focus-status) (focus-status pilot-riding)) + (let ((v1-3 (-> self gun gun-type))) + (set! (-> self skel top-anim base-anim) (cond + ((= v1-3 (pickup-type eco-yellow)) + (-> self draw art-group data 220) + ) + ((= v1-3 (pickup-type eco-red)) + (-> self draw art-group data 218) + ) + ((= v1-3 (pickup-type eco-blue)) + (-> self draw art-group data 221) + ) + (else + (-> self draw art-group data 219) + ) + ) + ) + ) + ) + (else + (let ((v1-14 (-> self gun gun-type))) + (set! gp-0 + (cond + ((= v1-14 (pickup-type eco-yellow)) + (let ((v1-17 (ja-group))) + (cond + ((and (and v1-17 (or (= v1-17 self) (= v1-17 (-> self draw art-group data 261)))) + (< (-> self gun top-anim-low-high) 0.5) + ) + (let ((s5-0 (top-anim-joint-control-method-11 (-> self skel top-anim) 0))) + (set! gp-0 (if (< 0.9 (-> self control unknown-float002)) + (-> self draw art-group data 299) + (-> self draw art-group data 298) + ) + ) + (set! (-> self skel top-anim base-anim-blend) 0.1) + (when (and s5-0 (= (-> s5-0 frame-group) gp-0)) + (set! (-> s5-0 frame-num) (ja-frame-num 0)) + (set! (-> self skel top-anim base-anim-speed) 0.0) + ) + ) + gp-0 + ) + ((< (-> self gun top-anim-low-high) 0.5) + (-> self draw art-group data 245) + ) + (else + (when (and (>= (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 1.5)) + (let ((v1-50 (-> self skel top-anim frame-group))) + (or (= v1-50 (-> self draw art-group data 247)) (= v1-50 (-> self draw art-group data 254))) + ) + ) + (seek! (-> self gun top-anim-low-high) 0.0 (* 6.0 (-> self clock seconds-per-frame))) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 247) + 0.0 + 0 + 60 + (if (< 20480.0 (-> self control unknown-float05)) + 2.0 + 1.0 + ) + 0.0 + #f + ) + ) + (-> self draw art-group data 254) + ) + ) + ) + ) + ((= v1-14 (pickup-type eco-red)) + (let ((v1-67 (ja-group))) + (cond + ((and v1-67 (or (= v1-67 self) (= v1-67 (-> self draw art-group data 12)))) + (let ((s5-1 (top-anim-joint-control-method-11 (-> self skel top-anim) 0))) + (set! gp-0 (if (< 0.9 (-> self control unknown-float002)) + (-> self draw art-group data 299) + (-> self draw art-group data 298) + ) + ) + (set! (-> self skel top-anim base-anim-blend) 0.1) + (when (and s5-1 (= (-> s5-1 frame-group) gp-0)) + (set! (-> s5-1 frame-num) (ja-frame-num 0)) + (set! (-> self skel top-anim base-anim-speed) 0.0) + ) + ) + gp-0 + ) + ((< (-> self gun top-anim-low-high) 0.5) + (-> self draw art-group data 244) + ) + (else + (when (and (or (>= (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 2.5)) + (and (< 4096.0 (-> self control unknown-float05)) + (>= (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 1.25)) + ) + ) + (let ((v1-104 (-> self skel top-anim frame-group))) + (or (= v1-104 (-> self draw art-group data 294)) + (= v1-104 (-> self draw art-group data 295)) + (= v1-104 (-> self draw art-group data 244)) + ) + ) + ) + (seek! (-> self gun top-anim-low-high) 0.0 (* 6.0 (-> self clock seconds-per-frame))) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 295) + 0.0 + 0 + 30 + 1.0 + 0.0 + #f + ) + ) + (-> self draw art-group data 294) + ) + ) + ) + ) + ((= v1-14 (pickup-type eco-blue)) + (let ((v1-119 (ja-group))) + (cond + ((and (and v1-119 (or (= v1-119 self) (= v1-119 (-> self draw art-group data 261)))) + (and (< (-> self gun top-anim-low-high) 0.5) + (>= (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 0.2)) + ) + ) + (let ((s5-2 (top-anim-joint-control-method-11 (-> self skel top-anim) 0))) + (set! gp-0 (if (< 0.9 (-> self control unknown-float002)) + (-> self draw art-group data 262) + (-> self draw art-group data 303) + ) + ) + (set! (-> self skel top-anim base-anim-blend) 0.1) + (when (and s5-2 (= (-> s5-2 frame-group) gp-0)) + (set! (-> s5-2 frame-num) (ja-frame-num 0)) + (set! (-> self skel top-anim base-anim-speed) 0.0) + ) + ) + gp-0 + ) + (else + (-> self draw art-group data 255) + ) + ) + ) + ) + ((let ((v1-150 (ja-group))) + (and v1-150 (or (= v1-150 self) (= v1-150 (-> self draw art-group data 12)))) + ) + (let ((s5-3 (top-anim-joint-control-method-11 (-> self skel top-anim) 0))) + (set! gp-0 (if (< 0.9 (-> self control unknown-float002)) + (-> self draw art-group data 299) + (-> self draw art-group data 298) + ) + ) + (set! (-> self skel top-anim base-anim-blend) 0.1) + (when (and s5-3 (= (-> s5-3 frame-group) gp-0)) + (set! (-> s5-3 frame-num) (ja-frame-num 0)) + (set! (-> self skel top-anim base-anim-speed) 0.0) + ) + ) + gp-0 + ) + (else + (-> self draw art-group data 253) + ) + ) + ) + ) + (set! (-> self skel top-anim base-anim) gp-0) + ) + ) + 0 + (none) + ) + +;; definition for function target-gun-compute-pos +;; INFO: Used lq/sq +(defbehavior target-gun-compute-pos target () + (let ((a1-0 (-> self node-list data 24 bone transform)) + (a2-0 (if (-> self sidekick) + (-> self sidekick 0 node-list data 28 bone transform) + (-> self node-list data 24 bone transform) + ) + ) + (gp-0 (new 'stack-no-clear 'matrix)) + ) + (matrix-lerp! gp-0 a1-0 a2-0 (-> self gun gun-daxter)) + (matrix->transformq (-> self gun gun-pos) gp-0) + (set! (-> self gun gun-pos scale quad) (-> self control scale quad)) + (when (and (using-gun? self) (and (logtest? (-> self focus-status) (focus-status edge-grab)) + (let ((v1-18 (ja-group))) + (and v1-18 (or (= v1-18 (-> self draw art-group data 27)) + (= v1-18 (-> self draw art-group data 35)) + (= v1-18 (-> self draw art-group data 33)) + (= v1-18 (-> self draw art-group data 34)) + ) + ) + ) + ) + ) + (let ((s4-0 (new 'static 'vector :y 491.52 :w 1.0)) + (a1-5 (new 'static 'vector :x -16384.0 :z -16384.0 :w 1.0)) + (s5-0 (new 'stack-no-clear 'quaternion)) + ) + (matrix-rotate-xyz! gp-0 a1-5) + (matrix->quaternion s5-0 gp-0) + (vector+! (the-as vector (-> self gun gun-pos)) (-> *edge-grab-info* center-hold) s4-0) + (vector+float*! + (the-as vector (-> self gun gun-pos)) + (the-as vector (-> self gun gun-pos)) + (-> self node-list data 0 bone transform vector 2) + 778.24 + ) + (quaternion-normalize! (quaternion*! (-> self gun gun-pos quat) (-> self control quat) s5-0)) + ) + ) + gp-0 + ) + ) + +;; definition for function target-gun-joint-points +;; WARN: Return type mismatch int vs none. +(defbehavior target-gun-joint-points target () + (when (-> self gun gun) + (set! (-> self gun gun-daxter) + (if (and (logtest? (-> self focus-status) (focus-status pilot-riding)) + (nonzero? (-> self skel float-channels)) + (= (-> (top-anim-joint-control-method-11 (-> self skel top-anim) (the-as int (+ (-> self skel float-channels) -1))) + frame-interp + 1 + ) + 1.0 + ) + ) + 1.0 + 0.0 + ) + ) + (cond + ((using-gun? self) + (set! (-> self gun gun-roty-targ) (y-angle (-> self control))) + (set! (-> self gun gun-roty) (-> self gun gun-roty-targ)) + (set! (-> self gun gun-roty-rel) 0.0) + (let ((v1-24 (top-anim-joint-control-method-11 (-> self skel top-anim) 0))) + (cond + ((not v1-24) + ) + ((handle->process (-> self gun charge-active?)) + (cond + ((and (= (-> v1-24 frame-group) (-> self draw art-group data 259)) (>= (-> v1-24 frame-num) 8.5)) + (set! (-> v1-24 frame-num) 5.0) + ) + ((and (= (-> v1-24 frame-group) (-> self draw art-group data 224)) (>= (-> v1-24 frame-num) 8.0)) + (set! (-> v1-24 frame-num) 3.0) + ) + ) + ) + ((and (= (-> v1-24 frame-group) (-> self draw art-group data 259)) (< (-> v1-24 frame-num) 9.0)) + (set! (-> v1-24 frame-num) 10.0) + ) + ((and (= (-> v1-24 frame-group) (-> self draw art-group data 224)) (< (-> v1-24 frame-num) 9.0)) + (set! (-> v1-24 frame-num) 9.0) + ) + ) + ) + (set! (-> self gun active?) + (and (not (logtest? (surface-flag gun-inactive gun-hide gun-off) (-> self control unknown-surface01 flags))) + (and (>= (- (-> self clock frame-counter) (-> self gun gun-get-on-time)) (seconds 0.1)) + (>= (-> self clock frame-counter) (-> self gun surpress-time)) + (let ((v1-35 (-> self skel top-anim frame-group)) + (f0-13 (-> self skel top-anim frame-num)) + ) + (and (not (or (= v1-35 (-> self draw art-group data 263)) + (= v1-35 (-> self draw art-group data 266)) + (= v1-35 (-> self draw art-group data 265)) + (= v1-35 (-> self draw art-group data 264)) + (and (-> self draw art-group data 198) + (or (= v1-35 (-> self draw art-group data 198)) + (= v1-35 (-> self draw art-group data 230)) + (= v1-35 (-> self draw art-group data 229)) + (= v1-35 (-> self draw art-group data 231)) + (= v1-35 (-> self draw art-group data 225)) + (= v1-35 (-> self draw art-group data 226)) + (= v1-35 (-> self draw art-group data 227)) + (= v1-35 (-> self draw art-group data 228)) + ) + ) + (and (= v1-35 (-> self draw art-group data 274)) (>= 6.8 f0-13)) + (or (and (= v1-35 (-> self draw art-group data 276)) (>= 6.8 f0-13)) + (= v1-35 (-> self draw art-group data 293)) + (= v1-35 (-> self draw art-group data 296)) + (= v1-35 (-> self draw art-group data 269)) + (= v1-35 (-> self draw art-group data 270)) + (= v1-35 (-> self draw art-group data 268)) + (= v1-35 (-> self draw art-group data 272)) + (= v1-35 (-> self draw art-group data 271)) + (= v1-35 (-> self draw art-group data 289)) + (= v1-35 (-> self draw art-group data 290)) + ) + ) + ) + (let ((v1-40 (-> self skel top-anim frame-group-push))) + (not (or (= v1-40 (-> self draw art-group data 263)) + (= v1-40 (-> self draw art-group data 266)) + (= v1-40 (-> self draw art-group data 265)) + (= v1-40 (-> self draw art-group data 264)) + (and (-> self draw art-group data 198) + (or (= v1-40 (-> self draw art-group data 198)) + (= v1-40 (-> self draw art-group data 230)) + (= v1-40 (-> self draw art-group data 229)) + (= v1-40 (-> self draw art-group data 231)) + (= v1-40 (-> self draw art-group data 225)) + (= v1-40 (-> self draw art-group data 226)) + (= v1-40 (-> self draw art-group data 227)) + (= v1-40 (-> self draw art-group data 228)) + ) + ) + (= v1-40 (-> self draw art-group data 293)) + (= v1-40 (-> self draw art-group data 296)) + (= v1-40 (-> self draw art-group data 269)) + (= v1-40 (-> self draw art-group data 270)) + (= v1-40 (-> self draw art-group data 268)) + (= v1-40 (-> self draw art-group data 272)) + (= v1-40 (-> self draw art-group data 271)) + (= v1-40 (-> self draw art-group data 289)) + (= v1-40 (-> self draw art-group data 290)) + ) + ) + ) + ) + ) + ) + ) + ) + (if (-> self gun active?) + (set! (-> self gun active-time) (-> self clock frame-counter)) + ) + (set! (-> self gun laser-active?) + (zero? (logand (surface-flag gun-inactive gun-hide gun-off laser-hide) (-> self control unknown-surface01 flags)) + ) + ) + (when (and (not (and (not (logtest? (surface-flag gun-inactive gun-hide gun-off) (-> self control unknown-surface01 flags))) + (>= (- (-> self clock frame-counter) (-> self gun gun-get-on-time)) (seconds 0.1)) + (>= (-> self clock frame-counter) (-> self gun surpress-time)) + ) + ) + (and (>= (- (-> self clock frame-counter) (-> self gun fire-pending-time)) (seconds 0.2)) + (>= (- (-> self clock frame-counter) (-> self gun active-time)) (seconds 0.2)) + (= (-> self gun fire-pending) 1) + ) + ) + (set! (-> self gun fire-pending) 0) + 0 + ) + (if (and (or (logtest? (surface-flag gun-hide gun-off) (-> self control unknown-surface01 flags)) + (logtest? (state-flags sf18) (-> self state-flags)) + (let ((v1-75 (-> self gun gun-type))) + (or (and (cond + ((= v1-75 (pickup-type eco-yellow)) + (logtest? (logior (logior (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 0) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 2) + ) + (pad-buttons down) + ) + ) + ((= v1-75 (pickup-type eco-red)) + (logtest? (logior (logior (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 0) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 2) + ) + (pad-buttons up) + ) + ) + ((= v1-75 (pickup-type eco-blue)) + (logtest? (logior (logior (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 0) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 2) + ) + (pad-buttons left) + ) + ) + (else + (logtest? (logior (logior (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 0) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 2) + ) + (pad-buttons right) + ) + ) + ) + (and (not (cpad-hold? (-> self control unknown-cpad-info00 number) r1)) + (not (logtest? (surface-flag gun-inactive) (-> self control unknown-surface01 flags))) + (zero? (logand (-> self focus-status) (focus-status grabbed))) + ) + ) + (-> self gun put-away?) + (not (logtest? (-> self game features) (game-feature unk-game-feature-06))) + (not (logtest? (the-as game-feature (ash 1 (+ (-> self gun gun-type) 5))) + (logand (-> self game features) (-> *setting-control* user-current features)) + ) + ) + (logtest? (focus-status dead dark) (-> self focus-status)) + (-> self board latch?) + ) + ) + ) + (>= (- (-> self clock frame-counter) (-> self gun gun-get-on-time)) (seconds 0.1)) + (let ((v1-110 (-> self skel top-anim frame-targ))) + (or (not v1-110) + (= v1-110 (-> self draw art-group data 304)) + (= v1-110 (-> self draw art-group data 300)) + (= v1-110 (-> self draw art-group data 305)) + (= v1-110 (-> self draw art-group data 301)) + (= v1-110 (-> self draw art-group data 299)) + (= v1-110 (-> self draw art-group data 298)) + (= v1-110 (-> self draw art-group data 262)) + (= v1-110 (-> self draw art-group data 303)) + (logtest? (surface-flag gun-fast-exit) (-> self control unknown-surface01 flags)) + ) + ) + ) + (target-gun-end-mode (zero? (logand (surface-flag gun-hide) (-> self control unknown-surface01 flags)))) + ) + ) + (else + (set! (-> self gun active?) #f) + ) + ) + ) + 0 + (none) + ) + +;; definition for function target-gun-fire +;; WARN: Return type mismatch symbol vs none. +(defbehavior target-gun-fire target ((arg0 pickup-type)) + (when (using-gun? self) + (let* ((gp-0 (-> self gun)) + (a1-0 (gun->ammo arg0)) + (f0-0 (-> self game gun-ammo (+ a1-0 -13))) + ) + (cond + ((or (< 0.0 f0-0) + (logtest? (state-flags sf16) (-> self state-flags)) + (logtest? (-> self game secrets) (game-secrets endless-ammo)) + ) + (pickup-collectable! (-> self fact) (the-as pickup-type a1-0) -1.0 (the-as handle #f)) + (case (-> gp-0 gun-type) + (((pickup-type eco-blue)) + (cond + ((logtest? (-> self focus-status) (focus-status pilot-riding)) + (let ((v1-15 (top-anim-joint-control-method-11 (-> self skel top-anim) 0))) + (when (not (or (= (-> self skel top-anim frame-group) (-> self draw art-group data 206)) + (and v1-15 (= (-> v1-15 frame-group) (-> self draw art-group data 206))) + ) + ) + (if (< 4096.0 (-> self control unknown-float05)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 207) + 1.0 + 9 + 9 + 1.0 + 0.0 + #f + ) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 207) + 1.0 + 6 + 6 + 1.0 + 0.0 + #f + ) + ) + ) + ) + ) + (else + (let ((v1-32 (top-anim-joint-control-method-11 (-> self skel top-anim) 0))) + (when (not (or (= (-> self skel top-anim frame-group) (-> self draw art-group data 257)) + (and v1-32 (= (-> v1-32 frame-group) (-> self draw art-group data 257))) + ) + ) + (if (< 4096.0 (-> self control unknown-float05)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 258) + 1.0 + 9 + 9 + 1.0 + 0.0 + #f + ) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 258) + 1.0 + 6 + 6 + 1.0 + 0.0 + #f + ) + ) + ) + ) + ) + ) + (target-gun-fire-blue) + ) + (((pickup-type eco-yellow)) + (cond + ((logtest? (-> self focus-status) (focus-status pilot-riding)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 223) + 0.0 + 15 + 0 + 1.0 + 0.0 + #f + ) + ) + ((< (-> self gun top-anim-low-high) 0.5) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 246) + 0.0 + 15 + 0 + 1.0 + 0.0 + #f + ) + (set! (-> self gun top-anim-low-high) 1.0) + ) + (else + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 260) + 0.0 + 0 + 0 + 1.0 + 0.0 + #f + ) + ) + ) + (target-gun-fire-yellow) + ) + (((pickup-type eco-red)) + (let ((f30-0 (if (logtest? (-> self game features) (game-feature gun-upgrade-speed)) + 1.4 + 1.0 + ) + ) + ) + (cond + ((logtest? (-> self focus-status) (focus-status pilot-riding)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 222) + 0.0 + 15 + 0 + (if (= f30-0 1.0) + f30-0 + (* 1.05 f30-0) + ) + 0.0 + #f + ) + ) + ((< 0.5 (-> self gun top-anim-low-high)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 292) + 0.0 + 0 + 15 + f30-0 + 0.0 + #f + ) + (set! (-> self gun top-anim-low-high) 0.0) + ) + ((and (rand-vu-percent? 0.2) (< (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 2))) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 293) + 0.0 + 0 + 15 + (if (logtest? (-> self game features) (game-feature gun-upgrade-speed)) + 1.7 + 1.0 + ) + 0.0 + #f + ) + ) + ((and (or (rand-vu-percent? 0.2) (= (-> self skel top-anim frame-targ) (-> self draw art-group data 256))) + (< (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 2)) + ) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 291) + 0.0 + 0 + 15 + f30-0 + 0.0 + #f + ) + (set! (-> self gun top-anim-low-high) 1.0) + ) + ((logtest? (-> self game features) (game-feature gun-upgrade-speed)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 309) + 0.0 + 0 + 15 + 1.0 + 0.0 + #f + ) + ) + (else + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 256) + 1.0 + 0 + 15 + f30-0 + 0.0 + #f + ) + ) + ) + ) + (target-gun-fire-red) + ) + (((pickup-type eco-dark)) + (if (logtest? (-> self focus-status) (focus-status pilot-riding)) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 224) + 0.0 + 0 + 15 + 1.0 + 0.0 + #f + ) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (-> self draw art-group data 259) + 0.0 + 0 + 15 + 1.0 + 0.0 + #f + ) + ) + (target-gun-fire-dark) + ) + ) + #t + ) + (else + (let ((v1-149 (target-gun-ammo-out-pick))) + (cond + ((nonzero? v1-149) + (if (nonzero? v1-149) + (set! (-> self gun using-gun-type) (the-as pickup-type v1-149)) + ) + (if (zero? (-> self gun fire-pending)) + (+! (-> self gun fire-pending) 1) + ) + ) + (else + (sound-play "walk-san1") + ) + ) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for function target-gun-check +;; WARN: Return type mismatch int vs none. +(defbehavior target-gun-check target () + (when (using-gun? self) + (let ((gp-0 (-> self gun))) + (cond + ((and (logtest? (-> self focus-status) (focus-status pilot-riding)) (nonzero? (-> self skel float-channels))) + (set! (-> self skel top-anim interp-select 0) (the-as uint #x800000)) + (set! (-> self skel top-anim interp-select 1) (the-as uint 0)) + 0 + ) + (else + (set! (-> self skel top-anim interp-select 0) (the-as uint #x3ffffc0001fffff0)) + (set! (-> self skel top-anim interp-select 1) (the-as uint 0)) + 0 + ) + ) + (if (not (or (logtest? (-> self focus-status) (focus-status in-head)) (= (-> self gun gun-type) (pickup-type eco-red))) + ) + (gun-info-method-9 gp-0) + ) + (if (and (logtest? (surface-flag spin) (-> self control unknown-surface01 flags)) + (logtest? (-> self control unknown-surface01 flags) (surface-flag air)) + ) + (set! (-> gp-0 combo-window-state) 'target-attack-air) + ) + (if (cpad-pressed? (-> self control unknown-cpad-info00 number) r1) + (set! (-> gp-0 fire-start-time) (-> self clock frame-counter)) + ) + (case (-> gp-0 gun-control) + ((1) + (when (and (cpad-pressed? (-> self control unknown-cpad-info00 number) r1) + (< (the-as time-frame (+ (-> gp-0 fire-delay) -30)) (- (-> self clock frame-counter) (-> gp-0 fire-time))) + ) + (set! (-> gp-0 fire-pending-time) (-> self clock frame-counter)) + (if (zero? (-> self gun fire-pending)) + (+! (-> self gun fire-pending) 1) + ) + (set! (-> gp-0 fire-charge) 0.5) + ) + (when (and (or (>= (- (-> self clock frame-counter) (-> gp-0 fire-time)) (the-as time-frame (-> gp-0 fire-delay))) + (case (-> gp-0 combo-window-state) + (('target-attack-air 'target-attack 'target-running-attack) + (>= (- (-> self clock frame-counter) (-> gp-0 fire-time)) (the-as time-frame (-> gp-0 combo-fire-delay))) + ) + ) + ) + (> (-> gp-0 fire-pending) 0) + (-> self gun active?) + ) + (seekl! (-> self gun fire-pending) 0 1) + (cond + ((send-event self 'gun (-> gp-0 gun-type)) + (set! (-> self gun fire-time) (-> self clock frame-counter)) + ) + (else + (set! (-> self gun fire-time) 0) + 0 + ) + ) + #t + ) + ) + ((2) + (when (and (cpad-hold? (-> self control unknown-cpad-info00 number) r1) + (and (not (handle->process (-> self gun charge-active?))) + (< (the-as time-frame (+ (-> gp-0 fire-delay) -30)) (- (-> self clock frame-counter) (-> gp-0 fire-time))) + ) + ) + (set! (-> gp-0 fire-pending-time) (-> self clock frame-counter)) + (if (zero? (-> self gun fire-pending)) + (+! (-> self gun fire-pending) 1) + ) + (set! (-> gp-0 fire-charge) 0.5) + ) + (when (and (>= (- (-> self clock frame-counter) (-> gp-0 fire-time)) (the-as time-frame (-> gp-0 fire-delay))) + (> (-> gp-0 fire-pending) 0) + (-> self gun active?) + ) + (seekl! (-> self gun fire-pending) 0 1) + (cond + ((send-event self 'gun (-> gp-0 gun-type)) + (set! (-> self gun fire-time) (-> self clock frame-counter)) + ) + (else + (set! (-> self gun fire-time) 0) + 0 + ) + ) + #t + ) + ) + ((4) + (cond + ((cpad-hold? (-> self control unknown-cpad-info00 number) r1) + (seek! (-> gp-0 fire-spinv) 218453.33 (* 145635.56 (-> self clock seconds-per-frame))) + (if (and (nonzero? (-> self gun track-target-hold-time)) + (< (-> self clock frame-counter) (-> self gun track-target-hold-time)) + ) + (set! (-> gp-0 fire-spinv) 218453.33) + ) + ) + (else + (seek! (-> gp-0 fire-spinv) 0.0 (* 109226.664 (-> self clock seconds-per-frame))) + ) + ) + (set! (-> gp-0 fire-spin) + (the float + (sar (shl (the int (+ (-> gp-0 fire-spin) (* (-> gp-0 fire-spinv) (-> self clock seconds-per-frame)))) 48) 48) + ) + ) + (set! (-> gp-0 fire-delay) (the-as uint (the int (lerp-scale 120.0 30.0 (-> gp-0 fire-spinv) 0.0 218453.33)))) + (when (and (>= (-> gp-0 fire-spinv) 218453.33) + (and (or (< 0.0 (-> self game gun-ammo 2)) + (logtest? (state-flags sf16) (-> self state-flags)) + (logtest? (-> self game secrets) (game-secrets endless-ammo)) + ) + (and (-> gp-0 active?) (not (or (= (-> self skel top-anim frame-group) (-> self draw art-group data 257)) + (= (-> self skel top-anim frame-group) (-> self draw art-group data 206)) + ) + ) + ) + ) + ) + (let* ((f0-23 (+ (-> self gun top-anim-blue-cycle) (the float (rand-vu-int-range 1 3)))) + (f0-24 (- f0-23 (* (the float (the int (/ f0-23 4.0))) 4.0))) + ) + (set! (-> self gun top-anim-blue-cycle) f0-24) + (top-anim-joint-control-method-12 + (-> self skel top-anim) + (if (logtest? (-> self focus-status) (focus-status pilot-riding)) + (-> self draw art-group data 206) + (-> self draw art-group data 257) + ) + (* 6.0 f0-24) + 0 + 5 + 1.0 + (- 18.0 (* 6.0 f0-24)) + #f + ) + ) + ) + (when (and (cpad-hold? (-> self control unknown-cpad-info00 number) r1) + (-> self gun active?) + (< (the-as time-frame (+ (-> gp-0 fire-delay) -30)) (- (-> self clock frame-counter) (-> gp-0 fire-time))) + ) + (set! (-> gp-0 fire-pending-time) (-> self clock frame-counter)) + (if (zero? (-> self gun fire-pending)) + (+! (-> self gun fire-pending) 1) + ) + (set! (-> gp-0 fire-charge) 0.5) + ) + (when (and (>= (- (-> self clock frame-counter) (-> gp-0 fire-time)) (the-as time-frame (-> gp-0 fire-delay))) + (> (-> gp-0 fire-pending) 0) + (-> self gun active?) + ) + (seekl! (-> self gun fire-pending) 0 1) + (cond + ((send-event self 'gun (-> gp-0 gun-type)) + (set! (-> self gun fire-time) (-> self clock frame-counter)) + ) + (else + (set! (-> self gun fire-time) 0) + 0 + ) + ) + #t + ) + ) + ) + (case (-> gp-0 gun-type) + (((pickup-type eco-blue)) + (set! (-> gp-0 blue-whine-volume) (* 0.000004577637 (-> gp-0 fire-spinv))) + (sound-play-by-name + (static-sound-name "blue-gun-whine") + (the-as sound-id (-> gp-0 blue-whine-sound-id)) + (the int (* 1024.0 (fmin 1.0 (* 2.0 (-> gp-0 blue-whine-volume))))) + (the int (* 1524.0 (lerp-scale -0.9 0.5 (-> gp-0 blue-whine-volume) 0.0 1.0))) + 0 + (sound-group sfx) + #t + ) + ) + (else + (when (!= (-> gp-0 blue-whine-volume) 0.0) + (let ((v1-245 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-245 command) (sound-command set-param)) + (set! (-> v1-245 id) (the-as sound-id (-> gp-0 blue-whine-sound-id))) + (set! (-> v1-245 params volume) -4) + (set! (-> v1-245 auto-time) 120) + (set! (-> v1-245 auto-from) 2) + (set! (-> v1-245 params mask) (the-as uint 17)) + (-> v1-245 id) + ) + (set! (-> gp-0 blue-whine-volume) 0.0) + ) + ) + ) + (set! (-> gp-0 gun-time) (-> self clock frame-counter)) + ) + ) + 0 + (none) + ) + +;; definition for function camera-rotate-to-vector +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defun camera-rotate-to-vector ((arg0 vector) (arg1 vector)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 quad) (-> arg0 quad)) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (set! (-> s4-0 quad) (-> (camera-matrix) vector 2 quad)) + (vector-flatten! s5-0 s5-0 arg1) + (vector-normalize! s5-0 1.0) + (vector-flatten! s4-0 s4-0 arg1) + (vector-normalize! s4-0 1.0) + (let ((f30-0 (vector-y-angle s5-0)) + (f0-0 (vector-y-angle s4-0)) + ) + (send-event *camera* 'joystick (fmax -1.0 (fmin 1.0 (* 0.00018310547 (deg-diff f0-0 f30-0)))) 1.0) + ) + ) + ) + (none) + ) + +;; definition for function target-gun-real-post +;; INFO: Used lq/sq +(defbehavior target-gun-real-post target () + (let ((f30-0 (-> self clock clock-ratio))) + (let ((gp-1 (max 1 (the int (-> self clock time-adjust-ratio))))) + (update-rates! (-> self clock) (/ f30-0 (the float gp-1))) + (while (nonzero? gp-1) + (+! gp-1 -1) + (set! (-> self control unknown-word07) gp-1) + (flag-setup) + (build-conversions (-> self control transv)) + (do-rotations1) + (let ((s4-0 (new-stack-vector0))) + (read-pad s4-0) + (turn-to-vector s4-0 (debounce-speed + (-> self control unknown-float12) + (-> self control unknown-float13) + (-> self control unknown-vector12) + (-> self control unknown-vector13) + ) + ) + ) + (add-thrust) + (add-gravity) + (do-rotations2) + (reverse-conversions (-> self control transv)) + (pre-collide-setup) + (when *debug-segment* + (let ((s5-1 (-> *display* frames (-> *display* on-screen) profile-array data 0)) + (v1-20 'target) + (s4-1 *profile-target-color*) + ) + (when (and *dproc* *debug-segment*) + (let ((s3-0 (-> s5-1 data (-> s5-1 count)))) + (let ((s2-0 (-> s5-1 base-time))) + (set! (-> s3-0 name) v1-20) + (set! (-> s3-0 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s2-0)))) + ) + (set! (-> s3-0 depth) (the-as uint (-> s5-1 depth))) + (set! (-> s3-0 color) s4-1) + (set! (-> s5-1 segment (-> s5-1 depth)) s3-0) + ) + (+! (-> s5-1 count) 1) + (+! (-> s5-1 depth) 1) + (set! (-> s5-1 max-depth) (max (-> s5-1 max-depth) (-> s5-1 depth))) + ) + ) + 0 + ) + (let ((a2-1 (new 'stack-no-clear 'collide-query)) + (v1-33 (-> self control)) + ) + (set! (-> a2-1 collide-with) (-> v1-33 root-prim prim-core collide-with)) + (set! (-> a2-1 ignore-process0) self) + (set! (-> a2-1 ignore-process1) #f) + (set! (-> a2-1 ignore-pat) (-> v1-33 pat-ignore-mask)) + (set! (-> a2-1 action-mask) (collide-action solid)) + (collide-shape-method-32 v1-33 (-> v1-33 transv) a2-1 (meters 1)) + ) + (if (and (logtest? (-> self control root-prim prim-core action) (collide-action check-edge)) + (>= (vector-dot + (-> self control dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> self control trans) (-> self control gspot-pos)) + ) + (-> *TARGET-bank* edge-grab-height-off-ground) + ) + ) + (target-method-27 *target* *collide-cache* *collide-edge-spec*) + ) + (when *debug-segment* + (let ((s5-2 (-> *display* frames (-> *display* on-screen) profile-array data 0))) + (when (and *dproc* *debug-segment*) + (let* ((v1-60 (+ (-> s5-2 depth) -1)) + (s4-2 (-> s5-2 segment v1-60)) + (s3-1 (-> s5-2 base-time)) + ) + (when (>= v1-60 0) + (set! (-> s4-2 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s3-1)))) + (+! (-> s5-2 depth) -1) + ) + ) + ) + ) + 0 + ) + (bend-gravity) + (post-flag-setup) + ) + ) + (update-rates! (-> self clock) f30-0) + ) + (when *debug-segment* + (let ((gp-2 (-> *display* frames (-> *display* on-screen) profile-array data 0)) + (v1-77 'target-post) + (s5-3 *profile-target-post-color*) + ) + (when (and *dproc* *debug-segment*) + (let ((s4-3 (-> gp-2 data (-> gp-2 count)))) + (let ((s3-2 (-> gp-2 base-time))) + (set! (-> s4-3 name) v1-77) + (set! (-> s4-3 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s3-2)))) + ) + (set! (-> s4-3 depth) (the-as uint (-> gp-2 depth))) + (set! (-> s4-3 color) s5-3) + (set! (-> gp-2 segment (-> gp-2 depth)) s4-3) + ) + (+! (-> gp-2 count) 1) + (+! (-> gp-2 depth) 1) + (set! (-> gp-2 max-depth) (max (-> gp-2 max-depth) (-> gp-2 depth))) + ) + ) + 0 + ) + (ja-post) + (when *debug-segment* + (let ((gp-3 (-> *display* frames (-> *display* on-screen) profile-array data 0))) + (when (and *dproc* *debug-segment*) + (let* ((v1-101 (+ (-> gp-3 depth) -1)) + (s5-4 (-> gp-3 segment v1-101)) + (s4-4 (-> gp-3 base-time)) + ) + (when (>= v1-101 0) + (set! (-> s5-4 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s4-4)))) + (+! (-> gp-3 depth) -1) + ) + ) + ) + ) + 0 + ) + (joint-points) + (do-target-gspot) + (target-powerup-process) + (none) + ) + +;; definition for function target-gun-post +(defbehavior target-gun-post target () + (target-gun-real-post) + (none) + ) diff --git a/test/decompiler/reference/jak2/engine/target/target-swim_REF.gc b/test/decompiler/reference/jak2/engine/target/target-swim_REF.gc new file mode 100644 index 0000000000..7deaf8491c --- /dev/null +++ b/test/decompiler/reference/jak2/engine/target/target-swim_REF.gc @@ -0,0 +1,1098 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(defstate target-wade-stance (target) + :event target-standard-event-handler + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self control unknown-surface00) *wade-mods*) + (set-zero! (-> self water bob)) + (none) + ) + :exit (behavior () + (target-state-hook-exit) + (target-exit) + (let ((v1-1 (-> self skel effect))) + (set! (-> v1-1 channel-offset) 0) + ) + 0 + (none) + ) + :trans (behavior () + ((-> self state-hook)) + (when (and (not (logtest? (water-flags wading) (-> self water flags))) + (>= (- (-> self clock frame-counter) (-> self water wade-time)) (seconds 0.05)) + ) + (if (logtest? (water-flags swimming) (-> self water flags)) + (go target-swim-stance) + (go target-stance) + ) + ) + (if (and (cpad-hold? (-> self control unknown-cpad-info00 number) l1) (can-duck?)) + (go target-duck-stance #f) + ) + (if (!= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + (go target-wade-walk) + ) + (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 0) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (target-jump-go) + ) + (when (and (cpad-pressed? (-> self control unknown-cpad-info00 number) circle) (can-feet? #t)) + (sound-play "swim-stroke") + (spawn-ripples (-> self water) 1.4 (-> self control trans) 0 (-> self control transv) #f) + (go target-attack) + ) + (if (and (cpad-pressed? (-> self control unknown-cpad-info00 number) square) (can-hands? #t)) + (go target-running-attack) + ) + (if (and (using-gun? self) (let ((v1-79 (ja-group))) + (and v1-79 (= v1-79 (-> self draw art-group data 5))) + ) + ) + (go target-gun-stance) + ) + (none) + ) + :code (-> target-stance code) + :post target-post + ) + +;; failed to figure out what this is: +(defstate target-wade-walk (target) + :event target-standard-event-handler + :enter (behavior () + ((-> target-wade-stance enter)) + (none) + ) + :exit (-> target-wade-stance exit) + :trans (behavior () + ((-> self state-hook)) + (when (and (not (logtest? (water-flags wading) (-> self water flags))) + (>= (- (-> self clock frame-counter) (-> self water wade-time)) (seconds 0.1)) + ) + (if (logtest? (water-flags swimming) (-> self water flags)) + (go target-swim-stance) + (go target-stance) + ) + ) + (if (= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + (go target-wade-stance) + ) + (if (and (cpad-hold? (-> self control unknown-cpad-info00 number) l1) (can-duck?)) + (go target-duck-walk #f) + ) + (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 0) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (target-jump-go) + ) + (when (and (cpad-pressed? (-> self control unknown-cpad-info00 number) circle) (can-feet? #t)) + (sound-play "swim-stroke") + (spawn-ripples (-> self water) 1.4 (-> self control trans) 0 (-> self control transv) #f) + (go target-attack) + ) + (if (and (cpad-pressed? (-> self control unknown-cpad-info00 number) square) (can-hands? #t)) + (go target-running-attack) + ) + (none) + ) + :code (behavior () + (let ((gp-0 105) + (f30-0 0.0) + ) + (let ((v1-2 (ja-group))) + (cond + ((and v1-2 (or (= v1-2 (-> self draw art-group data 12)) (= v1-2 (-> self draw art-group data 7)))) + (set! gp-0 15) + (set! f30-0 (ja-frame-num 0)) + ) + ((let ((v1-9 (ja-group))) + (and v1-9 (or (= v1-9 (-> self draw art-group data 23)) (= v1-9 (-> self draw art-group data 27)))) + ) + (set! gp-0 30) + ) + ((let ((v1-16 (ja-group))) + (and v1-16 (= v1-16 (-> self draw art-group data 97))) + ) + (set! gp-0 120) + ) + ) + ) + (cond + ((and (= (ja-group-size) 6) (let ((v1-25 (ja-group))) + (and v1-25 (= v1-25 (-> self draw art-group data 94))) + ) + ) + ) + (else + (ja-channel-push! 6 (the-as time-frame gp-0)) + (ja :group! (-> self draw art-group data 94) + :num! (identity f30-0) + :dist (-> *TARGET-bank* wade-shallow-walk-cycle-dist) + ) + (ja :chan 1 + :group! (-> self draw art-group data 95) + :num! (identity f30-0) + :dist (-> *TARGET-bank* wade-deep-walk-cycle-dist) + ) + (let ((gp-3 (-> self skel root-channel 2))) + (let ((f0-2 0.0)) + (set! (-> gp-3 frame-interp 1) f0-2) + (set! (-> gp-3 frame-interp 0) f0-2) + ) + (set! (-> gp-3 dist) (-> *TARGET-bank* walk-cycle-dist)) + (joint-control-channel-group-eval! + gp-3 + (the-as art-joint-anim (-> self draw art-group data 12)) + num-func-identity + ) + (set! (-> gp-3 frame-num) f30-0) + ) + (let ((gp-4 (-> self skel root-channel 3))) + (let ((f0-4 0.0)) + (set! (-> gp-4 frame-interp 1) f0-4) + (set! (-> gp-4 frame-interp 0) f0-4) + ) + (set! (-> gp-4 dist) (-> *TARGET-bank* walk-down-cycle-dist)) + (joint-control-channel-group-eval! + gp-4 + (the-as art-joint-anim (-> self draw art-group data 14)) + num-func-identity + ) + (set! (-> gp-4 frame-num) f30-0) + ) + (let ((gp-5 (-> self skel root-channel 4))) + (let ((f0-6 0.0)) + (set! (-> gp-5 frame-interp 1) f0-6) + (set! (-> gp-5 frame-interp 0) f0-6) + ) + (set! (-> gp-5 dist) (-> *TARGET-bank* walk-side-cycle-dist)) + (joint-control-channel-group-eval! + gp-5 + (the-as art-joint-anim (-> self draw art-group data 16)) + num-func-identity + ) + (set! (-> gp-5 frame-num) f30-0) + ) + ) + ) + ) + (set! (-> self skel root-channel 2 command) (joint-control-command push)) + (set! (-> self skel root-channel 5 command) (joint-control-command stack)) + (let ((f28-0 0.0) + (f26-0 0.0) + (f30-1 (lerp-scale 1.0 0.0 (-> self control unknown-float05) 16384.0 32768.0)) + (gp-6 0) + ) + (until #f + (let ((f0-10 (fmax -1.0 (fmin 1.0 (* 2.0 (-> self control unknown-float17))))) + (f24-0 (fmax -1.0 (fmin 1.0 (* 1.6 (-> self control unknown-float18))))) + ) + (let ((f1-4 (fabs (- f0-10 f28-0)))) + (set! f28-0 (seek f28-0 f0-10 (fmax 0.05 (fmin 0.2 (* 0.25 f1-4))))) + ) + (let ((f0-14 (fabs (- f24-0 f26-0)))) + (set! f26-0 (seek f26-0 f24-0 (fmax 0.05 (fmin 0.2 (* 0.25 f0-14))))) + ) + ) + (ja :chan 3 :group! (-> self draw art-group data 14) :dist (-> *TARGET-bank* walk-down-cycle-dist)) + (cond + ((>= f28-0 0.0) + (let ((v1-83 (-> self skel root-channel 3))) + (let ((f0-20 (fabs f28-0))) + (set! (-> v1-83 frame-interp 1) f0-20) + (set! (-> v1-83 frame-interp 0) f0-20) + ) + (set! (-> v1-83 dist) (-> *TARGET-bank* walk-up-cycle-dist)) + (set! (-> v1-83 frame-group) (the-as art-joint-anim (-> self draw art-group data 13))) + ) + ) + (else + (let ((v1-86 (-> self skel root-channel 3))) + (let ((f0-22 (fabs f28-0))) + (set! (-> v1-86 frame-interp 1) f0-22) + (set! (-> v1-86 frame-interp 0) f0-22) + ) + (set! (-> v1-86 dist) (-> *TARGET-bank* walk-down-cycle-dist)) + (set! (-> v1-86 frame-group) (the-as art-joint-anim (-> self draw art-group data 14))) + ) + ) + ) + (cond + ((>= f26-0 0.0) + (let ((v1-89 (-> self skel root-channel 4))) + (let ((f0-25 (fabs f26-0))) + (set! (-> v1-89 frame-interp 1) f0-25) + (set! (-> v1-89 frame-interp 0) f0-25) + ) + (set! (-> v1-89 dist) (-> *TARGET-bank* walk-side-cycle-dist)) + (set! (-> v1-89 frame-group) (the-as art-joint-anim (-> self draw art-group data 15))) + ) + ) + (else + (let ((v1-92 (-> self skel root-channel 4))) + (let ((f0-27 (fabs f26-0))) + (set! (-> v1-92 frame-interp 1) f0-27) + (set! (-> v1-92 frame-interp 0) f0-27) + ) + (set! (-> v1-92 dist) (-> *TARGET-bank* walk-side-cycle-dist)) + (set! (-> v1-92 frame-group) (the-as art-joint-anim (-> self draw art-group data 16))) + ) + ) + ) + (let* ((f0-30 (- (-> self water height) (-> self control trans y))) + (f24-1 + (lerp-scale + 0.0 + 1.0 + f0-30 + (lerp (-> self water wade-height) (-> self water swim-height) 0.25) + (lerp (-> self water wade-height) (-> self water swim-height) 0.75) + ) + ) + ) + (let ((v1-100 (-> self skel effect))) + (set! (-> v1-100 channel-offset) (if (< 0.5 f24-1) + 1 + 0 + ) + ) + ) + 0 + (set! f30-1 + (seek + f30-1 + (lerp-scale 1.0 0.0 (-> self control unknown-float05) 16384.0 32768.0) + (* 4.0 (-> self clock seconds-per-frame)) + ) + ) + (let ((v1-107 (-> self skel root-channel 1))) + (set! (-> v1-107 frame-interp 1) f24-1) + (set! (-> v1-107 frame-interp 0) f24-1) + ) + (ja :num! (loop! + (/ (-> self control unknown-float05) + (* 60.0 + (/ (* (current-cycle-distance (-> self skel)) (-> self control scale x)) (-> *TARGET-bank* run-cycle-length)) + ) + ) + ) + ) + (let ((s5-3 (-> self skel root-channel 5)) + (f0-44 (lerp f30-1 0.0 f24-1)) + ) + (set! (-> s5-3 frame-interp 1) f0-44) + (set! (-> s5-3 frame-interp 0) f0-44) + ) + ) + (ja :chan 1 :num! (chan 0)) + (ja :chan 2 :num! (chan 0)) + (ja :chan 3 :num! (chan 0)) + (ja :chan 4 :num! (chan 0)) + (when (and (>= (- (-> self clock frame-counter) (the-as time-frame gp-6)) (seconds 0.2)) + (< (- (-> self water height) (-> self control trans y)) 4096.0) + ) + (case (the int (ja-aframe-num 0)) + ((15 16 17 18) + (spawn-ripples + (-> self water) + 0.2 + (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 39)) + 0 + (vector-float*! (new 'stack-no-clear 'vector) (-> self control transv) 2.5) + #f + ) + (set! gp-6 (the-as int (-> self clock frame-counter))) + ) + ((46 47 48 49) + (spawn-ripples + (-> self water) + 0.2 + (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 32)) + 0 + (vector-float*! (new 'stack-no-clear 'vector) (-> self control transv) 2.5) + #f + ) + (set! gp-6 (the-as int (-> self clock frame-counter))) + ) + ) + ) + (suspend) + ) + ) + #f + (none) + ) + :post target-post + ) + +;; definition for function target-swim-tilt +(defbehavior target-swim-tilt target ((arg0 float) (arg1 float) (arg2 float) (arg3 float)) + (let ((gp-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self control unknown-quaternion00)))) + (let ((v1-2 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self control dir-targ))) + (f0-1 + (fmin 1.0 (* arg0 (/ (-> self control unknown-float05) (-> self control unknown-surface01 target-speed)))) + ) + ) + (seek! + (-> self control unknown-float43) + (fmax (fmin (* (+ f0-1 arg2) (fmax 0.5 (+ 0.5 (vector-dot gp-0 v1-2)))) arg3) (- arg3)) + (* arg1 (-> self clock seconds-per-frame)) + ) + ) + (let ((a2-2 (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self control unknown-quaternion00)))) + (forward-up-nopitch->quaternion (-> self control unknown-quaternion01) gp-0 a2-2) + ) + ) + (quaternion-rotate-x! + (-> self control unknown-quaternion01) + (-> self control unknown-quaternion01) + (if (>= (-> self control unknown-float43) 0.0) + 16384.0 + -16384.0 + ) + ) + (set! (-> self control unknown-float04) (fabs (-> self control unknown-float43))) + (if (and (-> self next-state) (= (-> self next-state name) 'target-swim-down)) + (seek! (-> self control unknown-float001) -6144.0 (* 4096.0 (-> self clock seconds-per-frame))) + (seek! (-> self control unknown-float001) 0.0 (* 2048.0 (-> self clock seconds-per-frame))) + ) + (set! (-> self control unknown-vector04 y) (-> self control unknown-float001)) + ) + +;; failed to figure out what this is: +(defstate target-swim-stance (target) + :event target-standard-event-handler + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self control unknown-surface00) *swim-mods*) + (logior! (-> self water flags) (water-flags swim-ground)) + (set! (-> self state-flags) (logior (state-flags lleg-no-ik rleg-no-ik) (-> self state-flags))) + (none) + ) + :exit (behavior () + (target-state-hook-exit) + (set! (-> self control unknown-surface00 target-speed) 28672.0) + (target-exit) + (when (not (and (-> self next-state) (let ((v1-6 (-> self next-state name))) + (or (= v1-6 'target-swim-stance) + (= v1-6 'target-swim-walk) + (= v1-6 'target-swim-down) + (= v1-6 'target-swim-up) + ) + ) + ) + ) + (quaternion-identity! (-> self control unknown-quaternion01)) + (set! (-> self control unknown-float04) 0.0) + ) + (when (not (and (-> self next-state) (let ((v1-14 (-> self next-state name))) + (or (= v1-14 'target-swim-stance) (= v1-14 'target-swim-walk)) + ) + ) + ) + (let ((v1-15 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-15 command) (sound-command set-param)) + (set! (-> v1-15 id) (-> self control unknown-sound-id02)) + (set! (-> v1-15 params volume) -4) + (set! (-> v1-15 auto-time) 960) + (set! (-> v1-15 auto-from) 2) + (set! (-> v1-15 params mask) (the-as uint 17)) + (-> v1-15 id) + ) + ) + (none) + ) + :trans (behavior () + ((-> self state-hook)) + (if (and (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (zero? (logand (-> self control status) (cshape-moving-flags on-water))) + ) + (set-zero! (-> self water bob)) + ) + (when (and (not (logtest? (water-flags swimming) (-> self water flags))) + (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + ) + (if (logtest? (water-flags wading) (-> self water flags)) + (go target-wade-stance) + (go target-stance) + ) + ) + (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 0) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? #f) + (>= (- (-> self clock frame-counter) (-> self water enter-swim-time)) (seconds 0.1)) + ) + (go target-swim-jump (-> *TARGET-bank* swim-jump-height-min) (-> *TARGET-bank* swim-jump-height-max)) + ) + (when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 0) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 2) + ) + (pad-buttons circle square) + ) + (< (-> *TARGET-bank* min-dive-depth) (target-height-above-ground)) + ) + (spawn-ripples (-> self water) 0.7 (-> self control trans) 1 *null-vector* #t) + (set! (-> self control unknown-float43) 0.0) + (go target-swim-down) + ) + (if (and (!= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + (let ((gp-0 (ja-group))) + (ja-aframe-num 0) + (if (or (and (= gp-0 (-> self draw art-group data 101)) #t) (and (= gp-0 (-> self draw art-group data 100)) #t)) + #f + #t + ) + ) + ) + (go target-swim-walk) + ) + (target-swim-tilt 0.0 2.0 0.0 1.0) + (sound-play "swim-bubbles" :id (-> self control unknown-sound-id02)) + (none) + ) + :code (behavior () + (let ((v1-2 (ja-group))) + (cond + ((and v1-2 (or (= v1-2 (-> self draw art-group data 101)) (= v1-2 (-> self draw art-group data 100)))) + (ja-channel-push! 1 (seconds 0.075)) + (ja-no-eval :group! (-> self draw art-group data 102) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 102)) frames num-frames) -1)) + (if (= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + 1.0 + 2.0 + ) + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (let ((a0-9 (-> self skel root-channel 0))) + (set! (-> a0-9 param 0) (the float (+ (-> a0-9 frame-group frames num-frames) -1))) + (let ((v1-38 (if (= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + 1.0 + 2.0 + ) + ) + ) + (set! (-> a0-9 param 1) v1-38) + ) + (joint-control-channel-group-eval! a0-9 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + (else + (let ((v1-43 (ja-group))) + (if (and v1-43 (= v1-43 (-> self draw art-group data 97))) + (ja-channel-push! 1 (seconds 0.83)) + (ja-channel-push! 1 (seconds 0.15)) + ) + ) + ) + ) + ) + (until #f + (ja :group! (-> self draw art-group data 96) :num! min) + (until (and (ja-done? 0) (= (-> self skel root-channel 0) (-> self skel channel))) + (can-play-stance-amibent?) + (suspend) + (if (= (-> self skel root-channel 0) (-> self skel channel)) + (ja :num! (seek!)) + ) + ) + ) + #f + (none) + ) + :post target-swim-post + ) + +;; failed to figure out what this is: +(defstate target-swim-walk (target) + :event target-standard-event-handler + :enter (behavior () + ((-> target-swim-stance enter)) + (die-on-next-update! (-> self water bob)) + (set! (-> self control unknown-word04) (the-as uint (-> self clock frame-counter))) + (set! (-> self state-flags) (logior (state-flags lleg-no-ik rleg-no-ik) (-> self state-flags))) + (none) + ) + :exit (-> target-swim-stance exit) + :trans (behavior () + ((-> self state-hook)) + (if (and (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (zero? (logand (-> self control status) (cshape-moving-flags on-water))) + ) + (set-zero! (-> self water bob)) + ) + (when (and (not (logtest? (water-flags swimming) (-> self water flags))) + (>= (- (-> self clock frame-counter) (-> self water swim-time)) (seconds 0.1)) + ) + (if (logtest? (water-flags wading) (-> self water flags)) + (go target-wade-stance) + (go target-stance) + ) + ) + (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 0) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? #f) + (>= (- (-> self clock frame-counter) (-> self water enter-swim-time)) (seconds 0.1)) + ) + (go target-swim-jump (-> *TARGET-bank* swim-jump-height-min) (-> *TARGET-bank* swim-jump-height-max)) + ) + (when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 0) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) button0-rel 2) + ) + (pad-buttons circle square) + ) + (< (-> *TARGET-bank* min-dive-depth) (target-height-above-ground)) + ) + (spawn-ripples (-> self water) 0.7 (-> self control trans) 1 *null-vector* #t) + (set! (-> self control unknown-float43) 0.0) + (go target-swim-down) + ) + (cond + ((= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + (if (>= (the-as uint (- (-> self clock frame-counter) (the-as int (-> self control unknown-word04)))) + (the-as uint 15) + ) + (go target-swim-stance) + ) + ) + (else + (set! (-> self control unknown-word04) (the-as uint (-> self clock frame-counter))) + ) + ) + (target-swim-tilt 0.0 2.0 0.0 1.0) + (sound-play "swim-bubbles" :id (-> self control unknown-sound-id02)) + (none) + ) + :code (behavior () + (let ((v1-2 (ja-group))) + (cond + ((and v1-2 (or (= v1-2 (-> self draw art-group data 101)) + (= v1-2 (-> self draw art-group data 100)) + (= v1-2 (-> self draw art-group data 102)) + ) + ) + (ja-channel-push! 1 (seconds 0.3)) + ) + ((let ((v1-8 (ja-group))) + (and v1-8 (= v1-8 (-> self draw art-group data 102))) + ) + (ja-channel-push! 1 (seconds 0.15)) + (ja-no-eval :group! (-> self draw art-group data 97) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 97)) frames num-frames) -1))) + :frame-num (ja-aframe 19.0 0) + ) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (if (not (logtest? (-> self align flags) (align-flags disabled))) + (set! (-> self control unknown-surface00 target-speed) + (* (-> self align delta trans z) (-> self control unknown-surface01 alignv) (-> self clock frames-per-second)) + ) + ) + (suspend) + (ja :num! (seek!)) + ) + ) + (else + (ja-channel-push! 1 (seconds 0.15)) + ) + ) + ) + (until #f + (ja-no-eval :group! (-> self draw art-group data 97) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 97)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (if (not (logtest? (-> self align flags) (align-flags disabled))) + (set! (-> self control unknown-surface00 target-speed) + (* (-> self align delta trans z) (-> self control unknown-surface01 alignv) (-> self clock frames-per-second)) + ) + ) + (suspend) + (ja :num! (seek!)) + ) + ) + #f + (none) + ) + :post target-swim-post + ) + +;; failed to figure out what this is: +(defstate target-swim-down (target) + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (local-vars (t0-7 symbol)) + (case event-type + (('attack 'attack-invinc 'attack-or-shove) + (let ((v1-1 (the-as attack-info (-> event param 1)))) + (set! t0-7 (or (not (logtest? (-> v1-1 mask) (attack-info-mask mode))) + (case (-> v1-1 mode) + (('bot 'lava 'melt 'dark-eco-pool) + #f + ) + (('drown-death 'sharkey 'instant-death 'crush 'death 'grenade 'endlessfall) + (set! t0-7 'drown-death) + (set! (-> v1-1 mode) t0-7) + t0-7 + ) + (else + #t + ) + ) + ) + ) + (when t0-7 + (if (not (logtest? (attack-info-mask damage) (-> v1-1 mask))) + (set! (-> v1-1 damage) (-> *FACT-bank* health-single-inc)) + ) + (if (!= (-> v1-1 mode) 'drown-death) + (set! (-> v1-1 mode) 'damage) + ) + (if (and (= (-> self game mode) 'play) + (>= 0.0 (- (-> (the-as fact-info-target (-> self fact)) health) (-> v1-1 damage))) + ) + (set! (-> v1-1 mode) 'drown-death) + ) + (logior! (-> v1-1 mask) (attack-info-mask mode)) + (set! (-> self control unknown-word04) (the-as uint #t)) + ) + ) + ) + (('slide) + ) + ) + (target-standard-event-handler proc arg1 event-type event) + ) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self state-flags) (logior (state-flags lleg-no-ik rleg-no-ik) (-> self state-flags))) + (logclear! (-> self water flags) (water-flags swim-ground)) + (set! (-> self control unknown-surface00) *dive-mods*) + (set! (-> self control dynam gravity-max) 16384.0) + (set! (-> self control dynam gravity-length) 16384.0) + (set! (-> self water swim-time) (-> self clock frame-counter)) + (set! (-> self control unknown-word04) (the-as uint #f)) + (set! (-> self neck flex-blend) 0.0) + (none) + ) + :exit (behavior () + (set! (-> self control dynam gravity-max) (-> self control unknown-dynamics00 gravity-max)) + (set! (-> self control dynam gravity-length) (-> self control unknown-dynamics00 gravity-length)) + (target-exit) + (when (not (and (-> self next-state) (let ((v1-11 (-> self next-state name))) + (or (= v1-11 'target-swim-stance) + (= v1-11 'target-swim-walk) + (= v1-11 'target-swim-down) + (= v1-11 'target-swim-up) + ) + ) + ) + ) + (quaternion-identity! (-> self control unknown-quaternion01)) + (set! (-> self control unknown-float04) 0.0) + ) + (when (not (and (-> self next-state) (let ((v1-19 (-> self next-state name))) + (or (= v1-19 'target-swim-down) (= v1-19 'target-swim-up)) + ) + ) + ) + (let ((v1-21 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-21 command) (sound-command set-param)) + (set! (-> v1-21 id) (-> self control unknown-sound-id03)) + (set! (-> v1-21 params volume) -4) + (set! (-> v1-21 auto-time) 960) + (set! (-> v1-21 auto-from) 2) + (set! (-> v1-21 params mask) (the-as uint 17)) + (-> v1-21 id) + ) + ) + (set! (-> self neck flex-blend) 1.0) + (none) + ) + :trans (behavior () + (if (>= (- (-> self clock frame-counter) (-> self water swim-time)) (seconds 0.5)) + (go target-stance) + ) + (cond + ((>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) (seconds 0.1)) + (set! (-> self control unknown-surface00) *dive-mods*) + (if (and (-> self next-state) (= (-> self next-state name) 'target-swim-down)) + (target-swim-tilt -0.9 1.0 0.0 0.5) + ) + ) + (else + (set! (-> self control unknown-surface00) *dive-bottom-mods*) + (if (and (-> self next-state) (let ((v1-18 (-> self next-state name))) + (or (= v1-18 'target-swim-down) (= v1-18 'target-swim-stance)) + ) + ) + (target-swim-tilt 0.0 2.0 -1.0 1.0) + ) + ) + ) + (none) + ) + :code (behavior () + (let ((gp-0 60) + (s5-0 3000) + (f30-0 0.0) + ) + (let ((v1-2 (ja-group))) + (set! f30-0 + (cond + ((and v1-2 + (or (= v1-2 (-> self draw art-group data 96)) + (= v1-2 (-> self draw art-group data 97)) + (= v1-2 (-> self draw art-group data 102)) + (= v1-2 (-> self draw art-group data 101)) + (= v1-2 (-> self draw art-group data 100)) + ) + ) + (let ((t9-0 ja-channel-push!) + (a0-16 1) + (v1-7 (ja-group)) + ) + (t9-0 a0-16 (the-as time-frame (if (and v1-7 (= v1-7 (-> self draw art-group data 100))) + 105 + 22 + ) + ) + ) + ) + (ja-no-eval :group! (-> self draw art-group data 98) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 98)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (align! (-> self align) (align-opts adjust-y-vel adjust-xz-vel) 1.0 1.0 1.0) + (if (= (ja-aframe-num 0) 73.0) + (spawn-ripples (-> self water) 0.7 (-> self control trans) 1 *null-vector* #f) + ) + (suspend) + (ja :num! (seek!)) + ) + (ja :group! (-> self draw art-group data 99) :num! min) + f30-0 + ) + (else + (let ((v1-50 (ja-group))) + (cond + ((and v1-50 (or (= v1-50 (-> self draw art-group data 52)) + (= v1-50 (-> self draw art-group data 55)) + (= v1-50 (-> self draw art-group data 53)) + (= v1-50 (-> self draw art-group data 56)) + ) + ) + (ja-channel-push! 1 (seconds 0.075)) + (set! gp-0 120) + (ja :group! (-> self draw art-group data 99) :num! (identity (ja-aframe 124.0 0))) + -16384.0 + ) + (else + (ja-channel-push! 1 (seconds 0.075)) + (ja :group! (-> self draw art-group data 99) :num! min) + f30-0 + ) + ) + ) + ) + ) + ) + ) + (until #f + (when (and (!= (-> self tobot?) 'tobot) (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05))) + (if (and (or (not (cpad-hold? (-> self control unknown-cpad-info00 number) circle square)) + (-> self control unknown-spool-anim00) + ) + (>= (- (-> self clock frame-counter) (-> self state-time)) gp-0) + ) + (go target-swim-up) + ) + (if (or (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame27)) s5-0) + (and (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (and (< (-> self water swim-depth) 8192.0) (>= (- (-> self clock frame-counter) (-> self state-time)) gp-0)) + ) + ) + (go target-swim-up) + ) + ) + (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (sound-play "water-bubbles" :id (-> self control unknown-sound-id03)) + ) + (let ((s4-3 (new-stack-vector0)) + (f0-13 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + ) + 0.0 + (vector-! s4-3 (-> self control transv) (vector-float*! s4-3 (-> self control dynam gravity-normal) f0-13)) + (let* ((f28-0 (vector-length s4-3)) + (f26-0 f28-0) + (f24-0 (+ f0-13 f30-0)) + ) + (set! f30-0 (seek f30-0 0.0 (* 32768.0 (-> self clock seconds-per-frame)))) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f24-0) + (vector-float*! s4-3 s4-3 (/ f28-0 f26-0)) + ) + ) + ) + (suspend) + (ja :num! (loop! (lerp-scale 0.4 1.0 (vector-length (-> self control transv)) 0.0 16384.0))) + ) + ) + #f + (none) + ) + :post target-swim-post + ) + +;; failed to figure out what this is: +(defstate target-swim-up (target) + :event (-> target-swim-down event) + :enter (behavior () + ((-> target-swim-down enter)) + (none) + ) + :exit (-> target-swim-down exit) + :trans (behavior () + (if (and (cpad-pressed? (-> self control unknown-cpad-info00 number) x) + (not (logtest? (-> self state-flags) (state-flags sf7))) + (zero? (logand (water-flags head-under-water bouncing) (-> self water flags))) + ) + (go + target-swim-jump-jump + (-> *TARGET-bank* swim-jump-height-min) + (-> *TARGET-bank* swim-jump-height-max) + (the-as surface #f) + ) + ) + (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 10)) + (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) + ) + (let ((a1-3 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-3 from) (process->ppointer self)) + (set! (-> a1-3 num-params) 2) + (set! (-> a1-3 message) 'attack) + (set! (-> a1-3 param 0) (the-as uint #f)) + (let ((v1-27 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (let* ((a0-8 *game-info*) + (a2-2 (+ (-> a0-8 attack-id) 1)) + ) + (set! (-> a0-8 attack-id) a2-2) + (set! (-> v1-27 id) a2-2) + ) + (set! (-> v1-27 mode) 'drown-death) + (set! (-> a1-3 param 1) (the-as uint v1-27)) + ) + (send-event-function self a1-3) + ) + ) + (if (and (cpad-pressed? (-> self control unknown-cpad-info00 number) circle square) + (or (< (- (-> self clock frame-counter) (-> self control unknown-time-frame27)) (seconds 10)) + (logtest? (-> self control status) (cshape-moving-flags t-ceil)) + ) + (and (< (-> *TARGET-bank* min-dive-depth) (target-height-above-ground)) + (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.05)) + ) + ) + (go target-swim-down) + ) + (sound-play "water-bubbles" :id (-> self control unknown-sound-id03)) + ((-> target-swim-down trans)) + (none) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.1)) + (let ((f30-0 1.0)) + (let ((s5-0 #t) + (gp-0 #f) + ) + (ja-no-eval :group! (-> self draw art-group data 100) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 100)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (target-swim-tilt + (if (< 8192.0 (-> self water swim-depth)) + 0.5 + 0.0 + ) + 1.0 + 0.0 + 0.1 + ) + (when (and (not gp-0) + (or (>= (ja-aframe-num 0) 240.0) (zero? (logand (water-flags head-under-water) (-> self water flags)))) + ) + (set! gp-0 #t) + (sound-play "swim-surface") + (spawn-ripples (-> self water) 0.2 (-> self control trans) 1 (-> self control transv) #t) + ) + (if (and (not (logtest? (-> self water flags) (water-flags under-water))) + (and (or (>= (ja-aframe-num 0) 222.0) + (and (!= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + (>= (ja-aframe-num 0) 200.0) + ) + ) + (!= (-> self tobot?) 'tobot) + ) + ) + (goto cfg-51) + ) + (compute-alignment! (-> self align)) + (when (not (logtest? (-> self water flags) (water-flags under-water))) + (logior! (-> self water flags) (water-flags swim-ground)) + (set! s5-0 #f) + ) + (if s5-0 + (align! (-> self align) (align-opts adjust-y-vel) 1.0 1.0 1.0) + ) + (suspend) + (ja :num! (seek!)) + ) + ) + (ja :group! (-> self draw art-group data 101) :num! min) + (until #f + (target-swim-tilt + (if (< 8192.0 (-> self water swim-depth)) + 0.3 + 0.0 + ) + 1.0 + 0.0 + 0.1 + ) + (if (and (not (logtest? (-> self water flags) (water-flags under-water))) (!= (-> self tobot?) 'tobot)) + (goto cfg-51) + ) + (if (cpad-pressed? (-> self control unknown-cpad-info00 number) x) + (set! f30-0 2.0) + ) + (compute-alignment! (-> self align)) + (when (logtest? (-> self water flags) (water-flags under-water)) + (align! (-> self align) (align-opts adjust-y-vel) 1.0 1.0 1.0) + (set! (-> self control transv y) (+ 8192.0 (* 8192.0 f30-0))) + ) + (suspend) + (ja :num! (loop! f30-0)) + (set! f30-0 (seek f30-0 1.0 (-> self clock seconds-per-frame))) + ) + ) + #f + (label cfg-51) + (logior! (-> self water flags) (water-flags swim-ground)) + (set! (-> self water swim-time) (-> self clock frame-counter)) + (start-bobbing! (-> self water) -4096.0 600 1500) + (set! (-> self water bob start-time) (+ (-> self clock frame-counter) (seconds -0.05))) + (go target-swim-stance) + (none) + ) + :post target-swim-post + ) + +;; failed to figure out what this is: +(defstate target-swim-jump-jump (target) + :event (-> target-jump event) + :enter (-> target-jump enter) + :exit target-exit + :trans (behavior () + (cond + ((< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (set! (-> self water flags) (logior (water-flags jump-out) (-> self water flags))) + (logclear! (-> self control status) (cshape-moving-flags on-surface on-ground t-surface)) + ) + (else + (set! (-> self trans-hook) (-> target-jump trans)) + ) + ) + ((-> target-jump trans)) + (none) + ) + :code (-> target-jump code) + :post target-post + ) + +;; failed to figure out what this is: +(defstate target-swim-jump (target) + :event target-standard-event-handler + :enter (-> target-swim-stance enter) + :exit (behavior () + ((-> target-swim-stance exit)) + (die-on-next-update! (-> self water bob)) + (set! (-> self water align-offset) 0.0) + (set! (-> self water flags) (logior (water-flags jump-out) (-> self water flags))) + (none) + ) + :code (behavior ((arg0 float) (arg1 float)) + (die-on-next-update! (-> self water bob)) + (ja-channel-push! 1 (seconds 0.05)) + (ja :group! (-> self draw art-group data 103) :num! min) + (until (and (ja-done? 0) (= (-> self skel root-channel 0) (-> self skel channel))) + (compute-alignment! (-> self align)) + (if (not (logtest? (-> self align flags) (align-flags disabled))) + (+! (-> self water align-offset) (* 0.6 (-> self align delta trans y))) + ) + (suspend) + (if (= (-> self skel root-channel 0) (-> self skel channel)) + (ja :num! (seek! max 2.0)) + ) + ) + (let ((f0-7 (fmax 0.0 (- (-> self water bob-offset))))) + (let ((v1-36 (new-stack-vector0))) + (let ((f1-5 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! v1-36 (-> self control transv) (vector-float*! v1-36 (-> self control dynam gravity-normal) f1-5)) + ) + (let* ((f1-6 (vector-length v1-36)) + (f2-2 f1-6) + (f3-0 0.4096) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f3-0) + (vector-float*! v1-36 v1-36 (/ f1-6 f2-2)) + ) + ) + ) + (go target-swim-jump-jump (+ f0-7 arg0) (+ f0-7 arg1) (the-as surface #f)) + ) + (none) + ) + :post target-swim-post + ) diff --git a/test/decompiler/reference/jak2/engine/target/target-util_REF.gc b/test/decompiler/reference/jak2/engine/target/target-util_REF.gc new file mode 100644 index 0000000000..39011b60e3 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/target/target-util_REF.gc @@ -0,0 +1,2197 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(defskelgroup skel-jchar jakb 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 3.2) + :longest-edge (meters 1) + :shadow 2 + :texture-level 6 + :sort 1 + :origin-joint-index 3 + :shadow-joint-index 3 + ) + +;; definition for symbol *target-shadow-control*, type shadow-control +(define *target-shadow-control* + (new 'static 'shadow-control :settings (new 'static 'shadow-settings + :center (new 'static 'vector :w (the-as float #x2)) + :shadow-dir (new 'static 'vector :x -0.4226 :y -0.9063 :w 409600.0) + :bot-plane (new 'static 'plane :y 1.0 :w 37683.2) + :top-plane (new 'static 'plane :y 1.0 :w 4096.0) + ) + ) + ) + +;; failed to figure out what this is: +(defskelgroup skel-jak-highres jak-highres 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 3.2) + :longest-edge (meters 1) + :shadow 2 + :sort 1 + :origin-joint-index 3 + :shadow-joint-index 3 + ) + +;; failed to figure out what this is: +(defskelgroup skel-generic-blast collectables 10 12 + ((11 (meters 999999))) + :bounds (static-spherem 0 0 0 50) + :texture-level 6 + :sort 4 + ) + +;; failed to figure out what this is: +(defskelgroup skel-generic-ripples collectables 13 15 + ((14 (meters 999999))) + :bounds (static-spherem 0 0 0 6) + :texture-level 6 + :sort 4 + ) + +;; failed to figure out what this is: +(defskelgroup skel-bomb-blast collectables 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 50) + :texture-level 6 + :sort 4 + ) + +;; definition of type target-bank +(deftype target-bank (basic) + ((jump-collide-offset meters :offset-assert 4) + (jump-height-min meters :offset-assert 8) + (jump-height-max meters :offset-assert 12) + (double-jump-height-min meters :offset-assert 16) + (double-jump-height-max meters :offset-assert 20) + (flip-jump-height-min meters :offset-assert 24) + (flip-jump-height-max meters :offset-assert 28) + (duck-jump-height-min meters :offset-assert 32) + (duck-jump-height-max meters :offset-assert 36) + (flop-jump-height-min meters :offset-assert 40) + (flop-jump-height-max meters :offset-assert 44) + (attack-jump-height-min meters :offset-assert 48) + (attack-jump-height-max meters :offset-assert 52) + (edge-grab-jump-height-min meters :offset-assert 56) + (edge-grab-jump-height-max meters :offset-assert 60) + (swim-jump-height-min meters :offset-assert 64) + (swim-jump-height-max meters :offset-assert 68) + (tube-jump-height-min meters :offset-assert 72) + (tube-jump-height-max meters :offset-assert 76) + (carry-jump-height-min meters :offset-assert 80) + (carry-jump-height-max meters :offset-assert 84) + (mech-jump-height-min meters :offset-assert 88) + (mech-jump-height-max meters :offset-assert 92) + (mech-carry-jump-height-min meters :offset-assert 96) + (mech-carry-jump-height-max meters :offset-assert 100) + (indax-jump-height-min meters :offset-assert 104) + (indax-jump-height-max meters :offset-assert 108) + (indax-double-jump-height-min meters :offset-assert 112) + (indax-double-jump-height-max meters :offset-assert 116) + (roll-duration uint64 :offset-assert 120) + (roll-jump-pre-window uint64 :offset-assert 128) + (roll-jump-post-window uint64 :offset-assert 136) + (roll-timeout uint64 :offset-assert 144) + (roll-speed-min meters :offset-assert 152) + (roll-speed-inc meters :offset-assert 156) + (roll-flip-duration uint64 :offset-assert 160) + (roll-flip-height meters :offset-assert 168) + (roll-flip-dist meters :offset-assert 172) + (roll-flip-art-height meters :offset-assert 176) + (roll-flip-art-dist meters :offset-assert 180) + (duck-slide-distance meters :offset-assert 184) + (fall-far meters :offset-assert 188) + (fall-far-inc meters :offset-assert 192) + (attack-timeout uint64 :offset-assert 200) + (ground-timeout uint64 :offset-assert 208) + (slide-down-timeout uint64 :offset-assert 216) + (fall-timeout uint64 :offset-assert 224) + (fall-stumble-threshold meters :offset-assert 232) + (yellow-projectile-speed meters :offset-assert 236) + (hit-invulnerable-timeout uint64 :offset-assert 240) + (same-attack-invulnerable-timeout uint64 :offset-assert 248) + (run-cycle-length float :offset-assert 256) + (walk-cycle-dist meters :offset-assert 260) + (walk-up-cycle-dist meters :offset-assert 264) + (walk-down-cycle-dist meters :offset-assert 268) + (walk-side-cycle-dist meters :offset-assert 272) + (run-cycle-dist meters :offset-assert 276) + (run-up-cycle-dist meters :offset-assert 280) + (run-down-cycle-dist meters :offset-assert 284) + (run-side-cycle-dist meters :offset-assert 288) + (run-wall-cycle-dist meters :offset-assert 292) + (duck-walk-cycle-dist meters :offset-assert 296) + (wade-shallow-walk-cycle-dist meters :offset-assert 300) + (wade-deep-walk-cycle-dist meters :offset-assert 304) + (mech-walk-cycle-dist meters :offset-assert 308) + (mech-run-cycle-dist meters :offset-assert 312) + (smack-surface-dist meters :offset-assert 316) + (smack-surface-height meters :offset-assert 320) + (min-dive-depth meters :offset-assert 324) + (root-radius meters :offset-assert 328) + (root-offset vector :inline :offset-assert 336) + (body-radius meters :offset-assert 352) + (edge-radius meters :offset-assert 356) + (edge-offset vector :inline :offset-assert 368) + (edge-grab-height-off-ground meters :offset-assert 384) + (head-radius meters :offset-assert 388) + (head-height meters :offset-assert 392) + (head-offset vector :inline :offset-assert 400) + (spin-radius meters :offset-assert 416) + (spin-offset vector :inline :offset-assert 432) + (duck-spin-radius meters :offset-assert 448) + (duck-spin-offset vector :inline :offset-assert 464) + (punch-radius meters :offset-assert 480) + (punch-offset vector :inline :offset-assert 496) + (uppercut-radius meters :offset-assert 512) + (uppercut0-offset vector :inline :offset-assert 528) + (uppercut1-offset vector :inline :offset-assert 544) + (flop-radius meters :offset-assert 560) + (flop0-offset vector :inline :offset-assert 576) + (flop1-offset vector :inline :offset-assert 592) + (stuck-time seconds :offset-assert 608) + (stuck-timeout seconds :offset-assert 616) + (stuck-distance meters :offset-assert 624) + (tongue-pull-speed-min float :offset-assert 628) + (tongue-pull-speed-max float :offset-assert 632) + (yellow-attack-timeout uint64 :offset-assert 640) + (fall-height meters :offset-assert 648) + (mech-jump-thrust-fuel float :offset-assert 652) + (strafe-jump-pre-window uint64 :offset-assert 656) + (strafe-jump basic :offset-assert 664) + (strafe-duck-jump basic :offset-assert 668) + (dark-jump-height-min meters :offset-assert 672) + (dark-jump-height-max meters :offset-assert 676) + ) + :method-count-assert 9 + :size-assert #x2a8 + :flag-assert #x9000002a8 + ) + +;; definition for method 3 of type target-bank +(defmethod inspect target-bank ((obj target-bank)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tjump-collide-offset: (meters ~m)~%" (-> obj jump-collide-offset)) + (format #t "~1Tjump-height-min: (meters ~m)~%" (-> obj jump-height-min)) + (format #t "~1Tjump-height-max: (meters ~m)~%" (-> obj jump-height-max)) + (format #t "~1Tdouble-jump-height-min: (meters ~m)~%" (-> obj double-jump-height-min)) + (format #t "~1Tdouble-jump-height-max: (meters ~m)~%" (-> obj double-jump-height-max)) + (format #t "~1Tflip-jump-height-min: (meters ~m)~%" (-> obj flip-jump-height-min)) + (format #t "~1Tflip-jump-height-max: (meters ~m)~%" (-> obj flip-jump-height-max)) + (format #t "~1Tduck-jump-height-min: (meters ~m)~%" (-> obj duck-jump-height-min)) + (format #t "~1Tduck-jump-height-max: (meters ~m)~%" (-> obj duck-jump-height-max)) + (format #t "~1Tflop-jump-height-min: (meters ~m)~%" (-> obj flop-jump-height-min)) + (format #t "~1Tflop-jump-height-max: (meters ~m)~%" (-> obj flop-jump-height-max)) + (format #t "~1Tattack-jump-height-min: (meters ~m)~%" (-> obj attack-jump-height-min)) + (format #t "~1Tattack-jump-height-max: (meters ~m)~%" (-> obj attack-jump-height-max)) + (format #t "~1Tedge-grab-jump-height-min: (meters ~m)~%" (-> obj edge-grab-jump-height-min)) + (format #t "~1Tedge-grab-jump-height-max: (meters ~m)~%" (-> obj edge-grab-jump-height-max)) + (format #t "~1Tswim-jump-height-min: (meters ~m)~%" (-> obj swim-jump-height-min)) + (format #t "~1Tswim-jump-height-max: (meters ~m)~%" (-> obj swim-jump-height-max)) + (format #t "~1Ttube-jump-height-min: (meters ~m)~%" (-> obj tube-jump-height-min)) + (format #t "~1Ttube-jump-height-max: (meters ~m)~%" (-> obj tube-jump-height-max)) + (format #t "~1Tcarry-jump-height-min: (meters ~m)~%" (-> obj carry-jump-height-min)) + (format #t "~1Tcarry-jump-height-max: (meters ~m)~%" (-> obj carry-jump-height-max)) + (format #t "~1Tmech-jump-height-min: (meters ~m)~%" (-> obj mech-jump-height-min)) + (format #t "~1Tmech-jump-height-max: (meters ~m)~%" (-> obj mech-jump-height-max)) + (format #t "~1Tmech-carry-jump-height-min: (meters ~m)~%" (-> obj mech-carry-jump-height-min)) + (format #t "~1Tmech-carry-jump-height-max: (meters ~m)~%" (-> obj mech-carry-jump-height-max)) + (format #t "~1Tindax-jump-height-min: (meters ~m)~%" (-> obj indax-jump-height-min)) + (format #t "~1Tindax-jump-height-max: (meters ~m)~%" (-> obj indax-jump-height-max)) + (format #t "~1Tindax-double-jump-height-min: (meters ~m)~%" (-> obj indax-double-jump-height-min)) + (format #t "~1Tindax-double-jump-height-max: (meters ~m)~%" (-> obj indax-double-jump-height-max)) + (format #t "~1Troll-duration: ~D~%" (-> obj roll-duration)) + (format #t "~1Troll-jump-pre-window: ~D~%" (-> obj roll-jump-pre-window)) + (format #t "~1Troll-jump-post-window: ~D~%" (-> obj roll-jump-post-window)) + (format #t "~1Troll-timeout: ~D~%" (-> obj roll-timeout)) + (format #t "~1Troll-speed-min: (meters ~m)~%" (-> obj roll-speed-min)) + (format #t "~1Troll-speed-inc: (meters ~m)~%" (-> obj roll-speed-inc)) + (format #t "~1Troll-flip-duration: ~D~%" (-> obj roll-flip-duration)) + (format #t "~1Troll-flip-height: (meters ~m)~%" (-> obj roll-flip-height)) + (format #t "~1Troll-flip-dist: (meters ~m)~%" (-> obj roll-flip-dist)) + (format #t "~1Troll-flip-art-height: (meters ~m)~%" (-> obj roll-flip-art-height)) + (format #t "~1Troll-flip-art-dist: (meters ~m)~%" (-> obj roll-flip-art-dist)) + (format #t "~1Tduck-slide-distance: (meters ~m)~%" (-> obj duck-slide-distance)) + (format #t "~1Tfall-far: (meters ~m)~%" (-> obj fall-far)) + (format #t "~1Tfall-far-inc: (meters ~m)~%" (-> obj fall-far-inc)) + (format #t "~1Tattack-timeout: ~D~%" (-> obj attack-timeout)) + (format #t "~1Tground-timeout: ~D~%" (-> obj ground-timeout)) + (format #t "~1Tslide-down-timeout: ~D~%" (-> obj slide-down-timeout)) + (format #t "~1Tfall-timeout: ~D~%" (-> obj fall-timeout)) + (format #t "~1Tfall-stumble-threshold: (meters ~m)~%" (-> obj fall-stumble-threshold)) + (format #t "~1Tyellow-projectile-speed: (meters ~m)~%" (-> obj yellow-projectile-speed)) + (format #t "~1Thit-invulnerable-timeout: ~D~%" (-> obj hit-invulnerable-timeout)) + (format #t "~1Tsame-attack-invulnerable-timeout: ~D~%" (-> obj same-attack-invulnerable-timeout)) + (format #t "~1Trun-cycle-length: ~f~%" (-> obj run-cycle-length)) + (format #t "~1Twalk-cycle-dist: (meters ~m)~%" (-> obj walk-cycle-dist)) + (format #t "~1Twalk-up-cycle-dist: (meters ~m)~%" (-> obj walk-up-cycle-dist)) + (format #t "~1Twalk-down-cycle-dist: (meters ~m)~%" (-> obj walk-down-cycle-dist)) + (format #t "~1Twalk-side-cycle-dist: (meters ~m)~%" (-> obj walk-side-cycle-dist)) + (format #t "~1Trun-cycle-dist: (meters ~m)~%" (-> obj run-cycle-dist)) + (format #t "~1Trun-up-cycle-dist: (meters ~m)~%" (-> obj run-up-cycle-dist)) + (format #t "~1Trun-down-cycle-dist: (meters ~m)~%" (-> obj run-down-cycle-dist)) + (format #t "~1Trun-side-cycle-dist: (meters ~m)~%" (-> obj run-side-cycle-dist)) + (format #t "~1Trun-wall-cycle-dist: (meters ~m)~%" (-> obj run-wall-cycle-dist)) + (format #t "~1Tduck-walk-cycle-dist: (meters ~m)~%" (-> obj duck-walk-cycle-dist)) + (format #t "~1Twade-shallow-walk-cycle-dist: (meters ~m)~%" (-> obj wade-shallow-walk-cycle-dist)) + (format #t "~1Twade-deep-walk-cycle-dist: (meters ~m)~%" (-> obj wade-deep-walk-cycle-dist)) + (format #t "~1Tmech-walk-cycle-dist: (meters ~m)~%" (-> obj mech-walk-cycle-dist)) + (format #t "~1Tmech-run-cycle-dist: (meters ~m)~%" (-> obj mech-run-cycle-dist)) + (format #t "~1Tsmack-surface-dist: (meters ~m)~%" (-> obj smack-surface-dist)) + (format #t "~1Tsmack-surface-height: (meters ~m)~%" (-> obj smack-surface-height)) + (format #t "~1Tmin-dive-depth: (meters ~m)~%" (-> obj min-dive-depth)) + (format #t "~1Troot-radius: (meters ~m)~%" (-> obj root-radius)) + (format #t "~1Troot-offset: ~`vector`P~%" (-> obj root-offset)) + (format #t "~1Tbody-radius: (meters ~m)~%" (-> obj body-radius)) + (format #t "~1Tedge-radius: (meters ~m)~%" (-> obj edge-radius)) + (format #t "~1Tedge-offset: ~`vector`P~%" (-> obj edge-offset)) + (format #t "~1Tedge-grab-height-off-ground: (meters ~m)~%" (-> obj edge-grab-height-off-ground)) + (format #t "~1Thead-radius: (meters ~m)~%" (-> obj head-radius)) + (format #t "~1Thead-height: (meters ~m)~%" (-> obj head-height)) + (format #t "~1Thead-offset: ~`vector`P~%" (-> obj head-offset)) + (format #t "~1Tspin-radius: (meters ~m)~%" (-> obj spin-radius)) + (format #t "~1Tspin-offset: ~`vector`P~%" (-> obj spin-offset)) + (format #t "~1Tduck-spin-radius: (meters ~m)~%" (-> obj duck-spin-radius)) + (format #t "~1Tduck-spin-offset: ~`vector`P~%" (-> obj duck-spin-offset)) + (format #t "~1Tpunch-radius: (meters ~m)~%" (-> obj punch-radius)) + (format #t "~1Tpunch-offset: ~`vector`P~%" (-> obj punch-offset)) + (format #t "~1Tuppercut-radius: (meters ~m)~%" (-> obj uppercut-radius)) + (format #t "~1Tuppercut0-offset: ~`vector`P~%" (-> obj uppercut0-offset)) + (format #t "~1Tuppercut1-offset: ~`vector`P~%" (-> obj uppercut1-offset)) + (format #t "~1Tflop-radius: (meters ~m)~%" (-> obj flop-radius)) + (format #t "~1Tflop0-offset: ~`vector`P~%" (-> obj flop0-offset)) + (format #t "~1Tflop1-offset: ~`vector`P~%" (-> obj flop1-offset)) + (format #t "~1Tstuck-time: (seconds ~e)~%" (-> obj stuck-time)) + (format #t "~1Tstuck-timeout: (seconds ~e)~%" (-> obj stuck-timeout)) + (format #t "~1Tstuck-distance: (meters ~m)~%" (-> obj stuck-distance)) + (format #t "~1Ttongue-pull-speed-min: ~f~%" (-> obj tongue-pull-speed-min)) + (format #t "~1Ttongue-pull-speed-max: ~f~%" (-> obj tongue-pull-speed-max)) + (format #t "~1Tyellow-attack-timeout: ~D~%" (-> obj yellow-attack-timeout)) + (format #t "~1Tfall-height: (meters ~m)~%" (-> obj fall-height)) + (format #t "~1Tmech-jump-thrust-fuel: ~f~%" (-> obj mech-jump-thrust-fuel)) + (format #t "~1Tstrafe-jump-pre-window: ~D~%" (-> obj strafe-jump-pre-window)) + (format #t "~1Tstrafe-jump: ~A~%" (-> obj strafe-jump)) + (format #t "~1Tstrafe-duck-jump: ~A~%" (-> obj strafe-duck-jump)) + (format #t "~1Tdark-jump-height-min: (meters ~m)~%" (-> obj dark-jump-height-min)) + (format #t "~1Tdark-jump-height-max: (meters ~m)~%" (-> obj dark-jump-height-max)) + (label cfg-4) + obj + ) + +;; definition for symbol *TARGET-bank*, type target-bank +(define *TARGET-bank* (new 'static 'target-bank + :jump-collide-offset (meters 0.7) + :jump-height-min (meters 1.01) + :jump-height-max (meters 3.5) + :double-jump-height-min (meters 1) + :double-jump-height-max (meters 2.5) + :flip-jump-height-min (meters 5) + :flip-jump-height-max (meters 7) + :duck-jump-height-min (meters 7) + :duck-jump-height-max (meters 7) + :flop-jump-height-min (meters 5) + :flop-jump-height-max (meters 7) + :attack-jump-height-min (meters 5) + :attack-jump-height-max (meters 6.5) + :edge-grab-jump-height-min (meters 1.7) + :edge-grab-jump-height-max (meters 1.7) + :swim-jump-height-min (meters 5) + :swim-jump-height-max (meters 5) + :tube-jump-height-min (meters 1.75) + :tube-jump-height-max (meters 2.5) + :carry-jump-height-min (meters 1.75) + :carry-jump-height-max (meters 2) + :mech-jump-height-min (meters 1.5) + :mech-jump-height-max (meters 1.5) + :mech-carry-jump-height-min (meters 2.5) + :mech-carry-jump-height-max (meters 3) + :indax-jump-height-min (meters 1.01) + :indax-jump-height-max (meters 3.5) + :indax-double-jump-height-min (meters 1) + :indax-double-jump-height-max (meters 2.5) + :roll-duration #x96 + :roll-jump-pre-window #x12c + :roll-jump-post-window #x1e + :roll-speed-min (meters 11.5) + :roll-speed-inc (meters 1.5) + :roll-flip-duration #xd2 + :roll-flip-height (meters 3.52) + :roll-flip-dist (meters 17.3) + :roll-flip-art-height (meters 3.2969) + :roll-flip-art-dist (meters 12.5) + :duck-slide-distance (meters 5.75) + :fall-far (meters 30) + :fall-far-inc (meters 20) + :attack-timeout #x5a + :ground-timeout #x3c + :slide-down-timeout #x3c + :fall-timeout #x12c + :fall-stumble-threshold (meters 39.9) + :yellow-projectile-speed (meters 60) + :hit-invulnerable-timeout #x12c + :same-attack-invulnerable-timeout #x258 + :run-cycle-length 60.0 + :walk-cycle-dist (meters 2.8) + :walk-up-cycle-dist (meters 2.8) + :walk-down-cycle-dist (meters 2.8) + :walk-side-cycle-dist (meters 2.8) + :run-cycle-dist (meters 6.25) + :run-up-cycle-dist (meters 5) + :run-down-cycle-dist (meters 5) + :run-side-cycle-dist (meters 6.25) + :run-wall-cycle-dist (meters 2.8) + :duck-walk-cycle-dist (meters 3.25) + :wade-shallow-walk-cycle-dist (meters 6) + :wade-deep-walk-cycle-dist (meters 6) + :mech-walk-cycle-dist (meters 4) + :mech-run-cycle-dist (meters 8) + :smack-surface-dist (meters 1.25) + :min-dive-depth (meters 2) + :root-radius (meters 2.2) + :root-offset (new 'static 'vector :y 4915.2 :w 1.0) + :body-radius (meters 0.7) + :edge-radius (meters 0.35) + :edge-offset (new 'static 'vector :y 4915.2 :z 4096.0 :w 1.0) + :edge-grab-height-off-ground (meters 2.3) + :head-radius (meters 0.7) + :head-height (meters 1.4) + :head-offset (new 'static 'vector :y 4915.2 :w 1.0) + :spin-radius (meters 2.2) + :spin-offset (new 'static 'vector :y 6553.6 :w 1.0) + :duck-spin-radius (meters 1.2) + :duck-spin-offset (new 'static 'vector :y 4096.0 :w 1.0) + :punch-radius (meters 1.3) + :punch-offset (new 'static 'vector :y 5324.8 :w 1.0) + :uppercut-radius (meters 1) + :uppercut0-offset (new 'static 'vector :y 3276.8 :w 1.0) + :uppercut1-offset (new 'static 'vector :y 9011.2 :w 1.0) + :flop-radius (meters 1.4) + :flop0-offset (new 'static 'vector :y 3276.8 :w 1.0) + :flop1-offset (new 'static 'vector :y 9011.2 :w 1.0) + :stuck-time (seconds 0.3) + :stuck-timeout (seconds 2) + :stuck-distance (meters 0.05) + :tongue-pull-speed-min 0.15 + :tongue-pull-speed-max 0.22 + :yellow-attack-timeout #x3c + :fall-height (meters 1) + :mech-jump-thrust-fuel 900.0 + :strafe-jump-pre-window #x96 + :strafe-jump #f + :strafe-duck-jump #f + :dark-jump-height-min (meters 20.5) + :dark-jump-height-max (meters 20.5) + ) + ) + +;; definition for function target-start-attack +;; WARN: Return type mismatch int vs none. +(defbehavior target-start-attack target () + (let* ((v1-0 *game-info*) + (a0-1 (+ (-> v1-0 attack-id) 1)) + ) + (set! (-> v1-0 attack-id) a0-1) + (set! (-> self control unknown-symbol05) (the-as symbol a0-1)) + ) + (set! (-> self control unknown-dword05) (the-as uint 0)) + (set! (-> self control unknown-float40) 0.0) + (+! (-> self anim-seed) 1) + 0 + (none) + ) + +;; definition for function target-danger-set! +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior target-danger-set! target ((arg0 symbol) (arg1 symbol)) + (let ((s4-0 (-> self control unknown-sphere-array00 6)) + (s5-0 (-> self control unknown-sphere-array00 7)) + (gp-0 (-> self control unknown-sphere-array00 8)) + ) + (let* ((s2-0 (-> self control unknown-sphere-array00 9)) + (v1-4 arg1) + (f30-0 (if (or (= v1-4 'cone) (= v1-4 'eco-red)) + 2.0 + 1.0 + ) + ) + ) + (if (and (logtest? (focus-status dark) (-> self focus-status)) + (and (nonzero? (-> self darkjak)) (logtest? (-> self darkjak stage) 32)) + ) + (set! f30-0 1.0) + ) + (set! (-> self control penetrate-using) (penetrate touch)) + (set! (-> self control penetrated-by) (penetrate lunge)) + (sphere<-vector+r! + (the-as sphere (-> self control root-prim local-sphere)) + (-> *TARGET-bank* root-offset) + (-> *TARGET-bank* root-radius) + ) + (set! (-> self control unknown-symbol04) arg0) + (logclear! (-> self focus-status) (focus-status dangerous)) + (set! (-> s4-0 transform-index) -2) + (set! (-> s4-0 prim-core collide-as) (collide-spec)) + (set! (-> s4-0 prim-core collide-with) (collide-spec)) + (set! (-> s4-0 local-sphere w) 0.0) + (set! (-> s5-0 transform-index) -2) + (set! (-> s5-0 prim-core collide-as) (collide-spec)) + (set! (-> s5-0 prim-core collide-with) (collide-spec)) + (set! (-> s5-0 local-sphere w) 0.0) + (set! (-> gp-0 transform-index) -2) + (set! (-> gp-0 prim-core collide-as) (collide-spec)) + (set! (-> gp-0 prim-core collide-with) (collide-spec)) + (set! (-> gp-0 local-sphere w) 0.0) + (set! (-> s2-0 transform-index) -2) + (set! (-> s2-0 prim-core collide-as) (collide-spec)) + (set! (-> s2-0 prim-core collide-with) (collide-spec)) + (set! (-> s2-0 local-sphere w) 0.0) + (case arg0 + (('harmless #f) + (set! (-> self control unknown-symbol04) #f) + (target-collide-set! (-> self control unknown-symbol00) (-> self control unknown-float000)) + ) + (('carry?) + (set! (-> s4-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s4-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> s4-0 local-sphere)) + (-> *TARGET-bank* spin-offset) + (+ 8192.0 (-> *TARGET-bank* spin-radius)) + ) + (set! (-> self control root-prim local-sphere quad) (-> s4-0 local-sphere quad)) + ) + (('spin 'spin-air) + (sphere<-vector+r! + (the-as sphere (-> self control root-prim local-sphere)) + (new 'static 'vector :y 6553.6 :w 1.0) + 9830.4 + ) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> s4-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s4-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> s4-0 local-sphere)) + (-> *TARGET-bank* spin-offset) + (-> *TARGET-bank* spin-radius) + ) + (set! (-> self control penetrate-using) (penetrate touch spin)) + ) + (('board-spin) + (sphere<-vector+r! + (the-as sphere (-> self control root-prim local-sphere)) + (new 'static 'vector :y 6553.6 :w 1.0) + 9830.4 + ) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> s4-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s4-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! (the-as sphere (-> s4-0 local-sphere)) (-> *TARGET-bank* spin-offset) 6963.2) + (set! (-> self control penetrate-using) (penetrate touch spin board)) + ) + (('duck-spin) + (sphere<-vector+r! + (the-as sphere (-> self control root-prim local-sphere)) + (new 'static 'vector :y 6553.6 :w 1.0) + 10649.6 + ) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> s4-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s4-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> s4-0 local-sphere)) + (-> *TARGET-bank* duck-spin-offset) + (-> *TARGET-bank* duck-spin-radius) + ) + (set! (-> s5-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s5-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! (the-as sphere (-> s5-0 local-sphere)) *null-vector* (-> *TARGET-bank* duck-spin-radius)) + (set! (-> s5-0 transform-index) 35) + (set! (-> self control penetrate-using) (penetrate touch spin)) + ) + (('duck-slide) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> s4-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s4-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> s4-0 local-sphere)) + (-> *TARGET-bank* duck-spin-offset) + (-> *TARGET-bank* duck-spin-radius) + ) + (set! (-> s5-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s5-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! (the-as sphere (-> s5-0 local-sphere)) *null-vector* (-> *TARGET-bank* duck-spin-radius)) + (set! (-> s5-0 transform-index) 28) + (set! (-> self control penetrate-using) (penetrate touch punch)) + ) + (('roll-solid) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> s4-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s4-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> s4-0 local-sphere)) + (-> *TARGET-bank* duck-spin-offset) + (+ 819.2 (-> *TARGET-bank* duck-spin-radius)) + ) + (set! (-> s5-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s5-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! (the-as sphere (-> s5-0 local-sphere)) *null-vector* (-> *TARGET-bank* duck-spin-radius)) + (set! (-> s5-0 transform-index) 8) + (set! (-> self control unknown-symbol04) 'roll) + (set! (-> self control penetrate-using) (penetrate touch roll)) + ) + (('flip) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> s4-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s4-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> s4-0 local-sphere)) + (-> *TARGET-bank* duck-spin-offset) + (+ 819.2 (-> *TARGET-bank* duck-spin-radius)) + ) + (set! (-> s5-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s5-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! (the-as sphere (-> s5-0 local-sphere)) *null-vector* (-> *TARGET-bank* duck-spin-radius)) + (set! (-> s5-0 transform-index) 8) + (set! (-> self control unknown-symbol04) 'flip) + (set! (-> self control penetrate-using) (penetrate touch roll)) + ) + (('punch) + (sphere<-vector+r! + (the-as sphere (-> self control root-prim local-sphere)) + (new 'static 'vector :y 6553.6 :w 1.0) + 11878.4 + ) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> s4-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s4-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> s4-0 local-sphere)) + (-> *TARGET-bank* punch-offset) + (-> *TARGET-bank* punch-radius) + ) + (when (not (logtest? (focus-status indax) (-> self focus-status))) + (set! (-> s5-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s5-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! (the-as sphere (-> s5-0 local-sphere)) *null-vector* (-> *TARGET-bank* punch-radius)) + (set! (-> s5-0 transform-index) 21) + ) + (set! (-> self control penetrate-using) (penetrate touch punch)) + (if (and (logtest? (focus-status dark) (-> self focus-status)) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) 2) + ) + (set! (-> self control penetrate-using) (logior (penetrate dark-punch) (-> self control penetrate-using))) + ) + ) + (('uppercut) + (sphere<-vector+r! + (the-as sphere (-> self control root-prim local-sphere)) + (new 'static 'vector :y 6553.6 :w 1.0) + 11878.4 + ) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> s4-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s4-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> s4-0 local-sphere)) + (-> *TARGET-bank* uppercut0-offset) + (-> *TARGET-bank* uppercut-radius) + ) + (set! (-> s5-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s5-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! (the-as sphere (-> s5-0 local-sphere)) *null-vector* (-> *TARGET-bank* uppercut-radius)) + (set! (-> s5-0 transform-index) 21) + (set! (-> gp-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> gp-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> gp-0 local-sphere)) + (-> *TARGET-bank* uppercut1-offset) + (-> *TARGET-bank* uppercut-radius) + ) + (set! (-> self control penetrate-using) (penetrate touch uppercut)) + ) + (('flop) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> s4-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s4-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> s4-0 local-sphere)) + (-> *TARGET-bank* flop0-offset) + (-> *TARGET-bank* flop-radius) + ) + (set! f30-0 1.0) + (set! (-> self control unknown-symbol04) 'flop) + (set! (-> self control penetrate-using) (penetrate touch flop)) + ) + (('flop-down) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> s4-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s4-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> s4-0 local-sphere)) + (-> *TARGET-bank* flop0-offset) + (-> *TARGET-bank* flop-radius) + ) + (set! (-> s5-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s5-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> s5-0 local-sphere)) + (-> *TARGET-bank* flop1-offset) + (-> *TARGET-bank* flop-radius) + ) + (if (!= f30-0 1.0) + (set! f30-0 2.1) + ) + (set! (-> self control unknown-symbol04) 'flop) + (set! (-> self control penetrate-using) (penetrate touch flop)) + ) + (('flut-attack) + (sphere<-vector+r! + (the-as sphere (-> self control root-prim local-sphere)) + (new 'static 'vector :y 6553.6 :w 1.0) + 12288.0 + ) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> s4-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s4-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> s4-0 local-sphere)) + (-> *TARGET-bank* spin-offset) + (+ 2048.0 (-> *TARGET-bank* punch-radius)) + ) + (set! (-> s5-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s5-0 prim-core collide-with) (the-as collide-spec (-> self control unknown-word10))) + (sphere<-vector+r! + (the-as sphere (-> s5-0 local-sphere)) + *null-vector* + (+ 1228.8 (-> *TARGET-bank* punch-radius)) + ) + (set! (-> s5-0 transform-index) 8) + (set! (-> self control penetrate-using) (penetrate touch flut-attack)) + ) + (('mech-punch) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> self control penetrate-using) (penetrate touch mech)) + ) + (('bomb) + (let* ((f0-32 (-> self control unknown-float40)) + (f28-0 (lerp-scale (-> *TARGET-bank* root-radius) 122880.0 f0-32 0.0 1.0)) + ) + (sphere<-vector+r! + (the-as sphere (-> self control root-prim local-sphere)) + (-> *TARGET-bank* root-offset) + f28-0 + ) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> s4-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s4-0 prim-core collide-with) (the-as collide-spec (logand -4097 (-> self control unknown-word10)))) + (sphere<-vector+r! (the-as sphere (-> s4-0 local-sphere)) (-> *TARGET-bank* root-offset) f28-0) + ) + (set! (-> self control penetrate-using) (penetrate touch dark-bomb)) + ) + (else + (format 0 "ERROR: ~A unknown danger mode ~A" self arg0) + ) + ) + (when (= arg1 'cone) + (let ((f28-1 16384.0)) + (sphere<-vector+r! + (the-as sphere (-> self control root-prim local-sphere)) + (-> *TARGET-bank* root-offset) + (+ (-> *TARGET-bank* root-radius) (* 2.0 f28-1)) + ) + (logior! (-> self focus-status) (focus-status dangerous)) + (set! (-> s2-0 prim-core collide-as) (the-as collide-spec (-> self control unknown-sphere000))) + (set! (-> s2-0 prim-core collide-with) (the-as collide-spec (logand -4097 (-> self control unknown-word10)))) + (set! (-> s2-0 transform-index) 0) + (sphere<-vector+r! + (the-as sphere (-> s2-0 local-sphere)) + (new 'static 'vector :y 12288.0 :z 16384.0 :w 1.0) + f28-1 + ) + ) + (set! (-> self control penetrate-using) (penetrate touch dark-bomb)) + ) + (when (and (!= f30-0 1.0) (not (or (= arg0 'harmless) (= arg0 #f)))) + (set! (-> self control root-prim local-sphere w) (* (-> self control root-prim local-sphere w) f30-0)) + (set! (-> s4-0 local-sphere w) (* (-> s4-0 local-sphere w) f30-0)) + (set! (-> s5-0 local-sphere w) (* (-> s5-0 local-sphere w) f30-0)) + (set! (-> gp-0 local-sphere w) (* (-> gp-0 local-sphere w) f30-0)) + ) + ) + (when (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (set! (-> self control penetrate-using) (logior (penetrate dark-skin) (-> self control penetrate-using))) + (when (and (logtest? (focus-status dark) (-> self focus-status)) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) 32) + ) + (set! (-> self control penetrate-using) (logior (penetrate dark-giant) (-> self control penetrate-using))) + (let ((f0-46 (lerp-scale 1.0 (-> self darkjak-giant-interp) (-> self darkjak-interp) 0.0 1.0))) + (set! (-> self control root-prim local-sphere w) (* (-> self control root-prim local-sphere w) f0-46)) + (set! (-> self control root-prim local-sphere y) (* (-> self control root-prim local-sphere y) f0-46)) + (set! (-> s4-0 local-sphere w) (* (-> s4-0 local-sphere w) f0-46)) + (set! (-> s4-0 local-sphere y) (* (-> s4-0 local-sphere y) f0-46)) + (set! (-> s5-0 local-sphere w) (* (-> s5-0 local-sphere w) f0-46)) + (set! (-> s5-0 local-sphere y) (* (-> s5-0 local-sphere y) f0-46)) + (set! (-> gp-0 local-sphere w) (* (-> gp-0 local-sphere w) f0-46)) + (set! (-> gp-0 local-sphere y) (* (-> gp-0 local-sphere y) f0-46)) + ) + ) + ) + ) + (case (-> (the-as fact-info-target (-> self fact)) eco-type) + ((1) + (set! (-> self control penetrate-using) (logior (penetrate eco-yellow) (-> self control penetrate-using))) + ) + ((2) + (set! (-> self control penetrate-using) (logior (penetrate eco-red) (-> self control penetrate-using))) + ) + ((3) + (set! (-> self control penetrate-using) (logior (penetrate eco-blue) (-> self control penetrate-using))) + ) + ((5) + (set! (-> self control penetrate-using) + (the-as penetrate (logior (penetrate eco-green) (-> self control penetrate-using))) + ) + ) + ) + (none) + ) + +;; definition for function target-collide-set! +(defbehavior target-collide-set! target ((arg0 symbol) (arg1 float)) + (let ((gp-0 (-> self control))) + (if (and (= arg0 'normal) + (enabled-gun? self) + (zero? (logand (-> self control unknown-surface01 flags) (surface-flag duck))) + ) + (set! arg0 'gun) + ) + (set! (-> self control unknown-symbol00) arg0) + (set! (-> self control unknown-float000) arg1) + (logclear! (-> self control penetrate-using) (penetrate tube vehicle board mech)) + (set! (-> self control penetrated-by) (penetrate lunge)) + (dotimes (v1-10 4) + (set! (-> gp-0 unknown-sphere-array00 v1-10 transform-index) -2) + ) + (set! (-> gp-0 unknown-sphere-array00 3 prim-core collide-as) (collide-spec)) + (set! (-> gp-0 unknown-sphere-array00 3 prim-core collide-with) (collide-spec)) + (set! (-> gp-0 unknown-sphere-array00 4 prim-core collide-as) (collide-spec jak)) + (set! (-> gp-0 unknown-sphere-array00 4 prim-core collide-with) (collide-spec + backgnd + bot + crate + civilian + enemy + obstacle + hit-by-player-list + hit-by-others-list + player-list + water + collectable + blocking-plane + tobot + pusher + vehicle-mesh + obstacle-for-jak + ) + ) + (cond + ((= arg0 'pole) + (set-vector! (-> gp-0 unknown-sphere-array00 0 local-sphere) 0.0 0.0 0.0 (-> *TARGET-bank* body-radius)) + (set-vector! (-> gp-0 unknown-sphere-array00 1 local-sphere) 0.0 0.0 0.0 (-> *TARGET-bank* body-radius)) + (set-vector! (-> gp-0 unknown-sphere-array00 2 local-sphere) 0.0 0.0 0.0 (-> *TARGET-bank* body-radius)) + (set! (-> gp-0 unknown-sphere-array00 0 transform-index) 28) + (set! (-> gp-0 unknown-sphere-array00 1 transform-index) 26) + (set! (-> gp-0 unknown-sphere-array00 2 transform-index) 8) + ) + ((= arg0 'board) + (logior! (-> self control penetrate-using) (penetrate touch board)) + ) + ((= arg0 'racer) + (set! (-> gp-0 unknown-vector04 y) 4096.0) + (sphere<-vector+r! + (the-as sphere (-> gp-0 root-prim local-sphere)) + (new 'static 'vector :y 8192.0 :w 1.0) + 16384.0 + ) + (set-vector! (-> gp-0 unknown-sphere-array00 0 local-sphere) 0.0 6553.6 0.0 6553.6) + (set-vector! (-> gp-0 unknown-sphere-array00 1 local-sphere) 0.0 9420.8 0.0 6553.6) + (set-vector! (-> gp-0 unknown-sphere-array00 2 local-sphere) 0.0 12288.0 0.0 6553.6) + (logior! (-> self control penetrate-using) (penetrate touch vehicle)) + ) + ((= arg0 'flut) + (sphere<-vector+r! + (the-as sphere (-> gp-0 root-prim local-sphere)) + (new 'static 'vector :y 8192.0 :w 1.0) + 12288.0 + ) + (set-vector! (-> gp-0 unknown-sphere-array00 0 local-sphere) 0.0 4915.2 0.0 4915.2) + (set-vector! (-> gp-0 unknown-sphere-array00 1 local-sphere) 0.0 7782.4004 0.0 4915.2) + (set-vector! (-> gp-0 unknown-sphere-array00 2 local-sphere) 0.0 10649.6 0.0 4915.2) + ) + ((= arg0 'mech) + (sphere<-vector+r! + (the-as sphere (-> gp-0 root-prim local-sphere)) + (new 'static 'vector :y 8192.0 :w 1.0) + 16384.0 + ) + (set-vector! (-> gp-0 unknown-sphere-array00 0 local-sphere) 0.0 4096.0 0.0 4096.0) + (set-vector! (-> gp-0 unknown-sphere-array00 1 local-sphere) 0.0 8601.6 0.0 6553.6) + (set-vector! (-> gp-0 unknown-sphere-array00 2 local-sphere) 0.0 14745.6 0.0 9420.8) + (logior! (-> self control penetrate-using) (penetrate touch mech)) + ) + ((= arg0 'mech-carry) + (set! (-> gp-0 unknown-vector04 y) 0.0) + (sphere<-vector+r! + (the-as sphere (-> gp-0 root-prim local-sphere)) + (new 'static 'vector :y 12288.0 :w 1.0) + 20480.0 + ) + (set-vector! (-> gp-0 unknown-sphere-array00 0 local-sphere) 0.0 4096.0 0.0 4096.0) + (set-vector! (-> gp-0 unknown-sphere-array00 1 local-sphere) 0.0 8601.6 0.0 6553.6) + (set-vector! + (-> gp-0 unknown-sphere-array00 2 local-sphere) + 0.0 + (+ 5734.4 (lerp-scale 9011.2 12288.0 arg1 0.0 1.0)) + 0.0 + (lerp-scale 9420.8 12697.6 arg1 0.0 1.0) + ) + ) + ((= arg0 'duck) + (set! (-> self control unknown-float31) arg1) + (let ((f30-1 (- 1.0 arg1))) + (set! (-> gp-0 unknown-vector04 y) 0.0) + (sphere<-vector+r! + (the-as sphere (-> gp-0 root-prim local-sphere)) + (-> *TARGET-bank* root-offset) + (-> *TARGET-bank* root-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 0 local-sphere) + 0.0 + (-> *TARGET-bank* body-radius) + (* 0.0 f30-1) + (-> *TARGET-bank* body-radius) + ) + (if (using-gun? self) + (set-vector! + (-> gp-0 unknown-sphere-array00 1 local-sphere) + 0.0 + (+ 2867.2 (-> *TARGET-bank* body-radius)) + 0.0 + (-> *TARGET-bank* body-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 1 local-sphere) + 0.0 + (+ (-> *TARGET-bank* body-radius) (* 2867.2 f30-1)) + 0.0 + (-> *TARGET-bank* body-radius) + ) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 2 local-sphere) + 0.0 + (+ (-> *TARGET-bank* body-radius) (* 5734.4 f30-1)) + 0.0 + (-> *TARGET-bank* body-radius) + ) + ) + ) + ((= arg0 'indax) + (let ((f30-2 0.2)) + (set! (-> gp-0 unknown-vector04 y) 0.0) + (sphere<-vector+r! + (the-as sphere (-> gp-0 root-prim local-sphere)) + (-> *TARGET-bank* root-offset) + (-> *TARGET-bank* root-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 0 local-sphere) + 0.0 + (-> *TARGET-bank* body-radius) + (* 0.0 f30-2) + (-> *TARGET-bank* body-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 1 local-sphere) + 0.0 + (+ (-> *TARGET-bank* body-radius) (* 2867.2 f30-2)) + 0.0 + (-> *TARGET-bank* body-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 2 local-sphere) + 0.0 + (+ (-> *TARGET-bank* body-radius) (* 5734.4 f30-2)) + 0.0 + (-> *TARGET-bank* body-radius) + ) + ) + (set! (-> gp-0 unknown-sphere-array00 4 prim-core collide-as) (collide-spec)) + (set! (-> gp-0 unknown-sphere-array00 4 prim-core collide-with) (collide-spec)) + 0 + ) + ((= arg0 'tube) + (set! (-> self control unknown-float31) arg1) + (let ((f30-3 (- 1.0 arg1))) + (set! (-> gp-0 unknown-vector04 y) 0.0) + (sphere<-vector+r! + (the-as sphere (-> gp-0 root-prim local-sphere)) + (-> *TARGET-bank* root-offset) + (-> *TARGET-bank* root-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 0 local-sphere) + 0.0 + (-> *TARGET-bank* body-radius) + (* 0.0 f30-3) + (-> *TARGET-bank* body-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 1 local-sphere) + 0.0 + (+ (-> *TARGET-bank* body-radius) (* 2867.2 f30-3)) + 0.0 + (-> *TARGET-bank* body-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 2 local-sphere) + 0.0 + (+ (-> *TARGET-bank* body-radius) (* 5734.4 f30-3)) + 0.0 + (-> *TARGET-bank* body-radius) + ) + ) + (logior! (-> self control penetrate-using) (penetrate touch tube)) + ) + ((= arg0 'carry) + (set! (-> gp-0 unknown-vector04 y) 0.0) + (sphere<-vector+r! + (the-as sphere (-> gp-0 root-prim local-sphere)) + (-> *TARGET-bank* root-offset) + (-> *TARGET-bank* root-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 0 local-sphere) + 0.0 + (-> *TARGET-bank* body-radius) + 0.0 + (-> *TARGET-bank* body-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 1 local-sphere) + 0.0 + (+ 2867.2 (-> *TARGET-bank* body-radius)) + 0.0 + (-> *TARGET-bank* body-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 2 local-sphere) + 0.0 + (+ 5734.4 (-> *TARGET-bank* body-radius)) + 0.0 + (lerp-scale (-> *TARGET-bank* body-radius) 7372.8 arg1 0.0 1.0) + ) + ) + ((= arg0 'gun) + (set! (-> self control unknown-float31) arg1) + (set! (-> gp-0 unknown-vector04 y) 0.0) + (sphere<-vector+r! + (the-as sphere (-> gp-0 root-prim local-sphere)) + (-> *TARGET-bank* root-offset) + (-> *TARGET-bank* root-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 0 local-sphere) + 0.0 + (-> *TARGET-bank* body-radius) + 0.0 + (-> *TARGET-bank* body-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 1 local-sphere) + 0.0 + (+ 2867.2 (-> *TARGET-bank* body-radius)) + 0.0 + (-> *TARGET-bank* body-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 2 local-sphere) + 0.0 + (+ 5734.4 (-> *TARGET-bank* body-radius)) + 0.0 + (-> *TARGET-bank* body-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 3 local-sphere) + 0.0 + (+ 5734.4 (-> *TARGET-bank* body-radius)) + 0.0 + (lerp-scale (-> *TARGET-bank* body-radius) 4915.2 arg1 0.0 1.0) + ) + (set! (-> gp-0 unknown-sphere-array00 3 prim-core collide-with) (collide-spec + backgnd + bot + crate + obstacle + hit-by-player-list + hit-by-others-list + player-list + water + collectable + blocking-plane + tobot + pusher + vehicle-mesh + obstacle-for-jak + ) + ) + ) + (else + (set! (-> self control unknown-float31) 0.0) + (set! (-> gp-0 unknown-vector04 y) 0.0) + (sphere<-vector+r! + (the-as sphere (-> gp-0 root-prim local-sphere)) + (-> *TARGET-bank* root-offset) + (-> *TARGET-bank* root-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 0 local-sphere) + 0.0 + (-> *TARGET-bank* body-radius) + 0.0 + (-> *TARGET-bank* body-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 1 local-sphere) + 0.0 + (+ 2867.2 (-> *TARGET-bank* body-radius)) + 0.0 + (-> *TARGET-bank* body-radius) + ) + (set-vector! + (-> gp-0 unknown-sphere-array00 2 local-sphere) + 0.0 + (+ 5734.4 (-> *TARGET-bank* body-radius)) + 0.0 + (-> *TARGET-bank* body-radius) + ) + ) + ) + (when (and (logtest? (focus-status dark) (-> self focus-status)) + (and (nonzero? (-> self darkjak)) (logtest? (-> self darkjak stage) 32)) + ) + (let ((f0-183 (lerp-scale 1.0 (-> self darkjak-giant-interp) (-> self darkjak-interp) 0.0 1.0))) + (set! (-> gp-0 unknown-sphere-array00 0 local-sphere w) + (* 0.5 (+ 1.0 f0-183) (-> gp-0 unknown-sphere-array00 0 local-sphere w)) + ) + (set! (-> gp-0 unknown-sphere-array00 0 local-sphere y) + (* 0.5 (+ 1.0 f0-183) (-> gp-0 unknown-sphere-array00 0 local-sphere y)) + ) + (set! (-> gp-0 unknown-sphere-array00 1 local-sphere w) + (* (-> gp-0 unknown-sphere-array00 1 local-sphere w) f0-183) + ) + (set! (-> gp-0 unknown-sphere-array00 1 local-sphere y) + (* (-> gp-0 unknown-sphere-array00 1 local-sphere y) f0-183) + ) + (set! (-> gp-0 unknown-sphere-array00 2 local-sphere w) + (* (-> gp-0 unknown-sphere-array00 2 local-sphere w) f0-183) + ) + (set! (-> gp-0 unknown-sphere-array00 2 local-sphere y) + (* (-> gp-0 unknown-sphere-array00 2 local-sphere y) f0-183) + ) + ) + ) + ) + 0 + ) + +;; definition for method 27 of type control-info +(defmethod get-quaternion control-info ((obj control-info)) + (-> obj unknown-quaternion00) + ) + +;; definition for function debounce-speed +(defbehavior debounce-speed target ((arg0 float) (arg1 float) (arg2 vector) (arg3 vector)) + (if (and (< 0.3 arg0) (< arg0 0.7) (< 0.0 arg1) (< (vector-dot arg2 arg3) 0.2)) + (set! arg0 0.0) + ) + arg0 + ) + +;; definition for function target-align-vel-z-adjust +(defbehavior target-align-vel-z-adjust target ((arg0 float)) + (let ((f1-0 (-> self control unknown-float17))) + (* arg0 (if (< 0.0 f1-0) + (* (- 1.0 f1-0) (-> self control unknown-surface01 alignv)) + (-> self control unknown-surface01 alignv) + ) + ) + ) + ) + +;; definition for method 26 of type target +(defmethod process-focusable-method-26 target ((obj target)) + (if (or (and (logtest? (focus-status dark) (-> obj focus-status)) + (nonzero? (-> obj darkjak)) + (logtest? (-> obj darkjak stage) 32) + ) + (logtest? (focus-status mech) (-> obj focus-status)) + ) + 0.1 + 1.0 + ) + ) + +;; definition for method 16 of type target +;; INFO: Used lq/sq +;; WARN: Return type mismatch control-info vs object. +(defmethod apply-alignment target ((obj target) (arg0 align-opts) (arg1 transformq) (arg2 vector)) + (with-pp + (let ((s2-0 (new 'stack-no-clear 'vector))) + (set! (-> s2-0 quad) (-> arg2 quad)) + (set! (-> s2-0 z) (target-align-vel-z-adjust (-> s2-0 z))) + (when (logtest? arg0 (align-opts adjust-x-vel adjust-y-vel adjust-xz-vel)) + (let* ((s3-0 (-> obj control unknown-matrix01)) + (s0-0 (-> obj control unknown-matrix00)) + (s1-0 (vector-matrix*! (new 'stack-no-clear 'vector) (-> obj control dynam gravity) s0-0)) + (a1-3 (vector-matrix*! (new 'stack-no-clear 'vector) (-> obj control transv) s0-0)) + ) + (if (logtest? arg0 (align-opts no-gravity)) + (set-vector! s1-0 0.0 0.0 0.0 1.0) + ) + (when (logtest? arg0 (align-opts adjust-x-vel)) + (set! (-> a1-3 x) (+ (* (-> arg1 trans x) (-> s2-0 x) (-> pp clock frames-per-second)) + (* (-> s1-0 x) (-> pp clock seconds-per-frame)) + ) + ) + (if (not (logtest? arg0 (align-opts adjust-xz-vel keep-other-velocities))) + (set! (-> a1-3 z) 0.0) + ) + ) + (if (and (logtest? arg0 (align-opts adjust-y-vel)) + (not (and (logtest? arg0 (align-opts ignore-y-if-zero)) (= (-> arg1 trans y) 0.0))) + ) + (set! (-> a1-3 y) (+ (* (-> arg1 trans y) (-> s2-0 y) (-> pp clock frames-per-second)) + (* (-> s1-0 y) (-> pp clock seconds-per-frame)) + ) + ) + ) + (when (logtest? arg0 (align-opts adjust-xz-vel)) + (set! (-> a1-3 z) (+ (* (-> arg1 trans z) (-> s2-0 z) (-> pp clock frames-per-second)) + (* (-> s1-0 z) (-> pp clock seconds-per-frame)) + ) + ) + (if (not (logtest? arg0 (align-opts adjust-x-vel keep-other-velocities))) + (set! (-> a1-3 x) 0.0) + ) + ) + (vector-matrix*! (-> obj control transv) a1-3 s3-0) + ) + ) + ) + (if (logtest? arg0 (align-opts adjust-quat)) + (quaternion-normalize! + (quaternion*! (-> obj control unknown-quaternion00) (-> obj control unknown-quaternion00) (-> arg1 quat)) + ) + ) + (the-as object (-> obj control)) + ) + ) + +;; definition for function average-turn-angle +(defun average-turn-angle ((arg0 target)) + (let ((f30-0 0.0)) + (dotimes (s5-0 8) + (+! f30-0 + (fabs + (deg-diff + (atan (-> arg0 control unknown-vector-array01 s5-0 x) (-> arg0 control unknown-vector-array01 s5-0 z)) + 0.0 + ) + ) + ) + ) + (* 0.125 f30-0) + ) + ) + +;; definition for function can-play-stance-amibent? +(defbehavior can-play-stance-amibent? target () + (and (or (and (= *kernel-boot-message* 'kiosk) + (>= (+ -300000 (-> *display* real-clock frame-counter)) (seconds 60)) + (>= (- (-> *display* base-clock frame-counter) (-> self control unknown-cpad-info00 change-time)) + (seconds 60) + ) + (>= (- (-> *display* game-clock frame-counter) (the-as int (-> self game kiosk-timeout))) (seconds 60)) + ) + (and (>= (- (-> self clock frame-counter) (-> self ambient-time)) (seconds 30)) + (not (logtest? (-> self control status) (cshape-moving-flags t-act))) + (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (not (or (logtest? (water-flags touch-water) (-> self water flags)) + (logtest? (-> self control status) (cshape-moving-flags on-water)) + ) + ) + (zero? (logand (focus-status dead hit grabbed in-head edge-grab pole flut tube board mech dark indax teleporting) + (-> self focus-status) + ) + ) + ) + ) + (not (paused?)) + (not (movie?)) + (>= (- (-> *display* base-clock frame-counter) (-> self control unknown-cpad-info00 change-time)) + (seconds 30) + ) + (!= (-> self tobot?) 'tobot) + (not (-> *setting-control* user-current talking)) + (not (-> *setting-control* user-current spooling)) + (not (-> *setting-control* user-current movie)) + (not (-> *setting-control* user-current hint)) + (not (logtest? (-> self focus-status) (focus-status dead hit grabbed))) + (logtest? (-> self game features) (game-feature sidekick)) + (case *kernel-boot-message* + (('kiosk) + (set! (-> self control unknown-cpad-info00 change-time) (-> *display* base-clock frame-counter)) + (auto-save-command 'restore 0 0 *default-pool* #f) + #f + ) + (else + #t + ) + ) + ) + ) + +;; definition for function target-height-above-ground +(defbehavior target-height-above-ground target () + (- (-> self control trans y) (-> self control gspot-pos y)) + ) + +;; definition for function can-jump? +(defbehavior can-jump? target ((arg0 symbol)) + (and (or (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (< (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) + (the-as time-frame (-> *TARGET-bank* ground-timeout)) + ) + (and (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (< 0.866 (-> self control surface-angle)) + ) + (and (= arg0 'board) + (or (< (- (-> self clock frame-counter) (-> self board unknown-time-frame00)) (seconds 0.05)) + (and (< (- (-> self clock frame-counter) (-> self control unknown-time-frame14)) (seconds 0.5)) + (< (target-height-above-ground) 2048.0) + ) + ) + ) + ) + (and (not (logtest? (-> self control unknown-surface01 flags) (surface-flag no-jump))) + (not (logtest? (-> self state-flags) (state-flags sf7))) + (or (= arg0 'board) (!= (-> self control poly-pat event) 13)) + (if (= arg0 'target-roll-flip) + (>= 0.5 (-> self control unknown-float17)) + #t + ) + ) + ) + ) + +;; definition for function target-jump-go +;; WARN: Return type mismatch object vs none. +(defbehavior target-jump-go target () + (go target-jump (-> *TARGET-bank* jump-height-min) (-> *TARGET-bank* jump-height-max) (the-as surface #f)) + (none) + ) + +;; definition for function move-legs? +(defbehavior move-legs? target () + (!= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + ) + +;; definition for function jump-hit-ground-stuck? +(defbehavior jump-hit-ground-stuck? target () + (or (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (when (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) + (not (and *cheat-mode* (cpad-hold? (-> self control unknown-cpad-info00 number) r2))) + ) + (set! (-> self control unknown-time-frame14) (-> self clock frame-counter)) + #t + ) + ) + ) + +;; definition for function target-time-to-ground +;; WARN: Return type mismatch int vs time-frame. +(defbehavior target-time-to-ground target () + (let ((f0-0 (target-height-above-ground)) + (f2-0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (f1-1 0.0) + ) + (while (< 0.0 f0-0) + (set! f1-1 (+ 5.0 f1-1)) + (+! f0-0 (* f2-0 (-> self clock seconds-per-frame))) + (set! f2-0 (- f2-0 (* (-> self control dynam gravity-length) (-> self clock seconds-per-frame)))) + ) + (the time-frame f1-1) + ) + ) + +;; definition for function fall-test +;; WARN: Return type mismatch object vs none. +(defbehavior fall-test target ((arg0 (state symbol target)) (arg1 float)) + (when (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface))) + (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) + (the-as time-frame (-> *TARGET-bank* ground-timeout)) + ) + (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (>= (target-height-above-ground) arg1) + ) + (if (< (- (-> self clock frame-counter) (-> self control rider-time)) + (the-as time-frame (-> *TARGET-bank* ground-timeout)) + ) + (send-event self 'push-transv (-> self control rider-last-move) #x7530) + ) + (go arg0 #f) + ) + (none) + ) + +;; definition for function slide-down-test +;; WARN: Return type mismatch object vs none. +(defbehavior slide-down-test target () + (if (and (not (logtest? (-> self control status) (cshape-moving-flags on-surface csmf07))) + (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) + (the-as time-frame (-> *TARGET-bank* ground-timeout)) + ) + (logtest? (-> self control status) (cshape-moving-flags t-surface)) + (< 0.5 (-> self control surface-angle)) + ) + (go target-slide-down) + ) + (none) + ) + +;; definition for function smack-surface? +(defbehavior smack-surface? target ((arg0 symbol)) + (and (< 0.7 (-> self control touch-angle)) + (and (< (-> self control surface-angle) 0.3) + (logtest? (-> self control status) (cshape-moving-flags t-wall)) + (or arg0 (zero? (logand (-> self control status) (cshape-moving-flags t-act)))) + ) + ) + ) + +;; definition for function can-roll? +(defbehavior can-roll? target () + (and (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (or (not (logtest? (-> self control status) (cshape-moving-flags t-wall))) + (>= 0.7 (-> self control touch-angle)) + ) + (< (-> self control unknown-float17) 0.7) + (not (logtest? (-> self state-flags) (state-flags sf8 sf9))) + (not (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak)))) + (>= (- (-> self clock frame-counter) (the-as int (-> *TARGET-bank* roll-timeout))) + (-> self control unknown-time-frame10) + ) + (or (not (enabled-gun? self)) + (not (-> *TARGET-bank* strafe-duck-jump)) + (and (< 0.3 (vector-dot (-> self control unknown-vector08) (-> self control unknown-matrix01 vector 2))) + (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame28)) (seconds 0.3)) + ) + ) + (not (and (not (using-gun? self)) (!= (-> self skel top-anim interp) 0.0))) + ) + ) + +;; definition for function can-duck? +(defbehavior can-duck? target () + (and (logtest? (-> self control status) (cshape-moving-flags on-surface)) + (>= (-> self control unknown-float0000) 0.7) + (not (logtest? (water-flags under-water swimming) (-> self water flags))) + (not (logtest? (-> self state-flags) (state-flags sf9))) + (or (not (logtest? (water-flags wading) (-> self water flags))) + (< (- (- (-> self control trans y) (- (-> self water base-height) (-> self water wade-height)))) 2457.6) + ) + ) + ) + +;; definition for function can-exit-duck? +;; INFO: Used lq/sq +(defun can-exit-duck? ((arg0 target)) + (let ((gp-0 (new 'stack-no-clear 'collide-query))) + (let ((s4-0 (new 'stack-no-clear 'inline-array 'sphere 2))) + (dotimes (s3-0 2) + ((method-of-type sphere new) (the-as symbol (-> s4-0 s3-0)) sphere) + ) + (set! (-> s4-0 0 quad) (-> arg0 control trans quad)) + (set! (-> s4-0 0 y) (+ 5734.4 (-> *TARGET-bank* body-radius) (-> s4-0 0 y))) + (set! (-> s4-0 0 r) (-> *TARGET-bank* body-radius)) + (set! (-> s4-0 1 quad) (-> arg0 control trans quad)) + (set! (-> s4-0 1 y) (+ 2867.2 (-> *TARGET-bank* body-radius) (-> s4-0 1 y))) + (set! (-> s4-0 1 r) (-> *TARGET-bank* body-radius)) + (let ((v1-12 gp-0)) + (set! (-> v1-12 spheres) s4-0) + (set! (-> v1-12 num-spheres) (the-as uint 2)) + (set! (-> v1-12 collide-with) (logclear + (-> arg0 control root-prim prim-core collide-with) + (collide-spec civilian enemy vehicle-sphere projectile) + ) + ) + (set! (-> v1-12 ignore-process0) #f) + (set! (-> v1-12 ignore-process1) #f) + (set! (-> v1-12 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-12 best-my-prim) (the-as collide-shape-prim #t)) + (set! (-> v1-12 action-mask) (collide-action solid)) + ) + ) + (if (fill-and-probe-using-spheres *collide-cache* gp-0) + #f + #t + ) + ) + ) + +;; definition for function can-hands? +(defbehavior can-hands? target ((arg0 symbol)) + (cond + ((or (logtest? (-> self state-flags) (state-flags sf8)) + (logtest? (-> self control unknown-surface01 flags) (surface-flag no-attack no-hands)) + ) + #f + ) + ((and (or (not arg0) + (and (< (- (-> self clock frame-counter) (-> self control unknown-time-frame06)) + (the-as time-frame (-> *TARGET-bank* ground-timeout)) + ) + (< (-> self control unknown-float17) 0.7) + ) + ) + (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame11)) + (the-as time-frame (if (and (= (-> (the-as fact-info-target (-> self fact)) eco-type) 1) + (>= (-> (the-as fact-info-target (-> self fact)) eco-level) 1.0) + ) + (-> *TARGET-bank* yellow-attack-timeout) + (-> *TARGET-bank* attack-timeout) + ) + ) + ) + ) + #t + ) + (else + (set! (-> self control unknown-time-frame001) (-> self clock frame-counter)) + #f + ) + ) + ) + +;; definition for function can-feet? +(defbehavior can-feet? target ((arg0 symbol)) + (cond + ((or (logtest? (-> self state-flags) (state-flags sf8)) + (logtest? (-> self control unknown-surface01 flags) (surface-flag no-attack no-feet)) + ) + #f + ) + ((>= (- (-> self clock frame-counter) (-> self control unknown-time-frame12)) + (the-as time-frame (-> *TARGET-bank* attack-timeout)) + ) + #t + ) + (else + (set! (-> self control unknown-time-frame002) (-> self clock frame-counter)) + #f + ) + ) + ) + +;; definition for function are-still? +(defbehavior are-still? target () + (or (= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + (< (-> self control unknown-float05) 61440.0) + ) + ) + +;; definition for function vector-local+! +;; INFO: Used lq/sq +(defbehavior vector-local+! target ((arg0 vector) (arg1 vector)) + (let ((s5-0 (new-stack-vector0))) + (vector-matrix*! s5-0 arg1 (-> self control unknown-matrix01)) + (vector+! arg0 arg0 s5-0) + ) + ) + +;; definition for function move-forward +;; INFO: Used lq/sq +(defbehavior move-forward target ((arg0 float)) + (let ((a1-0 (new-stack-vector0)) + (gp-0 (new-stack-vector0)) + ) + (set-vector! a1-0 0.0 0.0 arg0 1.0) + (vector-matrix*! gp-0 a1-0 (-> self control unknown-matrix01)) + (vector+! (-> self control transv) (-> self control transv) gp-0) + ) + ) + +;; definition for function set-forward-vel +;; INFO: Used lq/sq +(defbehavior set-forward-vel target ((arg0 float)) + (let ((gp-0 (new-stack-vector0))) + (vector-matrix*! gp-0 (-> self control transv) (-> self control unknown-matrix00)) + (set! (-> gp-0 z) arg0) + (set! (-> gp-0 x) 0.0) + (vector-matrix*! (-> self control transv) gp-0 (-> self control unknown-matrix01)) + ) + ) + +;; definition for function delete-back-vel +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior delete-back-vel target () + (let ((gp-0 (new-stack-vector0))) + (vector-z-quaternion! gp-0 (-> self control dir-targ)) + (let ((v1-1 (new-stack-vector0)) + (f0-1 (vector-dot gp-0 (-> self control transv))) + ) + 0.0 + (vector-! v1-1 (-> self control transv) (vector-float*! v1-1 gp-0 f0-1)) + (let* ((f1-2 (vector-length v1-1)) + (f2-0 f1-2) + ) + (if (< f0-1 0.0) + (set! f0-1 0.0) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) gp-0 f0-1) + (vector-float*! v1-1 v1-1 (/ f1-2 f2-0)) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for function set-side-vel +;; INFO: Used lq/sq +(defbehavior set-side-vel target ((arg0 float)) + (let ((gp-0 (new-stack-vector0))) + (vector-matrix*! gp-0 (-> self control transv) (-> self control unknown-matrix00)) + (set! (-> gp-0 x) arg0) + (set! (-> gp-0 z) 0.0) + (vector-matrix*! (-> self control transv) gp-0 (-> self control unknown-matrix01)) + ) + ) + +;; definition for function target-timed-invulnerable +;; WARN: Return type mismatch int vs none. +(defun target-timed-invulnerable ((arg0 time-frame) (arg1 target) (arg2 int)) + (with-pp + (case arg2 + ((1) + (logior! (-> arg1 state-flags) (state-flags tinvul1)) + (set! (-> arg1 control unknown-time-frame22) (-> pp clock frame-counter)) + (set! (-> arg1 control unknown-time-frame23) arg0) + ) + ((2) + (set! (-> arg1 state-flags) (logior (state-flags tinvul2) (-> arg1 state-flags))) + (set! (-> arg1 control unknown-time-frame24) (-> pp clock frame-counter)) + (set! (-> arg1 control unknown-time-frame25) arg0) + ) + ) + (collide-shape-method-49 (-> arg1 control) 2 #x8000 0) + (logior! (-> arg1 focus-status) (focus-status ignore)) + 0 + (none) + ) + ) + +;; definition for function target-timed-invulnerable-off +;; WARN: Return type mismatch int vs none. +(defun target-timed-invulnerable-off ((arg0 target) (arg1 int)) + (let ((v1-0 arg1)) + (cond + ((zero? v1-0) + (logclear! (-> arg0 state-flags) (state-flags tinvul1 tinvul2)) + ) + ((= v1-0 1) + (logclear! (-> arg0 state-flags) (state-flags tinvul1)) + ) + ((= v1-0 2) + (logclear! (-> arg0 state-flags) (state-flags tinvul2)) + ) + ) + ) + (when (not (logtest? (state-flags tinvul1 tinvul2) (-> arg0 state-flags))) + (logclear! (-> arg0 draw status) (draw-control-status no-draw-bounds)) + (collide-shape-method-49 (-> arg0 control) 2 0 #x8000) + ) + 0 + (none) + ) + +;; definition for function target-log-attack +(defbehavior target-log-attack target ((arg0 attack-info) (arg1 symbol)) + (if (and (= arg1 'background) (= (-> arg0 id) 2)) + (return #t) + ) + (let ((a3-0 (the-as object (-> self attack-info-old)))) + (dotimes (a2-2 8) + (let ((v1-9 (-> self attack-info-old a2-2))) + (when (= (-> arg0 id) (-> v1-9 id)) + (if (< (- (-> self clock frame-counter) (-> v1-9 attack-time)) + (the-as time-frame (-> *TARGET-bank* same-attack-invulnerable-timeout)) + ) + (return #f) + ) + (cond + ((= arg1 'test) + ) + (else + (mem-copy! (the-as pointer v1-9) (the-as pointer arg0) 160) + ) + ) + (return #t) + ) + (if (< (-> v1-9 attack-time) (-> (the-as attack-info a3-0) attack-time)) + (set! a3-0 v1-9) + ) + ) + ) + (case arg1 + (('test) + ) + (else + (mem-copy! (the-as pointer a3-0) (the-as pointer arg0) 160) + ) + ) + ) + #t + ) + +;; definition for method 9 of type attack-info +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod attack-info-method-9 attack-info ((obj attack-info) (arg0 attack-info) (arg1 process-drawable) (arg2 process-drawable)) + (local-vars (v1-14 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((s5-0 (if (type? arg1 process-drawable) + arg1 + ) + ) + ) + (let ((v1-0 (if (type? arg2 process-drawable) + arg2 + ) + ) + ) + (cond + ((logtest? (attack-info-mask attacker-velocity) (-> obj mask)) + (set! (-> arg0 attacker-velocity quad) (-> obj attacker-velocity quad)) + (vector-normalize-copy! (-> arg0 trans) (-> arg0 attacker-velocity) 1.0) + ) + (v1-0 + (cond + (s5-0 + (vector-! (-> arg0 trans) (-> v1-0 root trans) (-> s5-0 root trans)) + (vector-normalize! (-> arg0 trans) 1.0) + (set! (-> arg0 attacker-velocity quad) (-> arg0 trans quad)) + ) + (else + (vector-z-quaternion! (-> arg0 trans) (-> v1-0 root quat)) + (vector-negate-in-place! (-> arg0 trans)) + (vector-normalize! (-> arg0 trans) 1.0) + (set! (-> arg0 attacker-velocity quad) (-> arg0 trans quad)) + ) + ) + ) + (else + (set! (-> arg0 trans quad) (the-as uint128 0)) + (set! (-> arg0 attacker-velocity quad) (the-as uint128 0)) + ) + ) + ) + (if s5-0 + (set! (-> arg0 intersection quad) (-> s5-0 root trans quad)) + (set! (-> arg0 intersection quad) (-> (target-pos 0) quad)) + ) + ) + (.lvf vf1 (&-> (-> arg0 trans) quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.mov v1-14 vf1) + (cond + ((!= v1-14 0.0) + (set! (-> arg0 vector quad) (-> arg0 trans quad)) + (set! (-> arg0 vector y) 0.0) + (vector-xz-normalize! (-> arg0 vector) 1.0) + ) + (else + (set! (-> arg0 vector quad) (the-as uint128 0)) + ) + ) + 0 + (none) + ) + ) + +;; definition for method 10 of type attack-info +(defmethod attack-info-method-10 attack-info ((obj attack-info) (arg0 object) (arg1 process-drawable) (arg2 process) (arg3 touching-shapes-entry)) + (when (and arg3 arg1) + (let ((a1-2 (prims-touching? arg3 (the-as collide-shape (-> arg1 root)) (the-as uint -1)))) + (when a1-2 + (get-intersect-point (-> obj intersection) a1-2 (the-as collide-shape (-> arg1 root)) arg3) + (logior! (-> obj mask) (attack-info-mask intersection)) + ) + ) + ) + (when arg1 + (set! (-> obj prev-state) (-> arg1 state)) + (logior! (-> obj mask) (attack-info-mask prev-state)) + ) + (when (not (logtest? (-> obj mask) (attack-info-mask attacker))) + (set! (-> obj attacker) (process->handle arg2)) + (logior! (-> obj mask) (attack-info-mask attacker)) + ) + (when (not (logtest? (-> obj mask) (attack-info-mask attack-time))) + (set! (-> obj attack-time) (-> *display* base-clock frame-counter)) + (logior! (-> obj mask) (attack-info-mask attack-time)) + ) + (if (not (logtest? (attack-info-mask damage) (-> obj mask))) + (set! (-> obj damage) (-> *FACT-bank* health-default-inc)) + ) + obj + ) + +;; definition for method 11 of type attack-info +;; INFO: Used lq/sq +(defmethod combine! attack-info ((obj attack-info) (arg0 attack-info) (arg1 process-drawable)) + (let ((s4-0 (-> arg0 mask))) + (set! (-> obj mask) (-> arg0 mask)) + (if (logtest? s4-0 (attack-info-mask attacker)) + (set! (-> obj attacker) (-> arg0 attacker)) + ) + (if (logtest? s4-0 (attack-info-mask mode)) + (set! (-> obj mode) (-> arg0 mode)) + ) + (if (logtest? s4-0 (attack-info-mask angle)) + (set! (-> obj angle) (-> arg0 angle)) + ) + (if (logtest? s4-0 (attack-info-mask dist)) + (set! (-> obj dist) (-> arg0 dist)) + ) + (if (logtest? s4-0 (attack-info-mask control)) + (set! (-> obj control) (-> arg0 control)) + ) + (if (logtest? s4-0 (attack-info-mask speed)) + (set! (-> obj speed) (-> arg0 speed)) + ) + (if (logtest? (attack-info-mask penetrate-using) s4-0) + (set! (-> obj penetrate-using) (-> arg0 penetrate-using)) + ) + (if (logtest? (attack-info-mask damage) s4-0) + (set! (-> obj damage) (-> arg0 damage)) + ) + (if (logtest? (attack-info-mask shield-damage) s4-0) + (set! (-> obj shield-damage) (-> arg0 shield-damage)) + ) + (if (logtest? (attack-info-mask knock) s4-0) + (set! (-> obj knock) (-> arg0 knock)) + ) + (if (logtest? (attack-info-mask count) s4-0) + (set! (-> obj count) (-> arg0 count)) + ) + (if (logtest? s4-0 (attack-info-mask id)) + (set! (-> obj id) (-> arg0 id)) + ) + (if (logtest? s4-0 (attack-info-mask shove-back)) + (set! (-> obj shove-back) (-> arg0 shove-back)) + ) + (if (logtest? s4-0 (attack-info-mask shove-up)) + (set! (-> obj shove-up) (-> arg0 shove-up)) + ) + (if (logtest? s4-0 (attack-info-mask invinc-time)) + (set! (-> obj invinc-time) (-> arg0 invinc-time)) + ) + (if (logtest? s4-0 (attack-info-mask rotate-to)) + (set! (-> obj rotate-to) (-> arg0 rotate-to)) + ) + (if (logtest? s4-0 (attack-info-mask intersection)) + (set! (-> obj intersection quad) (-> arg0 intersection quad)) + ) + (if (logtest? (attack-info-mask attacker-velocity) s4-0) + (set! (-> obj attacker-velocity quad) (-> arg0 attacker-velocity quad)) + ) + (cond + ((not (logtest? s4-0 (attack-info-mask vector))) + (let* ((s2-0 (handle->process (-> obj attacker))) + (v1-65 (if (type? s2-0 process-drawable) + s2-0 + ) + ) + ) + (when (and v1-65 (nonzero? (-> (the-as process-drawable v1-65) root))) + (set! (-> obj trans quad) (-> (the-as process-drawable v1-65) root trans quad)) + (vector-! (-> obj vector) (-> arg1 root trans) (-> (the-as process-drawable v1-65) root trans)) + (logior! (-> obj mask) (attack-info-mask vector)) + ) + ) + ) + (else + (let* ((s3-1 (handle->process (-> obj attacker))) + (v1-72 (if (type? s3-1 process-drawable) + s3-1 + ) + ) + ) + (if (and v1-72 (nonzero? (-> (the-as process-drawable v1-72) root))) + (set! (-> obj trans quad) (-> (the-as process-drawable v1-72) root trans quad)) + ) + ) + (set! (-> obj vector quad) (-> arg0 vector quad)) + (when (not (logtest? s4-0 (attack-info-mask shove-back))) + (let ((v1-79 (-> obj vector))) + (set! (-> obj shove-back) (sqrtf (+ (* (-> v1-79 x) (-> v1-79 x)) (* (-> v1-79 z) (-> v1-79 z))))) + ) + ) + (if (not (logtest? s4-0 (attack-info-mask shove-up))) + (set! (-> obj shove-up) (-> obj vector y)) + ) + ) + ) + (if (not (logtest? (-> obj mask) (attack-info-mask dist))) + (set! (-> obj dist) (fabs (-> obj shove-back))) + ) + (if (logtest? s4-0 (attack-info-mask trans)) + (set! (-> obj trans quad) (-> arg0 trans quad)) + ) + ) + obj + ) + +;; definition for function ground-tween-initialize +(defbehavior ground-tween-initialize target ((arg0 ground-tween-info) + (arg1 uint) + (arg2 uint) + (arg3 uint) + (arg4 uint) + (arg5 uint) + (arg6 uint) + (arg7 float) + ) + (set! (-> arg0 group 0) arg2) + (set! (-> arg0 group 1) arg3) + (set! (-> arg0 group 2) arg4) + (set! (-> arg0 group 3) arg5) + (set! (-> arg0 group 4) arg6) + (dotimes (s2-0 3) + (set! (-> arg0 chan s2-0) (+ arg1 s2-0)) + (let ((s1-0 (-> self skel root-channel (-> arg0 chan s2-0)))) + (let ((f0-1 (fabs (-> arg0 blend s2-0)))) + (set! (-> s1-0 frame-interp 1) f0-1) + (set! (-> s1-0 frame-interp 0) f0-1) + ) + (joint-control-channel-group-eval! s1-0 (the-as art-joint-anim arg2) num-func-identity) + (set! (-> s1-0 frame-num) arg7) + ) + ) + arg0 + ) + +;; definition for function ground-tween-update +;; WARN: Return type mismatch int vs none. +(defbehavior ground-tween-update target ((arg0 ground-tween-info) (arg1 float) (arg2 float) (arg3 float)) + (let ((f0-1 (fmax -1.0 (fmin 1.0 arg1))) + (f30-0 (fmax -1.0 (fmin 1.0 arg2))) + ) + (let ((f1-5 (fabs (- f0-1 (-> arg0 blend 1))))) + (seek! (-> arg0 blend 1) f0-1 (fmax (fmin (* f1-5 arg3) (* 0.8 arg3)) (* 0.2 arg3))) + ) + (let ((f0-9 (fabs (- f30-0 (-> arg0 blend 2))))) + (seek! (-> arg0 blend 2) f30-0 (fmax (fmin (* f0-9 arg3) (* 0.8 arg3)) (* 0.2 arg3))) + ) + ) + (cond + ((>= (-> arg0 blend 1) 0.0) + (let ((v1-12 (-> self skel root-channel (-> arg0 chan 1)))) + (let ((f0-16 (fabs (-> arg0 blend 1)))) + (set! (-> v1-12 frame-interp 1) f0-16) + (set! (-> v1-12 frame-interp 0) f0-16) + ) + (set! (-> v1-12 frame-group) (the-as art-joint-anim (-> arg0 group 1))) + ) + ) + (else + (let ((v1-15 (-> self skel root-channel (-> arg0 chan 1)))) + (let ((f0-18 (fabs (-> arg0 blend 1)))) + (set! (-> v1-15 frame-interp 1) f0-18) + (set! (-> v1-15 frame-interp 0) f0-18) + ) + (set! (-> v1-15 frame-group) (the-as art-joint-anim (-> arg0 group 2))) + ) + ) + ) + (cond + ((>= (-> arg0 blend 2) 0.0) + (let ((v1-18 (-> self skel root-channel (-> arg0 chan 2)))) + (let ((f0-21 (fabs (-> arg0 blend 2)))) + (set! (-> v1-18 frame-interp 1) f0-21) + (set! (-> v1-18 frame-interp 0) f0-21) + ) + (set! (-> v1-18 frame-group) (the-as art-joint-anim (-> arg0 group 4))) + ) + ) + (else + (let ((v1-21 (-> self skel root-channel (-> arg0 chan 2)))) + (let ((f0-23 (fabs (-> arg0 blend 2)))) + (set! (-> v1-21 frame-interp 1) f0-23) + (set! (-> v1-21 frame-interp 0) f0-23) + ) + (set! (-> v1-21 frame-group) (the-as art-joint-anim (-> arg0 group 3))) + ) + ) + ) + 0 + (none) + ) + +;; definition for function target-pos +(defun target-pos ((arg0 int)) + (let ((a1-0 *target*)) + (cond + (a1-0 + (if (zero? arg0) + (-> a1-0 control trans) + (vector<-cspace! (new 'static 'vector) (-> a1-0 node-list data arg0)) + ) + ) + (else + (camera-pos) + ) + ) + ) + ) + +;; definition for function target-cam-pos +;; INFO: Used lq/sq +(defun target-cam-pos () + (let ((gp-0 *target*)) + (cond + ((not gp-0) + (camera-pos) + ) + ((logtest? (-> gp-0 state-flags) (state-flags sf6)) + (add-debug-sphere + *display-camera-marks* + (bucket-id debug-no-zbuf1) + (-> gp-0 alt-cam-pos) + (meters 0.2) + (new 'static 'rgba :r #xff :a #x80) + ) + (-> gp-0 alt-cam-pos) + ) + ((logtest? (-> gp-0 state-flags) (state-flags sf12)) + (add-debug-sphere + *display-camera-marks* + (bucket-id debug-no-zbuf1) + (-> gp-0 alt-cam-pos) + (meters 0.2) + (new 'static 'rgba :r #xff :a #x80) + ) + (-> gp-0 alt-cam-pos) + ) + ((logtest? (-> gp-0 state-flags) (state-flags sf14)) + (let ((s5-0 (new 'static 'vector))) + (set! (-> s5-0 quad) (-> gp-0 control unknown-vector15 quad)) + (set! (-> s5-0 y) (fmax (-> s5-0 y) (-> gp-0 alt-cam-pos y))) + (add-debug-sphere + *display-camera-marks* + (bucket-id debug-no-zbuf1) + s5-0 + (meters 0.2) + (new 'static 'rgba :r #xff :a #x80) + ) + s5-0 + ) + ) + (else + (add-debug-sphere + *display-camera-marks* + (bucket-id debug-no-zbuf1) + (-> gp-0 control unknown-vector15) + (meters 0.2) + (new 'static 'rgba :r #xff :a #x80) + ) + (-> gp-0 control unknown-vector15) + ) + ) + ) + ) + +;; definition for function target-rot +(defun target-rot () + (let ((v1-0 *target*)) + (if v1-0 + (-> v1-0 control unknown-quaternion00) + *unity-quaternion* + ) + ) + ) + +;; definition for method 20 of type target +;; INFO: Used lq/sq +(defmethod get-trans target ((obj target) (arg0 int)) + "@returns the `trans` [[vector]] from the process's `root` (typically either a [[trsqv]] or a [[collide-shape]]" + (local-vars (v0-0 vector)) + (let ((v1-0 (-> obj control))) + (cond + ((zero? arg0) + (-> v1-0 trans) + ) + ((= arg0 1) + (let ((a1-2 (-> obj water flags))) + (cond + ((and (logtest? (water-flags touch-water) a1-2) + (logtest? (water-flags under-water swimming) a1-2) + (zero? (logand (focus-status mech) (-> obj focus-status))) + ) + (set! v0-0 (new 'static 'vector :w 1.0)) + (set! (-> v0-0 quad) (-> obj control trans quad)) + (set! (-> v0-0 y) (-> obj water height)) + v0-0 + ) + (else + (-> v1-0 gspot-pos) + ) + ) + ) + ) + ((= arg0 2) + (vector<-cspace! (new 'static 'vector) (-> obj node-list data 8)) + ) + ((= arg0 3) + (set! v0-0 (vector<-cspace! (new 'static 'vector) (-> obj node-list data 6))) + (set! (-> v0-0 w) 4096.0) + v0-0 + ) + ((= arg0 4) + (target-cam-pos) + ) + ((= arg0 5) + (if (= (-> obj draw origin w) 0.0) + (-> v1-0 trans) + (-> obj draw origin) + ) + ) + ((= arg0 6) + (let ((f0-4 (vector-dot (-> v1-0 dynam gravity-normal) (-> v1-0 transv)))) + (cond + ((and (< 0.0 f0-4) (logtest? (-> obj focus-status) (focus-status in-air))) + (let* ((v0-1 (new 'static 'vector)) + (f0-5 (+ (* 0.0016666667 (-> v1-0 dynam gravity-length)) f0-4)) + (f0-8 (/ (* 0.5 f0-5 f0-5) (-> v1-0 dynam gravity-length))) + ) + (vector+float*! v0-1 (-> v1-0 trans) (-> v1-0 dynam gravity-normal) f0-8) + ) + ) + (else + (-> v1-0 trans) + ) + ) + ) + ) + ((= arg0 7) + (-> v1-0 unknown-vector23) + ) + ((= arg0 8) + (-> v1-0 unknown-vector42) + ) + (else + (-> v1-0 trans) + ) + ) + ) + ) + +;; definition for method 23 of type target +(defmethod process-focusable-method-23 target ((obj target) (arg0 int)) + (let ((v1-0 (-> obj control))) + (cond + ((zero? arg0) + (let ((f0-1 (vector-dot (-> v1-0 dynam gravity-normal) (-> v1-0 transv)))) + (if (and (< 0.0 f0-1) (logtest? (-> obj focus-status) (focus-status in-air))) + (time-to-apex f0-1 (- (-> v1-0 dynam gravity-length))) + 0 + ) + ) + ) + ((= arg0 1) + (if (logtest? (-> obj focus-status) (focus-status in-air)) + (the-as int (target-time-to-ground)) + 0 + ) + ) + (else + 0 + ) + ) + ) + ) + +;; definition for method 21 of type target +(defmethod get-quat target ((obj target) (arg0 int)) + (let ((v1-0 arg0)) + (cond + ((zero? v1-0) + (-> obj control quat) + ) + ((= v1-0 1) + (-> obj control unknown-quaternion00) + ) + ((= v1-0 2) + (-> obj control dir-targ) + ) + ((= v1-0 3) + (if (using-gun? obj) + (forward-up->quaternion + (new 'static 'quaternion) + (-> obj gun fire-dir-out) + (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> obj control unknown-quaternion00)) + ) + (-> obj control quat) + ) + ) + (else + (-> obj control quat) + ) + ) + ) + ) + +;; definition for method 24 of type target +(defmethod get-water-height target ((obj target)) + (-> obj water surface-height) + ) + +;; definition for method 25 of type target +(defmethod process-focusable-method-25 target ((obj target)) + (-> obj neck notice-time) + ) diff --git a/test/decompiler/reference/jak2/engine/target/target_REF.gc b/test/decompiler/reference/jak2/engine/target/target_REF.gc index 187578556d..ee96d70d85 100644 --- a/test/decompiler/reference/jak2/engine/target/target_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target_REF.gc @@ -828,7 +828,7 @@ ) ) ) - (begin self (can-exit-duck?)) + (can-exit-duck? self) ) ) ) @@ -856,7 +856,7 @@ ) (if (and (cpad-pressed? (-> self control unknown-cpad-info00 number) square) (can-hands? #t) - (begin self (can-exit-duck?)) + (can-exit-duck? self) (not (logtest? (-> self control unknown-surface01 flags) (surface-flag no-jump))) (zero? (logand (-> self state-flags) (state-flags sf7))) ) @@ -981,7 +981,7 @@ (>= (- (- (-> self control trans y) (- (-> self water base-height) (-> self water wade-height)))) 2457.6) ) ) - (begin self (can-exit-duck?)) + (can-exit-duck? self) ) (if (and (using-gun? self) (begin (set! v1-22 (top-anim-joint-control-method-11 (-> self skel top-anim) 0)) v1-22) @@ -1013,7 +1013,7 @@ ) (if (and (cpad-pressed? (-> self control unknown-cpad-info00 number) square) (can-hands? #t) - (begin self (can-exit-duck?)) + (can-exit-duck? self) (not (logtest? (-> self control unknown-surface01 flags) (surface-flag no-jump))) (zero? (logand (-> self state-flags) (state-flags sf7))) ) @@ -1886,11 +1886,12 @@ ((or (= arg0 'stuck) (logtest? (focus-status indax) (-> self focus-status))) ) (else - (let ((f0-2 (vector-dot - (-> self control dynam gravity-normal) - (vector-! (new 'stack-no-clear 'vector) (-> self control unknown-vector21) (-> self control trans)) - ) - ) + (let ((f0-2 + (vector-dot + (-> self control dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> self control unknown-vector21) (-> self control trans)) + ) + ) ) (if (and (< (-> *TARGET-bank* fall-far) f0-2) (zero? (logand (-> self control status) (cshape-moving-flags on-water))) @@ -1916,11 +1917,11 @@ (delete-back-vel) ) (set! (-> self control unknown-surface00) *walk-mods*) - (let ((s5-0 (method-of-object (-> self water) water-control-method-11))) + (start-bobbing! + (-> self water) (lerp-scale 0.0 4096.0 (-> self control ground-impact-vel) 40960.0 102400.0) 600 1500 - (s5-0) ) (if (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak)) @@ -1994,7 +1995,7 @@ ) (target-jump-go) ) - (if (and (or (cpad-hold? (-> self control unknown-cpad-info00 number) l1) (begin self (not (can-exit-duck?)))) + (if (and (or (cpad-hold? (-> self control unknown-cpad-info00 number) l1) (not (can-exit-duck? self))) (can-duck?) ) (go target-duck-stance #f) @@ -2113,24 +2114,23 @@ (case event-type (('touched) (cond - (((method-of-type touching-shapes-entry touching-shapes-entry-method-12) + (((method-of-type touching-shapes-entry prims-touching?) (the-as touching-shapes-entry (-> event param 0)) (-> self control) (the-as uint 1920) ) - (let ((t9-1 target-send-attack) - (a1-2 (-> self control unknown-symbol04)) - (a2-2 (-> event param 0)) - (a3-1 (-> self control unknown-symbol05)) - (t0-0 (-> self control unknown-dword05)) - ) - (-> self control penetrate-using) - (when (t9-1 proc (the-as uint a1-2) a2-2 (the-as int a3-1) (the-as int t0-0)) - (set! (-> self gun combo-window-start) (-> self clock frame-counter)) - (let ((v0-2 (the-as object (-> self state name)))) - (set! (-> self gun combo-window-state) (the-as symbol v0-2)) - v0-2 - ) + (when (target-send-attack + proc + (the-as uint (-> self control unknown-symbol04)) + (-> event param 0) + (the-as int (-> self control unknown-symbol05)) + (the-as int (-> self control unknown-dword05)) + (the-as uint (-> self control penetrate-using)) + ) + (set! (-> self gun combo-window-start) (-> self clock frame-counter)) + (let ((v0-2 (the-as object (-> self state name)))) + (set! (-> self gun combo-window-state) (the-as symbol v0-2)) + v0-2 ) ) ) @@ -2176,8 +2176,8 @@ ) (set-quaternion! (-> self control) (-> self control dir-targ)) (quaternion-copy! (-> self control unknown-quaternion04) (-> self control dir-targ)) - (set! (-> self control unknown-float40) 0.0) (set! (-> self control unknown-float41) 0.0) + (set! (-> self control unknown-float42) 0.0) (none) ) :exit (behavior () @@ -2401,59 +2401,59 @@ (case event-type (('touched) (cond - (((method-of-type touching-shapes-entry touching-shapes-entry-method-12) + (((method-of-type touching-shapes-entry prims-touching?) (the-as touching-shapes-entry (-> event param 0)) (-> self control) (the-as uint 1920) ) - (let ((t9-1 target-send-attack) - (a0-3 proc) - (a1-2 (-> self control unknown-symbol04)) - (a2-2 (-> event param 0)) - (a3-1 (-> self control unknown-symbol05)) - (t0-0 (-> self control unknown-dword05)) + (let ((gp-1 (target-send-attack + proc + (the-as uint (-> self control unknown-symbol04)) + (-> event param 0) + (the-as int (-> self control unknown-symbol05)) + (the-as int (-> self control unknown-dword05)) + (the-as uint (-> self control penetrate-using)) + ) + ) ) - (-> self control penetrate-using) - (let ((gp-1 (t9-1 a0-3 (the-as uint a1-2) a2-2 (the-as int a3-1) (the-as int t0-0)))) - (when gp-1 - (set! (-> self control unknown-time-frame17) (-> self clock frame-counter)) - (set! (-> self gun combo-window-start) (-> self clock frame-counter)) - (set! (-> self gun combo-window-state) (-> self state name)) - (let ((v1-13 (if (type? proc process-focusable) - proc - ) - ) - ) - (when v1-13 - (let* ((s5-1 (-> (the-as target v1-13) control)) - (v1-14 (if (type? s5-1 collide-shape) - s5-1 - ) - ) - ) - (if (and v1-14 (or (logtest? (-> v1-14 root-prim prim-core collide-as) (collide-spec enemy)) - (logtest? (-> v1-14 root-prim prim-core action) (collide-action no-smack)) - ) + (when gp-1 + (set! (-> self control unknown-time-frame17) (-> self clock frame-counter)) + (set! (-> self gun combo-window-start) (-> self clock frame-counter)) + (set! (-> self gun combo-window-state) (-> self state name)) + (let ((v1-13 (if (type? proc process-focusable) + proc ) - (set! (-> self control unknown-word04) (the-as uint (+ (-> self control unknown-word04) 1))) - ) - ) + ) + ) + (when v1-13 + (let* ((s5-1 (-> (the-as target v1-13) control)) + (v1-14 (if (type? s5-1 collide-shape) + s5-1 + ) + ) + ) + (if (and v1-14 (or (logtest? (-> v1-14 root-prim prim-core collide-as) (collide-spec enemy)) + (logtest? (-> v1-14 root-prim prim-core action) (collide-action no-smack)) + ) + ) + (set! (-> self control unknown-word04) (the-as uint (+ (-> self control unknown-word04) 1))) + ) ) ) - (cond - ((or (= gp-1 'die) (= gp-1 'push)) - (let ((v0-2 (the-as object (-> self clock frame-counter)))) - (set! (-> self control unknown-time-frame18) (the-as time-frame v0-2)) - v0-2 - ) + ) + (cond + ((or (= gp-1 'die) (= gp-1 'push)) + (let ((v0-2 (the-as object (-> self clock frame-counter)))) + (set! (-> self control unknown-time-frame18) (the-as time-frame v0-2)) + v0-2 ) - ((= gp-1 'back) - (let ((f0-0 -122880.0)) - (set! (-> self control unknown-word04) (the-as uint f0-0)) - f0-0 - ) + ) + ((= gp-1 'back) + (let ((f0-0 -122880.0)) + (set! (-> self control unknown-word04) (the-as uint f0-0)) + f0-0 ) - ) + ) ) ) ) @@ -2592,7 +2592,7 @@ (if (and (logtest? (water-flags touch-water) (-> self water flags)) (zero? (mod (- (-> self clock frame-counter) (-> self state-time)) 21)) ) - (water-control-method-13 + (spawn-ripples (-> self water) 0.6 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 8)) @@ -2837,7 +2837,7 @@ (set! (-> *run-attack-mods* turnvv) 0.0) ) (if (< 2 gp-2) - (set! f30-0 (* f30-0 (fmin 1.0 (-> self control unknown-float43)))) + (set! f30-0 (* f30-0 (fmin 1.0 (-> self control unknown-float44)))) ) (+! gp-2 1) ) @@ -3244,7 +3244,7 @@ (suspend) (ja :num! (seek! (ja-aframe 7.0 0))) ) - (go target-darkjak-bomb1) + (go target-darkjak-bomb1 arg0 arg1) ) (else (ja-no-eval :group! (-> self draw art-group data 51) @@ -3474,7 +3474,7 @@ (cond ((< 6144.0 (target-height-above-ground)) (sound-play "swim-flop") - (set! (-> self control unknown-float42) 0.0) + (set! (-> self control unknown-float43) 0.0) (go target-swim-down) ) (else @@ -3720,7 +3720,7 @@ (set! (-> gp-1 param 0) 0.0) (joint-control-channel-group-eval! gp-1 (the-as art-joint-anim #f) num-func-chan) ) - (set! f30-0 (* f30-0 (fmin 1.0 (-> self control unknown-float43)))) + (set! f30-0 (* f30-0 (fmin 1.0 (-> self control unknown-float44)))) (let ((v1-77 (new-stack-vector0)) (f0-33 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) ) @@ -3995,7 +3995,7 @@ ) (suspend) (ja :num! (seek!)) - (set! f30-0 (* f30-0 (fmin 1.0 (-> self control unknown-float43)))) + (set! f30-0 (* f30-0 (fmin 1.0 (-> self control unknown-float44)))) ) ) (if (and (or (< (- (-> self clock frame-counter) (the-as time-frame gp-0)) @@ -4146,7 +4146,7 @@ ) (suspend) (ja :num! (seek!)) - (set! f30-0 (* f30-0 (fmin 1.0 (-> self control unknown-float43)))) + (set! f30-0 (* f30-0 (fmin 1.0 (-> self control unknown-float44)))) (set! v1-37 (or (ja-max? 0) (and (>= (ja-aframe-num 0) 4.0) (logtest? (-> self control status) (cshape-moving-flags on-surface))) @@ -4216,9 +4216,8 @@ (none) ) ) - self (cond - ((not (can-exit-duck?)) + ((not (can-exit-duck? self)) (go target-duck-stance #f) ) (else diff --git a/test/decompiler/reference/jak2/engine/ui/progress/progress-static_REF.gc b/test/decompiler/reference/jak2/engine/ui/progress/progress-static_REF.gc index 846a5a6675..3329554fd5 100644 --- a/test/decompiler/reference/jak2/engine/ui/progress/progress-static_REF.gc +++ b/test/decompiler/reference/jak2/engine/ui/progress/progress-static_REF.gc @@ -2,40 +2,10 @@ (in-package goal) ;; failed to figure out what this is: -(let ((a0-0 (new 'static 'skeleton-group - :name "skel-hud-ring" - :extra #f - :info #f - :art-group-name "hud-ring" - :bounds (new 'static 'vector :w 225280.0) - :version #x7 - ) - ) - ) - (set! (-> a0-0 jgeo) 0) - (set! (-> a0-0 janim) 2) - (set! (-> a0-0 mgeo 0) 1) - (set! (-> a0-0 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-0) - ) +(defskelgroup skel-hud-ring hud-ring 0 2 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 55)) ;; failed to figure out what this is: -(let ((a0-1 (new 'static 'skeleton-group - :name "skel-hud-ring-part" - :extra #f - :info #f - :art-group-name "hud-ring" - :bounds (new 'static 'vector :w 225280.0) - :version #x7 - ) - ) - ) - (set! (-> a0-1 jgeo) 3) - (set! (-> a0-1 janim) 5) - (set! (-> a0-1 mgeo 0) 4) - (set! (-> a0-1 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-1) - ) +(defskelgroup skel-hud-ring-part hud-ring 3 5 ((4 (meters 999999))) :bounds (static-spherem 0 0 0 55)) ;; definition for symbol *main-options*, type menu-option-list (define *main-options* diff --git a/test/decompiler/reference/jak2/levels/common/airlock_REF.gc b/test/decompiler/reference/jak2/levels/common/airlock_REF.gc index 8a729322a0..d40b4c432c 100644 --- a/test/decompiler/reference/jak2/levels/common/airlock_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/airlock_REF.gc @@ -410,40 +410,16 @@ ) ;; failed to figure out what this is: -(let ((a0-10 (new 'static 'skeleton-group - :name "skel-com-airlock-outer" - :extra #f - :info #f - :art-group-name "com-airlock-outer" - :bounds (new 'static 'vector :y 20480.0 :w 57344.0) - :version #x7 - ) - ) - ) - (set! (-> a0-10 jgeo) 0) - (set! (-> a0-10 janim) 2) - (set! (-> a0-10 mgeo 0) 1) - (set! (-> a0-10 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-10) - ) +(defskelgroup skel-com-airlock-outer com-airlock-outer 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 5 0 14) + ) ;; failed to figure out what this is: -(let ((a0-11 (new 'static 'skeleton-group - :name "skel-com-airlock-inner" - :extra #f - :info #f - :art-group-name "com-airlock-inner" - :bounds (new 'static 'vector :y 20480.0 :w 57344.0) - :version #x7 - ) - ) - ) - (set! (-> a0-11 jgeo) 0) - (set! (-> a0-11 janim) 2) - (set! (-> a0-11 mgeo 0) 1) - (set! (-> a0-11 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-11) - ) +(defskelgroup skel-com-airlock-inner com-airlock-inner 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 5 0 14) + ) ;; failed to figure out what this is: (defstate close (com-airlock) @@ -1064,22 +1040,10 @@ ) ;; failed to figure out what this is: -(let ((a0-20 (new 'static 'skeleton-group - :name "skel-fort-entry-gate" - :extra #f - :info #f - :art-group-name "fort-entry-gate" - :bounds (new 'static 'vector :y 12288.0 :w 40960.0) - :version #x7 - ) - ) - ) - (set! (-> a0-20 jgeo) 0) - (set! (-> a0-20 janim) 2) - (set! (-> a0-20 mgeo 0) 1) - (set! (-> a0-20 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-20) - ) +(defskelgroup skel-fort-entry-gate fort-entry-gate 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 3 0 10) + ) ;; definition of type fort-entry-gate (deftype fort-entry-gate (com-airlock) @@ -1152,22 +1116,7 @@ ) ;; failed to figure out what this is: -(let ((a0-24 (new 'static 'skeleton-group - :name "skel-hip-door-a" - :extra #f - :info #f - :art-group-name "hip-door-a" - :bounds (new 'static 'vector :y 8192.0 :w 20480.0) - :version #x7 - ) - ) - ) - (set! (-> a0-24 jgeo) 0) - (set! (-> a0-24 janim) 2) - (set! (-> a0-24 mgeo 0) 1) - (set! (-> a0-24 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-24) - ) +(defskelgroup skel-hip-door-a hip-door-a 0 2 ((1 (meters 999999))) :bounds (static-spherem 0 2 0 5)) ;; definition of type hip-door-a (deftype hip-door-a (com-airlock) @@ -1241,23 +1190,11 @@ ) ;; failed to figure out what this is: -(let ((a0-28 (new 'static 'skeleton-group - :name "skel-tomb-mar-door" - :extra #f - :info #f - :art-group-name "tomb-mar-door" - :bounds (new 'static 'vector :y 24576.0 :w 73728.0) - :version #x7 - :origin-joint-index 3 - ) - ) - ) - (set! (-> a0-28 jgeo) 0) - (set! (-> a0-28 janim) 2) - (set! (-> a0-28 mgeo 0) 1) - (set! (-> a0-28 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-28) - ) +(defskelgroup skel-tomb-mar-door tomb-mar-door 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 6 0 18) + :origin-joint-index 3 + ) ;; definition of type tomb-mar-door (deftype tomb-mar-door (com-airlock) @@ -1339,23 +1276,11 @@ ) ;; failed to figure out what this is: -(let ((a0-34 (new 'static 'skeleton-group - :name "skel-pal-throne-door" - :extra #f - :info #f - :art-group-name "pal-throne-door" - :bounds (new 'static 'vector :y 24576.0 :w 98304.0) - :version #x7 - :origin-joint-index 3 - ) - ) - ) - (set! (-> a0-34 jgeo) 0) - (set! (-> a0-34 janim) 2) - (set! (-> a0-34 mgeo 0) 1) - (set! (-> a0-34 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-34) - ) +(defskelgroup skel-pal-throne-door pal-throne-door 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 6 0 24) + :origin-joint-index 3 + ) ;; definition of type pal-throne-door (deftype pal-throne-door (com-airlock) @@ -1429,22 +1354,10 @@ ) ;; failed to figure out what this is: -(let ((a0-38 (new 'static 'skeleton-group - :name "skel-vin-door-ctyinda" - :extra #f - :info #f - :art-group-name "vin-door-ctyinda" - :bounds (new 'static 'vector :y 12288.0 :w 24576.0) - :version #x7 - ) - ) - ) - (set! (-> a0-38 jgeo) 0) - (set! (-> a0-38 janim) 2) - (set! (-> a0-38 mgeo 0) 1) - (set! (-> a0-38 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-38) - ) +(defskelgroup skel-vin-door-ctyinda vin-door-ctyinda 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 3 0 6) + ) ;; definition of type vin-door-ctyinda (deftype vin-door-ctyinda (com-airlock) @@ -1518,22 +1431,7 @@ ) ;; failed to figure out what this is: -(let ((a0-42 (new 'static 'skeleton-group - :name "skel-under-door" - :extra #f - :info #f - :art-group-name "hip-door-a" - :bounds (new 'static 'vector :y 8192.0 :w 20480.0) - :version #x7 - ) - ) - ) - (set! (-> a0-42 jgeo) 0) - (set! (-> a0-42 janim) 2) - (set! (-> a0-42 mgeo 0) 1) - (set! (-> a0-42 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-42) - ) +(defskelgroup skel-under-door hip-door-a 0 2 ((1 (meters 999999))) :bounds (static-spherem 0 2 0 5)) ;; definition of type under-door (deftype under-door (com-airlock) @@ -1607,22 +1505,7 @@ ) ;; failed to figure out what this is: -(let ((a0-46 (new 'static 'skeleton-group - :name "skel-oracle-door" - :extra #f - :info #f - :art-group-name "oracle-door" - :bounds (new 'static 'vector :y 16384.0 :w 40960.0) - :version #x7 - ) - ) - ) - (set! (-> a0-46 jgeo) 0) - (set! (-> a0-46 janim) 2) - (set! (-> a0-46 mgeo 0) 1) - (set! (-> a0-46 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-46) - ) +(defskelgroup skel-oracle-door oracle-door 0 2 ((1 (meters 999999))) :bounds (static-spherem 0 4 0 10)) ;; definition of type oracle-door (deftype oracle-door (com-airlock) diff --git a/test/decompiler/reference/jak2/levels/common/cty-guard-turret-button_REF.gc b/test/decompiler/reference/jak2/levels/common/cty-guard-turret-button_REF.gc index a8a7919af8..51a46d9781 100644 --- a/test/decompiler/reference/jak2/levels/common/cty-guard-turret-button_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/cty-guard-turret-button_REF.gc @@ -2,22 +2,10 @@ (in-package goal) ;; failed to figure out what this is: -(let ((a0-0 (new 'static 'skeleton-group - :name "skel-cty-guard-turret-button" - :extra #f - :info #f - :art-group-name "cty-guard-turret-button" - :bounds (new 'static 'vector :w 12288.0) - :version #x7 +(defskelgroup skel-cty-guard-turret-button cty-guard-turret-button 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 3) ) - ) - ) - (set! (-> a0-0 jgeo) 0) - (set! (-> a0-0 janim) 2) - (set! (-> a0-0 mgeo 0) 1) - (set! (-> a0-0 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-0) - ) ;; definition of type cty-guard-turret-button (deftype cty-guard-turret-button (basebutton) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/bouncer_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/bouncer_REF.gc index 8621433393..73092d0704 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/bouncer_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/bouncer_REF.gc @@ -40,22 +40,7 @@ (method-set! bouncer 12 (method-of-type process run-logic?)) ;; failed to figure out what this is: -(let ((a0-3 (new 'static 'skeleton-group - :name "skel-bouncer" - :extra #f - :info #f - :art-group-name "bounceytarp" - :bounds (new 'static 'vector :w 16384.0) - :version #x7 - ) - ) - ) - (set! (-> a0-3 jgeo) 0) - (set! (-> a0-3 janim) 2) - (set! (-> a0-3 mgeo 0) 1) - (set! (-> a0-3 lod-dist 0) 4095996000.0) - (add-to-loading-level a0-3) - ) +(defskelgroup skel-bouncer bounceytarp 0 2 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 4)) ;; failed to figure out what this is: (defstate idle (bouncer) @@ -66,7 +51,7 @@ object (cond ((= evt-type 'bonk) - (when ((method-of-type touching-shapes-entry touching-shapes-entry-method-12) + (when ((method-of-type touching-shapes-entry prims-touching?) (the-as touching-shapes-entry (-> event param 0)) (the-as collide-shape (-> self root)) (the-as uint 1) @@ -86,7 +71,7 @@ (the-as uint 1) (the-as uint 0) ) - (when ((method-of-type touching-shapes-entry touching-shapes-entry-method-12) + (when ((method-of-type touching-shapes-entry prims-touching?) (the-as touching-shapes-entry gp-2) (the-as collide-shape (-> self root)) (the-as uint 1) @@ -100,7 +85,7 @@ ) ) ) - (((method-of-type touching-shapes-entry touching-shapes-entry-method-12) + (((method-of-type touching-shapes-entry prims-touching?) (the-as touching-shapes-entry gp-2) (the-as collide-shape (-> self root)) (the-as uint 4) @@ -132,7 +117,7 @@ ) ) (when (and (nonzero? a2-7) - (and ((method-of-type touching-shapes-entry touching-shapes-entry-method-12) + (and ((method-of-type touching-shapes-entry prims-touching?) (the-as touching-shapes-entry a0-17) (the-as collide-shape (-> self root)) (the-as uint a2-7) diff --git a/test/offline/offline_test_main.cpp b/test/offline/offline_test_main.cpp index dd09a68d73..a62369b883 100644 --- a/test/offline/offline_test_main.cpp +++ b/test/offline/offline_test_main.cpp @@ -98,7 +98,10 @@ Decompiler setup_decompiler(const std::vector& files, lg::error("DB file error: {} {} {}", db_files.size(), files.size(), art_files.size()); for (auto& f : files) { if (!db_files.count(f.unique_name)) { - lg::error("didn't find {}\n", f.unique_name); + lg::error( + "didn't find {}, make sure it's part of the DGO inputs and not in the banned objects " + "list\n", + f.unique_name); } } for (auto& f : art_files) {