diff --git a/common/type_system/Type.cpp b/common/type_system/Type.cpp index 9dd363af01..0ac2e02062 100644 --- a/common/type_system/Type.cpp +++ b/common/type_system/Type.cpp @@ -218,6 +218,7 @@ std::string Type::get_parent() const { bool Type::common_type_info_equal(const Type& other) const { // clang-format off return m_methods == other.m_methods && + m_states == other.m_states && m_new_method_info == other.m_new_method_info && m_new_method_info_defined == other.m_new_method_info_defined && m_parent == other.m_parent && @@ -247,17 +248,21 @@ std::string Type::common_type_info_diff(const Type& other) const { } } if (m_states != other.m_states) { - if (m_states.size() != other.m_states.size()) { - result += fmt::format("Number of additional states {} vs. {}\n", m_states.size(), - other.m_states.size()); + result += "States are different:\n"; + for (auto& ours : m_states) { + auto theirs = other.m_states.find(ours.first); + if (theirs == other.m_states.end()) { + result += fmt::format(" {} is in one, but not the other.\n", ours.first); + } else if (ours.second != theirs->second) { + result += fmt::format(" {} is defined differently: {} vs {}\n", ours.first, + ours.second.print(), theirs->second.print()); + } } - for (size_t i = 0; i < std::min(m_states.size(), other.m_states.size()); i++) { - if (m_states.at(i) != other.m_states.at(i)) { - result += - fmt::format("State {} ({}/{}):\n", i, m_states.at(i).name, other.m_states.at(i).name); - result += m_states.at(i).diff(other.m_states.at(i)); - result += "\n"; + for (auto& theirs : other.m_states) { + auto ours = m_states.find(theirs.first); + if (ours == m_states.end()) { + result += fmt::format(" {} is in one, but not the other.\n", theirs.first); } } } @@ -396,25 +401,10 @@ std::string Type::print_method_info() const { return result; } -const StateInfo& Type::add_state(const StateInfo& info) { - m_states.push_back(info); - return m_states.back(); -} - -bool StateInfo::operator==(const StateInfo& other) const { - return name == other.name && type == other.type; -} - -std::string StateInfo::diff(const StateInfo& other) const { - std::string result; - if (name != other.name) { - result += fmt::format("name: {} vs. {}\n", name, other.name); +void Type::add_state(const std::string& name, const TypeSpec& type) { + if (!m_states.insert({name, type}).second) { + throw std::runtime_error(fmt::format("State {} is multiply defined", name)); } - - if (type != other.type) { - result += fmt::format("type: {} vs. {}\n", type.print(), other.type.print()); - } - return result; } std::string Type::incompatible_diff(const Type& other) const { diff --git a/common/type_system/Type.h b/common/type_system/Type.h index 82e20f1258..9e28d98209 100644 --- a/common/type_system/Type.h +++ b/common/type_system/Type.h @@ -6,6 +6,7 @@ */ #include +#include #include "common/util/assert.h" #include #include "common/goal_constants.h" @@ -27,15 +28,6 @@ struct MethodInfo { std::string diff(const MethodInfo& other) const; }; -struct StateInfo { - std::string name; - TypeSpec type; - - bool operator==(const StateInfo& other) const; - bool operator!=(const StateInfo& other) const { return !((*this) == other); } - std::string diff(const StateInfo& other) const; -}; - /*! * Parent class of all Types. */ @@ -89,14 +81,14 @@ class Type { const MethodInfo& add_method(const MethodInfo& info); const MethodInfo& add_new_method(const MethodInfo& info); std::string print_method_info() const; - const StateInfo& add_state(const StateInfo& info); + void add_state(const std::string& name, const TypeSpec& type); void disallow_in_runtime() { m_allow_in_runtime = false; } virtual ~Type() = default; const std::vector& get_methods_defined_for_type() const { return m_methods; } - const std::vector& get_states_declared_for_type() const { return m_states; } + const std::map& get_states_declared_for_type() const { return m_states; } const MethodInfo* get_new_method_defined_for_type() const { if (m_new_method_info_defined) { @@ -116,7 +108,7 @@ class Type { std::string incompatible_diff(const Type& other) const; std::vector m_methods; - std::vector m_states; + std::map m_states; MethodInfo m_new_method_info; bool m_new_method_info_defined = false; diff --git a/common/type_system/TypeSystem.cpp b/common/type_system/TypeSystem.cpp index 4df2fbf618..404a4cebbb 100644 --- a/common/type_system/TypeSystem.cpp +++ b/common/type_system/TypeSystem.cpp @@ -1694,15 +1694,15 @@ std::string TypeSystem::generate_deftype_footer(const Type* type) const { std::string states_string; for (auto& info : type->get_states_declared_for_type()) { - if (info.type.arg_count() > 1) { - states_string.append(fmt::format(" ({}", info.name)); - for (size_t i = 0; i < info.type.arg_count() - 1; i++) { + if (info.second.arg_count() > 1) { + states_string.append(fmt::format(" ({}", info.first)); + for (size_t i = 0; i < info.second.arg_count() - 1; i++) { states_string.push_back(' '); - states_string.append(info.type.get_arg(i).print()); + states_string.append(info.second.get_arg(i).print()); } states_string.append(")\n"); } else { - states_string.append(fmt::format(" {}\n", info.name)); + states_string.append(fmt::format(" {}\n", info.first)); } } diff --git a/common/type_system/deftype.cpp b/common/type_system/deftype.cpp index d9aafecb74..c27437736f 100644 --- a/common/type_system/deftype.cpp +++ b/common/type_system/deftype.cpp @@ -258,7 +258,7 @@ void declare_state(Type* type, TypeSystem* type_system, const goos::Object& def) }); state_typespec.add_arg(TypeSpec(type->get_name())); - type->add_state({state_name, state_typespec}); + type->add_state(state_name, state_typespec); } else { // name auto state_name = symbol_string(*obj); @@ -266,7 +266,7 @@ void declare_state(Type* type, TypeSystem* type_system, const goos::Object& def) TypeSpec state_typespec("state"); state_typespec.add_arg(TypeSpec(type->get_name())); - type->add_state({state_name, state_typespec}); + type->add_state(state_name, state_typespec); } }); } diff --git a/decompiler/IR2/FormExpressionAnalysis.cpp b/decompiler/IR2/FormExpressionAnalysis.cpp index dd33c9bb3f..de39b252ff 100644 --- a/decompiler/IR2/FormExpressionAnalysis.cpp +++ b/decompiler/IR2/FormExpressionAnalysis.cpp @@ -3223,6 +3223,10 @@ Form* try_rewrite_as_process_to_ppointer(CondNoElseElement* value, auto repopped = stack.pop_reg(condition_var, {}, env, true); if (!repopped) { repopped = var_to_form(condition_var, pool); + } else { + if (!env.dts->ts.tc(TypeSpec("process"), env.get_variable_type(condition_var, true))) { + repopped = pool.form(TypeSpec("process"), repopped); + } } return pool.alloc_single_element_form( diff --git a/decompiler/IR2/bitfields.cpp b/decompiler/IR2/bitfields.cpp index fa500137d9..5dafb47b74 100644 --- a/decompiler/IR2/bitfields.cpp +++ b/decompiler/IR2/bitfields.cpp @@ -553,6 +553,39 @@ FormElement* BitfieldAccessElement::push_step(const BitfieldManip step, std::vector{def}); } + if (m_steps.empty() && step.kind == BitfieldManip::Kind::LOGIOR_WITH_CONSTANT_INT) { + // this is a rare case of setting a bitfield to a constant. Usually we clear the field with an + // and, then set the bits we want with an or. In the case where we want to set all the bits to + // 1, we can omit the and to clear first. + + // in this case, we expect the value we're oring with to be the appropriate mask for the field. + + fmt::print("Rare bitfield set!\n"); + u64 value = step.amount; + auto type = ts.lookup_type(m_type); + auto as_bitfield = dynamic_cast(type); + assert(as_bitfield); + auto field = find_field_from_mask(ts, as_bitfield, value, m_got_pcpyud); + assert(field); + bool is_signed = + ts.tc(TypeSpec("int"), field->type()) && !ts.tc(TypeSpec("uint"), field->type()); + + // use the field to figure out what value is being set. + s64 set_value; + if (is_signed) { + set_value = extract_bitfield(value, field->offset() - pcpyud_offset, field->size()); + } else { + set_value = extract_bitfield(value, field->offset() - pcpyud_offset, field->size()); + } + + BitFieldDef def; + def.field_name = field->name(); + def.value = pool.alloc_single_element_form( + nullptr, SimpleAtom::make_int_constant(set_value)); + return pool.alloc_element(m_type, m_base, m_got_pcpyud, + std::vector{def}); + } + if (m_steps.size() == 1 && m_steps.at(0).kind == BitfieldManip::Kind::LOGAND_WITH_CONSTANT_INT && step.kind == BitfieldManip::Kind::LOGIOR_WITH_FORM) { // this is setting a bitfield to a variable diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index f3782b7031..444462938b 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -9873,6 +9873,9 @@ (nocamera uint8 :offset 1 :size 1) (noedge uint8 :offset 2 :size 1) (nolineofsight uint8 :offset 12 :size 1) + + ;; this is not in the inspect, but appears to be set. + (unknown-bit uint8 :offset 15 :size 1) ) :method-count-assert 9 :size-assert #x4 @@ -11284,10 +11287,15 @@ (unknown-dword40 int64 :offset 2160) ;; from logic-target::target-compute-edge (unknown-dword41 int64 :offset 2168) ;; from logic-target::target-compute-edge (unknown-handle10 handle :offset 2176) ;; from logic-target::target-compute-pole - probably a swingpole + (unknown-float120 float :offset 2184) ;; from target::mod-var-jump (unknown-symbol20 symbol :offset 2184) ;; from (anon-function 1 basebutton) (unknown-int20 int32 :offset 2188) ;; from logic-target::target-compute-pole + (unknown-float121 float :offset 2188) ;; from target::mod-var-jump + (unknown-float123 float :offset 2200) ;; from target::mod-var-jump (unknown-vector102 vector :inline :offset 2224) ;; from (anon-function 3 basebutton) (unknown-vector103 vector :inline :offset 2240) ;; from (anon-function 3 basebutton) + (unknown-quaternion02 quaternion :inline :offset 2256) ;; from racer-states::(code target-racing-get-on) + (unknown-quaternion03 quaternion :inline :offset 2272) ;; from racer-states::(code target-racing-get-on) (unknown-smush00 smush-control :inline :offset 2288) ;; from (event target-fishing) (unknown-vector110 vector :inline :offset 2320) ;; from logic-target::flag-setup (unknown-vector111 vector :inline :offset 2336) ;; from logic-target::flag-setup @@ -11780,6 +11788,24 @@ (:methods (dummy-20 (_type_ collide-cache) none 20) ) + + (:states + (target-racing-get-off handle) + (target-racing-jump float float symbol) + (target-racing-hit handle attack-info) + (target-racing-grab) + (target-racing-clone-anim handle) + (target-racing-get-on handle) + (target-racing-falling) + (target-racing-bounce float float symbol) + (target-racing-death symbol) + (target-racing-get-off-jump handle) + (target-racing-get-off-hit-ground symbol) + + (target-death) + (target-hit-ground symbol) + (target-clone-anim) + ) ) (deftype sidekick (process-drawable) @@ -18116,7 +18142,7 @@ ;;(define-extern *col-timer-enable* object) ;; unknown type ;;(define-extern *frame-timer* object) ;; unknown type ;;(define-extern *col-timer* object) ;; unknown type -;;(define-extern *race-track-surface* object) ;; unknown type +(define-extern *race-track-surface* surface) ;; ---------------------- @@ -19459,7 +19485,7 @@ (define-extern set-forward-vel (function float vector :behavior target)) (define-extern delete-back-vel (function float none :behavior target)) (define-extern set-side-vel (function float vector :behavior target)) -(define-extern target-timed-invulnerable (function uint64 target none)) ;; TODO - likely useconds +(define-extern target-timed-invulnerable (function uint target none)) ;; TODO - likely useconds (define-extern target-timed-invulnerable-off (function target none)) (define-extern ground-tween-initialize (function ground-tween-info uint uint uint uint uint uint ground-tween-info :behavior target)) ;; TODO - dealing with inline-array issues (define-extern ground-tween-update (function ground-tween-info float float none :behavior target)) ;; TODO - inline array issues as well @@ -22784,6 +22810,9 @@ (away-from-rand-transv-y-lo float :offset 56) (away-from-rand-transv-y-hi float :offset 60) ) + (:methods + (new (symbol type int) _type_ 0) + ) :method-count-assert 9 :size-assert #x40 :flag-assert #x900000040 @@ -22873,7 +22902,7 @@ ;; - Functions (define-extern joint-exploder-joint-callback (function joint-exploder none)) -(define-extern joint-exploder-init-by-other function) +(define-extern joint-exploder-init-by-other (function skeleton-group int joint-exploder-static-params joint-exploder-tuning none :behavior joint-exploder)) ;; - Unknowns @@ -29405,7 +29434,7 @@ ;; - Types (deftype racer-info (basic) - ((entity basic :offset-assert 4) + ((entity entity-actor :offset-assert 4) (bike-trans vector :inline :offset-assert 16) (bike-quat vector :inline :offset-assert 32) (bike-scale vector :inline :offset-assert 48) @@ -29446,14 +29475,14 @@ (targ-rotx degrees :offset-assert 332) (speed-rotx float :offset-assert 336) (mult-rotx degrees :offset-assert 340) - (front-blade basic :offset-assert 344) + (front-blade joint-mod :offset-assert 344) (front-rot degrees :offset-assert 348) (front-rotv degrees :offset-assert 352) - (bottom-blade basic :offset-assert 356) + (bottom-blade joint-mod :offset-assert 356) (bottom-rot degrees :offset-assert 360) - (front basic :offset-assert 364) + (front joint-mod :offset-assert 364) (front-turn degrees :offset-assert 368) - (tail basic :offset-assert 372) + (tail joint-mod :offset-assert 372) (tail-tilt degrees :offset-assert 376) (transv-max meters :offset-assert 380) (slide-down-time uint64 2 :offset-assert 384) @@ -29470,7 +29499,7 @@ (boost-level float :offset-assert 452) (boost-target float :offset-assert 456) (boost-output float :offset-assert 460) - (hop? basic :offset-assert 464) + (hop? symbol :offset-assert 464) (hop-start-y float :offset-assert 468) (bounce int32 :offset-assert 472) (bounce-hit float :offset-assert 476) @@ -29485,10 +29514,10 @@ (rudd-anim-vel float :offset-assert 512) (rudd-anim-frame float :offset-assert 516) (racing-time uint64 :offset-assert 520) - (stick-lock basic :offset-assert 528) - (stick-off basic :offset-assert 532) - (heavy basic :offset-assert 536) - (unstuck-time uint64 :offset-assert 544) + (stick-lock symbol :offset-assert 528) + (stick-off symbol :offset-assert 532) + (heavy symbol :offset-assert 536) + (unstuck-time int64 :offset-assert 544) (stuck-count int32 :offset-assert 552) (scrape-sound-id sound-id :offset-assert 556) (heat-sound-time uint64 :offset-assert 560) @@ -29580,39 +29609,29 @@ ;; - Types -; (deftype racer (process-drawable) -; ((extra-trans vector :inline :offset-assert 176) -; (condition int32 :offset-assert 192) -; (cell uint64 :offset-assert 200) -; (path-data UNKNOWN 2 :offset-assert 208) -; (path-target basic :offset-assert 208) -; (path-racer basic :offset-assert 212) -; (auto-get-off basic :offset-assert 216) -; (shadow-backup basic :offset-assert 220) -; ) -; :method-count-assert 24 -; :size-assert #xe0 -; :heap-base #x70 -; :flag-assert #x18007000e0 -; ;; inherited inspect of process-drawable -; (:methods -; (dummy-9 () none 9) -; (dummy-10 () none 10) -; (dummy-11 () none 11) -; (dummy-12 () none 12) -; (dummy-13 () none 13) -; (dummy-14 () none 14) -; (dummy-15 () none 15) -; (dummy-16 () none 16) -; (dummy-17 () none 17) -; (dummy-18 () none 18) -; (dummy-19 () none 19) -; (dummy-20 () none 20) -; (dummy-21 () none 21) -; (dummy-22 () none 22) -; (dummy-23 () none 23) -; ) -; ) +(deftype racer (process-drawable) + ((parent-override (pointer target) :score 100 :offset 12) + (root-override collide-shape-moving :score 100 :offset 112) + (extra-trans vector :inline :offset-assert 176) + (condition int32 :offset-assert 192) + (cell handle :offset-assert 200) + (path-data path-control 2 :offset-assert 208) + (path-target curve-control :offset 208) + (path-racer path-control :offset 212) + (auto-get-off symbol :offset-assert 216) + (shadow-backup shadow-geo :offset-assert 220) + ) + :method-count-assert 24 + :size-assert #xe0 + :heap-base #x70 + :flag-assert #x18007000e0 + (:methods + (wait-for-start () _type_ :state 20) + (idle () _type_ :state 21) + (pickup ((state collectable)) _type_ :state 22) + (wait-for-return () _type_ :state 23) + ) + ) ;; - Functions @@ -29623,7 +29642,7 @@ ;; - Unknowns (define-extern *racer-sg* skeleton-group) -;;(define-extern *racer-shadow-control* object) ;; unknown type +(define-extern *racer-shadow-control* shadow-control) (define-extern *racer-explode-sg* skeleton-group) @@ -29639,21 +29658,21 @@ (define-extern racer-service-slide function) (define-extern racer-xz function) (define-extern racer-thrust function) -(define-extern racer-calc-gravity function) +(define-extern racer-calc-gravity (function vector :behavior target)) (define-extern racer-on-ground? function) (define-extern racer-collision function) (define-extern racer-integrate function) (define-extern racer-effects function) -(define-extern racer-sounds function) +(define-extern racer-sounds (function object :behavior target)) (define-extern racer-bend-gravity function) (define-extern racer-find-prop-point function) (define-extern racer-cushion function) -(define-extern racer-buzz function) -(define-extern target-racing-center-anim function) -(define-extern target-racing-turn-anim function) -(define-extern target-racing-jump-anim function) -(define-extern target-racing-land-anim function) -(define-extern target-racing-post function) +(define-extern racer-buzz (function float none :behavior target)) +(define-extern target-racing-center-anim (function none :behavior target)) +(define-extern target-racing-turn-anim (function none :behavior target)) +(define-extern target-racing-jump-anim (function basic int none :behavior target)) +(define-extern target-racing-land-anim (function symbol none :behavior target)) +(define-extern target-racing-post (function none :behavior target)) ;; - Unknowns @@ -29686,9 +29705,8 @@ (define-extern target-racing (state target)) ;; unknown type (define-extern target-racing-grab (state target)) ;; unknown type (define-extern target-racing-clone-anim (state handle target)) ;; unknown type -(define-extern target-racing-get-off-hit-ground (state target)) ;; unknown type +(define-extern target-racing-get-off-hit-ground (state symbol target)) ;; unknown type (define-extern target-racing-get-off-jump (state handle target)) ;; unknown type -(define-extern target-racing-death (state target)) ;; unknown type (define-extern target-racing-jump (state float float symbol target)) ;; unknown type (define-extern target-racing-bounce (state float float symbol target)) ;; unknown type (define-extern target-racing-falling (state target)) ;; unknown type diff --git a/decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc b/decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc index 46e2811f55..cb434cc4f4 100644 --- a/decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc @@ -801,5 +801,11 @@ [6, "(function final-door symbol)"] ], + "racer-states-FIC-LAV-MIS-OGR-ROL": [ + [17, "(function (pointer process) :behavior racer)"], + [45, "(function joint-mod :behavior manipy)"], + [46, "(function float :behavior manipy)"] + ], + "placeholder-do-not-add-below": [] } diff --git a/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc b/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc index 1fca2dff27..fe6bb5e48d 100644 --- a/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc @@ -2672,5 +2672,80 @@ [16, "event-message-block"] ], + "(exit target-racing-start)": [ + [16, "event-message-block"] + ], + + "(code target-racing-start)": [ + [16, "event-message-block"] + ], + + "target-racing-smack-check": [ + [16, "vector"], + [32, "vector"] + ], + + "(trans target-racing)": [ + [16, "vector"] + ], + + "(trans target-racing-jump)": [ + [16, "vector"] + ], + + "(trans target-racing-bounce)": [ + [16, "vector"] + ], + + "(code target-racing-hit)": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "vector"], + [80, "vector"] + ], + + "(exit target-racing-death)": [ + [16, "event-message-block"] + ], + + "(anon-function 17 racer-states-FIC-LAV-MIS-OGR-ROL)": [ + [16, "joint-exploder-tuning"] + ], + + "(code target-racing-death)": [ + [16, "event-message-block"], + [96, "vector"], + [112, "vector"] + ], + + "(code target-racing-get-on)": [ + [16, "vector"], + [32, "vector"], + [48, "event-message-block"] + ], + + "(post target-racing-get-on)": [ + [16, "vector"] + ], + + "(code target-racing-get-off-jump)": [ + [16, "vector"], + [32, "vector"], + [48, "event-message-block"] + ], + + "(post target-racing-get-off-jump)": [ + [16, "vector"] + ], + + "(exit target-racing-clone-anim)": [ + [16, "event-message-block"] + ], + + "(code target-racing-clone-anim)": [ + [16, "event-message-block"] + ], + "placeholder-do-not-add-below!": [] } diff --git a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc index 05f133b147..3725714cef 100644 --- a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc @@ -4042,5 +4042,44 @@ [251, "a0", "process-drawable"] ], + "(anon-function 46 racer-states-FIC-LAV-MIS-OGR-ROL)": [ + [[4, 32], "v1", "target"] + ], + + "(anon-function 45 racer-states-FIC-LAV-MIS-OGR-ROL)": [ + [19, "a0", "target"], + [31, "a0", "target"], + [42, "v1", "target"] + ], + + "(code target-racing-smack)": [ + [30, "v1", "art-joint-anim"] + ], + + "(code target-racing-hit)": [ + [186, "v1", "art-joint-anim"] + ], + + "(code target-racing-death)": [ + [242, "v1", "art-joint-anim"] + ], + + "(code target-racing-get-on)": [ + [59, "s3", "racer"] + ], + + "(code target-racing-get-off-jump)": [ + [67, "s2", "racer"], + [145, "v1", "art-joint-anim"] + ], + + "(code target-racing-get-off-hit-ground)": [ + [13, "v1", "art-joint-anim"] + ], + + "(event target-racing-grab)": [ + [24, "a0", "process-drawable"] + ], + "placeholder-do-not-add-below": [] } diff --git a/decompiler/util/DecompilerTypeSystem.cpp b/decompiler/util/DecompilerTypeSystem.cpp index b7b80b3afc..dca38e1b9b 100644 --- a/decompiler/util/DecompilerTypeSystem.cpp +++ b/decompiler/util/DecompilerTypeSystem.cpp @@ -67,7 +67,7 @@ void DecompilerTypeSystem::parse_type_defs(const std::vector& file_ } // declare the type's states globally for (auto& state : dtr.type_info->get_states_declared_for_type()) { - add_symbol(state.name, state.type); + add_symbol(state.first, state.second); } } else if (car(o).as_symbol()->name == "declare-type") { diff --git a/game/fake_iso.txt b/game/fake_iso.txt index 9d25c86953..a86e955879 100644 --- a/game/fake_iso.txt +++ b/game/fake_iso.txt @@ -21,4 +21,5 @@ VI1.DGO out/iso/VI1.DGO VI2.DGO out/iso/VI2.DGO VI3.DGO out/iso/VI3.DGO TRA.DGO out/iso/TRA.DGO -FIN.DGO out/iso/FIN.DGO \ No newline at end of file +FIN.DGO out/iso/FIN.DGO +FIC.DGO out/iso/FIC.DGO \ No newline at end of file diff --git a/goal_src/dgos/fic.gd b/goal_src/dgos/fic.gd new file mode 100644 index 0000000000..d6aea0f9f7 --- /dev/null +++ b/goal_src/dgos/fic.gd @@ -0,0 +1,28 @@ + +("FIC.DGO" + ("target-racer-h-FIC-LAV-MIS-OGR-ROL.o" "target-racer-h") + ("racer-part.o" "racer-part") + ("racer.o" "racer") + ("target-racer-FIC-LAV-MIS-OGR-ROL.o" "target-racer") + ("racer-states-FIC-LAV-MIS-OGR-ROL.o" "racer-states") + ("collide-reaction-racer.o" "collide-reaction-racer") + ("eichar-racer+0-ag.go" "eichar-racer+0") + ("tpage-1119.go" "tpage-1119") + ("blocking-plane.o" "blocking-plane") + ("firecanyon-part.o" "firecanyon-part") + ("assistant-firecanyon.o" "assistant-firecanyon") + ("firecanyon-obs.o" "firecanyon-obs") + ("tpage-815.go" "tpage-815") + ("tpage-822.go" "tpage-822") + ("tpage-854.go" "tpage-854") + ("tpage-1123.go" "tpage-1123") + ("assistant-firecanyon-ag.go" "assistant-firecanyon") + ("babak-ag.go" "babak") + ("balloon-ag.go" "balloon") + ("crate-darkeco-cluster-ag-FIC.go" "crate-darkeco-cluster") + ("ecovalve-ag-FIC-OGR.go" "ecovalve") + ("ef-plane-ag-FIC-LAV-OGR-ROL-SNO-SWA.go" "ef-plane") + ("racer-ag-FIC-ROL.go" "racer") + ("spike-ag.go" "spike") + ("firecanyon-vis.go" "firecanyon-vis") + ) \ No newline at end of file diff --git a/goal_src/engine/anim/joint-h.gc b/goal_src/engine/anim/joint-h.gc index 3347540c7a..49a3ec53b9 100644 --- a/goal_src/engine/anim/joint-h.gc +++ b/goal_src/engine/anim/joint-h.gc @@ -107,3 +107,4 @@ (define-extern cspace<-parented-transformq-joint! (function cspace transformq none)) (define-extern cspace<-transformq! (function cspace transformq matrix)) (define-extern vector<-cspace! (function vector cspace vector)) +(define-extern cspace<-transformq+world-trans! (function cspace transformq vector matrix)) \ No newline at end of file diff --git a/goal_src/engine/collide/collide-target-h.gc b/goal_src/engine/collide/collide-target-h.gc index 26e2c5701e..2d9357af0b 100644 --- a/goal_src/engine/collide/collide-target-h.gc +++ b/goal_src/engine/collide/collide-target-h.gc @@ -121,10 +121,15 @@ (unknown-dword40 int64 :offset 2160) ;; from logic-target::target-compute-edge (unknown-dword41 int64 :offset 2168) ;; from logic-target::target-compute-edge (unknown-handle10 handle :offset 2176) ;; from logic-target::target-compute-pole - probably a swingpole + (unknown-float120 float :offset 2184) ;; from target::mod-var-jump (unknown-symbol20 symbol :offset 2184) ;; from (anon-function 1 basebutton) (unknown-int20 int32 :offset 2188) ;; from logic-target::target-compute-pole + (unknown-float121 float :offset 2188) ;; from target::mod-var-jump + (unknown-float123 float :offset 2200) ;; from target::mod-var-jump (unknown-vector102 vector :inline :offset 2224) ;; from (anon-function 3 basebutton) (unknown-vector103 vector :inline :offset 2240) ;; from (anon-function 3 basebutton) + (unknown-quaternion02 quaternion :inline :offset 2256) ;; from racer-states::(code target-racing-get-on) + (unknown-quaternion03 quaternion :inline :offset 2272) ;; from racer-states::(code target-racing-get-on) (unknown-smush00 smush-control :inline :offset 2288) ;; from (event target-fishing) (unknown-vector110 vector :inline :offset 2320) ;; from logic-target::flag-setup (unknown-vector111 vector :inline :offset 2336) ;; from logic-target::flag-setup diff --git a/goal_src/engine/target/pat-h.gc b/goal_src/engine/target/pat-h.gc index 5e97b0dd92..3949e8daf5 100644 --- a/goal_src/engine/target/pat-h.gc +++ b/goal_src/engine/target/pat-h.gc @@ -63,6 +63,7 @@ (nocamera uint8 :offset 1 :size 1) (noedge uint8 :offset 2 :size 1) (nolineofsight uint8 :offset 12 :size 1) + (unknown-bit uint8 :offset 15 :size 1) ) :method-count-assert 9 :size-assert #x4 diff --git a/goal_src/engine/target/target-h.gc b/goal_src/engine/target/target-h.gc index e3fd23f21a..199f889a98 100644 --- a/goal_src/engine/target/target-h.gc +++ b/goal_src/engine/target/target-h.gc @@ -26,6 +26,9 @@ ;; TODO - for logic-target - defined in target-death (define-extern target-continue (state continue-point none)) (define-extern target-periscope (state target)) +(define-extern mod-var-jump (function symbol symbol symbol vector vector :behavior target)) +(define-extern init-var-jump (function float float vector vector vector vector :behavior target)) ;; 1st and 2nd vectors may be symbols instead? +(define-extern target-standard-event-handler function) (declare-type sidekick basic) (declare-type collide-cache basic) @@ -89,6 +92,24 @@ (:methods (dummy-20 (_type_ collide-cache) none 20) ) + + (:states + (target-racing-get-off handle) + (target-racing-jump float float symbol) + (target-racing-hit handle attack-info) + (target-racing-grab) + (target-racing-clone-anim handle) + (target-racing-get-on handle) + (target-racing-falling) + (target-racing-bounce float float symbol) + (target-racing-death symbol) + (target-racing-get-off-jump handle) + (target-racing-get-off-hit-ground symbol) + + (target-death) + (target-hit-ground symbol) + (target-clone-anim) + ) ) (define-perm *target* target #f) @@ -106,3 +127,4 @@ ) (define-perm *sidekick* sidekick #f) +(define-extern target-attacked (function symbol uint uint process (state target) object :behavior target)) ;; unconfirmed, target-tube::(event target-tube-start) \ No newline at end of file diff --git a/goal_src/engine/target/target-util.gc b/goal_src/engine/target/target-util.gc index 4b3912f311..47b81950e8 100644 --- a/goal_src/engine/target/target-util.gc +++ b/goal_src/engine/target/target-util.gc @@ -1188,7 +1188,7 @@ ) ) -(defun target-timed-invulnerable ((arg0 uint64) (arg1 target)) +(defun target-timed-invulnerable ((arg0 uint) (arg1 target)) (logior! (-> arg1 state-flags) 32) (set! (-> arg1 control unknown-dword70) (-> *display* base-frame-counter)) (set! (-> arg1 control unknown-dword71) (the-as int arg0)) diff --git a/goal_src/game.gp b/goal_src/game.gp index 9a99f63929..1151b10395 100644 --- a/goal_src/game.gp +++ b/goal_src/game.gp @@ -214,6 +214,7 @@ "out/iso/VI3.DGO" "out/iso/TRA.DGO" "out/iso/FIN.DGO" + "out/iso/FIC.DGO" ) ;;;;;;;;;;;;;;;;;;;;;;;; @@ -225,6 +226,9 @@ (copy-gos "warpgate-ag" "sharkey-ag-BEA-TRA-VI2" + "eichar-racer+0-ag" + + "babak-ag" ) @@ -240,6 +244,15 @@ "village_common/villagep-obs.gc" "village_common/oracle.gc" + "common/blocking-plane.gc" + + "racer_common/target-racer-h-FIC-LAV-MIS-OGR-ROL.gc" + "racer_common/racer-part.gc" + "racer_common/racer.gc" + "racer_common/target-racer-FIC-LAV-MIS-OGR-ROL.gc" + "racer_common/racer-states-FIC-LAV-MIS-OGR-ROL.gc" + "racer_common/collide-reaction-racer.gc" + ) @@ -314,6 +327,39 @@ "village1-vis" ) +;;;;;;;;;;;;;;;;;;;;; +;; Fire Canyon +;;;;;;;;;;;;;;;;;;;;; + +(cgo "FIC.DGO" + "fic.gd" + ) + +(copy-textures 1119) ;; might be common/zoomer hud?? + +(goal-src-sequence + "levels/firecanyon/" + :deps ;; no idea what these depend on, make it depend on the whole engine + ("out/obj/default-menu.o") + + "firecanyon-part.gc" + "assistant-firecanyon.gc" + "firecanyon-obs.gc" + + ) + +(copy-textures 815 822 854 1123) + +(copy-gos + "assistant-firecanyon-ag" + "balloon-ag" + "crate-darkeco-cluster-ag-FIC" + "ecovalve-ag-FIC-OGR" + "ef-plane-ag-FIC-LAV-OGR-ROL-SNO-SWA" + "racer-ag-FIC-ROL" + "spike-ag" + "firecanyon-vis") + ;;;;;;;;;;;;;;;;;;;;; ;; Training ;;;;;;;;;;;;;;;;;;;;; diff --git a/goal_src/levels/racer_common/racer-states-FIC-LAV-MIS-OGR-ROL.gc b/goal_src/levels/racer_common/racer-states-FIC-LAV-MIS-OGR-ROL.gc index f7e8eb1cd1..2be2ff3e76 100644 --- a/goal_src/levels/racer_common/racer-states-FIC-LAV-MIS-OGR-ROL.gc +++ b/goal_src/levels/racer_common/racer-states-FIC-LAV-MIS-OGR-ROL.gc @@ -5,3 +5,3197 @@ ;; name in dgo: racer-states ;; dgos: FIC, LAV, MIS, OGR, ROL +(define-extern *race-track-surface* surface) + +;; DECOMP BEGINS + +;; failed to figure out what this is: +(defstate target-racing-start (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (cond + ((and (= arg2 'query) (= (-> arg3 param 0) 'mode)) + 'racer + ) + ((and (= arg2 'get-pickup) (= (-> arg3 param 0) 3)) + (if + (>= + (- + (-> *display* base-frame-counter) + (the-as int (-> self racer boost-time)) + ) + 300 + ) + (send-event + self + 'boost + (fmax 1.0 (fmin 2.0 (the-as float (-> arg3 param 1)))) + ) + ) + ) + (else + (case arg2 + (('end-mode) + (go target-racing-get-off (process->handle arg0)) + ) + (('touched) + (send-event arg0 'attack (-> arg3 param 0) 'racer 0 0) + (when + (and + (type-type? (-> arg0 type) babak) + (< 40960.0 (-> self control unknown-float01)) + ) + (let + ((f0-5 + (lerp-scale + 16384.0 + 32768.0 + (-> self control unknown-float01) + 40960.0 + (-> self racer transv-max) + ) + ) + ) + (go target-racing-jump f0-5 f0-5 #f) + ) + ) + ) + (('attack 'attack-or-shove 'attack-invinc) + (let ((v1-27 (the-as attack-info (-> arg3 param 1)))) + (if + (not + (and + (logtest? (-> v1-27 mask) 32) + (or (= (-> v1-27 mode) 'burn) (= (-> v1-27 mode) 'burnup)) + ) + ) + (target-attacked + arg2 + (-> arg3 param 1) + (the-as uint arg0) + (the-as process (-> arg3 param 0)) + (the-as (state target) target-racing-hit) + ) + ) + ) + ) + (('heat) + (let + ((f0-7 + (fmax + 0.0 + (fmin + (+ (-> self racer heat) (the-as float (-> arg3 param 0))) + (-> *RACER-bank* heat-max) + ) + ) + ) + ) + (set! (-> self racer heat) f0-7) + f0-7 + ) + ) + (('boost) + (sound-play-by-name + (static-sound-name "get-blue-eco") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + (set! + (-> self racer boost-sound-id) + (sound-play-by-name + (static-sound-name "zoom-boost") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + ) + (set! + (-> self racer boost-time) + (the-as uint (-> *display* base-frame-counter)) + ) + (let + ((f0-12 + (seek + (-> self racer boost-level) + (-> *RACER-bank* boost-level-max) + (* + (-> *RACER-bank* boost-level-inc) + (the-as float (-> arg3 param 0)) + ) + ) + ) + ) + (set! (-> self racer boost-level) f0-12) + f0-12 + ) + ) + (('smack) + (go target-racing-smack (-> self control unknown-float01) #t) + ) + (('jump) + (go + target-racing-jump + (the-as float (-> arg3 param 0)) + (the-as float (-> arg3 param 1)) + #f + ) + ) + (('change-mode) + (case (-> arg3 param 0) + (('grab) + (go target-racing-grab) + ) + ) + ) + (('clone-anim) + (go + target-racing-clone-anim + (process->handle (the-as process (-> arg3 param 0))) + ) + ) + (else + (target-generic-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + ) + :exit + (behavior () + (when + (not + (or + (= (-> self next-state name) 'target-racing) + (= (-> self next-state name) 'target-racing-jump) + (= (-> self next-state name) 'target-racing-bounce) + (= (-> self next-state name) 'target-racing-hit) + (= (-> self next-state name) 'target-racing-death) + (= (-> self next-state name) 'target-racing-smack) + (= (-> self next-state name) 'target-racing-falling) + (= (-> self next-state name) 'target-racing-get-on) + (= (-> self next-state name) 'target-racing-get-off) + (= (-> self next-state name) 'target-racing-get-off-jump) + (= (-> self next-state name) 'target-racing-grab) + (= (-> self next-state name) 'target-racing-clone-anim) + ) + ) + (let ((v1-25 (-> self manipy))) + (when v1-25 + (deactivate (-> v1-25 0)) + (set! (-> self manipy) (the-as (pointer manipy) #f)) + ) + ) + (let ((v1-29 (-> *hud-parts* bike-speed))) + (when v1-29 + (set! (-> v1-29 0 deactivate-when-hidden) #t) + (send-event (ppointer->process v1-29) 'hide-quick) + ) + ) + (let ((v1-32 (-> *hud-parts* bike-heat))) + (when v1-32 + (set! (-> v1-32 0 deactivate-when-hidden) #t) + (send-event (ppointer->process v1-32) 'hide-quick) + ) + ) + (set! (-> *hud-parts* buzzers 0 next-y-offset) 0) + (set! (-> *hud-parts* power 0 next-y-offset) 0) + (set! (-> *hud-parts* buzzers 0 y-sgn) 1) + (set! (-> *hud-parts* power 0 y-sgn) 1) + (set! + (-> self control root-prim prim-core action) + (logand -66049 (-> self control root-prim prim-core action)) + ) + (set! (-> self control unknown-surface00) *walk-mods*) + (set! (-> self state-flags) (logand -1025 (-> self state-flags))) + (send-event *camera* 'clear-slave-option #x6000) + (set! + (-> self control dynam gravity-max) + (-> self control unknown-dynamics00 gravity-max) + ) + (set! + (-> self control dynam gravity-length) + (-> self control unknown-dynamics00 gravity-length) + ) + (let ((v1-60 (-> self node-list data))) + (set! (-> v1-60 0 param0) cspace<-transformq+trans!) + (set! (-> v1-60 0 param1) (the-as basic (-> self control trans))) + (set! + (-> v1-60 0 param2) + (the-as basic (-> self control unknown-vector12)) + ) + ) + (target-collide-set! 'normal 0.0) + (set! (-> self control reaction) target-collision-reaction) + (sound-stop (-> self racer engine-sound-id)) + (set! (-> self racer engine-sound-id) (new 'static 'sound-id)) + (set! (-> self control unknown-vector12 quad) (the-as uint128 0)) + (clear-pending-settings-from-process *setting-control* self 'sound-flava) + (target-exit) + ) + (none) + ) + :code + (behavior ((arg0 handle)) + (target-exit) + (set! *display-profile* #f) + (set! *display-entity-errors* #f) + (set-setting! *setting-control* self 'sound-flava #f 30.0 1) + (if (zero? (-> self racer)) + (set! (-> self racer) (new 'process 'racer-info)) + ) + (set! (-> self racer turn-anim-targ) 0.0) + (set! (-> self racer turn-anim-frame) 0.0) + (set! (-> self racer turn-anim-vel) 0.0) + (set! (-> self racer tail-anim-vel) 0.0) + (set! (-> self racer tail-anim-frame) 0.0) + (set! (-> self racer rudd-anim-vel) 0.0) + (set! (-> self racer rudd-anim-frame) 0.0) + (set! (-> self racer stick-lock) #f) + (set! (-> self racer stick-off) #f) + (set! (-> self racer heavy) #f) + (set! (-> self racer unstuck-time) (-> *display* base-frame-counter)) + (set! (-> self racer stuck-count) 0) + (set! (-> self racer cushion-base) 10240.0) + (set! (-> self racer shock-offset) 0.0) + (set! (-> self racer shock-offsetv) 0.0) + (set! (-> self racer shock-rotx) 0.0) + (set! (-> self racer engine-sound-id) (new 'static 'sound-id)) + (set! (-> self racer boost-sound-id) (new 'static 'sound-id)) + (set! (-> self racer scrape-sound-id) (new-sound-id)) + (set! (-> self racer entity) #f) + (let ((v1-28 (handle->process arg0))) + (if v1-28 + (set! (-> self racer entity) (the-as entity-actor (-> v1-28 entity))) + ) + ) + (set! (-> self control surf) *race-track-surface*) + (set! (-> self control reaction) racer-collision-reaction) + (vector-reset! (-> self racer rot)) + (set! (-> self racer rot y) (y-angle (-> self control))) + (target-collide-set! 'racer 0.0) + (set! (-> self control transv quad) (the-as uint128 0)) + (set! (-> self control unknown-float01) 0.0) + (logior! (-> self control root-prim prim-core action) 512) + (set! (-> self control unknown-surface00) *racer-mods*) + (set! (-> self racer lean-rotx) 0.0) + (vector-reset! (-> self racer rotv)) + (quaternion-identity! (the-as quaternion (-> self racer surface-quat))) + (quaternion-identity! + (the-as quaternion (-> self racer surface-quat-smooth)) + ) + (set! (-> self racer front-rot) (-> *RACER-bank* default-front-blade)) + (set! (-> self racer front-rotv) 0.0) + (set! (-> self racer bottom-rot) 0.0) + (let ((v1-56 (-> self node-list data))) + (set! (-> v1-56 0 param0) cspace<-transformq+world-trans!) + (set! (-> v1-56 0 param1) (the-as basic (-> self control trans))) + (set! (-> v1-56 0 param2) (the-as basic (-> self control unknown-vector12))) + ) + (set! (-> self control unknown-float81) 1.0) + (set! (-> self racer hop?) #f) + (set! (-> self racer bounce) 0) + (set! (-> self racer bounce-hit) 0.0) + (set! (-> self racer bob-period) 900.0) + (set! (-> self racer bob-mult-rot) 0.0) + (set! (-> self racer bob-mult-trans) 0.0) + (set! (-> self racer bob-meta-timer) 0.0) + (set! (-> self racer bob-meta-meta-timer) 0.0) + (set! (-> self racer bob-hit-ground-time) (the-as uint 0)) + (set! (-> self racer cushion-bob) 0.0) + (set! (-> self racer cushion-bob-old) 0.0) + (set! (-> self racer hill-value) 0.0) + (set! (-> self racer hill-ground-value) 0.0) + (set! (-> self racer hill-offset) 0.0) + (set! (-> self racer hill-boost) 0.0) + (set! (-> self racer cur-rotx) 0.0) + (set! (-> self racer targ-rotx) 0.0) + (set! (-> self racer hill-rotx) 0.0) + (set! (-> self racer mult-rotx) 0.0) + (set! (-> self racer speed-rotx) 0.25) + (set! (-> self racer boost-curve) 0.0) + (set! (-> self racer boost-level) 0.0) + (set! (-> self racer boost-target) 0.0) + (set! (-> self racer boost-output) 0.0) + (set! (-> self racer boost-time) (the-as uint 0)) + (set! + (-> self racer boost-duration) + (the-as uint (-> *RACER-bank* boost-duration)) + ) + (set! (-> self racer heat) 0.0) + (set! (-> self racer slide-mode) 0) + (set! (-> self racer slide-amp) 0.0) + (set! (-> self racer slide-down-time 0) (the-as uint 0)) + (set! (-> self racer slide-down-time 1) (the-as uint 0)) + (set! (-> self racer slide-interp) 0.0) + (set! (-> self racer surface-y) (-> self control trans y)) + (let ((s5-0 (-> self entity))) + (set! (-> self entity) (-> self racer entity)) + (let ((s4-0 (get-process *8k-dead-pool* manipy #x4000))) + (set! (-> self manipy) (the-as (pointer manipy) (when s4-0 + (let + ((t9-9 + (method-of-type + manipy + activate + ) + ) + ) + (t9-9 + (the-as manipy s4-0) + self + 'manipy + (the-as + pointer + #x70004000 + ) + ) + ) + (run-now-in-process + s4-0 + manipy-init + (-> self control trans) + (-> self entity) + *racer-sg* + #f + ) + (-> s4-0 ppointer) + ) + ) + ) + ) + (set! (-> self entity) s5-0) + ) + (when (-> self manipy) + (send-event + (ppointer->process (-> self manipy)) + 'trans-hook + (lambda :behavior manipy + () + (let ((v1-0 (ppointer->process (-> self parent)))) + (set! + (-> self root trans quad) + (-> (the-as target v1-0) racer bike-trans quad) + ) + (let ((a0-4 (-> (the-as target v1-0) racer bike-quat quad))) + (set! (-> self root quat vec quad) a0-4) + ) + (set! + (-> self root scale quad) + (-> (the-as target v1-0) racer bike-scale quad) + ) + (set! (-> self draw light-index) (the-as uint 255)) + (let ((a0-9 (-> (the-as target v1-0) draw color-mult quad))) + (set! (-> self draw color-mult quad) a0-9) + ) + (let ((a0-11 (-> (the-as target v1-0) draw color-emissive quad))) + (set! (-> self draw color-emissive quad) a0-11) + ) + (let ((f0-0 (-> (the-as target v1-0) draw secondary-interp))) + (set! (-> self draw secondary-interp) f0-0) + f0-0 + ) + ) + ) + ) + (send-event (ppointer->process (-> self manipy)) 'anim-mode 'loop) + (send-event + (ppointer->process (-> self manipy)) + 'art-joint-anim + "racer-get-on" + 0.0 + ) + (send-event + (ppointer->process (-> self manipy)) + 'eval + (lambda :behavior manipy + () + (set! (-> self clone-copy-trans) #f) + (let ((v1-1 (-> *target-shadow-control* settings shadow-dir quad))) + (set! (-> *racer-shadow-control* settings shadow-dir quad) v1-1) + ) + (set! (-> self draw shadow-ctrl) *racer-shadow-control*) + (let ((gp-0 (-> self parent))) + (set! + (-> (the-as target (-> gp-0 0)) racer front-blade) + (new 'process 'joint-mod (joint-mod-handler-mode rotate) self 4) + ) + (set! + (-> (the-as target (-> gp-0 0)) racer bottom-blade) + (new 'process 'joint-mod (joint-mod-handler-mode rotate) self 10) + ) + (let + ((v0-2 (new 'process 'joint-mod (joint-mod-handler-mode rotate) self 7)) + ) + (set! (-> (the-as target (-> gp-0 0)) racer tail) v0-2) + v0-2 + ) + ) + ) + ) + ) + (set-twist! + (-> self racer front-blade) + (the-as float #f) + (- (-> self racer front-rot)) + (the-as float #f) + ) + (set-twist! + (-> self racer bottom-blade) + (the-as float #f) + (the-as float #f) + (- (-> self racer bottom-rot)) + ) + (remove-exit) + (go target-racing-get-on arg0) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; definition for function target-racing-smack-check +;; INFO: Return type mismatch object vs none. +;; Used lq/sq +(defbehavior target-racing-smack-check target () + (if + (and + (< 20480.0 (-> self control unknown-float01)) + (and + (logtest? (-> self control status) 8) + (< (-> self control surface-angle) 0.5) + (let + ((gp-1 + (vector-! + (new 'stack-no-clear 'vector) + (-> self control unknown-vector70) + (-> self control trans) + ) + ) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> s5-0 quad) (-> self control unknown-vector10 quad)) + (set! (-> gp-1 y) 0.0) + (set! (-> s5-0 y) 0.0) + (vector-xz-normalize! gp-1 1.0) + (vector-xz-normalize! s5-0 1.0) + (< 0.87 (vector-dot gp-1 s5-0)) + ) + ) + ) + (go target-racing-smack (-> self control unknown-float01) #t) + ) + (none) + ) + +;; failed to figure out what this is: +(defstate target-racing (target) + :event + (-> target-racing-start event) + :enter + (behavior () + (set! (-> self control unknown-surface00) *racer-mods*) + (none) + ) + :exit + (behavior () + (target-racing-center-anim) + ((-> target-racing-start exit)) + (none) + ) + :trans + (behavior () + (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 l1 r1) + ) + (or + (< + (- (-> *display* base-frame-counter) (-> self control unknown-dword10)) + 30 + ) + (< + (vector-dot + (-> self control dynam gravity-normal) + (vector-! + (new 'stack-no-clear 'vector) + (-> self control trans) + (-> self control shadow-pos) + ) + ) + 4096.0 + ) + ) + ) + (go target-racing-jump 2048.0 5324.8 #t) + ) + (target-racing-smack-check) + (let* ((f30-0 (target-height-above-ground)) + (v1-28 + (time-to-ground + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + (-> self control dynam gravity-length) + f30-0 + ) + ) + ) + (if + (and + (zero? (logand (-> self control status) 1)) + (or + (>= + (- (-> *display* base-frame-counter) (-> self control unknown-dword10)) + (the-as int (* (-> *TARGET-bank* ground-timeout) 2)) + ) + (< 75 v1-28) + ) + (< 30 v1-28) + (< 4096.0 f30-0) + ) + (go target-racing-falling) + ) + ) + (set! (-> self racer turn-anim-targ) (* 20.0 (-> self racer mod-x))) + (racer-buzz (+ 0.45 (* 1.7 (fabs (-> self racer slide-shift-x))))) + (none) + ) + :code + (behavior () + (cond + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 138) + ) + (let ((a0-4 (-> self skel root-channel 0))) + (set! + (-> a0-4 param 0) + (the float (+ (-> a0-4 frame-group data 0 length) -1)) + ) + (set! (-> a0-4 param 1) 1.0) + (joint-control-channel-group! + a0-4 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + ) + ((let ((v1-16 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (or + (= v1-16 (-> self draw art-group data 130)) + (= v1-16 (-> self draw art-group data 131)) + ) + (> (-> self racer bounce) 0) + ) + ) + (let ((s5-0 #f) + (gp-0 #f) + ) + (when + (and + (< (fabs (-> self racer bob-mult-trans)) 0.2) + (and + (>= + (- + (-> *display* base-frame-counter) + (the-as int (-> self racer racing-time)) + ) + 45 + ) + (< 16384.0 (-> self control ground-impact-vel)) + ) + ) + (when (>= (-> self control unknown-float01) 40960.0) + (set! (-> *part-id-table* 2225 init-specs 1 initial-valuef) 100.0) + (sp-launch-particles-var + *sp-particle-system-2d* + (-> *part-id-table* 2225) + (-> self control trans) + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + (target-land-effect) + (when + (and + (>= (-> self control ground-impact-vel) 61440.0) + (zero? (-> self racer bounce)) + ) + (set! (-> self racer bounce) 0) + (set! (-> self racer bounce-hit) (-> self control ground-impact-vel)) + ) + (when (< (-> self racer bounce-hit) 73728.0) + (set! (-> self racer bounce) 0) + 0 + ) + (set! (-> self racer bob-timer) 90.0) + (let + ((f0-14 + (lerp-scale + 2.0 + 3.0 + (-> self control unknown-float01) + 0.0 + (-> self racer transv-max) + ) + ) + ) + (set! (-> self racer bob-meta-meta-timer) f0-14) + (set! (-> self racer bob-meta-timer) f0-14) + ) + (set! + (-> self racer bob-mult-trans) + (lerp-scale 0.2 2.5 (-> self control ground-impact-vel) 20480.0 81920.0) + ) + (set! + (-> self racer bob-hit-ground-time) + (the-as uint (-> *display* base-frame-counter)) + ) + (set! + (-> self racer bob-meta-time) + (the-as uint (-> *display* base-frame-counter)) + ) + (cond + ((or + s5-0 + (and (>= (-> self racer bounce) 1) (< (-> self racer bounce) 2)) + ) + (+! (-> self racer bounce) 1) + (let* ((v1-73 (-> self racer bounce)) + (a1-6 (cond + ((= v1-73 1) + (lerp-scale + 4096.0 + 8192.0 + (-> self racer bounce-hit) + 61440.0 + 81920.0 + ) + ) + ((= v1-73 2) + 2048.0 + ) + ) + ) + ) + (go target-racing-bounce a1-6 a1-6 gp-0) + ) + ) + ((>= (-> self racer slide-mode) 0) + ) + (else + (target-racing-land-anim gp-0) + ) + ) + ) + ) + ) + ) + (when (!= (-> self racer slide-shift-x) 0.0) + (if (rand-vu-percent? 0.5) + (sound-play-by-name + (static-sound-name "zoomer-rev1") + (new-sound-id) + 819 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + (sound-play-by-name + (static-sound-name "zoomer-rev2") + (new-sound-id) + 819 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + ) + ) + (set! (-> self racer bounce) 0) + (while #t + (let ((gp-3 (-> *display* base-frame-counter))) + (when (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 123) + ) + ) + (ja-channel-push! 4 30) + (let ((s5-3 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + s5-3 + (the-as art-joint-anim (-> self draw art-group data 123)) + num-func-identity + ) + (set! (-> s5-3 frame-num) (ja-aframe (-> self racer turn-anim-frame) 0)) + ) + (let ((a0-43 (-> self skel root-channel 1))) + (set! + (-> a0-43 frame-group) + (the-as art-joint-anim (-> self draw art-group data 124)) + ) + (set! (-> a0-43 param 0) 0.0) + (joint-control-channel-group-eval! + a0-43 + (the-as art-joint-anim (-> self draw art-group data 124)) + num-func-chan + ) + ) + (let ((a0-44 (-> self skel root-channel 2))) + (set! + (-> a0-44 frame-group) + (the-as art-joint-anim (-> self draw art-group data 125)) + ) + (set! (-> a0-44 param 0) 0.0) + (joint-control-channel-group-eval! + a0-44 + (the-as art-joint-anim (-> self draw art-group data 125)) + num-func-chan + ) + ) + (let ((a0-45 (-> self skel root-channel 3))) + (set! + (-> a0-45 frame-group) + (the-as art-joint-anim (-> self draw art-group data 126)) + ) + (set! (-> a0-45 param 0) 0.0) + (joint-control-channel-group-eval! + a0-45 + (the-as art-joint-anim (-> self draw art-group data 126)) + num-func-chan + ) + ) + ) + (while (< (- (-> *display* base-frame-counter) gp-3) 300) + (if + (or + (!= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (or + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons l1 r1 x) + ) + (>= (fabs (-> self racer turn-anim-frame)) 1.0) + ) + ) + (set! gp-3 (-> *display* base-frame-counter)) + ) + (target-racing-turn-anim) + (suspend) + ) + ) + (when (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 133) + ) + ) + (ja-channel-push! 1 120) + (let ((gp-4 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-4 + (the-as art-joint-anim (-> self draw art-group data 133)) + num-func-identity + ) + (set! (-> gp-4 frame-num) 0.0) + ) + ) + (while + (not + (or + (!= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (or + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons l1 r1 x) + ) + (>= (fabs (-> self racer turn-anim-frame)) 1.0) + ) + ) + ) + (suspend) + (let ((a0-54 (-> self skel root-channel 0))) + (set! (-> a0-54 param 0) 1.0) + (joint-control-channel-group-eval! + a0-54 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + ) + ) + (none) + ) + :post + (behavior () + (if (= (-> self next-state name) 'target-racing) + (set! + (-> self racer racing-time) + (the-as uint (-> *display* base-frame-counter)) + ) + ) + (target-racing-post) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate target-racing-jump (target) + :event + (-> target-racing-start event) + :enter + (behavior ((arg0 float) (arg1 float) (arg2 symbol)) + (set! (-> self racer shock-offsetv) 0.0) + (sound-play-by-name + (static-sound-name "zoomer-jump") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (when arg2 + (when (>= (-> self racer hill-ground-value) 0.11) + (set! + (-> self racer hill-boost) + (* 40960.0 (-> self racer hill-ground-value)) + ) + (vector-normalize! + (-> self control transv) + (+ (-> self control unknown-float01) (-> self racer hill-boost)) + ) + ) + ) + (if + (and + (logtest? (-> self control status) 1) + (< 16384.0 (-> self control transv y)) + ) + (set! (-> self racer hop?) #f) + (set! (-> self racer hop?) arg2) + ) + (set! (-> self racer hop-start-y) (-> self control trans y)) + (racer-calc-gravity) + (init-var-jump + arg0 + arg1 + (the-as vector #t) + (the-as vector #f) + (-> self control transv) + ) + (set! (-> self control status) (logand -8 (-> self control status))) + (set! (-> self control unknown-surface00) *racer-air-mods*) + (set! + (-> self control unknown-float123) + (fmax + 0.0 + (fmin 1.0 (* 0.00004359654 (+ -11468.8 (-> self control unknown-float01)))) + ) + ) + (if (< (-> self racer slide-mode) 0) + (set! + (-> self racer slide-down-time 0) + (the-as + uint + (if + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons l1 r1) + ) + (-> *display* base-frame-counter) + 0 + ) + ) + ) + ) + (none) + ) + :exit + (behavior () + (set! + (-> self control root-prim prim-core action) + (logand -32769 (-> self control root-prim prim-core action)) + ) + (set! (-> self racer hop?) #f) + ((-> target-racing-start exit)) + (none) + ) + :trans + (behavior () + (set! + (-> self control unknown-float123) + (fmax + (-> self control unknown-float123) + (* + 0.003921569 + (the + float + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + abutton + 6 + ) + ) + ) + ) + ) + (cond + ((logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons l1 r1) + ) + (set! + (-> self racer slide-down-time 0) + (the-as uint (-> *display* base-frame-counter)) + ) + ) + ((zero? + (logand + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons l1 r1) + ) + ) + (set! (-> self racer slide-down-time 0) (the-as uint 0)) + 0 + ) + ((and + (>= + (- + (-> *display* base-frame-counter) + (the-as int (-> self racer slide-down-time 0)) + ) + (the-as int (-> *RACER-bank* slide-hold-time)) + ) + (< (-> self racer slide-mode) 0) + (or + (< + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + leftx + ) + (the-as uint 64) + ) + (< + (the-as uint 192) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + leftx + ) + ) + ) + ) + (set! + (-> self racer slide-mode) + (if + (< + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + leftx + ) + (the-as uint 64) + ) + 0 + 1 + ) + ) + (set! + (-> self racer slide-enter-time) + (the-as uint (-> *display* base-frame-counter)) + ) + (set! (-> self racer slide-amp) 1.0) + (set! (-> self racer slide-grip-mult) 0.0) + ) + ((>= (-> self racer slide-mode) 0) + (cond + ((< + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + leftx + ) + (the-as uint 64) + ) + (set! (-> self racer slide-mode) 0) + 0 + ) + ((< + (the-as uint 192) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + leftx + ) + ) + (set! (-> self racer slide-mode) 1) + ) + ) + ) + ) + (if + (and + (logtest? (-> self control status) 1) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 30) + ) + (go target-racing) + ) + (if + (or + (< (-> self control trans y) (-> self racer hop-start-y)) + (< + 10240.0 + (vector-dot + (-> self control dynam gravity-normal) + (vector-! + (new 'stack-no-clear 'vector) + (-> self control trans) + (-> self control shadow-pos) + ) + ) + ) + ) + (set! (-> self racer hop?) #f) + ) + (target-racing-smack-check) + (if (>= (- (-> *display* base-frame-counter) (-> self state-time)) 300) + (logior! (-> self control root-prim prim-core action) #x8000) + ) + (mod-var-jump + #t + #t + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons l1 r1) + ) + (-> self control transv) + ) + (set! (-> self racer shock-offset) (* 0.8 (-> self racer shock-offset))) + (racer-buzz 0.4) + (none) + ) + :code + (behavior ((arg0 float) (arg1 float) (arg2 symbol)) + (let ((a0-1 (if (< 0.1 (-> self racer hill-value)) + 'jump + ) + ) + ) + (target-racing-jump-anim a0-1 60) + ) + (none) + ) + :post + (-> target-racing post) + ) + +;; failed to figure out what this is: +(defstate target-racing-bounce (target) + :event + (-> target-racing-start event) + :enter + (behavior ((arg0 float) (arg1 float) (arg2 symbol)) + (logior! (-> self control root-prim prim-core action) #x8000) + (sound-play-by-name + (static-sound-name "zoomer-jump") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (racer-calc-gravity) + (init-var-jump + arg0 + arg1 + (the-as vector #t) + (the-as vector #f) + (-> self control transv) + ) + (set! (-> self control status) (logand -8 (-> self control status))) + (set! + (-> self control unknown-float123) + (fmax + 0.0 + (fmin 1.0 (* 0.00004359654 (+ -11468.8 (-> self control unknown-float01)))) + ) + ) + (none) + ) + :exit + (behavior () + (set! + (-> self control root-prim prim-core action) + (logand -32769 (-> self control root-prim prim-core action)) + ) + ((-> target-racing-start exit)) + (none) + ) + :trans + (behavior () + (set! + (-> self control unknown-float123) + (fmax + (-> self control unknown-float123) + (* + 0.003921569 + (the + float + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + abutton + 6 + ) + ) + ) + ) + ) + (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 l1 r1) + ) + (or + (< + (- (-> *display* base-frame-counter) (-> self control unknown-dword10)) + 60 + ) + (< + (vector-dot + (-> self control dynam gravity-normal) + (vector-! + (new 'stack-no-clear 'vector) + (-> self control trans) + (-> self control shadow-pos) + ) + ) + 8192.0 + ) + ) + ) + (go target-racing-jump 2048.0 5324.8 #t) + ) + (if + (and + (logtest? (-> self control status) 1) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 30) + ) + (go target-racing) + ) + (mod-var-jump + #t + #t + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons l1 r1) + ) + (-> self control transv) + ) + (target-racing-smack-check) + (racer-buzz 0.4) + (none) + ) + :code + (behavior ((arg0 float) (arg1 float) (arg2 symbol)) + (target-racing-land-anim arg2) + (when (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 123) + ) + ) + (ja-channel-push! 4 30) + (let ((gp-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 123)) + num-func-identity + ) + (set! (-> gp-0 frame-num) (ja-aframe (-> self racer turn-anim-frame) 0)) + ) + (let ((a0-9 (-> self skel root-channel 1))) + (set! + (-> a0-9 frame-group) + (the-as art-joint-anim (-> self draw art-group data 124)) + ) + (set! (-> a0-9 param 0) 0.0) + (joint-control-channel-group-eval! + a0-9 + (the-as art-joint-anim (-> self draw art-group data 124)) + num-func-chan + ) + ) + (let ((a0-10 (-> self skel root-channel 2))) + (set! + (-> a0-10 frame-group) + (the-as art-joint-anim (-> self draw art-group data 125)) + ) + (set! (-> a0-10 param 0) 0.0) + (joint-control-channel-group-eval! + a0-10 + (the-as art-joint-anim (-> self draw art-group data 125)) + num-func-chan + ) + ) + (let ((a0-11 (-> self skel root-channel 3))) + (set! + (-> a0-11 frame-group) + (the-as art-joint-anim (-> self draw art-group data 126)) + ) + (set! (-> a0-11 param 0) 0.0) + (joint-control-channel-group-eval! + a0-11 + (the-as art-joint-anim (-> self draw art-group data 126)) + num-func-chan + ) + ) + ) + (while #t + (target-racing-turn-anim) + (suspend) + ) + (none) + ) + :post + (-> target-racing post) + ) + +;; failed to figure out what this is: +(defstate target-racing-smack (target) + :event + (-> target-racing-start event) + :enter + (behavior ((arg0 float) (arg1 symbol)) + (sound-play-by-name + (static-sound-name "smack-surface") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 150) + (set! (-> self racer heavy) arg1) + (vector-! + (-> self control transv) + (-> self control unknown-vector70) + (-> self control trans) + ) + (let ((f0-0 (lerp-scale 0.0 -61440.0 arg0 0.0 163840.0))) + (if + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons x) + ) + (set! f0-0 (* 2.0 f0-0)) + ) + (vector-normalize! (-> self control transv) f0-0) + ) + (set! (-> self racer boost-curve) 0.0) + (set! (-> self racer boost-level) 0.0) + (set! (-> self racer boost-target) 0.0) + (set! (-> self racer boost-output) 0.0) + (set! (-> self racer boost-time) (the-as uint 0)) + 0 + (none) + ) + :exit + (behavior () + (set! (-> self racer heavy) #f) + ((-> target-racing-start exit)) + (none) + ) + :trans + (behavior () + (set! (-> self racer turn-anim-targ) 0.0) + (none) + ) + :code + (behavior ((arg0 float) (arg1 symbol)) + (sound-play-by-name + (static-sound-name "zoomer-crash-2") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + (ja-channel-push! 2 15) + (let ((a0-4 (-> self skel root-channel 0))) + (set! + (-> a0-4 frame-group) + (the-as art-joint-anim (-> self draw art-group data 136)) + ) + (set! + (-> a0-4 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 136)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-4 param 1) 1.0) + (joint-control-channel-group! + a0-4 + (the-as art-joint-anim (-> self draw art-group data 136)) + num-func-seek! + ) + ) + (let ((s5-1 (-> self skel root-channel 1))) + (set! (-> s5-1 frame-interp) (lerp-scale 1.0 0.25 arg0 0.0 122880.0)) + (joint-control-channel-group-eval! + s5-1 + (the-as art-joint-anim (-> self draw art-group data 122)) + num-func-identity + ) + (set! (-> s5-1 frame-num) (ja-aframe 0.0 0)) + ) + (until (ja-done? 0) + (suspend) + (let ((s5-2 (-> self skel root-channel 0))) + (set! + (-> s5-2 param 0) + (the float (+ (-> s5-2 frame-group data 0 length) -1)) + ) + (set! (-> s5-2 param 1) (lerp-scale 2.0 1.0 arg0 0.0 163840.0)) + (joint-control-channel-group-eval! + s5-2 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (go target-racing) + (none) + ) + :post + (-> target-racing post) + ) + +;; failed to figure out what this is: +(defstate target-racing-falling (target) + :event + (-> target-racing-start event) + :enter + (behavior () + (set! (-> self control unknown-surface00) *racer-air-mods*) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (none) + ) + :exit + (behavior () + (set! + (-> self control root-prim prim-core action) + (logand -32769 (-> self control root-prim prim-core action)) + ) + ((-> target-racing-start exit)) + (none) + ) + :trans + (behavior () + (if (logtest? (-> self control status) 1) + (go target-racing) + ) + (target-racing-smack-check) + (racer-buzz 0.3) + (if (>= (- (-> *display* base-frame-counter) (-> self state-time)) 300) + (logior! (-> self control root-prim prim-core action) #x8000) + ) + (none) + ) + :code + (behavior () + (target-racing-jump-anim #f 30) + (none) + ) + :post + (-> target-racing post) + ) + +;; failed to figure out what this is: +(defstate target-racing-hit (target) + :event + (the-as + (function process int symbol event-message-block object :behavior target) + target-generic-event-handler + ) + :enter + (behavior ((arg0 handle) (arg1 attack-info)) + (let ((v1-0 (-> self attack-info))) + (set! (-> v1-0 attacker) arg0) + (set! (-> v1-0 mode) 'generic) + (set! (-> v1-0 shove-back) 6144.0) + (set! (-> v1-0 shove-up) 4915.2) + (set! (-> v1-0 angle) #f) + ) + (set! (-> self attack-info trans quad) (the-as uint128 0)) + (dummy-9 (-> self attack-info) arg1) + (case (-> self attack-info mode) + (('endlessfall 'death 'explode 'water-vol 'heat 'melt 'instant-death) + (pickup-collectable! + (-> self fact-info-target) + (pickup-type eco-green) + -1000.0 + (the-as handle #f) + ) + ) + (else + (pickup-collectable! + (-> self fact-info-target) + (pickup-type eco-green) + (- (-> *FACT-bank* health-single-inc)) + (the-as handle #f) + ) + ) + ) + (none) + ) + :exit + (behavior () + (if (!= (-> self next-state name) 'target-racing-death) + (set! (-> self state-flags) (logand -32777 (-> self state-flags))) + ) + ((-> target-racing-start exit)) + (none) + ) + :code + (behavior ((arg0 handle) (arg1 attack-info)) + (target-timed-invulnerable (-> *TARGET-bank* hit-invulnerable-timeout) self) + (when (!= (-> self attack-info mode) 'endlessfall) + (dummy-10 (-> self skel effect) 'group-target-hit -1.0 -1) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 90) + (sound-play-by-name + (static-sound-name "oof") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + ) + (set! (-> self game hit-time) (-> *display* base-frame-counter)) + (logior! (-> self state-flags) 8) + (set! (-> self racer boost-curve) 0.0) + (set! (-> self racer boost-level) 0.0) + (set! (-> self racer boost-target) 0.0) + (set! (-> self racer boost-output) 0.0) + (set! (-> self racer boost-time) (the-as uint 0)) + (if + (and + (= (-> self game mode) 'play) + (>= 0.0 (-> self fact-info-target health)) + ) + (go target-racing-death (-> self attack-info mode)) + ) + (case (-> self attack-info mode) + (('endlessfall) + ) + (('darkeco) + (let ((s5-1 (new 'stack-no-clear 'vector))) + (set! (-> s5-1 quad) (-> self control transv quad)) + (let + ((a2-3 + (vector-xz-normalize! + (vector-! + (new 'stack-no-clear 'vector) + (-> self control trans) + (-> self attack-info intersection) + ) + 1.0 + ) + ) + ) + (set! (-> a2-3 y) 0.0) + (let + ((gp-1 (vector-reflect-flat! (new 'stack-no-clear 'vector) s5-1 a2-3)) + (f30-0 (vector-xz-length s5-1)) + ) + (set! (-> gp-1 y) 0.0) + (vector-normalize! gp-1 1.0) + (vector-normalize-copy! (-> self control transv) gp-1 (* 2.0 f30-0)) + (let ((f28-0 (deg-diff (-> self racer rot y) (vector-y-angle gp-1)))) + (if (< 16384.0 (fabs f28-0)) + (set! + f28-0 + (deg-diff (-> self racer rot y) (+ 32768.0 (vector-y-angle gp-1))) + ) + ) + (set! + (-> self racer rotv y) + (* f28-0 (lerp-scale 4.0 7.0 f30-0 4096.0 (-> self racer transv-max))) + ) + ) + ) + ) + ) + ) + (else + (set! (-> self post-hook) target-racing-post) + (ja-channel-push! 1 15) + (let ((a0-24 (-> self skel root-channel 0))) + (set! + (-> a0-24 frame-group) + (the-as art-joint-anim (-> self draw art-group data 136)) + ) + (set! + (-> a0-24 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 136)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-24 param 1) 1.0) + (set! (-> a0-24 frame-num) 0.0) + (joint-control-channel-group! + a0-24 + (the-as art-joint-anim (-> self draw art-group data 136)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-25 (-> self skel root-channel 0))) + (set! + (-> a0-25 param 0) + (the float (+ (-> a0-25 frame-group data 0 length) -1)) + ) + (set! (-> a0-25 param 1) 1.0) + (joint-control-channel-group-eval! + a0-25 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ) + (go target-racing) + (none) + ) + :post + target-no-stick-post + ) + +;; failed to figure out what this is: +(defstate target-racing-death (target) + :event + (-> target-death event) + :exit + (behavior () + (set! (-> self state-flags) (logand -32769 (-> self state-flags))) + (send-event (ppointer->process (-> self manipy)) 'draw #t) + (send-event (ppointer->process (-> self manipy)) 'anim-mode 'clone-anim) + (target-timed-invulnerable-off self) + (set! + (-> self control pat-ignore-mask) + (new 'static 'pat-surface :skip #x1 :noentity #x1) + ) + (dummy-49 (-> self control)) + ((-> target-racing-start exit)) + (target-exit) + (set! (-> self racer stick-off) #f) + (none) + ) + :code + (behavior ((arg0 symbol)) + (local-vars (v1-154 symbol)) + (set! (-> self racer stick-off) #t) + (set! (-> self neck flex-blend) 0.0) + (target-timed-invulnerable-off self) + (logior! (-> self state-flags) #x8000) + (case (-> self attack-info mode) + (('explode 'darkeco 'heat 'death 'deadly 'balloonlurker) + ((-> target-racing-start exit)) + (send-event (ppointer->process (-> self manipy)) 'anim-mode 'loop) + (send-event (ppointer->process (-> self manipy)) 'draw #f) + (sound-play-by-name + (static-sound-name "zoomer-explode") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + (let ((gp-1 (get-process *default-dead-pool* part-tracker #x4000))) + (when gp-1 + (let ((t9-7 (method-of-type part-tracker activate))) + (t9-7 + (the-as part-tracker gp-1) + *entity-pool* + 'part-tracker + (the-as pointer #x70004000) + ) + ) + (run-now-in-process + gp-1 + part-tracker-init + (-> *part-group-id-table* 116) + -1 + #f + #f + #f + (-> self control trans) + ) + (-> gp-1 ppointer) + ) + ) + (send-event + (ppointer->process (-> self manipy)) + 'eval + (lambda :behavior racer () (let ((s5-0 (-> self parent-override)) + (gp-0 + (new 'stack 'joint-exploder-tuning 1) + ) + ) + (let* + ((f0-0 + (vector-length (-> s5-0 0 control transv)) + ) + (f30-0 (fmin 1.0 (* 0.000008138021 f0-0))) + ) + (set! (-> gp-0 duration) (the-as uint 1500)) + (set! + (-> gp-0 fountain-rand-transv-hi x) + (fmax 24576.0 f0-0) + ) + (set! + (-> gp-0 fountain-rand-transv-hi y) + (+ 81920.0 f0-0) + ) + (set! + (-> gp-0 fountain-rand-transv-hi z) + 20480.0 + ) + (set! + (-> gp-0 fountain-rand-transv-hi w) + 36864.0 + ) + (vector-negate! + (-> gp-0 fountain-rand-transv-lo) + (-> s5-0 0 control transv) + ) + (vector-normalize! + (-> gp-0 fountain-rand-transv-lo) + (* 12288.0 f30-0) + ) + ) + (vector+! + (-> gp-0 fountain-rand-transv-lo) + (-> gp-0 fountain-rand-transv-lo) + (-> s5-0 0 control trans) + ) + (let + ((s5-1 + (get-process + *default-dead-pool* + joint-exploder + #x4000 + ) + ) + ) + (when s5-1 + (let + ((t9-5 + (method-of-type joint-exploder activate) + ) + ) + (t9-5 + (the-as joint-exploder s5-1) + self + 'joint-exploder + (the-as pointer #x70004000) + ) + ) + (run-now-in-process + s5-1 + joint-exploder-init-by-other + *racer-explode-sg* + 24 + gp-0 + (new 'static 'joint-exploder-static-params + :joints + (new + 'static + 'boxed-array + :type joint-exploder-static-joint-params :length 16 :allocated-length 16 + (new 'static 'joint-exploder-static-joint-params + :joint-index 3 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 4 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 5 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 6 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 7 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 8 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 9 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 10 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 11 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 12 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 13 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 14 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 15 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 16 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 17 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 18 + :parent-joint-index -1 + ) + ) + ) + ) + (-> s5-1 ppointer) + ) + ) + ) + ) + ) + (ja-channel-push! 1 30) + (fmax -182044.44 (fmin 182044.44 (* -40.0 (-> self racer rot z)))) + (case (-> self attack-info mode) + (('balloonlurker) + (dummy-13 + (-> self water) + 2.0 + (-> self control trans) + 1 + (-> self control transv) + ) + (let ((gp-2 (-> self skel root-channel 0))) + (set! + (-> gp-2 frame-group) + (the-as art-joint-anim (-> self draw art-group data 139)) + ) + (set! (-> gp-2 param 0) (ja-aframe 240.0 0)) + (set! (-> gp-2 param 1) 1.0) + (set! (-> gp-2 frame-num) 0.0) + (joint-control-channel-group! + gp-2 + (the-as art-joint-anim (-> self draw art-group data 139)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (set! (-> self racer stick-lock) #t) + (set! + (-> self control unknown-vector11 y) + (seek + (-> self control unknown-vector11 y) + 6144.0 + (* 12288.0 (-> *display* seconds-per-frame)) + ) + ) + (send-event *camera* 'joystick 0.0 1.0) + (suspend) + (let ((gp-3 (-> self skel root-channel 0))) + (set! (-> gp-3 param 0) (ja-aframe 240.0 0)) + (set! (-> gp-3 param 1) 1.0) + (joint-control-channel-group-eval! + gp-3 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (else + (let ((a0-30 (-> self skel root-channel 0))) + (set! + (-> a0-30 frame-group) + (the-as art-joint-anim (-> self draw art-group data 139)) + ) + (set! + (-> a0-30 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 139)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-30 param 1) 1.0) + (set! (-> a0-30 frame-num) 0.0) + (joint-control-channel-group! + a0-30 + (the-as art-joint-anim (-> self draw art-group data 139)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (set! (-> self racer stick-lock) #t) + (send-event *camera* 'joystick 0.0 1.0) + (set! + (-> self control unknown-vector11 y) + (seek + (-> self control unknown-vector11 y) + 6144.0 + (* 12288.0 (-> *display* seconds-per-frame)) + ) + ) + (if (>= (ja-aframe-num 0) 245.0) + (set-forward-vel (* 0.5 (-> self control unknown-float01))) + ) + (suspend) + (let ((a0-36 (-> self skel root-channel 0))) + (set! + (-> a0-36 param 0) + (the float (+ (-> a0-36 frame-group data 0 length) -1)) + ) + (set! (-> a0-36 param 1) 1.0) + (joint-control-channel-group-eval! + a0-36 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ) + ) + (('melt) + (sound-play-by-name + (static-sound-name "zoomer-melt") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + (let ((gp-5 (get-process *default-dead-pool* part-tracker #x4000))) + (when gp-5 + (let ((t9-29 (method-of-type part-tracker activate))) + (t9-29 + (the-as part-tracker gp-5) + *entity-pool* + 'part-tracker + (the-as pointer #x70004000) + ) + ) + (run-now-in-process + gp-5 + part-tracker-init + (-> *part-group-id-table* 32) + -1 + #f + #f + #f + (-> self control trans) + ) + (-> gp-5 ppointer) + ) + ) + (dummy-48 (-> self control)) + (set! (-> self post-hook) target-no-ja-move-post) + (ja-channel-set! 0) + (ja-post) + (let ((gp-6 (-> *display* base-frame-counter))) + (until (>= (- (-> *display* base-frame-counter) gp-6) 600) + (suspend) + ) + ) + ) + (('endlessfall) + (sound-play-by-name + (static-sound-name "death-fall") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + (camera-change-to (the-as string cam-endlessfall) 30 #f) + (set! (-> self control pat-ignore-mask unknown-bit) 1) + (let ((f30-0 (fmin -4096.0 (- (-> self control ground-impact-vel))))) + (let ((gp-8 (new-stack-vector0))) + (let + ((f0-28 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + gp-8 + (-> self control transv) + (vector-float*! gp-8 (-> self control dynam gravity-normal) f0-28) + ) + ) + (let* ((f0-29 (vector-length gp-8)) + (f1-9 f0-29) + (f2-2 f30-0) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f2-2 + ) + (vector-float*! gp-8 gp-8 (/ f0-29 f1-9)) + ) + ) + ) + (let ((gp-9 (-> *display* base-frame-counter))) + (until (>= (- (-> *display* base-frame-counter) gp-9) 225) + (vector-seek! + (-> self draw color-mult) + *zero-vector* + (* 1.5 (-> *display* seconds-per-frame)) + ) + (set-forward-vel (* 0.96 (-> self control unknown-float01))) + (let ((s5-3 (new-stack-vector0)) + (f28-0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + s5-3 + (-> self control transv) + (vector-float*! s5-3 (-> self control dynam gravity-normal) f28-0) + ) + (let* ((f0-38 (vector-length s5-3)) + (f1-12 f0-38) + ) + (if (< f30-0 f28-0) + (set! f28-0 f30-0) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f28-0 + ) + (vector-float*! s5-3 s5-3 (/ f0-38 f1-12)) + ) + ) + ) + (suspend) + ) + ) + ) + (camera-change-to (the-as string 'base) 0 #f) + ) + ) + (set! (-> self control transv quad) (the-as uint128 0)) + (set! (-> self control unknown-float01) 0.0) + (set! (-> self post-hook) target-no-stick-post) + (initialize! (-> self game) 'dead (the-as game-save #f) (the-as string #f)) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (until v1-154 + (suspend) + (set! + v1-154 + (and + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 300) + (zero? + (logand (-> *kernel-context* prevent-from-run) (process-mask movie)) + ) + ) + ) + ) + (go target-stance) + (none) + ) + :post + target-racing-post + ) + +;; failed to figure out what this is: +(defstate target-racing-get-on (target) + :event + (the-as + (function process int symbol event-message-block object :behavior target) + target-generic-event-handler + ) + :exit + (-> target-racing-start exit) + :code + (behavior ((arg0 handle)) + (set! (-> self control transv quad) (the-as uint128 0)) + (set! + (-> self alt-cam-pos quad) + (-> (&-> (-> self control) unknown-qword00) 0) + ) + (logior! (-> self state-flags) 1024) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (set! (-> gp-0 quad) (-> self control trans quad)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 quad) (-> self control trans quad)) + (quaternion-copy! + (-> self control unknown-quaternion02) + (-> self control quat) + ) + (quaternion-copy! + (-> self control unknown-quaternion03) + (-> self control unknown-quaternion00) + ) + (set! + (-> self control unknown-float120) + (-> self control unknown-vector11 y) + ) + (let* ((s3-0 (handle->process arg0)) + (s4-1 + (if + (and (nonzero? s3-0) (type-type? (-> s3-0 type) process-drawable)) + (the-as racer s3-0) + ) + ) + ) + (when s4-1 + (set! (-> s5-0 quad) (-> s4-1 root-override trans quad)) + (quaternion-copy! + (-> self control unknown-quaternion03) + (-> s4-1 root-override quat) + ) + (send-event s4-1 'trans (-> self racer bike-trans)) + (quaternion-copy! + (the-as quaternion (-> self racer bike-quat)) + (-> s4-1 root-override quat) + ) + (set! (-> self racer bike-scale quad) (-> s4-1 root-override scale quad)) + (set! + (-> self control unknown-int20) + (the-as int (-> self racer bike-trans y)) + ) + ) + ) + (set! (-> self control unknown-vector102 quad) (-> gp-0 quad)) + (set! (-> self control unknown-vector103 quad) (-> s5-0 quad)) + ) + ) + (let ((s5-1 #f) + (gp-1 #f) + ) + (ja-channel-push! 1 15) + (let ((s4-2 (-> self skel root-channel 0))) + (set! + (-> s4-2 frame-group) + (the-as art-joint-anim (-> self draw art-group data 138)) + ) + (set! (-> s4-2 param 0) (ja-aframe 77.0 0)) + (set! (-> s4-2 param 1) 1.0) + (set! (-> s4-2 frame-num) 0.0) + (joint-control-channel-group! + s4-2 + (the-as art-joint-anim (-> self draw art-group data 138)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (when + (and (not s5-1) (= (-> self skel root-channel 0) (-> self skel channel))) + (send-event (ppointer->process (-> self manipy)) 'anim-mode 'clone-anim) + (set! s5-1 #t) + ) + (set! (-> self control transv quad) (the-as uint128 0)) + (when (< 50.0 (ja-aframe-num 0)) + (when (not gp-1) + (sound-play-by-name + (static-sound-name "zoomer-start") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + (set! gp-1 #t) + ) + (set! (-> self racer front-rotv) 65536.0) + (set! + (-> self racer front-rot) + (the + float + (sar + (shl + (the + int + (+ + (-> self racer front-rot) + (* (-> self racer front-rotv) (-> *display* seconds-per-frame)) + ) + ) + 48 + ) + 48 + ) + ) + ) + (+! + (-> self racer bottom-rot) + (* 364088.88 (-> *display* seconds-per-frame)) + ) + (set-twist! + (-> self racer front-blade) + (the-as float #f) + (- (-> self racer front-rot)) + (the-as float #f) + ) + (set-twist! + (-> self racer bottom-blade) + (the-as float #f) + (the-as float #f) + (- (-> self racer bottom-rot)) + ) + ) + (suspend) + (let ((s4-4 (-> self skel root-channel 0))) + (set! (-> s4-4 param 0) (ja-aframe 77.0 0)) + (set! (-> s4-4 param 1) 1.0) + (joint-control-channel-group-eval! + s4-4 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (set! (-> self state-flags) (logand -1025 (-> self state-flags))) + (send-event *camera* 'set-slave-option #x6000) + (set! (-> self control transv quad) (the-as uint128 0)) + (quaternion-copy! + (-> self control quat) + (-> self control unknown-quaternion00) + ) + (rot->dir-targ! (-> self control)) + (set! (-> self racer rot y) (y-angle (-> self control))) + (when *target* + (when + (or + (= (-> *target* current-level name) 'lavatube) + (= (-> *target* current-level name) 'firecanyon) + (= (-> *target* current-level name) 'citadel) + ) + (let ((gp-3 (get-process *default-dead-pool* hud-bike-heat #x4000))) + (set! (-> *hud-parts* bike-heat) (the-as (pointer hud-bike-heat) (when gp-3 + (let + ((t9-23 + (method-of-type + hud-bike-heat + activate + ) + ) + ) + (t9-23 + (the-as + hud-bike-heat + gp-3 + ) + self + 'hud-bike-heat + (the-as + pointer + #x70004000 + ) + ) + ) + (run-now-in-process + gp-3 + hud-init-by-other + 0 + ) + (-> + gp-3 + ppointer + ) + ) + ) + ) + ) + (set! (-> *hud-parts* buzzers 0 next-y-offset) -120) + (set! (-> *hud-parts* buzzers 0 y-sgn) 0) + 0 + ) + (let ((gp-4 (get-process *default-dead-pool* hud-bike-speed #x4000))) + (set! (-> *hud-parts* bike-speed) (the-as (pointer hud-bike-speed) (when gp-4 + (let + ((t9-26 + (method-of-type + hud-bike-speed + activate + ) + ) + ) + (t9-26 + (the-as + hud-bike-speed + gp-4 + ) + self + 'hud-bike-speed + (the-as + pointer + #x70004000 + ) + ) + ) + (run-now-in-process + gp-4 + hud-init-by-other + 0 + ) + (-> + gp-4 + ppointer + ) + ) + ) + ) + ) + (set! (-> *hud-parts* power 0 next-y-offset) -120) + (set! (-> *hud-parts* power 0 y-sgn) 0) + 0 + ) + (go target-racing) + (none) + ) + :post + (behavior () + (let ((gp-0 (new 'stack-no-clear 'vector)) + (f30-0 + (fmin + 1.0 + (* + 0.0044444446 + (the + float + (- (-> *display* base-frame-counter) (-> self state-time)) + ) + ) + ) + ) + ) + (vector-lerp! + gp-0 + (-> self control unknown-vector102) + (-> self control unknown-vector103) + f30-0 + ) + (set! + (-> gp-0 y) + (lerp + (-> self control unknown-vector102 y) + (-> self control unknown-vector103 y) + (fmax + 0.0 + (fmin + 1.0 + (* + 0.0044444446 + (the + float + (+ (- -150 (-> self state-time)) (-> *display* base-frame-counter)) + ) + ) + ) + ) + ) + ) + (TODO-RENAME-30 (-> self control) gp-0) + (quaternion-slerp! + (-> self control unknown-quaternion00) + (-> self control unknown-quaternion02) + (-> self control unknown-quaternion03) + f30-0 + ) + ) + (let + ((f30-1 + (fmax + 0.0 + (fmin + 1.0 + (* + 0.010528533 + (+ + -279.99 + (the float (- (-> *display* base-frame-counter) (-> self state-time))) + ) + ) + ) + ) + ) + ) + (set! + (-> self control unknown-vector11 y) + (lerp + (-> self control unknown-float120) + (-> self racer cushion-base) + f30-1 + ) + ) + (set! + (-> self racer bike-trans y) + (lerp + (-> self control unknown-float121) + (+ 4096.0 (-> self control unknown-float121)) + f30-1 + ) + ) + ) + (hide-hud-quick) + (target-no-move-post) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate target-racing-get-off (target) + :event + (the-as + (function process int symbol event-message-block object :behavior target) + target-generic-event-handler + ) + :exit + (-> target-racing-start exit) + :code + (behavior ((arg0 handle)) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control unknown-surface00) *racer-mods*) + (let ((a0-2 (-> *hud-parts* bike-speed))) + (if a0-2 + (set! (-> a0-2 0 deactivate-when-hidden) #t) + ) + ) + (let ((a0-4 (-> *hud-parts* bike-heat))) + (if a0-4 + (set! (-> a0-4 0 deactivate-when-hidden) #t) + ) + ) + (when (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 123) + ) + ) + (ja-channel-push! 4 30) + (let ((s5-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + s5-0 + (the-as art-joint-anim (-> self draw art-group data 123)) + num-func-identity + ) + (set! (-> s5-0 frame-num) (ja-aframe (-> self racer turn-anim-frame) 0)) + ) + (let ((a0-13 (-> self skel root-channel 1))) + (set! + (-> a0-13 frame-group) + (the-as art-joint-anim (-> self draw art-group data 124)) + ) + (set! (-> a0-13 param 0) 0.0) + (joint-control-channel-group-eval! + a0-13 + (the-as art-joint-anim (-> self draw art-group data 124)) + num-func-chan + ) + ) + (let ((a0-14 (-> self skel root-channel 2))) + (set! + (-> a0-14 frame-group) + (the-as art-joint-anim (-> self draw art-group data 125)) + ) + (set! (-> a0-14 param 0) 0.0) + (joint-control-channel-group-eval! + a0-14 + (the-as art-joint-anim (-> self draw art-group data 125)) + num-func-chan + ) + ) + (let ((a0-15 (-> self skel root-channel 3))) + (set! + (-> a0-15 frame-group) + (the-as art-joint-anim (-> self draw art-group data 126)) + ) + (set! (-> a0-15 param 0) 0.0) + (joint-control-channel-group-eval! + a0-15 + (the-as art-joint-anim (-> self draw art-group data 126)) + num-func-chan + ) + ) + ) + (let ((s5-1 (-> *display* base-frame-counter))) + (until (>= (- (-> *display* base-frame-counter) s5-1) 150) + (set! (-> self racer stick-lock) #t) + (set-forward-vel (* 0.9 (-> self control unknown-float01))) + (set! (-> self racer turn-anim-targ) 0.0) + (set! (-> self racer turn-anim-targ) 0.0) + (target-racing-turn-anim) + (set! + (-> self control unknown-vector11 y) + (seek + (-> self control unknown-vector11 y) + 6144.0 + (* 3.0 (-> *display* seconds-per-frame)) + ) + ) + (suspend) + ) + ) + (go target-racing-get-off-jump arg0) + (none) + ) + :post + target-racing-post + ) + +;; failed to figure out what this is: +(defstate target-racing-get-off-jump (target) + :event + (the-as + (function process int symbol event-message-block object :behavior target) + target-generic-event-handler + ) + :exit + (-> target-racing-start exit) + :code + (behavior ((arg0 handle)) + (sound-play-by-name + (static-sound-name "zoomer-stop") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control transv quad) (the-as uint128 0)) + (let ((gp-1 (new 'stack-no-clear 'vector))) + (set! (-> gp-1 quad) (-> self control trans quad)) + (let ((s4-1 (new 'stack-no-clear 'vector))) + (set! (-> s4-1 quad) (-> self control trans quad)) + (quaternion-copy! + (-> self control unknown-quaternion02) + (-> self control quat) + ) + (quaternion-copy! + (-> self control unknown-quaternion03) + (-> self control unknown-quaternion00) + ) + (set! + (-> self control unknown-float120) + (-> self control unknown-vector11 y) + ) + (let* ((s2-0 (handle->process arg0)) + (s3-0 + (if + (and (nonzero? s2-0) (type-type? (-> s2-0 type) process-drawable)) + (the-as racer s2-0) + ) + ) + ) + (when s3-0 + (set! (-> s4-1 quad) (-> s3-0 root-override trans quad)) + (set-yaw-angle-clear-roll-pitch! + (-> s3-0 root-override) + (quaternion-y-angle (-> self control quat)) + ) + (quaternion-copy! + (-> self control unknown-quaternion03) + (-> s3-0 root-override quat) + ) + (send-event s3-0 'trans (-> self racer bike-trans)) + (quaternion-copy! + (the-as quaternion (-> self racer bike-quat)) + (-> s3-0 root-override quat) + ) + (set! (-> self racer bike-scale quad) (-> s3-0 root-override scale quad)) + (set! + (-> self control unknown-int20) + (the-as int (-> self racer bike-trans y)) + ) + ) + ) + (set! (-> self control unknown-vector102 quad) (-> gp-1 quad)) + (set! (-> self control unknown-vector103 quad) (-> s4-1 quad)) + ) + (ja-channel-push! 1 15) + (let ((a0-24 (-> self skel root-channel 0))) + (set! + (-> a0-24 frame-group) + (the-as art-joint-anim (-> self draw art-group data 137)) + ) + (set! + (-> a0-24 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 137)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-24 param 1) 1.0) + (set! (-> a0-24 frame-num) 0.0) + (joint-control-channel-group! + a0-24 + (the-as art-joint-anim (-> self draw art-group data 137)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-25 (-> self skel root-channel 0))) + (set! + (-> a0-25 param 0) + (the float (+ (-> a0-25 frame-group data 0 length) -1)) + ) + (set! (-> a0-25 param 1) 1.0) + (joint-control-channel-group-eval! + a0-25 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (send-event (handle->process arg0) 'draw) + (set-yaw-angle-clear-roll-pitch! + (-> self control) + (quaternion-y-angle (-> self control unknown-quaternion03)) + ) + (rot->dir-targ! (-> self control)) + (ja-post) + (vector<-cspace! gp-1 (-> self node-list data 3)) + (set! (-> gp-1 y) (+ -5896.192 (-> gp-1 y))) + (TODO-RENAME-30 (-> self control) gp-1) + ) + (send-event *camera* 'ease-in) + (ja-channel-set! 0) + (go target-racing-get-off-hit-ground #f) + (none) + ) + :post + (behavior () + (let* + ((f0-2 + (deg-diff (-> self racer front-rot) (-> *RACER-bank* default-front-blade)) + ) + (f0-5 (if (< 0.0 f0-2) + (fmax 5461.3335 (* 4.0 f0-2)) + 54613.332 + ) + ) + ) + (set! + (-> self racer front-rotv) + (seek + (-> self racer front-rotv) + f0-5 + (* 54613.332 (-> *display* seconds-per-frame)) + ) + ) + ) + (set! + (-> self racer front-rot) + (the + float + (sar + (shl + (the + int + (+ + (-> self racer front-rot) + (* (-> self racer front-rotv) (-> *display* seconds-per-frame)) + ) + ) + 48 + ) + 48 + ) + ) + ) + (when + (and + (< + (fabs + (deg-diff + (-> *RACER-bank* default-front-blade) + (-> self racer front-rot) + ) + ) + 1820.4445 + ) + (= (-> self racer front-rotv) 5461.3335) + ) + (set! (-> self racer front-rotv) 0.0) + (set! (-> self racer front-rot) (-> *RACER-bank* default-front-blade)) + ) + (+! + (-> self racer bottom-rot) + (* 364088.88 (-> *display* seconds-per-frame)) + ) + (set-twist! + (-> self racer front-blade) + (the-as float #f) + (- (-> self racer front-rot)) + (the-as float #f) + ) + (set-twist! + (-> self racer bottom-blade) + (the-as float #f) + (the-as float #f) + (- (-> self racer bottom-rot)) + ) + (let ((gp-0 (new 'stack-no-clear 'vector)) + (f30-0 + (fmax + 0.0 + (fmin + 1.0 + (* + 0.004761905 + (+ + -150.0 + (the + float + (- (-> *display* base-frame-counter) (-> self state-time)) + ) + ) + ) + ) + ) + ) + ) + (fmax + 0.0 + (fmin + 1.0 + (* + 0.006666667 + (+ + -225.0 + (the float (- (-> *display* base-frame-counter) (-> self state-time))) + ) + ) + ) + ) + (vector-lerp! + gp-0 + (-> self control unknown-vector102) + (-> self control unknown-vector103) + f30-0 + ) + (set! + (-> gp-0 y) + (lerp + (-> self control unknown-vector102 y) + (-> self control unknown-vector103 y) + (fmax + 0.0 + (fmin + 1.0 + (* + 0.0044444446 + (the + float + (+ (- -150 (-> self state-time)) (-> *display* base-frame-counter)) + ) + ) + ) + ) + ) + ) + (TODO-RENAME-30 (-> self control) gp-0) + (quaternion-slerp! + (-> self control unknown-quaternion00) + (-> self control unknown-quaternion02) + (-> self control unknown-quaternion03) + f30-0 + ) + (set! + (-> self control unknown-vector11 y) + (lerp (-> self control unknown-float120) 6144.0 (fmin 1.0 (* 2.0 f30-0))) + ) + ) + (vector+! + (-> self racer bike-trans) + (-> self control trans) + (-> self control unknown-vector12) + ) + (quaternion-copy! + (the-as quaternion (-> self racer bike-quat)) + (-> self control quat) + ) + (set! (-> self racer bike-scale quad) (-> self control scale quad)) + (hide-hud) + (target-no-move-post) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate target-racing-get-off-hit-ground (target) + :event + (the-as + (function process int symbol event-message-block object :behavior target) + target-standard-event-handler + ) + :enter + (-> target-hit-ground enter) + :trans + (behavior () + (logior! (-> self control status) 7) + ((-> target-hit-ground trans)) + (none) + ) + :code + (behavior ((arg0 symbol)) + (ja-channel-set! 1) + (let ((gp-0 (-> self skel root-channel 0))) + (set! + (-> gp-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 35)) + ) + (set! + (-> gp-0 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 35)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> gp-0 param 1) 1.0) + (set! (-> gp-0 frame-num) (ja-aframe 42.0 0)) + (joint-control-channel-group! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 35)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-4 (-> self skel root-channel 0))) + (set! + (-> a0-4 param 0) + (the float (+ (-> a0-4 frame-group data 0 length) -1)) + ) + (set! (-> a0-4 param 1) 1.0) + (joint-control-channel-group-eval! + a0-4 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (go target-stance) + (none) + ) + :post + (behavior () + (hide-hud) + (target-post) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate target-racing-grab (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (cond + ((and (= arg2 'query) (= (-> arg3 param 0) 'mode)) + (-> self state name) + ) + (else + (case arg2 + (('end-mode) + (go target-racing) + ) + (('clone-anim) + (go + target-racing-clone-anim + (process->handle (the-as process (-> arg3 param 0))) + ) + ) + (else + (target-generic-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + ) + :enter + (behavior () + (set! (-> self control unknown-surface00) *grab-mods*) + (set! (-> self neck flex-blend) 0.0) + (logior! (-> self state-flags) 272) + (set! (-> self racer stick-off) #t) + (none) + ) + :exit + (behavior () + (set! (-> self racer stick-off) #f) + (set! (-> self state-flags) (logand -273 (-> self state-flags))) + (set! (-> self water flags) (logand -65537 (-> self water flags))) + ((-> target-racing-start exit)) + (none) + ) + :code + (behavior () + (when (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 123) + ) + ) + (ja-channel-push! 4 30) + (let ((gp-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 123)) + num-func-identity + ) + (set! (-> gp-0 frame-num) (ja-aframe (-> self racer turn-anim-frame) 0)) + ) + (let ((a0-7 (-> self skel root-channel 1))) + (set! + (-> a0-7 frame-group) + (the-as art-joint-anim (-> self draw art-group data 124)) + ) + (set! (-> a0-7 param 0) 0.0) + (joint-control-channel-group-eval! + a0-7 + (the-as art-joint-anim (-> self draw art-group data 124)) + num-func-chan + ) + ) + (let ((a0-8 (-> self skel root-channel 2))) + (set! + (-> a0-8 frame-group) + (the-as art-joint-anim (-> self draw art-group data 125)) + ) + (set! (-> a0-8 param 0) 0.0) + (joint-control-channel-group-eval! + a0-8 + (the-as art-joint-anim (-> self draw art-group data 125)) + num-func-chan + ) + ) + (let ((a0-9 (-> self skel root-channel 3))) + (set! + (-> a0-9 frame-group) + (the-as art-joint-anim (-> self draw art-group data 126)) + ) + (set! (-> a0-9 param 0) 0.0) + (joint-control-channel-group-eval! + a0-9 + (the-as art-joint-anim (-> self draw art-group data 126)) + num-func-chan + ) + ) + ) + (while #t + (target-racing-turn-anim) + (set-forward-vel 0.0) + (suspend) + ) + (none) + ) + :post + target-racing-post + ) + +;; failed to figure out what this is: +(defstate target-racing-clone-anim (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (if (and (= arg2 'trans) (= (-> arg3 param 0) 'restore)) + (set! (-> self control unknown-float120) (the-as float #f)) + ) + ((-> target-racing-grab event) arg0 arg1 arg2 arg3) + ) + :enter + (-> target-clone-anim enter) + :exit + (behavior () + (set! + (-> self control unknown-vector11 y) + (-> self control unknown-float120) + ) + (set! + (-> self control unknown-vector12 y) + (-> self control unknown-vector11 y) + ) + (send-event (ppointer->process (-> self sidekick)) 'matrix #f) + ((-> target-clone-anim exit)) + ((-> target-racing-start exit)) + (vector-reset! (-> self control transv)) + (none) + ) + :code + (behavior ((arg0 handle)) + (set! + (-> self control unknown-float120) + (-> self control unknown-vector11 y) + ) + (set! (-> self control unknown-vector11 y) 0.0) + (send-event (ppointer->process (-> self sidekick)) 'matrix 'play-anim) + (clone-anim arg0 33 #t "") + (go target-racing) + (none) + ) + :post + (behavior () + (racer-sounds) + (set! + (-> self racer heat) + (seek + (-> self racer heat) + 0.0 + (* (-> *RACER-bank* surface-heat-inc) (-> *display* seconds-per-frame)) + ) + ) + (vector+! + (-> self racer bike-trans) + (-> self control trans) + (-> self control unknown-vector12) + ) + (quaternion-copy! + (the-as quaternion (-> self racer bike-quat)) + (-> self control quat) + ) + (set! (-> self racer bike-scale quad) (-> self control scale quad)) + (target-no-ja-move-post) + (none) + ) + ) diff --git a/goal_src/levels/racer_common/racer.gc b/goal_src/levels/racer_common/racer.gc index fb54027266..a71fa5ea54 100644 --- a/goal_src/levels/racer_common/racer.gc +++ b/goal_src/levels/racer_common/racer.gc @@ -5,3 +5,27 @@ ;; name in dgo: racer ;; dgos: L1, FIC, LAV, MIS, OGR, RACERP, ROL +(deftype racer (process-drawable) + ((parent-override (pointer target) :score 100 :offset 12) + (root-override collide-shape-moving :score 100 :offset 112) + (extra-trans vector :inline :offset-assert 176) + (condition int32 :offset-assert 192) + (cell handle :offset-assert 200) + (path-data path-control 2 :offset-assert 208) + (path-target curve-control :offset 208) + (path-racer path-control :offset 212) + (auto-get-off symbol :offset-assert 216) + (shadow-backup shadow-geo :offset-assert 220) + ) + :method-count-assert 24 + :size-assert #xe0 + :heap-base #x70 + :flag-assert #x18007000e0 + (:methods + (wait-for-start () _type_ :state 20) + (idle () _type_ :state 21) + (pickup ((state collectable)) _type_ :state 22) + (wait-for-return () _type_ :state 23) + ) + ) + diff --git a/goal_src/levels/racer_common/target-racer-FIC-LAV-MIS-OGR-ROL.gc b/goal_src/levels/racer_common/target-racer-FIC-LAV-MIS-OGR-ROL.gc index 9108c2a689..14feccb184 100644 --- a/goal_src/levels/racer_common/target-racer-FIC-LAV-MIS-OGR-ROL.gc +++ b/goal_src/levels/racer_common/target-racer-FIC-LAV-MIS-OGR-ROL.gc @@ -5,3 +5,5 @@ ;; name in dgo: target-racer ;; dgos: FIC, LAV, MIS, OGR, ROL +(define-extern racer-collision-reaction function) +(define-extern *racer-mods* surface) \ No newline at end of file diff --git a/goal_src/levels/racer_common/target-racer-h-FIC-LAV-MIS-OGR-ROL.gc b/goal_src/levels/racer_common/target-racer-h-FIC-LAV-MIS-OGR-ROL.gc index 899162da56..74befa0523 100644 --- a/goal_src/levels/racer_common/target-racer-h-FIC-LAV-MIS-OGR-ROL.gc +++ b/goal_src/levels/racer_common/target-racer-h-FIC-LAV-MIS-OGR-ROL.gc @@ -6,11 +6,22 @@ ;; dgos: FIC, LAV, MIS, OGR, ROL (define-extern *balloon-sg* skeleton-group) +(define-extern *racer-sg* skeleton-group) +(define-extern target-racing-smack (state float symbol target)) +(define-extern target-racing-center-anim (function none :behavior target)) +(define-extern racer-buzz (function float none :behavior target)) +(define-extern target-racing-post (function none :behavior target)) +(define-extern target-racing-land-anim (function symbol none :behavior target)) +(define-extern target-racing-turn-anim (function none :behavior target)) +(define-extern racer-calc-gravity (function vector :behavior target)) +(define-extern target-racing-jump-anim (function basic int none :behavior target)) +(define-extern racer-sounds (function object :behavior target)) +(define-extern *racer-air-mods* surface) ;; decomp begins (deftype racer-info (basic) - ((entity basic :offset-assert 4) + ((entity entity-actor :offset-assert 4) (bike-trans vector :inline :offset-assert 16) (bike-quat vector :inline :offset-assert 32) (bike-scale vector :inline :offset-assert 48) @@ -51,14 +62,14 @@ (targ-rotx degrees :offset-assert 332) (speed-rotx float :offset-assert 336) (mult-rotx degrees :offset-assert 340) - (front-blade basic :offset-assert 344) + (front-blade joint-mod :offset-assert 344) (front-rot degrees :offset-assert 348) (front-rotv degrees :offset-assert 352) - (bottom-blade basic :offset-assert 356) + (bottom-blade joint-mod :offset-assert 356) (bottom-rot degrees :offset-assert 360) - (front basic :offset-assert 364) + (front joint-mod :offset-assert 364) (front-turn degrees :offset-assert 368) - (tail basic :offset-assert 372) + (tail joint-mod :offset-assert 372) (tail-tilt degrees :offset-assert 376) (transv-max meters :offset-assert 380) (slide-down-time uint64 2 :offset-assert 384) @@ -75,7 +86,7 @@ (boost-level float :offset-assert 452) (boost-target float :offset-assert 456) (boost-output float :offset-assert 460) - (hop? basic :offset-assert 464) + (hop? symbol :offset-assert 464) (hop-start-y float :offset-assert 468) (bounce int32 :offset-assert 472) (bounce-hit float :offset-assert 476) @@ -90,10 +101,10 @@ (rudd-anim-vel float :offset-assert 512) (rudd-anim-frame float :offset-assert 516) (racing-time uint64 :offset-assert 520) - (stick-lock basic :offset-assert 528) - (stick-off basic :offset-assert 532) - (heavy basic :offset-assert 536) - (unstuck-time uint64 :offset-assert 544) + (stick-lock symbol :offset-assert 528) + (stick-off symbol :offset-assert 532) + (heavy symbol :offset-assert 536) + (unstuck-time int64 :offset-assert 544) (stuck-count int32 :offset-assert 552) (scrape-sound-id sound-id :offset-assert 556) (heat-sound-time uint64 :offset-assert 560) @@ -103,6 +114,7 @@ :flag-assert #x900000238 ) + ;; definition of type racer-bank (deftype racer-bank (basic) ((slide-hold-time seconds :offset-assert 8) diff --git a/goalc/compiler/compilation/Type.cpp b/goalc/compiler/compilation/Type.cpp index 5500f88723..8e477febb5 100644 --- a/goalc/compiler/compilation/Type.cpp +++ b/goalc/compiler/compilation/Type.cpp @@ -376,21 +376,22 @@ Val* Compiler::compile_deftype(const goos::Object& form, const goos::Object& res // add declared states for (auto& state : result.type_info->get_states_declared_for_type()) { - auto existing_type = m_symbol_types.find(state.name); - if (existing_type != m_symbol_types.end() && existing_type->second != state.type) { + auto existing_type = m_symbol_types.find(state.first); + if (existing_type != m_symbol_types.end() && existing_type->second != state.second) { if (m_throw_on_define_extern_redefinition) { throw_compiler_error(form, "deftype would redefine the type of state {} from {} to {}.", - state.name, existing_type->second.print(), state.type.print()); + state.first, existing_type->second.print(), state.second.print()); } else { print_compiler_warning( "[Warning] deftype has redefined the type of state {}\npreviously: {}\nnow: " "{}\n", - state.name.c_str(), existing_type->second.print().c_str(), state.type.print().c_str()); + state.first.c_str(), existing_type->second.print().c_str(), + state.second.print().c_str()); } } - m_symbol_types[state.name] = state.type; - m_symbol_info.add_fwd_dec(state.name, form); + m_symbol_types[state.first] = state.second; + m_symbol_info.add_fwd_dec(state.first, form); } if (result.create_runtime_type) { diff --git a/test/decompiler/reference/engine/collide/collide-target-h_REF.gc b/test/decompiler/reference/engine/collide/collide-target-h_REF.gc index 9c85da2fdb..8134f32bc0 100644 --- a/test/decompiler/reference/engine/collide/collide-target-h_REF.gc +++ b/test/decompiler/reference/engine/collide/collide-target-h_REF.gc @@ -128,10 +128,15 @@ (unknown-dword40 int64 :offset 2160) (unknown-dword41 int64 :offset 2168) (unknown-handle10 handle :offset 2176) + (unknown-float120 float :offset 2184) (unknown-symbol20 symbol :offset 2184) (unknown-int20 int32 :offset 2188) + (unknown-float121 float :offset 2188) + (unknown-float123 float :offset 2200) (unknown-vector102 vector :inline :offset 2224) (unknown-vector103 vector :inline :offset 2240) + (unknown-quaternion02 quaternion :inline :offset 2256) + (unknown-quaternion03 quaternion :inline :offset 2272) (unknown-smush00 smush-control :inline :offset 2288) (unknown-vector110 vector :inline :offset 2320) (unknown-vector111 vector :inline :offset 2336) diff --git a/test/decompiler/reference/engine/target/pat-h_REF.gc b/test/decompiler/reference/engine/target/pat-h_REF.gc index 7144b53b67..0aff82d285 100644 --- a/test/decompiler/reference/engine/target/pat-h_REF.gc +++ b/test/decompiler/reference/engine/target/pat-h_REF.gc @@ -12,6 +12,7 @@ (nocamera uint8 :offset 1 :size 1) (noedge uint8 :offset 2 :size 1) (nolineofsight uint8 :offset 12 :size 1) + (unknown-bit uint8 :offset 15 :size 1) ) :method-count-assert 9 :size-assert #x4 diff --git a/test/decompiler/reference/engine/target/target-h_REF.gc b/test/decompiler/reference/engine/target/target-h_REF.gc index 505f70a5d6..7dc48ae00d 100644 --- a/test/decompiler/reference/engine/target/target-h_REF.gc +++ b/test/decompiler/reference/engine/target/target-h_REF.gc @@ -36,6 +36,22 @@ (:methods (dummy-20 (_type_ collide-cache) none 20) ) + (:states + target-clone-anim + target-death + (target-hit-ground symbol) + (target-racing-bounce float float symbol) + (target-racing-clone-anim handle) + (target-racing-death symbol) + target-racing-falling + (target-racing-get-off handle) + (target-racing-get-off-hit-ground symbol) + (target-racing-get-off-jump handle) + (target-racing-get-on handle) + target-racing-grab + (target-racing-hit handle attack-info) + (target-racing-jump float float symbol) + ) ) ;; definition for method 3 of type target diff --git a/test/decompiler/reference/engine/target/target-util_REF.gc b/test/decompiler/reference/engine/target/target-util_REF.gc index d8178d9697..559b0fac40 100644 --- a/test/decompiler/reference/engine/target/target-util_REF.gc +++ b/test/decompiler/reference/engine/target/target-util_REF.gc @@ -1433,7 +1433,7 @@ ;; definition for function target-timed-invulnerable ;; INFO: Return type mismatch int vs none. -(defun target-timed-invulnerable ((arg0 uint64) (arg1 target)) +(defun target-timed-invulnerable ((arg0 uint) (arg1 target)) (logior! (-> arg1 state-flags) 32) (set! (-> arg1 control unknown-dword70) (-> *display* base-frame-counter)) (set! (-> arg1 control unknown-dword71) (the-as int arg0)) diff --git a/test/decompiler/reference/kernel/gkernel_REF.gc b/test/decompiler/reference/kernel/gkernel_REF.gc index 84a4fa383d..dca9a10ad2 100644 --- a/test/decompiler/reference/kernel/gkernel_REF.gc +++ b/test/decompiler/reference/kernel/gkernel_REF.gc @@ -494,7 +494,7 @@ (v1-5 ((method-of-type process new) allocation process 'dead arg1)) ) (set! (-> s3-0 child) (process->ppointer v1-5)) - (set! (-> v1-5 parent) (process->ppointer s3-0)) + (set! (-> v1-5 parent) (process->ppointer (the-as process s3-0))) (set! (-> v1-5 pool) s3-0) (set! (-> v1-5 brother) s1-0) ) diff --git a/test/decompiler/reference/levels/common/basebutton_REF.gc b/test/decompiler/reference/levels/common/basebutton_REF.gc index 41966512da..30b9cb817e 100644 --- a/test/decompiler/reference/levels/common/basebutton_REF.gc +++ b/test/decompiler/reference/levels/common/basebutton_REF.gc @@ -836,7 +836,7 @@ (-> self control unknown-vector102 y) (+ -4096.0 (-> self control unknown-vector102 y)) ) - (set! (-> self control unknown-symbol20) #f) + (set! (-> self control unknown-float120) (the-as float #f)) (vector-reset! (-> self control transv)) (logior! (-> self state-flags) 1024) (set! (-> self alt-cam-pos quad) (-> arg1 quad)) @@ -986,7 +986,7 @@ (and (or (< (vector-dot gp-2 (-> self control transv)) 0.0) - (-> self control unknown-symbol20) + (-> self control unknown-float120) ) (>= (- (-> *display* base-frame-counter) (-> self state-time)) 15) ) @@ -997,10 +997,10 @@ ) (set! (-> self control transv x) (* 0.95 (-> self control transv x))) (set! (-> self control transv z) (* 0.95 (-> self control transv z))) - (when (not (-> self control unknown-symbol20)) + (when (not (-> self control unknown-float120)) (send-event self 'do-effect 'death-warp-out -1.0) (let ((v0-2 #t)) - (set! (-> self control unknown-symbol20) v0-2) + (set! (-> self control unknown-float120) (the-as float v0-2)) v0-2 ) ) diff --git a/test/decompiler/reference/levels/finalboss/light-eco_REF.gc b/test/decompiler/reference/levels/finalboss/light-eco_REF.gc index 2f3357f33b..ef31f94994 100644 --- a/test/decompiler/reference/levels/finalboss/light-eco_REF.gc +++ b/test/decompiler/reference/levels/finalboss/light-eco_REF.gc @@ -20,10 +20,10 @@ (common-trans (_type_) none 20) ) (:states + light-eco-child-die light-eco-child-grabbed light-eco-child-hit-ground light-eco-child-idle - light-eco-child-die ) ) @@ -60,8 +60,8 @@ (common-trans (_type_) none 21) ) (:states - light-eco-mother-discipate light-eco-mother-active + light-eco-mother-discipate ) ) diff --git a/test/decompiler/reference/levels/jungle/fisher-JUN_REF.gc b/test/decompiler/reference/levels/jungle/fisher-JUN_REF.gc index eeadaf9b06..6ddb7ed3c2 100644 --- a/test/decompiler/reference/levels/jungle/fisher-JUN_REF.gc +++ b/test/decompiler/reference/levels/jungle/fisher-JUN_REF.gc @@ -3004,7 +3004,7 @@ (activate! (-> self control unknown-smush00) 1.0 120 210 0.3 1.0) ) ((= arg2 'lose) - (set! (-> self control unknown-symbol20) arg2) + (set! (-> self control unknown-float120) (the-as float arg2)) arg2 ) (else @@ -3017,7 +3017,7 @@ (set! (-> self control unknown-surface00) *empty-mods*) (logior! (-> self state-flags) 16) (set-zero! (-> self control unknown-smush00)) - (set! (-> self control unknown-symbol20) #f) + (set! (-> self control unknown-float120) (the-as float #f)) (none) ) :exit @@ -3134,7 +3134,7 @@ (set! (-> s5-1 frame-num) (ja-aframe 15.0 0)) ) (let ((s5-2 (new 'stack-no-clear 'vector))) - (until (-> self control unknown-symbol20) + (until (-> self control unknown-float120) (let ((v1-42 (handle->process arg0))) (when v1-42 (let ((a0-28 (-> self skel root-channel 0))) @@ -3187,7 +3187,7 @@ (suspend) ) ) - (case (-> self control unknown-symbol20) + (case (-> self control unknown-float120) (('lose) (ja-channel-push! 1 30) (let ((a0-38 (-> self skel root-channel 0))) diff --git a/test/decompiler/reference/levels/maincave/baby-spider_REF.gc b/test/decompiler/reference/levels/maincave/baby-spider_REF.gc index ade8aeac9c..4bef244434 100644 --- a/test/decompiler/reference/levels/maincave/baby-spider_REF.gc +++ b/test/decompiler/reference/levels/maincave/baby-spider_REF.gc @@ -63,9 +63,9 @@ :size-assert #x200 :flag-assert #x4c01900200 (:states + baby-spider-die-fast baby-spider-hatching baby-spider-resume - baby-spider-die-fast ) ) diff --git a/test/decompiler/reference/levels/maincave/spiderwebs_REF.gc b/test/decompiler/reference/levels/maincave/spiderwebs_REF.gc index 5c532a9b78..32ba6ab975 100644 --- a/test/decompiler/reference/levels/maincave/spiderwebs_REF.gc +++ b/test/decompiler/reference/levels/maincave/spiderwebs_REF.gc @@ -42,8 +42,8 @@ :size-assert #xb4 :flag-assert #x14005000b4 (:states - spiderwebs-idle spiderwebs-bounce + spiderwebs-idle ) ) diff --git a/test/decompiler/reference/levels/racer_common/racer-states-FIC-LAV-MIS-OGR-ROL_REF.gc b/test/decompiler/reference/levels/racer_common/racer-states-FIC-LAV-MIS-OGR-ROL_REF.gc new file mode 100644 index 0000000000..c7b39e95d6 --- /dev/null +++ b/test/decompiler/reference/levels/racer_common/racer-states-FIC-LAV-MIS-OGR-ROL_REF.gc @@ -0,0 +1,3193 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(defstate target-racing-start (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (cond + ((and (= arg2 'query) (= (-> arg3 param 0) 'mode)) + 'racer + ) + ((and (= arg2 'get-pickup) (= (-> arg3 param 0) 3)) + (if + (>= + (- + (-> *display* base-frame-counter) + (the-as int (-> self racer boost-time)) + ) + 300 + ) + (send-event + self + 'boost + (fmax 1.0 (fmin 2.0 (the-as float (-> arg3 param 1)))) + ) + ) + ) + (else + (case arg2 + (('end-mode) + (go target-racing-get-off (process->handle arg0)) + ) + (('touched) + (send-event arg0 'attack (-> arg3 param 0) 'racer 0 0) + (when + (and + (type-type? (-> arg0 type) babak) + (< 40960.0 (-> self control unknown-float01)) + ) + (let + ((f0-5 + (lerp-scale + 16384.0 + 32768.0 + (-> self control unknown-float01) + 40960.0 + (-> self racer transv-max) + ) + ) + ) + (go target-racing-jump f0-5 f0-5 #f) + ) + ) + ) + (('attack 'attack-or-shove 'attack-invinc) + (let ((v1-27 (the-as attack-info (-> arg3 param 1)))) + (if + (not + (and + (logtest? (-> v1-27 mask) 32) + (or (= (-> v1-27 mode) 'burn) (= (-> v1-27 mode) 'burnup)) + ) + ) + (target-attacked + arg2 + (-> arg3 param 1) + (the-as uint arg0) + (the-as process (-> arg3 param 0)) + (the-as (state target) target-racing-hit) + ) + ) + ) + ) + (('heat) + (let + ((f0-7 + (fmax + 0.0 + (fmin + (+ (-> self racer heat) (the-as float (-> arg3 param 0))) + (-> *RACER-bank* heat-max) + ) + ) + ) + ) + (set! (-> self racer heat) f0-7) + f0-7 + ) + ) + (('boost) + (sound-play-by-name + (static-sound-name "get-blue-eco") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + (set! + (-> self racer boost-sound-id) + (sound-play-by-name + (static-sound-name "zoom-boost") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + ) + (set! + (-> self racer boost-time) + (the-as uint (-> *display* base-frame-counter)) + ) + (let + ((f0-12 + (seek + (-> self racer boost-level) + (-> *RACER-bank* boost-level-max) + (* + (-> *RACER-bank* boost-level-inc) + (the-as float (-> arg3 param 0)) + ) + ) + ) + ) + (set! (-> self racer boost-level) f0-12) + f0-12 + ) + ) + (('smack) + (go target-racing-smack (-> self control unknown-float01) #t) + ) + (('jump) + (go + target-racing-jump + (the-as float (-> arg3 param 0)) + (the-as float (-> arg3 param 1)) + #f + ) + ) + (('change-mode) + (case (-> arg3 param 0) + (('grab) + (go target-racing-grab) + ) + ) + ) + (('clone-anim) + (go + target-racing-clone-anim + (process->handle (the-as process (-> arg3 param 0))) + ) + ) + (else + (target-generic-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + ) + :exit + (behavior () + (when + (not + (or + (= (-> self next-state name) 'target-racing) + (= (-> self next-state name) 'target-racing-jump) + (= (-> self next-state name) 'target-racing-bounce) + (= (-> self next-state name) 'target-racing-hit) + (= (-> self next-state name) 'target-racing-death) + (= (-> self next-state name) 'target-racing-smack) + (= (-> self next-state name) 'target-racing-falling) + (= (-> self next-state name) 'target-racing-get-on) + (= (-> self next-state name) 'target-racing-get-off) + (= (-> self next-state name) 'target-racing-get-off-jump) + (= (-> self next-state name) 'target-racing-grab) + (= (-> self next-state name) 'target-racing-clone-anim) + ) + ) + (let ((v1-25 (-> self manipy))) + (when v1-25 + (deactivate (-> v1-25 0)) + (set! (-> self manipy) (the-as (pointer manipy) #f)) + ) + ) + (let ((v1-29 (-> *hud-parts* bike-speed))) + (when v1-29 + (set! (-> v1-29 0 deactivate-when-hidden) #t) + (send-event (ppointer->process v1-29) 'hide-quick) + ) + ) + (let ((v1-32 (-> *hud-parts* bike-heat))) + (when v1-32 + (set! (-> v1-32 0 deactivate-when-hidden) #t) + (send-event (ppointer->process v1-32) 'hide-quick) + ) + ) + (set! (-> *hud-parts* buzzers 0 next-y-offset) 0) + (set! (-> *hud-parts* power 0 next-y-offset) 0) + (set! (-> *hud-parts* buzzers 0 y-sgn) 1) + (set! (-> *hud-parts* power 0 y-sgn) 1) + (set! + (-> self control root-prim prim-core action) + (logand -66049 (-> self control root-prim prim-core action)) + ) + (set! (-> self control unknown-surface00) *walk-mods*) + (set! (-> self state-flags) (logand -1025 (-> self state-flags))) + (send-event *camera* 'clear-slave-option #x6000) + (set! + (-> self control dynam gravity-max) + (-> self control unknown-dynamics00 gravity-max) + ) + (set! + (-> self control dynam gravity-length) + (-> self control unknown-dynamics00 gravity-length) + ) + (let ((v1-60 (-> self node-list data))) + (set! (-> v1-60 0 param0) cspace<-transformq+trans!) + (set! (-> v1-60 0 param1) (the-as basic (-> self control trans))) + (set! + (-> v1-60 0 param2) + (the-as basic (-> self control unknown-vector12)) + ) + ) + (target-collide-set! 'normal 0.0) + (set! (-> self control reaction) target-collision-reaction) + (sound-stop (-> self racer engine-sound-id)) + (set! (-> self racer engine-sound-id) (new 'static 'sound-id)) + (set! (-> self control unknown-vector12 quad) (the-as uint128 0)) + (clear-pending-settings-from-process *setting-control* self 'sound-flava) + (target-exit) + ) + (none) + ) + :code + (behavior ((arg0 handle)) + (target-exit) + (set! *display-profile* #f) + (set! *display-entity-errors* #f) + (set-setting! *setting-control* self 'sound-flava #f 30.0 1) + (if (zero? (-> self racer)) + (set! (-> self racer) (new 'process 'racer-info)) + ) + (set! (-> self racer turn-anim-targ) 0.0) + (set! (-> self racer turn-anim-frame) 0.0) + (set! (-> self racer turn-anim-vel) 0.0) + (set! (-> self racer tail-anim-vel) 0.0) + (set! (-> self racer tail-anim-frame) 0.0) + (set! (-> self racer rudd-anim-vel) 0.0) + (set! (-> self racer rudd-anim-frame) 0.0) + (set! (-> self racer stick-lock) #f) + (set! (-> self racer stick-off) #f) + (set! (-> self racer heavy) #f) + (set! (-> self racer unstuck-time) (-> *display* base-frame-counter)) + (set! (-> self racer stuck-count) 0) + (set! (-> self racer cushion-base) 10240.0) + (set! (-> self racer shock-offset) 0.0) + (set! (-> self racer shock-offsetv) 0.0) + (set! (-> self racer shock-rotx) 0.0) + (set! (-> self racer engine-sound-id) (new 'static 'sound-id)) + (set! (-> self racer boost-sound-id) (new 'static 'sound-id)) + (set! (-> self racer scrape-sound-id) (new-sound-id)) + (set! (-> self racer entity) #f) + (let ((v1-28 (handle->process arg0))) + (if v1-28 + (set! (-> self racer entity) (the-as entity-actor (-> v1-28 entity))) + ) + ) + (set! (-> self control surf) *race-track-surface*) + (set! (-> self control reaction) racer-collision-reaction) + (vector-reset! (-> self racer rot)) + (set! (-> self racer rot y) (y-angle (-> self control))) + (target-collide-set! 'racer 0.0) + (set! (-> self control transv quad) (the-as uint128 0)) + (set! (-> self control unknown-float01) 0.0) + (logior! (-> self control root-prim prim-core action) 512) + (set! (-> self control unknown-surface00) *racer-mods*) + (set! (-> self racer lean-rotx) 0.0) + (vector-reset! (-> self racer rotv)) + (quaternion-identity! (the-as quaternion (-> self racer surface-quat))) + (quaternion-identity! + (the-as quaternion (-> self racer surface-quat-smooth)) + ) + (set! (-> self racer front-rot) (-> *RACER-bank* default-front-blade)) + (set! (-> self racer front-rotv) 0.0) + (set! (-> self racer bottom-rot) 0.0) + (let ((v1-56 (-> self node-list data))) + (set! (-> v1-56 0 param0) cspace<-transformq+world-trans!) + (set! (-> v1-56 0 param1) (the-as basic (-> self control trans))) + (set! (-> v1-56 0 param2) (the-as basic (-> self control unknown-vector12))) + ) + (set! (-> self control unknown-float81) 1.0) + (set! (-> self racer hop?) #f) + (set! (-> self racer bounce) 0) + (set! (-> self racer bounce-hit) 0.0) + (set! (-> self racer bob-period) 900.0) + (set! (-> self racer bob-mult-rot) 0.0) + (set! (-> self racer bob-mult-trans) 0.0) + (set! (-> self racer bob-meta-timer) 0.0) + (set! (-> self racer bob-meta-meta-timer) 0.0) + (set! (-> self racer bob-hit-ground-time) (the-as uint 0)) + (set! (-> self racer cushion-bob) 0.0) + (set! (-> self racer cushion-bob-old) 0.0) + (set! (-> self racer hill-value) 0.0) + (set! (-> self racer hill-ground-value) 0.0) + (set! (-> self racer hill-offset) 0.0) + (set! (-> self racer hill-boost) 0.0) + (set! (-> self racer cur-rotx) 0.0) + (set! (-> self racer targ-rotx) 0.0) + (set! (-> self racer hill-rotx) 0.0) + (set! (-> self racer mult-rotx) 0.0) + (set! (-> self racer speed-rotx) 0.25) + (set! (-> self racer boost-curve) 0.0) + (set! (-> self racer boost-level) 0.0) + (set! (-> self racer boost-target) 0.0) + (set! (-> self racer boost-output) 0.0) + (set! (-> self racer boost-time) (the-as uint 0)) + (set! + (-> self racer boost-duration) + (the-as uint (-> *RACER-bank* boost-duration)) + ) + (set! (-> self racer heat) 0.0) + (set! (-> self racer slide-mode) 0) + (set! (-> self racer slide-amp) 0.0) + (set! (-> self racer slide-down-time 0) (the-as uint 0)) + (set! (-> self racer slide-down-time 1) (the-as uint 0)) + (set! (-> self racer slide-interp) 0.0) + (set! (-> self racer surface-y) (-> self control trans y)) + (let ((s5-0 (-> self entity))) + (set! (-> self entity) (-> self racer entity)) + (let ((s4-0 (get-process *8k-dead-pool* manipy #x4000))) + (set! (-> self manipy) (the-as (pointer manipy) (when s4-0 + (let + ((t9-9 + (method-of-type + manipy + activate + ) + ) + ) + (t9-9 + (the-as manipy s4-0) + self + 'manipy + (the-as + pointer + #x70004000 + ) + ) + ) + (run-now-in-process + s4-0 + manipy-init + (-> self control trans) + (-> self entity) + *racer-sg* + #f + ) + (-> s4-0 ppointer) + ) + ) + ) + ) + (set! (-> self entity) s5-0) + ) + (when (-> self manipy) + (send-event + (ppointer->process (-> self manipy)) + 'trans-hook + (lambda :behavior manipy + () + (let ((v1-0 (ppointer->process (-> self parent)))) + (set! + (-> self root trans quad) + (-> (the-as target v1-0) racer bike-trans quad) + ) + (let ((a0-4 (-> (the-as target v1-0) racer bike-quat quad))) + (set! (-> self root quat vec quad) a0-4) + ) + (set! + (-> self root scale quad) + (-> (the-as target v1-0) racer bike-scale quad) + ) + (set! (-> self draw light-index) (the-as uint 255)) + (let ((a0-9 (-> (the-as target v1-0) draw color-mult quad))) + (set! (-> self draw color-mult quad) a0-9) + ) + (let ((a0-11 (-> (the-as target v1-0) draw color-emissive quad))) + (set! (-> self draw color-emissive quad) a0-11) + ) + (let ((f0-0 (-> (the-as target v1-0) draw secondary-interp))) + (set! (-> self draw secondary-interp) f0-0) + f0-0 + ) + ) + ) + ) + (send-event (ppointer->process (-> self manipy)) 'anim-mode 'loop) + (send-event + (ppointer->process (-> self manipy)) + 'art-joint-anim + "racer-get-on" + 0.0 + ) + (send-event + (ppointer->process (-> self manipy)) + 'eval + (lambda :behavior manipy + () + (set! (-> self clone-copy-trans) #f) + (let ((v1-1 (-> *target-shadow-control* settings shadow-dir quad))) + (set! (-> *racer-shadow-control* settings shadow-dir quad) v1-1) + ) + (set! (-> self draw shadow-ctrl) *racer-shadow-control*) + (let ((gp-0 (-> self parent))) + (set! + (-> (the-as target (-> gp-0 0)) racer front-blade) + (new 'process 'joint-mod (joint-mod-handler-mode rotate) self 4) + ) + (set! + (-> (the-as target (-> gp-0 0)) racer bottom-blade) + (new 'process 'joint-mod (joint-mod-handler-mode rotate) self 10) + ) + (let + ((v0-2 (new 'process 'joint-mod (joint-mod-handler-mode rotate) self 7)) + ) + (set! (-> (the-as target (-> gp-0 0)) racer tail) v0-2) + v0-2 + ) + ) + ) + ) + ) + (set-twist! + (-> self racer front-blade) + (the-as float #f) + (- (-> self racer front-rot)) + (the-as float #f) + ) + (set-twist! + (-> self racer bottom-blade) + (the-as float #f) + (the-as float #f) + (- (-> self racer bottom-rot)) + ) + (remove-exit) + (go target-racing-get-on arg0) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; definition for function target-racing-smack-check +;; INFO: Return type mismatch object vs none. +;; Used lq/sq +(defbehavior target-racing-smack-check target () + (if + (and + (< 20480.0 (-> self control unknown-float01)) + (and + (logtest? (-> self control status) 8) + (< (-> self control surface-angle) 0.5) + (let + ((gp-1 + (vector-! + (new 'stack-no-clear 'vector) + (-> self control unknown-vector70) + (-> self control trans) + ) + ) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> s5-0 quad) (-> self control unknown-vector10 quad)) + (set! (-> gp-1 y) 0.0) + (set! (-> s5-0 y) 0.0) + (vector-xz-normalize! gp-1 1.0) + (vector-xz-normalize! s5-0 1.0) + (< 0.87 (vector-dot gp-1 s5-0)) + ) + ) + ) + (go target-racing-smack (-> self control unknown-float01) #t) + ) + (none) + ) + +;; failed to figure out what this is: +(defstate target-racing (target) + :event + (-> target-racing-start event) + :enter + (behavior () + (set! (-> self control unknown-surface00) *racer-mods*) + (none) + ) + :exit + (behavior () + (target-racing-center-anim) + ((-> target-racing-start exit)) + (none) + ) + :trans + (behavior () + (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 l1 r1) + ) + (or + (< + (- (-> *display* base-frame-counter) (-> self control unknown-dword10)) + 30 + ) + (< + (vector-dot + (-> self control dynam gravity-normal) + (vector-! + (new 'stack-no-clear 'vector) + (-> self control trans) + (-> self control shadow-pos) + ) + ) + 4096.0 + ) + ) + ) + (go target-racing-jump 2048.0 5324.8 #t) + ) + (target-racing-smack-check) + (let* ((f30-0 (target-height-above-ground)) + (v1-28 + (time-to-ground + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + (-> self control dynam gravity-length) + f30-0 + ) + ) + ) + (if + (and + (zero? (logand (-> self control status) 1)) + (or + (>= + (- (-> *display* base-frame-counter) (-> self control unknown-dword10)) + (the-as int (* (-> *TARGET-bank* ground-timeout) 2)) + ) + (< 75 v1-28) + ) + (< 30 v1-28) + (< 4096.0 f30-0) + ) + (go target-racing-falling) + ) + ) + (set! (-> self racer turn-anim-targ) (* 20.0 (-> self racer mod-x))) + (racer-buzz (+ 0.45 (* 1.7 (fabs (-> self racer slide-shift-x))))) + (none) + ) + :code + (behavior () + (cond + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 138) + ) + (let ((a0-4 (-> self skel root-channel 0))) + (set! + (-> a0-4 param 0) + (the float (+ (-> a0-4 frame-group data 0 length) -1)) + ) + (set! (-> a0-4 param 1) 1.0) + (joint-control-channel-group! + a0-4 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + ) + ((let ((v1-16 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (or + (= v1-16 (-> self draw art-group data 130)) + (= v1-16 (-> self draw art-group data 131)) + ) + (> (-> self racer bounce) 0) + ) + ) + (let ((s5-0 #f) + (gp-0 #f) + ) + (when + (and + (< (fabs (-> self racer bob-mult-trans)) 0.2) + (and + (>= + (- + (-> *display* base-frame-counter) + (the-as int (-> self racer racing-time)) + ) + 45 + ) + (< 16384.0 (-> self control ground-impact-vel)) + ) + ) + (when (>= (-> self control unknown-float01) 40960.0) + (set! (-> *part-id-table* 2225 init-specs 1 initial-valuef) 100.0) + (sp-launch-particles-var + *sp-particle-system-2d* + (-> *part-id-table* 2225) + (-> self control trans) + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + (target-land-effect) + (when + (and + (>= (-> self control ground-impact-vel) 61440.0) + (zero? (-> self racer bounce)) + ) + (set! (-> self racer bounce) 0) + (set! (-> self racer bounce-hit) (-> self control ground-impact-vel)) + ) + (when (< (-> self racer bounce-hit) 73728.0) + (set! (-> self racer bounce) 0) + 0 + ) + (set! (-> self racer bob-timer) 90.0) + (let + ((f0-14 + (lerp-scale + 2.0 + 3.0 + (-> self control unknown-float01) + 0.0 + (-> self racer transv-max) + ) + ) + ) + (set! (-> self racer bob-meta-meta-timer) f0-14) + (set! (-> self racer bob-meta-timer) f0-14) + ) + (set! + (-> self racer bob-mult-trans) + (lerp-scale 0.2 2.5 (-> self control ground-impact-vel) 20480.0 81920.0) + ) + (set! + (-> self racer bob-hit-ground-time) + (the-as uint (-> *display* base-frame-counter)) + ) + (set! + (-> self racer bob-meta-time) + (the-as uint (-> *display* base-frame-counter)) + ) + (cond + ((or + s5-0 + (and (>= (-> self racer bounce) 1) (< (-> self racer bounce) 2)) + ) + (+! (-> self racer bounce) 1) + (let* ((v1-73 (-> self racer bounce)) + (a1-6 (cond + ((= v1-73 1) + (lerp-scale + 4096.0 + 8192.0 + (-> self racer bounce-hit) + 61440.0 + 81920.0 + ) + ) + ((= v1-73 2) + 2048.0 + ) + ) + ) + ) + (go target-racing-bounce a1-6 a1-6 gp-0) + ) + ) + ((>= (-> self racer slide-mode) 0) + ) + (else + (target-racing-land-anim gp-0) + ) + ) + ) + ) + ) + ) + (when (!= (-> self racer slide-shift-x) 0.0) + (if (rand-vu-percent? 0.5) + (sound-play-by-name + (static-sound-name "zoomer-rev1") + (new-sound-id) + 819 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + (sound-play-by-name + (static-sound-name "zoomer-rev2") + (new-sound-id) + 819 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + ) + ) + (set! (-> self racer bounce) 0) + (while #t + (let ((gp-3 (-> *display* base-frame-counter))) + (when (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 123) + ) + ) + (ja-channel-push! 4 30) + (let ((s5-3 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + s5-3 + (the-as art-joint-anim (-> self draw art-group data 123)) + num-func-identity + ) + (set! (-> s5-3 frame-num) (ja-aframe (-> self racer turn-anim-frame) 0)) + ) + (let ((a0-43 (-> self skel root-channel 1))) + (set! + (-> a0-43 frame-group) + (the-as art-joint-anim (-> self draw art-group data 124)) + ) + (set! (-> a0-43 param 0) 0.0) + (joint-control-channel-group-eval! + a0-43 + (the-as art-joint-anim (-> self draw art-group data 124)) + num-func-chan + ) + ) + (let ((a0-44 (-> self skel root-channel 2))) + (set! + (-> a0-44 frame-group) + (the-as art-joint-anim (-> self draw art-group data 125)) + ) + (set! (-> a0-44 param 0) 0.0) + (joint-control-channel-group-eval! + a0-44 + (the-as art-joint-anim (-> self draw art-group data 125)) + num-func-chan + ) + ) + (let ((a0-45 (-> self skel root-channel 3))) + (set! + (-> a0-45 frame-group) + (the-as art-joint-anim (-> self draw art-group data 126)) + ) + (set! (-> a0-45 param 0) 0.0) + (joint-control-channel-group-eval! + a0-45 + (the-as art-joint-anim (-> self draw art-group data 126)) + num-func-chan + ) + ) + ) + (while (< (- (-> *display* base-frame-counter) gp-3) 300) + (if + (or + (!= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (or + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons l1 r1 x) + ) + (>= (fabs (-> self racer turn-anim-frame)) 1.0) + ) + ) + (set! gp-3 (-> *display* base-frame-counter)) + ) + (target-racing-turn-anim) + (suspend) + ) + ) + (when (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 133) + ) + ) + (ja-channel-push! 1 120) + (let ((gp-4 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-4 + (the-as art-joint-anim (-> self draw art-group data 133)) + num-func-identity + ) + (set! (-> gp-4 frame-num) 0.0) + ) + ) + (while + (not + (or + (!= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (or + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons l1 r1 x) + ) + (>= (fabs (-> self racer turn-anim-frame)) 1.0) + ) + ) + ) + (suspend) + (let ((a0-54 (-> self skel root-channel 0))) + (set! (-> a0-54 param 0) 1.0) + (joint-control-channel-group-eval! + a0-54 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + ) + ) + (none) + ) + :post + (behavior () + (if (= (-> self next-state name) 'target-racing) + (set! + (-> self racer racing-time) + (the-as uint (-> *display* base-frame-counter)) + ) + ) + (target-racing-post) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate target-racing-jump (target) + :event + (-> target-racing-start event) + :enter + (behavior ((arg0 float) (arg1 float) (arg2 symbol)) + (set! (-> self racer shock-offsetv) 0.0) + (sound-play-by-name + (static-sound-name "zoomer-jump") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (when arg2 + (when (>= (-> self racer hill-ground-value) 0.11) + (set! + (-> self racer hill-boost) + (* 40960.0 (-> self racer hill-ground-value)) + ) + (vector-normalize! + (-> self control transv) + (+ (-> self control unknown-float01) (-> self racer hill-boost)) + ) + ) + ) + (if + (and + (logtest? (-> self control status) 1) + (< 16384.0 (-> self control transv y)) + ) + (set! (-> self racer hop?) #f) + (set! (-> self racer hop?) arg2) + ) + (set! (-> self racer hop-start-y) (-> self control trans y)) + (racer-calc-gravity) + (init-var-jump + arg0 + arg1 + (the-as vector #t) + (the-as vector #f) + (-> self control transv) + ) + (set! (-> self control status) (logand -8 (-> self control status))) + (set! (-> self control unknown-surface00) *racer-air-mods*) + (set! + (-> self control unknown-float123) + (fmax + 0.0 + (fmin 1.0 (* 0.00004359654 (+ -11468.8 (-> self control unknown-float01)))) + ) + ) + (if (< (-> self racer slide-mode) 0) + (set! + (-> self racer slide-down-time 0) + (the-as + uint + (if + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons l1 r1) + ) + (-> *display* base-frame-counter) + 0 + ) + ) + ) + ) + (none) + ) + :exit + (behavior () + (set! + (-> self control root-prim prim-core action) + (logand -32769 (-> self control root-prim prim-core action)) + ) + (set! (-> self racer hop?) #f) + ((-> target-racing-start exit)) + (none) + ) + :trans + (behavior () + (set! + (-> self control unknown-float123) + (fmax + (-> self control unknown-float123) + (* + 0.003921569 + (the + float + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + abutton + 6 + ) + ) + ) + ) + ) + (cond + ((logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons l1 r1) + ) + (set! + (-> self racer slide-down-time 0) + (the-as uint (-> *display* base-frame-counter)) + ) + ) + ((zero? + (logand + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons l1 r1) + ) + ) + (set! (-> self racer slide-down-time 0) (the-as uint 0)) + 0 + ) + ((and + (>= + (- + (-> *display* base-frame-counter) + (the-as int (-> self racer slide-down-time 0)) + ) + (the-as int (-> *RACER-bank* slide-hold-time)) + ) + (< (-> self racer slide-mode) 0) + (or + (< + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + leftx + ) + (the-as uint 64) + ) + (< + (the-as uint 192) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + leftx + ) + ) + ) + ) + (set! + (-> self racer slide-mode) + (if + (< + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + leftx + ) + (the-as uint 64) + ) + 0 + 1 + ) + ) + (set! + (-> self racer slide-enter-time) + (the-as uint (-> *display* base-frame-counter)) + ) + (set! (-> self racer slide-amp) 1.0) + (set! (-> self racer slide-grip-mult) 0.0) + ) + ((>= (-> self racer slide-mode) 0) + (cond + ((< + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + leftx + ) + (the-as uint 64) + ) + (set! (-> self racer slide-mode) 0) + 0 + ) + ((< + (the-as uint 192) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + leftx + ) + ) + (set! (-> self racer slide-mode) 1) + ) + ) + ) + ) + (if + (and + (logtest? (-> self control status) 1) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 30) + ) + (go target-racing) + ) + (if + (or + (< (-> self control trans y) (-> self racer hop-start-y)) + (< + 10240.0 + (vector-dot + (-> self control dynam gravity-normal) + (vector-! + (new 'stack-no-clear 'vector) + (-> self control trans) + (-> self control shadow-pos) + ) + ) + ) + ) + (set! (-> self racer hop?) #f) + ) + (target-racing-smack-check) + (if (>= (- (-> *display* base-frame-counter) (-> self state-time)) 300) + (logior! (-> self control root-prim prim-core action) #x8000) + ) + (mod-var-jump + #t + #t + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons l1 r1) + ) + (-> self control transv) + ) + (set! (-> self racer shock-offset) (* 0.8 (-> self racer shock-offset))) + (racer-buzz 0.4) + (none) + ) + :code + (behavior ((arg0 float) (arg1 float) (arg2 symbol)) + (let ((a0-1 (if (< 0.1 (-> self racer hill-value)) + 'jump + ) + ) + ) + (target-racing-jump-anim a0-1 60) + ) + (none) + ) + :post + (-> target-racing post) + ) + +;; failed to figure out what this is: +(defstate target-racing-bounce (target) + :event + (-> target-racing-start event) + :enter + (behavior ((arg0 float) (arg1 float) (arg2 symbol)) + (logior! (-> self control root-prim prim-core action) #x8000) + (sound-play-by-name + (static-sound-name "zoomer-jump") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (racer-calc-gravity) + (init-var-jump + arg0 + arg1 + (the-as vector #t) + (the-as vector #f) + (-> self control transv) + ) + (set! (-> self control status) (logand -8 (-> self control status))) + (set! + (-> self control unknown-float123) + (fmax + 0.0 + (fmin 1.0 (* 0.00004359654 (+ -11468.8 (-> self control unknown-float01)))) + ) + ) + (none) + ) + :exit + (behavior () + (set! + (-> self control root-prim prim-core action) + (logand -32769 (-> self control root-prim prim-core action)) + ) + ((-> target-racing-start exit)) + (none) + ) + :trans + (behavior () + (set! + (-> self control unknown-float123) + (fmax + (-> self control unknown-float123) + (* + 0.003921569 + (the + float + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + abutton + 6 + ) + ) + ) + ) + ) + (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 l1 r1) + ) + (or + (< + (- (-> *display* base-frame-counter) (-> self control unknown-dword10)) + 60 + ) + (< + (vector-dot + (-> self control dynam gravity-normal) + (vector-! + (new 'stack-no-clear 'vector) + (-> self control trans) + (-> self control shadow-pos) + ) + ) + 8192.0 + ) + ) + ) + (go target-racing-jump 2048.0 5324.8 #t) + ) + (if + (and + (logtest? (-> self control status) 1) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 30) + ) + (go target-racing) + ) + (mod-var-jump + #t + #t + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons l1 r1) + ) + (-> self control transv) + ) + (target-racing-smack-check) + (racer-buzz 0.4) + (none) + ) + :code + (behavior ((arg0 float) (arg1 float) (arg2 symbol)) + (target-racing-land-anim arg2) + (when (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 123) + ) + ) + (ja-channel-push! 4 30) + (let ((gp-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 123)) + num-func-identity + ) + (set! (-> gp-0 frame-num) (ja-aframe (-> self racer turn-anim-frame) 0)) + ) + (let ((a0-9 (-> self skel root-channel 1))) + (set! + (-> a0-9 frame-group) + (the-as art-joint-anim (-> self draw art-group data 124)) + ) + (set! (-> a0-9 param 0) 0.0) + (joint-control-channel-group-eval! + a0-9 + (the-as art-joint-anim (-> self draw art-group data 124)) + num-func-chan + ) + ) + (let ((a0-10 (-> self skel root-channel 2))) + (set! + (-> a0-10 frame-group) + (the-as art-joint-anim (-> self draw art-group data 125)) + ) + (set! (-> a0-10 param 0) 0.0) + (joint-control-channel-group-eval! + a0-10 + (the-as art-joint-anim (-> self draw art-group data 125)) + num-func-chan + ) + ) + (let ((a0-11 (-> self skel root-channel 3))) + (set! + (-> a0-11 frame-group) + (the-as art-joint-anim (-> self draw art-group data 126)) + ) + (set! (-> a0-11 param 0) 0.0) + (joint-control-channel-group-eval! + a0-11 + (the-as art-joint-anim (-> self draw art-group data 126)) + num-func-chan + ) + ) + ) + (while #t + (target-racing-turn-anim) + (suspend) + ) + (none) + ) + :post + (-> target-racing post) + ) + +;; failed to figure out what this is: +(defstate target-racing-smack (target) + :event + (-> target-racing-start event) + :enter + (behavior ((arg0 float) (arg1 symbol)) + (sound-play-by-name + (static-sound-name "smack-surface") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 150) + (set! (-> self racer heavy) arg1) + (vector-! + (-> self control transv) + (-> self control unknown-vector70) + (-> self control trans) + ) + (let ((f0-0 (lerp-scale 0.0 -61440.0 arg0 0.0 163840.0))) + (if + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons x) + ) + (set! f0-0 (* 2.0 f0-0)) + ) + (vector-normalize! (-> self control transv) f0-0) + ) + (set! (-> self racer boost-curve) 0.0) + (set! (-> self racer boost-level) 0.0) + (set! (-> self racer boost-target) 0.0) + (set! (-> self racer boost-output) 0.0) + (set! (-> self racer boost-time) (the-as uint 0)) + 0 + (none) + ) + :exit + (behavior () + (set! (-> self racer heavy) #f) + ((-> target-racing-start exit)) + (none) + ) + :trans + (behavior () + (set! (-> self racer turn-anim-targ) 0.0) + (none) + ) + :code + (behavior ((arg0 float) (arg1 symbol)) + (sound-play-by-name + (static-sound-name "zoomer-crash-2") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + (ja-channel-push! 2 15) + (let ((a0-4 (-> self skel root-channel 0))) + (set! + (-> a0-4 frame-group) + (the-as art-joint-anim (-> self draw art-group data 136)) + ) + (set! + (-> a0-4 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 136)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-4 param 1) 1.0) + (joint-control-channel-group! + a0-4 + (the-as art-joint-anim (-> self draw art-group data 136)) + num-func-seek! + ) + ) + (let ((s5-1 (-> self skel root-channel 1))) + (set! (-> s5-1 frame-interp) (lerp-scale 1.0 0.25 arg0 0.0 122880.0)) + (joint-control-channel-group-eval! + s5-1 + (the-as art-joint-anim (-> self draw art-group data 122)) + num-func-identity + ) + (set! (-> s5-1 frame-num) (ja-aframe 0.0 0)) + ) + (until (ja-done? 0) + (suspend) + (let ((s5-2 (-> self skel root-channel 0))) + (set! + (-> s5-2 param 0) + (the float (+ (-> s5-2 frame-group data 0 length) -1)) + ) + (set! (-> s5-2 param 1) (lerp-scale 2.0 1.0 arg0 0.0 163840.0)) + (joint-control-channel-group-eval! + s5-2 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (go target-racing) + (none) + ) + :post + (-> target-racing post) + ) + +;; failed to figure out what this is: +(defstate target-racing-falling (target) + :event + (-> target-racing-start event) + :enter + (behavior () + (set! (-> self control unknown-surface00) *racer-air-mods*) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (none) + ) + :exit + (behavior () + (set! + (-> self control root-prim prim-core action) + (logand -32769 (-> self control root-prim prim-core action)) + ) + ((-> target-racing-start exit)) + (none) + ) + :trans + (behavior () + (if (logtest? (-> self control status) 1) + (go target-racing) + ) + (target-racing-smack-check) + (racer-buzz 0.3) + (if (>= (- (-> *display* base-frame-counter) (-> self state-time)) 300) + (logior! (-> self control root-prim prim-core action) #x8000) + ) + (none) + ) + :code + (behavior () + (target-racing-jump-anim #f 30) + (none) + ) + :post + (-> target-racing post) + ) + +;; failed to figure out what this is: +(defstate target-racing-hit (target) + :event + (the-as + (function process int symbol event-message-block object :behavior target) + target-generic-event-handler + ) + :enter + (behavior ((arg0 handle) (arg1 attack-info)) + (let ((v1-0 (-> self attack-info))) + (set! (-> v1-0 attacker) arg0) + (set! (-> v1-0 mode) 'generic) + (set! (-> v1-0 shove-back) 6144.0) + (set! (-> v1-0 shove-up) 4915.2) + (set! (-> v1-0 angle) #f) + ) + (set! (-> self attack-info trans quad) (the-as uint128 0)) + (dummy-9 (-> self attack-info) arg1) + (case (-> self attack-info mode) + (('endlessfall 'death 'explode 'water-vol 'heat 'melt 'instant-death) + (pickup-collectable! + (-> self fact-info-target) + (pickup-type eco-green) + -1000.0 + (the-as handle #f) + ) + ) + (else + (pickup-collectable! + (-> self fact-info-target) + (pickup-type eco-green) + (- (-> *FACT-bank* health-single-inc)) + (the-as handle #f) + ) + ) + ) + (none) + ) + :exit + (behavior () + (if (!= (-> self next-state name) 'target-racing-death) + (set! (-> self state-flags) (logand -32777 (-> self state-flags))) + ) + ((-> target-racing-start exit)) + (none) + ) + :code + (behavior ((arg0 handle) (arg1 attack-info)) + (target-timed-invulnerable (-> *TARGET-bank* hit-invulnerable-timeout) self) + (when (!= (-> self attack-info mode) 'endlessfall) + (dummy-10 (-> self skel effect) 'group-target-hit -1.0 -1) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 90) + (sound-play-by-name + (static-sound-name "oof") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + ) + (set! (-> self game hit-time) (-> *display* base-frame-counter)) + (logior! (-> self state-flags) 8) + (set! (-> self racer boost-curve) 0.0) + (set! (-> self racer boost-level) 0.0) + (set! (-> self racer boost-target) 0.0) + (set! (-> self racer boost-output) 0.0) + (set! (-> self racer boost-time) (the-as uint 0)) + (if + (and + (= (-> self game mode) 'play) + (>= 0.0 (-> self fact-info-target health)) + ) + (go target-racing-death (-> self attack-info mode)) + ) + (case (-> self attack-info mode) + (('endlessfall) + ) + (('darkeco) + (let ((s5-1 (new 'stack-no-clear 'vector))) + (set! (-> s5-1 quad) (-> self control transv quad)) + (let + ((a2-3 + (vector-xz-normalize! + (vector-! + (new 'stack-no-clear 'vector) + (-> self control trans) + (-> self attack-info intersection) + ) + 1.0 + ) + ) + ) + (set! (-> a2-3 y) 0.0) + (let + ((gp-1 (vector-reflect-flat! (new 'stack-no-clear 'vector) s5-1 a2-3)) + (f30-0 (vector-xz-length s5-1)) + ) + (set! (-> gp-1 y) 0.0) + (vector-normalize! gp-1 1.0) + (vector-normalize-copy! (-> self control transv) gp-1 (* 2.0 f30-0)) + (let ((f28-0 (deg-diff (-> self racer rot y) (vector-y-angle gp-1)))) + (if (< 16384.0 (fabs f28-0)) + (set! + f28-0 + (deg-diff (-> self racer rot y) (+ 32768.0 (vector-y-angle gp-1))) + ) + ) + (set! + (-> self racer rotv y) + (* f28-0 (lerp-scale 4.0 7.0 f30-0 4096.0 (-> self racer transv-max))) + ) + ) + ) + ) + ) + ) + (else + (set! (-> self post-hook) target-racing-post) + (ja-channel-push! 1 15) + (let ((a0-24 (-> self skel root-channel 0))) + (set! + (-> a0-24 frame-group) + (the-as art-joint-anim (-> self draw art-group data 136)) + ) + (set! + (-> a0-24 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 136)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-24 param 1) 1.0) + (set! (-> a0-24 frame-num) 0.0) + (joint-control-channel-group! + a0-24 + (the-as art-joint-anim (-> self draw art-group data 136)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-25 (-> self skel root-channel 0))) + (set! + (-> a0-25 param 0) + (the float (+ (-> a0-25 frame-group data 0 length) -1)) + ) + (set! (-> a0-25 param 1) 1.0) + (joint-control-channel-group-eval! + a0-25 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ) + (go target-racing) + (none) + ) + :post + target-no-stick-post + ) + +;; failed to figure out what this is: +(defstate target-racing-death (target) + :event + (-> target-death event) + :exit + (behavior () + (set! (-> self state-flags) (logand -32769 (-> self state-flags))) + (send-event (ppointer->process (-> self manipy)) 'draw #t) + (send-event (ppointer->process (-> self manipy)) 'anim-mode 'clone-anim) + (target-timed-invulnerable-off self) + (set! + (-> self control pat-ignore-mask) + (new 'static 'pat-surface :skip #x1 :noentity #x1) + ) + (dummy-49 (-> self control)) + ((-> target-racing-start exit)) + (target-exit) + (set! (-> self racer stick-off) #f) + (none) + ) + :code + (behavior ((arg0 symbol)) + (local-vars (v1-154 symbol)) + (set! (-> self racer stick-off) #t) + (set! (-> self neck flex-blend) 0.0) + (target-timed-invulnerable-off self) + (logior! (-> self state-flags) #x8000) + (case (-> self attack-info mode) + (('explode 'darkeco 'heat 'death 'deadly 'balloonlurker) + ((-> target-racing-start exit)) + (send-event (ppointer->process (-> self manipy)) 'anim-mode 'loop) + (send-event (ppointer->process (-> self manipy)) 'draw #f) + (sound-play-by-name + (static-sound-name "zoomer-explode") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + (let ((gp-1 (get-process *default-dead-pool* part-tracker #x4000))) + (when gp-1 + (let ((t9-7 (method-of-type part-tracker activate))) + (t9-7 + (the-as part-tracker gp-1) + *entity-pool* + 'part-tracker + (the-as pointer #x70004000) + ) + ) + (run-now-in-process + gp-1 + part-tracker-init + (-> *part-group-id-table* 116) + -1 + #f + #f + #f + (-> self control trans) + ) + (-> gp-1 ppointer) + ) + ) + (send-event + (ppointer->process (-> self manipy)) + 'eval + (lambda :behavior racer () (let ((s5-0 (-> self parent-override)) + (gp-0 + (new 'stack 'joint-exploder-tuning 1) + ) + ) + (let* + ((f0-0 + (vector-length (-> s5-0 0 control transv)) + ) + (f30-0 (fmin 1.0 (* 0.000008138021 f0-0))) + ) + (set! (-> gp-0 duration) (the-as uint 1500)) + (set! + (-> gp-0 fountain-rand-transv-hi x) + (fmax 24576.0 f0-0) + ) + (set! + (-> gp-0 fountain-rand-transv-hi y) + (+ 81920.0 f0-0) + ) + (set! + (-> gp-0 fountain-rand-transv-hi z) + 20480.0 + ) + (set! + (-> gp-0 fountain-rand-transv-hi w) + 36864.0 + ) + (vector-negate! + (-> gp-0 fountain-rand-transv-lo) + (-> s5-0 0 control transv) + ) + (vector-normalize! + (-> gp-0 fountain-rand-transv-lo) + (* 12288.0 f30-0) + ) + ) + (vector+! + (-> gp-0 fountain-rand-transv-lo) + (-> gp-0 fountain-rand-transv-lo) + (-> s5-0 0 control trans) + ) + (let + ((s5-1 + (get-process + *default-dead-pool* + joint-exploder + #x4000 + ) + ) + ) + (when s5-1 + (let + ((t9-5 + (method-of-type joint-exploder activate) + ) + ) + (t9-5 + (the-as joint-exploder s5-1) + self + 'joint-exploder + (the-as pointer #x70004000) + ) + ) + (run-now-in-process + s5-1 + joint-exploder-init-by-other + *racer-explode-sg* + 24 + gp-0 + (new 'static 'joint-exploder-static-params + :joints + (new + 'static + 'boxed-array + :type joint-exploder-static-joint-params :length 16 :allocated-length 16 + (new 'static 'joint-exploder-static-joint-params + :joint-index 3 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 4 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 5 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 6 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 7 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 8 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 9 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 10 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 11 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 12 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 13 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 14 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 15 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 16 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 17 + :parent-joint-index -1 + ) + (new 'static 'joint-exploder-static-joint-params + :joint-index 18 + :parent-joint-index -1 + ) + ) + ) + ) + (-> s5-1 ppointer) + ) + ) + ) + ) + ) + (ja-channel-push! 1 30) + (fmax -182044.44 (fmin 182044.44 (* -40.0 (-> self racer rot z)))) + (case (-> self attack-info mode) + (('balloonlurker) + (dummy-13 + (-> self water) + 2.0 + (-> self control trans) + 1 + (-> self control transv) + ) + (let ((gp-2 (-> self skel root-channel 0))) + (set! + (-> gp-2 frame-group) + (the-as art-joint-anim (-> self draw art-group data 139)) + ) + (set! (-> gp-2 param 0) (ja-aframe 240.0 0)) + (set! (-> gp-2 param 1) 1.0) + (set! (-> gp-2 frame-num) 0.0) + (joint-control-channel-group! + gp-2 + (the-as art-joint-anim (-> self draw art-group data 139)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (set! (-> self racer stick-lock) #t) + (set! + (-> self control unknown-vector11 y) + (seek + (-> self control unknown-vector11 y) + 6144.0 + (* 12288.0 (-> *display* seconds-per-frame)) + ) + ) + (send-event *camera* 'joystick 0.0 1.0) + (suspend) + (let ((gp-3 (-> self skel root-channel 0))) + (set! (-> gp-3 param 0) (ja-aframe 240.0 0)) + (set! (-> gp-3 param 1) 1.0) + (joint-control-channel-group-eval! + gp-3 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (else + (let ((a0-30 (-> self skel root-channel 0))) + (set! + (-> a0-30 frame-group) + (the-as art-joint-anim (-> self draw art-group data 139)) + ) + (set! + (-> a0-30 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 139)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-30 param 1) 1.0) + (set! (-> a0-30 frame-num) 0.0) + (joint-control-channel-group! + a0-30 + (the-as art-joint-anim (-> self draw art-group data 139)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (set! (-> self racer stick-lock) #t) + (send-event *camera* 'joystick 0.0 1.0) + (set! + (-> self control unknown-vector11 y) + (seek + (-> self control unknown-vector11 y) + 6144.0 + (* 12288.0 (-> *display* seconds-per-frame)) + ) + ) + (if (>= (ja-aframe-num 0) 245.0) + (set-forward-vel (* 0.5 (-> self control unknown-float01))) + ) + (suspend) + (let ((a0-36 (-> self skel root-channel 0))) + (set! + (-> a0-36 param 0) + (the float (+ (-> a0-36 frame-group data 0 length) -1)) + ) + (set! (-> a0-36 param 1) 1.0) + (joint-control-channel-group-eval! + a0-36 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ) + ) + (('melt) + (sound-play-by-name + (static-sound-name "zoomer-melt") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + (let ((gp-5 (get-process *default-dead-pool* part-tracker #x4000))) + (when gp-5 + (let ((t9-29 (method-of-type part-tracker activate))) + (t9-29 + (the-as part-tracker gp-5) + *entity-pool* + 'part-tracker + (the-as pointer #x70004000) + ) + ) + (run-now-in-process + gp-5 + part-tracker-init + (-> *part-group-id-table* 32) + -1 + #f + #f + #f + (-> self control trans) + ) + (-> gp-5 ppointer) + ) + ) + (dummy-48 (-> self control)) + (set! (-> self post-hook) target-no-ja-move-post) + (ja-channel-set! 0) + (ja-post) + (let ((gp-6 (-> *display* base-frame-counter))) + (until (>= (- (-> *display* base-frame-counter) gp-6) 600) + (suspend) + ) + ) + ) + (('endlessfall) + (sound-play-by-name + (static-sound-name "death-fall") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + (camera-change-to (the-as string cam-endlessfall) 30 #f) + (set! (-> self control pat-ignore-mask unknown-bit) 1) + (let ((f30-0 (fmin -4096.0 (- (-> self control ground-impact-vel))))) + (let ((gp-8 (new-stack-vector0))) + (let + ((f0-28 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + gp-8 + (-> self control transv) + (vector-float*! gp-8 (-> self control dynam gravity-normal) f0-28) + ) + ) + (let* ((f0-29 (vector-length gp-8)) + (f1-9 f0-29) + (f2-2 f30-0) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f2-2 + ) + (vector-float*! gp-8 gp-8 (/ f0-29 f1-9)) + ) + ) + ) + (let ((gp-9 (-> *display* base-frame-counter))) + (until (>= (- (-> *display* base-frame-counter) gp-9) 225) + (vector-seek! + (-> self draw color-mult) + *zero-vector* + (* 1.5 (-> *display* seconds-per-frame)) + ) + (set-forward-vel (* 0.96 (-> self control unknown-float01))) + (let ((s5-3 (new-stack-vector0)) + (f28-0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + s5-3 + (-> self control transv) + (vector-float*! s5-3 (-> self control dynam gravity-normal) f28-0) + ) + (let* ((f0-38 (vector-length s5-3)) + (f1-12 f0-38) + ) + (if (< f30-0 f28-0) + (set! f28-0 f30-0) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f28-0 + ) + (vector-float*! s5-3 s5-3 (/ f0-38 f1-12)) + ) + ) + ) + (suspend) + ) + ) + ) + (camera-change-to (the-as string 'base) 0 #f) + ) + ) + (set! (-> self control transv quad) (the-as uint128 0)) + (set! (-> self control unknown-float01) 0.0) + (set! (-> self post-hook) target-no-stick-post) + (initialize! (-> self game) 'dead (the-as game-save #f) (the-as string #f)) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (until v1-154 + (suspend) + (set! + v1-154 + (and + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 300) + (zero? + (logand (-> *kernel-context* prevent-from-run) (process-mask movie)) + ) + ) + ) + ) + (go target-stance) + (none) + ) + :post + target-racing-post + ) + +;; failed to figure out what this is: +(defstate target-racing-get-on (target) + :event + (the-as + (function process int symbol event-message-block object :behavior target) + target-generic-event-handler + ) + :exit + (-> target-racing-start exit) + :code + (behavior ((arg0 handle)) + (set! (-> self control transv quad) (the-as uint128 0)) + (set! + (-> self alt-cam-pos quad) + (-> (&-> (-> self control) unknown-qword00) 0) + ) + (logior! (-> self state-flags) 1024) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (set! (-> gp-0 quad) (-> self control trans quad)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 quad) (-> self control trans quad)) + (quaternion-copy! + (-> self control unknown-quaternion02) + (-> self control quat) + ) + (quaternion-copy! + (-> self control unknown-quaternion03) + (-> self control unknown-quaternion00) + ) + (set! + (-> self control unknown-float120) + (-> self control unknown-vector11 y) + ) + (let* ((s3-0 (handle->process arg0)) + (s4-1 + (if + (and (nonzero? s3-0) (type-type? (-> s3-0 type) process-drawable)) + (the-as racer s3-0) + ) + ) + ) + (when s4-1 + (set! (-> s5-0 quad) (-> s4-1 root-override trans quad)) + (quaternion-copy! + (-> self control unknown-quaternion03) + (-> s4-1 root-override quat) + ) + (send-event s4-1 'trans (-> self racer bike-trans)) + (quaternion-copy! + (the-as quaternion (-> self racer bike-quat)) + (-> s4-1 root-override quat) + ) + (set! (-> self racer bike-scale quad) (-> s4-1 root-override scale quad)) + (set! + (-> self control unknown-int20) + (the-as int (-> self racer bike-trans y)) + ) + ) + ) + (set! (-> self control unknown-vector102 quad) (-> gp-0 quad)) + (set! (-> self control unknown-vector103 quad) (-> s5-0 quad)) + ) + ) + (let ((s5-1 #f) + (gp-1 #f) + ) + (ja-channel-push! 1 15) + (let ((s4-2 (-> self skel root-channel 0))) + (set! + (-> s4-2 frame-group) + (the-as art-joint-anim (-> self draw art-group data 138)) + ) + (set! (-> s4-2 param 0) (ja-aframe 77.0 0)) + (set! (-> s4-2 param 1) 1.0) + (set! (-> s4-2 frame-num) 0.0) + (joint-control-channel-group! + s4-2 + (the-as art-joint-anim (-> self draw art-group data 138)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (when + (and (not s5-1) (= (-> self skel root-channel 0) (-> self skel channel))) + (send-event (ppointer->process (-> self manipy)) 'anim-mode 'clone-anim) + (set! s5-1 #t) + ) + (set! (-> self control transv quad) (the-as uint128 0)) + (when (< 50.0 (ja-aframe-num 0)) + (when (not gp-1) + (sound-play-by-name + (static-sound-name "zoomer-start") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + (set! gp-1 #t) + ) + (set! (-> self racer front-rotv) 65536.0) + (set! + (-> self racer front-rot) + (the + float + (sar + (shl + (the + int + (+ + (-> self racer front-rot) + (* (-> self racer front-rotv) (-> *display* seconds-per-frame)) + ) + ) + 48 + ) + 48 + ) + ) + ) + (+! + (-> self racer bottom-rot) + (* 364088.88 (-> *display* seconds-per-frame)) + ) + (set-twist! + (-> self racer front-blade) + (the-as float #f) + (- (-> self racer front-rot)) + (the-as float #f) + ) + (set-twist! + (-> self racer bottom-blade) + (the-as float #f) + (the-as float #f) + (- (-> self racer bottom-rot)) + ) + ) + (suspend) + (let ((s4-4 (-> self skel root-channel 0))) + (set! (-> s4-4 param 0) (ja-aframe 77.0 0)) + (set! (-> s4-4 param 1) 1.0) + (joint-control-channel-group-eval! + s4-4 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (set! (-> self state-flags) (logand -1025 (-> self state-flags))) + (send-event *camera* 'set-slave-option #x6000) + (set! (-> self control transv quad) (the-as uint128 0)) + (quaternion-copy! + (-> self control quat) + (-> self control unknown-quaternion00) + ) + (rot->dir-targ! (-> self control)) + (set! (-> self racer rot y) (y-angle (-> self control))) + (when *target* + (when + (or + (= (-> *target* current-level name) 'lavatube) + (= (-> *target* current-level name) 'firecanyon) + (= (-> *target* current-level name) 'citadel) + ) + (let ((gp-3 (get-process *default-dead-pool* hud-bike-heat #x4000))) + (set! (-> *hud-parts* bike-heat) (the-as (pointer hud-bike-heat) (when gp-3 + (let + ((t9-23 + (method-of-type + hud-bike-heat + activate + ) + ) + ) + (t9-23 + (the-as + hud-bike-heat + gp-3 + ) + self + 'hud-bike-heat + (the-as + pointer + #x70004000 + ) + ) + ) + (run-now-in-process + gp-3 + hud-init-by-other + 0 + ) + (-> + gp-3 + ppointer + ) + ) + ) + ) + ) + (set! (-> *hud-parts* buzzers 0 next-y-offset) -120) + (set! (-> *hud-parts* buzzers 0 y-sgn) 0) + 0 + ) + (let ((gp-4 (get-process *default-dead-pool* hud-bike-speed #x4000))) + (set! (-> *hud-parts* bike-speed) (the-as (pointer hud-bike-speed) (when gp-4 + (let + ((t9-26 + (method-of-type + hud-bike-speed + activate + ) + ) + ) + (t9-26 + (the-as + hud-bike-speed + gp-4 + ) + self + 'hud-bike-speed + (the-as + pointer + #x70004000 + ) + ) + ) + (run-now-in-process + gp-4 + hud-init-by-other + 0 + ) + (-> + gp-4 + ppointer + ) + ) + ) + ) + ) + (set! (-> *hud-parts* power 0 next-y-offset) -120) + (set! (-> *hud-parts* power 0 y-sgn) 0) + 0 + ) + (go target-racing) + (none) + ) + :post + (behavior () + (let ((gp-0 (new 'stack-no-clear 'vector)) + (f30-0 + (fmin + 1.0 + (* + 0.0044444446 + (the + float + (- (-> *display* base-frame-counter) (-> self state-time)) + ) + ) + ) + ) + ) + (vector-lerp! + gp-0 + (-> self control unknown-vector102) + (-> self control unknown-vector103) + f30-0 + ) + (set! + (-> gp-0 y) + (lerp + (-> self control unknown-vector102 y) + (-> self control unknown-vector103 y) + (fmax + 0.0 + (fmin + 1.0 + (* + 0.0044444446 + (the + float + (+ (- -150 (-> self state-time)) (-> *display* base-frame-counter)) + ) + ) + ) + ) + ) + ) + (TODO-RENAME-30 (-> self control) gp-0) + (quaternion-slerp! + (-> self control unknown-quaternion00) + (-> self control unknown-quaternion02) + (-> self control unknown-quaternion03) + f30-0 + ) + ) + (let + ((f30-1 + (fmax + 0.0 + (fmin + 1.0 + (* + 0.010528533 + (+ + -279.99 + (the float (- (-> *display* base-frame-counter) (-> self state-time))) + ) + ) + ) + ) + ) + ) + (set! + (-> self control unknown-vector11 y) + (lerp + (-> self control unknown-float120) + (-> self racer cushion-base) + f30-1 + ) + ) + (set! + (-> self racer bike-trans y) + (lerp + (-> self control unknown-float121) + (+ 4096.0 (-> self control unknown-float121)) + f30-1 + ) + ) + ) + (hide-hud-quick) + (target-no-move-post) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate target-racing-get-off (target) + :event + (the-as + (function process int symbol event-message-block object :behavior target) + target-generic-event-handler + ) + :exit + (-> target-racing-start exit) + :code + (behavior ((arg0 handle)) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control unknown-surface00) *racer-mods*) + (let ((a0-2 (-> *hud-parts* bike-speed))) + (if a0-2 + (set! (-> a0-2 0 deactivate-when-hidden) #t) + ) + ) + (let ((a0-4 (-> *hud-parts* bike-heat))) + (if a0-4 + (set! (-> a0-4 0 deactivate-when-hidden) #t) + ) + ) + (when (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 123) + ) + ) + (ja-channel-push! 4 30) + (let ((s5-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + s5-0 + (the-as art-joint-anim (-> self draw art-group data 123)) + num-func-identity + ) + (set! (-> s5-0 frame-num) (ja-aframe (-> self racer turn-anim-frame) 0)) + ) + (let ((a0-13 (-> self skel root-channel 1))) + (set! + (-> a0-13 frame-group) + (the-as art-joint-anim (-> self draw art-group data 124)) + ) + (set! (-> a0-13 param 0) 0.0) + (joint-control-channel-group-eval! + a0-13 + (the-as art-joint-anim (-> self draw art-group data 124)) + num-func-chan + ) + ) + (let ((a0-14 (-> self skel root-channel 2))) + (set! + (-> a0-14 frame-group) + (the-as art-joint-anim (-> self draw art-group data 125)) + ) + (set! (-> a0-14 param 0) 0.0) + (joint-control-channel-group-eval! + a0-14 + (the-as art-joint-anim (-> self draw art-group data 125)) + num-func-chan + ) + ) + (let ((a0-15 (-> self skel root-channel 3))) + (set! + (-> a0-15 frame-group) + (the-as art-joint-anim (-> self draw art-group data 126)) + ) + (set! (-> a0-15 param 0) 0.0) + (joint-control-channel-group-eval! + a0-15 + (the-as art-joint-anim (-> self draw art-group data 126)) + num-func-chan + ) + ) + ) + (let ((s5-1 (-> *display* base-frame-counter))) + (until (>= (- (-> *display* base-frame-counter) s5-1) 150) + (set! (-> self racer stick-lock) #t) + (set-forward-vel (* 0.9 (-> self control unknown-float01))) + (set! (-> self racer turn-anim-targ) 0.0) + (set! (-> self racer turn-anim-targ) 0.0) + (target-racing-turn-anim) + (set! + (-> self control unknown-vector11 y) + (seek + (-> self control unknown-vector11 y) + 6144.0 + (* 3.0 (-> *display* seconds-per-frame)) + ) + ) + (suspend) + ) + ) + (go target-racing-get-off-jump arg0) + (none) + ) + :post + target-racing-post + ) + +;; failed to figure out what this is: +(defstate target-racing-get-off-jump (target) + :event + (the-as + (function process int symbol event-message-block object :behavior target) + target-generic-event-handler + ) + :exit + (-> target-racing-start exit) + :code + (behavior ((arg0 handle)) + (sound-play-by-name + (static-sound-name "zoomer-stop") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control transv quad) (the-as uint128 0)) + (let ((gp-1 (new 'stack-no-clear 'vector))) + (set! (-> gp-1 quad) (-> self control trans quad)) + (let ((s4-1 (new 'stack-no-clear 'vector))) + (set! (-> s4-1 quad) (-> self control trans quad)) + (quaternion-copy! + (-> self control unknown-quaternion02) + (-> self control quat) + ) + (quaternion-copy! + (-> self control unknown-quaternion03) + (-> self control unknown-quaternion00) + ) + (set! + (-> self control unknown-float120) + (-> self control unknown-vector11 y) + ) + (let* ((s2-0 (handle->process arg0)) + (s3-0 + (if + (and (nonzero? s2-0) (type-type? (-> s2-0 type) process-drawable)) + (the-as racer s2-0) + ) + ) + ) + (when s3-0 + (set! (-> s4-1 quad) (-> s3-0 root-override trans quad)) + (set-yaw-angle-clear-roll-pitch! + (-> s3-0 root-override) + (quaternion-y-angle (-> self control quat)) + ) + (quaternion-copy! + (-> self control unknown-quaternion03) + (-> s3-0 root-override quat) + ) + (send-event s3-0 'trans (-> self racer bike-trans)) + (quaternion-copy! + (the-as quaternion (-> self racer bike-quat)) + (-> s3-0 root-override quat) + ) + (set! (-> self racer bike-scale quad) (-> s3-0 root-override scale quad)) + (set! + (-> self control unknown-int20) + (the-as int (-> self racer bike-trans y)) + ) + ) + ) + (set! (-> self control unknown-vector102 quad) (-> gp-1 quad)) + (set! (-> self control unknown-vector103 quad) (-> s4-1 quad)) + ) + (ja-channel-push! 1 15) + (let ((a0-24 (-> self skel root-channel 0))) + (set! + (-> a0-24 frame-group) + (the-as art-joint-anim (-> self draw art-group data 137)) + ) + (set! + (-> a0-24 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 137)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-24 param 1) 1.0) + (set! (-> a0-24 frame-num) 0.0) + (joint-control-channel-group! + a0-24 + (the-as art-joint-anim (-> self draw art-group data 137)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-25 (-> self skel root-channel 0))) + (set! + (-> a0-25 param 0) + (the float (+ (-> a0-25 frame-group data 0 length) -1)) + ) + (set! (-> a0-25 param 1) 1.0) + (joint-control-channel-group-eval! + a0-25 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (send-event (handle->process arg0) 'draw) + (set-yaw-angle-clear-roll-pitch! + (-> self control) + (quaternion-y-angle (-> self control unknown-quaternion03)) + ) + (rot->dir-targ! (-> self control)) + (ja-post) + (vector<-cspace! gp-1 (-> self node-list data 3)) + (set! (-> gp-1 y) (+ -5896.192 (-> gp-1 y))) + (TODO-RENAME-30 (-> self control) gp-1) + ) + (send-event *camera* 'ease-in) + (ja-channel-set! 0) + (go target-racing-get-off-hit-ground #f) + (none) + ) + :post + (behavior () + (let* + ((f0-2 + (deg-diff (-> self racer front-rot) (-> *RACER-bank* default-front-blade)) + ) + (f0-5 (if (< 0.0 f0-2) + (fmax 5461.3335 (* 4.0 f0-2)) + 54613.332 + ) + ) + ) + (set! + (-> self racer front-rotv) + (seek + (-> self racer front-rotv) + f0-5 + (* 54613.332 (-> *display* seconds-per-frame)) + ) + ) + ) + (set! + (-> self racer front-rot) + (the + float + (sar + (shl + (the + int + (+ + (-> self racer front-rot) + (* (-> self racer front-rotv) (-> *display* seconds-per-frame)) + ) + ) + 48 + ) + 48 + ) + ) + ) + (when + (and + (< + (fabs + (deg-diff + (-> *RACER-bank* default-front-blade) + (-> self racer front-rot) + ) + ) + 1820.4445 + ) + (= (-> self racer front-rotv) 5461.3335) + ) + (set! (-> self racer front-rotv) 0.0) + (set! (-> self racer front-rot) (-> *RACER-bank* default-front-blade)) + ) + (+! + (-> self racer bottom-rot) + (* 364088.88 (-> *display* seconds-per-frame)) + ) + (set-twist! + (-> self racer front-blade) + (the-as float #f) + (- (-> self racer front-rot)) + (the-as float #f) + ) + (set-twist! + (-> self racer bottom-blade) + (the-as float #f) + (the-as float #f) + (- (-> self racer bottom-rot)) + ) + (let ((gp-0 (new 'stack-no-clear 'vector)) + (f30-0 + (fmax + 0.0 + (fmin + 1.0 + (* + 0.004761905 + (+ + -150.0 + (the + float + (- (-> *display* base-frame-counter) (-> self state-time)) + ) + ) + ) + ) + ) + ) + ) + (fmax + 0.0 + (fmin + 1.0 + (* + 0.006666667 + (+ + -225.0 + (the float (- (-> *display* base-frame-counter) (-> self state-time))) + ) + ) + ) + ) + (vector-lerp! + gp-0 + (-> self control unknown-vector102) + (-> self control unknown-vector103) + f30-0 + ) + (set! + (-> gp-0 y) + (lerp + (-> self control unknown-vector102 y) + (-> self control unknown-vector103 y) + (fmax + 0.0 + (fmin + 1.0 + (* + 0.0044444446 + (the + float + (+ (- -150 (-> self state-time)) (-> *display* base-frame-counter)) + ) + ) + ) + ) + ) + ) + (TODO-RENAME-30 (-> self control) gp-0) + (quaternion-slerp! + (-> self control unknown-quaternion00) + (-> self control unknown-quaternion02) + (-> self control unknown-quaternion03) + f30-0 + ) + (set! + (-> self control unknown-vector11 y) + (lerp (-> self control unknown-float120) 6144.0 (fmin 1.0 (* 2.0 f30-0))) + ) + ) + (vector+! + (-> self racer bike-trans) + (-> self control trans) + (-> self control unknown-vector12) + ) + (quaternion-copy! + (the-as quaternion (-> self racer bike-quat)) + (-> self control quat) + ) + (set! (-> self racer bike-scale quad) (-> self control scale quad)) + (hide-hud) + (target-no-move-post) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate target-racing-get-off-hit-ground (target) + :event + (the-as + (function process int symbol event-message-block object :behavior target) + target-standard-event-handler + ) + :enter + (-> target-hit-ground enter) + :trans + (behavior () + (logior! (-> self control status) 7) + ((-> target-hit-ground trans)) + (none) + ) + :code + (behavior ((arg0 symbol)) + (ja-channel-set! 1) + (let ((gp-0 (-> self skel root-channel 0))) + (set! + (-> gp-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 35)) + ) + (set! + (-> gp-0 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 35)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> gp-0 param 1) 1.0) + (set! (-> gp-0 frame-num) (ja-aframe 42.0 0)) + (joint-control-channel-group! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 35)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-4 (-> self skel root-channel 0))) + (set! + (-> a0-4 param 0) + (the float (+ (-> a0-4 frame-group data 0 length) -1)) + ) + (set! (-> a0-4 param 1) 1.0) + (joint-control-channel-group-eval! + a0-4 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (go target-stance) + (none) + ) + :post + (behavior () + (hide-hud) + (target-post) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate target-racing-grab (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (cond + ((and (= arg2 'query) (= (-> arg3 param 0) 'mode)) + (-> self state name) + ) + (else + (case arg2 + (('end-mode) + (go target-racing) + ) + (('clone-anim) + (go + target-racing-clone-anim + (process->handle (the-as process (-> arg3 param 0))) + ) + ) + (else + (target-generic-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + ) + :enter + (behavior () + (set! (-> self control unknown-surface00) *grab-mods*) + (set! (-> self neck flex-blend) 0.0) + (logior! (-> self state-flags) 272) + (set! (-> self racer stick-off) #t) + (none) + ) + :exit + (behavior () + (set! (-> self racer stick-off) #f) + (set! (-> self state-flags) (logand -273 (-> self state-flags))) + (set! (-> self water flags) (logand -65537 (-> self water flags))) + ((-> target-racing-start exit)) + (none) + ) + :code + (behavior () + (when (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 123) + ) + ) + (ja-channel-push! 4 30) + (let ((gp-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 123)) + num-func-identity + ) + (set! (-> gp-0 frame-num) (ja-aframe (-> self racer turn-anim-frame) 0)) + ) + (let ((a0-7 (-> self skel root-channel 1))) + (set! + (-> a0-7 frame-group) + (the-as art-joint-anim (-> self draw art-group data 124)) + ) + (set! (-> a0-7 param 0) 0.0) + (joint-control-channel-group-eval! + a0-7 + (the-as art-joint-anim (-> self draw art-group data 124)) + num-func-chan + ) + ) + (let ((a0-8 (-> self skel root-channel 2))) + (set! + (-> a0-8 frame-group) + (the-as art-joint-anim (-> self draw art-group data 125)) + ) + (set! (-> a0-8 param 0) 0.0) + (joint-control-channel-group-eval! + a0-8 + (the-as art-joint-anim (-> self draw art-group data 125)) + num-func-chan + ) + ) + (let ((a0-9 (-> self skel root-channel 3))) + (set! + (-> a0-9 frame-group) + (the-as art-joint-anim (-> self draw art-group data 126)) + ) + (set! (-> a0-9 param 0) 0.0) + (joint-control-channel-group-eval! + a0-9 + (the-as art-joint-anim (-> self draw art-group data 126)) + num-func-chan + ) + ) + ) + (while #t + (target-racing-turn-anim) + (set-forward-vel 0.0) + (suspend) + ) + (none) + ) + :post + target-racing-post + ) + +;; failed to figure out what this is: +(defstate target-racing-clone-anim (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (if (and (= arg2 'trans) (= (-> arg3 param 0) 'restore)) + (set! (-> self control unknown-float120) (the-as float #f)) + ) + ((-> target-racing-grab event) arg0 arg1 arg2 arg3) + ) + :enter + (-> target-clone-anim enter) + :exit + (behavior () + (set! + (-> self control unknown-vector11 y) + (-> self control unknown-float120) + ) + (set! + (-> self control unknown-vector12 y) + (-> self control unknown-vector11 y) + ) + (send-event (ppointer->process (-> self sidekick)) 'matrix #f) + ((-> target-clone-anim exit)) + ((-> target-racing-start exit)) + (vector-reset! (-> self control transv)) + (none) + ) + :code + (behavior ((arg0 handle)) + (set! + (-> self control unknown-float120) + (-> self control unknown-vector11 y) + ) + (set! (-> self control unknown-vector11 y) 0.0) + (send-event (ppointer->process (-> self sidekick)) 'matrix 'play-anim) + (clone-anim arg0 33 #t "") + (go target-racing) + (none) + ) + :post + (behavior () + (racer-sounds) + (set! + (-> self racer heat) + (seek + (-> self racer heat) + 0.0 + (* (-> *RACER-bank* surface-heat-inc) (-> *display* seconds-per-frame)) + ) + ) + (vector+! + (-> self racer bike-trans) + (-> self control trans) + (-> self control unknown-vector12) + ) + (quaternion-copy! + (the-as quaternion (-> self racer bike-quat)) + (-> self control quat) + ) + (set! (-> self racer bike-scale quad) (-> self control scale quad)) + (target-no-ja-move-post) + (none) + ) + ) diff --git a/test/decompiler/reference/levels/racer_common/target-racer-h-FIC-LAV-MIS-OGR-ROL_REF.gc b/test/decompiler/reference/levels/racer_common/target-racer-h-FIC-LAV-MIS-OGR-ROL_REF.gc index 6f020bf2e4..8426033ac3 100644 --- a/test/decompiler/reference/levels/racer_common/target-racer-h-FIC-LAV-MIS-OGR-ROL_REF.gc +++ b/test/decompiler/reference/levels/racer_common/target-racer-h-FIC-LAV-MIS-OGR-ROL_REF.gc @@ -3,7 +3,7 @@ ;; definition of type racer-info (deftype racer-info (basic) - ((entity basic :offset-assert 4) + ((entity entity-actor :offset-assert 4) (bike-trans vector :inline :offset-assert 16) (bike-quat vector :inline :offset-assert 32) (bike-scale vector :inline :offset-assert 48) @@ -44,14 +44,14 @@ (targ-rotx degrees :offset-assert 332) (speed-rotx float :offset-assert 336) (mult-rotx degrees :offset-assert 340) - (front-blade basic :offset-assert 344) + (front-blade joint-mod :offset-assert 344) (front-rot degrees :offset-assert 348) (front-rotv degrees :offset-assert 352) - (bottom-blade basic :offset-assert 356) + (bottom-blade joint-mod :offset-assert 356) (bottom-rot degrees :offset-assert 360) - (front basic :offset-assert 364) + (front joint-mod :offset-assert 364) (front-turn degrees :offset-assert 368) - (tail basic :offset-assert 372) + (tail joint-mod :offset-assert 372) (tail-tilt degrees :offset-assert 376) (transv-max meters :offset-assert 380) (slide-down-time uint64 2 :offset-assert 384) @@ -68,7 +68,7 @@ (boost-level float :offset-assert 452) (boost-target float :offset-assert 456) (boost-output float :offset-assert 460) - (hop? basic :offset-assert 464) + (hop? symbol :offset-assert 464) (hop-start-y float :offset-assert 468) (bounce int32 :offset-assert 472) (bounce-hit float :offset-assert 476) @@ -83,10 +83,10 @@ (rudd-anim-vel float :offset-assert 512) (rudd-anim-frame float :offset-assert 516) (racing-time uint64 :offset-assert 520) - (stick-lock basic :offset-assert 528) - (stick-off basic :offset-assert 532) - (heavy basic :offset-assert 536) - (unstuck-time uint64 :offset-assert 544) + (stick-lock symbol :offset-assert 528) + (stick-off symbol :offset-assert 532) + (heavy symbol :offset-assert 536) + (unstuck-time int64 :offset-assert 544) (stuck-count int32 :offset-assert 552) (scrape-sound-id sound-id :offset-assert 556) (heat-sound-time uint64 :offset-assert 560) diff --git a/test/decompiler/test_gkernel_decomp.cpp b/test/decompiler/test_gkernel_decomp.cpp index daabad593a..ddb1ba9d55 100644 --- a/test/decompiler/test_gkernel_decomp.cpp +++ b/test/decompiler/test_gkernel_decomp.cpp @@ -936,7 +936,7 @@ TEST_F(FormRegressionTest, ExprMethod0DeadPool) { " (v1-5 ((method-of-type process new) arg0 process 'dead arg3))\n" " )\n" " (set! (-> s3-0 child) (process->ppointer v1-5))\n" - " (set! (-> v1-5 parent) (process->ppointer s3-0))\n" + " (set! (-> v1-5 parent) (process->ppointer (the-as process s3-0)))\n" " (set! (-> v1-5 pool) s3-0)\n" " (set! (-> v1-5 brother) s1-0)\n" " )\n"